SimulationEngine
ModiaMath.SimulationEngine
โ Module.module ModiaMath.SimulationEngine
Simulation engine for implicit index 1 DAE models with events.
Main developer
Martin Otter, DLR - Institute of System Dynamics and Control
ModiaMath.SimulationEngine.simulate!
โ Method.ModiaMath.simulate!(simulationModel; log=false, startTime=NaN, stopTime=NaN,
tolerance=NaN, interval=NaN,
maxStepSize=NaN, maxNumberOfSteps=missing)
Simulates a DAE simulationModel
that is defined with package Modia
, package Modia3D
or with the ModiaMath.@component
macro. The DAE is mathematically described as implicit, index 1 DAE with events (containing an ODE or a semi-explicit index 1 DAE as special cases). For details see ModiaMath.StructureOfDAE
.
During continuous integration, the DAE is solved with the Sundials IDA solver (accessed via the Julia Sundials interface package).
Input arguments
simulationModel::ModiaMath.AbstractSimulationModel
: Model struct (generated with Modia, Modia3D orModiaMath.@component
).log::Bool
: = true, if logging is enabled, otherwise it is disabled.startTime::Float64
: Start time of the simulation in [s]. If startTime=NaN, the default startTime is used that is defined by thesimulationModel
.stopTime::Float64
: Stop time of the simulation in [s]. If stopTime=NaN, the default stopTime is used that is defined by thesimulationModel
.tolerance::Float64
: The relative tolerance for the integration. The absolute tolerance is computed as0.1*tolerance*nominal(variable)
wherenominal(variable)
is the nominal value of the variable. If tolerance=NaN, the default tolerance is used that is defined by thesimulationModel
.interval::Float64
: Output interval for results in [s]. If events occur, the event time instants are additionally added to the result. If interval=NaN, the default interval is used that is defined by thesimulationModel
.maxStepSize::Float64
: Maximum absolute value of the step size. IfmaxStepSize=NaN
, the default maximum step size of the integrator is used.maxNumberOfSteps::Union{Int,Missing}
: Maximum number of steps to be taken by the solver in its attempt to reach the next output time. IfmaxNumberOfSteps=missing
, the default value of the integrator is used (= 500).