This solver was integrated in SimulationX to be able to test models for real-time capability. It includes five explicit methods for the solution of explicit ordinary differential equations (ODE) according to which are also available for the Code Export project types "Executable model", "Matlab/Simulink S-Function", "CarSim, BikeSim, TruckSim component" and the targets for real-time simulation "NI VeriStand" or "ETAS Labcar".
In SimulationX you can find out what step size must be presumably chosen for a stable calculation of such models which are intended for the export to real-time platforms.
For this solver, the same restrictions as for C code export are to be considered.
The "Min. Calculation Step Size"
dtMin is the only quantity (beside
tStart/ tStop) in the dialog
"Simulation Control", tab card
"General" on which the calculation of state variables depend. The step size remains constant throughout the simulation.
As a result events can consequently not be detected exactly. Inaccurate results can follow when chosen a too big
dtMin. It will be checked once at each time step (after the calculation of the states) whether a zero function has changed its sign. The potential event iteration will then be carried out subsequently.
In the dialog "Simulation Control", tab card "Solver" you have the choice between five integration methods. Their difference consists in their order and the number of RHS computions (RHS: Right Hand Side or model evaluations) per time step.
0 : Euler Forward (1 RHS computation, order 1),
1 : ESI ITI Standard (1 RHS computation, order 2),
2 : Heun’s Method (2 RHS computations, order 2),
3 : RKF23 (3 RHS computations, order 3),
4 : DOPRI5 (6 RHS computations, order 5).
Responsible for the differing number of RHS computations is the method order which represents a degree of accuracy of the numerical approximations. As models are usually not linear and contain discontinuities, eigenvalues often depend on the corresponding working point in such cases. It is thus advisable to experiment with various methods and several step sizes
Figure 1: Stability domains (except ESI ITI Standard whose stability domain is located inside of those of Euler Forward)
dtMin to be chosen such that the product λ·
dtMin lies inside the stability domain for all eigenvalues λ with negative real part. Hence a larger stability domain promises theoretically calculations with a bigger step size.
However our present experience often shows that being able to choose a larger model step size due to more stability does not compensate the longer computation time due to multiple calculations of the model.
The total number of RHS calculations can be calculated as follows:
RHS calculations = FE * (tStop/dtMin + Event steps)
Hence the computation time grows with
- an increase of the method order,
- a decrease of
- many discontinuities and time events.
We recommend to try different methods and different step sizes in the range between
1.E-006 until you obtain the desired results, beginning with
iMode = 1 or 0 and
dtMin = 1.E-005.
Under "Further Parameters..." in the register "More" the following settings can be changed furthermore:
- A change of the parameters
blockLinSolvshould be proved when the solution of block equations has failed (see FAQs for further details).
- The Simulation usually fails/terminates when the values of state variables are below a given minimum or above a given maximum. Setting
bStateMinMax=trueprevents this limit violations (by holding the state variable on its limit) and thus improves real-time capability. (The minima/maxima have to be constant.) The value of
bIgnoreMinMaxis ignored in this case.
bIgnoreMinMaxis set to true given minima/maxima for state variables are ignored.
- By activating the option
bOptimizationit is possible to increase the calculating speed. Then the compiler will use the compiler option /O2. Be aware that this can result in a significant longer compile time.
- An object file can hold up to 65,536 (216) addressable sections. Setting
bBigobj=trueincreases the address capacity to 4,294,967,296 (232). Note: An .obj file produced with
/bigobjcan only be consumed by a linker that shipped in Visual C++ 2005 (or later).