Creating/Running a Script with the Scripting Window

For advanced users, the Scripting Window allows to create and run scripts using the Modelica language.

With scripts, you can call existing functions and automate complex processes.

Related Topics
Editing Modelica Text
  1. Select Tools > Modelica Scripting from the bar.

    The Modelica Scripting Window appears.

  2. To create and run a script:

    1. Type your commands in the lower part of the Modelica Scripting Window.

      Tips:
      • To list all available scripting functions, type: listfunctions().
      • To display the description of a function behavior, type: document("FunctionName").

    2. Press Enter.

      The script is displayed and run in the upper part of the window.

  3. To save a script:

    1. Create and run a script.
    2. Right-click in the upper part of the window and select Copy All Commands from the contextual menu.
    3. In a text editor (Notepad for example), paste the commands.

      Save this script on your computer with a .mos extension.

  4. To run an existing script, enter the following command:

    1. Type RunScript ("C:\Documents and Settings\Scripts\MyScript.mos")
    2. Press Enter to run the script.