New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inheritance of annotations #2314
Comments
@perost, you may want to comment on that |
As a simple test case, consider this package package P
model M
parameter Real x = 1;
annotation(experiment(StopTime = 2));
end M;
model M2
extends M(x = 2);
end M2;
end P; According to the specification, I would say that if I simulate |
As briefly discussed with @gkurzbach, one idea of the MCP0008 (Custom annotations) was to improve the behavior on inheritence. But one reason MCP0008 never got mature was the breaking backward-compatibility with existing annotations then. |
I agree that it could be specified more clearly; but for some of these it seems odd to inherit the annotation, e.g.: you normally don't specify derivative of a base-function. And even if a base-function did specify a derivative it's odd that the function extending from it could still use it - as it seems as if something added would invalidate it. (Short class definitions, e.g., |
Language group: But:
Should M2 have StopTime=2? (Reason for wanting this would be a base-experiment with solver and then specific experiments with e.g. different StopTime.) Need to consider more. |
If we view the experiment-annotation as completely overriding existing experiment-annotation (similarly as if it were a record value and The reason is that the inherited one will then only be used if there is no locally defined experiment-annotation, and the specification doesn't state what the default stop-time etc should be in that case. |
I see three possibilities:
|
I realize the notes are not clear here. Was the decision just to inherit experiment-annotation, or? |
That's how I remember it. |
Poll:
|
Two best options in previous poll were:
|
Specify inheritance of experiment annotation. Closes #2314
Section 7.1 of the specification says:
Regarding annotations, the specification is a bit vague, in the sense that it is not clear in general how annotations of the base class are merged with the annotations defined in the derived class.
The only case which is covered explicitly by the specification is graphical annotation, see Section 18.6:
Other than that, nothing at all is said. I think this should be clearly specified, since some annotations have an impact on the behaviour of the model (e.g.
Evaluate
,Inline
,derivative
, etc., as well as theexperiment
annotation for executable models)The text was updated successfully, but these errors were encountered: