-
Notifications
You must be signed in to change notification settings - Fork 83
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
Simplifying h_outflow calculation when allowFlowReversal = false #281
Comments
See example
This can be removed by setting
in |
If you agree with the proposed changes I can propose an implementation. |
I need to make a new pull request for this. |
Note that OpenModelica now considers the simplification. In fact any Modelica tool must do so in order to produce correct results for fluid models with absolute sensors, like Modelica.Fluid.Examples.{DrumBoiler, TraceSubstances.RoomCO2}. |
…rtialResistance and PartialFlowSensor rewrote equations in StaticTwoPortConservationEquation for better readability this is for #281
Merged in #312 |
Currently Dymola is able to simplify some calculations when
allowFlowReversal = false
. Consider for instance the following equation.H_in = semiLinear(m_flow, inStream(port_a.h_outflow), inStream(port_b.h_outflow))
allowFlowReversal
typically sets themin
attribute ofm_flow
equal to zero. Dymola can then detect that mass flow will never become negative and that thereforeinStream(port_a.h_outflow)
should always be used in the equation:H_in = m_flow*inStream(port_a.h_outflow)
Since the equation now no longer depends on
inStream(port_b.h_outflow)
this can lead to smaller algebraic loops.However there are some cases where the
min
andmax
attributes are not propagated properly by Dymola and therefore these simplifications are not made. Moreover OpenModelica does not make these simplifications at all. This can lead to large algebraic loops, which deteriorate simulation speed and stability.I propose to make some changes in the code such that this simplification is always made. To this end I would like to change
Annex60.Fluid.Interfaces.StaticTwoPortConservationEquation
,Buildings.Fluid.BaseClasses.PartialResistance
,Annex60.Fluid.Sensors.BaseClasses.PartialFlowSensor
and similar models.In the case of
Annex60.Fluid.Sensors.BaseClasses.PartialFlowSensor
the change would be to replaceby
It may actually be interesting the create a new partial that contains these equations since they are now repeated in a few partials.
I will add an example that demonstrates that this works.
The text was updated successfully, but these errors were encountered: