FMUComplianceChecker
FMUComplianceChecker copied to clipboard
Validation of FMI 2.0 InitialUnknown indices
The compliance checker does not validate indices used in unknowns in the ModelStructure/InitialUnknowns element of modelDescription.xml.
The FMI 2.0 standard (p. 60) specifies that InitialUnknowns is an
Ordered list of all exposed Unknowns in Initialization Mode. This list consists of all variables with (1) causality = "output" and (initial="approx" or "calculated"), and (2) causality = "calculatedParameter" and (3) all continuous-time states and all state derivatives (defined with element <Derivatives> from <ModelStructure>) with initial="approx" or "calculated" [if a Co-Simulation FMU does not define the <Derivatives> element, (3) cannot be present.].
However, the following example passes an XML check:
<ModelVariables>
<ScalarVariable name="v1" valueReference="0" causality="parameter" variability="fixed" initial="exact">
<Real start="0"/>
</ScalarVariable>
<ScalarVariable name="v2" valueReference="1" causality="parameter" variability="fixed" initial="exact">
<Real start="0"/>
</ScalarVariable>
</ModelVariables>
<ModelStructure>
<InitialUnknowns>
<Unknown index="1"/>
<Unknown index="2"/>
</InitialUnknowns>
</ModelStructure>
A check should be made that the listed unknowns are actually unknowns. This could also be extended to cover the knowns it depends on.