From f1f725040a2f0203d70a1237f8ab034dcfd027c4 Mon Sep 17 00:00:00 2001 From: kldjonge Date: Fri, 12 Sep 2025 09:10:12 +0200 Subject: [PATCH 01/16] set dp_turbulent to 0.01 (temporarily) The CONTAM-like implementation resulted in dp_turbulent values that are too low, effectively resulting in issues when dpAB switches direction in the door model. --- IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo b/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo index 07d1e2ce5e..06d2cf95ee 100644 --- a/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo +++ b/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo @@ -69,10 +69,9 @@ model CrackOrOperableDoor final parameter Boolean openDoorOnePort = useDoor and interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.OnePort "Sets whether a door is open or closed in one port configuration" ; - parameter Modelica.Units.SI.PressureDifference dp_turbulent(min=0,displayUnit="Pa") = - if useDoor then (MFtrans/(rho_default*(CDOpe * hOpe*wOpe * sqrt(2/rho_default))))^(1/mOpe) else 0.01 - "Pressure difference where laminar and turbulent flow relation coincide for large cavities" - annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); + parameter Modelica.Units.SI.PressureDifference dp_turbulent(min=0,displayUnit="Pa") = 0.01 + "Pressure difference where laminar and turbulent flow relation coincide for large cavities" + annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); parameter Modelica.Units.SI.MassFlowRate MFtrans=(hOpe*wOpe)*VItrans*REtrans/DOpe "Mass flow rate used for reguralisation" annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); From 7bb9353082122bdaec4133e2705c6aa413d09297 Mon Sep 17 00:00:00 2001 From: kldjonge Date: Fri, 12 Sep 2025 09:10:49 +0200 Subject: [PATCH 02/16] Avoid event for exterior convection coefficients of roofs and floors --- .../BaseClasses/ConvectiveHeatTransfer/ExteriorConvection.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IDEAS/Buildings/Components/BaseClasses/ConvectiveHeatTransfer/ExteriorConvection.mo b/IDEAS/Buildings/Components/BaseClasses/ConvectiveHeatTransfer/ExteriorConvection.mo index 4484aac126..a57c9fab63 100644 --- a/IDEAS/Buildings/Components/BaseClasses/ConvectiveHeatTransfer/ExteriorConvection.mo +++ b/IDEAS/Buildings/Components/BaseClasses/ConvectiveHeatTransfer/ExteriorConvection.mo @@ -53,13 +53,13 @@ equation // Assign empirical coefficient according to flow regime. if isCeiling then - if dT > 0 then + if noEvent(dT > 0) then C = C_horz_buoyant; else C = C_horz_stable; end if; elseif isFloor then - if dT < 0 then + if noEvent(dT < 0) then C = C_horz_buoyant; else C = C_horz_stable; From ed1e927ba49c9ebf12977b0d17b3eb53db9aca33 Mon Sep 17 00:00:00 2001 From: kldjonge Date: Fri, 12 Sep 2025 09:17:07 +0200 Subject: [PATCH 03/16] Increase door-model performance, avoid state-events and chattering --- .../Multizone/BaseClasses/TwoWayFlowElement.mo | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/IDEAS/Airflow/Multizone/BaseClasses/TwoWayFlowElement.mo b/IDEAS/Airflow/Multizone/BaseClasses/TwoWayFlowElement.mo index 8b59c0f7b1..e3e1e65281 100644 --- a/IDEAS/Airflow/Multizone/BaseClasses/TwoWayFlowElement.mo +++ b/IDEAS/Airflow/Multizone/BaseClasses/TwoWayFlowElement.mo @@ -19,13 +19,13 @@ partial model TwoWayFlowElement "Flow resistance that uses the power law" parameter Modelica.Units.SI.Velocity vZer=0.001 "Minimum velocity to prevent zero flow. Recommended: 0.001"; - Modelica.Units.SI.VolumeFlowRate VAB_flow(nominal=0.001) + Modelica.Units.SI.VolumeFlowRate VAB_flow(nominal=1/3600) "Volume flow rate from A to B if positive"; - Modelica.Units.SI.VolumeFlowRate VBA_flow(nominal=0.001) + Modelica.Units.SI.VolumeFlowRate VBA_flow(nominal=1/3600) "Volume flow rate from B to A if positive"; - Modelica.Units.SI.MassFlowRate mAB_flow(nominal=0.001) + output Modelica.Units.SI.MassFlowRate mAB_flow(nominal=1.2/3600) "Mass flow rate from A to B if positive"; - Modelica.Units.SI.MassFlowRate mBA_flow(nominal=0.001) + output Modelica.Units.SI.MassFlowRate mBA_flow(nominal=1.2/3600) "Mass flow rate from B to A if positive"; Modelica.Units.SI.Velocity vAB(nominal=0.01) "Average velocity from A to B"; @@ -88,8 +88,8 @@ equation vAB = VAB_flow/A; vBA = VBA_flow/A; - port_a1.m_flow = mAB_flow; - port_a2.m_flow = mBA_flow; + port_a1.m_flow = VAB_flow*rho_a1_inflow; + port_a2.m_flow = VBA_flow*rho_a2_inflow; // Energy balance (no storage, no heat loss/gain) port_a1.h_outflow = inStream(port_b1.h_outflow); From a028260067b232a138119a18ba98aece7e94d17c Mon Sep 17 00:00:00 2001 From: kldjonge Date: Fri, 12 Sep 2025 09:37:17 +0200 Subject: [PATCH 04/16] Explicitly set causality of mExc (error check state) to output --- IDEAS/Airflow/Multizone/BaseClasses/TwoWayFlowElement.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IDEAS/Airflow/Multizone/BaseClasses/TwoWayFlowElement.mo b/IDEAS/Airflow/Multizone/BaseClasses/TwoWayFlowElement.mo index e3e1e65281..7c78625ae5 100644 --- a/IDEAS/Airflow/Multizone/BaseClasses/TwoWayFlowElement.mo +++ b/IDEAS/Airflow/Multizone/BaseClasses/TwoWayFlowElement.mo @@ -41,9 +41,9 @@ protected Modelica.Units.SI.VolumeFlowRate VZer_flow(fixed=false) "Minimum net volume flow rate to prevent zero flow"; - Modelica.Units.SI.Mass mExcAB(start=0, fixed=true) + output Modelica.Units.SI.Mass mExcAB(start=0, fixed=true) "Air mass exchanged (for purpose of error control only)"; - Modelica.Units.SI.Mass mExcBA(start=0, fixed=true) + output Modelica.Units.SI.Mass mExcBA(start=0, fixed=true) "Air mass exchanged (for purpose of error control only)"; Medium.MassFraction Xi_a1_inflow[Medium1.nXi] From cc6e080a2409c3e3dc9ec78341e90f644d64724b Mon Sep 17 00:00:00 2001 From: kldjonge Date: Wed, 17 Sep 2025 15:33:25 +0200 Subject: [PATCH 05/16] Revert "set dp_turbulent to 0.01 (temporarily)" This reverts commit f1f725040a2f0203d70a1237f8ab034dcfd027c4. --- IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo b/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo index 06d2cf95ee..07d1e2ce5e 100644 --- a/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo +++ b/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo @@ -69,9 +69,10 @@ model CrackOrOperableDoor final parameter Boolean openDoorOnePort = useDoor and interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.OnePort "Sets whether a door is open or closed in one port configuration" ; - parameter Modelica.Units.SI.PressureDifference dp_turbulent(min=0,displayUnit="Pa") = 0.01 - "Pressure difference where laminar and turbulent flow relation coincide for large cavities" - annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); + parameter Modelica.Units.SI.PressureDifference dp_turbulent(min=0,displayUnit="Pa") = + if useDoor then (MFtrans/(rho_default*(CDOpe * hOpe*wOpe * sqrt(2/rho_default))))^(1/mOpe) else 0.01 + "Pressure difference where laminar and turbulent flow relation coincide for large cavities" + annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); parameter Modelica.Units.SI.MassFlowRate MFtrans=(hOpe*wOpe)*VItrans*REtrans/DOpe "Mass flow rate used for reguralisation" annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); From 98604dd4689059172662c799f3bbd17c2777603f Mon Sep 17 00:00:00 2001 From: kldjonge Date: Wed, 17 Sep 2025 15:43:44 +0200 Subject: [PATCH 06/16] =?UTF-8?q?Set=20dpAB=20nominal=20to=20correspond=20?= =?UTF-8?q?to=20the=20pressure=20that=20fits=201m=C2=B3/h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IDEAS/Airflow/Multizone/BaseClasses/DoorDiscretized.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IDEAS/Airflow/Multizone/BaseClasses/DoorDiscretized.mo b/IDEAS/Airflow/Multizone/BaseClasses/DoorDiscretized.mo index 7e9fdff819..505fcd9197 100644 --- a/IDEAS/Airflow/Multizone/BaseClasses/DoorDiscretized.mo +++ b/IDEAS/Airflow/Multizone/BaseClasses/DoorDiscretized.mo @@ -10,7 +10,7 @@ partial model DoorDiscretized displayUnit="Pa") = 0.01 "Pressure difference where laminar and turbulent flow relation coincide. Recommended: 0.01"; - Modelica.Units.SI.PressureDifference dpAB[nCom](each nominal=1) + Modelica.Units.SI.PressureDifference dpAB[nCom](each nominal=((1/(3600*nCom))/(0.78*dA*sqrt(2/rho_default)))^(1/m)) "Pressure difference between compartments"; Modelica.Units.SI.Velocity v[nCom](each nominal=0.01) "Velocity in compartment from A to B"; From 75afa8c8f8c4e2d7e5edd3e10924cc01fce245a7 Mon Sep 17 00:00:00 2001 From: kldjonge Date: Fri, 19 Sep 2025 11:23:59 +0200 Subject: [PATCH 07/16] Align nominal values with actual order of magnitude in typical large openings --- IDEAS/Airflow/Multizone/BaseClasses/DoorDiscretized.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IDEAS/Airflow/Multizone/BaseClasses/DoorDiscretized.mo b/IDEAS/Airflow/Multizone/BaseClasses/DoorDiscretized.mo index 505fcd9197..2d29a6eebb 100644 --- a/IDEAS/Airflow/Multizone/BaseClasses/DoorDiscretized.mo +++ b/IDEAS/Airflow/Multizone/BaseClasses/DoorDiscretized.mo @@ -10,9 +10,9 @@ partial model DoorDiscretized displayUnit="Pa") = 0.01 "Pressure difference where laminar and turbulent flow relation coincide. Recommended: 0.01"; - Modelica.Units.SI.PressureDifference dpAB[nCom](each nominal=((1/(3600*nCom))/(0.78*dA*sqrt(2/rho_default)))^(1/m)) + Modelica.Units.SI.PressureDifference dpAB[nCom](each nominal=((1/3600)/(A*sqrt(2/rho_default)))^(1/m)) "Pressure difference between compartments"; - Modelica.Units.SI.Velocity v[nCom](each nominal=0.01) + Modelica.Units.SI.Velocity v[nCom](each nominal=0.001) "Velocity in compartment from A to B"; Modelica.Units.SI.Velocity vTop "Velocity at top of opening from A to B"; Modelica.Units.SI.Velocity vBot "Velocity at bottom of opening from A to B"; From f671ed30fb95f4af09c2fdd70eb322a0a72c4a52 Mon Sep 17 00:00:00 2001 From: kldjonge Date: Fri, 19 Sep 2025 13:42:05 +0200 Subject: [PATCH 08/16] Minimum dp_turbulent in CrackOrOperableDoor Minimum dp_turbulent to guard for it becoming a very small value. 10e-10 is chosen as it alligns with CONTAM. --- IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo b/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo index 07d1e2ce5e..cae96f5bfd 100644 --- a/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo +++ b/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo @@ -69,10 +69,10 @@ model CrackOrOperableDoor final parameter Boolean openDoorOnePort = useDoor and interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.OnePort "Sets whether a door is open or closed in one port configuration" ; - parameter Modelica.Units.SI.PressureDifference dp_turbulent(min=0,displayUnit="Pa") = - if useDoor then (MFtrans/(rho_default*(CDOpe * hOpe*wOpe * sqrt(2/rho_default))))^(1/mOpe) else 0.01 - "Pressure difference where laminar and turbulent flow relation coincide for large cavities" - annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); + parameter Modelica.Units.SI.PressureDifference dp_turbulent(min=0,displayUnit="Pa") = + if useDoor then max(10e-10, MFtrans/(rho_default*CDOpe*hOpe*wOpe*sqrt(2/rho_default))^(1/mOpe)) else 0.01 + "Pressure difference where laminar and turbulent flow relation coincide for large cavities" + annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); parameter Modelica.Units.SI.MassFlowRate MFtrans=(hOpe*wOpe)*VItrans*REtrans/DOpe "Mass flow rate used for reguralisation" annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); @@ -104,6 +104,7 @@ model CrackOrOperableDoor if not useDoorModel "Pressure drop equation" annotation (Placement(visible = true, transformation(origin = {0, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + mMea_flow_nominal= IDEAS.Airflow.Multizone.MediumColumnReversible col_b1( redeclare package Medium = Medium, h=h_b1) if interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts and not useDoorModel From 4e5100d5c7e03794e32af94ed7bc31386af77eed Mon Sep 17 00:00:00 2001 From: kldjonge Date: Fri, 19 Sep 2025 13:48:46 +0200 Subject: [PATCH 09/16] =?UTF-8?q?Switch=20to=20more=20effici=C3=ABnt=20doo?= =?UTF-8?q?r=20model=20if=20not=20really=20operable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use doordiscretized in stead of doordiscretizedoperable of not operable. This is more efficient because it uses the more efficiƫnt powerlawfixedM function in the background. --- .../Airflow/Multizone/CrackOrOperableDoor.mo | 63 +++++++++++++++++-- 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo b/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo index cae96f5bfd..cee9034f73 100644 --- a/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo +++ b/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo @@ -174,6 +174,30 @@ model CrackOrOperableDoor vZer=MFtrans/(rho_default*doo.wOpe*doo.hOpe)/1000) if useDoorModel annotation (Placement(visible = true, transformation(origin={-2,0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + IDEAS.Airflow.Multizone.DoorDiscretizedOperable doo_operable( + forceErrorControlOnFlow=forceErrorControlOnFlow, + final dh=if IDEAS.Utilities.Math.Functions.isAngle(inc, IDEAS.Types.Tilt.Ceiling) + or IDEAS.Utilities.Math.Functions.isAngle(inc, IDEAS.Types.Tilt.Floor) + then 0 else doo_operable.hOpe*sin(inc)/nCom, + redeclare package Medium = Medium, + final hA=hA, + final hB=hB, + dp_turbulent=dp_turbulent, + nCom=nCom, + CDOpe=CDOpe, + CDClo=CDCloRat, + mOpe=mOpe, + mClo=mClo, + CDCloRat=CDCloRat, + wOpe=wOpe, + hOpe=hOpe, + dpCloRat=dpCloRat, + LClo=LClo, + vZer=3e-9/(doo_operable.wOpe*doo_operable.hOpe)) if useDoorModel and use_y + annotation (Placement(visible=true, transformation( + origin={-2,0}, + extent={{-10,-10},{10,10}}, + rotation=0))); IDEAS.Fluid.Sources.Boundary_pT bou( redeclare package Medium = Medium, nPorts = 2) @@ -185,6 +209,21 @@ model CrackOrOperableDoor "Door constantly opened" annotation (Placement(visible = true, transformation(origin = {-54, -14}, extent = {{-6, -6}, {6, 6}}, rotation = 0))); + DoorDiscretizedOpen doo_fixed( + forceErrorControlOnFlow=forceErrorControlOnFlow, + final dh=if IDEAS.Utilities.Math.Functions.isAngle(inc, IDEAS.Types.Tilt.Ceiling) + or IDEAS.Utilities.Math.Functions.isAngle(inc, IDEAS.Types.Tilt.Floor) + then 0 else doo_fixed.hOpe*sin(inc)/nCom, + redeclare package Medium = Medium, + final hA=hA, + final hB=hB, + dp_turbulent=dp_turbulent, + nCom=nCom, + wOpe=wOpe, + hOpe=hOpe, + vZer=3e-9/(doo_fixed.wOpe*doo_fixed.hOpe), + CD=CDOpe) if useDoorModel and not use_y annotation (Placement(visible=true, + transformation(extent={{-12,-34},{8,-14}}, rotation=0))); initial equation assert( not (interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts and useDoorModel and use_y), "In " +getInstanceName() + ": Cannot use a controllable door unless interZonalAirFlowType == TwoPorts."); @@ -200,19 +239,31 @@ equation connect(col_a2.port_b, port_a2) annotation (Line(points = {{60, -60}, {100, -60}}, color = {0, 127, 255})); connect(col_b1.port_b, port_b1) annotation (Line(points = {{60, 60}, {100, 60}}, color = {0, 127, 255})); connect(col_a1.port_b, port_a1) annotation (Line(points = {{-60, 60}, {-100, 60}}, color = {0, 127, 255})); - connect(y, doo.y) annotation (Line(points={{-110,0},{-13,0}},color = {0, 0, 127})); + connect(y, doo_operable.y) + annotation (Line(points={{-110,0},{-13,0}}, color={0,0,127})); connect(bou.ports[1], port_a2) annotation (Line(points={{-1,-80},{100,-80},{100,-60}},color = {0, 127, 255})); if interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts then connect(point_m_flow1.port_a, port_a1) annotation (Line(points = {{-10, 60}, {-100, 60}}, color = {0, 127, 255})); connect(point_m_flow1.port_b, port_b1) annotation (Line(points = {{10, 60}, {100, 60}}, color = {0, 127, 255})); end if; - connect(constOne.y, doo.y) annotation (Line(points={{-47.4,-14},{-32,-14},{-32,0},{-13,0}},color = {0, 0, 127})); connect(bou.ports[2], port_b2) annotation (Line(points={{1,-80},{-100,-80},{-100,-60}},color = {0, 127, 255})); - connect(doo.port_a1, port_a1) annotation (Line(points={{-12,6},{-30,6},{-30,60},{-100,60}},color = {0, 127, 255})); - connect(doo.port_b1, port_b1) annotation (Line(points={{8,6},{30,6},{30,60},{100,60}},color = {0, 127, 255})); - connect(doo.port_b2, port_b2) annotation (Line(points={{-12,-6},{-20,-6},{-20,-34},{-100,-34},{-100,-60}},color = {0, 127, 255})); - connect(doo.port_a2, port_a2) annotation (Line(points={{8,-6},{20,-6},{20,-34},{100,-34},{100,-60}},color = {0, 127, 255})); + connect(doo_operable.port_a1, port_a1) annotation (Line(points={{-12,6},{-30,6}, + {-30,60},{-100,60}}, color={0,127,255})); + connect(doo_operable.port_b1, port_b1) annotation (Line(points={{8,6},{30,6},{ + 30,60},{100,60}}, color={0,127,255})); + connect(doo_operable.port_b2, port_b2) annotation (Line(points={{-12,-6},{-20, + -6},{-20,-60},{-100,-60}}, color={0,127,255})); + connect(doo_operable.port_a2, port_a2) annotation (Line(points={{8,-6},{20,-6}, + {20,-60},{100,-60}}, color={0,127,255})); + connect(doo_fixed.port_a1, port_a1) annotation (Line(points={{-12,-18},{-30,-18}, + {-30,60},{-100,60}}, color={0,127,255})); + connect(doo_fixed.port_b2, port_b2) annotation (Line(points={{-12,-30},{-20,-30}, + {-20,-60},{-100,-60}}, color={0,127,255})); + connect(doo_fixed.port_a2, port_a2) annotation (Line(points={{8,-30},{20,-30}, + {20,-60},{100,-60}}, color={0,127,255})); + connect(doo_fixed.port_b1, port_b1) annotation (Line(points={{8,-18},{78,-18}, + {78,60},{100,60}}, color={0,127,255})); annotation(Documentation(info="

This component models infiltration or a large opening in a wall and From 350b3de2a7438428f838745d8ae5c42300fc1b56 Mon Sep 17 00:00:00 2001 From: kldjonge Date: Fri, 19 Sep 2025 14:54:32 +0200 Subject: [PATCH 10/16] Minimum dp_turbulent in CrackOrOperableDoor Minimum dp_turbulent to guard for it becoming a very small value. 10e-10 is chosen as it alligns with CONTAM. --- IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo b/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo index 07d1e2ce5e..67f5ead062 100644 --- a/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo +++ b/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo @@ -69,10 +69,10 @@ model CrackOrOperableDoor final parameter Boolean openDoorOnePort = useDoor and interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.OnePort "Sets whether a door is open or closed in one port configuration" ; - parameter Modelica.Units.SI.PressureDifference dp_turbulent(min=0,displayUnit="Pa") = - if useDoor then (MFtrans/(rho_default*(CDOpe * hOpe*wOpe * sqrt(2/rho_default))))^(1/mOpe) else 0.01 - "Pressure difference where laminar and turbulent flow relation coincide for large cavities" - annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); + parameter Modelica.Units.SI.PressureDifference dp_turbulent(min=0,displayUnit="Pa") = + if useDoor then max(10e-10, (MFtrans/(rho_default*(CDOpe * hOpe*wOpe * sqrt(2/rho_default))))^(1/mOpe)) else 0.01 + "Pressure difference where laminar and turbulent flow relation coincide for large cavities" + annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); parameter Modelica.Units.SI.MassFlowRate MFtrans=(hOpe*wOpe)*VItrans*REtrans/DOpe "Mass flow rate used for reguralisation" annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); From 1b6d227f3ee5530f7dca7c141e7b41142df732f2 Mon Sep 17 00:00:00 2001 From: kldjonge Date: Mon, 20 Oct 2025 14:53:19 +0200 Subject: [PATCH 11/16] set dp_turbulent to fix 0.01 for now --- IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo b/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo index 67f5ead062..041413d556 100644 --- a/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo +++ b/IDEAS/Airflow/Multizone/CrackOrOperableDoor.mo @@ -70,9 +70,10 @@ model CrackOrOperableDoor "Sets whether a door is open or closed in one port configuration" ; parameter Modelica.Units.SI.PressureDifference dp_turbulent(min=0,displayUnit="Pa") = - if useDoor then max(10e-10, (MFtrans/(rho_default*(CDOpe * hOpe*wOpe * sqrt(2/rho_default))))^(1/mOpe)) else 0.01 + 0.01 "Pressure difference where laminar and turbulent flow relation coincide for large cavities" annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); + //dp_turbulent(min=0,displayUnit="Pa") = if useDoor then max(10e-10, (MFtrans/(rho_default*(CDOpe * hOpe*wOpe * sqrt(2/rho_default))))^(1/mOpe)) else 0.01 parameter Modelica.Units.SI.MassFlowRate MFtrans=(hOpe*wOpe)*VItrans*REtrans/DOpe "Mass flow rate used for reguralisation" annotation (Dialog(tab="Advanced",group="Model regularisation", enable=useDoor)); From f8524e7eb4b8e065b570139b465b871df7188ac6 Mon Sep 17 00:00:00 2001 From: kldjonge Date: Mon, 20 Oct 2025 14:58:20 +0200 Subject: [PATCH 12/16] Fixed unintentional annotation for ouput mBA_flow --- IDEAS/Buildings/Components/Window.mo | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/IDEAS/Buildings/Components/Window.mo b/IDEAS/Buildings/Components/Window.mo index 733fe1faeb..4c84c352b5 100644 --- a/IDEAS/Buildings/Components/Window.mo +++ b/IDEAS/Buildings/Components/Window.mo @@ -195,8 +195,7 @@ model Window "Multipane window" output Modelica.Units.SI.MassFlowRate mBA_flow_TrVent=trickleVent.m_flow if use_trickle_vent - "Flow through trickle-vent outwards relative to propsBus_a" - annotation (Placement(visible = true, transformation(origin = {30, -52}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); + "Flow through trickle-vent outwards relative to propsBus_a"; protected Airflow.Multizone.MediumColumnReversible col_trickle(redeclare package Medium From 0896fbf86c0c11bcb0094de770bc1a4ba3725178 Mon Sep 17 00:00:00 2001 From: kldjonge Date: Fri, 24 Oct 2025 12:19:48 +0200 Subject: [PATCH 13/16] Updates to shading to avoid warnings about causality --- IDEAS/Buildings/Components/Shading/Box.mo | 6 ++-- .../Components/Shading/BuildingShade.mo | 24 +++++++++---- .../Components/Shading/HorizontalFins.mo | 16 +++++++-- .../Shading/Interfaces/DoubleShading.mo | 10 +++--- .../Shading/Interfaces/PartialShading.mo | 4 ++- .../Interfaces/PartialShadingDevice.mo | 35 ++++++++++++++----- IDEAS/Buildings/Components/Shading/None.mo | 12 +++---- .../Buildings/Components/Shading/Overhang.mo | 16 ++++++--- IDEAS/Buildings/Components/Shading/Screen.mo | 22 +++++++++--- IDEAS/Buildings/Components/Shading/Shading.mo | 26 +++++++------- .../Buildings/Components/Shading/SideFins.mo | 17 +++++++-- 11 files changed, 130 insertions(+), 58 deletions(-) diff --git a/IDEAS/Buildings/Components/Shading/Box.mo b/IDEAS/Buildings/Components/Shading/Box.mo index 7b79e8503f..dedcac2b43 100644 --- a/IDEAS/Buildings/Components/Shading/Box.mo +++ b/IDEAS/Buildings/Components/Shading/Box.mo @@ -159,9 +159,9 @@ equation connect(TDryBul, sideFins.TDryBul) annotation (Line(points={{40,-10},{3.5,-10}, {3.5,26.6667}}, color={0,0,127})); connect(m_flow, sideFins.m_flow) annotation( - Line(points = {{40, -90}, {2, -90}, {2, 20}}, color = {0, 0, 127})); + Line(points={{40,-90},{2.5,-90},{2.5,20}}, color = {0, 0, 127})); connect(m_flow, overhang.m_flow) annotation( - Line(points = {{40, -90}, {4, -90}, {4, 60}}, color = {0, 0, 127})); + Line(points={{40,-90},{4.5,-90},{4.5,60}}, color = {0, 0, 127})); annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100, -100},{100,200}})), Documentation(info="

@@ -199,4 +199,4 @@ Cleaned up implementation and documentation. "), Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100, 200}}))); -end Box; \ No newline at end of file +end Box; diff --git a/IDEAS/Buildings/Components/Shading/BuildingShade.mo b/IDEAS/Buildings/Components/Shading/BuildingShade.mo index 45cb396064..e7ee3590d6 100644 --- a/IDEAS/Buildings/Components/Shading/BuildingShade.mo +++ b/IDEAS/Buildings/Components/Shading/BuildingShade.mo @@ -2,7 +2,7 @@ within IDEAS.Buildings.Components.Shading; model BuildingShade "Component for modeling shade cast by distant objects such as buildings and treelines" extends IDEAS.Buildings.Components.Shading.Interfaces.PartialShadingDevice( - final controlled=false); + use_m_flow=false, final controlled=false); parameter Modelica.Units.SI.Length L(min=0) "Distance to object perpendicular to window" @@ -10,10 +10,12 @@ model BuildingShade parameter Modelica.Units.SI.Length dh "Height difference between top of object and top of window glazing" annotation (Dialog(group="Dimensions (see illustration in documentation)")); - parameter Modelica.Units.SI.Length hWin(min=0) = 1 + parameter Modelica.Units.SI.Length hWin(min=0)=1 "Window height: distance between top and bottom of window glazing" annotation (Dialog(group="Dimensions (see illustration in documentation)")); - parameter Real fraSha(min=0,max=1) = 1 + parameter Real fraSha( + max=1, + min=0)=1 "Fraction of the light that is shaded, e.g. smaller than 1 for shading cast by tree lines."; final parameter Real fraSunDifSky(final min=0,final max=1, final unit="1") = 1-vieAngObj/(Modelica.Constants.pi/2) "Fraction of window area exposed to diffuse sun light"; @@ -23,6 +25,11 @@ model BuildingShade // Computation assumes that window base is at ground level. // Viewing angle computed from center of glazing. + Modelica.Blocks.Sources.RealExpression HShaDirexpr(y=fraSunDir*HDirTil) + annotation (Placement(transformation(extent={{-30,40},{-10,60}}))); + Modelica.Blocks.Sources.RealExpression HShaSkyDifexpr(y=fraSunDifSky* + HSkyDifTil) + annotation (Placement(transformation(extent={{-30,20},{-10,40}}))); protected parameter Modelica.Units.SI.Angle vieAngObj=atan((hWin/2 + dh)/L) "Viewing angle of opposite object"; @@ -57,13 +64,16 @@ equation fraSunDir=1; end if; - HShaDirTil=fraSunDir*HDirTil; - HShaSkyDifTil = fraSunDifSky*HSkyDifTil; + connect(angInc, iAngInc) annotation (Line(points={{-60,-50},{-14,-50},{-14,-50}, {40,-50}}, color={0,0,127})); - connect(HGroDifTil, HShaGroDifTil) - annotation (Line(points={{-60,10},{40,10},{40,10}}, color={0,0,127})); + connect(HShaDirexpr.y, HShaDir.u) + annotation (Line(points={{-9,50},{-1.2,50}}, color={0,0,127})); + connect(HShaSkyDifexpr.y, HShaSkyDif.u) + annotation (Line(points={{-9,30},{-1.2,30}}, color={0,0,127})); + connect(HGroDifTil, HShaSkyGro.u) + annotation (Line(points={{-60,10},{-1.2,10}}, color={0,0,127})); annotation ( Icon(coordinateSystem(extent = {{-100, -100}, {100, 200}})), Documentation(info=" diff --git a/IDEAS/Buildings/Components/Shading/HorizontalFins.mo b/IDEAS/Buildings/Components/Shading/HorizontalFins.mo index b85c259245..cda7a17eff 100644 --- a/IDEAS/Buildings/Components/Shading/HorizontalFins.mo +++ b/IDEAS/Buildings/Components/Shading/HorizontalFins.mo @@ -44,6 +44,12 @@ protected Modelica.Units.SI.Length dy3Dif=max(0, min(dzDif*tan(angAltDif), s)); Modelica.Units.SI.Length dzDif=dx/cos(angAltDif); +public + Modelica.Blocks.Sources.RealExpression HShaDirexpr(y=(1 - shaFrac)*HDirTil) + annotation (Placement(transformation(extent={{-32,40},{-12,60}}))); + Modelica.Blocks.Sources.RealExpression HShaSkyDifexpr(y=(1 - shaFracDif)* + HSkyDifTil) + annotation (Placement(transformation(extent={{-32,20},{-12,40}}))); initial equation if not use_betaInput then assert(beta >= 0 and beta < acos(t/s), "In " + getInstanceName() + ": Beta must be within the feasible range."); @@ -84,12 +90,16 @@ equation shaFracDif = disp_internal*(1 - (dy1-min(dy1,dy3Dif))/s); end if; - HShaDirTil = (1-shaFrac)*HDirTil; - HShaSkyDifTil = (1-shaFracDif)*HSkyDifTil; angInc = iAngInc; - connect(HGroDifTil, HShaGroDifTil); + + connect(HGroDifTil, HShaSkyGro.u) + annotation (Line(points={{-60,10},{-1.2,10}}, color={0,0,127})); + connect(HShaDirexpr.y, HShaDir.u) + annotation (Line(points={{-11,50},{-1.2,50}}, color={0,0,127})); + connect(HShaSkyDifexpr.y, HShaSkyDif.u) + annotation (Line(points={{-11,30},{-1.2,30}}, color={0,0,127})); annotation ( Icon(coordinateSystem(extent = {{-100, -100}, {100, 200}})), Documentation(info=" diff --git a/IDEAS/Buildings/Components/Shading/Interfaces/DoubleShading.mo b/IDEAS/Buildings/Components/Shading/Interfaces/DoubleShading.mo index 2fff4d0d47..b016bd6d5f 100644 --- a/IDEAS/Buildings/Components/Shading/Interfaces/DoubleShading.mo +++ b/IDEAS/Buildings/Components/Shading/Interfaces/DoubleShading.mo @@ -109,16 +109,16 @@ equation connect(stateShading1.TDryBul, TDryBul) annotation ( Line(points={{-20.5,-11.3333},{40,-11.3333},{40,-10}}, color = {0, 0, 127})); - connect(Te, stateShading1.Te) annotation (Line(points={{-60,130},{-6,130},{-6, + connect(Te, stateShading1.Te) annotation (Line(points={{-60,130},{-8,130},{-8, -2},{-25.5,-2}},color={0,0,127})); connect(hForcedConExt, stateShading1.hForcedConExt) annotation (Line(points={{-60,110}, {-8,110},{-8,-3.33333},{-25.5,-3.33333}}, color={0,0,127})); connect(TEnv, stateShading1.TEnv) annotation (Line(points={{-60,90},{-10,90}, - {-10,-4.66667},{-25.5,-4.66667}},color={0,0,127})); + {-10,-4.66667},{-25.5,-4.66667}},color={0,0,127})); connect(stateShading2.m_flow, m_flow) annotation( - Line(points = {{2, -18}, {40, -18}, {40, -90}}, color = {0, 0, 127})); + Line(points={{2.5,-18},{40,-18},{40,-90}}, color = {0, 0, 127})); connect(stateShading1.m_flow, m_flow) annotation( - Line(points = {{-22, -18}, {40, -18}, {40, -90}}, color = {0, 0, 127})); + Line(points={{-21.5,-18},{40,-18},{40,-90}}, color = {0, 0, 127})); annotation (Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 200}})), Documentation(revisions="