LCOV - code coverage report
Current view: top level - EnergyPlus - ChillerElectricEIR.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 7 7
Test Date: 2025-05-22 16:09:37 Functions: 100.0 % 3 3

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, 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 ChillerElectricEIR_hh_INCLUDED
      49              : #define ChillerElectricEIR_hh_INCLUDED
      50              : 
      51              : // ObjexxFCL Headers
      52              : #include <ObjexxFCL/Array1D.hh>
      53              : 
      54              : // EnergyPlus Headers
      55              : #include <EnergyPlus/Data/BaseData.hh>
      56              : #include <EnergyPlus/DataGlobals.hh>
      57              : #include <EnergyPlus/EnergyPlus.hh>
      58              : #include <EnergyPlus/Plant/DataPlant.hh>
      59              : #include <EnergyPlus/PlantComponent.hh>
      60              : 
      61              : namespace EnergyPlus {
      62              : 
      63              : // Forward declarations
      64              : struct EnergyPlusData;
      65              : 
      66              : namespace ChillerElectricEIR {
      67              : 
      68              :     struct ElectricEIRChillerSpecs : PlantComponent
      69              :     {
      70              :         // Members
      71              :         std::string Name;                                                           // User identifier
      72              :         int TypeNum = 0;                                                            // plant loop type identifier
      73              :         DataPlant::CondenserType CondenserType = DataPlant::CondenserType::Invalid; // Type of Condenser - Air Cooled, Water Cooled or Evap Cooled
      74              :         Real64 RefCap = 0.0;                                                        // Reference capacity of chiller [W]
      75              :         bool RefCapWasAutoSized = false;                                            // reference capacity was autosized on input
      76              :         Real64 RefCOP = 0.0;                                                        // Reference coefficient of performance [W/W]
      77              :         DataPlant::FlowMode FlowMode = DataPlant::FlowMode::Invalid;                // one of 3 modes for component flow during operation
      78              :         DataPlant::CondenserFlowControl CondenserFlowControl = DataPlant::CondenserFlowControl::Invalid;
      79              :         bool ModulatedFlowSetToLoop = false;      // True if the setpoint is missing at the outlet node
      80              :         bool ModulatedFlowErrDone = false;        // true if setpoint warning issued
      81              :         bool HRSPErrDone = false;                 // TRUE if set point warning issued for heat recovery loop
      82              :         Real64 EvapVolFlowRate = 0.0;             // Reference water volumetric flow rate through the evaporator [m3/s]
      83              :         bool EvapVolFlowRateWasAutoSized = false; // true if previous was autosize input
      84              :         Real64 EvapMassFlowRate = 0.0;
      85              :         Real64 EvapMassFlowRateMax = 0.0;         // Reference water mass flow rate through evaporator [kg/s]
      86              :         Real64 CondVolFlowRate = 0.0;             // Reference water volumetric flow rate through the condenser [m3/s]
      87              :         bool CondVolFlowRateWasAutoSized = false; // true if previous was set to autosize on input
      88              :         Real64 CondMassFlowRate = 0.0;            // Condenser mass flow rate [kg/s]
      89              :         Real64 CondMassFlowRateMax = 0.0;         // Reference water mass flow rate through condenser [kg/s]
      90              :         Real64 CondenserFanPowerRatio = 0.0;      // Reference power of condenser fan to capacity ratio, W/W
      91              :         Real64 CompPowerToCondenserFrac = 0.0;    // Fraction of compressor electric power rejected by condenser [0 to 1]
      92              :         int EvapInletNodeNum = 0;                 // Node number on the inlet side of the plant (evaporator side)
      93              :         int EvapOutletNodeNum = 0;                // Node number on the outlet side of the plant (evaporator side)
      94              :         Real64 EvapOutletTemp = 0.0;              // Evaporator outlet temperature [C]
      95              :         int CondInletNodeNum = 0;                 // Node number on the inlet side of the condenser
      96              :         int CondOutletNodeNum = 0;                // Node number on the outlet side of the condenser
      97              :         Real64 CondOutletTemp = 0.0;              // Condenser outlet temperature [C]
      98              :         Real64 CondOutletHumRat = 0.0;            // Condenser outlet humidity ratio [kg/kg]
      99              :         Real64 MinPartLoadRat = 0.0;              // Minimum allowed operating fraction of full load
     100              :         Real64 MaxPartLoadRat = 0.0;              // Maximum allowed operating fraction of full load
     101              :         Real64 OptPartLoadRat = 0.0;              // Optimal operating fraction of full load
     102              :         Real64 MinUnloadRat = 0.0;                // Minimum unloading ratio
     103              :         Real64 TempRefCondIn = 0.0;               // The reference secondary loop fluid temperature
     104              :         // at the chiller condenser side inlet [C]
     105              :         Real64 TempRefEvapOut = 0.0; // The reference primary loop fluid temperature
     106              :         // at the chiller evaporator side outlet [C]
     107              :         Real64 TempLowLimitEvapOut = 0.0;                  // Low temperature shut off [C]
     108              :         Real64 DesignHeatRecVolFlowRate = 0.0;             // Design water volumetric flow rate through heat recovery loop [m3/s]
     109              :         bool DesignHeatRecVolFlowRateWasAutoSized = false; // true if previous input was autosize
     110              :         Real64 DesignHeatRecMassFlowRate = 0.0;            // Design water mass flow rate through heat recovery loop [kg/s]
     111              :         Real64 SizFac = 0.0;                               // sizing factor
     112              :         Real64 BasinHeaterPowerFTempDiff = 0.0;            // Basin heater capacity per degree C below setpoint (W/C)
     113              :         Real64 BasinHeaterSetPointTemp = 0.0;              // setpoint temperature for basin heater operation (C)
     114              :         bool HeatRecActive = false;                        // True when entered Heat Rec Vol Flow Rate > 0
     115              :         int HeatRecInletNodeNum = 0;                       // Node number for the heat recovery inlet side of the condenser
     116              :         int HeatRecOutletNodeNum = 0;                      // Node number for the heat recovery outlet side of the condenser
     117              :         Real64 HeatRecCapacityFraction = 0.0;              // user input for heat recovery capacity fraction []
     118              :         Real64 HeatRecMaxCapacityLimit = 0.0;              // Capacity limit for Heat recovery, one time calc [W]
     119              :         int HeatRecSetPointNodeNum = 0;                    // index for system node with the heat recover leaving setpoint
     120              :         Sched::Schedule *heatRecInletLimitSched = nullptr; // schedule for the inlet high limit for heat recovery operation
     121              :         int ChillerCapFTIndex = 0;                         // Index for the total cooling capacity modifier curve
     122              :         // (function of leaving chilled water temperature and
     123              :         //  entering condenser fluid temperature)
     124              :         int ChillerEIRFTIndex = 0; // Index for the energy input ratio modifier curve
     125              :         // (function of leaving chilled water temperature and
     126              :         //  entering condenser fluid temperature)
     127              :         int ChillerEIRFPLRIndex = 0;                 // Index for the EIR vs part-load ratio curve
     128              :         int ChillerCapFTError = 0;                   // Used for negative capacity as a function of temp warnings
     129              :         int ChillerCapFTErrorIndex = 0;              // Used for negative capacity as a function of temp warnings
     130              :         int ChillerEIRFTError = 0;                   // Used for negative EIR as a function of temp warnings
     131              :         int ChillerEIRFTErrorIndex = 0;              // Used for negative EIR as a function of temp warnings
     132              :         int ChillerEIRFPLRError = 0;                 // Used for negative EIR as a function of PLR warnings
     133              :         int ChillerEIRFPLRErrorIndex = 0;            // Used for negative EIR as a function of PLR warnings
     134              :         Real64 ChillerEIRFPLRMin = 0.0;              // Minimum value of PLR from EIRFPLR curve
     135              :         Real64 ChillerEIRFPLRMax = 0.0;              // Maximum value of PLR from EIRFPLR curve
     136              :         int DeltaTErrCount = 0;                      // Evaporator delta T equals 0 for variable flow chiller warning messages
     137              :         int DeltaTErrCountIndex = 0;                 // Index to evaporator delta T = 0 for variable flow chiller warning messages
     138              :         PlantLocation CWPlantLoc;                    // chilled water plant loop component index
     139              :         PlantLocation CDPlantLoc;                    // condenser water plant loop component index
     140              :         PlantLocation HRPlantLoc;                    // heat recovery water plant loop component index
     141              :         Sched::Schedule *basinHeaterSched = nullptr; // basin heater schedule
     142              :         int CondMassFlowIndex = 0;
     143              :         std::string MsgBuffer1;          // - buffer to print warning messages on following time step
     144              :         std::string MsgBuffer2;          // - buffer to print warning messages on following time step
     145              :         Real64 MsgDataLast = 0.0;        // value of data when warning occurred (passed to Recurring Warn)
     146              :         bool PrintMessage = false;       // logical to determine if message is valid
     147              :         int MsgErrorCount = 0;           // number of occurrences of warning
     148              :         int ErrCount1 = 0;               // for recurring error messages
     149              :         bool PossibleSubcooling = false; // flag to indicate chiller is doing less cooling that requested
     150              :         // Operational fault parameters
     151              :         bool FaultyChillerSWTFlag = false;       // True if the chiller has SWT sensor fault
     152              :         int FaultyChillerSWTIndex = 0;           // Index of the fault object corresponding to the chiller
     153              :         Real64 FaultyChillerSWTOffset = 0.0;     // Chiller SWT sensor offset
     154              :         bool FaultyChillerFoulingFlag = false;   // True if the chiller has fouling fault
     155              :         int FaultyChillerFoulingIndex = 0;       // Index of the fault object corresponding to the chiller
     156              :         Real64 FaultyChillerFoulingFactor = 1.0; // Chiller fouling factor
     157              :         std::string EndUseSubcategory;           // identifier use for the end use subcategory
     158              :         Real64 TimeStepSysLast = 0.0;
     159              :         Real64 CurrentEndTimeLast = 0.0;
     160              :         bool oneTimeFlag = true;
     161              :         bool MyEnvrnFlag = true;
     162              :         Real64 EvapWaterConsump = 0.0;              // Evap cooler water consumption (m3)
     163              :         Real64 EvapWaterConsumpRate = 0.0;          // Evap condenser water consumption rate [m3/s]
     164              :         Real64 Power = 0.0;                         // Rate of chiller electric energy use [W]
     165              :         Real64 QEvaporator = 0.0;                   // Rate of heat transfer to the evaporator coil [W]
     166              :         Real64 QCondenser = 0.0;                    // Rate of heat transfer to the condenser coil [W]
     167              :         Real64 QHeatRecovered = 0.0;                // Rate of heat transfer to the heat recovery coil [W]
     168              :         Real64 HeatRecOutletTemp = 0.0;             // Heat recovery outlet temperature [C]
     169              :         Real64 CondenserFanPower = 0.0;             // Condenser Fan Power (fan cycles with compressor) [W]
     170              :         Real64 ChillerCapFT = 0.0;                  // Chiller capacity fraction (evaluated as a function of temperature)
     171              :         Real64 ChillerEIRFT = 0.0;                  // Chiller electric input ratio (EIR = 1 / COP) as a function of temperature
     172              :         Real64 ChillerEIRFPLR = 0.0;                // Chiller EIR as a function of part-load ratio (PLR)
     173              :         Real64 ChillerPartLoadRatio = 0.0;          // Chiller part-load ratio (PLR)
     174              :         Real64 ChillerCyclingRatio = 0.0;           // Chiller cycling ratio
     175              :         Real64 BasinHeaterPower = 0.0;              // Basin heater power (W)
     176              :         Real64 ChillerFalseLoadRate = 0.0;          // Chiller false load over and above the water-side load [W]
     177              :         Real64 ChillerFalseLoad = 0.0;              // reporting: Chiller false load over and above water side load [W]
     178              :         Real64 Energy = 0.0;                        // reporting: Chiller electric consumption [J]
     179              :         Real64 EvapEnergy = 0.0;                    // reporting: Evaporator heat transfer energy [J]
     180              :         Real64 CondEnergy = 0.0;                    // reporting: Condenser heat transfer energy [J]
     181              :         Real64 CondInletTemp = 0.0;                 // reporting: Condenser inlet temperature [C]
     182              :         Real64 EvapInletTemp = 0.0;                 // reporting: Evaporator inlet temperature [C]
     183              :         Real64 ActualCOP = 0.0;                     // reporting: Coefficient of performance
     184              :         Real64 EnergyHeatRecovery = 0.0;            // reporting: Energy recovered from water-cooled condenser [J]
     185              :         Real64 HeatRecInletTemp = 0.0;              // reporting: Heat reclaim inlet temperature [C]
     186              :         Real64 HeatRecMassFlow = 0.0;               // reporting: Heat reclaim mass flow rate [kg/s]
     187              :         Real64 ChillerCondAvgTemp = 0.0;            // reporting: average condenser temp for curves with Heat recovery [C]
     188              :         Real64 CondenserFanEnergyConsumption = 0.0; // reporting: Air-cooled condenser fan energy [J]
     189              :         Real64 BasinHeaterConsumption = 0.0;        // Basin heater energy consumption (J)
     190              :         bool IPLVFlag = true;
     191              :         int ChillerCondLoopFlowFLoopPLRIndex = 0; // Condenser loop flow rate fraction function of loop PLR
     192              :         int CondDT = 0;                           // Temperature difference across condenser
     193              :         Sched::Schedule *condDTSched = nullptr;   // Temperature difference across condenser schedule
     194              :         Real64 MinCondFlowRatio = 0.2;            // Minimum condenser flow fraction
     195              :         DataBranchAirLoopPlant::ControlType EquipFlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid;
     196              :         Real64 VSBranchPumpMinLimitMassFlowCond = 0.0;
     197              :         bool VSBranchPumpFoundCond = false;
     198              :         bool VSLoopPumpFoundCond = false;
     199              : 
     200              :         // thermosiphon model
     201              :         int thermosiphonTempCurveIndex = 0;
     202              :         Real64 thermosiphonMinTempDiff = 0.0;
     203              :         int thermosiphonStatus = 0;
     204              : 
     205              :         static ElectricEIRChillerSpecs *factory(EnergyPlusData &state, std::string const &objectName);
     206              : 
     207              :         void setupOutputVars(EnergyPlusData &state);
     208              : 
     209              :         void simulate([[maybe_unused]] EnergyPlusData &state,
     210              :                       const PlantLocation &calledFromLocation,
     211              :                       bool FirstHVACIteration,
     212              :                       Real64 &CurLoad,
     213              :                       bool RunFlag) override;
     214              : 
     215              :         virtual void getDesignCapacities(
     216              :             EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     217              : 
     218              :         void getDesignTemperatures(Real64 &TempDesCondIn, Real64 &TempDesEvapOut) override;
     219              : 
     220              :         void getSizingFactor(Real64 &sizFac) override;
     221              : 
     222              :         void onInitLoopEquip(EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
     223              : 
     224              :         void oneTimeInit(EnergyPlusData &state) override;
     225              : 
     226              :         void initEachEnvironment(EnergyPlusData &state);
     227              : 
     228              :         virtual void initialize(EnergyPlusData &state, bool RunFlag, Real64 MyLoad);
     229              : 
     230              :         virtual void size(EnergyPlusData &state);
     231              : 
     232              :         virtual void calculate(EnergyPlusData &state, Real64 &MyLoad, bool RunFlag);
     233              : 
     234              :         void calcHeatRecovery(EnergyPlusData &state,
     235              :                               Real64 &QCond,        // Current condenser load [W]
     236              :                               Real64 CondMassFlow,  // Current condenser mass flow [kg/s]
     237              :                               Real64 condInletTemp, // Current condenser inlet temp [C]
     238              :                               Real64 &QHeatRec      // Amount of heat recovered [W]
     239              :         );
     240              : 
     241              :         virtual void update(EnergyPlusData &state, Real64 MyLoad, bool RunFlag);
     242              : 
     243              :         bool thermosiphonDisabled(EnergyPlusData &state);
     244              :     };
     245              : 
     246              :     void GetElectricEIRChillerInput(EnergyPlusData &state);
     247              : 
     248              : } // namespace ChillerElectricEIR
     249              : 
     250              : struct ChillerElectricEIRData : BaseGlobalStruct
     251              : {
     252              :     bool getInputFlag = true;
     253              :     Array1D<ChillerElectricEIR::ElectricEIRChillerSpecs> ElectricEIRChiller;
     254              : 
     255         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     256              :     {
     257         2126 :     }
     258              : 
     259         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     260              :     {
     261         1152 :     }
     262              : 
     263         2100 :     void clear_state() override
     264              :     {
     265         2100 :         new (this) ChillerElectricEIRData();
     266         2100 :     }
     267              : };
     268              : 
     269              : } // namespace EnergyPlus
     270              : 
     271              : #endif
        

Generated by: LCOV version 2.0-1