Home
Dymola - Dynamic Modeling Laboratory
Contents
1. lt gt 10 phi 3 al plot phi SimulateModel Pendulun b x stopTime 10 method dassl1 result File Pendulum true mmands Modeling y Simulation The results of previous simulations are available as the experiment Pendulum 1 in the Variable browser We can open it up and have phi of the two runs plotted in the same diagram by expanding Pendulum 1 in the variable browser and check the checkbox for phi Results from two Pendulum Pendulum Plot simulations Jy File Edit Simulation Plot Animation Commands Window Help JAK TA QOS ILERE CUA EEA T meagan Boia ib Mo M 44 4i ib DD Timefo E Speed 1 v Variable Browser 3 phi phi Variables Pendulum 1 OOO der phi Ww der w dulum 2 3 phi der phi Uw der w v K gt phi 3 plot phi SimulateModel Pendulum stopTime 10 method dassl1 resultFile Pendulum true x Commands modeling W Simulation Values of parameters are changed in a similar way To simulate another length of the pendulum just enter a new value for L and click on the simulate button 1 3 2 Improving the model Using pre defined physical quantities The parameters and variables are more than real numbers They are physical quantities The Modelica standard library provides type declarations for many physical quantities Usi
2. The model window now contains an empty Motor model The edit window has a gray frame and grid to indicate that the component is not write protected It is possible to toggle the grid using the toolbar button Before building the motor model please note that selecting a package in the package browser by just clicking on it does not mean that it is the one that is displayed in the edit window and component browser Yes it is indicated in the package browser by blue or red if not saved but the one displayed stays the same and is indicated by a blue frame in the package browser the name in the window header the top name in the component 48 browser and the name in the bottom left in the window By double clicking or right clicking on the package in the package browser the displayed package is changed however We will now start building the motor model To make it easier to follow the instructions the result is displayed below The finished motor model with all compo nents wil dim flange _b1 1 F J 0 001 We need a model component for a resistor It can be found in Modelica Electrical Ana log Basic The basic approach is to use drag and drop You can drag and drop from the package browser or from a library window To drag from package browser open in turn Modelica Electrical Analog and Basic Note that title of the Dymola window 1s still DriveLib Motor and also the component browser has DriveLib Motor as
3. lt gt amp lt gt Package a x info info rey rew TP ay Math A basic model of an electrical motor 31 ComplexMath Information Utilities This is a simple motor model i 7 Constants T a This documentation can certainly be extended using e g links and images of this editor An image of the toolbar above illustrates the image possiblility i 2 Icons _ st Kg Stunits _ Normal _ Default Oef 7 B Z Uxx Aro Esas f i pe For more information about this editor please see chapter Developing a model in this manual h Driv Swot sid More information about Dymola in general is found in www Dymola com id JL gt Lew Component Browser f x Connectors DriveLib Motor Type Name Ra input RealInput v1 Voltage between pin p and n p v n v as input signal ji G f Flange _b flange_b1 Right flange of shaft em Vs Name Motor Jm Path DriveLib Motor La Filename E Experiment DriveLib mo Uses Modelica version 3 2 1 vl E flange_bl The link can now be clicked by hovering on it the URL is shown in the status bar of Dymola main window bottom of window not shown in figure above The revision information can be edited in a similar way using Revisions editor We have now created the model Save it 1 4 5 Testing the model It is possible to check the model for syntactic semantic and structural errors Select Edit gt Check Hopefully your model will pass the check and you will g
4. Ctrl Shift L Pendulum ooo O Comment Selection Ctrl k Settings i Insert Component Reference d Insert Local Class Reference ta Insert Function Call Ctrl W Insert Type Insert Staternent Edit Function Call Ctrl U Selected Class The result is the declaration dialog just as before Mew Variable Declaration Type Prefix Modelica Real After having selected parameter from the dropdown menu we realize that the default type Real is not what we want in this case neither are any of the other dropdown alternatives relevant for us What we really would like is some length type However we can browse for any type available in the package browser by the browse button And on top of that we can type in the Search input field The search is dynamically updated while typing This is illustrated in this figure New Variable Type Prefix Type and name Description Declaration Search leng Modelica parame P Modelica Kkg SIunits Length PathLength Wavelength Wavelenght Compton Wavelength SlowingDownLength DiffusionLength MigrationLength CoherenceLength This was exactly what we wanted It is sufficient to click OK to get the type since it is preselected If we wanted another of the displayed types we could have selected that before clicking OK It should be noted that the way above is available also when the Modelica Text laye
5. Inpro vin he model x cisccsok ssi han cess a ba tcesed oud eosnnans Aecodie ies occas aad oti ade eee 29 l4 Usim the Modelica Standard Library oh scccscosieiusacs oie tatiance cacatiedysansanidciodiania scl eoiialeas adda ea 3 1 4 1 The Modelica Standard LAB rary i csceses coteions cnsvac a E ai adda eae ST 1 4 2 Creating a library TOP COMPO MEMS iss cede ots ee Mantes ered a tees 45 1 4 3 Creatine a model foran electric DC Motor iwciccasetiesccicccts vs ests AW ian lee A 47 1 4 4 V c menuns tele 11 6 6 krenari ene nn near on ae ree er nae errant er ern ee enon whe en E ner een E 53 1 4 5 NSS CLIT ES PIONS e asia sacs ais ccs aaa ec aa scat erectanica Raat a ea ute i tate nhac se acre nert astute dale toe euusemaes 56 1 4 6 in nas the Wy A GS sce ac er se cs T case ale atna de enone Sasa eaten dale waceeueaaes 60 1 4 7 Creating TnOGel Or Ne MOlOL Gri Cee ti55 Dor snaca tain a daisusayaeasncaie wacbueteeays 64 1 4 8 Parametere pres SIO INS assed sear tales ecm ease ctu actuate a au coda ead teatand ade wneeeueoae 68 1 4 9 IG CUMe MUN 8 the siman oms est caictaiaten cae ween a Gagtaseetedandale Wacstuetoas 73 VALO SSCUIPUMINS 4 Jeu nasvinct seacaus Soa EE EE anacodetonsiasayoniansenanensnotcacssdaiansuauahtaccedelonssonsbadces 75 LS Buldi r amec iamo mode Eians oE a EO EEEE Eet 71 kO OMET AIDE ATICS aironi onno E EEO EEEE EO E ESEE EREA 82 1 6 1 Libraries available mthe File menu Dy defali vosmsoniiiorgesge aoig n EREE ERDAS 82 1 6 2
6. Libraries that Can De Added c 2 ccscsudtecsctentamaanchcesnecerdniensacs EEEO OEE EOE TEANO 84 Er Helpand normai oeaan E E 84 1 7 1 Reaching Compressed ANLOr malo anaa a a wean a sectors 172 Reachine Morc extensive Imorat ON a2 aieai ae Candle ddtavaawoctincranmiencas dutadenldhiavectandetaincascauulentes S SNO CU aa a S O ee ne en 2 MING OX ivssscvssusccsstuvsedesadescvesarssedeveatsccssaesesdceeduadeusauweacevadsaeusshavenddshdcasectaussndenadeaaeretasbaddehdenctesadwedse 1 1 1 Modeling Getting started with Dymola Introduction W Simulation This chapter will take you through some examples in order to get you started with Dymola For detailed information about the program you are referred to the on line documentation and the user s manuals The on line documentation is available in the menu Help gt Documentation The tool tips and the What s this features are fast and convenient ways to access information Please see section Help and information on page 84 for more information Start Dymola The main Dymola window appears A Dymola main window operates in one of the two modes e Modeling for finding browsing and composing models and model components e Simulation for making experiments on the model plotting results and animating behav ior Dymola starts in Modeling mode The active mode is selected by clicking on the tabs in the bottom right corner of the Dymola window The operations tool buttons a
7. PID controller has four parameters k Ti Td and Nd There will be some warnings when translating We will take care of those later One way to tune a PID controller is by first disabling the integrator and derivative parts This is achieved by setting a large value for Ti and a small value for Td Set k 2 Ti 1000 and Td 0 001 and simulate for 5 seconds Use Simulation gt Setup to change the stop time As can be observed the step response is very slow Increase k to find out what happens Make sure to also investigate the magnitude of the control signal controller y The result will be MotorDrive lest DriveLib MotorDrivelest Plot File Edit Simulation Plot Animation Commands Window Help wda yika Be vet g2Sh AUE bp IL I 4 4i ib gt Timell J Speed 1 v Variable Browser f phiload phi Variables Values positionerror controller 1 0 initT ype xi_start xd_start y_start HP Hl WD Gain Add motor gearbox load amp phiload flange phi rad Estep height Trad vy l rad offset Nlrad e K gt phiload phi in MotorDriveTest mat modeling We Simulation Tuning result The interested reader may next proceed to tune the controller parameters to obtain a nice step response For example aim at a rise time around 0 4 seconds a settling time around 1 second maximum overshoot of 10
8. Translation i Translation of DriveLib TestMotor i The DAE has 50 scalar unknowns and 50 scalar equations AN The initial conditions for variables of type Real are not fully specified Dymola has selected default initial conditions i Assuming fixed start value for the continuous states motor La ifstart 0 i i Assuming fixed default start value for the continuous states motor Jm phi start 0 0 E motor Jm w start 0 0 i Statistics i Selected continuous time states AN The following parameters don t have any value only a start value _ motoremf k start 1 i Finished i WARNING 2 warnings were issued i Finished Two types of warnings are present for this example a warning that initial conditions are not fully specified at the top of the tab and a warning that a parameter does not have any value only a start value at the bottom of the tab The first type of warning has been described previously see section Handling of warnings on page 35 The difference here is that we can use the graphical user interface to set the variables to fixed we do not have to enter code Looking at the warnings they all have to do with components inside the Motor model By double clicking on the Motor in the package browser we return to this model The first variable of the upper warning section is located in the inductance component La Double clicking on this component will however not display any Initialization
9. Type and name Description Modelica Modelica Slunits Mass Now we can specify the type prefix parameter the name value and description etc By keeping the cursor on top of an input field for a while a tooltip text pops up explaining the field Complete the description in the following way Mew Variable Declaration Type Prefix Type and name a Nodeice Starts Mass Description Mass of pendulum Modelica Modelica Slunits Mass m 1 Mass of pendulum Click OK and the text appearing in the bottom row is inserted into the Modelica text window You can also declare variables by using menu commands Let us define the next parameter by right clicking in the Modelica Text layer and select New Variable GETTING STARTED WITH DYMOLA 31 32 Pendulum Pendulum Modelica Text File Edit Simulation Plot Animation Commands Window Help Linear analysis D a BAS MinOoVvA4 2 BiIAJs 0O i gt 888 si model Pendulu gt AttenuationCoefficient ai i PhaseCoeffident Modelica SIunits Mass m 1 Mass of pendulum PropagationCoefficient equation Damping der phi w WA Cut Cir X Mass d der w m g L sin phi Density gt a Copy Ctrl C RelativeDensity ae eee GA Paste Ctrl V Specific volume z LinearDensity Find and Replace Ctrl F SurfaceDensity Go To Ctrl G Momentum i x Expand d LS Highlight Syntax Ctrl L Component Browser a Reformat Selection
10. a resistor with de fault settings General Add modifiers Component Model Resistor Path Modelica Electrical 4nalog Basic Resistor Comment Ideal linear electrical resistor Parameters R Resistance R_ref at temperature T_ref T_ref PT Reference temperature i Temperature coefficient of resistance R_actual R_ref 1 alphatiheatFort T ts Tre useHeatPort true if HeatPort is enabled alpha Fixed device temperature if useHeatPort False Change the component name to Ra The parameter dialog allows setting of parameter val ues To set the resistance parameter R select the value field of parameter R and input 0 5 50 The parameter dialog of a resistor with new settings resistor in DriveLib Motor General Add modifiers Component Model Resistor Path Modelica Electrical Analog Basic Resistor Comment Ideal linear electrical resistor Parameters R Resistance R_ref at temperature T_ref T_ref Reference temperature Temperature coefficient of resistance R_actual R_reP 1 alpha heatPort T Trefi useHeatPort true if HeatPort is enabled alpha Fixed device temperature if useHeatPort False Click OK Similarly drag an inductor to the Motor window Name it La and set the inductance L to 0 05 Drag a ground component into the motor model Name it G The ground component is as important as in real electrical circuits It defines
11. animationRedraw a me true 3 ea true v lt til gt Modelica Mechanics MultiBody Examples Systems RobotR3 Components AxisTypel modeling V Simulation Now the diagram layer is visible You can now navigate exactly the same way as in the Modeling mode right click on the component you want to look into and select Show Component to look into it You go back using the Previous button in the diagram layer toolbar ia Ei If you want the diagram layer to show more of an overview e g the whole robot you have to go back to Modeling mode and change what is displayed in the Edit window Then you can go back to Simulate mode When having reached the interesting component right click on it and select Show Variables which will open and highlight the selected component instance in the variable browser In the figure below the variables of the motor in Axis 1 is displayed in this way Using the diagram layer to select variables to be shown E fullRobot Modelica Mechanics MultiBody Examples Systems RobotR3 fullRobot File Edit Simulation Plot Animation Commands Window Help Be ve gi FSR BOs gt N M 4 4 DD Tine I Plot 1 ex TYR lm Variable Browser Variables OD controlBus axisControlBus3 speed_ref rad s controlBus axisControlBus3 speed rad s 0y 05 Oratio ORx0 CRv1 0 0 CO peak flange gear SL CJ kg Ck N lw Dia
12. bound parameter cannot be changed in teractively MotorDrive Test DriveLib MotorDrive Test File cr el a RP s 100 b TL old 44 40 lb OP Time 0 Variable Browser Simulation Plot Animation Comman Variables MotorDriveTest 1 MotorDriveTest 2 gearbox phiload motor load positionerrar controller D sr Om aha step The parameters r and m can be set interactively between simulation runs but not the parameter load J because it is no longer a free parameter an expression is now binding it to rand m 1 4 9 Documenting the simulation The command window can be used to document the simulation Text also headers images links and mathematical expressions can be inserted and edited using the tools that are available in the toolbar in the top of the command window Plot results can also be inserted in the command log together with the corresponding plot command by using the context command Show In gt Command Window Note that you must not right click on a curve etc but in an empty area of the window to get the general context menu Now the content in the command log pane can be edited to document the simulation in a good way Commands given and output results will be automatically be included An example of documenting better values of the PID controller could be GETTING STARTED WITH DYMOLA 73 Commands 74 p il lill IIl A I I
13. button the button labeled A and lay out a rectangle that is as long as the cylinder and one grid squares high In the window prompt for the string enter name and click OK The sign has the magic function that when the model is used the actual component name will be displayed 1 4 4 Documenting the model We have now edited the icon and the diagram It is also important to document the model When creating the model the dialog has a slot Description It is possible to edit this after wards Select Edit gt Attributes to open the dialog GETTING STARTED WITH DYMOLA 53 Model attributes Change attributes for Motor General Graphics Description 4 basic model of an electrical motor Restricted class O Class Block Model Function Connector Package O Record Expandable connector Properties Encapsulated Partial Protected Replaceable Store az one file Dynamic typing Normal O Inner Outer Enter a description and click OK il A longer documentation can be provided in the following way Click on the toolbar button for Documentation the button between the Diagram button and the Modelica Text button Documentation View Motor DriveLib Motor Documentation File Edit Simulation Plot Animation Commands Window Help Linear analysis E Motor A fie lt gt E lt gt info info rew rev A basic model of an electrical motor l Informati
14. drive train in Axis 1 axle angleSenzor angle Speed acceleration controller flange SnApOUOaSiMe The drive train includes a controller A data bus is used to send measurements and reference signals to the controller and control signals from the controller to the actuator The bus for one axis has the following signals GETTING STARTED WITH DYMOLA 13 The robot controller in the robot drive train controller 14 Name Description motion_ref true if reference motion is not in rest angle ref reference angle of axis flange angle angle of axis flange speed_ref reference speed of axis flange speed speed of axis flange acceleration_ref reference acceleration of axis flange acceleration acceleration of axis flange current ref reference current of motor current current of motor motorAngle angle of motor flange motorSpeed speed of motor flange The bus from the path planning module is built as an array having 6 elements of the bus for an axis The figure below is displayed by selecting the controller and showing the components of it gain k ratio ain s feedba axisCorntrolaus The controller of an axis gets references for the angular position and speed from the path planning module as well as measurements of the actual values of them The controller out puts a reference for the current of the motor which drives the gearbox The motor model consists of the electromo
15. for a context menu Select Info to get documentation for the model GETTING STARTED WITH DYMOLA 43 The context menu for a component Mathematical defini tion of a rotational in ertia 44 Components package Modelica Mechanics Rotational Components ay Open Class in Mew Window a fe Edit j Fixed Ire Damper SpringDamper ElastoBacklash a cae i din D B mm Jp th rd Aor ae BearingFriction Brake Clutch OneWayClutch IdealG ear LossyGear IdealPlanetary 8 0 Gearbox IdealGearA2T IdealRolingw heel InitializeFlange Relatrve States To get a model window for Inertia select Open Class in New Window in the same context menu A window for the model Inertia is created Switch to the Modelica Text representation where you find Euler s equation as the last equation Inertia Modelica Mechanics Rotational Components Inertia Read Only Modelica Text File Edit Simulation Plot Animation Commands Window Help Linear analysis a x Orae e ASV vYoOoVAs amp BIAS 0 gt PSHE gt 3 neta E Z Package Browser X Rotational i model Inertia 1D rotational component with inertia ag a Gia 7 Q User s Guide of Rotational L Io P Examples parameter SI Inertia J min 0 start 1 Moment of inertia parameter StateSelect stateSelect StateSelect default l Components Priority to use phi and w a
16. have the Motor model being a part of DriveLib we need to enter DriveLib for Insert in package This can be done in several ways Dymola provides alternatives to be selected from and DriveLib is an available alternative There are no other alternative because all other open packages are write protected It is also possible to use the drag and drop feature and drag DriveLib into the slot In the package browser put the cursor on DriveLib and press the left mouse button While keeping it pressed drag the cursor to the slot for Insert in package optional release the button and the text DriveLib will appear in the slot It is also possible to browse for a package where to insert the model clicking on the browser symbol to the right GETTING STARTED WITH DYMOLA 47 Inserting Motor in DriveLib Create New Model Name Motor Description E Partial Extends optional Insert in package optional DriveLib Click OK The package browser shows that DriveLib has a component Motor as desired The picture below shows the model with the diagram layer displayed compare with the package created above z An empty Motor Motor DriveLib Motor Diagram model File Edit Simulation Plot Animation Commands Window Help Linear analysis x Derda Y Noo AB 9 AMS 0 Zihen Drivelib Moto Q A x 4 Modelica Reference Modelica DriveLib Component Browser f xX DriveLib Motor
17. in File Edit Simulation Plot Animation Commands Window Help Linear ar 100 p Speed 1 0 0 6 front of phi to get the angle plotted as shown below Plotting the angle Pendulum Pendulum Plot y File Edit Simulation Plot Animation Commands Window Help mr QOS Me Ble Reve g iFem BOs Sh OW M 4 41 ib DD Timeo J J Speed 1 v Variable Browser x Variables Values Pendulum 1 Jm I O phi der phi OOONOOUC Ww der w lt gt true x true SimulateModel Pendulun stopTime 10 method dassl1 true ommands result File Pendulum Modeling Y Simulation Let us study a swing pendulum with larger amplitude and let it start in almost the top posi tion with phi 3 It is easy to change initial conditions Just enter 3 in the value box for phi and click on the Simulate tool button You can also change start values and parameters by typing in the command window e g type phi 3 followed by carriage return for a change of phi GETTING STARTED WITH DYMOLA 27 28 Pendulum angle when Pendulum Pendulum Plot starting in almost the y File Edit Simulation Plot Animation Commands Window Help top position ime Oe ILER Custom EBS YOn gi Re yy UH ib Mo M 4 4 i b Timeo Jo Seea 1 ow Variable Browser phi Variables Pendulum 1 Pendulum 2 m L g J phi C der phi w der w
18. information concerns only exactly what has been clicked on sometimes the information concerns a group of signals etc In any menu When displaying any menu help for a certain entry is available by resting the cursor on it and then pressing Shift F1 Tooltips By resting the cursor on any component or button a tooltip text is shown For buttons it will be the name of the button for components it will be the name of the component the path to it The Search command button The search functionality can be reached either using the command File gt Search or clicking the Search button See chapter Developing a model section Editor command reference Modeling mode sub section Main window File menu command File gt Search for more information GETTING STARTED WITH DYMOLA 85 86 1 7 2 Reaching more extensive information The Info command button If any component is selected in the Edit window or in the package or component browser right clicking will take up a context menu where the command Info is available Inside a dialog a button Info is available instead The Help menu The Help menu can be used to display manuals and to go to the Dymola website The help menu also contains the license handling The help menu is described in chapter Developing a model section Editor command reference Modeling mode sub section Main window Help menu The Search command button The search fun
19. l Preformatted Courier New Default B J U x x A ce _ Selecting better values than the original ones for the PID _ controller_k 15 controller Ti 1000 controller Td 0 4 BinulateModel DriveLib MotorDriveTest stopTime 5 resultFile MotorDriveTest true plot atep y phiload phi colors 255 0 0 0 0 255 step y phiload phi T 50 oO 40 30 deg 20 10 10 Note The overshoot is now too big but that is because the limiter component is not yet included Some comments e This example is just a minor example of what can be done More about using the command log pane to document simulations can be read in chapter Simulating a model in the manual Note that math rendering of equations etc is supported including indexing and Greek letters e The command log pane is enlarged the command window can also be undocked instead using the Undock button e The header and the last line are entered by the user e The simulation command is output from the system including true in the following line indicating success assuming the user has given a simulate command e The plot command and plot image are added the following way o The variables are plotted in a plot window o To get the plot command in the plot window really not needed for documentation but for scripting the user clicked the command input line of the command window that echoed
20. section But since the variable is known we can click on the tab Add modifiers and enter the text i fixed true and press OK GETTING STARTED WITH DYMOLA 61 62 La in Drivelib Motor General Add modifiers 4dd new modifiers here e g phifstart 1 wistart 2 ifFixed true When having clicked OK the General tab will change to present the new initialization information Double clicking again on the inductance component will result in La in DriveLib Motor General Add modifiers Component Mame Lal l Inductor Model L Fath Modelica Electrical Analog Basic Inductor Comment Ideal linear electrical inductor Parameters Initialization istart w r A Current Flowing From pin p ta pin n The two last warnings in this part have to do with the inertia Jm Double clicking on this component brings up the parameter dialog for it and in the Initialization section phi and w are found By clicking on the little square in front of each of these variables a menu pops where we can select fixed true The final result will be Jm in DriveLib Motor General Advanced Add modifiers component Model Path Modelica Mechanics Rotational Components Inertia Comment 1D rotational component with inertia Parameters J 0 001 l kg m Moment of inertia Initialization phi stark w deg Absolute rotation angle of component Wostark w t rad s Absolute angular velocity of component der ph
21. the diagram and select Info Let us now inspect the drive train model There are several possible ways to get it displayed Press the Previous button the toolbar button with the bold left arrow once to go to the robot model and then put the cursor on one of the axis icons and right click Please note that robot mechanics also has components axisl axis6 but those are just connectors You must inspect for example robot axis1 see figure below GETTING STARTED WITH DYMOLA 11 Displaying the components of axis 1 File Edit Simulation Plot Animation Commands Window Help Linear analysis Drege PASM NOoVAnY 2 FR fullRobot E3 A p E MuttiBody User s Guide of MultiBody Li pathPlanr 2 0 o 6 axes i axis6 e axis5 7 f axisControlBus6 _ I Rotational3DEffects E I Constraints i E I Systems ooo ixisControlBus4 A ah axis3 At axisControlBusS controlBus fullRobot Modelica Mechanics MultiBody Examples Systems RobotR3 fullRobot Read Only Diagram Parameters Open Class in New Tab Open Class in New Window View Attributes Change Class Cut Copy Paste Delete Duplicate Rotate 90 Rotate 90 Flip Horizontal ax o i __ _ e Open Class Ctrl X Ctrl C Ctrl V Del Ctrl D Ctrl R Ctrl Shift R H axisControliBus3 lt q Flip Vertical V Info View Annotation Split Model axisControlBus2 axisCon
22. the electrical potential to be zero at its con nection point As in the real world never forget to ground an electrical circuit Drag an electromotive force EMF component into the motor model Keep the name emf The component is grounded meaning that the component has a support where the support connector is fixed to the ground Please keep in mind the difference from electrical grounding A voltage source is to be found in Modelica Electrical Analog Sources Use a library win dow or package browser to locate it Select SignalVoltage and drag it to the model window of Motor Name it Vs Let Vs be selected and use Edit gt Rotate 90 to turn the signal input Vs inPort from a top position to a left position SignalVoltage produces between its two electrical pins p and n a voltage difference p v n v that is equal to the signal input This info can be displayed by right clicking on the icon and selecting Info To get the proper sign we would like to have pin p in the top position Since the pin p is the filled blue square we must flip the component To do that use Edit gt Flip Vertical A rotating inertia component is to be found in Modelica Mechanics Rotational Components Drag and drop such an inertia component Name it Jm and set the inertia parameter J to 0 001 GETTING STARTED WITH DYMOLA 51 52 Now all model components are in place Components are connected by drawing connections between connectors Conn
23. the underlying plot command in the command log o To add the image the user right clicked an empty space in the plot window and selected Show In gt Command Window o The user removed the rather long createPlot command that was added together with the image e The content of an animation window can also be included using a flag the below shows how to set this flag to true by typing in the command input line of the command window This is a typical example of setting a flag using flags is not unusual in Dymola rL UE k ppr Commal Advanced ScriptingWindow IncludeAnimation true Modeling L P Simulation e Sections of the command log pane can of course be copied to e g Microsoft Word for further work e The content of the command log pane can be saved as a command log in Dymola in various formats and including various contents 1 4 10 Scripting Scripting makes it possible to store actions for various reasons Examples might be e The script can be used to run a demo e The script can be used for testing of e g different parameter sets e The script can be used as an action that can be included in other models The first item can be solved creating a script file while the last one is best solved creating a function that can be included in other models Creating functions is not treated here please see chapter Simulating a model in the manual for more about scripting in par
24. to customize the parameter dialogs More information about customization can be found in the chapter Developing a model section Advanced model editing sub section Parameters variables and constants Graphical illustrations can be included to show meaning of parameters If prepared for display units can be selected in the dialog Units that have alternatives are marked by white background here phi start and w start have selectable display units By resting the cursor over such a unit a button is displayed Initialization phi start rl O Relative rotation angle from frame_a to frame_b ve of angle phi relative angular velocity Ele Select display unit ive of angle phi relative angular acceleration and by clicking on that the selection can be made Alternatives of selectable display unit Edit Edit Text Copy Default R view Parameter Settings Insert Component Reference gt Insert Function Call PEA Q Choices for n Initialization phistart i ie elative rotation angle from frame_a to frame_b wastat deg fst derivative of angle phi relative angular velocity astat i rad s2 Second derivative of angle phi relative angular acceleration Next to each parameter field is a triangle this gives you a set of choices for editing the pa rameters Edit gives a matrix editor function call editor Edit Text gives a larger input field etc An example is that for the first parameter u
25. top level to indicate that we are editing the motor model About to drag a resis f Motor DriveLib Motor Diagram tor from the package File Edit Simulation Plot Animation Commands Window Help Linear analysis browser Drea iS Vv NOOVAEY S FiMsS o DriveLib Motor Package Browser a x Packages Er HE Basic 4 Resistor Ideal linear electrical resistor 9 ee 2 Conductor You can also drag from a library window Drag a resistor from Basic to the Motor window and place it as shown above The compo nent browser displays that Motor has a component Resistor1 GETTING STARTED WITH DYMOLA 49 Motor DriveLib Motor Diagram Inserting a resistor File Edit Simulation Plot Animation Commands Window Help Linear analysis x component Dre eHQSNiryoovAn4 2 FRS oZ e Hn DriveLib Motor B x ff Basic a og PEPER a resistor 1 f bwceResistor R Pid i stzieHeatingResistor Conductor When inserting a component it is given an automatically generated name The name may be changed in the parameter dialog The class name begins with an upper case character component instances begins with a lower case character Double click on the component to get its parameter dialog The parameter dialog can also be reached by placing the cursor on the component right clicking and selecting Parameters The parameter dialog resistor in OriveLib Motor of
26. validate the model However model validation is out of the scope for this introduction to Dymola It is possible to show several curves in the same diagram Simply tick the variables to be plotted A curve is erased by ticking once more The toolbar button Erase Curves white rectangle erases all curves in the active diagram It is also possible to have several diagrams To get a new diagram select Plot gt New Diagram or click on the toolbar button The new diagram becomes active Selecting a diagram makes it active Selecting Plot gt Delete Diagram removes the diagram In addition to the above there are numerous options in the plot window e g you can e Display dynamic tooltips and copy the values to clipboard if needed e Display tooltip for the legend to see more information about the corresponding signal e Display tooltip for the x axis and the y axis e Moving and zooming one way of zooming is to just drag a rectangle over the area that is of interest e Change time unit on x axis e Change the display unit of a signal e Display signal operators e Plot general expressions e Plot dependencies e Select multiple curves in a diagram for e g copying the curve values to Excel e Display a table instead of curves or create tables from curves e Plot parametric curves e Display Boolean and enumeration signals e Change color line marker style and thickness of a signal e Set diagram headings and axis titles an
27. 0 controller Tad O_4 SimulateModel DriveLib MotorDrivetTest stopTime 5 method dassl resultFile MotorDrivetltest Plot phiload phi step y colors 0 0 255 255 0 0 7 controller _Ti Note the difference between the saved log and the content in the command log pane By saving as a mos file only executable commands are saved Note also that the plot command echoed in the command log does not include features like plot header etc but for simple plot handling this is sufficient more advanced commands can be used to fully restore a plot window using scripting To run the script you have to be in Simulation mode The command Simulation gt Script gt Run Script or corresponding command button can be used to open execute the script Some comments e This script file is very simple just showing the idea of a script file rather than being a good example e Realizing how saving a script file works it is not necessary to start all over to create the file the total simulation can be saved and afterwards the script file can be edited to keep only the wanted parts of the simulation However it is important to test it if created that way e More information about script files is available in the chapter Simulating a model in the manual for more information e Working with scripting using functions is even smarter for more information please see the manual 1 5 Building a mechanical model
28. 80 Mass of load ong equation Component Browser ax E connect ipositionerror y controller u 4 connect motor flange bl gearbox flange_a a4 Components connect gearbox flange_b load flange_a a SlPrivelib MotorDrive connect load flange_b phiload flange a gearbox connect phiload phi positionerror uzZ phiload t connect controller y motor vl a motor end MotorDrive Hload positionerror controller Ok now activate the diagram representation Double click on the load icon to open the parameter dialog Binding a parameter to an expression load in DriveLib MotorDrive Test fx General Advanced Add modifiers Component Name a Model Fath Modelica Mechanics Rotational Components Inertia Comment 10 rotational component with inertia Parameters J 0 n r 2 gt koma Moment of inertia Initialization phistart hp deg Absolute rotation angle of component w atat hp rad Absolute angular velocity of component der phil asta hp rad s Absolute angular acceleration of component der v Click in the value field of J and enter the expression for J Click OK The model window now displays the expression for the load inertia When entering the expression you are sometimes not sure about the exact name of the variables names for example is the radius called r rO or rl The problem is even more pronounced whe
29. Dymola Dynamic Modeling Laboratory Getting started with Dymola Contents Chapter 2 Getting started with Dymola extracted from the manual Dymola User Manual Volume 1 March 2015 Dymola 2016 The information in this document is subject to change without notice Copyright 1992 2015 by Dassault Systemes AB All rights reserved Dymola is a registered trademark of Dassault Systemes AB Modelica is a registered trademark of the Modelica Association Other product or brand names are trademarks or registered trademarks of their respective holders Dassault Systemes AB Ideon Gateway Scheelev gen 27 Floor 9 SE 223 63 Lund Sweden E mail http www 3ds com support URL http www Dymola com Phone 46 46 270 67 00 Contents 1 Getting started with Dym la esse cssvessverceascescecciseanesoscecacsestcacecessecdeusss vex vasodecacaneeveneucsoeedeussesexvens 5 LE roduc OM issesi oecnects teases SN 5 k2 Sinulating amodel industtial To DOU oneee O a antddaans 6 1 2 1 Investicatine the robot 1m modelin IMOdC winds esc decd cevis sass ae a ite 6 122 SMAO a PRE SPR OPE OnSe Prste Ryn rrr e ne nTr eT re E TRE nme Ter nnn nrerere A 15 L223 OLNEt demo examples sieri a tea alies ctu a hase cee ide 19 1 3 Solving a non linear diiterential Quation 30s s6s essen tiaiac leis e a hes i ea 20 1 3 1 SMUT AGI ON enei E won aad sess gue saunaatusaacg2 ue aad uesos can cous aneasaco tunes oaeuotadaes 24 1 3 2
30. GETTING STARTED WITH DYMOLA 83 1 7 84 Modelica_Synchronous library is a free library from Modelica Association to precisely define and synchronize sampled data systems with different sampling rates The library has elements to define periodic clocks and event clocks that trigger elements to sample sub sample super sample or shift sample partitions synchronously Optionally quantization effects computational delay or noise can be simulated Continuous time equations can be automatically discretized and utilized in a sampled data system The sample rate of a partition needs to be defined at one location only All Modelica libraries designed so far for sampled systems such as Modelica Blocks Discrete or Modelica_LinearSystems2 Controller are becoming obsolete and instead Modelica_Synchronous should be utilized Modelica_DeviceDrivers is a free library that allows accessing some external devices in Modelica models Such external devices are input devices communication devices shared memory analog digital converters and else This is achieved by using the Modelica external C interface to call the appropriate C driver functions provided by the underlying operating system Currently Microsoft Windows and Linux are supported VehicleInterfaces is a free library providing standard interface definitions for automotive subsystems and vehicle models to promote compatibility between the various automotive libraries See the documentation inside the
31. Ga oe 2 a hk 100 Mi gt Tl ld 44 41 bh PP meo Speed 1 Variable Browser F Xx Variables Values Unit Description a Plot 1 MotorDriveTest 1 Fl MotorDriveTest 2 12 Cr Collapse All Radius of load Om es Mass of load 1 0 motor igearbox Export Result As L 0g load Close Result Hflange_a 06 BN B FL Aname Moment of inertia 0 4 CIphi Absolute rotation i 2 C der phi Animate Together der Absolute rotat 0 2 im L au os f Handling the warnings There will be some warnings when translating The principal handling of these warning has been dealt with previously The only thing that ought to be mentioned here is that in order to make the variable controller D x start controller D x_start fixed you have to double click on the MotorDrive then select the controller right click and select Show component Now you can double click on the D component to see the parameter dialog and since no x is available you have to select the Add modifier tab enter x fixed true and press OK The rest of the warnings can be handled like described in a previous section 1 4 8 Parameter expressions Modelica supports parameter propagation and parameter expressions which means that a parameter can be expressed in terms of others Assume that the load is a homogeneous cyl inder rotating long its axis and we would to have its mass m and radius r as primary pa rameters on the top level The inert
32. Help Lin y ChrShifteM ta Open Ctrl O Connector pa Ga Load Ctrl Shitt O Record Libraries d Block Demos d Function a m Save Ctrl Package Ctrl Shift P Save As Duplicate Class Ctrl Shift D Save All TT aoe You can also perform the opening command either by clicking the arrow on the New command button and select Model or click the command button New directly Model is the default selection in that case The dialog to name a new model component Dymola Dynamic Modeling Laboratory File Edit Simulation Plot Anim DehageWQe win Connector Record Block Function Package Duplicate Class Ctrl Shift Mi Ctrl Shiftt P Ctrl Shift D Dymola Dynamic Moc ije Edit Simulatio eee Q New Package Browser __ DymolaCommands Modelica Reference Having several alternatives doing the same thing is not uncommon in Dymola A dialog window opens Enter Pendulum as the name of the model Create New Model Hame of new model Description OOo Partial Extends optional C Insert in package optional Click OK You will then have to Accept that you want to add this at the top level You should in general store your models into packages as will be described later Since you use the New command a new tab will be opened with the new model The tabs work like working areas in for example I
33. We will now develop a more complex model a 3D mechanical model of a pendulum called a Furuta pendulum It has an arm rotating in a horizontal plane with a single or double pendulum attached to it see below The Furuta pendulum Start Dymola Open Modelica Standard Library In the package Mechanics open the sub package MultiBody This package includes 3D mechanical components such as joints and bodies which can be used to build a model of the Furuta pendulum To build the Furuta pendulum you will need to use the Parts and Joints sub packages If you open them in library windows by right clicking on them in the package browser and using the command Open Library Window and adapting the window they will look the following The Parts sub package Parts package Modelica Mechanics Multibody Parts library window Fixed FixedTranslation FixedRotation Body Shape BodyBox Body vlinder o ctto FaintMass Mounting D Rotori O BevelGear 1D RollingWwheel Rolling heelSet GETTING STARTED WITH DYMOLA 17 The Joints sub package library window 78 Joints package Modelica Mechanics MultiBody Joints ny Om oh Revolute RevolutePlanarLa Cylindrical Universal Planar Ca oa bs dh Spherical FreeMotion SphericalSpherical UniversalSpherical GearConstraint RollingWheel Mad kuran Rolling WwheelSet Assemblies Internal Select File gt New gt Model and give the name Furuta The first step in buil
34. and fullRobot Modelica Mechanics MultiBody Examples Systems RabotR3 fullRobot Rea Add Command Organize Commands The model is now translated and simulated automatically The script also contains some setting of a plot window and an animation window After enlarging the Dymola main window it will look the following E fullRobot Modelica Mechanics MultiBody Examples Systems RobotR3 fullRobot Read Only Sy a a ay Say aa D ena Nie om Bre VOUu S 5RB BOR oA se iP Wold 44 41 ib DD Time o wit aan Sere OrefAcc ax 1 OrefAcMax 2 OrefAccMax 3 OrefAc Max 4 OrefAccMax 5 OrefAcMax 6 Cks1 i Gy co E true true Selected object mechanics b3 shapel Form Selected object mLoad 4 mm Modeling Simulation Animation toolbar Let us start to animate the robot Start the animation by selecting Animation gt Run or clicking the Run button on the toolbar the leftmost button DW MD DD time Seed 1 This toolbar contains the usual buttons of running pausing rewinding and stepping forward and backward respectively Also the time flow is shown and there is a possibility to set the speed of the animation higher figures means higher speed Please note that the Animation window can be maximized in the main window in the usual way If the Animation window by mistake is deleted a new can be displayed using t
35. ar acceleration a start can be specified in the dialog The idea is of course to specify values when simulating but we have to specify what type of start values we want to use This is done by clicking on the box after each start value The choices are GETTING STARTED WITH DYMOLA 79 Fixed Choices for start True start yalue is used to initialize values False start walue is only a guess value w Inherited False start value is only a quess value Actually we don t need to change anything Dymola will itself take care of this but we will have warnings when translating In order to avoid these warnings phi start and w start should be set to fixed true using the menu above for all joints To get a double pendulum create another similar joint and another BodyBox and connect them This is accomplished easily by selecting the two components already present and choosing Edit gt Duplicate The selection of the start value type for phi start can be removed from R3 if wanted You should now have arrived at a model that is similar to the following The diagram of the Fu R2 B1 ruta pendulum 0 S 0 0 o s 0 0 4 cg mee Now it is time to simulate To enter the Simulation mode click on the tab at the bottom Simulation right The simulation menu is now activated and new tool bar buttons appear all When building 3D mechanical models it is possible to get visual feedback to check that the mechanical
36. ary gear bearing friction and clutch e Fluid contains components to model 1 dimensional thermo fluid flow in network of vessels pipes fluid machines valves and fittings All media from Modelica Media can be used A unique feature is that the component equations and the media models as well as pressure loss and heat transfer correlations are decoupled from each other e Media includes property models of media e Thermal provides models for heat transfer and thermo fluid pipe flow e Math gives access to mathematical functions such as sin cos and log and operations on matrices e g norm solve eig exp e ComplexMath contains complex mathematical functions e g sin cos and functions Operating on complex vectors e Utilities contain functions especially for scripting operating on files streams strings and systems e Constants provide constants from mathematics machine dependent constants and con stants from nature e Icons provide common graphical layouts used in the Modelica Standard Library e SIunits with about 450 type definitions with units such as Angle Voltage and Inertia based on ISO 31 1992 To get documentation for the entire Modelica Standard Library place the cursor on Modeli ca right click and select Info An information browser is directed to an HTML file containing documentation for Modelica This documentation has been generated from the Modelica description of the library There is basic informati
37. before saved The check command performs some symbolic and syntactic checks that will capture a number of errors that might have been introduced by the user The check can be made clicking on the Check icon or by selecting the command Edit gt Check or by using the F8 function key The result of a check of the above text looks the following Check of model Dymola Messages Translation i Check of Pendulum i The model has the same number of unknowns and equations 2 i Check of Pendulum successful The model is now ready to be saved Select File gt Save Call the file pendulum and keep the file extension to mo and place it in a working directory GETTING STARTED WITH DYMOLA 23 Modeling W Simulation KH m Selecting Setup in the Simulation menu 24 1 3 1 Simulation Now it is time to simulate To enter the simulation mode click on the tab Simulation at the bottom right of the main window The simulation menu is now activated and new tool bar buttons appear To set up the simulation select Simulation gt Setup or click directly on the Setup toolbar button Pendulum Pendulum File Edit Simulation Plot Animation Commands Window Help _ Linear anal Ga Go Ey Script j 100 aay ey Ela gt Il Translate Time 0 F Speed 1 Variable Brows ya Simulate T Continue G x Plot 1 1 0 Variables sscription Stop Linearize 0 8 The simulati
38. ctionality can be reached either using the command File gt Search or clicking the Search button For reference please see the corresponding section above The documentation layer of Edit window This layer can be used to display more extensive information about packages and components Please see chapter Developing a model section Basic Model editing sub section Documentation for more information This type of documentation can also be exported to HTML files etc Books etc Manuals are available for Dymola and a number of libraries used as well as for the Modelica language 1 8 Shortcuts Shortcuts are available for a number of commands The following is an overview of available shortcuts Please note that very common shortcuts e g Ctrl C for Copy and Ctrl V for Paste can be found in more locations than the one specified below File menu New Model Ctrl Shift M New Package Ctrl Shift P Duplicate Class Ctrl Shift D Ctsl Shift 0 Save All Ctrl Shift S Print Ctrl P Edit menu Dt Del Select All Ctrl A Cia C146 text editor Align to grid Ctrl G diagram icon layer Manhattanize Ctrl M GETTING STARTED WITH DYMOLA 87 88 Flip Horizontal Cirl Shifi R Flip Vertical Simulation menu Shorteut Translate F9 Translate FMU Ctrl F9 Simulate Continue D F12 Animation menu Backstep oo e Backstep Step Forward Shifts Dymola main window Shorteut Mode
39. d GETTING STARTED WITH DYMOLA 69 Expanded text representation 70 selecting Expand gt Show entire text However we refrain from showing it in this document Below the Modelica text as a result of first selecting select Expand gt Show components and connect and then the annotation for Motor has been individually expanded by clicking on a corresponding in the margin which means that now a is shown indicating the possibility to compress that annotation individually MotorDrive DriveLib MotorDrive Modelica Text E H File Edit Commands Window Help X eH AS MiNOovAnY 2 Z a gt 8 B02 om Package Browser oe x model MotorDrive Packages Modeli Mechani Rotati 1 C ts IdealG box ratio 3 wavenumber T odelica Mechanics Rotational Components IdealGear gearbox ratio Circular WaveNumber i me Modelica Mechanics Rotational Sensors AngleSensor phiload gag AmplitudeLevelDifference Lp L Diff Motor motor 4 ee Jatin Modelica Mechanics Rotational Components Inertia load J 10 DampingCoefficient e LogarithmicDecrement Modelica Blocks Math Feedback positionerror AttenuationCoefficient a PhaseCoefficient Modelica Blocks Continuous PID controller D x fixed true PropagationCoefficient a Damping tH a Mass v parameter Modelica SIunits Radius r 0 5 Radius of load ooo K parameter Modelica SIunits Mass m
40. d ranges e Insert and edit text objects in the plot e Change the appearance layout and location of the legend e Display the component where the signal comes from in a new window containing the diagram layer e Go back to a previously displayed plot window or any other window previously displayed For more information about these options please see chapter Simulating a model Using the option of adding a new diagram and ticking motor Jm w the result shown below is obtained GETTING STARTED WITH DYMOLA 59 Angular velocity TestMotor DriveLib TestMotor Plot 1 y File Edit Simulation Plot Animation Commands Window Help w WAS Me Blo Be ve o aE Bolts ob I MA lt 4 i DD Time O Speed 1 v x Variable Browser a motor flange_b1 phi Variables Values EiTestMotor 1 motor Ra HG emf avs Edm Hflange_a Hflange_b J 0 001 kg m2 g D phi F 0 irad 5 der phi rad s tO rads motor Jm rad s 2 rad s2 y Bflange_b1 C phi rad tau Num step gt true SimulateModel DriveLib TestMotor method dassl1 result File TestMotor true 0 25 x lt ommands Modeling V Simulation 1 4 6 Handling the warnings When simulating the TestMotor warnings can be seen by looking at the Translation tab of the Message window you have to expand the first warning to see the submessages of that warning 60 Dymola Messages
41. dea is to compare the simulation result against reference data to check if for example changes in model libraries change the result The reference data is assumed to be stored as trajectory files which is the data format used by Dymola to store simulation results When developing a model it is very natural and recommended to provide it with carefully checked reference simulation results Please also compare the library Model Management where model validation and regression testing is supported on a larger scale UserInteraction enables changing parameters and inputs by numbers sliders etc as well as animation of simulation results Please see the documentation in the package for more information Plot 3D is used to visualize models in 3D This library 1s free Modelica_LinearSystems2 is a free library from Modelica Association providing different representations of linear time invariant differential and difference equation systems as well as typical operations on these system descriptions See the documentation inside the package for details Modelica_StateGraphz2 is a free library from Modelica Association providing components to model discrete event reactive and hybrid systems in a convenient way with deterministic hierarchical state diagrams It can be used in combination with any Modelica model It has larger power than the package StateGraph in the Modelica Standard Library See the documentation inside the library for details
42. dia 33 Thermal A Math ComplexMath Utilities Constants H i Icons T Kkg SIunits zy ere E E E E E E E E E E Unnamed ssid As shown by the package browser the Modelica Standard Library includes 38 e Blocks with continuous and discrete input output blocks such as transfer functions filters and sources e ComplexBlocks provides basic input output control blocks with complex signals This library is especially useful e g in combination with the library Modelica Electrical QuasiStationary in order to build up very fast simulations of electrical circuits with periodic currents and voltages e StateGraph for modeling of discrete events and reactive systems by heretical state machines Please note that a more advanced library is available using the command File gt Libraries gt State Graph For more information about this library please see section Libraries available in the File menu by default starting on page 82 e Electrical provides electric and electronic components for analog digital machines and multi phase models such as resistor diode DC motor MOS and BJT transistor e Magnetic contains magnetic components to build especially electro magnetic devices e Mechanics includes one dimensional and 3 dimensional translational rotational and multi body components such as inertia gearbox planet
43. ding a MBS MultiBody System model is to define an inertial system Drag the component World from the package browser Multibody package into the Furuta edit window The default parameters need not be changed The gravity of acceleration is set to 9 81 and pointing in the negative direction of the y axis We then need a revolute joint Drag the model Joints Revolute onto the Furuta window You can either drag from the package browser or the library window Select Edit gt Rotate 90 This just changes the appearance of the icon Double click on the icon Change the name to R1 The axis of rotation is set as the parameter n We would like to have a vertical axis of rotation use the list of choices and select y axis Click OK Connect the connector of world to the bottom connector of the revolute joint revolute in Unnamed General Animation Advanced Add modifiers Component Icon Name Reevelute comment O S SOS Model Path Modelica Mechanics MultiBody Joints A evolute Comment Revolute joint 1 rotational d gree of freedom 2 potential states optional axis flange Parameters useAwisFlange _ true if asis flange is enabled animation true if animation shall be enabled show axis as cylinder n Axis of rotation resolved in frame_a same as in frame_b Initialization LOO s axis phi start 10 1 0 yp ais k Relative rotation angle from frame_a to frame_b w shart WOI ee First denvative of angle phi relatrve ang
44. e Total Modelica Synchronous Tutorial Version Automotive Demos Library Clear All Dymola starts loading the model libraries needed for the robot model and displays it The following will be displayed The robot demo fullRobot Modelica Mechanics MultiBody Examples Systems RobotR3 fullRobot Read Only Diagram File Edit Simulation Plot Animation Commands Window Help Linear analysis a x D s RP AS MinNOOVAB4 S GIAJS O i gt BAG gt fulRobot E pathPlanning axisControlBus6 mechanics axisControlBus5 axisControlBus4 fim Example Modelica Icons Example axisControlBus3 mechanics pathPlanning axisl axis2 axis3 axis4 axisS axis6 H E controlBus EKEK Browser Component controlBus axisControlBus1 E Modeling V Simulation GETTING STARTED WITH DYMOLA 7 About to view the me chanical structure of the robot The package browser in the upper left sub window displays the package hierarchy and it is now opened up with the robot model selected and highlighted The model diagram in the edit window the sub window to the right shows the top level structure of the model The model diagram has an icon for the model of the robot with connected drive lines for the joints The reference angles to the drive lines are calculated by a path planning module giving the fastest kinematic m
45. eLib Motor Info Source html source code File Edit Simulation Plot Animation Commands Window Help Linear analysis a x Dre oe QOS MivYooVA 4 amp EIS 0 z gt SBE gt Motor a g amp lt gt Package Browser a Xx CJ info rew rev i 2 ST lt html gt omplexMa i aC th lt p gt This is a simple motor model lt p gt Utilities lt p gt This documentation can certainly be extended using e g links and images of this fic editor An image of the toolbar above illustrates the image possiblility lt p gt ra 7 Constants lt p gt lt img src modelica DriveLib Resources Images Toolbar png gt lt p gt F lIcons lt p gt For more information about this editor please see chapter amp QUOT Developing a a model amp QUOT in this manual lt p gt Kg Slunits lt p gt More information about Dymola in general is found in lt a href http www Dymola com gt Unnamed www Dymola com lt a gt lt p gt _ DriveLib lt html gt The final result ae Fa i By clicking and selecting Formatted Documentation in the toolbar on top of the documentation layer the result will be shown GETTING STARTED WITH DYMOLA 55 a E Motor DriveLib Motor Documentation File Edit Simulation Plot Animation Commands Window Help Linear analysis Drege BASIN NYOoV AB 2 AMS el o Motor A
46. ect the resistor to the inductor by pointing at the right connector of the resistor the small white square press the left mouse button and keep it pressed while dragging it to the left connector of the inductor The resistor and the inductor are now connected and the graphical result is a line between them When connecting the voltage source and the resistor break the line by clicking at an intermediate point There is a possibility to obtain automatic Manhattanize of connections non endpoints of the connections are moved to make all line segments horizontal or vertical Select the connection right click and select Edit gt Manhattanize Draw all connections Note that we could have drawn a connection between two components as soon as we have the components and we have not to wait until all model components are in place The points of the connectors can be moved and new points can be inserted using the context menu of the connector Finally we have to introduce a signal connector for the voltage control and a flange connec tor corresponding to the shaft of the motor so the motor can be connected to an environment We would like to place the icon of the connectors at the border of the grid of the drawing pane because the icon of a model component also includes the connectors The connector inPort must be compatible with the connector of Vs inPort There is a simple way to get a connector inPort that is a clone of Vs inPort Start drawing a connec
47. elica SIunits The mass is the first one to be declared To find Mass in the package browser click on the package SIunits to get a good starting point and then press m on the keyboard The first physical type starting with m will be displayed Pressing m again will find the next physical type starting with m and so on Another way to find it fast is by clicking on the header Packages of the package browser that will sort the physical types in alphabetical order Once Mass is found drag it to the component browser The following menu will pop up Pendulum Pendulum Modelica Text o B 2s File Edit Simulation Plot Animation Commands Window Help Linear analysis X f mm tp j A J wt Creek SaVPivyoOoVvA4 2 BS 0 4 i gt SHE EZ ieee Package Browser ax B Packages model Pendulum i PowerLevelDifterence DampingCoefficient equation LogarithmicDecrement der phi w AttenuationCoefficient J der w m g L sin phi PhaseCoefficient end Pendulum PropagationCoeffident Dropped Class Damping Density RelativeDensity Change class of component Add component D Add dass parameter replaceable type name Modelica SIunits Mass Add base class Declaring a variable The choice to add a component is pre selected Click OK A menu to declare a variable pops up Mew Variable Declaration Type Prefix
48. endulum 77 pendulum 20 experiment setup See simulation setup extend 65 F fixed attribute of start value 36 font size 23 Furuta pendulum 77 H highlight syntax 22 info button 11 L library 45 manhattanize 52 matrix defining a matrix 35 mode Modeling 5 Simulation 5 model documentation 53 Modelica Standard Library 37 Modelica text layer font size 23 Modeling mode 5 92 moving animation view 17 plot window 538 P package browser 8 hierarchy amp pan animation view 17 parameter dialog 10 propagation 68 pendulum 20 plot window 16 window options 38 propagation of parameters 68 R robot demo 6 roll animation view 17 rotate animation view 17 run script 16 S script 16 75 scroll animation view 17 setting parameters 29 shortcuts list of shortcuts 87 simulate model 26 simulation 15 documentation 73 setup 24 Simulation mode 5 start values fixed 36 save to model 67 starting Dymola 5 syntax check 22 T translate model 26 W warnings 35 60 68 See also errors window animation 16 diagram layer 17 Dymola Main 5 edit 8 plot 16 Z zooming animation window 17 plot window 538 93
49. et the following message Checking the model E Dymola Messages Clear i The model has the same number of unknowns and equations 48 i Check of DriveLib Motor successful The connector inPort defines the voltage reference and should be defined for the complete model but is viewed as a known input to the model 56 Signal sources Simulation if It is important to test all models carefully because that eliminates tedious debugging later on Let us connect the motor to a voltage source Create a model called TestMotor and insert it into DriveLib The easiest way is to use the command File gt New gt Model It is good practice to keep testing models Drag a Motor component from the package browser into the diagram layer of TestMotor We need a source for the signal input to the motor Signal sources are to be found in Modelica Blocks Sources Sources package Modelica Blocks Sources gt gt gt 69806 RealExpression IntegerExpression BooleanExpression Clock Constant Step Ramp ExpSine Exponentials Pulse SawT oath Trapezoid KinematicPT P B BE lt it TimeT able CombiTimeTable BooleanConstant BooleanStep BooleanPulse SampleTrigger Lo IntegerConstant IntegerStep Drag for example over Step to the model window and connect it to the motor step startTime 0 Now it is time to simulate Click on the tab for Simulation This will change the mode from Modeling mode to Si
50. ghlighted color coded as you type except types e g Real To get also types color coded right click and select Highlight Syntax or press Ctrl L Apart from implementing color codes for types the command will also give a message if the syntax is not correct It is a good idea to use the command regularly The command does not however change the formatting of the text tabs etc Such change is implemented by selecting the part of the text that should be reformatted and then right clicking and selecting Reformat Selection or press Ctrl Shift L The color codes are red black values variables parameters etc green comments 22 If the text seems too small to work with the text size can be changed using the Edit gt Options command and temporary changing the Base font size in the Appearance tab It is a good idea to set it back afterwards r Declaration of parame Pendulum Pendulum Modelica Text Sto ters variables and File Edit Simulation Plot Animation Commands Window Help Linear analysis ox equations Dre eHRSBNwiryoOovAS4 amp FIRS O M i gt B A Pendulum Package Browser g x __ DymolaCommands model Pendulum parameter Real m1 parameter Real L 1 l 7 Modelica parameter Real g 9 81 Unnamed parameter Real J m L 2 Real w equation der phi w J der w m g L sin phi end Pendulum Since the model should be simulated it should be checked
51. gram OD Jw max 315 rac CJi max gj Hflange_motor Ys diff power emf La Ra Animation HAd2 C Opl Rd Ri Rp HRp2 HRd4 Hhall2 HRd3 wgl Hg2 Hg3 hall Hod Hg phi speed Jmotor convert convert2 axisControlBus controller yv lt i gt angleSen p motor m gear a E animationRedraw true lt true E K modeling y Simulation Please note that if the diagram layer window is active selecting another component in the variable browser will also change the selection in the diagram layer window Changing and saving start values Using the variable browser you can change values and then simulate again It is possible to save changed start values directly into the model see section Saving changed start values to the model on page 67 for more information about this possibility 1 2 3 Other demo examples Other demo examples can be found under the File gt Demos menu After selecting an exam ple it can be simulated by running a corresponding script file as was done for the robot ex ample The exception is the demos in Automotive Demos Library It contains several demos and the relevant demo has to be opened first by expanding the package Examples in the package browser by clicking the before it and then double clicking on the relevant demo to open it Please note that to run any of the Automotive Library demos yo
52. he command Animation gt New Animation Window Direct manipulation of the view in the animation window using the mouse has been implemented The view can be moved rotated and zoomed using mouse movements in combination with Meta keys dragging up down left right x axis y axis Roll rotate around Ctrl Shift Clockwise Counter Left Right Z axis clockwise Zoomin out none Wheel Zoomin out Ctrl Wheel Zoom in out Ctrl Right mouse button Up Down To set the rotation center on a selected component use the context menu of the object and select Current Object gt Set Rotation Center The arrow keys pan and tilt in fixed increments of 5 degrees in addition page up page down tilt 45 degrees The Home key resets viewing transformation Let us now look at the plot window The plot shows the speed reference and actual speed of the third joint A very convenient way to display the variables for a certain component that is of interest is to use the diagram layer of the edit window also in Simulation mode The diagram layer enables the user to follow a simulation by displaying variables and to control it by setting parameters The user can descend into any level of the model in order to plot or display variables GETTING STARTED WITH DYMOLA 17 emo The diagram layer in Simulation mode Open Class Open Class in New Tab Open Class in New Window 8 o a Ctrl X Ba Ctrl 18 Push the Diagram laye
53. he package browser if scrolled Select Modelica text to get the Modelica representation which at this stage just specifies a package with no contents The layer shown in the package created Modelica Text layer Diagram layer etc depends on what layer was shown when creating the package From the result below it is obvious that the Modelica Text layer was shown when this package was created The layer shown can easily be changed by buttons in the toolbar in the upper right of the window DriveLib DriveLib Modelica Text File Edit Simulation Plot Animation Commands Window Help Linear analysis Dre eR ASIN IVNOOoVARY gt ae DriveLib ex H e package DriveLib end DriveLib bModeiica Reference Modelica 1 4 3 Creating a model for an electric DC motor An electrical DC motor flange_b1 A model of the complexity indicated above will be developed for the electric DC motor For simplicity the voltage supply is included in the motor model The model includes an ideal controlled voltage source The electric part of the motor model includes armature resistance and armature inductance The electromotive force emf transforms electrical energy into ro tational mechanical energy The mechanical part includes the mechanical inertia of the mo tor Let us start building the motor model Select in the Dymola window File gt New gt Model Enter Motor as name of the new model To
54. he system from compo nents available when possible and develop only when necessary The idea of object oriented modeling is to support easy and flexible reuse of model knowledge Modelica has been designed to support reuse of model components as parts in different models and to support easy adaptation of model components to make them describe similar physical components The design of Modelica has also been accompanied by the development of model libraries 1 4 1 The Modelica Standard Library We will now have a look at the Modelica Standard Library to see what is available and how we access the model components and their documentation To open the library double click on Modelica in the Package browser GETTING STARTED WITH DYMOLA 37 Opening the Modelica ie Dymola Dynamic Modeling Laboratory Diagram Standard Library 5 Dymola Dy ng ry g Edit Simulation Plot Animation Commands Window Help Modelica lt Not yet opened gt Dymola reads in the library The Modelica Standard Library is hierarchically structured into sub libraries The sub libraries of the Modelica Standard Library Dymola Dynamic Modeling Laboratory Diagrar File Edt Simulation Plot Animation Cc S eHhQSanwinoo y Package Browser a x Packages H Modelica Reference ia Modelica H User s Guide Bi Blocks 1 ComplexBlocks pHa StateGraph 23 Electrical EI Magnetic p Mechanics 2 Fluid A Me
55. ia is J 0 5 m r 2 We need to declare m and r in MotorDrive Open MotorDrive Activate the Modelica Text representation press the Modelica Text toolbar button the second rightmost tool button The parameters and variables are more than real numbers They are physical quantities The Modelica standard library provides type declarations for many physical quantities Select Open Modelica SIunits by clicking on it in the package browser note do not open it MotorDrive should still be open For the parameter r which is a radius it is natural to declare it as being of type Radius To find it enter r and the browser goes to the first component starting with r R If it is not the desired one press r once again and so on to find it Declaration of parameter r Parameter declara tions added to motor drive When you have found Radius drag it to the component browser below The choice to add a component is pre selected Click OK A menu to declare a variable pops up Complete the declaration do not forget to change to a parameter New Variable Declaration Type Prefix Type and name Modelica Slunits Radius r Description Modelica parameter Modelica Slunits Radius r 0 5 Radius of load Click OK and the text appearing in the bottom row is inserted into the Modelica text win dow The parameter m being 80 kg if the resulting inertia should be the same as previously is defined in an analogue way MotorDr
56. ibody Examples Systems RobotR3 fullRobot General Animation Advanced Component Icon Hame mechanics r mwe S S Model Path Modelica Mechanics MultiBody Joints A evolute Fee viele Comment Revolute joint 1 rotational d gree of freedom 2 potential states optional axis flange Parameters Used wisF lange true if asis flange is enabled animation animation sel true if animation shall be enabled show axis as cylinder n 1 Asis of rotation resolved in frame_a same as in frame_b Initialization phi start E th deg Relative rotation angle fror frame_a to frame_b ww stark g fh rads First derivative of angle phi relative angular velocity a start Fe ih rad s2 Second derivative of angle phi relative angular acceleration The parameter dialog allows the user to inspect actual parameter values In demos the parameter values are write protected to avoid unintentional changes of the demo example then the dialog just has a Close button and an Info button When the parameter values can be changed there is one OK button and one Cancel button to choose between The values are dimmed to indicate they are not given at the top level model but somewhere down in the component hierarchy A parameter dialog may have several tabs This dialog has the tabs General Animation Advanced and Add modifiers In a tab the parameters can be further structured into groups as shown It is easy for a model developer
57. isplay the following Dymola Dynamic Modeling Laboratory Diagram File Edit Simulation Plot Animation Commands Window Ff I Jo pea DY AH 2E Pa pe Open Ctrl Q0 pa tae Load Ctrl Shiit O pil Libraries ON Modelica Reference Demos Modelica Standard Library i el Save Ctri S DymolaCommands Save As ModelManagement Save All DataFiles Save Total Design Version Userlnteraction Clear All PlotSD Oh Search Modelica_LinearSystems2 Change Directory Modelica_StateGraph2 8 Print Ctrl P Modelica_Synchronous Import b Modelica_DeviceDrivers Export Optimization Save Log Vehiclelnterfaces Modelica Reference is the documentation of classes operators etc from the Modelica Language Specification There are no components that can be dragged from this library to the edit window it is purely documentation This library 1s free Modelica Standard Library has been dealt with earlier in this chapter This library is free DymolaCommands contains selected commands built in functions They are grouped in the same way as they are documented in chapter 5 in this manual section Scripting sub section Built in functions in Dymola Note that this library is automatically opened when opening Dymola Model Management deals with version management model dependencies encryption model and library checking including regression testing of libraries model comparison and model structure It canno
58. ive DriveLib MotorDrive Modelica Text H File Edit SUSEN NODOJ AN Z 2 Z h SBH o Commands Window Help Package Browser a x model MotorDPrive Packages All i i WaveNumber a i CircularwaveNumber parameter Modelica SIunits Radius r 0 5 Radius of load i Arnolt delevelDifferenca parameter Modelica SIunits Mass m 80 Mass of load P equation PowerLevelDifference HMM i DampingCoefficient and HotorDriva Pr LogarithmicDecrement AttenuationCoefficient i PhaseCoefficient PropagationCoefficient Damping Mass v eee gt In Modelica Text representation above the components and connections are indicated by in the margin to the left of the text and icons in the text It is possible have them expanded textually in two ways 99 One way is to work with individual annotation It is possible to click on the or the corresponding icon to expand that annotation but no other If sub annotations are present new and icons will be visible which in turn can be expanded Of course they can also be compressed using The other way is to work with all annotations at the same time If that is wanted right click and select Expand gt Show components and connect It is also possible to expand the annotations such as the graphics for the icon of the model the positions and sizes of the icons of the components the path of the connections etc This is done by right clicking an
59. iy astat t oyadis2 Absolute angular acceleration of component dertwy Click OK to confirm the changes If simulated again the upper warnings in the Translation tab will not be present any more The lower warning states that the parameter motor emf k start 1 only has a start value start 1 but no value The warning implies that this parameter value is generic and that it ought to be set by the user More about such warnings can be read in chapter Developing a model section Advanced model editing sub section Parameters variables and constants The way to handle this is to double click on the emf component and set the value of k to 1 GETTING STARTED WITH DYMOLA 63 64 emf in DriveLib Motor General Add modifiers Component Mame comment Model Path Modelica Electrical Analog Basic EMF Comment Electromotoric Force felectric mechanic transformer Parameters usesupport C j true if support Flange enabled otherwise implicitly grounded k ap Mma Transformation coefficient Click OK to confirm the change When simulating again no warnings will be given 1 4 7 Creating a model for the motor drive The task was to build a model for a motor drive and it ought now to be a simple task to com plete the model We will just give a few hints Note that the full names of the components are given in the component browser at the lower left Give the model the name Moto
60. library for details Optimization is a newer version of the Design optimization package in the Design library see above It contains much more functionality and should be used for new applications rather than the old one For more information see the manual for the library which is available using the command Help gt Documentation 1 6 2 Libraries that can be added There are a number of libraries available both free and commercial ones For an overview of them please see http www modelica org libraries Help and information 1 7 1 Reaching compressed information The What s This command button etc The What s This command is used to display information about many things The command is activated in three different ways depending on where is should be used In the Main Dymola window Dymola Dynamic Modeling File Edit Simulation Plot Animat eH AS Miv ms Package Browser Packages what s this If more information should be obtained for e g a button or a symbol in the Dymola main window the easiest way is to click on the What s This button and then click on the symbol that is of interest The Help menu can also be used to activate this function Please note that this button does not work in the Edit window In any dialog Dymola In any dialog the What s This is reachable using the in the upper corner of the window Click on the and then on the field of interest Please note that sometimes the
61. ling Ctrl F1 Simulation Ctrl F2 Package browser Shorteut Cul Up Move Down Ctrl Down Copy Path Diagram icon layer Command Shortcut Modelica Text editor Edit Function Call Documentation layer Info revision editor Command window Shorteut Default shortcuts for text editor in Qt Shorteut Up Move one character to the left Move one character to the right Right GETTING STARTED WITH DYMOLA 89 90 Move one viewpoint page up PageUp Move one viewpoint page down Move to the beginning of the text Home Move to the end ofthe text Scroll the page horizontally Alt Wheel Ctrl Wheel Select all text Ctrl A 2 Index A animation 17 animation window 16 moving view 17 pan view 17 roll view 17 rotate view 17 scroll view 17 tilt view 17 zooming 17 array defining an array 35 B bound parameter 68 browser component 8 9 package 8 C class documentation 53 extend 65 component browser 8 9 library 45 reference ZL context menu 8 creating a model 47 D DC motor 37 declarations 22 demo 6 der operator 20 diagram layer 17 documentation editor See editor documentation manuals 86 of class 53 of model 53 of simulation 73 91 E edit documentation of class 55 documentation of simulation 73 edit window amp editor documentation of class 55 documentation of simulation 73 examples DC motor 37 Furuta p
62. margin to the left of the text and the icon almost at the end of the text indicates the presence of graphical information or annotations It may be displayed This can be done in two ways either by clicking on the or on the icon or by right clicking to get the context menu and then select Expand gt Show Entire Text Either way it is revealed that the annotation is an annotation documenting which version of the Modelica standard library was used Dymola uses this information to check if compatible versions of libraries are used and to support automatic upgrading of models to new versions of libraries A model developer can provide conversion scripts that specify how models shall be upgraded automatically to new versions of a library Please note that if any parameter variable should be changed later on the command Edit gt Variables can be used to select the variable that should be edited Example of defining a 3 x 3 matrix Real parameter Another way of inserting pre defined physical quantities is to recognize that these are types Types can be inserted in the code by right clicking to pop the context menu and then selecting Insert Type The menu that pops enables searching by typing in names The advantage is that all types in all open packages are searched It will be easy to find a known type even if it located in another package However to also get help from the Declare variable menu as above the user has to e Insert
63. mulation mode To simulate the model click on the toolbar button Simulate Please note the difference Some warnings will be presented Please see next section on how to get rid of them However they are warnings so the simulation will work anyway To inspect the result we will first look at the angular position of the motor motor flange_b phi Open motor in the variable browser by clicking on the sign Open the flange_b and tick phi GETTING STARTED WITH DYMOLA 57 Angular position MU C 58 TestMotor DriveLib TestMotor Plot 1 File Edit Simulation Plot Animation Commands Window Help TARET ILER g Bo Reve eFaerk Bolt Dh TL M 44 4i ib DD Time 0 J Speed 1 Variable Browse l i s motor flange _b1 phi Variables Values Unit 60 Si TestMotor 1 motor step lt J Advanced vw 0 00 025 true x simulateModel DriveLib TestMotor method dassl resultFile TestMotor true lt ommands Modeling y Simulation First we may establish that a positive input signal makes angular position increase The plot looks almost like a straight line However there are some wriggles in the beginning Zoom in use the mouse to stretch a rectangle over that portion of the curve you would like to see We may also plot the angular velocity motor Jm w there is an oscillation which dies out and the velocity becomes constant There is much to be done to
64. n you would like to reference a variable a bit down in the component hierarchy Dymola can assist you First you enter 0 5 and then you click on the small triangle to the right of the value field Select Insert Component Reference and then m GETTING STARTED WITH DYMOLA 71 Using Component load in DriveLib MotorDrive X Reference to enter a General Advanced Add modifiers formula Component Icon Inertia om EESE a Model J Path Modelica Mechanics Rotational Components Inertia Comment 1D rotational component with inertia a Parameters i load i T J Edit ial Initialization Edit Text Copy Default phi stark deg Absolute rotation anc View Parameter Settings woskark H radis Absolute angular welt Propagate a astat p rad s Absolute angular acc ch y Final OK Insert Component Reference gearbox rk ta Insert Function Call phiload motor F load positionerror F Mod controller r You have now 0 5 m in the value field for J Enter Use the menus to get a reference to r Complete the expression with the square Click OK The model window now displays the expression for the load inertia The component s pa rameter definition is visible in the model controller gearbox positionerror m J 0 5 m h2 peguyd Open MotorDriveTest and switch to Simulation mode oe Translate 72 A
65. ng these instead of declaring variables parameters yourself gives two advantages e The declarations will be faster e Additional features will automatically be present e g units and limits So let us change the model using ready made physical quantities The starting point is the Pendulum model built previously If Dymola is not started start it and use File gt Open to open Pendulum mo Press the Modelica Text toolbar button the second rightmost tool button to show the Modelica text layer GETTING STARTED WITH DYMOLA 29 Adding a physical type 30 Mark the declarations of variables parameters in the text and delete them Do not delete the equation that one we will keep The result will be Pendulum Pendulum Modelica Text File Edit Simulation Plot Animation Commands Window Help Linear anal Dv e ee AS MivYOoCVCAY o EIR Pendulum Package Browser Gx Packages __ DymolaCommands model Pendulum j egu ti Modelica Reference der ghi 1 w P Modelica J der w m g L sin phi end Pendulum Unnamed Open Modelica SIunits in the package browser by first expanding the Modelica package by clicking on the in front of it and then expanding SIunits by clicking on the in front of it Now a number of physical types should be visible What is to be done is to redo the declaration part of the model presented on page 22 using the physical types available in Mod
66. nternet Explorer A model can be inspected and edited in different views When specifying a behavior directly in terms of equations it is most convenient to work with the model as the Modelica Text that is working in the Modelica text layer of the edit window To display this layer press the Modelica Text toolbar button the second rightmost tool button The edit window can now be used as a text editor GETTING STARTED WITH DYMOLA 21 The model presented in the Modelica text layer Pendulum Pendulum Modelica Text File Edit Simulation Plot Animation Commands Window Help Linear analysis E x Dre eH hQSaiVPinNOocaAQb o Z iljs gt BSR Zz gt Unnamed Pendulum E Package Browser a x __ DymolaCommands IM model Pendulum Modelica Reference i quati _ Modelica i Unnamed end Pendulum To declare the parameters and the variables enter as shown the declarations for the parame ters m L and g which also are given default values The parameter J is bound in terms of other parameters Finally the time varying variables phi and w are declared A start value is given for phi while w is implicitly given a start value of zero model Pendulum parameter Real m 1 parameter Real L 1 parameter Real g 9 81 parameter Real J m L 2 Real phi start 0 1 Real w equation der phi w J der w m g L sin phi end Pendulum New text will be syntax hi
67. of Pendulum i The DAE has 2 scalar unknowns and 2 scalar equations AN The initial conditions for variables of type Real are not fully specified Dymola has selected default initial conditions i Assuming fixed start value for the continuous states _ phi start 0 1 i Assuming fixed default start value for the continuous states wi start 0 0 Statistics Selected continuous time states Finished WARNING 1 warning was issued Finished In order to have sufficient number of initial conditions Dymola look at the possibility to use variables as states and attribute fixed start values to such states For more information please see chapter Introduction to Modelica section Initialization of models and more advanced the manual Dymola User Manual Volume 2 chapter Advanced Modelica support section Means to control the selection of states Dymola presents in the warnings what variables have been selected as states with fixed start values Dymola assumes fixed start values phi 0 1 and w 0 We have set the start value of phi to 0 1 above while the start value of w was implicitly given a start value of zero default However the attribute fixed is the problem Fixed true means that the start value is used to initialize the model it must be satisfied during initialization Fixed false means that the value is just a guess value for a non linear solver For variables fixed is default false Since the in
68. omponent Browser OG x E 3 Parameters HModelica Mechanics MultiBody Exampl 5 l axis3 Show Component lim Example Modelica Icons Example axisControlBus3 A 2 Open Class mechanics 1 y pathPlanning axis Open Class in New Tab axisl axisControlBus2 4 Open Class in New Windo axis2 View Attributes axis3 axis 7 axis4 axisControlBus1 L 79 Change Class axis5 oe Cut axis6 33 Co controlBus Ea E E Paste 7A Delete Duplicate E Moc de Rotate 90 It is not necessary to select the robot component explicitly by first clicking with the left button on the mouse on it to access its menu It is sufficient to just have the cursor on its icon in the edit window and right click The component browser also gives easy access to The mechanical struc ture of the robot the robot component Just position the cursor over mechanics and right click to get the context menu for mechanics The component browser provides a tree representation of the component structure The edit window showing the diagram layer and the component browser are synchronized to give a consistent view When you select a component in the edit window it is also highlighted in the component browser and vice versa The diagram layer of the edit window gives the component structure of one component while the component browser gives a more global view useful to avoid getting lost in the hierarchical component structure The edit windo
69. on ae ae X ES BS rotted aaaea pan Cep avas mout sna 5g amen arse ilah forge of cet SISE Path DriveLib Motor Filename E Experiment DriveLib mo Uses Modelica version 3 2 1 54 l To enter a description click the command button Info Editor in the toolbar on top of the documentation layer You now have access to a documentation editor for the model class with text editing possibilities as well as link creation and image insertion After insertion of some text an image and a link the result can look like Documentation editor Motor DriveLib Motor Info Editor File Edit Simulation Plot Animation Commands Window Help Linear analysis Ove e PASM ivyoocvAS4 d EIRS o0 Z a e y 2 SHB we o z SANE a x infa reu reu Normal Default Default B This is a simple motor model This documentation can certainly be extended using e g links and images of this editor An image of the toolbar above illustrates the image possibiility g F Normal Default efit 7 BJ Ux x Ar amp iS For more information about this editor please see chapter Developing a model in this manual More information about Dymola in general is found in www Dymola com Sai The created source code in html formatting can be viewed clicking Info Source in the toolbar on top of the documentation layer The corresponding Motor Driv
70. on setup menu will be displayed The Simulation Setup f2 Simulation Setup menu General Experiment Name Pendulum Simulation interval Start time oO Stop time 1 Output interval Interval length Number of intervals 500 Integration Algorithm Tolerance 0 0001 Fixed Integrator Step 0 Set the Stop time to 10 seconds Click OK he To run the simulation select Simulation gt Simulate or click directly on the Simulate toolbar button GETTING STARTED WITH DYMOLA 25 Selecting Simulate in the Simulation menu 26 Pendulum Pendulum Time Linearize Setup Visualize Show Log Dymola first translates and manipulates the model and model equations to a form suitable for efficient simulation and then runs the simulation You may explicitly invoke translation yourself by selecting Simulation gt Translate or click on the Translate toolbar button You will get a warning that the initial conditions are not fully specified The warning can be seen in the Translation tab of the Message window that will pop However Dymola will select default initial conditions so the simulation will work We will discuss how to get rid of the warnings later For now you can just close the Message window When the simulation is finished the variable browser displays variables to plot To see the plot better maximize the plot window in the edit window Then click in the square box
71. on such as the content of the library conventions and conditions for use GETTING STARTED WITH DYMOLA 39 Opening Modelica Me chanics 40 Dymola comes also with other free model libraries A list of these libraries is given by the command File gt Libraries The package menu gives direct access to the sub libraries We will need components from various sub libraries We will need rotational mechanical components as well as electrical components for the motor To open the Modelica Mechanics double click on Mechanics in the Package browser The documentation layer of the library will be shown If not click on the Li in the upper toolbar a Mechanics Modelica Mechanics Read Only Documentation File Edit Simulation Plot Animation Commands Window Help Linear analysis x D oeeQSaitiryoocaAn 2 2 A S O gt 2 AE Mechanics v a Package Browser TEIE modelica Reference Library of 1 dim and 3 dim mechanical components multi body rotational translational P7 Modelica user s Guide i E Blocks This package contains components to model the movement of 1 dim rotational 1 dim translational and 3 dim mechanical systems Information E ComplexBlocks i fo Note all dissipative components of the Modelica Mechanics library have an optional heatPort connector to which the i E B 4StateGraph dissipated energy is transported in form of heat This connector i
72. or for the reference as we did for the electric DC motor model However here we will take the opportunity to show another useful way namely use of extends We will develop a new class say Motor DriveTest which extends MotorDrive Select MotorDrive in the package browser and select Edit gt Extend From in the context menu This gives the same dialog as File gt New gt Model but with several fields filled out It extends from MotorDrive and is inserted in the same package DriveLib Enter MotorDriveTest as the name of the model Click OK The result is a model window where the diagram layer looks exactly like that of MotorDrive GETTING STARTED WITH DYMOLA 65 Tuning the controller 66 However the components cannot be edited Try to move or delete a component It has no effect Drag a component Step from Modelica Blocks Sources to the edit window and connect it Save the model It is valuable to give some thoughts comparing extend to copy paste add The former strategy allows a far more clean structure where an object can be reused in a number of locations If that object is further refined all objects extended from that one will gain from that refinement A model can be used for different tasks One is tuning the controller manually Click on the tab for Simulation Translate the model MotorDriveTest by clicking on the Translate button Also delete one of the plot windows and delete the previous curve The
73. ovement under given constraints The edit window displays by default the model diagram diagram layer but the user can select other information other layers to be displayed instead e g documentation or Modelica text For more information please see the chapter Developing a model The component browser in the lower left sub window also shows the components of the ro bot experiment in a tree structured view To inspect the robot model select the icon in the edit window red handles appear see below and right click press the button to the right on the mouse A menu pops that contains a selection of actions that can be made for the selected object a context menu From the context menu select Show Component P fullRobot Modelica Mechanics MultiBody Examples Systems RobotR3 fullRobot Read Only Diagram File Edit Simulation Plot Animation Commands Window Help Linear analysis x Da j et An o a J pas m Dre e RP kOSMirnyOoVAY4 BIAJS O gt BBA GZ fullRobot v Package Browser g x rei Mechanics 0 MultiBody Eh User s Guide of MultiBody Li pathPlanning vore i AN i E P Examples 6 axes 2 2 i P Elementa re a axis ii Loops axisControlBus6 A P Rotational3DEffects mechanics PEPE eS axisS 1 Sig Consteints axisControlBusS L z E Systems ooo n 5 Gale gt 18 i mas 2 axisControlBus4 L 4 Paai C
74. percent and a maximum control signal magnitude of 100 Enforce the last constraint by adding a Modelica Blocks Nonlinear Limiter component between the controller and the motor in the MotorDrive model Set uMax 100 and uMin 100 for the limiter We will not show this component in the code The result might be something like MotorDrive lest DriveLib MotorDrivelest Plot 1 y File Edit Simulation Plot Animation Commands Window Help tm EQS Mie Blo Be vek i Serm Boia Sh WD M 44 4l i dD Time T Speed 1 Variable Browser phiload phi step y 1 2 iMotorDriveT est 2 positionerror controller motor gearbox load phiload flange v phi limiter Estep M e height viy _ offset startTime x gt Modeling y Simulation Saving changed start values to the model Having tuned values in simulation mode like the interested reader above it is a big advantage to be able to directly save them in the model changing the Modelica code This can be done by right clicking on the result file in the variable browser and selecting Save Start Values in Model like below on purpose the wanted values are hidden under the menu not to destroy the challenge of finding better values in previous section GETTING STARTED WITH DYMOLA 67 68 MotorDriveTest MotorDrive File Edit Simulation Plot Animation Commands Window Help Linear analysi
75. r button in the diagram layer toolbar to show the diagram The result might look like E fullRobot Modelica Mechanics MultiBody Examples Systems RobotR3 fullRobot File Edit Simulation Plot Animation Commands Window Help we QS Mie Bio vibe vet DAEA AOD I iM A aD DD Time x By Plot 1 Variable Browser Variables Y Values Us SjfullRobot 1 controlBus axisControlBus3 speed_ref rad s controlBus axisControlBus3 speed rad s C mLoad 15 kg C rLoad 1 m C rLoad 2 m C rLoad 3 m Og 9 81 m C refStartTime s C refSwingTime 0 5 ls O startAngle1 60 de O startAngle2 20 de O start ngle3 90 de CO start ngle4 0 de Diagram O startAngle5 110 de CO start ngle6 0 de C end nglel 60 de O end ngle2 70 de O end ngle3 35 de O end ngle4 45 de C end ngle5 110 de O end ngle6 45 de C refSpeedhliax 1 3 rac C refSpeedMax 2 1 5 ra C refSpeedMax 3 5 rac a C refSpeedMax 4 3 1 rac x C refSpeedMax 5 3 1 frac 8 C refS peedMax 6 4 1 ra E CrefAceMax 1 15 rac D O ref ccMar 2 15 rac n C ref ccMar 3 15 rac Cref ccMar d 60 rac angle ref itializef Cref ccMar 5 60 rac peed i Cl refAceMax 6 60 rac COkp1 5 COks1 05 E OTs 0 05 s Clkp2 5 COks2 0 5 OTs2 0 05 s Ckp3 5 Oks3 0 5 OTs3 0 05 s Clkp4 5 Clks4 0 5 OTs4 0 05 s Okp5 5 amp lt il gt m
76. r is not displayed the command Edit gt Variables gt New Variable is always available The other quantities are defined in analogue ways It is a good idea to try both ways above to see which one you like the best When coming to the variables phi and w they are variables not parameters Nothing should be entered in the type prefix input field for those When completing the form to declare the angle phi the start value of the angle is defined by clicking on the small triangle to the right of the value field and selecting Edit A submenu pops up Enter 0 1 for start The result will look like GETTING STARTED WITH DYMOLA 33 Entering a start value The result 34 Variable Declaration in Pendulum General Model Path Modelica Slunits Angle Comment Parameters displayUnit min max start fixed nominal stateSelect Click OK The following result is displayed E3 model Pendulum parameter Modelica parameter Modelica parameter Modelica parameter Modelica SITunits Mass m l Mass of pendulum SITunits Length L l Lenght of the pendulum SITunits Acceleration g 3 81 Gravity of acceleration Slunits MomentOtinertia J m b 2Z Moment af inertia Modelica SIunits Angle phitstart 0 1 Pendulum angle Modelica SIunits aAnqularVelocity w Angular velocity equat lon der phi J der iw ds end Pendulum Wy m q L sint phil The in the
77. rDrive we will refer to that name later on Put it in Drive Lib To generate the position error you may use the model component Modelica Blocks Math Feedback For the controller there is Modelica Blocks Continuous PID In this simple example we can select the component Modelica Mechanics Rotational Components IdealGear as gearbox For the meaning of ratio for the gearbox model please consult Info for the model Set ratio to 3 as indicated It means that the motor load rotates 3 times slower than the DC motor The library Modelica Mechanics Rotational Sensors contains a sensor for angles Inserting a load was dealt with when building the motor model MotorDrive DriveLib MotorDrive Diagram File Edit Simulation Plot Animation Commands Window Help Linear analysis selali NOovgA4 S RIS 0o Z h BABZ gt l Package Browser Packages Modelica Reference P Modelica Unnamed Drivetib ggeMotor TestMotor MotorDrive MotorDriveTest controller positionerror positionerror gearbox load controller phiload motor Modeling Y Simulation To test the model MotorDrive for normal operation we need to define a reference for the position This can be done in different ways A simple approach is to add a signal source di rectly to MotorDrive However we may like to use MotorDrive also for other purposes If we would like to use the drive as a component we could add a connect
78. s enabled via parameter useHeatPort If the i rb EE aia heatPort connector is enabled it must be connected and if it is not enabled it must not be connected Independently whether the heatPort is enabled or not the dissipated power is available from variable lossPower which is positive if Geg Bgg H ay R heat is flowing out of the heatPort Component Browser Extends from Modelica Icons Package Icon for standard packages Modelica Mechanics fim Package Modelica Icons Package Package Content Filename E Program Files x86 Dymola 2016 Beta 3 Modelica Library Modelica 3 2 1 Mechanics Version 3 2 1 2013 08 14 build 2 2013 08 14 08 44 41Z Uses Complex version 3 2 1 ModelicaServices version 3 2 1 Modeling W Simulation To get documentation on Modelica Mechanics as previously demonstrated place the cursor on Mechanics right click and select Info Besides using the package browser of the Dymola window it is also possible to open a li brary window that also contains a browser It can be done in two ways If the library window should contain the Mechanics package select Mechanics in the package browser and right click to get a menu Select Open Library Window If the window should contain the top package in the browser Modelica in this case use the toolbar to select Window gt New Library Window Using the latter selecting Modelica in
79. s states i i i fv st Fixed d a iiig SI Angle phi stateSelect stateSelect Absolute rotation angle of component ioio ppiGplnertia gt a i i i i u Baic a SI AngularVelocity w stateSelect stateSelect 1 ooo ap R Absolute angular velocity of component der phi ooo SN i ae Component Browser a x SI AngularAcceleration a Absolute angular acceleration of component der w CH Modelica Mechanics Rotational Compo a E flange_a E flange_b equation phi flange 4 phi phi flange b phi w der phi a der w J a flange _a tau flange _b tau D gt a end Inertia If wanted it is possible to look at the content with equations rendered with mathematical notation Click the command button Mathematical Notation in the toolbar above the Modelica text pane The result will be Displaying using mathematical notation Creating a new Modeli ca package Inertia Modelica Mechanics Rotational Components Inertia Read Only Mathematical Notation File Edit Simulation Plot Animation Commands Window Help Linear analysis a x Dre eR QSiWinyOocvAB4 2 FMS 0 Z e p m Package Browser a x 5 f Rotational model Inertia 1D rotational component with inertia pif User s Guide of Rotational L parameter SI Inertia J min 0 start 1 Moment of inertia it gt Examples parameter StateSelect stateSelect StateSelect default _ Priority to use phi and
80. seAxisFlange the command Edit Text can be used to enter an expression that should be true in order for the axis flange to be enabled If such an expression is entered the checkbox will be displayed as m Some parameters have a list of choices where you can select values instead of writing them One example is the parameter n which defines the axis of rotation The value for this revolute joint is 0 1 0 1 e the axis of rotation is vertical Parameters usedyisF lange true if axis flange is enabled animation arinnation 8 true if animation shall be enabled show axis as cylinder A Axis of rotation resolved in frame_a same az in frame_b Initialization HOO s anig phi start 10 10 y axis Relative rotation angle from frame_a to frame_b Ww shart veers First dernvative of angle phi relative angular velocity j 1 0 0 negative x anis e D 2 gt a start 0 1 0 negative y axis Second derivative of angle phi relative angular acceleration 0 0 1 negative z axis To learn more about the component select Info An information browser is opened to show the documentation of the revolute joint Links in the document makes it easy to navigate to e g the description of the package containing the revolute joint Now please close the browser and press Close in the parameter dialog to leave it If you want to see the documentation without going via the parameter dialog right click on the component in
81. system is put together as intended Click on the toolbar button Visualize The animation window shows the initial configuration of the system 80 Initial configuration of system Translate the model In the variable browser open R2 by clicking on the in front of it and enter a value for phi_start say 1 rad and simulate for 5 seconds use the command Simulation gt Setup to change the stop time View the pendulum in the animation window you may want to adjust the perspective when working with the robot please see section Simulation on page 15 for tools used It will be nicer to present it by e g moving it to the following position Initial configuration of A system rotated around y axis The representation of the revolute joints as cylinders can be changed using the parameter animation if that is set to false the joint cylinders are not shown Change parameters and study the different behavior GETTING STARTED WITH DYMOLA 81 1 6 Libraries available when no optional library is installed 82 Try to control the pendulum in such a way as to get a stable upright position A trick is to use a mechanical PD controller i e a spring and damper attached to the tip of the second bar and to a high position Other libraries 1 6 1 Libraries available in the File menu by default Using the command File gt Libraries in a Dymola program with no extra libraries installed will at present d
82. t be used free it demands a license For more information please see the manual Dymola User Manual Volume 2 chapter Model Management DataFiles contains functions for reading and writing data For more information please see chapter Developing a model section Advanced model editing sub section Using data from files Design deals with four main areas e Model calibration makes it possible to calibrate and assess models The Model Calibration option is required for problems with more than one tuner For more information please see the manual Dymola User Manual Volume 2 chapter Model calibration e Model experimentation gives the user possibility to vary parameters of the system to get an intuitive knowledge of the behavior of the model Monte Carlo analysis is included This part of the library is free For more information please see the manual Dymola User Manual Volume 2 chapter Model Experimentation e Design optimization is used to determine improved values of model parameters by multi criteria optimization based on simulation runs The Optimization option is required if used on more complex models For more information please see the manual Dymola User Manual Volume 2 chapter Design optimization Note that a newer library is available also please see Optimization below e Model validation supports validation and regression testing of a specified model The i
83. tention was to use these variable values as initialization values the best is to explicitly set the fixed attribute to true and also explicitly specify the start value of w to zero The resulting code generating no warnings will be model Pendulum parameter HModelica SITunitse Mass mw l Mass of the pendulum parameter HModelica SIunitse Length L l Lenght of the pendulum parameter HModelica SITunits Acceleration g 3 81 Gravity of acceleration parameter HModelica SIunits MomentOtfinertia J m L 2 Moment of inertia Modelica SIlunits Angle phifstart 0O 1 f1xed true Pendulum angle Modelica SIlunits AnqularVelocity wtstart 0 f1xed true Angular velocity equation der phij w J der wi mw q L sin phi l end Pendulum 1 4 Using the Modelica Standard Library Motor drive built with standard components In this example we will show how a model is built up using components from the Modelica Standard Library The task is to model a motor drive with an electric DC motor gearbox load and controller controller gearbox positionerror motor E load peoyiyd As when building a real system there are several approaches One extreme approach is to build the system from scratch However it is often a difficult and time consuming task An other approach is to investigate if the system already is available on the market or if there is some product that easily can be adapted or modified If not build t
84. the Package browser in the upper part of the window and adapting the window will display the following A library window dis Dymola Libraries playing the Modelica Standard Library OEE i BiBlods _ ft pt StateGraph El Magnetic H oka Fluid ee ComplexBlocks StateGraph Electrical Magnetic Mechanics Media RE ORES A Library window includes a package browser where the components of the selected sub library are displayed in a part of the window By closing the package browser by toggling the button to the bottom left double clicking on the icon for Modelica and adapting the window to the content the following will be displayed Please note that now the name of the package will be displayed in the window title bar GETTING STARTED WITH DYMOLA 41 A library window dis playing the compo nents of the Modelica Standard Library The rotational mechan ics library window 42 Modelica package Modelica fox bel Ag UsersGuide Blocks Statecraph Electrical Magnetic Mechanics Fluid Lixo io tran Hebe Media Thermal Math Utilities Constants SIunits By using the right button at the bottom it is possible to go up in the package hierarchy and by double clicking on the icons in the window it is possible to go down in the hierarchy The left and right arrow buttons allow going back and forth as in an ordinar
85. the type on an empty line e Enter a space and the name of the variable e Conclude with a semicolon e Use Edit gt Variables and select the new variable Note outside the example the ease of defining arrays matrices using Edit gt Variables gt New Variable In the Declare Variable dialog that is displayed an Array dimensions field is present after the Variable Name field By entering 3 in this field an array containing 3 elements is defined entering defines an expandable array Entering 3 3 defines a 3 x 3 matrix entering defines an expandable matrix New Variable Declaration Type Prefix Annotations Type and name parameter Real 32 MyMatrixin Description A 3x3 matrix as parameter MyMatrixin Modelica parameter Real MyMatrixin 3 3 A 3x3 matrix as parameter MyMatrixIn cance To enter values or and define the size click on the arrow after the last field see red marking in the figure above then on the Edit command Ez You will get a dialog to enter the values Handling of warnings When simulating we still get a warning that the initial conditions are not fully specified By clicking on the Translation tab in the Message window and scroll to the top the following can be seen when you have expanded the warning node by clicking on the before it GETTING STARTED WITH DYMOLA 35 36 Dymola Messages i Translation
86. ticular using functions If the simple example here should be saved as a script file the easiest way is to do the following assuming that the models have been saved 1 Go to Modeling mode clear everything using the command File gt Clear All 2 Clear the content of the command log pane using the command File gt Clear Log 3 Reopen the DriveLib package using File gt Recent Files GETTING STARTED WITH DYMOLA 15 76 4 Open MotorDriveTest and simulate it 5 Set wanted values of controller Simulate again 6 Plot phiload phi and step y If those are already selected you may have to deselect them and select them again to get the below item to work 7 Force a plot command in the log by clicking the command input line 8 Save the command log using File gt Save Log Select saving it as a Modelica Scripts mos file by selecting that alternative in the Save as type input field Save the script where the model resides Give it a name e g MyScript The saved script can be opened and edited using the Dymola script editor A general text editor e g Microsoft Notepad can also be used but the script editor contains more facilities a C Users UWM Desktop My Test MyScript mos Script Editor L Gar mj P MyScript mos x ff Seript generated by Dymola Fri Feb 28 14 34 19 2014 SimulateModel DriveLib MotorDrivetTest stopTime 5 method dassl resultFile MotorDrivetest controller_k 15 100
87. tion from Vs inPort and go to the left until you reach the border of the grid Then you double click and select Create Connector from the menu popped up The connector flange_b is created in a similar way If you would like to adjust the position of a connector it is easy to get into connect mode This can be avoided by toggling the toolbar button Toggle Connect Mode when the background is white it is in connect mode Click on Icon toolbar button to look at the icon layer You will see the icons for the connectors Let us draw an icon for the motor model One design is shown below The thicker line to the right symbolizes the physical axis from the motor It is a good idea to select that line and use the context menu Order gt Send to Back to prevent any case where the axis seems to be lying outside the motor The icon of the electri cal DC motor Toolbar for editing name To draw it we will use the toolbar for editing graphics NOOVAB4 S FPys 0 Start by drawing the big red cylinder shaded rectangle Click the Rectangle button yellow rectangle and draw a rectangle Let it be selected Click on the arrow to the right of the Fill style button Select Colors and then select a red color Click OK To select the gradient click once again on the arrow to the right of the Fill style button Select Gradient gt Horizontal Draw the rest of the parts using Rectangle or Polygon in an analogous way To enter the text click the Text
88. torical force three operational amplifiers resis tors inductors and sensors for the feedback loop The robot motor motor i 7 h fe m C Rp 7 ee choose F 200 a power ag Cc Ti P m Jmotor flange In M J J e 4d d paads conve MH zC lt oc o k k p ad gz conve axisControlBus View the component gear in a similar way as for the other components It shows the gearbox and the model of friction of the bearings and elasticity of the shafts The robot gearbox n flange of joint axis gear flange of motor axis hearingF rictian sprin flange_b 1 flange_a p Ee _O 1 2 2 Simulation Let us simulate the robot model To enter the Simulation mode click on the tab Simulation at the bottom right of the main window Please note that selecting Simulation mode is not the same as simulating the robot it however gives the possibility doing so the needed menus are available in this mode Modeling Y Simulation GETTING STARTED WITH DYMOLA 15 Simulating the demo by running a script Animated 3D view of the robot 16 Simulating manipulating with given values The Simulation menu contains commands to setup and run simulations Shortcut buttons are also available However the demo has also been prepared with a command script that will simulate the model The script is executed selecting Commands gt Simulate Please use that comm
89. trolBus1 Show Diagram pathPlanning axisl axis Show the diagram layer instead of the icon layer for the icon bag Modeling V Simulation Another convenient way is to use the component browser Put the cursor on top of the wanted component in the browser and right click to get the context menu Select Show Component as shown in the figure below In this case also care must be taken not to select any axes of the module mechanics The component browser has been enlarged in the figure to illustrate this Since Show Component is the first menu option double clicking will yield the same result Please recall that double clicking on a component in the edit window pops up the parameter dialog compare the two menus in the figure above and below 12 Component Browser axis6 F axisControlBus6 Displaying the Components components of axis 1 Modelica Mechanics MultiB ody Examples J mechanics F axis mechanics F A axisControlBus5 a 4 xis2 axis3 axis4 E axis4 E axish E axis6 world rl 12 axisControlBus2 3 r4 5 k 16 b0 b1 b2 b3 b4 b5 b6 load 1 pathPlanning sxisControlBus4 i isControlBus3 axis3 controlBus J V O A A MD axis2 fee fee fe e fee ee ee ee ee l Whatever method is used the result will be the following figure in the edit window The robot
90. u have to have a number of licenses for commercial libraries Please see the description presented when opening the library for more information GETTING STARTED WITH DYMOLA 19 1 3 Solving a non linear differential equation A pendulum The first step to create a new model 20 This example will show how to define a simple model given by an ordinary differential equation We will simulate a planar mathematical pendulum as shown in the figure Le phi mg The variable m is the mass and L is the distance from the support to the center of mass Let us assume the string is inextensible and massless and further let us neglect the resistance of the air and assume the gravitational field to be constant with g as the acceleration of gravity The equation of motion for the pendulum is given by the torque balance around the origin as J der w m g L sin phi where J is the moment of inertia with respect to the origin Assuming a point mass gives J m L 2 The variable w is the angular velocity and der w denotes the time derivative of w 1 e the angular acceleration For the angular position we have der phi w Start Dymola or if it is already started then give the command File gt Clear All in the Dymola main window Click on the tab Modeling at the bottom right Then select File gt New gt Model Ei Dymola Dynamic Modeling Laboratory Diagram File Edit Simulation Plot Animation Commands Window
91. ular velocity 1 100 negative x axis atl 2 a start 0 1 0 negative y axis Second denvatve of angle phi relative angular acceleration 10 0 1 negative z axis A bar is then connected to the revolute joint There is one bar which has the visual appear ance of a box during animation called BodyBox in the Parts library Drag such a component to the edit window Double click on the icon Name it B1 We would like the bar to be 0 5 long and initially horizontal and pointing in the positive x direction This is specified by setting the vector r between the two ends of the body to 0 5 0 0 Click on the Edit icon just to the right of the value field of r and a vector editor pops up Enter 0 5 in the first field 0 in the following two fields you must specify the values since no default values are shown otherwise you later will get an error message Click OK The width and height will be 0 1 by default To get nicer animation you can set different colors for the bars For example use the list of choices of color to make the bar red From the bar B1 we connect another revolute joint R2 having a horizontal axis of rotation n 1 0 0 and a BodyBox B2 rotated 90 with r 0 0 5 O and a different color than the first bar When simulating the start values of R2 are interesting Looking at the parameter dialog for R2 the initial value of the angle phi start the initial velocity w start and the relative angul
92. vailable and types of sub windows appearing depend on the mode and the user s choice Dymola starts with a useful default configuration but allows customizing GETTING STARTED WITH DYMOLA 5 Dymola main Dymola Dynamic Modeling Laboratory Diagram balao window E File Edit Simulatior Animation Commands Window Help Linear analysis _ tal x ee X NOOV Ams 2 2 ANS O Z r SB BABE wx Model tabs Ss ax Unnamed z Oeann Package i browser GaL E lt gt Component Browser 6 x Component browser E Modeling V Simulation 1 2 Simulating a model industrial robot This first example will show how to browse an existing model simulate it and look at the results If you want to learn the basics first you can skip to a smaller example in the next section 1 3 Solving a non linear differential equation on page 20 1 2 1 Investigating the robot in modeling mode We will study a model of an industrial robot To view the industrial robot model use the File gt Demos menu and select Robot Opening a demo exam Dymola Dynamic Modeling Laboratory Diagram ple File Edit Simulation Plot Animation Commands Window Help Linear analysis Fal New ooy AE o Helo T ta Open Ctrl 0 Unnamed o Gal Load Ctrl Shift O J I a Libraries ii C i pL Demos f e o H le Save Ctrl Motor Drive Save As Furuta pendulum Save All Coupled clutches Sav
93. w as states SI Angle phi stateSelect stateSelect Absolute rotation angle of component SI AngularVelocity w stateSelect stateSelect Absolute angular velocity of component der phi SI AngularAcceleration a Absolute angular acceleration of component der w flange A x Modelica Mechanics Rotational Compo d E flange_a w T E flange_b l d flange o cll J a flange r flange r end Inertia After this introduction of how to access model components and documentation of a library we will continue by actually building a model for an electric DC motor This task will give us more experience 1 4 2 Creating a library for components It is a good idea to insert developed components into a library It is a good way to keep track of components and it supports also the drag and drop feature when you will use the models as components Let us collect all developed components in a library called DriveLib Go to the Dymola window and select File gt New gt Package This will pop the dialog Create New Package Name DriveLib Description E Partial Extends optional Insert in package optional Save contents of package in one file Enter DriveLib as the new name of the package and click OK and Accept in the informa tion window GETTING STARTED WITH DYMOLA 45 DriveLib created 46 A package DriveLib is created and made visible in t
94. w now displays the mechanical structure consisting of connected joints and masses The component browser is opened up to also show the internals of the mechanics model component i fullRobot Modelica Mechanics MultiBody Examples Systems RobotR3 fullRobot Read Only Diagram File Edit Simulation Plot Animation Commands Window Help Linear analysis x Drege QS MWinyOovAS4 d IRS 0o Z e y BAG Z gt gt mechanics fullRobot ii Package Browser 7 T 7 all _ pei Mechanics E MuttBody User s Guide of MultiBody Li Eees an gt Elementary gt Loops gt Rotational3DEffects gt Constraints i 4 Systems gt K G x Modelica Mechanics MultiBody Exa lm Example Modelica Icons Exa mechanics W axisl E axis2 E axis3 E axis4 E axis E axis6 world rl r2 r3 l r4 Modelica Mechanics MultiBody Examples Systems RobotR3 Components MechanicalStructure vr E Modeling V Simulation Double click on for example r1 at the bottom of the edit window This is a revolute joint The parameter dialog of that component appears The parameter dialog can also be accessed from the right button menu Double clicking the left button selects the first alternative from the right button menu GETTING STARTED WITH DYMOLA 9 Parameter dialog Selectable display unit 10 mechanics r1 in Modelica Mechanics Mult
95. y web browser Open Modelica Mechanics Rotational in the library window by first double clicking on the icon for Mechanics and then on the icon for Rotational The package Rotational contains components for rotating elements and gearboxes which are useful for our modeling of the electrical motor drive Rotational package Modelica Mechanics Rotational k Users 5 Users ude Examples Components Sources Sensors Interaces The Info for Modelica Mechanics Rotational contains important information on the package content By navigating in the packages libraries present here using double clicking and left arrow we will find a number of components that might be of interest to us As examples this is how the libraries Components and Sensors will look like The Components library Components package Modelica Mechanics Rotational Components soy D amper SpringDamper ElastoBacklash PEs 1a TI ee lr Tr r E E BearingFriction Brake Clutch DnewapClutch Ideal ear LossyG ear IdealPlanetary Gearbox IdealGearA2T IdealRolingw heel InitializeFlange RelatiweStates The Sensors library Sensors package Modelica Mechanics Rotational Sensors O Me Mr Pe Me Oe 6 AngleSensor SpeedSensor AccSensor Rel4ngleSensor RelSpeedSensor AeldccSensor TorueSensor power PowerSensar A quick scan of the Component library indicates that the model Inertia may be of interest for us Right click on Inertia
Download Pdf Manuals
Related Search
Related Contents
inventaires d`aménagement Mac mini Early 2006 User's Guide QUADSTAR 422 Einleitung La réduction du syntagme terminologique au fil du discours Copyright © All rights reserved.
Failed to retrieve file