modelica / Modelica-Compliance

A semantics compliance suite for the Modelica language
Other
17 stars 16 forks source link

ModelicaCompliance.Algorithms.When.ElseWhenStatement is too numerically sensitive #47

Closed modelica-trac-importer closed 5 years ago

modelica-trac-importer commented 5 years ago

Reported by hansolsson on 30 Sep 2013 10:41 UTC The ModelicaCompliance.Algorithms.When.ElseWhenStatement has state events and relies on r integrating exactly to the boundaries 0.2 and -1.8 - without any integration error.


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

modelica-trac-importer commented 5 years ago

Comment by hansolsson on 30 Sep 2013 10:48 UTC Replying to [ticket:1294 hansolsson]:

The ModelicaCompliance.Algorithms.When.ElseWhenStatement has state events and relies on r integrating exactly to the boundaries 0.2 and -1.8 - without any integration error.

And same issue in ModelicaCompliance.Equations.When.ElseWhen

modelica-trac-importer commented 5 years ago

Comment by sjoelund.se on 30 Sep 2013 10:59 UTC I see no state events in those expressions. They are all time events in my book... Still, maybe too tight to enforce perfect integration.

modelica-trac-importer commented 5 years ago

Comment by hansolsson on 30 Sep 2013 11:26 UTC Replying to [comment:2 sjoelund.se]:

I see no state events in those expressions. They are all time events in my book... Still, maybe too tight to enforce perfect integration.

The models use 'when time>x' which is not one of the forms that normally trigger a time event - see:

8.5 Events and Synchronization It is a quality of implementation issue that the following special relations

time >= discrete expression 
time < discrete expression 

trigger a time event at “time = discrete expression”, i.e., the event instant is known in advance and no iteration is needed to find the exact event instant.

- With state-events the events introduce an error of the size of event-epsilon in the time of the event (and thus in the integration), and then the integrated error must be within event-epsilon which makes the test very fragile.

However, even though I would recommend using time>= ... instead it does not suffice here, since time events for those expressions are a quality of implementation issue.

modelica-trac-importer commented 5 years ago

Comment by perost on 7 Oct 2013 13:49 UTC I have attempted to fix this in om:r17585 and om:r17586 with suggestions from Martin. Let me know if my fixes are sufficient, or if the tests can be implemented in a better way.

modelica-trac-importer commented 5 years ago

Comment by hansolsson on 10 Oct 2013 09:00 UTC Seems ok now.

modelica-trac-importer commented 5 years ago

Modified by perost on 14 Oct 2013 08:34 UTC

modelica-trac-importer commented 5 years ago

Modified by dietmarw on 15 Nov 2013 13:32 UTC