FMI.simulate
— Functionsimulate(fmu, instance=nothing, tspan=nothing; kwargs...)
simulate(fmu, tspan; kwargs...)
simulate(instance, tspan; kwargs...)
Starts a simulation of the FMU2
for the instantiated type: CS, ME or SE (this is selected automatically or during loading of the FMU). You can force a specific simulation mode by calling simulateCS
, simulateME
or simulateSE
directly.
Arguments
fmu::FMU
: The FMU to be simulated.c::Union{FMUInstance, Nothing}=nothing
: The instance (FMI3) or component (FMI2) of the FMU,nothing
if not available.tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing
: Simulation-time-span as tuple (default = nothing: use default value from FMU's model description or (0.0, 1.0) if not specified)
Keyword arguments
recordValues::fmi2ValueReferenceFormat
= nothing: Array of variables (Strings or variableIdentifiers) to record. Results are returned asDiffEqCallbacks.SavedValues
saveat = nothing
: Time points to save (interpolated) values at (default = nothing: save at each solver timestep)setup::Bool
: call fmi2SetupExperiment, fmi2EnterInitializationMode and fmi2ExitInitializationMode before each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)reset::Bool
: call fmi2Reset before each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)instantiate::Bool
: call fmi2Instantiate! before each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)freeInstance::Bool
: call fmi2FreeInstance after each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)terminate::Bool
: call fmi2Terminate after each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)inputValueReferences::fmi2ValueReferenceFormat = nothing
: Input variables (Strings or variableIdentifiers) to set at each simulation stepinputFunction = nothing
: Function to get values for the input variables at each simulation step.parameters::Union{Dict{<:Any, <:Any}, Nothing} = nothing
: Dict of parameter variables (strings or variableIdentifiers) and values (Real, Integer, Boolean, String) to set parameters during initializationshowProgress::Bool = true
: print simulation progress meter in REPL
Input function pattern
[c
: current component, u
: current state ,t
: current time, returning array of values to be passed to fmi2SetReal(..., inputValueReferences, inputFunction(...))
or fmi3SetFloat64
]:
inputFunction(t::Real, u::AbstractVector{<:Real})
inputFunction(c::Union{FMUInstance, Nothing}, t::Real, u::AbstractVector{<:Real})
inputFunction(c::Union{FMUInstance, Nothing}, x::AbstractVector{<:Real}, u::AbstractVector{<:Real})
inputFunction(x::AbstractVector{<:Real}, t::Real, u::AbstractVector{<:Real})
inputFunction(c::Union{FMUInstance, Nothing}, x::AbstractVector{<:Real}, t::Real, u::AbstractVector{<:Real})
Returns:
- A
FMUSolution
struct.
See also simulate
, simulateME
, simulateCS
, simulateSE
.
FMI.simulateCS
— FunctionsimulateCS(fmu, instance=nothing, tspan=nothing; kwargs...)
simulateCS(fmu, tspan; kwargs...)
simulateCS(instance, tspan; kwargs...)
Simulate CS-FMU for the given simulation time interval. State- and Time-Events are handled internally by the FMU.
Arguments
fmu::FMU
: The FMU to be simulated.c::Union{FMUInstance, Nothing}=nothing
: The instance (FMI3) or component (FMI2) of the FMU,nothing
if not available.tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing
: Simulation-time-span as tuple (default = nothing: use default value from FMU's model description or (0.0, 1.0) if not specified)
Keyword arguments
tolerance::Union{Real, Nothing} = nothing
: The tolerance for the internal FMU solver.recordValues::fmi2ValueReferenceFormat
= nothing: Array of variables (Strings or variableIdentifiers) to record. Results are returned asDiffEqCallbacks.SavedValues
saveat = nothing
: Time points to save (interpolated) values at (default = nothing: save at each solver timestep)setup::Bool
: call fmi2SetupExperiment, fmi2EnterInitializationMode and fmi2ExitInitializationMode before each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)reset::Bool
: call fmi2Reset before each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)instantiate::Bool
: call fmi2Instantiate! before each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)freeInstance::Bool
: call fmi2FreeInstance after each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)terminate::Bool
: call fmi2Terminate after each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)inputValueReferences::fmi2ValueReferenceFormat = nothing
: Input variables (Strings or variableIdentifiers) to set at each simulation stepinputFunction = nothing
: Function to get values for the input variables at each simulation step.parameters::Union{Dict{<:Any, <:Any}, Nothing} = nothing
: Dict of parameter variables (strings or variableIdentifiers) and values (Real, Integer, Boolean, String) to set parameters during initializationshowProgress::Bool = true
: print simulation progress meter in REPL
Input function pattern
[c
: current component, u
: current state ,t
: current time, returning array of values to be passed to fmi2SetReal(..., inputValueReferences, inputFunction(...))
or fmi3SetFloat64
]:
inputFunction(t::Real, u::AbstractVector{<:Real})
inputFunction(c::Union{FMUInstance, Nothing}, t::Real, u::AbstractVector{<:Real})
inputFunction(c::Union{FMUInstance, Nothing}, x::AbstractVector{<:Real}, u::AbstractVector{<:Real})
inputFunction(x::AbstractVector{<:Real}, t::Real, u::AbstractVector{<:Real})
inputFunction(c::Union{FMUInstance, Nothing}, x::AbstractVector{<:Real}, t::Real, u::AbstractVector{<:Real})
Returns:
- A
FMUSolution
struct.
See also simulate
, simulateME
, simulateSE
.
FMI.simulateME
— FunctionsimulateME(fmu, instance=nothing, tspan=nothing; kwargs...)
simulateME(fmu, tspan; kwargs...)
simulateME(instance, tspan; kwargs...)
Simulate ME-FMU for the given simulation time interval. State- and Time-Events are handled correctly.
Arguments
fmu::FMU
: The FMU to be simulated.c::Union{FMUInstance, Nothing}=nothing
: The instance (FMI3) or component (FMI2) of the FMU,nothing
if not available.tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing
: Simulation-time-span as tuple (default = nothing: use default value from FMU's model description or (0.0, 1.0) if not specified)
Keyword arguments
solver = nothing
: Any Julia-supported ODE-solver (default = nothing: use DifferentialEquations.jl default solver)recordValues::fmi2ValueReferenceFormat
= nothing: Array of variables (Strings or variableIdentifiers) to record. Results are returned asDiffEqCallbacks.SavedValues
recordEventIndicators::Union{AbstractArray{<:Integer, 1}, UnitRange{<:Integer}, Nothing} = nothing
: Array or Range of event indicators to recordrecordEigenvalues::Bool=false
: compute and record eigenvaluessaveat = nothing
: Time points to save (interpolated) values at (default = nothing: save at each solver timestep)x0::Union{AbstractArray{<:Real}, Nothing} = nothing
: initial fmu State (default = nothing: use current or default-initial fmu state)setup::Bool
: call fmi2SetupExperiment, fmi2EnterInitializationMode and fmi2ExitInitializationMode before each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)reset::Bool
: call fmi2Reset before each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)instantiate::Bool
: call fmi2Instantiate! before each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)freeInstance::Bool
: call fmi2FreeInstance after each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)terminate::Bool
: call fmi2Terminate after each step (default = nothing: use value fromfmu
'sFMUExecutionConfiguration
)inputValueReferences::fmi2ValueReferenceFormat = nothing
: Input variables (Strings or variableIdentifiers) to set at each simulation stepinputFunction = nothing
: Function to get values for the input variables at each simulation step.parameters::Union{Dict{<:Any, <:Any}, Nothing} = nothing
: Dict of parameter variables (strings or variableIdentifiers) and values (Real, Integer, Boolean, String) to set parameters during initializationcallbacksBefore = []
: callbacks to call before the internal callbacks for state- and time-events are calledcallbacksAfter = []
: callbacks to call after the internal callbacks for state- and time-events are calledshowProgress::Bool = true
: print simulation progress meter in REPLsolveKwargs...
: keyword arguments that get passed onto the solvers solve call
Input function pattern
[c
: current component, u
: current state ,t
: current time, returning array of values to be passed to fmi2SetReal(..., inputValueReferences, inputFunction(...))
or fmi3SetFloat64
]:
inputFunction(t::Real, u::AbstractVector{<:Real})
inputFunction(c::Union{FMUInstance, Nothing}, t::Real, u::AbstractVector{<:Real})
inputFunction(c::Union{FMUInstance, Nothing}, x::AbstractVector{<:Real}, u::AbstractVector{<:Real})
inputFunction(x::AbstractVector{<:Real}, t::Real, u::AbstractVector{<:Real})
inputFunction(c::Union{FMUInstance, Nothing}, x::AbstractVector{<:Real}, t::Real, u::AbstractVector{<:Real})
Returns:
- A
FMUSolution
struct.
See also simulate
, simulateCS
, simulateSE
.
FMI.simulateSE
— FunctionsimulateSE(fmu, instance=nothing, tspan=nothing; kwargs...)
simulateSE(fmu, tspan; kwargs...)
simulateSE(instance, tspan; kwargs...)
To be implemented ...
Arguments
fmu::FMU3
: The FMU to be simulated. Note: SE is only available in FMI3.c::Union{FMU3Instance, Nothing}=nothing
: The instance (FMI3) of the FMU,nothing
if not available.tspan::Union{Tuple{Float64, Float64}, Nothing}=nothing
: Simulation-time-span as tuple (default = nothing: use default value from FMU's model description or (0.0, 1.0) if not specified)
Keyword arguments
- To be implemented ...
Returns:
- A
FMUSolution
struct.
See also simulate
, simulateME
, simulateCS
.