FMIBase.FMI2Struct
— TypeFMI2Struct
A wildcard for FMI2 related structs, namely Union{FMU2, fmi2ModelDescription, FMU2Component}
.
FMIBase.FMI3Struct
— TypeFMI3Struct
A wildcard for FMI3 related structs, namely Union{FMU3, fmi3ModelDescription, FMU3Instance}
.
FMIBase.fmi2ComponentStateContinuousTimeMode
— ConstantToDo
FMIBase.fmi2ComponentStateError
— ConstantToDo
FMIBase.fmi2ComponentStateEventMode
— ConstantToDo
FMIBase.fmi2ComponentStateFatal
— ConstantToDo
FMIBase.fmi2ComponentStateInitializationMode
— ConstantToDo
FMIBase.fmi2ComponentStateInstantiated
— ConstantToDo
FMIBase.fmi2ComponentStateTerminated
— ConstantToDo
FMIBase.fmi3InstanceStateClockActivationMode
— ConstantToDo
FMIBase.fmi3InstanceStateConfigurationMode
— ConstantToDo
FMIBase.fmi3InstanceStateContinuousTimeMode
— ConstantToDo
FMIBase.fmi3InstanceStateError
— ConstantToDo
FMIBase.fmi3InstanceStateEventMode
— ConstantToDo
FMIBase.fmi3InstanceStateFatal
— ConstantToDo
FMIBase.fmi3InstanceStateInitializationMode
— ConstantToDo
FMIBase.fmi3InstanceStateInstantiated
— ConstantToDo
FMIBase.fmi3InstanceStateReconfigurationMode
— ConstantToDo
FMIBase.fmi3InstanceStateStepMode
— ConstantToDo
FMIBase.fmi3InstanceStateTerminated
— ConstantToDo
FMIBase.FMU
— TypeFMU
The abstract type for FMUs (FMI 2 & 3).
FMIBase.FMU
— Method(fmu::FMU)(;dx::AbstractVector{<:Real},
y::AbstractVector{<:Real},
y_refs::AbstractVector{<:fmiValueReference},
x::AbstractVector{<:Real},
u::AbstractVector{<:Real},
u_refs::AbstractVector{<:fmiValueReference},
p::AbstractVector{<:Real},
p_refs::AbstractVector{<:fmiValueReference},
ec::AbstractVector{<:Real},
t::Real)
Evaluates a FMU
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.p
: An array of FMU parameters to be set.p_refs
: An array of parameter references to indicate which system parameter sensitivities need to be determined.ec
: An array of real valued implicit event conditions ("event indicators")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
).ec::Union{AbstractVector{<:Real}, Nothing}
: The system event indicators (if ME-FMU, otherwisenothing
).
FMIBase.FMU2
— TypeThe mutable struct representing a FMU (and a container for all its instances) in the FMI 2.0.2 Standard. Also contains the paths to the FMU and ZIP folder as well als all the FMI 2.0.2 function pointers.
FMIBase.FMU2Component
— TypeThe mutable struct represents an allocated instance of an FMU in the FMI 2.0.2 Standard.
FMIBase.FMU2ComponentEnvironment
— TypeSource: FMISpec 2.0.3 [p.16f]
This is a pointer to a data structure in the simulation environment that calls the FMU. Using this pointer, data from the modelDescription.xml file [(for example, mapping of valueReferences to variable names)] can be transferred between the simulation environment and the logger function (see [FMISpec 2.0.3] section 2.1.5).
FMIBase.FMU3
— TypeSource: FMISpec3.0, Version D5ef1c1: 2.2.1. Header Files and Naming of Functions
The mutable struct representing an FMU in the FMI 3.0 Standard. Also contains the paths to the FMU and ZIP folder as well als all the FMI 3.0 function pointers
FMIBase.FMU3Instance
— TypeSource: FMISpec3.0, Version D5ef1c1:: 2.2.1. Header Files and Naming of Functions
The mutable struct represents a pointer to an FMU specific data structure that contains the information needed to process the model equations or to process the co-simulation of the model/subsystem represented by the FMU.
FMIBase.FMU3InstanceEnvironment
— TypeThis is a pointer to a data structure in the importer. Using this pointer, data may be transferred between the importer and callback functions the importer provides with the instantiation functions.
Source: FMISpec 3.0.1 [2.2.3. Platform Dependent Definitions]
FMIBase.FMUEvent
— TypeContainer for event related information.
FMIBase.FMUExecutionConfiguration
— TypeA mutable struct representing the excution configuration of a FMU. For FMUs that have issues with calls like fmi2Reset
or fmi2FreeInstance
, this is pretty useful.
FMIBase.FMUInputFunction
— TypeFMUInputFunction(inputFunction, vrs)
Struct container for inplace input functions for FMUs.
Arguments
inputFunction
: The input function (inplace) that gets called when new inputs are needed, must match one of the patterns described under Input function patterns.vrs::AbstractVector
: A vector of value refernces to be set by the input function
Input function patterns
Available input patterns are [c
: current component, u
: current state ,t
: current time, returning array of values to be passed to fmi2SetReal(..., inputValueReferences, inputFunction(...))
or fmi3SetFloat64
]:
inputFunction(t::Real, u::AbstractVector{<:Real})
inputFunction(c::Union{FMUInstance, Nothing}, t::Real, u::AbstractVector{<:Real})
inputFunction(c::Union{FMUInstance, Nothing}, x::AbstractVector{<:Real}, u::AbstractVector{<:Real})
inputFunction(x::AbstractVector{<:Real}, t::Real, u::AbstractVector{<:Real})
inputFunction(c::Union{FMUInstance, Nothing}, x::AbstractVector{<:Real}, t::Real, u::AbstractVector{<:Real})
FMIBase.FMUInstance
— TypeFMUInstance
An instance of a FMU. This was called component
in FMI2, but was corrected to instance
in FMI3.
FMIBase.FMUInstance
— Method(c::FMUInstance)(;dx::AbstractVector{<:Real},
y::AbstractVector{<:Real},
y_refs::AbstractVector{<:fmiValueReference},
x::AbstractVector{<:Real},
u::AbstractVector{<:Real},
u_refs::AbstractVector{<:fmiValueReference},
p::AbstractVector{<:Real},
p_refs::AbstractVector{<:fmiValueReference},
ec::AbstractVector{<:Real},
t::Real)
Evaluates a FMUInstance
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.p
: An array of FMU parameters to be set.p_refs
: An array of parameter references to indicate which system parameter sensitivities need to be determined.ec
: An array of real valued implicit event conditions ("event indicators")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
).ec::Union{AbstractVector{<:Real}, Nothing}
: The system event indicators (if ME-FMU, otherwisenothing
).
FMIBase.FMULogLevel
— TypeLog levels for non-standard printing of infos, warnings and errors.
FMIBase.FMUSnapshot
— TypeToDo
FMIBase.FMUSolution
— TypeThe mutable struct representing a specific Solution of a FMI2 FMU.
FMIBase.fmi2ComponentState
— TypeToDo
FMIBase.fmi3InstanceState
— TypeToDo
Base.show
— MethodOverload the Base.show() function for custom printing of the FMU2Component.
Base.show
— MethodOverload the Base.show() function for custom printing of the FMU2.
Base.show
— MethodOverload the Base.show() function for custom printing of the FMU3Instance.
Base.show
— MethodOverload the Base.show() function for custom printing of the FMU3
Base.show
— MethodOverload the Base.show() function for custom printing of the FMU2.
FMIBase.canGetSetFMUState
— MethodcanGetSetFMUState(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.
FMIBase.canSerializeFMUState
— MethodcanSerializeFMUState(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
FMIBase.causalityToString
— MethodcausalityToString(c::fmi2Causality)
Converts fmi2Causality
c
to the corresponding String ("parameter", "calculatedParameter", "input", "output", "local", "independent").
FMIBase.dataTypeForValueReference
— MethoddataTypeForValueReference(obj, vr::fmi2ValueReference)
where:
obj ∈ (fmi2ModelDescription, FMU2)
Returns the fmi2DataType (fmi2Real
, fmi2Integer
, fmi2Boolean
, fmi2String
) for a given value reference vr
.
FMIBase.dependencyKindToString
— MethoddependencyKindToString(c::fmi2DependencyKind)
Converts fmi2DependencyKind
c
to the corresponding String ("dependent", "constant", "fixed", "tunable", "discrete")
FMIBase.doStep
— MethoddoStep(inst, dt; kwargs...)
Performs a co-simulation step with the FMU.
Arguments
inst::FMUInstance
: The FMUInstance to work with.dt::Real
: The time step to do.
Keyword arguments
currentCommunicationPoint::Real
: The current communication time point, current simulation time is assumed if not set.
Returns
- FMI2 or FMI3 return code
FMIBase.eval!
— MethodToDo: Doc String
FMIBase.freeFMUstate!
— MethodToDo
FMIBase.getAdjointDerivative!
— MethodToDo
FMIBase.getContinuousStates!
— MethodToDo
FMIBase.getContinuousStates
— MethodToDo
FMIBase.getCurrentInstance
— MethodToDo: Doc String
FMIBase.getDeclaredType
— MethodgetDeclaredType(md::fmi2ModelDescription, mv::fmi2ScalarVariable)
Returns the fmi2SimpleType
of the corresponding model variable mv
as defined in md.typeDefinitions
. If mv
does not have a declared type, return nothing
. If mv
has a declared type, but it is not found, issue a warning and return nothing
.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.mv::fmi2ScalarVariable
: The “ModelVariables” element consists of an ordered set of “ScalarVariable” elements. A “ScalarVariable” represents a variable of primitive type, like a real or integer variable.
Source
- FMISpec2.0.3 Link: https://fmi-standard.org/
- FMISpec2.0.3: 2.2.7 Definition of Model Variables (ModelVariables)
FMIBase.getDefaultStartTime
— MethodgetDefaultStartTime(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
.
FMIBase.getDefaultStepSize
— MethodgetDefaultStepSize(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
.
FMIBase.getDefaultStopTime
— MethodgetDefaultStopTime(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
.
FMIBase.getDefaultTolerance
— MethodgetDefaultTolerance(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
.
FMIBase.getDerivateValueReferencesAndNames
— Methodfmi2GetDerivateValueReferencesAndNames(md::fmi2ModelDescription)
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.
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
FMIBase.getDerivativeNames
— Methodfmi2GetDerivativeNames(md::fmi2ModelDescription; vrs=md.derivativeValueReferences, mode=:first)
Returns names of derivatives.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
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
FMIBase.getDirectionalDerivative!
— MethodToDo
FMIBase.getDirectionalDerivative
— MethodToDo
FMIBase.getDiscreteStates!
— MethodgetDiscreteStates!(c, xd)
Sets a new (discrete) state vector (in-place).
Arguments
c::FMU2Component
xd::AbstractArray{Union{fmi2Real, fmi2Integer, fmi2Boolean}}
FMIBase.getDiscreteStates
— MethodgetDiscreteStates(c)
Sets a new (discrete) state vector (out-of-place).
Arguments
c::FMU2Component
FMIBase.getEventIndicators!
— MethodToDo
FMIBase.getEventIndicators
— MethodToDo
FMIBase.getFMUstate!
— MethodgetFMUstate!(inst, state)
Copies the current FMU-state of the instance inst
(like a memory copy) to the address state
.
Arguments
inst
∈ (FMU2Component, FMI3Instance): the FMU instancestate
∈ (Ref{fmi2FMUstate}, Ref{fmi3FMUState}): the FMU state reference
FMIBase.getFMUstate
— MethodToDo
FMIBase.getGenerationDateAndTime
— MethodgetGenerationDateAndTime(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.
FMIBase.getGenerationTool
— MethodgetGenerationTool(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.
FMIBase.getInitial
— MethodgetInitial(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)
FMIBase.getInputNames
— MethodgetInputNames(md::fmi2ModelDescription; vrs=md.inputvalueReferences, mode=:first)
Returns names of inputs.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
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
FMIBase.getInputNamesAndStarts
— MethodgetInputNamesAndStarts(md::fmi2ModelDescription)
Returns a dictionary of input variables with their starting values.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
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 getStartValue
.
FMIBase.getInputValueReferencesAndNames
— MethodgetInputValueReferencesAndNames(md::fmi2ModelDescription)
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)
FMIBase.getInstantiationToken
— MethodReturns the tag 'instantionToken' from the model description.
FMIBase.getModelIdentifier
— MethodgetModelIdentifier(md::fmiModelDescription; 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.
FMIBase.getModelName
— MethodgetModelName(md::fmi2ModelDescription)
Returns the tag 'modelName' from the model description.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
modelName::String
: Returns the tag 'modelName' from the model description.
FMIBase.getModelVariableIndices
— MethodgetModelVariableIndices(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
FMIBase.getNames
— MethodgetNames(md::fmi2ModelDescription; 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.
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
FMIBase.getNamesAndDescriptions
— MethodgetNamesAndDescriptions(md::fmi2ModelDescription)
Returns a dictionary of variables with their descriptions.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
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))
FMIBase.getNamesAndInitials
— MethodgetNamesAndInitials(md::fmi2ModelDescription)
Returns a dictionary of variables with their initials.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
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 getInitial
.
FMIBase.getNamesAndUnits
— MethodgetNamesAndUnits(md::fmi2ModelDescription)
Returns a dictionary of variables with their units.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
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 getUnit
.
FMIBase.getNextEventTime
— MethodToDo
FMIBase.getNumberOfEventIndicators
— MethodgetNumberOfEventIndicators(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.
FMIBase.getNumberOfStates
— MethodgetNumberOfStates(md::fmi2ModelDescription)
Returns the number of states of the FMU.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
Returns
- Returns the number of states of the FMU.
FMIBase.getOutputNames
— Methodfmi2GetOutputNames(md::fmi2ModelDescription; vrs=md.outputvalueReferences, mode=:first)
Returns names of outputs.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
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
FMIBase.getOutputValueReferencesAndNames
— MethodgetOutputValueReferencesAndNames(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.
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)
FMIBase.getOutputs!
— MethodToDo
FMIBase.getParameterNames
— Methodfmi2GetParameterNames(md::fmi2ModelDescription; vrs=md.parameterValueReferences, mode=:first)
Returns names of parameters.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
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
FMIBase.getParameterValueReferencesAndNames
— MethodgetParameterValueReferencesAndNames(md::fmi2ModelDescription)
Returns a dictionary Dict(fmi2ValueReference, Array{String})
of parameterValueReferences and their corresponding names.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
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
.
FMIBase.getReal!
— MethodToDo
FMIBase.getReal
— MethodToDo
FMIBase.getSimpleTypeAttributeStruct
— MethodgetSimpleTypeAttributeStruct(st::fmi2SimpleType)
Returns the attribute structure for the simple type st
. Depending on definition, this is either st.Real
, st.Integer
, st.String
, st.Boolean
or st.Enumeration
.
Arguments
st::fmi2SimpleType
: Struct which provides the information on custom SimpleTypes.
Source
- FMISpec2.0.3 Link: https://fmi-standard.org/
- FMISpec2.0.3[p.40]: 2.2.3 Definition of Types (TypeDefinitions)
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.getStateNames
— Methodfmi2GetStateNames(fmu::FMU2; vrs=md.stateValueReferences, mode=:first)
Returns names of states.
Arguments
md::fmi2ModelDescription
: Struct which provides the static information of ModelVariables.
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
FMIBase.getStateValueReferencesAndNames
— Methodfmi2GetStateValueReferencesAndNames(md::fmi2ModelDescription)
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.
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)
FMIBase.getUnit
— MethodgetUnit(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 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)
FMIBase.getValue!
— MethodgetValue!(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
. Typefmi2Status
is an enumeration and indicates the success of the function call.
FMIBase.getValue
— MethodgetValue(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 offmi2ScalarVariable
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 asvrs
.
FMIBase.getValueReferencesAndNames
— MethodgetValueReferencesAndNames(obj; vrs=md.valueReferences)
with:
obj ∈ (fmi2ModelDescription, 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.
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}.
FMIBase.getVariableNamingConvention
— MethodgetVariableNamingConvention(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.
FMIBase.hasCurrentInstance
— MethodToDo: Doc String
FMIBase.initialToString
— Methodfmi2InitialToString(c::fmi2Initial)
Converts fmi2Initial
c
to the corresponding String ("approx", "exact", "calculated").
FMIBase.intervalQualifierToString
— MethodintervalQualifierToString(c::fmi3IntervalQualifier)
Convert fmi3IntervalQualifier
c
to the corresponding String ("intervalNotYetKnown", "intervalUnchanged", "intervalChanged").
FMIBase.isCoSimulation
— MethodisCoSimulation(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
FMIBase.isModelExchange
— MethodisModelExchange(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
FMIBase.isScheduledExecution
— MethodReturns true, if the FMU supports scheduled execution
FMIBase.logError
— FunctionPrints a message with level error
if the log level allows it.
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.modelVariablesForValueReference
— MethodmodelVariablesForValueReference(obj, vr)
where:
obj ∈ (fmi2ModelDescription, fmi3ModelDescription, FMU2, FMU3) vr ∈ (fmi2ValueReference, fmi3ValueReference)
Returns the model variable(s) matching the value reference.
FMIBase.prepareValue
— MethodprepareValue(value)
Prepares a value for a FMI ccall (they only accept arrays). Technically, the value is packed into an array - if not already.
FMIBase.prepareValueReference
— MethodprepareValueReference(obj, vrs)
where:
obj ∈ (fmi2ModelDescription, fmi3ModelDescription, FMU2, FMU3, FMU2Component, FMU3Instance) vrs ∈ (fmi2ValueReference, AbstractVector{fmi2ValueReference}, fmi3ValueReference, AbstractVector{fmi3ValueReference}, String, AbstractVector{String}, Integer, AbstractVector{Integer}, :states, :derivatives, :inputs, :outputs, :all, :none, Nothing)
Receives one or an array of value references in an arbitrary format (see fmi2ValueReferenceFormat) and converts it into an Array{fmi2ValueReference} (if not already).
FMIBase.providesAdjointDerivatives
— MethodReturns true, if the FMU provides adjoint derivatives
FMIBase.providesDirectionalDerivatives
— MethodprovidesDirectionalDerivative(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
FMIBase.setContinuousStates
— MethodToDo
FMIBase.setDiscreteStates
— MethodToDo
FMIBase.setDiscreteStates
— MethodsetDiscreteStates(c::FMU2Component,
x::Union{AbstractArray{Float32},AbstractArray{Float64}})
Set a new (discrete) state vector and reinitialize chaching of variables that depend on states.
Arguments
[ToDo]
FMIBase.setFMUstate!
— MethodToDo
FMIBase.setReal
— MethodToDo
FMIBase.setTime
— MethodToDo
FMIBase.setValue
— MethodsetValue(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 offmi2ScalarVariable
containing the modelVariables with the identical fmi2ValueReference to the input variable vr (vr = vrs[i]).srcArray
has 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
. Typefmi2Status
is an enumeration and indicates the success of the function call.
FMIBase.statusToString
— MethodstatusToString(::struct, status::Union{fmi2Status, Integer})
Converts fmi2Status
status
into a String ("OK", "Warning", "Discard", "Error", "Fatal", "Pending").
FMIBase.stringToCausality
— MethodstringToCausality(s::AbstractString)
Converts s
("parameter", "calculatedParameter", "input", "output", "local", "independent") to the corresponding fmi2Causality
.
FMIBase.stringToDataType
— MethodstringToDataType(modelDescription, typename)
Converts a typename to type, for example "Float64"
(::String) to fmi3Float64
(::DataType).
FMIBase.stringToDependencyKind
— MethodstringToDependencyKind(s::AbstractString)
Converts s
("dependent", "constant", "fixed", "tunable", "discrete") to the corresponding fmi2DependencyKind
FMIBase.stringToInitial
— MethodstringToInitial(s::AbstractString)
Converts s
("approx", "exact", "calculated") to the corresponding fmi2Initial
.
FMIBase.stringToIntervalQualifier
— MethodstringToIntervalQualifier(::FMI3Struct, s::AbstractString)
Convert s
("intervalNotYetKnown", "intervalUnchanged", "intervalChanged") to the corresponding fmi3IntervalQualifier
.
FMIBase.stringToStatus
— MethodstringToStatus(s)
Converts a String s
to fmi2Status.
FMIBase.stringToType
— MethodstringToType(s::AbstractString)
Convert s
("coSimulation", "modelExchange", "scheduledExecution") to the corresponding fmi3Type
.
FMIBase.stringToValueReference
— MethodstringToValueReference(obj, names)
Finds the value reference for a given name
.
Arguments
obj ∈ (fmi2ModelDescription, fmi3ModelDescription, FMU2, FMU3)
the FMI objectnames ∈ (String, AbstractVector{String})
the value refernce name or multiple names
Return
Returns a single or an array of fmi2ValueReferences
(FMI2) or fmi3ValueReferences
(FMI3) corresponding to the variable name(s).
FMIBase.stringToVariability
— MethodstringToVariability(s::AbstractString)
Converts s
("constant", "fixed", "tunable", "discrete", "continuous") to the corresponding fmi2Variability
.
FMIBase.stringToVariableNamingConvention
— MethodstringToVariableNamingConvention(s::AbstractString)
Convert s
("flat", "structured") to the corresponding fmi3VariableNamingConvention
.
FMIBase.typeToString
— MethodtypeToString(c::fmi3Type)
Convert fmi3Type
c
to the corresponding String ("coSimulation", "modelExchange", "scheduledExecution").
FMIBase.valueReferenceToString
— MethodvalueReferenceToString(obj, reference)
where:
obj ∈ (fmi2ModelDescription, fmi3ModelDescription, FMU2, FMU3) reference ∈ (fmi2ValueReference, fmi3ValueReference, Integer
Returns the string identifier for a give value reference.
FMIBase.variabilityToString
— MethodvariabilityToString(c::fmi2Variability)
Converts fmi2Variability
c
to the corresponding String ("constant", "fixed", "tunable", "discrete", "continuous").
FMIBase.variableNamingConventionToString
— MethodvariableNamingConventionToString(c::fmi3VariableNamingConvention)
Convert fmi3VariableNamingConvention
c
to the corresponding String ("flat", "structured").