FMIBase.FMI2StructType
FMI2Struct

A wildcard for FMI2 related structs, namely Union{FMU2, fmi2ModelDescription, FMU2Component}.

FMIBase.FMI3StructType
FMI3Struct

A wildcard for FMI3 related structs, namely Union{FMU3, fmi3ModelDescription, FMU3Instance}.

FMIBase.FMUType
FMU

The abstract type for FMUs (FMI 2 & 3).

FMIBase.FMUMethod
(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 output y (if requested, otherwise nothing).
  • dx::Union{AbstractVector{<:Real}, Nothing}: The system state-derivaitve (if ME-FMU, otherwise nothing).
  • ec::Union{AbstractVector{<:Real}, Nothing}: The system event indicators (if ME-FMU, otherwise nothing).
FMIBase.FMU2Type

The 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.FMU2ComponentType

The mutable struct represents an allocated instance of an FMU in the FMI 2.0.2 Standard.

FMIBase.FMU2ComponentEnvironmentType

Source: 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.FMU3Type

Source: 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.FMU3InstanceType

Source: 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.FMU3InstanceEnvironmentType

This 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.FMUExecutionConfigurationType

A 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.FMUInputFunctionType
FMUInputFunction(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.FMUInstanceType
FMUInstance

An instance of a FMU. This was called component in FMI2, but was corrected to instance in FMI3.

FMIBase.FMUInstanceMethod
(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 output y (if requested, otherwise nothing).
  • dx::Union{AbstractVector{<:Real}, Nothing}: The system state-derivaitve (if ME-FMU, otherwise nothing).
  • ec::Union{AbstractVector{<:Real}, Nothing}: The system event indicators (if ME-FMU, otherwise nothing).
FMIBase.FMULogLevelType

Log levels for non-standard printing of infos, warnings and errors.

Base.showMethod

Overload the Base.show() function for custom printing of the FMU2Component.

Base.showMethod

Overload the Base.show() function for custom printing of the FMU2.

Base.showMethod

Overload the Base.show() function for custom printing of the FMU3Instance.

Base.showMethod

Overload the Base.show() function for custom printing of the FMU3

Base.showMethod

Overload the Base.show() function for custom printing of the FMU2.

FMIBase.canGetSetFMUStateMethod
canGetSetFMUState(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.canSerializeFMUStateMethod
canSerializeFMUState(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.causalityToStringMethod
causalityToString(c::fmi2Causality)

Converts fmi2Causality c to the corresponding String ("parameter", "calculatedParameter", "input", "output", "local", "independent").

FMIBase.dataTypeForValueReferenceMethod
dataTypeForValueReference(obj, vr::fmi2ValueReference)

where:

obj ∈ (fmi2ModelDescription, FMU2)

Returns the fmi2DataType (fmi2Real, fmi2Integer, fmi2Boolean, fmi2String) for a given value reference vr.

FMIBase.doStepMethod
doStep(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.getDeclaredTypeMethod
getDeclaredType(md::fmi2ModelDescription, mv::fmi2ScalarVariable)

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

Arguments

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

Source

FMIBase.getDefaultStartTimeMethod
getDefaultStartTime(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 value startTime from the DefaultExperiment if defined else defaults to nothing.
FMIBase.getDefaultStepSizeMethod
getDefaultStepSize(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 value setpSize from the DefaultExperiment if defined else defaults to nothing.
FMIBase.getDefaultStopTimeMethod
getDefaultStopTime(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 value stopTime from the DefaultExperiment if defined else defaults to nothing.
FMIBase.getDefaultToleranceMethod
getDefaultTolerance(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 value tolerance from the DefaultExperiment if defined else defaults to nothing.
FMIBase.getDerivateValueReferencesAndNamesMethod
fmi2GetDerivateValueReferencesAndNames(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.getDerivativeNamesMethod
fmi2GetDerivativeNames(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 attribute derivativeValueReferences::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 references vrs
FMIBase.getDiscreteStates!Method
getDiscreteStates!(c, xd)

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

Arguments

  • c::FMU2Component
  • xd::AbstractArray{Union{fmi2Real, fmi2Integer, fmi2Boolean}}
FMIBase.getDiscreteStatesMethod
getDiscreteStates(c)

Sets a new (discrete) state vector (out-of-place).

Arguments

  • c::FMU2Component
FMIBase.getFMUstate!Method
getFMUstate!(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 instance
  • state ∈ (Ref{fmi2FMUstate}, Ref{fmi3FMUState}): the FMU state reference
FMIBase.getGenerationDateAndTimeMethod
getGenerationDateAndTime(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.getGenerationToolMethod
getGenerationTool(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.getInitialMethod
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

FMIBase.getInputNamesMethod
getInputNames(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 attribute inputvalueReferences::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 references vrs
FMIBase.getInputNamesAndStartsMethod
getInputNamesAndStarts(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.getInputValueReferencesAndNamesMethod
getInputValueReferencesAndNames(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.getModelIdentifierMethod
getModelIdentifier(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 tag modelIdentifier from ModelExchange section.
  • md.coSimulation.modelIdentifier::String: Returns the tag modelIdentifier from CoSimulation section.
FMIBase.getModelNameMethod
getModelName(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.getModelVariableIndicesMethod
getModelVariableIndices(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 attribute valueReferences::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 references vrs
FMIBase.getNamesMethod
getNames(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 attribute valueReferences::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 references vrs
FMIBase.getNamesAndDescriptionsMethod
getNamesAndDescriptions(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.getNamesAndInitialsMethod
getNamesAndInitials(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.getNamesAndUnitsMethod
getNamesAndUnits(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.getNumberOfEventIndicatorsMethod
getNumberOfEventIndicators(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.getNumberOfStatesMethod
getNumberOfStates(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.getOutputNamesMethod
fmi2GetOutputNames(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 attribute outputvalueReferences::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 references vrs
FMIBase.getOutputValueReferencesAndNamesMethod
getOutputValueReferencesAndNames(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 attribute outputvalueReferences::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.getParameterNamesMethod
fmi2GetParameterNames(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 attribute parameterValueReferences::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 references vrs
FMIBase.getParameterValueReferencesAndNamesMethod
getParameterValueReferencesAndNames(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.getSimpleTypeAttributeStructMethod
getSimpleTypeAttributeStruct(st::fmi2SimpleType)

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

Arguments

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

Source

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

FMIBase.getStateNamesMethod
fmi2GetStateNames(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 attribute parameterValueReferences::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 references vrs
FMIBase.getStateValueReferencesAndNamesMethod
fmi2GetStateValueReferencesAndNames(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.getUnitMethod
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

FMIBase.getValue!Method
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.
FMIBase.getValueMethod
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.
FMIBase.getValueReferencesAndNamesMethod
getValueReferencesAndNames(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 attribute valueReferences::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.getVariableNamingConventionMethod
getVariableNamingConvention(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.isCoSimulationMethod
isCoSimulation(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.isModelExchangeMethod
isModelExchange(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.logErrorFunction

Prints a message with level error if the log level allows it.

FMIBase.logInfoFunction

Prints a message with level info if the log level allows it.

FMIBase.logWarningFunction

Prints a message with level warn if the log level allows it.

FMIBase.modelVariablesForValueReferenceMethod
modelVariablesForValueReference(obj, vr)

where:

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

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

FMIBase.prepareValueMethod
prepareValue(value)

Prepares a value for a FMI ccall (they only accept arrays). Technically, the value is packed into an array - if not already.

FMIBase.prepareValueReferenceMethod
prepareValueReference(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.providesDirectionalDerivativesMethod
providesDirectionalDerivative(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.setDiscreteStatesMethod
setDiscreteStates(c::FMU2Component,
                             x::Union{AbstractArray{Float32},AbstractArray{Float64}})

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

Arguments

[ToDo]

FMIBase.setValueMethod
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.
FMIBase.statusToStringMethod
statusToString(::struct, status::Union{fmi2Status, Integer})

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

FMIBase.stringToCausalityMethod
stringToCausality(s::AbstractString)

Converts s ("parameter", "calculatedParameter", "input", "output", "local", "independent") to the corresponding fmi2Causality.

FMIBase.stringToDataTypeMethod
stringToDataType(modelDescription, typename)

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

FMIBase.stringToTypeMethod
stringToType(s::AbstractString)

Convert s ("coSimulation", "modelExchange", "scheduledExecution") to the corresponding fmi3Type.

FMIBase.stringToValueReferenceMethod
stringToValueReference(obj, names)

Finds the value reference for a given name.

Arguments

  • obj ∈ (fmi2ModelDescription, fmi3ModelDescription, FMU2, FMU3) the FMI object
  • names ∈ (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.typeToStringMethod
typeToString(c::fmi3Type)

Convert fmi3Type c to the corresponding String ("coSimulation", "modelExchange", "scheduledExecution").

FMIBase.valueReferenceToStringMethod
valueReferenceToString(obj, reference)

where:

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

Returns the string identifier for a give value reference.