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

Predefined Types -> Real Type -> assert for nominal #1445

Closed
modelica-trac-importer opened this issue Nov 4, 2018 · 7 comments
Closed

Predefined Types -> Real Type -> assert for nominal #1445

modelica-trac-importer opened this issue Nov 4, 2018 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@modelica-trac-importer
Copy link
Collaborator

Reported by vitalij.ruge on 19 Mar 2014 12:22 UTC
It seems for me

 assert(nominal >= min and
nominal <= max, "Nominal value out of limit"); 

is a bit odd, because nominal are the dimension of the variable and the do not depend from signum.

 assert(nominal >= abs(min) and
nominal <= abs(max) and nominal >0, "Nominal value out of limit"); 

e.g. for a = -1e13, 1e13 is a good nominal value


Migrated-From: https://trac.modelica.org/Modelica/ticket/1445

@modelica-trac-importer
Copy link
Collaborator Author

Comment by kurzbach on 19 Mar 2014 12:34 UTC
This is not really correct if min<max<0. Better would be:

assert(nominal > min(abs(min),abs(max)) and
nominal <= max(abs(min),abs(max)), "Nominal value out of limit"); 

The nominal>0 can be omitted in this case.

(Sorry for the orignial german text)

@modelica-trac-importer
Copy link
Collaborator Author

Comment by fcasella on 19 Mar 2014 13:02 UTC
The root problem here is the fuzzy semantics of the nominal attribute. The normative text says (sect. 4.8.6): "The attribute nominal gives the nominal value for the variable", which is what the ancient Greeks called a tautology. What does "nominal" actually mean? This is undefined. The non-normative text hints at scaling and tolerances, but that is not the definition.

We should clearly define the semantics in the normative text, and then draw the appropriate consequences on the assertions.

My proposal is to state explicitly in the normative text that the nominal attribute is meant to be used for scaling purposes and to define tolerances in relative terms. I cannot really see other uses of this attribute. As a consequence, we should remove that assertion entirely.

For example, it is perfectly legitimate to use 1e6 as a scaling value for a pressure type, but then use this type in an application where, say, min = 1.2e6 and max = 2e6, e.g., because you are computing properties by polynomials, which are only valid in that narrow range. I really don't see why one should change nominal in that case to, say, 1.5e6, as 1e6 would still be perfectly OK for scaling purposes, even if it falls outside the min-max range.

@modelica-trac-importer
Copy link
Collaborator Author

Comment by lochel on 22 Mar 2014 08:24 UTC
I agree with Francesco.

Moreover, nominal is the only real type attribute without default value. Hence, it has not to be set properly. How should the assert handled in that case?

@modelica-trac-importer
Copy link
Collaborator Author

Comment by hansolsson on 31 Mar 2016 15:48 UTC
Replying to [comment:2 fcasella]:

My proposal is to state explicitly in the normative text that the nominal attribute is meant to be used for scaling purposes and to define tolerances in relative terms. I cannot really see other uses of this attribute. As a consequence, we should remove that assertion entirely.

I also agree.

I.e. remove that assertion and add
"The nominal attribute is meant to be used for scaling purposes and to define tolerances in relative terms."

@modelica-trac-importer
Copy link
Collaborator Author

Comment by hansolsson on 21 Jun 2016 08:28 UTC
Language group: In agreement by acclamation.

@modelica-trac-importer
Copy link
Collaborator Author

Comment by hansolsson on 23 Jun 2016 11:40 UTC
Scheduled to be added to spec.

@modelica-trac-importer modelica-trac-importer added this to the ModelicaSpec3.4 milestone Nov 4, 2018
@modelica-trac-importer
Copy link
Collaborator Author

Comment by hansolsson on 23 Sep 2016 12:20 UTC
Resolved in r9489

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests