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

Generated by: LCOV version 1.13