Dassault Systèmes recently released Dymola 2021x, which provides a number of improvements to the modelling and simulation tool. In this blog post, I’m going to highlight some of the changes in Dymola 2021x that you can benefit from.
New Modelica Standard Library
The Modelica Standard Library supplied has been updated to version 4.0.0 in Dymola 2021x. This new version of the library is based on the Modelica Language Specification 3.4. As well as some bug fixes, the Modelica Standard Library 4.0.0 includes the following updates:
- Obsolete classes from previous versions have been removed. If an obsolete class couldn’t be automatically converted to the new implementation, it has been moved to a new ObsoleteModelica4 library which is also supplied.
- Improvements to the library quality, with the renaming and restructuring of some packages.
- A new Modelica.Clocked package to define and synchronise sampled data with different sampling rates.
- A new Modelica.Electrical.Batteries package for simple battery models.
These changes mean that the new version of the library is not backwards compatible. There is a conversion script to support upgrading your own libraries to use the new version. All the libraries supplied in Dymola 2021x have been upgraded to be compatible with Modelica Standard Library 4.0.0.
Arranging the Diagram
Dymola 2021x now features automatic connection routing when creating a connection or moving a component, which will try to position the connection clearly in the diagram.
Connections are now created in two steps; step 1) applying the connection as in previous versions Dymola, step 2) automatic routing. Using undo will undo a step at a time. If there is an intermediate point in the connection, automatic routing won’t be applied.
The automatic connection routing behaviour is controlled by the setting Tools > Options > Graphical Editor > Automatic routing of connections or the flag Advanced.Editor.Routing.Automatic. By default the automatic routing will avoid crossing other unrelated connections; this is controlled by flag Advanced.Editor.Routing.AvoidCrossing.
The automatic routing can be applied to existing connections using Route Connection in the connections context menu or Graphics tab > Arrange > Route Connections.
There are new options for spacing and aligning components in the diagram using Graphics tab > Align > Auto Space or Auto Align or Auto Align and Space.
Global settings for integers, reals and strings as well as Booleans can now be controlled via the Options dialog box, from either Tools > Options > Variables button or File > Options > Variables button. The non-Boolean values can be edited via the Edit option in the context menu.
In Dymola 2021x, controlling what is displayed is done using buttons at the bottom left of the window rather than in the Windows> Docked Windows options.
A Style check has been added to the Check menu in the Graphic and Text tabs. It uses the ModelManagement.Check.checkStyle by default, which includes checks for missing descriptions/documentation and bad class names. The Style check can be customised to use another style checking function with the flag Advanced.Check.StyleCheckFunction.
Another new flag, Advanced.Check.WarnAboutUnreferenced, has been added for finding unused parameters. When enabled a warning for unreferenced parameters is produced when checking, translating or simulating.
Additional units have been added to the script displayunit.mos. To make use of this extended units script to provide alternative units in Dymola, you will need to uncomment the relevant run script commands in C:\Program Files\Dymola 2021x\insert\dymola.mos by removing //.
In Dymola 2021x, you can filter signals when importing an FMU to make the interface easier to use. For this purpose there is a new input argument, includeVariables, in the in-built function DymolaCommands.SimulatorAPI.importFMU. When using the FMU import GUI, opened from File > Open > Import FMU, there are now additional filtering option.
You can also now select the package where the imported FMU should be added in the FMU import GUI.
Static Simulation Performance
The performance of static simulations has been improved when using the Lsodar, Dassl, Euler or Rkfix solvers; they can simulate up to twice as fast. For static simulations the start and stop times of the simulation are the same (often 0s to 0s).
Extended Simulation Analysis
The Simulation Analysis in Dymola 2021x has been extended to include equation incident graphs for systems of equations in a model. This uses the Block Lower Triangle form of equation blocks.
Selecting a diagonal block, as shown in Figure 6, shows the equation block above the graph and the variables solved from that block in the unknowns section below the graph. The diagonal blocks are colour coded for different types of systems. Selecting a non-diagonal block (grey dot) shows the two related equation blocks and the relevant variables solved from the first block.
To make use of this feature you will need to enable the setting Provide variable dependencies and equation incidence for plotting in Simulation > Setup >Debug prior to the simulation. After simulation you will need to go to Simulation > Simulation Analysis > Equation Incidence tab to see the equation block for the model.
It is now possible to apply different colour schemes to different results sets to make comparison easier using the setting Plot: Options > Setup > Options tab > One color per results file or the flag Advanced.Plot.ResultColor.
In Dymola 2021x you can colour code table cells dependent on their values by right clicking on cell and selecting Color Map.
There is an option to automatically recalculate plot expressions after simulation, using the setting Plot: Options > Setup > Options tab > Recalculate plot expressions after simulation or the flag Advanced.Plot.AutoUpdatePlotExpressions. It is also now possible to set units in plot expression plots.
The lighting model used in the animations has been extended in Dymola 2021x. The new lighting model allows the ambient lighting to be varied in the Animation > 3D View Control settings. The previous lighting model can still be used by setting Advanced.Animation.ExtendedLighting = false.
There have been some additions to the simulation log:
- Message at the end of the simulation log to say if the simulation was successful or failed.
- The full path of the simulated model is included.
- The level of detail logged for failed nonlinear solutions can be controlled using the setting Simulation > Setup > Debug tab > Detailed logging of failed nonlinear solutions. These messages are warnings rather than errors as previously.
- You can now select what events are logged during a simulation using the flags Advanced.Simulation.Debug.LogTimeEvents / LogStateEvents / LogStepEvents to make it easier to focus on the most important.
So as you can see there have been a variety of changes in the latest version of Dymola. This blog post doesn’t contain every update that has been made in Dymola 2021x; for full details you can read the release notes available here or in the Dymola documentation.
Written by: Hannah Hammond-Scott – Modelica Project Leader
Please get in touch if you have any questions or have got a topic in mind that you would like us to write about. You can submit your questions / topics via: Tech Blog Questions / Topic Suggestion