Skip to content

Commit

Permalink
Merge pull request #1783 from jelgerjansen/modelicaConferenceWorkshop
Browse files Browse the repository at this point in the history
IBPSA workshop Modelica Conference
  • Loading branch information
mwetter authored Sep 6, 2023
2 parents 265fac8 + 926f5f6 commit 7c39a70
Show file tree
Hide file tree
Showing 27 changed files with 1,447 additions and 4 deletions.
25 changes: 25 additions & 0 deletions IBPSA/Fluid/Examples/WorkshopModelicaConference/SimpleHouse1.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
within IBPSA.Fluid.Examples.WorkshopModelicaConference;
model SimpleHouse1 "Building wall model"
extends SimpleHouseTemplate;

Modelica.Thermal.HeatTransfer.Components.HeatCapacitor walCap(
C=A_wall*d_wall*cp_wall*rho_wall)
"Thermal mass of walls"
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
rotation=270,
origin={150,0})));
equation
connect(wallRes.port_b, walCap.port) annotation (Line(points={{100,0},{130,0},
{130,1.77636e-15},{140,1.77636e-15}}, color={191,0,0}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-240,
-220},{200,200}})),
experiment(StopTime=1e+06),
Documentation(revisions="<html>
<ul>
<li>
September 4, 2023, by Jelger Jansen:<br/>
First implementation.
</li>
</ul>
</html>"));
end SimpleHouse1;
36 changes: 36 additions & 0 deletions IBPSA/Fluid/Examples/WorkshopModelicaConference/SimpleHouse2.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
within IBPSA.Fluid.Examples.WorkshopModelicaConference;
model SimpleHouse2 "Building window model"
extends SimpleHouse1;

parameter Modelica.Units.SI.Area A_win=2 "Window area";

Modelica.Blocks.Math.Gain gaiWin(k=A_win)
"Gain for solar irradiance through the window"
annotation (Placement(transformation(extent={{-60,-40},{-40,-20}})));
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow window
"Very simple window model"
annotation (Placement(transformation(extent={{-20,-40},{0,-20}})));
equation
connect(gaiWin.y,window. Q_flow) annotation (Line(points={{-39,-30},{-20,-30}},
color={0,0,127}));
connect(window.port, walCap.port) annotation (Line(points={{0,-30},{132,-30},{
132,1.77636e-15},{140,1.77636e-15}},
color={191,0,0}));
connect(gaiWin.u, weaBus.HDirNor) annotation (Line(points={{-62,-30},{-150,-30},
{-150,-10}}, color={0,0,127}), Text(
string="%second",
index=1,
extent={{-6,3},{-6,3}},
horizontalAlignment=TextAlignment.Right));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-240,
-220},{200,200}})),
experiment(StopTime=1e+06),
Documentation(revisions="<html>
<ul>
<li>
September 4, 2023, by Jelger Jansen:<br/>
First implementation.
</li>
</ul>
</html>"));
end SimpleHouse2;
41 changes: 41 additions & 0 deletions IBPSA/Fluid/Examples/WorkshopModelicaConference/SimpleHouse3.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
within IBPSA.Fluid.Examples.WorkshopModelicaConference;
model SimpleHouse3 "Air model"
extends SimpleHouse2;

parameter Modelica.Units.SI.Volume V_zone=8*8*3 "Zone volume";
parameter Modelica.Units.SI.MassFlowRate mAir_flow_nominal=0.1
"Nominal mass flow rate for air loop";
parameter Modelica.Units.SI.CoefficientOfHeatTransfer h_wall=2
"Convective heat transfer coefficient at the wall";

Modelica.Thermal.HeatTransfer.Components.ThermalResistor convRes(R=1/2/A_wall)
"Thermal resistance for convective heat transfer"
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
rotation=270,
origin={130,20})));
MixingVolumes.MixingVolume zone(
redeclare package Medium = MediumAir,
V=V_zone,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
m_flow_nominal=mAir_flow_nominal,
massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial)
"Very simple zone air model"
annotation (Placement(transformation(extent={{110,130},{90,150}})));
equation
connect(convRes.port_b, walCap.port)
annotation (Line(points={{130,10},{130,1.77636e-15},{140,1.77636e-15}},
color={191,0,0}));
connect(zone.heatPort, convRes.port_a)
annotation (Line(points={{110,140},{130,140},{130,30}}, color={191,0,0}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-240,
-220},{200,200}})),
experiment(StopTime=1e+06),
Documentation(revisions="<html>
<ul>
<li>
September 4, 2023, by Jelger Jansen:<br/>
First implementation.
</li>
</ul>
</html>"));
end SimpleHouse3;
72 changes: 72 additions & 0 deletions IBPSA/Fluid/Examples/WorkshopModelicaConference/SimpleHouse4.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
within IBPSA.Fluid.Examples.WorkshopModelicaConference;
model SimpleHouse4 "Heating model"
extends SimpleHouse3;

parameter Modelica.Units.SI.HeatFlowRate QHea_nominal=3000
"Nominal capacity of heating system";
parameter Modelica.Units.SI.MassFlowRate mWat_flow_nominal=0.1
"Nominal mass flow rate for water loop";
parameter Boolean constantSourceHeater=true
"To enable/disable the connection between the constant source and heater";

HeatExchangers.Radiators.RadiatorEN442_2 rad(
redeclare package Medium = MediumWater,
T_a_nominal=333.15,
T_b_nominal=313.15,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
allowFlowReversal=false,
Q_flow_nominal=3000) "Radiator"
annotation (Placement(transformation(extent={{110,-110},{130,-90}})));
HeatExchangers.HeaterCooler_u heaWat(
redeclare package Medium = MediumWater,
m_flow_nominal=mWat_flow_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
allowFlowReversal=false,
dp_nominal=5000,
Q_flow_nominal=QHea_nominal) "Heater for water circuit"
annotation (Placement(transformation(extent={{60,-110},{80,-90}})));
Movers.FlowControlled_m_flow pump(
redeclare package Medium = MediumWater,
use_inputFilter=false,
m_flow_nominal=mWat_flow_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
allowFlowReversal=false,
nominalValuesDefineDefaultPressureCurve=true,
inputType=IBPSA.Fluid.Types.InputType.Constant)
"Pump"
annotation (Placement(transformation(extent={{110,-180},{90,-160}})));
Sources.Boundary_pT bouWat(redeclare package Medium = MediumWater, nPorts=1)
"Pressure bound for water circuit" annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
origin={10,-170})));
Modelica.Blocks.Sources.Constant const(k=1)
annotation (Placement(transformation(extent={{80,-80},{60,-60}})));
equation
connect(heaWat.port_b,rad. port_a) annotation (Line(points={{80,-100},{110,-100}},
color={0,127,255}));
connect(rad.port_b,pump. port_a) annotation (Line(points={{130,-100},{148,-100},
{148,-170},{110,-170}},color={0,127,255}));
connect(heaWat.port_a,pump. port_b) annotation (Line(points={{60,-100},{49.75,
-100},{49.75,-170},{90,-170}}, color={0,127,255}));
connect(rad.heatPortCon, zone.heatPort) annotation (Line(points={{118,-92.8},
{118,140},{110,140}},color={191,0,0}));
connect(rad.heatPortRad, walCap.port) annotation (Line(points={{122,-92.8},{122,
-30},{132,-30},{132,1.77636e-15},{140,1.77636e-15}}, color={191,0,0}));
if constantSourceHeater then
connect(const.y, heaWat.u) annotation (Line(points={{59,-70},{50,-70},{50,-94},
{58,-94}}, color={0,0,127}));
end if;
connect(bouWat.ports[1], pump.port_b)
annotation (Line(points={{20,-170},{90,-170}}, color={0,127,255}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-240,
-220},{200,200}})),
experiment(StopTime=1e+06),
Documentation(revisions="<html>
<ul>
<li>
September 4, 2023, by Jelger Jansen:<br/>
First implementation.
</li>
</ul>
</html>"));
end SimpleHouse4;
47 changes: 47 additions & 0 deletions IBPSA/Fluid/Examples/WorkshopModelicaConference/SimpleHouse5.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
within IBPSA.Fluid.Examples.WorkshopModelicaConference;
model SimpleHouse5 "Heating controller model"
extends SimpleHouse4(pump(inputType=IBPSA.Fluid.Types.InputType.Stages,
massFlowRates=mWat_flow_nominal*{1}),
constantSourceHeater=false);

Modelica.Blocks.Math.BooleanToInteger booleanToInt "Boolean to integer"
annotation (Placement(transformation(extent={{0,-150},{20,-130}})));
Modelica.Blocks.Math.BooleanToReal booleanToReal "Boolean to real"
annotation (Placement(transformation(extent={{0,-110},{20,-90}})));
Modelica.Blocks.Logical.Hysteresis hysRad(uLow=273.15 + 21, uHigh=273.15 + 23)
"Hysteresis controller for radiator"
annotation (Placement(transformation(extent={{-80,-110},{-60,-90}})));
Modelica.Blocks.Logical.Not not1
"Negation for enabling heating when temperature is low"
annotation (Placement(transformation(extent={{-40,-110},{-20,-90}})));
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor senTemZonAir
"Zone air temperature sensor"
annotation (Placement(transformation(extent={{90,150},{70,170}})));
equation
connect(booleanToInt.y, pump.stage) annotation (Line(points={{21,-140},{100,-140},
{100,-158}}, color={255,127,0}));
connect(booleanToInt.u,not1. y) annotation (Line(points={{-2,-140},{-11.5,-140},
{-11.5,-100},{-19,-100}},
color={255,0,255}));
connect(booleanToReal.y, heaWat.u) annotation (Line(points={{21,-100},{40.5,-100},
{40.5,-94},{58,-94}}, color={0,0,127}));
connect(not1.u,hysRad. y) annotation (Line(points={{-42,-100},{-59,-100}},
color={255,0,255}));
connect(senTemZonAir.T,hysRad. u) annotation (Line(points={{69,160},{-230,160},
{-230,-100},{-82,-100}}, color={0,0,127}));
connect(senTemZonAir.port, zone.heatPort) annotation (Line(points={{90,160},{
110,160},{110,140}}, color={191,0,0}));
connect(not1.y, booleanToReal.u)
annotation (Line(points={{-19,-100},{-2,-100}}, color={255,0,255}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-240,
-220},{200,200}})),
experiment(StopTime=1e+06),
Documentation(revisions="<html>
<ul>
<li>
September 4, 2023, by Jelger Jansen:<br/>
First implementation.
</li>
</ul>
</html>"));
end SimpleHouse5;
89 changes: 89 additions & 0 deletions IBPSA/Fluid/Examples/WorkshopModelicaConference/SimpleHouse6.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
within IBPSA.Fluid.Examples.WorkshopModelicaConference;
model SimpleHouse6 "Free cooling model"
extends SimpleHouse5(zone(nPorts=2),
mAir_flow_nominal=0.1,
A_win=6);

parameter Modelica.Units.SI.PressureDifference dpAir_nominal=200
"Pressure drop at nominal mass flow rate for air loop";

IBPSA.Fluid.Actuators.Dampers.Exponential
vavDam(
redeclare package Medium = MediumAir,
from_dp=true,
m_flow_nominal=mAir_flow_nominal,
dpDamper_nominal=dpAir_nominal)
"Damper" annotation (Placement(transformation(extent={{-10,10},{10,
-10}}, origin={50,110})));
IBPSA.Fluid.Movers.FlowControlled_dp
fan(
redeclare package Medium = MediumAir,
dp_nominal=dpAir_nominal,
use_inputFilter=false,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
nominalValuesDefineDefaultPressureCurve=true,
m_flow_nominal=mAir_flow_nominal,
show_T=true) "Constant head fan" annotation (Placement(transformation(
extent={{-10,10},{10,-10}},
origin={-50,110})));
Modelica.Blocks.Sources.Constant const_dp(k=dpAir_nominal) "Pressure head"
annotation (Placement(transformation(extent={{-90,70},{-70,90}})));
IBPSA.Fluid.HeatExchangers.ConstantEffectiveness
hexRec(
redeclare package Medium1 = MediumAir,
redeclare package Medium2 = MediumAir,
dp1_nominal=10,
dp2_nominal=10,
m1_flow_nominal=mAir_flow_nominal,
m2_flow_nominal=mAir_flow_nominal,
eps=0.85) "Heat exchanger for heat recuperation"
annotation (Placement(transformation(extent={{-80,104},{-110,136}})));
IBPSA.Fluid.Sources.Boundary_pT
bouAir(
redeclare package Medium = MediumAir,
use_T_in=true,
nPorts=2) "Air boundary with constant temperature"
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
origin={-130,130})));
Modelica.Blocks.Logical.Hysteresis hysAir(uLow=273.15 + 23, uHigh=273.15 + 25)
"Hysteresis controller for damper"
annotation (Placement(transformation(extent={{-20,70},{0,90}})));
Modelica.Blocks.Math.BooleanToReal booleanToReal1
"Boolean to real"
annotation (Placement(transformation(extent={{20,70},{40,90}})));
equation
connect(const_dp.y,fan. dp_in) annotation (Line(points={{-69,80},{-50,80},{
-50,98}}, color={0,0,127}));
connect(hexRec.port_a1, zone.ports[1]) annotation (Line(points={{-80,129.6},{97,
129.6},{97,130},{100,130}}, color={0,127,255}));
connect(bouAir.T_in, weaBus.TDryBul) annotation (Line(points={{-142,134},{
-150,134},{-150,-10}},color={0,0,127}));
connect(hexRec.port_b2, fan.port_a) annotation (Line(points={{-80,110.4},{-69,
110.4},{-69,110},{-60,110}}, color={0,127,255}));
connect(vavDam.port_b, zone.ports[2]) annotation (Line(points={{60,110},{100,110},
{100,130}}, color={0,127,255}));
connect(booleanToReal1.y, vavDam.y)
annotation (Line(points={{41,80},{50,80},{50,98}}, color={0,0,127}));
connect(hysAir.y, booleanToReal1.u)
annotation (Line(points={{1,80},{18,80}}, color={255,0,255}));
connect(vavDam.port_a, fan.port_b)
annotation (Line(points={{40,110},{-40,110}}, color={0,127,255}));
connect(hysAir.u, hysRad.u) annotation (Line(points={{-22,80},{-30,80},{-30,
160},{-230,160},{-230,-100},{-82,-100}}, color={0,0,127}));
connect(bouAir.ports[1], hexRec.port_b1) annotation (Line(points={{-120,129},
{-119,129},{-119,129.6},{-110,129.6}}, color={0,127,255}));
connect(bouAir.ports[2], hexRec.port_a2) annotation (Line(points={{-120,131},
{-120,110.4},{-110,110.4}}, color={0,127,255}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-240,
-220},{200,200}})),
experiment(StopTime=1e+06),
Documentation(revisions="<html>
<ul>
<li>
September 4, 2023, by Jelger Jansen:<br/>
First implementation.
</li>
</ul>
</html>"));
end SimpleHouse6;
Loading

0 comments on commit 7c39a70

Please sign in to comment.