Transcript Slide 1

MotoHawking with Others
Techniques to Make Large Scale Development Easier
Eric Bradley
Senior Program Engineer
MotoTron Corporation
MotoHawking with Others
Large Scale Development Challenges
–
–
–
–
Documenting Your Application
Creating Reusable Code
Integrating Work from Multiple Developers, Protecting IP
Model Architectures to Support Testing
Annotations
Creating Your Title Block
Select a title block in your model
Title blocks used for datasheet generation
Use set_param to adjust copyright, address, and image
• See MotoHawk Annotations\annotate\Libraries
• mh_set_copyright.m
• mh_set_address.m
• mh_set_image.m
Usage: mh_set_image(gcb,'MUG logo horizontal.jpg')
MotoHawk Users Group
PROPRIETARY
AND CONFIDENTIAL
THE INFORMATION CONTAINED IN THIS
DRAWING IS EXPRESSLY FOR USE
AS A TEACHING TOOL. USE IS
GRANTED FOR USE IN ANY MOTOHAWK MODEL.
COPYRIGHT  2007
4831 N Warren Drive,
Columbus, IN 47203
Description:
untitled
Path: untitled
REV: 000
Annotations
Placing Images in Your Model
Application Documenting with Images
THE INFORMATION CONTAINED IN THIS
DRAWING IS EXPRESSLY FOR USE
AS A TEACHING TOOL. USE IS
GRANTED FOR USE IN ANY MOTOHAWK MODEL.
COPYRIGHT
2007

•
MotoHawk Users Group
PROPRIETARY
AND CONFIDENTIAL
4831 N Warren Drive,
Columbus, IN 47203
Description:
annotate
Top-level root of model: annotate.mdl
Path: annotate
•
REV: 000
•
OS
MotoHawk Users Group
PROPRIETARY
AND CONFIDENTIAL
THE INFORMATION CONTAINED IN THIS
DRAWING IS EXPRESSLY FOR USE
AS A TEACHING TOOL. USE IS
GRANTED FOR USE IN ANY MOTOHAWK MODEL.
COPYRIGHT
2007

4831 N Warren Drive,
Columbus, IN 47203
Description:
annotate
Overview
Path: annotate|Overview
•
REV: 000
Let images tell the
story
Introduce the
contextual overview
Show the I/O block
diagram
Haul the
documentation in
the model
MotoHawk Users Group
PROPRIETARY
AND CONFIDENTIAL
THE INFORMATION CONTAINED IN THIS
DRAWING IS EXPRESSLY FOR USE
AS A TEACHING TOOL. USE IS
GRANTED FOR USE IN ANY MOTOHAWK MODEL.
COPYRIGHT
2007

4831 N Warren Drive,
Columbus, IN 47203
Description:
annotate
Control Application
Overview
Path: annotate|Overview |Control Application
Autonomous Test Vehicle
MotoHawk Function Trigger
FGND_RTI_PERIODIC
Priority Order: 0
MotoHawk Function Trigger
ONE_SECOND_EVENT
Priority Order: 0
Demonstrate automatic Guidance Algorithhms
5 ms
Foreground
Control Application
Beacon
To Do:
 Actually Write some Algorithms
REV: 000
Annotations
Add some notes
Annotations
Book Keep Your References
– Record reference information as you build the application
– Place copies of reference files in your project directory or reference web url
– Use helper function: motohawk_gen_datasheet
Summary list of references included at end of data sheet
Ref erence:
Version:
SAE International - Vehicle Application Layer - J1939-71
file://./CAN/J1939/sae j 1939-71.pdf
Revision Dec 2003
Section:
PGN 61444 - Electronic Engine Controller 1 - EEC1
Test Specif ication:
Test Spec
Test Section:
4.1.2
Reusable Code
•
•
•
•
Creating reusable code is critical to productivity
High reuse promotes confidence in operation
High reuse promotes consistency in calibration interface
Simulink’s library mechanism plus some mask editing is a powerful
concept
– But, there are some issues to be concerned about
• The MotoHawk blockset is distributed as a Simulink library
• Important skills
–
–
–
–
Creating library files and understanding their rules
Manipulating library files
Creating masks
Putting your library on the Simulink browser with slblocks.m
Creating a Library
• From Simulink, File->New->Library
• Use xxx_lib.mdl as filename to distinguish from normal model file
• By tradition we set background color of libraries to be different to
further remind us of the different rules
Creating a Library
• Build block in main model and refine prior to placing in library
• If a block needs to be edited, disable link in main model, edit, then
restore link an update library. This will make sure the block’s diagram
is checked and fully updated
• If a block needs calibrations or probes, mask the block and add a
prefix parameter so that the cals and probes can build a unique name
• Steps
–
–
–
–
Choose block(s), Right Click->Create Subsystem
Right Click->Mask Subsystem
Edit mask to make it look nice and add parameters
Cut block from model and place in library
– SAVE library
Creating a Library
Create the essence of the block
Creating a Library
Create and mask subsystem
Creating a Library
•Make it Pretty
•Add a Prefix Parameter for the Probe
Creating a Library
•
Put the block in the library and SAVE
•
Do not allow a “*” to persist
•
Replace block in the original model with the library block
Please Save
the File!!
Notice Link is
Displayed (if
Enabled)
Creating a Library
• If you need to edit the library, disable link in model and modify, then
restore the link to push the changes to the library
• SAVE the library
Notice Arrow
is Gray
Push
Changes to
Library
Creating a Library
•
•
Add the library to the Simulink browser with slblocks.m
Change lines 57, 78, 79, 80 (IsFlat = 1 if no hierarchy)
Libraries Wrap-up
Good
– Reusable widgets that are used often should be in libraries
– Some companies create “Approved” blocksets and validate blocks
– Developers often create “Pre-configure” blocks for built-in Simulink blocks
with colors and settings preset (see Libraries\MotoTron\Standard Blocks)
– Libraries simulate well
Challenging
– Distributing models with all of its libraries to others (keep copies in your
“Libraries” subdirectory for the project
– Unless designed not to, the block can still adjust data types and widths
causing the block to misbehave
– Layered libraries are difficult to update
Multi Developer Features of MotoHawk
Multiple developers of a single model is a harsh workflow
– A mechanism to subdivide the model is needed
– Libraries are usable but cannot be locked down tight
• Hiding IP is not possible
• Versioning is challenging
Large Models bring MATLAB to its knees
– Greater than 20,000 blocks cause update and build times to stretch
MotoHawk provides a Component Mechanism
– Partial Builds
– Hard versioning
– Encryption and IP Hiding
MotoHawk Components
•
•
Choose “Component (PPC)” in target definition
New trigger “Inherited” available
MotoHawk Components
•
•
•
Import and outport blocks create interfaces
Datatype, default value and an optional vardec
can be attached
Unfortunately, busses will not work
MotoHawk Components
All MotoHawk blocks work in components
– Be careful about availability
• Data definitions outside of a component are not visible inside
• Faults defined outside are not visible inside
• I/O is legal inside a component but probably should be kept outside
Building a component creates a .mhc file
– Single file distribution
– Optional DLOCK2
encryption
Using Components
Component instance block
•
•
Unpacks .mhc file into /Components subdirectory
Provides interface as defined by inports and outports
Components Wrap-up
Good
–
–
–
–
–
–
IP hiding
Makes dealing with large models easy
Allows incremental builds
Hard versioning makes sub-validation possible
Layered components are easy
Promotes good interfaces (no sneaking global data)
Challenging
– Components do not simulate (currently)
– Busses not possible
– Data store availability
– Only single instances allowed
Model Architecture for Testability
•
•
•
•
•
Separate I/O from algorithm
Put controller into library (or component)
Create a code generation model (motohawk_project)
Create separate model(s) for test purposes
Use controller from library/component for all tests
Typical MotoTron Architecture
Element
Simulation
In the Loop
Hardware in
the Loop
Code
Generation
Operator
Driver
Simulation and
Maneuvers
Driver
Simulation and
Maneuvers
Interface to
Driver (Throttle
Pedal, Dash,
PRNDL, etc.)
Controller
Controller
Algorithms
Interface to
Module Stimulus
and
Measurement
Devices
Controller
Algorithms
Plant
Plant Model
Plant Model
Interface to
Plant (Fuel
Injectors, Shift
Solenoids,
Speed Sensors,
etc.)
Environ.
Environmental
Model
Environmental
Model
Empty
double
Operator
double
double
Controller
double
double
Plant
double
Environment
MotoTron Corporation
End slide
734-822-7700
[email protected]
www.mototron.com
www.smartcraftnetworked.com
THANK YOU FOR YOUR ATTENTION!