ibpsa / modelica-ibpsa

Modelica library for building and district energy systems developed within IBPSA Project 1
https://ibpsa.github.io/project1
145 stars 84 forks source link

PrescribedOutlet does not avoid algebraic loop when using state #1128

Open Mathadon opened 5 years ago

Mathadon commented 5 years ago

The model PrescribedOutlet does not break algebraic loops for computing enthalpy when not energyDynamics==SteadState. This is a missed opportunity compared to pumps and valves where the dynamics state does break algebraic loops. The reason is that the implementation has

port_b.h_outflow = inStream(port_a.h_outflow) + dhAct;

such that a direct dependency between the inflow and outflow enthalpy remains. The current implementation thus only filters the control input but does actually add fluid dynamics.

This could be revised such that port_b.h_outflow depends directly on the state T. To conserve energy, dhAct should then be computed from (port_b.h_outflow - inStream(port_a.h_outflow))*port_a.m_flow, to which the capacity limitations can be applied, if needed. The corresponding heat flow rate is added to the computation of der(T).

Can we revise the implementation in this way?

mwetter commented 5 years ago

@Mathadon : If this leads to simpler equations then this would be a good change. I assume you will do the same for the moisture.