Home
Dymola 6, Additions.
Contents
1. Select case parameters Info Copy call Execute Close Select Tuner parameters in the left browser ax calibrate Tuner parameters E setup Description GO Tunerparameters Model parameters and start values to be calibrated ee Free start values Calibration data Rows o a i FE cases Bia name active value min mex FE inputCouplings i FE resultCouplings t a Integrator z Eq Optimizer Select parameters Info Copy cal Execute Close Click Select parameters A menu pops Select gearBox lossTable 1 2 engineTorque tau_0 Select parameters El gearbox O lossTable 1 1 A lossTable 1 2 O lossTable 1 3 O lossTable 1 4 O lossTable 1 5 El engine Torque tau_0 O tau_max Resetfrom file Value cos Click OK E Design calibrate Ax f calibrate 2 Tuner parameters i EA setup Description J Tuner parameters Model parameters and start values to be calibrated ee Free start values E Calibration data Rows 2 Ss ay FE AR learBoxlossTablef1 21 ue SP E00 E10 E FE resultCouplings Z J engine Torque tau_0 F 320 t Integrator z g Optimizer Select parameters Info Copy call Execute Close Free start values The start value of a state may be unknown By including the state as a tuner the start value is estimated automat
2. First data can be stored as Dymola result files mat format as text or as comma separated values suitable for Microsoft Excel and other applications e Comma separated values For use in e g Excel Note some versions of Excel uses the Regional Setting of List Separator when reading CSV files please set this to e Matlab format easy to use in Matlab and can also be re opened as a result in Dymola The file types marked with only plotted will only store the signals which are currently plotted Display units It is possible to change the display unit of a signal in the plot window for example from Pa to MPa or from rad s to rpm if suitable unit conversions have been defined Changing the display unit for a signal will change the display unit for all signals in the diagram with the same display unit Diagram tooltips show units After a signal has been plotted the display unit can be changed in Plot Setup The display unit is chosen from a list of known derived units The display unit must be changed for each plotted signal The last selected display unit becomes the default display unit when another signal with the same fundamental unit 1s plotted Properties Unit rad s Display unit rpm w Minimum Masimum Vertical 20 55 95 493 Horizontal O 1 Unit conversions and the initial default display unit can be specified in command scripts as needed For example defineUnitConversion Pa MPa le 6 0 scale an
3. Theta 1 Probability Density Data Preprocessing The quality of the calibration process 1s directly related to the quality of the measured data used as input to the calibration tool Any factor that perturbs the data will cause directly distortion of the final result of the calibration tool It is important then to preprocess the data that is to adjust the data eliminating noise zones where the model is not valid and erroneous or not representative measurements The Design Calibration package incorporates the function dataPreprocessing with this objective preprocess data for calibration Setting up for preprocessing Select dataPreprocessing in the class browser under Design Calibration Click right mouse button select the command Call function 142 Packages Design E J Calibration i Ch calibrate a perturbParameters f aeepParameter a sweep woParameters a checkCalibrations ensitivity cm dataPreprocessing Examples E Internal Open Class in This Window Open Class in New Window E aBa e Edit b Re Check a Search Close The dialog of dataPreprocessing pops We select now the file we want to process and the file that will contain the output Design Calibration dataP reprocessing dataPreproc
4. Arrays of records A simple address book can be created as an array of Person records as follows record Addresses Person4 persons end Addresses The corresponding dialog for such an array of records 1s Records Addresses Addresses Fersong Properties E persons Mare persone First name ko Middle initial Last name b Address Humber A persone 4 t Street name Postal code t City name H Info Copy Call Execute Close It 1s also possible to view all person records at the same time by selecting the array persons in the left tree browser Records Addresses Addresses Persons persons persons 1 Rows 3 es Midd Street name La IES a 123 Main Street Ass A SST Info Copy Call Execute Close MODELICA DATA STRUCTURES AND GUI 91 Visualize 3D Visualize 3D Introduction Data visualization in 3D is an important way of representation and it is adequate for understanding and comprehending model behavior Dymola 6 includes a new 3D graphical tool Visualize 3D Visualize 3D renders 3D scenes and has an associated Modelica package named Plot3D This new package manipulates and sends the graphical data representation of the scene to Visualize 3D This guide describes how to use Plot3D to obtain graphs and figures with the Visualize 3D tool in Dymola VISUALIZE 3D 95 96 Packagez E EJ Plot3D 1 plotPlonte 1 plotlines
5. Integration Algorithm egratorMethod Dassl Integration method to be used Rae o Relative tolerance outside of optimizer a more strict tolerance ts used during optimization Fixed integrator step 1 t 2 Step size for fixed step integrators Info Copy Call Execute Close Now we can run the command Click on Execute After the simulations and moving the legends to the appropriate place we get the following sequence of images MODEL EXPERIMENTATION 127 128 yl ww Reference Ji ww 141 4 1 00 0 10 Ji ww H J2 J 1 00 0 10 Ji e U3 1 00 0 10 Ji ww 11 J4 J 1 00 0 10 rad s J2 w ff Reference J2 w 1 1 00 0 10 J2 w ff J2 J 1 00 0 10 J2 w 3 1 00 0 10 J2 w 1 J4 J 1 00 0 10 rad s rad s J3 w ff Reference J3 w 4 J1 J 1 00 0 10 J3 w J2 J 1 00 0 10 J3 w i J3 J 1 00 0 10 J3 w H J4 J 1 00 0 10 J4 w ff Reference J4 w i 1 1 00 0 10 J4 w i J2 J 1 00 0 10 J ye i 43 J 1 00 0 10 J4 w i J4 J 1 00 0 10 rad s The plots show the variation of every variable when varying the parameters J1 J J2 J J3 J and J4 J 10 percent one at a time We observe for instance in the first plot that only the variation of J1 J affects the response on Jl w Sweep One Parameter two variants The phenomenon described before can be observed in ano
6. T caseCriteria Y setup Description j e Tuner parameters Criteria definitions for one case EB caseParameters Ez caseCriteria Rows 4 pa caseNames FE cases El demands GEO i x integrator 2 maxElevator _true H Fina optimizer riseTime false FinalVal settlingTime false Final Select Info Copy Call Execute Close Although the riseTime and the settlingTime criteria are not used in the optimization itself we have to provide demand values for them 0 5 and 5 E Design Optimization optimize o aixi CF optimize In demands E V setup Description Tuner parameters case caseCriteria matrix defining the demand values used for scaling ce EY caseParameters E Sa Rows fi Columns E YA caseCriteria Eg caseNames overshoot settingTime case 0 01 2 0 5 5 i 4 Integrator a E optimizer Import Load Save Plot gt gt gt Info Copy Call Execute Close After the optimization run same as Commands Run 2 Kq has been increased to 0 725383834580606 and Kf has been increased to 1 33686637964285 As a consequence the overshoot is now below the demand value of 1 However due to the high value of Kq the rise time increased Finally we update the tuner values again with the values from the previous optimization run set the riseTime and settlingTime criter
7. annotation smoothOrder 999 end P TestDivision3 MyDivision derf Removing the smoothOrder annotation instead gives Sizes of nonlinear systems of equations 1 Sizes after manipulation of the nonlinear systems 1 Number of numerical Jacobians 1 Commands and Scripting It is possible to use command line arguments when starting Dymola for example by making a short cut and associate either a mo or mos file After Dymola has started a mos file is executed by RunScript or a mo file is handled by openModel The command File Recent Files shows a submenu for the most recently opened model files or executed scripts during the current Dymola session The content of File Recent Files 1s saved between Dymola sessions Recent Files CDeyTest Complex Complex no Exit CiHlDevTestlenginefengine ma Ci DevTest Collidefcontact mo Ci DevTest Mewbops Opt3 ma Ci DevTest HNewblops Mops mo Ci DevTest Block PT2 mos Possible to include calls to scripts and opening of documents in menu Commands RECENT FEATURES IN DYMOLA 63 64 Commands Window Help Script to PowerPoint presentation Command File Save script to save various settings in a script The command log can be saved Alternatively switch settings plot and animation setup and variables can be saved Either all variables or only parameters and initial values of states can be saved either as specified initial values or as the final values after sim
8. Cro a Aged In the package Plot3D Examples Primitives the functions BasicPrimitives and BasicPrimitives2 produce 3D scenes with the primitives 106 JExamples E Primitives F E asicPrimitives a BasicPrirntivese Surfaces Click right on BasicPrimitivesl and then Call Function Then press Execute The resulting 3D scene is the following Visualizer 1 Sees gt Notice that the cylinder shell has no thickness BasicPrimitives2 1s another example showing some of the features of Visualize 3D Repeat for BasicPrimitives2 as before to get the following 3D scene VISUALIZE 3D 107 Visualizer 1 In particular the third curve at the top line is a Lissajous curve typically used in electronics and electrotechnique to find frequency and phase of a unkwon sine curve using a known one as reference If we observe now this curve along its z axis the result is the following The dialog windows of all primitives are very similar Each one of them have inherent fields for instance Plot3D Primitives Text has a String field called textString In this case the label we want to render The primitive Plot3D Primtives Axes is a very particular one since 1t produces a reference coordinate system We will use 1t in the next section 108 Surface Plots Other important feature of Plot3D is the easy user interface and the inclusion of high level help functions that will render surfaces contour li
9. Cross references Per file Top level Full name Include revigizons hor No classes v External references Generate online documentation O Generate HTML for referenced classes Generate links to online documentation Do not generate external links Diagram image size O Small image 75 Normal image Large image 150 O Huge image 200 The documentation layer has been also been improved e Documentation window in Dymola starts with description and Information followed by info text as does the generated HTML file e Package content parameters inputs and connectors are also included in info layer RECENT FEATURES IN DYMOLA 23 24 A Word 2002 template for generation of printed library documentation is available in dymola documentation Documentation template doc Index entries for class declarations is generated according to Word HTML format Settings and options The Edit Options dialog has been extended with two new tabs Appearance Protected classes are by default not included in package browser but this can be changed by clicking the checkbox Dymola by default uses the system font size for text in menus Modelica text etc If this size is too small for example when presenting Dymola for an audience the base font size can be changed On some computers the it can be difficult to see the difference between the digit 1 one and the letter 1 lower case L Increasi
10. Info Copy Call Execute Close An appropriate name is assigned to the currently considered case Design Optimization optimize optimize EY caseNames V setup Description Tuner parameters Names of the different cases G EY caseParameters Ta caseCriteria Rows f1 active nominal ES caseN ames pa EE cases pu la demands Pt 4 integrator E E optimizer Info Copy Call Execute Close We provide the case parameters values for the nominal case DESIGN OPTIMIZATION 207 E Design Optimization optimize f optimize Y setup Tuner parameters E caseParameters Nx caseCriteria caseN ames Pit integrator he E optimizer Design Optimization optimize optimize Y setup p e Tuner parameters ER caseParameters Y caseCriteria eacaseNames j E cases m demands yu integrator EB optimizer 208 EE cases Description 2 x case caseParameters matrix defining the different cases Rows fi Columns 5 Import Load Save Plot gt gt gt Info Copy Call Execute Close Finally we set the simulation time integrator to 10 seconds The obtained optimization result satisfies all criteria and gives the following tuner values Kf Ki Kq 2 7644705121894 2 73
11. Wireframe Hidden lines Filled Filled with Mesh Level Curves Select Plot Style None Contour Lines O Contour Lines Y Level curves rl 113 gt Maximum level gt Minimum level Number of levels gt Choose levels from vector Select Colomap None Gray Scale Red Scale Green Scale Blue Scale Custom Custom Color map l Water Fall Select Plot Style None Water Fall Water Fall Solid We observe the different alternatives We can combine independently four groups of data Surface Wireframe Hidden Lines Filled and Filled with Mesh Level Curves Contour Lines and Contour lines XY Water Fall Normal and Solid disks and Vector field check box in General group To change the axes properties we click on coordinateSystem on the tree The following dialog window pops Plot3D plotSurface plotSurface coordinateSystem plotSurfaces Description coordinateSystem Coordinate System Inputs Orientation of coordinate system lentity 4 Sale x Axis Label gt x Range min max 010 Enabled No Yes gt y Axis Label o y Axis gt y Range min max L Ji Enabled No Yes gt z Axis Label gt 2 Range min max Y gt Enabled O No Yes gt We observe here the fields Axis label Range and Enabled for X Y and Z axis Using the functions plotPoints plotLines plotStem plo
12. during event at Time 0 5000000000003932 Expression x gt O became true x 0 le 010 Iterating to find consistent restart conditions during event at Time 0 5000000001007865 Expression x gt O became false x 0 1 0025e 010 Iterating to find consistent restart conditions during event at Time 0 5000000003010365 The x variables in the log are links as described in the section Direct link in error log to variables in model window By using a fixed step solver euler the simulation runs to completion but there is still chattering and thus the warning message is given at the end of the successful simulation Fast sampling Another cause for slow simulations is that the model contains sampling at a high speed As an example consider model RapidSampling Real x equation when sample 0 le 6 then x pre x 1 end when end RapidSampling Running this with dassl lsodar generates the diagnostics Integration terminated successfully at T 1 WARNING You have many time events This is probably due to fast sampling Enable logging of event in Simulation Setup Debug Events during simulation CPU time for integration gt 57 1 seconds The simulation does not stop because of this but especially for a larger system it will be slower than normal and can be a cause for concern If the simulation is acceptably fast there is no need to enable the logging and investigate it further Using fixed step size
13. 1 rads qair 1 0 Gain amplitude of frequency response at zero frequency A ripple 0 5 Fas band ripple for Chebyshev filter fothernwise not used normalized true true if amplitude of low pase filter at f cut is 1 2grtf2 otherwise unmodified filter We choose a Butterworth filter in analogFilter and as cut frequency we choose 2 Hz It is enough to choose 2 Hz and not exactly 2 2159 since the filter is not ideal and we will smooth out the spectrum of the signal around those frequencies too The type of the filter has to be lowpass since the signal is clustered around zero frequency Press OK Then Execute in the main GUI The resultant spectra are presented MODEL EXPERIMENTATION 151 4 Amplitude 152 80 Frequency Analysis Fourier Transform TA 25 0 Frequency Hz 25 4 Amplitude 0 4 Frequency Analysis Fourier Transform 0 8 0 4 0 0 0 25 Frequency Hz We observe how high oscillatory modes are smoothed out This means that the signal in time is also smoother The result is presented in the next picture Time The filtered signal red has less noise than the original one blue This makes the calibration process easier The filters are constructed using the LinearSystems library from the Modelica Standard Library 2 2 These are discretised versions of continuous systems with a discretisation in
14. Copy Call Execute Close Now let us select the variables to plot Click on VariablesToPlot and then clicking on Select variables to plot button we get a variable browser where the selection of J1 w J2 w J3 w and J4 w is possible The resulting menu looks as following Design Experimentation perturbParameters 1 perturbParameterz 2 YariablesT oPlot A H setup Description E 8 perturbationParameters Calibration criteria definition for all experiments a 2 YarablesT oP lat 4 4 Integrator Select variables to plot Info Copy Call Execute Close Finally the setup for the integrator is to be done Click on integrator and set as stop time 1 2 126 Design Experimentation perturbParameters T perturbParameters bt integrator Advanced E HH setup Description E 6 perturbationParameterz Integrator parameters for all cases l Variables T oPlat Simulation Interval eg q integrator Stark time U dos Start time of simulation Stop time 14 Simulation stop time Info Copy Call Execute Close and the default tolerance for the integrator lowered to 1e 6 Design Experimentation perturbParameters CF perturbParameters t t integrator Advanced E HH setup Dutput Interval EH petturbationParameters Interval length 0 p Distance between output points E 2 WarablesToPlot Mumber of intervals Number of intervals for output i int t yl E
15. However due to the increased maximum elevator deflection other criteria could be decreased Multi case optimization In this section we start a new optimization task in order to extend the controller parameter synthesis to a multi case optimization As all aerodynamic parameters Ma Mq Md Za Zd of the F14 aircraft may vary within 10 of their nominal value Ma Md Mq Za Zd nominal 5 7 5 0 7 0 67 0 2 known worst case scenarios are simultaneously considered in addition to the nominal case A controller parameter set stabilizing all these cases shall be found First a simulation with the current controller parameters Ki 2 Kf 1 72 and Kq 0 5 for the nominal case is performed DESIGN OPTIMIZATION 205 ControllerDesign_F14 Design Optimization Examples ControllerDesign_Fl4 Encrypted File Edit Simulation Plot Animation Commands Window Help je QS Mi Bho Eee tr ola BRK AOE m m edo Variables Controller esign_F14 1 alpha_deg EControllerDesign_F14 2 1E alpha_c_deg 1 deg desired angle of Clg 9 80665 gravity constant OKI OKI ka 0 5 Ol 6 95 L Ma 5 Md PE CMg OF OTa 0 05 LITs PDT amii 210 1 Oza O67 Cl2d 02 LM alpha_deg 0 599841 deg angle of attack oO derlalpha_deg 0 0007 4676 degs derlangle of atta C q_degs 0 0007 466 degs pitch rate deg O delta deg 0 715735 deg elevator deflectic 2E overshoot O deg o
16. Persona Properties Mame frst ame Joe First name middlel mitral ko Optional middle initial lasthl ame Smith amp Last name Address number F House number street Din Street to Street name apLode AA ko ip code city e City ko City name Info Copy Call Execute Close These changes are made by adding the following annotations and extending the record with field married record Person3 String firstName First name annotation Dialog group Name String middlelnitial Optional middle initial annotation Dialog group Name String lastName Last name annotation Dialog group Name Integer number House number annotation Dialog group Address String street Street name annotation Dialog group Address Integer zipCode Zip code annotation Dialog group Address String city City mame annotation Dialog group Address Boolean married Marital status annotation Dialog tab Properties group Marital status end Person3 Note that for the Boolean field married the combobox with choices false and true appear automatically MODELICA DATA STRUCTURES AND GUI 81 82 Labels and layout By annotating a field such as firstName with the attribute joinNext true the next field middleInitial is put on the same horizontal line as firstLine Instead of having the variable name in front of the input field the description string 1s used if th
17. Tab Event i i O Y Group In A SSS OFF Ott K e Enable nf Modelica parameter Modelica Slunits Inertia J annotation Dialoglenable n gt 1 RECENT FEATURES IN DYMOLA 27 28 New variables of the built in types Real Integer Boolean and String can be declared with Edit Variables New Variable Declare variable SSS Declaration Type Prefix Annotations Type and name CC te Description It is easy access to all variable declarations in a model using Edit Variables This is allows easy modification of attributes and common annotations Re Check F Attributes variables Options Mew variable You can also use Setting Include non graphical in the component browser and select Parameters for a variable this will display the variable dialog Show Lomponent Parameters Open Class in New Window Attributes Include non graphical Remove selection Macq dadies eres Order The operation Propagate in the parameter context menu in the parameter dialog also gives a variable declaration dialog See Parameter dialog on page 9 Editor context menu The context menu of the Modelica text layer has been extended with several new operations gt Modelica Icons gt Mode Unda Chrl z gt Mode _ 8 a Redo Ctrl
18. annotation Dialog group Address descriptionlabel true Integer zipCode Zip code or postal code annotation Dialog group Address joinNext true absoluteWidth 10 descriptionLabel true label Postal code String Cily City name annotation Dialog group Address descriptionlabel true Boolean married Marital status annotation Dialog tab Properties group Marital status absoluteWidth 10 end Person4 Alternative forms for input fields Sometimes there is a set of frequent input values enumerations and in addition free text should be possible For such cases it is possible to add a combo box for the frequent choices This would for example be convenient for a sex field Integer sex Sex annotation Dialog tab Properties group Sex choices choice 1l Male choice 2 Female Associated with each value 1 2 it s possible to give a description string Male Female The Properties tab has the following layout after this addition MODELICA DATA STRUCTURES AND GUI 83 84 Records Person3 Persona Properties Info Copy Call Execute Close In the case of only a set of fixed choices radio buttons are more appropriate Specification of sex can for example be made by radio buttons by adding radioButtons true 1 e if the following declaration is given Integer sex Sex annotation Dialog tab Properties group Sex radioButtons true choice
19. trial and error using simulation runs or by using simplified linear models and apply the well established synthesis procedures for linear systems Design optimization is an approach to tune parameters such that the system behavior is improved The parameters that are tuned are often referred to as tuners Mathematically the tuning procedure is formulated as multi criteria parameter optimization Parameters are calculated to minimize criteria which express in mathematical terms what improvement shall mean Criteria values are usually derived from simulation results e g the overshoot or rise time of a response but they can also be derived by other analysis procedures such as frequency responses or eigenvalue analysis DESIGN OPTIMIZATION 189 190 The typical setup described below consists in defining the most important operating points of a model and to define criteria for every operating point This means that usually several simulation runs are needed to compute the criteria values This setup is called multi criteria multi case optimization The different operating points are the cases under consideration The major goal is to minimize all criteria and or to keep them below required bounds Other types of demands e g criteria that shall be maximized have to be reformulated Since several criteria shall be minimized there is usually no unique mathematical solution Instead the criteria have to be weighted with respect
20. Visualizer 1 Now we select from the context menu Erase Selected Objects and the disk 1s erased from the actual view Visualizer 1 Erase Window Change projection type Reset Print Export image as To close the cylinder shell we have then to set the bottom disk at the point 0 0 0 5 and the top disk at 0 0 0 5 since the cylinder has length 1 Press again on the Edit icon of Disk then change T to Translate and set tz to 0 5 Translate in objects 1 T Ff Translate Description Translate object in Y 2 directions Inputs gt Translation ines direction y Translation in direction Translation in Z direction C Ce E VISUALIZE 3D 105 Press Execute Then change tz to 0 5 and press Execute again We obtain now a closed cylinder as below We changed the color of top disk to yellow to show clearly the three components Visualizer 1 jek Visualizer 1 Dow Here we see top side and bottom of the newly created cylinder The primitive Plot3D Primitives Cylinder is constructed with this technique encapsulating all necessary steps to get a uniform color size and other properties Basic primitives The basic predefined primitives included in Plot3D are presented in the figure below Fackages E f Primitives AY Tent fv PolyLine Parametric5urfacel bject A Rectangle MA Box Disk 1 DiskArc Sphere mu Cylindershell mu Cylinder A Cone
21. a waa a rod Gee fregHz 5 The parameters of the model to explore are the inertia values J1 J J2 J J3 J and J4 J The observed variables are the rotational speeds Jl w J2 w J3 w and J4 w The setups of the functions are very similar and their description will therefore be brief Perturb parameters Let us check the behavior of the model if we perturb the nominal values of the parameters Select the function Design Experimentation perturbParameter in the package browser Click right mouse button and select Call Function The following menu pops Design Experimentation perturbParameters T perurbParameters E setup Tree data Inputs Model t Modelica name of the model used 4 4 Inbegrator Info Copy Call Execute Close Now to specify the model to use click on Edit icon to the left of the input field A package browser pops up Use it to select the model MODEL EXPERIMENTATION 123 Select model E A Design C Calibration C Experimentation E Probabilities _ RandomN umber Examples a CoupledClutches Click OK The model is now translated in order to gather information needed to build browsers and selectors to support the remaining setting up If Dymola already has a translated model then this model appears as the default model Design Experimentation perturbParameters iD perturbParameters H setup Tree data SA nas setup Inpuks perturbationParame
22. 163 164 Select case parameters Click OK The default values appear in the new columns Design calibrate H calibrate setup Tuner parameters E rr Free start values Experimentfles Calibration data DesignfExamples Accelerationmeasurements csv ES Calbiais SN eo meoo of 7 EZ inputCouplings is FE resultCouplings y t Integrator L g Optimizer From the measurement file we can find that the velocity at time 3 8s is 68 4 km hour 68 4 3 6 m s I tme speed dit acc Enter this value for carBody v and set gearBox i to have the value of the second gear namely 2 34 Enter also start time 3 8 and stop time 6 and set task to Validate Design calibrate l rr Free start values Calibration data 1 fDesign Examples Acceleration measurements csv ES Validate I 38 6f espe 234 FE inputCouplings E FF resultCouplings E y s Integrator La Ey Optimizer The files may include input signals to drive the model parameter values to be used and measured data that the model shall reproduce In this case the file includes measured speed distance and acceleration for each 20 ms in the time interval 0 6 24 seconds The acceleration measurements will be used for the calibration criterion To specify that click on resultCouplings in the browser to the left Design calibrate i y t Integrator ba g Optimizer Click on Couple file data MODEL CALIBRATION 165 C
23. 223 224 Use of revision information The underlying CVS system supports expansion of particular keywords for example to automatically document the revision or commit date of the model We could for example enter this text in the revision part of the documentation layer of our model Model revision Revision Last changed SDate Change log SLog The keywords indicated by will be expanded at the next commit operation The result is shown in the following example of HTML documentation 3 Decay Microsoft Internet Explorer File Edit View Favorites Tools Help OQ Bak gt E 2 J Search 37 Favorites Address Ci Documents and Settings DaglMy Documents Decaw html ho Decay Information Model revision Revision 1 3 Last changed Date 2005 10 04 09 51 52 Change lor SLog Decay mo w Revision 1 3 2005 10 04 09 51 52 Dag Added change log to documentation Parameters Type Name Default Description Real Ti 1 Modelica definition model Decay Real x start 2 parameter Real Ti 1 equat ion der x x Ti end Decay AM dacumentation generated by Dymaola Thu Dee 25 13 00 08 4000 gl Done d My Computer Version management using SVN Version management support in Dymola assumes that there exists a functional SVN subversion environment In its simplest form there exists a SVN repository on a local disk More advanced installations maintain a SVN server on a separate UNIX system
24. 51 52 number then it is possible to set it interactively In the plot browser click on Advanced and then click the button labeled vo and the interactively setting 1s enabled Setting Advanced LogStartValuesForIterationVariables true before translation will make Dymola produce a listing of all iteration variables and their start values Example Consider the following example intended to illustrate both the improved heuristics and setting start values model NonLinear Real x start xStart Real y Real z parameter Real xStart 1 algorithm xi y z Hime algorithm ee NT A equation O y Z end NonLinear Note Using algorithm in this way for actual models is not good since Dymola manipulates algorithms less and thus algorithms often lead to harder numeric problems larger system of equations no analytic Jacobian no alias elimination between and y and z Rewriting them as equations would be a good idea Translating this model gives a prompt for initial values Variables Values Unit ee Finitial values Advanced p Enabling guess values v gives the prompt Values Unit Desi Variables Binitial values A Oxstar A Advanced Setting z to 1 generates another solution for this non linear system of equations Bounds checking for variables Bounds checking for variables can be used to ensure that the solution 1s not only a numerical solution to the equations but also sati
25. E3 model used for the 1 caseCriteria Ba caseNames FE Cases optimization i demands E integrator EB optimizer Info Copy Call Execute Close Select Tuner parameters in order to define the model parameters that shall be determined by the optimizer Design Optimization optimize o g 21x optimize a Y setup 2 Tuner parameters Description L Tuner parameters Mode parameters to be optimized facaseParameters Ix caseCriteria Rows O 2 ga caseNames F cases mdemands yx integrator z EB optimizer Select parameters Info Copy Call Execute Close By clicking on the Select parameters button a variable tree browser of the selected models opens Select the controller parameter Kf as a tuner that is being optimized 194 The actual tuner value and the corresponding minimum and maximum values as well as the unit if defined in the model are read from the last simulation run Design Optimization optimize optimize amp Y setup caseParameters 1 caseCriteria gcaseNames F cases m demands ku integrator S optimizer Note minimum and maximum values should always be defined for tuner parameters in order to ease the task for the optimizer Optionally case parameters can be specified to define the operating conditions Here parameter alpha c deg is selected from the tree browser via button
26. It is worth pointing out that Dymola and the underlying SVN system supports development of libraries maintained at several different servers concurrently For example the Modelica standard library may be maintained at svn modelica org other libraries proprietary to the 225 SVN editor setup Location of the SVN command 226 company and still others by the user on a local disk In this fashion version management also facilitates effective distribution of updates as they become available from the vendor Some SVN operations require input from the user for example a log message when a file 1s committed To enable this feature the user must set either of the environment variables SVN_SETUP EDITOR or VISUAL to the name of a text editor On Windows notepad will be sufficient for most uses Note in several places the user is asked to execute SVN commands The files svn exe and svnadmin exe should be available from the command line 1f you have performed the default installation of SVN see References below Local SVN repository To set up a local SVN repository first choose the machine and disk on which you want to store the revision history of the source files CPU and memory requirements are modest so most machines should be adequate To create a repository with a set of configuration files run the svnadmin create DOS command to set up an empty repository in the designated directory For example svnadmin creat
27. Run 3 optimize Kf Ki Kq 4 criteria Calibration Run 4 optimize Ki Kf Kq 4 criteria Experimentation Run 5 Internal Optimization let overshoot increase from 1 to 10 Run 6 maxElevator as inequality optimize Run 7 optimize only nominal case JExamples Run 8 optimize 2 cases ControllerDesign_F14 Run 9 optimize 3 cases Utilities Add command AC ritaria After Execute 1s pressed the optimization 1s started The Dymola command log shows the iterations and the final output DESIGN OPTIMIZATION 199 Iteration 21 name value abs diff min max unit KE 1 685169e 000 4 314831e 000 1 000000e 001 0 000000e 000 eee ess Css s s ms fs e a e cs es is a E e a es cis e ce ei mms mir as sm sms Gm Sms mis es e e e e e Cs ms Sr ca Criteria se mmr me a mm cme memes mem pS ems am Name me vm um a Sm meme mm Spm ec eT cm mpm mS cm eC Ss ec a se ccm mn mms me Sc tm met me fm te ci signal name criteria sealed l dirr unscaled demand usag overshoot FinalValue max 2 95456 87 59 2 954561e 002 deg 1 000000e 002 deg mini maxElevator FinalValue 0 59558 66 26 1 191153e 000 deg 2 00
28. V Ca i NzPilot theta Component aircraft contains the dynamic equations of the aircraft Component controller is the control system for the longitudinal motion and component criteria contains the criteria computation This model is used for simulation and analysis of the closed loop step response of the longitudinal motion of a very simple F14 aircraft model A linear controller with fixed controller parameters 1s used for tracking the reference motion of the angle of attack alpha The goal is to determine the controller parameters such that the step response is reasonable in the operation region of the aircraft Simulate this model for 10 s and plot alpha c deg commanded angle of attack alpha deg angle of attack q_degs pitch rate and delta _deg elevator deflection DESIGN OPTIMIZATION 191 ES alpha_c_deg alpha_deg 15 1 0 0 5 deg degt 0 0 25 3 0 T5 10 0 delta_deq deg a 0 0 25 3 0 The controller is shown in the next figure alpha_c prefilter k Kf alpha integrator delta feedback 192 The values of the controller parameters are Kf 6 Ki 2 Kq 0 5 The desired reference value for alpha is alpha c deg 1 The initial value for alpha t is alpha 0 0 This arbitrarily chosen stabilizing set of controller parameters leads to a large overshoot of alpha and a significant maximum elevator deflection The des
29. all nodes in the variable browser e Clicking on a opens one more level of the tree The Browse operation opens two levels which makes the model structure clearer without creating a huge browse tree e The Open All operation opens every sub node in the browse tree Large sub trees may become very large and hard to navigate ce 39 e Clicking on will close a node The Close operation will close all nodes in the browse tree The difference is that the next time you open the node all nodes will be closed The last three commands in the menu are only available for top level result file nodes e The Save As operation allows the user to save the result file in several different file formats It is possible to either store the whole result file or just those signals which are currently plotted e The Close Result operation will delete the result file from Dymola and free the occupied storage space e The Animate operation will animate the data in the selected result file This operations requires that an animation window is open and that the result file contains animation data RECENT FEATURES IN DYMOLA 65 66 The Save As operation can store data in several different formats File name ha Save as type Result files mat hal Result files mat Textual format txt Comma separated values only plotted cev Ext Matlab file only plotted mat All Filez
30. are the same number of equations and number of unknown variables and that there is for each variable an equation from which the variable can be solved This check is now done in more detail as it is done separately for each of the four basic data types Real Integer Boolean and String This supports better checking For example let r be a real variable and let i be an integer variable and consider the equation r 1 This equation is a real equation since we need to use it to solve for r We cannot use it to solve for 1 It may be remarked that the checking for structural singularities of the initialization problem has had this more detailed checking from the start The simulation problem 1s more complex since 1t may have high DAE index which means that it is by definition singular if only the derivatives der x and algebraic variables v are considered to be the unknown variables It is necessary to also consider the appearances of x Using the check command enforces checking for structural singularities No user is happy when the error message at translation says missing equations or too many equations It may be that the components are used in a wrong way for example a component is missing but it may also be that a used component model is wrong Dymola has extended the checking of non partial models and block components to include checking for structural singularities in order to give component or library developers better support To get a non
31. commands Save Save All Save As and Save Total are not available for encrypted components The Duplicate command is only available if duplication is explicitly enabled The commands Print Export Image and Export Animation are not changed in the meaning that they output what 1s visible on the screen The command Open reads encrypted files in the usual way when the file type Encrypted Modelica files moe is selected This file type is visible for all users not only the ones who have enabled encryption of models Package and component browsers Concealed classes are never shown in the package browser The component browser does not show components or extends of a concealed class Editor graphics and text Encrypted models are read only and concealed models are never visible in the editor Dymola implements the following restrictions on what is shown in the graphical and textual layers of the editor e The icon layer is empty for concealed classes Also it does not show protected connectors regardless of encryption Note that these rules for the icon layer also apply to icons as they are shown in the diagram layer of some other class e The diagram layer is as default empty for encrypted classes not even public ones However models enclosed in a package called Examples or Tutorial are shown as default e Modelica text declarations and equations is as default empty if the class is encrypted e The docume
32. fregqHz time Vs signalSource startTime Vs signalSource phase Ri Wo f URL DS Ve CV Linear system of equations 7 Symbolie solution px Original equation R1 R C n i Ri sw Sy Coll gS RL VIRI R E Torn part End of linear system of equations Linear system of equations fi oymbolic Solution 15 Original eg ation C C der C v C n i kef der tCv z 0u I C G Torn part End of linear system of equations R2 v R2 R L i Dey iS RZ A NV Linear system of equations Li Symbolic solution Original equation bebrder DL Lev Kf derbe Ti DaN Dra Torn part End of linear system of equations fe SS SS A SS O SAS Conditionally Accepted Section VS oi FS Cot la ds Ep a MS O Ol das e a aaa E E a E E a Eliminated alias variables To have eliminated alias variables listed set ra Advanced OutputModelicaCodeWithAliasVariables true before translation May give much output The manipulated equations are sorted into sections First there are calculations of constants and bound parameters These parts are only executed at initialization Then the calculation of outputs and the derivatives of the continuous time states follow The output and dynamics sections are executed during continuous integration In the general case there is then a section titled Accepted Section It includes codes for detecting discrete event and updating discrete states that need not be e
33. in the models directory For our example we will use the simple model model Decay Real x start 2 equation der x x end Decay Initially the model is unknown to the version management system For example a Version Status command returns this information in the message window C util dymola bin cvs exe status v Decay mo in directory C dev Proj DymolaQt models cvs exe status use Cvs exe add to create an entry for Decay mo File Decay mo Status Unknown Working revision No entry for Decay mo Repository revision No revision control file Command finished Next we perform the Version Add Model command to make the model s file known to the version management system C util dymola bin cvs exe add Decay mo in directory C dev Proj DymolaQt models cvs exe add scheduling file Decay mo for addition cvs exe add use cvs exe commit to add this file permanently Command finished The information from Version Status is now different but there is no file in the repository yet not until we commit the file C util dymola bin cvs exe status v Decay mo in directory C dev Proj DymolaQt models File Decay mo Status Locally Added Working revision New file Repository revision No revision control file Sticky Tags none Sticky Date none Sticky Options none Command finished When we perform Version Commit the user is asked to enter a log message describing what changes are co
34. is a Boolean variable The algebraic loop is a mixed system with one Boolean equation and four real equations Mixed system of equations Linear system of equations Jf Symbolic solution Original equation D v Vs v R1 v Ey D s Vs v R1 R D Goff D Vknee D Vknee R1 R if D off then D Goff else 1 if D off then 1 else D Ron 1 7 Torn pare D 1 D s if D off then D Goff else 1 D Goff D Vknee law R1 R D i D v D s if D off then 1 else D Ron D Vknee End of linear system of equations Torn discrete part D off D s lt 0 End of mixed system of equations Dymola solves such a system by iterating Assuming the Boolean variable to be known and removing the Boolean equation the rest is a linear problem with four real unknowns As seen Dymola solves the linear part symbolically During simulation Dymola iterates 1f the assignment D off D s lt 0 changes the value of D off Diode circuit with exponential diode model Let us revise the diode circuit above to use the diode model RECENT FEATURES IN DYMOLA 49 Modelica Electrical Analog SemiConductors Diode D Its diode characteristic is nonlinear with exponential terms There 1s a nonlinear algebraic loop with three unknowns Mixed system of equations Nonlinear system of equations It depends on the following parameters Ii D Ids El D Maxexp DR El D Vt Ld R1 R It depends on the following t
35. lt html gt It is possible to lt b gt format lt b gt description x lt sup gt 2 lt sup gt lt font size l 21 gt larger lt tfont gt lt font colorf 1 FEF 0000 gt colar lt font gt lt html gt Real alpha lt html gt use other lt font face Courier New Courier monospace gt fonts lt font gt and lt b gt even lt b gt use greek characters alpha lt html1l gt annotation Dialog label lt html gt amp alpha lt html gt Real picture lt html gt and lt b gt also lt b gt include line lt br gt breaks and pictures lt imgsrc C Dymola work colorfill png gt amp nbsp in the description lt html gt gt end TestHTML Greek symbols can for example be found at http www htmlhelp com reference html40 entities symbols html Declare variable dialog It is possible to introduce groups and tabs in the Annotations tab of the Declare variable editor for the fields firstName middleInitial and lastName The rest of the fields are put in the group Address MODELICA DATA STRUCTURES AND GUI 87 Declare variable Declaration Type Prefix Evaluate Hide Parameter dialog placernent E Graphical information Default Default Tab Estent Edo O On O On Group Rotati atatian Ott Ott E Enable ue Modelica 2 annotation Dialog group MName jomblext tmue naturalidth 20 descriptionLabel truel This Declare variable editor is reached through Edit Varia
36. of the model around an operating point e g maximum real part of all eigen values can only 197 DESIGN OPTIMIZATION be selected from this menu and cannot be defined in the model this function criterion is not yet supported Column criteriaUsage remains unchanged for the moment As already mentioned it is possible to define multiple cases representing e g different working conditions We could provide different names for them but for our first optimization run we simply use the default name 2 Design Optimization optimize i 2 xi 1 optimize E caseN ames E V setup Description Tuner parameters Names of the different cases EH caseParameters WA caseCriteria Rows 1 active 3 caseNamez pa cases a la demands Al i 4 Integrator E E optimizer Info Copy Call Execute Close Since we are using several criteria they have to be weighted with regards to each other In optimize the value criterion demand is minimized 1 e demand is used as scaling factor of criterion A demand value has the same unit as the corresponding criterion For this first setup we use a demand value of 0 01 for the overshoot 1 overshoot and 2 for the maximum absolute elevator deflection Design Optimization optimize F optimize la demands a V setup Description t Tuner para
37. part of check Promptfor arguments i Execute when checking package Check has been extended with a drop down list to select if you also want to run such commands and simulate any model with stored experiment setup 2 ly Mar gt a Normal With simulation Simulation windows Dymola has new separate command window with a package browser Dymola Command window Seles Packages Runscript c fdymolafinsert dymola mos true HGP Modelica Reference rue J Modelica li Euns5cript C Documents and Settings Dag Application Data Dynasimfsettings mos true Unnamed a Selecting Window New Command Window displays the new command window aa Help Mode View b Tools New Library Window New Dymola Window New Command Window The Window menu has a new command Tools which makes it easy to select which browsers and toolbars should be visible For example this makes it possible to display the diagram layer of a model in Simulation mode Improvements in interactive functions Possible to trace function execution using the built in function trace variables false statements false calls false onlyFunction This will optionally trace values of assigned variables executed statements calls of the function and can optionally be overridden for a specicific function Calling trace with default value for onlyFunction overrides the trace settings for all functions Edit Function Call added
38. radius is 18 2 0 45 245 0 338 m Engine characteristics at full throttle for a BMW 5451 were found at http www e60 net information options engines N62B44 200 acm NRT 260 0 k wis 450 Nm 3600min 1 245 kW 6100min 1 440 ja t 240 0 SS Ta a e OEE ee A AS 2 220 0 200 0 360 180 0 320 A aA 160 0 280 v ape emma t T e FF 140 0 240 Y 120 0 200 100 0 160 a ne 80 0 120 a A ie il 60 0 ii L 40 0 E Z 40 ale ls Y D g E Fo A Loo O O 1000 200 3000 4000 5000 6000 7000 Engine speed min 1 BMW 5451 and BMW 6451 have the same 4 4 liter V8 engine The black lines in the plot above show the torque and power characteristics As a first approximation we fit a quadratic characteristic tau tau_0 tau_max tau_0 1 w w_max w_max 2 The parameter w_max is 3600 27 60 rad s and tau max is 450 Nm Choosing tau_0 to 320 gives the red curve in the plot above 158 The velocity and acceleration measurements are stored simply as a csv file Program Files Dymola Modelica Library Design Acceleration measurements csv The first row of the file includes the column headings and then the data follow Dymola supports plotting of such a csv file Select Plot Open Results and a file browser pops Use 1s to select the csv file The file and 1ts variables appear in the plot
39. solvers such as Euler does not generate any diagnostics since running a sampled system with a step size corresponding to the sampling rate is normal and not a cause for concern Ensuring that Stop stops the simulation Simulations normally run to completion but in some cases it is necessary to stop the simulation either because the setup was incorrect e g stop time lel0 instead of 10 or because the simulation is progressing too slowly Simulations are normally stopped in a nice way in order to ensure that the user gets a complete result file including diagnostics see Extended diagnostics for stuck simulation However in extreme examples a model might be stuck in an infinite loop Consider a user writing a variant of the rem function in Modelica the intention is that x should be a sawtooth shape but mixes up plus and minus RECENT FEATURES IN DYMOLA 59 60 model ReallyStuckSimulation Real x algorithm x time while x gt 0 2 loop x x 0 2 Subtract offset end while end ReallyStuckSimulation Running this example gives a stuck simulation after 0 2 seconds and the user should therefore press the red Stop button highlighted below ReallyStuckSimulation ReallyStuckSimulation File Edt Simulation Plot Animation Commands Window F me eo amp kk Be YO x After waiting for a half a minute the simulation process dymosim will be terminated The waiting period is used to ensure th
40. such a way that the ramp response is exact The possible filters are four Critically damped Bessel Butterworth and Chebyschev Model Calibration Model calibration Introduction Dymola includes features to perform integrated computer experiments with Modelica models This document describes the features to calibrate and to assess models The functions described in this document are parts of the Design Calibration package The ModelCalibration option is required for problems with more than one tuner However the examples given below can be run without the ModelCalibration option Consider a Modelica model describing a physical system Such a model includes typically many parameters which have to be set Some parameter values can be found from design sheets Some parameters such as physical dimensions may be easy to measure on the system Direct measurements of the weights of the parts are more difficult since 1t requires the system to be dismounted Moreover it is for example not simple to measure the inertia of a part Friction and loss parameters are good examples of parameters that often are unknown Model calibration parameter estimation is the process where measured data from a real device is used to tune parameters such that the simulation results are in good agreement with the measured data The parameters that we tune are often referred to as tuners Dymola varies the tuners and simulates when it searches for satisfactory solution
41. sweepTwoParameters Tree data E setup Description H Tuner parameters Sweep at mosttwo parameters and plot the criterion in 3D m Free start values i ee Inputs Calibration data a FF cases sweepVariableX gearBox lossTable 1 2 o EA valuesX Design Internal Equidistantgrid 0 5 y gt Values to sweep a FF resultCouplings sweepVariableY engine Torque tau_0 E E Integrator valuesY Design Internal Equidistantgrid 200 300 y gt Values to sweep ba Optimizer Info Copy cal Execute Close Click Execute and Dymola produces the plot below MODEL CALIBRATION 181 N 200 100 Response to parameter perturbations perturbParameters The function perturbParameters plots the responses to perturbations in the tuners As an example select the command Calibration with validation of the model Design Calibration Examples SimpleCar Select calibrate at the top in the tree browser click right mouse button and select perturbParameters The menu changes Click on perturbationParameters E Design Calibration perturbParameters ax E perturbParameters 2 perturbationParameters al setup Rows 2 E Tuner parameters Lee Free startvalues active Calibration data gearBoxlossTable 1 2 mea AM e El FE cases engineT orque tau_0 FE inputCouplings i FE resultCouplings i y Integrator E Eq Optimizer i 2 perturbationParamete
42. to context menu of command input line Additional function arguments SimulateExtendedModel RECENT FEATURES IN DYMOLA 37 38 autoLoad true If false the result file is not loaded in the plot window and variables are not replotted initialized isInitialized true If false it will initialize according to the initial equations at the start of the simulation iist and variables Possible to write the variables to a script file which can be executed filename script mos and limit it to certain variables by using variables varl var2 Can specify a model name with modifiers for translateModel simulateModel etc e g for source in Step Constant Ramp Sine Loop simulateModel TestSource redeclare Moce Lica Blocks Sources sourcet Source T gt end for Minor improvements Many minor improvements in particular e Performance of when and sample in certain cases e Global common sub expression elimination is performed for scalar functions e Solving of ill conditioned linear systems e Improvements necessary to generate efficient code for Modelica Media e Automatic differentiation and partial derivatives of Modelica functions For analytic Jacobians see section Analytic Jacobians on page 62 please contact Dynasim for further information on partial derivatives e The possible number of external objects has been increased Improved robustness of non linear solver e Initial equations au
43. to each other and the goal is to find the best compromise solution that minimizes all criteria in the designer s sense The weighting technique described in the next sections is a proven technology developed by DLR and it has been applied in many industrial projects in the last 10 years To load Design Optimization select File Libraries and click Design Packages a0 Design 0 Calibration 0 Experimentation Internal J Optimization optimize Examples a Criteria The function Design Optimization optimize is the main function for design optimization via multi criteria multi case parameter optimization There is also a set of functions and of models to define criteria For parameter studies in general see Design Experimentation To determine model parameters using measurement data see Design Calibration This document uses the design of a control system for a very simple model of an F14 aircraft see figure below to illustrate how a basic design optimization task is set up and executed and how the setup is stored for later reuse First optimization setup In this section the first setup of the design optimization of the F14 controllers is shown Open model Design Optimization Examples ControllerDesign F14 const from_deg deg Ps pe rad k alpha_c_deg controller alpha_c alpha delta gt q criteria alpha_c delta alpha actuator aircraft V alpha
44. type OnOff Boolean annotation choices choice false off choice true on parameter OnOff animation false Enable disable animation The following examples show similar choices from a set of predefined vectors representing different common directional axes or commonly used colors In the example to the right a selection has been among a set of strings animation X a PD false vr animation hal n mg color 1 0 0 x anis shape 0 1 0 y axis 0 0 1 z axis any asis The corresponding declarations are type Axis Real 3 annotation choices choice 1 0 0 1 0 0 x axis choices Url 0 LO 1 0 y exis choice 0 0 1 10 021 z axis choice 0 0 0 any exis parameter Axis n 1 0 0 Axis of rotation type Color Real 3 annotation choices choice 1 0 0 red choice 0 1 0 green choice 0 0 1 blue parameter Color color 1 0 0 Object color type Shape String annotation choices choice none choice box box choice cylinder cylinder parameter Shape shape Animation shape color shape none boy cylinder It should be noted that it s possible to enter any value without using the pull down menu This enables the use of expressions for example Structured editor for parameter fields Dymola has specialized array and matrix editors for entering structured parameters The context menu is available to insert be
45. versions of the Modelica Standard Library the following dialog 1s shown Click on Add Uses to update the model so this dialog is not shown in the future This model did not specify which version of Modelica it uses i and Dymola assumes that it should use version 1 6 Add Uses Do Mot Add Uses Cancel Other libraries Modelica Reference documentation as a package See the package browser HG Classes HE Functions E Operators Pbreak E connect Library Modelica_LinearSystems is a free Modelica package providing different representations of linear time invariant differential and difference equation systems as well as typical operations on these system descriptions See the Users Guide inside the package for details The package DataFiles has been updated with functions to write and read CSV comma separated values files CSV files are for example generated amd read by MS Excel The function DataFiles readCS Vmatrix fileName reads the data into a matrix skipping the first line 1f containing textual legends The data can be separated by tab semicolon or comma RECENT FEATURES IN DYMOLA 71 Library handling improvements If the string DYMOLA Modelica Library is not found in MODELICAPATH it is added first and not last The environment variable MODELICAPATH specifies a semi colon separated list of directories where packages will be searched for The handling of conversion to Modelica 2 2 an
46. x output Real y algorithm assert x lt 2 Cannot be larger than 2 y X x LEX end f Real x equation der xX u y f x annotation uses Modelica version 2 2 end MyF model WhichOne import Modelica Blocks Sources MyF MyF1 annotation extent 20 20 0 40 annotation Diagram uses Modelica version 2 2 Sources Step Stepl startTime 2 height 4 annotation extent 60 20 40 40 Sources Clock Clockl annotation extent 60 20 40 0 MyF MyF2 annotation extent 20 20 0 0 MyF MyF3 annotation extent 20 20 40 40 MyF MyF4 annotation extent 20 20 40 0 equation connect Stepl y MyF1 u annotation points 39 30 22 30 connect Clockl y MyF2 u annotation points 39 10 22 10 connect MyF2 y MyF4 u annotation points 1 10 18 10 connect MyFl y MyF3 u annotation points 1 30 18 30 end WhichOne 54 This model fails to simulate because of the assertion in f but which of MyF1 f MyF2 f MyF3 f and MyF4 f is violating the assertion The log message contains Assertion failed x lt 2 The following error was detected at time 0 7000000000000001 Cannot be larger than 2 The stack of functions is MyF f MyF f MyF1 x Integration terminated before reaching StopTime at T 0 7 This clearly shows MyF1 f caused the error Note Due to alias elimination the variable will in some cases not be the exact same variable but can be an ident
47. 0000e 000 deg mini cs sm e e a a A D a e i s cm e ED e e OG ee me O ee sn cm css O S OD een A OD D ne A D S O es jen je ee ce ce ee cece D e SED OD D OD SD CA D ec nce SD E C a ec ee es ane Summary 23 81173 Maximum scaled criterion at start 2 95456 Maximum scaled criterion in this iteration 2 95456 Maximum scaled criterion in best iteration 20 Optimization terminated successfully 1 68517406292052 8 Modeling Y Simulation All iterations that are better than all previous ones are shown in the log The following information are given in the log for iteration 21 Tuner Kf is active see last column in the figure above and has the value 1 68517 This is a change of 4 31 with regards to the value of Kf before the optimization started The search interval for the optimizer for this tuner is 10 0 see min max columns There is only one simulation case defined and therefore no additional information is given for the cases The scaled criteria overshoot is currently the largest of the scaled criteria due to the max in front of the scaled value and has a scaled value overshoot demand 2 95456 This is a change of 87 59 with regards to the initial value The actual value of overshoot 0 0295456 2 95 overshoot This criteria is minimized due to minimize and has a demand value of 0 01 see column demand The best values of all tuners are also give
48. 1 plotter F plotSurtace fF plotB arGraph F plotPieLhart F plotHistograrn G plotA esult F InsertPointer 1 InsertLabel 1 InsertPrinnitive ES Examples E J Frimitives H J Records el E Types EH E Internal The main functions are at top level of the package plotPoints plotlines plotStem plotSurface plotbarGraph plotPieChart plotHistogram plotResult insertPointer insertLabel and insertPrimitive We recommend strongly using these high level functions instead of trying to use the low level ones in Plot3D Internal The subpackage Plot3D Primitives contains the basic primitives preset The subpackages Records and Types also contain information about the internal representation of a 3D scene The subpackage Examples contains in its turn some of the examples presented here and we will refer to them later on Visualize 3D supports several different types of plots and can be presented separately in their own windows if desired all integrated in the Simulation tab Visualizer 1 JE Visualizer 2 E mpx Group 3 Grat p E Greup D Mh nandalina NA Girew dation Inserting and removing objects Visualize 3D has several basic primitives that can be combined to construct more complicated scenes We will start by constructing a simple solid cylinder by combining a cylinder shell with two disks We start by using the function Plot3D InsertPrimitive VISUALIZE 3D 97 98 Plot3D Plot3D Dia
49. 2 e Concealed classes are completely hidden for the users who shall not be aware of the existence of such components at all They are not shown in the package browser and they cannot be inspected A class or a component is defined as concealed if one of these conditions 1s fulfilled e Itis declared in the protected section of an encrypted class e Its lexically enclosing scope is concealed e It has the Protection annotation hideFromBrowser true Dymola supports encryption on file basis which means that all parts of an encrypted package must be stored in one file Storing an encrypted package in several files or in subdirectories would reveal structural information Instead it is possible to reveal the contents of encrypted packages Developing encrypted libraries To allow visible components to be used in the normal way to compose models set parameters and initial values the developer of such components must make a careful design The public part must provide all necessary parameters necessary control of initialization and variables to inspect and plot Nested modifiers cannot be used to modify concealed parameters Instead new parameters have to be declared and propagated down the hierarchy Parameters for initial conditions need to be introduced and propagated to start values or used in initial sections The procedure for developing an encrypted library 1s e The developer maintains an unencrypted library which is easy t
50. 200000 This curve relates at t 1 2 the parameter J1 J and the response J1 w The same situation can be depicted for J2 J as parameter and J1 w as response The figure follows Time 1 200000 T T T T T T T T T T T T T T T T T T 0 80 0 84 0 88 0 92 0 96 1 00 1 04 1 08 1 12 1 16 1 20 Sweep Two parameters To study the dependence of one response with respect to two parameters at the end of the integration interval the function sweepTwoParameters is to be used The setup is almost identical to sweepParameter and sweepOneParameter The only difference is that two dependency variables are to be selected instead 132 Design Experimentation sweep lwoParameters T sweepTwoParameters dependencyParameters E HB setup Description dependencyParameters Model parameters to be calibrated E s WariablesT oPlot Rows name Sweeping Y aluez 1 quidistantgrid 0 7 1 3 2 quidistantgrid 0 7 1 3 t Integrator We observe now J1 w against J1 J and J2 J The values chosen for J1 J and J2 J are eleven values between 0 7 and 1 3 for both variables Even for this case the Stop time is 1 2 and the tolerance is 1e 6 in the integrator tab J1 w Observing J2 w gives the following result MODEL EXPERIMENTATION 133 41 A e e J2 J W Monte Carlo Analysis Monte Carlo Analysis is widely used to explore the behavior of a model when the input parameters are multidimensional We will set up no
51. 348743052164 0 61829473903147 From a different analysis it is known that the obtained controller set does not satisfy the criteria in the case Ma Md Mq Za Zd worstovershoot 4 5 6 75 0 63 0 603 0 18 This set of aerodynamic parameters will be used to define a case worstOvershoot besides the nominal case In caseNames we define the additional case s caseNames Description Names of the different cases Rows 2 ee nominal E worstOvershoot true gt Info Copy Call Execute Close The different values for the parameters defining the new case are given in the cases case caseParameters matrix Design Optimization optimize 2x optimize FE cases y setup Description j e Tuner parameters ease caseParameters matrix defining the different cases Bj CaseParameters 1 caseCriteria Rows 2 Columns 5 g caseNames cases ludemands s iZ integrator worstOvershoot vershoot f optimizer Import Load Save Plot gt gt gt Info Copy Call Execute Close We have to provide demand values for the new case Design Optimization optimize gt ax CP optimize In demands a V setup Description H Tuner parameters case caseCriteria matrix defining the demand values used for scaling EY caseParameters i o Rows 2 Columns a NA case
52. 6 2 0 2 4 2 8 3 2 1 6 2 0 2 4 2 8 3 2 J3 w J4 w To plot the accumulated distributions check the flag Show accumulated distributions Design Experimentation MonteCarloAnalysis CF MonteCarlodnalysis oe MonteCarlodnalysis Tree data Description H uncertainParameters perform Monte Carlo Simulations to obtain the resultant probability distribution at tstop fixedParameters Inputs H obseredvarables P Number of random samples 100 Show Accumulated Distributions IW Plot the results of every draw r i e 4 4 Integrator Info Copy Call Execute Close Click on Execute The result plots follow Expected Value 2 63908 Expected Value 2 44466 Standard Deviation 0 33264 Standard Deviation 0 184702 1 2 1 2 0 87 0 8 gt E 0 4 3 04 4 8 8 a a 0 0 0 0 4 1 2 3 4 1 6 2 0 2 4 2 8 3 2 J1 w J2 w Expected Value 2 44466 aa Expected Value 2 44398 Standard Deviation 0 184702 ae Standard Deviation 0 184331 1 2 1 2 0 8 0 8 2 a a J z gt oO 0 4 D 8 0 4 a A 0 0 x gt lt 0 07 l 1 6 2 0 2 4 2 8 3 2 1 6 2 0 2 4 2 8 3 2 J3 w J4 w MODEL EXPERIMENTATION 139 Random Distributions available and their parameters The following table reviews briefly the random distributions in Experimentation package that can be used together with MonteCarloAnalysis Probabilit
53. Clutches and exchange components to illustrate various possibilities to provide or conceal information Let us make an encrypted package ConcealedMechanics where we put the components developed First let us just make an identical copy of Modelica Mechanics Rotational Inertia call 1t simply Inertia It is most simply done using New Model to insert 1t into ConcealedMechanics and extending from and extending from Modelica Mechanics Rotational Inertia model Inertia extends Modelica Mechanics Rotational Inertia end Inertia This model will reveal all public components model Inertia 1D rotational component with inertia extends Interfaces Rigid parameter Slunits Inertia J 1 Moment of inertia SIunits AngularVelocity w Absolute angular velocity SIunits AngularAcceleration a Absolute acceleration We could restrict this by putting w and a in a protected section Another approach is to encapsulate the model and design a new interface In Dymola we make a new model extending from Modelica Mechanics Interfaces TwoFlanges We drag in a component of class Modelica Mechanics Rotational Inertia and connect it Inertia 1m L J J To declare a parameter J we select Inertial click the right mouse button select the Parameter alternative and set its parameter J and in the right click menu select Propagate To make the component Inertial protected we once again click the right mouse button select the Attributes alternative a
54. Criteria frac overshoot etme _ setting romina OA E worstO vershoot 0 5 4 2 t Integrator Ey optimizer Plot gt gt gt Info Copy Call Execute Close An optimization will be performed now 1 e after having updated the tuner values using Reset from file for this multi case scenario The objective is to find controller parameter values for Ki Kf Kq such that all criteria are satisfied simultaneously for both cases nominal and worstOvershoot you may execute this optimization task by Commands Run 8 You can see that for both cases a controller parameter set could be determined that satisfies all criteria Kf Ki Kq 2 95319096183149 2 71504063778775 0 7005 19275733324 Again it can be shown that a controller using these parameters is not robust against the uncertainties in the aerodynamic parameters The settling time criterion is not satisfied for the aerodynamic parameters Ma Md Mq Za Zd worstsettlingTime 5 5 6 75 0 63 0 737 0 18 DESIGN OPTIMIZATION 209 210 This set enters the setup as new case worstSettlingTime Another optimization step will be performed we do not forget to update the tuner values and to provide demand values for the new case to determine controller parameter values to simultaneously satisfy all criteria for the three cases nominal worstOvershoot worstSettlingTime you may execute this optimization task by Co
55. Cut Chris cc so Ctrl Paste Ctrl Select All Crri 4 Find Ctrl F a MOE 3 is invoked Goto Line Crri G Expand Highlight Syntax Ctrl L Lonal Reformat Selection Ctri ShiFt L start Comment Selection cart 1 Settings Lona Insert Lonal l l F0 a a SiH Edit Function Call di 25 Ste Lonal Inertia J J 1 a Lonal Clutch clutch peak 1 1 fn m LI IZtJ L _ Line 13 E Modelin Open in This Window Open in Mew Window Syntax checking and highlighting without reformatting can be done by pressing on the Modelica Text button in addition to command Highlight Syntax in the context menu The keyboard shortcut is Ctrl L Syntax is automatically highlighted when you use the Check command It is possible to auto format pretty print a selection using the command Reformat Selection in the context menu or by pressing Ctrl Shift L A command to comment out selected rows is also available in the context menu Support for directly setting level of expansion from the context menu of the Modelica Text layer Expand Hide all annotations Highlight Syntax Show components and connect Settings Show entire text Insert Local packages are by default not shown in the Modelica Text view They can be shown by Expand Expand Local Packages in the context menu It is possible to get a parameter window for a function call in the Modelica text Select a function call up to ending paren
56. Design Acceleration measurements mat Let use use this file instead MODEL CALIBRATION 167 S Design calibrate n 2 lx FE cases 5 Hjseup lt x HA A A K K K X XKXKX K K K K K K K X AXAAAAAAAAX 4 Tuner parameters _ mm Free start values Experiment file jTask Start Time Stop Time 1 calibrate UZ 1e100 1e100 E Calibration data i E inputCouplings FE resultCouplings f calibrate E y Integrator haa Eq Optimizer Select case parameters Info Copy Call Execute Close As previously click on cases Click on the Edit icon of the first element in the Experiment files column A file browser pops up Use it to select the file Program Files Dymola Modelica Library Design Acceleration measurements csv Dymola then pops a menu to select the appropriate matrix E Dymola select matrix Select matrix from file C dev Design Design Calibration Acceleration measurements mat Matrices O Acceleration measurements mat 0 measurments Real 313 4 Click OK E Design Calibration calibrate f calibrate El cases p EEsetup Rows 1 i Tuner parameters a rr Free start values Experiment files 4 Calibration data n Design Calibration Acceleration measurements mat measurments FE cases E EE inputCouplings FE resultCouplings a y Integrator E E3 Optimizer 5 x Select case parameters Info Co
57. Dymola Dynamic Modeling Laboratory User s Manual Dymola 6 Additions Version 6 0 Copyright 1992 2006 by Dynasim AB All rights reserved Dymola is a trademark of Dynasim AB Dymola is a registered trademark of Dynasim AB in Sweden Modelica is a registered trademark of the Modelica Association Dynasim AB Research Park Ideon SE 223 70 Lund Sweden E mail support Dynasim com URL _ http www Dynasim com Phone 46 46 2862500 Fax 46 46 2862501 Contents Recent features in Dimolas anean a E EON 9 Graph caked AP A en 9 Parime A A A e A aAA e O A O E OE E 9 Packo e DIONS rinia A no 15 Component DLOWS bd ide 16 Replaceable COMPONER AS A da 17 COMES 18 MAP O di 19 HATMEd0 comenta a 22 Setna sand OP MONS e O 24 Modelca text coord AA 26 Vanable declarations ida 26 Editor COMTEX MA Rias 28 Oilheroperanons text ias 30 O Se Seoni E A O NA 30 INFOGE ICA langua ida 31 PP A E A E AA A E E E eaeamas ees 31 CONGO MACS LAT AMOS A A E O A E EA SAA A N E dade 32 CHECK ine LOU A Seini EEEE E AAT E OE E A E E ATEA 32 Moiprovements m a noslis a irane ON OP E E AA AA EA A E A AL 34 EyaliatoniO parameters lisis odia men em 34 Dynamics state oleo al dida cia etc 34 SOMO FOF protected yates iio inline enebro lit 35 A A enn ss eres aoe cel eases E A EE beh asta aati AT A E E E A teat A N E E 35 A E E E Er O TA EE EE A 36 Ac AA AA A 36 SIMIO WINGO WS it A A AA A AAA NO 36 Improvements TA interactive TUNCUONS A A aRE 37 Mi
58. ES IN DYMOLA 13 Modelica Data Structures and GUI Modelica Data Structures and GUI In addition to primitive data types Real Integer Boolean and String and from them derived types Modelica has records and arrays We will in this section show how to build graphical user interfaces for models and functions that correspond to these data structuring mechanisms Records and dialogs As an introductory example we will consider making a small data base of personal data Assume that each person is described by the following information record Person String firstName String middlelnitial String lastName Integer number String street Integer zipCode Strang cacy end Person The corresponding automatically constructed GUI dialog for entering data looks as follows MODELICA DATA STRUCTURES AND GUI 17 Records Person Person Inputs first ame E FirstName lastName TO number street ZipCode city Info Copy Call Execute Close The tool tip shows the data type of the input field Entering the following data Records Person Person Inputs first ame loe p middlelnitial Hi p last ame Smith number E d sest O Man Street gt apode 0 FB city fo Ne City Info Copy Call Execute Close and pressing the OK or Execute buttons gives the result in the log window as a call to the record constructor Records Person with the name value pairs for the entered d
59. LinearSystems ZerosAndPoles dataPreprocessing Modelica_LinearSystems Types dataPreprocessing calibrate checkCalibrationSensitivity perturbParameters extends Modelica Icons Function QA sweepParameter sweepT woParameters The left column shows all classes that have been referenced for example in import statements or as the type of a component extends clauses are specially marked The right column show the classs in this package which contain some kind of reference To see what the reference 1s click on the link and view the Modelica text Cross reference options The generation of cross references is controlled by options in File Export Setup HTML Per file Generate cross references to classes in HTML documentation in each HTML file This is typically a subpackage in a larger library Top level Generate cross references to classes in HTML documentation for top level package Because this often is quite large the cross references are stored in a separate file which is liked from the top level HTML file near the end Full name Generate HTML cross references to classes using full name the default When checking consistency of referencing to classes it may be useful to disable this option because inconsistent naming will show up as multiple cross reference entries Encryption in Dymola Introduction There are many closed simulation packages on the market where you are not able to see the details of the models Modeli
60. Number of points for u rv 40 Number of points for w We can select NoTransform Translate RotateX RotateY and RotateZ They are fairly described by their names The most general of the operations is Transform and involves a combination of all the others The dialog window for Transform 1s the following Transform in objects 1 T Transform Description Transform coordinate system by Translate Rotates Rotate Rotated and Scale Translation in direction Translation int direction Translation in 2 direction Rotation angle in degrees Rotation angle in degrees Rotation angle in degrees Scaling ins direction Scaling in direction Scaling in Z direction Here we can describe what we want to do with the object The order 1s important since all these operations are not commutative for instance it is not the same to rotate and translate as to translate and then rotate The order preset is scale first rotate around Z rotate around Y rotate around X and then translate Let us now add the top and bottom of the cylinder Again in the dialog window we change the CylinderShell primitive to the Disk primitive Plot 3D InsertPrimitive InsertFrimitive objects Lo Axes E Rectangle M Box al DiskArc i Sphere m Cylinders hell F ee Cylinder Arron Disk Disk Description Disk surface in x y coordinate plane Inputs T NoT ransformat Transformation of coordinate system
61. Select parameters DESIGN OPTIMIZATION 195 21xi Design Optimization optimize Doptimize Es caseParameters Y setup Description Tuner parameters Mode parameters defining one case e g operating point eacaseParameters 1 caseCriteria O emcase ames unit h demands integrator optimizer a Select Info Copy Call Execute Close The value of alpha c deg 1 of this operating conditions has to be given under cases caseParameters caseCriteria Rows 1 Columns i Ea caseNames F cases ldemands u integrator optimizer Import Load Save Plot gt gt gt Info Copy Cal Execute Close Design Optimization optimize aizi O optimize FE cases V setup Description S luner paramelers case caseParameters matrix defining the different cases alpha_c_deg In the model ControllerDesign F14 criteria blocks from the Design Criteria sublibrary are used to compute how well the controller works see next figure In the F14 model for example the criteria block Criteria MaximumDeviation is used with the component name maximum see figure below Since in the F14 model the maximum block is in a block called criteria and the criterion 1s always the output y from a criteria block the criterion of the maximum deviation is accessed as criteria maximum y 196 Design Optimization optimize F optimize E Y set
62. a Committed revision 2 Command finished It is also possible to view the change log with Version Log The change log contains all messages entered during commit operations svn exe log Decay mo in directory C Dag models re Dace 2OUS l7 15 laz Thu i gt Dee 20057 ql 2 Ames This is the first version of our example Command finished The output from both Status and Log contain information specific to the underlying SVN system which is beyond the scope of this report For non expert users it would be beneficial to filter the raw output Changing an existing model Changing the model follows the same pattern as for the CVS based example above The main difference is that SVN log message are different from those produced by CVS References The primary reference to the CVS version management system 1s e Per Cederqvist et al 1993 Version Management with CVS CVS binaries for several platforms and documentation including Cederqvist et al are available for downloading from the official CVS homepage http www cvshome org The primary source on Subversion is the homepage The SVN command line tools used by Dymola are available here http subversion tigris org Graphical user interfaces to SVN are available for downloading Two of the more popular are TortoiseSVN an extension to Windows Explorer nhttp tortolsesva tigris org and RapidSVN httpi rapidsvn tigris org which is a free s
63. a Drop class Action for dropped class Change type of to Modelica Slunits Inertia O Add class parameter with default Modelica Slunits Inertia Add base type Modelica Slunits Inertia Dymola will then show a declare variable dialog where you can specify name defaults variability parameter constant Declare variable Declaration Type Prefix Annotations Type and name ENEE Modelica Slunits Inertia kd ES oO P Description Modelica parameter Modelica Slunits Inertia J annotation Dialoglenable n gt 1 Type prefix such as final or protected causality and dynamic typing is specified in the second tab Declare variable Declaration Type Prefix Annotations Properties Connector members Causality Dynamic typing flow None Normal protected input inner replaceable output outer Modelica parameter Modelica Slunits Inertia J annotation Dialoglenable n gt 1 In the annotations you can specify the tab and group of parameters and also make the input field conditionally enabled depending on other parameters These are stored as annotations Declare variable Declaration Type Prefix Annotations Evaluate Hide Parameter dialog placement E Graphical information as
64. able 1 2 0 70 carBody v gearBox_lossTable 1 2 0 80 carBody v gearBox_lossTable 1 2 0 90 carBody v gearBox_lossTable 1 2 1 00 m s The velocites are in m s but it is easy to get them in km h Select Plot Setup 2 x Signals Titles Legend Options Range signal name m s PY Minimum kmh Venca o VO Horizontal 38 fe File gearBox lossTable 1 2 0 50 mat Number of data points 504 Select Display to km h The plot becomes now 180 km h lt carBody v gearBox lossTable 1 2 carBody v gearBox_lossTable 1 q carBody v gearBox lossTable 1 2 carBody v gearBox lossTable 1 2 carBody v gearBox_lossTable 1 2 carBody v gearBox_lossTable 1 2 q 4 0 45 5 0 5 5 6 0 Sweep two parameters sweepTwoParameters The function sweepTwoParameters sweeps two tuners and produces a 3D plot of the criterion As an example select the command Calibration with validation of the model Design Calibration Examples SimpleCar Select calibrate at the top in the tree browser click right mouse button and select sweepTwoParameters The menu changes Since we have just two tuners we select the efficieny as sweepVariableX and 11 values in the interval 0 5 1 We select tau_0 as sweepVariableY and 11 values in the interval 200 300 E Design Calibration sweepTwoParameters ax f sweepTwoParameters
65. aes verahtrone Milas e Suitowcus tea E Owe Seubcaauiean Duden hilon E 228 Modo dependencies A N 229 CEOSSAECICR CLIC COP HON Sers nre r ueesceatie asec eens nee ane eee ees 230 Encryption DM it AAA AAA AAN 230 A PP O E AE E AEN 230 Visible and concealed Classes is A E EOR 231 Developine encrypted DOS A A A A AA A AREA 232 Usine enced COMO NiS ngisi EO A I 233 A a a a E T Re NN ae 234 Special annotations Tor concealment ee dla 239 Scrambling in Dymola Recent features in Dymola Recent features in Dymola Dymola is constantly improved in order to better support building browsing simulating debugging and understanding large complex models This chapter describes features that are not yet included in the manual Graphical editor The graphical editor has been improved to better support editing and browsing of large complex models Parameter dialog The parameter dialog automatically gets a scrollbar for any dialog tab that would otherwise be too large for the screen The context menu for a parameter field is also available from a triangular shaped button Gain Edit ae Edit Text DK Copy Default A Propagate Select Class RECENT FEATURES IN DYMOLA 9 10 e The command Copy Default copies the default value to the input field for further editing e A line editor Edit Text is available for long parameter expressions and redeclarations e Command to Propagate a parameter in the context menu fo
66. agement problem and are rare in practice Normally people working on a project do not edit the same code Version management of non model files The discussion of version management is naturally focused on Modelica code but the facilities also handle parameter sets experiments and trajectories in large projects Parameter sets and experiments can be represented by Modelica models In this case the experiment extends from the top level model and provides experiment specific parameters through modifiers of the extends clause An alternative 1s to set up the experiment with a Modelica script file extension mos Trajectories are represented by binary files extension mat Files which are not Modelica text can be stored in hierarchical Modelica packages These files are added to the repository using the Add File command Operations performed on the package will then also operate on the contained mos and mat files Operations 99 66 supported include update commit and status Selecting version management system Dymola supports two version control systems CVS and SVN and generates the appropriate external commands to perform operations on the version control system Which system is used is set in Edit Options Version 217 Setting version management system Location of the CVS command 218 Setup Options Appearance Modelica version Force upgrade of models to this version Version manage
67. amplitude to 1 2 Translation gives the error message Error The parts of Sinel oOutPort signal TF 1inPort signal have incompatible sizes 2 and 1 Errors or failure to expand the equation Sinel outPort signal TF 1inPort signal Errors or failure to expand vector or matrix expressions This error message does not reveal any concealed information In fact the same error message is given also when MytransferFunction is not encrypted MyTransferFunction assumes that the transfer function is proper 1 e the degree of the nominator polynomial is equal to or less than the degree of the denominator polynomial As shown above the parameter a 1 1 If we set b 1 1 1 and translate Dymola issues the error message Error in concealed equation Errors or failure to expand vector or matrix expressions For a non encrypted MyTransferFunction the error message is more informative Error Negative sizes in zeros TF na TF nb 1 The sizes are 1 1 Errors or failure to expand the equation TF y transpose zeros TF na T1F nb 1 1F b TF xldot TF x Found in class MyTransferFunction MyTransferFunction mo at line 78 and used in component TF Errors or failure to expand vector or matrix expressions However such an error message cannot be output for the encrypted version because its reveals concealed information Coupled clutches We will use the example Modelica Mechanics Rotational Examples Coupled
68. an evaluations Number of model time events Number of U time events Number of state events Number of step events Minimum integration stepsize Maximum integration stepsize Maximum integration order 55 seconds O OOGO OG O OLOTO O OAH ON By pressing Ctrl C twice instead of once the simulation is stopped and the user is additionally prompted for further commands Enter command continue c quit q stop non linear with diagnostics s log event le log norm 1n log singular 1s 10g allow singular systems log iterationsnonlinear li log debugnonlinear ld log resultnonlinear lr Logging command syntax log event true log norm false and log norm reset The last three log commands correspond to the setup in Simulation Setup Debug Non linear solver diagnostics iterationsnonlinear Nonlinear iterations debugnonlinear Details resultnonlinear Nonlinear solution To log all subsequent non linear iterations write log iterationsnonlinear true continue To stop the simulation give the command quit instead The quit command generates the same diagnostics as if the non linear system of equations did not converge RECENT FEATURES IN DYMOLA 57 58 Extended diagnostics for stuck simulation When a simulation is stuck or progressing very slowly it is important to provide some form of simple diagnostics As an example consider the following example model StuckSimulation Real x start 0 5 equation de
69. another way It means that the set of intrinsic unknowns of an algebraic loop is well defined In order to obtain efficient simulation it is very important to reduce the size of the problem sent to a numerical solver Dymola uses a tearing approach to eliminate variables The numerical solver is only made aware of the remaining variables the iteration variables call them z A numerical solver provides values for the z variables and would like to have the residuals of the remaining equations calculated The tearing procedure has produced a sequence of assignments to calculate the eliminated variables v assuming z to be known The start values of the eliminated variables have no influence at all An aim is of course to make the number of components of z as small as possible It is a hard NP complete problem to find the minimum However there are fast heuristic approaches to finding good partitions of the unknowns into v and z In order to get good start values for the numerical solver Dymola tries first to eliminate variable with less reliable start values As for usual or iteration variables of nonlinear system of equations the plot browser provides support for setting start values interactively If the start value of the unknown is bound to a parameter expression then setting any of the parameters appearing in the expression will of course influence the start value If no start value 1s given or if it 1s a literal RECENT FEATURES IN DYMOLA
70. arameters Top level parameter records are handled in the same way as simple top level parameters they are not evaluated when you specify that parameters should be evaluated The simulation menu also allows a global setting for evaluating parameters and dynamics state selection Model translation Evaluate parameters to reduce models improves simulation speed Use new state selection can give dynamic choices It is also possible to specify Evaluate selectively for a parameter e annotation Evaluate true forces evaluation if value provided e annotation Evaluate false overrides the flag Evaluate Top level packages may contain an annotation of the form annotation Settings Evaluate true If a model uses anything from that package Dymola automatically uses Evaluate true Dynamics state selection Dymola has a new state selection algorithm that may cause dynamic state selection Top level packages may contain an annotation of the form annotation Settings NewStateSelection true If a model uses anything from that package Dymola automatically uses NewStateSelection true Since Modelica 2 2 has this annotation nearly all models will automatically use the new state selection and may thus cause dynamic state selection Storing of protected variables It 1s possible to prevent storing protected and hidden variables during simulation Not storing protected variables makes it easier to find the relevant information but in some case
71. are made at full throttle to give maximum acceleration It means for example that the tires are slipping say 4 which of course is increasing the losses It is very easy to add new tuners Just click Select parameters and select new parameters By changing active from true to false or vise versa it is easy to experiment with different set of tuners Having a parameter as an inactive turner is a good way to set a parameter to have a value different from the value given by the model Validation using measurements from first gear It is recommended to validate against other measuremnts Unfortunately we do not have another measurement series in this case but for validation we can use the data from the time interval where first gear is used We do this by specifying another case Click on cases Design Calibration calibrate H 2 Tuner parameters rr Free start values Calibration data pod cases E inputCouplings E EE resultCouplings Put the cursor in the input field for Row and hit the uparrow keyboard button once to increase the value by one You may also use the up arrow of Rows to increase Rows to 2 Design Calibration calibrate H 2 Tuner parameters rr Free start values Calibration data EE inputCouplings E EE resultCouplings As previosly use the Edit button of Experiment files to select experiment file You can also copy and paste the file name Enter the values for sta
72. as well as the remaining traditional methods described in the dymosim chapter of the manual support the entire range of events present in Modelica models 1 e state events time events and dynamic state selection The table below gives their characteristics the combo box contains the same information Method Stitt Radau Ha E Esdirk23a Esdirk34a Esdirk45a Dopri45 Dopri853 Sdirk34hw Cerk34 Cerk45 Variable or adaptive step size implies that the algorithm adapts the step size to meet a local error criterion based on the tolerance One step or Runge Kutta methods are basically designed such that they start fresh on every step and thus the cost of restarting them after an event is substantially reduced compared to multi step methods such as lsodar implementing Adams methods and dassl implementing BDF methods However even if the methods are one step methods the implementation often uses more information from the previous step Fixed order mean that you manually select the method including order where higher order should be used for stricter tolerance instead of the solver automatically adapting the order as for lsodar and dass Dense output implies that the method can handle state events efficiently and also produce evenly spaced output The dense output has traditionally been added as an afterthought to the methods Good exceptions are the cerk methods where the method coefficients were optimized including the
73. asic CVS and SVN commands where the principal automatic step is to provide the correct file name in which the model the user 1s located The primary commands in CVS terminology are Update Updates your local copy of the file with changes from the repository If your file has been changed since it was last updated your changes are merged with the changes made to the repository After a successful update the file is reloaded into Dymola If conflicts arise during the merge this 1s noted in the message window and the file is not reloaded into Dymola See Query Update for an explanation of the status code displayed in the message window Commit Updates the repository with changes you have made in your local file Your file is first checked to make sure that you have an up to date copy You are then asked to enter a description of the changes which is later available through the Log command Add Model Makes a new model s file known to the underlying version management system The user must then perform a Commit on the model 215 216 Add File Makes an arbitrary file known to the version management system The user must select the file using a file browser Diff Displays the textual differences between your local file and the corresponding version in the repository Query Update Displays which files in the model s directory are e Locally modified compared to the corresponding version in the repository marked
74. asily the functions and delimit the intersection area Plot3D plotSurface plotSurface ese plotSuraces coordinateSystem plotSurfaces Rows 2 plotD ata yectorField styleD ata 1 PotD ata x x1 y y1 2 21 nx nx1 ny ny1 nz n21 JataSurface 0 255 0 0 2 PlotDatalx x2 y y2 z 22 S ES sSurtace 0 255 170 85 VISUALIZE 3D 115 116 One possibility 1s to have different colors for the surfaces The intersection of the parabolic surface and the hyperbolic surface with different colors will look as follows Visualizer 1 Combining different styles we can obtain the following graph Visualizer 1 The contour lines in the parabolic surface red are used to illustrate that the intersection does not happen on a plane The black color corresponds to the level z 1 5 and the white color corresponds to the level z 1 We can add a pointer to show where the maximum of the red surface occurs Using the function Plot3D insertPointer directly on the last image we can add text and an arrow The resulting figure follows Visualizer 1 To plot discrete data the alternative 1s to use plotStem function This function considers each point by itself and puts a triangle square or circle at the data point and adds a line from the point to the plane XY We plot here down as example the amplitude or absolute value of the discrete Fourier Transform of a pulse Putting these values
75. ass in New Window Show Variables Attributes Info FLA ELE o i r i il i gies ia tt When double clicking on a component or selecting Parameters in the context menu the parameter dialog is displayed Jutches Re Of xj CoupledClutches Modelica Mechanics Rotational Examples Coupled File Edit Simulation Plot Animation Commands Window Help jer QS gt SA Blo ie vota laar HOH XA O x Variables Yaga lolx Eldsres 1 al freqHz Diagram OT2 is Ts J4 in Modelica Mechanics R otational Examples Couple 2 x Ehorqu E clute Elsin Hstepl Hd Comment PO clube 3 Fe clute Path Modelica Mechanics Rotational Inertia E 7 Comment 10 rotational component with inertia 0 Parameters Efla J 1 kgm2 Moment of inertia flar O e a Info Close a Advanced E Modeling 4 Simulation Changing parameters in the parameters dialog does not always require a new translation 1t is still necessary if the modifier is too complex the parameter had been evaluated during translation or if parameters of a different model were changed The model is changed and you will be asked to save it when exiting Dymola To use this for top level parameter see section The graphical editor has been improved to better support editing and browsing of large complex models Parameter dialog on page 9 Improved experiment setup The experiment
76. at the dymosim process is terminated in a nice way if possible even for larger examples New integration algorithms In Dymola a new set of integration algorithms has been added We will here present the algorithms and their advantages in order to allow you make a better choice both between them and compared to the traditional ones The main user benefit is better restart after events the addition of non stiff integrators with variable step size and solvers better suited for badly damped stiff systems 1 e with poles close to the imaginary axis The new algorithms are included in the integrator setup making it straightforward to switch between the traditional dymosim integrators and the new ones marked with order and the methods applicable to stiff systems are marked with stiff the first one is Radau Integration Algorithm Radau lla order 5 stiff Tolerance Feed Integrator Step Radau lla order 5 stiff Esdirk 3a order 3 stiff Esdirk34a order 4 stiff Esdirk45a order 5 stiff Dopri45 order 5 Changing between the new solvers and the normal solvers will cause a recompilation but not a complete retranslation Linearizing a model will use the dymosim solvers and might thus cause a recompilation For a user this implies that one should preferably select the integration algorithm before pressing Translate or start by pressing Simulate Overview of the new algorithms The new algorithms
77. ata Records Person firstName Joe middlelnitial M lastName Smith number 123 street Main Street ZipCode 45678 city New City If we would not fill in any value for middleInitial the following error message would be generated No Value Given Must supply value For argument middlelInitial To avoid having to give such data a default value can be given in the declaration 6699 String middleInitial Modelica allows you to add description strings to all variables record Person2 String firstName First name String middlelnitial Optional middle initial String lastName Last name Integer number House number String street Street name Integer zipCode Zip code String city City name end Person2 These are used to annotate the dialog as shown below MODELICA DATA STRUCTURES AND GUI 79 80 Records Person Persone Inputs first ame Joe p First name middlel nitial to Optional middle initial laztH ame Smith amp Last name number a t House number street fo ain Street to Street name apLode ABRA ko ip code city fo City City name Info Copy Call Execute Close Tabs and Groups It 1s possible to annotate input fields in various ways in order to simplify for the user to enter data It 1s for example possible to group record fields together and introduce tabs in the dialog by means of annotations Records Person3
78. aximum values and number of points and click OK Click Execute The result is plots of the result variables which in this case is the acceleration As expected higher efficiency gives higher acceleration miss carBody der v gearBox lossTable 1 carBody deriv gearBox lossTable 1 carBody der v gearBox lossTable 1 carBody der w gearBox lossTable 1 carBody der v gearBox lossTable 1 lt carBody deriv gearBox lossTable 1 D he he hg he da There 1s also a corresponding plot for the validation case Moreover all results of the simulations are available for access in the plot browser 178 Plot and initialization igearBoxlossTable 1 2 0 60 2 igearBox loss Table 1 2 0 03 igearBox loss Table 1 2 0 80 4 figea rBox lossTable 1 2 0 90 5 igearBox lossTable 1 2 1 006 It means that all Dymola s plotting facilities can be used to produce other plots from the sweep It is for example easy to get a similar plot with the velocity of the car Click on Advanced and tick Compare results Then select carBody v Plot and initialization EicarBody Hiflange_a iflange_b Oa Dder s Oder v cardaninertia Y Original Difference W Compare Results Search Filter Time and the plot becomes MODEL CALIBRATION 179 carBody v gearBox lossTable 1 2 0 50 carBody v gearBox_lossTable 1 2 0 60 carBody v gearBox_lossT
79. bar linkage LtMacPherson suspension with bushings and a simplfied anti roll bar D Steerable suspension without geometry Camber and toe are give as functions of bounce D MacPherson suspension with ideal joints Lt Double wish bone arm suspension with ideal joints Double wish bone A arm suspension with an onboard belle ville to decouple suspension and anti roll characteristics Lt Double wish bone A a suspension with onboard mounted struts It is possible to set that all choices generated by choicesAllMatching and choicesFromPackage are replaceable Advanced AutomaticChoicesAreReplaceable true Parameter dialog for inherited parameters Parameter dialog also for inherited parameters of the shown model This is in the context menu in diagrams 1f no component is selected Show Redeclared This also enabled at root model provided the model solely extend from other models and contain no declarations of its own For instance if extending from Modelica Mechanics Rotational Examples CoupledClutches RECENT FEATURES IN DYMOLA 13 14 l in HyCoupled zx con MyConpled xample Path MyCoupled Comment fregHz l He frequency of sine function to invoke clutch T2 Pos time when clutch ts invoked Ta J3 ezo time when clutcha ts invoked OF Cancel Semantics Parameter changes of the root model are stored as modifiers on the corresponding extends clause s Parameter changes
80. bles or after enabling non graphical components in the Component browser using the Parameters from the context menu Specialized GUI widgets Declarations of variables can be annotated to provide a convenient user interface for example to select models or to open files These annotations are typically used to give inputs to functions or for creating records The dialog is annotated with edit buttons Examples FileData FileD ata Inputs matFile csyFile Given the appropriate type definitions see below such a record is very easy to declare record FileData Examples TranslatedModel translateModel Examples FileName fileName Examples FileNameOut savefile Examples MatFileName matFile Examples CsvFileName csvFile end FileData A string type that presents a dialog for selecting a model 1s declared as follows type TranslatedModel String annotation Dialog translatedModel Pressing the edit button for such function argument displays this dialog Select model Packages El J Design J Calibration E Examples SimpleLar J Utilities E E Internal E3 Experimentation The following declarations use annotations to display different kinds of file dialogs The first one gets a filename for reading a file type FileName String annotation Dialog loadSelector filter Matlab files mat CSV files csv caption Open experiment data file The second one get a filename for wr
81. browser and can be plotted in the usual way E Dymola Dynamic Modeling Laboratory lala File Edit Simulation Plot Animation Commands Window Help sue e sj Jie vou giSSR OO8 gt 1 nao PE Acceleration measurements 1 acc oO speed E dist 6 4 2 0 0 1 2 3 4 5 6 Vehicle model The model we are going to build is available as Design Calibration Example SimpleCar Useful modeling components are found in Modelica Mechanics Rotational Modelica Mechanics Translational MODEL CALIBRATION 159 160 Te 17 finalDriveGear 3 46 engine Torque e J cardanlnertia x a g ae _ a en 1 lt 4 ETE o w heellnertias O m i A YZVV carBody a de Mi a Leow w heel 1 R To the left there 1s the engine driving the gearbox which 1s connected to the cardan system giving a final drive to the four wheels The rotational motion of the wheels results in a translational motion of the car Let R be the wheel radius then 1 R gives the ratio between the driving rotational motion and the resulting translational motion where R is the wheel radius The model defines parameter Real R 0 34 and binds the parameter wheel ratio 1 R Setting of parameters are indicated by the diagram Additionally the mass of the car carBody m is set to 1690 70 50 kg to include the weight of the driver and measurement equipment The quadratic torque characteristics at full throttle is modeled by extending from Modelica Mechanic
82. by M before the filename e Changed in the repository compared to the version that was checked out U or P e Caused a conflict during an Update operation or which could potentially create a conflict because it is both locally modified and changed in the repository C e Added but not yet commited A e Unknown to the version management system Local files are not updated The repository is not changed Status Displays version status of the file The information includes e Ifthe file is up to date needs an Update or has been locally changed e Revision of your local file and the repository file e A list of all symbolic tags and which revisions they refer to Log Displays log messages which were entered every time the file was committed and a list of all symbolic tags and which revisions they refer to Revert Deletes your local file and retrieves the latest version from the repository All changes to your local file are lost All version management systems operate on files An environment which would allow version management of individual models even when several models are stored in the same file could be implemented on top of external tools but would be quite complex However Dymola can easily map from model to the corresponding filename and also knows when a model is part of a larger package comprising several files in which case updates probably should be made on al
83. can be found in C dymola work Inertia3 moe The scrambling indicate which variables should be kept and include a tag before the variable to explain why Users can examine the Inertia3 tmp mo file to verify that the no vital information is present model Inertia3 encapsulated connector r0 Real phi unit rad Absolute rotation angle of flange flow Real tau unit N m Cut torque in the flange annotation Hide true Coordsys extent 100 100 100 100 grid 2 2 component 20 20 Icon Rectangle extent 100 1005 100 00s sty beteolLor 0 taLicolor LOVI Ta end r0 r0 flange_a annotation extent 110 10 90 10 encapsulated connector rl Real phi unit rad Absolute rotation angle of flange flow Real tau unit N m Cut torque in the flange annotation Hide true Coordsys extent 100 100 100 100 grid 2 2 component 20 20 Icon Rectangle extent 100 00 LOO 001 SEYyLetcolor 07 ELLLCOIOr TIIE end rl rl flange_b annotation extent 90 10 110 10 parameter Real r unit m 1 Radius 241 242 protected Real z1 Real 22 anotar 1on Cco rdsys extene 100 100 100 TOO grad 2 2 component 20 20 Documentation info lt html gt An inertia of a certain shape with settable radius lt OL gt protected equation flange_a phi zl flange_b phi zl z2 der z1 0 0416666666666667 r 2 der z2 flange_a tautflange_b tau en
84. d GL Trwid OCS ec te a eld crac oes bale et ate a ald ete ie hae 88 Check SO APUESTA Oe Ne Ta E 89 PTT AY SOT CORO GY 05 npn clei aiit toll elie ali ys e a ida 91 AAA sundae dieaacaisdsantantuacbaasteetatealaaentas 95 tod aos 95 TASA and removing aos eL 97 BASIC PUES iia eii 106 o ON 109 Model Experimental ssnin E 121 A 121 NAMED AA O A 122 Case Study Couple d lutches Moll titi 122 Permi b para mere Sarron a oE A AA 123 Sweep One Param ter TWO YATES id a a a l E 128 DW ECD LWO Para MEGI S o e EA E aeswae 132 Mome Carlo Amalia E E N E 134 Data PEC POC CS SIMO nes ada did 142 SEU Up TOL PECPLOC CSS NM A e arcane e dd 142 Limina and detrendme S18 al S is 146 Analy sine renal 1S heresdtly NOISE Penaia a TE N A Pend EAA EE ete Pees ee we 148 IPG INO RO 150 INO GED CAND EATION ii tad 155 TEE O UOT sie obese PPP eo un A 155 The basics of setting up and executing a calibration task oooooonnnnnonooooonononooonn nono nn nnnnnononnnnnnn ono nono nono nonononnnnnos 156 O A O EANES 157 Ve nc MOI stan E E ES 159 Validation On Henomnal Mode A AAA AAA A AA aos esa 161 Measurement o OMS AA A 167 O A N In A E 169 A A O A A O AET ANI A EEE AE 171 A A II E 172 Validation using measurements froni Tirst CAL it lis 173 MESAS oye A 016 commence nen ae ome tenner ee A eU ten CTE TOMS rt Ue ree nC MOT neta Ot 174 A sa etcetera Pune EE wee nds eae mela dad dieses ae naa 175 Reusino a Setup for ASI Thal Ol CPA OLN 3 tl 176 Analysing parame
85. d Inertia3 As can be seen the mass and shape have been constant evaluated making 1t impossible to determine their individual values In addition the names of all internal variables are replaced by scrambled names if the variable is preserved at all The encrypted file only contains this information but is in addition encrypted Encryption prevents disclosure of even the scrambled information and also makes the model read only
86. d also other conversions has been substantially improved e See separate document for more information e Sources with vector arguments automatically converted to array of components e Automatic save a script for conversion of models using the converted package when converting a package with its own version number e Can convert a inPort signal 1 toa u anda inPort signal to a u e The conversion script for Modelica 2 2 has been improved LAPACK library for GCC and Visual C required by packages Matrices and Sampled Installation and setup of Dymola 72 Dymola can be installed in directories with spaces for example Program Files If the default working directory dymola work is not writeable for the current user Dymola will instead start in the directory Dymola in the user s My documents folder the Dymola subdirectory will be created if it does not exist Please note that this cannot be an UNC path i e server If dymola tmp is not writeable for the current user Matlab Simulink compilation will still work but all files will be recompiled In combination with the change for compiler setup this means that users do not need write access to the Dymola installation directory The Dymola 6 executable is now called dymola exe and the version number is removed from several files including this one The Simulink interface starts Dymola 6 The setup for compilers has been redesigned and more com
87. d by Dymola has been improved in several ways e Dymola can generate a table of contents for packages connectors and connectors in models with small icons e Improved parameter tables for generated HTML tables for function inputs and outputs and type column in parameter tables e Ifthe diagram layer is in Show redeclared mode the generated diagrams and icons are also shown redeclared e Hyperlinks using Modelica Package Class are supported Such links makes it easy to reference Modelica classes in the documentation used for example in the new MultiBody library e Protected classes are not included if not shown in package browser e Empty pictures removed The control over HTML generation File Export Setup HTML has been extended with more options e Automatically generate table of classes with description for every package e Can set if revisions shall be included not included or included at top level e Control if types and default values are included e Switch to insert lines between classes e Page break can be inserted before each class HTML Options Class contents Parameters Equations and components Diagram images Icon images Filename Syntax highlighting Link to types Absolute links allowed Page break before class Horizontal rule before class Table of contents in package Icons in table of contents Include tyoe for parameters Include default for parameters Includes types and constants
88. d by linear interpolation Now we choose Line y a x b in the combo box Detrend signal This will fit in least squares sense a Straight line and subtract it form the data Design Calibration dataP reprocessing dataPreprocessing Preprocessingsignal signals Sa Inputs i 1gnal 1 Signal Hame minimum Bound Signal minimum time maximum time Detrend signal Filter Frequencyanalyeis Line y a b Info Copy Call Execute Close MODEL EXPERIMENTATION 147 Press Execute and the result follows Time We observe the resulting curve The other possibility for detrending is Mean Value that subtracts the mean value of the function Reset the values of the limits and set detrending to None We are now into frequency analysis and filtering of signals Analysing Signals is there any noise Let us analyse the function in the frequency domain The point now is to filter out noise Such a noisy perturbation is normally easy to get in the measured data and complicates later on the calibration process unnecessary Select Fourier from the combo box of FrequencyAnalysis 148 Design Calibration dataP reprocessing dataFreprocessing Preproces ing51gnal signals 1n Inputs gignals 1 Signal Name minimum Bound Signal masimum Bound Signal minimum time masimum time Detrend signal Filter Frequencyanalysis Mo Analysis Fourie
89. d offset defineDefaultDisplayUnit Pa MPa use MPa by default The set of common unit conversions which are used by default can be found in dymola insert displayunit mos Additional US unit conversions are defined in dymola insert displayunit_us mos which are used by default can be changed in dymola insert dymola mos Other plotting The command plotArray which is used to plot data computed in functions or scripts has been extended with new parameters xo o ales S yo ales SS style 0 Style of plotting default automatic legend Legend describing plotted data default none cid O Identity of window default 0 means last The resolution has been improved for plotted variables which are copied to clipboard with File Export To Clipboard or printed on high resolution printers Some programs for example Microsoft Word 97 may have problems when high resolution plots are pasted We suggest using Edit Paste Special and selecting Enhanced Metafile Format It is possible to set the resolution for high resolution printing or export to clipboard The variable is called Advanced ClipboardResolution default is 600 dpi It is also possible to export low resolution plots in Dymola by setting Advanced PrintLowRes true this will print and copy the plot window using screen resolution which is compatible with earlier versions of Dymola Derivative variables look smoother in plots Plotting of derivative variables when usin
90. deWithAliasVariables true the last part of the listing becomes Eliminated alias variables RZ ssa gt eds RECENT FEATURES IN DYMOLA 45 46 RI1 i C n i R2 n v L v RlsDaL Cholo R2 n i L i L p v Lav Vaeni Veepei Rl n i C n i C i C n i R2 i L i Bl MV C v RI pv R22pev Vs v R2 p v C p v CV Vout Vesper CeO Coiu Ts L p i L i Vs p v R2 p v Vs signalSource y R2 p v L n i L i Two resistors connected in series Consider a simple electric circuit with two resistors connected in series R1 R2 G After elimination of alias variables the problem has a linear algebraic loop with three unknowns Dymola solves this symbolically as seen from the following excerpt from the dsmodel mof Linear system of equations ff Symbolic solution Original equation R1 R R1 i R1 v e R1 1 Vs v R1L R R2 R Torn part R2 v R2 R R1 i Rilav Vs v R2 v End of linear system of equations The equation Roel f Vsu7 RI RIR2 R reveals that the resistance of two resistors connected in series is the sum of the resistances of the two resistors Dymola discovered this law automatically A simple resistor network Consider a simple resistor network After elimination of alias variables the problem has a linear algebraic loop with five unknowns Dymola reduces it to a linear problem with two unknowns as seen from the followin
91. declared in the current class you can only browse for replacements desiredVelocity controller feedback load zm A T Parameters T uration Show Component A Open Class in New Window gt Attributes 3 Change class E Lepeletier wheelset for 6 speed automatic gearbox Extended Simpson wheelset for 4 speed automatic gearbox Info The parameter dialog shows the parameter dialog of the redeclared class above for Lepellitier instead of the original class The text and info layers show the text of the redeclared class When changing class of a component dragging the new class from package browser and dropping it on the component in the component browser and modifiers or connections no longer match you will be asked to confirm the change and in that case they are automatically removed Dymola Change class Changing the class wil remove the modifiers R_ref Changing the class will remove connections connect HeatingResistor1 heatPort heatPort1 RECENT FEATURES IN DYMOLA 17 18 Connections Dymola has support for expandable connectors as defined in Modelica Language version 2 2 Connecting two expandable connectors gives a dialog as shown below and components of expandable connectors are automatically treated as connectors connect b1 b2 x Connectto component of expandable connector by selecting sub components below expandable connector b expandable co
92. dense output RECENT FEATURES IN DYMOLA 61 62 Most of the solvers are stiff solvers indicating that they are suited for stiff systems 1 e systems where the fastest time scale in the model is substantially faster than the interesting dynamics The new stiff algorithms are also designed to be A stable i e stable for all stable linear systems This means that the methods are better suited for badly damped stiff systems i e with poles close to the imaginary axis Furthermore since they start with higher order they are more suited for systems with discontinuities or events Analytic Jacobians For non linear systems of equations it 1s possible to avoid numeric Jacobians and instead rely on Dymola to automatically differentiate the functions Compared to writing derivative functions this is much easier for the modeler easier to understand for the user and also considerably less error prone In order to enable Dymola s automatic differentiation feature the modeler writing functions must declare the smoothness of the function by providing a smoothOrder annotation corresponding to the smooth operator in Modelica A basic limitation of automatic differentiation is that it can provide a derivative even at points where the function does not have a derivative Verifying that a function with branches if statements 1f expressions or while statements is continuous is a difficult problem The person providing the smoothOrder annotation is gua
93. e Setup the SVN repository with initial directories and check it out This is described above Creating a new model We can start by creating a model in Dymola and saving it in the models directory For our example we will use the simple model model Decay Real x start 2 equation ASP X end Decay Initially the model is unknown to the version management system For example a Version Status command returns this information svn exe status Decay mo in directory C Dag models Decay mo Command finished Next we perform the Version Add Model command to make the model s file known to the version management system svn exe add Decay mo in directory C Dag models A Decay mo Command finished We can now perform a Version Query Update command to get some more information svn exe status verbose show updates in directory C Dag models A 0 2 Decay mo 1 1 Dag Status against revision 1 Command finished When we perform Version Commit the user is asked to enter a log message describing what changes are committed The lines at the end are generated by SVN to help us remember which file is committed 227 228 This is the first version of our example This line and those below will be ignored A Decay mo The message after the commit operation has finished looks like this svn exe commit Decay mo in directory E Dag model s Adding Decay mo Transmitting file dat
94. e svn The SVn documentation suggests that you populate the repository with three directories called branches tags and trunks The easiest way to do that is to create these directories locally and then import them mkdir models cd models mkdir branches mkdir tags mkdir trunk sie aa svn import models file svn models m Initial import SVN will report that it has imported the directories as revision 1 It is worth noting that SVN manages directories as well as files whereas CVS only manages files directly and implicitly creates directories as needed These steps complete the initialization of the SVN repository Remove the local models directory to start over rmdir S models To use a SVN repository it is necessary to initially perform a checkout operation to create a local copy with files that can be modified svn checkout file svn models trunk models This command creates a models sub directory with all models currently stored in the corresponding top level directory in the SVN repository It also creates extra directories called svn at each level which are used to maintain SVN status information The files inside the svn directories should never be manipulated by hand An example of file management using SVN In this example we will demonstrate the basic version management operations provided by Dymola The example shows the first steps from the CVS based example abov
95. e Dialog annotation descriptionLabel true is given The description string is then not shown after the input field A label with free text can be given by label free text The free text label has precedence over the description label The width of the inputs fields can be specified as for example naturalWidth 10 The width is given in the unit en the width of character 0 The width can also be specified as absoluteWidth 10 The difference is that fields with absoluteWidth keep their size when the entire dialog is made wider The fields with naturalWidth specification are made wider By use of these annotations we can make the dialog much nicer Records Person4 Person4 Properties Mame First name PO Middle initial ns Last name Address Number Street name Postal code Po City name Info Copy Call Execute Close The details of the record declaration is given below record Person4 String firstName First name annotation Dialog group Name joinNext true naturalWidth 15 descriptionLabel true String midalel nitial Middle initial annotation Dialog group Name joinNext true absoluteWidth 3 descriptionlabel true String lastName Last name annotation Dialog group Name naturalWidth 25 descriptionLabel true Integer number Number annotation Dialog group Address joinNext true absoluteWidth 10 descriptionLabel true String street Street name
96. e an experiment file click on the Edit icon of the first element in the Experiment files column A file browser pops up Use it to select the file Program Files Dymola Modelica Library Design Acceleration measurements csv ax fF calibrate FE cases setup Roms Tuner parameters em Free start values Experiment files s Calibration data Design Examples Acceleration measurements csv E lel ae cases EE inputCouplings oe EE resultCouplings a y t Integrator Es Eq Optimizer Select case parameters Info Copy Call Execute Close If we had had more measurement files we had increased the number of rows and selected more measurement files In this case the measurements are stored in a csv file as described above Dymola supports some common ways of storing measurements see further below An advanced user can replace the calibration data input with a routine accessing data in different formats without having to change the underlying calibration routines The different cases may need individual parameter settings or individual initial values for some of the states Recall that we are to use the measurements from the time interval 3 8 6 seconds when second gear is engaged Thus we need to use the gear ratio of the second gear and an initial velocity To enter this information click on Select case parameters Use the browser to select gearBox 1 and carBody v MODEL CALIBRATION
97. e now interested in a few matrix T length color style colorInterpolationDirection and colorIntensity Change colorInterpolationDirection to x direction and press execute once more CylinderShell EE Colindershell Description Cylinder surface Inputs T MoTransformation 4 length width height color color style Fill 3 1 1 E2 colorlnterpolationDirectiorn specularColor Hone specularE sponent e direction t direction Z direction ry rfl ri mi Transformation of coordinate systern for graphical object Length extent of graphical primitive m Width estent of graphical primitive mi Height estent of graphical primitive Color of graphical primitive Secondary color of graphical primitive Style of plotting Color interpolation direction Intensity color Specular color of material 0 0 1 0 Specular exponent shininess 0 0 128 0 Number of points hor u Number of points hor w Press control key and move the mouse The change is that Visualize3D interpolates the color using the range of the x coordinate of the primitive Visualizer 1 Changing the colorIntensity parameter it is possible to set the brightness of the color scheme applied This factor 1s to be in the interval 0 1 Below we find depicted the cylinder shell for intensityColor 0 0 5 and 1 Visualizer 1 DER Visualizer 1 Visualizer 1 QQQ Remember that we are adding primitives this means that if
98. eased in industry over several years More recent is open source development which can be described as the loosely organized development typically of software by several geographically separated parties Public websites such as SourceForge support Open Source development with web based tools and CVS SVN The Modelica Standard Library is maintained as a project on a server Scope of implementation This is a description of minimal support for version management in Dymola The strategy is to provide a relatively thin layer on top of an existing version management system such as CVS Concurrent Versions System or SVN subversion The added value for the user compared to using existing graphical user interfaces e g WinCVS or TortoiseSVN is e Commands are integrated in the Dymola environment No need to swap between different applications Some information is easily accessible in Dymola e g version number and date e Some steps have been automated For example Dymola knows the filename of the current class knows 1f there are files which have been modified etc e Files are automatically reloaded into Dymola after updates from the repository However there is no need to provide a comprehensive version management environment in Dymola More complex tasks are better performed in specialized tool such as WinCVS TortoiseCVS TortoiseSVN or RapidSVN Supported features Dymola provides a graphical user interface to the most b
99. ed The Version Query Update command is used to quickly list which files have been locally modified indicated by M or need to be updated from the repository U C util dymola bin cvs exe qn update in directory C dev Proj DymolaQt models M Decay mo Command finished The Version Query Update command does not operate only on the file of the model Instead it operates on the entire directory and all sub directories this makes it particularly useful to concisely review the status of all files in a complex model hierarchy The model is then committed to the repository with Version Commit as shown above If we review the log with Version Log we see that the new revision comment is also listed The listing also shows the number of changed Modelica text lines C util dymola bin cvs exe log Decay mo in directory C dev Proj DymolaQt models RCS file cvs models Decay mo v Working file Decay mo head 1 2 branch LOCKS Ser LCt access list symbolic names keyword substitution kv total revisions 2 selected revisions 2 description revision 1 2 date 2005 10 04 09 44 57 author Dag state Exp lines e ml Added time constant Ti revision 1 1 date 2005 10 04 09 34 02 author Dag states Exp This is the first version of our test example Command finished This concludes the demonstration of how models are edited in co operation with the version management facilities in Dymola
100. ed Set mean to 1 and standard deviation to 0 1 MODEL EXPERIMENTATION 135 randomHNormal Distributions F EJ random oral Inputs Mean value lr Click OK Repeat the same process for J2 J to J4 J Design Experimentation MonteCarloAnalysis fF MonteCarlo4nalysis uncertainParameters El H setup Description H uncertainParameters Model parameters to be calibrated pa fisedParameterz Le observedVariables Pows a E megata Random Distibuton P randonormal 7 12100 randormMormall 1e1000 4 randomNormall ECU EE Ardo Z el Select Info Copy Call Execute Cloze The setup for fixedParameters is used if we want to specify other simulation situations than the nominal values written in the model For instance if the initial angle J1 phi is specified and different from zero we should add it there In our case we don t have such fixed parameters so we just go directly to observed variables Click on observedVariables and press the button Select observed variables Mark in the browser J1 w J2 w J3 w and J4 w Design Experimentation MonteCarloAnalysis 1 MonteCarlo nales s observed arables E EH setup Description H uncertainParameters Observed Variable of the random experiment p fixedParameters observed ariables t dc Observed variable 1 Sw FO 0 2 true oF ANNO 0 ue oF ANO 0 ANO 0 Select observed variables Info Copy Call E
101. ed ExtendedStructuralCheck false If a model is found to be singular at translation the components are checked recursively This can be be disabled by setting the flag Advanced ExtendedStructuralDiagnosis false Connectors that are neither physical matched flow and non flow nor causal will assume a suitable number of external conditions on them If this corrects the problem no recursive check is performed Models that by design are non partial and structurally singular can use the annotation structurallyIncomplete This has been added to e g Modelica Blocks Math TwoInputs and to the base classes of MediaModels Component models of partial classes inhibit the structural check RECENT FEATURES IN DYMOLA 33 34 Improvements in diagnostics Error messages for type errors are grouped together and start by giving the variable or equation that caused the error The error messages contain links to the text of classes Assertions are evaluated early to improve diagnostics and thus allow an assertion to guard against a structural error The translation log now also includes statistics for the initialization problem Improved diagnostics for nonlinear system of equations e Warnings are output for variables to be solved by a nonlinear solver but not having an explicit start value e The start values for all iteration variables can be logged by setting the flag Advanced LogStartValuesForiIterationVariables true Evaluation of p
102. ed in package browser e Constants are shown in the browser the tool tip gives the value e Changed handling of clicking in the package browser There is a switch to control browser behavior Advanced SingleClickOpensTree 0 no open on single click 1 toggle open 2 only open default 2 Component browser It 1s possible to drag classes from the package browser and drop them into the component browser This allows you to e Change type of declarations by dropping on top of the component name e Declare new variables see also Variable declarations e Declare new class parameters e Add new base class When something is dropped in the component browser the following dialog is shown Dymola Drop class Action for dropped class Change type of to Modelica Slunits nertia Add class parameter with default Modelica Slunits Inertia Add base type Modelica Slunits Inertia The type of a component is shown as tool tip if you rest the cursor over it Components Modelica Mechanics Rotational E ampl Example Modelica lcons Example E to Modelica Mechanics Rotational Inertia 2 clon Replaceable components It is possible to change class of replaceable component using the context menu for the component The menu shows a list of matching choices where the icon of the current choice is shown depressed Selecting the menu choice Browse displays a normal class browser If the component is
103. efined as minimum default 1 e the optimization task is to solve the min max problem min max c1 d1 c2 d2 c3 d3 c4 d4 over Kf Ki Kq A solution for the controller parameters Kf Ki Kq was found 4 25146525932043 4 23395327838336 1 00358897271209 such that all criteria are reduced below their demand values The scaled criteria all have nearly the same value within computational accuracy 0 7829 This result indicates that the solution is a Pareto optimal solution where no criterion can be further minimized without degrading at least one other criterion provided this is not a local minimum As a first variation we will change the demand value for the overshoot criterion from 1 to 10 This means that more overshoot in the alpha step response is allowed and we expect that the other criteria improve After updating the tuner values by Reset from file we start the optimization you can get this result also by executing Commands Run 5 In the command log output of this optimization run you can see that the overshoot increased with the effect that all the other criteria could be improved We obtain again a Pareto optimal solution among all criteria as their scaled criterion values are nearly identical 0 73 This demonstrates how different compromise solutions can be found by variation of the demand values As a next modification of the optimization task we change the type of the maxElevator criterion c4 fr
104. entation package provides several ways of analyzing the behavior of a model The main functions are perturbParameter sweepParameter sweepOneParameter sweepTwoParameters and MonteCarloAnalysis Packages E A Design PJ Calibration gt Experimentatior l lt p perturbParameters T sweepParameter Cf sweepUneParameters a sweep woParameters D MonteCarloAnalysts i 2 Probabilities i C Fandom umber Examples The functions perturbParameters sweepParameter and sweepTwoParameters have corresponding in the Calibration package and can be used for more general parameter studies The main difference in this package compared to Calibration is that the resulting output is the response of the model We give a short overview of these functions now The functions sweepOneParameter and MonteCarlo Analysis complete the set giving the possibility of plotting the response at the end of the integration interval and random draws of numbers for the parameters in Monte Carlo simulations The example studied for this package is the model Design Experimentation CoupledClutches This example is an extension of Modelica Mechanics Rotational CoupledClutches Case Study CoupledClutches model The model CoupledClutches is composed by four rotating inertias J1 J2 J3 and J4 coupled by three clutches that make them interact The diagram looks as follows sin torque J ine nn Y i i 0i 2 _ o i i ss S
105. eport Processing signal 4 Signal 4 has the 99 5341 of its power under 2 21519 Hz This is an important piece of information The tool detected that the energy of the signal 1s almost condensed in the interval 2 2159 2 2159 In the graphs before right we observe the behavior of the coefficients and it is less smooth and more erratic outside of the interval reported by the tool We can therefore suspect that additive noise is present in this range of frequencies We can now design a filter and get rid of these noisy oscillations Filtering signals Back to the GUI click on filter combo box and choose FilterDesign Design Calibration dataP reprocessing fx dataPreprocessing Preprocessingsignal signals 1o Inputs gignals 1 Signal Name minimum Bound Signal masimum Bound Signal minimum time masimum time Detrend signal filter Frequencyanalysis E NoFiltering FiterD eszign Info Copy Call Execute Close The GUI for filter Design from the LinearSystems library pops up now FilterDesign filter FilterDesign Inputs analogFilter ns Types AnalogF ilter Butterworth H Analog filter characteristics Critical D amping Bessel Butterworth Chebrshes filter T ype ppez Filter Type LowPass Type of filter LowPass HighPass order E Order of filter f cut Cut off frequency default i w_cut
106. ersion 2 2 Version 2 2 is backward compatible to version 2 1 Modelica Blocks has revised table blocks to avoid multiple allocations of table space Modelica Mechanics MultiBody has been revised See MSL 2 2 Release Notes for details The following new libraries have been added Modelica Media Property models of liquids and gases especially 1241 detailed gas models moist air high precision water model and incompressible media defined by tables The user can conveniently define mixtures of gases between the 1241 gas models The models are designed to work well in dynamic simulations They are based on a new standard interface for media with single and multiple substances and one or multiple phases Modelica Thermal FluidHeatFlow Simple components for 1 dim incompressible thermo fluid flow to model coolant flows e g of electrical machines Components can be connected arbitrarily together ideal mixing at connection points and fluid may reverse direction of flow Modelica Electrical Digital Digital electrical components based on 2 3 4 and 9 valued logic according to the VHDL standard Modelica Electrical Machines Asynchronous synchronous and DC motor and generator models The example shows a permanent magnet synchronous induction machine with inverter Signal ol duration t Star T Step Loadinertia li m 1E tim o dal Load E SMPME1 Modelica StateGraph Modeling of discrete event and reac
107. essing dataPreprocessing Tree data E signals one Description signals Preprocess data limit detrend filter Inputs hlenamelr F Input Filename hlenameDut to Dutput Filename d Plot Signals before and after Info Copy Call Execute Close MODEL EXPERIMENTATION 143 To introduce an experiment file click on the Edit icon in the Input Filename A file browser pops up Use it to select the file Design Calibration Acceleration measurements mat Design Calibration dataP reprocessing signals i signals dataFreprocessing Tree data Description Preprocess data limit detrend filter Inputs flenameln Design Calibration 4cceleration measurements matimeasurments F Input Filename filenamel ut Plot Signals before and after F Output Filename H Into Copy Call Execute Close The same procedure has to be repeated to select an output file In this case the file does not exists We choose as name for this example Design Calibration Acceleration measurementsfiltered mat Design Calibration dataP reprocessing dataPreprocessing signals i siqnals T 144 dataFreprocessing Tree data Description Preprocess data limit detrend filter Inputs hlenameln Design Calibration Acceleration measurements mat measurmentes F Input Filename hlernameld ut Design Design Calibration Acceleration measurementetltered mat Plot Sig
108. fied The documentation of Inertia2 needs thus to include documentation on initial conditions In this case we know that there are no initial conditions are stated for J2 so we may introduce an initial equation section in the CoupledClutches model containing for example initial equation 238 de Elange a pau zen Start angle der J2 flange aphi io Start velocity to specify the initial position and velocity of J2 Special annotations for concealment These special annotations are all grouped inside annotation Protection The annotations are designed based on the following basic principles e Security by default the default is to not reveal information for encrypted packages You as the library developer have to enable each of these flags e It is more important to protect an entire package from being viewed than individual classes in the package e Easy to use e Simple logic to make it easy to verify the behavior Thus you can enable duplication but hide diagrams even though this does not make sense e Only applied after encryption thus they can be present in the original library The behavior can be summarized in the following table the missing entries are not implemented Show allow Default nestedShowText Icon oon In class browser hideFromBrowser false choices all matching The annotation applies hierarchically to all classes unless overridden by a similar annotati
109. for graphical object length m Length extent of graphical primitive width m Width extent of graphical primitive height m Height extent of graphical primitive color Ap 10 023 Color of graphical primitive color2 33 0 0 Secondary color of graphical primitive style lll a 1 Style of plotting colorlnterpolationDirection Color interpolation direction colorlntensity Intensity color specularColor Specular color of material 0 0 1 0 specularE xponent IL Specular exponent shininess 0 0 128 0 nu 4L Number of points for u nv 3 Number of points for v Change the color of the Disk by pressing the Edit icon and then the Edit icon of the field color We choose in this case the red color to get a good contrast VISUALIZE 3D 103 104 Select color Ed Basic colors 4 nn fn ae m II E a En O A E A DOI IA IC A A Custom colors CELLET He 1 Ret 5 A Ee Sat 255 Green 0 Define Custom Colors gt gt Yal Blye o Press Execute and rotate once more using control Key and moving the mouse We observe the following result Visualizer 1 The disk is in the middle by default We want to place the disks on top and bottom of the cylinder shell We will therefore erase the disk and place it correctly using the translate transform To erase an object we have to select it first by clicking on it pressing Alt key The selected object is delimited by a dotted box
110. for non root models work in the same way 1f you use Show component and then Parameters with no selected component to bring up the parameters for the component or directly use Parameters for the component To experiment with a model such as CoupledClutches you can follow these steps The experimental changes are then stored in a model Note You can also edit parameters after translation in the plot selector Such changes are not stored in the model but you can store them in a script using File Save Script Variables Extend from the model CoupledClutches using the context menu on CoupledClutches in the package browser and give it a name Open Class in This Window Open Class in New Window ReMnove 5 Check Rename CQ Search Duplicate Class Close Info Hen less m Package Mirder b In the diagram select a component several components or no component and use the right mouse button to bring up the parameter dialog and modify parameters Simulate The model is translated if necessary Repeat from step 2 Package browser The context menu of the package browser has been extended with new functions Package Browser Packages HE Modelica Reference E LJ Design E C Calibration a Call Function 1 pert Open Class in This Window D a Open Class in New Window Doe E che S Check Rename F data Qh Search Duplicate Class Exa Close Extend Fram inte Info Mew Cla
111. fore selected entry and delete rows and columns Insert after the last entry is performed by increasing the size 11 RECENT FEATURES IN DYMOLA 12 Matrix Editor for tableFunction Edit Edit Text Copy Default Delete Row Delete Coluron Insert Row Insert Column Data for the table can be loaded from external file in Matlab CSV Comma Separated Values or text format The table contents can also be saved on file Matrix editor has extended dialog for plotting one and two dimensional table functions The plot is displayed by pressing the Plot gt gt gt button Plot for x 0 5 1 0 IN Table Map Rows 11 Map Columns A special editor for array of records 1s available 1f possible as Edit combined in context menu Replaceable components The context menu for a replaceable component allows editing of the redeclaration modifier redeclare YWehicleDynarmics Chassis Suspensions SimpleSuspension fonts uspension i redeclare YehicleDynamics Chassis Suspensions SimpleSuspensionhl obese rosarino be Edit Edit Text Copy Default Propagate Select Class This gives the parameter dialog for frontSuspension see also section Replaceable components on page 17 A class selector for redeclare is available in context menu as Select Class All matching classes are listed Select class for frontouepension A Di MacPherson suspension with bushings including anti roll
112. fore they become publicly available gives the opportunity to review changes and improves quality The development history documentation of changes may also be needed for tracing model incompatibilities for example Model testing should be integrated with model development which implies that the version control system must be able to handle test scripts support utilities and binary test data Regression testing where models are simulated and compared with known good simulation results 1s very powerful in detecting involuntary changes to model libraries A failed regression test may cause either a change of a model or the revision of the test itself Multiple libraries are often used together In this case version compatibility across libraries becomes essential It must be possible to tag releases of multiple libraries to indicate compatibility at the project level Dymola supports storing retrieving etc of models in version control systems such as CVS Concurrent Versions System or SVN subversion We have deliberately chosen to build on existing version control systems which offers greater flexibility and better integration than a proprietary system Because of the textual representation of models in the Modelica language existing text based tools can be used for example to compare versions To browse changes in large systems support in the graphical environment of Dymola would be needed The use of public libraries has incr
113. g excerpt from the dsmodel mof Linear system of equations ff Matrix solution Original equations R1 R R1 n i R1 v RZ RR Pal BiVi a Calculation of the J matrix and the b vector but these calculations are not listed here To have them listed set T Advanced OutputModelicaCodeWithJacobians a true before translation May give much output because common subexpression elimination is not activated x Solve J b J x b Ros Pals Raul 2 X Torn part Riche R B2 PSL1 FR Del Rov PE Ro aR Ro vos ELET Vs v R3 v End of linear system of equations RECENT FEATURES IN DYMOLA 47 To make the listing more readable some optimization steps such as elimination of common subexpressions are not done It means that Jacobians of algebraic loops are by default not listed because without common subexpression elimination those expressions may be very long As described above the listing of the non zero Jacobian elements 1s be enabled by issuing the command Advanced OutputModelicaCodeWithJacobians true The manipulated linear system 1s now output Linear system of equations LE Matrix solution Original equations R1 R R1 n i R1 v RaR RZa pa RIV a J 1 On R1 R R3 R A ee R3 R E R2 R Ser AS ve x Solve J bys 7 d x p R3 peip R2spei 325 E Torn part Ride CR Os ROO ROLE TE ARO RABO da RUE 2 Vs v R3 v End of linear sys
114. g the Euler method is no longer influenced by interpolation for finding events This improvement is only needed for plots and not for the actual solution Animation Direct manipulation of the view in the animation window using the mouse has been implemented The view can be panned rotated and zoomed using mouse movements in combination with meta keys Up Down Roll rotate around z Ctrl Shift Clockwise Counter axis clockwise Up Down In addition arrow keys pan and tilt in fixed increments of 5 degrees page up down tilt 45 degrees The Home key resets viewing transformation To better support model portability dxf files are found relative to the directory of the current model RECENT FEATURES IN DYMOLA 67 Texture mapping for animation objects is supported Please contact Dynasim for more information Example of animation window Welcome to Dymola Testing Center Matlab and Simulink Libraries 68 Matlab 7 1 R14SP3 is supported Dymola now generates Simulink S function level 2 unless you are using Matlab 5 The library annotation for external functions is automatically used also in Simulink For those who have worked around this in other ways it can be turned off using Advanced IncludeLibrariesForSimulink false Support for compiling models with dSpace release 4 2 Dymola generated models can be run on two more realtime platforms ADI SimSystem and ETAS LABCAR Modelica Standard Library v
115. gram File Edit Simulation Plot Animation Corr toe HQ NN moy Package Browser Packages A F plotPloints F plotLines F plotStem fF plotSurface 1 plotBarGraph O plotPieChart F plotHistogram F plotResult F insertPointer F insertLabel y O Examples t M Primitives a Lf JL J Lew Component Browser x Components Plot3D Click right on 1t and the following dialog will pop Plot3D InsertPrimitive InsertPrimitre InsertPrimitive Tree data objects Inputs T MoTransformation e gt Global ambient light 0 0 1 0 Visualize 3D window number Initial iew Transformation The first element we observe is the View transform matrix the global ambient light and Visualize 3D window number This number identifies the window we want to add some primitive to We keep the default values just now and click on objects field in the tree There we are to select the primitive forms to be added Click now on the arrow of the combo box and scroll down until CylinderShell Plot3D InsertPrimitive InsertPrimitive objects Rows 1 L Axes E Rectangle A Box We have now selected a cylinder shell and we can plot it with default values Press Execute At first sight there is just an empty Visualize 3D window Actually we are looking at the shell with zero thickness along its main axis To realize this press the Ctrl key and move the mouse to ro
116. he error is shown by the cursor It 1s possible to copy text with hidden annotations to clipboard Used classes The text of a Modelica class and classes which are used directly or indirectly is available in the used classes layer What is shown can be controlled by the context menu This layer is read only no editing is possible ANZ HA 2 B e gt BB eo model Modelica Mechanics Rotational Inertia 1D rotational component with inertia parameter SI Inertia J 1 Moment of inertia S5I inqularVelocity w Absolute angular velocity of component S5I inqularicceleration a Absolute anqular acceleration of c extends Interfaces Rigid equation wee ad Copy ctrl E a Select All Ctri J a flange a a ee She ESE eee Find Ctrl F Goto Line Chris o partial model Mod nal Interfaces Rigid E 1 f Settings fi i 1 Coe epee ee settings wv Manual Formatting l Selected Class SI ngle phi w Include component types Absolute rotation angle of conpor Include types 1 Include connectors Flange a flange a ier deena Eiane Elane Sad Include called Functions a Flange b flange b Show annotations righti driven flange flange axi Only Parameters 1 ok amie aa Y Include equations flange a phi phi ll wee p Include class parameters flange Bb phi phi end Rigid Modelica language Dymola s support for the Modelica language has been improved to provide better diagnostics and support recent fea
117. he keyword time and Time MODEL EXPERIMENTATION 145 Design Calibration dataPreprocessing dataPreprocessing PreprocessingSignal signals Inputs i sjgnals 1 Signal Hame minimum Bound Signal masimum Bound Signal minimam time masimum time Detrend signal None filter NoFiltering Frequencyanalysis 1 b Info Copy Call Execute Close We are ready now to run the preprocessor function We start lilmiting and detrending functions Limiting and detrending signals Limiting and detrending the signals is also very important To limit a signal in time and amplitude it 1s enough to write the desired values in the fields minimum Bound Signal and maximum Bound of Signal for the amplitude and minimum time and maximum time for time axis The data outside of these limits is taken away and interpolated or extrapolated linearly Design Calibration dataPreprocessing dataPreprocessing PreprocessingSignal signals Inputs i sjgnals 1 Signal Hame minimum Bound Signal 16 masimum Bound Signal 43 minimum time masimum time Detrend signal None r filter NoFiltering ES Frequencuanalysis 1 Info Copy Call Execute Close 146 Just to demonstrate this feature take as limits the interval 1e100 4 3 for the amplitude and 3 6 2 for time Press Execute and the result is presented Time All values outside of the range have been substitute
118. ia active and make the controller parameter Ki a tuner as well 1 e set active true as done in Commands Run 3 After the optimization is finished all demand values are fulfilled DESIGN OPTIMIZATION 203 Multi criteria experimenting 204 The Design optimize function provides features for criteria weighting and scaling by demand values as well as the possibility to use criteria as a value to be minimized or to use them as constraints During an optimization run the optimization criteria are scaled with their demand values 1 e the value delivered to the optimization method is criterion value demand value By changing the demand value of a criterion a differently weighted optimization task is defined and therefore normally a different solution is obtained In the following the effect of demand value variation on the multi criteria controller parameter optimization for the F14 aircraft is shown Furthermore the effect of using an optimization criterion as inequality constraint 1s demonstrated The controller parameters Kf Ki Kq are defined as tuners using the best values of the last run by Reset from file you may also execute Commands Run 4 to achieve this result and the final values of overshoot riseTime settlingTime and maxElevator as optimization criteria cl Kf Kq K1 c4 Kf Ki Kq with their new demand values d 0 01 0 5 2 5 3 For a first optimization of the controller parameters all criteria are d
119. ical variable in the same or a connected sub system This is active as default but it is possible to de activate this additional diagnostics since it adds to the size of the generated c code and is only interesting if the model fails in some function Direct link in error log to variables in model window When looking at the error message for the WhichOne model there is a tooltip for the component as follows Assertion failed lt 2 The following error was detected at time 0 7000000000000001 Cannot be larger than 2 The stack of functions is MyF MyF f MyF1 x Integration terminated before reaching StopTime at T 0 7 i 0 015 seconds 0 425 milli seconds Right clicking on MyF1 x brings up the context menu Assertion failed x 2 The following error was detected at time 0 7000000000000001 Cannot be larger than 2 The stack of functions is MyF f MyF f MyF1 Integratio Copy Ctri C g StopTime at T 0 7 CPU tim Select All Ct A 015 seconds CPU tim 429 milli seconds Number Ctri F Number Number MyF1 Number of F evaluations Number of Jacobian evaluations X Declaration Selecting MyF1 in this menu highlights the MyF1 component in the diagram RECENT FEATURES IN DYMOLA 55 Step MyF1 MyF3 startlime 2 Clock MyF2 MyF4 start lime 0 The intention of highlighting the component is that an error can be due to the component itself the parameters or the interactio
120. ically However in case we have several measurement series 1t may be necessary to tune or estimate these initial values individually for each calibration case Dymola supports individual tuning of parameters and start values of states and they are specified as freeStartValues MODEL CALIBRATION 171 172 ax calibrate rr Free start values E E setup Description E Tuner parameters Free start values and parameters to be calibrated for each case SEU values E Calibration data Rows o 2 qe EE cases Bez name active value min max FF inputCouplings Ee EE resultCouplings E y t Integrator E Eq Optimizer Select free variables Info Copy Call Execute Close Such parameters or states are selected by clicking Select free variables which pops a variable selector as when selecting case parameters or tuners The variable selector includes parameters and states These values are also tuned for cases having Task Validate Tune the parameters It is time to do the first calibration Click Execute During the calibration results are plotted After 25 fast iterations we obtain the result gearBox lossTable 1 2 0 794 engineTorque tau_0 260 7 criterion 0 218 Case 1 used for Calibration 4 4 Reference carBody der v 4 2 Calibration carBody der v 40 3 0 3 6 3 4 3 2 A passenger car has normally an efficiency of 0 90 at high gears in normal operation The measurements
121. icense file Encryption requires the Model Management option in Dymola Visible and concealed classes The basic idea of the protection of models is to hide some information while making it possible to use the model components A protected library typically consists of parts that are open and other parts that are protected Protected parts may require different degree of information hiding e g e The model is regarded as a black box The icon its connectors and parameters as well as documentation are available to the user to allow use of the model as a component but model structure and equations are concealed e The model is completely concealed from external use Dymola supports concealment by encrypting models or libraries and the use of protected code sections and special annotations to allow more information to be revealed The special annotations are grouped in Protection group similar to e g Diagram There are several kinds of classes in an encrypted library starting from the most open e Example classes that are completely open such that a user can duplicate it and use it as a basis for their own work They can still refer to concealed classes e Classes that that can be viewed completely including the entire Modelica text but cannot be copied e Classes where the diagram is visible but not the text e Classes where only the interface 1s visible This 1s the normal case 231 23
122. icture offset Offeet of output signal height Height of ramps startTime Jk s Output offset for time lt startTime Jeo ot duration duration de Duration of ramp stanTime Info Copy Call Execute Close The record declaration including the annotation to specify the file name of the picture is shown below record TestGroupPicture Real offset 0 Offset of output signal annotation Dialog group Group picture Real height 1 Height of ramps annotation Dialog group Group picture Modelica Slunits Time startTime 0 Output offset for time lt startTime annotation Dialog group Group picture Modelica Slunits Time duration min Modelica Constants small 2 Duration of ramp annotation Dialog group Group picture annotation Images Parameters group Group picture soires ramp pao end TestGroupPicture The description texts and labels may contain HTML formatting tags 1f the text string 1s enclosed in lt html gt lt html gt The example below shows some of the possibilities 86 Records TestHTML TestHTML Inputs format F o itis possible to format description w larger color Ti bo use other fonts and even use greek characters o l and also include line picture b breaks and pictures D In the description Info Copy Call Execute Close The corresponding record declaration is given below record TestHTML Real format
123. ign objectives will be to reduce overshoot of alpha below 1 and to reduce the maximum elevator deflection below 2 The design problem 1s now translated into a setup for optimization based parameter tuning In the Commands menu in the toolbar you can find all setups described in this tutorial We will perform now the setups manually Right click on function optimize in the package browser and select Call Function ControllerDesign_F14 Design Optimization Examples ControllerDesign_F14 Diagram Ioj x File Edit Simulation Plot Animation Commands Window Help 18 x sue Y NOOVAM4 oH gt auna 150 Packages criteria 6 Modelica Reference apna OModelica delta Unnamed Design lal g Calibration 4 Experimentation from_deg O Internal aircraft a Optimization alpha_c 0 optimize CJExamples Call Function a sg Criteria Open Class in This Window q Open Class in New Window Edit gt Check Q Search e Ej Close ny Info 8 Modeling y In the appearing dialog window the model name of the last translated model is automatically inserted there 1s also a browser for selecting the model DESIGN OPTIMIZATION 193 Design Optimization optimize Po 21 xi optimize Y setup Tree data Y setup Inputs be pater Pee Modelica name of the EacaseParameters Model Design Optimization Examples ControllerDesign_F14
124. imevarying variables Vs v discreteexpr_0 Unknowns R1 v start 0 algorithm Torn part D v Vs v R1 v D i if discreteexpr_0 then D Ids exp D Maxexp 14 D v D Vt D Maxexp 1 D v D R else D Ids exp D v D Vt 1 D v D R equation Residual equations 0 R1 R D i R1 v Non zero elements of Jacobian Jil 11 3s 1 if discreteexpr_0 then D Ids exp D Maxexp D Vt 1 D R else DiTdsr expD v D VE D Vt 1 D R R1 R End of nonlinear system of equations Torn discrete part discreteexpr_0 D v D Vt gt D Maxexp End of mixed system of equations Dymola reduces it to a nonlinear problem with one iteration variable namely R1l v start 0 50 The start value 1s included in the listing because the nonlinear solver will use 1t The diode model includes also an 1f then else expressions where the condition D v D Vt gt D Maxexp refer to one unknown D v of the algebraic loop Dymola introduces an auxiliary variable named discreteexpr 0 for the condition This transformation removes a possible discontinuity from the real part of the problem Discriminating start values When there are nonlinear algebraic loops the nonlinear solver will use the start values of the iteration variables The possibility of converging to a solution may depend critically on the quality of these start values The quality of start values may vary considerably between the unknown variables When it is p
125. in the unit circle of the complex plane relates the Z transform to the discrete Fourier transform The color is interpolated in the x direction VISUALIZE 3D 117 Visualizer 1 Imaginary Part Amplitude Other alternative that Plot3D provides is to make pie charts Statistiska Centralbyr n Central statistics office in Sweden reports the following population distribution by age in 2005 Two age groups are separated 30 34 and 55 59 to distinguish them Visualizer 1 Swedish Population Year 2005 Age Group 00 04 05 09 10 14 15 19 20 24 25 29 30 34 35 39 40 44 45 49 50 54 55 59 60 64 65 69 70 74 6 1 6 1 A 1 1 060000000000000808 118 Model Experimentation Model Experimentation Introduction Dymola provides the Experimentation package as a feature of the Design package The main purpose of this package is to allow the user to vary parameters of the system to get an intuitive knowledge of the behavior of the model Some of the functionalities of this package are related to other functions of the Calibration package The main difference is that those are coupled to the calibration setup while the functions in Experimentation are independent and can be used to illustrate phenomena of the system One of the functionalities of Experimentation package is essentially different Monte Carlo simulation MODEL EXPERIMENTATION 121 Varying parameters of a model 122 The Experim
126. information includes e Dymola window position and size e Position and location of command log browsers and toolbars inside the Dymola window The setup information is by default stored in a system directory associated with the user On Windows according to the recommendations of Microsoft the name is typically C Documents and Settings lt user gt Application Data Dynasim settings mos The directory Dynasim is automatically created by Dymola if needed It is also possible to store the settings in a directory read by all users or to save the settings as a local script file chosen by the user The command Clear A11 will erase the settings file for the current user or all users Defaults will apply until settings are saved RECENT FEATURES IN DYMOLA 25 Setup Options Appearance Versions Store settings about Position and geometry of Dymola window Default Modelica version Save settings for Current user All users Clear All O Save script az Modelica text editor 26 Variable declarations There is less need for writing Modelica code because most variable declarations can be generated by a drag and drop operation from the package browser To declare a new variable drag a type from the package browser to the component browser or diagram Several operations are possible but the default is to add a new variable of the specified type Dymol
127. it the bounding box The original pixel size is preserved e preserveAspectRatio false gt The bitmap is scaled to fill the bounding box possibly distorting the image The default values are true in both cases Default component size More flexibility in defining the size of components which are dragged into a model It is now possible to set a component scale factor in a class This factor defines the default size of a component of the class Assuming a model M has defined the scale factor 0 1 dragging class M into another model A will create a component which size is scale times the size of the coordinate system extent of M The default settings are compatible with the default behaviour of previous versions of Dymola Previously it was possible to set the default component size in Dymola In this case the receiving class A defined the size of any component that was inserted regardless of RECENT FEATURES IN DYMOLA 21 22 component type To preserve backward compatibility the old component size attribute 1s applied 1f scale has not been set To manually set component size the user must now edit the Modelica text of the model to create the appropriate annotation For this example open model A in the Modelica text layer Then right click and select Expand Show entire text Then add the annotation model A annotation Coordsys component 20 20 ES end A HTML documentation The content of the HTML generate
128. iting a file type FileNameOut String annotation Dialog saveselector filter Matlab files mat CSV files csv caption Save experiment data EA Checking of input data It is possible to declare parameters with minimum and maximum values which are then checked by Dymola when the user sets a parameter value The variable is declared with type and name as usual Then press the edit button right arrow and the end of the value field to present a menu MODELICA DATA STRUCTURES AND GUI 89 Declare variable KIEJ Type Pre Declaration Annotations Type and name parameter Real vi p S Edit Text Copy Default Description Modelica parameter Real p Select Edit from the menu and enter the min and max values for the parameter Assuming that we have specified the range to be 0 10 the variable dialog shows Declare variable Type Prefix Annotations Type and name EDI id meto Description Modelica parameter Real p min 0 max 10 If we have a model with such a parameter and try to set a value outside of the valid range Dymola will display an error message The parameter dialog cannot be closed until the invalid modifier value has been corrected legal modifiers Some of the given parameter values Were ilegal Literal value For p greater than max walue 10
129. l files Also note that CVS can update special keywords in the Modelica text which can be used to automatically insert information in the model documentation They include version number date of last change and a log describing all changes An example of this is given below Conflict handling after update If several users have modified the file the update command of CVS or SVN will attempt to merge the changes If they have modified the same lines of code CVS will detect a conflict After a conflict the original modified file is kept as backup and the merged file contains both sets of changes marked by special indicators inserted into the text It is then up to the user to resolve the conflicts An important issue here 1s that Dymola cannot use the file until conflicts have been resolved Initially we do nothing 1 e require that the user edits the Modelica file with some external text editor to delete conflicting lines and their indicators At some future point in time Dymola could be extended to parse Modelica text with CVS conflict indicators and the resolution could be handled from within Dymola which of course has better support for analyzing the conflicts An intermediate step 1s to rename the file with conflicts and restore the backup this will at least maintain consistency between the Dymola environment internally and the corresponding file externally It should be noted that merge conflicts arise from a people man
130. lation interval 166 2 x calibrate y Integrator Advanced Er setup Description 5 Tuner parameters Integrator method parameters for all cases es Free start values i ae Simulation Interval I Calibration data Lge cases Start time gt s Starttime of simulation L E inputCouplings Stop time gt s Simulation stop time E FF resultCouplings _ Integrator m Optimizer Info Copy Call Execute Close To perform the validation click Execute Case 1 used for Walidation 5 5 Reference carBody der v 5 0 Calibration carBody der v 45 40 3 5 3 0 40 4 4 46 5 2 5 6 6 0 The result is plotted above The curves have similar shapes but there is an offset The model gives a higher acceleration than measured This may make you think of losses not being modeled In the next section we will discuss calibration Measurement file formats In the example above the measurements are stored in a csv file as described Dymola supports some common ways of storing measurements and allows users to specify their own storage formats The measurement files must have the same format In case the measurement data are stored in Matlab 4 mat files we need to specify the name of the matrix containing the measurement data to be used and the data are referred by column number The acceleration measurements are also available as Program Files Dymola Modelica Library
131. lignment from the menu Horizontal alignment is specified with Left Middle and Right vertical alignment by Top Center and Bottom Align to gridlines Edit Align To Grid aligns selected objects to the gridlines The center is aligned to the nearest gridline or halfway between gridlines this allows alignment of components of default size on gridlines or between gridlines The keyboard shortcut is Ctrl G Color selection There is an improved color selection dialog with a better choice of standard colors Dymola supports true RGB color for all graphical objects offering improved capabilities to design icons For backward compatibility color information is stored both in true RGB form and mapped to a color index as in previous versions of Dymola Note that RGB color is lost if models are edited in an older version of Dymola Select color X EET E E Sat 170 Green 160 Define Custom Colors gt o val 240 Blue 240 Cancel Add to Custom Colors Basic colors Custom colors pe M ey pe a Hue 210 Red jo Bitmaps There is a button in the drawing tool bar to insert bitmap images Double click on the bitmap image presents a dialog to specify filename of bitmap Incorrect filename displays a default bitmap same as toolbar button Bitmap is by default scaled preserving aspect ratio centered in bounding box The bitmap annotation also has the attributes e stretch false gt The bitmap is not scaled to f
132. ls There is also a set of functions for analyzing parameter sensitivities and dependencies of calibration tasks For parameter studies in general see Design Experimentation This document uses a simple car model describing translational motion to illustrate how a basic calibration task is set up and executed How to store a setup for later reuse is described Then this document describes the set of functions to analyze parameter sensitivities and dependencies of calibration tasks The basics of setting up and executing a calibration task We have acceleration and speed measurements from a BMW 6451 at full throttle as shown in the plot below For further information we refer to Auto Mobil Issue 1 2005 acc Gear shi speed km h 100 60 60 40 20 Anti spin control and gear shifting make the acceleration curve complex Here we will focus on the time interval 3 8 6 seconds when the second gear is engaged We need to describe how the generated torque makes the car move Thus we need to make a simple powertrain model including gearbox and rotating elements which make the wheels rotate Vehicle data By searching on the web we can find the following data for the car Engine torque at 3600 rpm Nm 450 Engine inertia kgm 4 Gearbox and cardan inertia 0 01 kgm Automatic gear ratios I VI MODEL CALIBRATION 157 Gear ratio of final gear The wheel radius is calculated for 245 45 R18 W saying that the
133. mbolic names keyword substitution kv total revisions 1 selected revisions 1 description revision 1 1 date 2005710704 09 34 02 author Dag state Exp This is the first version of our test example Command finished The output from both Status and Log contain information specific to the underlying CVS system which is beyond the scope of this report For non expert users it would be beneficial to filter the raw output Changing an existing model Starting with the model created above we now modify it by adding a time constant Ti The revised Modelica text looks like this model Decay Real x start 2 parameter Real Ti 1 equation der x x Ti end Decay The Version Diff command will display the differences between the model stored in the repository and the current model Changed lines are indicated by added lines by and any removed lines by this is the so called context diff format CrNubilNvdymola bin eve exe dLit e Decay mo in directory C dev Proj DymolaQt models Index Decay mo RCS file cvs models Decay mo v retrieving revision 1 1 GLEE 0 w FL 1 Decay smo wee Decay Me 2005 10 04 09 34 02 1 1 Decay mo ZOO 5 7 MOP 04 094 3212 KKKKKKKKKKKKKKK xk irre kKkKkK model Decay Real x start 2 equation der x X end Decay 1 6 model Decay Real x start 2 parameter Real Ti 1 equation der x x Ti end Decay Command finish
134. ment system Concurrent Version System 0145 O Subversion SVN The setting for version management system is stored when you do a Save in Edit Options Save settings Version management using CVS Version management support in Dymola assumes that there exists a functional CVS environment In its simplest form there exists a CVS repository on a local disk More advanced installations maintain a CVS server on a separate UNIX system one such setup 1s the use of the SourceForge server to maintain the Modelica standard library Two examples are given below It is worth pointing out that Dymola and the underlying CVS system supports development of libraries maintained at several different servers concurrently For example the Modelica standard library may be maintained at SourceForge other libraries proprietary to the company and still others by the user on a local disk In this fashion version management also facilitates effective distribution of updates as they become available from the vendor Note in several places the user is asked to execute the CVS command The file cvs exe is located in the Dymola distribution typically dymola bin For conciseness it 1s written as cvs in these examples Local CVS repository To set up a local CVS repository first choose the machine and disk on which you want to store the revision history of the source files CPU and memory requirements are modest so most machines should be adequate T
135. meters case caseCrteria matrix defining the demand values used for scaling ER caseParameters tl Tx caseCriteria H Ea case ames E cases se integrator Ey optimizer Rows overshoot maxElevator 0 01 Cima a 3 Finally a simulation time of 10 s has to be defined under integrator 198 Design Optimization optimize optimize setup al Tuner parameters caseParameters a WR caseCriteria Ti caseCtiteria 1 17 caseCriteria 2 ea caseNames F cases h demands ttintegrator EB optimizer 2x integrator Advanced Description Integrator parameters for all cases Simulation Interval Start time os Start time of simulation Stop time 40 Simulation stop time Info Copy Call Execute Close The optimization problem defined and to be solved by the Design package optimizer is now min max overshoot Kf 0 01 maxElevator Kf 2 Kf in 10 0 By clicking on the Execute button the optimization is started The same setup could be obtained by selecting the first command in the Commands menu ControllerDesign_F14 Design Optimization Examples ControllerDesign_Fi4 Documentation B File Edit Simulation Plot Animation Commands Window Help suqQeley moy am gt Run 1 optimize Kf 2 Run 2 optimize Kf Kq 3 criteria Packages Design
136. meters and start values to be calibrated rr Free start values gt Calibration data Rows i 4 i FE cases i pee FF inputCouplings H EE resultCouplings cardaninertia J t a Integrator l g Optimizer Select parameters Info Copy Call Execute Close Click Execute Dymola outputs the message The calibration criteria are insensitive for small variations around the nominal values in the following linear parameter combinations engineInertia J 0 1826 cardanInertia J The message says that if we change the two values but keep engineInertia J 0 1826 cardanInertia J constant then the criterion does not change In other words we cannot tune the inertias individually but we can tune the combination given The engine and the cardan are rigidly coupled It means that the inertia for those to bodies sensed from the engine is J J li where J is the inertia of the engine and J is the inertia of the cardan and is 7 is the gear ratio Using i 2 34 we get J J i J 0 1826J This is consistent with what Dymola told us In fact the engine cardan wheels and the car body are rigidly connected It means that we can only estimate a total inertia for example reduced to the engine side or a mass equivalent reduced to car body Let us specify the inertias and the car mass as tuners MODEL CALIBRATION 185 E Design Calibration checkCalibrationSensitivity F checkCalibrationSen
137. mmands Run 9 The optimizer is able to find a controller parameter set that satisfies all demands in all three operating points Kf Ki Kq f 3 15272731479831 3 05878111172574 0 764835115980916 By further analysis it could be shown that this controller parameter set stabilizes the aircraft robustly to the aerodynamics parameters Although the F14 example is very simple many essential ingredients have been shown They can all be applied also to much more complicated cases Model management Model Management The model management package includes version management automatic documentation of model dependencies and encryption of models Use of the model management package requires the Model Management option Version management The context of version management In developing model components for a complex system such as a vehicle many different kinds of competence are needed Experts in engines transmissions and chassis etc are needed to develop a drivetrain Because several people are involved in the process it becomes essential to break up or decompose the overall problem into modular units during development As more people are involved in the process the development is geographically and chronologically distributed because it is natural to have centers with specific core competencies This implies that the modular units developed must be seamlessly integrated to solve the overall problem and the partitioning
138. mmitted The lines beginning with CVS are generated to help us remember the nature of the commit This is the first version of our test example CVO AAA A A E ese gt CVS Enter Log Lines beginning with CVS are removed automatically CVS CVS Added Files CVS Decay mo CNG SSeS eS ee ee eee Ser ee ee The message after the commit operation has finished looks like this C util dymola bin cvs exe commit Decay mo in directory C dev Proj DymolaQt models RCS file cvs models Decay mo v Checking in Decay mo Xevs models Decay mo v lt Decay mo initial revision 1 1 done Command finished The output from Version Status now contains more information in particular the version number of the file and the date it was last changed in the repository C util dymola bin cvs exe status v Decay mo in directory C dev Proj DymolaQt models File Decay mo Status Up to date Working revision LXE Pri Oct 04 09734702 2005 Repository revision 1 1 cvs models Decay mo v SEmoky Tag none Sticky Date none SErcky Opecons none Existing Tags No Tags Exist Command finished It is also possible to view the change log with Version Log The change log contains all messages entered during commit operations C util dymola bin cvs exe log Decay mo in directory C dev Proj DymolaQt models RCS file cvs models Decay mo v Working file Decay mo 221 222 head 1 1 branch locks strict access list sy
139. n Click right mouse button and select Edit function Call and the function call menu pops This can be done for any function call in the command log Reusing a setup for a similar operation A setup can be reused for a similar operation Assume that we just have made a calibration The menu is then 2 Design Calibration calibrate Axl calibrate H setup Tree data E a Tuner parameters Model Design Calibration Examples SimpleCar 2 Modelica name of the model to be calibrated m Free start values E Calibration data i i FF cases i FE inputCouplings e H FF resultCouplings i y s Integrator 2 gg Optimizer Info Copy call Execute Close 176 Select calibrate at the top in the tree browser click right mouse button to get the context menu 2 Design Calibration calibrate Axl ibrate Tree data 0 tion l v calibrate d setup H Tun perturbParameters model to measured data rr Free SweepParameter Calibra sweepTwoParameters FEC checkCaibrationSenstivity H FF resultCouplings le y s Integrator E Eq Optimizer Info Copy Call Execute Close The menu offers a selection of analysis and plotting functions that can exploit the calibration setup We will descibe these functions further below Analysing parameter sensitivities and dependencies Dymola provides a set of functions to analyze parameter sensitivities and depende
140. n given by dsmodel mof e Simple LC circuit is a first example to discuss the organization of the manipulated equations and listing of alias variables e Two resistors connected in series illustrates symbolic solution of a linear algebraic loop e A simple resistor network illustrates a manipulated linear system for numeric solution e Diode circuit with two valued resistance diode model introduces mixed discrete real algebraic loops e Diode circuit with diode exponential diode model introduces nonlinear algebraic loops Simple LC circuit Consider a simple electric LC circuit with two resistors connected in series G Translating the model produces a dsmodel mof file with following contents RECENT FEATURES IN DYMOLA 43 44 Translated Modelica model generated by Dymola from Modelica model OutputModelicaCodeExamples SimpleLC_Circuit yA BIS AA SS SA A A OS Initial Section VS Sagna Lsourcerpl 3141592653509979 A 0 G p v 0 L n v 0 Vs n v 0 Bound Parameter Section Vs signalSource amplitude Vs V Vs signalSource fregHz Vs freqHz Vs signalSource phase Vs phase Vs signalSource offset Vs offset Vs signalSource startTime Vs startTime 22 Dynamics Section R2 p v Vs signalSource offsett if time lt Vs signalSource startTime then 0 else Vs signalSource amplitude SINS 290391900307 7959 Vs signalSource
141. n in the log as last output The best value of Kf is 1 68517406292052 It can be seen that the overshoot is reduced by 87 59 and the control activity by 66 26 see column diff However by tuning only Kf the overshoot could not be reduced below the requested demand value of 1 Note the scaled criteria is below 1 if the demand value is fulfilled Therefore in the next steps the controller parameters Ki and Kq will be also optimized After the optimization is finalized the Design optimize menu remains open when using Execute Nothing in the setup has changed In order that the result of the last optimization run is included in the setup it is necessary to select the Select button of tunerParameters 200 Design Optimization optimize optimize amp Y setup Mo Tuner parameters _ ES caseParameters a caseCriteria ea caseNames E cases demands as integrator optimizer Select parameters mark value and click on OK This will load the values of all tuners from the last simulation run DESIGN OPTIMIZATION 201 Design Optimization optimize 2x 2 Tuner parameters D optimize Y setup pue id e tuner parameters Model parameters to be optimized 3 caseParameters HIR caseCriteria Rows K sacaseNames FE cases mdemands AY sa integrator optimizer Select parameters Info Copy Call Execute Close Since the optimizer
142. n the usual way by dragging and dropping components and connecting them together The encrypted model MyTransferFunction is available in the package browser for dragging but it cannot be displayed or inspected in the editor The connectors are public and thus available for connection Selecting the component and clicking the right mouse button pops the context menu in the usual way and selecting the alternative Parameter displays SI TF in TestNonProperTransferFunction Pix Component Name TF Comment Model Path My T ransterFunction Comment Linear transfer function Parameters b Numerator coefficients of transfer function al Denominator coefficients of transfer function and it is possible to enter values for the coefficient parameters The result of a simulation is shown below Please note that the state x components are not available in the plot selector 235 236 E Plot 1 ojx j4 File Edit Version Simulation Plot Animation Window Help _ a x le ed SR e vet gmlFaR Oiml gt N MA 41 i m 12 Ty ElTestl 1 EITF ElinPort Dl signal 1 EloutPott signal 0 4 A 1 6 1 Oal 1 0 alz 1 Sine 0 4 0 8 gt asics 0 0 2 0 4 0 5 0 8 The sine generator may produce multiple output signals while the transfer function assumes a scalar input Let us see what happens 1f we let the sine generator produce two signals This can be achieved by setting the value of its parameter
143. n with connected components By highlighting the component it is easy to investigate these Clicking on the last part x brings up the text layer of the component and searches for the declaration of x The function part of the function call has a similar link to the function Extended online diagnostics for non linear systems When a simulation is slow it can be due to the non linear systems of equations in the model This is especially the case if the simulation is not yet started and the problem occurs for the initial equations As acontrived example consider model SlowNonLinear Real x 10 function multiplySlowly input Real x output Real y size x 1 algorithm Y X for i in 1 1000000 loop Yi Xty end for end multiplySlowly equation multiplySlowly x ones size x 1 end SlowNonLinear Running this and pressing Ctrl c at the start gives Log file of program dymosim generated Wed Dec 21 11 59 03 2005 dymosim started dsin txt loading dymosim input file 56 In non linear solver after 11 function evaluations x 10 0 eo 999998 00 7 18 9999995 007 FL 9 99999E 007 Gl GO P99 SE 007 XLo 9 99999JE 007 x 4 9 99999E 007 3 9 29999R 00 7 LZ Ges oe oe 0 07 REL PI I99 SA 00007 Integration status probed at T 0 CPU time for integration Number of result points Number of GRID points Number of successful steps Number of F evaluations Number of Jacobi
144. nals before and after w Output Filename Into Copy Call Execute Close and check the field Plot Signals before and after to obtain a plot of the original signal and the result of the preprocessing It is possible to overwrite the original file there is no restriction for that But the data is destroyed This means that the original data is gone and no possibility of recovery is possible A good practice is always to change the name slightly since we might want to adjust later on the preprocessing parameters We select now a signal from the file Since the input filename is a mat file we don t have access to the name of the variables but we know the position of the acceleration signal that is number four in the matrix Choose 4 from the combo box in Signal Name Design Calibration dataP reprocessing dataPreprocessing PreprocessingSignal signals ae Inputs i 31gnals 1 Signal Name minimum Bound Signal masimum Bound Signal minimum time maximum time Detrend signal filter Freguency nalysis Into Copy Call Execute Close The dataPreprocessing tool assumes for mat files that time 1s in the first column always This is a cornerstone of the function since all functionalities are relying on time This is very important If we instead choose to process a csv file we get the names in the combo box We can simply then select acc And dataPreprocessing will seek t
145. ncies Below the functions perturbParameters sweepParameter sweepTwoParameters and checkCalibrationSensitivity will be described Sweep one parameter sweepParameter The function sweepParameter sweeps a tuner and plots the responses As an example select the command Calibration with validation of the model Design Calibration Examples SimpleCar Select calibrate at the top in the tree browser click right mouse button and select sweepParameter The menu changes since additional parameters needs to be provided E Design Calibration sweepParameter i 2 x f sweepParameter sweepParameter Tree data 10 i HHsetup Description H Tuner parameters Sweep one parameter and plot responses ee Free start values oe Inputs Calibration data Ll FF cases sweepVariable y gt Parameter to sweep subset of tuner parameters i ta EE inputCouplings values Parameter values to sweep E EE resultCouplings engine Torque tau_0 i 4 Integrator ba Optimizer gearBox loss Table 1 2 Info Copy Call Execute Close MODEL CALIBRATION 177 Select gearBox lossTable 1 2 in the combobox of sweepVariable and select Equidistant grid for values Equidistantgrid in values A ES Equidistantgrid Description Generate equidistant points in an interval Inputs minimumValue 05 maximumValue i numberPoints gl a Enter minimum and m
146. nd check Protected The resulting Modelica model is 237 model Inertia2 extends Modelica Mechanics Rotational Interfaces TwoFlanges parameter Modelica Slunits Inertia J 1 Moment of inertia protected Modelica Mechanics Rotational Inertia Inertial J U equation connect Inertial flange_a flange_a connect Inertial flange_b flange_b end Inertia2 Now we encrypt the package ConcealedMechanics For the model CoupledClutches we let Jl be of class ConcealedMechanics Inertia and J2 be of class ConcealedMechanics J2 Simulation of the model CoupledClutches gives the following variable browser Variables Values Unit al EH ph E to CI der phi rads EL der phi 2 rad s 2 Fiflange_a 3 Cl phi rad Da rn EJflange_b E PT kgm la TO rads EL derfw radas Da rads2 El torque Eeclutch El sim Estep J Eflange_a 3 Cl phi rad Da rn EJflange_b A PT kom ix For Jland J2 it is possible to plot the connector variables and set the moment of inertia J However for J1 it is also possible to plot velocity and acceleration What to do if we would like to plot the velocity of J2 The velocity can be made available by connecting a Speed Sensor For Jl it is possible to set an initial value for w For J2 the situation is more complex By just looking at it we cannot tell whether there is some internal initialization When translating the model Dymola issues a warning that initial conditions are not fully speci
147. nes water fall plots and bar graphs from matrix data In the following the notation we use 1s as follows l The matrices x y z describing a parametric surface of the form x f t 5 v 2 t 5 z h t s 2 The matrices nx ny nz describing a vector field 7 7 77 on the point x y z We will consider three test cases with their respective plots e parabolic function l x2 y on the interval 1 1 x 2 2 Visualizer 1 e hyperbolic function z 2xy on the interval 3 3 x 3 3 Visualizer 1 VISUALIZE 3D 109 E e bivariate non normalized Gaussian distribution z e on the interval 5 5 x 5 5 Visualizer 1 The function Plot3D Examples Surfaces surfaceDemo runs all test cases We will consider two of them here and just show the rest The functions Torus and Helix are further examples of closed surfaces in different styles Examples A Primitives Ef Suttaces F SurfaceD ema CF Torus Cf Helix Let us plot the first test function Execute the following command in the command window to create the matrices x y z nx ny and nz Xp Vr Ze NX NV OZ Plot3D Ut11l1t1es Surfacelestil 25 Now click right on the function Plot3D plotSurface Click Call Function item The following dialog window appears 110 Plot3D plotSurface ERRADA RAR RARA RARA AAA we iplotSurface i plotSurface Tree data plotSurfaces i coordinateSystem Inputs Draw axis Cho
148. ng is an art in the sense of describing the relevant aspects of 230 the object under observation It is thus very important to be able to see what assumptions and approximation the author of a model made Dymola is open to view all and possibly modify the details of models by showing graphical representations and if all details are wanted the Modelica code itself However Dymola also supports concealment of model details if for example a supplier wants to protect proprietary information when shipping models A classical way of protecting software is to distribute only executable programs or object code and no source code This approach is not useful for Modelica models To achieve robust and efficient simulation it is important that Dymola can make a global analysis and manipulation of all equations It is thus highly desirable to give Dymola access to the equations in their original form Encryption of the textual Modelica representation of the model supports concealment of internal parts such as the equations while still allowing Dymola internally to access the equations as if the model was not encrypted There are also other aspects of protecting models and model libraries Prevention of unauthorized modification of models but still having unrestricted viewing and use is supported by including checksums Another aspect of library protection is to ensure authorized use In this case any use of the library is controlled by options in a l
149. ng the font size often helps but if needed the font used for Modelica text can be changed by a command line option which font is suitable depends on the computer and which fons have been installed Example dymola exe fixedfont Lucida Console Setup Options Save settings Graphical editor Restrict minimum fort size Automatic Manhattanize of connections Align dragged components to gridlines Package browser Include protected classes in package browser All Base font si Versions Sets the default version of the Modelica Standard Library and whether models should be upgraded to this version This allows the user to quickly switch between Modelica 1 6 and Modelica 2 2 By setting the Force flag models are required to be updated to the currently selected version of Modelica if not set the version of Modelica that the model uses is loaded on demand If the Model Management option 1s available Dymola supports version control of models using two commonly used systems Concurrent Version System CVS and Subversion SVN Setup Options Appearance Save settings Modelica version Force upgrade of models to this version Version management system Concurrent Version System CVS O Subversion SVN Save settings The command Save will save the current window layout or Modelica version in a file associated with the user The next time Dymola is started the saved settings are used The layout
150. nnector b Pin electrical Pin electrical EngineBus engine EngineBus engine Real throttle Real throttle cal hs endik Make the connection connect b b2 engine engine speed throttle Support for array of connectors has been implemented e Vectors of connectors can be defined and connected to in the graphical editor e The graphical representation is currently as one large connector not as n individual connectors For that reason the extent e g height of the connector should be increased so 1t can accommodate a reasonable number of connections e When connecting to a connector array Dymola will present a dialog that lets the user select index e Connection lines are evenly distributed on the connector according to index number e The orientation of the connector determines if connections start at the top or the bottom The connections start from the first extent point of the connector If a different order is desired use Edit Flip Vertical or Edit Flip Horizontal on the connector e The array dimension can either be a number or a simple parameter ConnType al3 parameter Real n 2 ConnType bln Component tooltip Connector tooltip In the graphical editor connection lines are now drawn over components and other graphical objects This means that connections are not hidden by mistake Graphical editing Recent models Dymola provides easy access to recently viewed models Click on the He button
151. nor TINIPOE OV CMG INES AA A A A A AS RA 38 Diagram layer 4m Sima OLMOS A a 40 o o q AAA END nen ee nn ee 4 Output of manipulated equations in Modelica format ccccccccceesesseeseseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 42 VASCA ate start iia 51 Bounds cacao oie 53 Traceback message Or errors Uncle ned Aedes 53 Direct link in error log to variables in model WINdOW ococccnnnnnnnncnnnnnenoneninnnnnnnnninnnnnnnnnnnnnnnnnnnnn nn nn nn nn nn rra n nn 55 Extended online diagnostics for non linear dE edad 56 Extended diagnostics for st ck simulation a 58 Ensuring that Stop stops the IAN a 59 New integration alori O 60 Analytic 21020 6 osen a T o ae ene 62 Commands O eS QUES 63 Plottino NAAA a a Seana eaese oes aa Sie ee 65 Variable browser COMLEX mensa 65 PA gy ee ee ee ee 66 ME NOUNS a a lacado 67 ANMI O 67 Mataband STUART A A cid 68 A A EA TA ER A A 68 Modelicastandard Library Version ines 68 Comparison to Modelica Standard Library Lo 70 En E A MDL tra 71 Library bandina I mMproyemMeniS SAA A ese eae 12 Installation arid senp OF DIM AAA a ls eee eh ee 12 Modelica Data Structures and GUT esre i eai aas 77 Recordas and NAO OS oia 77 Tabs and o A me ve en ne er ee ne eee ere ee ee ee eee oe ee 80 Pabe and lao sao 82 Alternative Tors OA A E E A ea 83 Mstrations and TOMA in didlos y nkesnccee inie E enor oe Ra eo ee 85 Dechre lo S CIAO A a aoa datipae este cee pene as ores cI E A AAO AA OR 87 Specialize
152. ntation layer is empty for concealed classes but is otherwise shown The window title says Encrypted instead of Read Only for all encrypted classes 233 Simulation mode The aim of translating a model is to perform consistency checks and analyze and manipulate the equations to generate efficient code for simulation This procedure is not affected by the fact that components are encrypted or concealed with the following natural modifications e Diagnostics and error messages during translation and simulation do as default not reveal concealed information Warnings and error messages are issued as for non encrypted models but they may be less informative An extreme is Error in ConcealedEquation e The generated simulation code as default prohibits storing plotting or other access to simulation results for concealed variables by the use of their names Examples Encrypted transfer function To illustrate the basics of using and encrypted model component and how encryption changes error messages let us develop a simple encrypted model and use it in some simple contexts The model Modelica Blocks Continuous TransferFunction defines the transfer function between a scalar input u and a scalar output y Transfer functions may be realized in different ways Assume that we have invented a new good way to realize transfer functions and that we have developed a new model MyTransferFunction that exploits our ideas We have al
153. o create a repository with a set of configuration files run the cvs init DOS command to set up an empty repository in the designated directory For example mkdir cvs cvs d cvs init These steps complete the initialization of the CVS repository The cvs init command is careful to never overwrite any existing files in the repository so no harm is done 1f you run cvs init on an already set up repository Note that is you use a Windows drive letter you must write a slightly longer repository specification because the cvs command interprets the colon after the drive letter Cvs d Sihocaltes cve ate The CVS repository is initially empty It is necessary to create one or more directories which act as top level directories for further development For example we may create a models diectory mkdir cvs models To use a CVS repository it is necessary to initially perform a checkout operations cvs d cvs checkout models This command creates a models sub directory with all models currently stored in the corresponding top level directory in the CVS repository It also creates extra directories called CVS at each level which are used to maintain CVS status information The files inside the CVS directories should never be manipulated by hand Access to servers via CVS Projects maintained at SourceForge http www sourceforge net or other servers can be accessed via CVS To access
154. o modify and easy to maintain in a version control system All parts which should be concealed in the finished library must be declared as protected e When the unencrypted library has been finished for release double click on the package to show it in Dymola e If developing a licensed library add the following to the Modelica text in the Modelica text window annotation Dymola checkSum Library MyLib e Select File Export Encrypted model which produces the encrypted file myPackage moe e The encrypted file 1 e the moe file is distributed The original mo files for the encrypted parts are never distributed outside of the development group It is worth pointing out that external decrypting of a moe file is not supported by Dymola but all development work must be performed in the original unencrypted mo file In Dymola all encrypted files are by definition read only Using encrypted components Dymola must not reveal any concealed information when encrypted components are used to compose a model and as well as at simulation unless the library developers has decided otherwise It means that some commands or operations are disabled or have modified effects or results Also some diagnostics and error messages must be less informative Let us first discuss the use of encrypted components in Modeling mode File menu An important and basic restriction 1s that encrypted components are read only and cannot be modified The
155. o plot Variables T oP lat Rows E t Integrator Select vanables to plot Info Copr Call Execute Close Don t forget to set the Stop Time to 1 2 in the integration setup and the tolerance to le 6 Press Execute and the result follows 11 J1 w J1 J 0 80 m J1w J1J 0 88 Jtwi J1J 0 95 J1w J1 J 1 03 94 Jiw J1 J 1 10 8 7 4 mE Bo 5 44 3 a4 y 0 00 0 25 0 50 0 75 1 00 Let us observe now Jl w and vary J2 J Change in the setup J1 J with J2 J in dependencyparameters setup Press Execute again 130 TA J1 w J2 J 0 80 J1 w J2 J 0 88 J1 w J2 J 0 95 J1 w J2 J 1 03 J1 w J2 J 1 10 0 00 0 25 0 50 075 2 C 1 00 The response J1 w is less sensitive at the beginning of the interval to variations of J2 w At the end when all inertias are coupled the variation is larger sweepOneParameter If our interest 1s just the response at end point of the interval we use sweepOneParameter This setup 1s the same as for sweepOneParameter Just choose J1 J as dependency variable in the same way take 51 values between 0 8 and 1 2 and use J1 w as variable to plot The following curve is obtained when the command is executed Once more don t forget to set the Stop Time to 1 2 in the integration setup and the tolerance to le 6 MODEL EXPERIMENTATION 131 Time 1
156. om minimum to inequality Design Optimization optimize SV optimize setup e Tuner parameters 3 caseParameters T caseCriteria emcase ames E cases m demands sa integrator optimizer T caseCriteria Description Criteria definitions for one case Rows 4 ame criteria criterionUsage unit eg I MESA ee maxElevator y Select minimize Value demand Value lt demand inequality constraint Value demand equality constraint ute Close ii i fim N 4 4 deg This means that this criterion is not minimized any more but taken as inequality constraint The new problem to solve is min max c1 d1 c2 d2 c3 d3 subject to c4 d4 lt 1 over Kf Ki Kq After updating the tuners Reset from file and starting the optimization the result is this result can also be obtained with Commands Run 6 Kf Ki Kq 5 52323684440722 5 30428537997218 0 992903698285534 The change of the type of the maxElevator criterion from minimum to inequality yields a new controller parameter set You can see from the simulation results that due to the new criterion formulation the elevator is now deflected to the maximum allowed value of 3 during the step response This is an increase of 37 18 in the maximum elevator deflection compared to the solution of the previous optimization see the command log output
157. on Notes e false indicates that the default for Examples and _ Tutorial packages is showDiagram true 239 e The text window has copying disabled unless duplicate 1s allowed but there are ways of circumventing this e The logic for the browser 1s reversed In addition there are several package wide settings also inside Protection as follows Show allow Plotting of variables showVariables Diagnostics with variable false Statistics e g states Flat modelica Note that if several encrypted packages are used they must all enable e g statistics for the statistics to be shown Scrambling in Dymola Encryption of a package model is a useful way of making a package useable without revealing information However in certain scenarios it is not the ideal choice when sending one or a few component models that shall only be used directly In such cases the most important information to conceal is data and internal structure and there is no need to keep replaceable components or classes The ideal choice would in that case be to send something that e Does not contain internal structure and original data e Automatically hides all internal components e Can be used as any other model in Dymola including differentiation for state selection e Allows you to see exactly what is sent This is accomplished using Export Encrypted total model and can be done either on a model block or for a package
158. onential Inputs Lambda factor 1 mean_value 1 Circular randomCircularUniform rando Uniform randomCircularU niform Inputs Mean Value 15 Arc Parameter O gt randomBeta randomDistribution randomBeta Inputs Alpha factor 3 gt Beta factor Weibull randomWeibull randomDistrib random eibull Inputs Alpha factor 1 Beta factor 1 Probability Density Probability Density Probability Density Probability Density MODEL EXPERIMENTATION Accumulated Probability Accumulated Probability Accumulated Probability Accumulated Probability 141 randomErlang randomDistribu randomErlang Inputs K 1 Accumulated Probability
159. ose scale axis automatically plotld In this dialog we can set whether we want the axes automatically constructed or not Furthermore we can indicate a Visualize window number in plotId Click now on plotSurfaces The following dialog pops Plot3D plotSurface plotSurface plotSurfaces sg plotSurfaces Rows L coordinateSystem plotD ata vectorField styleD ata To set the parametric surface matrices x y and z we click on the edit icon of plotData The following window pops VISUALIZE 3D 111 The only needed to plot is to fill in the matrices We write x y and z in their corresponding places and click OK Then back in the main Dialog we click on Execute and obtain the following plot Visualizer 1 This 1s the default plot style Filled with Mesh and with default names for the X Y and Z axes If we want to change the style of the plots the data has to be filled in the styleData field using 1ts Edit icon The dialog follows 112 StyleDataSurface styleData StyleD ataSurface Description Specify style of plot to perform Inputs General Interpolation Direction Given color x direction y direction z direction Color of the Surface 10 0 2 Line Width gt Specular Coefficient 0 to 1 l gt Color Intensity 0 to 1 VectorField gt __ Surface Select Plot Style None
160. ossible to select between start values the best start value should be chosen Dymola has taken the approach to consider a literal start less confident than a literal expression When defining a basic quantity type or very generic model components start values if set are typically given a numeric value For example the start value of a pressure variable may be set to 10 Pascal In a well designed model library such as the Modelica Standard Library the full fledged components allow the user to specify initial conditions in a flexible way typically by setting of parameters These parameters are used to specify hard initial conditions fixed true or to control initial equations However the parameters are also used to specify start values when fixed false Thus such a start value should be a more reliable estimation of the correct value than a literal value set on a very general level Let us consider the situations where Dymola can select between start values The very first situation is elimination of alias variables A connection between non flow connectors gives an equation vl v2 A connection between two flow connectors gives v1 v2 0 Dymola exploits such simple equations to eliminate variables In this elimination procedure Dymola keeps the start value The sorting procedure of Dymola finds the minimal loops which means that the sorting 1s unique and such a loop cannot be made smaller by sorting the variables and the equations in
161. ouple file data raed Et carBody der s fla nge_a E flange_b derv a H gearBox ime engine Torque speed dist I Use the browser to select the car acceleration carBody der v and then click to the right to see the names of the data series in the input files Select acc We could also have chosen carBody a because carBody a carBody der v Click OK E Design calibrate 2 x f calibrate EE resultCouplings E Saup Description a Matched variables in file ee Free start values Calibration data Rows h a FF cases pod variable E FE inputCouplings io carBody der v FE resultCouplings t a Integrator a Eq Optimizer Couple file data Info Copy call Execute Close We have now specified that the difference between carBody der v and the data column acc shall be used as the criterion for calibration If the measured data are given in some unit different than that used in the model the scale column allows scaling of the measurements variable data scale offset In case the deviations of several variables shall be used to specify the criterion the weight column allows the user to give them different weights The model SimpleCar has no inputs In case the model has inputs click on inputCouplings and couple them to the file data in a similar way as done for the outputs The integrator element allows specification of a global simu
162. performs a last simulation run with the best tuner values these tuner values are the ones from the best iteration of the last optimization The setup is changed such that all controller parameters Kf Ki Kq are defined as tuners Furthermore rise time and settling time are introduced as further criteria These criteria are introduced to counteract the effect that the reduction of control activity and overshoot may lead to very long rise and settling times in the alpha step response The controller parameters Kf and Kq are defined with active true default value in the second column of the Tuner parameters table In turn we set active false for Ki This means that the value of Ki is not changed by the optimizer By increasing Kq it should be possible to reduce the overshoot Design Optimization optimize ax O optimize Tuner parameters Y setup Description a Tuner parameters Model parameters to be optimized 3 caseParameters ST caseCriteria Rows 3 means active value min max unit sonar KF true el 168517406292052 tof fintegrator E IC II E ys Er 10 a Select parameters Info Copy Call Execute Close 202 In a first step we set active false for the riseTime and settlingTime criteria via the second column of the caseCriteria Therefore these criteria are shown in the log output but are not utilized in the optimization Design Optimization optimize 4 2x optimize
163. pilers are supported Dymola dynamically recognizes Visual C compilers no need to install them before Dymola e Microsoft Visual Studio 6 e Microsoft Visual Studio NET 2002 and 2003 e Microsoft Visual Studio NET 2003 Toolkit This is a free compiler for Windows 2000 and Windows XP which can be downloaded from http msdn microsoft com visualc vctoolkit2003 The selected compiler is stored as a per user setting and for the future kept for new installations of Dymola Switching compiler does not modify dymola bin Experiment Setup General Translation Output Debug Compiler Realtime Compiler Gee compiler Microsoft Visual C Watcom C C 11 5 Note Microsoft Visual C and Watcom are optional compilers which may not be installed on your system Visual C version Visual Studio 6 Visual Studio MET 2002 7 0 Visual Studio NET 2003 Toolkit 7 1 Visual Studio NET 2003 7 1 Custom PO DDE visual C with DDE Verify compiler setup Performs several tests to ensure that the generated C code can be compiled Dymola displays a specific diagnostic message when the user runs Microsoft Windows Terminal Services which for security reasons is not supported Dymola supports external C libraries on Linux Classes which contain Library annotations to link with external libraries in C are supported on both Windows and Linux RECENT FEATUR
164. py Call Execute pS 168 Proceed as previously to select case parameters setting their values and start and stop time The specification of result couplings is slightly different because the data is referenced by column number The acceleration measurements 1s column 4 comenedaa A Carbod de r s iq flange_a flange_b derv a E gearbox E flange_a The result of the coupling now becomes 2 Design Calibration calibrate E lx FE resultCouplings Description E Matched variables in file ra Free start values Calibration data Rows Ee paa variable ee FF inputCouplings carBody der v FE resultCouplings EY Integrator ba Eq Optimizer Couple file data Info Copy Call Execute Close The data field has 4 instead of acc The simulation results of Dymola are stored as mat files which includes information on the name of the variables If such trajectory files are used as measurement files then the information on variable names are used The user will not be prompted for matrix name When coupling inputs or results the browser will display variable names Calibration The task of a calibration is to tune some parameters to obtain a better agreement between measured behavior and behavior predicted by the model Thus we need to address the MODEL CALIBRATION 169 170 question which parameters to tune When deciding which parameters to t
165. r Discrete Cosine We are about to perform the discrete Fourier transform DFT of the acceleration signal The DFT is defined as follows Assume we have N samples of a function x x t at t nI where T is the sampling time The DFT is a set of complex numbers C such that N X 2G exp 10 nT k 1 27k for all sampling x points and frequencies NT and 1 the imaginary unit The S coefficients C can be calculated explicitly by matrix vector multiplication or by more effective algorithms in case of large amounts of data T The frequencies are discrete equidistant points distributed in the interval 0 Since S 127 kn a the complex exponential function exp i OnT exp 22n is periodic we choose T IT a representation in the interval to have the highest frequencies farther at the S S boundary instead of in the middle of the graph Now we press Execute and obtain the graph at the left side The right side graph is a zooming MODEL EXPERIMENTATION 149 150 4 Amplitude 80 60 40 20 A Frequency Analysis Frequency Analysis Fourier O Fourier Transform 0 4 0 07 4 Amplitude 0 4 AR i 25 0 8 0 25 25 0 25 Frequency Hz Frequency Hz Since the coefficients are complex numbers we present their modulus In the log of the command window we observe also the following r
166. r x 1f x gt 0 then 1 else 1 end StuckSimulation This model is a classical example of chattering after 0 5 seconds when x has reached zero since the derivative of x is 1 for positive x and 1 for negative x Such models can occur when manually writing e g friction elements such as clutches without a stuck mode use Modelica Mechanics Rotational Clutch Adding noEvent around the if expression 1s not a solution Diagnostics for example Running this with Isodar dassl gives a very slow progress and it thus seems best to press Stop This terminates the simulations and gives a log with Integration started at T 0 using integration method DASSL DAE multi step solver dassl dasslrt of Petzold modified by Dynasim Integration terminated before reaching StopTime at T 0 5 WARNING You have many state events It might be due to chattering Enable logging of event in Simulation Setup Debug Events during simulation CPU time for integration 9 seconds Re running and pressing ctrl c in the dymosim window gives a message Integration status probed at T 0 5004871181 WARNING You have many state events It might be due to chattering Enable logging of events by pressing ctrl c twice and then log event true continue Enabling the logging in one of these ways gives a large number of messages of this type Expression x gt O became false x 0 3 93213e 013 Iterating to find consistent restart conditions
167. r parameters 1 e insert a parameter declaration in the enclosing model and bind the parameter to it A variable declaration dialog is displayed see Variable declarations below The parameter dialog also has an Info button that shows Modelica documentation using an external browser Graphical illustrations can be included to show meaning of parameters The syntax for adding images to a group in the parameter dialog is annotation Images Parameters tab Geometry group Left MacPherson source images MacPherson_text png In this example for the Tab Geometry and the Group Left MacPherson we wanted to add an illustration showing the meaning of parameters Lett MacPherson clit 0 0075 0 3753 0 0358 m rRL3 rel cli 0 3175 0 3535 0 02735 km ita 10 0058556 0 69905 0 0725 km Wwa 0 00013 0 725 0 0450 kom mi 0 0297 0 547 0 561 km ui 0000120 5791 0 042 r m wa T amp m r CL rCA AULA Pie Menu for choosing constants It is possible to annotate parameters or parameter types in order that it s possible to make a selection from a set of values from a pull down menu For example setting a parameter true or false can be made by selecting on or off as shown below Parameters animation Fl Enable dizable animation Asis of rotation color Object color Tr F F F shape Animation shape The needed declarations for this appearance are color shape
168. ranteeing that the function is at least that smooth When using the function its derivative is only constructed if it is found to be needed because of index reduction or to generate an analytic Jacobian The basics of automatic differentiation and the implementation choices in Dymola are discussed in H Olsson H Tummescheit and H Elmqvist Using automatic differentiation for partial derivatives in Modelica Proceedings of the 4 International Modelica Conference Hamburg Harburg Germany 2005 pp 105 112 Example We will use a simple function that just inverts a strictly positive number for illustration function MyDivision input Real x output Real y annotation smoothOrder 1000 algorithm assert x gt 0 x should be positive y 1 x end MyDivision We then write a simple model where this function must be differentiated in order to solver a non linear equation model TestDivision3 Real x equation MyDivision x 1 time end TestDivision3 Translating this example gives a translation log with Sizes of nonlinear systems of equations 1 Sizes after manipulation of the nonlinear systems 1 Number of numerical Jacobians 0 An analytic Jacobian is constructed and used since needed The derivative function 1s function P TestDivision3 MyDivision derf input Real x protected Real y public input Real x_der2 output Real y_der2 algorithm assert x gt 0 x should be positive ViderZ t x der2 x 2
169. reduce models improves simulation speed Use new state selection can give dynamic choices _ Generate listing of flat Modelica code in mof file Generate listing of translated Modelica code in dsmodel mof _ Include a variable for elapsed CPU time during simulation Wam about parameters with no default The listing may be useful for users who want to investigate algebraic loops or for other debugging purposes It gives the correct computational structure including algebraic loops However to make it more readable some optimization steps such as elimination of common subexpressions are not done It means that Jacobians of algebraic loops are by default not listed because without common subexpression elimination those expressions may be very long Listing of the non zero Jacobian elements may be enabled by issuing the command Advanced OutputModelicaCodeWithJacobians true Information on this is included in the listing if there are algebraic loops Listing of eliminated alias variables may also be long Thus the listing of these variables 1s not enabled by default The listing of alias variables 1s enabled by setting the flag Advanced OutputModelicaCodeWithAliasVariables true Information on this is also included at the end of dsmodel mof if listing of alias variables 1s not enabled Below some examples are given for illustration Examples Below some examples will be given to illustrate and to discuss the informatio
170. rs Info Copy Call Execute Close 182 m s s 5 2 5 0 4 8 4 6 4 4 4 2 4 0 3 8 The function exploits the setup of calibration but needs some additional input perturbationParameters which by default are the same as the tuner parameters of setup When executing the function it perturbs the parameters in turn The default pertubation is 10 Note that the efficiency has a nominal value of 1 meaning a default perturbation to 1 1 which is not a physical value Thus we change it to 10 to get an efficiency of 0 9 The results are plots of the result variables as shown below carBody der v Reference1 carBody der v gearBox lossTable 1 2 1 00 0 10 carBody der v engine Torque tau_0 320 00 32 00 4 0 4 5 5 0 5 5 6 0 Both tuners influence the acceleration The responses for the validation case are also plotted MODEL CALIBRATION 183 184 carBody der v Reference2 carBody der v gearBox lossTable 1 2 1 00 0 10 carBody der v engineT orque tau_0 320 00 32 00 7 6 m s s a D D D N ii T a i ii 5 25 2 0 2 5 3 0 Check if tuners can be calibrated checkCalibrationSensitivity When tuning parameters from measurements a basic question 1s Which parameters can be estimated from the measurements available Changing a parameter to be estimated must of course influence the output However this 1s not enough Two or
171. rt time 2 0 stop time 3 0 carBody v 39 9 3 6 and geraBox 1 4 17 as illustrated below MODEL CALIBRATION 173 174 Design Calibration calibrate i m Free start values gt 2 Tuner parameters Acceleration measurements csv r _Calibrate x mi Calibration data po cases 2 Acceleration measurements csv ES Validate il 3J 39 9 3 6 417 E a E inputCouplings H FE resultCouplings qa Integrator Optimizer Select case parameters Click Execute The calibration starts and gives the same results as previously but also the plot below for the validation case the criterion is 13 88 Case 2 used for Validation Reference carBody der v Calibration carBody der v The agreement for the interval 2 0 2 7 s is very good If we rerun the validation having set the stop time of the second case to 2 7 the criterion is 0 44 As indicated above the tires are slipping when the car is run to accelarate as fast as possible If the wheels slip too much the anti spin control system gets active and the result 1s reduced acceleration after 2 7 seconds as shown by the measured data As illustrated Dymola supports a flexible and incremental way of working We need not define this total setup in one step First we made the model and validated the nominal model against the measured data then selected turners and calibrated Finally we validated the calibrated model Dymola also provides support for sentivity analysi
172. s p mampes IR Ei mn Components The following menu pops MODEL CALIBRATION 161 Design calibrate Tuner parameters E rr Free start values Calibration data i FF cases a EE inputCouplings i E EE resultCouplings E Integrator E Eq Optimizer To specify the model to be calibrated click on the Edit icon to the left of the input field A package browser pops up Use it to select the model z Design Fl Calibration fee El Click OK The model is now translated in order to gather information needed to build browsers and selectors to support the remaining setting up of the calibration task If Dymola already has a translated model then this model appears as the default model Design calibrate e O Tuner parameters Design Examples LongitudinalCar SimpleCar E ba rr Free start values e Calibration data p FE cases FZ inputCouplings e FE resultCouplings y s Integrator L g Optimizer The next task is to specify the measurements and how they are stored Consider the tree browser to the left Select cases under Calibration data 162 Hx calibrate FE cases 5 Epsetup gt Tuner parameters em Free start values Experiment file Start Time Stop Time i E Calibration data EF inputCouplings e t FF resultCouplings L y Integrator z g Optimizer Select case parameters Info Copy Call Execute Close To introduc
173. s Mathematically the tuning procedure is an optimization procedure to minimize the error between the simulation results and the measurements MODEL CALIBRATION 155 156 When tuning parameters from measurements a basic question 1s Which parameters can be estimated from the measurements available Changing a parameter to be estimated must of course influence the output However this is not enough Two or several parameters may influence the result in a similar way such that it is not possible to estimate them individually Dymola includes function to analyze and to plot parameter sensitivities When a set of parameters have been tuned it is recommendable to validate the model and the tuned parameters against other measured data to check that there is a good agreement between the simulation result and the new measurements For a specific series of measured data it is possible to get good fits by increasing the model complexity and the number of tuned parameters However this does guarantee that the result is that good for other operating conditions To load Design Calibration select File Libraries and click Design Packages E Design 2 Calibration 2 F calibrate 2 P perturbParameters E T sweepParameter o T sweep TwoParameters 2 F checkCalibrationSensitivity 2 fl Examples 7 Intemal The function Design Calibration calibrate is the main function for calibration and validation of mode
174. s choice l Male choice 2 Female Use of enumeration types would have been more appropriate instead of Integer However Dymola does not support enumerations yet Boolean variables such as Boolean married Marital status annotation Dialog tab Properties group Marital status give by default a combo box with choices false and true However in many cases a check box is more convenient This is achieved by adding checkBox true 1 e be giving the declaration Boolean married Marital status annotation Dialog tab Properties group Marital status choices checkBox true By adding these declarations for sex and married Integer sex Sex annotation Dialog tab Properties group Sex compact true descriptionlabel true choices choice 1 Male choice 2 Female radioButtons true Boolean married Married annotation Dialog tab Properties group Marital status compact true descriptionLabel true choices checkBox true including compact true to move triangle closer to the input field we obtain the following dialog layout DataandGUlsamples Person5 Peron Properties Sex Sex f Male C Female Mantal status Mamed illustrations and formatting in dialogs To make it easier to understand the meaning of input data it s possible to associate a picture with a Group MODELICA DATA STRUCTURES AND GUI 85 Records lestGroupPicture TestGroupPicture Group p
175. s detailed post processing require access to protected variables e Check box in the dialog Experiment Setup Store Protected default 1s to not store them e flag Advanced StoreProtectedV ariables false e specify that a variable should be hidden annotation Hide true annotation Hide false overrides the flag Advanced StoreProtected Variables e This can cause some animation objects to disappear in particular for the PowerTrain library version 1 0 the problem is corrected in 1 0a and later versions You can either enable storing of all protected variables in Experiment Setup Store or contact Dynasim for a new version of the library Changing Protected variables in Simulation Setup Output Store does not force a recompilation of the model Other e semiLinear is now a built in function and redesigned to not generate events e Improved symbolic processing for intialization It includes exploitation of constant expressions This is in particular useful for steady state initialization where der x 0 is exploited to reduce the problem e Support for record constructor e Output arguments to functions may be omitted e In order to support inner outer components some new annotations are supported can also be useful for other cases annotation defaultComponentName world defaultAttributes inner missingInnerMessage No world component is defined A default world component with the default gravity field will be
176. s Rotational Interfaces PartialSpeedDependentTorque and adding the quadratic torque characteristics and the definitions of 1ts parameters model Engine extends Modelica Mechanics Rotational Interfaces PartialSpeedDependentT orque parameter Modelica Slunits Torque tau_0 parameter Modelica Slunits Torque tau_max parameter Modelica Slunits AngularVelocity w_max equation tau tau_0 tau_max tau_0 1 w w_max w_max 2 end Engine Please note minus sign for the torque to specify that the torque is a driving torque and not a reaction torque The parameters of the component engineTorque are then set as shown by its parameter dialogue Validation of the nominal model Let us first check how the model with nominal parameters compares with measured data Validation is set up very similar to calibration A basic difference is of course that no tunable parameters need to be specified for the validation The functions described in this document are parts of the Design package To load it select File Libraries and click Design To set up the calibration select Design Calibration calibrate in the package browser Click right mouse button select the command Call function Design Calibration Call Function perturbParam D sweepParam Open Class in This Window r sweepTwoPa Open Class in New Window E checkCalibrat Edit
177. s as will be discussed below The setup as Modelica code The calibration setup is represented in Modelica in the following way It is a function call where nested record constructors build the needed input arguments Design Calibration calibrate Design Internal Records ModelCalibrationSetup Model Design Calibration Examples SimpleCar Ea tunerParameters Design Internal Records TunerParameter name gearBox lossTable 1 2 Value 1 Design Internal Records TunerParameter name engineTorque tau_0 Value 320 calibrationData Design Calibration Internal Dynamic_common Design Internal Records DynamicCommonCalibrationCases experimentNames Acceleration measurements csv Acceleration measurements csv task 1 2 startTime 3 8 2 stopTime 6 0 3 parameterNames carBody v gearBox i parameterValues 68 4 3 6 2 34 39 9 3 6 4 17 resultCouplings Design Internal Records DynamicCalibrationResultCoupling variable carBody der v data acc integrator Design Internal Records CalibrationIntegrator stopTime 6 2 optimizer Design Internal Records Optimizer Saving the setup for reuse Note This cannot be After an execution of a command we can save it in the model for later reuse Select done for SimpleCar Commands Add command A menu pops up because it is read only f Call function izer Design Internal Records Optimizer Before execution model must be f No pre condi
178. setup can be stored in the current model using the button Store in model This applies to the General and Output tabs When the model is later selected these settings appear in the experiment setup dialog and can be changed before simulation A set of new inline integration methods have been introduced for real time simulation The following selector is available under the real time tab and as the built in variable Integer RECENT FEATURES IN DYMOLA 41 42 Advanced InlineMethod 0 Inline integration method not used 1 Explicit Euler 2 Implicit Euler 3 Trapezoidal method 4 Mixed explicit implicit Euler 5 Implicit Runge Kutta The order of the Implicit Runge Kutta method can be set between 2 and 4 Integer Advanced InlineOrder 2 Order of Implicit Runge Kutta method 2 4 More information about real time simulation can be found in the report Dymola Application Note HILS Output of manipulated equations in Modelica format Description The result of translating a Modelica model can be listed in a Modelica like representation The listing 1s stored in the file dsmodel mof and 1s meant to be a more readable version of dsmodel c The listing is enabled by ticking Generate listing of translated Modelica Code in dsmodel mof in the Model translation tab of Experiment Setup Experiment Setup Ed E General Translation Output Debug Compiler Realtime Model translation _ Evaluate parameters to
179. several parameters may influence the result in a similar way such that it is not possible to estimate them individually Assume that our nominal model is the correct model and we had used it to produce a measurement file If we make small perturbations of the values of some parameters and use the measurement file for calibration we would like the result of the calibration procedure to be that the perturbed parameters are tuned to their original values The function checkCalibrationSensitivity checks if this is the case If not it lists tuners that do not influence the criterion and linear combinations of parameters where changes of the appearing parameters do not influence the criterion if the linear expression remains constant As an example select the command Calibration with validation of the model Design Calibration Examples SimpleCar Select calibrate at the top in the tree browser click right mouse button and select checkCalibrationSensitivity Click Execute Dymola outputs a positive message The calibration criteria are sensitive for small variations around the nominal values in all tuner parameters and in all their linear combinations Let us try some other tuners Can we tune the engine and cardan inertia Select them as tuners S Design Calibration checkCalibrationSensitivity ax F checkCalibrationSensitivity 2 Tuner parameters E EA setup Description T Tuner parameters Model para
180. sfies additional bounds to and thus 1s physically correct Consider the following model where a length constraint should be satisfied and the length shall be positive model LimitProblem Real length min 0 equation length 2 length 1 end LimitProblem This equation has two solutions 0 62 and 1 62 However the solution at 0 62 does not satisfy the min value By enabling min max assertions in Simulation Setup Debug and allowing an error of le 6 it is guaranteed that an unphysical solution is not found and instead the physically correct solution at 1 62 1s found Min Max assertions if All variables lf Non linear iterations variables Allowed error e 006 Note that types in Modelica Slunits contain min values and thus by using Modelica SIunits some min values are automatically applied However based on the actual model it might make sense to add stricter limits Traceback message for errors in functions When an error occurs in a function call it is important to know in which instance of the function that caused the problem Consider the following simple model RECENT FEATURES IN DYMOLA 53 Step1 My F1 My F3 startTime 2 Clock My F2 My F4 startTime 0 Each of the blocks contain the same function call and in case one of them fails it is important to understand which one This problem can be even more pronounced in larger models model MyF extends Modelica Blocks Interfaces SISO function f input Real
181. should be able to reflect the organizational structure of the model development teams In order to increase quality and reduce development time tools should be made available to 213 214 e Provide a structure for organizing storing and retrieving information models simulation results documentation experiment data e Support the exchange of information and simplify reuse of models throughout the organization e Ensure that correct information is available to each user versions of libraries corresponding experiments A version control system provides means to track changes to a set of files A commit Operation associates a developer and documentation with each change to the common storage of files The Modelica text of two versions can be compared and it is possible to back up to any previous version The underlying version control system must be able to support multiple concurrent developers working on the same set of models Extensive locking of files is undesirable in a collaborative environment and more recent tools also support concurrent development of closely related parts with appropriate safety nets A single physical person may have multiple roles in the development or use of the library one role as a developer for new features of the library and one role fixing bugs in a release version of the library Traceability is essential for maintaining quality over time Tool enforcement to document modifications be
182. sitivity S setup Tunear rr Free start values Er Calibration data i FE cases mame E npp af enginemeria s ned 04 __ FE resultCouplings pa u Integrator 3 wheelinerias I tuo af carBodym me 2 g Optimizer Clicking Execute gives the expected answer The calibration criteria are insensitive for small variations around the nominal values in the following linear parameter combinations engineInertia J 0 1826 cardanInertia J 0 0153 wheelInertias J 0 0018 carBody m If we multiply by 1 this is the total inertia reduced to the engine side 186 Design optimization Design optimization Introduction Dymola includes features to perform integrated computer experiments with Modelica models This document describes the features to determine improved values of model parameters by multi criteria optimization based on simulation runs The functions and models described in this document are parts of the Design Optimization package The Optimization option is required However the optimization examples given below can be run without the Optimization option Consider a Modelica model describing a technical system that shall be improved Such a model includes typically many parameters that can still be changed for example the spring constants of a car the gear ratio of a gear box or parameters of a controller Some parameters might be determined by using heuristic design rules by adjusting them by
183. so decided to protect our intellectual property by encrypting the model MyTransferFunction before making it available to others The model MyTransferFunction may look like block MyTransferFunction Linear transfer function extends Modelica Blocks Interfaces SISO parameter Real b 1 Numerator coefficients parameter Real a 1 1 Denominator coefficients protected Real x size a 1 1 State parameter Integer na size a 1 parameter Integer nb size b 1 1 parameter Integer nx size a E Real xldot Real xn equation der x xn x1ldot x u transpose a xldot x y transpose zeros na nb 1 b xldot x end MyTransferFunction This is very similar to the model in the Modelica Standard Library However there is one very important difference The model in the Modelica Standard Library declares the state x in the public sections as output Real x size a 1 1 State 234 If it is possible to store the time trajectories of x it is possible to find out how we realize the transfer function by simulating different transfer functions In our MyTransferFunction the state 1s protected which to prevents users to store plot or otherwise inspect the simulation results for the state Let us test the model by connecting the input to the source to the sine signal generator of the type Modelica Block Sources Sine SNe 1 TF D S be he a s fregHz 1 Such a model is built i
184. ss in Package Order b i Experimentation The principal new operations are e Call Function displays a dialog to fill in parameters The Execute button shows the log window also in Modeling mode The Copy Call button copies the function call including parameter list to clipboard Dymola Scripting Plotting plotArray Inputs x PO OM Values y PO Y aluez style Je Stile of platting label Textsting documenting the plotted variable Execute Copy Call Close e Check of package e Edit Order to change order of classes e Close to close a package and all sub packages Clicking on the will close the package but when is clicked again all sub packages will be open as before The Close will close all sub packages so that they will not open when is clicked A new annotation from Modelica 2 1 has been introduced RECENT FEATURES IN DYMOLA 15 16 annotation DocumentationClass true It is used to control the browser for documentation classes such as ModelicaReference A special icon and the description string are shown in the browser selecting such a class will always show the documentation layer and dragging of such classes is inhibited Dymola supports a new annotation to control what layer to show when a class 1s selected annotation preferedView diagram text icon info Other minor improvements are e Protected classes are by default not includ
185. tSurface and plotBarGraph follows the same lines with particular variations VISUALIZE 3D 113 We want to emphasize the combination of contour plots with Wireframe This combination 1s particularly interesting to show interesting features of a function For instance the contour lines of the hyperbolic function z y 2xy for z 0 yield two straight lines and constitute a degenerated transition case between the hyperbolic lines in two quadrants above of z 0 and hyperbolic lines in the other two quadrants below of z 0 The resulting plot follows Visualizer 1 Ke Lop RES PERA Conn ee SR eee A The black lines are the asymptotes of both sets of hyperbolic contour lines red means z 4 green z 1 blue z 1 and yellow z 4 114 Other combinations can be useful to explain features too For instance when considering the Gaussian bivariate probability distribution If we integrate one of the variables let us integrate the y variable in this case the resulting univariate function is also a Gaussian distributed variable Combining the Rectangle on Top with the Rectangle plots of Plot3D plotBarGraph function we can illustrate just that The result follows Visualizer 1 The intersection of surfaces using Plot3D plotSurface is also possible The only thing we have to do 1s to increment the number of elements to plot in the dialog We can also set color and style to identify e
186. tanding application Model dependencies Dymola can export documentation of models and packages in HTML format The HTML documentation contains information extracted from Modelica classes For example model parameters and functions inputs and outputs are tabulated for easy reading without any need to understand the Modelica text Dymola can also make tables of cross references in HTML Such a table clearly shows dependencies to other packages and in some cases incorrect references can be found The following is an example from the design calibration package These classes have been referenced in this package Class Referenced From Plot3D sweepTwoParameters Design Internal Records MatCsvFileName dataPreprocessing Design Internal Records MatCsvFileNameOut dataPreprocessing calibrate checkCalibrationSensitivity perturbParameters sweepParameter sweep woParameters Design Internal Records PerturbationParameter perturbParameters Design Internal Records PreprocessingSignal dataPreprocessing Design Internal Records ModelCalibrationSetup Modelica Utilities Streams dataPreprocessing Modelica Utilities Streams print checkCalibrationSensitivity sweepTwoParameters checkCalibrationSensitivity perturbParameters sweep I woParameters Modelica_LinearSystems dataPreprocessing Modelica Utilities Strings 229 Modelica_LinearSystems StateSpace dataPreprocessing Modelica_LinearSystems TransferFunction dataPreprocessing Modelica_
187. tate along the axes x and y The figure below shows one possible view of the new created cylinder shell Visualizer 1 The operation of Visualize 3D can be summarized in the following table Operation Meta key Mouse move Arrow keys Pan Scroll none Left Right Up Down Left Right Up Down Rotate around x axis Ctrl Up Down Up Down Rotate around y axis Ctrl Left Right Left Right Rotate around z axis Ctrl Shift Clock wise Left Right Counter clock wise Zoom in out Shift Up Down Up Down or Wheel VISUALIZE 3D 99 100 We can also perform other operations on the cylinder shell Back to the dialog window and clicking on the edit icon we get the following dialog window CylinderShell ma Colinders hell Description Cylinder surface Inputs T length width height color color style colorlnterpolationD rection colorlntensity specularColor specularE xponent FL nw mi mi mi PX Transformation of coordinate system for graphical object Length extent of graphical primitive Width extent of graphical primitive Height extent of graphical primitive Color of graphical primitive Secondary color of graphical primitive Style of plotting Color interpolation direction Intensity color Specular color of material 0 0 1 0 Specular exponent shininess 0 0 128 0 Number of points for u Number of points for w We observe different graphical properties of the cylinder shell primitive We ar
188. tem of equations 1 2 dae sde Lp ea if Please note that all element of the J matrix are non literal expressions Elimination of variables must not introduce divisions by zero If we would like to use the first remaining equation to solve for the first unknown R3 p 1 we need to divide by J 1 1 R1 R R3 R Since it cannot be guaranteed that this expression always is non zero it is not a good idea to use this equation to eliminate R3 p 1 Thus to use an equation to eliminate a variable safely its coefficient must be a non zero numeric value Since the Jacobian above has no numeric elements it is not possible to eliminate variables further We need to invert the matrix It 1s indeed possible to do that for a two by two matrix and Dymola does it in some situations when generating simulation code for real time and HIL simulation However in normal cases Dymola generates code for numeric solution because it 1s allows better support of singular systems Diode circuit with two valued resistance diode model Consider a simple electric circuit with a diode and a resistor connected in series 48 L SA U Ld G Let the diode be modeled by the model Modelica Electrical Analog Ideal IdealDiode It models the diode characteristic as a conductance in off mode and a resistance in leading mode Thus in each of the two modes the problem is linear There is an algebraic loop with five unknowns of which one of them namely D off
189. ter sensitivities and dependencies cccccccecesseeeeseeeeeeeeeseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 177 Sweep one parameter sweepParameter sesest cass coe ecto dns ate oes aa ceo sce dinaaise dette ees Gots esn oe yet eee Soe 177 Sweep two parameters sweepTwoParameters ccsseeeesssseeeceeceeecaaaeeeseessseeeeeceeeeeeeeeeasueaeesssseeeeeeeeeeeeeeeaaaaas 181 Response to parameter perturbations perturbParameter ccccccccceseeseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 182 Check if tuners can be calibrated checkCalibrationSensitivity ccccccceceseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeees 184 DESIST OD CNT AU OM ai diia ivisiciiass 189 A telnaoaee edchic ae enh ea ale eaten tala dad De Goins A decea adn Ma aS T 189 A eas Ge E 191 NCAA experimen TE o a diia 204 o AAA tbe ia te ea waste eave date ia desea denca deez eeesene 205 Model Manace MeD sida czesbasendengecdedesaueensenseteecectavenscnscededecausensensesteneehassnccsscedeessaness 213 Version Maa MO re eRe em ee mn eee ee ec cee eee eee 213 Thecontext of version MANA EMO Saa 213 SCOPE Ol MAPICS Ma OM tetas 215 RL 0 018 6 2x4 ig eae OPERAR OP O po O o ee ee eee oe 215 Selectme version mandzement MM o 217 VEIS MARAL CEMSA O SS AA AA TEA AE EA AAA eI 218 An Example OL file MINAS 6ment USI GC Si 219 Version management usino SVN A A AAA A A A 223 An example ot file management using Ni 221 o e AAA ae ae tnend
190. ters Model Design Experimentation Examples CoupledClutches Modelica name of the model used So YariablesT oF lot 4 4 Inbegrator Info Copy Call Execute Close The next task is to select the parameters to perturb and the variables to observe and plot Click on perturbationParameters and then on the Select button 124 Design Experimentation perturbParameters T perturbParameters 5 perturbationParameters l HE setup Description perturbationParameters Model parameters to be calibrated o VariablesT oP lot mene Rows jo i 4 4 Inbegrator Select Info Copy Call Execute Close The following browser pops and the parameters J1 J J2 J J3 J and J4 J can be selected as perturbation parameters Their nominal value is for all of them The perturbation is by default 10 percent H zin H step J o E CI phi n Elis H clutch a i pu O phi H clutch3 Edd Reset from file Value We can select a percent change of absolute change if we like In the setup presented the parameters are perturbed 10 percent from their nominal value MODEL EXPERIMENTATION 125 Design Experimentation perturbParameters Cf perturbParameters 5 perturbationParameters El EF setup Description E B perturbationParameters Model parameters to be calibrated Rows E 4 AMM AU 2 WariablesT oP lot 4 4 Integrator LAR TORA E III RIMINI MIES IEA AA TR Info
191. the Modelica Blocks library are now scalar blocks As a result the parameters of the Blocks are scalars and no vectors any more For example a parameter amplitude that might had a value of 1 previously has now a value of 1 This simplifies the understanding and usage especially for beginners If a vector of blocks is needed this can be easily accomplished by adding a dimension to the instance For example Constant const 3 k 1 2 3 defines three Constant blocks An additional advantage of the new approach is that the implementation of Modelica Blocks is much simpler and is easier to understand All components of the ModelicaAdditions library are included in the Modelica Standard Library in an improved way e ModelicaAdditions Blocks is included in Modelica Blocks The logical blocks have a nicer icon layout now e ModelicaAdditions Tables iS included in Modelica Blocks Sources and Modelica Blocks Tables e ModelicaAdditions MultiBody is obsolete and is replaced by the much more powerful library Modelica Mechanics MultiBody this is version 1 0 1 of the MultiBody library where the signal connectors have been changed to the new signal connectors e ModelicaAdditions HeatFlow1D is obsolete since a long time It was replaced by the improved library Modelica Thermal HeatTransfer e ModelicaAdditions PetriNets is obsolete and is replaced by the much more powerful library Modelica StateGraph When opening models built using early
192. the Modelica area via CVS you set up your CVSROOT when the files are initially checked out and do a cvs login with an empty password After that the usual CVS commands work as expected If you work against a single CVS repository it may be convenient to set the CVSROOT environment variable to the value below as an alternative to using the d command line switch pserver anonymous cvs modelica sourceforge net cvsroot modeli ca To use it you must first login and then check out using these DOS commands cvs login empty password cvs checkout Modelica check out standard library This will checkout the entire Modelica standard library in the current directory An example of file management using CVS In this example we will demonstrate the basic version management operations provided by Dymola It is divided into several different steps to setup a local CVS repository to create a new model and to make changes to an existing model 219 220 Setting up the CVS repository A local CVS repository is set up and then a new top level directory called models is created Finally the new top level directory needs to be checked out in the current working directory Execute these DOS commands mkdir cvs cvs d cvs init mkdir cvs models cvs d cvs checkout models A new empty directory has now been created in our working directory Creating a new model We can start by creating a model in Dymola and saving it
193. the intention is to change and paint again the Visualize 3D window has to be erased This can be done by right clicking on the window the context menu opens and the selecting Erasing window as below This operation will clean the window object list Visualizer 1 Erase Selected Objects Change projection type Reset Print a Export image as VISUALIZE 3D 101 102 The matrix T 1s used to perform transforms on just the associated object Operations like translation scaling and rotation of the body respect to the global coordinate system are described with this T matrix These transforms are independent of the global view and are used to construct the 3D scene Clicking on the combo box arrow shows the predefined possibilities CylinderShell ge CylinderShell Description Cylinder surface Inputs T MoTranaformation Transformation of coordinate system for graphical object length m Length extent of graphical primitive width MoT ranstormation height Translate 1 m Height extent of graphical primitive Rotates color Fiatatet Color of graphical primitive m Width extent of graphical primitive color Rotates Secondary color of graphical primitive colorlnterpolatianD rection Tion om Color interpolation direction Style of plotting colorlntersity Intensity color specularColor 0 8 Specular color of material 0 0 1 0 specularE xponent 10 0 Specular exponent shininess 0 0 128 0 rill Es
194. ther fashion We can sweep one parameter and observe the result along the whole interval form 0 to 1 2 or just at the final time of 1 2 seconds These variants are implemented in two functions sweepParameter and SweepOneParameter sweepParameter The setup of this function is very similar to perturbParameter Click on Design Experimentation sweepParameter to get the setup menu The model is already filled in Design Experimentation sweepParameter CF sweepParameter EH setup Tree data sas setup m lnputs 2 dependencyParameters Model Design Experimentation E samples CoupledClutches t Modelica name of the model used So WarablesT oPlot 4 t Integrator Info Copy Call Execute Close We have to select the dependency parameter and the variable to plot The way 1s the same as before We just present the menus as a guide Design Experimentation sweepParameter Cf sweepParameter dependencyParameters El HH setup Description B 2 dependencyParameters Model parameters to be calibrated I A YariablesT oPlot Rows AS Pm JEquidistantaridi0 8 1 1 5 ES 4 4 Integrator Info Copy Call Execute Close In this case we are selecting five equidistant values between 0 8 and 1 1 for J1 J The variable to plot is J1 w MODEL EXPERIMENTATION 129 Design Experimentation sweepParameter P sWeepParameter 2 WarablesToPlot E EB PUp Description E 4 dependencyParameters Variables t
195. thesis or put the cursor inside name and select Edit Function Call in context menu RECENT FEATURES IN DYMOLA 29 30 It is possible to go to model function from Modelica text Select a class name or put the cursor inside the name The context menu contains operations on the Selected Class Other operations in text editor The number of the current line is shown in the statusbar It is also shown as default if you select Goto Line from the context menu shortcut Ctrl G The Find operation will automatically scroll the window to make the found text visible Find Replace in Modelica text gives warning 1f search string 1s not found A selection of Modelica text layer can be printed If you have selected a part of Modelica Text and then do File Print there is an option to print only the selected text instead of the whole model The formatting of declarations equations etc is kept by default The formatting is not kept for e Multiple statements or declarations on one line e Indentation of end tags such as end lt class gt e Indentation of separators such as then else e Multiple empty lines e Comments inside declaration of components or type prefixes of classes e g inner class a end a e Comments inside expressions e Equal sign for modifiers e Minor errors that are automatically corrected e g incorrect use of vs If a syntax error is detected the position of t
196. tion C Translated C Simulated Prompt for arguments Description fC O O Tick Prompt for arguments and enter a description which will be used in the commands menu Since the model needs to be translated in order to get the select browsers we tick that model shall be translated This is not critical butter only a matter of convenience If we do not tick Translated then when a browser need s to be popped Dymola will give a prompt pointing out that the model needs to be translated If we just select the command and then click Execute there will be no prompt but function is executed as expected The model is MODEL CALIBRATION 175 translated when needed The edit button next to the function call allows you browse or edit the function call once more f Call function fizer Design Internal Records Optimizer Before execution model must be No pre condition Translated C Simulated W Promptfor arguments Description Calibration with validation OK Cancel Click OK A function call menu as for calibrate has an Execute button Clicking this button start an execution of the function and the menu stays popped If we click Close the menu 1s closed without any execution If we click OK the function is executed and the menu is closed You click OK by mistake when you meant Execute you can fix the situation Click in the command input line Press the up arrow once to scroll back in the commands give
197. tive systems in a convenient way using hierarchical state machines and Modelica as action language It is based on JGraphChart and Grafcet and has a similar modeling power as StateCharts It avoids deficiences of usually used action languages This library makes the ModelicaAdditions PetriNets library obsolete The example shows the controller for a tank system RECENT FEATURES IN DYMOLA 69 70 makeProduct level 0 001 TS emptyTanks T levell level Modelica Math Matrices Functions operatinng on matrices such as solve A x b leastSquares norm LUO QRO eigen Values singularValues exp Modelica Utilities Functions to operate on files streams strings and support for operations in the operating system Comparison to Modelica Standard Library 1 6 Modelica 2 1 and 2 2 are major changes with respect to 1 6 and previous versions of the Modelica Standard Library because many new libraries and components are included and because the input output blocks Modelica Blocks have been considerably simplified e An input output connector is defined without a hierarchy this is possible due to new features of the Modelica language For example the input signal of a block FirstOrder was previously accessed as FirstOrder inPort signal 1 Now it is accessed as FirstOrder u This simplifies the understanding and usage especially for beginners e De vectorized the Modelica Blocks library All blocks in
198. tlab files CSV files for Excel and Text files e Matlab routines for easier construction of 2 dimensional load2DTable m save2DTable m and n dimensional loadNDTable m save2DTable m files e The n dimensional routine works in combination n dimensional table lookup model TableND The file is found in Dymola Modelica Library TableND mo and will later be integrated into the Tables library RECENT FEATURES IN DYMOLA 39 40 Diagram layer in simulation mode The diagram layer representing the model is available in Simulation mode to enable the user to follow a simulation by displaying variables and to control 1t by setting parameters The user can descend into any level of the model in order to plot or display variables Push the diagram layer button to show the diagram The context menu for a component contains the choice Show Variables which opens the plot selector for the selected component instance robot ModelicaAdditions MultiBody Examples Robots r3 robot Read Only File Edit Simulation Plot Animation Commands Window Help e 1438 NP Ba E 200 eS 2304 DD E 0 xi na robot axisd raboto ts elk Cwm OD i z ref EJflange_motor HoutPort w i HoutPort_phi 0 08 Diagram Pi i GlinPort d iia AZ Ml bi F Advanced ij integratorfintegrator 2 al raContral k1 rSMotom r3Gear2 states Parameters Show Component Open Cl
199. to select the previous model and on the arrow next to this to select one of the most recently viewed models Rl gt aE y Ildealaearh 2T dealGear Dynamic tooltips Resting the cursor over a model component or connector displays a tooltip with type and name Over a connection line the tooltip contains the names of the connectors Ey HyLib Valwes ReliefValwe EV Ey Interfaces Port B port E Hydraulic port where oil leaves the component Edit Align The alignment operations are used to organize objects in the graphical editor It is an alternative to moving the objects with the mouse or by using arrow keys RECENT FEATURES IN DYMOLA 19 20 Left Middle Right W e Til Co Top HF Center il Bottom Tf ToGrid ctrl G The alignment operations Middle Center and To Grid use a center point for alignment For graphical objects the center point is the center of the bounding box of the object For components and connectors the origin of the coordinate system of the component s class is used as center Align objects The majority of commands in Edit Align align graphical objects with each other The first selected object is used as reference and does not move First select the reference object Then select the objects that should be aligned with the reference while holding down the Shift key This creates a multiple selection with a known reference object Finally select the appropriate a
200. tomatically use a homotopy method to handle difficult cases e Automatic test of non zero start values in non linear systems e Special handling of scalar systems e Improved diagnostics Improved behavior and diagnostics for non linear solver Improved debug facilities while dymosim is running e Can enable logging of non linear systems of equations e Can interrupt during initialization New tab for selecting logging of Debug information in the Simulation Setup menu These correspond to the debug facilities while dymosim 1s running but are easier to access For details see the tool tips Experiment Setup General simulation debug information i Normal warming messages Settings included in translated model Event logging Events during simulation Events during initialization Nonlinear solver diagnostics Nonlinear solution Nonlinear iterations Details State variable logging Which states that dominate error Dynamic state selection Final selection of states Store in model Cancel The continue command has been extended in the menu to also allow continue from an arbitrary point in a result file from the same model Improved initialization and extended support for mixed equation systems Find in log windows see context menu or use Control F Improved event handling e Full support of smooth e Fewer events generated Improved handling of tables e Table editor has load save buttons for Ma
201. trivial result Dymola puts the component in an environment that should reflect a general use of the model e All inputs of the model are considered to be known e Flow variables that are not connected will at translation be set to zero However checking a flow source components that defines the flow variable in such a way would make 1t singular Such models are not intended to be used in that way At checking Dymola instead generates for each flow variable an fictive equation referring all variables of all the connectors of the model component The aim is to create the most general variable dependence that may be generated by connections e The equations of the model component may depend on the cardinality of its connectors whether a connector is connected or not The Check operation of a component considers all the connectors of the component to have connections on their outer sides e Overdetermined connectors for example in the MultiBody Library are dealt with in the following way If an overdetermined connector of the model component is part of a connected set that has a root or potential root candidates everything should be fine Otherwise Dymola specifies the connector as a potential root and if it is selected as a root Dymola adds fictive equations referring to all of the variables of the overdetermined connectors to compensate for the missing redundancy Checking of model components are done recursively As indicated above a struct
202. tures of the Modelica language Arrays The support for array of records makes it possible to check the entire Modelica 2 2 library Increased support for arrays in the interactive environment e The size of arrays of records can depend on the inputs e Arrays in functions declared using the size can be resized by assigning to the entire array This applies to both arrays of records and arrays of simple types FunetLon input Integer n output Real x algorithm for jJ in 1 n loop x cat 1 X ies end for end f RECENT FEATURES IN DYMOLA 31 32 Array of records with literal size is supported in compiled functions Conditional declarations Conditional declarations are supported according to the Modelica 2 2 semantics If the condition 1s false the component is removed including modifiers and connections to it model C2 extends Modelica Mechanics Rotational Examples CoupledClutches parameter Boolean addFriction true Modelica Mechanics Rotational BearingFriction BearingFrictionl tau_pos 0 2 if addFriction annotation extent 62 62 82 42 equation connect BearingFrictionl flange_a J3 flange_a annotation POLARES 627 52 50 52 50 0 35 0 style color 0 rgbcolor 0 0 0 end C2 Checking for structural singularities Dymola has extended support for checking for structural singularities ofthe model equations When using a model for simulation it is a basic requirement that there
203. ulation Dymola Save Script Store script for Command log Plot setup Animation setup Settings fe g translation settings Variables Store variables at Initial Final Store which variables e Parameters and states O Al Also include Simulation setup A i Cancel It is possible to specify that the generated script shall be callable from the Commands menu associated with the current model see section Commands menu on page 36 Selecting models in File Demo does no longer change current directory Import statement can be used on command line import Modelica Math true sin 1 0 841470984807897 Redeclaration of size for variables in work space allowed a 1 10 Declaring variable Integer a 10 a 1 20 Redeclaring variable Integer a 20 New built in functions to write to log window Utilities ModelicaMessage message Plotting and animation Variable browser context menu The top level nodes in the variable browser represent simulation result files other nodes represent the component hierarchy and variables and parameters at the lowest level The variable browser has a context menu with several important operations Variable Browser Variables Values Unit CoupledClutc EE Cl fregHz 1 2 Hz OT2 Open All Els OT3 Close EJE J Save As torque Close Result clutch Animate E sin l gt Flaten The first three choices are available for
204. une it is good to consider the question Which parameter values are most uncertain In the model above friction and losses in the gearbox elements have been neglected Frictions and other losses are good examples where calibration is useful There are for instance losses in both gearBox and finalDriveGear however having only measurements of the translational motion of the car 1t 1s not possible to decide the individual losses of these two elements Thus 1t 1s necessary to aggregate all losses to one element and gearBox is selected since it has provisions to model efficiency The efficiency is given by gearBox lossTable 1 2 see the documentation of Modelica Mechanics Rotational LossyGear The parameter tau_0 was manually selected to 320 so it is a good candidate for tuning Dymola supports an interactive explorative approach to this problem Dymola has powerful functions to perform parameter sweeps and to analyze parameter sensitivities and possible couplings between parameters with respect to the result variables to eliminate irrelevant parameters and to diagnose over parameterization However let us come back to these later and first try tuning the two parameters First we have to set the task to Calibrate Click on cases in the tree browser to the left and set task to Calibrate EA zx ia Free start values E Calibration data BES cases t a Integrator 5 Eq Optimizer FE inputCouplings EZ resultCouplings
205. up t Tuner parameters d E E caseParameters to_alpha_c settlingTime feedback rad gt gt gt deg maximum to_delta const Po EMA gt p k0 deg booleanStep O Criteria i a Examples 0 overshoot 1 RiseTime AI 44 Overshoot ae i A to_alpha riseTime SettlingTime a ft MaximumDeviation j A deg 13 IntegratedSquaredDeviation In order to access this variable a bit easier in the top level text layer of the F14 example an alias variable maxElevator is defined as output Real maxElevator unit deg criteria maximum y In other words maxElevator is the maximum deviation of the elevator signal from zero In the variable tree browser of caseCriteria the used criteria might be defined by selecting again variables here overshoot and maxElevator Nr caseCriteria Description Criteria definitions for one case Rows 2 EE caseCriteria caseNames name active overshoot v i EE cases 11 demands am integrator maxElevator v The default value in column criteria of the above menu is FinalValue 1 e the final value of a variable in the model is used as criterion Alternatively this pop up menu also allows selecting other criteria that are not defined in the model but are deduced from simulation results In some cases this is more convenient Criteria based on linearization
206. up to plot those with more samples To plot the densities we take five thousand samples and uncheck the flag Plot results of every draw Press Execute to obtain the plots Expected Value 2 64922 Standard Deviation 0 334017 Pxpecicd Valle 2017 Standard Deviation 0 183664 2 5 1 2 IA 2 07 An gt I eal 5 os a T Cc wn o o a la y 7 gt 107 Ss E 8 Q e 04 3 i 05 0 0 ll iii aet 0 0 e 0 5 2 3 4 1 6 2 0 2 4 2 8 3 2 J1 w J2 w Expected Value 2 45047 Expected Value 2 44975 Standard Deviation 0 183664 Standard Deviation 0 183524 2 5 2 5 2 07 att 2 07 AHHH gt 15 H gt 157 H 7 D _ 2 1 07 E 2 1 07 G o oO oO 8 8 E 057 05 0 04 al i Mm A 0 0 aai oh 0 5 Una l 1
207. ural singularity may be caused by improper use of components or come from singular components When trying to pinpoint a source of singularity we cannot assume that the components are correct because we have checked all model classes First the checking of a model component assumes a general use however when actually using a component the environment are more specific and singularities may then show up Secondly modifiers with redeclare may imply drastic changes of a component and there may not be an explicit class to make relevant checks on Thirdly this is even more accentuated when there are class parameters to set Fourth dimension parameters may take other values then assumed when checking the component model When Dymola finds a component to be singular it makes a recursive check of the components Dymola then tries to set up an environment that mimics the real environment in the best way For example a connector not being connected the generic equations for the flow variables of that connector are not generated but zero default values are used For example a flow source will then be diagnosed as singular Also the cardinality is preserved The error diagnosis output exploits the results If a component is found to be singular this is reported If no component is found to be singular the error message focuses on the use of the components The extended structural checking is enabled by default but can be disabled by setting the flag Advanc
208. used g 9 81 in negative y axis If this is not desired drag MultiBody World into the top level of your model e Handling of functions with non alphanumeric names e g lt has been improved e Expandable connectors are supported see Connections on page 18 RECENT FEATURES IN DYMOLA 35 Simulation 36 The main improvements in the simulation mode are model specific commands menu a new simulation window and improvements in the simulation itself to give increased robustness and diagnostics Commands menu The Commands menu has the choice Add Command This function 1s used to associate commands Modelica functions or script files with models The Commands menu can in addition to file file mos have executeCall foo and editCall bar Both of these calls the given function instead of running the file and editCall allows the caller to modify the function arguments before calling the function These commands are added to the Command menu when the model is active An annotation of the following form is used annotat ton Commands file file mos Script LO ssa file file ppt PowerPoint presentation The directory where the model was found is used in front of the file name Mos scripts are run everything else is opened Note Running a script does not perform cd to its directory thus the script cannot run other local scripts 1 e a full path to such script is needed You can also specify that commands are
209. valuated at continuous integration This section is executed at the end of each step to check for events The output dynamics and accepted sections are executed at event propagation also Finally there is the Conditionally Accepted Section It includes calculation of variables which are not necessary to know when calculating derivatives or updating discrete states This section is executed when storing values In some situations for example when simulating on a HIL platforms where only states and outputs may be visible the conditionally accepted section 1s not executed at all As shown by the listing Dymola converts this problem symbolically to explicit ODE form no algebraic loops to solve numerically We can observe that Ohm s law of the resistor R1 is used to solve for the current through the resistor C n i R1 v R1 R On the other hand Ohm s law of the resistor R2 is used to solve for the voltage drop across the resistor R2 v R2 R L i The sorting procedure of Dymola automatically finds which variable to solve for from each equation Connections between non flow connectors result in simple equations vl v2 A connection between two flow connectors gives vl v2 0 Dymola exploits such simple equations to eliminate variables The listing of these variables is not enabled by default as indicated above because it may give much output If we enable the listing of alias variables by setting the flag Advanced OutputModelicaCo
210. vershoot of ang rise Time 0 554484 s rise time of angle O settling T ime 3 5946 settling time of a 0 maxElewator 1 17046 deg maximum elevate El controller Advanced H A Constante Time varying e Original F Difference Compare Results Search Filter Time f T ad O Ef 1 72 simulateModel Design Optimization Examples ControllerDesign Flt stopTime 10 method dassl corri modeling 4 Simulation E The plot browser shows the corresponding criteria values o overshoot riseTime settlingTime maxElevator current value 0 055 37 12 206 You see that the riseTime criterion 1s not yet satisfied Therefore a new optimization task will be defined you may use Commands Run 7 instead In this particular step we only consider the nominal case It should be straightforward to define the tuners Kf Ki Kq and the criteria overshoot riseTime settlingTime maxElevator with the demand values given in the above table Further we define the aerodynamics parameters as case parameters E Design Optimization optimize T optimize EX caseParameters gt V soup Description Tuner parameters Model parameters defining one case e g operating point B caseParameters a oe YA caseCriteria ES case ames pu EE cases pu la demands SL integrator E optimizer Select
211. w the command MonteCarloAnalysis to observe the model response when varying J1 J J2 J J3 J and J4 J at the same time As before select Design Experimentation MonteCarloAnalysis function The following menu pops Design Experimentation MonteCarloAnalysis Fy MonteCaroAanalpsis m j as setup 134 uncertainParameters ie imedParameters H observed ariables 4 Integrator EH setup Tree data Inputs Model Desion Espermentation Esamplez CoupledClutches Po Modelica name of the model used for Monte Carlo Info Copy Call Execute Close The task now as before is to select the uncertain parameters Click on uncertainParameters and click on Select button Select in the browser J1 J to J4 J Select Component clutch H sinl H step And click OK The next step is to select a random distribution for every intertia Design Experimentation MonteCarloAnalysis fF MonteCarlo4nalysis uncertainParameters l H setup Description H uncertainParameters Model parameters to be calibrated pa fisedParameterzs io observedVariables ows E A intestate Random Distribution E A Fe RO EE Te CON r AAA Select Info Copy Call Execute Cloze Click on the arrow of the combo box and select randomNormal for J1 J Another menu pops up asking for values for mean and standard deviation Those values characterize the normal distribution to be us
212. where each public non partial model block is scrambled individually and then placed together in a package Each individual model is scrambled as explained in the next to remove unnecessary information and the resulting file 1s then encrypted as an additional safety precaution Example of scrambling We continue with the inertia example but now rewrite the Inertia model by replacing the parameter J by two variables r and m and computing the inertia based on these as follows model Inertia3 240 extends Modelica Mechanics Rotational Interfaces Rigid parameter Modelica Slunits length r 1 Radius protected constant Modelica Slunits Mass m 0 5 Mass Modelica Slunits AngularVelocity w annotation Documentation info lt html gt An inertia of a certain shape with settable radius lt hem tyjz equation w der phi m r 2 12 der w flange_a tau flange_b tau end Inertia3 The mass and the shape should be hidden from the user of the model By selecting Export Encrypted total model the model is first scrambled and then encrypted The procedure gives the messages Will encrypt to file C dymola work Inertia3 moe First scrambling to ile E 0ymola work TInertias tmp m Scrambling Inertia3 The scrambling should preserve the following top level variables connector flange_a connector flange_b parameter r Scrambling complete verifying it Encrypting Encryption complete file
213. xecute Close 136 The flag automaticBins set to true allows the algorithm to choose automatically an appropriate set of bins according to the maximum and minimum values observed in the result It takes also into account the total number of samples to set the appropriate resolution Set the integrator stop time once more to 1 2 To set up the type of desired result click on MonteCarloAnalysis Design Experimentation MonteCarloAnalysis QD MonteCarloAnalpsis EH sebup E uncertalnParameterz p fixedParameters observedyariables 4 4 Integrator Cf MonteCarlo nalzis Tree data Description perform Monte Carlo Simulations to obtain the resultant probability distribution at tetop Inputs Number of random samples 0 Show Accumulated Distributions Plot the results of every draw ne Info Copy Call Execute Close We set the number of draws in the field Number of random samples As we want to plot the result of every draw only twenty draws are needed Check also Plot the results of every draw to obtain the plot of the responses and the density of probability 103 0 00 0 25 0 50 0 75 1 00 MODEL EXPERIMENTATION 137 138 In this graph we observe the variation of slope and behavior produced by random sampling of the values of J1 J J2 J J3 J and J4 J in time If the plots of the density of probability or accumulated probability are important we change the set
214. y density Accumulated probability Normal randomNormal randomDistrib randomNormal Inputs Mean Value 0 Standard Deviation 1 Probability Density Accumulated Probability Uniform randomUniform randomDistri randomUniform Inputs Masximun Walue of Interval 0 Minimum Value of Interval 1 Probability Density Accumulated Probability Logarithmic randomLogNormal randomDist Normal randomLogNormal Inputs Mean Value 0 1 Standard Deviation 0 5 Probability Density Accumulated Probability Pareto randomPareto randomDistribu randomPareto Inputs lpha 1 Probability Density Accumulated Probability mo cue 140 Exponential S randomExponential randomDist randomE xp
Download Pdf Manuals
Related Search
Related Contents
Invacare® Programmiergerät WARRANTY Exacompta 55877E folder AVG AntiVirus User Manual V7 Slim Folio Stand for iPad, Green Télécharger la notice PC-CamLink™ User`s Manual 405-00009-00 ダイリーグMSDS(PDF:1.94MB) Copyright © All rights reserved.
Failed to retrieve file