Working with Scilab Plotting

You can import simulation result files in .mat format into Scilab. In Scilab you can plot variables and display values in different ways.

Note: You must export simulation result files from Dymola Behavior Modeling to be able to import them. See the example below.

This task shows you how to:

Install Scilab

You must install Scilab to work with it.

Note: You don“t need any specific license for Scilab. Scilab is an open source software.

  1. Download Scilab 2024.0.0 or newer from https://www.scilab.org.

    You can download to any suitable directory.

  2. Browse for the downloaded file and double-click it to install.

    By default, you can accept all suggested actions.

    Scilab is installed, and the Scilab console is opened.

Load Dymtools

You must load dymtools to use Scilab with Dymola Behavior Modeling.

Before you begin: Scilab must be installed.
  1. If the Scilab console is not open, double-click the Scilab shortcut to open the console.
  2. To load the Dymtools, enter the following command in the console, and press Enter:

    Dymtools are the functions that you need to work with Scilab. For Dymola Behavior Modeling, they are by default located in C:\Program Files\Dassault Systemes\B427\win_b64\resources\Dymola\scilab\dymtools\.

    exec("C:\Program Files\Dassault Systemes\B427\win_b64\resources\Dymola\scilab\dymtools\loader.sce", -1);

    The following text appears:

    Loading Dymola simulation results post-processing tools.
             Load help
    Run 'dymbrowse()' to launch GUI.

    You can now use the following dymtools functions:

    dymbrowse Interactively browse and plot Dymola Behavior Modeling simulation results.
    dymget Load the trajectory for a specific variable into the Scilab workspace.
    dymload Load the trajectory into the Scilab workspace.
    Note: You must export simulation result files from Dymola Behavior Modeling to be able to import them. See the example below.

    Important: If you close the console, you must load dymtools again when opening the console.

    Tips:
    • If you have not given a lot of commands, you can use arrow up to find the command to load dymtools in the command history.
    • You can get an automatic loading of dymtools when opeing the console, by adding the command to load dymtools to the Scilab user startup file. For more information, see https://help.scilab.org/startup.

Example: Plot with Scilab

You can plot variables with Scilab.

Before you begin: To work with simulation result files, you must first export them from Dymola Behavior Modeling. For more information, see Export a Simulation Result to a File.
Note: You must export as a .mat files.

Context: This task is a simple example of using one dymtools function, for more advanced use and other functions, see the dymtools documentation in Scilab. You reach this documentation by the command help dymtools in the console.

  1. Open Scilab and load dymtools as above.
  2. In the console, enter dymbrowse.
  3. In the DymBrowse dialog box, click Browse and browse for the simulation result file.

    The location of the file is the location that you exported the file to from Dymola Behavior Modeling to be able to work with it in Scilab.

  4. In the Variables pane, expand and select the variable to plot.
    The plot is presented in the Plot preview pane.
  5. To present the variable from the Plot preview pane as a plot in a Dymola Simulation Result window, double-click it in the Variables pane.

    You can display several variables in the same window by repeating Step 4 and Step 5. To present them in separate windows, activate New figure.