Skip to content

Commit 243a3cb

Browse files
authored
Merge pull request #109 from OpenSimulationInterface/feature/fmi-30-support
Add FMI 3.0 native support
2 parents 596af22 + 87374df commit 243a3cb

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

doc/spec/basic_conventions.adoc

+12
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,15 @@ A simulator can call the FMU `fmi2DoStep` routine at this implied rate.
2727
If the step size is not supplied, the model communication rate is determined from any input configuration data the model provides, or it must be configured manually.
2828

2929
The model may have inputs, outputs, and parameters that are not specified by OSMP if the model can be run correctly with all of those variables left unconnected and at their default values.
30+
31+
== FMI 3.0
32+
33+
Alternatively a model can be packaged as a valid FMU for co-simulation as specified in the FMI 3.0 standard cite:[fmi3.0].
34+
In this case, unless otherwise noted, all specifications in the FMI 3.0 cite:[fmi3.0] standard apply as-is.
35+
36+
The rules above for FMI 2.0 apply, with the provision that the annotation shall be placed as an `<Annotation>` element into the `<Annotations>` element of the `modelDescription.xml`:
37+
38+
[source,xml]
39+
----
40+
<Annotation type="net.pmsf.osmp" xmlns:osmp="http://xsd.pmsf.net/OSISensorModelPackaging"><osmp:osmp version="1.4.0" osi-version="x.y.z"/></Annotation>
41+
----

doc/spec/binary_variables.adoc

+43-3
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@ endif::[]
66

77
FMI 2.0 cite:[fmi2.0] does not directly support the efficient exchange of arbitrary binary data between FMUs.
88
OSMP therefore introduces the concept of notional binary variables that are mapped to actual integer variables for use with FMI 2.0 cite:[fmi2.0].
9-
Future FMI versions will directly support binary variables compatible with this concept.
9+
10+
For FMI 3.0 cite:[fmi3.0] and above these notional binary variables can be directly mapped into actual binary variables as specified below.
1011

1112
A notional binary variable named `<prefix>` is defined using the following conventions:
1213

13-
The name of the notional binary variable given by `<prefix>` shall be a valid structured name according to FMI 2.0 cite:[fmi2.0].
14+
The name of the notional binary variable given by `<prefix>` shall be a valid structured name according to FMI 2.0 cite:[fmi2.0] (or FMI 3.0 cite:[fmi3.0] for 3.0 FMUs).
1415

1516
The FMU shall not contain any other variable that is named `<prefix>`.
1617
This restriction ensures that there is no conflict between notional binary variables and actual variables.
1718

18-
For each notional binary variable, three actual FMU integer variables shall be defined:
19+
For FMI 2.0, for each notional binary variable, three actual FMU integer variables shall be defined:
1920

2021
`<prefix>.base.lo`::
2122
Lower, meaning the least significant, 32-bit address part of the binary data buffer to be passed into or out of the model, cast into a signed 32-bit integer without changing the bit values.
@@ -71,3 +72,42 @@ This convention allows the use of FMUs in simulation engines that have no specia
7172
The simulation engine can rely on the provided buffer to remain valid from the moment it is passed out of a model until the end of the next co-simulation calculation cycle.
7273
Thus, the simulation engine does not need to copy the contents in that case, corresponding to zero-copy output for the simulation engine at the cost of double buffering for the model providing the output data.
7374
It is possible to daisy-chain FMUs with protocol buffer inputs and outputs in a normal simulation engine supporting FMI, and get valid results.
75+
76+
== FMI 3.0
77+
78+
For FMI 3.0, each notional binary variable is mapped to an actual binary variable with the name `<prefix>` and the causality and variability of the notional binary variable.
79+
80+
The variable shall have a start value of length 0 (i.e. the empty binary), indicating that no valid binary data is available.
81+
The variable may have a different or no start value if the combination of causality and variability precludes this, for example, for `@variability = fixed` or `@variability = tunable` and `@causality = calculatedParameter`.
82+
83+
Model FMUs shall interpret empty binary values to indicate that no valid binary data is available.
84+
Model FMUs shall handle this case safely.
85+
86+
The actual binary variable shall contain an annotation of the following form in the `<Annotations>` child element of their `<Binary>` element of the `modelDescription.xml`:
87+
88+
[source,xml]
89+
----
90+
<Annotation type="net.pmsf.osmp" xmlns:osmp="http://xsd.pmsf.net/OSISensorModelPackaging"><osmp:osmp-binary-variable name="<prefix>" role="full" mime-type="<mime-type>"/></Annotation>
91+
----
92+
93+
`<prefix>` is the prefix as defined above.
94+
95+
It is an error if there is not exactly one variable for the same name.
96+
97+
The MIME type given in `@mime-type` shall be a valid MIME type specification.
98+
99+
In the case of OSI-specified data, the MIME type shall have the following form to indicate that the binary content is conformant to the given OSI version and contains a message of the given type:
100+
101+
[source,xml]
102+
----
103+
application/x-open-simulation-interface; type=<type>; version=x.y.z
104+
----
105+
106+
`<type>` shall be the name of an OSI top-level message, excluding the `osi3::` prefix.
107+
108+
The version parameter of the MIME type `application/x-open-simulation-interface` will default to the version specified in the `@osi-version` attribute as part of the top-level `<osmp:osmp>` annotation.
109+
It is an error if a version number is specified neither as part of the MIME type nor using the `@osi-version` attribute.
110+
111+
The guaranteed lifetime of the binary data transported through the actual variable is defined in the FMI 3.0 standard, **regardless** of any specifications in the following sections.
112+
113+
Alternatively, for specific compatibility or other reasons, it is permissible, though not recommended, for an FMI 3.0 FMU to follow the FMI 2.0 approach as specified above.

osmp.xsd

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<xs:enumeration value="base.lo"/>
2424
<xs:enumeration value="base.hi"/>
2525
<xs:enumeration value="size"/>
26+
<xs:enumeration value="full"/>
2627
</xs:restriction>
2728
</xs:simpleType>
2829
</xs:attribute>

0 commit comments

Comments
 (0)