Dymola 2013 FD01 has the ability to create and plot a general expression through the context menu of a signal in a plot window.
1. Right-click on a plot window and select Plot Expression (you can also go to the Plot menu in the Dymola toolbar and then click on Plot Expression or simply click on the corresponding icon ).
2. A window will pop up on the screen, consisting of 2 fields:
- Expression => write here the expression to be plotted.
- Legend => the default one is the expression set, although it can be modified.
3. The expression set is parsed. If it is correct, it will be plotted after pressing OK.
When a dialog window pops, it includes the corresponding plotted signal. If the function is not invoked on a signal, the dialog box will not include any signal in it, as it can be seen in the figure below:
The actual expression in the dialog box can be created by a combination of manual editing and selecting other signals from the variable browser. To do this, simply click on the variable name in the variable browser and it will automatically appear in the window Expression. It is also possible to combine signals from different result files: the name of the variable will go with the result file identifiers end and end-1 for the latest and the second latest results (for the rest of the cases, the absolute sequence number of the result is attached).
When an expression has already been set and plotted, it can be modified. Right-click on the expression signal and select Edit Expression: the old dialog box will pop up and you will be able to edit it.
Another way of setting the expression is through the command window function plotExpression:
A simple test case is proposed to practise with this new feature. Follow the steps indicated next:
1. Go, for example, to Modelica.Mechanics.MultiBody.Examples.Loops.Fourbar1 and run it.
2. Plot these angular variables: j1.phi, j3.phi, j4.phi, j5.phi, rev.phi and rev1.phi.
3. Add a new subplot window where to represent the expression.
4. Click on Plot Expression and fill in the fields of the dialog box with the following:
- Expression = Fourbar1[end].j1.phi + Fourbar1[end].j3.phi + Fourbar1[end].j4.phi + Fourbar1[end].j5.phi + Fourbar1[end].rev.phi + Fourbar1[end].rev1.phi
- Legend: by default, it would be set to the same as Expression. Delete it and type “Sum of angles” (inverted commas not included in the name).
5. Right-click on the new signal and select Edit Expression. Use these new settings:
- Expression = Fourbar1[end].j1.phi + Fourbar1[end].j3.phi + Fourbar1[end].j4.phi + Fourbar1[end].j5.phi – Fourbar1[end].rev.phi – Fourbar1[end].rev1.phi
- Legend: delete “Sum of angles” and write “Weighted sum of angles”.