Functions in FMI Import/Core .jl
FMIBase.logInfo — FunctionPrints a message with level info if the log level allows it.
FMIBase.logWarning — FunctionPrints a message with level warn if the log level allows it.
FMIBase.logError — FunctionPrints a message with level error if the log level allows it.
loadBinary eval!
Conversion functions
FMIBase.stringToStatus — FunctionstringToStatus(s)Converts a String s to fmi2Status.
FMIBase.statusToString — FunctionstatusToString(::struct, status::Union{fmi2Status, Integer})Converts fmi2Status status into a String ("OK", "Warning", "Discard", "Error", "Fatal", "Pending").
FMIBase.stringToDependencyKind — FunctionstringToDependencyKind(s::AbstractString)Converts s ("dependent", "constant", "fixed", "tunable", "discrete") to the corresponding fmi2DependencyKind
FMIBase.dependencyKindToString — FunctiondependencyKindToString(c::fmi2DependencyKind)Converts fmi2DependencyKind c to the corresponding String ("dependent", "constant", "fixed", "tunable", "discrete")
FMIBase.valueReferenceToString — FunctionvalueReferenceToString(obj, reference)where:
obj ∈ (fmi2ModelDescription, fmi3ModelDescription, FMU2, FMU3) reference ∈ (fmi2ValueReference, fmi3ValueReference, Integer
Returns the string identifier for a give value reference.
FMIBase.stringToInitial — FunctionstringToInitial(s::AbstractString)Converts s ("approx", "exact", "calculated") to the corresponding fmi2Initial.
FMIBase.initialToString — Functionfmi2InitialToString(c::fmi2Initial)Converts fmi2Initial c to the corresponding String ("approx", "exact", "calculated").
FMIBase.stringToIntervalQualifier — FunctionstringToIntervalQualifier(::FMI3Struct, s::AbstractString)Convert s ("intervalNotYetKnown", "intervalUnchanged", "intervalChanged") to the corresponding fmi3IntervalQualifier.
FMIBase.stringToDataType — FunctionstringToDataType(modelDescription, typename)Converts a typename to type, for example "Float64" (::String) to fmi3Float64 (::DataType).
FMIBase.stringToCausality — FunctionstringToCausality(s::AbstractString)Converts s ("parameter", "calculatedParameter", "input", "output", "local", "independent") to the corresponding fmi2Causality.
FMIBase.causalityToString — FunctioncausalityToString(c::fmi2Causality)Converts fmi2Causality c to the corresponding String ("parameter", "calculatedParameter", "input", "output", "local", "independent").
FMIBase.stringToVariability — FunctionstringToVariability(s::AbstractString)Converts s ("constant", "fixed", "tunable", "discrete", "continuous") to the corresponding fmi2Variability.
FMIBase.variabilityToString — FunctionvariabilityToString(c::fmi2Variability)Converts fmi2Variability c to the corresponding String ("constant", "fixed", "tunable", "discrete", "continuous").
fmi2StringToInitial
External/Additional functions
FMIBase.getInitial — FunctiongetInitial(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 theinitalentry of the corresponding ScalarVariable representing a variable of the primitive type Real. Otherwisenothingis returned.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
FMIBase.getStartValue — FunctiongetStartValue(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
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
FMIBase.hasCurrentInstance — FunctionToDo: Doc StringFMIBase.getCurrentInstance — FunctionToDo: Doc StringFMIBase.modelVariablesForValueReference — FunctionmodelVariablesForValueReference(obj, vr)where:
obj ∈ (fmi2ModelDescription, fmi3ModelDescription, FMU2, FMU3) vr ∈ (fmi2ValueReference, fmi3ValueReference)
Returns the model variable(s) matching the value reference.
FMIBase.setValue — FunctionsetValue(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]ValueReferencesrcArray::AbstractArray: Stores the specific value offmi2ScalarVariablecontaining the modelVariables with the identical fmi2ValueReference to the input variable vr (vr = vrs[i]).srcArrayhas the same length asvrs.
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 Typefmi2Status. Typefmi2Statusis an enumeration and indicates the success of the function call.
FMIBase.getValue — FunctiongetValue(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 offmi2ScalarVariablecontaining the modelVariables with the identical fmi2ValueReference to the input variable vr (vr = vrs[i]).dstArrayis a 1-Dimensional Array that has the same length asvrs.
getValue(solution::FMUSolution, vr::fmi2ValueReferenceFormat; isIndex::Bool=false)Returns the Solution values.
Arguments
solution::FMUSolution: Struct contains information about the solutionvalue,success,stateandeventsof 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: ArgumentisIndexexists to check ifvrist 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.savevalis 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
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2[p.22]: 2.1.2 Platform Dependent Definitions (fmi2TypesPlatform.h)
FMIBase.getValue! — FunctiongetValue!(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]ValueReferencedst::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 Typefmi2Status. Typefmi2Statusis an enumeration and indicates the success of the function call.
FMIBase.getUnit — FunctiongetUnit(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 theunitentry of the corresponding ScalarVariable representing a variable of the primitive type Real. Otherwisenothingis returned.
Source
- FMISpec2.0.2 Link: https://fmi-standard.org/
- FMISpec2.0.2: 2.2.7 Definition of Model Variables (ModelVariables)
fmi2GetSolutionDerivative fmi2GetSolutionState fmi2GetSolutionValue fmi2GetSolutionTime fmi2GetJacobian fmi2GetJacobian! fmi2GetFullJacobian fmi2GetFullJacobian!