ModelicaSpecification
ModelicaSpecification copied to clipboard
MCP-0009 Removing Modifications
Reported by kurzbach on 25 Mar 2018 17:57 UTC To parametrize components of classes modifications can be added. These modifications are merged with others, when the class is used as component in another class.
Once a modification is placed at a component, currently there is no way to remove this again at the place of usage of the surrounding class. This prevents a more sophisticated determination of parameter values, e.g., by initial equations.
This MCP adds such a possibility.
This ticked should open the discussion about version 2 of this MCP, which is renamed, completely revised and simplified, compared to version 1. Also, there is no relation to MCP-0008 anymore, which lead to many misunderstandings. The old version was discussed in #1377 which is replaced by this and closed now.
The documents are in https://svn.modelica.org/projects/MCP/MAinternal/MCP-0009_UndefinedModifications (the old directory structure is used)
Migrated-From: https://trac.modelica.org/Modelica/ticket/2241
Modified by kurzbach on 25 Mar 2018 17:58 UTC
This is an interesting idea, and fairly straightforward to add to the specification (and likely to implement).
My only concern is that the proposal uses the new keyword <empty>
; which really breaks the usual rules for keywords in Modelica. Would it be possible to find another solution?
Addendum: The token <>
is already part of Modelica, I don't know if a=<>
would signal if a is unmodified.
In SimulationX we have a implementation of that. There we use the keyword break
.
The advantages are:
- it is already a keyword
- currently only allowed in statement context, therefore no problem to redefine it in modification context
- the semantics can be inferred by the user: it "breaks" the merging of modifications
- no special handling necessary when merging modifications
- the user never sees that at the GUI, it is always presented as empty parameter (but this would be tool specific).
In the current interpretation of the specs I would consider the following model invalid since it contains an outer
declaration with a declaration equation:
model MissingInner
model Q
outer parameter Real p;
Real x = p;
end Q;
Q q;
outer parameter Real p = 0;
end MissingInner;
The current proposal would make it possible to remove binding equations, I was wondering if we should think of allowing this model since the problematic outer
declaration will be turned into an inner
declaration giving the binding equation a clear meaning, and the model will now be able to be used in other contexts.
Adding the current link to MCP-0009, because the issue description is outdated: https://github.com/modelica/ModelicaSpecification/tree/MCP/0009/RationaleMCP/0009
In SimulationX we have a implementation of that. There we use the keyword break. The advantages are:
it is already a keyword currently only allowed in statement context, therefore no problem to redefine it in modification context the semantics can be inferred by the user: it "breaks" the merging of modifications no special handling necessary when merging modifications the user never sees that at the GUI, it is always presented as empty parameter (but this would be tool specific).
break
would be consistent with MCP-0032, selective model extension.
Hence, I would very much prefer it.
Closed by https://github.com/modelica/ModelicaSpecification/pull/3167