fmi-standard
fmi-standard copied to clipboard
Layered Standard to represent maps and curves
@klausschuch had presented an initial draft at a previous meeting. Could you please provide more information?
We at AVL currently use a vendor annotation to represent nd-lookup tables. I guess the simplest way to present our approach is by a snippet of a modeldescription.xml of a FMI2.0 FMU:
<VendorAnnotations>
<Tool name="AVL_SDT">
<AVLAnnotations>
<RegularMaps>
<RegularMap name="map2d">
<Domains>
<Domain name="x" input="in_2d_x" />
<Domain name="y" input="in_2d_y" />
</Domains>
<Codomains>
<Codomain name="v" />
</Codomains>
</RegularMap>
<RegularMap name="lookup1d">
<Domains>
<Domain name="d" input="in_1d" />
</Domains>
<Codomains>
<Codomain name="cd" />
</Codomains>
</RegularMap>
</RegularMaps>
</AVLAnnotations>
</Tool>
</VendorAnnotations>
<ModelVariables>
<!-- 01 --><ScalarVariable name="x[1]" valueReference="0" causality="parameter" variability="tunable"> <Real start="2.0"/> </ScalarVariable>
<!-- 02 --><ScalarVariable name="x[2]" valueReference="1" causality="parameter" variability="tunable"> <Real start="3.0"/> </ScalarVariable>
<!-- 03 --><ScalarVariable name="y[1]" valueReference="2" causality="parameter" variability="tunable"> <Real start="10.0"/> </ScalarVariable>
<!-- 04 --><ScalarVariable name="y[2]" valueReference="3" causality="parameter" variability="tunable"> <Real start="25.0"/> </ScalarVariable>
<!-- 05 --><ScalarVariable name="y[3]" valueReference="4" causality="parameter" variability="tunable"> <Real start="30.0"/> </ScalarVariable>
<!-- 06 --><ScalarVariable name="v[1,1]" valueReference="5" causality="parameter" variability="tunable"> <Real start="11" /> </ScalarVariable>
<!-- 07 --><ScalarVariable name="v[1,2]" valueReference="6" causality="parameter" variability="tunable"> <Real start="12" /> </ScalarVariable>
<!-- 08 --><ScalarVariable name="v[1,3]" valueReference="7" causality="parameter" variability="tunable"> <Real start="13" /> </ScalarVariable>
<!-- 09 --><ScalarVariable name="v[2,1]" valueReference="8" causality="parameter" variability="tunable"> <Real start="21"/> </ScalarVariable>
<!-- 10 --><ScalarVariable name="v[2,2]" valueReference="9" causality="parameter" variability="tunable"> <Real start="22"/> </ScalarVariable>
<!-- 11 --><ScalarVariable name="v[2,3]" valueReference="10" causality="parameter" variability="tunable"> <Real start="23"/> </ScalarVariable>
<!-- 12 --><ScalarVariable name="d[1]" valueReference="11" causality="parameter" variability="tunable" > <Real start="10.0"/> </ScalarVariable>
<!-- 13 --><ScalarVariable name="d[2]" valueReference="12" causality="parameter" variability="tunable" > <Real start="20.0"/> </ScalarVariable>
<!-- 14 --><ScalarVariable name="d[3]" valueReference="13" causality="parameter" variability="tunable" > <Real start="25.0"/> </ScalarVariable>
<!-- 15 --><ScalarVariable name="d[4]" valueReference="14" causality="parameter" variability="tunable" > <Real start="30.0"/> </ScalarVariable>
<!-- 16 --><ScalarVariable name="cd[1]" valueReference="15" causality="parameter" variability="tunable" > <Real start="10.0"/> </ScalarVariable>
<!-- 17 --><ScalarVariable name="cd[2]" valueReference="16" causality="parameter" variability="tunable" > <Real start="20.0"/> </ScalarVariable>
<!-- 18 --><ScalarVariable name="cd[3]" valueReference="17" causality="parameter" variability="tunable" > <Real start="30.0"/> </ScalarVariable>
<!-- 19 --><ScalarVariable name="cd[4]" valueReference="18" causality="parameter" variability="tunable" > <Real start="40.0"/> </ScalarVariable>
<!-- 20 --><ScalarVariable name="in_2d_x" valueReference="19" causality="input" variability="discrete" > <Real start="2.0"/> </ScalarVariable>
<!-- 21 --><ScalarVariable name="in_2d_y" valueReference="20" causality="input" variability="discrete" > <Real start="10.0"/> </ScalarVariable>
<!-- 22 --><ScalarVariable name="out_2d" valueReference="21" causality="output" variability="discrete" > <Real/> </ScalarVariable>
<!-- 23 --><ScalarVariable name="in_1d" valueReference="22" causality="input" variability="discrete" > <Real start="10.0"/> </ScalarVariable>
<!-- 24 --><ScalarVariable name="out_1d" valueReference="23" causality="output" variability="discrete" > <Real/> </ScalarVariable>
</ModelVariables>
Here two 1d-arrays and one 2d-array (the building blocks) are grouped into one 2d-lookup table called "map2d". These building blocks are defined via naming convention. The same concept would work with native fmi3.0 variables representing arrays.
Possible names for the XML elements/attributes:
- regular map, lookup table, array
- codomain, value, data, ordinate, table
- dimension scale, domain, abscissa, applicate, axis, breakpoints
We should aim at being compatible with ASAM Standards such as https://www.asam.net/standards/detail/cdf/ . As these are not free, we should discuss with ASAM.
There are a number of standards that deal with multi-dimensional arrays and unfortunately, they often disagree on how to represent these objects. One more is ASAP2 (a2l), or PAR, DCM, ... we should discuss the "compatibility", but not be discouraged, if we cannot find a good solution. We just might have to pick one of the ways and then live with that decision.
I created the repository https://github.com/modelica/fmi-ls-struct in which the development will take place.