model management tools and technologies · model management tools and technologies michael tiller...
TRANSCRIPT
Model ManagementTools and Technologies
Michael TillerPowertrain Research Department
Ford Motor Company
Overview
Development ToolsVersion ControlWeb-based Tools
Modelica – Open StandardRepresenting behaviorTranslationModelica-based applications
Tools
Choosing Tools
Tools are like houses:They need a solid foundation to build onYou can always add a coat of paint later
Key Principles (for us)CheapTools and technologies should be
Open – Non-proprietary and well-documentedProven – Scales for real-world applicationsMature – Relatively bug-free
Treat model development like software development
Leverage tools/libraries as appropriate“Redundancy is the root of all evil”
Tools – Version Control
Version Control RequirementsArchive previous versionsArchive developer comments on changesAllow branching for parallel developmentAllow merging for coherent code baseAbility to “diff” changesTag (or label) releasesRetrieve versions by tag, branch or dateCross-platformKeyword substitutionBinary file support
Version Control ToolsClearCase – used extensively
Excellent featuresExpensiveHigh maintenance
CVS – used extensivelyGood features (missing a few nice ones)FreeFairly simple to install and maintain
Perforce – never usedGood compromise
CVS User InterfacesCommand lineAncillary Tools
TkDiff, CSDiff – Diffing and mergingSeveral GUIs
WinCVS – primary user interfaceTkCVS – Works on Windows/UnixCVSWeb – Web based access
Good example of an open system
Typical UsageCreate a branch for either a bug fix or enhancement
We use eTrackerBug fix branch names use eTracker Ids
Work in parallelClearly identifies all changesAvoid “stepping on toes”
Merge changes
WinCVS
Create branches and tagsView local changes and/or conflictsView “version tree” for a given fileReview check-in comments“Sandbox” approachhttp://www.wincvs.org/
Tools - Utilizing the Intranet
CVS WebOverview of the filesystemDownload specific versions of filesView differences between files
http://www.freebsd.org/projects/cvsweb.html
Wiki – Collaborative ToolCollaborative environment
FAQs, user and developer informationTechnical discussions
Web-basedSearchableActive server-side scriptingCustomizableFreeChange tracking, version control and diff-inghttp://twiki.org/
Wiki Screen Shots
CORBAUsed to allow programs to communicate and interact over networksOpen standardCross-platformSupports every major languageHave not needed this functionality yetTypical example of thought out solution
Modelica
Unclear MessageNot (strictly) about physical modelingInterest in an open specificationFormat for model storage and exchangeFeatures beyond behavioral descriptions
Data handlingCode maintenance
Non-proprietaryScalable
blah blah Modelica blah blah Simulink
Modelica blah blah index
reduction blah
blah blah Modelica blah blah causality
Development Effort
It requires a considerable effort to identify all the issues and then develop solutionsWe wanted to leverage work already doneThe diverse composition of the Modelica Organization provided many views
Capturing InformationEncapsulation (protected, public, encapsulated)Built-in types capture
Units, min & max values, nominal valuesAnnotations – Meta Data
Non-behavioral (e.g. graphical)All tools must preserve this dataStructured/Hierarchical (conceptually like XML)Avoids “kitchen sink” approachUseful for other applications (e.g. FMEA)
Meta-DataAnnotations
Currently used for several things including“Masks”Laying out components and connectionsDocumentation
Completely open-endedCan be associated with models, functions, packages, model instances, etc
Structured commentsPossible to store arbitrary data files in the Modelica model hierarchy
Configuration ManagementExample: Level of fidelity“Redundancy is the root of all evil”Version control provides different dimension sometimes misused, e.g.
Version 1.3 – Model with base halfshaftsVersion 1.4 – Model with stiff halfshaftsVersion 1.5 – Model with slip clutch
We build this into the modelParametrically change whether shaft is rigid or compliantSwap one component for another with a comparable interface
“Variant” Control
Using “Save As” is problematicVariants are nice because they
Reference other classes (not copy)Do not alter the “base” modelThey explicitly list exactly what has changed (called modifications)
Type safe
Example
model TransmissionWithFrictionextends Transmission(rigidShaft=true, damping=0.72,redeclare Ford.Mechanical.Gears.PlanetaryWithLossesplanetary(ratio=Nr/Ns, efficiency=efficiency));
end TransmissionWithFriction;
Topologicalmodification
New componenttype
Parametricmodification
Reuse anothermodel
GUI HandlingVariations are handled similarly to LSM
Annotations are used for choices
Representing BehaviorModelica includes both declarative and procedural semantics
Can be used for scripts and functions
Can handle both continuous and discrete behavior
Can be used for things like Petri nets, digital circuits and state charts
Different GUIs might be required to build modelsDifferent simulators may provide different performance for different problem types
Control Logic
Discrete behavior
Control Logic (cont.)model Tdelay "Transition with one input and one output connection"
parameter Real delay=5;protected
Boolean activated;Boolean delay_passed;Boolean fire;Real last_activation_time;
equation//activation of transitionactivated = inTransition.state;//set activation timewhen activated then
last_activation_time = time;end when;//activated and delay passeddelay_passed = activated and ((time - delay) > last_activation_time);//fire commandfire = activated and delay_passed and not outTransition.state;//propagate firing to in and output placesinTransition.fire = fire;outTransition.set = fire;
end TDelay;
Modelica Applications
Sample Package Structuredefinition
(e.g. package)
definition definition
parameter
component
definition
component
equation
annotation
annotation
modifications
definition
component
component
component
definition(e.g. package)
definition definition
component
annotation…
definition
component
component
annotation
constant
definition
equation
equation
equation
Libraries
Model
Modelica ToolsSimulate modelsGenerate documentationBundle models for distributionStyle guideline reportingOther possibilities
Specialized diffing/mergingCode generatorObfuscation/shroudingConversion/transformation utilitiesFormal verification
Example: Dymola LayersDymola uses annotations for:
Icon graphicsDiagram layout (and drawing elements)Documentation
ResultAll captured in the modelViewable in DymolaUsed to generate HTML documentation
Style GuidelinesTypical requirements
Naming conventionsDocumentation requirementsAvoid confusing constructsMake code more reusable/maintainable
Possible to automate the process of checking these guidelines
Report Generator
Translating Representations
Example: (simple) Simulink diagramsRead “.mdl” file, generate an ASTProcess AST and then generate Modelica codeComponents involved:
Continuous: Sum, Sin, GainDiscrete: Triggered Subsystem
Toplevel System
Subsystem
Preserving Information
Block {BlockType SinName “sine"Position [120, 70, 150, 100]SineType “Time-based"Amplitude "1"Bias "0"Frequency "10"Phase “0“Samples “10"Offset "0"SampleTime "0"VectorParams1D on
}
Simulink.Sin sine(Bias=0, Amplitude=1, Phase=0,Frequency=10) annotation(
Simulink(Offset="0",SampleTime="0",VectorParams1D=on,Samples="10",SineType="Time-based"),
extent=[-82,74;-72,84]);
Conclusions
Summary – Tool Philosophy
Handle version control and configuration management differentlyUse open and mature tools and technologies as a foundationBe prepared to customize, this requires
Open standardsApplication Programmer Interfaces (APIs)
Summary – Modelica
Captures all kinds of behaviorFairly mature and scalableHandles meta-dataAvoids the “Save As” syndromeRoom for more than simulation tools
Doesn’t have to be a monolithic system