ModelicaSpecification icon indicating copy to clipboard operation
ModelicaSpecification copied to clipboard

MCP-0009 Removing Modifications

Open modelica-trac-importer opened this issue 5 years ago • 6 comments

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

modelica-trac-importer avatar Nov 04 '18 22:11 modelica-trac-importer

Modified by kurzbach on 25 Mar 2018 17:58 UTC

modelica-trac-importer avatar Nov 04 '18 22:11 modelica-trac-importer

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.

HansOlsson avatar Feb 12 '20 14:02 HansOlsson

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).

gkurzbach avatar Feb 13 '20 06:02 gkurzbach

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.

qlambert-pro avatar Jun 17 '21 06:06 qlambert-pro

Adding the current link to MCP-0009, because the issue description is outdated: https://github.com/modelica/ModelicaSpecification/tree/MCP/0009/RationaleMCP/0009

GallLeo avatar Jan 21 '22 21:01 GallLeo

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.

christoff-buerger avatar Jan 26 '22 13:01 christoff-buerger

Closed by https://github.com/modelica/ModelicaSpecification/pull/3167

HansOlsson avatar Nov 21 '22 09:11 HansOlsson