LCOV - code coverage report
Current view: top level - EnergyPlus - CondenserLoopTowers.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 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        1014 :     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 VSTower = 0;                               // Index to a variable speed tower (otherwise = 0)
     199             :         int FanPowerfAirFlowCurve = 0;                 // Index to fan power correlation curve for VS Towers
     200             :         int BlowDownSchedulePtr = 0;                   // Pointer to blow down schedule
     201             :         int BasinHeaterSchedulePtr = 0;                // Pointer to basin heater schedule
     202             :         int HighMassFlowErrorCount = 0;                // Counter when mass flow rate is > Design*TowerMassFlowRateMultiplier
     203             :         int HighMassFlowErrorIndex = 0;                // Index for high mass flow recurring error message
     204             :         int OutletWaterTempErrorCount = 0;             // Counter when outlet water temperature is < minimum allowed temperature
     205             :         int OutletWaterTempErrorIndex = 0;             // Index for outlet water temperature recurring error message
     206             :         int SmallWaterMassFlowErrorCount = 0;          // Counter when water mass flow rate is very small
     207             :         int SmallWaterMassFlowErrorIndex = 0;          // Index for very small water mass flow rate recurring error message
     208             :         int WMFRLessThanMinAvailErrCount = 0;          // Counter when water mass flow rate is less than minimum available
     209             :         int WMFRLessThanMinAvailErrIndex = 0;          // Index for water mass flow rate less than minavail recurring message
     210             :         int WMFRGreaterThanMaxAvailErrCount = 0;       // Counter when water mass flow rate is greater than minimum available
     211             :         int WMFRGreaterThanMaxAvailErrIndex = 0;       // Index for water mass flow rate > minavail recurring message
     212             :         int CoolingTowerAFRRFailedCount = 0;           // Counter for air flow rate ratio out of bounds error
     213             :         int CoolingTowerAFRRFailedIndex = 0;           // Index for air flow rate ratio out of bounds error
     214             :         int SpeedSelected = 0;                         // speed of the two-speed fan selected (0:ON;1:LOW;2:HIGH)
     215             :         // fluid bypass
     216             :         CapacityCtrl CapacityControl = CapacityCtrl::Invalid; // Type of capacity control for single speed cooling tower:
     217             :         //  0 - FanCycling, 1 - FluidBypass
     218             :         Real64 BypassFraction = 0.0; // Fraction of fluid bypass as a ratio of total fluid flow
     219             :         //  through the tower sump
     220             :         // multi cell tower
     221             :         int NumCell = 0; // Number of cells in the cooling tower
     222             :         CellCtrl cellCtrl = CellCtrl::MaxCell;
     223             :         int NumCellOn = 0;            // number of cells working
     224             :         Real64 MinFracFlowRate = 0.0; // Minimal fraction of design flow/cell allowable
     225             :         Real64 MaxFracFlowRate = 0.0; // Maximal ratio of design flow/cell allowable
     226             :         // begin water system interactions
     227             :         EvapLoss EvapLossMode = EvapLoss::MoistTheory;   // sets how tower water evaporation is modeled
     228             :         Real64 UserEvapLossFactor = 0.0;                 // simple model [%/Delt C]
     229             :         Real64 DriftLossFraction = 0.008;                // default value is 0.008%
     230             :         Blowdown BlowdownMode = Blowdown::Concentration; // sets how tower water blowdown is modeled
     231             :         Real64 ConcentrationRatio = 3.0;                 // ratio of solids in blowdown vs make up water
     232             :         int SchedIDBlowdown = 0;                         // index "pointer" to schedule of blowdown in [m3/s]
     233             :         bool SuppliedByWaterSystem = false;
     234             :         int WaterTankID = 0;          // index "pointer" to WaterStorage structure
     235             :         int WaterTankDemandARRID = 0; // index "pointer" to demand array inside WaterStorage structure
     236             :         // end water system variables
     237             :         // loop topology variables
     238             :         PlantLocation plantLoc;
     239             :         // Merkel VS model curves
     240             :         int UAModFuncAirFlowRatioCurvePtr = 0;   // curve index for UA modifier as a function of air flow ratio
     241             :         int UAModFuncWetBulbDiffCurvePtr = 0;    // curve index for UA modifier as a function of local wetbulb
     242             :         int UAModFuncWaterFlowRatioCurvePtr = 0; // curve index for UA modifier as a function of water flow ratio
     243             :         bool SetpointIsOnOutlet = false;         // if true look to outlet node of tower, if flase look to overall loop setpoint
     244             :         int VSMerkelAFRErrorIter = 0;            // error counter for regula falsi failed with max iterations, vs merkel model
     245             :         int VSMerkelAFRErrorIterIndex = 0;       // recurring error index for regula falsi failed with max iterations, vs merkel model
     246             :         int VSMerkelAFRErrorFail = 0;            // error counter for regula falsi failed with limits exceeded, vs merkel model
     247             :         int VSMerkelAFRErrorFailIndex = 0;       // recurring error index for regula falsi failed with limits exceeded, vs merkel model
     248             :         Real64 DesInletWaterTemp = 0.0;          // design tower inlet water temperature (C)
     249             :         Real64 DesOutletWaterTemp = 0.0;         // design tower outlet water temperature (C)
     250             :         Real64 DesInletAirDBTemp = 0.0;          // design tower inlet air dry-bulb temperature (C)
     251             :         Real64 DesInletAirWBTemp = 0.0;          // design tower outlet air wet-bulb temperature (C)
     252             :         Real64 DesApproach = 0.0;                // design tower approach temperature (deltaC)
     253             :         Real64 DesRange = 0.0;                   // design tower range temperature (deltaC)
     254             :         bool TowerInletCondsAutoSize = false;    // true if tower inlet condition is autosized or defaulted to autosize
     255             :         // Operational fault parameters
     256             :         bool FaultyCondenserSWTFlag = false;   // True if the condenser has SWT sensor fault
     257             :         int FaultyCondenserSWTIndex = 0;       // Index of the fault object corresponding to the condenser
     258             :         Real64 FaultyCondenserSWTOffset = 0.0; // Condenser SWT sensor offset
     259             :         bool FaultyTowerFoulingFlag = false;   // True if the tower has fouling fault
     260             :         int FaultyTowerFoulingIndex = 0;       // Index of the fouling fault object corresponding to the condenser
     261             :         Real64 FaultyTowerFoulingFactor = 1.0; // Tower fouling factor
     262             :         std::string EndUseSubcategory;         // identifier use for the end use subcategory
     263             :         bool envrnFlag = true;
     264             :         bool oneTimeFlag = true;
     265             :         Real64 TimeStepSysLast = 0.0;    // last system time step (used to check for downshifting)
     266             :         Real64 CurrentEndTimeLast = 0.0; // end time of time step for last simulation time step
     267             : 
     268             :         // From module level variables, apparently the module AirFlowRateRatio was used slightly different from the struct's AirFlowRatio variable
     269             :         //  so removing this caused diffs that I did not spend time investigating...they might be fine diffs, check some time later
     270             :         Real64 airFlowRateRatio = 0.0;
     271             : 
     272             :         // From TowerInletConds struct
     273             :         Real64 WaterTemp = 0.0;  // Tower water inlet temperature (C)
     274             :         Real64 AirTemp = 0.0;    // Tower air inlet dry-bulb temperature (C)
     275             :         Real64 AirWetBulb = 0.0; // Tower air inlet wet-bulb temperature (C)
     276             :         Real64 AirPress = 0.0;   // Tower air barometric pressure
     277             :         Real64 AirHumRat = 0.0;  // Tower air inlet humidity ratio (kg/kg)
     278             : 
     279             :         // From ReportVars struct
     280             :         Real64 InletWaterTemp = 0.0;         // Tower inlet water temperature (C)
     281             :         Real64 OutletWaterTemp = 0.0;        // Tower outlet water temperature (C)
     282             :         Real64 WaterMassFlowRate = 0.0;      // Tower water mass flow rate (m3/s)
     283             :         Real64 Qactual = 0.0;                // Tower heat rejection rate (W)
     284             :         Real64 FanPower = 0.0;               // Tower fan power (W)
     285             :         Real64 FanEnergy = 0.0;              // Tower fan energy consumption (J)
     286             :         Real64 AirFlowRatio = 0.0;           // Air flow ratio through variable speed cooling tower
     287             :         Real64 BasinHeaterPower = 0.0;       // Basin heater power (W)
     288             :         Real64 BasinHeaterConsumption = 0.0; // Basin heater energy consumption (J)
     289             :         Real64 WaterUsage = 0.0;             // Tower water usage (m3/s)
     290             :         Real64 WaterAmountUsed = 0.0;        // Tower make up water usage (m3)
     291             :         Real64 FanCyclingRatio = 0.0;        // cycling ratio of tower fan when min fan speed provide too much capacity (for VFD)
     292             :         Real64 EvaporationVdot = 0.0;
     293             :         Real64 EvaporationVol = 0.0;
     294             :         Real64 DriftVdot = 0.0;
     295             :         Real64 DriftVol = 0.0;
     296             :         Real64 BlowdownVdot = 0.0;
     297             :         Real64 BlowdownVol = 0.0;
     298             :         Real64 MakeUpVdot = 0.0;
     299             :         Real64 MakeUpVol = 0.0;
     300             :         Real64 TankSupplyVdot = 0.0;
     301             :         Real64 TankSupplyVol = 0.0;
     302             :         Real64 StarvedMakeUpVdot = 0.0;
     303             :         Real64 StarvedMakeUpVol = 0.0;
     304             : 
     305             :         // From VSTower struct - for Variable speed towers only
     306             :         std::array<Real64, 35> Coeff = {0.0}; // - model coefficients
     307             :         bool FoundModelCoeff = false;         // - TRUE if model is calibratable
     308             :         Real64 MinInletAirWBTemp = 0.0;       // - model limit for min inlet air WB temp
     309             :         Real64 MaxInletAirWBTemp = 0.0;       // - model limit for max inlet air WB temp
     310             :         Real64 MinRangeTemp = 0.0;            // - model limit for min range temp
     311             :         Real64 MaxRangeTemp = 0.0;            // - model limit for max range temp
     312             :         Real64 MinApproachTemp = 0.0;         // - model limit for min approach temp
     313             :         Real64 MaxApproachTemp = 0.0;         // - model limit for max approach temp
     314             :         Real64 MinWaterFlowRatio = 0.0;       // - model limit for min water flow rate ratio
     315             :         Real64 MaxWaterFlowRatio = 0.0;       // - model limit for max water flow rate ratio
     316             :         Real64 MaxLiquidToGasRatio = 0.0;     // - model limit for max liquid to gas ratio
     317             :         int VSErrorCountFlowFrac = 0;         // - counter if water flow rate ratio limits are exceeded
     318             :         int VSErrorCountWFRR = 0;             // - counter if water flow rate ratio limits are exceeded
     319             :         int VSErrorCountIAWB = 0;             // - counter if inlet air wet-bulb temperature limits are exceeded
     320             :         int VSErrorCountTR = 0;               // - counter if tower range temperature limits are exceeded
     321             :         int VSErrorCountTA = 0;               // - counter if tower approach temperature limits are exceeded
     322             :         int ErrIndexFlowFrac = 0;             // - index to recurring error structure for liquid to gas ratio
     323             :         int ErrIndexWFRR = 0;                 // - index to recurring error structure for water flow rate ratio
     324             :         int ErrIndexIAWB = 0;                 // - index to recurring error structure for inlet air WB
     325             :         int ErrIndexTR = 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);
     387             : 
     388             :         void calculateTwoSpeedTower(EnergyPlusData &state);
     389             : 
     390             :         void calculateMerkelVariableSpeedTower(EnergyPlusData &state, Real64 &MyLoad);
     391             : 
     392             :         void calculateVariableSpeedTower(EnergyPlusData &state);
     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             :         static PlantComponent *factory(EnergyPlusData &state, std::string_view objectName);
     427             :     };
     428             : 
     429             :     void GetTowerInput(EnergyPlusData &state);
     430             : 
     431             : } // namespace CondenserLoopTowers
     432             : 
     433        1542 : struct CondenserLoopTowersData : BaseGlobalStruct
     434             : {
     435             :     bool GetInput = true;
     436             :     Array1D<CondenserLoopTowers::CoolingTower> towers; // dimension to number of machines
     437             : 
     438           0 :     void clear_state() override
     439             :     {
     440           0 :         *this = CondenserLoopTowersData();
     441           0 :     }
     442             : };
     443             : 
     444             : } // namespace EnergyPlus
     445             : 
     446             : #endif

Generated by: LCOV version 1.13