diff --git a/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse0.mo b/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse0.mo index 8950434730..28c3662126 100644 --- a/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse0.mo +++ b/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse0.mo @@ -1,100 +1,102 @@ -within IBPSA.Examples.Tutorial.SimpleHouse; -model SimpleHouse0 - "Start file for simple house example" - extends Modelica.Icons.Example; - package MediumAir = IBPSA.Media.Air "Medium model for air"; - package MediumWater = IBPSA.Media.Water "Medium model for water"; - parameter Modelica.Units.SI.Area AWall = 100 "Wall area"; - parameter Modelica.Units.SI.Length dWall = 0.25 "Wall thickness"; - parameter Modelica.Units.SI.ThermalConductivity kWall = 0.04 "Wall thermal conductivity"; - parameter Modelica.Units.SI.Density rhoWall = 2000 "Wall density"; - parameter Modelica.Units.SI.SpecificHeatCapacity cpWall = 1000 "Wall specific heat capacity"; - IBPSA.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam= - ModelicaServices.ExternalReferences.loadResource( - "modelica://IBPSA/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos")) - "Weather data reader" - annotation (Placement(transformation(extent={{-180,-10},{-160,10}}))); - IBPSA.BoundaryConditions.WeatherData.Bus weaBus "Weather data bus" - annotation (Placement(transformation(extent={{-140,-10},{-120,10}}), - iconTransformation(extent={{-152,-10},{-132,10}}))); - Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TOut - "Exterior temperature boundary condition" - annotation (Placement(transformation(extent={{-80,-10},{-60,10}}))); -equation - connect(weaDat.weaBus, weaBus) annotation (Line( - points={{-160,0},{-130,0}}, - color={255,204,51}, - thickness=0.5)); - connect(TOut.T, weaBus.TDryBul) - annotation (Line(points={{-82,0},{-130,0}}, color={0,0,127})); - annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220, - -220},{220,220}}), graphics={ - Rectangle( - extent={{-200,60},{-20,-60}}, - fillColor={238,238,238}, - fillPattern=FillPattern.Solid, - pattern=LinePattern.None), - Rectangle( - extent={{-200,-80},{200,-200}}, - fillColor={238,238,238}, - fillPattern=FillPattern.Solid, - pattern=LinePattern.None), - Rectangle( - extent={{-200,200},{200,80}}, - fillColor={238,238,238}, - fillPattern=FillPattern.Solid, - pattern=LinePattern.None), - Rectangle( - extent={{0,60},{200,-60}}, - fillColor={238,238,238}, - fillPattern=FillPattern.Solid, - pattern=LinePattern.None), - Text( - extent={{57.25,40.25},{2.75,59.75}}, - textColor={0,0,127}, - fillColor={255,213,170}, - fillPattern=FillPattern.Solid, - textString="Building"), - Text( - extent={{-137,-99},{-203,-81}}, - textColor={0,0,127}, - fillColor={255,213,170}, - fillPattern=FillPattern.Solid, - textString="Heating"), - Text( - extent={{-102,39},{-198,61}}, - textColor={0,0,127}, - fillColor={255,213,170}, - fillPattern=FillPattern.Solid, - textString="Weather inputs"), - Text( - 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), - Documentation(revisions=" -
-This model is used as the starting point for the SimpleHouse
tutorial.
-It contains a weather data reader and a PrescribedTemperature
component
-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
-(https://github.com/open-ideas/__CrashCourse__).
-
+This model is used as the starting point for the
+IBPSA.Examples.Tutorial.SimpleHouse
+tutorial.
+It contains a weather data reader and a PrescribedTemperature
component
+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
+(https://github.com/open-ideas/__CrashCourse__).
+
-A very simple building envelope model will be constructed manually using thermal resistors and heat capacitors. -The house consists of a wall represented by a single heat capacitor and a thermal resistor. -The boundary temperature are already included in - -IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse0. -The wall has a surface area of Awall=100 m2, -a thickness of dwall=25 cm, -a thermal conductivity of kwall=0.04 W/(m K), -a density of ρwall=2000 kg/m3, -and a specific heat capacity of cp,wall= 1000 J/(kg K) -
--These parameters are already declared in the equation section of - -IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse0. -You can use this way of declaring parameters in the remainder of this exercise, but this is not required. -
--The conductive thermal resistance value of a wall may be computed as R=d/(A*k). -The heat capacity value of a wall may be computed as C=A*d*cp*ρ -
-
-Connect one side of the thermal resistor to the output of PrescribedTemperature
-and the other side of the thermal resistor to the heat capacitor.
-
-If you correctly added the model of the heat capacitor, -connected it to the resistor and added the parameter values for C, -then you should be able to simulate the model. -To do this, press the Simulation Setup and set the model Stop time to 1e6 seconds. -You can now simulate the model by pressing the Simulate button. -
--You can plot individual variables values by clicking on their name in the variable browser on the left. -Now plot the wall capacitor temperature value T. -It should look like the figure below (1 Ms is around 12 days). -
-- -
-"), - __Dymola_Commands(file= - "modelica://IBPSA/Resources/Scripts/Dymola/Examples/Tutorial/SimpleHouse/SimpleHouse1.mos" - "Simulate and plot")); -end SimpleHouse1; +within IBPSA.Examples.Tutorial.SimpleHouse; +model SimpleHouse1 "Building wall model" + extends SimpleHouse0; + + Modelica.Thermal.HeatTransfer.Components.HeatCapacitor walCap( + C=AWall*dWall*cpWall*rhoWall, + T(fixed=true)) + "Thermal mass of wall" + annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + rotation=270, + 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={{60,-10},{80,10}}))); +equation + 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={{-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=" ++A very simple building envelope model will be constructed manually using thermal resistors and heat capacitors. +The house consists of a wall represented by a single heat capacitor and a thermal resistor. +The boundary temperature are already included in + +IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse0. +The wall has a surface area of Awall=100 m2, +a thickness of dwall=25 cm, +a thermal conductivity of kwall=0.04 W/(m K), +a density of ρwall=2000 kg/m3, +and a specific heat capacity of cp,wall= 1000 J/(kg K) +
++These parameters are already declared in the equation section of + +IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse0. +You can use this way of declaring parameters in the remainder of this exercise, but this is not required. +
++The conductive thermal resistance value of a wall may be computed as R=d/(A*k). +The heat capacity value of a wall may be computed as C=A*d*cp*ρ +
+
+Connect one side of the thermal resistor to the output of PrescribedTemperature
+and the other side of the thermal resistor to the heat capacitor.
+
+If you correctly added the model of the heat capacitor, +connected it to the resistor and added the parameter values for C, +then you should be able to simulate the model. +To do this, press the Simulation Setup and set the model Stop time to 1e6 seconds. +You can now simulate the model by pressing the Simulate button. +
++You can plot individual variables values by clicking on their name in the variable browser on the left. +Now plot the wall capacitor temperature value T. +It should look like the figure below (1 Ms is around 12 days). +
++ +
+"), + __Dymola_Commands(file= + "modelica://IBPSA/Resources/Scripts/Dymola/Examples/Tutorial/SimpleHouse/SimpleHouse1.mos" + "Simulate and plot")); +end SimpleHouse1; diff --git a/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse2.mo b/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse2.mo index 9dd59a9f8a..a35f20d80e 100644 --- a/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse2.mo +++ b/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse2.mo @@ -1,79 +1,79 @@ -within IBPSA.Examples.Tutorial.SimpleHouse; -model SimpleHouse2 "Building window model" - extends SimpleHouse1; - - parameter Modelica.Units.SI.Area AWin=2 "Window area"; - - Modelica.Blocks.Math.Gain gaiWin(k=AWin) - "Gain for solar irradiance through the window" - annotation (Placement(transformation(extent={{20,-50},{40,-30}}))); - Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow win - "Very simple window model" - annotation (Placement(transformation(extent={{60,-50},{80,-30}}))); -equation - connect(gaiWin.y, win.Q_flow) - 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)); - 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=" --The window has a surface area of 2 m2. -In this simple model we will therefore assume that -two times the outdoor solar irradiance is injected as heat onto the inside of the wall. -
-
-To be able to use the value of the outdoor solar irradiance
-you will need to access the weather data reader.
-To do this, make a connection to the weaBus
.
-In the dialog box select <New Variable> and here type HDirNor,
-which is the direct solar irradiance on a surface of 1 m2,
-perpendicular to the sun rays.
-Set the gain factor k to 2,
-in order to get the solar irradiance through the window of 2 m2.
-
-Make a connection with the PrescribedHeatFlow
as well.
-This block makes the connection between the heat flow from the gain, represented as a real value,
-and a heat port that is compatible with the connectors of the thermal capacitance and resistance.
-
-The result with and without the window model is plotted in the figure below. -
-- -
-"), - __Dymola_Commands(file= - "modelica://IBPSA/Resources/Scripts/Dymola/Examples/Tutorial/SimpleHouse/SimpleHouse2.mos" - "Simulate and plot")); -end SimpleHouse2; +within IBPSA.Examples.Tutorial.SimpleHouse; +model SimpleHouse2 "Building window model" + extends SimpleHouse1; + + parameter Modelica.Units.SI.Area AWin=2 "Window area"; + + Modelica.Blocks.Math.Gain gaiWin(k=AWin) + "Gain for solar irradiance through the window" + annotation (Placement(transformation(extent={{20,-50},{40,-30}}))); + Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow win + "Very simple window model" + annotation (Placement(transformation(extent={{60,-50},{80,-30}}))); +equation + connect(gaiWin.y, win.Q_flow) + 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)); + 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=" ++The window has a surface area of 2 m2. +In this simple model we will therefore assume that +two times the outdoor solar irradiance is injected as heat onto the inside of the wall. +
+
+To be able to use the value of the outdoor solar irradiance
+you will need to access the weather data reader.
+To do this, make a connection to the weaBus
.
+In the dialog box select <New Variable> and here type HDirNor
,
+which is the direct solar irradiance on a surface of 1 m2,
+perpendicular to the sun rays.
+Set the gain factor k
to 2,
+in order to get the solar irradiance through the window of 2 m2.
+
+Make a connection with the PrescribedHeatFlow
as well.
+This block makes the connection between the heat flow from the gain, represented as a real value,
+and a heat port that is compatible with the connectors of the thermal capacitance and resistance.
+
+The result with and without the window model is plotted in the figure below. +
++ +
+"), + __Dymola_Commands(file= + "modelica://IBPSA/Resources/Scripts/Dymola/Examples/Tutorial/SimpleHouse/SimpleHouse2.mos" + "Simulate and plot")); +end SimpleHouse2; diff --git a/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse3.mo b/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse3.mo index 0446f28da8..59325b856b 100644 --- a/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse3.mo +++ b/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse3.mo @@ -1,87 +1,87 @@ -within IBPSA.Examples.Tutorial.SimpleHouse; -model SimpleHouse3 "Air model" - extends SimpleHouse2; - - parameter Modelica.Units.SI.Volume VZone=8*8*3 "Zone volume"; - parameter Modelica.Units.SI.MassFlowRate mAir_flow_nominal=1 - "Nominal mass flow rate for air loop"; - parameter Modelica.Units.SI.CoefficientOfHeatTransfer hWall=2 - "Convective heat transfer coefficient at the wall"; - - Modelica.Thermal.HeatTransfer.Components.ThermalResistor conRes(R=1/hWall/ - AWall) "Thermal resistance for convective heat transfer" annotation ( - Placement(transformation( - extent={{-10,-10},{10,10}}, - rotation=270, - origin={110,20}))); - IBPSA.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={{160,50},{180,30}}))); -equation - connect(zon.heatPort, conRes.port_a) - 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=" --To increase the model detail we now add an air model assuming the zone is 8m x 8m x 3m in size. -The air will exchange heat with the wall. -This may be modelled using a thermal resistance representing -the convective heat resistance which is equal to Rconv=1/(h*A), -where A is the heat exchange surface area and h=2 W/(m2*K) is the convective heat transfer coefficient. -
-
-The MixingVolume
Medium parameter contains information about
-the type of fluid and its properties that should be modelled by the MixingVolume
.
-Set its value to MediumAir, which is declared in the template,
-by typing redeclare package Medium = MediumAir.
-For the nominal mass flow rate you may assume a value of 1 kg/m3 for now.
-You will have to change this value once you add a ventilation system to the model (see
-
-IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse6).
-Finally, set the energyDynamics of the MixingVolume
,
-which can be found in the Dynamics tab of the model parameter window, to FixedInitial.
-
-Make a connection with the PrescribedHeatFlow
as well.
-This block makes the connection between the heat flow from the gain, represented as a real value,
-and a heat port that is compatible with the connectors of the thermal capacitance and resistance.
-
-The result with and without the air model is plotted in the figure below. -
-- -
-"), - __Dymola_Commands(file= - "modelica://IBPSA/Resources/Scripts/Dymola/Examples/Tutorial/SimpleHouse/SimpleHouse3.mos" - "Simulate and plot")); -end SimpleHouse3; +within IBPSA.Examples.Tutorial.SimpleHouse; +model SimpleHouse3 "Air model" + extends SimpleHouse2; + + parameter Modelica.Units.SI.Volume VZone=8*8*3 "Zone volume"; + parameter Modelica.Units.SI.MassFlowRate mAir_flow_nominal=1 + "Nominal mass flow rate for air loop"; + parameter Modelica.Units.SI.CoefficientOfHeatTransfer hWall=2 + "Convective heat transfer coefficient at the wall"; + + Modelica.Thermal.HeatTransfer.Components.ThermalResistor conRes(R=1/hWall/ + AWall) "Thermal resistance for convective heat transfer" annotation ( + Placement(transformation( + extent={{-10,-10},{10,10}}, + rotation=270, + origin={110,20}))); + IBPSA.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={{160,50},{180,30}}))); +equation + connect(zon.heatPort, conRes.port_a) + 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=" ++To increase the model detail we now add an air model assuming the zone is 8m x 8m x 3m in size. +The air will exchange heat with the wall. +This may be modelled using a thermal resistance representing +the convective heat resistance which is equal to Rconv=1/(h*A), +where A is the heat exchange surface area and h=2 W/(m2*K) is the convective heat transfer coefficient. +
+
+The MixingVolume
Medium
parameter contains information about
+the type of fluid and its properties that should be modelled by the MixingVolume
.
+Set its value to MediumAir
, which is declared in the template,
+by typing redeclare package Medium = MediumAir
.
+For the nominal mass flow rate you may assume a value of 1 kg/m3 for now.
+You will have to change this value once you add a ventilation system to the model (see
+
+IBPSA.Examples.Tutorial.SimpleHouse.SimpleHouse6).
+Finally, set the energyDynamics
of the MixingVolume
,
+which can be found in the Dynamics
tab of the model parameter window, to FixedInitial
.
+
+Make a connection with the PrescribedHeatFlow
as well.
+This block makes the connection between the heat flow from the gain, represented as a real value,
+and a heat port that is compatible with the connectors of the thermal capacitance and resistance.
+
+The result with and without the air model is plotted in the figure below. +
++ +
+"), + __Dymola_Commands(file= + "modelica://IBPSA/Resources/Scripts/Dymola/Examples/Tutorial/SimpleHouse/SimpleHouse3.mos" + "Simulate and plot")); +end SimpleHouse3; diff --git a/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse4.mo b/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse4.mo index c4fc28d751..335d544c15 100644 --- a/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse4.mo +++ b/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse4.mo @@ -2,12 +2,14 @@ within IBPSA.Examples.Tutorial.SimpleHouse; model SimpleHouse4 "Heating model" extends SimpleHouse3; + constant Boolean use_constantHeater=true + "To enable/disable the connection between the constant source and heater and circulation pump"; + parameter Modelica.Units.SI.HeatFlowRate QHea_flow_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 use_constantHeater=true - "To enable/disable the connection between the constant source and heater"; + IBPSA.Fluid.HeatExchangers.Radiators.RadiatorEN442_2 rad( redeclare package Medium = MediumWater, @@ -15,8 +17,9 @@ model SimpleHouse4 "Heating model" T_b_nominal=313.15, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, allowFlowReversal=false, - Q_flow_nominal=QHea_flow_nominal) "Radiator" + Q_flow_nominal=QHea_flow_nominal) "Radiator" annotation (Placement(transformation(extent={{140,-140},{160,-120}}))); + IBPSA.Fluid.HeatExchangers.HeaterCooler_u heaWat( redeclare package Medium = MediumWater, m_flow_nominal=mWat_flow_nominal, @@ -25,38 +28,45 @@ model SimpleHouse4 "Heating model" dp_nominal=5000, Q_flow_nominal=QHea_flow_nominal) "Heater for water circuit" annotation (Placement(transformation(extent={{60,-140},{80,-120}}))); - IBPSA.Fluid.Movers.FlowControlled_m_flow pum( + + Fluid.Movers.Preconfigured.FlowControlled_m_flow pum( 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={{160,-190},{140,-170}}))); - IBPSA.Fluid.Sources.Boundary_pT bouWat(redeclare package Medium = MediumWater, nPorts=1) - "Pressure bound for water circuit" annotation (Placement(transformation( + allowFlowReversal=false) "Pump" + annotation (Placement(transformation(extent={{110,-190},{90,-170}}))); + + IBPSA.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={20,-180}))); Modelica.Blocks.Sources.Constant conHea(k=1) + if use_constantHeater "Gain for heater" annotation (Placement(transformation(extent={{80,-110},{60,-90}}))); + Modelica.Blocks.Sources.Constant conPum(k=mWat_flow_nominal) + if use_constantHeater "Gain for pump" + annotation (Placement(transformation(extent={{130,-160},{110,-140}}))); equation 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={{160,-130},{175,-130}, - {175,-180},{160,-180}}, color={0,127,255})); + {175,-180},{110,-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})); + {39.75,-180},{90,-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,-100},{40,-100},{40,-124}, + connect(conPum.y, pum.m_flow_in) annotation (Line(points={{109,-150},{100,-150}, + {100,-168}}, 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={{30,-180},{140,-180}},color={0,127,255})); + annotation (Line(points={{30,-180},{90,-180}}, color={0,127,255})); annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220, -220},{220,220}})), experiment(Tolerance=1e-6, StopTime=1e+06), @@ -80,16 +90,16 @@ the media for the models in the heating circuit should be set to MediumWater<
The radiator contains one port for convective heat transfer and one for radiative heat transfer.
Connect both in a reasonable way. Since the heating system uses water as a heat carrier fluid,
-the media for the models should be set to MediumWater.
+the media for the models should be set to MediumWater
.
The Boundary_pT
model needs to be used to set an absolute pressure somewhere in the system.
@@ -113,7 +123,17 @@ Pressure difference modelling may be disregarded in the heating circuit
since the chosen pump sets a fixed mass flow rate regardless of the pressure drop.
-Set the heater input to 1, meaning that it will produce 1 times its nominal power. +Set the heater input to 1, meaning that it will produce 1 times its nominal power. +
+
+The pump and the heater need a control input, which we set here to a constant
+of 1.
+However, in the next version of this model, we want to connect an actual controller to these models.
+We can therefore introduce a Boolean constant
(or a Boolean parameter
+would also work), and use this to conditionally remove the Modelica block
+that outputs the control signal. When Modelica removes such a block, then all
+connections to it will also be removed.
diff --git a/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse5.mo b/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse5.mo index 52a25ecc82..108e59050b 100644 --- a/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse5.mo +++ b/IBPSA/Examples/Tutorial/SimpleHouse/SimpleHouse5.mo @@ -1,9 +1,9 @@ within IBPSA.Examples.Tutorial.SimpleHouse; model SimpleHouse5 "Heating controller model" - extends SimpleHouse4(pum(inputType=IBPSA.Fluid.Types.InputType.Stages, - massFlowRates=mWat_flow_nominal*{1}), final use_constantHeater=false); + extends SimpleHouse4(final use_constantHeater=false); - Modelica.Blocks.Math.BooleanToInteger booInt "Boolean to integer" + Modelica.Blocks.Math.BooleanToReal booRea1(realTrue=mWat_flow_nominal) + "Boolean to integer" annotation (Placement(transformation(extent={{0,-160},{20,-140}}))); Modelica.Blocks.Math.BooleanToReal booRea "Boolean to real" annotation (Placement(transformation(extent={{0,-120},{20,-100}}))); @@ -17,9 +17,7 @@ model SimpleHouse5 "Heating controller model" "Zone air temperature sensor" annotation (Placement(transformation(extent={{90,160},{70,180}}))); equation - 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, + connect(booRea1.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})); @@ -31,6 +29,8 @@ equation 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})); + connect(booRea1.y, pum.m_flow_in) annotation (Line(points={{21,-150},{100,-150}, + {100,-168}}, color={0,0,127})); annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-220, -220},{220,220}})), experiment(Tolerance=1e-6, StopTime=1e+06), @@ -68,11 +68,12 @@ Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor
-The heater modulation level should be set to one when the heater is on and to zero otherwise. +The heater modulation level should be set to 1 when the heater is on and to 0 otherwise. +Furthermore, the pump should only circulate water when the heater is on.
-The figure below shows the air temperature when the controller is added. +The figure below shows the air temperature after the controller is added.
0.1 kg/s.
MixingVolume
representing the zone air.
Add a boundary_pT
to draw air from the environment.
-Enable its temperature input and connect it to the TDryBul variable in the weather data reader.
+Enable its temperature input and connect it to the TDryBul
variable in the weather data reader.
Also reconsider the nominal mass flow rate parameter value in the MixingVolume
given the flow rate information of the ventilation system.
+Finally, make sure that the fan is only active when the damper is open.
diff --git a/IBPSA/Fluid/Interfaces/PartialEightPortInterface.mo b/IBPSA/Fluid/Interfaces/PartialEightPortInterface.mo index d0f37c5a4c..fddc7b6dc3 100644 --- a/IBPSA/Fluid/Interfaces/PartialEightPortInterface.mo +++ b/IBPSA/Fluid/Interfaces/PartialEightPortInterface.mo @@ -1,6 +1,6 @@ within IBPSA.Fluid.Interfaces; partial model PartialEightPortInterface - "Partial model transporting fluid between eight ports without storing mass or energy" + "Partial model with eight ports and declaration of quantities that are used by many models" extends IBPSA.Fluid.Interfaces.EightPort; parameter Modelica.Units.SI.MassFlowRate m1_flow_nominal(min=0) "Nominal mass flow rate" annotation (Dialog(group="Nominal condition")); @@ -163,7 +163,8 @@ protected preferredView="info", Documentation(info="
-This component defines the interface for models that transport four fluid streams between eight ports. +This component defines the interface for models with eight fluid ports +and four fluid streams. It is similar to IBPSA.Fluid.Interfaces.PartialTwoPortInterface, but it has eight ports instead of two.
@@ -173,6 +174,12 @@ mass transfer and pressure drop equations. ", revisions="
allowFlowReversal==false
, removed noEvent()
declaration
for sta_a
and for sta_b
because the variable is either
diff --git a/IBPSA/Fluid/Interfaces/PartialFourPort.mo b/IBPSA/Fluid/Interfaces/PartialFourPort.mo
index 524ee257a9..1d5cb458ca 100644
--- a/IBPSA/Fluid/Interfaces/PartialFourPort.mo
+++ b/IBPSA/Fluid/Interfaces/PartialFourPort.mo
@@ -34,44 +34,26 @@ partial model PartialFourPort "Partial model with four ports"
m_flow(min=if allowFlowReversal1 then -Modelica.Constants.inf else 0),
h_outflow(start = Medium1.h_default, nominal = Medium1.h_default))
"Fluid connector a1 (positive design flow direction is from port_a1 to port_b1)"
- annotation (Placement(transformation(extent={{port_a1_x-10,port_a1_y-10},{port_a1_x+10,port_a1_y+10}})));
+ annotation (Placement(transformation(extent={{-110,50},{-90,70}})));
Modelica.Fluid.Interfaces.FluidPort_b port_b1(
redeclare final package Medium = Medium1,
m_flow(max=if allowFlowReversal1 then +Modelica.Constants.inf else 0),
h_outflow(start = Medium1.h_default, nominal = Medium1.h_default))
"Fluid connector b1 (positive design flow direction is from port_a1 to port_b1)"
- annotation (Placement(transformation(extent={{port_b1_x-10,port_b1_y-10},{port_b1_x+10,port_b1_y+10}})));
+ annotation (Placement(transformation(extent={{110,50},{90,70}})));
Modelica.Fluid.Interfaces.FluidPort_a port_a2(
redeclare final package Medium = Medium2,
m_flow(min=if allowFlowReversal2 then -Modelica.Constants.inf else 0),
h_outflow(start = Medium2.h_default, nominal = Medium2.h_default))
"Fluid connector a2 (positive design flow direction is from port_a2 to port_b2)"
- annotation (Placement(transformation(extent={{port_a2_x-10,port_a2_y-10},{port_a2_x+10,port_a2_y+10}})));
+ annotation (Placement(transformation(extent={{90,-70},{110,-50}})));
Modelica.Fluid.Interfaces.FluidPort_b port_b2(
redeclare final package Medium = Medium2,
m_flow(max=if allowFlowReversal2 then +Modelica.Constants.inf else 0),
h_outflow(start = Medium2.h_default, nominal = Medium2.h_default))
"Fluid connector b2 (positive design flow direction is from port_a2 to port_b2)"
- annotation (Placement(transformation(extent={{port_b2_x-10,port_b2_y-10},{port_b2_x+10,port_b2_y+10}})));
-
-protected
- constant Integer port_a1_x = -100
- "x-coordinate of port_a1 center";
- constant Integer port_a1_y = 60
- "y-coordinate of port_a1 center";
- constant Integer port_b1_x = 100
- "x-coordinate of port_b1 center";
- constant Integer port_b1_y = 60
- "y-coordinate of port_b1 center";
- constant Integer port_a2_x = 100
- "x-coordinate of port_a2 center";
- constant Integer port_a2_y = -60
- "y-coordinate of port_a2 center";
- constant Integer port_b2_x = -100
- "x-coordinate of port_b2 center";
- constant Integer port_b2_y = -60
- "y-coordinate of port_b2 center";
+ annotation (Placement(transformation(extent={{-90,-70},{-110,-50}})));
annotation (
preferredView="info",
@@ -101,11 +83,6 @@ are not implemented.
", revisions="
allowFlowReversal=false
.
diff --git a/IBPSA/Fluid/Interfaces/PartialFourPortInterface.mo b/IBPSA/Fluid/Interfaces/PartialFourPortInterface.mo
index 57e60c4262..e1cdf5d257 100644
--- a/IBPSA/Fluid/Interfaces/PartialFourPortInterface.mo
+++ b/IBPSA/Fluid/Interfaces/PartialFourPortInterface.mo
@@ -1,6 +1,6 @@
within IBPSA.Fluid.Interfaces;
partial model PartialFourPortInterface
- "Partial model transporting fluid between two ports without storing mass or energy"
+ "Partial model with four ports and declaration of quantities that are used by many models"
extends IBPSA.Fluid.Interfaces.PartialFourPort;
parameter Modelica.Units.SI.MassFlowRate m1_flow_nominal(min=0)
"Nominal mass flow rate" annotation (Dialog(group="Nominal condition"));
@@ -90,8 +90,8 @@ protected
preferredView="info",
Documentation(info="
-This component defines the interface for models that -transport two fluid streams between four ports. +This component defines the interface for models with four fluid ports +and two fluid streams. It is similar to IBPSA.Fluid.Interfaces.PartialTwoPortInterface, @@ -104,6 +104,12 @@ mass transfer and pressure drop equations. ", revisions="
allowFlowReversal==false
, removed noEvent()
declaration
for sta_a
and for sta_b
because the variable is either
diff --git a/IBPSA/Fluid/Interfaces/PartialTwoPort.mo b/IBPSA/Fluid/Interfaces/PartialTwoPort.mo
index d2a4f3d8b9..dfa69ce6fc 100644
--- a/IBPSA/Fluid/Interfaces/PartialTwoPort.mo
+++ b/IBPSA/Fluid/Interfaces/PartialTwoPort.mo
@@ -20,23 +20,13 @@ partial model PartialTwoPort "Partial component with two ports"
m_flow(min=if allowFlowReversal then -Modelica.Constants.inf else 0),
h_outflow(start = Medium.h_default, nominal = Medium.h_default))
"Fluid connector a (positive design flow direction is from port_a to port_b)"
- annotation (Placement(transformation(extent={{port_a_x-10,port_a_y-10},{port_a_x+10,port_a_y+10}})));
+ annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
Modelica.Fluid.Interfaces.FluidPort_b port_b(
redeclare final package Medium = Medium,
m_flow(max=if allowFlowReversal then +Modelica.Constants.inf else 0),
h_outflow(start = Medium.h_default, nominal = Medium.h_default))
"Fluid connector b (positive design flow direction is from port_a to port_b)"
- annotation (Placement(transformation(extent={{port_b_x-10,port_b_y-10},{port_b_x+10,port_b_y+10}})));
-
-protected
- constant Integer port_a_x = -100
- "x-coordinate of port_a center";
- constant Integer port_a_y = 0
- "y-coordinate of port_a center";
- constant Integer port_b_x = 100
- "x-coordinate of port_b center";
- constant Integer port_b_y = 0
- "y-coordinate of port_b center";
+ annotation (Placement(transformation(extent={{110,-10},{90,10}})));
annotation (
Documentation(info="
@@ -58,11 +48,6 @@ users have not used this global definition to assign parameters.
", revisions="
-This component defines the interface for models that -transports a fluid between two ports. It is similar to +This component defines the interface for models with two fluid ports. +It is similar to Modelica.Fluid.Interfaces.PartialTwoPortTransport, but it does not include the species balance @@ -71,6 +71,13 @@ include the species balance Thus, it can be used as a base class for a heat and mass transfer component
+The partial model extends
+
+IBPSA.Fluid.Interfaces.PartialTwoPort
+and adds quantities that are used by many models such as
+m_flow_nominal
, m_flow
and dp
.
+
The model is used by other models in this package that add heat transfer, mass transfer and pressure drop equations. See for example @@ -79,6 +86,12 @@ IBPSA.Fluid.Interfaces.StaticTwoPortHeatMassExchanger. ", revisions="
allowFlowReversal==false
, replaced actualStream()
with inStream()
for sta_a
and
diff --git a/IBPSA/Fluid/Interfaces/PartialTwoPortVector.mo b/IBPSA/Fluid/Interfaces/PartialTwoPortVector.mo
index ab193a43eb..f22cb87398 100644
--- a/IBPSA/Fluid/Interfaces/PartialTwoPortVector.mo
+++ b/IBPSA/Fluid/Interfaces/PartialTwoPortVector.mo
@@ -11,7 +11,6 @@ partial model PartialTwoPortVector "Partial component with two ports, one of whi
property_T=293.15,
X_a=0.40)
"Propylene glycol water, 40% mass fraction")));
-
parameter Integer nPorts "Number of ports"
annotation(Evaluate=true, Dialog(connectorSizing=true, tab="General",group="Ports"));
parameter Boolean allowFlowReversal=true
@@ -23,14 +22,14 @@ partial model PartialTwoPortVector "Partial component with two ports, one of whi
m_flow(min=if allowFlowReversal then -Modelica.Constants.inf else 0),
h_outflow(start=Medium.h_default, nominal=Medium.h_default))
"Fluid connector a (positive design flow direction is from port_a to ports_b)"
- annotation (Placement(transformation(extent={{port_a_x-10,port_a_y-10},{port_a_x+10,port_a_y+10}})));
+ annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
Modelica.Fluid.Interfaces.FluidPorts_b ports_b[nPorts](
redeclare each package Medium = Medium,
each m_flow(max=if allowFlowReversal then +Modelica.Constants.inf else 0),
each h_outflow(start=Medium.h_default, nominal=Medium.h_default))
"Fluid connectors b (positive design flow direction is from port_a to ports_b)"
- annotation (Placement(transformation(extent={{port_b_x-10,port_b_y-40},{port_b_x+10,port_b_y+40}})));
+ annotation (Placement(transformation(extent={{90,-40},{110,40}})));
// Diagnostics
parameter Boolean show_T = false
@@ -50,17 +49,6 @@ partial model PartialTwoPortVector "Partial component with two ports, one of whi
noEvent(actualStream(ports_b.h_outflow)),
noEvent(actualStream(ports_b.Xi_outflow)))
if show_T "Medium properties in ports_b";
-
-protected
- constant Integer port_a_x = -100
- "x-coordinate of port_a center";
- constant Integer port_a_y = 0
- "y-coordinate of port_a center";
- constant Integer port_b_x = 100
- "x-coordinate of port_b center";
- constant Integer port_b_y = 0
- "y-coordinate of port_b center";
-
annotation (
Documentation(info="
@@ -85,11 +73,6 @@ users have not used this global definition to assign parameters. ", revisions="
HideResult=true
.
+This partial class implements the same functionality as
+
+IBPSA.Fluid.Interfaces.PartialTwoPortInterface,
+except that port_a
and port_b
are placed at the top and bottom
+of the component.
+
+The implementation is done in this package as opposed to + +IBPSA.Fluid.Interfaces +as it is only used by the storage model, and may be removed when the tool limitations +that are discussed in +IBPSA, #1794. +are removed. +
+", revisions=" +