From ef41f5da3ff4068643c03e6126d492a090bd0437 Mon Sep 17 00:00:00 2001 From: Filip Jorissen Date: Thu, 13 Aug 2020 22:56:13 +0200 Subject: [PATCH] Medium declarations for #1066 --- .../Components/Interfaces/PartialSurface.mo | 14 +++--- .../Components/Interfaces/PartialZone.mo | 1 + .../RectangularZoneTemplateInterface.mo | 43 ++++++++++++++++--- .../Components/Interfaces/ZoneBus.mo | 2 + .../Interfaces/ZoneBusVarMultiplicator.mo | 23 +++++++++- IDEAS/Buildings/Components/InternalWall.mo | 1 + IDEAS/Buildings/Components/Zone.mo | 7 +-- 7 files changed, 75 insertions(+), 16 deletions(-) diff --git a/IDEAS/Buildings/Components/Interfaces/PartialSurface.mo b/IDEAS/Buildings/Components/Interfaces/PartialSurface.mo index bf9811e974..1c3d05c076 100644 --- a/IDEAS/Buildings/Components/Interfaces/PartialSurface.mo +++ b/IDEAS/Buildings/Components/Interfaces/PartialSurface.mo @@ -4,7 +4,6 @@ partial model PartialSurface "Partial model for building envelope component" outer IDEAS.BoundaryConditions.SimInfoManager sim "Simulation information manager for climate data" annotation (Placement(transformation(extent={{30,-100},{50,-80}}))); - parameter Integer incOpt = 4 "Tilt angle option from simInfoManager, or custom using inc" annotation(choices(__Dymola_radioButtons=true, choice=1 "Wall", choice=2 "Floor", choice=3 "Ceiling", choice=4 "Custom")); @@ -39,11 +38,14 @@ partial model PartialSurface "Partial model for building envelope component" parameter Modelica.Fluid.Types.Dynamics energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial "Static (steady state) or transient (dynamic) thermal conduction model" annotation(Evaluate=true, Dialog(tab = "Dynamics", group="Equations")); - + replaceable package Medium = + Modelica.Media.Interfaces.PartialMedium + "Medium in the component" + annotation(Dialog(group="Interzonal airflow (Optional)")); IDEAS.Buildings.Components.Interfaces.ZoneBus propsBus_a( + redeclare final package Medium = Medium, numIncAndAziInBus=sim.numIncAndAziInBus, outputAngles=sim.outputAngles, final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, - final use_port_2=sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts) "If inc = Floor, then propsbus_a should be connected to the zone above this floor. If inc = ceiling, then propsbus_a should be connected to the zone below this ceiling. @@ -99,14 +101,15 @@ protected Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlowQgai "Component for computing conservation of energy"; - IDEAS.Buildings.Components.Interfaces.ZoneBusVarMultiplicator gain(k=nWin) + IDEAS.Buildings.Components.Interfaces.ZoneBusVarMultiplicator gain(redeclare + package Medium = Medium, k=nWin) "Gain for all propsBus variable to represent nWin surfaces instead of 1" annotation (Placement(transformation(extent={{70,6},{88,36}}))); IDEAS.Buildings.Components.Interfaces.ZoneBus propsBusInt( + redeclare final package Medium = Medium, numIncAndAziInBus=sim.numIncAndAziInBus, outputAngles=sim.outputAngles, final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, - final use_port_2=sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts) annotation (Placement(transformation( extent={{-18,-18},{18,18}}, @@ -115,6 +118,7 @@ protected extent={{-20,-20},{20,20}}, rotation=-90, origin={50,20}))); + equation connect(prescribedHeatFlowE.port, propsBusInt.E); connect(Qgai.y,prescribedHeatFlowQgai. Q_flow); diff --git a/IDEAS/Buildings/Components/Interfaces/PartialZone.mo b/IDEAS/Buildings/Components/Interfaces/PartialZone.mo index 5a5f91c2b6..f08257cbbf 100644 --- a/IDEAS/Buildings/Components/Interfaces/PartialZone.mo +++ b/IDEAS/Buildings/Components/Interfaces/PartialZone.mo @@ -174,6 +174,7 @@ model PartialZone "Building zone model" protected IDEAS.Buildings.Components.Interfaces.ZoneBus[nSurf] propsBusInt( + redeclare each final package Medium = Medium, each final numIncAndAziInBus=sim.numIncAndAziInBus, each final outputAngles=sim.outputAngles, each final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, diff --git a/IDEAS/Buildings/Components/Interfaces/RectangularZoneTemplateInterface.mo b/IDEAS/Buildings/Components/Interfaces/RectangularZoneTemplateInterface.mo index 3ab6e93577..2be8af17db 100644 --- a/IDEAS/Buildings/Components/Interfaces/RectangularZoneTemplateInterface.mo +++ b/IDEAS/Buildings/Components/Interfaces/RectangularZoneTemplateInterface.mo @@ -461,6 +461,7 @@ partial model RectangularZoneTemplateInterface "Azimuth angle of face D"; IDEAS.Buildings.Components.Interfaces.ZoneBus[nSurfExt] proBusExt( + redeclare each final package Medium = Medium, each final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, each final use_port_2=sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts, each final numIncAndAziInBus=sim.numIncAndAziInBus, @@ -798,8 +799,13 @@ protected annotation (Placement(transformation(extent={{-176,20},{-164,40}}))); public IDEAS.Buildings.Components.Interfaces.ZoneBus proBusA[nExtA]( + redeclare each final package Medium = Medium, each final numIncAndAziInBus=sim.numIncAndAziInBus, - each final outputAngles=sim.outputAngles) if + each final outputAngles=sim.outputAngles, + each final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, + + each final use_port_2=sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts) + if bouTypA == IDEAS.Buildings.Components.Interfaces.BoundaryType.InternalWall or bouTypA == IDEAS.Buildings.Components.Interfaces.BoundaryType.External "Propsbus connector for connecting to external surface or internalWall of face A" @@ -811,8 +817,13 @@ public rotation=180, origin={-60,90}))); IDEAS.Buildings.Components.Interfaces.ZoneBus proBusB[nExtB]( + redeclare each final package Medium = Medium, each final numIncAndAziInBus=sim.numIncAndAziInBus, - each final outputAngles=sim.outputAngles) if + each final outputAngles=sim.outputAngles, + each final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, + + each final use_port_2=sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts) + if bouTypB == IDEAS.Buildings.Components.Interfaces.BoundaryType.InternalWall or bouTypB == IDEAS.Buildings.Components.Interfaces.BoundaryType.External "Propsbus connector for connecting to external surface or internalWall of face B" @@ -824,8 +835,13 @@ public rotation=90, origin={90,60}))); IDEAS.Buildings.Components.Interfaces.ZoneBus proBusC[nExtC]( + redeclare each final package Medium = Medium, each final numIncAndAziInBus=sim.numIncAndAziInBus, - each final outputAngles=sim.outputAngles) if + each final outputAngles=sim.outputAngles, + each final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, + + each final use_port_2=sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts) + if bouTypC == IDEAS.Buildings.Components.Interfaces.BoundaryType.InternalWall or bouTypC == IDEAS.Buildings.Components.Interfaces.BoundaryType.External "Propsbus connector for connecting to external surface or internalWall of face C" @@ -837,8 +853,13 @@ public rotation=0, origin={68,-98}))); IDEAS.Buildings.Components.Interfaces.ZoneBus proBusD[nExtD]( + redeclare each final package Medium = Medium, each final numIncAndAziInBus=sim.numIncAndAziInBus, - each final outputAngles=sim.outputAngles) if + each final outputAngles=sim.outputAngles, + each final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, + + each final use_port_2=sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts) + if bouTypD == IDEAS.Buildings.Components.Interfaces.BoundaryType.InternalWall or bouTypD == IDEAS.Buildings.Components.Interfaces.BoundaryType.External "Propsbus connector for connecting to external surface or internalWall of face D" @@ -850,8 +871,13 @@ public rotation=-90, origin={-96,-70}))); IDEAS.Buildings.Components.Interfaces.ZoneBus proBusFlo[nExtFlo]( + redeclare each final package Medium = Medium, each final numIncAndAziInBus=sim.numIncAndAziInBus, - each final outputAngles=sim.outputAngles) if + each final outputAngles=sim.outputAngles, + each final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, + + each final use_port_2=sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts) + if bouTypFlo == IDEAS.Buildings.Components.Interfaces.BoundaryType.InternalWall or bouTypFlo == IDEAS.Buildings.Components.Interfaces.BoundaryType.External "Propsbus connector for connecting to external surface or internalWall of floor" @@ -863,8 +889,13 @@ public rotation=180, origin={0,-60}))); IDEAS.Buildings.Components.Interfaces.ZoneBus proBusCei[nExtCei]( + redeclare each final package Medium = Medium, each final numIncAndAziInBus=sim.numIncAndAziInBus, - each final outputAngles=sim.outputAngles) if + each final outputAngles=sim.outputAngles, + each final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, + + each final use_port_2=sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts) + if bouTypCei == IDEAS.Buildings.Components.Interfaces.BoundaryType.External "Propsbus connector for connecting to external surface of ceiling: internal walls should be modelled as the floor of the zone above" annotation (Placement(transformation( diff --git a/IDEAS/Buildings/Components/Interfaces/ZoneBus.mo b/IDEAS/Buildings/Components/Interfaces/ZoneBus.mo index d78e29901a..31c88da936 100644 --- a/IDEAS/Buildings/Components/Interfaces/ZoneBus.mo +++ b/IDEAS/Buildings/Components/Interfaces/ZoneBus.mo @@ -1,6 +1,8 @@ within IDEAS.Buildings.Components.Interfaces; connector ZoneBus extends Modelica.Icons.SignalBus; + replaceable package Medium = + Modelica.Media.Interfaces.PartialMedium "Medium in the component"; parameter Integer numIncAndAziInBus "Number of calculated azimuth angles, set to sim.numIncAndAziInBus"; parameter Boolean outputAngles = true "Set to false when linearising in Dymola only"; diff --git a/IDEAS/Buildings/Components/Interfaces/ZoneBusVarMultiplicator.mo b/IDEAS/Buildings/Components/Interfaces/ZoneBusVarMultiplicator.mo index 64a064ba22..77e0cee0b0 100644 --- a/IDEAS/Buildings/Components/Interfaces/ZoneBusVarMultiplicator.mo +++ b/IDEAS/Buildings/Components/Interfaces/ZoneBusVarMultiplicator.mo @@ -1,29 +1,40 @@ within IDEAS.Buildings.Components.Interfaces; model ZoneBusVarMultiplicator "Component to scale all flows from the zone propsBus. This can be used to scale the surface to n identical surfaces" + replaceable package Medium = + Modelica.Media.Interfaces.PartialMedium + "Medium in the component"; parameter Real k = 1 "Scaling factor"; ZoneBus propsBus_a( numIncAndAziInBus=sim.numIncAndAziInBus, outputAngles=sim.outputAngles, final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, - final use_port_2=sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts) "Unscaled port" annotation (Placement(transformation( extent={{-20,-20},{20,20}}, rotation=90, origin={-100,0}))); + ZoneBus propsBus_b( numIncAndAziInBus=sim.numIncAndAziInBus, outputAngles=sim.outputAngles, final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, - final use_port_2=sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts) "Scaled port" annotation (Placement(transformation( extent={{-20,-20},{20,20}}, rotation=270, origin={100,0}))); + outer BoundaryConditions.SimInfoManager sim "Simulation information manager for climate data" annotation (Placement(transformation(extent={{72,122},{92,142}}))); protected + IDEAS.Fluid.BaseClasses.MassFlowRateMultiplier massFlowRateMultiplier2(final k=k) if + sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None + "Mass flow rate multiplier for port 2" + annotation (Placement(transformation(extent={{-10,-200},{10,-180}}))); + IDEAS.Fluid.BaseClasses.MassFlowRateMultiplier massFlowRateMultiplier1(final k=k) if + sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts + "Mass flow rate multiplier for port 1" + annotation (Placement(transformation(extent={{-10,-170},{10,-150}}))); Modelica.Blocks.Math.Gain QTra_desgin(k=k) "Design heat flow rate" annotation (Placement(transformation(extent={{-10,178},{10,198}}))); Modelica.Blocks.Math.Gain area(k=k) "Heat exchange surface area" @@ -109,6 +120,14 @@ equation 128},{100.1,-0.1}}, color={0,0,127})); connect(epsSw.y, propsBus_b.epsSw) annotation (Line(points={{11,98},{100.1,98}, {100.1,-0.1}}, color={0,0,127})); + connect(massFlowRateMultiplier1.port_a, propsBus_a.port_1) annotation (Line( + points={{-10,-160},{-100.1,-160},{-100.1,0.1}}, color={0,127,255})); + connect(massFlowRateMultiplier2.port_a, propsBus_a.port_2) annotation (Line( + points={{-10,-190},{-100.1,-190},{-100.1,0.1}}, color={0,127,255})); + connect(massFlowRateMultiplier1.port_b, propsBus_b.port_1) annotation (Line( + points={{10,-160},{100.1,-160},{100.1,-0.1}}, color={0,127,255})); + connect(massFlowRateMultiplier2.port_b, propsBus_b.port_2) annotation (Line( + points={{10,-190},{100,-190},{100,-0.1},{100.1,-0.1}}, color={0,127,255})); annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-180}, {100,200}}), graphics={ Polygon( diff --git a/IDEAS/Buildings/Components/InternalWall.mo b/IDEAS/Buildings/Components/InternalWall.mo index bfc30ccf7b..f361d42395 100644 --- a/IDEAS/Buildings/Components/InternalWall.mo +++ b/IDEAS/Buildings/Components/InternalWall.mo @@ -49,6 +49,7 @@ model InternalWall "interior opaque wall between two zones" annotation(Dialog(enable=hasCavity,group="Cavity or open door",tab="Advanced")); IDEAS.Buildings.Components.Interfaces.ZoneBus propsBus_b( + redeclare final package Medium = Medium, numIncAndAziInBus=sim.numIncAndAziInBus, outputAngles=sim.outputAngles, final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, diff --git a/IDEAS/Buildings/Components/Zone.mo b/IDEAS/Buildings/Components/Zone.mo index 677f506a78..ef1c990634 100644 --- a/IDEAS/Buildings/Components/Zone.mo +++ b/IDEAS/Buildings/Components/Zone.mo @@ -4,11 +4,11 @@ model Zone "Building zone model" //this propsbus exposes all ports to the outside of the model IDEAS.Buildings.Components.Interfaces.ZoneBus[nSurf] propsBus( + redeclare each final package Medium = Medium, each final numIncAndAziInBus=sim.numIncAndAziInBus, each final outputAngles=sim.outputAngles, - final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, - - final use_port_2=sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts) + each final use_port_1=sim.interZonalAirFlowType <> IDEAS.BoundaryConditions.Types.InterZonalAirFlow.None, + each final use_port_2=sim.interZonalAirFlowType == IDEAS.BoundaryConditions.Types.InterZonalAirFlow.TwoPorts) annotation (Placement(transformation( extent={{-20,20},{20,-20}}, rotation=-90, @@ -16,6 +16,7 @@ model Zone "Building zone model" extent={{-20,20},{20,-20}}, rotation=-90, origin={-100,40}))); + equation connect(propsBus, propsBusInt) annotation (Line( points={{-100,40},{-90,40},{-80,40}},