LBL logo

Buildings.Examples.Tutorial.SpaceCooling

Package with example for how to build a model for space cooling

Information

This package contains examples with step-by-step instructions for how to build a system model for space cooling as shown in the figure below. The temperautures correspond to design conditions that will be used to size the components. The room heat capacity has been increased by a factor of three to approximate the thermal storage effect of furniture and building constructions.

image

The model consists of

  1. a room with a cooling load due to internal heat gains and due to conductive heat gains from the environment,
  2. a fresh air supply with a heat recovery, a cooling coil and a fan. The fan is operating continuously at full speed. The room air temperature is controlled by a controller that switches the water flow rate through the coil on and off with a dead-band of 1 Kelvin.

To explain the implementation of this model, the model has been created in the following three stages:

  1. Buildings.Examples.Tutorial.SpaceCooling.System1 implements the room model without air supply.
  2. Buildings.Examples.Tutorial.SpaceCooling.System2 implements the air supply with open-loop control.
  3. Buildings.Examples.Tutorial.SpaceCooling.System3 adds closed-loop control.

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

Package Content

Name Description
Buildings.Examples.Tutorial.SpaceCooling.System1 System1 First part of the system model, consisting of the room with heat transfer
Buildings.Examples.Tutorial.SpaceCooling.System2 System2 Second part of the system model with air supply and open loop control
Buildings.Examples.Tutorial.SpaceCooling.System3 System3 Third part of the system model with air supply and closed loop control

Buildings.Examples.Tutorial.SpaceCooling.System1 Buildings.Examples.Tutorial.SpaceCooling.System1

First part of the system model, consisting of the room with heat transfer

Buildings.Examples.Tutorial.SpaceCooling.System1

Information

This part of the system model implements the room with a heat gain. The room is simplified as a volume of air, a prescribed heat source for the internal convective heat gain, and a heat conductor for steady-state heat conduction to the outside. To increase the heat capacity of the room, such as due to heat stored in furniture and in building constructions, the heat capacity of the room air was increased by a factor of three. The convective heat transfer coefficient is lumped into the heat conductor model.

Implementation

This section describes step by step how we implemented the model.

  1. First, to define the medium properties, we added the declaration

      replaceable package MediumA = Buildings.Media.Air "Medium for air";
    

    This will allow the propagation of the medium model to all models that contain air. In this example, there is only one model with air, but when we connect an air supply, there will be multiple models that use this medium.

    We called the medium MediumA to distinguish it from MediumW that we will use in later versions of the model for components that have water as a medium. Because we do not anticipate saturated air, we used the medium model Buildings.Media.Air instead of Buildings.Media.GasesPTDecoupled.MoistAir as the latter is computationally more expensive. Note that although the medium model is for unsaturated air, the cooling coil will be able to reduce the moisture content of the medium. But since the air outlet state of the cooling coil has a relative humidity below 100%, we can use this medium model for unsaturated air.

    We also defined the system-level parameters

      parameter Modelica.SIunits.Volume V=6*10*3 "Room volume";
      parameter Modelica.SIunits.MassFlowRate mA_flow_nominal = V*6/3600
        "Nominal mass flow rate";
      parameter Modelica.SIunits.HeatFlowRate QRooInt_flow = 1000
        "Internal heat gains of the room";
    

    to declare that the room volume is 180 m3, that the room has a nominal mass flow rate of 6 air changes per hour and that the internal heat gains of the room are 1000 Watts. These parameters have been declared at the top-level of the model as they will be used in several other models. Declaring them at the top-level allows to propagate them to other models, and to easily change them at one location should this be required when revising the model.

  2. To model the room air, approximated as a completely mixed volume of air, an instance of Buildings.Fluid.MixingVolumes.MixingVolume has been used, as this model can be used with dry air or moist air. The medium model has been set to MediumA. We set the parameter energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial which will cause the initial conditions of the volume to be fixed to the values specified by the parameters on the Initialization tab.

    The nominal mass flow rate of the volume is set to mA_flow_nominal. The nominal mass flow rate is used for numerical reasons and should be set to the approximate order of magnitude. It only has an effect if the mass flow rate is near zero and what "near zero" means depends on the magnitude of m_flow_nominal, as it is used for the default value of the parameter m_flow_small on the Assumptions tag of the model. See also Buildings.Fluid.UsersGuide for an explanation of the purpose of m_flow_small.

  3. To increase the heat capacity of the room air to approximate energy storage in furniture and building constructions, we set the parameter mSenFac=3 in the instance vol. This will increase the sensible heat capacity of the room air by a factor of three.

  4. We used the instance heaCon to model the heat conductance to the ambient. Since our room should have a heat loss of 10 kW at a temperature difference of 30 Kelvin, we set the conductance to G=10000 ⁄ 30 W/K.

  5. Finally, we used the instance preHea to model a prescribed, constant heat gain of 1000 Watts, such as due to internal heat source.

This completes the initial version of the model. When simulating the model for 3 hours, or 10800 seconds, the response shown below should be seen.

image

To verify the correctness of the model, we can compare the simulated results to the following analytical solutions:

  1. At steady-state, the temperature difference to the outside should be Δ T = Q̇ ⁄ UA = 1000/(10000/30) = 3 Kelvin, which corresponds to a room temperature of -7°C.
  2. It can be shown that the time constant of the room is τ = C ⁄ UA = 1950 seconds, where C is the heat capacity of the room air and the thermal storage element that is connected to it, and G is the heat conductance.

Both analytical values agree with the simulation results shown in the above figure.

Notes

For a more realistic model of a room, the model Buildings.Rooms.MixedAir could have been used. For transient heat conduction, models from the package Buildings.HeatTransfer.Conduction could have been used.

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

Parameters

TypeNameDefaultDescription
replaceable package MediumABuildings.Media.AirMedium for air
VolumeV6*10*3Room volume [m3]
MassFlowRatemA_flow_nominalV*6/3600Nominal mass flow rate [kg/s]
HeatFlowRateQRooInt_flow1000Internal heat gains of the room [W]

Connectors

TypeNameDescription
replaceable package MediumAMedium for air

Modelica definition

model System1 "First part of the system model, consisting of the room with heat transfer" extends Modelica.Icons.Example; replaceable package MediumA = Buildings.Media.Air "Medium for air"; Fluid.MixingVolumes.MixingVolume vol( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, V=V, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, mSenFac=3); Modelica.Thermal.HeatTransfer.Components.ThermalConductor theCon(G=10000/30) "Thermal conductance with the ambient"; parameter Modelica.SIunits.Volume V=6*10*3 "Room volume"; parameter Modelica.SIunits.MassFlowRate mA_flow_nominal = V*6/3600 "Nominal mass flow rate"; parameter Modelica.SIunits.HeatFlowRate QRooInt_flow = 1000 "Internal heat gains of the room"; Modelica.Thermal.HeatTransfer.Sources.FixedTemperature TOut(T=263.15) "Outside temperature"; Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow preHea(Q_flow= QRooInt_flow) "Prescribed heat flow"; equation connect(TOut.port, theCon.port_a); connect(theCon.port_b, vol.heatPort); connect(preHea.port, vol.heatPort); end System1;

Buildings.Examples.Tutorial.SpaceCooling.System2 Buildings.Examples.Tutorial.SpaceCooling.System2

Second part of the system model with air supply and open loop control

Buildings.Examples.Tutorial.SpaceCooling.System2

Information

This part of the system model adds a space cooling with open loop control to the model Buildings.Examples.Tutorial.SpaceCooling.System1. The space cooling consist of a model for the ambient conditions out, a heat recovery hex, a cooling coil cooCoi and a fan fan. There is also a return duct that connects the room volume vol with the heat recovery. Weather data are obtained from the instance weaDat which is connected to the model for the ambient air conditions out and the outside temperature that is used for the heat conductance TOut.

In this model, the duct pressure loss is not modeled explicitly, but rather lumped into the pressure drops of the heat exchangers.

Implementation

This section describes the steps that were required to build the model.

  1. The first step was to copy the model Buildings.Examples.Tutorial.SpaceCooling.System1. Note that for larger models, it is recommended to extend models instead of copying them to avoid code duplication, as code duplication makes it hard to maintain different versions of a model. But for this model, we copied the old model to avoid this model to be dependent on Buildings.Examples.Tutorial.SpaceCooling.System1.

  2. As this model will also use water as the medium for the water-side of the cooling coil, we added the medium declaration

      replaceable package MediumW = Buildings.Media.Water "Medium for water";
    
  3. Next, we defined system-level parameters for the water and air temperatures and the water and air mass flow rates. These declarations are essentially the design calculations which are then used to size the components and flow rates. It is good practice to list them at the top-level of the model to allow easy change of temperatures or loads at a central place, and automatic propagation of the new results to models that use these parameters.

    Note that we use an assignment for the nominal air mass flow rate mA_flow_nominal that is different from the assignment in Buildings.Examples.Tutorial.SpaceCooling.System1 because now, the air flow rate is a result of the sizing calculations.

    The calculations are as follows:

      //////////////////////////////////////////////////////////
      // 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=4*
        (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";
    
      /////////////////////////////////////////////////////////
      // Water temperatures and mass flow rates
      parameter Modelica.SIunits.Temperature TWSup_nominal = 273.15+16
        "Water supply temperature";
      parameter Modelica.SIunits.Temperature TWRet_nominal = 273.15+12
        "Water return temperature";
      parameter Modelica.SIunits.MassFlowRate mW_flow_nominal=
        QCoiC_flow_nominal/(TWRet_nominal-TWSup_nominal)/4200
        "Nominal water mass flow rate";
    

Now, we explain the component models that are used to assemble the system model.

  1. The weather data are obtained from the instance weaDat in which we set the location to Chicago, IL. We also configured the model to use a constant atmospheric pressure, as opposed to the pressure from the weather file, as we are not interested in modeling the effect of changes in the atmospheric pressure. Furthermore, we configured the model to use a constant dry-bulb temperature of TOut_nominal. This helps in testing the model at the design conditions, and can easily be changed later to use weather data from the file. Thus, although we use a model that reads a weather data file, for now we want to use constant outside conditions to simplify the testing of the model.

  2. To use weather data for the heat conduction, we changed the instance TOut to a model that allows obtaining the temperature from the input port. To connect this input port to weather data, we added the connector weaBus, as this is needed to pick a single variable, the dry-bulb temperature, from the weather bus which carries all weather data.

  3. To model ambient outside air conditions, we use the instance out which is connected directly to the weather data model weaDat. In this model, we also set the medium model to MediumA.

  4. Next, we set in all new component models the medium model to MediumA if it is part of the air system, or to MediumW if it is part of the water system. From the information section of the cooling coil, we see that its parameter Medium1 needs to be water, and Medium2 needs to be air.

Next, we configured the air-side components of the model.

  1. For the heat recovery hex, we set the effectiveness to the parameter eps, which we defined earlier to be 0.8. We also set the nominal mass flow rates to mA_flow_nominal and the pressure drops on both sides to 200 Pascals. This pressure drop is attained when the air mass flow rate is equal to mA_flow_nominal, and it is adjusted for other flow rates using a quadratic law with regularization when the flow rate is below 10% of mA_flow_nominal. This default value can be changed on the tab Flow resistance of the model.

  2. To configure the cooling coil model cooCoi, we set the water and air side nominal mass flow rates and pressure drops to

        m1_flow_nominal=mW_flow_nominal,
        m2_flow_nominal=mA_flow_nominal,
        dp1_nominal=6000,
        dp2_nominal=200,
    

    This model also requires the specification of the UA-value. We assign this value using the equation

    UA = Q̇ ⁄ lmtd,

    where is the exchanged heat and lmtd is the logarithmic mean temperature difference. The computation of the UA is done using the parameter assignment

      UA_nominal=-QCoiC_flow_nominal/
            Buildings.Fluid.HeatExchangers.BaseClasses.lmtd(
              T_a1=THeaRecLvg,
              T_b1=TASup_nominal,
              T_a2=TWSup_nominal,
              T_b2=TWRet_nominal)
    

    which calls the function Buildings.Fluid.HeatExchangers.BaseClasses.lmtd. In order to see the coil inlet and outlet temperatures, we set the parameter

      show_T = true
    

    Its default value is false, as this setting can lead to faster computation in large system models in which the flow rate crosses zero, because crossing zero triggers the numerical solution for a state-event which can be computationally expensive.

    To use prescribed initial values for the state variables of the cooling coil, we set the parameter

      energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial
    
  3. For the fan, we set the nominal mass flow rate to mA_flow_nominal and also connect its input port to the component mAir_flow, which assigns a constant air flow rate. We leave the fan efficiency at its default value of 0.7. We set the parameter

      energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState
    

    to configure the fan to be a steady-state model. This was done as we are using a constant fan speed in this example.

  4. For the two temperature sensors in the supply duct, we also set the nominal mass flow rate to mA_flow_nominal.

Now, what is left is to configure the water-side components.

  1. We configured the component souWat so that it obtains its mass flow rate from the input connector, and we connected this input connector to the constant block mWat_flow. To set the water temperature that leaves this component, we set the parameter T=TWSup_nominal. Alternatively, we could have used the model Buildings.Fluid.Movers.FlowControlled_m_flow as is used for the fan, but we chose to use the simpler model Buildings.Fluid.Sources.MassFlowSource_T as this model allows the direct specification of the leaving fluid temperature.
  2. To complete the water circuit, we also used the instance sinWat. This model is required for the water to flow out of the heat exchanger into an infinite reservoir. It is also required to set a reference for the pressure of the water loop. Since in our model, no water flows out of this reservoir, there is no need to set its temperature.

This completes the initial version of the model. When simulating the model, the response shown below should be seen.

image

Notes

If we were interested in computing electricity use for the pump, we could have used the same model as for the fan.

To explicitly model duct pressure drop, we could have added Buildings.Fluid.FixedResistances.FixedResistanceDpM to the model. However, computationally it is cheaper to lump these pressure drops into other component models. In fact, rather than separately computing the pressure drop of the heat recovery and the air-side pressure drop of the cooling coil, we could have modeled the cooling coil pressure drop as dp_nominal = 2*200+200 and set for the heat recovery dp1_nominal = 0 and dp2_nominal = 0. Setting the nominal pressure drop to zero will remove this equation from the model.

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

Parameters

TypeNameDefaultDescription
replaceable package MediumABuildings.Media.AirMedium for air
replaceable package MediumWBuildings.Media.WaterMedium for water
VolumeV6*10*3Room volume [m3]
Realeps0.8Heat recovery effectiveness
TemperatureTASup_nominal273.15 + 18Nominal air temperature supplied to room [K]
TemperatureTRooSet273.15 + 24Nominal room air temperature [K]
TemperatureTOut_nominal273.15 + 30Design outlet air temperature [K]
TemperatureTHeaRecLvgTOut_nominal - eps*(TOut_nom...Air temperature leaving the heat recovery [K]
HeatFlowRateQRooInt_flow1000Internal heat gains of the room [W]
HeatFlowRateQRooC_flow_nominal-QRooInt_flow - 10E3/30*(TOu...Nominal cooling load of the room [W]
MassFlowRatemA_flow_nominal1.3*QRooC_flow_nominal/1006/...Nominal air mass flow rate, increased by factor 1.3 to allow for recovery after temperature setback [kg/s]
TemperatureDifferencedTFan2Estimated temperature raise across fan that needs to be made up by the cooling coil [K]
HeatFlowRateQCoiC_flow_nominal4*(QRooC_flow_nominal + mA_f...Cooling load of coil, taking into account economizer, and increased due to latent heat removal [W]
TemperatureTWSup_nominal273.15 + 16Water supply temperature [K]
TemperatureTWRet_nominal273.15 + 12Water return temperature [K]
MassFlowRatemW_flow_nominalQCoiC_flow_nominal/(TWRet_no...Nominal water mass flow rate [kg/s]

Connectors

TypeNameDescription
replaceable package MediumAMedium for air
replaceable package MediumWMedium for water
BusweaBus 

Modelica definition

model System2 "Second part of the system model with air supply and open loop control" extends Modelica.Icons.Example; replaceable package MediumA = Buildings.Media.Air "Medium for air"; replaceable package MediumW = Buildings.Media.Water "Medium for water"; Fluid.MixingVolumes.MixingVolume vol( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, V=V, nPorts=2, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, mSenFac=3); Modelica.Thermal.HeatTransfer.Components.ThermalConductor theCon(G=10000/30) "Thermal conductance with the ambient"; 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=4* (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"; ///////////////////////////////////////////////////////// // Water temperatures and mass flow rates parameter Modelica.SIunits.Temperature TWSup_nominal = 273.15+16 "Water supply temperature"; parameter Modelica.SIunits.Temperature TWRet_nominal = 273.15+12 "Water return temperature"; parameter Modelica.SIunits.MassFlowRate mW_flow_nominal= QCoiC_flow_nominal/(TWRet_nominal-TWSup_nominal)/4200 "Nominal water mass flow rate"; Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TOut "Outside temperature"; Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow preHea(Q_flow= QRooInt_flow) "Prescribed heat flow"; Fluid.Movers.FlowControlled_m_flow fan( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "Supply air fan"; Fluid.HeatExchangers.ConstantEffectiveness hex(redeclare package Medium1 = MediumA, redeclare package Medium2 = MediumA, m1_flow_nominal=mA_flow_nominal, m2_flow_nominal=mA_flow_nominal, dp1_nominal=200, dp2_nominal=200, eps=eps) "Heat recovery"; Fluid.HeatExchangers.WetCoilCounterFlow cooCoi(redeclare package Medium1 = MediumW, redeclare package Medium2 = MediumA, m1_flow_nominal=mW_flow_nominal, m2_flow_nominal=mA_flow_nominal, dp1_nominal=6000, dp2_nominal=200, UA_nominal=-QCoiC_flow_nominal/ Buildings.Fluid.HeatExchangers.BaseClasses.lmtd( T_a1=THeaRecLvg, T_b1=TASup_nominal, T_a2=TWSup_nominal, T_b2=TWRet_nominal), show_T=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Cooling coil"; Fluid.Sources.Outside out(nPorts=2, redeclare package Medium = MediumA); Fluid.Sources.MassFlowSource_T souWat( nPorts=1, redeclare package Medium = MediumW, use_m_flow_in=true, T=TWSup_nominal) "Source for water flow rate"; Fluid.Sources.FixedBoundary sinWat(nPorts=1, redeclare package Medium = MediumW) "Sink for water circuit"; BoundaryConditions.WeatherData.ReaderTMY3 weaDat( pAtmSou=Buildings.BoundaryConditions.Types.DataSource.Parameter, TDryBulSou=Buildings.BoundaryConditions.Types.DataSource.Parameter, TDryBul=TOut_nominal, filNam="modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos") "Weather data reader"; BoundaryConditions.WeatherData.Bus weaBus; Modelica.Blocks.Sources.Constant mAir_flow(k=mA_flow_nominal) "Fan air flow rate"; Modelica.Blocks.Sources.Constant mWat_flow(k=mW_flow_nominal) "Water flow rate"; Fluid.Sensors.TemperatureTwoPort senTemHXOut(redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal) "Temperature sensor for heat recovery outlet on supply side"; Fluid.Sensors.TemperatureTwoPort senTemSupAir(redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal) "Temperature sensor for supply air"; equation connect(theCon.port_b, vol.heatPort); connect(preHea.port, vol.heatPort); connect(fan.port_b, vol.ports[1]); connect(vol.ports[2], hex.port_a2); connect(out.ports[1], hex.port_a1); connect(out.ports[2], hex.port_b2); connect(souWat.ports[1], cooCoi.port_a1); connect(cooCoi.port_b1, sinWat.ports[1]); connect(weaDat.weaBus, out.weaBus); connect(weaDat.weaBus, weaBus); connect(weaBus.TDryBul, TOut.T); connect(fan.m_flow_in, mAir_flow.y); connect(mWat_flow.y, souWat.m_flow_in); connect(hex.port_b1, senTemHXOut.port_a); connect(senTemHXOut.port_b, cooCoi.port_a2); connect(cooCoi.port_b2, senTemSupAir.port_a); connect(senTemSupAir.port_b, fan.port_a); connect(TOut.port, theCon.port_a); end System2;

Buildings.Examples.Tutorial.SpaceCooling.System3 Buildings.Examples.Tutorial.SpaceCooling.System3

Third part of the system model with air supply and closed loop control

Buildings.Examples.Tutorial.SpaceCooling.System3

Information

This part of the system model modifies Buildings.Examples.Tutorial.SpaceCooling.System2 to use the actual outside temperature for a summer day, and it adds closed loop control. The closed loop control measures the room temperature and switches the chilled water flow rate on or off.

Implementation

This section describes how we modified Buildings.Examples.Tutorial.SpaceCooling.System2 to build this model.

  1. The first step was to copy the model Buildings.Examples.Tutorial.SpaceCooling.System2.

  2. Next, we changed in weaDat the parameter that determines whether the outside dry bulb temperature is used from the weather data file or set to a constant value. This can be accomplished in the GUI of the weather data reader as follows:

    image

If the model is now simulated, the following plot could be generated that shows that the room is cooled too much due to the open loop control:

image

To add closed loop control, we proceeded as follows.

  1. First, we made an instance of the on/off controller Modelica.Blocks.Logical.OnOffController and set its name to con. We set the parameter for the bandwidth to 1 Kelvin. This model requires as an input the measured temperature and the set point.

  2. For the set point, we made the instance TRooSetPoi to feed a constant set point into the controller.

  3. The instance senTemRoo has been added to measure the room air temperature. Note that we decided to measure directly the room air temperature. If we would have used a temperature sensor in the return air stream, then its temperature would never change when the mass flow rate is zero, and hence it would not measure how the room temperature changes when the fan is off.

  4. Since the controller output is a boolean signal, but the instance souWat needs a real signal as an input for the water mass flow rate, we needed to add a conversion block. We therefore replaced the instance mWat_flow from a constant block to the block Modelica.Blocks.Math.BooleanToReal. Because the cooling control has a reverse action, i.e., if the measured value exceeds the set point, the system should switch on instead of off, we configured the parameters of the conversion block as follow:

      realTrue=0
      realFalse=mW_flow_nominal
    

    This will output mW_flow_nominal when the room temperature is above the set point, and 0 otherwise.

This completes building the model shown in the figure on Buildings.Examples.Tutorial.SpaceCooling. When simulating the model, the response shown below should be seen.

image
image

Notes

To add a continuous controller for the coil water flow rate, we could have used the model Buildings.Controls.Continuous.LimPID.

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

Parameters

TypeNameDefaultDescription
replaceable package MediumABuildings.Media.AirMedium for air
replaceable package MediumWBuildings.Media.WaterMedium for water
VolumeV6*10*3Room volume [m3]
Realeps0.8Heat recovery effectiveness
TemperatureTASup_nominal273.15 + 18Nominal air temperature supplied to room [K]
TemperatureTRooSet273.15 + 24Nominal room air temperature [K]
TemperatureTOut_nominal273.15 + 30Design outlet air temperature [K]
TemperatureTHeaRecLvgTOut_nominal - eps*(TOut_nom...Air temperature leaving the heat recovery [K]
HeatFlowRateQRooInt_flow1000Internal heat gains of the room [W]
HeatFlowRateQRooC_flow_nominal-QRooInt_flow - 10E3/30*(TOu...Nominal cooling load of the room [W]
MassFlowRatemA_flow_nominal1.3*QRooC_flow_nominal/1006/...Nominal air mass flow rate, increased by factor 1.3 to allow for recovery after temperature setback [kg/s]
TemperatureDifferencedTFan2Estimated temperature raise across fan that needs to be made up by the cooling coil [K]
HeatFlowRateQCoiC_flow_nominal4*(QRooC_flow_nominal + mA_f...Cooling load of coil, taking into account economizer, and increased due to latent heat removal [W]
TemperatureTWSup_nominal273.15 + 16Water supply temperature [K]
TemperatureTWRet_nominal273.15 + 12Water return temperature [K]
MassFlowRatemW_flow_nominalQCoiC_flow_nominal/(TWRet_no...Nominal water mass flow rate [kg/s]

Connectors

TypeNameDescription
replaceable package MediumAMedium for air
replaceable package MediumWMedium for water
BusweaBus 

Modelica definition

model System3 "Third part of the system model with air supply and closed loop control" extends Modelica.Icons.Example; replaceable package MediumA = Buildings.Media.Air "Medium for air"; replaceable package MediumW = Buildings.Media.Water "Medium for water"; Fluid.MixingVolumes.MixingVolume vol( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, V=V, nPorts=2, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyStateInitial, mSenFac=3); Modelica.Thermal.HeatTransfer.Components.ThermalConductor theCon(G=10000/30) "Thermal conductance with the ambient"; 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=4* (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"; ///////////////////////////////////////////////////////// // Water temperatures and mass flow rates parameter Modelica.SIunits.Temperature TWSup_nominal = 273.15+16 "Water supply temperature"; parameter Modelica.SIunits.Temperature TWRet_nominal = 273.15+12 "Water return temperature"; parameter Modelica.SIunits.MassFlowRate mW_flow_nominal= QCoiC_flow_nominal/(TWRet_nominal-TWSup_nominal)/4200 "Nominal water mass flow rate"; Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature TOut "Outside temperature"; Modelica.Thermal.HeatTransfer.Sources.FixedHeatFlow preHea(Q_flow= QRooInt_flow) "Prescribed heat flow"; Fluid.Movers.FlowControlled_m_flow fan( redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) "Supply air fan"; Fluid.HeatExchangers.ConstantEffectiveness hex(redeclare package Medium1 = MediumA, redeclare package Medium2 = MediumA, m1_flow_nominal=mA_flow_nominal, m2_flow_nominal=mA_flow_nominal, dp1_nominal=200, dp2_nominal=200, eps=eps) "Heat recovery"; Fluid.HeatExchangers.WetCoilCounterFlow cooCoi(redeclare package Medium1 = MediumW, redeclare package Medium2 = MediumA, m1_flow_nominal=mW_flow_nominal, m2_flow_nominal=mA_flow_nominal, dp1_nominal=6000, UA_nominal=-QCoiC_flow_nominal/ Buildings.Fluid.HeatExchangers.BaseClasses.lmtd( T_a1=THeaRecLvg, T_b1=TASup_nominal, T_a2=TWSup_nominal, T_b2=TWRet_nominal), dp2_nominal=200, show_T=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Cooling coil"; Fluid.Sources.Outside out(nPorts=2, redeclare package Medium = MediumA); Fluid.Sources.MassFlowSource_T souWat( nPorts=1, redeclare package Medium = MediumW, use_m_flow_in=true, T=TWSup_nominal) "Source for water flow rate"; Fluid.Sources.FixedBoundary sinWat(nPorts=1, redeclare package Medium = MediumW) "Sink for water circuit"; 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 senTemHXOut(redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal) "Temperature sensor for heat recovery outlet on supply side"; Fluid.Sensors.TemperatureTwoPort senTemSupAir(redeclare package Medium = MediumA, m_flow_nominal=mA_flow_nominal) "Temperature sensor for supply air"; Modelica.Blocks.Logical.OnOffController con(bandwidth=1) "Controller for coil water flow rate"; Modelica.Blocks.Sources.Constant TRooSetPoi(k=TRooSet) "Room temperature set point"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor senTemRoo "Room temperature sensor"; Modelica.Blocks.Math.BooleanToReal mWat_flow(realTrue=0, realFalse= mW_flow_nominal) "Conversion from boolean to real for water flow rate"; equation connect(theCon.port_b, vol.heatPort); connect(preHea.port, vol.heatPort); connect(fan.port_b, vol.ports[1]); connect(vol.ports[2], hex.port_a2); connect(out.ports[1], hex.port_a1); connect(out.ports[2], hex.port_b2); connect(souWat.ports[1], cooCoi.port_a1); connect(cooCoi.port_b1, sinWat.ports[1]); connect(weaDat.weaBus, out.weaBus); connect(weaDat.weaBus, weaBus); connect(weaBus.TDryBul, TOut.T); connect(fan.m_flow_in, mAir_flow.y); connect(hex.port_b1, senTemHXOut.port_a); connect(senTemHXOut.port_b, cooCoi.port_a2); connect(cooCoi.port_b2, senTemSupAir.port_a); connect(senTemSupAir.port_b, fan.port_a); connect(TOut.port, theCon.port_a); connect(TRooSetPoi.y, con.reference); connect(vol.heatPort, senTemRoo.port); connect(senTemRoo.T, con.u); connect(con.y, mWat_flow.u); connect(mWat_flow.y, souWat.m_flow_in); end System3;

http://simulationresearch.lbl.gov/modelica