Buildings.Fluid.HeatPumps.ModularReversible.Examples.BaseClasses

Bases package for examples

Information

Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).

Package Content

Name Description
Buildings.Fluid.HeatPumps.ModularReversible.Examples.BaseClasses.OneRoomRadiatorHeatPumpControl OneRoomRadiatorHeatPumpControl Helper model for the control of the system
Buildings.Fluid.HeatPumps.ModularReversible.Examples.BaseClasses.PartialOneRoomRadiator PartialOneRoomRadiator Simple room model with radiator, without a heat pump

Buildings.Fluid.HeatPumps.ModularReversible.Examples.BaseClasses.OneRoomRadiatorHeatPumpControl Buildings.Fluid.HeatPumps.ModularReversible.Examples.BaseClasses.OneRoomRadiatorHeatPumpControl

Helper model for the control of the system

Buildings.Fluid.HeatPumps.ModularReversible.Examples.BaseClasses.OneRoomRadiatorHeatPumpControl

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

TypeNameDefaultDescription
BooleanwitCootrue=true to simulate cooling behaviour
TemperatureTRooSetHea293.15Room set temperature for heating [K]
TemperatureTRooSetCoo296.15Room set temperature for cooling [K]
TemperatureTRadMinSup290.15Minimal radiator supply temperature to avoid condensation effects [K]
TemperatureDifferencedTHysRoo2Temperature hysteresis for room control [K]

Connectors

TypeNameDescription
input RealInputTRooMeaRoom measurement temperature [K]
input RealInputTRadSupRadiator supply temperature [K]
output RealOutputySetHeat pump set speed
output BooleanOutputheaHeat pump in normal mode

Modelica definition

model OneRoomRadiatorHeatPumpControl "Helper model for the control of the system" parameter Boolean witCoo=true "=true to simulate cooling behaviour"; parameter Modelica.Units.SI.Temperature TRooSetHea=293.15 "Room set temperature for heating"; parameter Modelica.Units.SI.Temperature TRooSetCoo=296.15 "Room set temperature for cooling"; parameter Modelica.Units.SI.Temperature TRadMinSup=290.15 "Minimal radiator supply temperature to avoid condensation effects"; parameter Modelica.Units.SI.TemperatureDifference dTHysRoo=2 "Temperature hysteresis for room control"; Modelica.Blocks.Logical.Hysteresis hysHea( final uLow=TRooSetHea - dTHysRoo, final uHigh=TRooSetHea + dTHysRoo, final pre_y_start=false) "Hysteresis controller for heating"; Modelica.Blocks.Logical.Hysteresis hysCoo( final uLow=TRooSetCoo - dTHysRoo, final uHigh=TRooSetCoo + dTHysRoo, final pre_y_start=false) if witCoo "Hysteresis controller for cooling"; Modelica.Blocks.Sources.BooleanConstant conFal(final k=false) if not witCoo "No cooling if witCoo=false"; Modelica.Blocks.Logical.Not heaIsOn "If lower than hysteresis, heating demand"; Modelica.Blocks.Logical.Switch swiHeaCooYSet if witCoo "Switch ySet for heating and cooling"; 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 "PI control for cooling, inverse"; 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)) "PI control for heating"; Modelica.Blocks.Sources.Constant constTSetRooHea(final k=TRooSetHea) "Room set point temperature for heating"; Modelica.Blocks.Sources.Constant constTSetRooCoo(final k=TRooSetCoo) if witCoo "Room set point temperature for cooling"; Modelica.Blocks.Sources.Constant constYSetZer(final k=0) "ySet equals zero"; Modelica.Blocks.Logical.Switch swiYSet "If no demand, switch heat pump off"; Modelica.Blocks.Logical.Switch swiSecForCoo "If in cooling mode, heat pump can't operate below condensing temperature of 15 °C"; Modelica.Blocks.Logical.Hysteresis hysSecCoo( final uLow=TRadMinSup, final uHigh=TRadMinSup + 4, final pre_y_start=false) if witCoo "Hysteresis for avoiding temperatures below 15 °C when cooling"; Modelica.Blocks.Sources.BooleanConstant conTru(final k=true) if not witCoo "No cooling if witCoo=false, then no safety is necessary"; Modelica.Blocks.Interfaces.RealInput TRooMea(unit="K", displayUnit="degC") "Room measurement temperature"; Modelica.Blocks.Interfaces.RealInput TRadSup(displayUnit="degC", unit="K") "Radiator supply temperature"; Modelica.Blocks.Interfaces.RealOutput ySet "Heat pump set speed"; Modelica.Blocks.Interfaces.BooleanOutput hea if witCoo "Heat pump in normal mode"; Modelica.Blocks.Logical.Or heaOrCooIsOn "Heating or cooling is on"; Modelica.Blocks.Logical.Or cooValOrHea "Cooling safety control is used only when the device is not heating"; Modelica.Blocks.Routing.BooleanPassThrough booPasThrCoo "Used for reset of PID"; 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;

Buildings.Fluid.HeatPumps.ModularReversible.Examples.BaseClasses.PartialOneRoomRadiator Buildings.Fluid.HeatPumps.ModularReversible.Examples.BaseClasses.PartialOneRoomRadiator

Simple room model with radiator, without a heat pump

Buildings.Fluid.HeatPumps.ModularReversible.Examples.BaseClasses.PartialOneRoomRadiator

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

TypeNameDefaultDescription
replaceable package MediumAirBuildings.Media.AirMedium model for air
replaceable package MediumWatBuildings.Media.WaterMedium model for water
replaceable package MediumEvaBuildings.Media.WaterMedium model for evaporator-side fluid
HeatFlowRateQ_flow_nominal20000Nominal heat flow rate of radiator [W]
TemperatureTRadSup_nominal273.15 + 50Radiator nominal supply water temperature [K]
TemperatureTRadRet_nominal273.15 + 45Radiator nominal return water temperature [K]
MassFlowRatemCon_flow_nominalQ_flow_nominal/4200/5Heat pump nominal mass flow rate in condenser [kg/s]
MassFlowRatemEva_flow_nominal Heat pump nominal mass flow rate in evaporator [kg/s]
VolumeV6*10*3Room volume [m3]
MassFlowRatemAirRoo_flow_nominalV*1.2*6/3600Nominal mass flow rate of room air [kg/s]
HeatFlowRateQRooInt_flowQ_flow_nominal/5Internal heat gains of the room [W]
BooleanwitCootrue=true to simulate cooling behaviour
FlowControlled_m_flowpumHeaPumpumHeaPum(redeclare package ...Pump for radiator side

Connectors

TypeNameDescription
replaceable package MediumAirMedium model for air
replaceable package MediumWatMedium model for water
replaceable package MediumEvaMedium model for evaporator-side fluid
BusweaBusWeather data bus

Modelica definition

partial model PartialOneRoomRadiator "Simple room model with radiator, without a heat pump" 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 constrainedby Modelica.Media.Interfaces.PartialMedium "Medium model for evaporator-side fluid"; parameter Modelica.Units.SI.HeatFlowRate Q_flow_nominal=20000 "Nominal heat flow rate of radiator"; parameter Modelica.Units.SI.Temperature TRadSup_nominal=273.15 + 50 "Radiator nominal supply water temperature"; parameter Modelica.Units.SI.Temperature TRadRet_nominal=273.15 + 45 "Radiator nominal return water temperature"; parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal=Q_flow_nominal/4200 /5 "Heat pump nominal mass flow rate in condenser"; parameter Modelica.Units.SI.MassFlowRate mEva_flow_nominal(min=Modelica.Constants.eps) "Heat pump nominal mass flow rate in evaporator"; parameter Modelica.Units.SI.Volume V=6*10*3 "Room volume"; parameter Modelica.Units.SI.MassFlowRate mAirRoo_flow_nominal=V*1.2*6/3600 "Nominal mass flow rate of room air"; parameter Modelica.Units.SI.HeatFlowRate QRooInt_flow=Q_flow_nominal/5 "Internal heat gains of the room"; parameter Boolean witCoo=true "=true to simulate cooling behaviour"; //------------------------------------------------------------------------------// 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) "Thermal conductance with the ambient"; Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHea "Prescribed heat flow"; Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heaCap( C=2*V*1.2*1006) "Heat capacity for furniture and walls"; 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]) "Time table for internal heat gain"; 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) "Radiator"; Buildings.Fluid.Sensors.TemperatureTwoPort temSup( redeclare package Medium = MediumWat, m_flow_nominal=mCon_flow_nominal, T_start=TRadSup_nominal) "Supply water temperature"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor temRoo "Room temperature"; //----------------------------------------------------------------------------// 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) "Pump for radiator side"; //----------------------------------------------------------------------------// Buildings.Fluid.Sensors.TemperatureTwoPort temRet( redeclare package Medium = MediumWat, m_flow_nominal=mCon_flow_nominal, T_start=TRadSup_nominal) "Return water temperature"; //------------------------------------------------------------------------------------// Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam= Modelica.Utilities.Files.loadResource( "modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos")) "Weather data reader"; Buildings.BoundaryConditions.WeatherData.Bus weaBus "Weather data bus"; Buildings.HeatTransfer.Sources.PrescribedTemperature TOut "Outside temperature"; //--------------------------------------------------------------------------------------// 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) "Pump for heat pump source side"; Modelica.Blocks.Math.BooleanToReal booToReaPumCon( realTrue=mCon_flow_nominal, y(start=0)) "Pump signal"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = MediumEva, T=281.15, nPorts=1) "Fluid source on source side"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = MediumEva, T=283.15) "Fluid sink on source side"; Buildings.Fluid.Sources.Boundary_pT preSou( redeclare package Medium = MediumWat, T=TRadSup_nominal, nPorts=1) "Source for pressure and to account for thermal expansion of water"; Modelica.Blocks.Math.BooleanToReal booToReaPumEva(realTrue=1, y(start=0)) "Pump signal"; Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow preHeaCoo if witCoo "Prescribed heat flow to trigger cooling"; Modelica.Blocks.Sources.Pulse cooLoa( amplitude=Q_flow_nominal/2, width=10, period=86400, startTime=86400/2) if witCoo "Cooling load with step"; Buildings.Fluid.HeatPumps.ModularReversible.Examples.BaseClasses.OneRoomRadiatorHeatPumpControl oneRooRadHeaPumCtr( final witCoo=witCoo) "Control block for single room heat pump control"; Modelica.Blocks.Sources.BooleanConstant conPumAlwOn(final k=true) "Let the pumps always run, due to inertia of the heat pump"; 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;