Functions in FMI Import/Core .jl

loadBinary eval!

Conversion functions

FMIBase.statusToStringFunction
statusToString(::struct, status::Union{fmi2Status, Integer})

Converts fmi2Status status into a String ("OK", "Warning", "Discard", "Error", "Fatal", "Pending").

source
FMIBase.valueReferenceToStringFunction
valueReferenceToString(obj, reference)

where:

obj ∈ (fmi2ModelDescription, fmi3ModelDescription, FMU2, FMU3) reference ∈ (fmi2ValueReference, fmi3ValueReference, Integer

Returns the string identifier for a give value reference.

source
FMIBase.stringToDataTypeFunction
stringToDataType(modelDescription, typename)

Converts a typename to type, for example "Float64" (::String) to fmi3Float64 (::DataType).

source

fmi2StringToInitial

External/Additional functions

FMIBase.getInitialFunction
getInitial(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 the inital entry of the corresponding ScalarVariable representing a variable of the primitive type Real. Otherwise nothing is returned.

Source

source
FMIBase.getStartValueFunction
getStartValue(md::fmi2ModelDescription, vrs::fmi2ValueReferenceFormat = md.valueReferences)

Returns the start/default value for a given value reference.

Arguments

  • md::fmi2ModelDescription: Struct which provides the static information of ModelVariables.
  • 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

  • starts::Array{fmi2ValueReferenceFormat}: start/default value for a given value reference

Source

source
FMIBase.modelVariablesForValueReferenceFunction
modelVariablesForValueReference(obj, vr)

where:

obj ∈ (fmi2ModelDescription, fmi3ModelDescription, FMU2, FMU3) vr ∈ (fmi2ValueReference, fmi3ValueReference)

Returns the model variable(s) matching the value reference.

source
FMIBase.setValueFunction
setValue(component,
            vrs::fmi2ValueReferenceFormat,
            srcArray::AbstractArray;
            filter=nothing)

Stores the specific value of fmi2ScalarVariable containing the modelVariables with the identical fmi2ValueReference and returns an array that indicates the Status.

Arguments

  • comp::FMUInstance (FMU2Component or FMU3Instance): Mutable struct represents an instantiated instance of an FMU in the FMI 2 or 3.
  • vrs::fmi2ValueReferenceFormat: wildcards for how a user can pass a fmi[X]ValueReference
  • srcArray::AbstractArray: Stores the specific value of fmi2ScalarVariable containing the modelVariables with the identical fmi2ValueReference to the input variable vr (vr = vrs[i]). srcArray has the same length as vrs.

Keywords

  • filter=nothing: It is applied to each ModelVariable to determine if it should be updated.

Returns

  • retcodes::Array{fmi2Status}: Returns an array of length length(vrs) with Type fmi2Status. Type fmi2Status is an enumeration and indicates the success of the function call.
source
FMIBase.getValueFunction
getValue(comp::FMU2Component, vrs::fmi2ValueReferenceFormat)

Returns the specific value of fmi2ScalarVariable containing the modelVariables with the identical fmi2ValueReference in an array.

Arguments

  • comp::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vrs::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

  • dstArray::Array{Any,1}(undef, length(vrs)): Stores the specific value of fmi2ScalarVariable containing the modelVariables with the identical fmi2ValueReference to the input variable vr (vr = vrs[i]). dstArray is a 1-Dimensional Array that has the same length as vrs.
source
getValue(solution::FMUSolution, vr::fmi2ValueReferenceFormat; isIndex::Bool=false)

Returns the Solution values.

Arguments

  • solution::FMUSolution: Struct contains information about the solution value, success, state and events of a specific FMU.
  • vr::fmi2ValueReferenceFormat: 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}

  • isIndex::Bool=false: Argument isIndex exists to check if vr ist the specific solution element ("index") that equals the given fmi2ValueReferenceFormat

Return

  • If he length of the given references equals 1, each element u in the collection solution.values.saveval is selecting the element at the index represented by indices[1] and returns it.

Thus, the collect() function is taking the generator expression and returning an array of the selected elements.

  • If more than one reference is given, the same process takes place as before. The difference is that now more than one index is accessed.

Source

source
FMIBase.getValue!Function
getValue!(comp::FMU2Component, vrs::fmi2ValueReferenceFormat, dst::AbstractArray)

Retrieves values for the refernces vrs and stores them in dst

Arguments

  • comp::FMU2Component: Mutable struct represents an instantiated instance of an FMU in the FMI 2.0.2 Standard.
  • vrs::fmi2ValueReferenceFormat: wildcards for how a user can pass a fmi[X]ValueReference
  • dst::AbstractArray: The array of destinations, must match the data types of the value references.

Returns

  • retcodes::Array{fmi2Status}: Returns an array of length length(vrs) with Type fmi2Status. Type fmi2Status is an enumeration and indicates the success of the function call.
source
FMIBase.getUnitFunction
getUnit(mv::fmi2ScalarVariable)

Returns the unit entry (a string) 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 the unit entry of the corresponding ScalarVariable representing a variable of the primitive type Real. Otherwise nothing is returned.

Source

source

fmi2GetSolutionDerivative fmi2GetSolutionState fmi2GetSolutionValue fmi2GetSolutionTime fmi2GetJacobian fmi2GetJacobian! fmi2GetFullJacobian fmi2GetFullJacobian!