Navigation Menu

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

Meaning of argument-less experiment annotation #2985

Closed
henrikt-ma opened this issue Sep 1, 2021 · 7 comments · Fixed by #2999
Closed

Meaning of argument-less experiment annotation #2985

henrikt-ma opened this issue Sep 1, 2021 · 7 comments · Fixed by #2999
Milestone

Comments

@henrikt-ma
Copy link
Collaborator

Bringing up question as suggested in #2922 (comment):

Quoting the grammar for the experiment annotation:

"experiment"
   [ "(" [ experimentOption { "," experimentOption } ] ")" ]

What is the purpose of allowing the annotation without argument list?

model M
  annotation(experiment); /* Valid, but what is the purpose? */
end M;

Why don't we simply require the argument list?

@sjoelund
Copy link
Member

sjoelund commented Sep 1, 2021

Having an empty experiment would make sense if the experiment annotation was inherited, to mark the model as an experiment but the settings are elsewhere. (Or perhaps just stating it is an experiment; use default settings)

@henrikt-ma
Copy link
Collaborator Author

Having an empty experiment would make sense if the experiment annotation was inherited, to mark the model as an experiment but the settings are elsewhere. (Or perhaps just stating it is an experiment; use default settings)

To me, it would be more natural to express that with experiment() instead, although I'm hesitant to consider anything without StopTime a meaningful experiment.

@perost
Copy link
Collaborator

perost commented Sep 1, 2021

Why is there even specific grammar for some of the annotations in the specification, while others are defined as records? The actual grammar of Modelica for annotations is annotation class-modification, which is not consistent with the grammar given for experiment.

OpenModelica ignores modifiers with neither submodifiers nor an expression (like Real x(start)), so for what it's worth we currently ignore an experiment annotation such as this. That might be wrong in this case since it means the model is not even marked as an experiment, but I guess that's what this issue is about.

@maltelenz
Copy link
Collaborator

See also #2852, #2314 and #2535.

@henrikt-ma
Copy link
Collaborator Author

henrikt-ma commented Nov 22, 2023

Without reopening, let me just try to summarize how I interpret the resolution by #2999:

When an annotation is defined by a pseudo-record, the record constructor form must be used in order to express a valid annotation, so annotation(experiement) is invalid (but unfortunately, invalid annotations like this are not errors), while annotation(experiemnt()) is valid:

model A
  annotation(experiment(StartTime = -1.0));
end A;
model B
  extends A;
  /* This model has StartTime = -1.0, inherited from A. */
  annotation(experiment); /* Not a valid experiment annotation; means nothing at all. */
end B;
model C
  extends A;
  /* This model has StartTime = 0.0, coming from the local annotation. */
  annotation(experiment()); /* Valid annotation. */
end C;

@perost
Copy link
Collaborator

perost commented Nov 22, 2023

Without reopening, let me just try to summarize how I interpret the resolution by #2999:

When an annotation is defined by a pseudo-record, the record constructor form must be used in order to express a valid annotation, so annotation(experiement) is invalid (but unfortunately, invalid annotations like this are not errors), while annotation(experiemnt()) is valid:

model A
  annotation(experiment(StartTime = -1.0));
end A;
model B
  extends A;
  /* This model has StartTime = -1.0, inherited from A. */
  annotation(experiment); /* Not a valid experiment annotation; means nothing at all. */
end B;
model C
  extends A;
  /* This model has StartTime = 0.0, coming from the local annotation. */
  annotation(experiment()); /* Valid annotation. */
end C;

experiment() is not a record constructor in this context though, it's an empty class modifier. If the normal modifier semantics were to be used it wouldn't have any meaning either.

@henrikt-ma
Copy link
Collaborator Author

experiment() is not a record constructor in this context though, it's an empty class modifier. If the normal modifier semantics were to be used it wouldn't have any meaning either.

This comment by @HansOlsson shows where the confusion comes from. I believe it is best we continue the discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants