Written by: David Briant – Project Engineer
This is the seventh in a series of Basics of Dymola that describe some basic elements and methods to be used within Dymola. It follows on from a post describing some Plotting features found in the simulation tab of Dymola.
After simulating a model there can be animations to be displayed, although these are not necessarily included and therefore displayed by default. If there are animation components within a model they can be activated or deactivated, normally using a Boolean parameter named animation.
If there is animation associated with the model, then an Animation Window will be displayed by default when the initialisation stage of the simulation concludes. An animation window can also be displayed by opening the Animation dropdown menu and selecting New Animation Window, as shown below.
Figure 1: Opening a New Animation Window in the Simulation Window
The animation window displays any activated animation components within the model. In the case of the DoublePendulum (Modelica.Mechanics.MultiBody.Examples.Elementary.DoublePendulum) example shown, it includes an axis display, the two links, the corresponding revolute joints and an arrow showing the acting direction of the world gravity. While this example only uses animations of a fixed size, it can also display shapes of varying size, such as a force arrow that extends according to the value force applied.
The time of the animation can be controlled through using the Animation bar, located in the top left corner of the simulation window, as shown below in Figure 2 with descriptions of what each button does to the animation.
Figure 2: Description of the Animation bar
Simple manipulation of the view of the animation can be done by clicking and dragging the animation around in the window; holding the shift button while clicking and dragging up or down will zoom in or out of the centre of the model or using the scroll wheel without holding anything else. Holding control and clicking and dragging will rotate the model around the origin or selected centre of the followed object, as will using the arrow keys; using control+shift and clicking and dragging rotates the animation around the plan in which it is being viewed.
To follow an object while it is moving during the simulation, the desired object must be selected then right clicked on, as this brings up an option to access the animation options related to the current object, as shown in Figure 3. Select follow to track the desired object. This both moves the animation display origin now to the origin of that object and also holds that origin in the same position within the window, moving the animation with the object. From the menu shown in figure 3 the visibility and transparency of the object can be set.
Figure 3: Object options within the animation window
When an object is selected the trace of the object is automatically activated, but to activate it permanently without selecting the object the Toggle Trace button will display the trace of the object’s origin. The Toggle History button is only effective when the history settings have been set within the Setup menu that is accessed through the Animation dropdown menu shown in Figure 1. Within the Frames tab the number and interval of history frames can be set; the animation of the frame history can be seen in Figure 4, with the top link having its history deactivated using the Toggle History button.
Figure 4: The use of the Animation Setup menu and toggling the history of a component animation
The colour of the object denotes its age, with the grey objects representing earliest position of the object and the full colour object representing the position of the object at the time selected. The origin is grey as it does not move thus the earliest position is the same as the current.
The animation can be reset to the default position by selecting Reset View when right clicking anywhere in the animation window; resetting the sizing and the position to fit the animation within the window is achieved by selecting Reset and Fit View. The option Reset All Objects will return all object animation settings to their default.
When multiple simulations with animations have been run, the displayed animation can be selected by right clicking on the name of the simulation in the Variable Browser whilst having the desired simulation window active and selecting Animate. To animate multiple animations within the same window, ensure that the desired window is active then when right clicking on the simulation name select Animate Together.