In Dymola 2022 there are a number of new features ranging from simulation stop time auto adjustment all the way to the implementation of cross platform FMUs, the latter will be a feature of my colleague’s future blog post.
In this post we will focus on two new features that will help save us time when running simulations, the ‘Max run time’ and ‘Stop when steady state is reached’ features.
Max run time
Max run time can be set within the simulation setup. Providing a value for this setting will instruct Dymola to stop or terminate the simulation if the wall clock time (not the CPU time) reaches the value set by the user.
As with other simulation setup settings, these can be stored within individual models by simply clicking the Store in Model button in the lower left corner of the setup window.
The setting can also be adjusted from the Dymola Command line by typing:
Advanced.Simulation.MaxRunTime = Your chosen time value
Advanced.Simulation.MaxRunTime = 0.0 corresponds to the Not set value that you see in Figure 1.
- The settings apply to both single and batch runs.
- The wall clock time is measured in Dymola. Therefore, the Max run time constraint will also apply to any external code that is used/called from the Dymola model.
The early termination message will appear within the Translation tab:
Stop when steady state is reached!
‘Stop when steady state is reached‘ is another new feature in Dymola 2022. It will automatically stop the simulation when steady state is reached. The feature can be set within the Simulation setup and is particularly useful for shortening simulation times where we are looking to drive a model to steady state conditions and stopping the simulation when this condition is met.
Be aware that the Stop time stops the simulation when that time is reached, even if steady state has not been reached yet.
The tolerance is by default 0.02, with the time scale taken into account.
Alternatively, you can set the tolerance to an absolute value by using the flag
The default value of this flag is 0.0, meaning that the flag is not used.
Formally, this gives the test if steady state is reached for each state x_i as:
|der(x_i)| <= tolerance * (|x_i| + |nominal_i|) / 2.0
where tolerance = Advanced.Simulation.SteadyStateTerminationTolerance
if this flag is set, or tolerance = 0.02 / min(stopTime – startTime, 500*interval_length)
For unbounded variables, the term |x_i| is removed from the test.
The option Stop when steady state is reached corresponds to the flag
The steady state simulation termination is implemented by checking if the state derivatives are close to zero, so for example for a rotational system, the angular velocity and the angular acceleration.
This means that the following cannot be detected:
• Periodic steady states
• Steady states where a subset of the states are still varying
The termination message is displayed in the Simulation tab:
We hope we have given you some insight on how to use these two new features and hope they make your modelling and simulation tasks more efficient.
Written by: Alessandro Picarelli – Engineering Director
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