Create a Modelica Command from a Script
You can use a script file to create a command that is used only in the current model.
-
From the
Behavior Tools section of the
action bar,
click
Modelica Commands
.
Tip: You can also access this command from any of: - The App Options panel
- The Action Pad panel
The Modelica Commands dialog box appears. -
Select
Create in this dialog box.
The Modelica Command Edition dialog box appears.
-
In the
Associated Modelica command area:
- Select Run script.
- Click Resources Management .
The Resources Management dialog box appears.The current library is highlighted.
-
You can select a file from the Modelica library or import an external
file:
Tip: You can also create a new folder to store your script. For this, select a folder from the library (its name appears in the Insert in field). Then enter a name for the new folder in the corresponding field and click Add Folder.
- Select a script
from the Modelica Library:
- Expand the folder that contains the script in the Modelica Library.
- Select the .mos file you want to use as script.
- Click OK.
- Import an external
script:
- Click Browse
next to the Import a
File field, in the Resources
Management dialog box.
The Select files dialog box appears.
- Select a script then click
Open.
Warning: The file must be in .mos format. The Select files dialog box is closed. In the Resources Management dialog box, the name of the selected file appears in the Import a file field.
- Click OK to confirm and close the Resources Management dialog box.
- Click Browse
next to the Import a
File field, in the Resources
Management dialog box.
The script's path appears in the Run script field of the Modelica Command Edition dialog box. - Select a script
from the Modelica Library:
- Type a Description of the command in the corresponding field.
-
Select the
Action on the model before command execution:
- No
action
The command is executed directly on the model.
- Translation
The model is first translated, then the command is executed.
- Simulation
The model is first simulated, then the command is executed.
- No
action
-
Click
OK.
The Modelica Command Edition dialog box is closed and your Modelica command is created and appears in the Modelica Commands dialog box.
-
In the
Modelica Commands dialog box, click
Close.
The script is stored as a Modelica command for the model.