Two of the many new features in Dymola 2022 – “Max run time” and “Stop when steady state is reached”

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.

Figure 1. Snapshot taken from the Dymola 2022 release notes illustrating the new functionality for setting a simulation time limit for experiments.
Figure 1. Snapshot taken from the Dymola 2022 release notes illustrating the new functionality for setting a simulation time limit for experiments.

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.

Remarks:

  • 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:

Figure 2. The Translation tab displaying information about the fact that the simulation has been stopped because the max wall-clock time has been reached.
Figure 2. The Translation tab displaying information about the fact that the simulation has been stopped because the max wall-clock time has been reached.

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.

Figure 3. Snapshot of the Simulation Setup window highlighting where we can turn the "Stop when steady state is reached" on and off.
Figure 3. Snapshot of the Simulation Setup window highlighting where we can turn the “Stop when steady state is reached” on and off.

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
Advanced.Simulation.SteadyStateTerminationTolerance.

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
Advanced.Simulation.SteadyStateTermination.


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:

Figure 4. Message in the Simulation tab to notify the user (last line) that the Simulation terminated early because a steady state of the state derivatives has been reached.
Figure 4. Message in the Simulation tab to notify the user (last line) that the Simulation terminated early because a steady state of the state derivatives has been reached.

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

CONTACT US

Got a question? Just fill in this form and send it to us and we'll get back to you shortly.

Sending

© Copyright 2010-2021 Claytex Services Ltd All Rights Reserved

Log in with your credentials

Forgot your details?