Simulating a model
- Post-processing after simulation
In Dymola, we can automatically run external post-processing commands after the simulation has finished. These commands can be selected in Simulation > Setup… and in the Output tab.
Setting up post-processing commands.
We can access the available post-processing commands using a script function.
The arguments in the function are: Command name, Description of the command, Path leading to the command and a flag to enable the command by default.
definePostProcessing(“Status”, “Show result file status”,
“Modelica.Utilities.System.command(”dir %RESULTFILE%.* & pause”)”, true);
To execute a command in the standard command shell of the operating system, we can use Modelica.Utilities.System.command(). %RESULTFILE% is a local system variable set by Dymola and points to the name of the result file without the .mat part.
Having dir in front of the result filename generates further information about the result file, such as the size and the date that the file was created.
The & pause means that you have to press a key before the windows command box goes away.
Selecting post-processing commands.
To select which commands are to be executed, go to Simulation > Setup… and in the Output tab. The available commands are listed and only need to be selected in order to be executed. The order matters.
- Support for Scientific Data Format
The Scientific Data Format (SDF) is a file format that allows to store table data and simulation results. (see https://www.hdfgroup.org/HDF5). Dymola 2016 FD01 supports copying of the simulation result file to the SDF just by using a post-processing command (see previous section).
Utility functions exist for loading and saving SDF files in Matlab. These functions are in the package SDF in Dymola 2016 FD01Mfiles+SDFload.m.
- Improved multicore support
FMUs are now supported with both Visual Studio and MinGW GCC compilers on Windows.
- Plot window
Drag and drop variables.
We can now drag and drop variables from the variable browser to plot windows or table window to create curves/tables. If a variable is dropped to the background than a new plot window will be opened where the curve will be added. In a text window, the signal path is added.
Figure 1: How to plot a variable by dragging it from the variable tree.
Dragging of curves between plots and tables.
We can drag curves between plot windows and table windows. To copy the curve/data as well, hold Ctrl when dragging.
Copying curves between plots/diagrams by dragging.
We could already move curves between plots in the previous versions by dragging the legend, we can now copy them as well by holding Ctrl when dragging the curve.
- Minor improvements
Preventing multiple C code files when translating.
On Windows, we can set a flag to prevent splitting of the generated C code (dsmodel.c) across multiple files. To set this flag go to: Dymola 2016 FD01insert and open dymola.mos with Notepad or an equivalent. Add the end of the script, add: Advanced.SeparateFilesCode=false;
Save this and copy and paste it in Dymola 2016 FD01insert to replace the old one.
Written by: Romain Gillot – Project Engineer