LCOV - code coverage report
Current view: top level - EnergyPlus - CondenserLoopTowers.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 CondenserLoopTowers_hh_INCLUDED
      49              : #define CondenserLoopTowers_hh_INCLUDED
      50              : 
      51              : // C++ Headers
      52              : #include <unordered_map>
      53              : 
      54              : // ObjexxFCL Headers
      55              : #include <ObjexxFCL/Array1D.hh>
      56              : 
      57              : // EnergyPlus Headers
      58              : #include <EnergyPlus/Data/BaseData.hh>
      59              : #include <EnergyPlus/DataGlobals.hh>
      60              : #include <EnergyPlus/EnergyPlus.hh>
      61              : #include <EnergyPlus/Plant/Enums.hh>
      62              : #include <EnergyPlus/Plant/PlantLocation.hh>
      63              : #include <EnergyPlus/PlantComponent.hh>
      64              : 
      65              : namespace EnergyPlus {
      66              : 
      67              : // Forward declarations
      68              : struct EnergyPlusData;
      69              : 
      70              : namespace CondenserLoopTowers {
      71              : 
      72              :     enum class ModelType
      73              :     {
      74              :         // Empirical Model Type
      75              :         Invalid = -1,
      76              :         CoolToolsXFModel,
      77              :         CoolToolsUserDefined,
      78              :         YorkCalcModel,
      79              :         YorkCalcUserDefined,
      80              :         Num
      81              :     };
      82              : 
      83              :     enum class EvapLoss
      84              :     {
      85              :         Invalid = -1,
      86              :         UserFactor,
      87              :         MoistTheory,
      88              :         Num
      89              :     };
      90              : 
      91              :     enum class Blowdown
      92              :     {
      93              :         Invalid = -1,
      94              :         Concentration,
      95              :         Schedule,
      96              :         Num
      97              :     };
      98              : 
      99              :     enum class PIM
     100              :     {
     101              :         Invalid = -1,
     102              :         NominalCapacity,
     103              :         UFactor,
     104              :         Num
     105              :     };
     106              : 
     107              :     enum class CapacityCtrl
     108              :     {
     109              :         Invalid = -1,
     110              :         FanCycling,
     111              :         FluidBypass,
     112              :         Num
     113              :     };
     114              : 
     115              :     constexpr std::array<std::string_view, static_cast<int>(CapacityCtrl::Num)> CapacityCtrlNamesUC{"FANCYCLING", "FLUIDBYPASS"};
     116              : 
     117              :     enum class CellCtrl
     118              :     {
     119              :         Invalid = -1,
     120              :         MinCell,
     121              :         MaxCell,
     122              :         Num
     123              :     };
     124              : 
     125              :     struct CoolingTower : PlantComponent
     126              :     {
     127              :         // Members
     128              :         std::string Name; // User identifier
     129              :         DataPlant::PlantEquipmentType TowerType = DataPlant::PlantEquipmentType::Invalid;
     130              :         PIM PerformanceInputMethod_Num = PIM::Invalid; // Method of entering tower performance: UA and Design Water
     131              :         //  Flow Rate, or Nominal Capacity
     132              :         std::string ModelCoeffObjectName;                 // Cooling Tower:Variable Speed Model Coefficient Object name
     133              :         bool Available = true;                            // need an array of logicals--load identifiers of available equipment
     134              :         bool ON = true;                                   // Simulate the machine at it's operating part load ratio
     135              :         Real64 DesignWaterFlowRate = 0.0;                 // Design water flow rate through the tower [m3/s]
     136              :         bool DesignWaterFlowRateWasAutoSized = false;     // true if previous was autosize on input
     137              :         Real64 DesignWaterFlowPerUnitNomCap = 0.0;        // scalable sizing factor for water flow per capacity [m3/s/W]
     138              :         Real64 DesWaterMassFlowRate = 0.0;                // Design water flow rate through the entire tower [kg/s]
     139              :         Real64 DesWaterMassFlowRatePerCell = 0.0;         // Design water flow rate per cell [Kg/s]
     140              :         Real64 HighSpeedAirFlowRate = 0.0;                // Air flow rate through tower at high speed [m3/s]
     141              :         bool HighSpeedAirFlowRateWasAutoSized = false;    // true if previous was autosize on input
     142              :         Real64 DesignAirFlowPerUnitNomCap = 0.0;          // scalable sizing factor for air flow per capacity [m3/s/W]
     143              :         bool DefaultedDesignAirFlowScalingFactor = false; // true if user left input field blank for DesignAirFlowPerUnitNomCap
     144              :         Real64 HighSpeedFanPower = 0.0;                   // Fan power at high fan speed [W]
     145              :         bool HighSpeedFanPowerWasAutoSized = false;       // true if fan power was autosize on input
     146              :         Real64 DesignFanPowerPerUnitNomCap = 0.0;         // scalable sizing factor for fan power per capacity [W/W]
     147              : 
     148              :         Real64 HighSpeedTowerUA = 0.0;                // UA of tower at high fan speed [W/C]
     149              :         bool HighSpeedTowerUAWasAutoSized = false;    // true if previous was autosize on input
     150              :         Real64 LowSpeedAirFlowRate = 0.0;             // Air flow rate through tower at low speed [m3/s]
     151              :         bool LowSpeedAirFlowRateWasAutoSized = false; // true if previous was autosize on input
     152              :         Real64 LowSpeedAirFlowRateSizingFactor = 0.0; // sizing factor for low speed flow rate [ ]
     153              :         Real64 LowSpeedFanPower = 0.0;                // Fan power at low fan speed [W]
     154              :         bool LowSpeedFanPowerWasAutoSized = false;    // true if low speed fan power was autosized on input
     155              :         Real64 LowSpeedFanPowerSizingFactor = 0.0;    // sizing factor for low speed fan power []
     156              :         Real64 LowSpeedTowerUA = 0.0;                 // UA of tower at low fan speed [W/C]
     157              :         bool LowSpeedTowerUAWasAutoSized = false;     // ture if low speed UA was autosize on input
     158              :         Real64 LowSpeedTowerUASizingFactor = 0.0;     // sizing factor for UA at low fan speed []
     159              :         Real64 FreeConvAirFlowRate = 0.0;             // Air flow rate through tower with fan off [m3/s]
     160              :         bool FreeConvAirFlowRateWasAutoSized = false; // true if previous was autosize on input
     161              :         Real64 FreeConvAirFlowRateSizingFactor = 0.0; // sizing factor for air flow at free conv []
     162              :         Real64 FreeConvTowerUA = 0.0;                 // UA of tower with fan off [W/C]
     163              :         bool FreeConvTowerUAWasAutoSized = false;     // true if previous was autosize on input
     164              :         Real64 FreeConvTowerUASizingFactor = 0.0;     // sizing factor for UA at fre convection []
     165              :         Real64 DesignInletWB = 0.0;                   // Design inlet air wet-bulb temperature (C)
     166              :         Real64 DesignApproach = 0.0;                  // Design approach (outlet water temp minus inlet air wet-bulb temp (C)
     167              :         Real64 DesignRange = 0.0;                     // Design range temperature (inlet water temp minus outlet water temp (C)
     168              :         Real64 MinimumVSAirFlowFrac = 0.0;            // Min air flow ratio (used for VS tower only, point where free conv occurs)
     169              :         Real64 CalibratedWaterFlowRate = 0.0;         // Water flow ratio required for model calibration
     170              :         Real64 BasinHeaterPowerFTempDiff = 0.0;       // Basin heater capacity per degree C below setpoint (W/C)
     171              :         Real64 BasinHeaterSetPointTemp = 0.0;         // setpoint temperature for basin heater operation (C)
     172              :         Real64 MakeupWaterDrift = 0.0;                // Makeup water flow rate fraction due to drift
     173              :         Real64 FreeConvectionCapacityFraction = 0.0;  // Percentage of tower capacity in free convection regime
     174              :         Real64 TowerMassFlowRateMultiplier = 0.0;     // Maximum tower flow rate is this multiplier times design flow rate
     175              :         Real64 HeatRejectCapNomCapSizingRatio = 1.25; // ratio of actual cap to nominal capacity []
     176              :         Real64 TowerNominalCapacity = 0.0;            // Nominal capacity of the tower [W] with entering water at 35C (95F),
     177              :         //  leaving water at 29.44C (85F), entering air at 25.56C (78F) wet-bulb
     178              :         //  temp and 35C (95F) dry-bulb temp, and water flow
     179              :         //  rate of 5.382E-8 m3/s per watt (3 gpm/ton)
     180              :         bool TowerNominalCapacityWasAutoSized = false; // true if tower nominal capacity was autosized on input
     181              :         Real64 TowerLowSpeedNomCap = 0.0;              // Nominal capacity of the tower [W] with entering water at 35C (95F),
     182              :         //  leaving water at 29.44C (85F), entering air at 25.56C (78F) wet-bulb
     183              :         //  temp and 35C (95F) dry-bulb temp, and water flow
     184              :         //  rate of 5.382E-8 m3/s per nominal capacity watt (3 gpm/ton)
     185              :         bool TowerLowSpeedNomCapWasAutoSized = false; // true if previous was autosize on input
     186              :         Real64 TowerLowSpeedNomCapSizingFactor = 0.0; // sizing factor for low speed capacity []
     187              :         Real64 TowerFreeConvNomCap = 0.0;             // Nominal capacity of the tower [W] with entering water at 35C (95F),
     188              :         //  leaving water at 29.44C (85F), entering air at 25.56C (78F) wet-bulb
     189              :         //  temp and 35C (95F) dry-bulb temp, and water flow
     190              :         //  rate of 5.382E-8 m3/s per nominal capacity watt (3 gpm/ton)
     191              :         bool TowerFreeConvNomCapWasAutoSized = false;  // true if previous was autosize on Input
     192              :         Real64 TowerFreeConvNomCapSizingFactor = 0.0;  // sizing factor for free conv capacity []
     193              :         Real64 SizFac = 0.0;                           // sizing factor
     194              :         int WaterInletNodeNum = 0;                     // Node number on the water inlet side of the tower
     195              :         int WaterOutletNodeNum = 0;                    // Node number on the water outlet side of the tower
     196              :         int OutdoorAirInletNodeNum = 0;                // Node number of outdoor air inlet for the tower
     197              :         ModelType TowerModelType = ModelType::Invalid; // Type of empirical model (1=CoolTools)
     198              :         int FanPowerfAirFlowCurve = 0;                 // Index to fan power correlation curve for VS Towers
     199              :         Sched::Schedule *blowDownSched = nullptr;      // Pointer to blow down schedule
     200              :         Sched::Schedule *basinHeaterSched = nullptr;   // Pointer to basin heater schedule
     201              :         int HighMassFlowErrorCount = 0;                // Counter when mass flow rate is > Design*TowerMassFlowRateMultiplier
     202              :         int HighMassFlowErrorIndex = 0;                // Index for high mass flow recurring error message
     203              :         int OutletWaterTempErrorCount = 0;             // Counter when outlet water temperature is < minimum allowed temperature
     204              :         int OutletWaterTempErrorIndex = 0;             // Index for outlet water temperature recurring error message
     205              :         int SmallWaterMassFlowErrorCount = 0;          // Counter when water mass flow rate is very small
     206              :         int SmallWaterMassFlowErrorIndex = 0;          // Index for very small water mass flow rate recurring error message
     207              :         int WMFRLessThanMinAvailErrCount = 0;          // Counter when water mass flow rate is less than minimum available
     208              :         int WMFRLessThanMinAvailErrIndex = 0;          // Index for water mass flow rate less than minavail recurring message
     209              :         int WMFRGreaterThanMaxAvailErrCount = 0;       // Counter when water mass flow rate is greater than minimum available
     210              :         int WMFRGreaterThanMaxAvailErrIndex = 0;       // Index for water mass flow rate > minavail recurring message
     211              :         int CoolingTowerAFRRFailedCount = 0;           // Counter for air flow rate ratio out of bounds error
     212              :         int CoolingTowerAFRRFailedIndex = 0;           // Index for air flow rate ratio out of bounds error
     213              :         int SpeedSelected = 0;                         // speed of the two-speed fan selected (0:ON;1:LOW;2:HIGH)
     214              :         // fluid bypass
     215              :         CapacityCtrl CapacityControl = CapacityCtrl::Invalid; // Type of capacity control for single speed cooling tower:
     216              :         //  0 - FanCycling, 1 - FluidBypass
     217              :         Real64 BypassFraction = 0.0; // Fraction of fluid bypass as a ratio of total fluid flow
     218              :         //  through the tower sump
     219              :         // multi cell tower
     220              :         int NumCell = 0; // Number of cells in the cooling tower
     221              :         CellCtrl cellCtrl = CellCtrl::MaxCell;
     222              :         int NumCellOn = 0;            // number of cells working
     223              :         Real64 MinFracFlowRate = 0.0; // Minimal fraction of design flow/cell allowable
     224              :         Real64 MaxFracFlowRate = 0.0; // Maximal ratio of design flow/cell allowable
     225              :         // begin water system interactions
     226              :         EvapLoss EvapLossMode = EvapLoss::MoistTheory;   // sets how tower water evaporation is modeled
     227              :         Real64 UserEvapLossFactor = 0.0;                 // simple model [%/Delt C]
     228              :         Real64 DriftLossFraction = 0.008;                // default value is 0.008%
     229              :         Blowdown BlowdownMode = Blowdown::Concentration; // sets how tower water blowdown is modeled
     230              :         Real64 ConcentrationRatio = 3.0;                 // ratio of solids in blowdown vs make up water
     231              :         Sched::Schedule *blowdownSched = nullptr;        // index "pointer" to schedule of blowdown in [m3/s]
     232              :         bool SuppliedByWaterSystem = false;
     233              :         int WaterTankID = 0;          // index "pointer" to WaterStorage structure
     234              :         int WaterTankDemandARRID = 0; // index "pointer" to demand array inside WaterStorage structure
     235              :         // end water system variables
     236              :         // loop topology variables
     237              :         PlantLocation plantLoc;
     238              :         // Merkel VS model curves
     239              :         int UAModFuncAirFlowRatioCurvePtr = 0;   // curve index for UA modifier as a function of air flow ratio
     240              :         int UAModFuncWetBulbDiffCurvePtr = 0;    // curve index for UA modifier as a function of local wetbulb
     241              :         int UAModFuncWaterFlowRatioCurvePtr = 0; // curve index for UA modifier as a function of water flow ratio
     242              :         bool SetpointIsOnOutlet = false;         // if true look to outlet node of tower, if flase look to overall loop setpoint
     243              :         int VSMerkelAFRErrorIter = 0;            // error counter for regula falsi failed with max iterations, vs merkel model
     244              :         int VSMerkelAFRErrorIterIndex = 0;       // recurring error index for regula falsi failed with max iterations, vs merkel model
     245              :         int VSMerkelAFRErrorFail = 0;            // error counter for regula falsi failed with limits exceeded, vs merkel model
     246              :         int VSMerkelAFRErrorFailIndex = 0;       // recurring error index for regula falsi failed with limits exceeded, vs merkel model
     247              :         Real64 DesInletWaterTemp = 0.0;          // design tower inlet water temperature (C)
     248              :         Real64 DesOutletWaterTemp = 0.0;         // design tower outlet water temperature (C)
     249              :         Real64 DesInletAirDBTemp = 0.0;          // design tower inlet air dry-bulb temperature (C)
     250              :         bool TowerInletCondsAutoSize = false;    // true if tower inlet condition is autosized or defaulted to autosize
     251              :         // Operational fault parameters
     252              :         bool FaultyCondenserSWTFlag = false;   // True if the condenser has SWT sensor fault
     253              :         int FaultyCondenserSWTIndex = 0;       // Index of the fault object corresponding to the condenser
     254              :         Real64 FaultyCondenserSWTOffset = 0.0; // Condenser SWT sensor offset
     255              :         bool FaultyTowerFoulingFlag = false;   // True if the tower has fouling fault
     256              :         int FaultyTowerFoulingIndex = 0;       // Index of the fouling fault object corresponding to the condenser
     257              :         Real64 FaultyTowerFoulingFactor = 1.0; // Tower fouling factor
     258              :         std::string EndUseSubcategory;         // identifier use for the end use subcategory
     259              :         bool envrnFlag = true;
     260              :         bool oneTimeFlag = true;
     261              :         Real64 TimeStepSysLast = 0.0;    // last system time step (used to check for downshifting)
     262              :         Real64 CurrentEndTimeLast = 0.0; // end time of time step for last simulation time step
     263              : 
     264              :         // From module level variables, apparently the module AirFlowRateRatio was used slightly different from the struct's AirFlowRatio variable
     265              :         //  so removing this caused diffs that I did not spend time investigating...they might be fine diffs, check some time later
     266              :         Real64 airFlowRateRatio = 0.0;
     267              : 
     268              :         // From TowerInletConds struct
     269              :         Real64 WaterTemp = 0.0;  // Tower water inlet temperature (C)
     270              :         Real64 AirTemp = 0.0;    // Tower air inlet dry-bulb temperature (C)
     271              :         Real64 AirWetBulb = 0.0; // Tower air inlet wet-bulb temperature (C)
     272              :         Real64 AirPress = 0.0;   // Tower air barometric pressure
     273              :         Real64 AirHumRat = 0.0;  // Tower air inlet humidity ratio (kg/kg)
     274              : 
     275              :         // From ReportVars struct
     276              :         Real64 InletWaterTemp = 0.0;         // Tower inlet water temperature (C)
     277              :         Real64 OutletWaterTemp = 0.0;        // Tower outlet water temperature (C)
     278              :         Real64 WaterMassFlowRate = 0.0;      // Tower water mass flow rate (m3/s)
     279              :         Real64 Qactual = 0.0;                // Tower heat rejection rate (W)
     280              :         Real64 FanPower = 0.0;               // Tower fan power (W)
     281              :         Real64 FanEnergy = 0.0;              // Tower fan energy consumption (J)
     282              :         Real64 AirFlowRatio = 0.0;           // Air flow ratio through variable speed cooling tower
     283              :         Real64 BasinHeaterPower = 0.0;       // Basin heater power (W)
     284              :         Real64 BasinHeaterConsumption = 0.0; // Basin heater energy consumption (J)
     285              :         Real64 WaterUsage = 0.0;             // Tower water usage (m3/s)
     286              :         Real64 WaterAmountUsed = 0.0;        // Tower make up water usage (m3)
     287              :         Real64 FanCyclingRatio = 0.0;        // cycling ratio of tower fan when min fan speed provide too much capacity (for VFD)
     288              :         Real64 EvaporationVdot = 0.0;
     289              :         Real64 EvaporationVol = 0.0;
     290              :         Real64 DriftVdot = 0.0;
     291              :         Real64 DriftVol = 0.0;
     292              :         Real64 BlowdownVdot = 0.0;
     293              :         Real64 BlowdownVol = 0.0;
     294              :         Real64 MakeUpVdot = 0.0;
     295              :         Real64 MakeUpVol = 0.0;
     296              :         Real64 TankSupplyVdot = 0.0;
     297              :         Real64 TankSupplyVol = 0.0;
     298              :         Real64 StarvedMakeUpVdot = 0.0;
     299              :         Real64 StarvedMakeUpVol = 0.0;
     300              :         Real64 coolingTowerApproach = 0.0;
     301              :         Real64 coolingTowerRange = 0.0;
     302              : 
     303              :         // From VSTower struct - for Variable speed towers only
     304              :         std::array<Real64, 35> Coeff = {0.0}; // - model coefficients
     305              :         bool FoundModelCoeff = false;         // - TRUE if model is calibratable
     306              :         Real64 MinInletAirWBTemp = 0.0;       // - model limit for min inlet air WB temp
     307              :         Real64 MaxInletAirWBTemp = 0.0;       // - model limit for max inlet air WB temp
     308              :         Real64 MinRangeTemp = 0.0;            // - model limit for min range temp
     309              :         Real64 MaxRangeTemp = 0.0;            // - model limit for max range temp
     310              :         Real64 MinApproachTemp = 0.0;         // - model limit for min approach temp
     311              :         Real64 MaxApproachTemp = 0.0;         // - model limit for max approach temp
     312              :         Real64 MinWaterFlowRatio = 0.0;       // - model limit for min water flow rate ratio
     313              :         Real64 MaxWaterFlowRatio = 0.0;       // - model limit for max water flow rate ratio
     314              :         Real64 MaxLiquidToGasRatio = 0.0;     // - model limit for max liquid to gas ratio
     315              :         int VSErrorCountFlowFrac = 0;         // - counter if water flow rate ratio limits are exceeded
     316              :         int VSErrorCountWFRR = 0;             // - counter if water flow rate ratio limits are exceeded
     317              :         int VSErrorCountIAWB = 0;             // - counter if inlet air wet-bulb temperature limits are exceeded
     318              :         int VSErrorCountTR = 0;               // - counter if tower range temperature limits are exceeded
     319              :         int VSErrorCountTRCalc = 0;           // - counter if tower range temperature could not be calculated
     320              :         int VSErrorCountTA = 0;               // - counter if tower approach temperature limits are exceeded
     321              :         int ErrIndexFlowFrac = 0;             // - index to recurring error structure for liquid to gas ratio
     322              :         int ErrIndexWFRR = 0;                 // - index to recurring error structure for water flow rate ratio
     323              :         int ErrIndexIAWB = 0;                 // - index to recurring error structure for inlet air WB
     324              :         int ErrIndexTR = 0;                   // - index to recurring error structure for tower range
     325              :         int ErrIndexTRCalc = 0;               // - index to recurring error structure for tower range
     326              :         int ErrIndexTA = 0;                   // - index to recurring error structure for tower approach
     327              :         int ErrIndexLG = 0;                   // - index to recurring error structure for tower liquid/gas ratio
     328              :         //- Tr = Range temperature
     329              :         std::string TrBuffer1; // - buffer to print Tr warning messages on following time step
     330              :         std::string TrBuffer2; // - buffer to print Tr warning messages on following time step
     331              :         std::string TrBuffer3; // - buffer to print Tr warning messages on following time step
     332              :         //- Twb = Wet-bulb temperature
     333              :         std::string TwbBuffer1; // - buffer to print Twb warning messages on following time step
     334              :         std::string TwbBuffer2; // - buffer to print Twb warning messages on following time step
     335              :         std::string TwbBuffer3; // - buffer to print Twb warning messages on following time step
     336              :         //- Ta = Approach temperature
     337              :         std::string TaBuffer1; // - buffer to print Ta warning messages on following time step
     338              :         std::string TaBuffer2; // - buffer to print Ta warning messages on following time step
     339              :         std::string TaBuffer3; // - buffer to print Ta warning messages on following time step
     340              :         //- WFRR = Water flow rate ratio
     341              :         std::string WFRRBuffer1; // - buffer to print WFRR warning messages on following time step
     342              :         std::string WFRRBuffer2; // - buffer to print WFRR warning messages on following time step
     343              :         std::string WFRRBuffer3; // - buffer to print WFRR warning messages on following time step
     344              :         //- LG = Liquid to gas ratio
     345              :         std::string LGBuffer1;               // - buffer to print LG warning messages on following time step
     346              :         std::string LGBuffer2;               // - buffer to print LG warning messages on following time step
     347              :         bool PrintTrMessage = false;         // - flag to print Tr error message
     348              :         bool PrintTwbMessage = false;        // - flag to print Twb error message
     349              :         bool PrintTaMessage = false;         // - flag to print Ta error message
     350              :         bool PrintWFRRMessage = false;       // - flag to print WFRR error message
     351              :         bool PrintLGMessage = false;         // - flag to print liquid-gas ratio error message
     352              :         Real64 TrLast = 0.0;                 // value of Tr when warning occurred (passed to Recurring Warning)
     353              :         Real64 TwbLast = 0.0;                // value of Twb when warning occurred (passed to Recurring Warning)
     354              :         Real64 TaLast = 0.0;                 // value of Ta when warning occurred (passed to Recurring Warning)
     355              :         Real64 WaterFlowRateRatioLast = 0.0; // value of WFRR when warning occurred (passed to Recurring Warn)
     356              :         Real64 LGLast = 0.0;                 // value of LG when warning occurred (passed to Recurring Warn)
     357              : 
     358              :         void simulate([[maybe_unused]] EnergyPlusData &state,
     359              :                       const PlantLocation &calledFromLocation,
     360              :                       bool FirstHVACIteration,
     361              :                       Real64 &CurLoad,
     362              :                       bool RunFlag) override;
     363              : 
     364              :         void getDesignCapacities(EnergyPlusData &state,
     365              :                                  [[maybe_unused]] const PlantLocation &calledFromLocation,
     366              :                                  Real64 &MaxLoad,
     367              :                                  Real64 &MinLoad,
     368              :                                  Real64 &OptLoad) override;
     369              : 
     370              :         void getSizingFactor(Real64 &SizFac) override;
     371              : 
     372              :         void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override;
     373              : 
     374              :         void oneTimeInit(EnergyPlusData &state) override;
     375              : 
     376              :         void initEachEnvironment(EnergyPlusData &state);
     377              : 
     378              :         void initialize(EnergyPlusData &state);
     379              : 
     380              :         void setupOutputVariables(EnergyPlusData &state);
     381              : 
     382              :         void SizeTower(EnergyPlusData &state);
     383              : 
     384              :         void SizeVSMerkelTower(EnergyPlusData &state);
     385              : 
     386              :         void calculateSingleSpeedTower(EnergyPlusData &state, Real64 &MyLoad, bool RunFlag);
     387              : 
     388              :         void calculateTwoSpeedTower(EnergyPlusData &state, Real64 &MyLoad, bool RunFlag);
     389              : 
     390              :         void calculateMerkelVariableSpeedTower(EnergyPlusData &state, Real64 &MyLoad, bool RunFlag);
     391              : 
     392              :         void calculateVariableSpeedTower(EnergyPlusData &state, Real64 &MyLoad, bool RunFlag);
     393              : 
     394              :         Real64 calculateSimpleTowerOutletTemp(EnergyPlusData &state, Real64 waterMassFlowRate, Real64 AirFlowRate, Real64 UAdesign);
     395              : 
     396              :         Real64 calculateVariableTowerOutletTemp(EnergyPlusData &state,
     397              :                                                 Real64 WaterFlowRateRatio,    // current water flow rate ratio (capped if applicable)
     398              :                                                 Real64 airFlowRateRatioLocal, // current air flow rate ratio
     399              :                                                 Real64 Twb                    // current inlet air wet-bulb temperature (C, capped if applicable)
     400              :         );
     401              : 
     402              :         void calculateWaterUsage(EnergyPlusData &state);
     403              : 
     404              :         Real64 calculateVariableSpeedApproach(EnergyPlusData &state,
     405              :                                               Real64 PctWaterFlow,      // Water flow ratio of cooling tower
     406              :                                               Real64 airFlowRatioLocal, // Air flow ratio of cooling tower
     407              :                                               Real64 Twb,               // Inlet air wet-bulb temperature [C]
     408              :                                               Real64 Tr                 // Cooling tower range (outlet water temp minus inlet air wet-bulb temp) [C]
     409              :         );
     410              : 
     411              :         void checkModelBounds(EnergyPlusData &state,
     412              :                               Real64 Twb,                      // current inlet air wet-bulb temperature (C)
     413              :                               Real64 Tr,                       // requested range temperature for current time step (C)
     414              :                               Real64 Ta,                       // requested approach temperature for current time step (C)
     415              :                               Real64 WaterFlowRateRatio,       // current water flow rate ratio at water inlet node
     416              :                               Real64 &TwbCapped,               // bounded value of inlet air wet-bulb temperature (C)
     417              :                               Real64 &TrCapped,                // bounded value of range temperature (C)
     418              :                               Real64 &TaCapped,                // bounded value of approach temperature (C)
     419              :                               Real64 &WaterFlowRateRatioCapped // bounded value of water flow rate ratio
     420              :         );
     421              : 
     422              :         void update(EnergyPlusData &state);
     423              : 
     424              :         void report(EnergyPlusData &state, bool RunFlag);
     425              : 
     426              :         void checkMassFlowAndLoad(EnergyPlusData &state, Real64 MyLoad, bool RunFlag, bool &returnFlagSet);
     427              : 
     428              :         static CoolingTower *factory(EnergyPlusData &state, std::string_view objectName);
     429              : 
     430              :         Real64 getDynamicMaxCapacity(EnergyPlusData &state) override;
     431              :     };
     432              : 
     433              :     void GetTowerInput(EnergyPlusData &state);
     434              : 
     435              : } // namespace CondenserLoopTowers
     436              : 
     437              : struct CondenserLoopTowersData : BaseGlobalStruct
     438              : {
     439              :     bool GetInput = true;
     440              :     Array1D<CondenserLoopTowers::CoolingTower> towers; // dimension to number of machines
     441              : 
     442         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     443              :     {
     444         2126 :     }
     445              : 
     446         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     447              :     {
     448         1152 :     }
     449              : 
     450         2100 :     void clear_state() override
     451              :     {
     452         2100 :         new (this) CondenserLoopTowersData();
     453         2100 :     }
     454              : };
     455              : 
     456              : } // namespace EnergyPlus
     457              : 
     458              : #endif
        

Generated by: LCOV version 2.0-1