Advanced Modelica TutorialExercisesHilding Elmqvist, DynasimMartin Otter, DLRRefine MultiBody/EngineMake Engine example model a reusable component1. Manage parameters2. Allow changing number of cylinders3. Test rig with replaceable engineAdvanced Modelica Tutorial - Exercises, Modelica'2003, Nov. 3-4, 2003 2Use Cylinder from Library MultiBodyAdvanced Modelica Tutorial - Exercises, Modelica'2003, Nov. 3-4, 2003 3Package structuringFirst create package Then create models, etc within the packageAdvanced Modelica Tutorial - Exercises, Modelica'2003, Nov. 3-4, 2003 4Task 1. Handling of parameters• Now – multiple selectDependent on experimentCommon to all cylindersSpecific for each cylinderOK as defaultAdvanced Modelica Tutorial - Exercises, Modelica'2003, Nov. 3-4, 2003 5Parameter record• Introduce parameter record for common parameters– Record gives possible reuse of data in different engine configurations– Propagate record elements to individual parameters– Introduce tabs and groupsAdvanced Modelica Tutorial - Exercises, Modelica'2003, Nov. 3-4, 2003 6To build record in the GUICreate record Change of setting neededcylinderParameters and insert parameters.Drag and dropAdvanced Modelica Tutorial - Exercises, Modelica'2003, Nov. 3-4, 2003 7Copy and paste alternativeDelete this lineContext menu (after paste)Advanced Modelica Tutorial - Exercises, Modelica'2003, Nov. 3-4, 2003 8Create MyCylinderCreate modelMyCylinder and insert a ...
Introduce parameter record for common parameters Record gives possible reuse of data in different engine configurations Propagate record elements to individual parameters Introduce tabs and groups
Propagate parameters Propagate each parameter in the record to the correspondingparameter of the MultiBody cylinder. Point to the input field and click the right mouse button and create Componentreference.
Give values to the parameter set by using the Parameter command of the extended class. Advanced Modelica Tutorial - Exercises, Modelica'2003, Nov. 3-4, 2003
Instead of using the hierarchical parameter dialog, use the Select Record command to create a record constructor referring to the predefined parameter set.
For MyEngineN introduce a parameter record, n and the angle vectors. Introduce an array of cylinders [n] and propagate the parameters. Use the each keyword to the cylinder parameters since all the cylinders have the same set.