LCOV - code coverage report
Current view: top level - EnergyPlus - WaterCoils.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 14 52 26.9 %
Date: 2023-01-17 19:17:23 Functions: 8 11 72.7 %

          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 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        6514 :     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             :         std::string Schedule;                        // WaterCoil Operation Schedule
      93             :         int SchedPtr;                                // Pointer to the correct schedule
      94             :         bool RequestingAutoSize;                     // True if this coil has appropriate autosize fields
      95             :         Real64 InletAirMassFlowRate;                 // MassFlow through the WaterCoil being Simulated [kg/s]
      96             :         Real64 OutletAirMassFlowRate;                // MassFlow through the WaterCoil being Simulated[kg/s]
      97             :         Real64 InletAirTemp;                         // Inlet Air Temperature Operating Condition [C]
      98             :         Real64 OutletAirTemp;                        // Outlet Air Temperature Operating Condition [C]
      99             :         Real64 InletAirHumRat;                       // Inlet Air Humidity Ratio Operating Condition
     100             :         Real64 OutletAirHumRat;                      // Outlet Air Humidity Ratio Calculated Condition
     101             :         Real64 InletAirEnthalpy;                     // Inlet Air enthalpy [J/kg]
     102             :         Real64 OutletAirEnthalpy;                    // Outlet Air enthalpy [J/kg]
     103             :         Real64 TotWaterCoilLoad;                     // Total Load on the Coil [W]
     104             :         Real64 SenWaterCoilLoad;                     // Sensible Load on the Coil [W]
     105             :         Real64 TotWaterHeatingCoilEnergy;            // Total Heating Coil energy of the Coil [J]
     106             :         Real64 TotWaterCoolingCoilEnergy;            // Total Cooling Coil energy of the Coil [J]
     107             :         Real64 SenWaterCoolingCoilEnergy;            // Sensible Cooling Coil energy of the Coil [J]
     108             :         Real64 DesWaterHeatingCoilRate;              // Design Heating Coil Rate used for sizing [W]
     109             :         Real64 TotWaterHeatingCoilRate;              // Total Heating Coil Rate on the Coil [W]
     110             :         Real64 DesWaterCoolingCoilRate;              // Design Cooling Coil Rate used for sizing [W]
     111             :         Real64 TotWaterCoolingCoilRate;              // Total Cooling Coil Rate on the Coil [W]
     112             :         Real64 SenWaterCoolingCoilRate;              // Sensible Cooling Coil Rate on the Coil [W]
     113             :         Real64 UACoil;                               // WaterCoil UA Value
     114             :         Real64 LeavingRelHum;                        // Simple Coil Latent Model requires User input for leaving RH
     115             :         Real64 DesiredOutletTemp;
     116             :         Real64 DesiredOutletHumRat;
     117             :         Real64 InletWaterTemp;          // Inlet Water Temperature [C]
     118             :         Real64 OutletWaterTemp;         // Outlet Water Temperature [C]
     119             :         Real64 InletWaterMassFlowRate;  // Inlet Water Mass Flow Rate [Kg/s]
     120             :         Real64 OutletWaterMassFlowRate; // Outlet Water Mass Flow Rate [Kg/s]
     121             :         Real64 MaxWaterVolFlowRate;     // Maximum water Volume flow rate [m3/s]
     122             :         Real64 MaxWaterMassFlowRate;    // Maximum water mass flow rate [Kg/s]
     123             :         Real64 InletWaterEnthalpy;      // Inlet Water Enthalpy
     124             :         Real64 OutletWaterEnthalpy;     // Outlet Water Enthalpy
     125             :         // These are the additional Geometry and Design Variables for Detailed Flat Fin Coil
     126             :         Real64 TubeOutsideSurfArea; // Tube Primary Surface Area
     127             :         Real64 TotTubeInsideArea;   // Total Tube inside Surface Area
     128             :         Real64 FinSurfArea;         // Fin Surface Area
     129             :         Real64 MinAirFlowArea;
     130             :         Real64 CoilDepth;
     131             :         Real64 FinDiam; // Fin Diameter or the Coil Height
     132             :         Real64 FinThickness;
     133             :         Real64 TubeInsideDiam;  // Inner diameter of Tubes
     134             :         Real64 TubeOutsideDiam; // Outer Diameter of the Tubes
     135             :         Real64 TubeThermConductivity;
     136             :         Real64 FinThermConductivity;
     137             :         Real64 FinSpacing; // Fin Spacing or Distance
     138             :         Real64 TubeDepthSpacing;
     139             :         int NumOfTubeRows;
     140             :         int NumOfTubesPerRow;
     141             :         // BEGIN calculated parameters for detailed flat fin coil
     142             :         Real64 EffectiveFinDiam;
     143             :         Real64 TotCoilOutsideSurfArea;
     144             :         Real64 CoilEffectiveInsideDiam;
     145             :         Real64 GeometryCoef1;
     146             :         Real64 GeometryCoef2;
     147             :         Array1D<Real64> DryFinEfficncyCoef;
     148             :         Real64 SatEnthlCurveConstCoef;
     149             :         Real64 SatEnthlCurveSlope;
     150             :         Real64 EnthVsTempCurveAppxSlope;
     151             :         Real64 EnthVsTempCurveConst;
     152             :         Real64 MeanWaterTempSaved;
     153             :         Real64 InWaterTempSaved;
     154             :         Real64 OutWaterTempSaved;
     155             :         Real64 SurfAreaWetSaved;
     156             :         Real64 SurfAreaWetFraction;
     157             :         // END calculated parameters for detailed flat fin coil
     158             :         // Design Input Variables to the Design Detailed Simple inputs model
     159             :         Real64 DesInletWaterTemp;   // Entering water temperature at Design(C)
     160             :         Real64 DesAirVolFlowRate;   // Entering Air Volume Flow Rate Design( m3/s)
     161             :         Real64 DesInletAirTemp;     // Entering air dry bulb temperature at Design(C)
     162             :         Real64 DesInletAirHumRat;   // Entering air humidity ratio at design conditions
     163             :         Real64 DesTotWaterCoilLoad; // Total heat transfer rate at Design(Watt)
     164             :         Real64 DesSenWaterCoilLoad; // Sensible heat transfer rate at Design(Watt)
     165             :         // BEGIN calculated parameters for Design Detailed Simple inputs model
     166             :         Real64 DesAirMassFlowRate;   // Design Air MassFlow through the WaterCoil [kg/Sec]
     167             :         Real64 UACoilTotal;          // Overall external dry UA (W/C)
     168             :         Real64 UACoilInternal;       // Overall internal UA(W/C)
     169             :         Real64 UACoilExternal;       // Overall external heat transfer coefficient(W/C)
     170             :         Real64 UACoilInternalDes;    // Overall design internal UA(W/C)
     171             :         Real64 UACoilExternalDes;    // Overall design external heat transfer coefficient(W/C)
     172             :         Real64 DesOutletAirTemp;     // Leaving air temperature at rating(C)
     173             :         Real64 DesOutletAirHumRat;   // Humidity ratio of air leaving at design capacity.
     174             :         Real64 DesOutletWaterTemp;   // Temp of Liquid Leaving the Coil at design Capacity
     175             :         int HeatExchType;            // Heat exchanger configuration, default to Cross Flow
     176             :         int CoolingCoilAnalysisMode; // Mode Of analysis, Simple=1 and Detailed =2
     177             :         //    Simple= AllWet-AllDry, Detailed= PartWet-PartDry
     178             :         Real64 UACoilInternalPerUnitArea; // Internal overall heat transfer coefficient(W/m2 C)
     179             :         Real64 UAWetExtPerUnitArea;       // External overall heat transfer coefficient(W/m2 C)
     180             :         Real64 UADryExtPerUnitArea;       // External overall heat transfer coefficient(W/m2 C)
     181             :         Real64 SurfAreaWetFractionSaved;  // Previous saved value, for numerical efficiency.
     182             :         // END calculated parameters for Design Inputs Detailed coil
     183             :         // variables for simple heating coil with variable UA
     184             :         Real64 UACoilVariable;                 // WaterCoil UA value when variable (simple heating coil only)
     185             :         Real64 RatioAirSideToWaterSideConvect; // "r" value for coil,
     186             :         Real64 AirSideNominalConvect;          // nominal rating point air side convection term (fin_effic*(hc*A))
     187             :         Real64 LiquidSideNominalConvect;       // nominal rating point water side convection term (hc*A)
     188             :         int Control;                           // Const Vol =1;  Variable Vol = 2
     189             :         int AirInletNodeNum;
     190             :         int AirOutletNodeNum;
     191             :         int WaterInletNodeNum;
     192             :         int WaterOutletNodeNum;
     193             :         PlantLocation WaterPlantLoc; // Plant location struct
     194             :         // begin variables for Water System interactions
     195             :         int CondensateCollectMode;         // where does water come from
     196             :         std::string CondensateCollectName; // name of water source e.g. water storage tank
     197             :         int CondensateTankID;              // index "pointer" to Storage TAnk array WaterStorage
     198             :         int CondensateTankSupplyARRID;     // index point to supply Vdot array in WaterStorage
     199             :         Real64 CondensateVdot;             // rate of water condensation from air stream [m3/s]
     200             :         Real64 CondensateVol;              // amount of water condensed from air stream [m3]
     201             :         // end variables for water system interactions
     202             :         // COIL:Water:SimpleHeating Coil Performance Input Method
     203             :         int CoilPerfInpMeth; // 1 = UA and Design Water Flow Rate; 2 = Nominal Capacity
     204             : 
     205             :         // Operational fault parameters
     206             :         bool FaultyCoilFoulingFlag;     // True if the coil has fouling fault
     207             :         int FaultyCoilFoulingIndex;     // Index of the fault object corresponding to the coil
     208             :         Real64 FaultyCoilFoulingFactor; // Coil fouling factor [m2K/W]
     209             :         Real64 OriginalUACoilVariable;
     210             :         Real64 OriginalUACoilExternal;
     211             :         Real64 OriginalUACoilInternal;
     212             : 
     213             :         bool DesiccantRegenerationCoil; // true if it is a regeneration air heating coil defined in Desiccant Dehumidifier system
     214             :         int DesiccantDehumNum;          // index to desiccant dehumidifier object
     215             :         Real64 DesignWaterDeltaTemp;    // water deltaT for coil sizing [K]
     216             :         bool UseDesignWaterDeltaTemp;   // is true, the DesignWaterDeltaTemp is used for sizing coil design water flow rate
     217             :         std::string ControllerName;     // controller name used by water coil
     218             :         int ControllerIndex;            // controller index used by water coil
     219             :         bool reportCoilFinalSizes;      // one time report of sizes to coil summary report
     220             :         bool AirLoopDOASFlag;           // True when this coil is used AirLoopDOAS
     221             :         bool heatRecoveryCoil;          // is true when coils are connected to each other to create a heat recovery loop
     222             : 
     223             :         // Default Constructor
     224        3414 :         WaterCoilEquipConditions()
     225        3414 :             : WaterCoilType(DataPlant::PlantEquipmentType::Invalid), WaterCoilModel(CoilModel::Invalid), SchedPtr(0), RequestingAutoSize(false),
     226             :               InletAirMassFlowRate(0.0), OutletAirMassFlowRate(0.0), InletAirTemp(0.0), OutletAirTemp(0.0), InletAirHumRat(0.0), OutletAirHumRat(0.0),
     227             :               InletAirEnthalpy(0.0), OutletAirEnthalpy(0.0), TotWaterCoilLoad(0.0), SenWaterCoilLoad(0.0), TotWaterHeatingCoilEnergy(0.0),
     228             :               TotWaterCoolingCoilEnergy(0.0), SenWaterCoolingCoilEnergy(0.0), DesWaterHeatingCoilRate(0.0), TotWaterHeatingCoilRate(0.0),
     229             :               DesWaterCoolingCoilRate(0.0), TotWaterCoolingCoilRate(0.0), SenWaterCoolingCoilRate(0.0), UACoil(0.0), LeavingRelHum(0.0),
     230             :               DesiredOutletTemp(0.0), DesiredOutletHumRat(0.0), InletWaterTemp(0.0), OutletWaterTemp(0.0), InletWaterMassFlowRate(0.0),
     231             :               OutletWaterMassFlowRate(0.0), MaxWaterVolFlowRate(0.0), MaxWaterMassFlowRate(0.0), InletWaterEnthalpy(0.0), OutletWaterEnthalpy(0.0),
     232             :               TubeOutsideSurfArea(0.0), TotTubeInsideArea(0.0), FinSurfArea(0.0), MinAirFlowArea(0.0), CoilDepth(0.0), FinDiam(0.0),
     233             :               FinThickness(0.0), TubeInsideDiam(0.0), TubeOutsideDiam(0.0), TubeThermConductivity(0.0), FinThermConductivity(0.0), FinSpacing(0.0),
     234             :               TubeDepthSpacing(0.0), NumOfTubeRows(0), NumOfTubesPerRow(0), EffectiveFinDiam(0.0), TotCoilOutsideSurfArea(0.0),
     235             :               CoilEffectiveInsideDiam(0.0), GeometryCoef1(0.0), GeometryCoef2(0.0), DryFinEfficncyCoef(5, 0.0), SatEnthlCurveConstCoef(0.0),
     236             :               SatEnthlCurveSlope(0.0), EnthVsTempCurveAppxSlope(0.0), EnthVsTempCurveConst(0.0), MeanWaterTempSaved(0.0), InWaterTempSaved(0.0),
     237             :               OutWaterTempSaved(0.0), SurfAreaWetSaved(0.0), SurfAreaWetFraction(0.0), DesInletWaterTemp(0.0), DesAirVolFlowRate(0.0),
     238             :               DesInletAirTemp(0.0), DesInletAirHumRat(0.0), DesTotWaterCoilLoad(0.0), DesSenWaterCoilLoad(0.0), DesAirMassFlowRate(0.0),
     239             :               UACoilTotal(0.0), UACoilInternal(0.0), UACoilExternal(0.0), UACoilInternalDes(0.0), UACoilExternalDes(0.0), DesOutletAirTemp(0.0),
     240             :               DesOutletAirHumRat(0.0), DesOutletWaterTemp(0.0), HeatExchType(0), CoolingCoilAnalysisMode(0), UACoilInternalPerUnitArea(0.0),
     241             :               UAWetExtPerUnitArea(0.0), UADryExtPerUnitArea(0.0), SurfAreaWetFractionSaved(0.0), UACoilVariable(0.0),
     242             :               RatioAirSideToWaterSideConvect(1.0), AirSideNominalConvect(0.0), LiquidSideNominalConvect(0.0), Control(0), AirInletNodeNum(0),
     243             :               AirOutletNodeNum(0), WaterInletNodeNum(0), WaterOutletNodeNum(0), WaterPlantLoc{}, CondensateCollectMode(1001), CondensateTankID(0),
     244             :               CondensateTankSupplyARRID(0), CondensateVdot(0.0), CondensateVol(0.0), CoilPerfInpMeth(0), FaultyCoilFoulingFlag(false),
     245             :               FaultyCoilFoulingIndex(0), FaultyCoilFoulingFactor(0.0), DesiccantRegenerationCoil(false), DesiccantDehumNum(0),
     246             :               DesignWaterDeltaTemp(0.0), UseDesignWaterDeltaTemp(false), ControllerName(""), ControllerIndex(0), reportCoilFinalSizes(true),
     247        3414 :               AirLoopDOASFlag(false), heatRecoveryCoil(false)
     248             :         {
     249        3414 :         }
     250             :     };
     251             : 
     252        6514 :     struct WaterCoilNumericFieldData
     253             :     {
     254             :         // Members
     255             :         Array1D_string FieldNames;
     256             : 
     257             :         // Default Constructor
     258        3414 :         WaterCoilNumericFieldData()
     259        3414 :         {
     260        3414 :         }
     261             :     };
     262             : 
     263             :     // Functions
     264             : 
     265             :     void SimulateWaterCoilComponents(EnergyPlusData &state,
     266             :                                      std::string_view CompName,
     267             :                                      bool const FirstHVACIteration,
     268             :                                      int &CompIndex,
     269             :                                      Optional<Real64> QActual = _,
     270             :                                      Optional_int_const FanOpMode = _,
     271             :                                      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             :                                int const FanOpMode,        // 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             :                                       int const FanOpMode,       // 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             :                      int const FanOpMode,       // 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             :                            int const FanOpMode,       // 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             :                            int const FanOpMode,          // 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             :                             int const FanOpMode,           // 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             :     int GetWaterCoilAvailScheduleIndex(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             :                           Optional_bool DesiccantRegenerationCoil = _, // Flag that this coil is used as regeneration air heating coil
     518             :                           Optional_int DesiccantDehumIndex = _,        // Index for the desiccant dehum system where this caoil is used
     519             :                           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             :                                     int const FanOpMode,              // 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         771 : 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           0 :     void clear_state() override
     598             :     {
     599           0 :         this->NumWaterCoils = 0;
     600           0 :         this->InitWaterCoilOneTimeFlag = true;
     601           0 :         this->MySizeFlag.deallocate();
     602           0 :         this->MyUAAndFlowCalcFlag.deallocate();
     603           0 :         this->MyCoilDesignFlag.deallocate();
     604           0 :         this->CoilWarningOnceFlag.deallocate();
     605           0 :         this->WaterTempCoolCoilErrs.deallocate();
     606           0 :         this->PartWetCoolCoilErrs.deallocate();
     607           0 :         this->GetWaterCoilsInputFlag = true;
     608           0 :         this->CheckEquipName.deallocate();
     609           0 :         this->WaterCoil.deallocate();
     610           0 :         this->WaterCoilNumericFields.deallocate();
     611           0 :         this->WaterCoilControllerCheckOneTimeFlag = true;
     612           0 :         this->TOutNew = 0.0;
     613           0 :         this->WOutNew = 0.0;
     614           0 :         this->DesCpAir.deallocate();
     615           0 :         this->DesUARangeCheck.deallocate();
     616           0 :         this->MyEnvrnFlag.deallocate();
     617           0 :         this->MyCoilReportFlag.deallocate();
     618           0 :         this->PlantLoopScanFlag.deallocate();
     619           0 :         this->CoefSeries = Array1D<Real64>(5);
     620           0 :         this->NoSatCurveIntersect = false;
     621           0 :         this->BelowInletWaterTemp = false;
     622           0 :         this->CBFTooLarge = false;
     623           0 :         this->NoExitCondReset = false;
     624           0 :         this->RatedLatentCapacity = 0.0;
     625           0 :         this->RatedSHR = 0.0;
     626           0 :         this->CapacitanceWater = 0.0;
     627           0 :         this->CMin = 0.0;
     628           0 :         this->CoilEffectiveness = 0.0;
     629           0 :         this->SurfaceArea = 0.0;
     630           0 :         this->UATotal = 0.0;
     631           0 :         this->RptCoilHeaderFlag = Array1D_bool(2, true);
     632           0 :         this->OrderedPair = Array2D<Real64>(WaterCoils::MaxOrderedPairs, 2);
     633           0 :         this->OrdPairSum = Array2D<Real64>(10, 2);
     634           0 :         this->OrdPairSumMatrix = Array2D<Real64>(10, 10);
     635           0 :     }
     636             : 
     637             :     // Default Constructor
     638         771 :     WaterCoilsData()
     639         771 :         : CounterFlow(1), CrossFlow(2), SimpleAnalysis(1), DetailedAnalysis(2), CondensateDiscarded(1001), CondensateToTank(1002), UAandFlow(1),
     640             :           NomCap(2), DesignCalc(1), SimCalc(2), NumWaterCoils(0), GetWaterCoilsInputFlag(true), WaterCoilControllerCheckOneTimeFlag(true),
     641         771 :           InitWaterCoilOneTimeFlag(true)
     642             :     {
     643         771 :     }
     644             : };
     645             : 
     646             : } // namespace EnergyPlus
     647             : 
     648             : #endif

Generated by: LCOV version 1.13