LCOV - code coverage report
Current view: top level - EnergyPlus - ChillerElectricEIR.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 2 5 40.0 %
Date: 2023-01-17 19:17:23 Functions: 5 8 62.5 %

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

Generated by: LCOV version 1.13