LCOV - code coverage report
Current view: top level - EnergyPlus - ChillerIndirectAbsorption.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 ChillerIndirectAbsorption_hh_INCLUDED
      49              : #define ChillerIndirectAbsorption_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/FluidProperties.hh>
      59              : #include <EnergyPlus/Plant/DataPlant.hh>
      60              : #include <EnergyPlus/PlantComponent.hh>
      61              : 
      62              : namespace EnergyPlus {
      63              : 
      64              : // Forward declarations
      65              : struct EnergyPlusData;
      66              : 
      67              : namespace ChillerIndirectAbsorption {
      68              : 
      69              :     struct ReportVars
      70              :     {
      71              :         // Members
      72              :         Real64 PumpingPower = 0.0;         // reporting: W - electric pumping power
      73              :         Real64 QGenerator = 0.0;           // reporting: W - steam heat transfer rate
      74              :         Real64 QEvap = 0.0;                // reporting: W - evaporator heat transfer rate
      75              :         Real64 QCond = 0.0;                // reporting: W - condenser heat transfer rate
      76              :         Real64 PumpingEnergy = 0.0;        // reporting: J - electric pumping power
      77              :         Real64 GeneratorEnergy = 0.0;      // reporting: J - steam heat transfer rate
      78              :         Real64 EvapEnergy = 0.0;           // reporting: J - evaporator heat transfer rate
      79              :         Real64 CondEnergy = 0.0;           // reporting: J - condenser heat transfer rate
      80              :         Real64 CondInletTemp = 0.0;        // reporting: C - condenser inlet temperature
      81              :         Real64 EvapInletTemp = 0.0;        // reporting: C - evaporator inlet temperature
      82              :         Real64 CondOutletTemp = 0.0;       // reporting: C - condenser outlet temperature
      83              :         Real64 EvapOutletTemp = 0.0;       // reporting: C - evaporator outlet temperature
      84              :         Real64 Evapmdot = 0.0;             // reporting: kg/ - evaporator mass flow rate
      85              :         Real64 Condmdot = 0.0;             // reporting: kg/ - condenser mass flow rate
      86              :         Real64 Genmdot = 0.0;              // reporting: generators mass flow rate when connected to plant
      87              :         Real64 SteamMdot = 0.0;            // reporting: kg/s - steam mass flow rate
      88              :         Real64 ActualCOP = 0.0;            // reporting: coefficient of performance = QEvap/QGenerator
      89              :         Real64 ChillerPartLoadRatio = 0.0; // reporting: part-load ratio
      90              :         Real64 ChillerCyclingFrac = 0.0;   // reporting: chiller on/off cycling fraction
      91              :         Real64 LoopLoss = 0.0;             // reporting: W - loop loss from absorber outlet to condensate pump inlet
      92              :     };
      93              : 
      94              :     struct IndirectAbsorberSpecs : PlantComponent
      95              :     {
      96              :         // Members
      97              :         std::string Name;                         // user identifier
      98              :         Real64 NomCap = 0.0;                      // W - design nominal capacity of Absorber
      99              :         bool NomCapWasAutoSized = false;          // true if Nominal capacity was autosize on input
     100              :         Real64 NomPumpPower = 0.0;                // W - design nominal capacity of Absorber
     101              :         bool NomPumpPowerWasAutoSized = false;    // true if nominal pump power was autosize on input
     102              :         Real64 EvapVolFlowRate = 0.0;             // m3/s - design nominal water volumetric flow rate through the evaporator
     103              :         bool EvapVolFlowRateWasAutoSized = false; // true if evaporator flow rate was autosize on input
     104              :         Real64 CondVolFlowRate = 0.0;             // m3/s - design nominal water volumetric flow rate through the condenser
     105              :         bool CondVolFlowRateWasAutoSized = false; // true if condenser flow rate was autosize on input
     106              :         Real64 EvapMassFlowRateMax = 0.0;         // kg/s - Max Design Evaporator Mass Flow Rate converted from Volume Flow Rate
     107              :         Real64 CondMassFlowRateMax = 0.0;         // Max Design Condenser Mass Flow Rate [kg/s]
     108              :         Real64 GenMassFlowRateMax = 0.0;          // kg/s - Max Design Generator Mass Flow Rate converted from Volume Flow Rate
     109              :         Real64 MinPartLoadRat = 0.0;              // (BLAST MIN) min allowed operating frac full load
     110              :         Real64 MaxPartLoadRat = 0.0;              // (BLAST MAX) max allowed operating frac full load
     111              :         Real64 OptPartLoadRat = 0.0;              // (BLAST BEST) optimal operating frac full load
     112              :         Real64 TempDesCondIn = 0.0;               // C - (BLAST ADJTC(1)The design secondary loop fluid
     113              :         // temperature at the Absorber condenser side inlet
     114              :         Real64 MinCondInletTemp = 0.0;                 // C - minimum condenser inlet temperature for chiller operation
     115              :         Real64 MinGeneratorInletTemp = 0.0;            // C - minimum generator inlet temperature for chiller operation
     116              :         Real64 TempLowLimitEvapOut = 0.0;              // C - low temperature shut off
     117              :         Real64 GeneratorVolFlowRate = 0.0;             // m3/s - hot water volumetric flow rate through generator
     118              :         bool GeneratorVolFlowRateWasAutoSized = false; // true if hot water flow was autosize on input
     119              :         Real64 GeneratorSubcool = 0.0;                 // C - amount of subcooling in steam generator
     120              :         Real64 LoopSubcool = 0.0;                      // C - amount of subcooling in steam generator
     121              :         Real64 GeneratorDeltaTemp = -99999.0;          // C - generator fluid temperature difference (water only)
     122              :         bool GeneratorDeltaTempWasAutoSized = true;    // true if generator delta T was autosize on input
     123              :         Real64 SizFac = 0.0;                           // Sizing factor
     124              :         int EvapInletNodeNum = 0;                      // Node number on the inlet side of the plant
     125              :         int EvapOutletNodeNum = 0;                     // Node number on the outlet side of the plant
     126              :         int CondInletNodeNum = 0;                      // Node number on the inlet side of the condenser
     127              :         int CondOutletNodeNum = 0;                     // Node number on the outlet side of the condenser
     128              :         int GeneratorInletNodeNum = 0;                 // Generator inlet node number, steam/water side
     129              :         int GeneratorOutletNodeNum = 0;                // Generator outlet node number, steam/water side
     130              :         int GeneratorInputCurvePtr = 0;                // Index to steam use curve as a function of PLR
     131              :         int PumpPowerCurvePtr = 0;                     // Index to pump power curve as a function of PLR
     132              :         int CapFCondenserTempPtr = 0;                  // Index to capacity as a function of absorber temp curve
     133              :         int CapFEvaporatorTempPtr = 0;                 // Index to capacity as a function of evaporator temp curve
     134              :         int CapFGeneratorTempPtr = 0;                  // Index to capacity as a function of generator temp curve
     135              :         int HeatInputFCondTempPtr = 0;                 // Index to generator heat input as a function of absorber temp
     136              :         int HeatInputFEvapTempPtr = 0;                 // Index to generator heat input as a function of absorber temp
     137              :         int ErrCount2 = 0;                             // error counter
     138              :         DataLoopNode::NodeFluidType GenHeatSourceType =
     139              :             DataLoopNode::NodeFluidType::Blank;                      // Generator heat source type, DataLoopNode::NodeFluidType::Steam=3 or
     140              :                                                                      // DataLoopNode::NodeFluidType::Water=2
     141              :         Fluid::RefrigProps *steam = nullptr;                         // STEAM Fluid Properties
     142              :         bool Available = false;                                      // need an array of logicals--load identifiers of available equipment
     143              :         bool ON = false;                                             // simulate the machine at it's operating part load ratio
     144              :         DataPlant::FlowMode FlowMode = DataPlant::FlowMode::Invalid; // one of 3 modes for component flow during operation
     145              :         bool ModulatedFlowSetToLoop = false;                         // True if the setpoint is missing at the outlet node
     146              :         bool ModulatedFlowErrDone = false;                           // true if setpoint warning issued
     147              :         int MinCondInletTempCtr = 0;                                 // Low condenser temp warning message counter
     148              :         int MinCondInletTempIndex = 0;                               // Low condenser temp warning message index
     149              :         int MinGenInletTempCtr = 0;                                  // Low generator temp warning message counter
     150              :         int MinGenInletTempIndex = 0;                                // Low generator temp warning message index
     151              :         PlantLocation CWPlantLoc;                                    // chilled water plant loop component index
     152              :         PlantLocation CDPlantLoc;                                    // condenser water plant loop component index
     153              :         PlantLocation GenPlantLoc;                                   // generator plant loop component index
     154              :         bool FaultyChillerSWTFlag = false;                           // True if the chiller has SWT sensor fault
     155              :         int FaultyChillerSWTIndex = 0;                               // Index of the fault object corresponding to the chiller
     156              :         Real64 FaultyChillerSWTOffset = 0.0;                         // Chiller SWT sensor offset
     157              :         bool PossibleSubcooling = false;                             // flag to indicate chiller is doing less cooling that requested
     158              :         Real64 CondMassFlowRate = 0.0;                               // Kg/s - condenser mass flow rate, water side
     159              :         Real64 EvapMassFlowRate = 0.0;                               // Kg/s - evaporator mass flow rate, water side
     160              :         Real64 GenMassFlowRate = 0.0;                                // Kg/s - steam mass flow rate, water side
     161              :         Real64 CondOutletTemp = 0.0;                                 // C - condenser outlet temperature, water side
     162              :         Real64 EvapOutletTemp = 0.0;                                 // C - evaporator outlet temperature, water side
     163              :         Real64 GenOutletTemp = 0.0;                                  // C - generator fluid outlet temperature
     164              :         Real64 SteamOutletEnthalpy = 0.0;                            // J/kg - generator fluid outlet enthalpy
     165              :         Real64 PumpingPower = 0.0;                                   // W - rate of Absorber energy use
     166              :         Real64 PumpingEnergy = 0.0;                                  // J - Absorber energy use
     167              :         Real64 QGenerator = 0.0;                                     // W - rate of Absorber steam use
     168              :         Real64 GeneratorEnergy = 0.0;                                // J - Absorber steam use
     169              :         Real64 QEvaporator = 0.0;                                    // W - rate of heat transfer to the evaporator coil
     170              :         Real64 EvaporatorEnergy = 0.0;                               // J - heat transfer to the evaporator coil
     171              :         Real64 QCondenser = 0.0;                                     // W - rate of heat transfer to the condenser coil
     172              :         Real64 CondenserEnergy = 0.0;                                // J - heat transfer to the condenser coil
     173              :         Real64 ChillerONOFFCyclingFrac = 0.0;                        // fraction of time chiller is on
     174              :         Real64 EnergyLossToEnvironment = 0.0;                        // J - piping energy loss from generator outlet to pump inlet
     175              :         bool GenInputOutputNodesUsed = false;
     176              :         bool MyOneTimeFlag = true;
     177              :         bool MyEnvrnFlag = true;
     178              :         ReportVars Report;
     179              :         DataBranchAirLoopPlant::ControlType EquipFlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid;
     180              : 
     181              :         Fluid::GlycolProps *water = nullptr;
     182              : 
     183              :         static IndirectAbsorberSpecs *factory(EnergyPlusData &state, std::string const &objectName);
     184              : 
     185              :         void simulate([[maybe_unused]] EnergyPlusData &state,
     186              :                       const PlantLocation &calledFromLocation,
     187              :                       bool FirstHVACIteration,
     188              :                       Real64 &CurLoad,
     189              :                       bool RunFlag) override;
     190              : 
     191              :         void getDesignCapacities(
     192              :             EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     193              : 
     194              :         void getSizingFactor(Real64 &sizFac) override;
     195              : 
     196              :         void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
     197              : 
     198              :         void oneTimeInit(EnergyPlusData &state) override;
     199              : 
     200              :         void initialize(EnergyPlusData &state, bool RunFlag, Real64 MyLoad);
     201              : 
     202              :         void setupOutputVars(EnergyPlusData &state);
     203              : 
     204              :         void sizeChiller(EnergyPlusData &state);
     205              : 
     206              :         void updateRecords(EnergyPlusData &state, Real64 MyLoad, bool RunFlag);
     207              : 
     208              :         void calculate(EnergyPlusData &state, Real64 MyLoad, bool RunFlag);
     209              :     };
     210              : 
     211              :     void GetIndirectAbsorberInput(EnergyPlusData &state);
     212              : 
     213              : } // namespace ChillerIndirectAbsorption
     214              : 
     215              : struct ChillerIndirectAbsoprtionData : BaseGlobalStruct
     216              : {
     217              :     bool GetInput = true;
     218              :     Array1D<ChillerIndirectAbsorption::IndirectAbsorberSpecs> IndirectAbsorber;
     219              : 
     220         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     221              :     {
     222         2126 :     }
     223              : 
     224         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     225              :     {
     226         1152 :     }
     227              : 
     228         2100 :     void clear_state() override
     229              :     {
     230         2100 :         new (this) ChillerIndirectAbsoprtionData();
     231         2100 :     }
     232              : };
     233              : 
     234              : } // namespace EnergyPlus
     235              : 
     236              : #endif
        

Generated by: LCOV version 2.0-1