-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add defaults for Valve params and assert for check #201
Conversation
@@ -31,6 +31,18 @@ protected | |||
else m_flow_ref_set/rho_ref "Reference volume flow"; | |||
|
|||
equation | |||
|
|||
//this if clause shall ensure that valid parameters have been entered | |||
if flowCoefficient == FlowCoeffType.Kvs then |
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.
@dzimmer @casella Considering only parameters are involved here, wouldn't it be better/more efficient/performant to place these if
statements in an initial equation
section, so they are only evaluated once instead of continuously?
Or can it be expected (is it specified, maybe?) that tools optimize that out and only execute it once, anyway?
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.
I think that Dymola will optimize for it but the specification does not say anything about it.
Moving to initial equations seems like a good idea.
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.
Actually, the assertion level is set to "error". So the current model's evaluation shall be aborted. The simulation itself still may continue with another evaluation, but IMO is not the case here.
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.
Stupid me... Of course that is why I did not care when implementing it.
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.
Huh? It will only abort if the assert fails, no? If not, does this not check if Kvs>0 over and over again?
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.
Meaning, if you have FlowCoeffType.Kvs, and a Kvs of, say, 0.1, you would still trigger an assert check at every time step?
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.
At least there is a Modelica example with assert() for parameters.
https://build.openmodelica.org/Documentation/ModelicaReference.Operators.%27assert()%27.html
and assert for parameters is used e.g. in:
- Modelica.Blocks.Continuous.Filter
- Modelica.Electrical.Analog.Semiconductors.Diode2
- Modelica.Fluid.Pipes.BaseClasses.PartialStraightPipe
- Modelica.Mechanics.MultiBody.Joints.Revolute
I can't tell how often the assert is evaluated tho.
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.
- corrected some typos
- changed
V_flow_ref
tofinal parameter V_flow_ref
- added a default value + assert for
d_valve
(ThermofluidStream.FlowControl.SpecificValveType
).
I didnt know how to suggest the changes, i hope its fine, that i directly pushed them.
Could we also change m_flow_ref
in ThermofluidStream.FlowControl.Internal.PartialValve
to parameter m_flow_ref
, or does that cause issues concerning conversion script or so?
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.
Pushing directly is the best way.
I'll move the assert to the initial and if I do not find any reason against it would change m_flow_ref to a parameter
|
* Added defaults for Valve params and assert for check * Omit SI-units in description of parameter m_flow_ref_set * Typos * Changed V_flow_ref to final parameter * Added default value + assert for d_valve (ThermofluidStream.FlowControl.SpecificValveType) * Same for TFS.Undirected * assert to initial equations * turned m_flow_ref into parameter --------- Co-authored-by: tobolar <[email protected]> Co-authored-by: Raphael Gebhart <[email protected]>
closes #171 according to result of the discussion
substitutes #187
Performed regression test succesfully.