FMI.simulateFunction
simulate(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 as DiffEqCallbacks.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 from fmu's FMUExecutionConfiguration)
  • reset::Bool: call fmi2Reset before each step (default = nothing: use value from fmu's FMUExecutionConfiguration)
  • instantiate::Bool: call fmi2Instantiate! before each step (default = nothing: use value from fmu's FMUExecutionConfiguration)
  • freeInstance::Bool: call fmi2FreeInstance after each step (default = nothing: use value from fmu's FMUExecutionConfiguration)
  • terminate::Bool: call fmi2Terminate after each step (default = nothing: use value from fmu's FMUExecutionConfiguration)
  • inputValueReferences::fmi2ValueReferenceFormat = nothing: Input variables (Strings or variableIdentifiers) to set at each simulation step
  • inputFunction = 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 initialization
  • showProgress::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:

See also simulate, simulateME, simulateCS, simulateSE.

FMI.simulateCSFunction
simulateCS(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 as DiffEqCallbacks.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 from fmu's FMUExecutionConfiguration)
  • reset::Bool: call fmi2Reset before each step (default = nothing: use value from fmu's FMUExecutionConfiguration)
  • instantiate::Bool: call fmi2Instantiate! before each step (default = nothing: use value from fmu's FMUExecutionConfiguration)
  • freeInstance::Bool: call fmi2FreeInstance after each step (default = nothing: use value from fmu's FMUExecutionConfiguration)
  • terminate::Bool: call fmi2Terminate after each step (default = nothing: use value from fmu's FMUExecutionConfiguration)
  • inputValueReferences::fmi2ValueReferenceFormat = nothing: Input variables (Strings or variableIdentifiers) to set at each simulation step
  • inputFunction = 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 initialization
  • showProgress::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:

See also simulate, simulateME, simulateSE.

FMI.simulateMEFunction
simulateME(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 as DiffEqCallbacks.SavedValues
  • recordEventIndicators::Union{AbstractArray{<:Integer, 1}, UnitRange{<:Integer}, Nothing} = nothing: Array or Range of event indicators to record
  • recordEigenvalues::Bool=false: compute and record eigenvalues
  • saveat = 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 from fmu's FMUExecutionConfiguration)
  • reset::Bool: call fmi2Reset before each step (default = nothing: use value from fmu's FMUExecutionConfiguration)
  • instantiate::Bool: call fmi2Instantiate! before each step (default = nothing: use value from fmu's FMUExecutionConfiguration)
  • freeInstance::Bool: call fmi2FreeInstance after each step (default = nothing: use value from fmu's FMUExecutionConfiguration)
  • terminate::Bool: call fmi2Terminate after each step (default = nothing: use value from fmu's FMUExecutionConfiguration)
  • inputValueReferences::fmi2ValueReferenceFormat = nothing: Input variables (Strings or variableIdentifiers) to set at each simulation step
  • inputFunction = 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 initialization
  • callbacksBefore = []: callbacks to call before the internal callbacks for state- and time-events are called
  • callbacksAfter = []: callbacks to call after the internal callbacks for state- and time-events are called
  • showProgress::Bool = true: print simulation progress meter in REPL
  • solveKwargs...: 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:

See also simulate, simulateCS, simulateSE.

FMI.simulateSEFunction
simulateSE(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:

See also simulate, simulateME, simulateCS.