-
Notifications
You must be signed in to change notification settings - Fork 40
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
Comments
To me the description was made it clear by only stating the effect of However, it would clearly be possible to remove the default and with increased unit inference it makes more sense.
The problem I see is that inferring whether something is an absolute value or not can be more complicated, and either we need to specify it (which will take time) or different tools will behave differently. On the other hand if we have In many cases I don't see how we can infer if it is an absolute value or not - in particular if we had "t1=t5+t6;" (using Thus, I would consider it important that we state that specifying it is preferable. |
Yes, but it is actually not completely trivial to extend this example to something realistic where it is still not possible to infer which of them is absolute (especially if removing the requirement that the inference should be supported by some existing Modelica tool).
Well, saying it is preferable even in the cases where it is trivially inferable seems a bit clumsy, so we should aim for something more nuanced. Maybe this could work:
|
More important than giving recommendations for the user however, is probably to give the sensible rule for tools:
Given this, the recommendation could be replaced by a non-normative observation:
|
Since we don't have any rules for inference (yet) I would rewrite it as follows: For a component where unit conversions involving non-zero offset is possible (mainly temperatures) it is recommend to give a value for absoluteValue in annotation either for the component or the type declaration. Tools may infer absoluteValue in other cases, but specifying absoluteValue reduces impact of quality-of-implementation in tool ability to infer absoluteValue. |
OK, then I'll prepare a PR where the discussion can be continued. |
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 bothabsoluteValue = false
andabsoluteValue = 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 fort2
andt4
here:(In more realistic examples,
t2
andt4
would not have adisplayUnit
-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 forunit
anddisplayUnit
: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.
The text was updated successfully, but these errors were encountered: