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

Generated by: LCOV version 2.0-1