Declare tolerance as MSL constant#4277
Conversation
henrikt-ma
left a comment
There was a problem hiding this comment.
The change from 1e-4 to Modelica.Constants.eps is massive. I made a small test with System Modeler, and to my big surprise the asserts were not triggered, despite the new tolerance being extremely tight. I hope that someone with a deeper understanding of the dynamics here can approve the change to such tight tolerances.
What about all the other test models in ModelicaTest.MultiBody that still use 1e-4?
This is how I understand the examples:
Basically, all three groups have parameters and initial contitions set in a way to deliver numercally identical results - which is the case for Dymola.
I hope so, too.
Hmm, they are quite a lot. :-( |
MartinOtter
left a comment
There was a problem hiding this comment.
I am strongly against this change.
Several different modeling ways are compared in a simulation. Signals are computed in the order of the relative tolerance, so the correct way would be something like tol = 10*relativeTolerance. However, this cannot be expressed in Modelica. 1e-4 is far good enough as an approximation
Ok. The tolerance is set again to 1e-4. I will change the tolerances back to 1e-4 also in #4276 |
henrikt-ma
left a comment
There was a problem hiding this comment.
There are now lots of unrelated changes in graphic coordinates. Please remove.
Sorry for this. Fixed now. |
HansOlsson
left a comment
There was a problem hiding this comment.
I'm not sure this is a good idea.
I understand that we want to be less strict with unit-checking for such constants, and it matches that. (However, it is not decided yet so no need to rush.)
But if the test fails it does make sense to experiment with changing the tolerance, and thus having a constant seems problematic. (Except that the assert test is completely broken.)
Thus to me it would make sense to instead have two tolerances in the model: rtol (position) and vtol (velocity), even if they have the same value.
This is similar to the idea in #4051 to have different sources.
Sounds like a good alternative. |
I can change this, retaining the same values. Reasonable also to give them units (position, velocity)? @MartinOtter Do you agree? As this changes the original idea of this PR, I guess we can close this PR without merging. |
Yes, this will ensure unit-awareness when viewing/modifying the parameters in context where units determined by inference are not available. |
Close #4193