FMICore.FMU2
— Method(fmu::FMU2)(;dx::Union{AbstractVector{<:Real}, Nothing}=nothing,
y::Union{AbstractVector{<:Real}, Nothing}=nothing,
y_refs::Union{AbstractVector{fmi2ValueReference}, Nothing}=nothing,
x::Union{AbstractVector{<:Real}, Nothing}=nothing,
u::Union{AbstractVector{<:Real}, Nothing}=nothing,
u_refs::Union{AbstractVector{fmi2ValueReference}, Nothing}=nothing,
t::Union{Real, Nothing}=nothing)
Evaluates a FMU2
by setting the component state x
, inputs u
and/or time t
. If no component is available, one is allocated. The result of the evaluation might be the system output y
and/or state-derivative dx
. Not all options are available for any FMU type, e.g. setting state is not supported for CS-FMUs. Assertions will be generated for wrong use.
Keywords
dx
: An array to store the state-derivatives in. If not provided but necessary, a suitable array is allocated and returned. Not supported by CS-FMUs.y
: An array to store the system outputs in. If not provided but requested, a suitable array is allocated and returned.y_refs
: An array of value references to indicate which system outputs shall be returned.x
: An array containing the states to be set. Not supported by CS-FMUs.u
: An array containing the inputs to be set.u_refs
: An array of value references to indicate which system inputs want to be set.t
: A scalar value holding the system time to be set.
Returns (as Tuple)
y::Union{AbstractVector{<:Real}, Nothing}
: The system outputy
(if requested, otherwisenothing
).dx::Union{AbstractVector{<:Real}, Nothing}
: The system state-derivaitve (if ME-FMU, otherwisenothing
).
FMICore.FMU2Component
— Method(c::FMU2Component)(;dx::Union{AbstractVector{<:Real}, Nothing}=nothing,
y::Union{AbstractVector{<:Real}, Nothing}=nothing,
y_refs::Union{AbstractVector{fmi2ValueReference}, Nothing}=nothing,
x::Union{AbstractVector{<:Real}, Nothing}=nothing,
u::Union{AbstractVector{<:Real}, Nothing}=nothing,
u_refs::Union{AbstractVector{fmi2ValueReference}, Nothing}=nothing,
t::Union{Real, Nothing}=nothing)
Evaluates a FMU2Component
by setting the component state x
, inputs u
and/or time t
. The result of the evaluation might be the system output y
and/or state-derivative dx
. Not all options are available for any FMU type, e.g. setting state is not supported for CS-FMUs. Assertions will be generated for wrong use.
Keywords
dx
: An array to store the state-derivatives in. If not provided but necessary, a suitable array is allocated and returned. Not supported by CS-FMUs.y
: An array to store the system outputs in. If not provided but requested, a suitable array is allocated and returned.y_refs
: An array of value references to indicate which system outputs shall be returned.x
: An array containing the states to be set. Not supported by CS-FMUs.u
: An array containing the inputs to be set.u_refs
: An array of value references to indicate which system inputs want to be set.t
: A scalar value holding the system time to be set.
Returns (as Tuple)
y::Union{AbstractVector{<:Real}, Nothing}
: The system outputy
(if requested, otherwisenothing
).dx::Union{AbstractVector{<:Real}, Nothing}
: The system state-derivaitve (if ME-FMU, otherwisenothing
).
FMICore.fmi2CancelStep
— Methodfmi2CancelStep(c::FMU2Component)
Can be called if fmi2DoStep
returned fmi2Pending
in order to stop the current asynchronous execution.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.104]: 4.2.2 Computation
See also fmi2DoStep
.
FMICore.fmi2CompletedIntegratorStep!
— Methodfmi2CompletedIntegratorStep!(c::FMU2Component, noSetFMUStatePriorToCurrentPoint::fmi2Boolean, enterEventMode::Ref{fmi2Boolean}, terminateSimulation::Ref{fmi2Boolean})
This function must be called by the environment after every completed step of the integrator provided the capability flag completedIntegratorStepNotNeeded = false.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.noSetFMUStatePriorToCurrentPoint::fmi2Boolean
: ArgumentnoSetFMUStatePriorToCurrentPoint = fmi2True
iffmi2SetFMUState
will no longer be called for time instants prior to current time in this simulation run.enterEventMode::Ref{fmi2Boolean}
: ArgumententerEventMode
points to the return value (fmi2Boolean) which signals to the environment if the FMU shall callfmi2EnterEventMode
.fmi2Boolean
is an alias type forBoolean
data type.terminateSimulation::Ref{fmi2Boolean}
: ArgumentterminateSimulation
points to the return value (fmi2Boolean) which signals signal if the simulation shall be terminated.fmi2Boolean
is an alias type forBoolean
data type.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2CompletedIntegratorStep
, fmi2SetFMUState
.
FMICore.fmi2DeSerializeFMUstate!
— Methodfmi2DeSerializeFMUstate!(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
: Argumentstate
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}
: ArgumentserializedState
contains the copy of the serialized data referenced by the pointer FMUstate.size::Csize_t
: Argumentsize
defines the length of the serialized vector.FMUstate::Ref{fmi2FMUstate}
: ArgumentFMUstate
is an object that safely references data of typefmi3FMUstate
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
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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!
.
FMICore.fmi2DoStep
— Functionfmi2DoStep(c::FMU2Component, communicationStepSize::Union{Real, Nothing} = nothing; currentCommunicationPoint::Union{Real, Nothing} = nothing, noSetFMUStatePriorToCurrentPoint::Bool = true)
Does one step in the CoSimulation FMU
Arguments
C::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.communicationStepSize::Union{Real, Nothing} = nothing
: ArgumentcommunicationStepSize
contains a value of typeReal
orNothing
, if no argument is passed the default valuenothing
is used.communicationStepSize
defines the communiction step size.
Keywords
currentCommunicationPoint::Union{Real, Nothing} = nothing
: ArgumentcurrentCommunicationPoint
contains a value of typeReal
or typeNothing
. If no argument is passed the default valuenothing
is used.currentCommunicationPoint
defines the current communication point of the master.noSetFMUStatePriorToCurrentPoint::Bool = true
: ArgumentnoSetFMUStatePriorToCurrentPoint
contains a value of typeBoolean
. If no argument is passed the default valuetrue
is used.noSetFMUStatePriorToCurrentPoint
indicates whetherfmi2SetFMUState
is no longer called for times before thecurrentCommunicationPoint
in this simulation run Simulation run.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.104]: 4.2.2 Computation
See also fmi2DoStep
, fmi2Struct
, FMU2
, FMU2Component
.
FMICore.fmi2DoStep
— Methodfmi2DoStep(c::FMU2Component, currentCommunicationPoint::fmi2Real, communicationStepSize::fmi2Real, noSetFMUStatePriorToCurrentPoint::fmi2Boolean)
The computation of a time step is started.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.currentCommunicationPoint::fmi2Real
: ArgumentcurrentCommunicationPoint
contains a value of typefmi2Real
which is a identifier for a variable value .currentCommunicationPoint
defines the current communication point of the master.communicationStepSize::fmi2Real
: ArgumentcommunicationStepSize
contains a value of typefmi2Real
which is a identifier for a variable value.communicationStepSize
defines the communiction step size.
noSetFMUStatePriorToCurrentPoint::Bool = true
: Argument noSetFMUStatePriorToCurrentPoint
contains a value of type Boolean
. If no argument is passed the default value true
is used. noSetFMUStatePriorToCurrentPoint
indicates whether fmi2SetFMUState
is no longer called for times before the currentCommunicationPoint
in this simulation run Simulation run.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.104]: 4.2.2 Computation
See also fmi2DoStep
.
FMICore.fmi2EnterContinuousTimeMode
— Methodfmi2EnterContinuousTimeMode(c::FMU2Component; soft::Bool=false)
The model enters Continuous-Time Mode and all discrete-time equations become inactive and all relations are “frozen”. This function has to be called when changing from Event Mode (after the global event iteration in Event Mode over all involved FMUs and other models has converged) into Continuous-Time Mode.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
Keywords
soft::Bool=false
: If the Keywordsoft = true
the command is only performed if the FMU is in an allowed state for this command.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2EnterContinuousTimeMode
.
FMICore.fmi2EnterEventMode
— Methodfmi2EnterEventMode(c::FMU2Component; soft::Bool=false)
The model enters Event Mode from the Continuous-Time Mode and discrete-time equations may become active (and relations are not “frozen”).
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
Keywords
soft::Bool=false
: If the Keywordsoft = true
the command is only performed if the FMU is in an allowed state for this command.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2EnterEventMode
.
FMICore.fmi2EnterInitializationMode
— Methodfmi2EnterInitializationMode(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
: Argumentc
is a Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi2ExitInitializationMode
— Methodfmi2ExitInitializationMode(c::FMU2Component)
Informs the FMU to exit Initialization Mode.
Arguments
c::FMU2Component
: Argumentc
is a Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi2FreeFMUstate!
— Methodfmi2FreeFMUstate!(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
: Argumentstate
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
.
FMICore.fmi2FreeFMUstate!
— Methodfmi2FreeFMUstate!(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}
: ArgumentFMUstate
is an object that safely references data of typefmi3FMUstate
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
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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!
.
FMICore.fmi2FreeInstance!
— MethodSource: 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.
FMICore.fmi2GetBoolean!
— Methodfmi2GetBoolean!(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}
: Argumentvr
is an AbstractArray ofnvr
value handels called "ValueReference" that define the variable that shall be inquired.nvr::Csize_t
: Argumentnvr
defines the size ofvr
.value::AbstractArray{fmi2Boolean}
: Argumentvalues
is an array with the actual values of these variables.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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!
.
FMICore.fmi2GetBoolean!
— Methodfmi2GetBoolean!(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
: Argumentvr
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}
: Argumentvr
is an array ofnvr
value handels called "ValueReference" that define the variable that shall be inquired.nvr::Csize_t
: Argumentnvr
defines the size ofvr
.values::AbstractArray{fmi2Boolean}
: Argumentvalue
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!
.
FMICore.fmi2GetBooleanStatus!
— Methodfmi2GetBooleanStatus!(c::FMU2Component, s::fmi2StatusKind, value::Ref{fmi2Boolean})
Informs the master about the actual status of the simulation run. Which status information is to be returned is specified by the argument fmi2StatusKind
.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.s::fmi2StatusKind
: Arguments
defines which status information is to be returned.fmi2StatusKind
is an enumeration that defines which status is inquired.
The following status information can be retrieved from a slave:
fmi2DoStepStatus::fmi2Status
: Can be called when thefmi2DoStep
function returnedfmi2Pending
. The function deliversfmi2Pending
if the computation is not finished. Otherwise the function returns the result of the asynchronously executedfmi2DoStep
call.fmi2PendingStatus::fmi2String
: Can be called when thefmi2DoStep
function returnedfmi2Pending
. The function delivers a string which informs about the status of the currently running asynchronousfmi2DoStep
computationfmi2LastSuccessfulTime:: fmi2Real
: Returns the end time of the last successfully completed communication step. Can be called after fmi2DoStep(..) returned fmi2Discard.fmi2Terminated::fmi2Boolean
: Returnsfmi2True
, if the slave wants to terminate the simulation. Can be called after fmi2DoStep(..) returnedfmi2Discard
. Use fmi2LastSuccessfulTime to determine the time instant at which the slave terminated.value::Ref{fmi2Boolean}
: Argumentvalue
points to the return value (fmi2Boolean) which was requested.fmi2Boolean
is a alias type forBoolean
data type.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.106]: 4.2.3 Retrieving Status Information from the Slave
See also fmi2GetBooleanStatus!
.
FMICore.fmi2GetContinuousStates!
— Methodfmi2GetContinuousStates!(c::FMU2Component, x::AbstractArray{fmi2Real}, nx::Csize_t)
Stores the new (continuous) state vector in x.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.x::AbstractArray{fmi2Real}
: Argumentx
contains values of typefmi2Real
which is a alias type forReal
data type.x
is theAbstractArray
which contains theReal
values of the vector that represent the new state vector.nx::Csize_t
: Argumentnx
defines the length of vectorx
and is provided for checking purposes
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2GetEventIndicators!
.
FMICore.fmi2GetDerivatives!
— Methodfmi2GetDerivatives!(c::FMU2Component, derivatives::AbstractArray{fmi2Real}, nx::Csize_t)
Compute state derivatives at the current time instant and for the current states.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.derivatives::AbstractArray{fmi2Real}
: Argumentderivatives
contains values of typefmi2Real
which is a alias type forReal
data type.derivatives
is theAbstractArray
which contains theReal
values of the vector that represent the derivatives. The ordering of the elements of the derivatives vector is identical to the ordering of the state vector.nx::Csize_t
: Argumentnx
defines the length of vectorderivatives
and is provided for checking purposes
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2GetDerivatives!
.
FMICore.fmi2GetDerivatives!
— Methodfmi2GetDerivatives!(c::FMU2Component, derivatives::AbstractArray{fmi2Real})
Compute state derivatives at the current time instant and for the current states.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.derivatives::Array{fmi2Real}
: Storesfmi2Real
values representing thederivatives
for the current states. The ordering of the elements of the derivatives vector is identical to the ordering of the state vector.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2GetDerivatives
.
FMICore.fmi2GetDirectionalDerivative!
— FunctionTODO -> Arguments fmiGetDirectionalDerivative!(c::FMU2Component, vUnknownref::AbstractArray{fmi2ValueReference}, vKnownref::AbstractArray{fmi2ValueReference}, dvUnknown::AbstractArray, dvKnown::Union{Array{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
ordiscrete
. If<ModelStructure><Derivatives>
is present, also the variables listed here as state derivatives.
- Initialization Mode: unkowns kisted under
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}
: ArgumentvUnknown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vUnknown_ref
can be equated withv_unknown
(variable described above).vKnown_ref::AbstractArray{fmi2ValueReference}
: ArgumentvKnown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vKnown_ref
can be equated withv_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 valuenothing
is used. The vector values Compute the partial derivative with respect to the given entries in vectorvKnown_ref
with the matching evaluate ofdvKnown
.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi2GetDirectionalDerivative!
— MethodToDo Arguments
function fmi2GetDirectionalDerivative!(c::FMU2Component, vUnknownref::AbstractArray{fmi2ValueReference}, nUnknown::Csizet, vKnownref::AbstractArray{fmi2ValueReference}, nKnown::Csizet, 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
ordiscrete
. If<ModelStructure><Derivatives>
is present, also the variables listed here as state derivatives.
- Initialization Mode: unkowns kisted under
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}
: ArgumentvUnknown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vUnknown_ref
can be equated withv_unknown
(variable described above).nUnknown::Csize_t
:vKnown_ref::AbstractArray{fmi2ValueReference}
: ArgumentvKnown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vKnown_ref
can be equated withv_known
(variable described above).nKnown::Csize_t
:dvKnown::AbstractArray{fmi2Real}
:The vector values Compute the partial derivative with respect to the given entries in vectorvKnown_ref
with the matching evaluate ofdvKnown
.dvUnknown::AbstractArray{fmi2Real}
: Stores the directional derivative vector values.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi2GetEventIndicators!
— Methodfmi2GetEventIndicators!(c::FMU2Component, eventIndicators::AbstractArray{fmi2Real}, ni::Csize_t)
Compute event indicators at the current time instant and for the current states.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.eventIndicators::AbstractArray{fmi2Real}
: ArgumenteventIndicators
contains values of typefmi2Real
which is a alias type forReal
data type.eventIndicators
is theAbstractArray
which contains theReal
values of the vector that represent the event indicators.ni::Csize_t
: Argumentni
defines the length of vectoreventIndicators
and is provided for checking purposes
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2GetEventIndicators!
.
FMICore.fmi2GetEventIndicators!
— MethodReturns the event indicators of the FMU
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.eventIndicators::AbstractArray{fmi2Real}
:The event indicators are in an AbstractArray represented by an array of "fmi2Real" values.
Returns
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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2GetEventIndicators
.
FMICore.fmi2GetFMUstate!
— Methodfmi2GetFMUstate!(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 entryFMUstate == NULL
, a new allocation is required. IfFMUstate != NULL
, thenFMUstate
points to a previously returnedFMUstate
that has not been modified since.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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!
.
FMICore.fmi2GetInteger!
— Methodfmi2GetInteger!(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}
: Argumentvr
is an AbstractArray ofnvr
value handels, called "ValueReference" that define the variable that shall be inquired.nvr::Csize_t
: Argumentnvr
defines the size ofvr
.values::AbstractArray{fmi2Integer}
: Argumentvalues
is an AbstractArray with the actual values of these variables.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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!
,fmi2ValueReferenceFormat
, fmi2Struct
, FMU2
, FMU2Component
.
FMICore.fmi2GetInteger!
— Methodfmi2GetInteger!(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
: Argumentvr
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}
: Argumentvr
is an array ofnvr
value handels called "ValueReference" that define the variable that shall be inquired.nvr::Csize_t
: Argumentnvr
defines the size ofvr
.values::Array{fmi2Integer}
: Argumentvalues
is an array with the actual values of these variables.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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!
.
FMICore.fmi2GetIntegerStatus!
— Methodfmi2GetIntegerStatus!(c::FMU2Component, s::fmi2StatusKind, value::Ref{fmi2Integer})
Informs the master about the actual status of the simulation run. Which status information is to be returned is specified by the argument fmi2StatusKind
.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.s::fmi2StatusKind
: Arguments
defines which status information is to be returned.fmi2StatusKind
is an enumeration that defines which status is inquired.
The following status information can be retrieved from a slave:
fmi2DoStepStatus::fmi2Status
: Can be called when thefmi2DoStep
function returnedfmi2Pending
. The function deliversfmi2Pending
if the computation is not finished. Otherwise the function returns the result of the asynchronously executedfmi2DoStep
call.fmi2PendingStatus::fmi2String
: Can be called when thefmi2DoStep
function returnedfmi2Pending
. The function delivers a string which informs about the status of the currently running asynchronousfmi2DoStep
computationfmi2LastSuccessfulTime:: fmi2Real
: Returns the end time of the last successfully completed communication step. Can be called after fmi2DoStep(..) returned fmi2Discard.fmi2Terminated::fmi2Boolean
: Returnsfmi2True
, if the slave wants to terminate the simulation. Can be called after fmi2DoStep(..) returnedfmi2Discard
. Use fmi2LastSuccessfulTime to determine the time instant at which the slave terminated.value::Ref{fmi2Integer}
: Argumentvalue
points to the return value (fmi2Integer) which was requested.fmi2Integer
is a alias type forInteger
data type.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.106]: 4.2.3 Retrieving Status Information from the Slave
See also fmi2GetIntegerStatus!
.
FMICore.fmi2GetNominalsOfContinuousStates!
— Methodfmi2GetNominalsOfContinuousStates!(c::FMU2Component, xnominal::AbstractArray{fmi2Real}, nx::Csizet)
Stores the nominal values of the continuous states in x_nominal.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.x_nominal::AbstractArray{fmi2Real}
: Argumentx_nominal
contains values of typefmi2Real
which is a alias type forReal
data type.x_nominal
is theAbstractArray
which contains theReal
values of the vector that represent the nominal values of the continuous states.nx::Csize_t
: Argumentnx
defines the length of vectorx
and is provided for checking purposes
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2GetEventIndicators!
.
FMICore.fmi2GetReal!
— Methodfmi2GetReal!(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}
: Argumentvr
is an AbstractArray ofnvr
value handels called "ValueReference" that define the variable that shall be inquired.nvr::Csize_t
: Argumentnvr
defines the size ofvr
.values::AbstractArray{fm2Real}
: Argumentvalues
is an AbstractArray with the actual values of these variables.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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!
.
FMICore.fmi2GetReal!
— Methodfmi2GetReal!(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}
: Argumentvalues
is an AbstractArray with the actual values of these variables.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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!
.
FMICore.fmi2GetRealOutputDerivatives!
— Methodfmi2GetRealOutputDerivatives!(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}
: Argumentvr
is an array ofnvr
value handels called "ValueReference" that t define the variables whose derivatives shall be set.nvr::Csize_t
: Argumentnvr
defines the size ofvr
.order::Array{fmi2Integer}
: Argumentorder
is an array of fmi2Integer values witch specifys the corresponding order of derivative of the real input variable.values::Array{fmi2Real}
: Argumentvalues
is an array with the actual values of these variables.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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!
.
FMICore.fmi2GetRealStatus!
— Methodfmi2GetRealStatus!(c::FMU2Component, s::fmi2StatusKind, value::Ref{fmi2Real})
Informs the master about the actual status of the simulation run. Which status information is to be returned is specified by the argument fmi2StatusKind
.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.s::fmi2StatusKind
: Arguments
defines which status information is to be returned.fmi2StatusKind
is an enumeration that defines which status is inquired.
The following status information can be retrieved from a slave:
fmi2DoStepStatus::fmi2Status
: Can be called when thefmi2DoStep
function returnedfmi2Pending
. The function deliversfmi2Pending
if the computation is not finished. Otherwise the function returns the result of the asynchronously executedfmi2DoStep
call.fmi2PendingStatus::fmi2String
: Can be called when thefmi2DoStep
function returnedfmi2Pending
. The function delivers a string which informs about the status of the currently running asynchronousfmi2DoStep
computationfmi2LastSuccessfulTime:: fmi2Real
: Returns the end time of the last successfully completed communication step. Can be called after fmi2DoStep(..) returned fmi2Discard.fmi2Terminated::fmi2Boolean
: Returnsfmi2True
, if the slave wants to terminate the simulation. Can be called after fmi2DoStep(..) returnedfmi2Discard
. Use fmi2LastSuccessfulTime to determine the time instant at which the slave terminated.value::Ref{fmi2Real}
: Argumentvalue
points to the return value (fmi2Real) which was requested.fmi2Real
is a alias type forReal
data type.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.106]: 4.2.3 Retrieving Status Information from the Slave
See also fmi2GetRealStatus!
.
FMICore.fmi2GetStatus!
— Methodfmi2GetStatus!(c::FMU2Component, s::fmi2StatusKind, value::Ref{fmi2Status})
Informs the master about the actual status of the simulation run. Which status information is to be returned is specified by the argument fmi2StatusKind
.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.s::fmi2StatusKind
: Arguments
defines which status information is to be returned.fmi2StatusKind
is an enumeration that defines which status is inquired.
The following status information can be retrieved from a slave:
fmi2DoStepStatus::fmi2Status
: Can be called when thefmi2DoStep
function returnedfmi2Pending
. The function deliversfmi2Pending
if the computation is not finished. Otherwise the function returns the result of the asynchronously executedfmi2DoStep
call.fmi2PendingStatus::fmi2String
: Can be called when thefmi2DoStep
function returnedfmi2Pending
. The function delivers a string which informs about the status of the currently running asynchronousfmi2DoStep
computationfmi2LastSuccessfulTime:: fmi2Real
: Returns the end time of the last successfully completed communication step. Can be called after fmi2DoStep(..) returned fmi2Discard.fmi2Terminated::fmi2Boolean
: Returnsfmi2True
, if the slave wants to terminate the simulation. Can be called after fmi2DoStep(..) returnedfmi2Discard
. Use fmi2LastSuccessfulTime to determine the time instant at which the slave terminated.value::Ref{fmi2Status}
: Thevalue
argument points to a status flag that was requested.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.106]: 4.2.3 Retrieving Status Information from the Slave
See also fmi2GetStatus!
.
FMICore.fmi2GetString!
— Methodfmi2GetString!(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}
: Argumentvr
is an array ofnvr
value handels called "ValueReference" that define the variable that shall be inquired.nvr::Csize_t
: Argumentnvr
defines the size ofvr
.value::Union{AbstractArray{Ptr{Cchar}, AbstractArray{Ptr{UInt8}}}
: Thevalue
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
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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!
.
FMICore.fmi2GetString!
— Methodfmi2GetString!(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
: Argumentvr
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}
: Argumentvalues
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!
.
FMICore.fmi2GetStringStatus!
— Methodfmi2GetStringStatus!(c::FMU2Component, s::fmi2StatusKind, value::Ref{fmi2String})
Informs the master about the actual status of the simulation run. Which status information is to be returned is specified by the argument fmi2StatusKind
.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.s::fmi2StatusKind
: Arguments
defines which status information is to be returned.fmi2StatusKind
is an enumeration that defines which status is inquired.
The following status information can be retrieved from a slave:
fmi2DoStepStatus::fmi2Status
: Can be called when thefmi2DoStep
function returnedfmi2Pending
. The function deliversfmi2Pending
if the computation is not finished. Otherwise the function returns the result of the asynchronously executedfmi2DoStep
call.fmi2PendingStatus::fmi2String
: Can be called when thefmi2DoStep
function returnedfmi2Pending
. The function delivers a string which informs about the status of the currently running asynchronousfmi2DoStep
computationfmi2LastSuccessfulTime:: fmi2Real
: Returns the end time of the last successfully completed communication step. Can be called after fmi2DoStep(..) returned fmi2Discard.fmi2Terminated::fmi2Boolean
: Returnsfmi2True
, if the slave wants to terminate the simulation. Can be called after fmi2DoStep(..) returnedfmi2Discard
. Use fmi2LastSuccessfulTime to determine the time instant at which the slave terminated.value:Ref{fmi2String}:
Argumentvalue
points to the return value (fmi2String) which was requested.fmi2String
is a alias type forString
data type.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.106]: 4.2.3 Retrieving Status Information from the Slave
See also fmi2GetStringStatus!
.
FMICore.fmi2GetTypesPlatform
— Methodfmi2GetTypesPlatform(fmu::FMU2)
fmi2GetTypesPlatform(c::FMU2Component)
Returns the string to uniquely identify the “fmi2TypesPlatform.h” header file used for compilation of the functions of the FMU. The standard header file, as documented in this specification, has fmi2TypesPlatform set to “default” (so this function usually returns “default”).
Arguments
fmu::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.
Returns
- Returns the string to uniquely identify the “fmi2TypesPlatform.h” header file used for compilation of the functions of the FMU.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2[p.22]: 2.1.4 Inquire Platform and Version Number of Header Files
- FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
FMICore.fmi2GetVersion
— Methodfmi2GetVersion(fmu::FMU2)
fmi2GetVersion(c::FMU2Component)
Arguments
fmu::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.
Returns
- Returns a string from the address of a C-style (NUL-terminated) string. The string represents the version of the “fmi2Functions.h” header file which was used to compile the functions of the FMU. The function returns “fmiVersion” which is defined in this header file. The standard header file as documented in this specification has version “2.0”
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2[p.22]: 2.1.4 Inquire Platform and Version Number of Header Files
- FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
FMICore.fmi2NewDiscreteStates!
— Methodfmi2NewDiscreteStates!(c::FMU2Component, eventInfo::fmi2EventInfo)
The FMU is in Event Mode and the super dense time is incremented by this call.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.eventInfo::fmi2EventInfo*
: Strut withfmi2Boolean
Variables that
More detailed:
newDiscreteStatesNeeded::fmi2Boolean
: IfnewDiscreteStatesNeeded = fmi2True
the FMU should stay in Event Mode, and the FMU requires to set new inputs to the FMU to compute and get the outputs and to call
fmi2NewDiscreteStates again. If all FMUs return newDiscreteStatesNeeded = fmi2False
call fmi2EnterContinuousTimeMode.
terminateSimulation::fmi2Boolean
: IfterminateSimulation = fmi2True
callfmi2Terminate
nominalsOfContinuousStatesChanged::fmi2Boolean
: IfnominalsOfContinuousStatesChanged = fmi2True
then the nominal values of the states have changed due to the function call and can be inquired withfmi2GetNominalsOfContinuousStates
.valuesOfContinuousStatesChanged::fmi2Boolean
: IfvaluesOfContinuousStatesChanged = fmi2True
, then at least one element of the continuous state vector has changed its value due to the function call. The new values of the states can be retrieved withfmi2GetContinuousStates
. If no element of the continuous state vector has changed its value,valuesOfContinuousStatesChanged
must return fmi2False.nextEventTimeDefined::fmi2Boolean
: IfnextEventTimeDefined = fmi2True
, then the simulation shall integrate at most untiltime = nextEventTime
, and shall callfmi2EnterEventMode
at this time instant. If integration is stopped before nextEventTime, the definition ofnextEventTime
becomes obsolete.nextEventTime::fmi2Real
: next event ifnextEventTimeDefined=fmi2True
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2NewDiscreteStates
.
FMICore.fmi2Reset
— Methodfmi2Reset(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
: Argumentc
is a Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
Keywords
soft::Bool=false
: If the Keywordsoft = true
the command is only performed if the FMU is in an allowed state for this command.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi2SerializeFMUstate!
— Methodfmi2SerializeFMUstate!(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
: Argumentstate
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}
: ArgumentserializedState
contains the copy of the serialized data referenced by the pointer FMUstate.size::Csize_t
: Argumentsize
defines the length of the serialized vector.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
,fmi2FMUstate
, fmi2Struct
, FMU2
, FMU2Component
.
FMICore.fmi2SerializedFMUstateSize!
— Methodfmi2SerializedFMUstateSize!(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
: ArgumentFMUstate
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}
: Argumentsize
is an object that safely references a value of typeCsize_t
and defines the size of the byte vector in which the FMUstate can be stored.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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!
.
FMICore.fmi2SetBoolean
— Methodfmi2SetBoolean(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}
: Argumentvr
is an array ofnvr
value handels called "ValueReference" that define the variable that shall be inquired.nvr::Csize_t
: Argumentnvr
defines the size ofvr
.value::AbstractArray{fmi2Boolean}
: Argumentvalues
is an array with the actual values of these variables.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
,fmi2ValueReferenceFormat
, fmi2Struct
, FMU2
, FMU2Component
.
FMICore.fmi2SetBoolean
— Methodfmi2SetBoolean(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
: Argumentvr
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}
: Argumentvalues
is an array or a single value with type Boolean or any subtyp
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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!
.
FMICore.fmi2SetContinuousStates
— Methodfmi2SetContinuousStates(c::FMU2Component, x::AbstractArray{fmi2Real}, nx::Csize_t)
Set a new (continuous) state vector and re-initialize caching of variables that depend on the states. Argument nx is the length of vector x and is provided for checking purposes
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.x::AbstractArray{fmi2Real}
: Argumentx
contains values of typefmi2Real
which is a alias type forReal
data type.x
is theAbstractArray
of the vector values ofReal
input variables of function h that changes its value in the actual Mode.nx::Csize_t
: Argumentnx
defines the length of vectorx
and is provided for checking purposes
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.83]: 3.2.1 Providing Independent Variables and Re-initialization of Caching
See also fmi2SetContinuousStates
.
FMICore.fmi2SetContinuousStates
— MethodfmiSetContinuousStates(c::FMU2Component,
x::Union{AbstractArray{Float32},AbstractArray{Float64}})
Set a new (continuous) state vector and reinitialize chaching of variables that depend on states.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.x::Union{AbstractArray{Float32},AbstractArray{Float64}}
:Argumentx
is theAbstractArray
of the vector values ofFloat64
orFloat32
.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.83]: 3.2.1 Providing Independent Variables and Re-initialization of Caching
See also fmi2SetContinuousStates
.
FMICore.fmi2SetDebugLogging
— Methodfmi2SetDebugLogging(c::FMU2Component, logginOn::fmi2Boolean, nCategories::Unsigned, categories::Ptr{Nothing})
Control the use of the logging callback function, version independent.
Arguments
c::FMU2Component
: Argumentc
is a Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.logginOn::fmi2Boolean
: IfloggingOn = fmi2True
, debug logging is enabled for the log categories specified in categories, otherwise it is disabled. Typefmi2Boolean
is defined as an alias Type for the C-Type Boolean and is to be used withfmi2True
andfmi2False
.nCategories::Unsigned
: ArgumentnCategories
defines the length of the argumentcategories
.categories::Ptr{Nothing}
:
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi2SetDebugLogging
— MethodTODO: FMI specification reference.
Set the DebugLogger for the FMU.
FMICore.fmi2SetFMUstate
— Methodfmi2SetFMUstate(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
: ArgumentFMUstate
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
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
, fmi2Struct
, FMU2
, FMU2Component
.
FMICore.fmi2SetInteger
— Methodfmi2SetInteger(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}
: Argumentvr
is an AbstractArray ofnvr
value handels, called "ValueReference" that define the variable that shall be inquired.nvr::Csize_t
: Argumentnvr
defines the size ofvr
.values::AbstractArray{fmi2Integer}
: Argumentvalues
is an AbstractArray with the actual values of these variables.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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!
.
FMICore.fmi2SetInteger
— Methodfmi2SetInteger(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
: Argumentvr
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}
: Argumentvr
is an array ofnvr
value handels called "ValueReference" that define the variable that shall be inquired.values::Union{Array{<:Integer}, <:Integer}
: Argumentvalues
is an array or a single value with type Integer or any subtyp
Returns
status::fmi2Status
: Returnstatus
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
.
FMICore.fmi2SetReal
— Methodfmi2SetReal(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}
: Argumentvr
is an AbstractArray ofnvr
value handels, called "ValueReference" that define the variable that shall be inquired.nvr::Csize_t
: Argumentnvr
defines the size ofvr
.values::AbstractArray{fm2Real}
: Argumentvalues
is an AbstractArray with the actual values of these variables.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi2SetReal
— Methodfmi2SetReal(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}
: Argumentvalues
is an array with the actual values of these variables.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi2SetRealInputDerivatives
— Methodfmi2SetRealInputDerivatives(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}
: Argumentvr
is an array ofnvr
value handels called "ValueReference" that t define the variables whose derivatives shall be set.nvr::Csize_t
: Argumentnvr
defines the size ofvr
.order::AbstractArray{fmi2Integer}
: Argumentorder
is an AbstractArray of fmi2Integer values witch specifys the corresponding order of derivative of the real input variable.values::AbstractArray{fmi2Real}
: Argumentvalues
is an AbstractArray with the actual values of these variables.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi2SetRealInputDerivatives
— Methodfmi2SetRealInputDerivatives(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}
: Argumentvr
is an array ofnvr
value handels called "ValueReference" that define the variables whose derivatives shall be set.order::AbstractArray{fmi2Integer}
: Argumentorder
is an AbstractArray of fmi2Integer values witch specifys the corresponding order of derivative of the real input variable.values::AbstractArray{fmi2Real}
: Argumentvalues
is an AbstractArray with the actual values of these variables.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi2SetString
— Methodfmi2SetString(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}
: Argumentvr
is an array ofnvr
value handels called "ValueReference" that define the variable that shall be inquired.nvr::Csize_t
: Argumentnvr
defines the size ofvr
.value::Union{AbstractArray{Ptr{Cchar}, AbstractArray{Ptr{UInt8}}}
: Thevalue
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
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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: 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
FMICore.fmi2SetString
— Methodfmi2SetString(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
: Argumentvr
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}
: Argumentvalues
is an array or a single value with type String.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi2SetTime
— Methodfmi2SetTime(c::FMU2Component, time::fmi2Real; soft::Bool=false)
Set a new time instant and re-initialize caching of variables that depend on time, provided the newly provided time value is different to the previously set time value (variables that depend solely on constants or parameters need not to be newly computed in the sequel, but the previously computed values can be reused).
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.time::fmi2Real
: Argumenttime
contains a value of typefmi2Real
which is a alias type forReal
data type.time
sets the independent variable time t.
Keywords
soft::Bool=false
: If the Keywordsoft = true
the command is only performed if the FMU is in an allowed state for this command.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.83]: 3.2.1 Providing Independent Variables and Re-initialization of Caching
See also fmi2SetTime
.
FMICore.fmi2SetTime
— MethodfmiSetTime(c::FMU2Component, t::Real)
Set a new time instant and re-initialize caching of variables that depend on time.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.t::Real
: Argumentt
contains a value of typeReal
.t
sets the independent variable time t.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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.83]: 3.2.1 Providing Independent Variables and Re-initialization of Caching
See also fmi2SetTime
FMICore.fmi2SetupExperiment
— Functionfmi2SetupExperiment(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 represents 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 infmi2ComponentStateInstantiated
. status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi2SetupExperiment
— Methodfmi2SetupExperiment(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
: Argumentc
is a Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.toleranceDefined::fmi2Boolean
: ArgumentstoleranceDefined
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 usingtolerance
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.
- fmuType = fmi2ModelExchange: If
startTime::fmi2Real
: ArgumentstartTime
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 istime
,startTime
is the starting time of initializaton.stopTimeDefined::fmi2Boolean
: IfstopTimeDefined = fmi2True
, then stopTime is the defined final value of the independent variable and ifstopTimeDefined = fmi2False
, then no final value
of the independent variable is defined and argument stopTime
is meaningless.
stopTime::fmi2Real
: ArgumentstopTime
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
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi2Terminate
— Methodfmi2Terminate(c::FMU2Component; soft::Bool=false)
Informs the FMU that the simulation run is terminated.
Arguments
c::FMU2Component
: Argumentc
is a Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
Keywords
soft::Bool=false
: If the Keywordsoft = true
the command is only performed if the FMU is in an allowed state for this command.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: 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
.
FMICore.fmi3ActivateModelPartition
— MethodSource: FMISpec3.0, Version D5ef1c1: 5.2.2. State: Clock Activation Mode
During Clock Activation Mode (see 5.2.2.) after fmi3ActivateModelPartition has been called for a calculated, tunable or changing Clock the FMU provides the information on when the Clock will tick again, i.e. when the corresponding model partition has to be scheduled the next time.
Each fmi3ActivateModelPartition call is associated with the computation of an exposed model partition of the FMU and therefore to an input Clock.
FMICore.fmi3CompletedIntegratorStep!
— MethodSource: FMISpec3.0, Version D5ef1c1: 3.2.1. State: Continuous-Time Mode
This function must be called by the environment after every completed step of the integrator provided the capability flag needsCompletedIntegratorStep = true. If enterEventMode == fmi3True, the event mode must be entered If terminateSimulation == fmi3True, the simulation shall be terminated
FMICore.fmi3DeSerializeFMUState!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.4. Getting and Setting the Complete FMU State
fmi3DeSerializeFMUstate deserializes the byte vector serializedState of length size, constructs a copy of the FMU state and returns FMUstate, the pointer to this copy.
FMICore.fmi3DoStep!
— MethodSource: FMISpec3.0, Version D5ef1c1: 4.2.1. State: Step Mode
The computation of a time step is started.
FMICore.fmi3EnterConfigurationMode
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.2. State: Instantiated
If the importer needs to change structural parameters, it must move the FMU into Configuration Mode using fmi3EnterConfigurationMode.
FMICore.fmi3EnterContinuousTimeMode
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.5. State: Event Mode
The model enters Continuous-Time Mode and all discrete-time equations become inactive and all relations are “frozen”. This function has to be called when changing from Event Mode (after the global event iteration in Event Mode over all involved FMUs and other models has converged) into Continuous-Time Mode.
FMICore.fmi3EnterEventMode
— MethodSource: FMISpec3.0, Version D5ef1c1: 3.2.1. State: Continuous-Time Mode
The model enters Event Mode.
For more information call ?fmi3EnterEventMode
FMICore.fmi3EnterEventMode
— MethodSource: FMISpec3.0, Version D5ef1c1: 3.2.1. State: Continuous-Time Mode
The model enters Event Mode from the Continuous-Time Mode in ModelExchange oder Step Mode in CoSimulation and discrete-time equations may become active (and relations are not “frozen”).
FMICore.fmi3EnterInitializationMode
— FunctionSource: FMISpec3.0, Version D5ef1c1: 2.3.2. State: Instantiated
FMU enters Initialization mode.
For more information call ?fmi3EnterInitializationMode
FMICore.fmi3EnterInitializationMode
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.2. State: Instantiated
Informs the FMU to enter Initialization Mode. Before calling this function, all variables with attribute <Datatype initial = "exact" or "approx"> can be set with the “fmi3SetXXX” functions (the ScalarVariable attributes are defined in the Model Description File, see section 2.4.7). Setting other variables is not allowed. Also sets the simulation start and stop time.
FMICore.fmi3EnterStepMode
— MethodSource: 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.).
FMICore.fmi3EvaluateDiscreteStates
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.3. State: Initialization Mode
This function is called to trigger the evaluation of fdisc to compute the current values of discrete states from previous values. The FMU signals the support of fmi3EvaluateDiscreteStates via the capability flag providesEvaluateDiscreteStates.
FMICore.fmi3ExitConfigurationMode
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.6. State: Configuration Mode
Exits the Configuration Mode and returns to state Instantiated.
FMICore.fmi3ExitInitializationMode
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.3. State: Initialization Mode
Informs the FMU to exit Initialization Mode.
FMICore.fmi3FreeFMUState!
— Methodfunction fmi3FreeFMUState(c::FMU3Instance, FMUstate::Ref{fmi3FMUState})
Free the allocated memory for the FMU state.
For more information call ?fmi3FreeFMUstate
FMICore.fmi3FreeFMUState!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.4. Getting and Setting the Complete FMU State
fmi3FreeFMUstate frees all memory and other resources allocated with the fmi3GetFMUstate call for this FMUstate.
FMICore.fmi3FreeInstance!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.1. Super State: FMU State Setable
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 argument instance, the function call is ignored (does not have an effect).
FMICore.fmi3GetAdjointDerivative!
— FunctionSource: FMISpec3.0, Version D5ef1c1: 2.2.11. Getting Partial Derivatives
Computes adjoint derivatives.
For more information call ?fmi3GetAdjointDerivative
FMICore.fmi3GetAdjointDerivative!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.11. Getting Partial Derivatives
This function computes the adjoint derivatives v^T{sensitivity}= v^T{seed} ⋅ J of an FMU.
unknowns - contains value references to the unknowns.
nUnknowns - contains the length of argument unknowns.
knowns - contains value references of the knowns.
nKnowns - contains the length of argument knowns.
seed - contains the components of the seed vector.
nSeed - contains the length of seed.
sensitivity - contains the components of the sensitivity vector.
nSensitivity - contains the length of sensitivity.
This function can only be called if the 'ProvidesAdjointDerivatives' tag in the ModelDescription is set.
FMICore.fmi3GetBinary!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValues - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetBinary!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Binary variables.
For more information call ?fmi3GetBinary!
FMICore.fmi3GetBoolean!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetBoolean!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Boolean variables.
For more information call ?fmi3GetBoolean!
FMICore.fmi3GetClock!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetClock!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Clock variables.
For more information call ?fmi3GetClock!
FMICore.fmi3GetContinuousStateDerivatives
— MethodSource: FMISpec3.0, Version D5ef1c1: 3.2.1. State: Continuous-Time Mode
Compute first-oder state derivatives at the current time instant and for the current states.
FMICore.fmi3GetContinuousStateDerivatives
— MethodSource: FMISpec3.0, Version D5ef1c1: 3.2.1. State: Continuous-Time Mode
Compute state derivatives at the current time instant and for the current states.
For more information call ?fmi3GetContinuousDerivatives
FMICore.fmi3GetContinuousStates!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.3. State: Initialization Mode
Return the states at the current time instant.
This function must be called if fmi3UpdateDiscreteStates returned with valuesOfContinuousStatesChanged == fmi3True. Not allowed in Co-Simulation and Scheduled Execution.
FMICore.fmi3GetDirectionalDerivative!
— FunctionSource: FMISpec3.0, Version D5ef1c1: 2.2.11. Getting Partial Derivatives
Computes directional derivatives.
For more information call ?fmi3GetDirectionalDerivative
FMICore.fmi3GetDirectionalDerivative!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.11. Getting Partial Derivatives
This function computes the directional derivatives v{sensitivity} = J ⋅ v{seed} of an FMU.
unknowns - contains value references to the unknowns.
nUnknowns - contains the length of argument unknowns.
knowns - contains value references of the knowns.
nKnowns - contains the length of argument knowns.
seed - contains the components of the seed vector.
nSeed - contains the length of seed.
sensitivity - contains the components of the sensitivity vector.
nSensitivity - contains the length of sensitivity.
This function can only be called if the 'ProvidesDirectionalDerivatives' tag in the ModelDescription is set.
FMICore.fmi3GetEventIndicators!
— MethodSource: FMISpec3.0, Version D5ef1c1: 3.2.1. State: Continuous-Time Mode
Compute event indicators at the current time instant and for the current states. EventIndicators signal Events by their sign change.
FMICore.fmi3GetFMUState!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.4. Getting and Setting the Complete FMU State
fmi3GetFMUstate makes a copy of the internal FMU state and returns a pointer to this copy
FMICore.fmi3GetFloat32!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetFloat32!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Float32 variables.
For more information call ?fmi3GetFloat32!
FMICore.fmi3GetFloat64!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetFloat64!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Float64 variables.
For more information call ?fmi3GetFloat64!
FMICore.fmi3GetInt16!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetInt16!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Int16 variables.
For more information call ?fmi3GetInt16!
FMICore.fmi3GetInt32!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetInt32!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Int32 variables.
For more information call ?fmi3GetInt32!
FMICore.fmi3GetInt64!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetInt64!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Int64 variables.
For more information call ?fmi3GetInt64!
FMICore.fmi3GetInt8!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetInt8!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Int8 variables.
For more information call ?fmi3GetInt8!
FMICore.fmi3GetIntervalDecimal!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.9. Clocks
fmi3GetIntervalDecimal retrieves the interval until the next clock tick.
For input Clocks it is allowed to call this function to query the next activation interval. For changing aperiodic Clock, this function must be called in every Event Mode where this clock was activated. For countdown aperiodic Clock, this function must be called in every Event Mode. Clock intervals are computed in fmi3UpdateDiscreteStates (at the latest), therefore, this function should be called after fmi3UpdateDiscreteStates. For information about fmi3IntervalQualifiers, call ?fmi3IntervalQualifier
FMICore.fmi3GetIntervalFraction!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.9. Clocks
fmi3GetIntervalFraction retrieves the interval until the next clock tick.
For input Clocks it is allowed to call this function to query the next activation interval. For changing aperiodic Clock, this function must be called in every Event Mode where this clock was activated. For countdown aperiodic Clock, this function must be called in every Event Mode. Clock intervals are computed in fmi3UpdateDiscreteStates (at the latest), therefore, this function should be called after fmi3UpdateDiscreteStates. For information about fmi3IntervalQualifiers, call ?fmi3IntervalQualifier
FMICore.fmi3GetNominalsOfContinuousStates!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.3. State: Initialization Mode
Return the nominal values of the continuous states.
If fmi3UpdateDiscreteStates returned with nominalsOfContinuousStatesChanged == fmi3True, then at least one nominal value of the states has changed and can be inquired with fmi3GetNominalsOfContinuousStates. Not allowed in Co-Simulation and Scheduled Execution.
FMICore.fmi3GetNumberOfContinuousStates!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.2. State: Instantiated
This function returns the number of continuous states. This function can only be called in Model Exchange.
fmi3GetNumberOfContinuousStates must be called after a structural parameter is changed. As long as no structural parameters changed, the number of states is given in the modelDescription.xml, alleviating the need to call this function.
FMICore.fmi3GetNumberOfEventIndicators!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.2. State: Instantiated
This function returns the number of event indicators. This function can only be called in Model Exchange.
fmi3GetNumberOfEventIndicators must be called after a structural parameter is changed. As long as no structural parameters changed, the number of states is given in the modelDescription.xml, alleviating the need to call this function.
FMICore.fmi3GetOutputDerivatives!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.12. Getting Derivatives of Continuous Outputs
Retrieves the n-th derivative of output values.
valueReferences - is a vector of value references that define the variables whose derivatives shall be retrieved. If multiple derivatives of a variable shall be retrieved, list the value reference multiple times.
nValueReferences - is the dimension of the arguments valueReferences and orders.
orders - contains the orders of the respective derivative (1 means the first derivative, 2 means the second derivative, …, 0 is not allowed). If multiple derivatives of a variable shall be retrieved, provide a list of them in the orders array, corresponding to a multiply occurring value reference in the valueReferences array. The highest order of derivatives retrievable can be determined by the 'maxOutputDerivativeOrder' tag in the ModelDescription.
values - is a vector with the values of the derivatives. The order of the values elements is derived from a twofold serialization: the outer level corresponds to the combination of a value reference (e.g., valueReferences[k]) and order (e.g., orders[k]), and the inner level to the serialization of variables as defined in Section 2.2.6.1. The inner level does not exist for scalar variables.
nValues - is the size of the argument values. nValues only equals nValueReferences if all corresponding output variables are scalar variables.
FMICore.fmi3GetShiftDecimal!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.9. Clocks
fmi3GetShiftDecimal retrieves the delay to the first Clock tick from the FMU.
FMICore.fmi3GetShiftFraction!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.9. Clocks
fmi3GetShiftFraction retrieves the delay to the first Clock tick from the FMU.
FMICore.fmi3GetString!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetString!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3String variables.
For more information call ?fmi3GetString!
FMICore.fmi3GetUInt16!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetUInt16!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3UInt16 variables.
For more information call ?fmi3GetUInt16!
FMICore.fmi3GetUInt32!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetUInt32!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3UInt32 variables.
For more information call ?fmi3GetUInt32!
FMICore.fmi3GetUInt64!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetUInt64!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3UInt64 variables.
For more information call ?fmi3GetUInt64!
FMICore.fmi3GetUInt8!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3GetUInt8!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3UInt8 variables.
For more information call ?fmi3GetUInt8!
FMICore.fmi3GetVariableDependencies!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.10. Dependencies of Variables
The actual dependencies (of type dependenciesKind) can be retrieved by calling the function fmi3GetVariableDependencies:
dependent - specifies the valueReference of the variable for which the dependencies should be returned.
nDependencies - specifies the number of dependencies that the calling environment allocated space for in the result buffers, and should correspond to value obtained by calling fmi3GetNumberOfVariableDependencies.
elementIndicesOfDependent - must point to a buffer of size_t values of size nDependencies allocated by the calling environment. It is filled in by this function with the element index of the dependent variable that dependency information is provided for. The element indices start with 1. Using the element index 0 means all elements of the variable. (Note: If an array has more than one dimension the indices are serialized in the same order as defined for values in Section 2.2.6.1.)
independents - must point to a buffer of fmi3ValueReference values of size nDependencies allocated by the calling environment. It is filled in by this function with the value reference of the independent variable that this dependency entry is dependent upon.
elementIndicesIndependents - must point to a buffer of size_t values of size nDependencies allocated by the calling environment. It is filled in by this function with the element index of the independent variable that this dependency entry is dependent upon. The element indices start with 1. Using the element index 0 means all elements of the variable. (Note: If an array has more than one dimension the indices are serialized in the same order as defined for values in Section 2.2.6.1.)
dependencyKinds - must point to a buffer of dependenciesKind values of size nDependencies allocated by the calling environment. It is filled in by this function with the enumeration value describing the dependency of this dependency entry. For more information about dependenciesKinds, call ?fmi3DependencyKind
If this function is called before the fmi3ExitInitializationMode call, it returns the initial dependencies. If this function is called after the fmi3ExitInitializationMode call, it returns the runtime dependencies. The retrieved dependency information of one variable becomes invalid as soon as a structural parameter linked to the variable or to any of its depending variables are set. As a consequence, if you change structural parameters affecting B or A, the dependency of B becomes invalid. The dependency information must change only if structural parameters are changed.
This information can only be retrieved if the 'providesPerElementDependencies' tag in the ModelDescription is set.
FMICore.fmi3GetVersion
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.4. Inquire Version Number of Header Files
This function returns fmi3Version of the fmi3Functions.h header file which was used to compile the functions of the FMU. This function call is allowed always and in all interface types.
The standard header file as documented in this specification has version "3.0-beta.2", so this function returns "3.0-beta.2".
FMICore.fmi3Reset
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.1. Super State: FMU State Setable
Is called by the environment to reset the FMU after a simulation run. The FMU goes into the same state as if fmi3InstantiateXXX would have been called.
FMICore.fmi3SerializeFMUState!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.4. Getting and Setting the Complete FMU State
fmi3SerializeFMUstate serializes the data which is referenced by pointer FMUstate and copies this data in to the byte vector serializedState of length size
FMICore.fmi3SerializedFMUStateSize!
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.4. Getting and Setting the Complete FMU State
fmi3SerializedFMUstateSize returns the size of the byte vector which is needed to store FMUstate in it.
FMICore.fmi3SetBinary
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetBinary
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3Binary variables.
For more information call ?fmi3SetBinary
FMICore.fmi3SetBoolean
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetBoolean
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3Boolean variables.
For more information call ?fmi3SetBoolean
FMICore.fmi3SetClock
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetClock
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3Clock variables.
For more information call ?fmi3SetClock
FMICore.fmi3SetContinuousStates
— MethodSource: FMISpec3.0, Version D5ef1c1: 3.2.1. State: Continuous-Time Mode
Set a new (continuous) state vector and re-initialize caching of variables that depend on the states. Argument nx is the length of vector x and is provided for checking purposes
FMICore.fmi3SetContinuousStates
— MethodSource: FMISpec3.0, Version D5ef1c1: 3.2.1. State: Continuous-Time Mode
Set a new (continuous) state vector and reinitialize chaching of variables that depend on states.
For more information call ?fmi3SetContinuousStates
FMICore.fmi3SetDebugLogging
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.1. Super State: FMU State Setable
The function controls debug logging that is output via the logger function callback. If loggingOn = fmi3True, debug logging is enabled, otherwise it is switched off.
FMICore.fmi3SetDebugLogging
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.1. Super State: FMU State Setable
Set the DebugLogger for the FMU.
FMICore.fmi3SetFMUState
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.4. Getting and Setting the Complete FMU State
fmi3SetFMUstate copies the content of the previously copied FMUstate back and uses it as actual new FMU state.
FMICore.fmi3SetFloat32
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetFloat32
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3Float32 variables.
For more information call ?fmi3SetFloat32
FMICore.fmi3SetFloat64
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetFloat64
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3Float64 variables.
For more information call ?fmi3SetFloat64
FMICore.fmi3SetInt16
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetInt16
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3Int16 variables.
For more information call ?fmi3SetInt16
FMICore.fmi3SetInt32
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetInt32
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3Int32 variables.
For more information call ?fmi3SetInt32
FMICore.fmi3SetInt64
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetInt64
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3Int64 variables.
For more information call ?fmi3SetInt64
FMICore.fmi3SetInt8
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetInt8
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3Int8 variables.
For more information call ?fmi3SetInt8
FMICore.fmi3SetIntervalFraction
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.9. Clocks
fmi3SetIntervalFraction sets the interval until the next clock tick Only allowed if the attribute 'supportsFraction' is set.
FMICore.fmi3SetString
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetString
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3String variables.
For more information call ?fmi3SetString
FMICore.fmi3SetTime
— MethodSource: FMISpec3.0, Version D5ef1c1: 3.2.1. State: Continuous-Time Mode
Set a new time instant and re-initialize caching of variables that depend on time, provided the newly provided time value is different to the previously set time value (variables that depend solely on constants or parameters need not to be newly computed in the sequel, but the previously computed values can be reused).
FMICore.fmi3SetTime
— MethodSource: FMISpec3.0, Version D5ef1c1: 3.2.1. State: Continuous-Time Mode
Set independent variable time and reinitialize chaching of variables that depend on time.
For more information call ?fmi3SetTime
FMICore.fmi3SetUInt16
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetUInt16
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3UInt16 variables.
For more information call ?fmi3SetUInt16
FMICore.fmi3SetUInt32
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetUInt32
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3UInt32 variables.
For more information call ?fmi3SetUInt32
FMICore.fmi3SetUInt64
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetUInt64
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3UInt64 variables.
For more information call ?fmi3SetUInt64
FMICore.fmi3SetUInt8
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Functions to get and set values of variables idetified by their valueReference.
nValue - is different from nvr if the value reference represents an array and therefore are more values tied to a single value reference.
FMICore.fmi3SetUInt8
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Set the values of an array of fmi3UInt8 variables.
For more information call ?fmi3SetUInt8
FMICore.fmi3Terminate
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.4. Super State: Initialized
Informs the FMU that the simulation run is terminated.
FMICore.fmi3UpdateDiscreteStates
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.5. State: Event Mode
This function is called to signal a converged solution at the current super-dense time instant. fmi3UpdateDiscreteStates must be called at least once per super-dense time instant.
FMICore.fmi3UpdateDiscreteStates
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.5. State: Event Mode
This function is called to signal a converged solution at the current super-dense time instant. fmi3UpdateDiscreteStates must be called at least once per super-dense time instant.
For more information call ?fmi3UpdateDiscreteStates
FMIImport.fmi2CallbackAllocateMemory
— MethodSource: FMISpec2.0.2[p.21-22]: 2.1.5 Creation, Destruction and Logging of FMU Instances
Function that is called in the FMU if memory needs to be allocated. If attribute “canNotUseMemoryManagementFunctions = true” in <fmiModelDescription><ModelExchange / CoSimulation>, then function allocateMemory is not used in the FMU and a void pointer can be provided. If this attribute has a value of “false” (which is the default), the FMU must not use malloc, calloc or other memory allocation functions. One reason is that these functions might not be available for embedded systems on the target machine. Another reason is that the environment may have optimized or specialized memory allocation functions. allocateMemory returns a pointer to space for a vector of nobj objects, each of size “size” or NULL, if the request cannot be satisfied. The space is initialized to zero bytes [(a simple implementation is to use calloc from the C standard library)].
FMIImport.fmi2CallbackFreeMemory
— MethodSource: FMISpec2.0.2[p.22]: 2.1.5 Creation, Destruction and Logging of FMU Instances
Function that must be called in the FMU if memory is freed that has been allocated with allocateMemory. If a null pointer is provided as input argument obj, the function shall perform no action [(a simple implementation is to use free from the C standard library; in ANSI C89 and C99, the null pointer handling is identical as defined here)]. If attribute “canNotUseMemoryManagementFunctions = true” in <fmiModelDescription><ModelExchange / CoSimulation>, then function freeMemory is not used in the FMU and a null pointer can be provided.
FMIImport.fmi2CallbackLogger
— MethodSource: FMISpec2.0.2[p.21]: 2.1.5 Creation, Destruction and Logging of FMU Instances
Function that is called in the FMU, usually if an fmi2XXX function, does not behave as desired. If “logger” is called with “status = fmi2OK”, then the message is a pure information message. “instanceName” is the instance name of the model that calls this function. “category” is the category of the message. The meaning of “category” is defined by the modeling environment that generated the FMU. Depending on this modeling environment, none, some or all allowed values of “category” for this FMU are defined in the modelDescription.xml file via element “<fmiModelDescription><LogCategories>”, see section 2.2.4. Only messages are provided by function logger that have a category according to a call to fmi2SetDebugLogging (see below). Argument “message” is provided in the same way and with the same format control as in function “printf” from the C standard library. [Typically, this function prints the message and stores it optionally in a log file.]
FMIImport.fmi2CallbackStepFinished
— MethodSource: FMISpec2.0.2[p.22]: 2.1.5 Creation, Destruction and Logging of FMU Instances
Optional call back function to signal if the computation of a communication step of a co-simulation slave is finished. A null pointer can be provided. In this case the master must use fmiGetStatus(..) to query the status of fmi2DoStep. If a pointer to a function is provided, it must be called by the FMU after a completed communication step.
FMIImport.fmi2CanGetSetState
— Methodfmi2CanGetSetState(fmu::FMU2)
Returns true, if the FMU supports the getting/setting of states
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
::Bool
: Returns true, if the FMU supports the getting/setting of states.
FMIImport.fmi2CanGetSetState
— Methodfmi2CanGetSetState(md::fmi2ModelDescription)
Returns true, if the FMU supports the getting/setting of states
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
::Bool
: Returns true, if the FMU supports the getting/setting of states.
FMIImport.fmi2CanSerializeFMUstate
— Methodfmi2CanSerializeFMUstate(fmu::FMU2)
Returns true, if the FMU state can be serialized
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
::Bool
: Returns true, if the FMU state can be serialized
FMIImport.fmi2CanSerializeFMUstate
— Methodfmi2CanSerializeFMUstate(md::fmi2ModelDescription)
Returns true, if the FMU state can be serialized
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
::Bool
: Returns true, if the FMU state can be serialized
FMIImport.fmi2CompletedIntegratorStep
— MethodfmiCompletedIntegratorStep(c::FMU2Component, noSetFMUStatePriorToCurrentPoint::fmi2Boolean)
This function must be called by the environment after every completed step
Arguments
C::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.noSetFMUStatePriorToCurrentPoint::fmi2Boolean
: ArgumentnoSetFMUStatePriorToCurrentPoint = fmi2True
iffmi2SetFMUState
will no longer be called for time instants prior to current time in this simulation run.
Returns
status::fmi2Status
: Returnstatus
is an enumeration of typefmi2Status
and indicates the success of the function call.
More detailed:
fmi2OK
: all wellfmi2Warning
: things are not quite right, but the computation can continuefmi2Discard
: if the slave computed successfully only a subinterval of the communication stepfmi2Error
: the communication step could not be carried out at allfmi2Fatal
: if an error occurred which corrupted the FMU irreparablyfmi2Pending
: this status is returned if the slave executes the function asynchronouslyenterEventMode::Array{fmi2Boolean, 1}
: ReturnsenterEventMode[1]
to signal to the environment if the FMU shall callfmi2EnterEventMode
terminateSimulation::Array{fmi2Boolean, 1}
: ReturnsterminateSimulation[1]
to signal if the simulation shall be terminated.
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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2CompletedIntegratorStep
, fmi2SetFMUState
.
FMIImport.fmi2DeSerializeFMUstate
— Methodfmi2DeSerializeFMUstate(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}
: ArgumentserializedState
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
.
FMIImport.fmi2DependenciesSupported
— Methodfmi2DependenciesSupported(md::fmi2ModelDescription)
Returns true if the FMU model description contains dependency
information.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
::Bool
: Returns true, if the FMU model description containsdependency
information.
FMIImport.fmi2DerivativeDependenciesSupported
— Methodfmi2DerivativeDependenciesSupported(md::fmi2ModelDescription)
Returns if the FMU model description contains dependency
information for derivatives
.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
::Bool
: Returns true, if the FMU model description containsdependency
information forderivatives
.
FMIImport.fmi2GetBoolean
— Methodfmi2GetBoolean(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
: Argumentvr
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}
: Returnvalues
is an array with the actual values of these variables.
See also fmi2GetBoolean!
.
FMIImport.fmi2GetContinuousStates
— Methodfmi2GetContinuousStates(c::FMU2Component)
Return the new (continuous) state vector x
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
Returns
x::Array{fmi2Real}
: Returns an array offmi2Real
values representing the new continuous state vectorx
.
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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2GetEventIndicators
.
FMIImport.fmi2GetDefaultStartTime
— Methodfmi2GetDefaultStartTime(md::fmi2ModelDescription)
Returns startTime from DefaultExperiment if defined else defaults to nothing.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
md.defaultExperiment.startTime::Union{Real,Nothing}
: Returns a real valuestartTime
from the DefaultExperiment if defined else defaults tonothing
.
FMIImport.fmi2GetDefaultStepSize
— Methodfmi2GetDefaultStepSize(md::fmi2ModelDescription)
Returns stepSize from DefaultExperiment if defined else defaults to nothing.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
md.defaultExperiment.stepSize::Union{Real,Nothing}
: Returns a real valuesetpSize
from the DefaultExperiment if defined else defaults tonothing
.
FMIImport.fmi2GetDefaultStopTime
— Methodfmi2GetDefaultStopTime(md::fmi2ModelDescription)
Returns stopTime from DefaultExperiment if defined else defaults to nothing.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
md.defaultExperiment.stopTime::Union{Real,Nothing}
: Returns a real valuestopTime
from the DefaultExperiment if defined else defaults tonothing
.
FMIImport.fmi2GetDefaultTolerance
— Methodfmi2GetDefaultTolerance(md::fmi2ModelDescription)
Returns tolerance from DefaultExperiment if defined else defaults to nothing.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
md.defaultExperiment.tolerance::Union{Real,Nothing}
: Returns a real valuetolerance
from the DefaultExperiment if defined else defaults tonothing
.
FMIImport.fmi2GetDerivateValueReferencesAndNames
— Methodfmi2GetDerivateValueReferencesAndNames(md::fmi2ModelDescription)
fmi2GetDerivateValueReferencesAndNames(fmu::FMU2)
Returns a dictionary Dict(fmi2ValueReference, Array{String})
of derivative value references and their corresponding names
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
dict::Dict{fmi2ValueReference, Array{String}}
: Returns a dictionary that constructs a hash table with keys of type fmi2ValueReference and values of type Array{String}. So returns a dict with (vrs, names of derivatives)
See also 'fmi2GetValueReferencesAndNames'
FMIImport.fmi2GetDerivativeNames
— Methodfmi2GetDerivativeNames(md::fmi2ModelDescription; vrs=md.derivativeValueReferences, mode=:first)
fmi2GetDerivativeNames(fmu::FMU2; vrs=md.derivativeValueReferences, mode=:first)
Returns names of derivatives
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Keywords
vrs=md.derivativeValueReferences
: Additional attributederivativeValueReferences::Array{fmi2ValueReference}
of the Model Description that is a handle to a (base type) variable value. Handle and base type uniquely identify the value of a variable. (default =md.derivativeValueReferences::Array{fmi2ValueReference}
)mode=:first
: If there are multiple names per value reference, availabel modes are:first
(default, pick only the first one),:group
(pick all and group them into an array) and:flat
(pick all, but flat them out into a 1D-array together with all other names)
Returns
names::Array{String}
: Returns a array of names corresponding to parameter value referencesvrs
See also 'fmi2GetNames'.
FMIImport.fmi2GetDerivatives
— Methodfmi2GetDerivatives(c::FMU2Component)
Compute state derivatives at the current time instant and for the current states.
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
Returns
derivatives::Array{fmi2Real}
: Returns an array offmi2Real
values representing thederivatives
for the current states. The ordering of the elements of the derivatives vector is identical to the ordering of the state
vector.
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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2GetDerivatives
.
FMIImport.fmi2GetDirectionalDerivative
— Functionfmi2GetDirectionalDerivative(c::FMU2Component, vUnknownref::AbstractArray{fmi2ValueReference}, vKnownref::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
ordiscrete
. If<ModelStructure><Derivatives>
is present, also the variables listed here as state derivatives.
- Initialization Mode: unkowns kisted under
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}
: ArgumentvUnknown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vUnknown_ref
can be equated withv_unknown
(variable described above).vKnown_ref::AbstractArray{fmi2ValueReference}
: ArgumentvKnown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vKnown_ref
can be equated withv_known
(variable described above).dvKnown::Union{AbstractArray{fmi2Real}, Nothing} = nothing
: If no seed vector is passed the valuenothing
is used. The vector values Compute the partial derivative with respect to the given entries in vectorvKnown_ref
with the matching evaluate ofdvKnown
. # gehört das zu den v_rest values
Returns
dvUnknown::Array{fmi2Real}
: ReturndvUnknown
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
.
FMIImport.fmi2GetDirectionalDerivative
— Functionfmi2GetDirectionalDerivative(c::FMU2Component, vUnknownref::fmi2ValueReference, vKnownref::fmi2ValueReference, dvKnown::fmi2Real = 1.0)
Direct function call to compute the partial derivative with respect to 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
ordiscrete
. If<ModelStructure><Derivatives>
is present, also the variables listed here as state derivatives.
- Initialization Mode: unkowns kisted under
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::fmi2ValueReference
: ArgumentvUnknown_ref
contains a value of typefmi2ValueReference
which is an identifier of a variable value of the model.vUnknown_ref
can be equated withv_unknown
(variable described above).vKnown_ref::fmi2ValueReference
: ArgumentvKnown_ref
contains a value of typefmi2ValueReference
which is an identifier of a variable value of the model.vKnown_ref
can be equated withv_known
(variable described above).dvKnown::fmi2Real = 1.0
: If no seed value is passed the valuedvKnown = 1.0
is used. Compute the partial derivative with respect tovKnown_ref
with the valuedvKnown = 1.0
. # gehört das zu den v_rest values
Returns
dvUnknown::Array{fmi2Real}
: ReturndvUnknown
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
.
FMIImport.fmi2GetEventIndicators
— Methodfmi2GetEventIndicators(c::FMU2Component)
Returns the event indicators of the FMU
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
Returns
eventIndicators::Array{fmi2Real}
:The event indicators are returned as a vector represented by an array of "fmi2Real" 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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2GetEventIndicators
.
FMIImport.fmi2GetFMUstate
— Methodfmi2GetFMUstate(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
.
FMIImport.fmi2GetFullJacobian!
— Methodfmi2GetFullJacobian!(jac::AbstractMatrix{fmi2Real},
comp::FMU2Component,
rdx::AbstractArray{fmi2ValueReference},
rx::AbstractArray{fmi2ValueReference};
steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing)
Fills the jacobian over the FMU fmu
for FMU value references rdx
and rx
, so that the function returns the jacobian ∂rdx / ∂rx.
If FMI built-in directional derivatives are supported, they are used. As fallback, directional derivatives will be sampled with central differences. No performance optimization, for an optimized version use fmi2GetJacobian!
.
Arguments
jac::AbstractMatrix{fmi2Real}
: Stores the the jacobian ∂rdx / ∂rx.comp::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.rdx::AbstractArray{fmi2ValueReference}
: ArgumentvUnknown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.rx::AbstractArray{fmi2ValueReference}
: ArgumentvKnown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.
Keywords
steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing)
: If sampling is used, sampling step size can be set (for each direction individually) using optional argumentsteps
.
Returns
nothing
FMIImport.fmi2GetFullJacobian
— Methodfmi2GetFullJacobian(comp::FMU2Component, rdx::AbstractArray{fmi2ValueReference}, rx::AbstractArray{fmi2ValueReference}; steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing)
Builds the jacobian over the FMU fmu
for FMU value references rdx
and rx
, so that the function returns the jacobian ∂rdx / ∂rx.
If FMI built-in directional derivatives are supported, they are used. As fallback, directional derivatives will be sampled with central differences. No performance optimization, for an optimized version use fmi2GetJacobian
.
Arguments
comp::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.rdx::AbstractArray{fmi2ValueReference}
: ArgumentvUnknown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.rx::AbstractArray{fmi2ValueReference}
: ArgumentvKnown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.
Keywords
steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing)
: If sampling is used, sampling step size can be set (for each direction individually) using optional argumentsteps
.
Returns
mat::Array{fmi2Real}
: Returnmat
contains the jacobian ∂rdx / ∂rx.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
See also fmi2GetFullJacobian!
FMIImport.fmi2GetGUID
— Methodfmi2GetGUID(fmu::FMU2)
Returns the tag 'guid' from the model description.
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
fmu.modelDescription.guid::String
: Returns the tag 'guid' from the model description.
FMIImport.fmi2GetGUID
— Methodfmi2GetGUID(md::fmi2ModelDescription)
Returns the tag 'guid' from the model description.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
md.guid::String
: Returns the tag 'guid' from the model description.
FMIImport.fmi2GetGenerationDateAndTime
— Methodfmi2GetGenerationDateAndTime(fmu::FMU2)
Returns the tag 'generationdateandtime' from the model description.
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
fmu.modelDescription.generationDateAndTime::DateTime
: Returns the tag 'generationdateandtime' from the model description.
FMIImport.fmi2GetGenerationDateAndTime
— Methodfmi2GetGenerationDateAndTime(md::fmi2ModelDescription)
Returns the tag 'generationdateandtime' from the model description.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
md.generationDateAndTime::DateTime
: Returns the tag 'generationdateandtime' from the model description.
FMIImport.fmi2GetGenerationTool
— Methodfmi2GetGenerationTool(fmu::FMU2)
Returns the tag 'generationtool' from the model description.
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
fmu.modelDescription.generationTool::Union{String, Nothing}
: Returns the tag 'generationtool' from the model description.
FMIImport.fmi2GetGenerationTool
— Methodfmi2GetGenerationTool(md::fmi2ModelDescription)
Returns the tag 'generationtool' from the model description.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
md.generationTool::Union{String, Nothing}
: Returns the tag 'generationtool' from the model description.
FMIImport.fmi2GetInitial
— Methodfmi2GetInitial(mv::fmi2ScalarVariable)
Returns the inital
entry of the corresponding model variable.
Arguments
fmi2GetStartValue(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.
Returns
mv._Real.unit
: Returns theinital
entry of the corresponding ScalarVariable representing a variable of the primitive type Real. Otherwisenothing
is returned.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
FMIImport.fmi2GetInputNames
— Methodfmi2GetInputNames(md::fmi2ModelDescription; vrs=md.inputvalueReferences, mode=:first)
fmi2GetInputNames(fmu::FMU2; vrs=md.inputValueReferences, mode=:first)
Returns names of inputs
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Keywords
vrs=md.inputvalueReferences
: Additional attributeinputvalueReferences::Array{fmi2ValueReference}
of the Model Description that is a handle to a (base type) variable value. Handle and base type uniquely identify the value of a variable. (default =md.valueReferences::Array{fmi2ValueReference}
)mode=:first
: If there are multiple names per value reference, availabel modes are:first
(default, pick only the first one),:group
(pick all and group them into an array) and:flat
(pick all, but flat them out into a 1D-array together with all other names)
Returns
names::Array{String}
: Returns a array of names corresponding to value referencesvrs
FMIImport.fmi2GetInputNamesAndStarts
— Methodfmi2GetInputNamesAndStarts(md::fmi2ModelDescription)
fmi2GetInputNamesAndStarts(fmu::FMU2)
Returns a dictionary of input variables with their starting values
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
dict::Dict{String, Array{fmi2ValueReferenceFormat}}
: Returns a dictionary that constructs a hash table with keys of type String and values of type fmi2ValueReferenceFormat. So returns a dict with (md.modelVariables[i].name::String
,starts:: Array{fmi2ValueReferenceFormat}
). (Creates a tuple (name, starts) for each i in inputIndices)
See also 'fmi2GetStartValue'.
FMIImport.fmi2GetInputValueReferencesAndNames
— Methodfmi2GetInputValueReferencesAndNames(md::fmi2ModelDescription)
fmi2GetInputValueReferencesAndNames(fmu::FMU2)
Returns a dict with (vrs, names of inputs)
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
dict::Dict{fmi2ValueReference, Array{String}}
: Returns a dictionary that constructs a hash table with keys of type fmi2ValueReference and values of type Array{String}. So returns a dict with (vrs, names of inputs)
FMIImport.fmi2GetInteger
— Methodfmi2GetInteger(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
: Argumentvr
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}
: Returnvalues
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!
FMIImport.fmi2GetJacobian!
— Methodfunction fmi2GetJacobian!(jac::AbstractMatrix{fmi2Real},
comp::FMU2Component,
rdx::AbstractArray{fmi2ValueReference},
rx::AbstractArray{fmi2ValueReference};
steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing)
Fills the jacobian over the FMU fmu
for FMU value references rdx
and rx
, so that the function stores the jacobian ∂rdx / ∂rx in an AbstractMatrix jac
.
If FMI built-in directional derivatives are supported, they are used. As fallback, directional derivatives will be sampled with central differences. For optimization, if the FMU's model description has the optional entry 'dependencies', only dependent variables are sampled/retrieved. This drastically boosts performance for systems with large variable count (like CFD).
Arguments
jac::AbstractMatrix{fmi2Real}
: Stores the the jacobian ∂rdx / ∂rx.comp::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.rdx::AbstractArray{fmi2ValueReference}
: ArgumentvUnknown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.rx::AbstractArray{fmi2ValueReference}
: ArgumentvKnown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.
Keywords
steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing)
: If sampling is used, sampling step size can be set (for each direction individually) using optional argumentsteps
.
Returns
nothing
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
FMIImport.fmi2GetJacobian
— Methodfmi2GetJacobian(comp::FMU2Component,
rdx::AbstractArray{fmi2ValueReference},
rx::AbstractArray{fmi2ValueReference};
steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing)
Builds the jacobian over the FMU fmu
for FMU value references rdx
and rx
, so that the function returns the jacobian ∂rdx / ∂rx.
If FMI built-in directional derivatives are supported, they are used. As fallback, directional derivatives will be sampled with central differences. For optimization, if the FMU's model description has the optional entry 'dependencies', only dependent variables are sampled/retrieved. This drastically boosts performance for systems with large variable count (like CFD).
Arguments
comp::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.rdx::AbstractArray{fmi2ValueReference}
: ArgumentvUnknown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.rx::AbstractArray{fmi2ValueReference}
: ArgumentvKnown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.
Keywords
steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing)
: If sampling is used, sampling step size can be set (for each direction individually) using optional argumentsteps
.
Returns
mat::Array{fmi2Real}
: Returnmat
contains the jacobian ∂rdx / ∂rx.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
FMIImport.fmi2GetModelIdentifier
— Methodfmi2GetModelIdentifier(md::fmi2ModelDescription; type=nothing)
Returns the tag 'modelIdentifier' from CS or ME section.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Keywords
type=nothing
: Defines whether a Co-Simulation or Model Exchange is present. (default = nothing)
Returns
md.modelExchange.modelIdentifier::String
: Returns the tagmodelIdentifier
from ModelExchange section.md.coSimulation.modelIdentifier::String
: Returns the tagmodelIdentifier
from CoSimulation section.
FMIImport.fmi2GetModelName
— Methodfunction fmi2GetModelName(fmu::FMU2)
Returns the tag 'modelName' from the model description.
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
fmu.modelDescription.modelName::String
: Returns the tag 'modelName' from the model description.
FMIImport.fmi2GetModelName
— Methodfmi2GetModelName(md::fmi2ModelDescription) Returns the tag 'modelName' from the model description.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
md.modelName::String
: Returns the tag 'modelName' from the model description.
FMIImport.fmi2GetModelVariableIndices
— Methodfmi2GetModelVariableIndices(md::fmi2ModelDescription; vrs=md.valueReferences)
Returns a array of indices corresponding to value references vrs
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Keywords
vrs=md.valueReferences
: Additional attributevalueReferences::Array{fmi2ValueReference}
of the Model Description that is a handle to a (base type) variable value. Handle and base type uniquely identify the value of a variable. (default =md.valueReferences::Array{fmi2ValueReference}
)
Returns
names::Array{Integer}
: Returns a array of indices corresponding to value referencesvrs
FMIImport.fmi2GetNames
— Methodfmi2GetNames(md::fmi2ModelDescription; vrs=md.valueReferences, mode=:first)
fmi2GetNames(fmu::FMU2; vrs=md.valueReferences, mode=:first)
Returns a array of names corresponding to value references vrs
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Keywords
vrs=md.valueReferences
: Additional attributevalueReferences::Array{fmi2ValueReference}
of the Model Description that is a handle to a (base type) variable value. Handle and base type uniquely identify the value of a variable. (default =md.valueReferences::Array{fmi2ValueReference}
)mode=:first
: If there are multiple names per value reference, availabel modes are:first
(default, pick only the first one),:group
(pick all and group them into an array) and:flat
(pick all, but flat them out into a 1D-array together with all other names)
Returns
names::Array{String}
: Returns a array of names corresponding to value referencesvrs
FMIImport.fmi2GetNamesAndDescriptions
— Methodfmi2GetNamesAndDescriptions(md::fmi2ModelDescription)
fmi2GetNamesAndDescriptions(fmu::FMU2)
Returns a dictionary of variables with their descriptions
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
dict::Dict{String, String}
: Returns a dictionary that constructs a hash table with keys of type String and values of type String. So returns a dict with (md.modelVariables[i].name::String
,md.modelVariables[i].description::Union{String, Nothing}
). (Creates a tuple (name, description) for each i in 1:length(md.modelVariables))
FMIImport.fmi2GetNamesAndInitials
— Methodfmi2GetNamesAndInitials(md::fmi2ModelDescription)
fmi2GetNamesAndInitials(fmu::FMU2)
Returns a dictionary of variables with their initials
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
dict::Dict{String, Cuint}
: Returns a dictionary that constructs a hash table with keys of type String and values of type Cuint. So returns a dict with (md.modelVariables[i].name::String
,md.modelVariables[i].inital::Union{fmi2Initial, Nothing}
). (Creates a tuple (name,initial) for each i in 1:length(md.modelVariables))
See also fmi2GetInitial
.
FMIImport.fmi2GetNamesAndUnits
— Methodfmi2GetNamesAndUnits(md::fmi2ModelDescription)
fmi2GetNamesAndUnits(fmu::FMU2)
Returns a dictionary of variables with their units
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
dict::Dict{String, String}
: Returns a dictionary that constructs a hash table with keys of type String and values of type String. So returns a dict with (md.modelVariables[i].name::String
,md.modelVariables[i]._Real.unit::Union{String, Nothing}
). (Creates a tuple (name, unit) for each i in 1:length(md.modelVariables))
See also fmi2GetUnit
.
FMIImport.fmi2GetNominalsOfContinuousStates
— Methodfmi2GetNominalsOfContinuousStates(c::FMU2Component)
Return the new (continuous) state vector x
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
Returns
x::Array{fmi2Real}
: Returns an array offmi2Real
values representing the new continuous state vectorx
.
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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2GetNominalsOfContinuousStates
.
FMIImport.fmi2GetNumberOfEventIndicators
— Methodfmi2GetNumberOfEventIndicators(fmu::FMU2)
Returns the tag 'numberOfEventIndicators' from the model description.
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
fmu.modelDescription.numberOfEventIndicators::Union{UInt, Nothing}
: Returns the tag 'numberOfEventIndicators' from the model description.
FMIImport.fmi2GetNumberOfEventIndicators
— Methodfmi2GetNumberOfEventIndicators(md::fmi2ModelDescription)
Returns the tag 'numberOfEventIndicators' from the model description.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
md.numberOfEventIndicators::Union{UInt, Nothing}
: Returns the tag 'numberOfEventIndicators' from the model description.
FMIImport.fmi2GetNumberOfStates
— Methodfmi2GetNumberOfStates(fmu::FMU2)
Returns the number of states of the FMU.
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
- Returns the length of the
fmu.modelDescription.valueReferences::Array{fmi2ValueReference}
corresponding to the number of states of the FMU.
FMIImport.fmi2GetNumberOfStates
— Methodfmi2GetNumberOfStates(md::fmi2ModelDescription)
Returns the number of states of the FMU.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
- Returns the length of the
md.valueReferences::Array{fmi2ValueReference}
corresponding to the number of states of the FMU.
FMIImport.fmi2GetOutputNames
— Methodfmi2GetOutputNames(md::fmi2ModelDescription; vrs=md.outputvalueReferences, mode=:first)
fmi2GetOutputNames(fmu::FMU2; vrs=md.outputvalueReferences, mode=:first)
Returns names of outputs
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Keywords
vrs=md.outputvalueReferences
: Additional attributeoutputvalueReferences::Array{fmi2ValueReference}
of the Model Description that is a handle to a (base type) variable value. Handle and base type uniquely identify the value of a variable. (default =md.outputvalueReferences::Array{fmi2ValueReference}
)mode=:first
: If there are multiple names per value reference, availabel modes are:first
(default, pick only the first one),:group
(pick all and group them into an array) and:flat
(pick all, but flat them out into a 1D-array together with all other names)
Returns
names::Array{String}
: Returns a array of names corresponding to value referencesvrs
FMIImport.fmi2GetOutputValueReferencesAndNames
— Methodfmi2GetOutputValueReferencesAndNames(md::fmi2ModelDescription)
Returns a dictionary Dict(fmi2ValueReference, Array{String})
of value references and their corresponding names
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Keywords
vrs=md.outputvalueReferences
: Additional attributeoutputvalueReferences::Array{fmi2ValueReference}
of the Model Description that is a handle to a (base type) variable value. Handle and base type uniquely identify the value of a variable. (default =md.outputvalueReferences::Array{fmi2ValueReference}
)
Returns
dict::Dict{fmi2ValueReference, Array{String}}
: Returns a dictionary that constructs a hash table with keys of type fmi2ValueReference and values of type Array{String}.So returns a dict with (vrs, names of outputs)
FMIImport.fmi2GetParameterNames
— Methodfmi2GetParameterNames(md::fmi2ModelDescription; vrs=md.parameterValueReferences, mode=:first)
fmi2GetParameterNames(fmu::FMU2; vrs=md.parameterValueReferences, mode=:first)
Returns names of parameters
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Keywords
vrs=md.parameterValueReferences
: Additional attributeparameterValueReferences::Array{fmi2ValueReference}
of the Model Description that is a handle to a (base type) variable value. Handle and base type uniquely identify the value of a variable. (default =md.parameterValueReferences::Array{fmi2ValueReference}
)mode=:first
: If there are multiple names per value reference, availabel modes are:first
(default, pick only the first one),:group
(pick all and group them into an array) and:flat
(pick all, but flat them out into a 1D-array together with all other names)
Returns
names::Array{String}
: Returns a array of names corresponding to parameter value referencesvrs
See also 'fmi2GetNames'.
FMIImport.fmi2GetParameterValueReferencesAndNames
— Methodfmi2GetParameterValueReferencesAndNames(md::fmi2ModelDescription)
fmi2GetParameterValueReferencesAndNames(fmu::FMU2)
Returns a dictionary Dict(fmi2ValueReference, Array{String})
of parameterValueReferences and their corresponding names
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
dict::Dict{fmi2ValueReference, Array{String}}
: Returns a dictionary that constructs a hash table with keys of type fmi2ValueReference and values of type Array{String}. So returns a dict with (vrs, names of parameters).
See also 'fmi2GetValueReferencesAndNames'.
FMIImport.fmi2GetReal
— Methodfmi2GetReal(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
.
FMIImport.fmi2GetRealOutputDerivatives
— Methodfmi2GetRealOutputDerivatives(c::FMU2Component, vr::fmi2ValueReferenceFormat, order::AbstractArray{fmi2Integer})
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}
: Argumentvr
is an array ofnvr
value handels called "ValueReference" that t define the variables whose derivatives shall be set.order::Array{fmi2Integer}
: Argumentorder
is an array of fmi2Integer values witch specifys the corresponding order of derivative of the real input variable.
Returns
value::AbstactArray{fmi2Integer}
: Returnvalue
is an array which represents a vector with the values of the derivatives.
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!
.
FMIImport.fmi2GetStartValue
— FunctionReturns the start/default value for a given value reference.
FMIImport.fmi2GetStartValue
— Functionfmi2GetStartValue(md::fmi2ModelDescription, vrs::fmi2ValueReferenceFormat = md.valueReferences)
fmi2GetStartValue(fmu::FMU2, vrs::fmi2ValueReferenceFormat = fmu.modelDescription.valueReferences)
fmi2GetStartValue(c::FMU2Component, vrs::fmi2ValueReferenceFormat = c.fmu.modelDescription.valueReferences)
fmi2GetStartValue(mv::fmi2ScalarVariable)
Returns the start/default value for a given value reference.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::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.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.vrs::fmi2ValueReferenceFormat = md.valueReferences
: wildcards for how a user can pass a fmi[X]ValueReference (default = md.valueReferences)
More detailed: fmi2ValueReferenceFormat = Union{Nothing, String, Array{String,1}, fmi2ValueReference, Array{fmi2ValueReference,1}, Int64, Array{Int64,1}, Symbol}
Returns
- first optional function:
starts::Array{fmi2ValueReferenceFormat}
: start/default value for a given value reference - second optional function:
starts::fmi2ValueReferenceFormat
: start/default value for a given value reference - third optional function:
starts::fmi2ValueReferenceFormat
: start/default value for a given value reference - forth optional function:
mv._Real.start
: start/default value for a given ScalarVariable. In this case representing a variable of primitive type Real.mv._Integer.start
: start/default value for a given ScalarVariable. In this case representing a variable of primitive type Integer.mv._Boolean.start
: start/default value for a given ScalarVariable. In this case representing a variable of primitive type Boolean.mv._String.start
: start/default value for a given ScalarVariable. In this case representing a variable of primitive type String.mv._Enumeration.start
: start/default value for a given ScalarVariable. In this case representing a variable of primitive type Enumeration.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
FMIImport.fmi2GetStartValue
— FunctionReturns the start/default value for a given value reference.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
FMIImport.fmi2GetStateNames
— Methodfmi2GetStateNames(md::fmi2ModelDescription; vrs=md.stateValueReferences, mode=:first)
fmi2GetStateNames(fmu::FMU2; vrs=md.stateValueReferences, mode=:first)
Returns names of states
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Keywords
vrs=md.stateValueReferences
: Additional attributeparameterValueReferences::Array{fmi2ValueReference}
of the Model Description that is a handle to a (base type) variable value. Handle and base type uniquely identify the value of a variable. (default =md.stateValueReferences::Array{fmi2ValueReference}
)mode=:first
: If there are multiple names per value reference, availabel modes are:first
(default, pick only the first one),:group
(pick all and group them into an array) and:flat
(pick all, but flat them out into a 1D-array together with all other names)
Returns
names::Array{String}
: Returns a array of names corresponding to parameter value referencesvrs
See also 'fmi2GetNames'.
FMIImport.fmi2GetStateValueReferencesAndNames
— Methodfmi2GetStateValueReferencesAndNames(md::fmi2ModelDescription)
fmi2GetStateValueReferencesAndNames(fmu::FMU2) Returns dict(vrs, names of states)
Returns a dictionary Dict(fmi2ValueReference, Array{String})
of state value references and their corresponding names.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
dict::Dict{fmi2ValueReference, Array{String}}
: Returns a dictionary that constructs a hash table with keys of type fmi2ValueReference and values of type Array{String}. So returns a dict with (vrs, names of states)
FMIImport.fmi2GetStatus
— MethodToDo
FMIImport.fmi2GetString
— Methodfmi2GetString(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
: Argumentvr
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}
: Returnvalues
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!
.
FMIImport.fmi2GetUnit
— Methodfmi2GetUnit(mv::fmi2ScalarVariable)
Returns the unit
entry of the corresponding model variable.
Arguments
fmi2GetStartValue(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.
Returns
mv._Real.unit
: Returns theunit
entry of the corresponding ScalarVariable representing a variable of the primitive type Real. Otherwisenothing
is returned.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
FMIImport.fmi2GetValueReferencesAndNames
— Methodfmi2GetValueReferencesAndNames(md::fmi2ModelDescription; vrs=md.valueReferences)
fmi2GetValueReferencesAndNames(fmu::FMU2)
Returns a dictionary Dict(fmi2ValueReference, Array{String})
of value references and their corresponding names
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Keywords
vrs=md.valueReferences
: Additional attributevalueReferences::Array{fmi2ValueReference}
of the Model Description that is a handle to a (base type) variable value. Handle and base type uniquely identify the value of a variable. (default =md.valueReferences::Array{fmi2ValueReference}
)
Returns
dict::Dict{fmi2ValueReference, Array{String}}
: Returns a dictionary that constructs a hash table with keys of type fmi2ValueReference and values of type Array{String}.
FMIImport.fmi2GetVariableNamingConvention
— Methodfmi2GetVariableNamingConvention(fmu::FMU2)
Returns the tag 'varaiblenamingconvention' from the model description.
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
fmu.modelDescription.variableNamingConvention::Union{fmi2VariableNamingConvention, Nothing}
: Returns the tag 'variableNamingConvention' from the model description.
FMIImport.fmi2GetVariableNamingConvention
— Methodfmi2GetVariableNamingConvention(md::fmi2ModelDescription)
Returns the tag 'varaiblenamingconvention' from the model description.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
md.variableNamingConvention::Union{fmi2VariableNamingConvention, Nothing}
: Returns the tag 'variableNamingConvention' from the model description.
FMIImport.fmi2Instantiate!
— Methodfunction 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 instancetype::fmi2Type=fmu.type
: Defines whether a Co-Simulation or Model Exchange is presentpushComponents::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 kindfmi2OK
(default=true
)logStatusWarning::Bool=true
whether to log status of kindfmi2Warning
(default=true
)logStatusDiscard::Bool=true
whether to log status of kindfmi2Discard
(default=true
)logStatusError::Bool=true
whether to log status of kindfmi2Error
(default=true
)logStatusFatal::Bool=true
whether to log status of kindfmi2Fatal
(default=true
)logStatusPending::Bool=true
whether to log status of kindfmi2Pending
(default=true
)
Returns
- Returns the instance of a new FMU component.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
See also fmi2Instantiate
.
FMIImport.fmi2IsCoSimulation
— Methodfmi2IsCoSimulation(fmu::FMU2)
Returns true, if the FMU supports co simulation
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
::Bool
: Returns true, if the FMU supports co simulation
FMIImport.fmi2IsCoSimulation
— Methodfmi2IsCoSimulation(md::fmi2ModelDescription)
Returns true, if the FMU supports co simulation
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
::Bool
: Returns true, if the FMU supports co simulation
FMIImport.fmi2IsModelExchange
— Methodfmi2IsModelExchange(fmu::FMU2)
Returns true, if the FMU supports model exchange
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
::Bool
: Returns true, if the FMU supports model exchange
FMIImport.fmi2IsModelExchange
— Methodfmi2IsModelExchange(md::fmi2ModelDescription)
Returns true, if the FMU supports model exchange
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
::Bool
: Returns true, if the FMU supports model exchange
FMIImport.fmi2Load
— Methodfmi2Load(pathToFMU::String; unpackPath=nothing, type=nothing, cleanup=true)
Sets the properties of the fmu by reading the modelDescription.xml. Retrieves all the pointers of binary functions.
Arguments
pathToFMU::String
: The folder path to the .fmu file.
Keywords
unpackPath=nothing
: Via optional argumentunpackPath
, a path to unpack the FMU can be specified (default: system temporary directory).type=nothing
: Defines whether a Co-Simulation or Model Exchange is presentcleanup=true
: The cleanup option controls whether the temporary directory is automatically deleted when the process exits.
Returns
- Returns the instance of the FMU struct.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
See also .
FMIImport.fmi2LoadModelDescription
— Methodfmi2LoadModelDescription(pathToModellDescription::String)
Extract the FMU variables and meta data from the ModelDescription
Arguments
pathToModellDescription::String
: Contains the path to a file name that is selected to be read and converted to an XML document. In order to better extract the variables and meta data in the further process.
Returns
md::fmi2ModelDescription
: Retuns a struct which provides the static information of ModelVariables.
Source
FMIImport.fmi2ModelVariablesForValueReference
— Methodfmi2ModelVariablesForValueReference(md::fmi2ModelDescription, vr::fmi2ValueReference)
Returns the model variable(s) fitting the value reference.
Arguments
md::fmi2ModelDescription
: Argumentmd
stores all static information related to an FMU. Especially, the FMU variables and their attributes such as name, unit, default initial value, etc..vr::fmi2ValueReference
: Argumentvr
contains a value of typefmi2ValueReference
which are identifiers of a variable value of the model.
Returns
ar::Array{fmi2ScalarVariable}
: Returnar
is an array offmi2ScalarVariable
containing the modelVariables with the identical fmi2ValueReference to the input variable vr.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
See also fmi2ModelVariablesForValueReference
.
FMIImport.fmi2NewDiscreteStates
— Methodfmi2NewDiscreteStates(c::FMU2Component)
Returns the next discrete states
Arguments
c::FMU2Component
: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
Returns
eventInfo::fmi2EventInfo*
: Strut withfmi2Boolean
Variables
More detailed:
newDiscreteStatesNeeded::fmi2Boolean
: IfnewDiscreteStatesNeeded = fmi2True
the FMU should stay in Event Mode, and the FMU requires to set new inputs to the FMU to compute and get the outputs and to call
fmi2NewDiscreteStates again. If all FMUs return newDiscreteStatesNeeded = fmi2False
call fmi2EnterContinuousTimeMode.
terminateSimulation::fmi2Boolean
: IfterminateSimulation = fmi2True
callfmi2Terminate
nominalsOfContinuousStatesChanged::fmi2Boolean
: IfnominalsOfContinuousStatesChanged = fmi2True
then the nominal values of the states have changed due to the function call and can be inquired withfmi2GetNominalsOfContinuousStates
.valuesOfContinuousStatesChanged::fmi2Boolean
: IfvaluesOfContinuousStatesChanged = fmi2True
, then at least one element of the continuous state vector has changed its value due to the function call. The new values of the states can be retrieved withfmi2GetContinuousStates
. If no element of the continuous state vector has changed its value,valuesOfContinuousStatesChanged
must return fmi2False.nextEventTimeDefined::fmi2Boolean
: IfnextEventTimeDefined = fmi2True
, then the simulation shall integrate at most untiltime = nextEventTime
, and shall callfmi2EnterEventMode
at this time instant. If integration is stopped before nextEventTime, the definition ofnextEventTime
becomes obsolete.nextEventTime::fmi2Real
: next event ifnextEventTimeDefined=fmi2True
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.83]: 3.2.2 Evaluation of Model Equations
See also fmi2NewDiscreteStates
.
FMIImport.fmi2ProvidesDirectionalDerivative
— Methodfmi2ProvidesDirectionalDerivative(fmu::FMU2)
Returns true, if the FMU provides directional derivatives
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Returns
::Bool
: Returns true, if the FMU provides directional derivatives
FMIImport.fmi2ProvidesDirectionalDerivative
— Methodfmi2ProvidesDirectionalDerivative(md::fmi2ModelDescription)
Returns true, if the FMU provides directional derivatives
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
::Bool
: Returns true, if the FMU provides directional derivatives
FMIImport.fmi2Reload
— Methodfmi2Reload(fmu::FMU2)
Reloads the FMU-binary. This is useful, if the FMU does not support a clean reset implementation.
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
FMIImport.fmi2SampleDirectionalDerivative
— Functionfmi2SampleDirectionalDerivative(c::FMU2Component, vUnknownref::Array{fmi2ValueReference}, vKnownref::Array{fmi2ValueReference}, steps::Array{fmi2Real} = ones(fmi2Real, length(vKnown_ref)).*1e-5)
This function samples the directional derivative by manipulating corresponding values (central differences).
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.vUnknown_ref::Array{fmi2ValueReference}
: ArgumentvUnKnown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vKnown_ref
is the Array of the vector values of Real input variables of function h that changes its value in the actual Mode.vKnown_ref::Array{fmi2ValueReference}
: ArgumentvKnown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vKnown_ref
is the Array of the vector values of Real input variables of function h that changes its value in the actual Mode.steps::Array{fmi2Real} = ones(fmi2Real, length(vKnown_ref)).*1e-5
:steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing
:
Returns
dvUnknown::Arrya{fmi2Real}
:
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
FMIImport.fmi2SampleDirectionalDerivative
— Functionfmi2SampleDirectionalDerivative(c::FMU2Component,
vUnknown_ref::AbstractArray{fmi2ValueReference},
vKnown_ref::AbstractArray{fmi2ValueReference},
steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing)
This function samples the directional derivative by manipulating corresponding values (central differences).
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
ordiscrete
. If<ModelStructure><Derivatives>
is present, also the variables listed here as state derivatives.
- Initialization Mode: unkowns kisted under
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::AbstractArray{fmi2ValueReference}
: ArgumentvUnknown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vUnknown_ref
can be equated withv_unknown
(variable described above).vKnown_ref::AbstractArray{fmi2ValueReference}
: ArgumentvKnown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vKnown_ref
can be equated withv_known
(variable described above).steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing)
: If sampling is used, sampling step size can be set (for each direction individually) using optional argumentsteps
.
Returns
dvUnkonwn::Array{fmi2Real}
: ArgumentvUnknown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vUnknown_ref
can be equated withv_unknown
(see function fmi2GetDirectionalDerivative!).
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
See also fmi2GetDirectionalDerivative!
,fmi2GetDirectionalDerivative
.
FMIImport.fmi2SampleDirectionalDerivative!
— Functionfunction fmi2SampleDirectionalDerivative!(c::FMU2Component, vUnknownref::AbstractArray{fmi2ValueReference}, vKnownref::AbstractArray{fmi2ValueReference}, dvUnknown::AbstractArray, # ToDo: datatype steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing)
This function samples the directional derivative by manipulating corresponding values (central differences) and saves in-place.
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
ordiscrete
. If<ModelStructure><Derivatives>
is present, also the variables listed here as state derivatives.
- Initialization Mode: unkowns kisted under
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::AbstractArray{fmi2ValueReference}
: ArgumentvUnknown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vUnknown_ref
can be equated withv_unknown
(variable described above).vKnown_ref::AbstractArray{fmi2ValueReference}
: ArgumentvKnown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vKnown_ref
can be equated withv_known
(variable described above).dvUnknown::AbstractArray{fmi2Real}
: Stores the directional derivative vector values.steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing)
: If sampling is used, sampling step size can be set (for each direction individually) using optional argumentsteps
.
Returns
nothing
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
See also fmi2GetDirectionalDerivative!
,fmi2GetDirectionalDerivative
.
FMIImport.fmi2SampleDirectionalDerivative!
— Functionfmi2SampleDirectionalDerivative!(c::FMU2Component, vUnknownref::Array{fmi2ValueReference}, vKnownref::Array{fmi2ValueReference}, dvUnknown::AbstractArray, steps::Array{fmi2Real} = ones(fmi2Real, length(vKnown_ref)).*1e-5)
This function samples the directional derivative by manipulating corresponding values (central differences) and saves in-place.
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.vUnknown_ref::Array{fmi2ValueReference}
: ArgumentvUnKnown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vKnown_ref
is the Array of the vector values of Real input variables of function h that changes its value in the actual Mode.vKnown_ref::Array{fmi2ValueReference}
: ArgumentvKnown_ref
contains values of typefmi2ValueReference
which are identifiers of a variable value of the model.vKnown_ref
is the Array of the vector values of Real input variables of function h that changes its value in the actual Mode.dvUnknown::AbstractArray
: stores the samples of the directional derivativesteps::Array{fmi2Real} = ones(fmi2Real, length(vKnown_ref)).*1e-5
:steps::Union{AbstractArray{fmi2Real}, Nothing} = nothing
:
Returns
nothing
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
FMIImport.fmi2SerializeFMUstate
— Methodfmi2SerializeFMUstate(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
: Argumentstate
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}
: ReturnserializedState
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
.
FMIImport.fmi2SerializedFMUstateSize
— Methodfmi2SerializedFMUstateSize(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
: Argumentstate
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 typeCsize_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
.
FMIImport.fmi2StringToValueReference
— MethodReturns the ValueReference or an array of ValueReferences coresponding to the variable names.
FMIImport.fmi2StringToValueReference
— Methodfmi2StringToValueReference(md::fmi2ModelDescription, names::AbstractArray{String})
Returns an array of ValueReferences coresponding to the variable names.
Arguments
md::fmi2ModelDescription
: Argumentmd
stores all static information related to an FMU. Especially, the FMU variables and their attributes such as name, unit, default initial value, etc..names::AbstractArray{String}
: Argumentnames
contains a list of Strings. For each string ("variable name"), the corresponding value reference is searched in the given modelDescription.
Returns
vr:Array{fmi2ValueReference}
: Returnvr
is an array ofValueReference
coresponding to the variable names.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
See also fmi2StringToValueReference
.
FMIImport.fmi2StringToValueReference
— Methodfmi2StringToValueReference(md::fmi2ModelDescription, name::String)
fmi2StringToValueReference(fmu::FMU2, name::Union{String, AbstractArray{String}})
Returns the ValueReference or an array of ValueReferences coresponding to the variable names.
Arguments
md::fmi2ModelDescription
: Argumentmd
stores all static information related to an FMU. Especially, the FMU variables and their attributes such as name, unit, default initial value, etc..fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.name::String
: Argumentnames
contains a String or a list of Strings. For each string ("variable name"), the corresponding value reference is searched in the given modelDescription.name::Union{String, AbstractArray{String}}
: Argumentnames
contains a Strings or AbstractArray{String}. For that, the corresponding value reference is searched in the given modelDescription.
Returns
reference::md.stringValueReferences
: Returnreferences
is an array ofValueReference
coresponding to the variable name.
For input parameter name::Sting
:
reference::md.stringValueReferences
: Returnreferences
is an array ofValueReference
coresponding to the variable name.
For input parameter name::AbstractArray{String}
ar::Array{fmi2ScalarVariable}
: Returnar
is an array offmi2ScalarVariable
containing the modelVariables with the identical fmi2ValueReference to the input variable vr.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
See also fmi2StringToValueReference
FMIImport.fmi2Unload
— Functionfunction fmi2Unload(fmu::FMU2, cleanUp::Bool = true)
Unload a FMU. Free the allocated memory, close the binaries and remove temporary zip and unziped FMU model description.
Arguments
fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.cleanUp::Bool= true
: Defines if the file, link, or empty directory should be deleted.
FMIImport.fmi2Unzip
— Methodfmi2Unzip(pathToFMU::String; unpackPath=nothing, cleanup=true)
Create a copy of the .fmu file as a .zip folder and unzips it. Returns the paths to the zipped and unzipped folders.
Arguments
pathToFMU::String
: The folder path to the .zip folder.
Keywords
unpackPath=nothing
: Via optional argumentunpackPath
, a path to unpack the FMU can be specified (default: system temporary directory).cleanup=true
: The cleanup option controls whether the temporary directory is automatically deleted when the process exits.
Returns
unzippedAbsPath::String
: Contains the Path to the uzipped Folder.zipAbsPath::String
: Contains the Path to the zipped Folder.
See also mktempdir
.
FMIImport.fmi2ValueReferenceToString
— Methodfmi2ValueReferenceToString(md::fmi2ModelDescription, reference::fmi2ValueReference)
fmi2ValueReferenceToString(md::fmi2ModelDescription, reference::Int64)
fmi2ValueReferenceToString(fmu::FMU2, reference::Union{fmi2ValueReference, Int64})
Arguments
md::fmi2ModelDescription
: Argumentmd
stores all static information related to an FMU. Especially, the FMU variables and their attributes such as name, unit, default initial value, etc..fmu::FMU2
: Mutable struct representing a FMU and all it instantiated instances in the FMI 2.0.2 Standard.reference::fmi2ValueReference
: The argumentreferences
is a variable of the typeValueReference
.reference::Int64
: Argumentreferences
is a variable of the typeInt64
.reference::Union{fmi2ValueReference, Int64}
: Argumentreferences
of the typefmi2ValueReference
orInt64
.
Return
md.stringValueReferences::Dict{String, fmi2ValueReference}
: Returns a dictionarymd.stringValueReferences
that constructs a hash table with keys of type String and values of type fmi2ValueReference.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2[p.22]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
FMIImport.fmi3CallbackClockUpdate
— MethodSource: FMISpec3.0, Version D5ef1c1: 5.2.2. State: Clock Activation Mode
A model partition of a Scheduled Execution FMU calls fmi3CallbackClockUpdate to signal that a triggered output Clock ticked or a new interval for a countdown Clock is available. fmi3CallbackClockUpdate switches the FMU itself then into the Clock Update Mode (see 5.2.3.). The callback may be called from several model partitions.
instanceEnvironment - is the instance name of the model that calls this function.
FMIImport.fmi3CallbackIntermediateUpdate
— MethodSource: FMISpec3.0, Version D5ef1c1: 4.2.2. State: Intermediate Update Mode
When a Co-Simulation FMU provides values for its output variables at intermediate points between two consecutive communication points, and is able to receive new values for input variables at these intermediate points, the Intermediate Update Callback function is called. This is typically required when the FMU uses a numerical solver to integrate the FMU's internal state between communication points in fmi3DoStep. The callback function switches the FMU from Step Mode (see 4.2.1.) in the Intermediate Update Mode (see 4.2.2.) and returns to Step Mode afterwards. The parameters of this function are:
instanceEnvironment - is the instance name of the model that calls this function.
intermediateUpdateTime - is the internal value of the independent variable [typically simulation time] of the FMU at which the callback has been called for intermediate and final steps. If an event happens or an output Clock ticks, intermediateUpdateTime is the time of event or output Clock tick. In Co-Simulation, intermediateUpdateTime is restricted by the arguments to fmi3DoStep as follows: currentCommunicationPoint ≤ intermediateUpdateTime ≤ (currentCommunicationPoint + communicationStepSize). The FMU must not call the callback function fmi3CallbackIntermediateUpdate with an intermediateUpdateTime that is smaller than the intermediateUpdateTime given in a previous call of fmi3CallbackIntermediateUpdate with intermediateStepFinished == fmi3True.
If intermediateVariableSetRequested == fmi3True, the co-simulation algorithm may provide intermediate values for continuous input variables with intermediateUpdate = true by calling fmi3Set{VariableType}. The set of variables for which the co-simulation algorithm will provide intermediate values is declared through the requiredIntermediateVariables argument to fmi3InstantiateXXX. If a co-simulation algorithm does not provide a new value for any of the variables contained in the set it registered, the last value set remains.
If intermediateVariableGetAllowed == fmi3True, the co-simulation algorithm may collect intermediate output variables by calling fmi3Get{VariableType} for variables with intermediateUpdate = true. The set of variables for which the co-simulation algorithm can get values is supplied through the requiredIntermediateVariables argument to fmi3InstantiateXXX.
If intermediateStepFinished == fmi3False, the intermediate outputs of the FMU that the co-simulation algorithm inquires with fmi3Get{VariableType} resulting from tentative internal solver states and may still change for the same intermediateUpdateTime [e.g., if the solver deems the tentative state to cause a too high approximation error, it may go back in time and try to re-estimate the state using smaller internal time steps]. If intermediateStepFinished == fmi3True, intermediate outputs inquired by the co-simulation algorithm with fmi3Get{VariableType} correspond to accepted internal solver step.
When canReturnEarly == fmi3True the FMU signals to the co-simulation algorithm its ability to return early from the current fmi3DoStep.
earlyReturnRequested - If and only if canReturnEarly == fmi3True, the co-simulation algorithm may request the FMU to return early from fmi3DoStep by setting earlyReturnRequested == fmi3True.
earlyReturnTime is used to signal the FMU at which time to return early from the current fmi3DoStep, if the return value of earlyReturnRequested == fmi3True. If the earlyReturnTime is greater than the last signaled intermediateUpdateTime, the FMU may integrate up to the time instant earlyReturnTime.
If the ModelDescription has the "providesIntermediateUpdate" flag, the Intermediate update callback function is called. That flag is ignored in ModelExchange and ScheduledExecution.
FMIImport.fmi3CanGetSetState
— MethodReturns true, if the FMU supports the getting/setting of states
FMIImport.fmi3CanSerializeFMUState
— MethodReturns true, if the FMU state can be serialized
FMIImport.fmi3CompletedIntegratorStep
— MethodSource: FMISpec3.0, Version D5ef1c1: 3.2.1. State: Continuous-Time Mode
This function must be called by the environment after every completed step If enterEventMode == fmi3True, the event mode must be entered If terminateSimulation == fmi3True, the simulation shall be terminated
For more information call ?fmi3CompletedIntegratorStep
FMIImport.fmi3DeSerializeFMUState
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.4. Getting and Setting the Complete FMU State
Deserialize the data in the serializedState fmi3Byte field.
For more information call ?fmi3DeSerzializeFMUstate
FMIImport.fmi3GetAdjointDerivative
— FunctionSource: FMISpec3.0, Version D5ef1c1: 2.2.11. Getting Partial Derivatives
Computes adjoint derivatives.
For more information call ?fmi3GetAdjointDerivative
FMIImport.fmi3GetAdjointDerivative
— FunctionSource: FMISpec3.0, Version D5ef1c1: 2.2.11. Getting Partial Derivatives
Computes adjoint derivatives.
For more information call ?fmi3GetAdjointDerivative
FMIImport.fmi3GetBinary
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Binary variables.
For more information call ?fmi3GetBinary
FMIImport.fmi3GetBoolean
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Boolean variables.
For more information call ?fmi3GetBoolean
FMIImport.fmi3GetClock
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Clock variables.
For more information call ?fmi3GetClock
FMIImport.fmi3GetContinuousStates
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.3. State: Initialization Mode
Return the new (continuous) state vector x.
For more information call ?fmi3GetContinuousStates
FMIImport.fmi3GetDefaultStartTime
— MethodReturns startTime from DefaultExperiment if defined else defaults to nothing.
FMIImport.fmi3GetDefaultStepSize
— MethodReturns stepSize from DefaultExperiment if defined else defaults to nothing.
FMIImport.fmi3GetDefaultStopTime
— MethodReturns stopTime from DefaultExperiment if defined else defaults to nothing.
FMIImport.fmi3GetDefaultTolerance
— MethodReturns tolerance from DefaultExperiment if defined else defaults to nothing.
FMIImport.fmi3GetDirectionalDerivative
— FunctionSource: FMISpec3.0, Version D5ef1c1: 2.2.11. Getting Partial Derivatives
Computes directional derivatives.
For more information call ?fmi3GetDirectionalDerivative
FMIImport.fmi3GetDirectionalDerivative
— FunctionSource: FMISpec3.0, Version D5ef1c1: 2.2.11. Getting Partial Derivatives
Computes directional derivatives.
For more information call ?fmi3GetDirectionalDerivative
FMIImport.fmi3GetEventIndicators
— MethodSource: FMISpec3.0, Version D5ef1c1: 3.2.1. State: Continuous-Time Mode
Returns the event indicators of the FMU.
For more information call ?fmi3GetEventIndicators
FMIImport.fmi3GetFMUState
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.4. Getting and Setting the Complete FMU State
Get the pointer to the current FMU state.
For more information call ?fmi3GetFMUstate
FMIImport.fmi3GetFloat32
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Float32 variables.
For more information call ?fmi3GetFloat32
FMIImport.fmi3GetFloat64
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Float64 variables.
For more information call ?fmi3GetFloat64
FMIImport.fmi3GetFullJacobian!
— MethodFills the jacobian over the FMU fmu
for FMU value references rdx
and rx
, so that the function returns the jacobian ∂rdx / ∂rx.
If FMI built-in directional derivatives are supported, they are used. As fallback, directional derivatives will be sampled with central differences. No performance optimization, for an optimized version use fmi3GetJacobian!
.
If sampling is used, sampling step size can be set (for each direction individually) using optional argument steps
.
FMIImport.fmi3GetFullJacobian
— MethodBuilds the jacobian over the FMU fmu
for FMU value references rdx
and rx
, so that the function returns the jacobian ∂rdx / ∂rx.
If FMI built-in directional derivatives are supported, they are used. As fallback, directional derivatives will be sampled with central differences. No performance optimization, for an optimized version use fmi3GetJacobian
.
If sampling is used, sampling step size can be set (for each direction individually) using optional argument steps
.
FMIImport.fmi3GetGenerationDateAndTime
— MethodReturns the tag 'generationdateandtime' from the model description.
FMIImport.fmi3GetGenerationTool
— MethodReturns the tag 'generationtool' from the model description.
FMIImport.fmi3GetInstantiationToken
— MethodReturns the tag 'instantionToken' from the model description.
FMIImport.fmi3GetInt16
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Int16 variables.
For more information call ?fmi3GetInt16
FMIImport.fmi3GetInt32
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Int32 variables.
For more information call ?fmi3GetInt32
FMIImport.fmi3GetInt64
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Int64 variables.
For more information call ?fmi3GetInt64
FMIImport.fmi3GetInt8
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3Int8 variables.
For more information call ?fmi3GetInt8
FMIImport.fmi3GetJacobian!
— MethodFills the jacobian over the FMU fmu
for FMU value references rdx
and rx
, so that the function returns the jacobian ∂rdx / ∂rx.
If FMI built-in directional derivatives are supported, they are used. As fallback, directional derivatives will be sampled with central differences. For optimization, if the FMU's model description has the optional entry 'dependencies', only dependent variables are sampled/retrieved. This drastically boosts performance for systems with large variable count (like CFD).
If sampling is used, sampling step size can be set (for each direction individually) using optional argument steps
.
FMIImport.fmi3GetJacobian
— MethodBuilds the jacobian over the FMU fmu
for FMU value references rdx
and rx
, so that the function returns the jacobian ∂rdx / ∂rx.
If FMI built-in directional derivatives are supported, they are used. As fallback, directional derivatives will be sampled with central differences. For optimization, if the FMU's model description has the optional entry 'dependencies', only dependent variables are sampled/retrieved. This drastically boosts performance for systems with large variable count (like CFD).
If sampling is used, sampling step size can be set (for each direction individually) using optional argument steps
.
FMIImport.fmi3GetModelIdentifier
— MethodReturns the tag 'modelIdentifier' from CS or ME section.
FMIImport.fmi3GetModelName
— MethodReturns the tag 'modelName' from the model description.
FMIImport.fmi3GetNominalsOfContinuousStates
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.3. State: Initialization Mode
Return the new (continuous) state vector x.
For more information call ?fmi3GetNominalsOfContinuousStates
FMIImport.fmi3GetNumberOfContinuousStates
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.2. State: Instantiated
This function returns the number of continuous states. This function can only be called in Model Exchange. For more information call ?fmi3GetNumberOfContinuousStates
FMIImport.fmi3GetNumberOfEventIndicators
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.3.2. State: Instantiated
This function returns the number of event indicators. This function can only be called in Model Exchange. For more information call ?fmi3GetNumberOfEventIndicators
FMIImport.fmi3GetNumberOfEventIndicators
— MethodReturns the number of EventIndicators from the model description.
FMIImport.fmi3GetNumberOfVariableDependencies
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.10. Dependencies of Variables
The number of dependencies of a given variable, which may change if structural parameters are changed, can be retrieved by calling the following function: For more information call ?fmi3GetNumberOfVariableDependencies
FMIImport.fmi3GetOutputDerivatives
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.12. Getting Derivatives of Continuous Outputs
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
For more information call ?fmi3GetOutputDerivatives
FMIImport.fmi3GetOutputDerivatives
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.12. Getting Derivatives of Continuous Outputs
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
For more information call ?fmi3GetOutputDerivatives
FMIImport.fmi3GetStartValue
— MethodReturns the start/default value for a given value reference.
TODO: Add this command in the documentation.
FMIImport.fmi3GetString
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3String variables.
For more information call ?fmi3GetString
FMIImport.fmi3GetUInt16
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3UInt16 variables.
For more information call ?fmi3GetUInt16
FMIImport.fmi3GetUInt32
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3UInt32 variables.
For more information call ?fmi3GetUInt32
FMIImport.fmi3GetUInt64
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3UInt64 variables.
For more information call ?fmi3GetUInt64
FMIImport.fmi3GetUInt8
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.2. Getting and Setting Variable Values
Get the values of an array of fmi3UInt8 variables.
For more information call ?fmi3GetUInt8
FMIImport.fmi3GetVariableDependencies
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.10. Dependencies of Variables
The actual dependencies (of type dependenciesKind) can be retrieved by calling the function fmi3GetVariableDependencies: For more information call ?fmi3GetVariableDependencies
FMIImport.fmi3GetVariableNamingConvention
— MethodReturns the tag 'varaiblenamingconvention' from the model description.
FMIImport.fmi3InstantiateCoSimulation!
— MethodSource: FMISpec3.0, Version D5ef1c1:: 2.3.1. Super State: FMU State Setable Create a new instance of the given fmu, adds a logger if logginOn == true. Returns the instance of a new FMU component. For more information call ?fmi3InstantiateCoSimulation
FMIImport.fmi3InstantiateModelExchange!
— MethodSource: FMISpec3.0, Version D5ef1c1:: 2.3.1. Super State: FMU State Setable Create a new instance of the given fmu, adds a logger if logginOn == true. Returns the instance of a new FMU component. For more information call ?fmi3InstantiateModelExchange
FMIImport.fmi3InstantiateScheduledExecution!
— MethodSource: FMISpec3.0, Version D5ef1c1:: 2.3.1. Super State: FMU State Setable Create a new instance of the given fmu, adds a logger if logginOn == true. Returns the instance of a new FMU component. For more information call ?fmi3InstantiateScheduledExecution
FMIImport.fmi3IsCoSimulation
— MethodReturns true, if the FMU supports co simulation
FMIImport.fmi3IsModelExchange
— MethodReturns true, if the FMU supports model exchange
FMIImport.fmi3IsScheduledExecution
— MethodReturns true, if the FMU supports scheduled execution
FMIImport.fmi3Load
— MethodSets the properties of the fmu by reading the modelDescription.xml. Retrieves all the pointers of binary functions. Returns the instance of the FMU struct. Via optional argument unpackPath
, a path to unpack the FMU can be specified (default: system temporary directory).
FMIImport.fmi3LoadModelDescription
— MethodExtract the FMU variables and meta data from the ModelDescription
FMIImport.fmi3ModelVariablesForValueReference
— MethodReturns the model variable(s) fitting the value reference.
FMIImport.fmi3ProvidesAdjointDerivatives
— MethodReturns true, if the FMU provides adjoint derivatives
FMIImport.fmi3ProvidesDirectionalDerivatives
— MethodReturns true, if the FMU provides directional derivatives
FMIImport.fmi3Reload
— MethodReloads the FMU-binary. This is useful, if the FMU does not support a clean reset implementation.
FMIImport.fmi3SampleDirectionalDerivative
— FunctionThis function samples the directional derivative by manipulating corresponding values (central differences).
FMIImport.fmi3SampleDirectionalDerivative
— FunctionThis function samples the directional derivative by manipulating corresponding values (central differences).
FMIImport.fmi3SampleDirectionalDerivative!
— FunctionThis function samples the directional derivative by manipulating corresponding values (central differences) and saves in-place.
FMIImport.fmi3SampleDirectionalDerivative!
— FunctionThis function samples the directional derivative by manipulating corresponding values (central differences) and saves in-place.
FMIImport.fmi3SerializeFMUState
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.4. Getting and Setting the Complete FMU State
Serialize the data in the FMU state pointer.
For more information call ?fmi3SerzializeFMUstate
FMIImport.fmi3SerializedFMUStateSize
— MethodSource: FMISpec3.0, Version D5ef1c1: 2.2.6.4. Getting and Setting the Complete FMU State
Returns the size of a byte vector the FMU can be stored in.
For more information call ?fmi3SerzializedFMUstateSize
FMIImport.fmi3StringToValueReference
— MethodReturns an array of ValueReferences coresponding to the variable names.
FMIImport.fmi3StringToValueReference
— MethodReturns the ValueReference coresponding to the variable name.
FMIImport.fmi3Unload
— FunctionUnload a FMU. Free the allocated memory, close the binaries and remove temporary zip and unziped FMU model description.
FMIImport.fmi3Unzip
— MethodCreate a copy of the .fmu file as a .zip folder and unzips it. Returns the paths to the zipped and unzipped folders. Via optional argument unpackPath
, a path to unpack the FMU can be specified (default: system temporary directory).
FMIImport.fmi3ValueReferenceToString
— MethodReturns an array of variable names matching a fmi3ValueReference.