FMI2 Types in FMI Import/Core .jl
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.FMI2Struct
— TypeFMI2Struct
A wildcard for FMI2 related structs, namely Union{FMU2, fmi2ModelDescription, FMU2Component}
.
FMICore.fmi2Initial
— TypeSource: FMISpec2.0.2[p.48]: 2.2.7 Definition of Model Variables (ModelVariables)
Enumeration that defines how the variable is initialized. It is not allowed to provide a value for initial if causality = "input" or "independent":
"exact": The variable is initialized with the start value (provided under Real, Integer, Boolean, String or Enumeration). "approx": The variable is an iteration variable of an algebraic loop and the iteration at initialization starts with the start value. "calculated": The variable is calculated from other variables during initialization. It is not allowed to provide a “start” value. If initial is not present, it is defined by the table below based on causality and variability. If initial = exact or approx, or causality = ″input″, a start value must be provided. If initial = calculated, or causality = ″independent″, it is not allowed to provide a start value. If fmiSetXXX is not called on a variable with causality = ″input″, then the FMU must use the start value as value of this input. Added prefix "fmi2" to help with redefinition of constans in enums.
FMICore.fmi2ScalarVariable
— TypeSource: FMISpec2.0.2[p.46]: 2.2.7 Definition of Model Variables (ModelVariables)
The fmi2ScalarVariable specifies the type and argument of every exposed variable in the fmu
FMICore.fmi2SimpleType
— TypeSource: FMISpec2.0.3[p.40]: 2.2.3 Definition of Types (TypeDefinitions)
The fmi2SimpleType describes the attributes of a type definition.
FMICore.fmi2Type
— TypeSource: FMISpec2.0.2[p.19]: 2.1.5 Creation, Destruction and Logging of FMU Instances
Argument fmuType defines the type of the FMU:
- fmi2ModelExchange: FMU with initialization and events; between events simulation of continuous systems is performed with external integrators from the environment.
- fmi2CoSimulation: Black box interface for co-simulation.
FMICore.fmi2BaseUnit
— TypeSource: FMISpec2.0.3[p.35]: 2.2.2 Definition of Units (UnitDefinitions)
fmi2BaseUnit(
kg=0, m=0, s=0, A=0, K=0, mol=0, cd=0, rad=0, factor=1.0, offset=0.0)
Type for the optional “BaseUnit” field of an fmi2Unit
.
FMICore.fmi2Unit
— TypeSource: FMISpec2.0.3[p.35]: 2.2.2 Definition of Units (UnitDefinitions)
Element “UnitDefinitions ” of fmiModelDescription.
FMICore.fmi2DisplayUnit
— TypeSource: FMISpec2.0.3[p.35]: 2.2.2 Definition of Units (UnitDefinitions)
fmi2DisplayUnit(name, factor=1.0, offset=0.0)
Type for the optional “DisplayUnit” field(s) of an fmi2Unit
.
FMICore.fmi2Char
— TypeSource: FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
FMI2 Data Types To simplify porting, no C types are used in the function interfaces, but the alias types are defined in this section. All definitions in this section are provided in the header file “fmi2TypesPlatform.h”.
FMICore.fmi2Variability
— TypeSource: FMISpec2.0.2[p.49]: 2.2.7 Definition of Model Variables (ModelVariables)
Enumeration that defines the time dependency of the variable, in other words, it defines the time instants when a variable can change its value.
"constant": The value of the variable never changes. "fixed": The value of the variable is fixed after initialization, in other words, after fmi2ExitInitializationMode was called the variable value does not change anymore. "tunable": The value of the variable is constant between external events (ModelExchange) and between Communication Points (Co-Simulation) due to changing variables with causality = "parameter" or "input" and variability = "tunable". Whenever a parameter or input signal with variability = "tunable" changes, an event is triggered externally (ModelExchange), or the change is performed at the next Communication Point (Co-Simulation) and the variables with variability = "tunable" and causality = "calculatedParameter" or "output" must be newly computed. "discrete": ModelExchange: The value of the variable is constant between external and internal events (= time, state, step events defined implicitly in the FMU). Co-Simulation: By convention, the variable is from a “real” sampled data system and its value is only changed at Communication Points (also inside the slave). "continuous": Only a variable of type = “Real” can be “continuous”. ModelExchange: No restrictions on value changes. Co-Simulation: By convention, the variable is from a differential The default is “continuous”. Added prefix "fmi2" to help with redefinition of constans in enums.
FMICore.fmi2VariableDependency
— TypeMutable Struct representing existance and kind of dependencies of an Unknown on Known Variables in Continuous-Time and Event Mode (ME) and at Communication Points (CS)
See also FMI2.0.3 Spec fmi2VariableDependency [p.60]
FMICore.fmi2DependencyKind
— TypeTypes of dependency:
fmi2DependencyKindDependent
: no particular structure, f(v)fmi2DependencyKindConstant
: constant factor, c*v (for Real valued variables only)fmi2DependencyKindFixed
: tunable factor, p*v (for Real valued variables only)fmi2DependencyKindTunable
[ToDo]fmi2DependencyKindDiscrete
[ToDo]
Source: FMI2.0.3 Spec for fmi2VariableDependency [p.60]
FMICore.fmi2EventInfo
— TypeSource: FMISpec2.0.2[p.84]: 3.2.2 Evaluation of Model Equations
If return argument fmi2eventInfo.newDiscreteStatesNeeded = fmi2True, the FMU should stay in Event Mode, and the FMU requires to set new inputs to the FMU (fmi2SetXXX on inputs) to compute and get the outputs (fmi2GetXXX on outputs) and to call fmi2NewDiscreteStates again. Depending on the connection with other FMUs, the environment shall
- call fmi2Terminate, if terminateSimulation = fmi2True is returned by at least one FMU.
- call fmi2EnterContinuousTimeMode if all FMUs return newDiscreteStatesNeeded = fmi2False.
- stay in Event Mode otherwise.
When the FMU is terminated, it is assumed that an appropriate message is printed by the logger function (see section 2.1.5) to explain the reason for the termination. If nominalsOfContinuousStatesChanged = fmi2True, then the nominal values of the states have changed due to the function call and can be inquired with fmi2GetNominalsOfContinuousStates. If valuesOfContinuousStatesChanged = fmi2True. then at least one element of the continuous state vector has changed its value due to the function call. The new values of the states can be retrieved with fmi2GetContinuousStates or individually for each state for which reinit = "true" by calling getReal. If no element of the continuous state vector has changed its value, valuesOfContinuousStatesChanged must return fmi2False. [If fmi2True would be returned in this case, an infinite event loop may occur.] If nextEventTimeDefined = fmi2True, then the simulation shall integrate at most until time = nextEventTime, and shall call fmi2EnterEventMode at this time instant. If integration is stopped before nextEventTime, for example, due to a state event, the definition of nextEventTime becomes obsolete.
FMICore.fmi2Status
— TypeSource: FMISpec2.0.2[p.18]: 2.1.3 Status Returned by Functions
Status returned by functions. The status has the following meaning:
- fmi2OK – all well
- fmi2Warning – things are not quite right, but the computation can continue. Function “logger” was called in the model (see below), and it is expected that this function has shown the prepared information message to the user.
- fmi2Discard – this return status is only possible if explicitly defined for the corresponding function
(ModelExchange: fmi2SetReal, fmi2SetInteger, fmi2SetBoolean, fmi2SetString, fmi2SetContinuousStates, fmi2GetReal, fmi2GetDerivatives, fmi2GetContinuousStates, fmi2GetEventIndicators; CoSimulation: fmi2SetReal, fmi2SetInteger, fmi2SetBoolean, fmi2SetString, fmi2DoStep, fmiGetXXXStatus): For “model exchange”: It is recommended to perform a smaller step size and evaluate the model equations again, for example because an iterative solver in the model did not converge or because a function is outside of its domain (for example sqrt(<negative number>)). If this is not possible, the simulation has to be terminated. For “co-simulation”: fmi2Discard is returned also if the slave is not able to return the required status information. The master has to decide if the simulation run can be continued. In both cases, function “logger” was called in the FMU (see below) and it is expected that this function has shown the prepared information message to the user if the FMU was called in debug mode (loggingOn = fmi2True). Otherwise, “logger” should not show a message.
- fmi2Error – the FMU encountered an error. The simulation cannot be continued with this FMU instance. If one of the functions returns fmi2Error, it can be tried to restart the simulation from a formerly stored FMU state by calling fmi2SetFMUstate.
This can be done if the capability flag canGetAndSetFMUstate is true and fmi2GetFMUstate was called before in non-erroneous state. If not, the simulation cannot be continued and fmi2FreeInstance or fmi2Reset must be called afterwards.4 Further processing is possible after this call; especially other FMU instances are not affected. Function “logger” was called in the FMU (see below), and it is expected that this function has shown the prepared information message to the user.
- fmi2Fatal – the model computations are irreparably corrupted for all FMU instances. [For example, due to a run-time exception such as access violation or integer division by zero during the execution of an fmi function]. Function “logger” was called in the FMU (see below), and it is expected that this function has shown the prepared information message to the user. It is not possible to call any other function for any of the FMU instances.
- fmi2Pending – this status is returned only from the co-simulation interface, if the slave executes the function in an asynchronous way. That means the slave starts to compute but returns immediately. The master has to call fmi2GetStatus(..., fmi2DoStepStatus) to determine if the slave has finished the computation. Can be returned only by fmi2DoStep and by fmi2GetStatus (see section 4.2.3).
FMICore.fmi2Annotation
— TypeA not further specified annotation struct.
FMICore.fmi2ModelDescription
— TypeSource: FMISpec2.0.2[p.34]: 2.2.1 Definition of an FMU (fmiModelDescription)
The “ModelVariables” element of fmiModelDescription is the central part of the model description. It provides the static information of all exposed variables.
FMICore.fmi2FMUstate
— Typefmi2FMUstate is a pointer to a data structure in the FMU that saves the internal FMU state of the actual or a previous time instant. This allows to restart a simulation from a previous FMU state.
Source: FMI2.0.3 Spec [p.17]; See also section 2.1.8
FMICore.fmi2StatusKind
— TypeSource: FMISpec2.0.2[p.106]: 4.2.3 Retrieving Status Information from the Slave
CoSimulation specific Enum representing state of FMU after fmi2DoStep returned fmi2Pending.
FMICore.fmi2VariableNamingConvention
— TypeToDo
FMICore.fmi2Causality
— TypeSource: FMISpec2.0.2[p.48]: 2.2.7 Definition of Model Variables (ModelVariables)
Enumeration that defines the causality of the variable. Allowed values of this enumeration:
"parameter": Independent parameter (a data value that is constant during the simulation and is provided by the environment and cannot be used in connections). variability must be "fixed" or "tunable". initial must be exact or not present (meaning exact). "calculatedParameter": A data value that is constant during the simulation and is computed during initialization or when tunable parameters change. variability must be "fixed" or "tunable". initial must be "approx", "calculated" or not present (meaning calculated). "input": The variable value can be provided from another model or slave. It is not allowed to define initial. "output": The variable value can be used by another model or slave. The algebraic relationship to the inputs is defined via the dependencies attribute of <fmiModelDescription><ModelStructure><Outputs><Unknown>. "local": Local variable that is calculated from other variables or is a continuous-time state (see section 2.2.8). It is not allowed to use the variable value in another model or slave. "independent": The independent variable (usually “time”). All variables are a function of this independent variable. variability must be "continuous". At most one ScalarVariable of an FMU can be defined as "independent". If no variable is defined as "independent", it is implicitly present with name = "time" and unit = "s". If one variable is defined as "independent", it must be defined as "Real" without a "start" attribute. It is not allowed to call function fmi2SetReal on an "independent" variable. Instead, its value is initialized with fmi2SetupExperiment and after initialization set by fmi2SetTime for ModelExchange and by arguments currentCommunicationPoint and communicationStepSize of fmi2DoStep for CoSimulation. [The actual value can be inquired with fmi2GetReal.] The default of causality is “local”. A continuous-time state must have causality = "local" or "output", see also section 2.2.8. [causality = "calculatedParameter" and causality = "local" with variability = "fixed" or "tunable" are similar. The difference is that a calculatedParameter can be used in another model or slave, whereas a local variable cannot. For example, when importing an FMU in a Modelica environment, a "calculatedParameter" should be imported in a public section as final parameter, whereas a "local" variable should be imported in a protected section of the model.] Added prefix "fmi2" to help with redefinition of constans in enums.
FMIBase.fmi2ComponentState
— TypeToDo
fmi2StructMD FMU2Solution FMIImport.fmi2ValueReferenceFormat FMU2Event FMU2ExecutionConfiguration
FMI2 Constants in FMI Import/Core .jl
FMICore.fmi2True
— ConstantSource: FMISpec2.0.2[p.16]: 2.1.2 Platform Dependent Definitions
To simplify porting, no C types are used in the function interfaces, but the alias types are defined in this section. All definitions in this section are provided in the header file “fmi2TypesPlatform.h”.
FMIBase.fmi2ComponentStateInstantiated
— ConstantToDo
FMIBase.fmi2ComponentStateInitializationMode
— ConstantToDo
FMIBase.fmi2ComponentStateEventMode
— ConstantToDo
FMIBase.fmi2ComponentStateContinuousTimeMode
— ConstantToDo
FMIBase.fmi2ComponentStateTerminated
— ConstantToDo
FMIBase.fmi2ComponentStateError
— ConstantToDo
FMIBase.fmi2ComponentStateFatal
— ConstantToDo
fmi2False fmi2StatusOK fmi2StatusWarning fmi2StatusPending fmi2StatusError fmi2StatusDiscard fmi2StatusFatal