LCOV - code coverage report
Current view: top level - EnergyPlus - CoolTower.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 CoolTower_hh_INCLUDED
      49              : #define CoolTower_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/ScheduleManager.hh>
      59              : 
      60              : namespace EnergyPlus {
      61              : 
      62              : // Forward declarations
      63              : struct EnergyPlusData;
      64              : 
      65              : namespace CoolTower {
      66              : 
      67              :     enum class FlowCtrl
      68              :     {
      69              :         Invalid = -1,
      70              :         FlowSchedule,
      71              :         WindDriven,
      72              :         Num
      73              :     };
      74              : 
      75              :     enum class WaterSupplyMode
      76              :     {
      77              :         Invalid = -1,
      78              :         FromMains,
      79              :         FromTank,
      80              :         Num
      81              :     };
      82              : 
      83              :     struct CoolTowerParams
      84              :     {
      85              :         // Members
      86              :         std::string Name;                                                  // The component name
      87              :         std::string CompType;                                              // Type of component
      88              :         Sched::Schedule *availSched = nullptr;                             // schedule
      89              :         int ZonePtr = 0;                                                   // Index to zone
      90              :         int spacePtr = 0;                                                  // Index to space (if applicable)
      91              :         Sched::Schedule *pumpSched = nullptr;                              // Index to schedule for water pump
      92              :         FlowCtrl FlowCtrlType = FlowCtrl::Invalid;                         // Type of cooltower operation
      93              :         WaterSupplyMode CoolTWaterSupplyMode = WaterSupplyMode::FromMains; // Type of water source
      94              :         std::string CoolTWaterSupplyName;                                  // Name of water source
      95              :         int CoolTWaterSupTankID;                                           // Index to water storage tank
      96              :         int CoolTWaterTankDemandARRID;                                     // Index to water storage demand
      97              :         Real64 TowerHeight = 0.0;                                          // Effective cooltower height in m
      98              :         Real64 OutletArea = 0.0;                                           // Outlet area where conditioned air comes in m2
      99              :         Real64 OutletVelocity = 0.0;                                       // Outlet velocity of the cooltower in m/s
     100              :         Real64 MaxAirVolFlowRate = 0.0;                                    // Maximum allowable airflow in m3/s
     101              :         Real64 AirMassFlowRate = 0.0;                                      // Air mass flow rate in kg/s
     102              :         Real64 CoolTAirMass = 0.0;                                         // Air mass in kg
     103              :         Real64 MinZoneTemp = 0.0;                                          // Lower temperature limit to prevent over cooling in C
     104              :         Real64 FracWaterLoss = 0.0;                                        // Fraction of estimated blowdown and drift water
     105              :         Real64 FracFlowSched = 0.0;                                        // Fraction of airflow loss
     106              :         Real64 MaxWaterFlowRate = 0.0;                                     // Maximum limit of water flow rate in m3/s
     107              :         Real64 ActualWaterFlowRate = 0.0;                                  // Actual water mass flow rate in m3/s
     108              :         Real64 RatedPumpPower = 0.0;                                       // Rated power consumption for water pump serving the cooltower in watts
     109              :         Real64 SenHeatLoss = 0.0;                                          // Sensible heat loss in Joules
     110              :         Real64 SenHeatPower = 0.0;                                         // Sensible heat loss rate in watts
     111              :         Real64 LatHeatLoss = 0.0;                                          // Latent heat loss in Joules
     112              :         Real64 LatHeatPower = 0.0;                                         // Latent heat loss rate in watts
     113              :         Real64 AirVolFlowRate = 0.0;                                       // Air flow rate in m3/s
     114              :         Real64 AirVolFlowRateStd = 0.0;                                    // Air flow rate in m3/s at standard conditions
     115              :         Real64 CoolTAirVol = 0.0;                                          // Air volume in m3
     116              :         Real64 ActualAirVolFlowRate = 0.0;                                 // Actual air flow rate in m3/s
     117              :         Real64 InletDBTemp = 0.0;                                          // Outdoor dry bulb temperature in C
     118              :         Real64 InletWBTemp = 0.0;                                          // Outdoor wet bulb temperature in C
     119              :         Real64 InletHumRat = 0.0;                                          // Outdoor humidity ratio
     120              :         Real64 OutletTemp = 0.0;                                           // Dry bulb temperature at cooltower exit in C
     121              :         Real64 OutletHumRat = 0.0;                                         // Humidity ratio at cooltower exit
     122              :         Real64 CoolTWaterConsumpRate = 0.0;                                // Total water consumption during the processes in m3/s
     123              :         Real64 CoolTWaterStarvMakeupRate = 0.0;                            // Water provided from the mains (m3/s)
     124              :         Real64 CoolTWaterStarvMakeup = 0.0;                                // Water provided from the mains
     125              :         Real64 CoolTWaterConsump = 0.0;                                    // Total water consumption in m3
     126              :         Real64 PumpElecPower = 0.0;                                        // Pump power in watts
     127              :         Real64 PumpElecConsump = 0.0;                                      // Pump energy consumption in Joules
     128              :     };
     129              : 
     130              :     void ManageCoolTower(EnergyPlusData &state);
     131              : 
     132              :     void GetCoolTower(EnergyPlusData &state);
     133              : 
     134              :     void CalcCoolTower(EnergyPlusData &state);
     135              : 
     136              :     void UpdateCoolTower(EnergyPlusData &state);
     137              : 
     138              :     void ReportCoolTower(EnergyPlusData &state);
     139              : 
     140              : } // namespace CoolTower
     141              : 
     142              : struct CoolTowerData : BaseGlobalStruct
     143              : {
     144              : 
     145              :     bool GetInputFlag = true;
     146              :     Array1D<CoolTower::CoolTowerParams> CoolTowerSys;
     147              : 
     148         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     149              :     {
     150         2126 :     }
     151              : 
     152         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     153              :     {
     154         1152 :     }
     155              : 
     156         2100 :     void clear_state() override
     157              :     {
     158         2100 :         new (this) CoolTowerData();
     159         2100 :     }
     160              : };
     161              : 
     162              : } // namespace EnergyPlus
     163              : 
     164              : #endif
        

Generated by: LCOV version 2.0-1