Description: "Package with base classes for Buildings.Fluid.HeatExchangers.Examples"

- Home > Modelica

## Buildings.Fluid.HeatExchangers.Examples.BaseClasses

Package with base classes for Buildings.Fluid.HeatExchangers.Examples

### Information

This package contains base classes that are used to construct the models in Buildings.Fluid.HeatExchangers.Examples.

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

### Package Content

Name | Description
--- | ---
EffectivenessNTUMassFlow | Partial model of epsilon-NTU coil that tests variable mass flow rates
Heater | Base class for example model for the heater and cooler
WetCoilDiscretized | Model that demonstrates use of a finite volume model of a heat exchanger with condensation

## Buildings.Fluid.HeatExchangers.Examples.BaseClasses.EffectivenessNTUMassFlow

Partial model of epsilon-NTU coil that tests variable mass flow rates

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Temperature | T_a1_nominal | 5 + 273.15 | Nominal water inlet temperature [K]
Temperature | T_b1_nominal | 10 + 273.15 | Nominal water outlet temperature [K]
Temperature | T_a2_nominal | 30 + 273.15 | Nominal air inlet temperature [K]
Temperature | T_b2_nominal | 15 + 273.15 | Nominal air outlet temperature [K]
HeatFlowRate | Q_flow_nominal | m1_flow_nominal*4200*(T_a1_n... | Nominal heat transfer [W]
MassFlowRate | m1_flow_nominal | 0.1 | Nominal mass flow rate medium 1 [kg/s]
MassFlowRate | m2_flow_nominal | m1_flow_nominal*4200/1000*(T... | Nominal mass flow rate medium 2 [kg/s]

### Modelica definition

partial model EffectivenessNTUMassFlow "Partial model of epsilon-NTU coil that tests variable mass flow rates" package Medium1 = Buildings.Media.Water "Medium model for water"; package Medium2 = Buildings.Media.Air "Medium model for air"; parameter Modelica.SIunits.Temperature T_a1_nominal=5 + 273.15 "Nominal water inlet temperature"; parameter Modelica.SIunits.Temperature T_b1_nominal=10 + 273.15 "Nominal water outlet temperature"; parameter Modelica.SIunits.Temperature T_a2_nominal=30 + 273.15 "Nominal air inlet temperature"; parameter Modelica.SIunits.Temperature T_b2_nominal=15 + 273.15 "Nominal air outlet temperature"; parameter Modelica.SIunits.HeatFlowRate Q_flow_nominal = m1_flow_nominal*4200*(T_a1_nominal-T_b1_nominal) "Nominal heat transfer"; parameter Modelica.SIunits.MassFlowRate m1_flow_nominal=0.1 "Nominal mass flow rate medium 1"; parameter Modelica.SIunits.MassFlowRate m2_flow_nominal=m1_flow_nominal*4200/ 1000*(T_a1_nominal - T_b1_nominal)/(T_b2_nominal - T_a2_nominal) "Nominal mass flow rate medium 2"; Sources.MassFlowSource_T sin_2( redeclare package Medium = Medium2, T=T_a2_nominal, use_m_flow_in=true) "Sink for air"; Sources.Boundary_pT sou_2( redeclare package Medium = Medium2, T=T_a2_nominal, X={0.02,1 - 0.02}, use_T_in=true, use_X_in=true) "Source for air"; Sources.MassFlowSource_T sin_1( redeclare package Medium = Medium1, T=T_a1_nominal, use_m_flow_in=true) "Sink for water"; Sources.Boundary_pT sou_1( redeclare package Medium = Medium1, use_T_in=false, T=T_a1_nominal) "Source for water"; Modelica.Blocks.Sources.Constant relHum(k=0.8) "Relative humidity"; Buildings.Utilities.Psychrometrics.X_pTphi x_pTphi(use_p_in=false); Modelica.Blocks.Sources.Constant temSou_2(k=T_a2_nominal) "Temperature boundary condition"; Modelica.Blocks.Math.Gain mWat_flow(k=-m1_flow_nominal) "Water mass flow rate"; Modelica.Blocks.Sources.TimeTable mWatGai( table=[0,1; 3600*0.1,1; 3600*0.2,0.01; 3600*0.3,0.01]) "Gain for water mass flow rate"; Modelica.Blocks.Sources.TimeTable mAirGai( table=[0,1; 3600*0.5,1; 3600*0.6,-1; 3600*0.7,0; 3600*1,0]) "Gain for air mass flow rate"; Modelica.Blocks.Math.Gain mAir_flow(k=-m2_flow_nominal) "Air mass flow rate"; equation connect(x_pTphi.X, sou_2.X_in); connect(relHum.y, x_pTphi.phi); connect(temSou_2.y, x_pTphi.T); connect(temSou_2.y, sou_2.T_in); connect(mWatGai.y, mWat_flow.u); connect(mWat_flow.y, sin_1.m_flow_in); connect(mAirGai.y, mAir_flow.u); connect(mAir_flow.y, sin_2.m_flow_in); end EffectivenessNTUMassFlow;

## Buildings.Fluid.HeatExchangers.Examples.BaseClasses.Heater

Base class for example model for the heater and cooler

### Information

This partial model is used to construct the models Buildings.Fluid.HeatExchangers.Examples.Heater_T and Buildings.Fluid.HeatExchangers.Examples.Heater_u. It consists of an air volume with heat loss to the ambient, a fan, a set point for the room air temperature and a PI controller.

The instance `bou` is required to set a reference pressure for system models in which the air is modelled as an incompressible fluid.

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Volume | VRoo | 6*6*2.7 | Room volume [m3]
MassFlowRate | m_flow_nominal | VRoo*1.2*6/3600 | Nominal mass flow rate [kg/s]
HeatFlowRate | Q_flow_nominal | 30*6*6 | Nominal heat loss of the room [W]

### Modelica definition

partial model Heater "Base class for example model for the heater and cooler" package Medium = Buildings.Media.Air "Medium model"; parameter Modelica.SIunits.Volume VRoo = 6*6*2.7 "Room volume"; parameter Modelica.SIunits.MassFlowRate m_flow_nominal = VRoo*1.2*6/3600 "Nominal mass flow rate"; parameter Modelica.SIunits.HeatFlowRate Q_flow_nominal = 30*6*6 "Nominal heat loss of the room"; Buildings.Fluid.MixingVolumes.MixingVolume vol( V=VRoo, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, mSenFac=2, nPorts=3); Modelica.Thermal.HeatTransfer.Components.ThermalConductor theCon( G=Q_flow_nominal/20) "Thermal conductance to the outside"; Buildings.HeatTransfer.Sources.PrescribedTemperature TBou "Fixed temperature boundary condition"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TVol "Sensor for volume temperature"; Buildings.Fluid.Movers.FlowControlled_m_flow fan( redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal, addPowerToMedium=false, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "Fan"; Modelica.Blocks.Sources.RealExpression TOut(y=273.15 + 16 - 5*cos(time/86400* 2*Modelica.Constants.pi)) "Outdoor temperature"; Modelica.Blocks.Sources.Pulse TSet( amplitude=4, period=86400, offset=273.15 + 16, startTime=7*3600) "Setpoint for room temperature"; Controls.Continuous.LimPID conPI( controllerType=Modelica.Blocks.Types.SimpleController.PI, k=1, yMax=1, yMin=0, Ti=120) "Controller"; Modelica.Blocks.Sources.Constant mFan_flow(k=m_flow_nominal) "Mass flow rate of the fan"; Sources.FixedBoundary bou(redeclare package Medium = Medium, nPorts=1) "Fixed pressure boundary condition, required to set a reference pressure"; Sensors.TemperatureTwoPort THeaOut(redeclare package Medium = Medium, m_flow_nominal=m_flow_nominal) "Outlet temperature of the heater"; equation connect(theCon.port_a, TBou.port); connect(vol.heatPort, theCon.port_b); connect(vol.heatPort, TVol.port); connect(TOut.y, TBou.T); connect(TVol.T, conPI.u_m); connect(TSet.y, conPI.u_s); connect(mFan_flow.y, fan.m_flow_in); connect(THeaOut.port_b, vol.ports[1]); connect(vol.ports[2], fan.port_a); connect(bou.ports[1], vol.ports[3]); end Heater;

## Buildings.Fluid.HeatExchangers.Examples.BaseClasses.WetCoilDiscretized

Model that demonstrates use of a finite volume model of a heat exchanger with condensation

### Information

This is the base model that is used to test the initialization of the coil model. There are three instances of the coil model, each having different settings for the initial conditions.

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium2 | Modelica.Media.Interfaces.Pa... | Medium for air-side
Temperature | T_a1_nominal | 5 + 273.15 | Water inlet temperature [K]
Temperature | T_b1_nominal | 10 + 273.15 | Water outlet temperature [K]
Temperature | T_a2_nominal | 30 + 273.15 | Air inlet temperature [K]
Temperature | T_b2_nominal | 10 + 273.15 | Air inlet temperature [K]
MassFlowRate | m1_flow_nominal | 5 | Nominal mass flow rate water-side [kg/s]
MassFlowRate | m2_flow_nominal | m1_flow_nominal*4200/1000*(T... | Nominal mass flow rate air-side [kg/s]

### Connectors

Type | Name | Description
--- | --- | ---
replaceable package Medium2 | Medium for air-side

### Modelica definition

partial model WetCoilDiscretized "Model that demonstrates use of a finite volume model of a heat exchanger with condensation" package Medium1 = Buildings.Media.Water "Medium for water-side"; replaceable package Medium2 = Modelica.Media.Interfaces.PartialMedium "Medium for air-side"; parameter Modelica.SIunits.Temperature T_a1_nominal = 5+273.15 "Water inlet temperature"; parameter Modelica.SIunits.Temperature T_b1_nominal = 10+273.15 "Water outlet temperature"; parameter Modelica.SIunits.Temperature T_a2_nominal = 30+273.15 "Air inlet temperature"; parameter Modelica.SIunits.Temperature T_b2_nominal = 10+273.15 "Air inlet temperature"; parameter Modelica.SIunits.MassFlowRate m1_flow_nominal = 5 "Nominal mass flow rate water-side"; parameter Modelica.SIunits.MassFlowRate m2_flow_nominal= m1_flow_nominal*4200/1000*(T_a1_nominal-T_b1_nominal)/(T_b2_nominal-T_a2_nominal) "Nominal mass flow rate air-side"; Buildings.Fluid.HeatExchangers.WetCoilDiscretized hexFixIni( redeclare package Medium1 = Medium1, redeclare package Medium2 = Medium2, m1_flow_nominal=m1_flow_nominal, m2_flow_nominal=m2_flow_nominal, dp2_nominal(displayUnit="Pa") = 200, nPipPar=1, nPipSeg=3, nReg=2, dp1_nominal(displayUnit="Pa") = 5000, UA_nominal=m1_flow_nominal*4200*(T_a1_nominal - T_b1_nominal)/ Buildings.Fluid.HeatExchangers.BaseClasses.lmtd( T_a1_nominal, T_b1_nominal, T_a2_nominal, T_b2_nominal), energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, show_T=true) "Coil with fixed initial conditions"; Sources.MassFlowSource_T sin_2( redeclare package Medium = Medium2, nPorts=1, use_m_flow_in=true, T=303.15); Buildings.Fluid.Sources.Boundary_pT sou_2( redeclare package Medium = Medium2, nPorts=1, T=293.15); Modelica.Blocks.Sources.Ramp TWat( duration=60, height=15, offset=273.15 + 5, startTime=0) "Water temperature"; Sources.MassFlowSource_T sin_1( redeclare package Medium = Medium1, nPorts=1, use_m_flow_in=true, T=293.15); Buildings.Fluid.Sources.Boundary_pT sou_1( redeclare package Medium = Medium1, p=300000 + 5000, use_T_in=true, T=293.15, nPorts=1); Buildings.Fluid.HeatExchangers.WetCoilDiscretized hexSteStaIni( redeclare package Medium1 = Medium1, redeclare package Medium2 = Medium2, m1_flow_nominal=m1_flow_nominal, m2_flow_nominal=m2_flow_nominal, dp2_nominal(displayUnit="Pa") = 200, nPipPar=1, nPipSeg=3, nReg=2, dp1_nominal(displayUnit="Pa") = 5000, UA_nominal=m1_flow_nominal*4200*(T_a1_nominal - T_b1_nominal)/ Buildings.Fluid.HeatExchangers.BaseClasses.lmtd( T_a1_nominal, T_b1_nominal, T_a2_nominal, T_b2_nominal), energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyStateInitial, show_T=true) "Coil with fixed initial conditions"; Sources.MassFlowSource_T sin_3( redeclare package Medium = Medium2, nPorts=1, use_m_flow_in=true, T=303.15); Buildings.Fluid.Sources.Boundary_pT sou_3( redeclare package Medium = Medium2, nPorts=1, T=293.15); Sources.MassFlowSource_T sin_4( redeclare package Medium = Medium1, nPorts=1, use_m_flow_in=true, T=293.15); Buildings.Fluid.Sources.Boundary_pT sou_4( redeclare package Medium = Medium1, p=300000 + 5000, use_T_in=true, T=293.15, nPorts=1); Buildings.Fluid.HeatExchangers.WetCoilDiscretized hexSteSta( redeclare package Medium1 = Medium1, redeclare package Medium2 = Medium2, m1_flow_nominal=m1_flow_nominal, m2_flow_nominal=m2_flow_nominal, dp2_nominal(displayUnit="Pa") = 200, nPipPar=1, nPipSeg=3, nReg=2, dp1_nominal(displayUnit="Pa") = 5000, UA_nominal=m1_flow_nominal*4200*(T_a1_nominal - T_b1_nominal)/ Buildings.Fluid.HeatExchangers.BaseClasses.lmtd( T_a1_nominal, T_b1_nominal, T_a2_nominal, T_b2_nominal), energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState, show_T=true) "Coil with fixed initial conditions"; Sources.MassFlowSource_T sin_5( redeclare package Medium = Medium2, nPorts=1, use_m_flow_in=true, T=303.15); Buildings.Fluid.Sources.Boundary_pT sou_5( redeclare package Medium = Medium2, nPorts=1, T=293.15); Sources.MassFlowSource_T sin_6( redeclare package Medium = Medium1, nPorts=1, use_m_flow_in=true, T=293.15); Buildings.Fluid.Sources.Boundary_pT sou_6( redeclare package Medium = Medium1, p=300000 + 5000, use_T_in=true, T=293.15, nPorts=1); Modelica.Blocks.Sources.Ramp m2_flow( duration=60, startTime=60, height=1.1*m2_flow_nominal, offset=-m2_flow_nominal) "Air mass flow rate"; Modelica.Blocks.Sources.Ramp m1_flow( duration=60, startTime=180, height=1.1*m1_flow_nominal, offset=-m1_flow_nominal) "Water mass flow rate"; equation connect(TWat.y, sou_1.T_in); connect(sou_1.ports[1], hexFixIni.port_a1); connect(sou_2.ports[1], hexFixIni.port_a2); connect(hexFixIni.port_b1, sin_1.ports[1]); connect(hexFixIni.port_b2, sin_2.ports[1]); connect(TWat.y,sou_4. T_in); connect(sou_4.ports[1], hexSteStaIni.port_a1); connect(sou_3.ports[1], hexSteStaIni.port_a2); connect(hexSteStaIni.port_b1, sin_4.ports[1]); connect(TWat.y,sou_6. T_in); connect(sou_6.ports[1], hexSteSta.port_a1); connect(sou_5.ports[1], hexSteSta.port_a2); connect(hexSteSta.port_b1, sin_6.ports[1]); connect(hexSteSta.port_b2, sin_5.ports[1]); connect(hexSteStaIni.port_b2, sin_3.ports[1]); connect(m2_flow.y, sin_2.m_flow_in); connect(m2_flow.y, sin_3.m_flow_in); connect(m2_flow.y, sin_5.m_flow_in); connect(m1_flow.y, sin_1.m_flow_in); connect(m1_flow.y, sin_4.m_flow_in); connect(m1_flow.y, sin_6.m_flow_in); end WetCoilDiscretized;