LCOV - code coverage report
Current view: top level - EnergyPlus - PlantChillers.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 54 68 79.4 %
Date: 2024-08-23 23:50:59 Functions: 6 7 85.7 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois,
       2             : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3             : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4             : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5             : // contributors. All rights reserved.
       6             : //
       7             : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8             : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9             : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10             : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11             : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12             : //
      13             : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14             : // provided that the following conditions are met:
      15             : //
      16             : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17             : //     conditions and the following disclaimer.
      18             : //
      19             : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20             : //     conditions and the following disclaimer in the documentation and/or other materials
      21             : //     provided with the distribution.
      22             : //
      23             : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24             : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25             : //     used to endorse or promote products derived from this software without specific prior
      26             : //     written permission.
      27             : //
      28             : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29             : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30             : //     reference solely to the software portion of its product, Licensee must refer to the
      31             : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32             : //     obtained under this License and may not use a different name for the software. Except as
      33             : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34             : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35             : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36             : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37             : //
      38             : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39             : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40             : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41             : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42             : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43             : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44             : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45             : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46             : // POSSIBILITY OF SUCH DAMAGE.
      47             : 
      48             : #ifndef PlantChillers_hh_INCLUDED
      49             : #define PlantChillers_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array1D.hh>
      53             : 
      54             : // EnergyPlus Headers
      55             : #include <EnergyPlus/Data/BaseData.hh>
      56             : #include <EnergyPlus/DataBranchAirLoopPlant.hh>
      57             : #include <EnergyPlus/DataGlobalConstants.hh>
      58             : #include <EnergyPlus/DataGlobals.hh>
      59             : #include <EnergyPlus/EnergyPlus.hh>
      60             : #include <EnergyPlus/Plant/DataPlant.hh>
      61             : #include <EnergyPlus/PlantComponent.hh>
      62             : #include <EnergyPlus/UtilityRoutines.hh>
      63             : 
      64             : namespace EnergyPlus {
      65             : 
      66             : // Forward declarations
      67             : struct EnergyPlusData;
      68             : 
      69             : namespace PlantChillers {
      70             : 
      71             :     struct BaseChillerSpecs : PlantComponent // NOTE: This base class is abstract, derived classes must override pure virtual methods
      72             :     {
      73             :         // Members
      74             :         std::string Name;      // user identifier
      75             :         Real64 MinPartLoadRat; // (GT MIN) min allowed operating frac full load
      76             :         Real64 MaxPartLoadRat; // (GT MAX) max allowed operating frac full load
      77             :         Real64 OptPartLoadRat; // (GT BEST) optimal operating frac full load
      78             :         Real64 TempDesCondIn;  // C - (GT ADJTC(1)The design secondary loop fluid
      79             :         // temperature at the chiller condenser side inlet
      80             :         Real64 TempRiseCoef;                    // (GT ADJTC(2)) correction factor for off ChillDesign oper.
      81             :         Real64 TempDesEvapOut;                  // C - (GT ADJTC(3)The design primary loop fluid
      82             :         DataPlant::CondenserType CondenserType; // Type of Condenser - Air or Water Cooled
      83             :         Real64 NomCap;                          // design nominal capacity of chiller
      84             :         bool NomCapWasAutoSized;                // true if NomCap was autosize on input
      85             :         Real64 COP;                             // COP
      86             :         DataPlant::FlowMode FlowMode;           // one of 3 modes for component flow during operation
      87             :         bool ModulatedFlowSetToLoop;            // True if the setpoint is missing at the outlet node
      88             :         bool ModulatedFlowErrDone;              // true if setpoint warning issued
      89             :         bool HRSPErrDone;                       // TRUE if set point warning issued for heat recovery loop
      90             :         int EvapInletNodeNum;                   // Node number on the inlet side of the plant
      91             :         int EvapOutletNodeNum;                  // Node number on the outlet side of the plant
      92             :         int CondInletNodeNum;                   // Node number on the inlet side of the condenser
      93             :         int CondOutletNodeNum;                  // Node number on the outlet side of the condenser
      94             :         Real64 EvapVolFlowRate;                 // m**3/s - design nominal water volumetric flow rate through the evaporator
      95             :         bool EvapVolFlowRateWasAutoSized;       // true if autosized design evap flow rate on input
      96             :         Real64 EvapMassFlowRateMax;             // kg/s - design water mass flow rate through evaporator
      97             :         Real64 CondVolFlowRate;                 // m**3/s - design nominal water volumetric flow rate through the condenser
      98             :         bool CondVolFlowRateWasAutoSized;       // true if previous was autosized
      99             :         Real64 CondMassFlowRateMax;             // kg/s - design water mass flow rate through condenser
     100             :         PlantLocation CWPlantLoc;               // chilled water plant loop component index
     101             :         PlantLocation CDPlantLoc;               // condenser water plant loop component index
     102             :         Real64 SizFac;                          // sizing factor
     103             :         Real64 BasinHeaterPowerFTempDiff;       // Basin heater capacity per degree C below setpoint (W/C)
     104             :         Real64 BasinHeaterSetPointTemp;         // Setpoint temperature for basin heater operation (C)
     105             :         int BasinHeaterSchedulePtr;             // Pointer to basin heater schedule
     106             :         int ErrCount1;                          // for recurring error messages
     107             :         int ErrCount2;                          // for recurring error messages
     108             :         std::string MsgBuffer1;                 // - buffer to print warning messages on following time step
     109             :         std::string MsgBuffer2;                 // - buffer to print warning messages on following time step
     110             :         Real64 MsgDataLast;                     // value of data when warning occurred (passed to Recurring Warn)
     111             :         bool PrintMessage;                      // logical to determine if message is valid
     112             :         int MsgErrorCount;                      // number of occurrences of warning
     113             :         bool CheckEquipName;
     114             :         bool PossibleSubcooling; // flag to indicate chiller is doing less cooling that requested
     115             :         int CondMassFlowIndex;
     116             :         // Operational fault parameters
     117             :         bool FaultyChillerSWTFlag;         // True if the chiller has SWT sensor fault
     118             :         int FaultyChillerSWTIndex;         // Index of the fault object corresponding to the chiller
     119             :         Real64 FaultyChillerSWTOffset;     // Chiller SWT sensor offset
     120             :         bool FaultyChillerFoulingFlag;     // True if the chiller has fouling fault
     121             :         int FaultyChillerFoulingIndex;     // Index of the fault object corresponding to the chiller
     122             :         Real64 FaultyChillerFoulingFactor; // Chiller fouling factor
     123             :         bool MyFlag;
     124             :         bool MyEnvrnFlag;
     125             :         Real64 TimeStepSysLast;
     126             :         Real64 CurrentEndTimeLast;
     127             :         Real64 CondMassFlowRate;  // Kg/s - condenser mass flow rate, water side
     128             :         Real64 EvapMassFlowRate;  // Kg/s - evaporator mass flow rate, water side
     129             :         Real64 CondOutletTemp;    // C - condenser outlet temperature, air or water side
     130             :         Real64 EvapOutletTemp;    // C - evaporator outlet temperature, water side
     131             :         Real64 QEvaporator;       // W - rate of heat transfer to the evaporator coil
     132             :         Real64 QCondenser;        // W - rate of heat transfer to the condenser coil
     133             :         Real64 Energy;            // J - chiller energy use
     134             :         Real64 EvaporatorEnergy;  // J - rate of heat transfer to the evaporator coil
     135             :         Real64 CondenserEnergy;   // J - rate of heat transfer to the condenser coil
     136             :         Real64 QHeatRecovered;    // W - rate of heat transfer to the Heat Recovery coil
     137             :         Real64 HeatRecOutletTemp; // C - Heat Rec outlet temperature, water side
     138             :         Real64 AvgCondSinkTemp;   // condenser temperature value for use in curves [C]
     139             :         Real64 BasinHeaterPower;  // Basin heater power (W)
     140             :         Real64 Power;
     141             :         Real64 CondInletTemp;
     142             :         Real64 EvapInletTemp;
     143             :         Real64 BasinHeaterConsumption; // Basin heater energy consumption (J)
     144             :         DataPlant::PlantEquipmentType ChillerType;
     145             : 
     146             :         // Default Constructor
     147         642 :         BaseChillerSpecs()
     148        1284 :             : MinPartLoadRat(0.0), MaxPartLoadRat(1.0), OptPartLoadRat(1.0), TempDesCondIn(0.0), TempRiseCoef(0.0), TempDesEvapOut(0.0),
     149         642 :               CondenserType(DataPlant::CondenserType::WaterCooled), NomCap(0.0), NomCapWasAutoSized(false), COP(0.0),
     150         642 :               FlowMode(DataPlant::FlowMode::Invalid), ModulatedFlowSetToLoop(false), ModulatedFlowErrDone(false), HRSPErrDone(false),
     151         642 :               EvapInletNodeNum(0), EvapOutletNodeNum(0), CondInletNodeNum(0), CondOutletNodeNum(0), EvapVolFlowRate(0.0),
     152         642 :               EvapVolFlowRateWasAutoSized(false), EvapMassFlowRateMax(0.0), CondVolFlowRate(0.0), CondVolFlowRateWasAutoSized(false),
     153         642 :               CondMassFlowRateMax(0.0), CWPlantLoc{}, CDPlantLoc{}, SizFac(0.0), BasinHeaterPowerFTempDiff(0.0), BasinHeaterSetPointTemp(0.0),
     154        1284 :               BasinHeaterSchedulePtr(0), ErrCount1(0), ErrCount2(0), MsgDataLast(0.0), PrintMessage(false), MsgErrorCount(0), CheckEquipName(true),
     155         642 :               PossibleSubcooling(false), CondMassFlowIndex(0), FaultyChillerSWTFlag(false), FaultyChillerSWTIndex(0), FaultyChillerSWTOffset(0.0),
     156         642 :               FaultyChillerFoulingFlag(false), FaultyChillerFoulingIndex(0), FaultyChillerFoulingFactor(1.0), MyFlag(true), MyEnvrnFlag(true),
     157         642 :               TimeStepSysLast(0.0), CurrentEndTimeLast(0.0), CondMassFlowRate(0.0), EvapMassFlowRate(0.0), CondOutletTemp(0.0),
     158         642 :               EvapOutletTemp(0.0),    // C - evaporator outlet temperature, water side
     159         642 :               QEvaporator(0.0),       // W - rate of heat transfer to the evaporator coil
     160         642 :               QCondenser(0.0),        // W - rate of heat transfer to the condenser coil
     161         642 :               Energy(0.0),            // J - chiller energy use
     162         642 :               EvaporatorEnergy(0.0),  // J - rate of heat transfer to the evaporator coil
     163         642 :               CondenserEnergy(0.0),   // J - rate of heat transfer to the condenser coil
     164         642 :               QHeatRecovered(0.0),    // W - rate of heat transfer to the Heat Recovery coil
     165         642 :               HeatRecOutletTemp(0.0), // C - Heat Rec outlet temperature, water side
     166         642 :               AvgCondSinkTemp(0.0),   // condenser temperature value for use in curves [C]
     167         642 :               BasinHeaterPower(0.0),  // Basin heater power (W)
     168        1284 :               Power(0.0), CondInletTemp(0.0), EvapInletTemp(0.0), BasinHeaterConsumption(0.0), ChillerType(DataPlant::PlantEquipmentType::Invalid)
     169             : 
     170             :         {
     171         642 :         }
     172             : 
     173             :         void getDesignCapacities(EnergyPlusData &state,
     174             :                                  [[maybe_unused]] const PlantLocation &calledFromLocation,
     175             :                                  [[maybe_unused]] Real64 &MaxLoad,
     176             :                                  [[maybe_unused]] Real64 &MinLoad,
     177             :                                  [[maybe_unused]] Real64 &OptLoad) override;
     178             : 
     179             :         void getSizingFactor([[maybe_unused]] Real64 &SizFac) override;
     180             : 
     181             :         void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override;
     182             : 
     183             :         void getDesignTemperatures([[maybe_unused]] Real64 &TempDesCondIn, [[maybe_unused]] Real64 &TempDesEvapOut) override;
     184             : 
     185             :         virtual void initialize(EnergyPlusData &state, bool RunFlag, Real64 MyLoad) = 0;
     186             : 
     187             :         virtual void size(EnergyPlusData &state) = 0;
     188             :     };
     189             : 
     190             :     struct ElectricChillerSpecs : BaseChillerSpecs
     191             :     {
     192             :         // Members
     193             :         // temperature at the chiller evaporator side outlet
     194             :         Array1D<Real64> CapRatCoef;                // (Electric RCAVC() ) coeff of cap ratio poly fit
     195             :         Array1D<Real64> PowerRatCoef;              // (Electric ADJEC() ) coeff of power rat poly fit
     196             :         Array1D<Real64> FullLoadCoef;              // (Electric RPWRC() ) coeff of full load poly. fit
     197             :         Real64 TempLowLimitEvapOut;                // C - low temperature shut off
     198             :         Real64 DesignHeatRecVolFlowRate;           // m3/s, Design Water mass flow rate through heat recovery loop
     199             :         bool DesignHeatRecVolFlowRateWasAutoSized; // true if previous was input autosize.
     200             :         Real64 DesignHeatRecMassFlowRate;          // kg/s, Design Water mass flow rate through heat recovery loop
     201             :         bool HeatRecActive;                        // True entered Heat Rec Vol Flow Rate >0
     202             :         int HeatRecInletNodeNum;                   // Node number on the heat recovery inlet side of the condenser
     203             :         int HeatRecOutletNodeNum;                  // Node number on the heat recovery outlet side of the condenser
     204             :         Real64 HeatRecCapacityFraction;            // user input for heat recovery capacity fraction []
     205             :         Real64 HeatRecMaxCapacityLimit;            // Capacity limit for Heat recovery, one time calc [W]
     206             :         int HeatRecSetPointNodeNum;                // index for system node with the heat recover leaving setpoint
     207             :         int HeatRecInletLimitSchedNum;             // index for schedule for the inlet high limit for heat recovery operation
     208             :         PlantLocation HRPlantLoc;                  // heat recovery water plant loop component index
     209             :         std::string EndUseSubcategory;             // identifier use for the end use subcategory
     210             :         Real64 CondOutletHumRat;                   // kg/kg - condenser outlet humditiy ratio, air side
     211             :         Real64 ActualCOP;
     212             :         Real64 QHeatRecovery;
     213             :         Real64 EnergyHeatRecovery;
     214             :         Real64 HeatRecInletTemp; // (HeatRecOutletTemp is in base already)
     215             :         Real64 HeatRecMdot;
     216             :         Real64 ChillerCondAvgTemp; // the effective condenser temperature for chiller performance [C]
     217             :         Real64 partLoadRatio = 0.0;
     218             :         Real64 cyclingRatio = 0.0;
     219             : 
     220             :         // thermosiphon model
     221             :         int thermosiphonTempCurveIndex = 0;
     222             :         Real64 thermosiphonMinTempDiff = 0.0;
     223             :         int thermosiphonStatus = 0;
     224             : 
     225             :         // Default Constructor
     226         426 :         ElectricChillerSpecs()
     227         426 :             : CapRatCoef(3, 0.0), PowerRatCoef(3, 0.0), FullLoadCoef(3, 0.0), TempLowLimitEvapOut(0.0), DesignHeatRecVolFlowRate(0.0),
     228         426 :               DesignHeatRecVolFlowRateWasAutoSized(false), DesignHeatRecMassFlowRate(0.0), HeatRecActive(false), HeatRecInletNodeNum(0),
     229         426 :               HeatRecOutletNodeNum(0), HeatRecCapacityFraction(0.0), HeatRecMaxCapacityLimit(0.0), HeatRecSetPointNodeNum(0),
     230         426 :               HeatRecInletLimitSchedNum(0), HRPlantLoc{}, CondOutletHumRat(0.0), ActualCOP(0.0), QHeatRecovery(0.0), EnergyHeatRecovery(0.0),
     231         852 :               HeatRecInletTemp(0.0), HeatRecMdot(0.0), ChillerCondAvgTemp(0.0)
     232             :         {
     233         426 :         }
     234             : 
     235             :         static void getInput(EnergyPlusData &state);
     236             : 
     237             :         void setupOutputVariables(EnergyPlusData &state);
     238             : 
     239             :         static ElectricChillerSpecs *factory(EnergyPlusData &state, std::string const &chillerName);
     240             : 
     241             :         void simulate([[maybe_unused]] EnergyPlusData &state,
     242             :                       const PlantLocation &calledFromLocation,
     243             :                       bool FirstHVACIteration,
     244             :                       Real64 &CurLoad,
     245             :                       bool RunFlag) override;
     246             : 
     247             :         void initialize(EnergyPlusData &state, bool RunFlag, Real64 MyLoad) override;
     248             : 
     249             :         void size(EnergyPlusData &state) override;
     250             : 
     251             :         void calculate(EnergyPlusData &state,
     252             :                        Real64 &MyLoad,                                   // operating load
     253             :                        bool RunFlag,                                     // TRUE when chiller operating
     254             :                        DataBranchAirLoopPlant::ControlType EquipFlowCtrl // Flow control mode for the equipment
     255             :         );
     256             : 
     257             :         void update(EnergyPlusData &state,
     258             :                     Real64 MyLoad, // current load
     259             :                     bool RunFlag   // TRUE if chiller operating
     260             :         );
     261             : 
     262             :         void calcHeatRecovery(EnergyPlusData &state,
     263             :                               Real64 &QCond,        // current condenser load
     264             :                               Real64 CondMassFlow,  // current condenser Mass Flow
     265             :                               Real64 condInletTemp, // current condenser Inlet Temp
     266             :                               Real64 &QHeatRec      // amount of heat recovered
     267             :         );
     268             : 
     269             :         void oneTimeInit(EnergyPlusData &state) override;
     270             : 
     271             :         bool thermosiphonDisabled(EnergyPlusData &state);
     272             :     };
     273             : 
     274             :     struct EngineDrivenChillerSpecs : BaseChillerSpecs
     275             :     {
     276             :         // temperature at the chiller evaporator side outlet
     277             :         Constant::eFuel FuelType = Constant::eFuel::Invalid;
     278             :         Array1D<Real64> CapRatCoef;                // (EngineDriven RCAVC() ) coeff of cap ratio poly fit
     279             :         Array1D<Real64> PowerRatCoef;              // (EngineDriven ADJEC() ) coeff of power rat poly fit
     280             :         Array1D<Real64> FullLoadCoef;              // (EngineDriven RPWRC() ) coeff of full load poly. fit
     281             :         Real64 TempLowLimitEvapOut;                // C - low temperature shut off
     282             :         int ClngLoadtoFuelCurve;                   // Coeff of Shaft Power to Fuel Energy Input Coeff Poly Fit
     283             :         int RecJacHeattoFuelCurve;                 // Curve Index for Ratio of Recoverable Jacket Heat to
     284             :         int RecLubeHeattoFuelCurve;                // Curve Index for Ratio of Recoverable Lube Oil Heat to
     285             :         int TotExhausttoFuelCurve;                 // Curve Index for Total Exhaust heat Input to Fuel Energy Input Coeffs Poly Fit
     286             :         Real64 ExhaustTemp;                        // (TEXDC) Exhaust Gas Temp to Fuel Energy Input
     287             :         int ExhaustTempCurve;                      // Curve Index for Exhaust Gas Temp to Fuel Energy Input Coeffs Poly Fit
     288             :         Real64 UA;                                 // (UACDC) exhaust gas Heat Exchanger UA to Capacity
     289             :         Array1D<Real64> UACoef;                    // Heat Exchanger UA Coeffs Poly Fit
     290             :         Real64 MaxExhaustperPowerOutput;           // MAX EXHAUST FLOW PER W DSL POWER OUTPUT COEFF
     291             :         Real64 DesignMinExitGasTemp;               // Steam Saturation Temperature
     292             :         Real64 FuelHeatingValue;                   // Heating Value of Fuel in kJ/kg
     293             :         Real64 DesignHeatRecVolFlowRate;           // m3/s, Design Water mass flow rate through heat recovery loop
     294             :         bool DesignHeatRecVolFlowRateWasAutoSized; // true if user input was autosize for heat recover design flow rate
     295             :         Real64 DesignHeatRecMassFlowRate;          // kg/s, Design Water mass flow rate through heat recovery loop
     296             :         bool HeatRecActive;                        // True entered Heat Rec Vol Flow Rate >0
     297             :         int HeatRecInletNodeNum;                   // Node number on the heat recovery inlet side of the condenser
     298             :         int HeatRecOutletNodeNum;                  // Node number on the heat recovery outlet side of the condenser
     299             :         Real64 HeatRecCapacityFraction;            // user input for heat recovery capacity fraction []
     300             :         Real64 HeatRecMaxTemp;                     // Max Temp that can be produced in heat recovery
     301             :         PlantLocation HRPlantLoc;                  // heat recovery water plant loop component index
     302             : 
     303             :         // engine driven:
     304             :         Real64 HeatRecInletTemp;    // Inlet Temperature of the heat recovery fluid
     305             :         Real64 HeatRecMdotActual;   // Heat Recovery Loop Mass flow rate
     306             :         Real64 QTotalHeatRecovered; // total heat recovered (W)
     307             :         Real64 QJacketRecovered;    // heat recovered from jacket (W)
     308             :         Real64 QLubeOilRecovered;   // heat recovered from lube (W)
     309             :         Real64 QExhaustRecovered;   // exhaust gas heat recovered (W)
     310             :         Real64 FuelEnergyUseRate;   // Fuel Energy used (W)
     311             :         Real64 TotalHeatEnergyRec;  // total heat recovered (J)
     312             :         Real64 JacketEnergyRec;     // heat recovered from jacket (J)
     313             :         Real64 LubeOilEnergyRec;    // heat recovered from lube (J)
     314             :         Real64 ExhaustEnergyRec;    // exhaust gas heat recovered (J)
     315             :         Real64 FuelEnergy;          // Fuel Energy used (J)
     316             :         Real64 FuelMdot;            // Fuel Amount used (Kg/s)
     317             :         Real64 ExhaustStackTemp;    // Exhaust Stack Temperature (C)
     318             : 
     319             :         Real64 HeatRecMdot; // Heat Recovery Loop Mass flow rate (kg/s)
     320             :         Real64 FuelCOP;     // Fuel COP [delivered cooling rate/fuel energy input rate] (W/W)
     321             : 
     322             :         // Default Constructor
     323          24 :         EngineDrivenChillerSpecs()
     324          24 :             : CapRatCoef(3, 0.0), PowerRatCoef(3, 0.0), FullLoadCoef(3, 0.0), TempLowLimitEvapOut(0.0), ClngLoadtoFuelCurve(0),
     325          24 :               RecJacHeattoFuelCurve(0), RecLubeHeattoFuelCurve(0), TotExhausttoFuelCurve(0), ExhaustTemp(0.0), ExhaustTempCurve(0), UA(0.0),
     326          24 :               UACoef(2, 0.0), MaxExhaustperPowerOutput(0.0), DesignMinExitGasTemp(0.0), FuelHeatingValue(0.0), DesignHeatRecVolFlowRate(0.0),
     327          24 :               DesignHeatRecVolFlowRateWasAutoSized(false), DesignHeatRecMassFlowRate(0.0), HeatRecActive(false), HeatRecInletNodeNum(0),
     328          24 :               HeatRecOutletNodeNum(0), HeatRecCapacityFraction(0.0), HeatRecMaxTemp(0.0), HRPlantLoc{}, HeatRecInletTemp(0.0), HeatRecMdotActual(0.0),
     329          24 :               QTotalHeatRecovered(0.0), QJacketRecovered(0.0),
     330             : 
     331             :               // engine driven:
     332          24 :               QLubeOilRecovered(0.0), QExhaustRecovered(0.0), FuelEnergyUseRate(0.0), TotalHeatEnergyRec(0.0), JacketEnergyRec(0.0),
     333          24 :               LubeOilEnergyRec(0.0), ExhaustEnergyRec(0.0), FuelEnergy(0.0), FuelMdot(0.0), ExhaustStackTemp(0.0), HeatRecMdot(0.0), FuelCOP(0.0)
     334             :         {
     335          24 :         }
     336             : 
     337             :         static EngineDrivenChillerSpecs *factory(EnergyPlusData &state, std::string const &chillerName);
     338             : 
     339             :         static void getInput(EnergyPlusData &state);
     340             : 
     341             :         void simulate([[maybe_unused]] EnergyPlusData &state,
     342             :                       const PlantLocation &calledFromLocation,
     343             :                       bool FirstHVACIteration,
     344             :                       Real64 &CurLoad,
     345             :                       bool RunFlag) override;
     346             : 
     347             :         void setupOutputVariables(EnergyPlusData &state);
     348             : 
     349             :         void initialize(EnergyPlusData &state, bool RunFlag, Real64 MyLoad) override;
     350             : 
     351             :         void size(EnergyPlusData &state) override;
     352             : 
     353             :         void calculate(EnergyPlusData &state,
     354             :                        Real64 &MyLoad,                                   // operating load
     355             :                        bool RunFlag,                                     // TRUE when chiller operating
     356             :                        DataBranchAirLoopPlant::ControlType EquipFlowCtrl // Flow control mode for the equipment
     357             :         );
     358             : 
     359             :         void calcHeatRecovery(EnergyPlusData &state,
     360             :                               Real64 EnergyRecovered, // Amount of heat recovered
     361             :                               Real64 &HeatRecRatio    // Max Heat recovery ratio
     362             :         );
     363             : 
     364             :         void update(EnergyPlusData &state,
     365             :                     Real64 MyLoad, // current load
     366             :                     bool RunFlag   // TRUE if chiller operating
     367             :         );
     368             : 
     369             :         void oneTimeInit(EnergyPlusData &state) override;
     370             :     };
     371             : 
     372             :     struct GTChillerSpecs : BaseChillerSpecs
     373             :     {
     374             :         // Members
     375             :         Constant::eFuel FuelType = Constant::eFuel::Invalid;
     376             :         Array1D<Real64> CapRatCoef;   // (GT RCAVC() ) coeff of cap ratio poly fit
     377             :         Array1D<Real64> PowerRatCoef; // (GT ADJEC() ) coeff of power rat poly fit
     378             :         Array1D<Real64> FullLoadCoef; // (GT RPWRC() ) coeff of full load poly. fit
     379             :         Real64 TempLowLimitEvapOut;   // C - low temperature shut off
     380             :         // "special" GT chiller input parameters
     381             :         Real64 FuelEnergyIn;                      // (EFUEL) Amount of Fuel Energy Required to run gas turbine
     382             :         Array1D<Real64> PLBasedFuelInputCoef;     // (FUL1GC) Part Load Ratio Based Fuel Input Coefficients Poly Fit
     383             :         Array1D<Real64> TempBasedFuelInputCoef;   // (FUL2GC) Ambient Temperature Based Fuel Input Coeff Poly Fit
     384             :         Real64 ExhaustFlow;                       // (FEX) Exhaust Gas Flow Rate cubic meters per second
     385             :         Array1D<Real64> ExhaustFlowCoef;          // (FEXGC) Exhaust Gas Flow Rate Input Coef Poly Fit
     386             :         Real64 ExhaustTemp;                       // (TEX) Exhaust Gas Temperature in C
     387             :         Array1D<Real64> PLBasedExhaustTempCoef;   // (TEX1GC) Part Load Ratio Based Exhaust Temperature Input Coeffs Poly Fit
     388             :         Array1D<Real64> TempBasedExhaustTempCoef; // (TEX2GC) Ambient Temperature Based Exhaust Gas Temp to
     389             :         // Fuel Energy Input Coeffs Poly Fit
     390             :         Real64 HeatRecLubeEnergy;                  // (ELUBE) Recoverable Lube Oil Energy
     391             :         Real64 HeatRecLubeRate;                    // (ELUBE) Recoverable Lube Oil Rate of Recovery (W)
     392             :         Array1D<Real64> HeatRecLubeEnergyCoef;     // (ELUBEGC)  Recoverable Lube Oil Energy Input Coef Poly Fit
     393             :         Real64 UAtoCapRat;                         // (UACGC) Heat Exchanger UA to Capacity
     394             :         Array1D<Real64> UAtoCapCoef;               // Heat Exchanger UA to Capacity Coeffs Poly Fit
     395             :         Real64 GTEngineCapacity;                   // Capacity of GT Unit attached to Chiller
     396             :         bool GTEngineCapacityWasAutoSized;         // true if previous field was autosize on inpt
     397             :         Real64 MaxExhaustperGTPower;               // Max Exhaust Flow per KW Power Out
     398             :         Real64 DesignSteamSatTemp;                 // Steam Saturation Temperature
     399             :         Real64 ExhaustStackTemp;                   // Temperature of Exhaust Gases
     400             :         int HeatRecInletNodeNum;                   // Node number on the heat recovery inlet side of the condenser
     401             :         int HeatRecOutletNodeNum;                  // Node number on the heat recovery outlet side of the condenser
     402             :         Real64 HeatRecInletTemp;                   // Inlet Temperature of the heat recovery fluid (HeatRecOutletTemp is in base already)
     403             :         Real64 HeatRecMdot;                        // Heat Recovery Loop Mass flow rate
     404             :         Real64 DesignHeatRecVolFlowRate;           // m3/s, Design Water mass flow rate through heat recovery loop
     405             :         bool DesignHeatRecVolFlowRateWasAutoSized; // true if previous field was autosize on input
     406             :         Real64 DesignHeatRecMassFlowRate;          // kg/s, Design Water mass flow rate through heat recovery loop
     407             :         bool HeatRecActive;                        // True entered Heat Rec Vol Flow Rate >0
     408             :         Real64 FuelHeatingValue;                   // Heating Value of Fuel in kJ/kg
     409             :         Real64 HeatRecCapacityFraction;            // user input for heat recovery capacity fraction []
     410             :         Real64 engineCapacityScalar;               // user input for engine efficiency for sizing GTEngineCapacity []
     411             :         Real64 HeatRecMaxTemp;                     // Max Temp that can be produced in heat recovery
     412             :         PlantLocation HRPlantLoc;                  // heat recovery water plant loop component index
     413             : 
     414             :         Real64 FuelEnergyUsed;     // Fuel Energy used
     415             :         Real64 FuelEnergyUsedRate; // Fuel energy used rate (fuel consumption rate)
     416             :         Real64 FuelMassUsed;       // Fuel Amount used
     417             :         Real64 FuelMassUsedRate;   // Fuel amount used (fuel Mass consumption rate)
     418             :         Real64 FuelCOP;            // Fuel coefficient of performance (Qevap/FuelEnergyUsedRate)
     419             : 
     420             :         // Default Constructor
     421           4 :         GTChillerSpecs()
     422           4 :             : CapRatCoef(3, 0.0), PowerRatCoef(3, 0.0), FullLoadCoef(3, 0.0), TempLowLimitEvapOut(0.0), FuelEnergyIn(0.0),
     423           4 :               PLBasedFuelInputCoef(3, 0.0), TempBasedFuelInputCoef(3, 0.0), ExhaustFlow(0.0), ExhaustFlowCoef(3, 0.0), ExhaustTemp(0.0),
     424           4 :               PLBasedExhaustTempCoef(3, 0.0), TempBasedExhaustTempCoef(3, 0.0), HeatRecLubeEnergy(0.0), HeatRecLubeRate(0.0),
     425           4 :               HeatRecLubeEnergyCoef(3, 0.0), UAtoCapRat(0.0), UAtoCapCoef(3, 0.0), GTEngineCapacity(0.0), GTEngineCapacityWasAutoSized(false),
     426           4 :               MaxExhaustperGTPower(0.0), DesignSteamSatTemp(0.0), ExhaustStackTemp(0.0), HeatRecInletNodeNum(0), HeatRecOutletNodeNum(0),
     427           4 :               HeatRecInletTemp(0.0), HeatRecMdot(0.0), DesignHeatRecVolFlowRate(0.0), DesignHeatRecVolFlowRateWasAutoSized(false),
     428           4 :               DesignHeatRecMassFlowRate(0.0), HeatRecActive(false), FuelHeatingValue(0.0), HeatRecCapacityFraction(0.0), engineCapacityScalar(0.35),
     429           8 :               HeatRecMaxTemp(0.0), HRPlantLoc{}, FuelEnergyUsed(0.0), FuelEnergyUsedRate(0.0), FuelMassUsed(0.0), FuelMassUsedRate(0.0), FuelCOP(0.0)
     430             :         {
     431           4 :         }
     432             : 
     433             :         static GTChillerSpecs *factory(EnergyPlusData &state, std::string const &chillerName);
     434             : 
     435             :         static void getInput(EnergyPlusData &state);
     436             : 
     437             :         void simulate([[maybe_unused]] EnergyPlusData &state,
     438             :                       const PlantLocation &calledFromLocation,
     439             :                       bool FirstHVACIteration,
     440             :                       Real64 &CurLoad,
     441             :                       bool RunFlag) override;
     442             : 
     443             :         void setupOutputVariables(EnergyPlusData &state);
     444             : 
     445             :         void initialize(EnergyPlusData &state, bool RunFlag, Real64 MyLoad) override;
     446             : 
     447             :         void size(EnergyPlusData &state) override;
     448             : 
     449             :         void calculate(EnergyPlusData &state,
     450             :                        Real64 &MyLoad,                                   // operating load
     451             :                        bool RunFlag,                                     // TRUE when chiller operating
     452             :                        DataBranchAirLoopPlant::ControlType EquipFlowCtrl // Flow control mode for the equipment
     453             :         );
     454             : 
     455             :         void update(EnergyPlusData &state,
     456             :                     Real64 MyLoad, // current load
     457             :                     bool RunFlag   // TRUE if chiller operating
     458             :         );
     459             : 
     460             :         void oneTimeInit(EnergyPlusData &state) override;
     461             :     };
     462             : 
     463             :     struct ConstCOPChillerSpecs : BaseChillerSpecs
     464             :     {
     465             :         // Members
     466             :         Real64 ActualCOP;
     467             :         Real64 partLoadRatio = 0.0;
     468             :         Real64 cyclingRatio = 1.0;
     469             : 
     470             :         // thermosiphon model
     471             :         int thermosiphonTempCurveIndex = 0;
     472             :         Real64 thermosiphonMinTempDiff = 0.0;
     473             :         int thermosiphonStatus = 0;
     474             : 
     475             :         // Default Constructor
     476         188 :         ConstCOPChillerSpecs() : ActualCOP(0.0)
     477             :         {
     478         188 :         }
     479             : 
     480             :         static ConstCOPChillerSpecs *factory(EnergyPlusData &state, std::string const &chillerName);
     481             : 
     482             :         static void getInput(EnergyPlusData &state);
     483             : 
     484             :         void simulate([[maybe_unused]] EnergyPlusData &state,
     485             :                       const PlantLocation &calledFromLocation,
     486             :                       bool FirstHVACIteration,
     487             :                       Real64 &CurLoad,
     488             :                       bool RunFlag) override;
     489             : 
     490             :         void setupOutputVariables(EnergyPlusData &state);
     491             : 
     492             :         void initialize(EnergyPlusData &state, bool RunFlag, Real64 MyLoad) override;
     493             : 
     494             :         void size(EnergyPlusData &state) override;
     495             : 
     496             :         void calculate(EnergyPlusData &state, Real64 &MyLoad, bool RunFlag, DataBranchAirLoopPlant::ControlType EquipFlowCtrl);
     497             : 
     498             :         void update(EnergyPlusData &state, Real64 MyLoad, bool RunFlag);
     499             : 
     500             :         void oneTimeInit(EnergyPlusData &state) override;
     501             : 
     502             :         bool thermosiphonDisabled(EnergyPlusData &state);
     503             :     };
     504             : } // namespace PlantChillers
     505             : 
     506             : struct PlantChillersData : BaseGlobalStruct
     507             : {
     508             : 
     509             :     int NumElectricChillers = 0;
     510             :     int NumEngineDrivenChillers = 0;
     511             :     int NumGTChillers = 0;
     512             :     int NumConstCOPChillers = 0;
     513             : 
     514             :     bool GetEngineDrivenInput = true;
     515             :     bool GetElectricInput = true;
     516             :     bool GetGasTurbineInput = true;
     517             :     bool GetConstCOPInput = true;
     518             : 
     519             :     EPVector<PlantChillers::ElectricChillerSpecs> ElectricChiller;
     520             :     EPVector<PlantChillers::EngineDrivenChillerSpecs> EngineDrivenChiller;
     521             :     EPVector<PlantChillers::GTChillerSpecs> GTChiller;
     522             :     EPVector<PlantChillers::ConstCOPChillerSpecs> ConstCOPChiller;
     523             : 
     524         796 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     525             :     {
     526         796 :     }
     527             : 
     528           0 :     void clear_state() override
     529             :     {
     530           0 :         NumElectricChillers = 0;
     531           0 :         NumEngineDrivenChillers = 0;
     532           0 :         NumGTChillers = 0;
     533           0 :         NumConstCOPChillers = 0;
     534           0 :         GetEngineDrivenInput = true;
     535           0 :         GetElectricInput = true;
     536           0 :         GetGasTurbineInput = true;
     537           0 :         GetConstCOPInput = true;
     538           0 :         ElectricChiller.deallocate();
     539           0 :         EngineDrivenChiller.deallocate();
     540           0 :         GTChiller.deallocate();
     541           0 :         ConstCOPChiller.deallocate();
     542           0 :     }
     543             : };
     544             : 
     545             : } // namespace EnergyPlus
     546             : 
     547             : #endif

Generated by: LCOV version 1.14