-
Notifications
You must be signed in to change notification settings - Fork 167
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
Implementation and demo of IntervalTest #3913
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK from my side.
@@ -0,0 +1,3 @@ | |||
time | |||
and1.y | |||
intervallTest.y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
intervallTest.y | |
intervalTest.y |
connect(upperLimitInternal, upperLimit); | ||
connect(lowerLimitInternal, lowerLimit); | ||
end if; | ||
assert(upperLimitInternal>lowerLimitInternal, "Erroneous interval limits"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this assertion is really needed, I would set this as a warning only - insted of hard termination of the simulation. Optionally, a parameter of type "AssertionLevel" could be add to give the user an opportunity to decide - but this approach is not used elsewhere in MSL so maybe not that good idea.
Modelica.Blocks.Interfaces.RealInput lowerLimitInternal annotation (Placement( | ||
transformation(extent={{-94,-84},{-86,-76}}), iconTransformation(extent={ | ||
{-94,56},{-86,64}}))); | ||
Modelica.Blocks.Interfaces.RealInput upperLimitInternal annotation (Placement( | ||
transformation(extent={{-94,76},{-86,84}}), iconTransformation(extent={{-94,76}, | ||
{-86,84}}))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it could be considered good style to at least not have an iconTransformation
on a protected component? Maybe remove the entire Placement
annotation?
In Simulink a block IntervalTest (i.e. checking whether the input lies within or without the specified interval) exists, in Modelica you have to implement it again and again using Modelica.Blocks.Logical.{And, Or, GreaterThreshold, GreaterEqualThreshold, LessTreshold, LessEqualThreshold, Greater, GreaterEqual, Less, LessEqual}.
I'm pretty sure that this is a block used in many applications, here is a convenient implementation of this functionality.