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

Default for absoluteValue #3631

Open
henrikt-ma opened this issue Dec 20, 2024 · 0 comments
Open

Default for absoluteValue #3631

henrikt-ma opened this issue Dec 20, 2024 · 0 comments

Comments

@henrikt-ma
Copy link
Collaborator

henrikt-ma commented Dec 20, 2024

In Modelica 3.6, it was not a clear definition of default behavior for the absoluteValue-annotation. We also observed that there are examples of both absoluteValue = false and absoluteValue = true in existing libraries, which corroborated the theory that there was no fixed default.

In System Modeler, we have taken advantage of this by allowing inference for absoluteValue, similar to how the unit of a variable may be inferred. For example, we do the "correct" display value conversion for t2 and t4 here:

  Real t1(unit = "K", displayUnit = "degC") = 293.15 annotation(absoluteValue = true); // Displays as 20°C.
  Real t2(displayUnit = "degC") = t1; // Should display the same way as t1.
  Real t3(unit = "K", displayUnit = "degC") = 293.15 annotation(absoluteValue = false); // Displays as 293.15°C.
  Real t4(displayUnit = "degC") = t3; // Should display the same way as t3.

(In more realistic examples, t2 and t4 would not have a displayUnit-attribute, but the tool would infer that the unit is "K", and based on this allow the user to select "degC" when plotting the result.)

Based on this, I am proposing to spell out that the default for the absoluteValue-annotation is that we use a similar formulation as for unit and displayUnit:

By default, the absoluteValue status is inferred by the tool.

I am aware that this leaves the question of exactly how to do this inference, but this is a problem closely related to how inference should be done for units, and I propose that we don't try to resolve this part before we have solved problem for units. For now, my main priority is just that the specification doesn't close the door for allowing inference which was still open in the 3.6 release.

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

No branches or pull requests

1 participant