You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reported by hansolsson on 19 Dec 2012 14:06 UTC
The block Modelica.Blocks.Math.RootMeanSquare does not guard the square-root against negative numbers.
Mathematically the integral of a square should be >=0, but one cannot guarantee that every numerical integration scheme satisfies this. Since the integral is sampled it will not be detected during integration (where an integrator can easily reduce the step-size), but during event-handling
A solution could be to take max(0, mean.y) as input (using the max-block); with suitable explanation.
Comment by otter on 1 Jan 2013 22:01 UTC
Fixed in 21f046b:
Added a parameter in block "Mean" to state, if the output is guaranteed to be >= 0.0.
In such a case, the output of block "Mean" is computed as max(0, y_computed), i.e., it is
guaranteed to be >= 0.0. In the RootMeanSquare block, this parameter is appropriately set and
then it is guaranteed that the input to the Sqrt block is >= 0.0.
Additionally, added a test model in ModelicaTest to check the desired behavior.
Reported by hansolsson on 19 Dec 2012 14:06 UTC
The block Modelica.Blocks.Math.RootMeanSquare does not guard the square-root against negative numbers.
Mathematically the integral of a square should be >=0, but one cannot guarantee that every numerical integration scheme satisfies this. Since the integral is sampled it will not be detected during integration (where an integrator can easily reduce the step-size), but during event-handling
A solution could be to take max(0, mean.y) as input (using the max-block); with suitable explanation.
Migrated-From: https://trac.modelica.org/Modelica/ticket/935
The text was updated successfully, but these errors were encountered: