Bases package for examples
Information
Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).
Package Content
Name |
Description |
OneRoomRadiatorHeatPumpControl
|
Helper model for the control of the system |
PartialOneRoomRadiator
|
Simple room model with radiator, without a heat pump |
Helper model for the control of the system
Information
Helper control model for the example
Buildings.Fluid.HeatPumps.ModularReversible.Examples.BaseClasses.PartialOneRoomRadiator
The control enables a PI control of the heat pumps compressor
speed for both heating and cooling. Depending on a hysteresis,
the heating or cooling mode is selected.
If the radiator supply temperature drops below a critical
value, the heat pump will turn to heating mode. This prohibits
possible freezing or water condensation.
Parameters
Type | Name | Default | Description |
Boolean | witCoo | true | =true to simulate cooling behaviour |
Temperature | TRooSetHea | 293.15 | Room set temperature for heating [K] |
Temperature | TRooSetCoo | 296.15 | Room set temperature for cooling [K] |
Temperature | TRadMinSup | 290.15 | Minimal radiator supply temperature to avoid condensation effects [K] |
TemperatureDifference | dTHysRoo | 2 | Temperature hysteresis for room control [K] |
Connectors
Type | Name | Description |
input RealInput | TRooMea | Room measurement temperature [K] |
input RealInput | TRadSup | Radiator supply temperature [K] |
output RealOutput | ySet | Heat pump set speed |
output BooleanOutput | hea | Heat pump in normal mode |
Modelica definition
model OneRoomRadiatorHeatPumpControl
parameter Boolean witCoo=true
;
parameter Modelica.Units.SI.Temperature TRooSetHea=293.15
;
parameter Modelica.Units.SI.Temperature TRooSetCoo=296.15
;
parameter Modelica.Units.SI.Temperature TRadMinSup=290.15
;
parameter Modelica.Units.SI.TemperatureDifference dTHysRoo=2
;
Modelica.Blocks.Logical.Hysteresis hysHea(
final uLow=TRooSetHea - dTHysRoo,
final uHigh=TRooSetHea + dTHysRoo,
final pre_y_start=false)
;
Modelica.Blocks.Logical.Hysteresis hysCoo(
final uLow=TRooSetCoo - dTHysRoo,
final uHigh=TRooSetCoo + dTHysRoo,
final pre_y_start=false)
if witCoo
;
Modelica.Blocks.Sources.BooleanConstant conFal(
final k=false)
if not witCoo
;
Modelica.Blocks.Logical.Not heaIsOn
;
Modelica.Blocks.Logical.Switch swiHeaCooYSet
if witCoo
;
Modelica.Blocks.Continuous.LimPID PIDCoo(
controllerType=Modelica.Blocks.Types.SimpleController.PI,
k=0.01,
Ti=800,
yMax=1,
yMin=0.3,
I(use_reset=true, reset=booPasThrCoo.y))
if witCoo
;
Modelica.Blocks.Continuous.LimPID PIDHea(
controllerType=Modelica.Blocks.Types.SimpleController.PI,
k=0.01,
Ti=800,
yMax=1,
yMin=0.3,
I(use_reset=true, reset=hysHea.y))
;
Modelica.Blocks.Sources.Constant constTSetRooHea(
final k=TRooSetHea)
;
Modelica.Blocks.Sources.Constant constTSetRooCoo(
final k=TRooSetCoo)
if witCoo
;
Modelica.Blocks.Sources.Constant constYSetZer(
final k=0) ;
Modelica.Blocks.Logical.Switch swiYSet ;
Modelica.Blocks.Logical.Switch swiSecForCoo
;
Modelica.Blocks.Logical.Hysteresis hysSecCoo(
final uLow=TRadMinSup,
final uHigh=TRadMinSup + 4,
final pre_y_start=false)
if witCoo
;
Modelica.Blocks.Sources.BooleanConstant conTru(
final k=true)
if not witCoo
;
Modelica.Blocks.Interfaces.RealInput TRooMea(unit="K", displayUnit="degC")
;
Modelica.Blocks.Interfaces.RealInput TRadSup(displayUnit="degC", unit="K")
;
Modelica.Blocks.Interfaces.RealOutput ySet ;
Modelica.Blocks.Interfaces.BooleanOutput hea
if witCoo
;
Modelica.Blocks.Logical.Or heaOrCooIsOn ;
Modelica.Blocks.Logical.Or cooValOrHea
;
Modelica.Blocks.Routing.BooleanPassThrough booPasThrCoo ;
equation
connect(hysHea.y, heaIsOn.u);
connect(swiHeaCooYSet.u2, hysCoo.y);
connect(swiYSet.u2, heaOrCooIsOn.y);
connect(heaIsOn.y, heaOrCooIsOn.u1);
connect(PIDHea.u_s,constTSetRooHea. y);
connect(PIDHea.y, swiHeaCooYSet.u3);
connect(constTSetRooCoo.y,PIDCoo. u_m);
connect(swiSecForCoo.u3, constYSetZer.y);
connect(constYSetZer.y, swiYSet.u3);
connect(hysCoo.u, TRooMea);
connect(TRooMea, hysHea.u);
connect(swiSecForCoo.y, ySet);
connect(hysSecCoo.u, TRadSup);
connect(swiYSet.y, swiSecForCoo.u1);
connect(PIDCoo.u_s, TRooMea);
connect(PIDHea.u_m, TRooMea);
connect(PIDCoo.y, swiHeaCooYSet.u1);
connect(swiHeaCooYSet.y, swiYSet.u1);
connect(heaOrCooIsOn.u2, conFal.y);
connect(hysCoo.y, heaOrCooIsOn.u2);
connect(heaIsOn.y, hea);
connect(cooValOrHea.y, swiSecForCoo.u2);
connect(cooValOrHea.u2, conTru.y);
connect(cooValOrHea.u2, hysSecCoo.y);
connect(heaIsOn.y, cooValOrHea.u1);
if not witCoo
then
connect(PIDHea.y, swiYSet.u1);
end if;
connect(hysCoo.y, booPasThrCoo.u);
connect(conFal.y, booPasThrCoo.u);
end OneRoomRadiatorHeatPumpControl;
Simple room model with radiator, without a heat pump
Information
Motivated by the example
Buildings.Fluid.HeatPumps.Examples.ScrollWaterToWater_OneRoomRadiator,
this example enables the use of the ModularReversible
approach for heat pumps and chillers.
Both heating and cooling of the room is possible by using
the reversible approach. For heating, 20 degC room temperature
is the set point, for cooling 23 degC.
The radiator minimal supply temperature is 23 degC.
Parameters
Type | Name | Default | Description |
replaceable package MediumAir | Buildings.Media.Air | Medium model for air |
replaceable package MediumWat | Buildings.Media.Water | Medium model for water |
replaceable package MediumEva | Buildings.Media.Water | Medium model for evaporator-side fluid |
HeatFlowRate | Q_flow_nominal | 20000 | Nominal heat flow rate of radiator [W] |
Temperature | TRadSup_nominal | 273.15 + 50 | Radiator nominal supply water temperature [K] |
Temperature | TRadRet_nominal | 273.15 + 45 | Radiator nominal return water temperature [K] |
MassFlowRate | mCon_flow_nominal | Q_flow_nominal/4200/5 | Heat pump nominal mass flow rate in condenser [kg/s] |
MassFlowRate | mEva_flow_nominal | | Heat pump nominal mass flow rate in evaporator [kg/s] |
Volume | V | 6*10*3 | Room volume [m3] |
MassFlowRate | mAirRoo_flow_nominal | V*1.2*6/3600 | Nominal mass flow rate of room air [kg/s] |
HeatFlowRate | QRooInt_flow | Q_flow_nominal/5 | Internal heat gains of the room [W] |
Boolean | witCoo | true | =true to simulate cooling behaviour |
FlowControlled_m_flow | pumHeaPum | pumHeaPum(redeclare package ... | Pump for radiator side |
Connectors
Type | Name | Description |
replaceable package MediumAir | Medium model for air |
replaceable package MediumWat | Medium model for water |
replaceable package MediumEva | Medium model for evaporator-side fluid |
Bus | weaBus | Weather data bus |
Modelica definition
partial model PartialOneRoomRadiator
replaceable package MediumAir =
Buildings.Media.Air ;
replaceable package MediumWat =
Buildings.Media.Water ;
replaceable package MediumEva =
Buildings.Media.Water
constrainedby Modelica.Media.Interfaces.PartialMedium
;
parameter Modelica.Units.SI.HeatFlowRate Q_flow_nominal=20000
;
parameter Modelica.Units.SI.Temperature TRadSup_nominal=273.15 + 50
;
parameter Modelica.Units.SI.Temperature TRadRet_nominal=273.15 + 45
;
parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal=Q_flow_nominal/4200
/5 ;
parameter Modelica.Units.SI.MassFlowRate mEva_flow_nominal(min=Modelica.Constants.eps)
;
parameter Modelica.Units.SI.Volume V=6*10*3 ;
parameter Modelica.Units.SI.MassFlowRate mAirRoo_flow_nominal=V*1.2*6/3600
;
parameter Modelica.Units.SI.HeatFlowRate QRooInt_flow=Q_flow_nominal/5
;
parameter Boolean witCoo=true ;
Buildings.Fluid.MixingVolumes.MixingVolume vol(
redeclare package Medium =
MediumAir,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
m_flow_nominal=mAirRoo_flow_nominal,
V=V);
Modelica.Thermal.HeatTransfer.Components.ThermalConductor theCon(
G=Q_flow_nominal/40)
;
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHea
;
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heaCap(
C=2*V*1.2*1006)
;
Modelica.Blocks.Sources.CombiTimeTable timTab(
extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic,
smoothness=Modelica.Blocks.Types.Smoothness.ConstantSegments,
table=[-6*3600, 0;
8*3600, QRooInt_flow;
18*3600, 0]) ;
Buildings.Fluid.HeatExchangers.Radiators.RadiatorEN442_2 rad(
redeclare package Medium =
MediumWat,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
Q_flow_nominal=Q_flow_nominal,
T_a_nominal=TRadSup_nominal,
T_b_nominal=TRadRet_nominal,
m_flow_nominal=mCon_flow_nominal,
T_start=TRadSup_nominal) ;
Buildings.Fluid.Sensors.TemperatureTwoPort temSup(
redeclare package Medium =
MediumWat,
m_flow_nominal=mCon_flow_nominal,
T_start=TRadSup_nominal) ;
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temRoo
;
replaceable Buildings.Fluid.Movers.Preconfigured.FlowControlled_m_flow pumHeaPum(
redeclare package Medium =
MediumWat,
m_flow_nominal=mCon_flow_nominal,
m_flow_start=mCon_flow_nominal,
T_start=TRadSup_nominal,
use_riseTime=false,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState)
;
Buildings.Fluid.Sensors.TemperatureTwoPort temRet(
redeclare package Medium =
MediumWat,
m_flow_nominal=mCon_flow_nominal,
T_start=TRadSup_nominal) ;
Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam=
Modelica.Utilities.Files.loadResource(
"modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"))
;
Buildings.BoundaryConditions.WeatherData.Bus weaBus ;
Buildings.HeatTransfer.Sources.PrescribedTemperature TOut
;
Buildings.Fluid.Movers.Preconfigured.FlowControlled_m_flow pumHeaPumSou(
redeclare package Medium =
MediumEva,
m_flow_start=mEva_flow_nominal,
m_flow_nominal=mEva_flow_nominal,
use_riseTime=false,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState)
;
Modelica.Blocks.Math.BooleanToReal booToReaPumCon(
realTrue=mCon_flow_nominal,
y(start=0)) ;
Buildings.Fluid.Sources.Boundary_pT sou(
redeclare package Medium =
MediumEva,
T=281.15,
nPorts=1) ;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare package Medium =
MediumEva,
T=283.15) ;
Buildings.Fluid.Sources.Boundary_pT preSou(
redeclare package Medium =
MediumWat,
T=TRadSup_nominal,
nPorts=1)
;
Modelica.Blocks.Math.BooleanToReal booToReaPumEva(realTrue=1, y(start=0))
;
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaCoo
if witCoo
;
Modelica.Blocks.Sources.Pulse cooLoa(
amplitude=Q_flow_nominal/2,
width=10,
period=86400,
startTime=86400/2)
if witCoo ;
Buildings.Fluid.HeatPumps.ModularReversible.Examples.BaseClasses.OneRoomRadiatorHeatPumpControl
oneRooRadHeaPumCtr(
final witCoo=witCoo)
;
Modelica.Blocks.Sources.BooleanConstant conPumAlwOn(
final k=true)
;
equation
connect(theCon.port_b, vol.heatPort);
connect(preHea.port, vol.heatPort);
connect(heaCap.port, vol.heatPort);
connect(timTab.y[1], preHea.Q_flow);
connect(temSup.port_b, rad.port_a);
connect(temRoo.port, vol.heatPort);
connect(rad.heatPortCon, vol.heatPort);
connect(rad.heatPortRad, vol.heatPort);
connect(weaDat.weaBus, weaBus);
connect(weaBus.TDryBul, TOut.T);
connect(TOut.port, theCon.port_a);
connect(pumHeaPum.port_b, temSup.port_a);
connect(temRet.port_a, rad.port_b);
connect(booToReaPumCon.y, pumHeaPum.m_flow_in);
connect(sou.ports[1], pumHeaPumSou.port_a);
connect(preSou.ports[1], temRet.port_b);
connect(booToReaPumEva.y, pumHeaPumSou.m_flow_in);
connect(cooLoa.y, preHeaCoo.Q_flow);
connect(preHeaCoo.port, heaCap.port);
connect(conPumAlwOn.y, booToReaPumEva.u);
connect(conPumAlwOn.y, booToReaPumCon.u);
connect(oneRooRadHeaPumCtr.TRadSup, temSup.T);
connect(oneRooRadHeaPumCtr.TRooMea, temRoo.T);
end PartialOneRoomRadiator;