modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
466 stars 166 forks source link

SmoothPower_der function includes noEvent operator #1800

Closed modelica-trac-importer closed 7 years ago

modelica-trac-importer commented 7 years ago

Reported by msasena on 13 Oct 2015 15:53 UTC The function Modelica.Fluid.Dissipation.Utilities.Functions.General includes the following algorithm section:

adeltax := abs(deltax);
if noEvent(x >= adeltax) then
   dy := dx*pow*x^(pow - 1);
elseif noEvent(x <= -adeltax) then
   dy := dx*pow*(-x)^(pow - 1);
else
   C3 := (pow - 1)/2*adeltax^(pow - 3);
   C1 := (3 - pow)/2*adeltax^(pow - 1);
   dy := (C1 + 3*C3*x*x)*dx;
end if;

Since Modelica functions are not supposed to generate events, the noEvent operator is not needed. In the case of the LMS Amesim compiler, we consider this usage illegal and reject the model. We would therefore recommend the noEvent operator be removed from the function.


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

modelica-trac-importer commented 7 years ago

Comment by wischhusen on 13 Oct 2015 16:04 UTC noEvent() is not needed in this function. It is removed with bf5ddc8172d92d681febeea08c5e8f710cb56de5

modelica-trac-importer commented 7 years ago

Changelog modified by wischhusen on 13 Oct 2015 16:04 UTC Operator noEvent() was removed from function SmoothPower_der.

modelica-trac-importer commented 7 years ago

Modified by dietmarw on 13 Oct 2015 16:08 UTC