LCOV - code coverage report
Current view: top level - EnergyPlus - WaterCoils.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 76 76
Test Date: 2025-05-22 16:09:37 Functions: 100.0 % 6 6

            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 WaterCoils_hh_INCLUDED
      49              : #define WaterCoils_hh_INCLUDED
      50              : 
      51              : // ObjexxFCL Headers
      52              : #include <ObjexxFCL/Array2A.hh>
      53              : #include <ObjexxFCL/Optional.hh>
      54              : 
      55              : // EnergyPlus Headers
      56              : #include <EnergyPlus/Data/BaseData.hh>
      57              : #include <EnergyPlus/DataGlobals.hh>
      58              : #include <EnergyPlus/EnergyPlus.hh>
      59              : #include <EnergyPlus/HVACControllers.hh>
      60              : #include <EnergyPlus/Plant/DataPlant.hh>
      61              : 
      62              : namespace EnergyPlus {
      63              : 
      64              : // Forward declarations
      65              : struct EnergyPlusData;
      66              : 
      67              : namespace WaterCoils {
      68              : 
      69              :     constexpr int MaxPolynomOrder = 4;
      70              :     constexpr int MaxOrderedPairs = 60;
      71              :     constexpr Real64 PolyConvgTol = 1.E-05;
      72              :     constexpr Real64 MinWaterMassFlowFrac = 0.000001;
      73              :     constexpr Real64 MinAirMassFlow = 0.001;
      74              : 
      75              :     enum class CoilModel
      76              :     {
      77              :         Invalid = -1,
      78              :         HeatingSimple,
      79              :         CoolingSimple,
      80              :         CoolingDetailed,
      81              :         Num
      82              :     };
      83              : 
      84              :     struct WaterCoilEquipConditions
      85              :     {
      86              :         // Members
      87              :         std::string Name;                            // Name of the WaterCoil
      88              :         std::string WaterCoilTypeA;                  // Type of WaterCoil ie. Heating or Cooling
      89              :         std::string WaterCoilModelA;                 // Type of WaterCoil ie. Simple, Detailed, etc.
      90              :         DataPlant::PlantEquipmentType WaterCoilType; // Type of WaterCoil ie. Heating or Cooling
      91              :         CoilModel WaterCoilModel;                    // Type of WaterCoil ie. Simple, Detailed, etc.
      92              :         Sched::Schedule *availSched = nullptr;       // availability schedule
      93              :         bool RequestingAutoSize;                     // True if this coil has appropriate autosize fields
      94              :         Real64 InletAirMassFlowRate;                 // MassFlow through the WaterCoil being Simulated [kg/s]
      95              :         Real64 OutletAirMassFlowRate;                // MassFlow through the WaterCoil being Simulated[kg/s]
      96              :         Real64 InletAirTemp;                         // Inlet Air Temperature Operating Condition [C]
      97              :         Real64 OutletAirTemp;                        // Outlet Air Temperature Operating Condition [C]
      98              :         Real64 InletAirHumRat;                       // Inlet Air Humidity Ratio Operating Condition
      99              :         Real64 OutletAirHumRat;                      // Outlet Air Humidity Ratio Calculated Condition
     100              :         Real64 InletAirEnthalpy;                     // Inlet Air enthalpy [J/kg]
     101              :         Real64 OutletAirEnthalpy;                    // Outlet Air enthalpy [J/kg]
     102              :         Real64 TotWaterCoilLoad;                     // Total Load on the Coil [W]
     103              :         Real64 SenWaterCoilLoad;                     // Sensible Load on the Coil [W]
     104              :         Real64 TotWaterHeatingCoilEnergy;            // Total Heating Coil energy of the Coil [J]
     105              :         Real64 TotWaterCoolingCoilEnergy;            // Total Cooling Coil energy of the Coil [J]
     106              :         Real64 SenWaterCoolingCoilEnergy;            // Sensible Cooling Coil energy of the Coil [J]
     107              :         Real64 DesWaterHeatingCoilRate;              // Design Heating Coil Rate used for sizing [W]
     108              :         Real64 TotWaterHeatingCoilRate;              // Total Heating Coil Rate on the Coil [W]
     109              :         Real64 DesWaterCoolingCoilRate;              // Design Cooling Coil Rate used for sizing [W]
     110              :         Real64 TotWaterCoolingCoilRate;              // Total Cooling Coil Rate on the Coil [W]
     111              :         Real64 SenWaterCoolingCoilRate;              // Sensible Cooling Coil Rate on the Coil [W]
     112              :         Real64 UACoil;                               // WaterCoil UA Value
     113              :         Real64 LeavingRelHum;                        // Simple Coil Latent Model requires User input for leaving RH
     114              :         Real64 DesiredOutletTemp;
     115              :         Real64 DesiredOutletHumRat;
     116              :         Real64 InletWaterTemp;          // Inlet Water Temperature [C]
     117              :         Real64 OutletWaterTemp;         // Outlet Water Temperature [C]
     118              :         Real64 InletWaterMassFlowRate;  // Inlet Water Mass Flow Rate [Kg/s]
     119              :         Real64 OutletWaterMassFlowRate; // Outlet Water Mass Flow Rate [Kg/s]
     120              :         Real64 MaxWaterVolFlowRate;     // Maximum water Volume flow rate [m3/s]
     121              :         Real64 MaxWaterMassFlowRate;    // Maximum water mass flow rate [Kg/s]
     122              :         Real64 InletWaterEnthalpy;      // Inlet Water Enthalpy
     123              :         Real64 OutletWaterEnthalpy;     // Outlet Water Enthalpy
     124              :         // These are the additional Geometry and Design Variables for Detailed Flat Fin Coil
     125              :         Real64 TubeOutsideSurfArea; // Tube Primary Surface Area
     126              :         Real64 TotTubeInsideArea;   // Total Tube inside Surface Area
     127              :         Real64 FinSurfArea;         // Fin Surface Area
     128              :         Real64 MinAirFlowArea;
     129              :         Real64 CoilDepth;
     130              :         Real64 FinDiam; // Fin Diameter or the Coil Height
     131              :         Real64 FinThickness;
     132              :         Real64 TubeInsideDiam;  // Inner diameter of Tubes
     133              :         Real64 TubeOutsideDiam; // Outer Diameter of the Tubes
     134              :         Real64 TubeThermConductivity;
     135              :         Real64 FinThermConductivity;
     136              :         Real64 FinSpacing; // Fin Spacing or Distance
     137              :         Real64 TubeDepthSpacing;
     138              :         int NumOfTubeRows;
     139              :         int NumOfTubesPerRow;
     140              :         // BEGIN calculated parameters for detailed flat fin coil
     141              :         Real64 EffectiveFinDiam;
     142              :         Real64 TotCoilOutsideSurfArea;
     143              :         Real64 CoilEffectiveInsideDiam;
     144              :         Real64 GeometryCoef1;
     145              :         Real64 GeometryCoef2;
     146              :         Array1D<Real64> DryFinEfficncyCoef;
     147              :         Real64 SatEnthlCurveConstCoef;
     148              :         Real64 SatEnthlCurveSlope;
     149              :         Real64 EnthVsTempCurveAppxSlope;
     150              :         Real64 EnthVsTempCurveConst;
     151              :         Real64 MeanWaterTempSaved;
     152              :         Real64 InWaterTempSaved;
     153              :         Real64 OutWaterTempSaved;
     154              :         Real64 SurfAreaWetSaved;
     155              :         Real64 SurfAreaWetFraction;
     156              :         // END calculated parameters for detailed flat fin coil
     157              :         // Design Input Variables to the Design Detailed Simple inputs model
     158              :         Real64 DesInletWaterTemp;   // Entering water temperature at Design(C)
     159              :         Real64 DesAirVolFlowRate;   // Entering Air Volume Flow Rate Design( m3/s)
     160              :         Real64 DesInletAirTemp;     // Entering air dry bulb temperature at Design(C)
     161              :         Real64 DesInletAirHumRat;   // Entering air humidity ratio at design conditions
     162              :         Real64 DesTotWaterCoilLoad; // Total heat transfer rate at Design(Watt)
     163              :         Real64 DesSenWaterCoilLoad; // Sensible heat transfer rate at Design(Watt)
     164              :         // BEGIN calculated parameters for Design Detailed Simple inputs model
     165              :         Real64 DesAirMassFlowRate;   // Design Air MassFlow through the WaterCoil [kg/Sec]
     166              :         Real64 UACoilTotal;          // Overall external dry UA (W/C)
     167              :         Real64 UACoilInternal;       // Overall internal UA(W/C)
     168              :         Real64 UACoilExternal;       // Overall external heat transfer coefficient(W/C)
     169              :         Real64 UACoilInternalDes;    // Overall design internal UA(W/C)
     170              :         Real64 UACoilExternalDes;    // Overall design external heat transfer coefficient(W/C)
     171              :         Real64 DesOutletAirTemp;     // Leaving air temperature at rating(C)
     172              :         Real64 DesOutletAirHumRat;   // Humidity ratio of air leaving at design capacity.
     173              :         Real64 DesOutletWaterTemp;   // Temp of Liquid Leaving the Coil at design Capacity
     174              :         int HeatExchType;            // Heat exchanger configuration, default to Cross Flow
     175              :         int CoolingCoilAnalysisMode; // Mode Of analysis, Simple=1 and Detailed =2
     176              :         //    Simple= AllWet-AllDry, Detailed= PartWet-PartDry
     177              :         Real64 UACoilInternalPerUnitArea; // Internal overall heat transfer coefficient(W/m2 C)
     178              :         Real64 UAWetExtPerUnitArea;       // External overall heat transfer coefficient(W/m2 C)
     179              :         Real64 UADryExtPerUnitArea;       // External overall heat transfer coefficient(W/m2 C)
     180              :         Real64 SurfAreaWetFractionSaved;  // Previous saved value, for numerical efficiency.
     181              :         // END calculated parameters for Design Inputs Detailed coil
     182              :         // variables for simple heating coil with variable UA
     183              :         Real64 UACoilVariable;                 // WaterCoil UA value when variable (simple heating coil only)
     184              :         Real64 RatioAirSideToWaterSideConvect; // "r" value for coil,
     185              :         Real64 AirSideNominalConvect;          // nominal rating point air side convection term (fin_effic*(hc*A))
     186              :         Real64 LiquidSideNominalConvect;       // nominal rating point water side convection term (hc*A)
     187              :         int Control;                           // Const Vol =1;  Variable Vol = 2
     188              :         int AirInletNodeNum;
     189              :         int AirOutletNodeNum;
     190              :         int WaterInletNodeNum;
     191              :         int WaterOutletNodeNum;
     192              :         PlantLocation WaterPlantLoc; // Plant location struct
     193              :         // begin variables for Water System interactions
     194              :         int CondensateCollectMode;         // where does water come from
     195              :         std::string CondensateCollectName; // name of water source e.g. water storage tank
     196              :         int CondensateTankID;              // index "pointer" to Storage TAnk array WaterStorage
     197              :         int CondensateTankSupplyARRID;     // index point to supply Vdot array in WaterStorage
     198              :         Real64 CondensateVdot;             // rate of water condensation from air stream [m3/s]
     199              :         Real64 CondensateVol;              // amount of water condensed from air stream [m3]
     200              :         // end variables for water system interactions
     201              :         // COIL:Water:SimpleHeating Coil Performance Input Method
     202              :         int CoilPerfInpMeth; // 1 = UA and Design Water Flow Rate; 2 = Nominal Capacity
     203              : 
     204              :         // Operational fault parameters
     205              :         bool FaultyCoilFoulingFlag;     // True if the coil has fouling fault
     206              :         int FaultyCoilFoulingIndex;     // Index of the fault object corresponding to the coil
     207              :         Real64 FaultyCoilFoulingFactor; // Coil fouling factor [m2K/W]
     208              :         Real64 OriginalUACoilVariable;
     209              :         Real64 OriginalUACoilExternal;
     210              :         Real64 OriginalUACoilInternal;
     211              : 
     212              :         bool DesiccantRegenerationCoil; // true if it is a regeneration air heating coil defined in Desiccant Dehumidifier system
     213              :         int DesiccantDehumNum;          // index to desiccant dehumidifier object
     214              :         Real64 DesignWaterDeltaTemp;    // water deltaT for coil sizing [K]
     215              :         bool UseDesignWaterDeltaTemp;   // is true, the DesignWaterDeltaTemp is used for sizing coil design water flow rate
     216              :         std::string ControllerName;     // controller name used by water coil
     217              :         int ControllerIndex;            // controller index used by water coil
     218              :         bool reportCoilFinalSizes;      // one time report of sizes to coil summary report
     219              :         bool AirLoopDOASFlag;           // True when this coil is used AirLoopDOAS
     220              :         bool heatRecoveryCoil;          // is true when coils are connected to each other to create a heat recovery loop
     221              : 
     222              :         // Default Constructor
     223          213 :         WaterCoilEquipConditions()
     224          426 :             : WaterCoilType(DataPlant::PlantEquipmentType::Invalid), WaterCoilModel(CoilModel::Invalid), RequestingAutoSize(false),
     225          213 :               InletAirMassFlowRate(0.0), OutletAirMassFlowRate(0.0), InletAirTemp(0.0), OutletAirTemp(0.0), InletAirHumRat(0.0), OutletAirHumRat(0.0),
     226          213 :               InletAirEnthalpy(0.0), OutletAirEnthalpy(0.0), TotWaterCoilLoad(0.0), SenWaterCoilLoad(0.0), TotWaterHeatingCoilEnergy(0.0),
     227          213 :               TotWaterCoolingCoilEnergy(0.0), SenWaterCoolingCoilEnergy(0.0), DesWaterHeatingCoilRate(0.0), TotWaterHeatingCoilRate(0.0),
     228          213 :               DesWaterCoolingCoilRate(0.0), TotWaterCoolingCoilRate(0.0), SenWaterCoolingCoilRate(0.0), UACoil(0.0), LeavingRelHum(0.0),
     229          213 :               DesiredOutletTemp(0.0), DesiredOutletHumRat(0.0), InletWaterTemp(0.0), OutletWaterTemp(0.0), InletWaterMassFlowRate(0.0),
     230          213 :               OutletWaterMassFlowRate(0.0), MaxWaterVolFlowRate(0.0), MaxWaterMassFlowRate(0.0), InletWaterEnthalpy(0.0), OutletWaterEnthalpy(0.0),
     231          213 :               TubeOutsideSurfArea(0.0), TotTubeInsideArea(0.0), FinSurfArea(0.0), MinAirFlowArea(0.0), CoilDepth(0.0), FinDiam(0.0),
     232          213 :               FinThickness(0.0), TubeInsideDiam(0.0), TubeOutsideDiam(0.0), TubeThermConductivity(0.0), FinThermConductivity(0.0), FinSpacing(0.0),
     233          213 :               TubeDepthSpacing(0.0), NumOfTubeRows(0), NumOfTubesPerRow(0), EffectiveFinDiam(0.0), TotCoilOutsideSurfArea(0.0),
     234          213 :               CoilEffectiveInsideDiam(0.0), GeometryCoef1(0.0), GeometryCoef2(0.0), DryFinEfficncyCoef(5, 0.0), SatEnthlCurveConstCoef(0.0),
     235          213 :               SatEnthlCurveSlope(0.0), EnthVsTempCurveAppxSlope(0.0), EnthVsTempCurveConst(0.0), MeanWaterTempSaved(0.0), InWaterTempSaved(0.0),
     236          213 :               OutWaterTempSaved(0.0), SurfAreaWetSaved(0.0), SurfAreaWetFraction(0.0), DesInletWaterTemp(0.0), DesAirVolFlowRate(0.0),
     237          213 :               DesInletAirTemp(0.0), DesInletAirHumRat(0.0), DesTotWaterCoilLoad(0.0), DesSenWaterCoilLoad(0.0), DesAirMassFlowRate(0.0),
     238          213 :               UACoilTotal(0.0), UACoilInternal(0.0), UACoilExternal(0.0), UACoilInternalDes(0.0), UACoilExternalDes(0.0), DesOutletAirTemp(0.0),
     239          213 :               DesOutletAirHumRat(0.0), DesOutletWaterTemp(0.0), HeatExchType(0), CoolingCoilAnalysisMode(0), UACoilInternalPerUnitArea(0.0),
     240          213 :               UAWetExtPerUnitArea(0.0), UADryExtPerUnitArea(0.0), SurfAreaWetFractionSaved(0.0), UACoilVariable(0.0),
     241          213 :               RatioAirSideToWaterSideConvect(1.0), AirSideNominalConvect(0.0), LiquidSideNominalConvect(0.0), Control(0), AirInletNodeNum(0),
     242          213 :               AirOutletNodeNum(0), WaterInletNodeNum(0), WaterOutletNodeNum(0), WaterPlantLoc{}, CondensateCollectMode(1001), CondensateTankID(0),
     243          213 :               CondensateTankSupplyARRID(0), CondensateVdot(0.0), CondensateVol(0.0), CoilPerfInpMeth(0), FaultyCoilFoulingFlag(false),
     244          213 :               FaultyCoilFoulingIndex(0), FaultyCoilFoulingFactor(0.0), OriginalUACoilVariable(0.0), OriginalUACoilExternal(0.0),
     245          213 :               OriginalUACoilInternal(0.0), DesiccantRegenerationCoil(false), DesiccantDehumNum(0), DesignWaterDeltaTemp(0.0),
     246          426 :               UseDesignWaterDeltaTemp(false), ControllerName(""), ControllerIndex(0), reportCoilFinalSizes(true), AirLoopDOASFlag(false),
     247          426 :               heatRecoveryCoil(false)
     248              :         {
     249          213 :         }
     250              :     };
     251              : 
     252              :     struct WaterCoilNumericFieldData
     253              :     {
     254              :         // Members
     255              :         Array1D_string FieldNames;
     256              : 
     257              :         // Default Constructor
     258          205 :         WaterCoilNumericFieldData()
     259          205 :         {
     260          205 :         }
     261              :     };
     262              : 
     263              :     // Functions
     264              : 
     265              :     void SimulateWaterCoilComponents(EnergyPlusData &state,
     266              :                                      std::string_view CompName,
     267              :                                      bool const FirstHVACIteration,
     268              :                                      int &CompIndex,
     269              :                                      ObjexxFCL::Optional<Real64> QActual = _,
     270              :                                      ObjexxFCL::Optional<HVAC::FanOp const> fanOp = _,
     271              :                                      ObjexxFCL::Optional<Real64 const> PartLoadRatio = _);
     272              : 
     273              :     void GetWaterCoilInput(EnergyPlusData &state);
     274              : 
     275              :     void InitWaterCoil(EnergyPlusData &state, int const CoilNum, bool const FirstHVACIteration);
     276              : 
     277              :     void                                                          // refactor for coil report
     278              :     CalcAdjustedCoilUA(EnergyPlusData &state, int const CoilNum); // refactor for coil report
     279              : 
     280              :     void SizeWaterCoil(EnergyPlusData &state, int const CoilNum);
     281              : 
     282              :     void CalcSimpleHeatingCoil(EnergyPlusData &state,
     283              :                                int const CoilNum,          // index to heating coil
     284              :                                HVAC::FanOp const fanOp,    // fan operating mode
     285              :                                Real64 const PartLoadRatio, // part-load ratio of heating coil
     286              :                                int const CalcMode          // 1 = design calc; 2 = simulation calculation
     287              :     );
     288              : 
     289              :     void CalcDetailFlatFinCoolingCoil(EnergyPlusData &state,
     290              :                                       int const CoilNum,
     291              :                                       int const CalcMode,
     292              :                                       HVAC::FanOp const fanOp,   // fan operating mode
     293              :                                       Real64 const PartLoadRatio // part-load ratio of heating coil
     294              :     );
     295              : 
     296              :     void CoolingCoil(EnergyPlusData &state,
     297              :                      int const CoilNum,
     298              :                      bool const FirstHVACIteration,
     299              :                      int const CalcMode,
     300              :                      HVAC::FanOp const fanOp,   // fan operating mode
     301              :                      Real64 const PartLoadRatio // part-load ratio of heating coil
     302              :     );
     303              : 
     304              :     void CoilCompletelyDry(EnergyPlusData &state,
     305              :                            int const CoilNum,
     306              :                            Real64 const WaterTempIn,  // Entering water temperature
     307              :                            Real64 const AirTempIn,    // Entering air dry bulb temperature
     308              :                            Real64 const CoilUA,       // Overall heat transfer coefficient
     309              :                            Real64 &OutletWaterTemp,   // Leaving water temperature
     310              :                            Real64 &OutletAirTemp,     // Leaving air dry bulb temperature
     311              :                            Real64 &OutletAirHumRat,   // Leaving air humidity ratio
     312              :                            Real64 &Q,                 // Heat transfer rate
     313              :                            HVAC::FanOp const fanOp,   // fan operating mode
     314              :                            Real64 const PartLoadRatio // part-load ratio of heating coil
     315              :     );
     316              : 
     317              :     // Coil Completely Wet Subroutine for Cooling Coil
     318              : 
     319              :     void CoilCompletelyWet(EnergyPlusData &state,
     320              :                            int const CoilNum,            // Number of Coil
     321              :                            Real64 const WaterTempIn,     // Water temperature IN to this function (C)
     322              :                            Real64 const AirTempIn,       // Air dry bulb temperature IN to this function(C)
     323              :                            Real64 const AirHumRat,       // Air Humidity Ratio IN to this funcation (C)
     324              :                            Real64 const UAInternalTotal, // Internal overall heat transfer coefficient(W/m2 C)
     325              :                            Real64 const UAExternalTotal, // External overall heat transfer coefficient(W/m2 C)
     326              :                            Real64 &OutletWaterTemp,      // Leaving water temperature (C)
     327              :                            Real64 &OutletAirTemp,        // Leaving air dry bulb temperature(C)
     328              :                            Real64 &OutletAirHumRat,      // Leaving air humidity ratio
     329              :                            Real64 &TotWaterCoilLoad,     // Total heat transfer rate(W)
     330              :                            Real64 &SenWaterCoilLoad,     // Sensible heat transfer rate(W)
     331              :                            Real64 &SurfAreaWetFraction,  // Fraction of surface area wet
     332              :                            Real64 &AirInletCoilSurfTemp, // Surface temperature at air entrance(C)
     333              :                            HVAC::FanOp const fanOp,      // fan operating mode
     334              :                            Real64 const PartLoadRatio    // part-load ratio of heating coil
     335              :     );
     336              : 
     337              :     // Coil Part Wet Part Dry Subroutine for Cooling Coil
     338              : 
     339              :     void CoilPartWetPartDry(EnergyPlusData &state,
     340              :                             int const CoilNum,             // Number of Coil
     341              :                             bool const FirstHVACIteration, // Saving Old values
     342              :                             Real64 const InletWaterTemp,   // Entering liquid temperature(C)
     343              :                             Real64 const InletAirTemp,     // Entering air dry bulb temperature(C)
     344              :                             Real64 const AirDewPointTemp,  // Entering air dew point(C)
     345              :                             Real64 &OutletWaterTemp,       // Leaving liquid temperature(C)
     346              :                             Real64 &OutletAirTemp,         // Leaving air dry bulb temperature(C)
     347              :                             Real64 &OutletAirHumRat,       // Leaving air humidity ratio
     348              :                             Real64 &TotWaterCoilLoad,      // Total heat transfer rate (W)
     349              :                             Real64 &SenWaterCoilLoad,      // Sensible heat transfer rate (W)
     350              :                             Real64 &SurfAreaWetFraction,   // Fraction of surface area wet
     351              :                             HVAC::FanOp const fanOp,       // fan operating mode
     352              :                             Real64 const PartLoadRatio     // part-load ratio of heating coil
     353              :     );
     354              : 
     355              :     // Calculating coil UA for Cooling Coil
     356              : 
     357              :     Real64 CalcCoilUAbyEffectNTU(EnergyPlusData &state,
     358              :                                  int const CoilNum,
     359              :                                  Real64 const CapacityStream1,     // Capacity rate of stream1.(W/C)
     360              :                                  Real64 const EnergyInStreamOne,   // Inlet state of stream1.(C)
     361              :                                  Real64 const CapacityStream2,     // Capacity rate of stream2.(W/C)
     362              :                                  Real64 const EnergyInStreamTwo,   // Inlet state of stream2.(C)
     363              :                                  Real64 const DesTotalHeatTransfer // Heat transfer rate(W)
     364              :     );
     365              : 
     366              :     // Calculating coil outlet stream conditions and coil UA for Cooling Coil
     367              : 
     368              :     void CoilOutletStreamCondition(EnergyPlusData &state,
     369              :                                    int const CoilNum,
     370              :                                    Real64 const CapacityStream1,   // Capacity rate of stream1(W/C)
     371              :                                    Real64 const EnergyInStreamOne, // Inlet state of stream1 (C)
     372              :                                    Real64 const CapacityStream2,   // Capacity rate of stream2 (W/C)
     373              :                                    Real64 const EnergyInStreamTwo, // Inlet state of stream2 (C)
     374              :                                    Real64 const CoilUA,            // Heat transfer rateW)
     375              :                                    Real64 &EnergyOutStreamOne,     // Outlet state of stream1 (C)
     376              :                                    Real64 &EnergyOutStreamTwo      // Outlet state of stream2 (C)
     377              :     );
     378              : 
     379              :     // Subroutine for caculating outlet condition if coil is wet , for Cooling Coil
     380              : 
     381              :     void WetCoilOutletCondition(EnergyPlusData &state,
     382              :                                 int const CoilNum,
     383              :                                 Real64 const AirTempIn,      // Entering air dry bulb temperature(C)
     384              :                                 Real64 const EnthAirInlet,   // Entering air enthalpy(J/kg)
     385              :                                 Real64 const EnthAirOutlet,  // Leaving air enthalpy(J/kg)
     386              :                                 Real64 const UACoilExternal, // Heat transfer coefficient for external surface (W/C)
     387              :                                 Real64 &OutletAirTemp,       // Leaving air dry bulb temperature(C)
     388              :                                 Real64 &OutletAirHumRat,     // Leaving air humidity ratio
     389              :                                 Real64 &SenWaterCoilLoad     // Sensible heat transfer rate(W)
     390              :     );
     391              : 
     392              :     void UpdateWaterCoil(EnergyPlusData &state, int const CoilNum);
     393              : 
     394              :     void ReportWaterCoil(EnergyPlusData &state, int const CoilNum);
     395              : 
     396              :     void CalcDryFinEffCoef(EnergyPlusData &state, Real64 const OutTubeEffFinDiamRatio, Array1D<Real64> &PolynomCoef);
     397              : 
     398              :     void CalcIBesselFunc(Real64 const BessFuncArg, int const BessFuncOrd, Real64 &IBessFunc, int &ErrorCode);
     399              : 
     400              :     void CalcKBesselFunc(Real64 const BessFuncArg, int const BessFuncOrd, Real64 &KBessFunc, int &ErrorCode);
     401              : 
     402              :     void CalcPolynomCoef(EnergyPlusData &state, Array2<Real64> const &OrderedPair, Array1D<Real64> &PolynomCoef);
     403              : 
     404              :     // Iterate Routine for Cooling Coil
     405              : 
     406              :     void CoilAreaFracIter(Real64 &NewSurfAreaWetFrac,       // Out Value of variable
     407              :                           Real64 const SurfAreaFracCurrent, // Driver Value
     408              :                           Real64 const ErrorCurrent,        // Objective Function
     409              :                           Real64 &SurfAreaFracPrevious,     // First Previous value of Surf Area Fraction
     410              :                           Real64 &ErrorPrevious,            // First Previous value of error
     411              :                           Real64 &SurfAreaFracLast,         // Second Previous value of Surf Area Fraction
     412              :                           Real64 &ErrorLast,                // Second Previous value of error
     413              :                           int const IterNum,                // Number of Iterations
     414              :                           int &icvg                         // Iteration convergence flag
     415              :     );
     416              : 
     417              :     void CheckWaterCoilSchedule(EnergyPlusData &state, std::string_view CompName, Real64 &Value, int &CompIndex);
     418              : 
     419              :     Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state,
     420              :                                    std::string_view CoilType,   // must match coil types in this module
     421              :                                    std::string const &CoilName, // must match coil names for the coil type
     422              :                                    bool &ErrorsFound            // set to true if problem
     423              :     );
     424              : 
     425              :     int GetCoilInletNode(EnergyPlusData &state,
     426              :                          std::string_view CoilType,   // must match coil types in this module
     427              :                          std::string const &CoilName, // must match coil names for the coil type
     428              :                          bool &ErrorsFound            // set to true if problem
     429              :     );
     430              : 
     431              :     int GetCoilOutletNode(EnergyPlusData &state,
     432              :                           std::string_view CoilType,   // must match coil types in this module
     433              :                           std::string const &CoilName, // must match coil names for the coil type
     434              :                           bool &ErrorsFound            // set to true if problem
     435              :     );
     436              : 
     437              :     int GetCoilWaterInletNode(EnergyPlusData &state,
     438              :                               std::string_view CoilType,   // must match coil types in this module
     439              :                               std::string const &CoilName, // must match coil names for the coil type
     440              :                               bool &ErrorsFound            // set to true if problem
     441              :     );
     442              : 
     443              :     int GetCoilWaterOutletNode(EnergyPlusData &state,
     444              :                                std::string_view CoilType,   // must match coil types in this module
     445              :                                std::string const &CoilName, // must match coil names for the coil type
     446              :                                bool &ErrorsFound            // set to true if problem
     447              :     );
     448              : 
     449              :     void SetCoilDesFlow(EnergyPlusData &state,
     450              :                         std::string_view CoilType,   // must match coil types in this module
     451              :                         std::string const &CoilName, // must match coil names for the coil type
     452              :                         Real64 const CoilDesFlow,    // coil volumetric air flow rate [m3/s]
     453              :                         bool &ErrorsFound            // set to true if problem
     454              :     );
     455              : 
     456              :     Real64 GetWaterCoilDesAirFlow(EnergyPlusData &state,
     457              :                                   std::string const &CoilType, // must match coil types in this module
     458              :                                   std::string const &CoilName, // must match coil names for the coil type
     459              :                                   bool &ErrorsFound            // set to true if problem
     460              :     );
     461              : 
     462              :     void CheckActuatorNode(EnergyPlusData &state,
     463              :                            int const ActuatorNodeNum,                    // input actuator node number
     464              :                            DataPlant::PlantEquipmentType &WaterCoilType, // Cooling or Heating or 0
     465              :                            bool &NodeNotFound                            // true if matching water inlet node not found
     466              :     );
     467              : 
     468              :     void CheckForSensorAndSetPointNode(EnergyPlusData &state,
     469              :                                        int const SensorNodeNum,                    // controller sensor node number
     470              :                                        HVACControllers::CtrlVarType ControlledVar, // controlled variable type
     471              :                                        bool &NodeNotFound                          // true if matching air outlet node not found
     472              :     );
     473              : 
     474              :     Real64 TdbFnHRhPb(EnergyPlusData &state,
     475              :                       Real64 const H,  // specific enthalpy {J/kg}
     476              :                       Real64 const RH, // relative humidity value (0.0-1.0)
     477              :                       Real64 const PB  // barometric pressure {Pascals}
     478              :     );
     479              : 
     480              :     Real64 EstimateHEXSurfaceArea(EnergyPlusData &state, int const CoilNum); // coil number, [-]
     481              : 
     482              :     int GetWaterCoilIndex(EnergyPlusData &state,
     483              :                           std::string_view CoilType,   // must match coil types in this module
     484              :                           std::string const &CoilName, // must match coil names for the coil type
     485              :                           bool &ErrorsFound            // set to true if problem
     486              :     );
     487              :     int GetCompIndex(EnergyPlusData &state, CoilModel coilType, std::string_view const coilName);
     488              : 
     489              :     Real64 GetWaterCoilCapacity(EnergyPlusData &state,
     490              :                                 std::string const &CoilType, // must match coil types in this module
     491              :                                 std::string const &CoilName, // must match coil names for the coil type
     492              :                                 bool &ErrorsFound            // set to true if problem
     493              :     );
     494              : 
     495              :     void UpdateWaterToAirCoilPlantConnection(EnergyPlusData &state,
     496              :                                              DataPlant::PlantEquipmentType const CoilType,
     497              :                                              std::string const &CoilName,
     498              :                                              int const EquipFlowCtrl,                    // Flow control mode for the equipment
     499              :                                              int const LoopNum,                          // Plant loop index for where called from
     500              :                                              const DataPlant::LoopSideLocation LoopSide, // Plant loop side index for where called from
     501              :                                              int &CompIndex,                             // Chiller number pointer
     502              :                                              bool const FirstHVACIteration,
     503              :                                              bool &InitLoopEquip // If not zero, calculate the max load for operating conditions
     504              :     );
     505              : 
     506              :     Sched::Schedule *GetWaterCoilAvailSched(EnergyPlusData &state,
     507              :                                             std::string const &CoilType, // must match coil types in this module
     508              :                                             std::string const &CoilName, // must match coil names for the coil type
     509              :                                             bool &ErrorsFound            // set to true if problem
     510              :     );
     511              : 
     512              :     // sets data to a coil that is used as a regeneration air heating coil in
     513              :     // desiccant dehumidification system
     514              :     void SetWaterCoilData(EnergyPlusData &state,
     515              :                           int const CoilNum,                                      // index of hot water heating Coil
     516              :                           bool &ErrorsFound,                                      // Set to true if certain errors found
     517              :                           ObjexxFCL::Optional_bool DesiccantRegenerationCoil = _, // Flag that this coil is used as regeneration air heating coil
     518              :                           ObjexxFCL::Optional_int DesiccantDehumIndex = _,        // Index for the desiccant dehum system where this caoil is used
     519              :                           ObjexxFCL::Optional_bool heatRecoveryCoil = _           // true if water coil is connected to heat recovery loop
     520              :     );
     521              : 
     522              :     // estimate heating coil design inlet water temperature for autosizing UA-value
     523              :     void EstimateCoilInletWaterTemp(EnergyPlusData &state,
     524              :                                     int const CoilNum,                // index to heating coil
     525              :                                     HVAC::FanOp const fanOp,          // fan operating mode
     526              :                                     Real64 const PartLoadRatio,       // part-load ratio of heating coil
     527              :                                     Real64 const UAMax,               // maximum UA-Value
     528              :                                     Real64 &DesCoilInletWaterTempUsed // estimated coil design inlet water temperature
     529              :     );
     530              : 
     531              : } // namespace WaterCoils
     532              : 
     533              : struct WaterCoilsData : BaseGlobalStruct
     534              : {
     535              : 
     536              :     // Parameters for Heat Exchanger Configuration
     537              :     int const CounterFlow;
     538              :     int const CrossFlow;
     539              :     int const SimpleAnalysis;
     540              :     int const DetailedAnalysis;
     541              : 
     542              :     // Water Systems
     543              :     int const CondensateDiscarded; // default mode where water is "lost"
     544              :     int const CondensateToTank;    // collect coil condensate from air and store in water storage tank
     545              : 
     546              :     // Parameters for COIL:Water:SimpleHeating Coil Performance Input Method
     547              :     int const UAandFlow; // for Coil Performance Input Method = UA and Design Water Flow Rate
     548              :     int const NomCap;    // for Coil Performance Input Method = Nominal Capacity
     549              : 
     550              :     // Parameters Subroutine CoolingCoil: design calc or simulation calc.
     551              :     int const DesignCalc; // ignore on/off check in CoolingCoil
     552              :     int const SimCalc;    // pay attention to on/off check in CoolingCoil
     553              : 
     554              :     // DERIVED TYPE DEFINITIONS
     555              : 
     556              :     // MODULE VARIABLE DECLARATIONS:
     557              :     int NumWaterCoils; // The Number of WaterCoils found in the Input
     558              :     Array1D_bool MySizeFlag;
     559              :     Array1D_bool MyUAAndFlowCalcFlag;
     560              :     Array1D_bool MyCoilDesignFlag;
     561              :     Array1D_bool CoilWarningOnceFlag;
     562              :     Array1D_int WaterTempCoolCoilErrs;        // error counting for detailed coils
     563              :     Array1D_int PartWetCoolCoilErrs;          // error counting for detailed coils
     564              :     bool GetWaterCoilsInputFlag;              // Flag set to make sure you get input once
     565              :     bool WaterCoilControllerCheckOneTimeFlag; // flg used to check water coil controller
     566              :     Array1D_bool CheckEquipName;
     567              : 
     568              :     bool InitWaterCoilOneTimeFlag;
     569              : 
     570              :     EPVector<WaterCoils::WaterCoilEquipConditions> WaterCoil;
     571              :     EPVector<WaterCoils::WaterCoilNumericFieldData> WaterCoilNumericFields;
     572              : 
     573              :     Real64 TOutNew = 0.0;            // reset outlet air temperature for Coil:Cooling:Water
     574              :     Real64 WOutNew = 0.0;            // reset outlet air humidity ratio for Coil:Cooling:Water
     575              :     Array1D<Real64> DesCpAir;        // CpAir at Design Inlet Air Temp
     576              :     Array1D<Real64> DesUARangeCheck; // Value for range check based on Design Inlet Air Humidity Ratio
     577              :     Array1D_bool MyEnvrnFlag;
     578              :     Array1D_bool MyCoilReportFlag;
     579              :     Array1D_bool PlantLoopScanFlag;
     580              :     Array1D<Real64> CoefSeries = Array1D<Real64>(5); // Tuned Changed to static: High call count: Set before use
     581              :     bool NoSatCurveIntersect = false;                // TRUE if failed to find apparatus dew-point
     582              :     bool BelowInletWaterTemp = false;                // TRUE if apparatus dew-point below design inlet water temperature
     583              :     bool CBFTooLarge = false;                        // TRUE if the coil bypass factor is unrealistically large
     584              :     bool NoExitCondReset = false;                    // TRUE if exit condition reset is not to be done
     585              :     Real64 RatedLatentCapacity = 0.0;                // latent cooling capacity at the rating point [W]
     586              :     Real64 RatedSHR = 0.0;                           // sensible heat ratio at the rating point
     587              :     Real64 CapacitanceWater = 0.0;                   // capacitance of the water stream [W/K]
     588              :     Real64 CMin = 0.0;                               // minimum capacitance of 2 streams [W/K]
     589              :     Real64 CoilEffectiveness = 0.0;                  // effectiveness of the coil (rated)
     590              :     Real64 SurfaceArea = 0.0;                        // heat exchanger surface area, [m2]
     591              :     Real64 UATotal = 0.0;                            // heat exchanger UA total, [W/C]
     592              :     Array1D_bool RptCoilHeaderFlag = Array1D_bool(2, true);
     593              :     Array2D<Real64> OrderedPair = Array2D<Real64>(WaterCoils::MaxOrderedPairs, 2);
     594              :     Array2D<Real64> OrdPairSum = Array2D<Real64>(10, 2);
     595              :     Array2D<Real64> OrdPairSumMatrix = Array2D<Real64>(10, 10);
     596              : 
     597         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     598              :     {
     599         2126 :     }
     600              : 
     601         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     602              :     {
     603         1152 :     }
     604              : 
     605         2100 :     void clear_state() override
     606              :     {
     607         2100 :         this->NumWaterCoils = 0;
     608         2100 :         this->InitWaterCoilOneTimeFlag = true;
     609         2100 :         this->MySizeFlag.deallocate();
     610         2100 :         this->MyUAAndFlowCalcFlag.deallocate();
     611         2100 :         this->MyCoilDesignFlag.deallocate();
     612         2100 :         this->CoilWarningOnceFlag.deallocate();
     613         2100 :         this->WaterTempCoolCoilErrs.deallocate();
     614         2100 :         this->PartWetCoolCoilErrs.deallocate();
     615         2100 :         this->GetWaterCoilsInputFlag = true;
     616         2100 :         this->CheckEquipName.deallocate();
     617         2100 :         this->WaterCoil.deallocate();
     618         2100 :         this->WaterCoilNumericFields.deallocate();
     619         2100 :         this->WaterCoilControllerCheckOneTimeFlag = true;
     620         2100 :         this->TOutNew = 0.0;
     621         2100 :         this->WOutNew = 0.0;
     622         2100 :         this->DesCpAir.deallocate();
     623         2100 :         this->DesUARangeCheck.deallocate();
     624         2100 :         this->MyEnvrnFlag.deallocate();
     625         2100 :         this->MyCoilReportFlag.deallocate();
     626         2100 :         this->PlantLoopScanFlag.deallocate();
     627         2100 :         this->CoefSeries = Array1D<Real64>(5);
     628         2100 :         this->NoSatCurveIntersect = false;
     629         2100 :         this->BelowInletWaterTemp = false;
     630         2100 :         this->CBFTooLarge = false;
     631         2100 :         this->NoExitCondReset = false;
     632         2100 :         this->RatedLatentCapacity = 0.0;
     633         2100 :         this->RatedSHR = 0.0;
     634         2100 :         this->CapacitanceWater = 0.0;
     635         2100 :         this->CMin = 0.0;
     636         2100 :         this->CoilEffectiveness = 0.0;
     637         2100 :         this->SurfaceArea = 0.0;
     638         2100 :         this->UATotal = 0.0;
     639         2100 :         this->RptCoilHeaderFlag = Array1D_bool(2, true);
     640         2100 :         this->OrderedPair = Array2D<Real64>(WaterCoils::MaxOrderedPairs, 2);
     641         2100 :         this->OrdPairSum = Array2D<Real64>(10, 2);
     642         2100 :         this->OrdPairSumMatrix = Array2D<Real64>(10, 10);
     643         2100 :     }
     644              : 
     645              :     // Default Constructor
     646         2129 :     WaterCoilsData()
     647         4258 :         : CounterFlow(1), CrossFlow(2), SimpleAnalysis(1), DetailedAnalysis(2), CondensateDiscarded(1001), CondensateToTank(1002), UAandFlow(1),
     648         4258 :           NomCap(2), DesignCalc(1), SimCalc(2), NumWaterCoils(0), GetWaterCoilsInputFlag(true), WaterCoilControllerCheckOneTimeFlag(true),
     649         2129 :           InitWaterCoilOneTimeFlag(true)
     650              :     {
     651         2129 :     }
     652              : };
     653              : 
     654              : } // namespace EnergyPlus
     655              : 
     656              : #endif
        

Generated by: LCOV version 2.0-1