Adding Curves From Existing Data
You can add a new curve from existing data without modifying the data.
-
Right-click a chart, then select .
The Create Curve dialog box appears.
- Select the Operator alternative if not selected.
By default, this option is selected. -
From the list, select None.
-
Click Select to insert Data 1.
The Select curves dialog box appears, displaying the curves
in the plot, and the time. You can select the curve from the Select
curves dialog box. Click OK to validate.
-
Click OK in the Create Curve dialog box to validate.
The curve is created in the chart.
Note:
You can pause the pointer over a curve point to see its maximum, minimum and slope.
Create a New Curve from Existing Data, Optionally with Predefined Operators
You can create a new curve from existing data, optionally with predefined operators.
-
Right-click a chart, then select .
The Create Curve dialog box appears.
- Select the Operator alternative if not selected.
By default, this option is selected. -
From the list, select the convenient operator.
-
Click Select to insert Data 1.
The Select curves dialog box appears, displaying the curves
in the plot, and the time. You can select the curve from the Select
curves dialog box. Click OK to validate.
Note:
For the None and
Absolute operators, you can only select Data
1.
-
To insert Data 2, repeat the previous step for
Data 2.
-
Click OK in the Create Curve dialog box to validate.
The curve is created in the chart.
Note:
You can pause the pointer over a curve point to see its maximum, minimum and slope.
Create a New Curve Using General Expressions in a Dialog Box
You can create a new curve from existing data using general expressions.
-
Right-click a chart, then select .
The Create Curve dialog box appears.
-
Select the General Expression
alternative.
- Type and select signals to create an expression. The following steps 4-6 explain how to select a signal.
- Signals to select from different locations can be displayed the following ways:
- From the plot, click the plot to display the corresponding signals in a Select signal dialog box.
- From the Variable Browser, click a node to select from the signals corresponding to the leaves in that node. A corresponding Select signal dialog box is displayed.
- Select the signal you want to add in the expression.
-
Click OK in the Select signal dialog box
to add the signal to the expression and close the dialog box.
-
You can continue to add signals as in step 4-6 above in the expression. You must also
manually enter operators like +, -, sin, cos, to create the expression.
An example selecting signals from a plot might
be: 1+abs(sin( .Plotter[1].Chart[1].'J1.phi')-sin( .Plotter[1].Chart[1].'J2.phi'))
- Click OK in the Create curve dialog box to create the corresponding curve and close the dialog box.
The expression is computed, and if valid, a curve is created; otherwise an error message appears.
Create a New Curve Using General Expressions by Scripting
You can create a new curve from existing data using general expressions, by scripting.
The scenario below describes how to use the Modelica Scripting window to
display a plot of signals from the model example Coupled Clutches, but scripts can also be
saved and later executed by, for example, Modelica code. In this example the Modelica Scripting window is used, but the Modelica Script Editor can also be used. For more information about scripting, see Dymola Behavior Modeling User's Guide: Performing a Virtual Execution: Scripting.
Before you begin: Simulation results must be present (the model must be simulated before any curves can be
displayed). This corresponds to step 1–2 in the scenario below.
- From the Behavior Tools section of the action bar, click Coupled Clutches to open the model example Coupled Clutches.
- From the Behavior Authoring section, click Execute to simulate the model and create simulation results.
- From the Behavior Tools section, click Modelica Scripting .
The Modelica Scripting window is displayed. - Enter the following in the command input line of the Modelica Scripting window (the line in the lower part of the window):
plotExpression(apply(J1.w+sin(J2.w)),true,"MyExpression"); and press Enter.One of the following is displayed: - If no plot is displayed, a new plot with the expression plotted is displayed.
- If one or more plots exist, the latest/last plot is displaying the expression plotted (earlier
signals in this plot are erased, due to
(eraseOld=)true in the
function call.)
- Optional: If you want to display all alternatives of the function call, enter
document("plotExpression"); in the command line input of the Modelica Scripting window and press Enter.The documentation of the function is displayed. An example using more of the features
would
be: plotExpression(apply(CoupledClutches[end].J1.w+sin(CoupledClutches[end-1].J2.w)),true,"MyExpression2",-1); Here
J1.w is taken from the last simulation (results file), while
J2.w is taken from the second last simulation (results file).
(Absolute pointing can be used as well, for example
CoupledClutches[1].J3.phi .) The resulting curve is displayed in a
new plot (-1). To display it in a specific plot, you can use the number of the plot,
for example 2.
|