modelica / Modelica-Compliance

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

ModelicaCompliance.{Algorithms,Equations}.When.WhenPriority has non-trigged when #48

Closed modelica-trac-importer closed 5 years ago

modelica-trac-importer commented 5 years ago

Reported by hansolsson on 30 Sep 2013 10:47 UTC The updated ModelicaCompliance.Algorithms.When.WhenPriority and ModelicaCompliance.Equations.When.WhenPriority have a when-statement that never should be triggered.

See mapping of when to if in 8.3.5.1; i.e. the mapping implies that a when that starts true does not trigger an event initially.


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

modelica-trac-importer commented 5 years ago

Comment by perost on 7 Oct 2013 11:45 UTC Fixed in om:r17580. Let me know if this is an acceptable solution.

modelica-trac-importer commented 5 years ago

Comment by perost on 8 Oct 2013 09:35 UTC Improved fix in om:r17600 and om:r17601.

modelica-trac-importer commented 5 years ago

Comment by hansolsson on 8 Oct 2013 13:27 UTC Still too numerically sensitive, since zero difference for crossing function. One possibility would be:

  when not initial() then
    x = 6;
  end when;

  when x >= 5 then
...

Another would be to use something like

   Boolean activated=time>=1e-3;
algorithm
   when activated and x>=2 then
     ...
   elsewhen activated and x>=1 then
      ...
   end 
   assert(not activated or ..., "");
modelica-trac-importer commented 5 years ago

Comment by perost on 14 Oct 2013 09:17 UTC Fixed in om:r17678 by using the first suggestion (x = 6).

modelica-trac-importer commented 5 years ago

Modified by perost on 10 Feb 2014 16:57 UTC

modelica-trac-importer commented 5 years ago

Modified by dietmarw on 10 Feb 2014 17:06 UTC