-
Notifications
You must be signed in to change notification settings - Fork 166
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
Catastrophic cancellation in PadeDelay1 #4409
Comments
Well, the question is really whether cancellation happens in the model - and the answer is that it does: We know that Without balancing What isn't clear is whether this cancellation is really problematic or not, as without balancing der(x[1]) goes smoothly up to 1e16, and still the output looks the same as with balancing. As an example modifying the unbalanced model to set To me the obvious improvement would be to make Note that if we were to increase n=18 then the unbalanced model seems to hang with Dymola; whereas the balanced model even runs (slowly) with n=30. |
On the affected platform, we get garbage in the order of 1e2 in the derivative, which appears to be enough to make the error control effectively hang the simulation. On the other platforms, we happen to get an exact 0.0 instead of the noise, and integration completes in no time.
I suppose the backward incompatibility would be easy to accept if the change is considered a bugfix. |
This concerns a potential issue with the example
ModelicaTest.Blocks.PadeDelay1
.In System Modeler,
der(padeDelay1.x[1]
is computed using the following expression:The first time this is evaluated, all terms are zero except the first and the last one. The first one is -6.5472907499999936e+17, while the last one is 6.5472907499999936e+17, which leads to completely catastrophic cancellation. We happen to get away with it on all platforms except one, but the catastrophic cancellation as such exists on all platforms.
Is it System Modeler which is not smart enough about handling the
PadeDelay
equations, or is the catastrophic cancellation happening in other tools as well?On a side note, if I enable
balance
in thePadeDelay
, the simulation runs fine, but I haven't investigated whether this is thanks to actually eliminating the catastrophic cancellation.The text was updated successfully, but these errors were encountered: