LCOV - code coverage report
Current view: top level - EnergyPlus - WaterCoils.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 36 74 48.6 %
Date: 2024-08-23 23:50:59 Functions: 4 5 80.0 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2024, 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             :         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        3638 :         WaterCoilEquipConditions()
     225       10914 :             : WaterCoilType(DataPlant::PlantEquipmentType::Invalid), WaterCoilModel(CoilModel::Invalid), SchedPtr(0), RequestingAutoSize(false),
     226        3638 :               InletAirMassFlowRate(0.0), OutletAirMassFlowRate(0.0), InletAirTemp(0.0), OutletAirTemp(0.0), InletAirHumRat(0.0), OutletAirHumRat(0.0),
     227        3638 :               InletAirEnthalpy(0.0), OutletAirEnthalpy(0.0), TotWaterCoilLoad(0.0), SenWaterCoilLoad(0.0), TotWaterHeatingCoilEnergy(0.0),
     228        3638 :               TotWaterCoolingCoilEnergy(0.0), SenWaterCoolingCoilEnergy(0.0), DesWaterHeatingCoilRate(0.0), TotWaterHeatingCoilRate(0.0),
     229        3638 :               DesWaterCoolingCoilRate(0.0), TotWaterCoolingCoilRate(0.0), SenWaterCoolingCoilRate(0.0), UACoil(0.0), LeavingRelHum(0.0),
     230        3638 :               DesiredOutletTemp(0.0), DesiredOutletHumRat(0.0), InletWaterTemp(0.0), OutletWaterTemp(0.0), InletWaterMassFlowRate(0.0),
     231        3638 :               OutletWaterMassFlowRate(0.0), MaxWaterVolFlowRate(0.0), MaxWaterMassFlowRate(0.0), InletWaterEnthalpy(0.0), OutletWaterEnthalpy(0.0),
     232        3638 :               TubeOutsideSurfArea(0.0), TotTubeInsideArea(0.0), FinSurfArea(0.0), MinAirFlowArea(0.0), CoilDepth(0.0), FinDiam(0.0),
     233        3638 :               FinThickness(0.0), TubeInsideDiam(0.0), TubeOutsideDiam(0.0), TubeThermConductivity(0.0), FinThermConductivity(0.0), FinSpacing(0.0),
     234        3638 :               TubeDepthSpacing(0.0), NumOfTubeRows(0), NumOfTubesPerRow(0), EffectiveFinDiam(0.0), TotCoilOutsideSurfArea(0.0),
     235        3638 :               CoilEffectiveInsideDiam(0.0), GeometryCoef1(0.0), GeometryCoef2(0.0), DryFinEfficncyCoef(5, 0.0), SatEnthlCurveConstCoef(0.0),
     236        3638 :               SatEnthlCurveSlope(0.0), EnthVsTempCurveAppxSlope(0.0), EnthVsTempCurveConst(0.0), MeanWaterTempSaved(0.0), InWaterTempSaved(0.0),
     237        3638 :               OutWaterTempSaved(0.0), SurfAreaWetSaved(0.0), SurfAreaWetFraction(0.0), DesInletWaterTemp(0.0), DesAirVolFlowRate(0.0),
     238        3638 :               DesInletAirTemp(0.0), DesInletAirHumRat(0.0), DesTotWaterCoilLoad(0.0), DesSenWaterCoilLoad(0.0), DesAirMassFlowRate(0.0),
     239        3638 :               UACoilTotal(0.0), UACoilInternal(0.0), UACoilExternal(0.0), UACoilInternalDes(0.0), UACoilExternalDes(0.0), DesOutletAirTemp(0.0),
     240        3638 :               DesOutletAirHumRat(0.0), DesOutletWaterTemp(0.0), HeatExchType(0), CoolingCoilAnalysisMode(0), UACoilInternalPerUnitArea(0.0),
     241        3638 :               UAWetExtPerUnitArea(0.0), UADryExtPerUnitArea(0.0), SurfAreaWetFractionSaved(0.0), UACoilVariable(0.0),
     242        3638 :               RatioAirSideToWaterSideConvect(1.0), AirSideNominalConvect(0.0), LiquidSideNominalConvect(0.0), Control(0), AirInletNodeNum(0),
     243        3638 :               AirOutletNodeNum(0), WaterInletNodeNum(0), WaterOutletNodeNum(0), WaterPlantLoc{}, CondensateCollectMode(1001), CondensateTankID(0),
     244        3638 :               CondensateTankSupplyARRID(0), CondensateVdot(0.0), CondensateVol(0.0), CoilPerfInpMeth(0), FaultyCoilFoulingFlag(false),
     245        3638 :               FaultyCoilFoulingIndex(0), FaultyCoilFoulingFactor(0.0), OriginalUACoilVariable(0.0), OriginalUACoilExternal(0.0),
     246        3638 :               OriginalUACoilInternal(0.0), DesiccantRegenerationCoil(false), DesiccantDehumNum(0), DesignWaterDeltaTemp(0.0),
     247        3638 :               UseDesignWaterDeltaTemp(false), ControllerName(""), ControllerIndex(0), reportCoilFinalSizes(true), AirLoopDOASFlag(false),
     248        7276 :               heatRecoveryCoil(false)
     249             :         {
     250        3638 :         }
     251             :     };
     252             : 
     253             :     struct WaterCoilNumericFieldData
     254             :     {
     255             :         // Members
     256             :         Array1D_string FieldNames;
     257             : 
     258             :         // Default Constructor
     259        3638 :         WaterCoilNumericFieldData()
     260        3638 :         {
     261        3638 :         }
     262             :     };
     263             : 
     264             :     // Functions
     265             : 
     266             :     void SimulateWaterCoilComponents(EnergyPlusData &state,
     267             :                                      std::string_view CompName,
     268             :                                      bool const FirstHVACIteration,
     269             :                                      int &CompIndex,
     270             :                                      ObjexxFCL::Optional<Real64> QActual = _,
     271             :                                      ObjexxFCL::Optional<HVAC::FanOp const> fanOp = _,
     272             :                                      ObjexxFCL::Optional<Real64 const> PartLoadRatio = _);
     273             : 
     274             :     void GetWaterCoilInput(EnergyPlusData &state);
     275             : 
     276             :     void InitWaterCoil(EnergyPlusData &state, int const CoilNum, bool const FirstHVACIteration);
     277             : 
     278             :     void                                                          // refactor for coil report
     279             :     CalcAdjustedCoilUA(EnergyPlusData &state, int const CoilNum); // refactor for coil report
     280             : 
     281             :     void SizeWaterCoil(EnergyPlusData &state, int const CoilNum);
     282             : 
     283             :     void CalcSimpleHeatingCoil(EnergyPlusData &state,
     284             :                                int const CoilNum,          // index to heating coil
     285             :                                HVAC::FanOp const fanOp,    // fan operating mode
     286             :                                Real64 const PartLoadRatio, // part-load ratio of heating coil
     287             :                                int const CalcMode          // 1 = design calc; 2 = simulation calculation
     288             :     );
     289             : 
     290             :     void CalcDetailFlatFinCoolingCoil(EnergyPlusData &state,
     291             :                                       int const CoilNum,
     292             :                                       int const CalcMode,
     293             :                                       HVAC::FanOp const fanOp,   // fan operating mode
     294             :                                       Real64 const PartLoadRatio // part-load ratio of heating coil
     295             :     );
     296             : 
     297             :     void CoolingCoil(EnergyPlusData &state,
     298             :                      int const CoilNum,
     299             :                      bool const FirstHVACIteration,
     300             :                      int const CalcMode,
     301             :                      HVAC::FanOp const fanOp,   // fan operating mode
     302             :                      Real64 const PartLoadRatio // part-load ratio of heating coil
     303             :     );
     304             : 
     305             :     void CoilCompletelyDry(EnergyPlusData &state,
     306             :                            int const CoilNum,
     307             :                            Real64 const WaterTempIn,  // Entering water temperature
     308             :                            Real64 const AirTempIn,    // Entering air dry bulb temperature
     309             :                            Real64 const CoilUA,       // Overall heat transfer coefficient
     310             :                            Real64 &OutletWaterTemp,   // Leaving water temperature
     311             :                            Real64 &OutletAirTemp,     // Leaving air dry bulb temperature
     312             :                            Real64 &OutletAirHumRat,   // Leaving air humidity ratio
     313             :                            Real64 &Q,                 // Heat transfer rate
     314             :                            HVAC::FanOp const fanOp,   // fan operating mode
     315             :                            Real64 const PartLoadRatio // part-load ratio of heating coil
     316             :     );
     317             : 
     318             :     // Coil Completely Wet Subroutine for Cooling Coil
     319             : 
     320             :     void CoilCompletelyWet(EnergyPlusData &state,
     321             :                            int const CoilNum,            // Number of Coil
     322             :                            Real64 const WaterTempIn,     // Water temperature IN to this function (C)
     323             :                            Real64 const AirTempIn,       // Air dry bulb temperature IN to this function(C)
     324             :                            Real64 const AirHumRat,       // Air Humidity Ratio IN to this funcation (C)
     325             :                            Real64 const UAInternalTotal, // Internal overall heat transfer coefficient(W/m2 C)
     326             :                            Real64 const UAExternalTotal, // External overall heat transfer coefficient(W/m2 C)
     327             :                            Real64 &OutletWaterTemp,      // Leaving water temperature (C)
     328             :                            Real64 &OutletAirTemp,        // Leaving air dry bulb temperature(C)
     329             :                            Real64 &OutletAirHumRat,      // Leaving air humidity ratio
     330             :                            Real64 &TotWaterCoilLoad,     // Total heat transfer rate(W)
     331             :                            Real64 &SenWaterCoilLoad,     // Sensible heat transfer rate(W)
     332             :                            Real64 &SurfAreaWetFraction,  // Fraction of surface area wet
     333             :                            Real64 &AirInletCoilSurfTemp, // Surface temperature at air entrance(C)
     334             :                            HVAC::FanOp const fanOp,      // fan operating mode
     335             :                            Real64 const PartLoadRatio    // part-load ratio of heating coil
     336             :     );
     337             : 
     338             :     // Coil Part Wet Part Dry Subroutine for Cooling Coil
     339             : 
     340             :     void CoilPartWetPartDry(EnergyPlusData &state,
     341             :                             int const CoilNum,             // Number of Coil
     342             :                             bool const FirstHVACIteration, // Saving Old values
     343             :                             Real64 const InletWaterTemp,   // Entering liquid temperature(C)
     344             :                             Real64 const InletAirTemp,     // Entering air dry bulb temperature(C)
     345             :                             Real64 const AirDewPointTemp,  // Entering air dew point(C)
     346             :                             Real64 &OutletWaterTemp,       // Leaving liquid temperature(C)
     347             :                             Real64 &OutletAirTemp,         // Leaving air dry bulb temperature(C)
     348             :                             Real64 &OutletAirHumRat,       // Leaving air humidity ratio
     349             :                             Real64 &TotWaterCoilLoad,      // Total heat transfer rate (W)
     350             :                             Real64 &SenWaterCoilLoad,      // Sensible heat transfer rate (W)
     351             :                             Real64 &SurfAreaWetFraction,   // Fraction of surface area wet
     352             :                             HVAC::FanOp const fanOp,       // fan operating mode
     353             :                             Real64 const PartLoadRatio     // part-load ratio of heating coil
     354             :     );
     355             : 
     356             :     // Calculating coil UA for Cooling Coil
     357             : 
     358             :     Real64 CalcCoilUAbyEffectNTU(EnergyPlusData &state,
     359             :                                  int const CoilNum,
     360             :                                  Real64 const CapacityStream1,     // Capacity rate of stream1.(W/C)
     361             :                                  Real64 const EnergyInStreamOne,   // Inlet state of stream1.(C)
     362             :                                  Real64 const CapacityStream2,     // Capacity rate of stream2.(W/C)
     363             :                                  Real64 const EnergyInStreamTwo,   // Inlet state of stream2.(C)
     364             :                                  Real64 const DesTotalHeatTransfer // Heat transfer rate(W)
     365             :     );
     366             : 
     367             :     // Calculating coil outlet stream conditions and coil UA for Cooling Coil
     368             : 
     369             :     void CoilOutletStreamCondition(EnergyPlusData &state,
     370             :                                    int const CoilNum,
     371             :                                    Real64 const CapacityStream1,   // Capacity rate of stream1(W/C)
     372             :                                    Real64 const EnergyInStreamOne, // Inlet state of stream1 (C)
     373             :                                    Real64 const CapacityStream2,   // Capacity rate of stream2 (W/C)
     374             :                                    Real64 const EnergyInStreamTwo, // Inlet state of stream2 (C)
     375             :                                    Real64 const CoilUA,            // Heat transfer rateW)
     376             :                                    Real64 &EnergyOutStreamOne,     // Outlet state of stream1 (C)
     377             :                                    Real64 &EnergyOutStreamTwo      // Outlet state of stream2 (C)
     378             :     );
     379             : 
     380             :     // Subroutine for caculating outlet condition if coil is wet , for Cooling Coil
     381             : 
     382             :     void WetCoilOutletCondition(EnergyPlusData &state,
     383             :                                 int const CoilNum,
     384             :                                 Real64 const AirTempIn,      // Entering air dry bulb temperature(C)
     385             :                                 Real64 const EnthAirInlet,   // Entering air enthalpy(J/kg)
     386             :                                 Real64 const EnthAirOutlet,  // Leaving air enthalpy(J/kg)
     387             :                                 Real64 const UACoilExternal, // Heat transfer coefficient for external surface (W/C)
     388             :                                 Real64 &OutletAirTemp,       // Leaving air dry bulb temperature(C)
     389             :                                 Real64 &OutletAirHumRat,     // Leaving air humidity ratio
     390             :                                 Real64 &SenWaterCoilLoad     // Sensible heat transfer rate(W)
     391             :     );
     392             : 
     393             :     void UpdateWaterCoil(EnergyPlusData &state, int const CoilNum);
     394             : 
     395             :     void ReportWaterCoil(EnergyPlusData &state, int const CoilNum);
     396             : 
     397             :     void CalcDryFinEffCoef(EnergyPlusData &state, Real64 const OutTubeEffFinDiamRatio, Array1D<Real64> &PolynomCoef);
     398             : 
     399             :     void CalcIBesselFunc(Real64 const BessFuncArg, int const BessFuncOrd, Real64 &IBessFunc, int &ErrorCode);
     400             : 
     401             :     void CalcKBesselFunc(Real64 const BessFuncArg, int const BessFuncOrd, Real64 &KBessFunc, int &ErrorCode);
     402             : 
     403             :     void CalcPolynomCoef(EnergyPlusData &state, Array2<Real64> const &OrderedPair, Array1D<Real64> &PolynomCoef);
     404             : 
     405             :     // Iterate Routine for Cooling Coil
     406             : 
     407             :     void CoilAreaFracIter(Real64 &NewSurfAreaWetFrac,       // Out Value of variable
     408             :                           Real64 const SurfAreaFracCurrent, // Driver Value
     409             :                           Real64 const ErrorCurrent,        // Objective Function
     410             :                           Real64 &SurfAreaFracPrevious,     // First Previous value of Surf Area Fraction
     411             :                           Real64 &ErrorPrevious,            // First Previous value of error
     412             :                           Real64 &SurfAreaFracLast,         // Second Previous value of Surf Area Fraction
     413             :                           Real64 &ErrorLast,                // Second Previous value of error
     414             :                           int const IterNum,                // Number of Iterations
     415             :                           int &icvg                         // Iteration convergence flag
     416             :     );
     417             : 
     418             :     void CheckWaterCoilSchedule(EnergyPlusData &state, std::string_view CompName, Real64 &Value, int &CompIndex);
     419             : 
     420             :     Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state,
     421             :                                    std::string_view CoilType,   // must match coil types in this module
     422             :                                    std::string const &CoilName, // must match coil names for the coil type
     423             :                                    bool &ErrorsFound            // set to true if problem
     424             :     );
     425             : 
     426             :     int GetCoilInletNode(EnergyPlusData &state,
     427             :                          std::string_view CoilType,   // must match coil types in this module
     428             :                          std::string const &CoilName, // must match coil names for the coil type
     429             :                          bool &ErrorsFound            // set to true if problem
     430             :     );
     431             : 
     432             :     int GetCoilOutletNode(EnergyPlusData &state,
     433             :                           std::string_view CoilType,   // must match coil types in this module
     434             :                           std::string const &CoilName, // must match coil names for the coil type
     435             :                           bool &ErrorsFound            // set to true if problem
     436             :     );
     437             : 
     438             :     int GetCoilWaterInletNode(EnergyPlusData &state,
     439             :                               std::string_view CoilType,   // must match coil types in this module
     440             :                               std::string const &CoilName, // must match coil names for the coil type
     441             :                               bool &ErrorsFound            // set to true if problem
     442             :     );
     443             : 
     444             :     int GetCoilWaterOutletNode(EnergyPlusData &state,
     445             :                                std::string_view CoilType,   // must match coil types in this module
     446             :                                std::string const &CoilName, // must match coil names for the coil type
     447             :                                bool &ErrorsFound            // set to true if problem
     448             :     );
     449             : 
     450             :     void SetCoilDesFlow(EnergyPlusData &state,
     451             :                         std::string_view CoilType,   // must match coil types in this module
     452             :                         std::string const &CoilName, // must match coil names for the coil type
     453             :                         Real64 const CoilDesFlow,    // coil volumetric air flow rate [m3/s]
     454             :                         bool &ErrorsFound            // set to true if problem
     455             :     );
     456             : 
     457             :     Real64 GetWaterCoilDesAirFlow(EnergyPlusData &state,
     458             :                                   std::string const &CoilType, // must match coil types in this module
     459             :                                   std::string const &CoilName, // must match coil names for the coil type
     460             :                                   bool &ErrorsFound            // set to true if problem
     461             :     );
     462             : 
     463             :     void CheckActuatorNode(EnergyPlusData &state,
     464             :                            int const ActuatorNodeNum,                    // input actuator node number
     465             :                            DataPlant::PlantEquipmentType &WaterCoilType, // Cooling or Heating or 0
     466             :                            bool &NodeNotFound                            // true if matching water inlet node not found
     467             :     );
     468             : 
     469             :     void CheckForSensorAndSetPointNode(EnergyPlusData &state,
     470             :                                        int const SensorNodeNum,                    // controller sensor node number
     471             :                                        HVACControllers::CtrlVarType ControlledVar, // controlled variable type
     472             :                                        bool &NodeNotFound                          // true if matching air outlet node not found
     473             :     );
     474             : 
     475             :     Real64 TdbFnHRhPb(EnergyPlusData &state,
     476             :                       Real64 const H,  // specific enthalpy {J/kg}
     477             :                       Real64 const RH, // relative humidity value (0.0-1.0)
     478             :                       Real64 const PB  // barometric pressure {Pascals}
     479             :     );
     480             : 
     481             :     Real64 EstimateHEXSurfaceArea(EnergyPlusData &state, int const CoilNum); // coil number, [-]
     482             : 
     483             :     int GetWaterCoilIndex(EnergyPlusData &state,
     484             :                           std::string_view CoilType,   // must match coil types in this module
     485             :                           std::string const &CoilName, // must match coil names for the coil type
     486             :                           bool &ErrorsFound            // set to true if problem
     487             :     );
     488             :     int GetCompIndex(EnergyPlusData &state, CoilModel coilType, std::string_view const coilName);
     489             : 
     490             :     Real64 GetWaterCoilCapacity(EnergyPlusData &state,
     491             :                                 std::string const &CoilType, // must match coil types in this module
     492             :                                 std::string const &CoilName, // must match coil names for the coil type
     493             :                                 bool &ErrorsFound            // set to true if problem
     494             :     );
     495             : 
     496             :     void UpdateWaterToAirCoilPlantConnection(EnergyPlusData &state,
     497             :                                              DataPlant::PlantEquipmentType const CoilType,
     498             :                                              std::string const &CoilName,
     499             :                                              int const EquipFlowCtrl,                    // Flow control mode for the equipment
     500             :                                              int const LoopNum,                          // Plant loop index for where called from
     501             :                                              const DataPlant::LoopSideLocation LoopSide, // Plant loop side index for where called from
     502             :                                              int &CompIndex,                             // Chiller number pointer
     503             :                                              bool const FirstHVACIteration,
     504             :                                              bool &InitLoopEquip // If not zero, calculate the max load for operating conditions
     505             :     );
     506             : 
     507             :     int GetWaterCoilAvailScheduleIndex(EnergyPlusData &state,
     508             :                                        std::string const &CoilType, // must match coil types in this module
     509             :                                        std::string const &CoilName, // must match coil names for the coil type
     510             :                                        bool &ErrorsFound            // set to true if problem
     511             :     );
     512             : 
     513             :     // sets data to a coil that is used as a regeneration air heating coil in
     514             :     // desiccant dehumidification system
     515             :     void SetWaterCoilData(EnergyPlusData &state,
     516             :                           int const CoilNum,                                      // index of hot water heating Coil
     517             :                           bool &ErrorsFound,                                      // Set to true if certain errors found
     518             :                           ObjexxFCL::Optional_bool DesiccantRegenerationCoil = _, // Flag that this coil is used as regeneration air heating coil
     519             :                           ObjexxFCL::Optional_int DesiccantDehumIndex = _,        // Index for the desiccant dehum system where this caoil is used
     520             :                           ObjexxFCL::Optional_bool heatRecoveryCoil = _           // true if water coil is connected to heat recovery loop
     521             :     );
     522             : 
     523             :     // estimate heating coil design inlet water temperature for autosizing UA-value
     524             :     void EstimateCoilInletWaterTemp(EnergyPlusData &state,
     525             :                                     int const CoilNum,                // index to heating coil
     526             :                                     HVAC::FanOp const fanOp,          // fan operating mode
     527             :                                     Real64 const PartLoadRatio,       // part-load ratio of heating coil
     528             :                                     Real64 const UAMax,               // maximum UA-Value
     529             :                                     Real64 &DesCoilInletWaterTempUsed // estimated coil design inlet water temperature
     530             :     );
     531             : 
     532             : } // namespace WaterCoils
     533             : 
     534             : struct WaterCoilsData : BaseGlobalStruct
     535             : {
     536             : 
     537             :     // Parameters for Heat Exchanger Configuration
     538             :     int const CounterFlow;
     539             :     int const CrossFlow;
     540             :     int const SimpleAnalysis;
     541             :     int const DetailedAnalysis;
     542             : 
     543             :     // Water Systems
     544             :     int const CondensateDiscarded; // default mode where water is "lost"
     545             :     int const CondensateToTank;    // collect coil condensate from air and store in water storage tank
     546             : 
     547             :     // Parameters for COIL:Water:SimpleHeating Coil Performance Input Method
     548             :     int const UAandFlow; // for Coil Performance Input Method = UA and Design Water Flow Rate
     549             :     int const NomCap;    // for Coil Performance Input Method = Nominal Capacity
     550             : 
     551             :     // Parameters Subroutine CoolingCoil: design calc or simulation calc.
     552             :     int const DesignCalc; // ignore on/off check in CoolingCoil
     553             :     int const SimCalc;    // pay attention to on/off check in CoolingCoil
     554             : 
     555             :     // DERIVED TYPE DEFINITIONS
     556             : 
     557             :     // MODULE VARIABLE DECLARATIONS:
     558             :     int NumWaterCoils; // The Number of WaterCoils found in the Input
     559             :     Array1D_bool MySizeFlag;
     560             :     Array1D_bool MyUAAndFlowCalcFlag;
     561             :     Array1D_bool MyCoilDesignFlag;
     562             :     Array1D_bool CoilWarningOnceFlag;
     563             :     Array1D_int WaterTempCoolCoilErrs;        // error counting for detailed coils
     564             :     Array1D_int PartWetCoolCoilErrs;          // error counting for detailed coils
     565             :     bool GetWaterCoilsInputFlag;              // Flag set to make sure you get input once
     566             :     bool WaterCoilControllerCheckOneTimeFlag; // flg used to check water coil controller
     567             :     Array1D_bool CheckEquipName;
     568             : 
     569             :     bool InitWaterCoilOneTimeFlag;
     570             : 
     571             :     EPVector<WaterCoils::WaterCoilEquipConditions> WaterCoil;
     572             :     EPVector<WaterCoils::WaterCoilNumericFieldData> WaterCoilNumericFields;
     573             : 
     574             :     Real64 TOutNew = 0.0;            // reset outlet air temperature for Coil:Cooling:Water
     575             :     Real64 WOutNew = 0.0;            // reset outlet air humidity ratio for Coil:Cooling:Water
     576             :     Array1D<Real64> DesCpAir;        // CpAir at Design Inlet Air Temp
     577             :     Array1D<Real64> DesUARangeCheck; // Value for range check based on Design Inlet Air Humidity Ratio
     578             :     Array1D_bool MyEnvrnFlag;
     579             :     Array1D_bool MyCoilReportFlag;
     580             :     Array1D_bool PlantLoopScanFlag;
     581             :     Array1D<Real64> CoefSeries = Array1D<Real64>(5); // Tuned Changed to static: High call count: Set before use
     582             :     bool NoSatCurveIntersect = false;                // TRUE if failed to find apparatus dew-point
     583             :     bool BelowInletWaterTemp = false;                // TRUE if apparatus dew-point below design inlet water temperature
     584             :     bool CBFTooLarge = false;                        // TRUE if the coil bypass factor is unrealistically large
     585             :     bool NoExitCondReset = false;                    // TRUE if exit condition reset is not to be done
     586             :     Real64 RatedLatentCapacity = 0.0;                // latent cooling capacity at the rating point [W]
     587             :     Real64 RatedSHR = 0.0;                           // sensible heat ratio at the rating point
     588             :     Real64 CapacitanceWater = 0.0;                   // capacitance of the water stream [W/K]
     589             :     Real64 CMin = 0.0;                               // minimum capacitance of 2 streams [W/K]
     590             :     Real64 CoilEffectiveness = 0.0;                  // effectiveness of the coil (rated)
     591             :     Real64 SurfaceArea = 0.0;                        // heat exchanger surface area, [m2]
     592             :     Real64 UATotal = 0.0;                            // heat exchanger UA total, [W/C]
     593             :     Array1D_bool RptCoilHeaderFlag = Array1D_bool(2, true);
     594             :     Array2D<Real64> OrderedPair = Array2D<Real64>(WaterCoils::MaxOrderedPairs, 2);
     595             :     Array2D<Real64> OrdPairSum = Array2D<Real64>(10, 2);
     596             :     Array2D<Real64> OrdPairSumMatrix = Array2D<Real64>(10, 10);
     597             : 
     598         796 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     599             :     {
     600         796 :     }
     601             : 
     602           0 :     void clear_state() override
     603             :     {
     604           0 :         this->NumWaterCoils = 0;
     605           0 :         this->InitWaterCoilOneTimeFlag = true;
     606           0 :         this->MySizeFlag.deallocate();
     607           0 :         this->MyUAAndFlowCalcFlag.deallocate();
     608           0 :         this->MyCoilDesignFlag.deallocate();
     609           0 :         this->CoilWarningOnceFlag.deallocate();
     610           0 :         this->WaterTempCoolCoilErrs.deallocate();
     611           0 :         this->PartWetCoolCoilErrs.deallocate();
     612           0 :         this->GetWaterCoilsInputFlag = true;
     613           0 :         this->CheckEquipName.deallocate();
     614           0 :         this->WaterCoil.deallocate();
     615           0 :         this->WaterCoilNumericFields.deallocate();
     616           0 :         this->WaterCoilControllerCheckOneTimeFlag = true;
     617           0 :         this->TOutNew = 0.0;
     618           0 :         this->WOutNew = 0.0;
     619           0 :         this->DesCpAir.deallocate();
     620           0 :         this->DesUARangeCheck.deallocate();
     621           0 :         this->MyEnvrnFlag.deallocate();
     622           0 :         this->MyCoilReportFlag.deallocate();
     623           0 :         this->PlantLoopScanFlag.deallocate();
     624           0 :         this->CoefSeries = Array1D<Real64>(5);
     625           0 :         this->NoSatCurveIntersect = false;
     626           0 :         this->BelowInletWaterTemp = false;
     627           0 :         this->CBFTooLarge = false;
     628           0 :         this->NoExitCondReset = false;
     629           0 :         this->RatedLatentCapacity = 0.0;
     630           0 :         this->RatedSHR = 0.0;
     631           0 :         this->CapacitanceWater = 0.0;
     632           0 :         this->CMin = 0.0;
     633           0 :         this->CoilEffectiveness = 0.0;
     634           0 :         this->SurfaceArea = 0.0;
     635           0 :         this->UATotal = 0.0;
     636           0 :         this->RptCoilHeaderFlag = Array1D_bool(2, true);
     637           0 :         this->OrderedPair = Array2D<Real64>(WaterCoils::MaxOrderedPairs, 2);
     638           0 :         this->OrdPairSum = Array2D<Real64>(10, 2);
     639           0 :         this->OrdPairSumMatrix = Array2D<Real64>(10, 10);
     640           0 :     }
     641             : 
     642             :     // Default Constructor
     643         796 :     WaterCoilsData()
     644        1592 :         : CounterFlow(1), CrossFlow(2), SimpleAnalysis(1), DetailedAnalysis(2), CondensateDiscarded(1001), CondensateToTank(1002), UAandFlow(1),
     645        1592 :           NomCap(2), DesignCalc(1), SimCalc(2), NumWaterCoils(0), GetWaterCoilsInputFlag(true), WaterCoilControllerCheckOneTimeFlag(true),
     646         796 :           InitWaterCoilOneTimeFlag(true)
     647             :     {
     648         796 :     }
     649             : };
     650             : 
     651             : } // namespace EnergyPlus
     652             : 
     653             : #endif

Generated by: LCOV version 1.14