Legacy Issue Number: 17537
Source: NASA ( Nicolas Rouquette)
The SysML/Modelica spec includes a metamodel for the Modelica language:
The modelica language has a concept of initial equations & initial algorithms (see sec. 8.6).
The modelica language clearly states that initial equations/algorithms are added to the set of equations:
[A Modelica translator may first transform the continuous equations of a model, at least conceptually, to state
space form. This may require to differentiate equations for index reduction, i.e., additional equations and, in some
cases, additional unknown variables are introduced. This whole set of equations, together with the additional
constraints defined above, should lead to an algebraic system of equations where the number of equations and the
number of all variables (including der(..) and pre(..) variables) is equal. Often, this is a nonlinear system
of equations and therefore it may be necessary to provide appropriate guess values (i.e., start values and
fixed=false) in order to compute a solution numerically.
It may be difficult for a user to figure out how many initial equations have to be added, especially if the system
has a higher index. A tool may add or remove initial equations automatically such that the resulting system is
structurally nonsingular. In these cases diagnostics are appropriate since the result is not unique and may not be
what the user expects. A missing initial value of a discrete variable which does not influence the simulation
result, may be automatically set to the start value or its default without informing the user. For example, variables
8.7 assigned in a when-clause which are not accessed outside of the when-clause and where the pre() operator is
not explicitly used on these variables, do not have an effect on the simulation.]
The Modelica metamodel reflects this differently for initial algorithms than for initial equations.
Notice how INITIALALGORITHMS::contents is composite but INITIALEQUATIONS::contents is not.
<ownedType xmi:type="emof:Class" xmi:id="Absyn.ClassPart.INITIALEQUATIONS" name="INITIALEQUATIONS"
<ownedAttribute xmi:id="Absyn.ClassPart.INITIALEQUATIONS.contents" name="contents"
isOrdered="true" lower="0" upper="*" type="Absyn.EquationItem.uEquationItem"/>
<ownedType xmi:type="emof:Class" xmi:id="Absyn.ClassPart.INITIALALGORITHMS" name="INITIALALGORITHMS"
<ownedAttribute xmi:id="Absyn.ClassPart.INITIALALGORITHMS.contents" name="contents"
isOrdered="true" lower="0" upper="*" type="Absyn.AlgorithmItem.uAlgorithmItem"
</ownedType>I believe that the metamodel should be changed to make INITIALEQUATIONS::contents composite and the QVTO transformations updated accordingly.
Reported: SyM 1.0 — Thu, 2 Aug 2012 04:00 GMT
Updated: Fri, 6 Mar 2015 20:58 GMT