LCOV - code coverage report
Current view: top level - EnergyPlus - ChillerReformulatedEIR.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 ChillerReformulatedEIR_hh_INCLUDED
      49             : #define ChillerReformulatedEIR_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 ChillerReformulatedEIR {
      67             : 
      68             :     enum class PLR
      69             :     {
      70             :         Invalid = -1,
      71             :         LeavingCondenserWaterTemperature, // Type 1_LeavingCondenserWaterTemperature
      72             :         Lift,                             // Type 2_Lift
      73             :         Num
      74             :     };
      75             : 
      76         124 :     struct ReformulatedEIRChillerSpecs : PlantComponent
      77             :     {
      78             :         // Members
      79             :         std::string Name;        // User identifier
      80             :         int TypeNum = 0;         // plant loop type identifier
      81             :         std::string CAPFTName;   // CAPFT curve name
      82             :         std::string EIRFTName;   // EIRFT curve name
      83             :         std::string EIRFPLRName; // EIRPLR curve name
      84             :         DataPlant::CondenserType CondenserType =
      85             :             DataPlant::CondenserType::Invalid;                       // Type of Condenser. Water Cooled is the only available option for now
      86             :         PLR PartLoadCurveType = PLR::Invalid;                        // Part Load Ratio Curve Type: 1_LeavingCondenserWaterTemperature; 2_Lift
      87             :         Real64 RefCap = 0.0;                                         // Reference capacity of the chiller [W]
      88             :         bool RefCapWasAutoSized = false;                             // reference capacity was autosized on input
      89             :         Real64 RefCOP = 0.0;                                         // Reference coefficient of performance [W/W]
      90             :         DataPlant::FlowMode FlowMode = DataPlant::FlowMode::Invalid; // one of 3 modes for component flow during operation
      91             :         bool ModulatedFlowSetToLoop = false;                         // True if the setpoint is missing at the outlet node
      92             :         bool ModulatedFlowErrDone = false;                           // true if setpoint warning issued
      93             :         Real64 EvapVolFlowRate = 0.0;                                // Reference water volumetric flow rate through the evaporator [m3/s]
      94             :         bool EvapVolFlowRateWasAutoSized = false;                    // true if previous was autosize input
      95             :         Real64 EvapMassFlowRateMax = 0.0;                            // Reference water mass flow rate through evaporator [kg/s]
      96             :         Real64 CondVolFlowRate = 0.0;                                // Reference water volumetric flow rate through the condenser [m3/s]
      97             :         bool CondVolFlowRateWasAutoSized = false;                    // true if previous was set to autosize on input
      98             :         Real64 CondMassFlowRateMax = 0.0;                            // Reference water mass flow rate through condenser [kg/s]
      99             :         Real64 CompPowerToCondenserFrac = 0.0;                       // Fraction of compressor electric power rejected by condenser [0 to 1]
     100             :         int EvapInletNodeNum = 0;                                    // Node number on the inlet side of the plant (evaporator side)
     101             :         int EvapOutletNodeNum = 0;                                   // Node number on the outlet side of the plant (evaporator side)
     102             :         int CondInletNodeNum = 0;                                    // Node number on the inlet side of the condenser
     103             :         int CondOutletNodeNum = 0;                                   // Node number on the outlet side of the condenser
     104             :         Real64 MinPartLoadRat = 0.0;                                 // Minimum allowed operating fraction of full load
     105             :         Real64 MaxPartLoadRat = 0.0;                                 // Maximum allowed operating fraction of full load
     106             :         Real64 OptPartLoadRat = 0.0;                                 // Optimal operating fraction of full load
     107             :         Real64 MinUnloadRat = 0.0;                                   // Minimum unloading ratio
     108             :         Real64 TempRefCondIn = 0.0;                                  // The reference secondary loop fluid temperature at the
     109             :         // chiller condenser side inlet for the reformulated chiller [C]
     110             :         Real64 TempRefCondOut = 0.0; // The reference secondary loop fluid temperature at the
     111             :         // chiller condenser side outlet for the reformulated chiller [C]
     112             :         Real64 TempRefEvapOut = 0.0; // The reference primary loop fluid
     113             :         // temperature at the chiller evaporator side outlet [C]
     114             :         Real64 TempLowLimitEvapOut = 0.0;                  // Low temperature shut off [C]
     115             :         Real64 DesignHeatRecVolFlowRate = 0.0;             // Design water volumetric flow rate through heat recovery loop [m3/s]
     116             :         bool DesignHeatRecVolFlowRateWasAutoSized = false; // true if previous input was autosize
     117             :         Real64 DesignHeatRecMassFlowRate = 0.0;            // Design water mass flow rate through heat recovery loop [kg/s]
     118             :         Real64 SizFac = 0.0;                               // sizing factor
     119             :         bool HeatRecActive = false;                        // True when entered Heat Rec Vol Flow Rate > 0
     120             :         int HeatRecInletNodeNum = 0;                       // Node number for the heat recovery inlet side of the condenser
     121             :         int HeatRecOutletNodeNum = 0;                      // Node number for the heat recovery outlet side of the condenser
     122             :         Real64 HeatRecCapacityFraction = 0.0;              // user input for heat recovery capacity fraction []
     123             :         Real64 HeatRecMaxCapacityLimit = 0.0;              // Capacity limit for Heat recovery, one time calc [W]
     124             :         int HeatRecSetPointNodeNum = 0;                    // index for system node with the heat recover leaving setpoint
     125             :         int HeatRecInletLimitSchedNum = 0;                 // index for schedule for the inlet high limit for heat recovery operation
     126             :         int ChillerCapFTIndex = 0;                         // Index for the total cooling capacity modifier curve
     127             :         // (function of leaving evaporator and condenser water temperatures)
     128             :         int ChillerEIRFTIndex = 0; // Index for the energy input ratio modifier curve
     129             :         // (function of leaving evaporator and condenser water temperatures)
     130             :         int ChillerEIRFPLRIndex = 0; // Index for the energy input ratio vs part-load ratio curve
     131             :         // (function of leaving condenser water temperature and part-load ratio)
     132             :         int ChillerCapFTError = 0;           // Used for negative capacity as a function of temp warnings
     133             :         int ChillerCapFTErrorIndex = 0;      // Used for negative capacity as a function of temp warnings
     134             :         int ChillerEIRFTError = 0;           // Used for negative EIR as a function of temp warnings
     135             :         int ChillerEIRFTErrorIndex = 0;      // Used for negative EIR as a function of temp warnings
     136             :         int ChillerEIRFPLRError = 0;         // Used for negative EIR as a function of PLR warnings
     137             :         int ChillerEIRFPLRErrorIndex = 0;    // Used for negative EIR as a function of PLR warnings
     138             :         Real64 ChillerCAPFTXTempMin = 0.0;   // Minimum value of CAPFT curve X variable [C]
     139             :         Real64 ChillerCAPFTXTempMax = 0.0;   // Maximum value of CAPFT curve X variable [C]
     140             :         Real64 ChillerCAPFTYTempMin = 0.0;   // Minimum value of CAPFT curve Y variable [C]
     141             :         Real64 ChillerCAPFTYTempMax = 0.0;   // Maximum value of CAPFT curve Y variable [C]
     142             :         Real64 ChillerEIRFTXTempMin = 0.0;   // Minimum value of EIRFT curve X variable [C]
     143             :         Real64 ChillerEIRFTXTempMax = 0.0;   // Maximum value of EIRFT curve X variable [C]
     144             :         Real64 ChillerEIRFTYTempMin = 0.0;   // Minimum value of EIRFT curve Y variable [C]
     145             :         Real64 ChillerEIRFTYTempMax = 0.0;   // Maximum value of EIRFT curve Y variable [C]
     146             :         Real64 ChillerEIRFPLRTempMin = 0.0;  // Minimum value of EIRFPLR curve condenser outlet temperature [C]
     147             :         Real64 ChillerEIRFPLRTempMax = 0.0;  // Maximum value of EIRFPLR curve condenser outlet temperature [C]
     148             :         Real64 ChillerEIRFPLRPLRMin = 0.0;   // Minimum value of EIRFPLR curve part-load ratio
     149             :         Real64 ChillerEIRFPLRPLRMax = 0.0;   // Maximum value of EIRFPLR curve part-load ratio
     150             :         Real64 ChillerLiftNomMin = 0.0;      // Minimum value of EIRFPLR curve Normalized Chiller lift
     151             :         Real64 ChillerLiftNomMax = 10.0;     // Maximum value of EIRFPLR curve Normalized Chiller lift
     152             :         Real64 ChillerTdevNomMin = 0.0;      // Minimum value of EIRFPLR curve Normalized Tdev
     153             :         Real64 ChillerTdevNomMax = 10.0;     // Maximum value of EIRFPLR curve Normalized Tdev
     154             :         int CAPFTXIter = 0;                  // Iteration counter for evaporator outlet temperature CAPFT warning messages
     155             :         int CAPFTXIterIndex = 0;             // Index for evaporator outlet temperature CAPFT warning messages
     156             :         int CAPFTYIter = 0;                  // Iteration counter for condenser outlet temperature CAPFT warning messages
     157             :         int CAPFTYIterIndex = 0;             // Index for condenser outlet temperature CAPFT warning messages
     158             :         int EIRFTXIter = 0;                  // Iteration counter for evaporator outlet temperature EIRFT warning messages
     159             :         int EIRFTXIterIndex = 0;             // Index for evaporator outlet temperature EIRFT warning messages
     160             :         int EIRFTYIter = 0;                  // Iteration counter for condenser outlet temperature EIRFT warning messages
     161             :         int EIRFTYIterIndex = 0;             // Index for condenser outlet temperature EIRFT warning messages
     162             :         int EIRFPLRTIter = 0;                // Iteration counter for condenser outlet temperature EIRFPLR warning messages
     163             :         int EIRFPLRTIterIndex = 0;           // Index for condenser outlet temperature EIRFPLR warning messages
     164             :         int EIRFPLRPLRIter = 0;              // Iteration counter for part-load ratio EIRFPLR warning messages
     165             :         int EIRFPLRPLRIterIndex = 0;         // Index for part-load ratio EIRFPLR warning messages
     166             :         bool FaultyChillerSWTFlag = false;   // True if the chiller has SWT sensor fault
     167             :         int FaultyChillerSWTIndex = 0;       // Index of the fault object corresponding to the chiller
     168             :         Real64 FaultyChillerSWTOffset = 0.0; // Chiller SWT sensor offset
     169             :         int IterLimitExceededNum = 0;        // Iteration limit exceeded for RegulaFalsi routine
     170             :         int IterLimitErrIndex = 0;           // Index to iteration limit warning for RegulaFalsi routine
     171             :         int IterFailed = 0;                  // Iteration limit failed for RegulaFalsi routine
     172             :         int IterFailedIndex = 0;             // Index to iteration limit failed for RegulaFalsi routine
     173             :         int DeltaTErrCount = 0;              // Evaporator delta T equals 0 for variable flow chiller warning messages
     174             :         int DeltaTErrCountIndex = 0;         // Index to evaporator delta T = 0 for variable flow chiller warning messages
     175             :         PlantLocation CWPlantLoc;            // chilled water plant loop component index
     176             :         PlantLocation CDPlantLoc;            // condenser water plant loop component index
     177             :         PlantLocation HRPlantLoc;            // heat recovery water plant loop component index
     178             :         int CondMassFlowIndex = 0;
     179             :         bool PossibleSubcooling = false; // flag to indicate chiller is doing less cooling that requested
     180             :         // Operational fault parameters
     181             :         bool FaultyChillerFoulingFlag = false;   // True if the chiller has fouling fault
     182             :         int FaultyChillerFoulingIndex = 0;       // Index of the fault object corresponding to the chiller
     183             :         Real64 FaultyChillerFoulingFactor = 1.0; // Chiller fouling factor
     184             :         std::string EndUseSubcategory;           // identifier use for the end use subcategory
     185             :         bool MyEnvrnFlag = true;
     186             :         bool MyInitFlag = true;
     187             :         bool MySizeFlag = true;
     188             :         Real64 ChillerCondAvgTemp = 0.0;   // average condenser temp for curves with Heat recovery [C]
     189             :         Real64 ChillerFalseLoadRate = 0.0; // Chiller false load over and above water side load [J]
     190             :         Real64 ChillerCyclingRatio = 0.0;  // Chiller cycling ratio (time on/time step)
     191             :         Real64 ChillerPartLoadRatio = 0.0; // Chiller PLR (Load/Capacity)
     192             :         Real64 ChillerEIRFPLR = 0.0;       // Chiller EIRFPLR curve output value
     193             :         Real64 ChillerEIRFT = 0.0;         // Chiller EIRFT curve output value
     194             :         Real64 ChillerCapFT = 0.0;         // Chiller capacity curve output value
     195             :         Real64 HeatRecOutletTemp = 0.0;
     196             :         Real64 QHeatRecovery = 0.0; // Heat recovered from water-cooled condenser [W]
     197             :         Real64 QCondenser = 0.0;
     198             :         Real64 QEvaporator = 0.0;        // Evaporator heat transfer rate [W]
     199             :         Real64 Power = 0.0;              // Chiller power [W]
     200             :         Real64 EvapOutletTemp = 0.0;     // Evaporator outlet temperature [C]
     201             :         Real64 CondOutletTemp = 0.0;     // Condenser outlet temperature [C]
     202             :         Real64 EvapMassFlowRate = 0.0;   // Evaporator mass flow rate [kg/s]
     203             :         Real64 CondMassFlowRate = 0.0;   // Condenser mass flow rate [kg/s]
     204             :         Real64 ChillerFalseLoad = 0.0;   // Chiller false load over and above water side load [W]
     205             :         Real64 Energy = 0.0;             // Chiller electric consumption [J]
     206             :         Real64 EvapEnergy = 0.0;         // Evaporator heat transfer energy [J]
     207             :         Real64 CondEnergy = 0.0;         // Condenser heat transfer energy [J]
     208             :         Real64 CondInletTemp = 0.0;      // Condenser inlet temperature [C]
     209             :         Real64 EvapInletTemp = 0.0;      // Evaporator inlet temperature [C]
     210             :         Real64 ActualCOP = 0.0;          // Coefficient of performance
     211             :         Real64 EnergyHeatRecovery = 0.0; // Energy recovered from water-cooled condenser [J]
     212             :         Real64 HeatRecInletTemp = 0.0;   // Heat reclaim inlet temperature [C]
     213             :         Real64 HeatRecMassFlow = 0.0;    // Heat reclaim mass flow rate [kg/s]
     214             :         DataBranchAirLoopPlant::ControlType EquipFlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid;
     215             : 
     216             :         static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
     217             : 
     218             :         void simulate([[maybe_unused]] EnergyPlusData &state,
     219             :                       const PlantLocation &calledFromLocation,
     220             :                       bool FirstHVACIteration,
     221             :                       Real64 &CurLoad,
     222             :                       bool RunFlag) override;
     223             : 
     224             :         void getDesignCapacities(
     225             :             EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     226             : 
     227             :         void getDesignTemperatures(Real64 &TempDesCondIn, Real64 &TempDesEvapOut) override;
     228             : 
     229             :         void getSizingFactor(Real64 &sizFac) override;
     230             : 
     231             :         void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
     232             : 
     233             :         void oneTimeInit(EnergyPlusData &state) override;
     234             : 
     235             :         void initialize(EnergyPlusData &state, bool RunFlag, Real64 MyLoad);
     236             : 
     237             :         void setupOutputVars(EnergyPlusData &state);
     238             : 
     239             :         void size(EnergyPlusData &state);
     240             : 
     241             :         void control(EnergyPlusData &state, Real64 &MyLoad, bool RunFlag, bool FirstIteration);
     242             : 
     243             :         void calculate(EnergyPlusData &state, Real64 &MyLoad, bool RunFlag, Real64 FalsiCondOutTemp);
     244             : 
     245             :         void calcHeatRecovery(EnergyPlusData &state, Real64 &QCond, Real64 CondMassFlow, Real64 condInletTemp, Real64 &QHeatRec);
     246             : 
     247             :         void update(EnergyPlusData &state, Real64 MyLoad, bool RunFlag);
     248             : 
     249             :         void checkMinMaxCurveBoundaries(EnergyPlusData &state, bool FirstIteration);
     250             :     };
     251             : 
     252             :     void GetElecReformEIRChillerInput(EnergyPlusData &state);
     253             : 
     254             : } // namespace ChillerReformulatedEIR
     255             : 
     256        1542 : struct ChillerReformulatedEIRData : BaseGlobalStruct
     257             : {
     258             :     bool GetInputREIR = true;
     259             :     Array1D<ChillerReformulatedEIR::ReformulatedEIRChillerSpecs> ElecReformEIRChiller;
     260             : 
     261           0 :     void clear_state() override
     262             :     {
     263           0 :         *this = ChillerReformulatedEIRData();
     264           0 :     }
     265             : };
     266             : 
     267             : } // namespace EnergyPlus
     268             : 
     269             : #endif

Generated by: LCOV version 1.13