This is the fifth in a series of the basics of Dymola following on from the first blog about the Component Browser. This post will be describing the Variable Browser in the Simulation window and the features surrounding the use of it to evaluate simulation results.
The Variable Browser is the location that a user can view all the variables that are used and calculated, both inputs and outputs, within a simulation and is highlighted below in Figure 1 with a simulation of the DoublePendulum example that can be found in the Modelica Standard Library with the path: Modelica.Mechanics.MultiBody.Examples.Elementary.DoublePendulum.
Once a model has been simulated all the variables are shown allowing them to be plotted, such as the variable angle in the joint revolute1 shown plotted above. The list of variables is stored under the name of the model run, in this case DoublePendulum, but when multiple simulations of the same model occur then they are displayed in numerical order according to the time they were run. If another DoublePendulum simulation was run, then it would appear as DoublePendulum 2 and the first would be DoublePendulum 1.
If another simulation was run, then it would be DoublePendulum 2 and the second would now appear as DoublePendulum 1 and the data for the first simulation has now been removed from the Variable Browser. This can be stopped by right clicking on the model name, e.g. DoublePendulum, and selecting Keep Result, as shown in Figure 2. This stops the results from being overridden and is shown by the pin icon to the left of the name, this can be undone by repeating the process. In a similar way, a data set can be removed from the variable browser by selecting Close Result.
The Variable Browser also allows modification to values that are not constrained, in the case of the first image phi and w which is the initial angle and angular speed of the joint. If the variable has a unit associated with it then it is displayed alongside the variable with a description of the variable if made in the variable declaration. The modified variable values can be saved to the model and replace the starting model parameter inputs by selecting Save Start Values in Model from right clicking the name of the model with the preferred values.
While able to change the variable input after a simulation a user can also change the initial conditions of a simulation after just translating the model by using the Translate button highlighted in Figure 3.
This shows a list of initial values of the model but as the model has not been simulated it only shows the list of variable able to be modified as shown below these can be modified in the same way a simulated model can be to modify the conditions of the simulation.
Within the Variable Browser there are buttons to filter variables and advanced plotting features below is listed the different buttons and what each button does:
|
p= |
Enables/disables the display of parameters |
|
x0= |
Enables/disables the display of initial conditions |
|
v0≈ |
Enables/disables the display of initial guess values used to initialise non-linear systems |
|
constants |
Enables/disables the display of constants |
|
Time Varying |
Enables/disables the display of variables that vary with time |
|
Online |
Enables/disables the updating of plots during simulation |
The checkboxes modify how the data is displayed in the plotting window:
|
Compare Results |
Plots all the same signal from the repeated simulations that are open in one click with all simulations now displayed under “All Results” |
|
Difference |
Plots the difference between the signals plotted on the active plot window |
|
Original |
Enables/disables the display of the original signals on the selected plot, leaving only the Difference plots |
Table 1 - Advanced Variable Browser plotting checkboxes
The Search Filter allows the variables displayed in the Variable Browser to be searched through using either the name of the variable or the path of a variable or a component.
The Time input displays all the values of the variables within the Variable Browser at the time entered.
Figure 5 is an example of the use of the Advanced tab that searches for all variables starting with phi and then displays their values at the time of 1.5 seconds but does not display Constants. The Plotting window displays 2 variables (blue and red) and the difference between them (green) throughout the simulation.
There is an ability to further filter the search results within the advanced tab of the variable browser. The table below shows the different symbols and their effect on which variables are shown:
|
* |
Match everything |
|
? |
Match any single character |
|
{ab} |
Match characters a or b |
|
{a-z} |
Match characters a to z |
|
{^ab} |
Match any characters except a and b |
|
E+ |
Match one or more occurrences of E |
|
(ad|cd) |
Match ab or cd |
|
\\d |
Match any digit |
|
\\w |
Match any digit or letter |
|
^ |
Match from start |
|
$ |
Match at end |
Table 2 - Advanced filtering terms