Closed modelica-trac-importer closed 5 years ago
Comment by jakob on 7 Feb 2011 10:09 UTC Related to this: There is a paper on Modelica 2011 about using FMUs to represent control software
Using the Functional Mockup Interface as an Intermediate Format
in AUTOSAR Software Component Development.
Thiele, Bernhard; Henriksson, Dan
Comment by otter on 14 Feb 2011 13:57 UTC Decision at meeting on Feb. 8, 2011
Enumerations can be additionally defined by a set of tuples(name,value), so a name/value pair. The values must be unique for the same enumeration.This means that most of C-enums are supported (with exception of enums with a non-unique mapping of values). This requires a change in the xml-schema "EnumerationType".
The "min/max" values in the xml schema "EnumerationType" do not make sense and are removed.
Clarify the meaning of min/max for enumerations in ScalarVariable: It restricts the range of the base enumeration (it also holds for non-monotonic enumerations with "holes").
Comment by otter on 4 Apr 2011 16:29 UTC Included in FMI 2.0 draft
Modified by dietmarw on 19 Mar 2012 10:07 UTC
Modified by dietmarw on 7 Sep 2012 10:18 UTC
Modified by dietmarw on 19 Mar 2012 10:07 UTC Section 3.2 Definition of a Type (fmiType) of "FMI for Model Exchange" says that EnumerationType has integer-valued attributes min and max, and a list of zero or more Items. Comment in the corresponding UML diagram: "First item has value=1, Second value has value=2, etc."
I guess this comment implies that the min attribute has value 1 (at least if there is at least 1 Item), and max is the number of Items. If so, the constraints for min max of an EnumerationType should be made explicit in the spec.
However, I propose to generalize the current rep in a backward compatible way to also support non Modelica enums, e.g. those that start from 0, or contain gaps and duplicate values.
Background: a customer used the FMI to also represent control software compiled from C code. His example used an enum that started from -2 (meaning 2nd reverse gear in this case) and contained gaps.
The proposal is to fully support C enums.
This would e.g. allow the encoding of the following C enum
The names declared inside the enumeration are constants with int type. Their values are these:
This enum is of course ugly. But if we do not support such enums, it will be difficult to create automated conversion procedures from C to FMU. A tool could issue a warning here, but it should not silenty use a different value encoding (error prone) or force the user to stick to Modelica enum rules in their C code (difficult if he uses a code generator).
Reported by jakob on 25 Dec 2010 13:33 UTC Section 3.2 Definition of a Type (fmiType) of "FMI for Model Exchange" says that EnumerationType has integer-valued attributes min and max, and a list of zero or more Items. Comment in the corresponding UML diagram: "First item has value=1, Second value has value=2, etc."
I guess this comment implies that the min attribute has value 1 (at least if there is at least 1 Item), and max is the number of Items. If so, the constraints for min max of an EnumerationType should be made explicit in the spec.
However, I propose to generalize the current rep in a backward compatible way to also support non Modelica enums, e.g. those that start from 0, or contain gaps and duplicate values.
Background: a customer used the FMI to also represent control software compiled from C code. His example used an enum that started from -2 (meaning 2nd reverse gear in this case) and contained gaps.
The proposal is to fully support C enums.
This would e.g. allow the encoding of the following C enum
The names declared inside the enumeration are constants with int type. Their values are these:
This enum is of course ugly. But if we do not support such enums, it will be difficult to create automated conversion procedures from C to FMU. A tool could issue a warning here, but it should not silenty use a different value encoding (error prone) or force the user to stick to Modelica enum rules in their C code (difficult if he uses a code generator).
Migrated-From: https://trac.fmi-standard.org/ticket/42