Skip to content

Commit

Permalink
Medium declarations for #1066
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathadon committed Aug 13, 2020
1 parent 49495a8 commit ef41f5d
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 16 deletions.
14 changes: 9 additions & 5 deletions IDEAS/Buildings/Components/Interfaces/PartialSurface.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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}},
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions IDEAS/Buildings/Components/Interfaces/PartialZone.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions IDEAS/Buildings/Components/Interfaces/ZoneBus.mo
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
23 changes: 21 additions & 2 deletions IDEAS/Buildings/Components/Interfaces/ZoneBusVarMultiplicator.mo
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions IDEAS/Buildings/Components/InternalWall.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions IDEAS/Buildings/Components/Zone.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ 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,
origin={-100,40}), iconTransformation(
extent={{-20,20},{20,-20}},
rotation=-90,
origin={-100,40})));

equation
connect(propsBus, propsBusInt) annotation (Line(
points={{-100,40},{-90,40},{-80,40}},
Expand Down

0 comments on commit ef41f5d

Please sign in to comment.