Using inline integration and fixed step solvers to speed up offline simulations

Solver selection can have a large influence on the performance speed of your simulation. Inline integration can be deployed to improve the speed of simulations using fixed step solvers.

Variable Step vs. Fixed Step; pick your solver!

Dymola supports a wide variety of time integration solvers for use in simulations. Traditionally these can be split into two groups; variable step and fixed step solvers. As the name implies, a variable step solver will vary the integration step size during simulation. In practice, this means that if states are changing slowly, then the solver will take a large step; if the states are changing fast, then the step size will be reduced accordingly. For complex system dynamics, such as those with a multitude of events (step, state or time), then the solver can be quite slow, as the step size is reduced. This is undertaken to ensure the accuracy of the result, enabling them to capture the system dynamics in detail.

Fixed step solvers, on the other hand, do not vary their step size during simulation. A faster integration time may result, although accuracy around complex system dynamics can be lost as they cannot reduce their step size when the system becomes ‘stiff’ (difficult to solve) or the derivative values get larger. So a trade off has to be made between the ensured accuracy of a variable step solver and the speed of a fixed step solver. Due to the fact they provide a step execution time which is predictable, fixed step solvers are used when running real-time simulations, such as with a Driver-in-the-Loop (DiL) simulator.

But their use isn’t solely restricted to real time simulations. Fixed step solvers can be used on any suitable model or system (defined as the result accuracy not being compromised versus a variable step solver); therefore, they can be deployed in offline simulations, with the potential for a speed gain. Selecting the correct fixed step solver settings for optimal simulation speed requires investigation and analysis of various model parts, to determine the step execution time is not being exceeded. Within the Claytex library, the function empowers users to investigate the fixed step solver performance of a model. Able to toggle various advanced flags, solver types, step sizes or other parameters whilst logging pertinent results, such as the turnaround time for each step or the event behaviour during simulation, the function also enables the user to test various fixed step solvers and optimise their settings. One example is determining the optimal integration order for a Runga-Kutta solver.

Inline Integration

Speed benefits from deploying fixed step solvers in offline simulations are not just limited to the deployment of the solver itself; they can be combined with various advanced flags to yield further simulation speed gains. One such example of this is to harness Dymola’s inbuilt ability to apply inline integration. Developed as a method of speeding up simulations, the mathematical basis of the inline integration approach is presented by Elmqvist et al. (1995). To summarise, inline integration harnesses the symbolic manipulation of Dymola to insert discretization expressions, representing the numerical integration algorithms, into the differential algebraic equation (DAE) model to be solved. In effect, the inserted discretization expressions (representing the numerical integration algorithms) are solved “inline” with the model, rising to the name of the technique. The upshot is a DAE which is easier to solve numerically, thus leading to a shorter solve time.

Applying inline integration

In order to harness inline integration to speed up your simulation, you must first ensure that you have selected a fixed step solver. As explained above, this may not be suitable depending upon the application, so care must be taken when selecting a specific fixed step solver. For various fixed step solver types, a corresponding inline integration option is available. To activate inline integration, set the following advanced Dymola flag, followed by the numerical identifier of the method used:


The options shown below detail the inline integration options available:

The inline integration options available

So for instance to set the Implicit Euler inline integration, set the following advanced flag:


For more information, please see the Dymola user manual Vol. 1, page 826.


Elmqvist, H., M. Otter, and F. E. Cellier (1995): “Inline Integration: A New Mixed Symbolic/Numeric Approach for Solving Differential-Algebraic Equation Systems”, In Proceedings of ESM’95, SCS European Simulation MultiConference, Prague, Czech Republic, pp. xxiiixxxiv.

Written by: Theodor Ensbury – Project Engineer

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


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


© Copyright 2010-2024 Claytex Services Ltd All Rights Reserved

Log in with your credentials

Forgot your details?