LCOV - code coverage report
Current view: top level - EnergyPlus - ChillerExhaustAbsorption.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 ChillerExhaustAbsorption_hh_INCLUDED
      49              : #define ChillerExhaustAbsorption_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/ElectricPowerServiceManager.hh>
      58              : #include <EnergyPlus/EnergyPlus.hh>
      59              : #include <EnergyPlus/Plant/PlantLocation.hh>
      60              : #include <EnergyPlus/PlantComponent.hh>
      61              : 
      62              : namespace EnergyPlus {
      63              : 
      64              : // Forward declarations
      65              : struct EnergyPlusData;
      66              : 
      67              : namespace Curve {
      68              :     struct Curve;
      69              : }
      70              : 
      71              : namespace ChillerExhaustAbsorption {
      72              : 
      73              :     struct ExhaustAbsorberSpecs : PlantComponent
      74              :     {
      75              :         // Members
      76              :         // Parts of Type that do not correspond with IDD definition
      77              :         bool Available = false; // need an array of logicals--load identifiers of available equipment
      78              :         bool ON = false;        // simulate the machine at it's operating part load ratio
      79              :         bool InCoolingMode = false;
      80              :         bool InHeatingMode = false;
      81              :         // Part of Type that directly corresponds with IDD definition
      82              :         std::string Name;                         // user identifier
      83              :         Real64 NomCoolingCap = 0.0;               // W - design nominal capacity of Absorber
      84              :         bool NomCoolingCapWasAutoSized = false;   // true if nominal capacity was autosize on input
      85              :         Real64 NomHeatCoolRatio = 0.0;            // ratio of heating to cooling capacity
      86              :         Real64 ThermalEnergyCoolRatio = 0.0;      // ratio of thermal energy input to cooling output
      87              :         Real64 ThermalEnergyHeatRatio = 0.0;      // ratio of thermal energy input to heating output
      88              :         Real64 ElecCoolRatio = 0.0;               // ratio of electricity input to cooling output
      89              :         Real64 ElecHeatRatio = 0.0;               // ratio of electricity input to heating output
      90              :         int ChillReturnNodeNum = 0;               // Node number on the inlet side of the plant
      91              :         int ChillSupplyNodeNum = 0;               // Node number on the outlet side of the plant
      92              :         bool ChillSetPointErrDone = false;        // flag to report missing setpoint on CW outlet
      93              :         bool ChillSetPointSetToLoop = false;      // flag to use overall loop setpoint
      94              :         int CondReturnNodeNum = 0;                // Node number on the inlet side of the condenser
      95              :         int CondSupplyNodeNum = 0;                // Node number on the outlet side of the condenser
      96              :         int HeatReturnNodeNum = 0;                // absorber steam inlet node number, water side
      97              :         int HeatSupplyNodeNum = 0;                // absorber steam outlet node number, water side
      98              :         bool HeatSetPointErrDone = false;         // flag to report missing setpoint on HW outlet
      99              :         bool HeatSetPointSetToLoop = false;       // flag to use overall loop setpoint
     100              :         Real64 MinPartLoadRat = 0.0;              // min allowed operating frac full load
     101              :         Real64 MaxPartLoadRat = 0.0;              // max allowed operating frac full load
     102              :         Real64 OptPartLoadRat = 0.0;              // optimal operating frac full load
     103              :         Real64 TempDesCondReturn = 0.0;           // design secondary loop fluid temperature at the Absorber condenser side inlet
     104              :         Real64 TempDesCHWSupply = 0.0;            // design chilled water supply temperature
     105              :         Real64 EvapVolFlowRate = 0.0;             // m**3/s - design nominal 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;             // m**3/s - design nominal water volumetric flow rate through the condenser
     108              :         bool CondVolFlowRateWasAutoSized = false; // true if condenser flow rate was autosize on input
     109              :         Real64 HeatVolFlowRate = 0.0;             // m**3/s - design nominal water volumetric flow rate through the heater side
     110              :         bool HeatVolFlowRateWasAutoSized = false; // true if hot water flow rate was autosize on input
     111              :         Real64 SizFac = 0.0;                      // sizing factor
     112              :         Curve::Curve *CoolCapFTCurve = nullptr;   // cooling capacity as a function of temperature curve (chilled water temp,
     113              :         // condenser water temp)
     114              :         Curve::Curve *ThermalEnergyCoolFTCurve = nullptr; // Thermal Energy-Input-to cooling output Ratio Function of Temperature Curve (chilled
     115              :         // water temp, condenser water temp)
     116              :         Curve::Curve *ThermalEnergyCoolFPLRCurve = nullptr; // Thermal Energy-Input-to cooling output Ratio Function of Part Load Ratio Curve
     117              :         Curve::Curve *ElecCoolFTCurve = nullptr;            // Electric-Input-to cooling output Ratio Function of Temperature Curve
     118              :         // (chilled water temp, condenser water temp)
     119              :         Curve::Curve *ElecCoolFPLRCurve = nullptr;           // Electric-Input-to cooling output Ratio Function of Part Load Ratio Curve
     120              :         Curve::Curve *HeatCapFCoolCurve = nullptr;           // Heating Capacity Function of Cooling Capacity Curve
     121              :         Curve::Curve *ThermalEnergyHeatFHPLRCurve = nullptr; // Thermal Energy Input to heat output ratio during heating only function
     122              :         bool isEnterCondensTemp = false;                     // if using entering conderser water temperature is TRUE, exiting is FALSE
     123              :         bool isWaterCooled = false;                          // if water cooled it is TRUE
     124              :         Real64 CHWLowLimitTemp = 0.0;                        // Chilled Water Lower Limit Temperature
     125              :         int ExhaustAirInletNodeNum = 0;                      // Node number on Exhaust input from generator
     126              :         // Calculated design values
     127              :         Real64 DesCondMassFlowRate = 0.0; // design nominal mass flow rate of water through the condenser [kg/s]
     128              :         Real64 DesHeatMassFlowRate = 0.0; // design nominal mass flow rate of water through the hot water side [kg/s]
     129              :         Real64 DesEvapMassFlowRate = 0.0; // design nominal mass flow rate of water through chilled water side [kg/s]
     130              :         // other values used during simulation
     131              :         int DeltaTempCoolErrCount = 0;   // error count for Delta Temp = 0 while cooling
     132              :         int DeltaTempHeatErrCount = 0;   // error count for Delta Temp = 0 while heating
     133              :         int CondErrCount = 0;            // error count for poor Condenser Supply Estimate
     134              :         bool PossibleSubcooling = false; // Flag to determine whether plant is overcooled
     135              :         // loop topology variables
     136              :         PlantLocation CWPlantLoc;                            // chilled water plant loop component index
     137              :         PlantLocation CDPlantLoc;                            // condenser water plant loop component index
     138              :         PlantLocation HWPlantLoc;                            // hot water plant loop component index
     139              :         GeneratorType CompType_Num = GeneratorType::Invalid; // Numeric designator for CompType (TypeOf)
     140              :         int ExhTempLTAbsLeavingTempIndex = 0;                // index for exhaust potential less than thermal energy needed during cooling
     141              :         int ExhTempLTAbsLeavingHeatingTempIndex = 0;         // index for exhaust potential less than thermal energy needed during heating
     142              :         int lCondWaterMassFlowRate_Index = 0;                // index for condenser water mass flow rate too low recurring severe warning
     143              :         std::string TypeOf;                                  // Generator type
     144              :         std::string ExhaustSourceName;                       // Generator type Name
     145              :         bool envrnInit = true;
     146              :         Real64 oldCondSupplyTemp = 0.0; // save the last iteration value of leaving condenser water temperature
     147              : 
     148              :         // Members from old report struct
     149              :         Real64 CoolingLoad = 0.0;              // cooling load on the chiller (previously called QEvap)
     150              :         Real64 CoolingEnergy = 0.0;            // variable to track total cooling load for period (was EvapEnergy)
     151              :         Real64 HeatingLoad = 0.0;              // heating load on the chiller
     152              :         Real64 HeatingEnergy = 0.0;            // heating energy
     153              :         Real64 TowerLoad = 0.0;                // load on the cooling tower/condenser (previously called QCond)
     154              :         Real64 TowerEnergy = 0.0;              // variable to track total tower load for a period (was CondEnergy)
     155              :         Real64 ThermalEnergyUseRate = 0.0;     // instantaneous use of Exhaust for period
     156              :         Real64 ThermalEnergy = 0.0;            // variable to track total ThermalEnergy used for a period
     157              :         Real64 CoolThermalEnergyUseRate = 0.0; // instantaneous use of Exhaust for period for cooling
     158              :         Real64 CoolThermalEnergy = 0.0;        // variable to track total ThermalEnergy used for a period for cooling
     159              :         Real64 HeatThermalEnergyUseRate = 0.0; // instantaneous use of Exhaust for period for heating
     160              :         Real64 HeatThermalEnergy = 0.0;        // variable to track total ThermalEnergy used for a period for heating
     161              :         Real64 ElectricPower = 0.0;            // parasitic electric power used (was PumpingPower)
     162              :         Real64 ElectricEnergy = 0.0;           // track the total electricity used for a period (was PumpingEnergy)
     163              :         Real64 CoolElectricPower = 0.0;        // parasitic electric power used  for cooling
     164              :         Real64 CoolElectricEnergy = 0.0;       // track the total electricity used for a period for cooling
     165              :         Real64 HeatElectricPower = 0.0;        // parasitic electric power used  for heating
     166              :         Real64 HeatElectricEnergy = 0.0;       // track the total electricity used for a period for heating
     167              :         Real64 ChillReturnTemp = 0.0;          // reporting: evaporator inlet temperature (was EvapInletTemp)
     168              :         Real64 ChillSupplyTemp = 0.0;          // reporting: evaporator outlet temperature (was EvapOutletTemp)
     169              :         Real64 ChillWaterFlowRate = 0.0;       // reporting: evaporator mass flow rate (was Evapmdot)
     170              :         Real64 CondReturnTemp = 0.0;           // reporting: condenser inlet temperature (was CondInletTemp)
     171              :         Real64 CondSupplyTemp = 0.0;           // reporting: condenser outlet temperature (was CondOutletTemp)
     172              :         Real64 CondWaterFlowRate = 0.0;        // reporting: condenser mass flow rate (was Condmdot)
     173              :         Real64 HotWaterReturnTemp = 0.0;       // reporting: hot water return (inlet) temperature
     174              :         Real64 HotWaterSupplyTemp = 0.0;       // reporting: hot water supply (outlet) temperature
     175              :         Real64 HotWaterFlowRate = 0.0;         // reporting: hot water mass flow rate
     176              :         Real64 CoolPartLoadRatio = 0.0;        // operating part load ratio (load/capacity for cooling)
     177              :         Real64 HeatPartLoadRatio = 0.0;        // operating part load ratio (load/capacity for heating)
     178              :         Real64 CoolingCapacity = 0.0;          // current capacity after temperature adjustment
     179              :         Real64 HeatingCapacity = 0.0;          // current heating capacity
     180              :         Real64 FractionOfPeriodRunning = 0.0;  // fraction of the time period that the unit is operating
     181              :         Real64 ThermalEnergyCOP = 0.0;         // reporting: cooling output/ThermalEnergy input = CoolingLoad/CoolThermalEnergyUseRate
     182              :         Real64 ExhaustInTemp = 0.0;            // reporting: Exhaust inlet temperature
     183              :         Real64 ExhaustInFlow = 0.0;            // reporting: Exhaust Inlet Flow rate
     184              :         Real64 ExhHeatRecPotentialHeat = 0.0;  // reporting: Heat Recovery Potential during heating
     185              :         Real64 ExhHeatRecPotentialCool = 0.0;  // reporting: Heat Recovery Potential during cooling
     186              : 
     187              :         static ExhaustAbsorberSpecs *factory(EnergyPlusData &state, std::string const &objectName);
     188              : 
     189              :         void
     190              :         simulate(EnergyPlusData &state, const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag) override;
     191              : 
     192              :         void getDesignCapacities(
     193              :             EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     194              : 
     195              :         void getSizingFactor(Real64 &SizFac) override;
     196              : 
     197              :         void onInitLoopEquip(EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
     198              : 
     199              :         void oneTimeInit(EnergyPlusData &state) override;
     200              : 
     201              :         void oneTimeInit_new(EnergyPlusData &state) override;
     202              : 
     203              :         void getDesignTemperatures(Real64 &TempDesCondIn, Real64 &TempDesEvapOut) override;
     204              : 
     205              :         void initialize(EnergyPlusData &state);
     206              : 
     207              :         void setupOutputVariables(EnergyPlusData &state);
     208              : 
     209              :         void size(EnergyPlusData &state);
     210              : 
     211              :         void calcChiller(EnergyPlusData &state, Real64 &MyLoad);
     212              : 
     213              :         void calcHeater(EnergyPlusData &state, Real64 &MyLoad, bool RunFlag);
     214              : 
     215              :         void updateCoolRecords(EnergyPlusData &state, Real64 MyLoad, bool RunFlag);
     216              : 
     217              :         void updateHeatRecords(EnergyPlusData &state, Real64 MyLoad, bool RunFlag);
     218              :     };
     219              : 
     220              :     void GetExhaustAbsorberInput(EnergyPlusData &state);
     221              : 
     222              : } // namespace ChillerExhaustAbsorption
     223              : 
     224              : struct ChillerExhaustAbsorptionData : BaseGlobalStruct
     225              : {
     226              :     bool Sim_GetInput = true;
     227              :     Array1D<ChillerExhaustAbsorption::ExhaustAbsorberSpecs> ExhaustAbsorber;
     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) ChillerExhaustAbsorptionData();
     240         2100 :     }
     241              : };
     242              : 
     243              : } // namespace EnergyPlus
     244              : 
     245              : #endif
        

Generated by: LCOV version 2.0-1