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

Name Description
Buildings.Fluid.Chillers.BaseClasses.AbsorptionIndirectSteam AbsorptionIndirectSteam Absorption indirect chiller performance curve method
Buildings.Fluid.Chillers.BaseClasses.Carnot Carnot  
Buildings.Fluid.Chillers.BaseClasses.PartialCarnot_T PartialCarnot_T Partial model for chiller with performance curve adjusted based on Carnot efficiency
Buildings.Fluid.Chillers.BaseClasses.PartialCarnot_y PartialCarnot_y Partial chiller model with performance curve adjusted based on Carnot efficiency
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.AbsorptionIndirectSteam Buildings.Fluid.Chillers.BaseClasses.AbsorptionIndirectSteam

Absorption indirect chiller performance curve method

Buildings.Fluid.Chillers.BaseClasses.AbsorptionIndirectSteam

Information

Block that computes the performance for the model Buildings.Fluid.Chillers.AbsorptionIndirectSteam. See Buildings.Fluid.Chillers.AbsorptionIndirectSteam for a description of this model.

Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).

Parameters

TypeNameDefaultDescription
Genericper Performance data
HeatFlowRateQ_flow_small Small value for heat flow rate or power, used to avoid division by zero [W]

Connectors

TypeNameDescription
input BooleanInputonSet to true to enable the absorption chiller
input RealInputTConEntCondenser entering water temperature [K]
input RealInputTEvaLvgEvaporator leaving water temperature [K]
input RealInputQEva_flow_setEvaporator setpoint heat flow rate [W]
output RealOutputQCon_flowCondenser heat flow rate [W]
output RealOutputQEva_flowEvaporator heat flow rate [W]
output RealOutputQGen_flowRequired generator heat flow rate [W]
output RealOutputPPump power [W]
output RealOutputPLRPart load ratio [1]
output RealOutputCRCycling ratio [1]

Modelica definition

block AbsorptionIndirectSteam "Absorption indirect chiller performance curve method" extends Modelica.Blocks.Icons.Block; parameter Buildings.Fluid.Chillers.Data.AbsorptionIndirectSteam.Generic per "Performance data"; parameter Modelica.Units.SI.HeatFlowRate Q_flow_small "Small value for heat flow rate or power, used to avoid division by zero"; Modelica.Blocks.Interfaces.BooleanInput on "Set to true to enable the absorption chiller"; Modelica.Blocks.Interfaces.RealInput TConEnt( final unit="K", displayUnit="degC") "Condenser entering water temperature"; Modelica.Blocks.Interfaces.RealInput TEvaLvg( final unit="K", displayUnit="degC") "Evaporator leaving water temperature"; Modelica.Blocks.Interfaces.RealInput QEva_flow_set(final unit="W") "Evaporator setpoint heat flow rate"; Modelica.Blocks.Interfaces.RealOutput QCon_flow(final unit="W") "Condenser heat flow rate "; Modelica.Blocks.Interfaces.RealOutput QEva_flow(final unit="W") "Evaporator heat flow rate"; Modelica.Blocks.Interfaces.RealOutput QGen_flow(final unit="W") "Required generator heat flow rate"; Modelica.Blocks.Interfaces.RealOutput P(final unit="W") "Pump power"; Modelica.Blocks.Interfaces.RealOutput PLR(min=0, final unit="1") "Part load ratio"; Modelica.Blocks.Interfaces.RealOutput CR(min=0, final unit="1") "Cycling ratio"; Modelica.Units.SI.Efficiency genHIR "Ratio of the generator heat input to chiller operating capacity"; Modelica.Units.SI.Efficiency EIRP(min=0) "Ratio of the actual absorber pumping power to the nominal pumping power"; Real capFunEva(min=0) "Evaporator capacity factor function of temperature curve"; Real capFunCon(min=0) "Condenser capacity factor function of temperature curve"; Real genConT(min=0) "Heat input modifier based on the generator input temperature"; Real genEvaT(min=0) "Heat input modifier based on the evaporator outlet temperature"; Modelica.Units.SI.HeatFlowRate QEva_flow_ava "Cooling capacity available at the evaporator"; protected Modelica.Units.NonSI.Temperature_degC TConEnt_degC "Condenser entering water temperature in degC"; Modelica.Units.NonSI.Temperature_degC TEvaLvg_degC "Evaporator leaving water temperature in degC"; initial equation assert(per.QEva_flow_nominal < 0, "In " + getInstanceName() + ": Parameter QEva_flow_nominal must be smaller than zero."); assert(Q_flow_small > 0, "In " + getInstanceName() + ": Parameter Q_flow_small must be larger than zero."); equation TConEnt_degC=Modelica.Units.Conversions.to_degC(TConEnt); TEvaLvg_degC=Modelica.Units.Conversions.to_degC(TEvaLvg); if on then capFunEva = Buildings.Utilities.Math.Functions.smoothMax( x1 = 1E-6, x2 = Buildings.Utilities.Math.Functions.polynomial(x=TEvaLvg_degC, a=per.capFunEva), deltaX = Q_flow_small); capFunCon = Buildings.Utilities.Math.Functions.smoothMax( x1 = 1E-6, x2 = Buildings.Utilities.Math.Functions.polynomial(x=TConEnt_degC, a=per.capFunCon), deltaX = Q_flow_small); QEva_flow_ava = per.QEva_flow_nominal*capFunEva*capFunCon; QEva_flow = Buildings.Utilities.Math.Functions.smoothMax( x1 = QEva_flow_set, x2 = QEva_flow_ava, deltaX = Q_flow_small); PLR =Buildings.Utilities.Math.Functions.smoothMin( x1=QEva_flow_set/(QEva_flow_ava - Q_flow_small), x2=per.PLRMax, deltaX=per.PLRMax/100); genHIR = per.genHIR[1]+ per.genHIR[2]*PLR+per.genHIR[3]*PLR^2+per.genHIR[4]*PLR^3; genConT = Buildings.Utilities.Math.Functions.polynomial(x=TConEnt_degC, a=per.genConT); genEvaT = Buildings.Utilities.Math.Functions.polynomial(x=TEvaLvg_degC, a=per.genEvaT); EIRP = Buildings.Utilities.Math.Functions.polynomial(x=PLR, a=per.EIRP); CR = Buildings.Utilities.Math.Functions.smoothMin( x1 = PLR/per.PLRMin, x2 = 1, deltaX = 0.001); QGen_flow = -QEva_flow_ava * genHIR * genConT * genEvaT * CR; P = EIRP * per.P_nominal * CR; QCon_flow = -QEva_flow + QGen_flow + P; else capFunEva = 0; capFunCon = 0; QEva_flow_ava = 0; QEva_flow = 0; PLR = 0; genHIR = per.genHIR[1]; genConT = 1; genEvaT = 1; EIRP = 0; CR = 0; QGen_flow = 0; P = 0; QCon_flow = 0; end if; end AbsorptionIndirectSteam;

Buildings.Fluid.Chillers.BaseClasses.Carnot Buildings.Fluid.Chillers.BaseClasses.Carnot


Buildings.Fluid.Chillers.BaseClasses.Carnot

Information

This is the base class for the Carnot chiller and the Carnot heat pump whose coefficient of performance COP changes with temperatures in the same way as the Carnot efficiency changes.

Set use_eta_Carnot_nominal=true to specify directly the Carnot effectiveness ηCarnot,0, in which case the value of the parameter COP_nominal will not affect the simulation. If use_eta_Carnot_nominal=false, the model will use the value of the parameter COP_nominal together with the specified nominal temperatures to compute the Carnot effectiveness as

ηCarnot,0 = COP0 ⁄ (Tuse,0 ⁄ (Tcon,0 + Tapp,con,0 - (Teva,0-Tapp,eva,0))),

where Teva,0 is the evaporator temperature, Tcon,0 is the condenser temperature, Tapp,eva,0 is the evaporator approach temperature, Tapp,con,0 is the condenser approach temperature, and Tuse,0 is the temperature of the the useful heat. If COP_is_for_cooling=true, then Tuse,0 is the condenser temperature of a heat pump plus the approach temperature, otherwise it is the evaporator temperature minus the approach temperature of a chiller.

The COP is computed as the product

COP = ηCarnot,0 COPCarnot ηPL,

where COPCarnot is the Carnot efficiency and ηPL is the part load efficiency, expressed using a polynomial. This polynomial has the form

ηPL = a1 + a2 y + a3 y2 + ...,

where y ∈ [0, 1] is either the part load for cooling in case of a chiller, or the part load of heating in case of a heat pump, and the coefficients ai are declared by the parameter a.

Implementation

To make this base class applicable to chiller or heat pumps, it uses the boolean constant COP_is_for_cooling. Depending on its value, the equations for the coefficient of performance and the part load ratio are set up.

Extends from Buildings.Fluid.Interfaces.PartialFourPortInterface (Partial model with four ports and declaration of quantities that are used by many models).

Parameters

TypeNameDefaultDescription
replaceable package Medium1PartialMediumMedium 1 in the component
replaceable package Medium2PartialMediumMedium 2 in the component
Nominal condition
MassFlowRatem1_flow_nominalQCon_flow_nominal/cp1_defaul...Nominal mass flow rate [kg/s]
MassFlowRatem2_flow_nominalQEva_flow_nominal/cp2_defaul...Nominal mass flow rate [kg/s]
HeatFlowRateQEva_flow_nominal Nominal cooling heat flow rate (QEva_flow_nominal < 0) [W]
HeatFlowRateQCon_flow_nominal Nominal heating flow rate [W]
TemperatureDifferencedTEva_nominal-10Temperature difference evaporator outlet-inlet [K]
TemperatureDifferencedTCon_nominal10Temperature difference condenser outlet-inlet [K]
Pressuredp1_nominal Pressure difference over condenser [Pa]
Pressuredp2_nominal Pressure difference over evaporator [Pa]
Efficiency
Booleanuse_eta_Carnot_nominaltrueSet to true to use Carnot effectiveness etaCarnot_nominal rather than COP_nominal
RealetaCarnot_nominal0.3Carnot effectiveness (=COP/COP_Carnot) used during simulation if use_eta_Carnot_nominal = true [1]
RealCOP_nominaletaCarnot_nominal*TUseAct_no...Coefficient of performance at TEva_nominal and TCon_nominal, used during simulation if use_eta_Carnot_nominal = false [1]
TemperatureTCon_nominal303.15Condenser temperature used to compute COP_nominal if use_eta_Carnot_nominal=false [K]
TemperatureTEva_nominal278.15Evaporator temperature used to compute COP_nominal if use_eta_Carnot_nominal=false [K]
Reala[:]{1}Coefficients for efficiency curve (need p(a=a, yPL=1)=1)
TemperatureDifferenceTAppCon_nominalif cp1_default < 1500 then 5...Temperature difference between refrigerant and working fluid outlet in condenser [K]
TemperatureDifferenceTAppEva_nominalif cp2_default < 1500 then 5...Temperature difference between refrigerant and working fluid outlet in evaporator [K]
Assumptions
BooleanallowFlowReversal1true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 1
BooleanallowFlowReversal2true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 2
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]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed
Flow resistance
Condenser
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 [1]
Evaporator
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 [1]
Dynamics
Condenser
Timetau160Time constant at nominal flow rate (used if energyDynamics1 <> Modelica.Fluid.Types.Dynamics.SteadyState) [s]
TemperatureT1_startMedium1.T_defaultInitial or guess value of set point [K]
Evaporator
Timetau260Time constant at nominal flow rate (used if energyDynamics2 <> Modelica.Fluid.Types.Dynamics.SteadyState) [s]
TemperatureT2_startMedium2.T_defaultInitial or guess value of set point [K]
Evaporator and condenser
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state

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)
output RealOutputQCon_flowActual heating heat flow rate added to fluid 1 [W]
output RealOutputPElectric power consumed by compressor [W]
output RealOutputQEva_flowActual cooling heat flow rate removed from fluid 2 [W]

Modelica definition

partial model Carnot extends Buildings.Fluid.Interfaces.PartialFourPortInterface( m1_flow_nominal = QCon_flow_nominal/cp1_default/dTCon_nominal, m2_flow_nominal = QEva_flow_nominal/cp2_default/dTEva_nominal); constant Boolean homotopyInitialization = true "= true, use homotopy method"; parameter Modelica.Units.SI.HeatFlowRate QEva_flow_nominal(max=0) "Nominal cooling heat flow rate (QEva_flow_nominal < 0)"; parameter Modelica.Units.SI.HeatFlowRate QCon_flow_nominal(min=0) "Nominal heating flow rate"; parameter Modelica.Units.SI.TemperatureDifference dTEva_nominal(final max=0) = -10 "Temperature difference evaporator outlet-inlet"; parameter Modelica.Units.SI.TemperatureDifference dTCon_nominal(final min=0) = 10 "Temperature difference condenser outlet-inlet"; // Efficiency parameter Boolean use_eta_Carnot_nominal = true "Set to true to use Carnot effectiveness etaCarnot_nominal rather than COP_nominal"; parameter Real etaCarnot_nominal(unit="1") = 0.3 "Carnot effectiveness (=COP/COP_Carnot) used during simulation if use_eta_Carnot_nominal = true"; parameter Real COP_nominal(unit="1") = etaCarnot_nominal*TUseAct_nominal/ (TCon_nominal+TAppCon_nominal - (TEva_nominal-TAppEva_nominal)) "Coefficient of performance at TEva_nominal and TCon_nominal, used during simulation if use_eta_Carnot_nominal = false"; parameter Modelica.Units.SI.Temperature TCon_nominal=303.15 "Condenser temperature used to compute COP_nominal if use_eta_Carnot_nominal=false"; parameter Modelica.Units.SI.Temperature TEva_nominal=278.15 "Evaporator temperature used to compute COP_nominal if use_eta_Carnot_nominal=false"; parameter Real a[:] = {1} "Coefficients for efficiency curve (need p(a=a, yPL=1)=1)"; parameter Modelica.Units.SI.Pressure dp1_nominal(displayUnit="Pa") "Pressure difference over condenser"; parameter Modelica.Units.SI.Pressure dp2_nominal(displayUnit="Pa") "Pressure difference over evaporator"; parameter Modelica.Units.SI.TemperatureDifference TAppCon_nominal(min=0) = if cp1_default < 1500 then 5 else 2 "Temperature difference between refrigerant and working fluid outlet in condenser"; parameter Modelica.Units.SI.TemperatureDifference TAppEva_nominal(min=0) = if cp2_default < 1500 then 5 else 2 "Temperature difference between refrigerant and working fluid outlet in evaporator"; parameter Boolean from_dp1=false "= true, use m_flow = f(dp) else dp = f(m_flow)"; parameter Boolean from_dp2=false "= true, use m_flow = f(dp) else dp = f(m_flow)"; parameter Boolean linearizeFlowResistance1=false "= true, use linear relation between m_flow and dp for any flow rate"; parameter Boolean linearizeFlowResistance2=false "= true, use linear relation between m_flow and dp for any flow rate"; parameter Real deltaM1(final unit="1")=0.1 "Fraction of nominal flow rate where flow transitions to laminar"; parameter Real deltaM2(final unit="1")=0.1 "Fraction of nominal flow rate where flow transitions to laminar"; parameter Modelica.Units.SI.Time tau1=60 "Time constant at nominal flow rate (used if energyDynamics1 <> Modelica.Fluid.Types.Dynamics.SteadyState)"; parameter Modelica.Units.SI.Time tau2=60 "Time constant at nominal flow rate (used if energyDynamics2 <> Modelica.Fluid.Types.Dynamics.SteadyState)"; parameter Modelica.Units.SI.Temperature T1_start=Medium1.T_default "Initial or guess value of set point"; parameter Modelica.Units.SI.Temperature T2_start=Medium2.T_default "Initial or guess value of set point"; parameter Modelica.Fluid.Types.Dynamics energyDynamics= Modelica.Fluid.Types.Dynamics.SteadyState "Type of energy balance: dynamic (3 initialization options) or steady state"; Modelica.Blocks.Interfaces.RealOutput QCon_flow( final quantity="HeatFlowRate", final unit="W") "Actual heating heat flow rate added to fluid 1"; Modelica.Blocks.Interfaces.RealOutput P( final quantity="Power", final unit="W") "Electric power consumed by compressor"; Modelica.Blocks.Interfaces.RealOutput QEva_flow( final quantity="HeatFlowRate", final unit="W") "Actual cooling heat flow rate removed from fluid 2"; Real yPL(final unit="1", min=0) = if COP_is_for_cooling then QEva_flow/QEva_flow_nominal else QCon_flow/QCon_flow_nominal "Part load ratio"; Real etaPL(final unit = "1")= if evaluate_etaPL then Buildings.Utilities.Math.Functions.polynomial(a=a, x=yPL) else 1 "Efficiency due to part load (etaPL(yPL=1)=1)"; Real COP(min=0, final unit="1") = etaCarnot_nominal_internal * COPCar * etaPL "Coefficient of performance"; Real COPCar(min=0) = TUseAct/Buildings.Utilities.Math.Functions.smoothMax( x1=1, x2=TConAct - TEvaAct, deltaX=0.25) "Carnot efficiency"; Modelica.Units.SI.Temperature TConAct(start=TCon_nominal + TAppCon_nominal) = Medium1.temperature(staB1) + QCon_flow/QCon_flow_nominal*TAppCon_nominal "Condenser temperature used to compute efficiency, taking into account pinch temperature between fluid and refrigerant"; Modelica.Units.SI.Temperature TEvaAct(start=TEva_nominal - TAppEva_nominal) = Medium2.temperature(staB2) - QEva_flow/QEva_flow_nominal*TAppEva_nominal "Evaporator temperature used to compute efficiency, taking into account pinch temperature between fluid and refrigerant"; protected constant Boolean COP_is_for_cooling "Set to true if the specified COP is for cooling"; parameter Real etaCarnot_nominal_internal(unit="1")= if use_eta_Carnot_nominal then etaCarnot_nominal else COP_nominal/ (TUseAct_nominal / (TCon_nominal + TAppCon_nominal - (TEva_nominal - TAppEva_nominal))) "Carnot effectiveness (=COP/COP_Carnot) used to compute COP"; // For Carnot_y, computing etaPL = f(yPL) introduces a nonlinear equation. // The parameter below avoids this if a = {1}. final parameter Boolean evaluate_etaPL= not ((size(a, 1) == 1 and abs(a[1] - 1) < Modelica.Constants.eps)) "Flag, true if etaPL should be computed as it depends on yPL"; final parameter Modelica.Units.SI.Temperature TUseAct_nominal=if COP_is_for_cooling then TEva_nominal - TAppEva_nominal else TCon_nominal + TAppCon_nominal "Nominal evaporator temperature for chiller or condenser temperature for heat pump, taking into account pinch temperature between fluid and refrigerant"; Modelica.Units.SI.Temperature TUseAct=if COP_is_for_cooling then TEvaAct else TConAct "Temperature of useful heat (evaporator for chiller, condenser for heat pump), taking into account pinch temperature between fluid and refrigerant"; final parameter Modelica.Units.SI.SpecificHeatCapacity cp1_default= Medium1.specificHeatCapacityCp(Medium1.setState_pTX( p=Medium1.p_default, T=Medium1.T_default, X=Medium1.X_default)) "Specific heat capacity of medium 1 at default medium state"; final parameter Modelica.Units.SI.SpecificHeatCapacity cp2_default= Medium2.specificHeatCapacityCp(Medium2.setState_pTX( p=Medium2.p_default, T=Medium2.T_default, X=Medium2.X_default)) "Specific heat capacity of medium 2 at default medium state"; Medium1.ThermodynamicState staA1 = Medium1.setState_phX( port_a1.p, inStream(port_a1.h_outflow), inStream(port_a1.Xi_outflow)) "Medium properties in port_a1"; Medium1.ThermodynamicState staB1 = Medium1.setState_phX( port_b1.p, port_b1.h_outflow, port_b1.Xi_outflow) "Medium properties in port_b1"; Medium2.ThermodynamicState staA2 = Medium2.setState_phX( port_a2.p, inStream(port_a2.h_outflow), inStream(port_a2.Xi_outflow)) "Medium properties in port_a2"; Medium2.ThermodynamicState staB2 = Medium2.setState_phX( port_b2.p, port_b2.h_outflow, port_b2.Xi_outflow) "Medium properties in port_b2"; replaceable Interfaces.PartialTwoPortInterface con constrainedby Interfaces.PartialTwoPortInterface( redeclare final package Medium = Medium1, final allowFlowReversal=allowFlowReversal1, final m_flow_nominal=m1_flow_nominal, final m_flow_small=m1_flow_small, final show_T=false) "Condenser"; replaceable Interfaces.PartialTwoPortInterface eva constrainedby Interfaces.PartialTwoPortInterface( redeclare final package Medium = Medium2, final allowFlowReversal=allowFlowReversal2, final m_flow_nominal=m2_flow_nominal, final m_flow_small=m2_flow_small, final show_T=false) "Evaporator"; initial equation assert(dTEva_nominal < 0, "Parameter dTEva_nominal must be negative."); assert(dTCon_nominal > 0, "Parameter dTCon_nominal must be positive."); assert(abs(Buildings.Utilities.Math.Functions.polynomial( a=a, x=1)-1) < 0.01, "Efficiency curve is wrong. Need etaPL(y=1)=1."); assert(etaCarnot_nominal_internal < 1, "Parameters lead to etaCarnot_nominal > 1. Check parameters."); assert(homotopyInitialization, "In " + getInstanceName() + ": The constant homotopyInitialization has been modified from its default value. This constant will be removed in future releases.", level = AssertionLevel.warning); equation connect(port_a2, eva.port_a); connect(eva.port_b, port_b2); connect(port_a1, con.port_a); connect(con.port_b, port_b1); end Carnot;

Buildings.Fluid.Chillers.BaseClasses.PartialCarnot_T Buildings.Fluid.Chillers.BaseClasses.PartialCarnot_T

Partial model for chiller with performance curve adjusted based on Carnot efficiency

Buildings.Fluid.Chillers.BaseClasses.PartialCarnot_T

Information

This is a partial model of a chiller whose coefficient of performance (COP) changes with temperatures in the same way as the Carnot efficiency changes. This base class is used for the Carnot chiller and Carnot heat pump that uses the compressor part load ratio as the control signal.

Extends from Buildings.Fluid.Chillers.BaseClasses.Carnot.

Parameters

TypeNameDefaultDescription
replaceable package Medium1PartialMediumMedium 1 in the component
replaceable package Medium2PartialMediumMedium 2 in the component
Nominal condition
MassFlowRatem1_flow_nominalQCon_flow_nominal/cp1_defaul...Nominal mass flow rate [kg/s]
MassFlowRatem2_flow_nominalQEva_flow_nominal/cp2_defaul...Nominal mass flow rate [kg/s]
HeatFlowRateQEva_flow_nominal Nominal cooling heat flow rate (QEva_flow_nominal < 0) [W]
HeatFlowRateQCon_flow_nominal Nominal heating flow rate [W]
TemperatureDifferencedTEva_nominal-10Temperature difference evaporator outlet-inlet [K]
TemperatureDifferencedTCon_nominal10Temperature difference condenser outlet-inlet [K]
Pressuredp1_nominal Pressure difference over condenser [Pa]
Pressuredp2_nominal Pressure difference over evaporator [Pa]
Efficiency
Booleanuse_eta_Carnot_nominaltrueSet to true to use Carnot effectiveness etaCarnot_nominal rather than COP_nominal
RealetaCarnot_nominal0.3Carnot effectiveness (=COP/COP_Carnot) used during simulation if use_eta_Carnot_nominal = true [1]
RealCOP_nominaletaCarnot_nominal*TUseAct_no...Coefficient of performance at TEva_nominal and TCon_nominal, used during simulation if use_eta_Carnot_nominal = false [1]
TemperatureTCon_nominal303.15Condenser temperature used to compute COP_nominal if use_eta_Carnot_nominal=false [K]
TemperatureTEva_nominal278.15Evaporator temperature used to compute COP_nominal if use_eta_Carnot_nominal=false [K]
Reala[:]{1}Coefficients for efficiency curve (need p(a=a, yPL=1)=1)
TemperatureDifferenceTAppCon_nominalif cp1_default < 1500 then 5...Temperature difference between refrigerant and working fluid outlet in condenser [K]
TemperatureDifferenceTAppEva_nominalif cp2_default < 1500 then 5...Temperature difference between refrigerant and working fluid outlet in evaporator [K]
Assumptions
BooleanallowFlowReversal1true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 1
BooleanallowFlowReversal2true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 2
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]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed
Flow resistance
Condenser
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 [1]
Evaporator
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 [1]
Dynamics
Condenser
Timetau160Time constant at nominal flow rate (used if energyDynamics1 <> Modelica.Fluid.Types.Dynamics.SteadyState) [s]
TemperatureT1_startMedium1.T_defaultInitial or guess value of set point [K]
Evaporator
Timetau260Time constant at nominal flow rate (used if energyDynamics2 <> Modelica.Fluid.Types.Dynamics.SteadyState) [s]
TemperatureT2_startMedium2.T_defaultInitial or guess value of set point [K]
Evaporator and condenser
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state

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)
output RealOutputQCon_flowActual heating heat flow rate added to fluid 1 [W]
output RealOutputPElectric power consumed by compressor [W]
output RealOutputQEva_flowActual cooling heat flow rate removed from fluid 2 [W]

Modelica definition

partial model PartialCarnot_T "Partial model for chiller with performance curve adjusted based on Carnot efficiency" extends Buildings.Fluid.Chillers.BaseClasses.Carnot; protected Modelica.Blocks.Sources.RealExpression PEle "Electrical power consumption"; equation connect(PEle.y, P); end PartialCarnot_T;

Buildings.Fluid.Chillers.BaseClasses.PartialCarnot_y Buildings.Fluid.Chillers.BaseClasses.PartialCarnot_y

Partial chiller model with performance curve adjusted based on Carnot efficiency

Buildings.Fluid.Chillers.BaseClasses.PartialCarnot_y

Information

This is a partial model of a chiller whose coefficient of performance (COP) changes with temperatures in the same way as the Carnot efficiency changes. This base class is used for the Carnot chiller and Carnot heat pump that uses the leaving fluid temperature as the control signal.

Extends from Carnot.

Parameters

TypeNameDefaultDescription
replaceable package Medium1PartialMediumMedium 1 in the component
replaceable package Medium2PartialMediumMedium 2 in the component
Nominal condition
MassFlowRatem1_flow_nominalQCon_flow_nominal/cp1_defaul...Nominal mass flow rate [kg/s]
MassFlowRatem2_flow_nominalQEva_flow_nominal/cp2_defaul...Nominal mass flow rate [kg/s]
HeatFlowRateQEva_flow_nominalif COP_is_for_cooling then -...Nominal cooling heat flow rate (QEva_flow_nominal < 0) [W]
HeatFlowRateQCon_flow_nominalP_nominal - QEva_flow_nominalNominal heating flow rate [W]
TemperatureDifferencedTEva_nominal-10Temperature difference evaporator outlet-inlet [K]
TemperatureDifferencedTCon_nominal10Temperature difference condenser outlet-inlet [K]
Pressuredp1_nominal Pressure difference over condenser [Pa]
Pressuredp2_nominal Pressure difference over evaporator [Pa]
PowerP_nominal Nominal compressor power (at y=1) [W]
Efficiency
Booleanuse_eta_Carnot_nominaltrueSet to true to use Carnot effectiveness etaCarnot_nominal rather than COP_nominal
RealetaCarnot_nominal0.3Carnot effectiveness (=COP/COP_Carnot) used during simulation if use_eta_Carnot_nominal = true [1]
RealCOP_nominaletaCarnot_nominal*TUseAct_no...Coefficient of performance at TEva_nominal and TCon_nominal, used during simulation if use_eta_Carnot_nominal = false [1]
TemperatureTCon_nominal303.15Condenser temperature used to compute COP_nominal if use_eta_Carnot_nominal=false [K]
TemperatureTEva_nominal278.15Evaporator temperature used to compute COP_nominal if use_eta_Carnot_nominal=false [K]
Reala[:]{1}Coefficients for efficiency curve (need p(a=a, yPL=1)=1)
TemperatureDifferenceTAppCon_nominalif cp1_default < 1500 then 5...Temperature difference between refrigerant and working fluid outlet in condenser [K]
TemperatureDifferenceTAppEva_nominalif cp2_default < 1500 then 5...Temperature difference between refrigerant and working fluid outlet in evaporator [K]
Assumptions
BooleanallowFlowReversal1true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 1
BooleanallowFlowReversal2true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 2
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]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed
Flow resistance
Condenser
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 [1]
Evaporator
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 [1]
Dynamics
Condenser
Timetau160Time constant at nominal flow rate (used if energyDynamics1 <> Modelica.Fluid.Types.Dynamics.SteadyState) [s]
TemperatureT1_startMedium1.T_defaultInitial or guess value of set point [K]
Evaporator
Timetau260Time constant at nominal flow rate (used if energyDynamics2 <> Modelica.Fluid.Types.Dynamics.SteadyState) [s]
TemperatureT2_startMedium2.T_defaultInitial or guess value of set point [K]
Evaporator and condenser
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state

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)
output RealOutputQCon_flowActual heating heat flow rate added to fluid 1 [W]
output RealOutputPElectric power consumed by compressor [W]
output RealOutputQEva_flowActual cooling heat flow rate removed from fluid 2 [W]
input RealInputyPart load ratio of compressor [1]

Modelica definition

partial model PartialCarnot_y "Partial chiller model with performance curve adjusted based on Carnot efficiency" extends Carnot( final QCon_flow_nominal= P_nominal - QEva_flow_nominal, final QEva_flow_nominal = if COP_is_for_cooling then -P_nominal * COP_nominal else -P_nominal * (COP_nominal-1), redeclare HeatExchangers.HeaterCooler_u con( final from_dp=from_dp1, final dp_nominal=dp1_nominal, final linearizeFlowResistance=linearizeFlowResistance1, final deltaM=deltaM1, final tau=tau1, final T_start=T1_start, final energyDynamics=energyDynamics, final homotopyInitialization=homotopyInitialization, final Q_flow_nominal=QCon_flow_nominal), redeclare HeatExchangers.HeaterCooler_u eva( final from_dp=from_dp2, final dp_nominal=dp2_nominal, final linearizeFlowResistance=linearizeFlowResistance2, final deltaM=deltaM2, final tau=tau2, final T_start=T2_start, final energyDynamics=energyDynamics, final homotopyInitialization=homotopyInitialization, final Q_flow_nominal=QEva_flow_nominal)); parameter Modelica.Units.SI.Power P_nominal(min=0) "Nominal compressor power (at y=1)"; Modelica.Blocks.Interfaces.RealInput y(min=0, max=1, unit="1") "Part load ratio of compressor"; protected Modelica.Units.SI.HeatFlowRate QCon_flow_internal(start=QCon_flow_nominal) = P - QEva_flow_internal "Condenser heat input"; Modelica.Units.SI.HeatFlowRate QEva_flow_internal(start=QEva_flow_nominal) = if COP_is_for_cooling then -COP*P else (1 - COP)*P "Evaporator heat input"; Modelica.Blocks.Sources.RealExpression yEva_flow_in( y=QEva_flow_internal/QEva_flow_nominal) "Normalized evaporator heat flow rate"; Modelica.Blocks.Sources.RealExpression yCon_flow_in( y=QCon_flow_internal/QCon_flow_nominal) "Normalized condenser heat flow rate"; Modelica.Blocks.Math.Gain PEle(final k=P_nominal) "Electrical power consumption"; equation connect(PEle.y, P); connect(PEle.u, y); connect(yEva_flow_in.y, eva.u); connect(yCon_flow_in.y, con.u); connect(con.Q_flow, QCon_flow); connect(eva.Q_flow, QEva_flow); end PartialCarnot_y;

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.

Optionally, the model can be configured to represent heat recovery chillers with a switchover option by setting the parameter have_switchover to true. In that case an additional Boolean input connector coo is used. The chiller is tracking a chilled water supply temperature setpoint at the outlet of the evaporator barrel if coo is true. Otherwise, if coo is false, the chiller is tracking a hot water supply temperature setpoint at the outlet of the condenser barrel. See Buildings.Fluid.Chillers.Examples.ElectricEIR_HeatRecovery for an example with a chiller operating in heating mode.

Implementation

This implementation computes the chiller capacity and power consumption the same way as documented in EnergyPlus v22.1.0 Engineering Reference section 14.3.9.2. Especially see equations 14.234 and 14.240 in the referenced document.

The available chiller capacity QEva_flow_ava is adjusted from its nominal capacity QEva_flow_nominal by factor capFunT as

  QEva_flow_ava = QEva_flow_nominal*capFunT

and the compressor power consumption is computed as

  P = -QEva_flow_ava*(1/COP_nominal)*EIRFunT*EIRFunPLR*CR.

The models that extend from this base class implement the functions used above in ways that are shown in the table below.

Function Description Formulation
ElectricEIR ElectricReformulatedEIR
capFunT Adjusts cooling capacity for current fluid temperatures Biquadratic on TConEnt and TEvaLvg Biquadratic on TConLvg and TEvaLvg
EIRFunPLR Adjusts EIR for the current PLR Quadratic on PLR Bicubic on TConLvg and PLR
EIRFunT Adjusts EIR for current fluid temperatures Biquadratic on TConEnt and TEvaLvg Biquadratic on TConLvg and TEvaLvg

where TConEnt is the condenser entering temperature, TEvaLvg is the evaporator leaving temperature, TConLvg is the condenser leaving temperatore, and PLR is the part load ratio.

References

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
Booleanhave_switchoverfalseSet to true for heat recovery chiller with built-in switchover
Nominal condition
MassFlowRatem1_flow_nominalmCon_flow_nominalNominal mass flow rate [kg/s]
MassFlowRatem2_flow_nominalmEva_flow_nominalNominal mass flow rate [kg/s]
PressureDifferencedp1_nominal Pressure difference [Pa]
PressureDifferencedp2_nominal Pressure difference [Pa]
Assumptions
BooleanallowFlowReversal1true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 1
BooleanallowFlowReversal2true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 2
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]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed
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]
Conservation equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
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 (condenser water if have_switchover=true and coo=false) [K]
output RealOutputPElectric power consumed by compressor [W]
output RealOutputCOP_hCoefficient of performance of heating [1]
input BooleanInputcooSwitchover signal: true for cooling, false for heating

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)); parameter Boolean have_switchover=false "Set to true for heat recovery chiller with built-in switchover"; 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 (condenser water if have_switchover=true and coo=false)"; Modelica.Blocks.Interfaces.RealOutput P(final quantity="Power", unit="W") "Electric power consumed by compressor"; Modelica.Blocks.Interfaces.RealOutput COP_h(final unit="1") if have_switchover "Coefficient of performance of heating"; Modelica.Units.SI.Temperature TEvaEnt "Evaporator entering temperature"; Modelica.Units.SI.Temperature TEvaLvg "Evaporator leaving temperature"; Modelica.Units.SI.Temperature TConEnt "Condenser entering temperature"; Modelica.Units.SI.Temperature TConLvg "Condenser leaving temperature"; Modelica.Units.SI.Efficiency COP "Coefficient of performance"; Modelica.Units.SI.HeatFlowRate QCon_flow "Condenser heat input"; Modelica.Units.SI.HeatFlowRate QEva_flow "Evaporator heat input"; Real capFunT(min=0, unit="1") "Cooling capacity factor function of temperature curve"; Modelica.Units.SI.Efficiency EIRFunT "Power input to cooling capacity ratio function of temperature curve"; Modelica.Units.SI.Efficiency EIRFunPLR "Power input to cooling capacity ratio function of part load ratio"; Real PLR1(min=0, unit="1", start=0) "Part load ratio"; Real PLR2(min=0, unit="1") "Part load ratio"; Real CR(min=0, unit="1") "Cycling ratio"; Controls.OBC.CDL.Interfaces.BooleanInput coo if have_switchover "Switchover signal: true for cooling, false for heating"; Controls.OBC.CDL.Logical.Sources.Constant tru( final k=true) if not have_switchover "Constant true signal"; protected Controls.OBC.CDL.Interfaces.BooleanInput coo_internal "Internal switchover signal: true for cooling, false for heating"; Modelica.Units.SI.HeatFlowRate QEva_flow_ava(nominal=QEva_flow_nominal, start =QEva_flow_nominal) "Cooling capacity available at evaporator"; Modelica.Units.SI.HeatFlowRate QEva_flow_set(nominal=QEva_flow_nominal, start =QEva_flow_nominal) "Cooling capacity required to cool to set point temperature"; Modelica.Units.SI.HeatFlowRate QCon_flow_set( nominal=-QEva_flow_nominal * (1 + 1 / COP_nominal * etaMotor), start=-QEva_flow_nominal * (1 + 1 / COP_nominal * etaMotor)) "Heating capacity required to heat up condenser water to setpoint"; Modelica.Units.SI.SpecificEnthalpy hSet "Enthalpy setpoint for leaving chilled water"; // Performance data parameter Modelica.Units.SI.HeatFlowRate QEva_flow_nominal(max=0) "Reference capacity (negative number)"; parameter Modelica.Units.SI.Efficiency COP_nominal "Reference coefficient of performance"; parameter Real PLRMax(min=0, unit="1") "Maximum part load ratio"; parameter Real PLRMinUnl(min=0, unit="1") "Minimum part unload ratio"; parameter Real PLRMin(min=0, unit="1") "Minimum part load ratio"; parameter Modelica.Units.SI.Efficiency etaMotor(max=1) "Fraction of compressor motor heat entering refrigerant"; parameter Modelica.Units.SI.MassFlowRate mEva_flow_nominal "Nominal mass flow at evaporator"; parameter Modelica.Units.SI.MassFlowRate mCon_flow_nominal "Nominal mass flow at condenser"; parameter Modelica.Units.SI.Temperature TEvaLvg_nominal "Temperature of fluid leaving evaporator at nominal condition"; final parameter Modelica.Units.NonSI.Temperature_degC TEvaLvg_nominal_degC= Modelica.Units.Conversions.to_degC(TEvaLvg_nominal) "Temperature of fluid leaving evaporator at nominal condition"; Modelica.Units.NonSI.Temperature_degC TEvaLvg_degC "Temperature of fluid leaving evaporator"; parameter Modelica.Units.SI.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"; Modelica.Blocks.Sources.RealExpression calCOPHea( final y=QCon_flow/(P - Q_flow_small)) if have_switchover "Compute heating COP"; initial equation assert(QEva_flow_nominal < 0, "Parameter QEva_flow_nominal must be smaller than zero."); assert(Q_flow_small < 0, "Parameter Q_flow_small 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), inStream(port_a1.Xi_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.Units.Conversions.to_degC(TEvaLvg); // Enthalpy of temperature setpoint hSet =if coo_internal then Medium2.specificEnthalpy_pTX( p=port_b2.p, T=TSet, X=cat( 1, port_b2.Xi_outflow, {1 - sum(port_b2.Xi_outflow)})) else Medium1.specificEnthalpy_pTX( p=port_b1.p, T=TSet, X=cat( 1, port_b1.Xi_outflow, {1 - sum(port_b1.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 = Buildings.Utilities.Math.Functions.smoothMin( x1=if coo_internal then m2_flow * (hSet - inStream(port_a2.h_outflow)) else P * etaMotor - QCon_flow_set, x2=Q_flow_small, deltaX=-Q_flow_small/100); // Heating capacity required to heat up condenser water to setpoint QCon_flow_set = if coo_internal then QCon_flow else m1_flow * (hSet - inStream(port_a1.h_outflow)); // Part load ratio PLR1 = Buildings.Utilities.Math.Functions.smoothMin( x1 = QEva_flow_set/(QEva_flow_ava+Q_flow_small), x2 = PLRMax, deltaX=PLRMax/100); // 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 = Buildings.Utilities.Math.Functions.smoothMax( x1 = PLRMinUnl, x2 = PLR1, deltaX = PLRMinUnl/100); // Cycling ratio. // Due to smoothing, this can be about deltaX/10 above 1.0 CR = Buildings.Utilities.Math.Functions.smoothMin( x1 = PLR1/PLRMin, x2 = 1, deltaX=0.001); // Compressor power. P = -QEva_flow_ava/COP_nominal*EIRFunT*EIRFunPLR*CR; // Heat flow rates into evaporator and condenser // Q_flow_small is a negative number. QEva_flow = Buildings.Utilities.Math.Functions.smoothMax( x1 = QEva_flow_set, x2 = QEva_flow_ava, deltaX= -Q_flow_small/10); //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; QCon_flow_set = 0; PLR1 = 0; PLR2 = 0; CR = 0; P = 0; QEva_flow = 0; QCon_flow = 0; COP = 0; end if; connect(calCOPHea.y, COP_h); 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); connect(coo, coo_internal); connect(tru.y, coo_internal); 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

impure 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( "*** Warning: Chiller performance curves at nominal conditions are outside of bounds. " + msg + " is outside of bounds 0.9 to 1.1. The value of the curve fit is " + String(x) + " Check the coefficients of the function " + curveName + "."); end if; end warnIfPerformanceOutOfBounds;