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

Nominal values in MSL Rotational examples #1557

Closed
modelica-trac-importer opened this issue Jan 15, 2017 · 12 comments
Closed

Nominal values in MSL Rotational examples #1557

modelica-trac-importer opened this issue Jan 15, 2017 · 12 comments
Assignees
Labels
enhancement New feature or enhancement L: Mechanics.Rotational Issue addresses Modelica.Mechanics.Rotational
Milestone

Comments

@modelica-trac-importer
Copy link

Reported by christian.andersson on 22 Aug 2014 09:45 UTC
A few example models in the Mechanics.Rotational library are missing nominal values making them quite difficult to simulate as the chosen states (by most tools) are very small.

I would propose to add appropriate nominal values for those variables that have fixed=true and a start value. The affected models and changes would then be:

For LossyGearDemo1 add nominals for Inertia2.phi (0.001) and Inertia2.w (0.01)
For LossyGearDemo2 add nominals for Inertia2.phi (1e-4) and Inertia2.w (0.001)

Comments?


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

@modelica-trac-importer
Copy link
Author

Modified by beutlich on 22 Aug 2014 11:50 UTC

@modelica-trac-importer modelica-trac-importer added the L: Mechanics.Rotational Issue addresses Modelica.Mechanics.Rotational label Jan 15, 2017
@modelica-trac-importer
Copy link
Author

Comment by jmattsson on 11 Dec 2014 13:27 UTC
This is also true for the model ElasticBearing where the variable springDamper.w_rel should have the nominal 1e-4.

@modelica-trac-importer
Copy link
Author

Comment by jmattsson on 11 Dec 2014 13:32 UTC
a79e6a1
Added nominal value for problematic variable in ElasticBearing example.

(Tested in Dymola, OpenModelica and JModelica.org.)

@modelica-trac-importer
Copy link
Author

Comment by beutlich on 11 Dec 2014 19:30 UTC
Let's set milestone to MSL 3.2.2 where a79e6a1 went.

Jesper, can you fix and check LossyGearDemo1 and LossyGearDemo2, too?

@modelica-trac-importer modelica-trac-importer added this to the MSL3.2.2 milestone Jan 15, 2017
@modelica-trac-importer
Copy link
Author

Comment by otter on 12 Dec 2014 10:11 UTC
It is fine to add nominal values, but I wonder whether this is in general the right approach:

Typically, step-size control on a state variable is switched off if the variable value becomes smaller as the absolute tolerance defined for this variable. In the Modelica specification it is stated (section 4.8.7):
The attribute nominal gives the nominal value for the variable. The user need not set it even though the standard does not define a default value. [The nominal value can be used by an analysis tool to determine appropriate tolerances or epsilons, or may be used for scaling. For example, the absolute tolerance for an integrator could be computed as “absTol=abs(nominal)*relTol/100”. ...]

With the default tolerance of 1e-4 and the default nominal value of 1, the absolute tolerance is 1e-6 (according to the recommendation of the Modelica Specification). For all the examples mentioned in this ticket, this tolerance should be still sufficient for a proper step size control. If this is not the case, vendors should consider to change the default setting of the absolute tolerance according to the recommendation of the Modelica specification (or explain, why this recommendation is not sufficient or not good).

What vendors could additionally provide is a debug option to detect critical cases (a user cannot do this, because a user does not know the strategy how a tool computes the absolute tolerance): Once this debug option is set, a tool could compare all state variables of the simulation run with the used absolute tolerance. If a state variable x is permanently too small with respect to the absolute tolerance (say |x(t)| < absTol*10), then a warning message is printed.

@modelica-trac-importer
Copy link
Author

Comment by jmattsson on 12 Dec 2014 10:40 UTC
Replying to [comment:5 otter]:

(according to the recommendation of the Modelica Specification).

I really can't agree that the non-normative text "For example, the absolute tolerance for an integrator could be computed as" constitutes a recommendation.

Replying to [comment:5 otter]:

What vendors could additionally provide is a debug option to detect critical cases

Certainly, but these are not user models, they are examples in the MSL. I think it is probably in the best interest of all of us that the MSL examples are robust models.

@modelica-trac-importer
Copy link
Author

Comment by otter on 12 Dec 2014 13:38 UTC

Replying to [comment:5 otter]:

What vendors could additionally provide is a debug option to detect critical cases
Certainly, but these are not user models, they are examples in the MSL. I think it is probably in the best interest of all of us that the MSL examples are robust models.

I do not think it is possible to arrive at a robust solution, because from a library point of view one has to make assumptions for the tools and if these (implicit) assumptions are not fulfilled, it is highly likely that simulations will fail. Implicit assumptions on a tool: (a) appropriate numerical, variable step solvers for the differential and the algebraic equations, (b) appropriate numerical algorithms for initialization,(c) appropriate definition of relative tolerances for the numerical solvers, (d) appropriate default values for relative tolerances, (e) appropriate absolute tolerances, and probably more.

One goal is that the MSL runs satisfactorily in all the Modelica tools, and one just has to be pragmatic. If for some examples, the simulation in some tools is not satisfactory, and it is possible to fix this with a change in the MSL, then this should be just done (such as adding nominal values).

However, this does not mean that nominal values should be excessively added (in the end this would mean that for all > 500 example models, one has to set StateSelect.always for ALL states, and set appropriate nominals values for ALL states; this is just not practical, and is also not a good template for an end-user, how he/she should use Modelica). On the other hand, tool vendors should see the MSL examples also as benchmarks to tune the default settings of their tools, in order that these examples simulate satisfactorily with not much special settings.

@modelica-trac-importer
Copy link
Author

Comment by jmattsson on 19 Oct 2015 13:34 UTC
c785bb4
Merged a79e6a1 to maintenance branch for 3.2.1.

@modelica-trac-importer
Copy link
Author

Comment by otter on 13 Dec 2015 07:57 UTC
Fixed in 92f881d by adding nominal values as suggested.

@modelica-trac-importer
Copy link
Author

Changelog modified by otter on 13 Dec 2015 07:57 UTC
Added nominal values to small state variables in Rotational examples ( LossyGearDemo1/2)

@modelica-trac-importer
Copy link
Author

Modified by beutlich on 13 Dec 2015 08:21 UTC

@modelica-trac-importer
Copy link
Author

Changelog modified by beutlich on 13 Dec 2015 08:21 UTC
Added nominal values to small state variables in Rotational examples (LossyGearDemo1/2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement L: Mechanics.Rotational Issue addresses Modelica.Mechanics.Rotational
Projects
None yet
Development

No branches or pull requests

2 participants