Skip to content

Commit

Permalink
Merged IBPSA, issue1794_revertPortPlacement and issue1785_modelicaCon…
Browse files Browse the repository at this point in the history
…fTutorial
  • Loading branch information
mwetter committed Sep 20, 2023
1 parent 4740d27 commit 90f045f
Show file tree
Hide file tree
Showing 14 changed files with 241 additions and 174 deletions.
1 change: 1 addition & 0 deletions Buildings/.copiedFiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1756,6 +1756,7 @@ Buildings/Fluid/Storage/BaseClasses/Examples/package.mo
Buildings/Fluid/Storage/BaseClasses/Examples/package.order
Buildings/Fluid/Storage/BaseClasses/IndirectTankHeatExchanger.mo
Buildings/Fluid/Storage/BaseClasses/PartialStratified.mo
Buildings/Fluid/Storage/BaseClasses/PartialTwoPortInterface.mo
Buildings/Fluid/Storage/BaseClasses/ThirdOrderStratifier.mo
Buildings/Fluid/Storage/BaseClasses/package.mo
Buildings/Fluid/Storage/BaseClasses/package.order
Expand Down
41 changes: 21 additions & 20 deletions Buildings/Examples/Tutorial/SimpleHouse/SimpleHouse0.mo
Original file line number Diff line number Diff line change
Expand Up @@ -13,74 +13,72 @@ model SimpleHouse0
ModelicaServices.ExternalReferences.loadResource(
"modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"))
"Weather data reader"
annotation (Placement(transformation(extent={{-200,-20},{-180,0}})));
annotation (Placement(transformation(extent={{-180,-10},{-160,10}})));
Buildings.BoundaryConditions.WeatherData.Bus weaBus "Weather data bus"
annotation (Placement(transformation(extent={{-160,-20},{-140,0}})));
annotation (Placement(transformation(extent={{-140,-10},{-120,10}}),
iconTransformation(extent={{-152,-10},{-132,10}})));
Buildings.HeatTransfer.Sources.PrescribedTemperature TOut
"Exterior temperature boundary condition"
annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
equation
connect(weaDat.weaBus, weaBus) annotation (Line(
points={{-180,-10},{-150,-10}},
points={{-160,0},{-130,0}},
color={255,204,51},
thickness=0.5));
connect(TOut.T, weaBus.TDryBul)
annotation (Line(points={{-82,0},{-150,0},{-150,-10}},color={0,0,127}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-240,
-220},{200,200}}), graphics={
annotation (Line(points={{-82,0},{-130,0}}, color={0,0,127}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220,
-220},{220,220}}), graphics={
Rectangle(
extent={{-220,40},{-38,-40}},
extent={{-200,60},{-20,-60}},
fillColor={238,238,238},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Rectangle(
extent={{-220,-60},{180,-200}},
extent={{-200,-80},{200,-200}},
fillColor={238,238,238},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Rectangle(
extent={{-220,180},{180,60}},
extent={{-200,200},{200,80}},
fillColor={238,238,238},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Rectangle(
extent={{-20,40},{180,-40}},
extent={{0,60},{200,-60}},
fillColor={238,238,238},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Text(
extent={{22,22},{-23,39}},
extent={{57.25,40.25},{2.75,59.75}},
textColor={0,0,127},
fillColor={255,213,170},
fillPattern=FillPattern.Solid,
textString="Wall"),
textString="Building"),
Text(
extent={{-157,-79},{-223,-61}},
extent={{-137,-99},{-203,-81}},
textColor={0,0,127},
fillColor={255,213,170},
fillPattern=FillPattern.Solid,
textString="Heating"),
Text(
extent={{-118,18},{-214,40}},
extent={{-102,39},{-198,61}},
textColor={0,0,127},
fillColor={255,213,170},
fillPattern=FillPattern.Solid,
textString="Weather inputs"),
Text(
extent={{-76,158},{-214,180}},
extent={{-61,179},{-199,201}},
textColor={0,0,127},
fillColor={255,213,170},
fillPattern=FillPattern.Solid,
textString="Cooling and ventilation")}),
experiment(Tolerance=1E-6, StopTime=1e+06),
__Dymola_Commands(file=
"modelica://Buildings/Resources/Scripts/Dymola/Examples/Tutorial/SimpleHouse/SimpleHouse0.mos"
"Simulate and plot"),
Documentation(revisions="<html>
<ul>
<li>
September 4, 2023, by Jelger Jansen:<br/>
Replace IDEAS by Buildings models.
Replace IDEAS by Buildings models and general revision/update of the model.
</li>
<li>
October 11, 2016, by Filip Jorissen:<br/>
Expand All @@ -95,5 +93,8 @@ that allows the user to connect thermal components to the dry bulb temperature.
It was based on from the Modelica crash course organised by KU Leuven
(<a href=\"https://github.com/open-ideas/__CrashCourse__\">https://github.com/open-ideas/__CrashCourse__</a>).
</p>
</html>"));
</html>"),
__Dymola_Commands(file=
"modelica://Buildings/Resources/Scripts/Dymola/Examples/Tutorial/SimpleHouse/SimpleHouse0.mos"
"Simulate and plot"));
end SimpleHouse0;
14 changes: 7 additions & 7 deletions Buildings/Examples/Tutorial/SimpleHouse/SimpleHouse1.mo
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ model SimpleHouse1 "Building wall model"
"Thermal mass of wall"
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
rotation=270,
origin={150,0})));
origin={170,0})));
Modelica.Thermal.HeatTransfer.Components.ThermalResistor walRes(R=dWall/AWall
/kWall) "Thermal resistor for wall: 25 cm of rockwool"
annotation (Placement(transformation(extent={{80,-10},{100,10}})));
annotation (Placement(transformation(extent={{60,-10},{80,10}})));
equation
connect(walRes.port_b, walCap.port) annotation (Line(points={{100,0},{112,0},
{112,1.77636e-15},{140,1.77636e-15}}, color={191,0,0}));
connect(walRes.port_b, walCap.port) annotation (Line(points={{80,0},{100,0},{100,
1.77636e-15},{160,1.77636e-15}}, color={191,0,0}));
connect(TOut.port, walRes.port_a)
annotation (Line(points={{0,0},{80,0}}, color={191,0,0}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-240,
-220},{200,200}})),
annotation (Line(points={{-60,0},{60,0}}, color={191,0,0}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220,
-220},{220,220}})),
experiment(Tolerance=1e-6, StopTime=1e+06),
Documentation(revisions="<html>
<ul>
Expand Down
19 changes: 9 additions & 10 deletions Buildings/Examples/Tutorial/SimpleHouse/SimpleHouse2.mo
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,23 @@ model SimpleHouse2 "Building window model"

Modelica.Blocks.Math.Gain gaiWin(k=AWin)
"Gain for solar irradiance through the window"
annotation (Placement(transformation(extent={{0,-30},{20,-10}})));
annotation (Placement(transformation(extent={{20,-50},{40,-30}})));
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow win
"Very simple window model"
annotation (Placement(transformation(extent={{40,-30},{60,-10}})));
annotation (Placement(transformation(extent={{60,-50},{80,-30}})));
equation
connect(gaiWin.y, win.Q_flow)
annotation (Line(points={{21,-20},{40,-20}}, color={0,0,127}));
connect(win.port, walCap.port) annotation (Line(points={{60,-20},{130,-20},{
130,1.77636e-15},{140,1.77636e-15}},
color={191,0,0}));
connect(gaiWin.u, weaBus.HDirNor) annotation (Line(points={{-2,-20},{-150,-20},
{-150,-10}}, color={0,0,127}), Text(
annotation (Line(points={{41,-40},{60,-40}}, color={0,0,127}));
connect(gaiWin.u, weaBus.HDirNor) annotation (Line(points={{18,-40},{-130,-40},
{-130,0}}, 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}})),
connect(win.port, walCap.port) annotation (Line(points={{80,-40},{110,-40},{110,
1.77636e-15},{160,1.77636e-15}}, color={191,0,0}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220,
-220},{220,220}})),
experiment(Tolerance=1e-6, StopTime=1e+06),
Documentation(revisions="<html>
<ul>
Expand Down
14 changes: 7 additions & 7 deletions Buildings/Examples/Tutorial/SimpleHouse/SimpleHouse3.mo
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ model SimpleHouse3 "Air model"
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={130,20})));
origin={110,20})));
Buildings.Fluid.MixingVolumes.MixingVolume zon(
redeclare package Medium = MediumAir,
V=VZone,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
m_flow_nominal=mAir_flow_nominal) "Very simple zone air model"
annotation (Placement(transformation(extent={{110,130},{90,150}})));
annotation (Placement(transformation(extent={{160,50},{180,30}})));
equation
connect(conRes.port_b, walCap.port) annotation (Line(points={{130,10},{130,
1.77636e-15},{140,1.77636e-15}}, color={191,0,0}));
connect(zon.heatPort, conRes.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}})),
annotation (Line(points={{160,40},{110,40},{110,30}}, color={191,0,0}));
connect(conRes.port_b, walCap.port) annotation (Line(points={{110,10},{110,1.77636e-15},
{160,1.77636e-15}}, color={191,0,0}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220,
-220},{220,220}})),
experiment(Tolerance=1e-6, StopTime=1e+06),
Documentation(revisions="<html>
<ul>
Expand Down
38 changes: 19 additions & 19 deletions Buildings/Examples/Tutorial/SimpleHouse/SimpleHouse4.mo
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ model SimpleHouse4 "Heating model"
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
allowFlowReversal=false,
Q_flow_nominal=QHea_flow_nominal) "Radiator"
annotation (Placement(transformation(extent={{110,-110},{130,-90}})));
annotation (Placement(transformation(extent={{140,-140},{160,-120}})));
Buildings.Fluid.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_flow_nominal) "Heater for water circuit"
annotation (Placement(transformation(extent={{60,-110},{80,-90}})));
annotation (Placement(transformation(extent={{60,-140},{80,-120}})));
Buildings.Fluid.Movers.FlowControlled_m_flow pum(
redeclare package Medium = MediumWater,
use_inputFilter=false,
Expand All @@ -33,32 +33,32 @@ model SimpleHouse4 "Heating model"
allowFlowReversal=false,
nominalValuesDefineDefaultPressureCurve=true,
inputType=Buildings.Fluid.Types.InputType.Constant) "Pump"
annotation (Placement(transformation(extent={{110,-180},{90,-160}})));
annotation (Placement(transformation(extent={{160,-190},{140,-170}})));
Buildings.Fluid.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})));
origin={20,-180})));
Modelica.Blocks.Sources.Constant conHea(k=1)
annotation (Placement(transformation(extent={{80,-80},{60,-60}})));
annotation (Placement(transformation(extent={{80,-110},{60,-90}})));
equation
connect(heaWat.port_b,rad. port_a) annotation (Line(points={{80,-100},{110,-100}},
connect(heaWat.port_b,rad. port_a) annotation (Line(points={{80,-130},{140,-130}},
color={0,127,255}));
connect(rad.port_b, pum.port_a) annotation (Line(points={{130,-100},{148,-100},
{148,-170},{110,-170}}, color={0,127,255}));
connect(heaWat.port_a, pum.port_b) annotation (Line(points={{60,-100},{49.75,
-100},{49.75,-170},{90,-170}}, color={0,127,255}));
connect(rad.heatPortCon, zon.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,
-20},{130,-20},{130,1.77636e-15},{140,1.77636e-15}}, color={191,0,0}));
connect(rad.port_b, pum.port_a) annotation (Line(points={{160,-130},{175,-130},
{175,-180},{160,-180}}, color={0,127,255}));
connect(heaWat.port_a, pum.port_b) annotation (Line(points={{60,-130},{39.75,-130},
{39.75,-180},{140,-180}}, color={0,127,255}));
connect(rad.heatPortCon, zon.heatPort) annotation (Line(points={{148,-122.8},{
148,40},{160,40}}, color={191,0,0}));
connect(rad.heatPortRad, walCap.port) annotation (Line(points={{152,-122.8},{152,
1.77636e-15},{160,1.77636e-15}}, color={191,0,0}));
if use_constantHeater then
connect(conHea.y, heaWat.u) annotation (Line(points={{59,-70},{50,-70},{50,
-94},{58,-94}}, color={0,0,127}));
connect(conHea.y, heaWat.u) annotation (Line(points={{59,-100},{40,-100},{40,-124},
{58,-124}}, color={0,0,127}));
end if;
connect(bouWat.ports[1], pum.port_b)
annotation (Line(points={{20,-170},{90,-170}}, color={0,127,255}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-240,
-220},{200,200}})),
annotation (Line(points={{30,-180},{140,-180}},color={0,127,255}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220,
-220},{220,220}})),
experiment(Tolerance=1e-6, StopTime=1e+06),
Documentation(revisions="<html>
<ul>
Expand Down
36 changes: 18 additions & 18 deletions Buildings/Examples/Tutorial/SimpleHouse/SimpleHouse5.mo
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ model SimpleHouse5 "Heating controller model"
massFlowRates=mWat_flow_nominal*{1}), final use_constantHeater=false);

Modelica.Blocks.Math.BooleanToInteger booInt "Boolean to integer"
annotation (Placement(transformation(extent={{0,-150},{20,-130}})));
annotation (Placement(transformation(extent={{0,-160},{20,-140}})));
Modelica.Blocks.Math.BooleanToReal booRea "Boolean to real"
annotation (Placement(transformation(extent={{0,-110},{20,-90}})));
annotation (Placement(transformation(extent={{0,-120},{20,-100}})));
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}})));
annotation (Placement(transformation(extent={{-80,-120},{-60,-100}})));
Modelica.Blocks.Logical.Not not1
"Negation for enabling heating when temperature is low"
annotation (Placement(transformation(extent={{-40,-110},{-20,-90}})));
annotation (Placement(transformation(extent={{-40,-120},{-20,-100}})));
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor senTemZonAir
"Zone air temperature sensor"
annotation (Placement(transformation(extent={{90,150},{70,170}})));
annotation (Placement(transformation(extent={{90,160},{70,180}})));
equation
connect(booInt.y, pum.stage) annotation (Line(points={{21,-140},{100,-140},{
100,-158}}, color={255,127,0}));
connect(booInt.u, not1.y) annotation (Line(points={{-2,-140},{-11.5,-140},{-11.5,
-100},{-19,-100}}, color={255,0,255}));
connect(booRea.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}},
connect(booInt.y, pum.stage) annotation (Line(points={{21,-150},{150,-150},{150,
-168}}, color={255,127,0}));
connect(booInt.u, not1.y) annotation (Line(points={{-2,-150},{-11.5,-150},{-11.5,
-110},{-19,-110}}, color={255,0,255}));
connect(not1.u,hysRad. y) annotation (Line(points={{-42,-110},{-59,-110}},
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.T,hysRad. u) annotation (Line(points={{69,170},{-210,170},
{-210,-110},{-82,-110}}, color={0,0,127}));
connect(senTemZonAir.port, zon.heatPort)
annotation (Line(points={{90,160},{110,160},{110,140}}, color={191,0,0}));
annotation (Line(points={{90,170},{160,170},{160,40}}, color={191,0,0}));
connect(not1.y, booRea.u)
annotation (Line(points={{-19,-100},{-2,-100}}, color={255,0,255}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-240,
-220},{200,200}})),
annotation (Line(points={{-19,-110},{-2,-110}}, color={255,0,255}));
connect(booRea.y, heaWat.u) annotation (Line(points={{21,-110},{40,-110},{40,-124},
{58,-124}}, color={0,0,127}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220,
-220},{220,220}})),
experiment(Tolerance=1e-6, StopTime=1e+06),
Documentation(revisions="<html>
<ul>
Expand Down
Loading

0 comments on commit 90f045f

Please sign in to comment.