Skip to content
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

Inherit experiment #2535

Merged
merged 1 commit into from
Nov 29, 2023
Merged

Conversation

HansOlsson
Copy link
Collaborator

Specify inheritance of experiment annotation.
Closes #2314

@maltelenz
Copy link
Collaborator

Why should experiment annotations not be merged? That way you could specify common settings in one place in a partial base class, and "fill out" differing fields in the simulation model. I think that would be a much more useful behavior.

Backwards compatibility should not be a concern, since this was previously undefined behavior, and different tools have different behavior.

@HansOlsson
Copy link
Collaborator Author

Why should experiment annotations not be merged?

That was the result of the discussion at the previous meeting.

The issue is that if you in a model have
annotation(experiment(StopTime=1))
you currently don't expect that you need to check all base-classes to see whether they specify e.g. Tolerance. And to avoid that models will then specify annotation(experiment(StartTime=0, StopTime=1, Tolerance=1e-4, ...)).

Note that the text was based on the similar text for coordinate system.

I agree that having some way of specifying "inherit experiment and modify it" would be good, but this was just intended as a solution for the current issue - and not a complete design.

@maltelenz
Copy link
Collaborator

Why should experiment annotations not be merged?

That was the result of the discussion at the previous meeting.

The issue is that if you in a model have
annotation(experiment(StopTime=1))
you currently don't expect that you need to check all base-classes to see whether they specify e.g. Tolerance.

Who is the quoted "you" in this context? I certainly expect that I need to check all base classes, since that is the implementation in SystemModeler.

I agree that having some way of specifying "inherit experiment and modify it" would be good, but this was just intended as a solution for the current issue - and not a complete design.

But this paints us into a corner for no good reason, preventing the (in my opinion) better design of being able to inherit partial experiments.

@henrikt-ma
Copy link
Collaborator

I agree with @maltelenz here, but just wanted to mention that perhaps even more important than inheriting a partial experiment annotation, is the ability to define a base class with complete experiment annotation, and then being able to override just parts of it.

Copy link
Collaborator

@henrikt-ma henrikt-ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

@HansOlsson
Copy link
Collaborator Author

Have (based on feedback) changed to specify that you only override specific fields.

Copy link
Collaborator

@maltelenz maltelenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested fix for minor spelling error, otherwise looks good!

chapters/annotations.tex Outdated Show resolved Hide resolved
@henrikt-ma henrikt-ma dismissed their stale review November 20, 2023 21:57

Dismissing my own review with request for changes, as I'd like to just leave a comment for now.

Copy link
Collaborator

@henrikt-ma henrikt-ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am personally in favor of accepting the PR as it is now. However, I tried to find a clear language group statement about going with this formulation, but couldn't find it. @HansOlsson could you please point us to the relevant phone meeting decision if there is one, or plan to get language group approval in the next meeting?

@HansOlsson
Copy link
Collaborator Author

Language group:
(Should clearly allow StopTime in partial model for this to work; so that it is not considered a simulation model in that case.)
Favor of overriding specific ones: Elena, Dag, Stephan, Gerd, Quentin
Against:
Abstain: Markus

@henrikt-ma
Copy link
Collaborator

Language group: (Should clearly allow StopTime in partial model for this to work; so that it is not considered a simulation model in that case.) Favor of overriding specific ones: Elena, Dag, Stephan, Gerd, Quentin Against: Abstain: Markus

I take this for a language group approval of the current formulation, and will approve the PR accordingly.

Copy link
Collaborator

@henrikt-ma henrikt-ma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, and as far as I can tell, according to phone meeting decision.

@HansOlsson
Copy link
Collaborator Author

I realized that I could either spend a long time trying to figure out how to rebase/merge the current status in the proper way, and be certain that nothing was missed. Or just rebase skip and then re-add the four lines that were added.

@HansOlsson HansOlsson merged commit ed76f68 into modelica:master Nov 29, 2023
1 check passed
@HansOlsson HansOlsson deleted the InheritExperiment branch November 29, 2023 16:19
@HansOlsson HansOlsson added the M37 For pull requests merged into Modelica 3.7 label Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M37 For pull requests merged into Modelica 3.7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inheritance of annotations
3 participants