310 likes | 522 Views
On Large Scale Modeling. Jonathan Friedman, Ph.D. Industry Marketing Manager MathWorks. Agenda. What is a Large Scale Model and Why is it Important? Use of Libraries & Model Reference Configuration Management of Models Model Packaging & Sharing. Agenda.
E N D
On Large Scale Modeling Jonathan Friedman, Ph.D.Industry Marketing ManagerMathWorks
Agenda • What is a Large Scale Model and Why is it Important? • Use of Libraries & Model Reference • Configuration Management of Models • Model Packaging & Sharing
Agenda • What is a Large Scale Model and Why is it Important? • Use of Libraries & Model Reference • Configuration Management of Models • Model Packaging & Sharing
Single Model Project & Configuration Management Single User
Single Model Project & Configuration Management Advanced Single User Single User Multiple Models Environment settings Data Files Libraries Path Export Revision Control Utilities Reproducibility
Single Model Project & Configuration Management Advanced Single User Single User Large Projects Model Sharing Team Reuse Multiple Models Environment settings Interface Definition Data Files Project Sharing Libraries Path Shared Libraries Export Revision Control Configuration Management Utilities Variants Reproducibility Common Environments Requirements Parallel Development
Single Model Advanced Single User Multiple Teams Single User Team Change Request Management Corporate Database Large Projects PLM Model Sharing Reuse Multiple Models Environment settings Interface Definition Data Files Project Sharing Libraries Path Shared Libraries Export Revision Control Configuration Management Utilities Variants Reproducibility Common Environments Requirements Parallel Development
What is Large Scale Modeling? • Project that is too big for a single person to know all the details • Usually comprised of a combination of: • >10,000 blocks in one model • >10 custom libraries linked • >5 engineers editing one model • >15 engineers using one model • >20 components or models • Requires high degrees and overhead of coordination • Multiple disciplines, teams, sites or organizations • Models reused throughout life cycle • Models have different versions • Multiple tool versions (internal and external)
Essential Technologies for Large Scale Modeling • Componentization • Reduce overall complexity by solving smaller problems • Facilitate concurrent teamwork and lower file contention • Permit component test and isolate behaviors • Eliminate re-test for unchanged components • Integration • Specify interface control descriptions • Isolate interactions between components • Coordination • Version control and configuration management
Simulink Hierarchical Components • Virtual subsystem • Graphical component • Contents of a virtual subsystem are flattened to level of the parent system during execution • Atomic subsystem • Simulink executes all blocks within an atomic subsystem as a unit before executing the next block • Inherit properties from their context such as Dimension, Data Type, Sample Time, so are context dependent • Model block • Executed as a unit • Do not inherit properties, are context independent
Partitioning a Model using Model Blocks • Model Reference used to partition top-level model into components • Signal Buses & Bus Objects used to define the interfaces between components • One file-per-component fits well with Revision Control packages • Enabler for parallel development of components
Libraries • Libraries support graphical reuse only • Instances of library blocks are duplicated during simulation • Not scalable for large models • Libraries serve as a container • Collection of well defined and related blocks (e.g., a block set) • Atomic subsystem library componentization issues • Cannot update, simulate, or test atomic subsystems in library • Requires break/restore links to update atomic subsystems • Cannot use buses • Suggestions • Use libraries for containing utility function blocks • Use Model Reference for designing system components
Agenda • What is a Large Scale Model and Why is it Important? • Use of Libraries & Model Reference • Configuration Management of Models • Model Packaging & Sharing
Model Reference and Libraries • Frequency of Edits • Software Boundaries • Simulation Performance • Sub-component Utilization • Single Component Files • Code Reuse in ModelReference Subsystems
Frequency of Edits Minimize edits to prevent users from disabling library links Libraries Model Reference Frequency of Edits Once every 6 months Daily
Simulation Performance • Determining “sensible” components for Model Reference will lead to improved simulation performance • Model Reference also improves model update times during editing Model Reference foo.mexw32 foo.mdl
Single Component Files • Reduce VC clash between authors with Component Libraries • Promotes component reuse Link Primary Library Model Component Library Link Compoent 1 Compoent 1 Compoent 1 Component Library Compoent 2 Compoent 2 Compoent 2 Link Link
Code Reuse in ModelReference Subsystems Model • Scenario: • 2 Model Ref blocks have models thatcontain links to the same utility in a library • Model contains 2 copies of utility • When you generatecode: • 3 Separate functionsthat do the same thing: • Model_Utility.c • A_Utility.c • B_Utility.c Model Reference B Model Reference A A Utility Utility Utility Utility Library Utility
Code Reuse in ModelReference Subsystems Model • Scenario: • The utility is now amodel reference block • When you generatecode: • One function call: • Utility.c Model Reference B Model Reference A A Utility Utility Utility Utility Library Utility
Agenda • What is a Large Scale Model and Why is it Important? • Use of Libraries & Model Reference • Configuration Management of Models • Model Packaging & Sharing
Project.mdl importantLib.mdl newFeature.mdl Configuration Management ReleaseCandidate Project Creation Release 1 Release 2 Rev 1 Revised Rev 2 Rev 6 Rev 3 Revised Revised Rev 1 No Change Rev 1 Rev 4 No Change Rev 4 Revised Rev 5 Revised Rev 1 Rev 5 New Feature Revised Configuration Set Files Incremental versions contained a bug, or were incompatible with other files.
Configuration Management R2007a“Branch” R2006a“Branch” “Branch” R14SP3“Branch”
Project Solutions for Version Control and Configuration Management • Use VC or CM tools to manage project files • Use Model Reference to break down large models into “sensible” components • frequently edited • Use Libraries to manage sub-components • infrequently edited • Use Signal Buses to define component interfaces • component uses all bus signals
Project Solutions for Version Control and Configuration Management • Does this work well? Yes! VC or CM tools manage files: • Model Reference: one file per component • Libraries: one file per sub-component • Bus Objects: can be serialized to file • Simulink.Parameter objects can be saved in .mat files • Parameters can be stored in .mat files or created by m-scripts • Standard configurations can be saved (configuration set) • Model Reference now has the notion of referenced configuration sets
Using Simulink with VC/CM Tools • Simulink can be configured to use revision numbers from the VC/CM tool • Use the appropriate keywords for your VC/CM tool • This information can be displayed using a “Model Info” block
Agenda • What is a Large Scale Model and Why is it Important? • Use of Libraries & Model Reference • Configuration Management of Models • Model Packaging & Sharing
Simulink Manifest Tools Dictionary Definition: 10 results for: manifest + adjective + verb – noun • 6. a list of the cargo carried by a ship, made for the use of various agents and officials at the ports of destination. • 7. a list or invoice of goods transported by truck or train. • 8. a list of the cargo or passengers carried on an airplane. Used by Java, Microsoft & others in software context
Simulink Manifest Tools (R2007a) Analyze Solution • Analysis to determine the list of files a model requires – the “manifest” • Determine which blocksets and toolboxes the model uses • View, edit and generate HTML report of the manifest • Export manifest contents to zip-file Benefit • Sending Model-Based Design projects to colleagues, suppliers or customers is easier Export to zip-file Report
Preserving Process Artifacts • Typically preserved for future root cause analysis or similar activities • Model Manifest • What files & toolboxes was the model using? • Model Checking: used to demonstrate review readiness • Custom tools, model advisor report generator • Requirements used for review checklist • Model Checker API • Code generation log (MATLAB diary command) • Check in generated code as derived files • Preserves dependencies for traceability