ThermofluidStream
ThermofluidStream copied to clipboard
PartialNTU outlet enthalpy filter fix
ThermofluidStream.HeatExchangers.Internal.PartialNTU filters outlet enthalpy:
if noEvent(C_A < C_B) then
...
der(h_out_A)*TC = h_in_A - dh_A - h_out_A;
der(h_out_B)*TC = h_in_B - dh_B - h_out_B;
else
...
der(h_out_A)*TC = h_in_A - dh_A - h_out_A;
der(h_out_B)*TC = h_in_B - dh_B - h_out_B;
end if;
- [x] For Dymola 2024x moving the outlet enthalpy filter equation out of the if clause can have a huge impact on simulation time:
if noEvent(C_A < C_B) then
...
else
...
end if;
der(h_out_A)*TC = h_in_A - dh_A - h_out_A;
der(h_out_B)*TC = h_in_B - dh_B - h_out_B;
- [ ] The if clause could be further simplified (move the heat flow rates
q_flowAandq_flowBout of the if clause):
q_flowA = q_flow;
q_flowB = -q_flowA;
if noEvent(inletA.m_flow < m_flow_reg) and noEvent(inletB.m_flow < m_flow_reg) then
dh_A = 0;
dh_B = 0;
else
if noEvent(C_A < C_B) then
dh_A = Delta_T_max*cp_A*effectiveness;
dh_B = (m_flow_B*q_flowB)/(m_flow_B^2 + (m_flow_reg/10)^2);
else
dh_B = -Delta_T_max*cp_B*effectiveness;
dh_A = (m_flow_A*q_flowA)/(m_flow_A^2 + (m_flow_reg/10)^2);
end if;
end if;
but for my tests this caused no obvious improvements.
I would personally only apply the first change der(h_out_A)*TC ..., since for me it seems to solve the issue with slow simulation.
Currently it seems like this is not the main issue.