Description: "Package with example of DX cooling coil models"

- Home > Modelica

## Buildings.Fluid.HeatExchangers.DXCoils.Examples

Package with example of DX cooling coil models

### Information

This package contains examples that use DX cooling coil models.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

### Package Content

Name | Description
--- | ---
MultiStage | Test model for multi stage DX coil
SingleSpeed | Test model for single speed DX coil
SpaceCooling | Space cooling with DX coils
VariableSpeed | Test model for variable speed DX coil
PerformanceCurves | Package with sevral performance curves

## Buildings.Fluid.HeatExchangers.DXCoils.Examples.MultiStage

Test model for multi stage DX coil

### Information

This is a test model for Buildings.Fluid.HeatExchangers.DXCoils.MultiStage. The model has open-loop control and time-varying input conditions.

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
MassFlowRate | m_flow_nominal | datCoi.sta[datCoi.nSta].nomV... | Nominal mass flow rate [kg/s]
Pressure | dp_nominal | 1000 | Pressure drop at m_flow_nominal [Pa]

### Modelica definition

model MultiStage "Test model for multi stage DX coil" package Medium = Buildings.Media.Air; extends Modelica.Icons.Example; parameter Modelica.SIunits.MassFlowRate m_flow_nominal = datCoi.sta[datCoi.nSta].nomVal.m_flow_nominal "Nominal mass flow rate"; parameter Modelica.SIunits.Pressure dp_nominal = 1000 "Pressure drop at m_flow_nominal"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=1, p(displayUnit="Pa") = 101325, T=293.15) "Sink"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, nPorts=1, p(displayUnit="Pa") = 101325 + dp_nominal, use_T_in=true, use_p_in=true, T=299.85) "Source"; Buildings.Fluid.HeatExchangers.DXCoils.MultiStage mulStaDX( redeclare package Medium = Medium, dp_nominal=dp_nominal, datCoi=datCoi, T_start=datCoi.sta[1].nomVal.TEvaIn_nominal, show_T=true, from_dp=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Multispeed DX coil"; Modelica.Blocks.Sources.Ramp TEvaIn( duration=600, startTime=2400, height=-5, offset=273.15 + 23) "Temperature"; Modelica.Blocks.Sources.Ramp p( duration=600, startTime=600, height=dp_nominal, offset=101325) "Pressure"; Data.Generic.DXCoil datCoi(nSta=4, sta={ Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.Stage( spe=900/60, nomVal= Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.NominalValues( Q_flow_nominal=-12000, COP_nominal=3, SHR_nominal=0.8, m_flow_nominal=0.9), perCur= Buildings.Fluid.HeatExchangers.DXCoils.Examples.PerformanceCurves.Curve_I()), Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.Stage( spe=1200/60, nomVal= Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.NominalValues( Q_flow_nominal=-18000, COP_nominal=3, SHR_nominal=0.8, m_flow_nominal=1.2), perCur= Buildings.Fluid.HeatExchangers.DXCoils.Examples.PerformanceCurves.Curve_I()), Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.Stage( spe=1800/60, nomVal= Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.NominalValues( Q_flow_nominal=-21000, COP_nominal=3, SHR_nominal=0.8, m_flow_nominal=1.5), perCur= Buildings.Fluid.HeatExchangers.DXCoils.Examples.PerformanceCurves.Curve_II()), Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.Stage( spe=2400/60, nomVal= Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.NominalValues( Q_flow_nominal=-30000, COP_nominal=3, SHR_nominal=0.8, m_flow_nominal=1.8), perCur= Buildings.Fluid.HeatExchangers.DXCoils.Examples.PerformanceCurves.Curve_III())}) "Coil data"; Modelica.Blocks.Sources.IntegerTable speRat(table=[ 0.0,0.0; 900,1; 1800,4; 2700,3; 3600,2]) "Speed ratio "; Modelica.Blocks.Sources.Constant TConIn(k=273.15 + 25) "Condensor inlet temperature"; equation connect(sou.ports[1], mulStaDX.port_a); connect(mulStaDX.port_b, sin.ports[1]); connect(TEvaIn.y, sou.T_in); connect(p.y, sou.p_in); connect(speRat.y, mulStaDX.stage); connect(TConIn.y, mulStaDX.TConIn); end MultiStage;

## Buildings.Fluid.HeatExchangers.DXCoils.Examples.SingleSpeed

Test model for single speed DX coil

### Information

This is a test model for Buildings.Fluid.HeatExchangers.DXCoils.SingleSpeed. The model has open-loop control and time-varying input conditions.

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
MassFlowRate | m_flow_nominal | datCoi.sta[datCoi.nSta].nomV... | Nominal mass flow rate [kg/s]
Pressure | dp_nominal | 1000 | Pressure drop at m_flow_nominal [Pa]

### Modelica definition

model SingleSpeed "Test model for single speed DX coil" package Medium = Buildings.Media.Air; extends Modelica.Icons.Example; parameter Modelica.SIunits.MassFlowRate m_flow_nominal = datCoi.sta[datCoi.nSta].nomVal.m_flow_nominal "Nominal mass flow rate"; parameter Modelica.SIunits.Pressure dp_nominal = 1000 "Pressure drop at m_flow_nominal"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, p(displayUnit="Pa") = 101325, nPorts=1, T=303.15) "Sink"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, p(displayUnit="Pa") = 101325 + dp_nominal, use_T_in=true, nPorts=1, use_p_in=true, T=299.85) "Source"; Modelica.Blocks.Sources.BooleanStep onOff(startTime=600) "Compressor on-off signal"; Modelica.Blocks.Sources.Ramp TEvaIn( duration=600, startTime=2400, height=-5, offset=273.15 + 23) "Temperature"; Buildings.Fluid.HeatExchangers.DXCoils.SingleSpeed sinSpeDX( redeclare package Medium = Medium, dp_nominal=dp_nominal, datCoi=datCoi, T_start=datCoi.sta[1].nomVal.TEvaIn_nominal, show_T=true, from_dp=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Single speed DX coil"; Modelica.Blocks.Sources.Ramp p( duration=600, startTime=600, height=dp_nominal, offset=101325) "Pressure"; Data.Generic.DXCoil datCoi( sta={ Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.Stage( spe=1800/60, nomVal= Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.NominalValues( Q_flow_nominal=-21000, COP_nominal=3, SHR_nominal=0.8, m_flow_nominal=1.5), perCur= Buildings.Fluid.HeatExchangers.DXCoils.Examples.PerformanceCurves.Curve_II())}, nSta= 1) "Coil data"; Modelica.Blocks.Sources.Constant TConIn(k=273.15 + 25) "Condensor inlet temperature"; equation connect(TEvaIn.y, sou.T_in); connect(onOff.y, sinSpeDX.on); connect(sou.ports[1], sinSpeDX.port_a); connect(sinSpeDX.port_b, sin.ports[1]); connect(p.y, sou.p_in); connect(TConIn.y, sinSpeDX.TConIn); end SingleSpeed;

## Buildings.Fluid.HeatExchangers.DXCoils.Examples.SpaceCooling

Space cooling with DX coils

### Information

This model illustrates the use of the DX coil models with single speed compressor, multi-stage compressor, and variable speed compressor. The three systems all have the same simple model for a room, and the same HVAC components, except for the coil. The top system has a DX coil with single speed compressor and on/off control with dead-band. The middle system has a DX coil with two stages, each representing a different compressor speed. The bottom system has a DX coil with variable speed control for the compressor.

All coils are controlled based on the respective room air temperature. The plot below shows how room air temperatures and humidity levels are controlled with the respective coils. The single speed coil has the highest room air humidity level because during its off-time, water that accumulated on the coil evaporates into the air stream. This effect is smaller for the coil with two compressor stages and for the coil with variable compressor speed, as both of these coils switch off less frequent.

#### Implementation

The model is based on Buildings.Examples.Tutorial.SpaceCooling.System3.

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | Buildings.Media.Air |
Volume | V | 6*10*3 | Room volume [m3]
Real | eps | 0.8 | Heat recovery effectiveness
Temperature | TASup_nominal | 273.15 + 18 | Nominal air temperature supplied to room [K]
Temperature | TRooSet | 273.15 + 24 | Nominal room air temperature [K]
Temperature | TOut_nominal | 273.15 + 30 | Design outlet air temperature [K]
Temperature | THeaRecLvg | TOut_nominal - eps*(TOut_nom... | Air temperature leaving the heat recovery [K]
HeatFlowRate | QRooInt_flow | 1000 | Internal heat gains of the room [W]
HeatFlowRate | QRooC_flow_nominal | -QRooInt_flow - 10E3/30*(TOu... | Nominal cooling load of the room [W]
MassFlowRate | mA_flow_nominal | 1.3*QRooC_flow_nominal/1006/... | Nominal air mass flow rate, increased by factor 1.3 to allow for recovery after temperature setback [kg/s]
TemperatureDifference | dTFan | 2 | Estimated temperature raise across fan that needs to be made up by the cooling coil [K]
HeatFlowRate | QCoiC_flow_nominal | (QRooC_flow_nominal + mA_flo... | Cooling load of coil, taking into account economizer, and increased due to latent heat removal [W]
DXCoil | datCoiMulSpe |  | Coil data

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package Medium |
Bus | weaBus |

### Modelica definition

model SpaceCooling "Space cooling with DX coils" extends Modelica.Icons.Example; replaceable package Medium = Buildings.Media.Air; parameter Modelica.SIunits.Volume V=6*10*3 "Room volume"; ////////////////////////////////////////////////////////// // Heat recovery effectiveness parameter Real eps = 0.8 "Heat recovery effectiveness"; ///////////////////////////////////////////////////////// // Air temperatures at design conditions parameter Modelica.SIunits.Temperature TASup_nominal = 273.15+18 "Nominal air temperature supplied to room"; parameter Modelica.SIunits.Temperature TRooSet = 273.15+24 "Nominal room air temperature"; parameter Modelica.SIunits.Temperature TOut_nominal = 273.15+30 "Design outlet air temperature"; parameter Modelica.SIunits.Temperature THeaRecLvg= TOut_nominal - eps*(TOut_nominal-TRooSet) "Air temperature leaving the heat recovery"; ///////////////////////////////////////////////////////// // Cooling loads and air mass flow rates parameter Modelica.SIunits.HeatFlowRate QRooInt_flow= 1000 "Internal heat gains of the room"; parameter Modelica.SIunits.HeatFlowRate QRooC_flow_nominal= -QRooInt_flow-10E3/30*(TOut_nominal-TRooSet) "Nominal cooling load of the room"; parameter Modelica.SIunits.MassFlowRate mA_flow_nominal= 1.3*QRooC_flow_nominal/1006/(TASup_nominal-TRooSet) "Nominal air mass flow rate, increased by factor 1.3 to allow for recovery after temperature setback"; parameter Modelica.SIunits.TemperatureDifference dTFan = 2 "Estimated temperature raise across fan that needs to be made up by the cooling coil"; parameter Modelica.SIunits.HeatFlowRate QCoiC_flow_nominal= (QRooC_flow_nominal + mA_flow_nominal*(TASup_nominal-THeaRecLvg-dTFan)*1006) "Cooling load of coil, taking into account economizer, and increased due to latent heat removal"; Buildings.Fluid.Movers.FlowControlled_m_flow fan(redeclare package Medium = Medium, m_flow_nominal=mA_flow_nominal, dynamicBalance=false) "Supply air fan"; Fluid.HeatExchangers.ConstantEffectiveness hex(redeclare package Medium1 = Medium, redeclare package Medium2 = Medium, m1_flow_nominal=mA_flow_nominal, m2_flow_nominal=mA_flow_nominal, dp1_nominal=200, dp2_nominal=200, eps=eps) "Heat recovery"; Fluid.Sources.Outside out(nPorts=6, redeclare package Medium = Medium); BoundaryConditions.WeatherData.ReaderTMY3 weaDat( pAtmSou=Buildings.BoundaryConditions.Types.DataSource.Parameter, TDryBul=TOut_nominal, filNam="modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos", TDryBulSou=Buildings.BoundaryConditions.Types.DataSource.File) "Weather data reader"; BoundaryConditions.WeatherData.Bus weaBus; Modelica.Blocks.Sources.Constant mAir_flow(k=mA_flow_nominal) "Fan air flow rate"; Fluid.Sensors.TemperatureTwoPort senTemHXEvaOut(redeclare package Medium = Medium, m_flow_nominal=mA_flow_nominal) "Temperature sensor for heat recovery outlet on supply side"; Fluid.Sensors.TemperatureTwoPort senTemSupAir(redeclare package Medium = Medium, m_flow_nominal=mA_flow_nominal) "Temperature sensor for supply air"; Modelica.Blocks.Logical.OnOffController con(bandwidth=1, pre_y_start=true) "Controller for coil water flow rate"; Modelica.Blocks.Sources.Constant TRooSetPoi(k=TRooSet) "Room temperature set point"; Buildings.Fluid.HeatExchangers.DXCoils.SingleSpeed sinSpeDX( redeclare package Medium = Medium, datCoi=datCoi, dp_nominal=400, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial); SimpleRoom rooSinSpe( redeclare package Medium = Medium, nPorts=2, QRooInt_flow=QRooInt_flow, mA_flow_nominal=mA_flow_nominal) "Room model connected to single speed coil"; Buildings.Fluid.Movers.FlowControlled_m_flow fan1( redeclare package Medium = Medium, m_flow_nominal=mA_flow_nominal, dynamicBalance=false) "Supply air fan"; Fluid.HeatExchangers.ConstantEffectiveness hex1( redeclare package Medium1 = Medium, redeclare package Medium2 = Medium, m1_flow_nominal=mA_flow_nominal, m2_flow_nominal=mA_flow_nominal, dp1_nominal=200, dp2_nominal=200, eps=eps) "Heat recovery"; Fluid.Sensors.TemperatureTwoPort senTemHXEvaOut1( redeclare package Medium = Medium, m_flow_nominal=mA_flow_nominal) "Temperature sensor for heat recovery outlet on supply side"; Fluid.Sensors.TemperatureTwoPort senTemSupAir1( redeclare package Medium = Medium, m_flow_nominal=mA_flow_nominal) "Temperature sensor for supply air"; Buildings.Fluid.HeatExchangers.DXCoils.MultiStage mulStaDX( redeclare package Medium = Medium, dp_nominal=400, datCoi=datCoiMulSpe, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Multi-speed DX coil"; SimpleRoom rooMulSpe( redeclare package Medium = Medium, nPorts=2, QRooInt_flow=QRooInt_flow, mA_flow_nominal=mA_flow_nominal) "Room model connected to multi stage coil"; Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.DXCoil datCoi( sta={ Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.Stage( spe=1800/60, nomVal= Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.NominalValues( Q_flow_nominal=QCoiC_flow_nominal, COP_nominal=3, SHR_nominal=0.7, m_flow_nominal=mA_flow_nominal), perCur= Buildings.Fluid.HeatExchangers.DXCoils.Examples.PerformanceCurves.Curve_I())}, nSta=1); parameter Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.DXCoil datCoiMulSpe(nSta=2, sta= {Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.Stage( spe=900/60, nomVal= Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.NominalValues( Q_flow_nominal=QCoiC_flow_nominal*900/2400, COP_nominal=3, SHR_nominal=0.7, m_flow_nominal=mA_flow_nominal*900/2400), perCur= Buildings.Fluid.HeatExchangers.DXCoils.Examples.PerformanceCurves.Curve_I()), Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.Stage( spe=2400/60, nomVal= Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.NominalValues( Q_flow_nominal=QCoiC_flow_nominal, COP_nominal=3, SHR_nominal=0.7, m_flow_nominal=mA_flow_nominal), perCur= Buildings.Fluid.HeatExchangers.DXCoils.Examples.PerformanceCurves.Curve_III())}) "Coil data"; ControllerTwoStage mulSpeCon "Controller for multi-stage coil"; SimpleRoom rooVarSpe( redeclare package Medium = Medium, nPorts=2, QRooInt_flow=QRooInt_flow, mA_flow_nominal=mA_flow_nominal) "Room model connected to variable speed coil"; Buildings.Fluid.Movers.FlowControlled_m_flow fan2( redeclare package Medium = Medium, m_flow_nominal=mA_flow_nominal, dynamicBalance=false) "Supply air fan"; Fluid.Sensors.TemperatureTwoPort senTemSupAir2( redeclare package Medium = Medium, m_flow_nominal=mA_flow_nominal) "Temperature sensor for supply air"; Buildings.Fluid.HeatExchangers.DXCoils.VariableSpeed varSpeDX( redeclare package Medium = Medium, dp_nominal=400, datCoi=datCoiMulSpe, minSpeRat=0.2, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Variable-speed DX coil"; Fluid.Sensors.TemperatureTwoPort senTemHXEvaOut2( redeclare package Medium = Medium, m_flow_nominal=mA_flow_nominal) "Temperature sensor for heat recovery outlet on supply side"; Fluid.HeatExchangers.ConstantEffectiveness hex2( redeclare package Medium1 = Medium, redeclare package Medium2 = Medium, m1_flow_nominal=mA_flow_nominal, m2_flow_nominal=mA_flow_nominal, dp1_nominal=200, dp2_nominal=200, eps=eps) "Heat recovery"; Modelica.Blocks.Continuous.Integrator sinSpePow(y(unit="J")) "Power consumed by single speed coil"; Modelica.Blocks.Continuous.Integrator mulSpePow(y(unit="J")) "Power consumed by multi-stage coil"; Modelica.Blocks.Continuous.Integrator varSpePow(y(unit="J")) "Power consumed by multi-stage coil"; Modelica.Blocks.Logical.Not not1; Buildings.Controls.Continuous.LimPID conVarSpe( controllerType=Modelica.Blocks.Types.SimpleController.P, Ti=1, Td=1, reverseAction=true) "Controller for variable speed DX coil"; equation connect(out.ports[1], hex.port_a1); connect(out.ports[2], hex.port_b2); connect(weaDat.weaBus, out.weaBus); connect(weaDat.weaBus, weaBus); connect(fan.m_flow_in, mAir_flow.y); connect(hex.port_b1, senTemHXEvaOut.port_a); connect(senTemSupAir.port_b, fan.port_a); connect(senTemHXEvaOut.port_b, sinSpeDX.port_a); connect(sinSpeDX.port_b, senTemSupAir.port_a); public model SimpleRoom "Simple model of a room" replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the room"; Buildings.Fluid.MixingVolumes.MixingVolume vol( redeclare package Medium = Medium, m_flow_nominal=mA_flow_nominal, V=V, nPorts=2, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial); Modelica.Thermal.HeatTransfer.Components.ThermalConductor theCon(G=10000/30) "Thermal conductance with the ambient"; Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TOut "Outside temperature"; Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow preHea(Q_flow= QRooInt_flow) "Prescribed heat flow"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor senTemRoo "Room temperature sensor"; Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heaCap(C=2*V*1.2*1006) "Heat capacity for furniture and walls"; parameter Integer nPorts=0 "Number of ports"; final parameter Modelica.SIunits.Volume V=6*10*3 "Room volume"; parameter Modelica.SIunits.HeatFlowRate QRooInt_flow "Internal heat gains of the room"; parameter Modelica.SIunits.MassFlowRate mA_flow_nominal "Nominal air mass flow rate"; Modelica.Blocks.Interfaces.RealInput TOutDryBul "Outdoor drybulb temperature"; Modelica.Blocks.Interfaces.RealOutput TRoo(unit="K") "Room temperature"; Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b ports[nPorts](redeclare each package Medium = Medium); equation connect(theCon.port_b,vol. heatPort); connect(preHea.port,vol. heatPort); connect(TOut.port,theCon. port_a); connect(vol.heatPort,senTemRoo. port); connect(heaCap.port,vol. heatPort); connect(TRoo, senTemRoo.T); connect(ports, vol.ports); connect(TOut.T, TOutDryBul); end SimpleRoom; equation connect(sinSpeDX.TConIn, weaBus.TDryBul); connect(fan.port_b, rooSinSpe.ports[1]); connect(rooSinSpe.ports[2], hex.port_a2); connect(hex1.port_b1, senTemHXEvaOut1.port_a); connect(senTemSupAir1.port_b, fan1.port_a); connect(senTemHXEvaOut1.port_b, mulStaDX.port_a); connect(mulStaDX.port_b, senTemSupAir1.port_a); connect(mulStaDX.TConIn, weaBus.TDryBul); connect(fan1.port_b, rooMulSpe.ports[1]); connect(rooMulSpe.ports[2], hex1.port_a2); connect(rooMulSpe.TOutDryBul, weaBus.TDryBul); public model ControllerTwoStage "Controller for two stage coil" parameter Real bandwidth=1 "Bandwidth around reference signal"; extends Buildings.BaseClasses.BaseIcon; Modelica.Blocks.Logical.OnOffController con1(bandwidth=bandwidth/2, pre_y_start=true) "Controller for coil water flow rate"; Modelica.Blocks.Logical.OnOffController con2(bandwidth=bandwidth/2, pre_y_start=true) "Controller for coil water flow rate"; Modelica.Blocks.Interfaces.RealInput u; Modelica.Blocks.Interfaces.RealInput reference "Connector of Real input signal used as reference signal"; Modelica.Blocks.Math.Add add(k2=-1); Modelica.Blocks.Sources.Constant const(k=bandwidth/2); Modelica.Blocks.Math.Add add1; Modelica.Blocks.MathInteger.MultiSwitch multiSwitch1( expr={2,1}, y_default=0, use_pre_as_default=false, nu=2); Modelica.Blocks.Interfaces.IntegerOutput stage "Coil stage control signal"; Modelica.Blocks.Logical.Not not1; Modelica.Blocks.Logical.Not not2; equation connect(con1.reference, reference); connect(const.y, add.u2); connect(const.y, add1.u1); connect(add.u1, u); connect(add1.u2, u); connect(add.y, con1.u); connect(add1.y, con2.u); connect(reference, con2.reference); connect(multiSwitch1.y, stage); connect(not2.y, multiSwitch1.u[1]); connect(not1.y, multiSwitch1.u[2]); connect(con1.y, not1.u); connect(con2.y, not2.u); end ControllerTwoStage; equation connect(mulSpeCon.stage, mulStaDX.stage); connect(rooVarSpe.TOutDryBul, weaBus.TDryBul); connect(senTemSupAir2.port_b,fan2. port_a); connect(varSpeDX.port_b, senTemSupAir2.port_a); connect(senTemHXEvaOut2.port_b, varSpeDX.port_a); connect(varSpeDX.TConIn, weaBus.TDryBul); connect(hex2.port_b1,senTemHXEvaOut2. port_a); connect(out.ports[3], hex1.port_a1); connect(out.ports[4], hex1.port_b2); connect(out.ports[5], hex2.port_a1); connect(out.ports[6], hex2.port_b2); connect(fan2.port_b, rooVarSpe.ports[1]); connect(rooVarSpe.ports[2], hex2.port_a2); connect(mAir_flow.y, fan1.m_flow_in); connect(mAir_flow.y, fan2.m_flow_in); connect(rooSinSpe.TOutDryBul, weaBus.TDryBul); connect(sinSpePow.u, sinSpeDX.P); connect(mulSpePow.u, mulStaDX.P); connect(varSpeDX.P, varSpePow.u); connect(TRooSetPoi.y, con.reference); connect(rooSinSpe.TRoo, con.u); connect(not1.u, con.y); connect(not1.y, sinSpeDX.on); connect(mulSpeCon.reference, TRooSetPoi.y); connect(rooMulSpe.TRoo, mulSpeCon.u); connect(TRooSetPoi.y, conVarSpe.u_s); connect(conVarSpe.u_m, rooVarSpe.TRoo); connect(conVarSpe.y, varSpeDX.speRat); end SpaceCooling;

## Buildings.Fluid.HeatExchangers.DXCoils.Examples.VariableSpeed

Test model for variable speed DX coil

### Information

This is a test model for Buildings.Fluid.HeatExchangers.DXCoils.VariableSpeed. The model has open-loop control and time-varying input conditions.

Extends from Modelica.Icons.Example (Icon for runnable examples).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
MassFlowRate | m_flow_nominal | datCoi.sta[datCoi.nSta].nomV... | Nominal mass flow rate [kg/s]
Pressure | dp_nominal | 1000 | Pressure drop at m_flow_nominal [Pa]

### Modelica definition

model VariableSpeed "Test model for variable speed DX coil" package Medium = Buildings.Media.Air; extends Modelica.Icons.Example; parameter Modelica.SIunits.MassFlowRate m_flow_nominal = datCoi.sta[datCoi.nSta].nomVal.m_flow_nominal "Nominal mass flow rate"; parameter Modelica.SIunits.Pressure dp_nominal = 1000 "Pressure drop at m_flow_nominal"; Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=1, p(displayUnit="Pa") = 101325, T=293.15) "Sink"; Buildings.Fluid.Sources.Boundary_pT sou( redeclare package Medium = Medium, nPorts=1, p(displayUnit="Pa") = 101325 + dp_nominal, use_T_in=true, use_p_in=true, T=299.85) "Source"; Buildings.Fluid.HeatExchangers.DXCoils.VariableSpeed varSpeDX( redeclare package Medium = Medium, dp_nominal=dp_nominal, datCoi=datCoi, minSpeRat=datCoi.minSpeRat, T_start=datCoi.sta[1].nomVal.TEvaIn_nominal, from_dp=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Variable speed DX coil"; Modelica.Blocks.Sources.Ramp TEvaIn( duration=600, startTime=900, height=5, offset=273.15 + 20, y(unit="K")) "temperature"; Modelica.Blocks.Sources.TimeTable speRat(table=[0.0,0.0; 100,0.0; 900,0.2; 1800,0.8; 2700,0.75; 3600,0.75]) "Speed ratio "; Modelica.Blocks.Sources.Ramp p( duration=600, height=dp_nominal, offset=101325, startTime=100) "Mass flow rate of air"; Data.Generic.DXCoil datCoi(nSta=4, sta={ Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.Stage( spe=900/60, nomVal= Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.NominalValues( Q_flow_nominal=-12000, COP_nominal=3, SHR_nominal=0.8, m_flow_nominal=0.9), perCur= Buildings.Fluid.HeatExchangers.DXCoils.Examples.PerformanceCurves.Curve_I()), Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.Stage( spe=1200/60, nomVal= Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.NominalValues( Q_flow_nominal=-18000, COP_nominal=3, SHR_nominal=0.8, m_flow_nominal=1.2), perCur= Buildings.Fluid.HeatExchangers.DXCoils.Examples.PerformanceCurves.Curve_I()), Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.Stage( spe=1800/60, nomVal= Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.NominalValues( Q_flow_nominal=-21000, COP_nominal=3, SHR_nominal=0.8, m_flow_nominal=1.5), perCur= Buildings.Fluid.HeatExchangers.DXCoils.Examples.PerformanceCurves.Curve_II()), Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.Stage( spe=2400/60, nomVal= Buildings.Fluid.HeatExchangers.DXCoils.Data.Generic.BaseClasses.NominalValues( Q_flow_nominal=-30000, COP_nominal=3, SHR_nominal=0.8, m_flow_nominal=1.8), perCur= Buildings.Fluid.HeatExchangers.DXCoils.Examples.PerformanceCurves.Curve_III())}) "Coil data"; Modelica.Blocks.Sources.Constant TConIn(k=273.15 + 25) "Condensor inlet temperature"; equation connect(sou.ports[1], varSpeDX.port_a); connect(varSpeDX.port_b, sin.ports[1]); connect(TEvaIn.y, sou.T_in); connect(speRat.y, varSpeDX.speRat); connect(p.y, sou.p_in); connect(varSpeDX.TConIn, TConIn.y); end VariableSpeed;

## Buildings.Fluid.HeatExchangers.DXCoils.Examples.SpaceCooling.SimpleRoom

Simple model of a room

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | Modelica.Media.Interfaces.Pa... | Medium in the room
HeatFlowRate | QRooInt_flow |  | Internal heat gains of the room [W]
MassFlowRate | mA_flow_nominal |  | Nominal air mass flow rate [kg/s]

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package Medium | Medium in the room
input RealInput | TOutDryBul | Outdoor drybulb temperature
output RealOutput | TRoo | Room temperature [K]
VesselFluidPorts_b | ports[nPorts] |

### Modelica definition

model SimpleRoom "Simple model of a room" replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the room"; Buildings.Fluid.MixingVolumes.MixingVolume vol( redeclare package Medium = Medium, m_flow_nominal=mA_flow_nominal, V=V, nPorts=2, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial); Modelica.Thermal.HeatTransfer.Components.ThermalConductor theCon(G=10000/30) "Thermal conductance with the ambient"; Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TOut "Outside temperature"; Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow preHea(Q_flow= QRooInt_flow) "Prescribed heat flow"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor senTemRoo "Room temperature sensor"; Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heaCap(C=2*V*1.2*1006) "Heat capacity for furniture and walls"; parameter Integer nPorts=0 "Number of ports"; final parameter Modelica.SIunits.Volume V=6*10*3 "Room volume"; parameter Modelica.SIunits.HeatFlowRate QRooInt_flow "Internal heat gains of the room"; parameter Modelica.SIunits.MassFlowRate mA_flow_nominal "Nominal air mass flow rate"; Modelica.Blocks.Interfaces.RealInput TOutDryBul "Outdoor drybulb temperature"; Modelica.Blocks.Interfaces.RealOutput TRoo(unit="K") "Room temperature"; Modelica.Fluid.Vessels.BaseClasses.VesselFluidPorts_b ports[nPorts](redeclare each package Medium = Medium); equation connect(theCon.port_b,vol. heatPort); connect(preHea.port,vol. heatPort); connect(TOut.port,theCon. port_a); connect(vol.heatPort,senTemRoo. port); connect(heaCap.port,vol. heatPort); connect(TRoo, senTemRoo.T); connect(ports, vol.ports); connect(TOut.T, TOutDryBul); end SimpleRoom;

## Buildings.Fluid.HeatExchangers.DXCoils.Examples.SpaceCooling.ControllerTwoStage

Controller for two stage coil

### Information

Extends from Buildings.BaseClasses.BaseIcon (Base icon).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Real | bandwidth | 1 | Bandwidth around reference signal

### Connectors

Type | Name | Description
--- | --- | ---
input RealInput | u |
input RealInput | reference | Connector of Real input signal used as reference signal
output IntegerOutput | stage | Coil stage control signal

### Modelica definition

model ControllerTwoStage "Controller for two stage coil" parameter Real bandwidth=1 "Bandwidth around reference signal"; extends Buildings.BaseClasses.BaseIcon; Modelica.Blocks.Logical.OnOffController con1(bandwidth=bandwidth/2, pre_y_start=true) "Controller for coil water flow rate"; Modelica.Blocks.Logical.OnOffController con2(bandwidth=bandwidth/2, pre_y_start=true) "Controller for coil water flow rate"; Modelica.Blocks.Interfaces.RealInput u; Modelica.Blocks.Interfaces.RealInput reference "Connector of Real input signal used as reference signal"; Modelica.Blocks.Math.Add add(k2=-1); Modelica.Blocks.Sources.Constant const(k=bandwidth/2); Modelica.Blocks.Math.Add add1; Modelica.Blocks.MathInteger.MultiSwitch multiSwitch1( expr={2,1}, y_default=0, use_pre_as_default=false, nu=2); Modelica.Blocks.Interfaces.IntegerOutput stage "Coil stage control signal"; Modelica.Blocks.Logical.Not not1; Modelica.Blocks.Logical.Not not2; equation connect(con1.reference, reference); connect(const.y, add.u2); connect(const.y, add1.u1); connect(add.u1, u); connect(add1.u2, u); connect(add.y, con1.u); connect(add1.y, con2.u); connect(reference, con2.reference); connect(multiSwitch1.y, stage); connect(not2.y, multiSwitch1.u[1]); connect(not1.y, multiSwitch1.u[2]); connect(con1.y, not1.u); connect(con2.y, not2.u); end ControllerTwoStage;