LCOV - code coverage report
Current view: top level - EnergyPlus - EvaporativeFluidCoolers.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 EvaporativeFluidCoolers_hh_INCLUDED
      49              : #define EvaporativeFluidCoolers_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/PlantComponent.hh>
      59              : 
      60              : namespace EnergyPlus {
      61              : 
      62              : // Forward declarations
      63              : struct EnergyPlusData;
      64              : 
      65              : namespace EvaporativeFluidCoolers {
      66              : 
      67              :     enum class EvapLoss
      68              :     {
      69              :         Invalid = -1,
      70              :         ByUserFactor,
      71              :         ByMoistTheory,
      72              :         Num
      73              :     };
      74              : 
      75              :     enum class Blowdown
      76              :     {
      77              :         Invalid = -1,
      78              :         ByConcentration,
      79              :         BySchedule,
      80              :         Num
      81              :     };
      82              : 
      83              :     enum struct PIM
      84              :     {
      85              :         StandardDesignCapacity,
      86              :         UFactor,
      87              :         UserSpecifiedDesignCapacity
      88              :     };
      89              : 
      90              :     enum class CapacityControl
      91              :     {
      92              :         Invalid = -1,
      93              :         FanCycling,
      94              :         FluidBypass,
      95              :         Num
      96              :     };
      97              : 
      98              :     struct EvapFluidCoolerInletConds
      99              :     {
     100              :         Real64 WaterTemp = 0.0;  // Evaporative fluid cooler water inlet temperature (C)
     101              :         Real64 AirTemp = 0.0;    // Evaporative fluid cooler air inlet dry-bulb temperature (C)
     102              :         Real64 AirWetBulb = 0.0; // Evaporative fluid cooler air inlet wet-bulb temperature (C)
     103              :         Real64 AirPress = 0.0;   // Evaporative fluid cooler air barometric pressure
     104              :         Real64 AirHumRat = 0.0;  // Evaporative fluid cooler air inlet humidity ratio (kg/kg)
     105              :     };
     106              : 
     107              :     struct EvapFluidCoolerSpecs : PlantComponent
     108              :     {
     109              :         // Members
     110              :         std::string Name;                // User identifier
     111              :         std::string EvapFluidCoolerType; // Type of evaporative fluid cooler
     112              :         DataPlant::PlantEquipmentType Type = DataPlant::PlantEquipmentType::Invalid;
     113              :         std::string PerformanceInputMethod;
     114              :         PIM PerformanceInputMethod_Num = PIM::StandardDesignCapacity;
     115              :         bool Available = true;                               // need an array of logicals--load identifiers of available equipment
     116              :         bool ON = true;                                      // Simulate the machine at it's operating part load ratio
     117              :         Real64 DesignWaterFlowRate = 0.0;                    // Design water flow rate through the evaporative fluid cooler [m3/s]
     118              :         Real64 DesignSprayWaterFlowRate = 0.0;               // Design spray water flow rate through the evaporative fluid cooler [m3/s]
     119              :         Real64 DesWaterMassFlowRate = 0.0;                   // Design water flow rate through the evaporative fluid cooler [kg/s]
     120              :         Real64 HighSpeedAirFlowRate = 0.0;                   // Air flow rate through evaporative fluid cooler at high speed [m3/s]
     121              :         Real64 HighSpeedFanPower = 0.0;                      // Fan power at high fan speed [W]
     122              :         Real64 HighSpeedEvapFluidCoolerUA = 0.0;             // UA of evaporative fluid cooler at high fan speed [W/C]
     123              :         Real64 LowSpeedAirFlowRate = 0.0;                    // Air flow rate through evaporative fluid cooler at low speed [m3/s]
     124              :         Real64 LowSpeedAirFlowRateSizingFactor = 0.0;        // sizing factor for low speed air flow rate []
     125              :         Real64 LowSpeedFanPower = 0.0;                       // Fan power at low fan speed [W]
     126              :         Real64 LowSpeedFanPowerSizingFactor = 0.0;           // Sizing factor for low speed fan power []
     127              :         Real64 LowSpeedEvapFluidCoolerUA = 0.0;              // UA of evaporative fluid cooler at low fan speed [W/C]
     128              :         bool DesignWaterFlowRateWasAutoSized = false;        // true if design water rate was autosize on input
     129              :         bool HighSpeedAirFlowRateWasAutoSized = false;       // true if high speed air rate was autosized
     130              :         bool HighSpeedFanPowerWasAutoSized = false;          // true if high fan power was autosize on input
     131              :         bool HighSpeedEvapFluidCoolerUAWasAutoSized = false; // true if high speed UA was autosized on input
     132              :         bool LowSpeedAirFlowRateWasAutoSized = false;        // true if low speed air rate was autosize on input
     133              :         bool LowSpeedFanPowerWasAutoSized = false;           // true if low speed fan power set to autosize on input
     134              :         bool LowSpeedEvapFluidCoolerUAWasAutoSized = false;  // true if low speed UA set to autosize on input
     135              :         Real64 LowSpeedEvapFluidCoolerUASizingFactor = 0.0;  // sizing factor for low speed UA []
     136              :         Real64 DesignEnteringWaterTemp = 0.0;                // Entering water temperature at design conditions
     137              :         Real64 DesignEnteringAirTemp = 0.0;                  // Design inlet air dry-bulb temperature (C)
     138              :         Real64 DesignEnteringAirWetBulbTemp = 0.0;           // Design inlet air wet-bulb temperature (C)
     139              :         Real64 EvapFluidCoolerMassFlowRateMultiplier = 0.0;  // Maximum evaporative fluid cooler flow rate is
     140              :         // this multiplier times design flow rate
     141              :         Real64 HeatRejectCapNomCapSizingRatio = 0.0;  // ratio of actual cap to nominal capacity []
     142              :         Real64 HighSpeedStandardDesignCapacity = 0.0; // Standard Design Capacity of the evaporative fluid cooler [W]
     143              :         // with entering water at 35C (95F),
     144              :         //  leaving water at 29.44C (85F), entering air at 25.56C (78F) wet-bulb
     145              :         //  temp and 35C (95F) dry-bulb temp, and water flow
     146              :         //  rate of 5.382E-8 m3/s per watt (3 gpm/ton)
     147              :         Real64 LowSpeedStandardDesignCapacity = 0.0; // Standard Design Capacity of the evaporative fluid cooler [W]
     148              :         // with entering water at 35C (95F),
     149              :         //  leaving water at 29.44C (85F), entering air at 25.56C (78F) wet-bulb
     150              :         //  temp and 35C (95F) dry-bulb temp, and water flow
     151              :         //  rate of 5.382E-8 m3/s per watt (3 gpm/ton)
     152              :         Real64 HighSpeedUserSpecifiedDesignCapacity = 0.0; // User specified design capacity [W]
     153              :         Real64 LowSpeedUserSpecifiedDesignCapacity = 0.0;  // User specified design capacity for at low speed for
     154              :         // two speed fluid cooler[W]
     155              :         Real64 Concentration = 0.0;           // fluid/glycol concentration - percent
     156              :         Fluid::GlycolProps *glycol = nullptr; // Index to Property arrays
     157              :         Real64 SizFac = 0.0;                  // sizing factor
     158              :         int WaterInletNodeNum = 0;            // Node number on the water inlet side of the evaporative fluid cooler
     159              :         int WaterOutletNodeNum = 0;           // Node number on the water outlet side of the evaporative fluid cooler
     160              :         int OutdoorAirInletNodeNum = 0;       // Node number of outdoor air inlet for the evaporative fluid cooler
     161              :         int HighMassFlowErrorCount = 0;       // Counter when mass flow rate is >
     162              :         int HighMassFlowErrorIndex = 0;       // Index for high mass flow recurring error message
     163              :         int OutletWaterTempErrorCount = 0;    // Counter when outlet water temperature is < minimum allowed temperature
     164              :         int OutletWaterTempErrorIndex = 0;    // Index for outlet water temperature recurring error message
     165              :         int SmallWaterMassFlowErrorCount = 0; // Counter when water mass flow rate is very small
     166              :         int SmallWaterMassFlowErrorIndex = 0; // Index for very small water mass flow rate recurring error message
     167              :         // fluid bypass
     168              :         CapacityControl capacityControl = CapacityControl::Invalid; // Type of capacity control for single speed cooling tower
     169              :         Real64 BypassFraction = 0.0;                                // Fraction of fluid bypass as a ratio of total fluid flow
     170              :         //  through the tower sump
     171              :         // begin water system interactions
     172              :         EvapLoss EvapLossMode = EvapLoss::ByMoistTheory;   // sets how evaporative fluid cooler water evaporation is modeled
     173              :         Blowdown BlowdownMode = Blowdown::ByConcentration; // sets how evaporative fluid cooler water blowdown is modeled
     174              :         Sched::Schedule *blowdownSched = nullptr;          // schedule of blowdown in [m3/s]
     175              :         int WaterTankID = 0;                               // index "pointer" to WaterStorage structure
     176              :         int WaterTankDemandARRID = 0;                      // index "pointer" to demand array inside WaterStorage structure
     177              :         Real64 UserEvapLossFactor = 0.0;                   // simple model [%/Delt C]
     178              :         Real64 DriftLossFraction = 0.0;
     179              :         Real64 ConcentrationRatio = 0.0; // ratio of solids in blowdown vs make up water
     180              :         bool SuppliedByWaterSystem = false;
     181              :         // end water system variables
     182              :         // loop topology variables
     183              :         PlantLocation plantLoc;
     184              :         Real64 InletWaterTemp = 0.0;    // CW temperature at evaporative fluid cooler inlet
     185              :         Real64 OutletWaterTemp = 0.0;   // CW temperature at evaporative fluid cooler outlet
     186              :         int WaterInletNode = 0;         // Node number at evaporative fluid cooler inlet
     187              :         int WaterOutletNode = 0;        // Node number at evaporative fluid cooler outlet
     188              :         Real64 WaterMassFlowRate = 0.0; // WaterMassFlowRate through evaporative fluid cooler
     189              :         Real64 Qactual = 0.0;           // Evaporative fluid cooler heat transfer
     190              :         Real64 FanPower = 0.0;          // Evaporative fluid cooler fan power used
     191              :         Real64 AirFlowRateRatio = 0.0;  // Ratio of air flow rate through VS evaporative fluid cooler
     192              :         Real64 WaterUsage = 0.0;        // Evaporative fluid cooler water usage (m3/s)
     193              :         bool MyOneTimeFlag = true;
     194              :         bool MyEnvrnFlag = true;
     195              :         bool OneTimeFlagForEachEvapFluidCooler = true;
     196              :         bool CheckEquipName = true;
     197              :         Real64 fluidCoolerInletWaterTemp = 0.0;  // Evaporative fluid cooler inlet water temperature (C)
     198              :         Real64 fluidCoolerOutletWaterTemp = 0.0; // Evaporative fluid cooler outlet water temperature (C)
     199              :         Real64 FanEnergy = 0.0;                  // Evaporative fluid cooler fan energy consumption (J)
     200              :         Real64 WaterAmountUsed = 0.0;            // Evaporative fluid cooler make up water usage (m3)
     201              :         Real64 EvaporationVdot = 0.0;
     202              :         Real64 EvaporationVol = 0.0;
     203              :         Real64 DriftVdot = 0.0;
     204              :         Real64 DriftVol = 0.0;
     205              :         Real64 BlowdownVdot = 0.0;
     206              :         Real64 BlowdownVol = 0.0;
     207              :         Real64 MakeUpVdot = 0.0;
     208              :         Real64 MakeUpVol = 0.0;
     209              :         Real64 TankSupplyVdot = 0.0;
     210              :         Real64 TankSupplyVol = 0.0;
     211              :         Real64 StarvedMakeUpVdot = 0.0;
     212              :         Real64 StarvedMakeUpVol = 0.0;
     213              :         EvapFluidCoolerInletConds inletConds;
     214              : 
     215              :         static EvapFluidCoolerSpecs *factory(EnergyPlusData &state, DataPlant::PlantEquipmentType objectType, std::string const &objectName);
     216              : 
     217              :         void setupOutputVars(EnergyPlusData &state);
     218              : 
     219              :         void getSizingFactor(Real64 &_sizFac) override;
     220              : 
     221              :         void getDesignCapacities(EnergyPlusData &state, const PlantLocation &, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     222              : 
     223              :         void simulate([[maybe_unused]] EnergyPlusData &state,
     224              :                       const PlantLocation &calledFromLocation,
     225              :                       bool FirstHVACIteration,
     226              :                       Real64 &CurLoad,
     227              :                       bool RunFlag) override;
     228              : 
     229              :         void InitEvapFluidCooler(EnergyPlusData &state);
     230              : 
     231              :         void SizeEvapFluidCooler(EnergyPlusData &state);
     232              : 
     233              :         void CalculateWaterUsage(EnergyPlusData &state);
     234              : 
     235              :         void UpdateEvapFluidCooler(EnergyPlusData &state);
     236              : 
     237              :         void ReportEvapFluidCooler(EnergyPlusData &state, bool RunFlag);
     238              : 
     239              :         void CalcSingleSpeedEvapFluidCooler(EnergyPlusData &state);
     240              : 
     241              :         void CalcTwoSpeedEvapFluidCooler(EnergyPlusData &state);
     242              : 
     243              :         void SimSimpleEvapFluidCooler(EnergyPlusData &state, Real64 waterMassFlowRate, Real64 AirFlowRate, Real64 UAdesign, Real64 &outletWaterTemp);
     244              : 
     245              :         void onInitLoopEquip(EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
     246              : 
     247              :         void oneTimeInit(EnergyPlusData &state) override;
     248              :     };
     249              : 
     250              :     void GetEvapFluidCoolerInput(EnergyPlusData &state);
     251              : 
     252              : } // namespace EvaporativeFluidCoolers
     253              : 
     254              : struct EvaporativeFluidCoolersData : BaseGlobalStruct
     255              : {
     256              : 
     257              :     bool GetEvapFluidCoolerInputFlag = true;
     258              :     Array1D<EvaporativeFluidCoolers::EvapFluidCoolerSpecs> SimpleEvapFluidCooler; // dimension to number of machines
     259              :     std::unordered_map<std::string, std::string> UniqueSimpleEvapFluidCoolerNames;
     260              : 
     261         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     262              :     {
     263         2126 :     }
     264              : 
     265         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     266              :     {
     267         1152 :     }
     268              : 
     269         2100 :     void clear_state() override
     270              :     {
     271         2100 :         new (this) EvaporativeFluidCoolersData();
     272         2100 :     }
     273              : };
     274              : 
     275              : } // namespace EnergyPlus
     276              : 
     277              : #endif
        

Generated by: LCOV version 2.0-1