LBL logo

Buildings.Fluid.Chillers.BaseClasses

Package with base classes for Buildings.Fluid.Chillers

Information

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

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

Package Content

NameDescription
Buildings.Fluid.Chillers.BaseClasses.PartialElectric PartialElectric Partial model for electric chiller based on the model in DOE-2, CoolTools and EnergyPlus
Buildings.Fluid.Chillers.BaseClasses.warnIfPerformanceOutOfBounds warnIfPerformanceOutOfBounds Function that checks the performance and writes a warning if it is outside of 0.9 to 1.1


Buildings.Fluid.Chillers.BaseClasses.PartialElectric Buildings.Fluid.Chillers.BaseClasses.PartialElectric

Partial model for electric chiller based on the model in DOE-2, CoolTools and EnergyPlus

Buildings.Fluid.Chillers.BaseClasses.PartialElectric

Information

Base class for model of an electric chiller, based on the DOE-2.1 chiller model and the CoolTools chiller model that are implemented in EnergyPlus as the models Chiller:Electric:EIR and Chiller:Electric:ReformulatedEIR.

The model takes as an input the set point for the leaving chilled water temperature, which is met if the chiller has sufficient capacity. Thus, the model has a built-in, ideal temperature control. The model has three tests on the part load ratio and the cycling ratio:

  1. The test
      PLR1 =min(QEva_flow_set/QEva_flow_ava, PLRMax);
    
    ensures that the chiller capacity does not exceed the chiller capacity specified by the parameter PLRMax.
  2. The test
      CR = min(PLR1/per.PRLMin, 1.0);
    
    computes a cycling ratio. This ratio expresses the fraction of time that a chiller would run if it were to cycle because its load is smaller than the minimal load at which it can operature. Notice that this model does continuously operature even if the part load ratio is below the minimum part load ratio. Its leaving evaporator and condenser temperature can therefore be considered as an average temperature between the modes where the compressor is off and on.
  3. The test
      PLR2 = max(PLRMinUnl, PLR1);
    
    computes the part load ratio of the compressor. The assumption is that for a part load ratio below PLRMinUnl, the chiller uses hot gas bypass to reduce the capacity, while the compressor power draw does not change.

The electric power only contains the power for the compressor, but not any power for pumps or fans.

Implementation

Models that extend from this base class need to provide three functions to predict capacity and power consumption:

Extends from Buildings.Fluid.Interfaces.FourPortHeatMassExchanger (Model transporting two fluid streams between four ports with storing mass or energy).

Parameters

TypeNameDefaultDescription
replaceable package Medium1PartialMediumMedium 1 in the component
replaceable package Medium2PartialMediumMedium 2 in the component
Nominal condition
MassFlowRatem1_flow_nominalmCon_flow_nominalNominal mass flow rate [kg/s]
MassFlowRatem2_flow_nominalmEva_flow_nominalNominal mass flow rate [kg/s]
Pressuredp1_nominal Pressure [Pa]
Pressuredp2_nominal Pressure [Pa]
Initialization
MassFlowRatem1_flow.start0Mass flow rate from port_a1 to port_b1 (m1_flow > 0 is design flow direction) [kg/s]
Pressuredp1.start0Pressure difference between port_a1 and port_b1 [Pa]
MassFlowRatem2_flow.start0Mass flow rate from port_a2 to port_b2 (m2_flow > 0 is design flow direction) [kg/s]
Pressuredp2.start0Pressure difference between port_a2 and port_b2 [Pa]
Assumptions
BooleanallowFlowReversal1system.allowFlowReversal= true to allow flow reversal in medium 1, false restricts to design direction (port_a -> port_b)
BooleanallowFlowReversal2system.allowFlowReversal= true to allow flow reversal in medium 2, false restricts to design direction (port_a -> port_b)
Advanced
MassFlowRatem1_flow_small1E-4*abs(m1_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
MassFlowRatem2_flow_small1E-4*abs(m2_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanhomotopyInitializationtrue= true, use homotopy method
Diagnostics
Booleanshow_V_flowfalse= true, if volume flow rate at inflowing port is computed
Booleanshow_Tfalse= true, if actual temperature at port is computed (may lead to events)
Flow resistance
Medium 1
Booleanfrom_dp1false= true, use m_flow = f(dp) else dp = f(m_flow)
BooleanlinearizeFlowResistance1false= true, use linear relation between m_flow and dp for any flow rate
RealdeltaM10.1Fraction of nominal flow rate where flow transitions to laminar
Medium 2
Booleanfrom_dp2false= true, use m_flow = f(dp) else dp = f(m_flow)
BooleanlinearizeFlowResistance2false= true, use linear relation between m_flow and dp for any flow rate
RealdeltaM20.1Fraction of nominal flow rate where flow transitions to laminar
Dynamics
Nominal condition
Timetau130Time constant at nominal flow [s]
Timetau230Time constant at nominal flow [s]
Equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Formulation of energy balance
DynamicsmassDynamicsenergyDynamicsFormulation of mass balance
Initialization
Medium 1
AbsolutePressurep1_startMedium1.p_defaultStart value of pressure [Pa]
TemperatureT1_start273.15 + 25Start value of temperature [K]
MassFractionX1_start[Medium1.nX]Medium1.X_defaultStart value of mass fractions m_i/m [kg/kg]
ExtraPropertyC1_start[Medium1.nC]fill(0, Medium1.nC)Start value of trace substances
ExtraPropertyC1_nominal[Medium1.nC]fill(1E-2, Medium1.nC)Nominal value of trace substances. (Set to typical order of magnitude.)
Medium 2
AbsolutePressurep2_startMedium2.p_defaultStart value of pressure [Pa]
TemperatureT2_start273.15 + 5Start value of temperature [K]
MassFractionX2_start[Medium2.nX]Medium2.X_defaultStart value of mass fractions m_i/m [kg/kg]
ExtraPropertyC2_start[Medium2.nC]fill(0, Medium2.nC)Start value of trace substances
ExtraPropertyC2_nominal[Medium2.nC]fill(1E-2, Medium2.nC)Nominal value of trace substances. (Set to typical order of magnitude.)

Connectors

TypeNameDescription
FluidPort_aport_a1Fluid connector a1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_bport_b1Fluid connector b1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_aport_a2Fluid connector a2 (positive design flow direction is from port_a2 to port_b2)
FluidPort_bport_b2Fluid connector b2 (positive design flow direction is from port_a2 to port_b2)
input BooleanInputonSet to true to enable compressor, or false to disable compressor
input RealInputTSetSet point for leaving chilled water temperature [K]
output RealOutputPElectric power consumed by compressor [W]

Modelica definition

partial model PartialElectric 
  "Partial model for electric chiller based on the model in DOE-2, CoolTools and EnergyPlus"
  extends Buildings.Fluid.Interfaces.FourPortHeatMassExchanger(
   m1_flow_nominal = mCon_flow_nominal,
   m2_flow_nominal = mEva_flow_nominal,
   T1_start = 273.15+25,
   T2_start = 273.15+5,
   redeclare final Buildings.Fluid.MixingVolumes.MixingVolume vol2(
      V=m2_flow_nominal*tau2/rho2_nominal,
      nPorts=2,
      final prescribedHeatFlowRate=true),
    vol1(
      final prescribedHeatFlowRate=true));

  Modelica.Blocks.Interfaces.BooleanInput on 
    "Set to true to enable compressor, or false to disable compressor";
  Modelica.Blocks.Interfaces.RealInput TSet(unit="K", displayUnit="degC") 
    "Set point for leaving chilled water temperature";

  Modelica.SIunits.Temperature TEvaEnt "Evaporator entering temperature";
  Modelica.SIunits.Temperature TEvaLvg "Evaporator leaving temperature";
  Modelica.SIunits.Temperature TConEnt "Condenser entering temperature";
  Modelica.SIunits.Temperature TConLvg "Condenser leaving temperature";

  Real COP(min=0) "Coefficient of performance";
  Modelica.SIunits.HeatFlowRate QCon_flow "Condenser heat input";
  Modelica.SIunits.HeatFlowRate QEva_flow "Evaporator heat input";
  Modelica.Blocks.Interfaces.RealOutput P(unit="W") 
    "Electric power consumed by compressor";

  Real capFunT(min=0, nominal=1, start=1) 
    "Cooling capacity factor function of temperature curve";
  Real EIRFunT(min=0, nominal=1, start=1) 
    "Power input to cooling capacity ratio function of temperature curve";
  Real EIRFunPLR(min=0, nominal=1, start=1) 
    "Power input to cooling capacity ratio function of part load ratio";
  Real PLR1(min=0, nominal=1, start=1) "Part load ratio";
  Real PLR2(min=0, nominal=1, start=1) "Part load ratio";
  Real CR(min=0, nominal=1,  start=1) "Cycling ratio";

protected 
  Modelica.SIunits.HeatFlowRate QEva_flow_ava(nominal=QEva_flow_nominal,start=QEva_flow_nominal) 
    "Cooling capacity available at evaporator";
  Modelica.SIunits.HeatFlowRate QEva_flow_set(nominal=QEva_flow_nominal,start=QEva_flow_nominal) 
    "Cooling capacity required to cool to set point temperature";
  Modelica.SIunits.SpecificEnthalpy hSet 
    "Enthalpy setpoint for leaving chilled water";
  // Performance data
  parameter Modelica.SIunits.HeatFlowRate QEva_flow_nominal(max=0) 
    "Reference capacity (negative number)";
  parameter Real COP_nominal "Reference coefficient of performance";
  parameter Real PLRMax(min=0) "Maximum part load ratio";
  parameter Real PLRMinUnl(min=0) "Minimum part unload ratio";
  parameter Real PLRMin(min=0) "Minimum part load ratio";
  parameter Real etaMotor(min=0, max=1) 
    "Fraction of compressor motor heat entering refrigerant";
  parameter Modelica.SIunits.MassFlowRate mEva_flow_nominal 
    "Nominal mass flow at evaporator";
  parameter Modelica.SIunits.MassFlowRate mCon_flow_nominal 
    "Nominal mass flow at condenser";
  parameter Modelica.SIunits.Temperature TEvaLvg_nominal 
    "Temperature of fluid leaving evaporator at nominal condition";
  final parameter Modelica.SIunits.Conversions.NonSIunits.Temperature_degC
    TEvaLvg_nominal_degC=
    Modelica.SIunits.Conversions.to_degC(TEvaLvg_nominal) 
    "Temperature of fluid leaving evaporator at nominal condition";
  Modelica.SIunits.Conversions.NonSIunits.Temperature_degC TEvaLvg_degC 
    "Temperature of fluid leaving evaporator";
  parameter Modelica.SIunits.HeatFlowRate Q_flow_small = QEva_flow_nominal*1E-9 
    "Small value for heat flow rate or power, used to avoid division by zero";
  Buildings.HeatTransfer.Sources.PrescribedHeatFlow preHeaFloEva 
    "Prescribed heat flow rate";
  Buildings.HeatTransfer.Sources.PrescribedHeatFlow preHeaFloCon 
    "Prescribed heat flow rate";
  Modelica.Blocks.Sources.RealExpression QEva_flow_in(y=QEva_flow) 
    "Evaporator heat flow rate";
  Modelica.Blocks.Sources.RealExpression QCon_flow_in(y=QCon_flow) 
    "Condenser heat flow rate";

initial equation 
  assert(QEva_flow_nominal < 0, "Parameter QEva_flow_nominal must be smaller than zero.");
  assert(PLRMinUnl >= PLRMin, "Parameter PLRMinUnl must be bigger or equal to PLRMin");
  assert(PLRMax > PLRMinUnl, "Parameter PLRMax must be bigger than PLRMinUnl");
equation 
  // Condenser temperatures
  TConEnt = Medium1.temperature(Medium1.setState_phX(port_a1.p, inStream(port_a1.h_outflow)));
  TConLvg = vol1.heatPort.T;
  // Evaporator temperatures
  TEvaEnt = Medium2.temperature(Medium2.setState_phX(port_a2.p, inStream(port_a2.h_outflow)));
  TEvaLvg = vol2.heatPort.T;
  TEvaLvg_degC=Modelica.SIunits.Conversions.to_degC(TEvaLvg);

  // Enthalpy of temperature setpoint
  hSet = Medium2.specificEnthalpy_pTX(port_b2.p, TSet, port_b2.Xi_outflow);

  if on then
    // Available cooling capacity
    QEva_flow_ava = QEva_flow_nominal*capFunT;
    // Cooling capacity required to chill water to setpoint
    QEva_flow_set = min(m2_flow*(hSet-inStream(port_a2.h_outflow)),0);

    // Part load ratio
    PLR1 = min(QEva_flow_set/(QEva_flow_ava+Q_flow_small), PLRMax);
    // PLR2 is the compressor part load ratio. The lower bound PLRMinUnl is
    // since for PLR1<PLRMinUnl, the chiller uses hot gas bypass, under which
    // condition the compressor power is assumed to be the same as if the chiller
    // were to operate at PLRMinUnl
    PLR2 = max(PLRMinUnl, PLR1);
    // Cycling ratio
    CR = min(PLR1/PLRMin,1.0);

    // Compressor power.
    P = -QEva_flow_ava/COP_nominal*EIRFunT*EIRFunPLR*CR;
    // Heat flow rates into evaporator and condenser
    QEva_flow = max(QEva_flow_set, QEva_flow_ava);
    QCon_flow = -QEva_flow + P*etaMotor;
    // Coefficient of performance
    COP = -QEva_flow/(P-Q_flow_small);
  else
    QEva_flow_ava = 0;
    QEva_flow_set = 0;
    PLR1 = 0;
    PLR2 = 0;
    CR   = 0;
    P    = 0;
    QEva_flow = 0;
    QCon_flow = 0;
    COP  = 0;
  end if;

  connect(QCon_flow_in.y, preHeaFloCon.Q_flow);
  connect(preHeaFloCon.port, vol1.heatPort);
  connect(QEva_flow_in.y, preHeaFloEva.Q_flow);
  connect(preHeaFloEva.port, vol2.heatPort);
end PartialElectric;

Buildings.Fluid.Chillers.BaseClasses.warnIfPerformanceOutOfBounds

Function that checks the performance and writes a warning if it is outside of 0.9 to 1.1

Information

This function checks if the numeric argument is outside of the interval 0.9 to 1.1. If this is the case, the function writes a warning.

Inputs

TypeNameDefaultDescription
Realx Argument to be checked
Stringmsg String to be added to warning message
StringcurveName Name of the curve that was tested

Outputs

TypeNameDescription
IntegerretVal0 if x is inside bounds, -1 if it is below bounds, or +1 if it is above bounds

Modelica definition

function warnIfPerformanceOutOfBounds 
  "Function that checks the performance and writes a warning if it is outside of 0.9 to 1.1"
  input Real x "Argument to be checked";
  input String msg "String to be added to warning message";
  input String curveName "Name of the curve that was tested";
  output Integer retVal 
    "0 if x is inside bounds, -1 if it is below bounds, or +1 if it is above bounds";

algorithm 
  if (x > 1.1) then
    retVal :=1;
  elseif ( x < 0.9) then
      retVal :=-1;
  else
    retVal :=0;
  end if;
  if (retVal <> 0) then
      Modelica.Utilities.Streams.print("************************************************************************************");
      Modelica.Utilities.Streams.print("*** Warning: Chiller performance curves at nominal conditions are outside of bounds.");
      Modelica.Utilities.Streams.print(msg + " is outside of bounds 0.9 to 1.1.");
      Modelica.Utilities.Streams.print("The value of the curve fit is " + String(x));
      Modelica.Utilities.Streams.print("Check the coefficients of the function " + curveName);
      Modelica.Utilities.Streams.print("************************************************************************************");

  end if;

end warnIfPerformanceOutOfBounds;

Automatically generated Wed Feb 22 15:21:51 2012.