FMI Common Concepts for Model Exchange and Co-Simulation

In both cases, FMI defines an input/output block of a dynamic model where the distribution of the block, the platform dependent header file, several access functions, as well as the schema files are identical.

Opening and closing FMUs

fmi2Unzip fmi2Load fmi2Reload fmi2Unload

Creation, Destruction and Logging of FMU Instances

FMIImport.fmi2Instantiate!Function
fmi2Instantiate!(fmu::FMU2;
                    instanceName::String=fmu.modelName,
                    type::fmi2Type=fmu.type,
                    pushComponents::Bool = true,
                    visible::Bool = false,
                    loggingOn::Bool = fmu.executionConfig.loggingOn,
                    externalCallbacks::Bool = fmu.executionConfig.externalCallbacks,
                    logStatusOK::Bool=true,
                    logStatusWarning::Bool=true,
                    logStatusDiscard::Bool=true,
                    logStatusError::Bool=true,
                    logStatusFatal::Bool=true,
                    logStatusPending::Bool=true)

Create a new instance of the given fmu, adds a logger if logginOn == true.

Arguments

  • fmu::FMU2: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.

Keywords

  • instanceName::String=fmu.modelName: Name of the instance
  • type::fmi2Type=fmu.type: Defines whether a Co-Simulation or Model Exchange is present
  • pushComponents::Bool = true: Defines if the fmu components should be pushed in the application.
  • visible::Bool = false if the FMU should be started with graphic interface, if supported (default=false)
  • loggingOn::Bool = fmu.executionConfig.loggingOn if the FMU should log and display function calls (default=false)
  • externalCallbacks::Bool = fmu.executionConfig.externalCallbacks if an external shared library should be used for the fmi2CallbackFunctions, this may improve readability of logging messages (default=false)
  • logStatusOK::Bool=true whether to log status of kind fmi2OK (default=true)
  • logStatusWarning::Bool=true whether to log status of kind fmi2Warning (default=true)
  • logStatusDiscard::Bool=true whether to log status of kind fmi2Discard (default=true)
  • logStatusError::Bool=true whether to log status of kind fmi2Error (default=true)
  • logStatusFatal::Bool=true whether to log status of kind fmi2Fatal (default=true)
  • logStatusPending::Bool=true whether to log status of kind fmi2Pending (default=true)

Returns

  • Returns the instance of a new FMU component.

Source

See also fmi2Instantiate.

source
FMICore.fmi2InstantiateFunction

Source: FMISpec2.0.2[p.19]: 2.1.5 Creation, Destruction and Logging of FMU Instances

The function returns a new instance of an FMU.

source
FMICore.fmi2FreeInstanceFunction

Source: FMISpec2.0.2[p.22]: 2.1.5 Creation, Destruction and Logging of FMU Instances

Disposes the given instance, unloads the loaded model, and frees all the allocated memory and other resources that have been allocated by the functions of the FMU interface. If a null pointer is provided for “c”, the function call is ignored (does not have an effect).

Removes the component from the FMUs component list.

source
FMICore.fmi2SetDebugLoggingFunction

Source: FMISpec2.0.2[p.22]: 2.1.5 Creation, Destruction and Logging of FMU Instances

The function controls debug logging that is output via the logger function callback. If loggingOn = fmi2True, debug logging is enabled, otherwise it is switched off.

source
fmi2SetDebugLogging(c::FMU2Component, loggingOn::fmi2Boolean, nCategories::Unsigned, categories::Ptr{Nothing})

Control the use of the logging callback function, version independent.

Arguments

  • c::FMU2Component: Argument c is a Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • loggingOn::fmi2Boolean: If loggingOn = fmi2True, debug logging is enabled for the log categories specified in categories, otherwise it is disabled. Type fmi2Boolean is defined as an alias Type for the C-Type Boolean and is to be used with fmi2True and fmi2False.
  • nCategories::Unsigned: Argument nCategories defines the length of the argument categories.
  • categories::Ptr{Nothing}:

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.22]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.22]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.22]: 2.1.5 Creation, Destruction and Logging of FMU Instances

See also fmi2SetDebugLogging.

source
fmi2SetDebugLogging(c::FMU2Component)

Control the use of the logging callback function, version independent.

Arguments

  • c::FMU2Component: Argument c is a mutable struct representing an instantiated instance of an FMU in the FMI 2.0.2 Standard.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.22]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.22]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.22]: 2.1.5 Creation, Destruction and Logging of FMU Instances

See also fmi2SetDebugLogging.

source

Initialization, Termination, and Resetting an FMU

FMICore.fmi2SetupExperimentFunction

Source: FMISpec2.0.2[p.23]: 2.1.6 Initialization, Termination, and Resetting an FMU

Informs the FMU to setup the experiment. This function must be called after fmi2Instantiate and before fmi2EnterInitializationMode is called.The function controls debug logging that is output via the logger function callback. If loggingOn = fmi2True, debug logging is enabled, otherwise it is switched off.

source
fmi2SetupExperiment(c::FMU2Component, toleranceDefined::fmi2Boolean, tolerance::fmi2Real, startTime::fmi2Real, stopTimeDefined::fmi2Boolean, stopTime::fmi2Real)

Informs the FMU to setup the experiment. This function must be called after fmi2Instantiate and before fmi2EnterInitializationMode is called.

Arguments

  • c::FMU2Component: Argument c is a Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • toleranceDefined::fmi2Boolean: Arguments toleranceDefined depend on the FMU type:
    • fmuType = fmi2ModelExchange: If toleranceDefined = fmi2True, then the model is called with a numerical integration scheme where the step size is controlled by using tolerance for error estimation. In such a case, all numerical algorithms used inside the model (for example, to solve non-linear algebraic equations) should also operate with an error estimation of an appropriate smaller relative tolerance.
    • fmuType = fmi2CoSimulation: If toleranceDefined = fmi2True, then the communication interval of the slave is controlled by error estimation. In case the slave utilizes a numerical integrator with variable step size and error estimation, it is suggested to use “tolerance” for the error estimation of the internal integrator (usually as relative tolerance). An FMU for Co-Simulation might ignore this argument.
  • startTime::fmi2Real: Argument startTime can be used to check whether the model is valid within the given boundaries or to allocate memory which is necessary for storing results. It is the fixed initial value of the independent variable and if the independent variable is time, startTime is the starting time of initializaton.
  • stopTimeDefined::fmi2Boolean: If stopTimeDefined = fmi2True, then stopTime is the defined final value of the independent variable and if stopTimeDefined = fmi2False, then no final value

of the independent variable is defined and argument stopTime is meaningless.

  • stopTime::fmi2Real: Argument stopTime can be used to check whether the model is valid within the given boundaries or to allocate memory which is necessary for storing results. It is the fixed final value of the independent variable and if the independent variable is “time”, stopTime is the stop time of the simulation.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.22]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.22]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.22]: 2.1.6 Initialization, Termination, and Resetting an FMU

See also fmi2SetupExperiment.

source
fmi2SetupExperiment(c::FMU2Component, 
                        startTime::Union{Real, Nothing} = nothing, 
                        stopTime::Union{Real, Nothing} = nothing; 
                        tolerance::Union{Real, Nothing} = nothing)

Setup the simulation but without defining all of the parameters.

Arguments

  • c::fmi2Struct: Representative for an FMU in the FMI 2.0.2 Standard.

More detailed: fmi2Struct = Union{FMU2, FMU2Component}

  • c::FMU2: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
  • c::FMU2Component: Mutable struct representing an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • startTime::Union{Real, Nothing} = nothing: startTime is a real number which sets the value of starting time of the experiment. The default value is set automatically if doing nothing (default = nothing).
  • stopTime::Union{Real, Nothing} = nothing: stopTime is a real number which sets the value of ending time of the experiment. The default value is set automatically if doing nothing (default = nothing).

Keywords

  • tolerance::Union{Real, Nothing} = nothing: tolerance is a real number which sets the value of tolerance range. The default value is set automatically if doing nothing (default = nothing).

Returns

  • Returns a warning if str.state is not called in fmi2ComponentStateInstantiated.
  • status::fmi2Status: Return status is an enumeration of type fmi2Status and indicates the success of the function call.

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.23]: 2.1.6 Initialization, Termination, and Resetting an FMU
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2SetupExperiment.

source
FMICore.fmi2EnterInitializationModeFunction

Source: FMISpec2.0.2[p.23]: 2.1.6 Initialization, Termination, and Resetting an FMU

Informs the FMU to enter Initialization Mode. Before calling this function, all variables with attribute <ScalarVariable initial = "exact" or "approx"> can be set with the “fmi2SetXXX” functions (the ScalarVariable attributes are defined in the Model Description File, see section 2.2.7). Setting other variables is not allowed. Furthermore, fmi2SetupExperiment must be called at least once before calling fmi2EnterInitializationMode, in order that startTime is defined.

source
fmi2EnterInitializationMode(c::FMU2Component)

Informs the FMU to enter Initialization Mode. Before calling this function, all variables with attribute <ScalarVariable initial = "exact" or "approx"> can be set with the “fmi2SetXXX” functions (the ScalarVariable attributes are defined in the Model Description File, see section 2.2.7). Setting other variables is not allowed. Furthermore, fmi2SetupExperiment must be called at least once before calling fmi2EnterInitializationMode, in order that startTime is defined.

Arguments

  • c::FMU2Component: Argument c is a Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.22]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.22]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.22]: 2.1.6 Initialization, Termination, and Resetting an FMU

See also fmi2EnterInitializationMode.

source
FMICore.fmi2ExitInitializationModeFunction

Source: FMISpec2.0.2[p.23]: 2.1.6 Initialization, Termination, and Resetting an FMU

Informs the FMU to exit Initialization Mode.

source
fmi2ExitInitializationMode(c::FMU2Component)

Informs the FMU to exit Initialization Mode.

Arguments

  • c::FMU2Component: Argument c is a Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.22]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.22]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.22]: 2.1.6 Initialization, Termination, and Resetting an FMU

See also fmi2EnterInitializationMode.

source
FMICore.fmi2TerminateFunction

Source: FMISpec2.0.2[p.24]: 2.1.6 Initialization, Termination, and Resetting an FMU

Informs the FMU that the simulation run is terminated.

source
fmi2Terminate(c::FMU2Component; soft::Bool=false)

Informs the FMU that the simulation run is terminated.

Arguments

  • c::FMU2Component: Argument c is a Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.

Keywords

  • soft::Bool=false: If the Keyword soft = true the command is only performed if the FMU is in an allowed state for this command.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.22]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.22]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.22]: 2.1.6 Initialization, Termination, and Resetting an FMU

See also fmi2Terminate.

source
FMICore.fmi2ResetFunction

Source: FMISpec2.0.2[p.24]: 2.1.6 Initialization, Termination, and Resetting an FMU

Is called by the environment to reset the FMU after a simulation run. The FMU goes into the same state as if fmi2Instantiate would have been called.

source
fmi2Reset(c::FMU2Component; soft::Bool=false)

Is called by the environment to reset the FMU after a simulation run. The FMU goes into the same state as if fmi2Instantiate would have been called.All variables have their default values. Before starting a new run, fmi2SetupExperiment and fmi2EnterInitializationMode have to be called.

Arguments

  • c::FMU2Component: Argument c is a Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.

Keywords

  • soft::Bool=false: If the Keyword soft = true the command is only performed if the FMU is in an allowed state for this command.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.3 Link: https://fmi-standard.org/
  • FMISpec2.0.3[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.3[p.18]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.3[p.22]: 2.1.6 Initialization, Termination, and Resetting an FMU

See also fmi2Terminate.

source

Getting and Setting Variable Values

All variable values of an FMU are identified with a variable handle called “value reference”. The handle is defined in the modelDescription.xml file (as attribute “valueReference” in element “ScalarVariable”). Element “valueReference” might not be unique for all variables. If two or more variables of the same base data type (such as fmi2Real) have the same valueReference, then they have identical values but other parts of the variable definition might be different (for example, min/max attributes).

FMIImport.fmi2GetRealFunction

fmi2GetReal(c::FMU2Component, vr::fmi2ValueReferenceFormat)

Get the values of an array of fmi2Real variables.

Arguments

  • c::fmi2Struct: Representative for an FMU in the FMI 2.0.2 Standard.

More detailed: fmi2Struct = Union{FMU2, FMU2Component}

  • c::FMU2: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::fmi2ValueReferenceFormat: wildcards for how a user can pass a fmi[X]ValueReference

More detailed: fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1}, fmi2ValueReference, Array{fmi2ValueReference,1}, Int64, Array{Int64,1}, Symbol}

Returns

  • values::Array{fm2Real}: Returns values of an array of fmi2Real variables with the dimension of fmi2ValueReferenceFormat length.

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2GetReal.

source
FMICore.fmi2GetReal!Function

Source: FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values

Functions to get and set values of variables idetified by their valueReference

source
fmi2GetReal!(c::FMU2Component, vr::AbstractArray{fmi2ValueReference}, nvr::Csize_t, value::AbstractArray{fmi2Real})

Functions to get and set values of variables idetified by their valueReference

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::AbstractArray{fmi2ValueReference}: Argument vr is an AbstractArray of nvr value handels called "ValueReference" that define the variable that shall be inquired.
  • nvr::Csize_t: Argument nvr defines the size of vr.
  • values::AbstractArray{fm2Real}: Argument values is an AbstractArray with the actual values of these variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values

See also fmi2GetReal!.

source
fmi2GetReal!(c::FMU2Component, vr::fmi2ValueReferenceFormat, values::AbstractArray{fmi2Real})

Get the values of an array of fmi2Real variables.

rites the real values of an array of variables in the given field

Arguments

  • c::fmi2Struct: Representative for an FMU in the FMI 2.0.2 Standard.

More detailed: fmi2Struct = Union{FMU2, FMU2Component}

  • c::FMU2: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::fmi2ValueReferenceFormat: Wildcards for how a user can pass a fmi[X]ValueReference

More detailed: fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1}, fmi2ValueReference, Array{fmi2ValueReference,1}, Int64, Array{Int64,1}, Symbol}

  • values::AbstractArray{fm2Real}: Argument values is an AbstractArray with the actual values of these variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2GetReal!.

source
FMIImport.fmi2GetIntegerFunction
fmi2GetInteger(c::FMU2Component, vr::fmi2ValueReferenceFormat)

Returns the integer values of an array of variables

Arguments

  • c::fmi2Struct: Representative for an FMU in the FMI 2.0.2 Standard.

More detailed: fmi2Struct = Union{FMU2, FMU2Component}

  • c::FMU2: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::fmi2ValueReferenceFormat: Argument vr defines the value references of the variables

More detailed: fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1}, fmi2ValueReference, Array{fmi2ValueReference,1}, Int64, Array{Int64,1}, Symbol}

Returns

  • values::Array{fmi2Integer}: Return values is an array with the actual values of these variables.

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2GetInteger!

source
FMICore.fmi2GetInteger!Function

Source: FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values

Functions to get and set values of variables idetified by their valueReference

source
fmi2GetInteger!(c::FMU2Component, vr::AbstractArray{fmi2ValueReference}, nvr::Csize_t, value::AbstractArray{fmi2Integer})

Writes the integer values of an array of variables in the given field

fmi2GetInteger! is only possible for arrays of values, please use an array instead of a scalar.

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::AbstractArray{fmi2ValueReference}: Argument vr is an AbstractArray of nvr value handels, called "ValueReference" that define the variable that shall be inquired.
  • nvr::Csize_t: Argument nvr defines the size of vr.
  • values::AbstractArray{fmi2Integer}: Argument values is an AbstractArray with the actual values of these variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2GetInteger!.

source
fmi2GetInteger!(c::FMU2Component, vr::fmi2ValueReferenceFormat, values::AbstractArray{fmi2Integer})

Writes the integer values of an array of variables in the given field

fmi2GetInteger! is only possible for arrays of values, please use an array instead of a scalar.

Arguments

  • c::fmi2Struct: Representative for an FMU in the FMI 2.0.2 Standard.

More detailed: fmi2Struct = Union{FMU2, FMU2Component}

  • c::FMU2: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::fmi2ValueReferenceFormat: Argument vr defines the value references of the variables.

More detailed: fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1}, fmi2ValueReference, Array{fmi2ValueReference,1}, Int64, Array{Int64,1}, Symbol}

  • vr::Array{fmi2ValueReference}: Argument vr is an array of nvr value handels called "ValueReference" that define the variable that shall be inquired.
  • nvr::Csize_t: Argument nvr defines the size of vr.
  • values::Array{fmi2Integer}: Argument values is an array with the actual values of these variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2GetInteger!.

source
FMIImport.fmi2GetBooleanFunction
fmi2GetBoolean(c::FMU2Component, vr::fmi2ValueReferenceFormat)

Get the values of an array of fmi2Boolean variables.

Arguments

  • c::fmi2Struct: Representative for an FMU in the FMI 2.0.2 Standard.

More detailed: fmi2Struct = Union{FMU2, FMU2Component}

  • c::FMU2: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::fmi2ValueReferenceFormat: Argument vr defines the value references of the variables.

More detailed: fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1}, fmi2ValueReference, Array{fmi2ValueReference,1}, Int64, Array{Int64,1}, Symbol}

Returns

  • values::Array{fmi2Boolean}: Return values is an array with the actual values of these variables.

See also fmi2GetBoolean!.

source
FMICore.fmi2GetBoolean!Function

Source: FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values

Functions to get and set values of variables idetified by their valueReference

source
fmi2GetBoolean!(c::FMU2Component, vr::AbstractArray{fmi2ValueReference}, nvr::Csize_t, value::AbstractArray{fmi2Boolean})

Writes the boolean values of an array of variables in the given field

fmi2GetBoolean! is only possible for arrays of values, please use an array instead of a scalar.

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::AbstractArray{fmi2ValueReference}: Argument vr is an AbstractArray of nvr value handels called "ValueReference" that define the variable that shall be inquired.
  • nvr::Csize_t: Argument nvr defines the size of vr.
  • value::AbstractArray{fmi2Boolean}: Argument values is an array with the actual values of these variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2GetBoolean!.

source
fmi2GetBoolean!(c::FMU2Component, vr::fmi2ValueReferenceFormat, values::AbstractArray{fmi2Boolean})

Writes the boolean values of an array of variables in the given field

fmi2GetBoolean! is only possible for arrays of values, please use an array instead of a scalar.

Arguments

  • str::fmi2Struct: Representative for an FMU in the FMI 2.0.2 Standard.

More detailed: fmi2Struct = Union{FMU2, FMU2Component}

  • str::FMU2: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
  • str::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::fmi2ValueReferenceFormat: Argument vr defines the value references of the variables.

More detailed: fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1}, fmi2ValueReference, Array{fmi2ValueReference,1}, Int64, Array{Int64,1}, Symbol}

  • vr::AbstractArray{fmi2ValueReference}: Argument vr is an array of nvr value handels called "ValueReference" that define the variable that shall be inquired.
  • nvr::Csize_t: Argument nvr defines the size of vr.
  • values::AbstractArray{fmi2Boolean}: Argument value is an array with the actual values of these variables

Returns

  • Return singleton instance of type Nothing, if there is no value to return (as in a C void function) or when a variable or field holds no value.

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2GetBoolean!.

source
FMIImport.fmi2GetStringFunction
fmi2GetString(c::FMU2Component, vr::fmi2ValueReferenceFormat)

Get the values of an array of fmi2String variables.

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::fmi2ValueReferenceFormat: Argument vr defines the value references of the variables.

More detailed: fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1}, fmi2ValueReference, Array{fmi2ValueReference,1}, Int64, Array{Int64,1}, Symbol}

Returns

  • values::Array{fmi2String}: Return values is an array with the actual values of these variables.

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2GetString!.

source
FMICore.fmi2GetString!Function

Source: FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values

Functions to get and set values of variables idetified by their valueReference

source
fmi2GetString!(c::FMU2Component, vr::AbstractArray{fmi2ValueReference}, nvr::Csize_t, value::Union{AbstractArray{Ptr{Cchar}}, AbstractArray{Ptr{UInt8}}})

Functions to get and set values of variables idetified by their valueReference

These functions are especially used to get the actual values of output variables if a model is connected with other models.

Arguments

  • str::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::AbstractArray{fmi2ValueReference}: Argument vr is an array of nvr value handels called "ValueReference" that define the variable that shall be inquired.
  • nvr::Csize_t: Argument nvr defines the size of vr.
  • value::Union{AbstractArray{Ptr{Cchar}, AbstractArray{Ptr{UInt8}}}: The value argument is an AbstractArray of values whose memory address refers to data of type Cchar or UInt8and describes a vector with the actual values of these. variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values

See also fmi2GetString!.

source
fmi2GetString!(c::FMU2Component, vr::fmi2ValueReferenceFormat, values::AbstractArray{fmi2String})

Writes the string values of an array of variables in the given field

These functions are especially used to get the actual values of output variables if a model is connected with other models.

Arguments

  • str::fmi2Struct: Representative for an FMU in the FMI 2.0.2 Standard.

More detailed: fmi2Struct = Union{FMU2, FMU2Component}

  • str::FMU2: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
  • str::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::fmi2ValueReferenceFormat: Argument vr defines the value references of the variables.

More detailed: fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1}, fmi2ValueReference, Array{fmi2ValueReference,1}, Int64, Array{Int64,1}, Symbol}

  • values::AbstractArray{fmi2String}: Argument values is an AbstractArray with the actual values of these variables

Returns

  • Return singleton instance of type Nothing, if there is no value to return (as in a C void function) or when a variable or field holds no value.

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2GetString!.

source
FMICore.fmi2SetRealFunction

Source: FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values

Functions to get and set values of variables idetified by their valueReference

source
fmi2SetReal(c::FMU2Component, vr::AbstractArray{fmi2ValueReference}, nvr::Csize_t, value::AbstractArray{fmi2Real})

Functions to get and set values of variables idetified by their valueReference

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::AbstractArray{fmi2ValueReference}: Argument vr is an AbstractArray of nvr value handels, called "ValueReference" that define the variable that shall be inquired.
  • nvr::Csize_t: Argument nvr defines the size of vr.
  • values::AbstractArray{fm2Real}: Argument values is an AbstractArray with the actual values of these variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values

See also fmi2GetReal.

source
fmi2SetReal(c::FMU2Component, vr::fmi2ValueReferenceFormat, values::Union{AbstractArray{<:Real}, <:Real})

Set the values of an array of real variables

Arguments

  • c::fmi2Struct: Representative for an FMU in the FMI 2.0.2 Standard.

More detailed: fmi2Struct = Union{FMU2, FMU2Component}

  • c::FMU2: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::fmi2ValueReferenceFormat: Wildcards for how a user can pass a fmi[X]ValueReference

More detailed: fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1}, fmi2ValueReference, Array{fmi2ValueReference,1}, Int64, Array{Int64,1}, Symbol}

  • values::Union{Array{<:Real}, <:Real}: Argument values is an array with the actual values of these variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2SetReal.

source
FMICore.fmi2SetIntegerFunction

Source: FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values

Functions to get and set values of variables idetified by their valueReference

source
fmi2SetInteger(c::FMU2Component, vr::AbstractArray{fmi2ValueReference}, nvr::Csize_t, value::AbstractArray{fmi2Integer})

Set the values of an array of integer variables

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::AbstractArray{fmi2ValueReference}: Argument vr is an AbstractArray of nvr value handels, called "ValueReference" that define the variable that shall be inquired.
  • nvr::Csize_t: Argument nvr defines the size of vr.
  • values::AbstractArray{fmi2Integer}: Argument values is an AbstractArray with the actual values of these variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2GetInteger!.

source
fmi2SetInteger(c::FMU2Component, vr::fmi2ValueReferenceFormat, values::Union{AbstractArray{<:Integer}, <:Integer})

Set the values of an array of integer variables

Arguments

  • c::fmi2Struct: Representative for an FMU in the FMI 2.0.2 Standard.

More detailed: fmi2Struct = Union{FMU2, FMU2Component}

  • c::FMU2: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::fmi2ValueReferenceFormat: Argument vr defines the value references of the variables.

More detailed: fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1}, fmi2ValueReference, Array{fmi2ValueReference,1}, Int64, Array{Int64,1}, Symbol}

  • vr::Array{fmi2ValueReference}: Argument vr is an array of nvr value handels called "ValueReference" that define the variable that shall be inquired.
  • values::Union{Array{<:Integer}, <:Integer}: Argument values is an array or a single value with type Integer or any subtyp

Returns

  • status::fmi2Status: Return status indicates the success of the function call.

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2SetInteger.

source
FMICore.fmi2SetBooleanFunction

Source: FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values

Functions to get and set values of variables idetified by their valueReference

source
fmi2SetBoolean(c::FMU2Component, vr::AbstractArray{fmi2ValueReference}, nvr::Csize_t, value::AbstractArray{fmi2Boolean})

Functions to get and set values of variables idetified by their valueReference

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::AbstractArray{fmi2ValueReference}: Argument vr is an array of nvr value handels called "ValueReference" that define the variable that shall be inquired.
  • nvr::Csize_t: Argument nvr defines the size of vr.
  • value::AbstractArray{fmi2Boolean}: Argument values is an array with the actual values of these variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2GetBoolean.

source
fmi2SetBoolean(c::FMU2Component, vr::fmi2ValueReferenceFormat, values::Union{AbstractArray{Bool}, Bool})

Set the values of an array of boolean variables

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::fmi2ValueReferenceFormat: Argument vr defines the value references of the variables.

More detailed: fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1}, fmi2ValueReference, Array{fmi2ValueReference,1}, Int64, Array{Int64,1}, Symbol}

  • values::Union{Array{Bool}, Bool}: Argument values is an array or a single value with type Boolean or any subtyp

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions

See also fmi2GetBoolean!.

source
FMICore.fmi2SetStringFunction

Source: FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values

Functions to get and set values of variables idetified by their valueReference

source
fmi2SetString(c::FMU2Component, vr::AbstractArray{fmi2ValueReference}, nvr::Csize_t, value::Union{AbstractArray{Ptr{Cchar}}, AbstractArray{Ptr{UInt8}}})

Set the values of an array of string variables

For the exact rules on which type of variables fmi2SetXXX can be called see FMISpec2.0.2 section 2.2.7 , as well as FMISpec2.0.2 section 3.2.3 in case of ModelExchange and FMISpec2.0.2 section 4.2.4 in case ofCoSimulation.

Arguments

  • str::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::AbstractArray{fmi2ValueReference}: Argument vr is an array of nvr value handels called "ValueReference" that define the variable that shall be inquired.
  • nvr::Csize_t: Argument nvr defines the size of vr.
  • value::Union{AbstractArray{Ptr{Cchar}, AbstractArray{Ptr{UInt8}}}: The value argument is an AbstractArray of values whose memory address refers to data of type Cchar or UInt8and describes a vector with the actual values of these. variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values

See also fmi2GetString!.

source
fmi2SetString(c::FMU2Component, vr::fmi2ValueReferenceFormat, values::Union{AbstractArray{String}, String})

Set the values of an array of string variables

For the exact rules on which type of variables fmi2SetXXX can be called see FMISpec2.0.2 section 2.2.7 , as well as FMISpec2.0.2 section 3.2.3 in case of ModelExchange and FMISpec2.0.2 section 4.2.4 in case of CoSimulation.

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::fmi2ValueReferenceFormat: Argument vr defines the value references of the variables.

More detailed: fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1}, fmi2ValueReference, Array{fmi2ValueReference,1}, Int64, Array{Int64,1}, Symbol}

  • values::Union{Array{String}, String}: Argument values is an array or a single value with type String.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values
  • FMISpec2.0.2[p.46]: 2.2.7 Definition of Model Variables
  • FMISpec2.0.2[p.46]: 3.2.3 State Machine of Calling Sequence
  • FMISpec2.0.2[p.108]: 4.2.4 State Machine of Calling Sequence from Master to Slave

See also fmi2SetString.

source

fmi2Get fmi2Get! fmi2Set

Getting and Setting the Complete FMU State

The FMU has an internal state consisting of all values that are needed to continue a simulation. This internal state consists especially of the values of the continuous-time states, iteration variables, parameter values, input values, delay buffers, file identifiers, and FMU internal status information. With the functions of this section, the internal FMU state can be copied and the pointer to this copy is returned to the environment. The FMU state copy can be set as actual FMU state, in order to continue the simulation from it.

FMIImport.fmi2GetFMUstateFunction
fmi2GetFMUstate(c::FMU2Component)

Makes a copy of the internal FMU state and returns a pointer to this copy.

Arguments

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

Returns

  • Return state is a pointer to a copy of the internal FMU state.

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.25]: 2.1.8 Getting and Setting the Complete FMU State

See also fmi2GetFMUstate.

source
FMICore.fmi2GetFMUstate!Function

Source: FMISpec2.0.2[p.26]: 2.1.8 Getting and Setting the Complete FMU State

fmi2GetFMUstate makes a copy of the internal FMU state and returns a pointer to this copy

source
fmi2GetFMUstate!(c::FMU2Component, FMUstate::Ref{fmi2FMUstate})

Makes a copy of the internal FMU state and returns a pointer to this copy.

Arguments

  • str::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • FMUstate::Ref{fmi2FMUstate}:If on entry FMUstate == NULL, a new allocation is required. If FMUstate != NULL, then FMUstate points to a previously returned FMUstate that has not been modified since.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.24]: 2.1.7 Getting and Setting Variable Values

See also fmi2GetFMUstate!.

source
FMICore.fmi2SetFMUstateFunction

Source: FMISpec2.0.2[p.26]: 2.1.8 Getting and Setting the Complete FMU State

fmi2SetFMUstate copies the content of the previously copied FMUstate back and uses it as actual new FMU state.

source
fmi2SetFMUstate(c::FMU2Component, FMUstate::fmi2FMUstate)

Copies the content of the previously copied FMUstate back and uses it as actual new FMU state.

Arguments

  • str::fmi2Struct: Representative for an FMU in the FMI 2.0.2 Standard.

More detailed: fmi2Struct = Union{FMU2, FMU2Component}

  • str::FMU2: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
  • str::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • FMUstate::fmi2FMUstate: Argument FMUstate is a pointer to a data structure in the FMU that saves the internal FMU state of the actual or a previous time instant.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.16]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.25]: 2.1.8 Getting and Setting the Complete FMU State

See also fmi2GetFMUstate.

source
FMICore.fmi2FreeFMUstateFunction

Source: FMISpec2.0.2[p.26]: 2.1.8 Getting and setting the complete FMU state

fmi2FreeFMUstate frees all memory and other resources allocated with the fmi2GetFMUstate call for this FMUstate.

source
fmi2FreeFMUstate(c::FMU2Component, FMUstate::Ref{fmi2FMUstate})

Frees all memory and other resources allocated with the fmi2GetFMUstate call for this FMUstate.

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • FMUstate::Ref{fmi2FMUstate}: Argument FMUstate is an object that safely references data of type fmi3FMUstate which is a pointer to a data structure in the FMU that saves the internal FMU state of the actual or a previous time instant.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.16]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.25]: 2.1.8 Getting and Setting the Complete FMU State

See also fmi2FreeFMUstate.

source
fmi2FreeFMUstate!(c::FMU2Component, state::fmi2FMUstate)

Free the memory for the allocated FMU state

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • state::fmi2FMUstate: Argument state is a pointer to a data structure in the FMU that saves the internal FMU state of the actual or a previous time instant.

Returns

  • Return singleton instance of type Nothing, if there is no value to return (as in a C void function) or when a variable or field holds no value.

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.16]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.25]: 2.1.8 Getting and Setting the Complete FMU State

See also fmi2FreeFMUstate.

source
FMIImport.fmi2SerializedFMUstateSizeFunction
fmi2SerializedFMUstateSize(c::FMU2Component, state::fmi2FMUstate)

Returns the size of the byte vector in which the FMUstate can be stored.

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • state::fmi2FMUstate: Argument state is a pointer to a data structure in the FMU that saves the internal FMU state of the actual or a previous time instant.

Returns

  • Return size is an object that safely references a value of type Csize_t.

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.16]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.25]: 2.1.8 Getting and Setting the Complete FMU State

See also fmi2SerializedFMUstateSize.

source
FMICore.fmi2SerializedFMUstateSize!Function

Source: FMISpec2.0.2[p.26]: 2.1.8 Getting and Setting the Complete FMU State

fmi2SerializedFMUstateSize returns the size of the byte vector, in order that FMUstate can be stored in it.

source
fmi2SerializedFMUstateSize!(c::FMU2Component, FMUstate::fmi2FMUstate, size::Ref{Csize_t})

Stores the size of the byte vector in the given referenced Address, in order that FMUstate can be stored in it.

Argument

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • FMUstate::fmi2FMUstate: Argument FMUstate is a pointer to a data structure in the FMU that saves the internal FMU state of the actual or a previous time instant.
  • size::Ref{Csize_t}: Argument size is an object that safely references a value of type Csize_t and defines the size of the byte vector in which the FMUstate can be stored.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.16]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.25]: 2.1.8 Getting and Setting the Complete FMU State

See also fmi2SerializedFMUstateSize!.

source
FMIImport.fmi2SerializeFMUstateFunction
fmi2SerializeFMUstate(c::FMU2Component, state::fmi2FMUstate)

Serializes the data referenced by the pointer FMUstate and copies this data into the byte vector serializedState of length size to be provided by the environment.

Arguments

  • str::fmi2Struct: Representative for an FMU in the FMI 2.0.2 Standard.

More detailed: fmi2Struct = Union{FMU2, FMU2Component}

  • str::FMU2: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
  • str::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • state::fmi2FMUstate: Argument state is a pointer to a data structure in the FMU that saves the internal FMU state of the actual or a previous time instant.

Returns

  • serializedState:: Array{fmi2Byte}: Return serializedState contains the copy of the serialized data referenced by the pointer FMUstate

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.16]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.25]: 2.1.8 Getting and Setting the Complete FMU State

See also fmi2SerializeFMUstate.

source
FMICore.fmi2SerializeFMUstate!Function

Source: FMISpec2.0.2[p.26]: 2.1.8 Getting and Setting the Complete FMU State

fmi2SerializeFMUstate serializes the data which is referenced by pointer FMUstate and copies this data in to the byte vector serializedState of length size

source
fmi2SerializeFMUstate!(c::FMU2Component, FMUstate::fmi2FMUstate, serialzedState::AbstractArray{fmi2Byte}, size::Csize_t)

Serializes the data which is referenced by pointer FMUstate and copies this data in to the byte vector serializedState of length size, that must be provided by the environment.

Arguments

  • str::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • state::fmi2FMUstate: Argument state is a pointer to a data structure in the FMU that saves the internal FMU state of the actual or a previous time instant.
  • serialzedState::AbstractArray{fmi2Byte}: Argument serializedState contains the copy of the serialized data referenced by the pointer FMUstate.
  • size::Csize_t: Argument size defines the length of the serialized vector.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.16]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.25]: 2.1.8 Getting and Setting the Complete FMU State

See also fmi2SerializeFMUstate.

source
FMIImport.fmi2DeSerializeFMUstateFunction
fmi2DeSerializeFMUstate(c::FMU2Component, serializedState::AbstractArray{fmi2Byte})

Deserialize the data in the serializedState fmi2Byte field

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • serializedState::Array{fmi2Byte}: Argument serializedState contains the fmi2Byte field to be deserialized.

Returns

  • Return state is a pointer to a copy of the internal FMU state.

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.16]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.25]: 2.1.8 Getting and Setting the Complete FMU State

See also fmi2DeSerializeFMUstate.

source
FMICore.fmi2DeSerializeFMUstate!Function

Source: FMISpec2.0.2[p.26]: 2.1.8 Getting and Setting the Complete FMU State

fmi2DeSerializeFMUstate deserializes the byte vector serializedState of length size, constructs a copy of the FMU state and returns FMUstate, the pointer to this copy.

source
fmi2DeSerializeFMUstate!(c::FMU2Component, serializedState::AbstractArray{fmi2Byte}, size::Csize_t, FMUstate::Ref{fmi2FMUstate})

Deserializes the byte vector serializedState of length size, constructs a copy of the FMU state and stores the FMU state in the given address of the reference FMUstate, the pointer to this copy.

Arguments

  • str::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • state::fmi2FMUstate: Argument state is a pointer to a data structure in the FMU that saves the internal FMU state of the actual or a previous time instant.
  • serialzedState::AbstractArray{fmi2Byte}: Argument serializedState contains the copy of the serialized data referenced by the pointer FMUstate.
  • size::Csize_t: Argument size defines the length of the serialized vector.
  • FMUstate::Ref{fmi2FMUstate}: Argument FMUstate is an object that safely references data of type fmi3FMUstate which is a pointer to a data structure in the FMU that saves the internal FMU state of the actual or a previous time instant.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.16]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.25]: 2.1.8 Getting and Setting the Complete FMU State

See also fmi2DeSerializeFMUstate!.

source

Getting Partial Dervatives

It is optionally possible to provide evaluation of partial derivatives for an FMU. For Model Exchange, this means computing the partial derivatives at a particular time instant. For Co-Simulation, this means to compute the partial derivatives at a particular communication point. One function is provided to compute directional derivatives. This function can be used to construct the desired partial derivative matrices.

FMIImport.fmi2GetDirectionalDerivativeFunction
fmi2GetDirectionalDerivative(c::FMU2Component,
                                  vUnknown_ref::AbstractArray{fmi2ValueReference},
                                  vKnown_ref::AbstractArray{fmi2ValueReference},
                                  dvKnown::Union{AbstractArray{fmi2Real}, Nothing} = nothing)

Wrapper Function call to compute the partial derivative with respect to the variables vKnown_ref.

Computes the directional derivatives of an FMU. An FMU has different Modes and in every Mode an FMU might be described by different equations and different unknowns.The precise definitions are given in the mathematical descriptions of Model Exchange (section 3.1) and Co-Simulation (section 4.1). In every Mode, the general form of the FMU equations are: 𝐯unknown = 𝐡(𝐯known, 𝐯_rest)

  • v_unknown: vector of unknown Real variables computed in the actual Mode:
    • Initialization Mode: unkowns kisted under <ModelStructure><InitialUnknowns> that have type Real.
    • Continuous-Time Mode (ModelExchange): The continuous-time outputs and state derivatives. (= the variables listed under <ModelStructure><Outputs> with type Real and variability = continuous and the variables listed as state derivatives under <ModelStructure><Derivatives>).
    • Event Mode (ModelExchange): The same variables as in the Continuous-Time Mode and additionally variables under <ModelStructure><Outputs> with type Real and variability = discrete.
    • Step Mode (CoSimulation): The variables listed under <ModelStructure><Outputs> with type Real and variability = continuous or discrete. If <ModelStructure><Derivatives> is present, also the variables listed here as state derivatives.
  • v_known: Real input variables of function h that changes its value in the actual Mode.
  • v_rest:Set of input variables of function h that either changes its value in the actual Mode but are non-Real variables, or do not change their values in this Mode, but change their values in other Modes

Computes a linear combination of the partial derivatives of h with respect to the selected input variables 𝐯_known:

Δv_unknown = (δh / δv_known) Δv_known

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vUnknown_ref::AbstractArray{fmi2ValueReference}: Argument vUnknown_ref contains values of typefmi2ValueReference which are identifiers of a variable value of the model. vUnknown_ref can be equated with v_unknown(variable described above).
  • vKnown_ref::AbstractArray{fmi2ValueReference}: Argument vKnown_ref contains values of type fmi2ValueReference which are identifiers of a variable value of the model.vKnown_ref can be equated with v_known(variable described above).
  • dvKnown::Union{AbstractArray{fmi2Real}, Nothing} = nothing: If no seed vector is passed the value nothing is used. The vector values Compute the partial derivative with respect to the given entries in vector vKnown_ref with the matching evaluate of dvKnown. # gehört das zu den v_rest values

Returns

  • dvUnknown::Array{fmi2Real}: Return dvUnknown contains the directional derivative vector values.

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.16]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.25]: 2.1.9 Getting Partial Derivatives

See also fmi2GetDirectionalDerivative!.

source
FMICore.fmi2GetDirectionalDerivative!Function

Source: FMISpec2.0.2[p.26]: 2.1.9 Getting Partial Derivatives

This function computes the directional derivatives of an FMU.

ΔvUnknown = ∂h / ∂vKnown ⋅ ΔvKnown
source
fmi2GetDirectionalDerivative!(c::FMU2Component,
                                   vUnknown_ref::AbstractArray{fmi2ValueReference},
                                   nUnknown::Csize_t,
                                   vKnown_ref::AbstractArray{fmi2ValueReference},
                                   nKnown::Csize_t,
                                   dvKnown::AbstractArray{fmi2Real},
                                   dvUnknown::AbstractArray{fmi2Real})

Wrapper Function call to compute the partial derivative with respect to the variables vKnown_ref.

Computes the directional derivatives of an FMU. An FMU has different Modes and in every Mode an FMU might be described by different equations and different unknowns. The precise definitions are given in the mathematical descriptions of Model Exchange (section 3.1) and Co-Simulation (section 4.1). In every Mode, the general form of the FMU equations are: 𝐯unknown = 𝐡(𝐯known, 𝐯_rest)

  • v_unknown: vector of unknown Real variables computed in the actual Mode:
    • Initialization Mode: unkowns kisted under <ModelStructure><InitialUnknowns> that have type Real.
    • Continuous-Time Mode (ModelExchange): The continuous-time outputs and state derivatives. (= the variables listed under <ModelStructure><Outputs> with type Real and variability = continuous and the variables listed as state derivatives under <ModelStructure><Derivatives>).
    • Event Mode (ModelExchange): The same variables as in the Continuous-Time Mode and additionally variables under <ModelStructure><Outputs> with type Real and variability = discrete.
    • Step Mode (CoSimulation): The variables listed under <ModelStructure><Outputs> with type Real and variability = continuous or discrete. If <ModelStructure><Derivatives> is present, also the variables listed here as state derivatives.
  • v_known: Real input variables of function h that changes its value in the actual Mode.
  • v_rest:Set of input variables of function h that either changes its value in the actual Mode but are non-Real variables, or do not change their values in this Mode, but change their values in other Modes

Computes a linear combination of the partial derivatives of h with respect to the selected input variables 𝐯_known:

Δvunknown = (δh / δvknown) Δv_known

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vUnknown_ref::AbstracArray{fmi2ValueReference}: Argument vUnknown_ref contains values of typefmi2ValueReference which are identifiers of a variable value of the model. vUnknown_ref can be equated with v_unknown(variable described above).
  • nUnknown::Csize_t: Length of the Unknown Array.
  • vKnown_ref::AbstractArray{fmi2ValueReference}: Argument vKnown_ref contains values of type fmi2ValueReference which are identifiers of a variable value of the model.vKnown_ref can be equated with v_known(variable described above).
  • nKnown::Csize_t: Length of the Known Array.
  • dvKnown::AbstractArray{fmi2Real}:The vector values Compute the partial derivative with respect to the given entries in vector vKnown_ref with the matching evaluate of dvKnown.
  • dvUnknown::AbstractArray{fmi2Real}: Stores the directional derivative vector values.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.16]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.25]: 2.1.9 Getting Partial Derivatives

See also fmi2GetDirectionalDerivative!.

source
fmiGetDirectionalDerivative!(c::FMU2Component,
                                  vUnknown_ref::AbstractArray{fmi2ValueReference},
                                  vKnown_ref::AbstractArray{fmi2ValueReference},
                                  dvKnown::Array{fmi2Real},
                                  dvUnknown::AbstractArray)

Wrapper Function call to compute the partial derivative with respect to the variables vKnown_ref.

Computes the directional derivatives of an FMU. An FMU has different Modes and in every Mode an FMU might be described by different equations and different unknowns.The precise definitions are given in the mathematical descriptions of Model Exchange (section 3.1) and Co-Simulation (section 4.1). In every Mode, the general form of the FMU equations are: 𝐯unknown = 𝐡(𝐯known, 𝐯_rest)

  • v_unknown: vector of unknown Real variables computed in the actual Mode:
    • Initialization Mode: unkowns kisted under <ModelStructure><InitialUnknowns> that have type Real.
    • Continuous-Time Mode (ModelExchange): The continuous-time outputs and state derivatives. (= the variables listed under <ModelStructure><Outputs> with type Real and variability = continuous and the variables listed as state derivatives under <ModelStructure><Derivatives>).
    • Event Mode (ModelExchange): The same variables as in the Continuous-Time Mode and additionally variables under <ModelStructure><Outputs> with type Real and variability = discrete.
    • Step Mode (CoSimulation): The variables listed under <ModelStructure><Outputs> with type Real and variability = continuous or discrete. If <ModelStructure><Derivatives> is present, also the variables listed here as state derivatives.
  • v_known: Real input variables of function h that changes its value in the actual Mode.
  • v_rest:Set of input variables of function h that either changes its value in the actual Mode but are non-Real variables, or do not change their values in this Mode, but change their values in other Modes

Computes a linear combination of the partial derivatives of h with respect to the selected input variables 𝐯_known:

Δv_unknown = (δh / δv_known) Δv_known

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vUnknown_ref::AbstracArray{fmi2ValueReference}: Argument vUnknown_ref contains values of typefmi2ValueReference which are identifiers of a variable value of the model. vUnknown_ref can be equated with v_unknown(variable described above).
  • vKnown_ref::AbstractArray{fmi2ValueReference}: Argument vKnown_ref contains values of type fmi2ValueReference which are identifiers of a variable value of the model.vKnown_ref can be equated with v_known(variable described above).
  • dvUnknown::AbstractArray{fmi2Real}: Stores the directional derivative vector values.
  • dvKnown::Union{AbstractArray{fmi2Real}, Nothing} = nothing: If no seed vector is passed the value nothing is used. The vector values Compute the partial derivative with respect to the given entries in vector vKnown_ref with the matching evaluate of dvKnown.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
  • FMISpec2.0.2[p.16]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.25]: 2.1.9 Getting Partial Derivatives

See also fmi2GetDirectionalDerivative!.

source
FMICore.fmi2SetRealInputDerivativesFunction

Source: FMISpec2.0.2[p.104]: 4.2.1 Transfer of Input / Output Values and Parameters

Sets the n-th time derivative of real input variables. vr defines the value references of the variables the array order specifies the corresponding order of derivation of the variables

source
fmi2SetRealInputDerivatives(c::FMU2Component,
                                vr::AbstractArray{fmi2ValueReference},
                                nvr::Csize_t,
                                order::AbstractArray{fmi2Integer}, 
                                value::AbstractArray{fmi2Real})

Sets the n-th time derivative of real input variables.

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::Array{fmi2ValueReference}: Argument vr is an array of nvr value handels called "ValueReference" that t define the variables whose derivatives shall be set.
  • nvr::Csize_t: Argument nvr defines the size of vr.
  • order::AbstractArray{fmi2Integer}: Argument order is an AbstractArray of fmi2Integer values witch specifys the corresponding order of derivative of the real input variable.
  • values::AbstractArray{fmi2Real}: Argument values is an AbstractArray with the actual values of these variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.104]: 4.2.1 Transfer of Input / Output Values and Parameters

See also fmi2SetRealInputDerivatives.

source
fmi2SetRealInputDerivatives(c::FMU2Component, 
                                vr::AbstractArray{fmi2ValueReference}, 
                                order::AbstractArray{fmi2Integer}, 
                                values::AbstractArray{fmi2Real})

Sets the n-th time derivative of real input variables.

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::Array{fmi2ValueReference}: Argument vr is an array of nvr value handels called "ValueReference" that define the variables whose derivatives shall be set.
  • order::AbstractArray{fmi2Integer}: Argument order is an AbstractArray of fmi2Integer values witch specifys the corresponding order of derivative of the real input variable.
  • values::AbstractArray{fmi2Real}: Argument values is an AbstractArray with the actual values of these variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.104]: 4.2.1 Transfer of Input / Output Values and Parameters

See also fmi2SetRealInputDerivatives.

source
FMICore.fmi2GetRealOutputDerivatives!Function

Source: FMISpec2.0.2[p.104]: 4.2.1 Transfer of Input / Output Values and Parameters

Retrieves the n-th derivative of output values. vr defines the value references of the variables the array order specifies the corresponding order of derivation of the variables

source
fmi2GetRealOutputDerivatives!(c::FMU2Component,  
                                vr::AbstractArray{fmi2ValueReference}, 
                                nvr::Csize_t, order::AbstractArray{fmi2Integer}, 
                                value::AbstractArray{fmi2Real})

Sets the n-th time derivative of real input variables.

Arguments

  • c::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vr::Array{fmi2ValueReference}: Argument vr is an array of nvr value handels called "ValueReference" that t define the variables whose derivatives shall be set.
  • nvr::Csize_t: Argument nvr defines the size of vr.
  • order::Array{fmi2Integer}: Argument order is an array of fmi2Integer values witch specifys the corresponding order of derivative of the real input variable.
  • values::Array{fmi2Real}: Argument values is an array with the actual values of these variables.

Returns

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

More detailed:

  • fmi2OK: all well
  • fmi2Warning: things are not quite right, but the computation can continue
  • fmi2Discard: if the slave computed successfully only a subinterval of the communication step
  • fmi2Error: the communication step could not be carried out at all
  • fmi2Fatal: if an error occurred which corrupted the FMU irreparably
  • fmi2Pending: this status is returned if the slave executes the function asynchronously

Source

  • FMISpec2.0.2 Link: https://fmi-standard.org/
  • FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
  • FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions
  • FMISpec2.0.2[p.104]: 4.2.1 Transfer of Input / Output Values and Parameters
source

fmi2SampleJacobian fmi2SampleJacobian!

External/Additional functions

FMIBase.setDiscreteStatesFunction

ToDo

source
setDiscreteStates(c::FMU2Component,
                             x::Union{AbstractArray{Float32},AbstractArray{Float64}})

Set a new (discrete) state vector and reinitialize chaching of variables that depend on states.

Arguments

[ToDo]

source
FMIBase.getDiscreteStates!Function
getDiscreteStates!(c, xd)

Sets a new (discrete) state vector (in-place).

Arguments

  • c::FMU2Component
  • xd::AbstractArray{Union{fmi2Real, fmi2Integer, fmi2Boolean}}
source
FMIBase.getSimpleTypeAttributeStructFunction
getSimpleTypeAttributeStruct(st::fmi2SimpleType)

Returns the attribute structure for the simple type st. Depending on definition, this is either st.Real, st.Integer, st.String, st.Boolean or st.Enumeration.

Arguments

  • st::fmi2SimpleType: Struct which provides the information on custom SimpleTypes.

Source

source
FMIBase.getDeclaredTypeFunction
getDeclaredType(md::fmi2ModelDescription, mv::fmi2ScalarVariable)

Returns the fmi2SimpleType of the corresponding model variable mv as defined in md.typeDefinitions. If mv does not have a declared type, return nothing. If mv has a declared type, but it is not found, issue a warning and return nothing.

Arguments

  • md::fmi2ModelDescription: Struct which provides the static information of ModelVariables.
  • mv::fmi2ScalarVariable: The “ModelVariables” element consists of an ordered set of “ScalarVariable” elements. A “ScalarVariable” represents a variable of primitive type, like a real or integer variable.

Source

source

fmi2GetSolutionDerivative fmi2GetSolutionState fmi2GetSolutionValue fmi2GetSolutionTime fmi2GetJacobian fmi2GetJacobian! fmi2GetFullJacobian fmi2GetFullJacobian!