LCOV - code coverage report
Current view: top level - EnergyPlus - ChillerGasAbsorption.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 ChillerGasAbsorption_hh_INCLUDED
      49              : #define ChillerGasAbsorption_hh_INCLUDED
      50              : 
      51              : // ObjexxFCL Headers
      52              : #include <ObjexxFCL/Array1D.hh>
      53              : 
      54              : // EnergyPlus Headers
      55              : #include <EnergyPlus/Data/BaseData.hh>
      56              : #include <EnergyPlus/DataGlobalConstants.hh>
      57              : #include <EnergyPlus/DataGlobals.hh>
      58              : #include <EnergyPlus/EnergyPlus.hh>
      59              : #include <EnergyPlus/Plant/Enums.hh>
      60              : #include <EnergyPlus/Plant/PlantLocation.hh>
      61              : #include <EnergyPlus/PlantComponent.hh>
      62              : #include <EnergyPlus/UtilityRoutines.hh>
      63              : 
      64              : namespace EnergyPlus {
      65              : 
      66              : // Forward declarations
      67              : struct EnergyPlusData;
      68              : 
      69              : namespace Curve {
      70              :     struct Curve;
      71              : }
      72              : 
      73              : namespace ChillerGasAbsorption {
      74              : 
      75              :     struct GasAbsorberSpecs : PlantComponent
      76              :     {
      77              :         // Members
      78              :         // Parts of Type that do not correspond with IDD definition
      79              :         bool Available = false; // need an array of logicals--load identifiers of available equipment
      80              :         bool ON = false;        // simulate the machine at it's operating part load ratio
      81              :         bool InCoolingMode = false;
      82              :         bool InHeatingMode = false;
      83              :         // Part of Type that directly corresponds with IDD definition
      84              :         std::string Name;                         // user identifier
      85              :         Constant::eFuel FuelType;                 // Type of Fuel - DIESEL, GASOLINE, GAS
      86              :         Real64 NomCoolingCap = 0.0;               // W - design nominal capacity of Absorber
      87              :         bool NomCoolingCapWasAutoSized = false;   // true if nominal capacity was autosize on input
      88              :         Real64 NomHeatCoolRatio = 0.0;            // ratio of heating to cooling capacity
      89              :         Real64 FuelCoolRatio = 0.0;               // ratio of fuel input to cooling output
      90              :         Real64 FuelHeatRatio = 0.0;               // ratio of fuel input to heating output
      91              :         Real64 ElecCoolRatio = 0.0;               // ratio of electricity input to cooling output
      92              :         Real64 ElecHeatRatio = 0.0;               // ratio of electricity input to heating output
      93              :         int ChillReturnNodeNum = 0;               // Node number on the inlet side of the plant
      94              :         int ChillSupplyNodeNum = 0;               // Node number on the outlet side of the plant
      95              :         bool ChillSetPointErrDone = false;        // flag to report missing setpoint on CW outlet
      96              :         bool ChillSetPointSetToLoop = false;      // flag to use overall loop setpoint
      97              :         int CondReturnNodeNum = 0;                // Node number on the inlet side of the condenser
      98              :         int CondSupplyNodeNum = 0;                // Node number on the outlet side of the condenser
      99              :         int HeatReturnNodeNum = 0;                // absorber steam inlet node number, water side
     100              :         int HeatSupplyNodeNum = 0;                // absorber steam outlet node number, water side
     101              :         bool HeatSetPointErrDone = false;         // flag to report missing setpoint on HW outlet
     102              :         bool HeatSetPointSetToLoop = false;       // flag to use overall loop setpoint
     103              :         Real64 MinPartLoadRat = 0.0;              // min allowed operating frac full load
     104              :         Real64 MaxPartLoadRat = 0.0;              // max allowed operating frac full load
     105              :         Real64 OptPartLoadRat = 0.0;              // optimal operating frac full load
     106              :         Real64 TempDesCondReturn = 0.0;           // design secondary loop fluid temperature at the Absorber condenser side inlet
     107              :         Real64 TempDesCHWSupply = 0.0;            // design chilled water supply temperature
     108              :         Real64 EvapVolFlowRate = 0.0;             // m**3/s - design nominal water volumetric flow rate through the evaporator
     109              :         bool EvapVolFlowRateWasAutoSized = false; // true if evaporator flow rate was autosize on input
     110              :         Real64 CondVolFlowRate = 0.0;             // m**3/s - design nominal water volumetric flow rate through the condenser
     111              :         bool CondVolFlowRateWasAutoSized = false; // true if condenser flow rate was autosize on input
     112              :         Real64 HeatVolFlowRate = 0.0;             // m**3/s - design nominal water volumetric flow rate through the heater side
     113              :         bool HeatVolFlowRateWasAutoSized = false; // true if hot water flow rate was autosize on input
     114              :         Real64 SizFac = 0.0;                      // sizing factor
     115              :         Curve::Curve *CoolCapFTCurve = nullptr;   // cooling capacity as a function of temperature curve (chilled water temp,
     116              :         // condenser water temp)
     117              :         Curve::Curve *FuelCoolFTCurve = nullptr; // Fuel-Input-to cooling output Ratio Function of Temperature Curve (chilled
     118              :         // water temp, condenser water temp)
     119              :         Curve::Curve *FuelCoolFPLRCurve = nullptr; // Fuel-Input-to cooling output Ratio Function of Part Load Ratio Curve
     120              :         Curve::Curve *ElecCoolFTCurve = nullptr;   // Electric-Input-to cooling output Ratio Function of Temperature Curve
     121              :         // (chilled water temp, condenser water temp)
     122              :         Curve::Curve *ElecCoolFPLRCurve = nullptr;  // Electric-Input-to cooling output Ratio Function of Part Load Ratio Curve
     123              :         Curve::Curve *HeatCapFCoolCurve = nullptr;  // Heating Capacity Function of Cooling Capacity Curve
     124              :         Curve::Curve *FuelHeatFHPLRCurve = nullptr; // Fuel Input to heat output ratio during heating only function
     125              :         bool isEnterCondensTemp = false;            // if using entering conderser water temperature is TRUE, exiting is FALSE
     126              :         bool isWaterCooled = false;                 // if water cooled it is TRUE
     127              :         Real64 CHWLowLimitTemp = 0.0;               // Chilled Water Lower Limit Temperature
     128              :         Real64 FuelHeatingValue = 0.0;
     129              :         // Calculated design values
     130              :         Real64 DesCondMassFlowRate = 0.0; // design nominal mass flow rate of water through the condenser [kg/s]
     131              :         Real64 DesHeatMassFlowRate = 0.0; // design nominal mass flow rate of water through the hot water side [kg/s]
     132              :         Real64 DesEvapMassFlowRate = 0.0; // design nominal mass flow rate of water through chilled water side [kg/s]
     133              :         // other values used during simulation
     134              :         int DeltaTempCoolErrCount = 0;        // error count for Delta Temp = 0 while cooling
     135              :         int DeltaTempHeatErrCount = 0;        // error count for Delta Temp = 0 while heating
     136              :         int CondErrCount = 0;                 // error count for poor Condenser Supply Estimate
     137              :         int lCondWaterMassFlowRate_Index = 0; // index for condenser water mass flow rate too low recurring severe warning
     138              :         bool PossibleSubcooling = false;      // Flag to determine whether plant is overcooled
     139              :         // loop topology variables
     140              :         PlantLocation CWplantLoc; // chilled water plant loop component index
     141              :         PlantLocation CDplantLoc; // condenser water plant loop component index
     142              :         PlantLocation HWplantLoc; // hot water plant loop component index
     143              :         bool envrnFlag = true;
     144              :         Real64 oldCondSupplyTemp = 0.0; // save the last iteration value of leaving condenser water temperature
     145              : 
     146              :         // Originally on report variable structure
     147              :         Real64 CoolingLoad = 0.0;             // cooling load on the chiller (previously called QEvap)
     148              :         Real64 CoolingEnergy = 0.0;           // variable to track total cooling load for period (was EvapEnergy)
     149              :         Real64 HeatingLoad = 0.0;             // heating load on the chiller
     150              :         Real64 HeatingEnergy = 0.0;           // heating energy
     151              :         Real64 TowerLoad = 0.0;               // load on the cooling tower/condenser (previously called QCond)
     152              :         Real64 TowerEnergy = 0.0;             // variable to track total tower load for a period (was CondEnergy)
     153              :         Real64 FuelUseRate = 0.0;             // instantaneous use of gas for period
     154              :         Real64 FuelEnergy = 0.0;              // variable to track total fuel used for a period
     155              :         Real64 CoolFuelUseRate = 0.0;         // instantaneous use of gas for period for cooling
     156              :         Real64 CoolFuelEnergy = 0.0;          // variable to track total fuel used for a period for cooling
     157              :         Real64 HeatFuelUseRate = 0.0;         // instantaneous use of gas for period for heating
     158              :         Real64 HeatFuelEnergy = 0.0;          // variable to track total fuel used for a period for heating
     159              :         Real64 ElectricPower = 0.0;           // parasitic electric power used (was PumpingPower)
     160              :         Real64 ElectricEnergy = 0.0;          // track the total electricity used for a period (was PumpingEnergy)
     161              :         Real64 CoolElectricPower = 0.0;       // parasitic electric power used  for cooling
     162              :         Real64 CoolElectricEnergy = 0.0;      // track the total electricity used for a period for cooling
     163              :         Real64 HeatElectricPower = 0.0;       // parasitic electric power used  for heating
     164              :         Real64 HeatElectricEnergy = 0.0;      // track the total electricity used for a period for heating
     165              :         Real64 ChillReturnTemp = 0.0;         // reporting: evaporator inlet temperature (was EvapInletTemp)
     166              :         Real64 ChillSupplyTemp = 0.0;         // reporting: evaporator outlet temperature (was EvapOutletTemp)
     167              :         Real64 ChillWaterFlowRate = 0.0;      // reporting: evaporator mass flow rate (was Evapmdot)
     168              :         Real64 CondReturnTemp = 0.0;          // reporting: condenser inlet temperature (was CondInletTemp)
     169              :         Real64 CondSupplyTemp = 0.0;          // reporting: condenser outlet temperature (was CondOutletTemp)
     170              :         Real64 CondWaterFlowRate = 0.0;       // reporting: condenser mass flow rate (was Condmdot)
     171              :         Real64 HotWaterReturnTemp = 0.0;      // reporting: hot water return (inlet) temperature
     172              :         Real64 HotWaterSupplyTemp = 0.0;      // reporting: hot water supply (outlet) temperature
     173              :         Real64 HotWaterFlowRate = 0.0;        // reporting: hot water mass flow rate
     174              :         Real64 CoolPartLoadRatio = 0.0;       // operating part load ratio (load/capacity for cooling)
     175              :         Real64 HeatPartLoadRatio = 0.0;       // operating part load ratio (load/capacity for heating)
     176              :         Real64 CoolingCapacity = 0.0;         // current capacity after temperature adjustment
     177              :         Real64 HeatingCapacity = 0.0;         // current heating capacity
     178              :         Real64 FractionOfPeriodRunning = 0.0; // fraction of the time period that the unit is operating
     179              :         Real64 FuelCOP = 0.0;                 // reporting: cooling output/fuel input = CoolingLoad/CoolFuelUseRate
     180              : 
     181              :         static GasAbsorberSpecs *factory(EnergyPlusData &state, std::string const &objectName);
     182              : 
     183              :         void
     184              :         simulate(EnergyPlusData &state, const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag) override;
     185              : 
     186              :         void getDesignCapacities(
     187              :             EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     188              : 
     189              :         void getSizingFactor(Real64 &SizFac) override;
     190              : 
     191              :         void onInitLoopEquip(EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
     192              : 
     193              :         void getDesignTemperatures(Real64 &TempDesCondIn, Real64 &TempDesEvapOut) override;
     194              : 
     195              :         void oneTimeInit(EnergyPlusData &state) override;
     196              : 
     197              :         void oneTimeInit_new(EnergyPlusData &state) override;
     198              : 
     199              :         void initialize(EnergyPlusData &state);
     200              : 
     201              :         void setupOutputVariables(EnergyPlusData &state);
     202              : 
     203              :         void size(EnergyPlusData &state);
     204              : 
     205              :         void calculateChiller(EnergyPlusData &state, Real64 &MyLoad);
     206              : 
     207              :         void calculateHeater(EnergyPlusData &state, Real64 &MyLoad, bool RunFlag);
     208              : 
     209              :         void updateCoolRecords(EnergyPlusData &state,
     210              :                                Real64 MyLoad, // current load
     211              :                                bool RunFlag   // TRUE if Absorber operating
     212              :         );
     213              : 
     214              :         void updateHeatRecords(EnergyPlusData &state,
     215              :                                Real64 MyLoad, // current load
     216              :                                bool RunFlag   // TRUE if Absorber operating
     217              :         );
     218              :     };
     219              : 
     220              :     void GetGasAbsorberInput(EnergyPlusData &state);
     221              : 
     222              : } // namespace ChillerGasAbsorption
     223              : 
     224              : struct ChillerGasAbsorptionData : BaseGlobalStruct
     225              : {
     226              :     bool getGasAbsorberInputs = true;
     227              :     Array1D<ChillerGasAbsorption::GasAbsorberSpecs> GasAbsorber;
     228              : 
     229         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     230              :     {
     231         2126 :     }
     232              : 
     233         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     234              :     {
     235         1152 :     }
     236              : 
     237         2100 :     void clear_state() override
     238              :     {
     239         2100 :         new (this) ChillerGasAbsorptionData();
     240         2100 :     }
     241              : };
     242              : 
     243              : } // namespace EnergyPlus
     244              : 
     245              : #endif
        

Generated by: LCOV version 2.0-1