FMI for Co-Simulation

This chapter defines the Functional Mock-up Interface (FMI) for the coupling of two or more simulation models in a Co-Simulation environment (FMI for Co-Simulation). Co-Simulation is a rather general approach to the simulation of coupled technical systems and coupled physical phenomena in engineering with focus on instationary (time-dependent) problems.

Transfer of Input / Output Values and Parameters

In order to enable the slave to interpolate the continuous real inputs between communication steps, the derivatives of the inputs with respect to time can be provided. Also, higher derivatives can be set to allow higher order interpolation.

fmi3CallbackIntermediateUpdate

Computation

The computation of time steps is controlled by the following function.

FMICore.fmi3EnterStepModeFunction

Source: FMISpec3.0, Version D5ef1c1: 2.3.5. State: Event Mode

This function must be called to change from Event Mode into Step Mode in Co-Simulation (see 4.2.).

source
fmi3EnterStepMode(c::FMU3Instance; soft::Bool=false)

This function must be called to change from Event Mode into Step Mode in Co-Simulation (see 4.2.).

Arguments

  • c::FMU3Instance: Mutable struct represents an instantiated instance of an FMU in the FMI 3.0 Standard.

Keywords

  • soft::Bool=false: If the Keyword soft = true the fmi3Teminate needs to be called in state fmi3InstanceStateContinuousTimeMode or fmi3InstanceStateEventMode.

Returns

  • status::fmi3Status: Return status is an enumeration of type fmi3Status and indicates the success of the function call.

More detailed:

  • fmi3OK: all well
  • fmi3Warning: things are not quite right, but the computation can continue
  • fmi3Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi3Error: the communication step could not be carried out at all
  • fmi3Fatal: if an error occurred which corrupted the FMU irreparably

Source

  • FMISpec3.0 Link: https://fmi-standard.org/
  • FMISpec3.0: 2.2.3 Platform Dependent Definitions
  • FMISpec3.0: 2.2.4 Status Returned by Functions
  • FMISpec3.0: 2.3.5. State: Event Mode

See also fmi3EnterStepMode.

source
FMICore.fmi3DoStep!Function

Source: FMISpec3.0, Version D5ef1c1: 4.2.1. State: Step Mode

The computation of a time step is started.

source
fmi3DoStep!(c::FMU3Instance, currentCommunicationPoint::fmi3Float64, communicationStepSize::fmi3Float64, noSetFMUStatePriorToCurrentPoint::fmi3Boolean,
                eventEncountered::Ref{fmi3Boolean}, terminateSimulation::Ref{fmi3Boolean}, earlyReturn::Ref{fmi3Boolean}, lastSuccessfulTime::Ref{fmi3Float64})

The computation of a time step is started.

TODO argmuents

Arguments

  • c::FMU3Instance: Mutable struct represents an instantiated instance of an FMU in the FMI 3.0 Standard.
  • currentCommunicationPoint::fmi3Float64:
  • communicationStepSize::fmi3Float64:
  • noSetFMUStatePriorToCurrentPoint::fmi3Boolean:
  • eventEncountered::Ref{fmi3Boolean}:
  • terminateSimulation::Ref{fmi3Boolean}:
  • earlyReturn::Ref{fmi3Boolean}:
  • lastSuccessfulTime::Ref{fmi3Float64}:

Returns

  • status::fmi3Status: Return status is an enumeration of type fmi3Status and indicates the success of the function call.

More detailed:

  • fmi3OK: all well
  • fmi3Warning: things are not quite right, but the computation can continue
  • fmi3Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi3Error: the communication step could not be carried out at all
  • fmi3Fatal: if an error occurred which corrupted the FMU irreparably

Source

  • FMISpec3.0 Link: https://fmi-standard.org/
  • FMISpec3.0: 2.2.3 Platform Dependent Definitions
  • FMISpec3.0: 2.2.4 Status Returned by Functions
  • FMISpec3.0: 4.2.1. State: Step Mode

See also fmi3DoStep!.

source
fmi3DoStep!(c::FMU3Instance, currentCommunicationPoint::Union{Real, Nothing} = nothing, communicationStepSize::Union{Real, Nothing} = nothing, noSetFMUStatePriorToCurrentPoint::Bool = true,
    eventEncountered::fmi3Boolean = fmi3False, terminateSimulation::fmi3Boolean = fmi3False, earlyReturn::fmi3Boolean = fmi3False, lastSuccessfulTime::fmi3Float64 = 0.0)

The computation of a time step is started.

TODO argmuents

Arguments

  • c::FMU3Instance: Mutable struct represents an instantiated instance of an FMU in the FMI 3.0 Standard.
  • currentCommunicationPoint::Union{Real, Nothing} = nothing
  • communicationStepSize::Union{Real, Nothing} = nothing
  • noSetFMUStatePriorToCurrentPoint::Bool = true
  • eventEncountered::fmi3Boolean = fmi3False
  • terminateSimulation::fmi3Boolean = fmi3False
  • earlyReturn::fmi3Boolean = fmi3False
  • lastSuccessfulTime::fmi3Float64 = 0.0

Returns

  • status::fmi3Status: Return status is an enumeration of type fmi3Status and indicates the success of the function call.

More detailed:

  • fmi3OK: all well
  • fmi3Warning: things are not quite right, but the computation can continue
  • fmi3Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi3Error: the communication step could not be carried out at all
  • fmi3Fatal: if an error occurred which corrupted the FMU irreparably

Source

  • FMISpec3.0 Link: https://fmi-standard.org/
  • FMISpec3.0: 2.2.3 Platform Dependent Definitions
  • FMISpec3.0: 2.2.4 Status Returned by Functions
  • FMISpec3.0: 4.2.1. State: Step Mode

See also fmi3DoStep!.

source

Retrieving Status Information from the Slave

Status information is retrieved from the slave by the following functions: