Skip to content
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

Modelica.Blocks.Math.RootMeanSquare might fail #935

Closed
modelica-trac-importer opened this issue Jan 14, 2017 · 1 comment
Closed

Modelica.Blocks.Math.RootMeanSquare might fail #935

modelica-trac-importer opened this issue Jan 14, 2017 · 1 comment
Assignees
Labels
bug Critical/severe issue L: Blocks Issue addresses Modelica.Blocks
Milestone

Comments

@modelica-trac-importer
Copy link

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

@modelica-trac-importer modelica-trac-importer added this to the MSL3.2.1 milestone Jan 14, 2017
@modelica-trac-importer modelica-trac-importer added bug Critical/severe issue L: Blocks Issue addresses Modelica.Blocks labels Jan 14, 2017
@modelica-trac-importer
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Critical/severe issue L: Blocks Issue addresses Modelica.Blocks
Projects
None yet
Development

No branches or pull requests

2 participants