From 6d0685251fbc959190abca527d52db01228285c3 Mon Sep 17 00:00:00 2001 From: Michael Wetter Date: Mon, 7 Feb 2022 07:47:54 -0800 Subject: [PATCH] Merged IBPSA, issue1580_OpenModelicaCI (#2878) This also merges the update to the calculation of sta_a and sta_b --- Buildings/.copiedFiles.txt | 1 + .../Interfaces/PartialEightPortInterface.mo | 117 +++++++++++++----- .../Interfaces/PartialFourPortInterface.mo | 67 +++++++--- .../Interfaces/PartialTwoPortInterface.mo | 18 +++ .../Validation/BESTEST/generateResults.py | 2 +- 5 files changed, 160 insertions(+), 45 deletions(-) diff --git a/Buildings/.copiedFiles.txt b/Buildings/.copiedFiles.txt index 8cd5b054fa4..41b9509f8b9 100644 --- a/Buildings/.copiedFiles.txt +++ b/Buildings/.copiedFiles.txt @@ -2005,6 +2005,7 @@ Buildings/Resources/Scripts/Dymola/Utilities/Time/Validation/CalendarTimeMonthsM Buildings/Resources/Scripts/Dymola/Utilities/Time/Validation/CalendarTimeMonthsPlus.mos Buildings/Resources/Scripts/JModelica/buildingspy_to_csv.py Buildings/Resources/Scripts/travis/dymola/dymola +Buildings/Resources/Scripts/travis/omc/omc Buildings/Resources/bin/ConvertWeatherData.jar Buildings/Resources/src/convertEPW/Makefile Buildings/Resources/src/convertEPW/doc/ConvertWeatherData.html diff --git a/Buildings/Fluid/Interfaces/PartialEightPortInterface.mo b/Buildings/Fluid/Interfaces/PartialEightPortInterface.mo index 5571d24c65d..2fc0af7b7fb 100644 --- a/Buildings/Fluid/Interfaces/PartialEightPortInterface.mo +++ b/Buildings/Fluid/Interfaces/PartialEightPortInterface.mo @@ -32,63 +32,106 @@ partial model PartialEightPortInterface HideResult=true); Medium1.MassFlowRate m1_flow = port_a1.m_flow "Mass flow rate from port_a1 to port_b1 (m1_flow > 0 is design flow direction)"; - Modelica.Units.SI.Pressure dp1(displayUnit="Pa") + Modelica.Units.SI.Pressure dp1(displayUnit="Pa") = port_a1.p - port_b1.p "Pressure difference between port_a1 and port_b1"; Medium2.MassFlowRate m2_flow = port_a2.m_flow "Mass flow rate from port_a2 to port_b2 (m2_flow > 0 is design flow direction)"; - Modelica.Units.SI.Pressure dp2(displayUnit="Pa") + Modelica.Units.SI.Pressure dp2(displayUnit="Pa") = port_a2.p - port_b2.p "Pressure difference between port_a2 and port_b2"; Medium3.MassFlowRate m3_flow = port_a3.m_flow "Mass flow rate from port_a3 to port_b3 (m3_flow > 0 is design flow direction)"; - Modelica.Units.SI.Pressure dp3(displayUnit="Pa") + Modelica.Units.SI.Pressure dp3(displayUnit="Pa") = port_a3.p - port_b3.p "Pressure difference between port_a3 and port_b3"; Medium4.MassFlowRate m4_flow = port_a4.m_flow "Mass flow rate from port_a4 to port_b4 (m4_flow > 0 is design flow direction)"; - Modelica.Units.SI.Pressure dp4(displayUnit="Pa") + Modelica.Units.SI.Pressure dp4(displayUnit="Pa") = port_a4.p - port_b4.p "Pressure difference between port_a4 and port_b4"; Medium1.ThermodynamicState sta_a1= + if allowFlowReversal1 then Medium1.setState_phX(port_a1.p, - noEvent(actualStream(port_a1.h_outflow)), - noEvent(actualStream(port_a1.Xi_outflow))) + noEvent(actualStream(port_a1.h_outflow)), + noEvent(actualStream(port_a1.Xi_outflow))) + else + Medium1.setState_phX(port_a1.p, + inStream(port_a1.h_outflow), + inStream(port_a1.Xi_outflow)) if show_T "Medium properties in port_a1"; Medium1.ThermodynamicState sta_b1= + if allowFlowReversal1 then + Medium1.setState_phX(port_b1.p, + noEvent(actualStream(port_b1.h_outflow)), + noEvent(actualStream(port_b1.Xi_outflow))) + else Medium1.setState_phX(port_b1.p, - noEvent(actualStream(port_b1.h_outflow)), - noEvent(actualStream(port_b1.Xi_outflow))) - if show_T "Medium properties in port_b1"; + port_b1.h_outflow, + port_b1.Xi_outflow) + if show_T "Medium properties in port_b1"; + Medium2.ThermodynamicState sta_a2= + if allowFlowReversal2 then Medium2.setState_phX(port_a2.p, - noEvent(actualStream(port_a2.h_outflow)), - noEvent(actualStream(port_a2.Xi_outflow))) + noEvent(actualStream(port_a2.h_outflow)), + noEvent(actualStream(port_a2.Xi_outflow))) + else + Medium2.setState_phX(port_a2.p, + inStream(port_a2.h_outflow), + inStream(port_a2.Xi_outflow)) if show_T "Medium properties in port_a2"; Medium2.ThermodynamicState sta_b2= + if allowFlowReversal2 then + Medium2.setState_phX(port_b2.p, + noEvent(actualStream(port_b2.h_outflow)), + noEvent(actualStream(port_b2.Xi_outflow))) + else Medium2.setState_phX(port_b2.p, - noEvent(actualStream(port_b2.h_outflow)), - noEvent(actualStream(port_b2.Xi_outflow))) - if show_T "Medium properties in port_b2"; + port_b2.h_outflow, + port_b2.Xi_outflow) + if show_T "Medium properties in port_b2"; - Medium3.ThermodynamicState sta_a3= + Medium3.ThermodynamicState sta_a3= + if allowFlowReversal3 then Medium3.setState_phX(port_a3.p, - noEvent(actualStream(port_a3.h_outflow)), - noEvent(actualStream(port_a3.Xi_outflow))) + noEvent(actualStream(port_a3.h_outflow)), + noEvent(actualStream(port_a3.Xi_outflow))) + else + Medium3.setState_phX(port_a3.p, + inStream(port_a3.h_outflow), + inStream(port_a3.Xi_outflow)) if show_T "Medium properties in port_a3"; Medium3.ThermodynamicState sta_b3= + if allowFlowReversal3 then + Medium3.setState_phX(port_b3.p, + noEvent(actualStream(port_b3.h_outflow)), + noEvent(actualStream(port_b3.Xi_outflow))) + else Medium3.setState_phX(port_b3.p, - noEvent(actualStream(port_b3.h_outflow)), - noEvent(actualStream(port_b3.Xi_outflow))) - if show_T "Medium properties in port_b3"; + port_b3.h_outflow, + port_b3.Xi_outflow) + if show_T "Medium properties in port_b3"; + Medium4.ThermodynamicState sta_a4= + if allowFlowReversal4 then Medium4.setState_phX(port_a4.p, - noEvent(actualStream(port_a4.h_outflow)), - noEvent(actualStream(port_a4.Xi_outflow))) + noEvent(actualStream(port_a4.h_outflow)), + noEvent(actualStream(port_a4.Xi_outflow))) + else + Medium4.setState_phX(port_a4.p, + inStream(port_a4.h_outflow), + inStream(port_a4.Xi_outflow)) if show_T "Medium properties in port_a4"; Medium4.ThermodynamicState sta_b4= + if allowFlowReversal4 then + Medium4.setState_phX(port_b4.p, + noEvent(actualStream(port_b4.h_outflow)), + noEvent(actualStream(port_b4.Xi_outflow))) + else Medium4.setState_phX(port_b4.p, - noEvent(actualStream(port_b4.h_outflow)), - noEvent(actualStream(port_b4.Xi_outflow))) - if show_T "Medium properties in port_b4"; + port_b4.h_outflow, + port_b4.Xi_outflow) + if show_T "Medium properties in port_b4"; + protected Medium1.ThermodynamicState state_a1_inflow= Medium1.setState_phX(port_a1.p, inStream(port_a1.h_outflow), inStream(port_a1.Xi_outflow)) @@ -114,11 +157,8 @@ protected Medium4.ThermodynamicState state_b4_inflow= Medium4.setState_phX(port_b4.p, inStream(port_b4.h_outflow), inStream(port_b4.Xi_outflow)) "state for medium inflowing through port_b4"; -equation - dp1 = port_a1.p - port_b1.p; - dp2 = port_a2.p - port_b2.p; - dp3 = port_a3.p - port_b3.p; - dp4 = port_a4.p - port_b4.p; + + annotation ( preferredView="info", Documentation(info=" @@ -133,6 +173,23 @@ mass transfer and pressure drop equations. ", revisions="