All static information related to the core functionality of an FMU is stored in the text file modelDescription.xml
in XML format as specified by the XML schema file fmi3ModelDescription.xsd
.
Especially, the FMU variables and their attributes such as name
, unit
, start
value, etc. are stored in this file.
Additional optional information about the graphical representation and the grouping of FMU variables into terminals is stored in the optional text file terminalsAndIcons/terminalsAndIcons.xml
in XML format as specified by the XML schema file fmi3TerminalsAndIcons.xsd
.
Build information for source code FMUs is provided together with a buildDescription.xml
file in the sources
directory that adheres to the fmi3BuildDescription.xsd
schema file.
It is not allowed to change the modelDescription.xml
file within an FMU.
[Reason: The modelDescription.xml
file has to be consistent with the binary or source code implementations.
Specifically, changes to the start values would introduce such inconsistencies.]
In this section the schema files mentioned above, including their helper schema files, are discussed.
In the graphical representation of the schemata, optional elements are marked with a dashed box (e.g., see Annotations Element.).
The required data types (like: xs:normalizedString
) are defined in XML Schema Part 2: Datatypes Second Edition.
The types used in the FMI schema files are:
XML | Description (https://www.w3.org/TR/xmlschema-2/) | Mapping to C | Mapping to FMI |
---|---|---|---|
|
IEEE 754 double-precision 64-bit floating point type [An IEEE 754 double-precision floating point value can have up to 17 significant digits in its decimal representation. In order to not loose precision, either an appropriate minimal printer algorithm should be used, or alternatively a number of this type should be stored in XML files with at least 17 significant digits.] |
|
|
|
IEEE 754 single-precision 32-bit floating point type [An IEEE 754 single-precision floating point value can have up to 9 significant digits in its decimal representation. In order to not loose precision, either an appropriate minimal printer algorithm should be used, or alternatively a number of this type should be stored in XML files with at least 9 significant digits.] |
|
|
|
Integer number with maximum value 127 and minimum value -128 (8-bit signed integer) |
|
|
|
Integer number with maximum value 255 and minimum value 0 (8-bit unsigned integer) |
|
|
|
Integer number with maximum value 32767 and minimum value -32768 (16-bit signed integer) |
|
|
|
Integer number with maximum value 65535 and minimum value 0 (16-bit unsigned integer) |
|
|
|
Integer number with maximum value 2147483647 and minimum value -2147483648 (32-bit signed integer) |
|
|
|
Integer number with maximum value 4294967295 and minimum value 0 (32-bit unsigned integer) |
|
|
|
Integer number with maximum value 9223372036854775807 and minimum value -9223372036854775808 (64-bit signed integer) |
|
|
|
Integer number with maximum value 18446744073709551615 and minimum value 0 (64-bit unsigned integer) |
|
|
|
Boolean number.
Legal literals: |
|
|
|
Any number of characters |
|
|
|
String without carriage return, line feed, and tab characters |
|
|
|
Arbitrary hex-encoded binary data |
|
|
|
Date, time and time zone (for details see XML Schema Part 2: Datatypes Second Edition).
Example: |
tool specific |
not defined |
The first line of an XML file, such as modelDescription.xml
, must contain the encoding scheme of the XML file.
It is required that the encoding scheme is always UTF-8:
link:examples/co_simulation.xml[role=include]
The FMI schema files (fmi3*.xsd
) are also stored in UTF-8.
[Note that the definition of an encoding scheme is a prerequisite in order for the XML file to contain letters outside of the 7-bit ANSI ASCII character set, such as German umlauts, or Asian characters.
Furthermore, note the FMI calling interface requires that strings are encoded in UTF-8.
Since the XML files are also required to be encoded in UTF-8, string variables need not to be transformed when reading from the XML files in to C string variables.].
name
attributes of list elements (for example VariableType or Variable) must be unique within that list and must not be empty strings.
Additional restrictions for these name
attributes are listed in their respective sections.
[Note that child information items, such as elements in a sequence are ordered lists according to document order, whereas attribute information items are unordered sets (see https://www.w3.org/TR/XML-infoset/#infoitem.element).
The FMI schema is based on ordered lists in a sequence and therefore parsing must preserve this order.
For example, the order of the <ContinuousStateDerivative>
elements define the order to be used in [fmi3GetContinuousStates], [fmi3SetContinuousStates], and [fmi3GetContinuousStateDerivatives].]
All XML-based file formats defined in this standard allow optional Annotation
elements to be inserted in certain XML elements.
This is achieved through the Annotations
element:
Each Annotation
element contains a required type
attribute, which contains the namespace for that annotation.
The content of the Annotation
element can be arbitrary XML data, and can make use of XML namespaces and XML schemas for combined validation where appropriate.
The namespace mechanism for the type
attribute is based on reverse domain notation:
The originator of a specification for additional data specifies a domain name under their control as the namespace for the additional data, in order to avoid conflicts due to name collisions.
All namespaces under both the org.modelica
and org.fmi-standard
domains are reserved for use in future layered standards.
[For example, extensions defined by the Modelica Association might make use of the org.modelica.fmi
namespace.
This could lead to annotations with a type
attribute of org.modelica.fmi.something
, and/or extra files under the extra/org.modelica.ssp.something
sub-directory.]
Annotations are intended to allow structured extensions of the FMI XML files, without creating conflicting extensions, or leaving ambiguities in interpretation. All annotations may safely be ignored by implementations that just implement the base FMI standard.
fmiModelDescription
element. shows the root element fmiModelDescription
.
[If an optional element is present and defines a list (such as <UnitDefinitions>
), the list must have at least one element (such as <Unit>
).]
fmiModelDescription
element details.
Element | Description |
---|---|
|
If present, the FMU is based on FMI for Model Exchange ([fmi-for-model-exchange]). |
|
If present, the FMU is based on FMI for Co-Simulation ([fmi-for-co-simulation]). |
|
If present, the FMU is based on FMI for Scheduled Execution ([fmi-for-scheduled-execution]). |
|
A list of unit and display unit definitions [for example, used to convert display units into the units used in the model equations].
These definitions are used in the XML element |
|
A list of type definitions that are utilized in |
|
A list of log categories that can be set to define the log information that is supported from the FMU. |
|
Default settings for the importer algorithms, such as stop time and relative tolerance. |
A list of all variables of the FMU that are accessible via the FMU functions. |
|
Defines the structure of the model.
Especially, the ordered lists of |
|
Optional annotations for the top-level element. |
At least one element of <ModelExchange>
, <CoSimulation>
or <ScheduledExecution>
must be present to identify the type of the FMU.
The details of these elements are defined in [model-exchange-schema], [co-simulation-schema] or [scheduled-execution-schema].
How to support multiple interface types within one FMU, see [multipleInterfaceTypes].
The XML attributes of <fmiModelDescription>
are:
fmiModelDescription
attribute details.
Attribute | Description |
---|---|
|
Version of FMI the XML file complies with.
The value for this version is [During development prototype FMU implementations can indicate compliance with a certain development version based on the tags available at https://github.com/modelica/fmi-standard/tags.
For example the value for the FMI 3.0 Alpha 2 release is |
|
The name of the model as used in the modeling environment that generated the XML file, such as |
|
The |
|
Optional string with a brief description of the model. |
|
Optional string with the name of the model author. |
|
Optional version of the model [for example |
|
Optional information on the intellectual property copyright for this FMU [for example |
|
Optional information on the intellectual property licensing for this FMU. |
|
Optional name of the tool that generated the XML file. |
|
Optional date and time when the XML file was generated.
The format is a subset of |
Defines whether the variable names in |
The elements <ModelExchange>
, <CoSimulation>
and <ScheduledExecution>
contain attributes, some representing capability flags, describing which optional functionalities the FMU supports.
Note that future FMI minor releases may add additional capability flags for optional features. Importers must be prepared to ignore unknown capability flags. Exporters must not generate capability flags without an XML namespace, unless specified by this standard or any later release of this standard.
The following table contains attributes and capability flags common to all three interface types.
For all Boolean attributes the default is false
.
Attribute | Description |
---|---|
|
Short class name according to C syntax, for example, |
|
If |
|
If |
|
If |
|
If |
|
If |
|
If |
|
If |
|
If |
This section describes how units for variables can be defined. These descriptions allow automatic unit checks and value conversion in the importer to bridge the gap between FMUs from different simulation domains. The FMI unit descriptions are more secure than using humanly readable unit strings only, because all units can be defined as combinations of the seven SI base units.
Element <fmiModelDescription><UnitDefinitions>
is defined as:
Units are referenced via its unique attribute name
by the attribute unit
and displayUnit
of variable types and variables.
The name
of a Unit
must be unique with respect to all other <Unit>
elements.
If a variable is associated with a Unit
, the value passed to fmi3Set{VariableType}
(resp. retrieved with fmi3Get{VariableType}
) has this unit.
[The purpose of the name is to uniquely identify a unit and, for example, use it to display the unit in menus or in plots.
Since there is no standard to represent units in strings, and there are different ways how this is performed in different tools, no specific format for the string representation of the unit is required.]
The Unit
definition consists of the exponents of the seven SI base units kg
, m
, s
, A
, K
, mol
, cd
, the exponent of the SI derived unit rad
, and optionally a factor
and an offset
.
[The additional rad
base unit helps to handle the often occurring quantities in technical systems that depend on an angle.]
A value \(v_{\mathit{unit}}\) in Unit
is converted to the base unit \(v_{\mathit{base}}\) by the equation
where factor
and offset
are attributes of the <BaseUnit>
, and relativeQuantity
an attribute of the TypeDefinition
of a variable.
[For example, if \({p_{\mathit{bar}}}\) is a pressure value in unit bar
, and \({p_{\mathit{Pa}}}\) is the pressure value in <BaseUnit>
, then
and therefore, factor = 1.0e5
and offset = 0.0
.
In the following table several unit examples are given.
Note that if in column exponents
the definition \(\frac{kg \cdot m^2}{s^2}\) is present, then the attributes of <BaseUnit>
are kg=1, m=2, s=-2
.
Quantity |
Unit.name (examples) |
Unit.BaseUnit |
||
---|---|---|---|---|
exponents |
factor |
offset |
||
Torque |
|
\({kg \cdot m^2 / s^2}\) |
|
|
Energy |
|
\({kg \cdot m^2 / s^2}\) |
|
|
Pressure |
|
\({\frac{kg}{m \cdot s^2}}\) |
|
|
Angle |
|
|
|
|
Angular velocity |
|
|
|
|
Angular velocity |
|
|
|
|
Frequency |
|
|
|
|
Temperature |
|
|
|
|
Percent by length |
|
|
|
|
Parts per million |
|
|
|
|
Length |
|
|
|
|
Length |
|
|
|
|
Note that Hz
is typically used as Unit.name
for a frequency quantity, but it can also be used as <DisplayUnit>
for an angular velocity quantity (since revolution/s
).
The <BaseUnit>
definitions can be utilized for different purposes (the following application examples are optional and a tool may also completely ignore the Unit
definitions):
- Unit check when connecting variables of different FMUs
-
When only one of
input
v2
andoutput
v1
, connected with equationv2 = v1
, defines a<BaseUnit>
element,fmi3Get{VariableType}
must be used to get the value ofv1
to then set it withfmi3Set{VariableType}
forv2
.When two variables v1 and v2 are connected and for both of them
<BaseUnit>
elements are defined, then they must have identical exponents of their<BaseUnit>
. Iffactor
andoffset
are also identical, again the connection equationv2 = v1
holds. Iffactor
andoffset
are not identical, the tool may either trigger an error or, if supported, perform a conversion; in other words, use the connection equation (in this case therelativeQuantity
of the<TypeDefinition>
, see below, has to be taken into account in order to determine whetheroffset
shall or shall not be utilized):factor(v1) * v1 + (if relativeQuantity(v1) then 0 else offset(v1)) = factor(v2) * v2 + (if relativeQuantity(v2) then 0 else offset(v2))
whererelativeQuantity(v1) = relativeQuantity(v2)
is required.As a result, wrong connections can be detected (for example, connecting a force with an angle-based variable would trigger an error) and conversions between, say, US and SI units can be either automatically performed or, if not supported, an error is triggered as well.
This approach is not satisfactory for variables belonging to different quantities that have, however, the same
<BaseUnit>
, such as quantitiesEnergy
andTorque
, orAngularVelocity
andFrequency
. To handle such cases, quantity definitions have to be taken into account (see<TypeDefinitions>
) and quantity names need to be standardized.This approach allows a general treatment of units, without being forced to standardize the grammar and allowed values for units (for example, in FMI 1.0, a unit could be defined as
N.m
in one FMU and asN*m
in another FMU, and a tool would have to reject a connection, since the units are not identical. In FMI 2.0, the connection would be accepted, provided both elements have the same<BaseUnit>
definition). - Dimensional analysis of equations
-
In order to check the validity of equations in a modeling language, the defined units can be used for dimensional analysis, by using the
<BaseUnit>
definition of the respective unit. For this purpose, the<BaseUnit>
rad
has to be treated as1
. Example:\[\begin{align*} J \cdot \alpha = \tau \rightarrow [kg.m^2]*[rad/s^2] = [kg.m^2/s^2] & \quad \text{// o.k. ("rad" is treated as "1")} \\ J \cdot \alpha = f \rightarrow [kg.m^2]*[rad/s^2] = [kg.m/s^2] & \quad \text{// error, since dimensions do not agree} \end{align*}\] - Unit propagation
-
If unit definitions are missing for variables, they might be deduced from the equations where the variables are used. If no unit computation is needed,
rad
is propagated. If a unit computation is needed and one of the involved units hasrad
as a<BaseUnit>
, then unit propagation is not possible. Examples:-
a = b + c, and
Unit
of c is provided, but notUnit
of a and b:
The Unit definition ofc
(in other words,Unit.name
,<BaseUnit>
,<DisplayUnit>
) is also used fora
andb
. For example, if BaseUnit(c) =rad/s
, then BaseUnit(a) = BaseUnit(b) =rad/s
. -
a = b*c, and
Unit
of a and of c is provided, but notUnit
of b:
Ifrad
is either part of the<BaseUnit>
ofa
and/or ofc
, then the<BaseUnit>
ofb
cannot be deduced (otherwise it can be deduced). Example: IfBaseUnit(a) = kg.m/s2
andBaseUnit(c) = m/s2
, then theBaseUnit(b)
can be deduced to bekg
. In such a caseUnit.name
of b cannot be deduced from theUnit.name
ofa
andc
, and a tool would typically construct theUnit.name
ofb
from the deduced<BaseUnit>
.]
-
A <Unit>
can contain any number of <DisplayUnit>
elements.
A <DisplayUnit>
is defined by name
, factor
, offset
, and inverse
.
The attribute name
must be unique with respect to all other names of the <DisplayUnit>
definitions of the same Unit
.
[Different Unit
elements may have the same <DisplayUnit>
names].
inverse = true
is only allowed if offset = 0
.
[Reason: no use case is known for the combination of inverse and offset, which would also be more complicated.]
A value \(v_{\mathit{unit}}\) in Unit
is converted to a value \(v_{\mathit{display}}\) in DisplayUnit
by the equation:
[offset
is needed for temperature units like F
(Fahrenheit), inverse
for inverse display units like mpg
(miles per gallon) or S
(Siemens).
For example, if \({T_K}\) is the temperature value of Unit.name
(in K
) and \({T_F}\) is the temperature value of <DisplayUnit>
(in °F
), then
and therefore, factor = 1.8 (=9/5)
and offset = -459.67 (= 32 - 273.15*9/5)
.
Both the DisplayUnit.name
definitions as well as the Unit.name
definitions are used in the variable elements.
Example of a definition:
link:examples/unit_definition.xml[role=include]
]
Element <fmiModelDescription><TypeDefinitions>
is defined as:
This element consists of a set of <TypeDefinition>
elements according to schema fmi3TypeDefinition
in file fmi3Type.xsd
.
Each variable type has its own set of attributes. Float64Type element., Int32Type element., BooleanType element., BinaryType element., EnumerationType element., and ClockType element. are representative examples.
The <TypeDefinition>
elements are referred to in variable elements to declare their type.
[The alternative would be to define a type per variable.
However, this would lead to a situation where, e.g., the definition of a Torque
type would have to be repeated over and over.]
The attributes and elements have the following meaning:
Attribute or Element | Description |
---|---|
|
The unique name of the variable type referenced using the attribute |
|
An optional description string describing the meaning of the variable type. |
|
Physical quantity of the variable.
[For example, |
|
Unit of the variable referencing to a |
|
Default display unit of the variable referencing to a |
|
Indicates the type of data passed as a binary.
Defaults to |
|
Indicates the maximum size (bytes) of the data passed as a binary. |
|
If this attribute is |
|
Minimum value of variable (variable value \(\geq\) |
|
Maximum value of variable (variable value \(\leq\) |
|
Nominal value of variable.
If not defined and no other information about the nominal value is available, then |
|
If |
|
An |
Attributes for |
|
|
|
|
This attribute is mandatory for input |
|
The attribute |
The values of the following float and integer attributes refer to the unit of the |
|
|
This attribute defines the time interval \(T_{\mathit{interval}}\) between consecutive [Clock] ticks.
This value must be greater than 0.0.
This attribute is required if Clock type is |
|
This attribute defines the delay of the first clock activation relative to \(t_{\mathit{start}}\) ([startTime]).
This attribute requires that |
|
This attribute defines, if the functions |
|
Instead of defining clock timing using floating point numbers, FMI allows the definition of rational numbers using |
|
This attribute defines (together with \(T_{\mathit{interval}} = \)
|
|
This value defines (together with \(T_{\mathit{shift}} = \) This attribute requires that |
Element <fmiModelDescription><LogCategories>
is defined as:
<LogCategories>
defines an unordered set of category strings that classify output of the callback function [logMessage].
The importer may use the function [fmi3SetDebugLogging] to control for which <LogCategories>
the callback function [logMessage] is allowed to be called.
The name
attribute of <Category>
must be unique with respect to all other elements of the <LogCategories>
list.
Standard name
definitions for <Category>
. shows the standardized values for name
of <Category>
.
These names should be used if a tool supports the corresponding log category.
If an FMU supports one of these log categories, then an element <Category>
with this name
must be added to <LogCategories>
.
Any other FMU specific <LogCategories>
may be defined.
name
definitions for <Category>
.
Category | Description |
---|---|
|
Log all events (during initialization and simulation). |
|
Log the solution of linear systems of equations if the solution is singular (and the tool picked one solution of the infinitely many solutions). |
|
Log the solution of nonlinear systems of equations. |
|
Log the dynamic selection of states. |
|
Log messages when returning [fmi3Warning] status from any function. |
|
Log messages when returning [fmi3Discard] status from any function. |
|
Log messages when returning [fmi3Error] status from any function. |
|
Log messages when returning [fmi3Fatal] status from any function. |
The optional attribute description
shall contain a description of the respective log category.
[Typically, this string can be shown by a tool if more details for a log category are presented.
This approach to define <LogCategories>
has the following advantages:
-
An importer may present the possible log categories in a menu and the user can select the desired one.
-
The log output is drastically reduced, because via [fmi3SetDebugLogging] the categories are set that shall be logged and therefore the FMU will print only the messages with the corresponding categories to the [logMessage] function.
Note that since element <LogCategories>
is optional, an FMU does not need to expose its log categories.]
Element <fmiModelDescription><DefaultExperiment>
is defined as:
<DefaultExperiment>
consists of the optional default start time, stop time, relative tolerance, and step size for a simulation run.
A tool may ignore this information.
[However, it is convenient for a user that [startTime], [stopTime], [tolerance] and stepSize
have already a meaningful default value for the model at hand.]
Furthermore, for Co-Simulation FMUs the stepSize
defines the preferred [communicationStepSize].
[startTime], [stopTime] and stepSize
refer to the unit of the independent
variable.
The element of <fmiModelDescription><ModelVariables>
is the central part of the modelDescription.xml
.
It provides the static information of all exposed variables and is defined as follows:
The <ModelVariables>
element consists of an arbitrary number of <fmi3Variable>
elements (see ModelVariables element.).
<fmi3Variable>
elements represent scalars or arrays of an arbitrary (but fixed) number of dimensions for variables of different types, like single-precision floating point, string or binary.
The schema definition is present in a separate file fmi3Variable.xsd
.
Except for Clocks, variable elements can represent an array variable.
Variable elements representing array variables must contain at least one <Dimension>
element.
Each <Dimension>
element specifies the size of one dimension of the array:
-
If the
start
attribute of the<Dimension>
element is present, it defines a constant unsigned 64-bit integer size for this dimension. Thevariability
of the dimension size isconstant
in this case. -
If the
valueReference
attribute of the<Dimension>
element is present, it defines the size of this dimension to be the value of the variable with the value reference given by thevalueReference
attribute. The referenced variable must be a variable of type<UInt64>
, and must either be a constant (i.e. withvariability
=constant
) or astructural parameter
(i.e. withcausality
=structuralParameter
). Thevariability
of the dimension size is in this case thevariability
of the referenced variable. Astructural parameter
must be a variable of type<UInt64>
only if it is referenced in<Dimension>
.
These two options are mutually exclusive, i.e., for each <Dimension>
element either a start
attribute or a valueReference
attribute can be supplied, but not both.
However different <Dimension>
sizes for the same variable may be specified using different mechanisms by having different variability
attributes.
All initial dimension sizes (defined by start
values either directly or indirectly in the <fmiModelDescription>
) must be positive integers (i.e. not zero), so that no dimension is initially vanished.
[This allows importers to ignore structural parameters
because their start
values reflect the internal default settings of structural parameters
.
If we allowed 0 dimension sizes for initial values, tools that do not even care about changing dimension sizes would need to be able to handle vanishing arrays.]
[Example:
The variable V
is a floating point vector parameter.
The length of the vector depends on the structural parameter
len
, connected via the valueReference = "100"
.
The default length of the vector is 7.
This length can be changed in [ConfigurationMode] because the variability
of the structural parameter
len
is fixed
.
The values of V
can be changed whenever tunable
parameters can be changed.
link:examples/structural_parameter_example.xml[role=include]
]
Changes to dimension sizes are constrained by the min
/max
attributes of the referenced structural parameters
, which can be any non-negative integer, including zero.
Specifying a minimum size of zero on a structural parameter
allows any related dimension sizes to be changed to zero in [ConfigurationMode] or [ReconfigurationMode], thus causing the respective array size to go to zero, which leaves the respective array variable without any active elements.
The actual dimension sizes of arrays are also constrained by the importer, due to memory and addressing constraints:
Since the API functions to access variables and their values are constrained to size_t
individual elements, platforms with addresses of less than 64-bit width will not be able to access elements beyond their addressing limits, neither will they be able to allocate enough memory or address space to represent such arrays.
For these reasons implementations must take platform-specific constraints into account when changing dimension sizes, and must be prepared to handle the inability of the FMU to adjust to the desired sizes during [ConfigurationMode] or [ReconfigurationMode].
Changing any dimension of a variable in [ConfigurationMode] or [ReconfigurationMode] invalidates the variable’s current value (including its start
value).
Changing one structural parameter
might affect dimension sizes of several variables.
A variable can have any number of <Alias>
elements that define a variable alias.
Each variable alias has a required attribute name
whose value must be unique among all variables and variable aliases, and an optional attribute description
.
Variable aliases of floating point variables may additionally have a displayUnit
that follows the same rules as for variables.
[ Example:
link:examples/alias_example.xml[role=include]
]
The common attributes of variables are shown in fmi3ArrayableVariable element..
Attribute | Description |
---|---|
|
The unique name of the variable. This attribute may follow a defined naming convention. |
|
A handle of the variable to identify the variable value in the C-API functions and for references within the |
|
An optional description string describing the meaning of the variable. |
|
Enumeration that defines the causality of the variable.
Allowed combinations of Values of this enumeration are:
Setting of local variables:
Local variable values must not be used as input to another model or FMU.
|
|
Enumeration that defines the time dependency of the variable, in other words, it defines the time instants when a variable may be changed by the importer or may change its value due to FMU internal computations, depending on their [For example, Allowed combinations of Values of this enumeration are:
The
For more explanations on value changes see [smoothness]. |
|
Only for variables with [This flag can be set to |
|
If this boolean attribute is This attribute is ignored in Model Exchange and Scheduled Execution.
Variables of type [Clock] must not have the |
|
If present, this variable is a
[For example, if |
|
If present, this variable is clocked.
The value of the attribute |
Allowed combinations of variability
/causality
. shows the combinations of variability
/causality
settings that are allowed.
variability
/causality
.
— (a) |
— (a) |
— (a) |
— (a) |
(7) |
(10) |
— (c) |
|
(16) |
(1) |
(3) |
— (d) |
— (e) |
(11) |
— (c) |
|
(17) |
(2) |
(4) |
— (d) |
— (e) |
(12) |
— (c) |
|
— (b) |
— (b) |
— (b) |
(5) |
(8) |
(13) |
— (c) |
|
— (b) |
— (b) |
— (b) |
(6) |
(9) |
(14) |
(15) |
[Discussion of the combinations that are not allowed:
Explanation why this combination is not allowed | |
---|---|
(a) |
The combinations |
(b) |
The combinations |
(c) |
For an |
(d) |
A |
(e) |
A |
Discussion of the combinations that are allowed:
Setting | Example | |
---|---|---|
(1) |
||
(2) |
||
(3) |
Non- |
|
(4) |
|
|
(5) |
||
(6) |
|
|
(7) |
Variable where the value never changes and that can be used in another model. |
|
(8) |
|
|
(9) |
|
|
(10) |
Variable that never changes its value. Cannot be used in another model. |
|
(11) |
Local variable that depends on |
|
(12) |
Local variable that depends on |
|
(13) |
|
|
(14) |
|
|
(15) |
All variables are a function of the continuous-time variable marked as |
|
(16) |
|
|
(17) |
|
How to treat tunable
variables:
A parameter
p is a variable that does not change its value during simulation, in other words, dp/dt = 0.
If the parameter
p is changing, then Dirac impulses are introduced since dp/dt of a discontinuous constant
variable p
is a Dirac impulse.
Even if this Dirac impulse would be modeled correctly by the FMU, it would introduce unwanted vibrations
.
Furthermore, in many cases the model equations are derived under the assumption of a constant
value (like mass or capacity), and the model equations would be different if p
would be time varying.
FMI for Model Exchange:
Therefore, "tuning a (structural) parameter
" during simulation does not mean to "change the parameter online" during simulation.
Instead, this is a short hand notation for:
-
Stop the simulation at an event instant (usually, a [step event], in other words, after a successful integration step).
-
Change the values of the
tunable
(structural)parameters
. Fortunable
structural parameters
, the [ReconfigurationMode] must be entered before and left afterwards. -
Compute all
parameters
(and sizes of variables, states,derivatives
, event indicators, …) that depend on thetunable
(structural)parameters
. -
Newly start the simulation using as initial values previously stored values and the new values of the
parameters
.
Basically this means that a new simulation run is started from the previous FMU state with changed parameter
values.
With this interpretation, changing parameters
online is "clean", as long as these changes appear at an event instant.
FMI for Co-Simulation:
Changing of tunable
parameters
is allowed before an [fmi3DoStep] call (so, whenever an input
can be set with fmi3Set{VariableType}
) and before [fmi3ExitInitializationMode] is called (that is before and during [InitializationMode]).
The FMU internally carries out event handling if necessary.
FMI for Scheduled Execution:
Changing of tunable
parameters
is allowed before an [fmi3ActivateModelPartition] call (so, whenever an input
can be set with fmi3Set{VariableType}
) and before [fmi3ExitInitializationMode] is called (that is before and during [InitializationMode]).]
<ModelVariables>
can be of different types, for example Float64, Int32, Boolean, Binary, Enumeration and Clock.
The attributes common to all variable types are defined in Type element and attribute details. and fmi3ArrayableVariable attribute details.. Type specific attributes are listed in the following table.
Attribute | Description |
---|---|
|
If present, name of type defined with |
|
This attribute defines the unit of the variable by referencing a |
|
Default display unit of the variable referencing to a |
|
Enumeration that defines how the variable is initialized, i.e. if a For the variable with The attribute
Definition of |
|
Initial or guess value of the variable.
During instantiation, the FMU initializes its variables with their The For variables of type [ Example: Start values of string array variable link:examples/string_vector_example.xml[role=include] ] The interpretation of Variables with
|
|
If present, then the variable with this attribute is the derivative of the variable with value reference given in |
|
Only used in Model Exchange, ignored for the other interface types.
May only be present for a continuous-time [state]. |
If initial
is not present in a type that can have that attribute, its value is defined by Definition of initial
. based on the values of causality
and variability
(default underlined):
initial
.
— |
— |
— |
— |
exact |
exact |
— |
|
exact |
exact |
calculated |
— |
— |
calculated |
— |
|
exact |
exact |
calculated |
— |
— |
calculated |
— |
|
— |
— |
— |
exact |
calculated |
calculated |
— |
|
— |
— |
— |
exact |
calculated |
calculated |
— |
With attribute Convention
in <fmiModelDescription>
, the convention is defined how the variable names have been constructed.
The importer may use this information to represent the names in a better way (for example, as a tree and not as a linear list).
In the following definitions, the Extended Backus-Naur Form (EBNF) is used:
= production rule [ ] optional { } repeat zero or more times | or
The names must be unique, non-empty strings.
The following conventions for scalar names are defined:
name = Unicode-char { Unicode-char } // identical to xs:normalizedString Unicode-char = any Unicode character without carriage return (#xD), line feed (#xA) nor tab (#x9)
Structured names are using "." as a separator between hierarchies.
A name consists of "_", letters and digits or may consist of any characters enclosed in single apostrophes.
A name may identify an array element on every hierarchical level using "[…]" to identify the respective array index.
If an array is a leaf node of the variable hierarchy then the array can also be represented as a single variable of type array.
A derivative
of a variable is defined with der(name)
for the first time derivative and der(name,N)
for the N-th derivative.
Examples:
vehicle.engine.speed resistor12.u v_min robot.axis.'motor #234' der(pipe[3,4].T[14],2) // second time derivative of pipe[3,4].T[14]
The precise syntax is:
name = identifier | "der(" identifier ["," unsignedInteger ] ")" identifier = B-name [ arrayIndices ] {"." B-name [ arrayIndices ] } B-name = nondigit { digit | nondigit } | Q-name nondigit = "pass:[_]" | letters "a" to "z" | letters "A" to "Z" digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" Q-name = "'" ( Q-char | escape ) { Q-char | escape } "'" Q-char = nondigit | digit | "!" | "#" | "$" | "%" | "&" | "(" | ")" | "*" | "+" | "," | "-" | "." | "/" | ":" | ";" | "<" | ">" | "=" | "?" | "@" | "[" | "]" | "^" | "{" | "}" | "|" | "~" | " " escape = "\'" | "\"" | "\?" | "\\" | "\a" | "\b" | "\f" | "\n" | "\r" | "\t" | "\v" arrayIndices = "[" unsignedInteger {"," unsignedInteger} "]" unsignedInteger = digit { digit }
[This definition is identical to the syntax of an identifier in the Modelica Language Specification.]
Example:
vehicle transmission ratio outputSpeed engine inputSpeed temperature
is mapped to the following list of variable names:
vehicle.transmission.ratio vehicle.transmission.outputSpeed vehicle.engine.inputSpeed vehicle.engine.temperature
It might be that not all elements of an array are present.
The Convention
structured
does not define if arrays are 0-based or 1-based.
The structure of the model is defined in element <fmiModelDescription><ModelStructure>
.
It defines the dependencies between variables.
The required part of the model structure for all FMI types defines the ordering of outputs in <Output>
and unknowns during initialization in <InitialUnknown>
.
A Model Exchange FMU must also expose all derivatives of continuous states in <ContinuousStateDerivative>
and all event indicators in <EventIndicator>
.
The optional part of the model structure defines in which way derivatives
, outputs
, and initial unknowns depend on inputs
and/or parameters
, and continuous-time states.
The listed dependencies
declare the dependencies between whole (multi-dimensional-)variables and not individual elements of the variables.
[Dependencies of individual array elements can be retrieved during runtime using [fmi3GetVariableDependencies].]
ModelStructure element. shows the definition of <ModelStructure>
.
Note that attribute dependenciesKind
for element <InitialUnknown>
has less enumeration values as dependenciesKind
in the other lists, as detailed in ModelStructure elements..
<ModelStructure>
consists of the elements detailed in ModelStructure elements. (see also ModelStructure element.; the symbols of the mathematical equations describing the dependencies are defined in [concepts-model-exchange]):
Element | Description |
---|---|
|
Ordered list of all outputs, in other words, a list of value references where every corresponding variable must have |
|
Ordered list of value references of all derivatives of continuous states.
The order defined by this list defines the order of the elements for [fmi3GetContinuousStates], [fmi3SetContinuousStates], and [fmi3GetContinuousStateDerivatives].
[Note that only The corresponding continuous-time states are defined by attribute |
|
A |
|
Ordered list of all exposed unknowns in [InitializationMode]. This list consists of all variables which:
The resulting list is not allowed to have duplicates (for example, if a [state] is also an \({\mathbf{v}_{\mathit{initialUnknowns}} := \mathbf{f}_{\mathit{init}}(\mathbf{u}_c, \mathbf{u}_d, t_{\mathit{start}}, \mathbf{v}_{\mathit{initial=exact}})}\) Since,
[Example: Assume an FMU is defined in the following way: \({(\mathbf{y}_{c+d}, \dot{\mathbf{x}}_c) := \mathbf{f}_{\mathit{init}}(\mathbf{x}_c, \mathbf{u}_{c+d}, t_{\mathit{start}}, \mathbf{p})}\) \({(\mathbf{y}_{c+d}, \dot{\mathbf{x}}_c) := \mathbf{f}_{\mathit{sim}}(\mathbf{x}_c, \mathbf{u}_{c+d}, t_i, \mathbf{p})}\) Therefore, the initial state \({\mathbf{x}_c(t_{\mathit{start}})}\) has |
|
An ordered list of value references where every referenced variable must be an event indicator.
The serialized (if value reference points to array variable) and concatenated values of the variables referenced by the attribute For Co-Simulation and Scheduled Execution, [The intention for connecting event indicators to variables via |
Elements <Output>
, <ContinuousStateDerivative>
, <ClockedState>
, <InitialUnknown>
, and <EventIndicator>
have (partially) the following attributes:
<Output>
, <ContinuousStateDerivative>
, <ClockedState>
, <InitialUnknown>
, and <EventIndicator>
attribute details.
Attribute | Description |
---|---|
|
The value reference of the unknown \({v_{\mathit{unknown}}}\). |
|
Optional attribute defining the algebraic dependencies as list of value references of the unknown \({\mathbf{v}_{\mathit{unknown}}}\) directly with respect to \({\mathbf{v}_{\mathit{known}}}\).
For a real valued unknown and a real valued known, if the known is not listed among the dependencies then the partial derivative of the unknown with respect to that known is identically zero.
If dependencies is not present, it must be assumed that the unknown depends on all knowns.
If dependencies is present as empty list, the unknown depends on none of the knowns.
Otherwise the unknown depends on the knowns defined by the given value references.
Knowns \({\mathbf{v}_{\mathit{known}}}\) in [InitializationMode] (for elements
[The |
|
If
The following
The following
|
Terminals define semantic groups of variables to ease connecting compatible signals on the system level.
This definition adds an additional layer to the interface description of the FMUs.
It does not change the causality
of the variables (i.e. inputs and outputs), but enables the definition of physical and bus-like connectors that require special handling on the system level by the importer (e.g. flow variables and bus frames).
Icons define a graphical representation of an FMU and its terminals.
Both features are optional and may be defined in the separate XML file terminalsAndIcons/terminalsAndIcons.xml
.
[The usage of a separate file enables backporting of this feature to previous FMI versions.]
On the top level, the schema consists of the following elements (see fmiTerminalsAndIcons element.).
Attribute or Element | Description |
---|---|
|
This attribute declares the FMI version defining the XSD of the |
|
If present, contains information for importers of FMUs to draw graphical representations of the FMU in a system view. |
|
If present, this allows combining variables (e.g. inputs, outputs and parameters) into logical groups to ease connections on a system level and add semantic information required for system-level connections. |
The graphical representation of the FMU and terminals are needed to more easily comprehend the meaning of connected FMUs and to help importers to display the terminals and the FMU icon in the way the exporter intended.
The graphical representation is fully optional.
The graphical representation of terminals is separate from the terminal definitions in the <Terminals>
element.
There are two optional elements in the <GraphicalRepresentation>
:
-
The element
<CoordinateSystem>
defines the extent of the whole icon, graphical items may exceed that rectangle. -
The element
<Icon>
defines the image position.
The <CoordinateSystem>
element and its extent is used as reference for other graphical items.
It also provides a scaling factor to millimeter.
The coordinate system is defined by the coordinates of two points, the lower left (x1
, y1
) corner and the upper right (x2
, y2
) corner, where the coordinates of the first point shall be less than the coordinates of the second point [a first quadrant coordinate system].
The x-axis is directed to the right, the y-axis is directed upwards.
[The exporting tool should define how the coordinate system unit relates to mm display or printout size. However, an importer might choose to use the factor from the default coordinate system extent to the actual coordinate system extent to calculate a scaling factor, to match the default icon size in the importer.
The area defined by the coordinate system is suggested to be used as "clickable icon size" in importers.
A <Terminal>
might be placed outside of this area, therefore the visible bounding box has to be determined by the importer.]
The coordinate system default is x1=-100, y1=-100, x2=100, y2=100
.
This extent is used if the <CoordinateSystem>
element is missing.
The default suggestedScalingFactorTo_mm
is 0.1
.
So the default coordinate system display size should be 20 mm
width and 20 mm
height.
The FMU icon and all graphical representations provide the position and extent with the attributes x1
, y1
, x2
, y2
.
The values of these attributes directly relate to this coordinate system and are not normalized.
Flipping of the FMU icon or a terminal can be realized by setting its attributes x2 < x1
or y2 < y1
without changing the coordinate system.
The extent and position of the FMU icon are defined in the <Icon>
element.
The optional image file of the FMU icon is placed at the path terminalsAndIcons/icon.png
in the ZIP archive of the FMU.
The terminals should not be visible in the image.
Optionally an SVG file with path terminalsAndIcons/icon.svg
can be provided if also the PNG file is present.
This enables high quality rendering and printing in importers.
The point (x1
, y1
) maps to the left lower corner of the PNG image or SVG viewport.
The point (x2
, y2
) maps to the right upper corner of the PNG image or SVG viewport.
The clickable icon size is defined by the <CoordinateSystem>
element.
The FMU icon itself may exceed this extent (or bounding box).
The bounding box of the terminals is given by the extent in the terminals element.
Their location is neither limited to the extent of the icon nor the extent of the coordinate system.
[An importer has to determine the outer bounding box enclosing all graphical items.]
Transparent SVG or PNG files are allowed and wanted.
The order of the elements in the XML file defines the order of painting.
The first element in the <TerminalGraphicalRepresentation>
is painted first and therefore behind the others, the last element is painted on top of the others and because of that in front of them.
[So the FMU icon should be placed first in the XML file, terminal below.]
Terminals are fully optional and can be ignored by any importer.
A terminal is:
-
a structured interface for connections to other models,
-
intended to be used for signal flow between models, parameter propagation, and compatibility checks of the model configuration, and
-
a sequence of references to variables with connection meta data.
Predefined rules for variable matching in a connection are given in Predefined matching rules.. Predefined variable kinds are used to describe how the terminal member variables have to be handled. Domain specific connection rules, terminals and their member variables can be provided by other standards.
[Algebraic loops in systems of connected FMUs are not addressed or resolved by the terminals.
The FMU standard does not require that the causality
of the terminal member variables in connected terminals match.
This must be handled by the importer.
The System Structure & Parameterization Standard (SSP) refers to a connectorKind
.
This connectorKind
is not related to the terminalKind
or variableKind
described in Terminals and Terminal Member Variable.]
Element <fmiTerminalsAndIcons><Terminals>
is defined as:
The normalized string attribute name
of the <Terminal>
element is the unique instance name of the terminal.
The terminal name must be unique on each level.
The normalized string attribute matchingRule
describes the rules for variable matching in a connection of terminals.
As detailed in Predefined matching rules., there are three predefined matching rules: plug
, bus
, and sequence
.
Other standards may define new matching rules.
In order to avoid ambiguities and conflicts, rule names must follow the reverse domain notation of a domain that is controlled by the entity defining the semantics and content of the additional entries.
The rule names beginning with org.modelica
and org.fmi-standard
are explicitly reserved for use by layered standards defined by Modelica Association or its own projects (MAPs).
The normalized string terminalKind
is an optional attribute.
Other standards may define terminal kinds.
It is intended that the terminalKind
is used to define domain specific member variable sequences, member names and order, or high level restrictions for connections.
[Externally defined terminal kinds should refer to a predefined matchingRule
, if possible.
Vendor specific terminal kinds should start with _vendorName
or _toolName
to avoid namespace clashes.
Examples for terminalKind
: StandardXXX_Mechanical_Translational
, Modelica.Mechanics.Translational.Interfaces.Flange_a
, vendorNameA_customTypeA
, _vendorNameB_customLibrary_customTypeB
.
The structured naming convention of the <ModelVariables>
is independent from the terminal names and member variable names.
A tool may choose to connect terminals with a different or unknown terminalKind
, if the matchingRule
matches.
A tool may choose to take the structured naming convention of variable names into account when matching terminals. This can for example be used to allow matching between terminals employing arrays mapped to scalar variables using structured naming convention ("naming convention arrays"), and those using native FMI 3.0 arrays, as in the following example:
Assume that an (FMI 3.0) FMU has a one-dimensional array variable x
of length 3 as member variable of a terminal and is connected to another (FMI 2.0 or FMI 3.0) FMU supporting structured naming convention, which has scalar variables x[1]
, x[2]
, x[3]
as member variables of a terminal.
Then x[1]
, x[2]
, x[3]
are interpreted as a "naming convention array" with name x
, which "matches" the array variable x
of the first FMU, in name-based matching.
Similarly the notional "naming convention array" x
would participate in sequence-based matching as a single notional variable in the place of the underlying scalar variables.
]
The <TerminalMemberVariable>
is defined as:
The normalized string variableName
identifies a variable in <ModelVariables>
which is actually connected and for which fmi3Get{VariableType}
and fmi3Set{VariableType}
is called.
If the matchingRule
plug
and bus
are used, then memberName
is used for variable matching.
Therefore, the memberName
attribute is required for plug
and bus
and must be unique per terminal.
The memberName
is not required for matchingRule
sequence
.
The normalized string variableKind
is used to provide general information about the variable.
This information defines how the connection of this variable has to be implemented (e.g. Kirchhoff’s current law or common signal flow).
The predefined variableKind
are:
.Predefined kinds of variables.
variableKind |
Description |
---|---|
|
The values in connected terminals are intended to be equal.
Restricted to |
|
Variables which fulfill Kirchhoff’s current law.
Restricted to |
[The suggested variable naming scheme for the structured naming convention is <ModelVariable name> = <terminalName>.<memberName>.
Not all <ModelVariables>
which have the prefix "<terminalName>." are a member variable, and there may exist member variables which don’t have this prefix.
Example 1 (suggested scheme): <ModelVariable name> is portA.U
, <terminalName> is portA
, <memberName> is U
.
Example 2 (suggested scheme): <ModelVariable name> is hierarchConn.innerConn.U
, <outer terminal name> is hierarchConn
, <inner terminal name> is innerConn
, <memberName> is U
.
Example 3 (no prefix): <ModelVariable name> is u
, <terminalName> is portA
, <memberName> is u
.
Example 4 (prefix but not a member): <ModelVariable name> is portA.u
, there is a terminal with <terminalName> portA
, but this variable is not a terminal member.
The suggested variable naming scheme for the non-structured naming convention is: <ModelVariable name> = <memberName>
Matching is not restricted by variability
, causality
or variable type.
Example: A fixed
variable may be connected to a tunable
variable, a variable of type fmi3Float64
may be connected to a variable of type fmi3Int32
.
However, it is recommended that the variable types and variabilities are equal.
The matchingRule
refers to the <TerminalMemberVariable>
on the same level only.
Nested terminals can have different matchingRules
.
There is no special handling of derivatives
.
If a derivative
is a terminal member variable then it is considered as normal member variable.
However, if a derivative
of a terminal member variable is not terminal member, then this derivative
information may be used by an importer.]
The <TerminalStreamMemberVariable>
is defined as:
This element is used for variables which fulfill the balance equation for transported quantities.
It is restricted to input
and output
, parameter
and calculatedParameter
.
The Stream concept is described in the appendix D "Derivations of Stream Equations" of the Modelica Language Specification.
Only one terminal member variable with the variableKind
inflow
or outflow
per terminal is allowed, if a <TerminalStreamMemberVariable>
is present.
[More sophisticated structures can be implemented using hierarchical terminals.]
The attribute inStreamVariableName
and outStreamVariableName
are used to identify the <ModelVariables>
.
If the referenced model variables are arrays, then the size of the inStreamVariableName
and outStreamVariableName
has to be equal.
A terminal may have more than one <TerminalStreamMemberVariable>
.
The inStreamMemberName
and outStreamMemberName
describe the terminal member name for matching purposes, similar to the memberName
attribute in the <TerminalMemberVariable>
.
[An example of use for an array of stream variables is a gas mixture flow.
The gas composition could be implemented as a mass fraction vector.
The outStreamVariableName
refers to \(portA.q_\textit{outStream}\textit{[]}\) and the inStreamVariableName
refers to \(portA.q_\textit{inStream}\textit{[]}\) .
The inStreamMemberName
and outStreamMemberName
are " \(q_\textit{inStream}\textit{[]}\) " and " \(q_\textit{outStream}\textit{[]}\) ".
Balance equation for transported quantities:
\(0 = \sum{q_i\dot{m}_i}\)
\(0 = \sum{\dot{m}_i}\cdot \left\{\begin{array}{ll} q_{i, \mathit{outStream}} &\textit{if $\dot{m}$ is outflowing through terminal $i$}\\ q_{i, \mathit{inStream}} &\textit{if $\dot{m}$ is inflowing through terminal $i$} \end{array}\right.\)
The \(q_{i,\mathit{outStream}}\) is the convective quantity in case the matter flows out of the FMU.
\(q_{i,\mathit{inStream}}\) is the convective quantity in case the matter flows into the FMU.
Both variables are present in the terminal.
The outStream variable has the causality
output
or calculatedParameter
because this information has to be provided by each FMU.
The inStream variable has the causality
input
or parameter
.
To display the actual value in an importer, this actual value has to be selected depending on the sign of the terminal member variable with variableKind
inflow
or outflow
.
However, calculating the actual value is not necessary.
If only two terminals with a variable are connected and their causality
matches, then the values of the outStream variables can be forwarded to the corresponding inStream values.
In Modelica the inStream variable is not directly visible, the value can only be accessed using "inStream()", therefore an additional model variable has to be added during the export. It is suggested that Modelica tools exporting an FMU derive the member name for the inStream variable according to the scheme "<outStream name>_inStream". E.g. if the outStream name is "h_outflow" then the inStream name should be "h_outflow_inStream".]
The <TerminalGraphicalRepresentation>
is defined as:
The iconBaseName
attribute is mandatory.
This attribute defines the base name of the image file as a relative URI according to RFC 3986.
The base URI that this relative URI is resolved against is the URI of the terminalsAndIcons/terminalsAndIcons.xml
file in the FMU ZIP archive.
Implementations are required to support relative URIs, excluding relative URIs that move beyond the baseURI (i.e. go "up" a level via ..).
Implementations are not required to support any absolute URIs and any specific URI schemes.
The PNG file with the extension '.png' has to be provided.
An additional SVG file with extension '.svg' is optional.
[Note that this specification is functionally equivalent to looking up image sources from the terminalsAndIcons
folder of the FMU ZIP archive after dot removal from the path as per section 5.2.4 of RFC 3986.]
The defaultConnectionStrokeSize
and defaultConnectionColor
can be provided to define the intended connection line layout in the importer.
The stroke size is given relative to the coordinate system extent.
The stroke color is given in RGB values from 0 to 255. E.g.: 255 255 0
.
[Nested terminals may have a <TerminalGraphicalRepresentation>
element.
However, if and how nested terminals are displayed, is up to the importer.]
[The order of painting of the <TerminalGraphicalRepresentation>
of terminals on each level is equal to the order in the <Terminal>
element.
So graphical representations appearing first, are painted first, are behind graphical representations which appear below.]
The Annotations
element can be used by vendors to store additional information for the graphical representation.
[It is suggested that Modelica tools store the Modelica annotation of the connector under the type
org.modelica.Modelica4Annotation
in the annotations of an element connector
.
The attribute name
of the connector element is equal to the name
attribute of the referenced fmi3Terminal
.]
[The signal variableKind
can be applied for different use cases.
The first use case is a signal flow from an output
of one FMU to an input
of another FMU.
The output
value has to be forwarded to the input
.
The signal flow can cause algebraic loops.
If variables in connected terminals have the causality
output
, then an importer may iterate an undefined input
of an FMU to ensure that the connected output values are equal.
Another use case is the parameter propagation.
If a variable in both connected terminals has the causality
parameter
, then an importer could ask the user for the value of one of those parameters
only, and propagate this value to the other FMU.
If only one of the variables has causality
parameter
, and the other is a constant
output
or calculatedParameter
, then the importer could also propagate the parameter
value without presenting a parameter to the user.
One example of use would be the name of a substance flowing through a pipe.
If the fluid flows from one pipe FMU to another, the substance should be the same.
This substance name could be propagated over several FMUs.
Finally the variableKind
signal
can be applied to implement compatibility checks.
If for example the variability
of the variables in connected terminals are constant
, then the importer can implement an equality assertion.
This is also possible with calculated
parameters
.
One example of use would be the cross sectional flow area in pipes which is calculated from geometry parameters.
A change in the cross sectional flow area is relevant for the momentum equation, and therefore the connection has to be deemed incompatible if these variables are present and unequal.]
[Flow variables have a direction and must fulfill a zero sum constraint i.e. the sum of all flow variables connected must be zero (Kirchhoff’s current law).
In addition because different tools might have different direction definitions both, inflow
and outflow
are available as variableKind
.
For variables with inflow
a positive value means that the flow is inwards, and for outflow
a positive value means that the flow is outwards.
For the sake of simplicity in the following \(\dot{m}_i\) denotes an inflowing quantity:
\(0 = \sum{\dot{m}_i}\)
[Connecting a single output
outflow
to a single input
inflow
, or vice versa automatically fulfills the flow constraint, while connecting two variables of the same flow type requires a negation of the variable value.
inflow
and outflow
is only used as a sign convention for scalar flow quantities which obey Kirchhoff’s current law (sum up to zero).
Other, nonscalar, quantities which also sum up to zero, like a mechanical force in 3D space according to D’Alembert’s principle, are not covered by this sign convention.
This is the case since Kirchhoff’s current law only holds for scalars where a sign convention is sufficient.
Other definitions are beyond the scope of this terminal specification and need clear definition in other specifications on top of this.]
Each <BuildConfiguration>
provides the necessary information to compile and link the sources of the model into a dynamic library or as part of an executable.
An FMU importer may not regard more than one <BuildConfiguration>
when building the FMU for a specific platform
.
The importer chooses the matching <BuildConfiguration>
based on the platform
and modelIdentifier
attributes.
[On platforms that support shared libraries, executables should not be linked statically against or be compiled directly from the sources of an FMU in order to avoid name conflicts.]
In order to avoid symbol name conflicts when compiling and linking multiple source code FMUs, source files should keep the exported symbols to a minimum by declaring all symbols not needed for linking as static
.
If only a single <SourceFile>
is provided in the <BuildConfiguration>
all symbols except for the FMI functions should be defined as static
.
This source file may include other source files that are not listed in the <BuildConfiguration>
.
It is also recommended to use a descriptive name (e.g. <model_identifier>.c
) for this single <SourceFile>
instead of generic names (like all.c
, or model.c
) in order to aid readability and reduce integration effort.
Attribute | Description |
---|---|
|
The attribute |
|
Platform tuple of the platform the |
|
Description of the build configuration |
The <SourceFileSet>
element groups source files that can be compiled with the same compiler and compiler options.
Every build configuration must contain at least one <SourceFileSet>
.
An importer of the FMU has to process every <SourceFileSet>
of the matching <BuildConfiguration>
.
Attribute | Description |
---|---|
|
Unique name of the |
|
Language of the source files (e.g. |
|
The compiler to compile the sources (e.g. |
|
The compiler flags that have to be used when compiling the sources (e.g. |
Attribute | Description |
---|---|
|
Path of the source file relative to the |
The <PreprocessorDefinition>
element defines a preprocessor definition that needs to be passed to the compiler when compiling the source files in the <SourceFileSet>
.
Attribute | Description |
---|---|
|
Name of the preprocessor definition |
|
Value of the preprocessor definition |
|
Determines whether the definition is optional (default is |
|
Description of the preprocessor definition |
The <Option>
element defines a possible value for the <PreprocessorDefinition>
.
If a <PreprocessorDefinition>
contains <Option>
elements, its default value must be contained in the options.
Attribute | Description |
---|---|
|
Value of the preprocessor definition option |
|
Description of the preprocessor definition option |
The <IncludeDirectory>
element defines the include directories that need to be passed to the compiler when compiling the source files in the <SourceFileSet>
.
Attribute | Description |
---|---|
|
Path of the include directory relative to the |
[Note that the header files fmi3PlatformTypes.h
and fmi3FunctionTypes.h/fmi3Functions.h
are not included in the FMU because:
fmi3PlatformTypes.h
makes no sense in the sources
directory, because if sources are provided, then the importer defines this header file and not the FMU.
This header file is not included in the binaries
directory, because it is implicitly defined by the platform directory (for example, x86-windows
for a 32-bit machine running Windows or x86_64-linux
for a 64-bit machine running Linux).
fmi3FunctionTypes.h
/ fmi3Functions.h
are not needed in the sources
directory, because they are implicitly defined by attribute fmiVersion
in file modelDescription.xml
.
Furthermore, in order that the C compiler can check for consistent function arguments, the header file from the importer should be used when compiling the C sources.
It would therefore be counter-productive (unsafe) if this header file was present.
These header files are not included in the binaries
directory, since they are already utilized to build the executable of the simulation environment.
The version number of the header file used to construct the FMU can be deduced via attribute fmiVersion
in file modelDescription.xml
or via function call [fmi3GetVersion].]
The <Library>
element defines a static library required to link the model binary.
An importer of the FMU has to link every library of the matching <BuildConfiguration>
.
Attribute | Description |
---|---|
|
Name of the library |
|
Version specifier of the library as defined in PEP 440.
The characters |
|
Boolean attribute that determines whether the library is contained in the |
|
Description of the library definition option |