LCOV - code coverage report
Current view: top level - EnergyPlus - WaterToAirHeatPumpSimple.cc (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 1446 2033 71.1 %
Date: 2023-01-17 19:17:23 Functions: 16 17 94.1 %

          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             : // C++ Headers
      49             : #include <cmath>
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array.functions.hh>
      53             : #include <ObjexxFCL/Fmath.hh>
      54             : 
      55             : // EnergyPlus Headers
      56             : #include <EnergyPlus/Autosizing/Base.hh>
      57             : #include <EnergyPlus/BranchNodeConnections.hh>
      58             : #include <EnergyPlus/CurveManager.hh>
      59             : #include <EnergyPlus/Data/EnergyPlusData.hh>
      60             : #include <EnergyPlus/DataAirSystems.hh>
      61             : #include <EnergyPlus/DataContaminantBalance.hh>
      62             : #include <EnergyPlus/DataEnvironment.hh>
      63             : #include <EnergyPlus/DataHeatBalance.hh>
      64             : #include <EnergyPlus/DataLoopNode.hh>
      65             : #include <EnergyPlus/DataPrecisionGlobals.hh>
      66             : #include <EnergyPlus/DataSizing.hh>
      67             : #include <EnergyPlus/Fans.hh>
      68             : #include <EnergyPlus/FluidProperties.hh>
      69             : #include <EnergyPlus/General.hh>
      70             : #include <EnergyPlus/GeneralRoutines.hh>
      71             : #include <EnergyPlus/GlobalNames.hh>
      72             : #include <EnergyPlus/HVACFan.hh>
      73             : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      74             : #include <EnergyPlus/NodeInputManager.hh>
      75             : #include <EnergyPlus/OutputProcessor.hh>
      76             : #include <EnergyPlus/OutputReportPredefined.hh>
      77             : #include <EnergyPlus/PlantUtilities.hh>
      78             : #include <EnergyPlus/Psychrometrics.hh>
      79             : #include <EnergyPlus/UtilityRoutines.hh>
      80             : #include <EnergyPlus/WaterThermalTanks.hh>
      81             : #include <EnergyPlus/WaterToAirHeatPumpSimple.hh>
      82             : 
      83             : namespace EnergyPlus {
      84             : 
      85             : namespace WaterToAirHeatPumpSimple {
      86             : 
      87             :     // Module containing the Water to Air Heat Pump simulation routines
      88             : 
      89             :     // MODULE INFORMATION:
      90             :     //       AUTHOR         Arun Shenoy
      91             :     //       DATE WRITTEN   Nov 2003
      92             :     //       MODIFIED       Brent Griffith, Sept 2010 plant upgrades
      93             :     //       RE-ENGINEERED  Kenneth Tang (Jan 2005)
      94             : 
      95             :     // PURPOSE OF THIS MODULE:
      96             :     // To encapsulate the data and algorithms required to
      97             :     // manage the Water to Air Heat Pump Simple Component
      98             : 
      99             :     // METHODOLOGY EMPLOYED:
     100             : 
     101             :     // REFERENCES:
     102             :     // (1) Lash.T.A.,1992.Simulation and Analysis of a Water Loop Heat Pump System.
     103             :     // M.S. Thesis, University of Illinois at Urbana Champaign.
     104             :     // (2) Shenoy, Arun. 2004. Simulation, Modeling and Analysis of Water to Air Heat Pump.
     105             :     // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
     106             :     // Oklahoma State University. (downloadable from www.hvac.okstate.edu)
     107             :     // (3) Tang,C.C.. 2005. Modeling Packaged Heat Pumps in a Quasi-Steady
     108             :     // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
     109             :     // Oklahoma State University. (downloadable from www.hvac.okstate.edu)
     110             : 
     111             :     constexpr std::array<std::string_view, static_cast<int>(WatertoAirHP::Num)> WatertoAirHPNamesUC{"HEATING", "COOLING"};
     112             : 
     113    39376595 :     void SimWatertoAirHPSimple(EnergyPlusData &state,
     114             :                                std::string_view CompName,     // Coil Name
     115             :                                int &CompIndex,                // Index for Component name
     116             :                                Real64 const SensLoad,         // Sensible demand load [W]
     117             :                                Real64 const LatentLoad,       // Latent demand load [W]
     118             :                                int const CyclingScheme,       // Continuous fan OR cycling compressor
     119             :                                Real64 const RuntimeFrac,      // Compressor run time fraction  or
     120             :                                Real64 &MaxONOFFCyclesperHour, // Maximum cycling rate of heat pump [cycles/hr]
     121             :                                Real64 &HPTimeConstant,        // Heat pump time constant [s]
     122             :                                Real64 &FanDelayTime,          // Fan delay time, time delay for the HP's fan to
     123             :                                DataHVACGlobals::CompressorOperation const CompressorOp,
     124             :                                Real64 const PartLoadRatio,
     125             :                                bool const FirstHVACIteration,
     126             :                                Optional<Real64 const> OnOffAirFlowRat // ratio of comp on to comp off air flow rate
     127             :     )
     128             :     {
     129             : 
     130             :         //       AUTHOR         Arun Shenoy
     131             :         //       DATE WRITTEN   Nov 2003
     132             :         //       RE-ENGINEERED  Kenneth Tang (Jan 2005)
     133             : 
     134             :         // PURPOSE OF THIS SUBROUTINE:
     135             :         // This subroutine manages Simple Water to Air Heat Pump component simulation.
     136             : 
     137             :         // REFERENCES:
     138             :         // (1) Lash.T.A.,1992.Simulation and Analysis of a Water Loop Heat Pump System.
     139             :         // M.S. Thesis, University of Illinois at Urbana Champaign.
     140             :         // (2) Shenoy, Arun. 2004. Simulation, Modeling and Analysis of Water to Air Heat Pump.
     141             :         // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
     142             :         // Oklahoma State University. (downloadable from www.hvac.okstate.edu)
     143             :         // (3) Tang,C.C.. 2005. Modeling Packaged Heat Pumps in a Quasi-Steady
     144             :         // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
     145             :         // Oklahoma State University. (downloadable from www.hvac.okstate.edu)
     146             : 
     147             :         // percent on-time (on-time/cycle time)
     148             :         // shut off after compressor cycle off  [s]
     149             : 
     150             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     151             :         int HPNum;                // The WatertoAirHP that you are currently loading input into
     152             :         Real64 OnOffAirFlowRatio; // ratio of comp on to comp off air flow rate
     153             : 
     154             :         // Obtains and Allocates WatertoAirHP related parameters from input file
     155    39376595 :         if (state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag) { // First time subroutine has been entered
     156           0 :             GetSimpleWatertoAirHPInput(state);
     157           0 :             state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag = false;
     158             :         }
     159             : 
     160    39376595 :         if (CompIndex == 0) {
     161           0 :             HPNum = UtilityRoutines::FindItemInList(CompName, state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP);
     162           0 :             if (HPNum == 0) {
     163           0 :                 ShowFatalError(state, format("WaterToAirHPSimple not found= {}", CompName));
     164             :             }
     165           0 :             CompIndex = HPNum;
     166             :         } else {
     167    39376595 :             HPNum = CompIndex;
     168    39376595 :             if (HPNum > state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs || HPNum < 1) {
     169           0 :                 ShowFatalError(state,
     170           0 :                                format("SimWatertoAirHPSimple: Invalid CompIndex passed={}, Number of Water to Air HPs={}, WaterToAir HP name={}",
     171             :                                       HPNum,
     172           0 :                                       state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs,
     173           0 :                                       CompName));
     174             :             }
     175    39376595 :             if (!CompName.empty() && CompName != state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).Name) {
     176           0 :                 ShowFatalError(
     177             :                     state,
     178           0 :                     format("SimWatertoAirHPSimple: Invalid CompIndex passed={}, WaterToAir HP name={}, stored WaterToAir HP Name for that index={}",
     179             :                            HPNum,
     180             :                            CompName,
     181           0 :                            state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).Name));
     182             :             }
     183             :         }
     184             : 
     185    39376595 :         auto &simpleWAHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum));
     186             : 
     187    39376595 :         if (present(OnOffAirFlowRat)) {
     188           0 :             OnOffAirFlowRatio = OnOffAirFlowRat;
     189             :         } else {
     190    39376595 :             OnOffAirFlowRatio = 1.0;
     191             :         }
     192             : 
     193    39376595 :         if (simpleWAHP.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit) {
     194             :             // Cooling mode
     195    19688275 :             InitSimpleWatertoAirHP(state,
     196             :                                    HPNum,
     197             :                                    MaxONOFFCyclesperHour,
     198             :                                    HPTimeConstant,
     199             :                                    FanDelayTime,
     200             :                                    SensLoad,
     201             :                                    LatentLoad,
     202             :                                    CyclingScheme,
     203             :                                    OnOffAirFlowRatio,
     204             :                                    FirstHVACIteration);
     205    19688275 :             CalcHPCoolingSimple(state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, LatentLoad, CompressorOp, PartLoadRatio, OnOffAirFlowRatio);
     206    19688275 :             UpdateSimpleWatertoAirHP(state, HPNum);
     207    19688320 :         } else if (simpleWAHP.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit) {
     208             :             // Heating mode
     209    19688320 :             InitSimpleWatertoAirHP(state,
     210             :                                    HPNum,
     211             :                                    MaxONOFFCyclesperHour,
     212             :                                    HPTimeConstant,
     213             :                                    FanDelayTime,
     214             :                                    SensLoad,
     215             :                                    DataPrecisionGlobals::constant_zero,
     216             :                                    CyclingScheme,
     217             :                                    OnOffAirFlowRatio,
     218             :                                    FirstHVACIteration);
     219    19688320 :             CalcHPHeatingSimple(state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, CompressorOp, PartLoadRatio, OnOffAirFlowRatio);
     220    19688320 :             UpdateSimpleWatertoAirHP(state, HPNum);
     221             :         } else {
     222           0 :             ShowFatalError(state, "SimWatertoAirHPSimple: WatertoAir heatpump not in either HEATING or COOLING mode");
     223             :         }
     224    39376595 :     }
     225             : 
     226          17 :     void GetSimpleWatertoAirHPInput(EnergyPlusData &state)
     227             :     {
     228             : 
     229             :         // SUBROUTINE INFORMATION:
     230             :         //       AUTHOR         Arun Shenoy
     231             :         //       DATE WRITTEN   Nov 2003
     232             :         //       RE-ENGINEERED  Kenneth Tang (Jan 2005)
     233             : 
     234             :         // PURPOSE OF THIS SUBROUTINE:
     235             :         // Obtains input data for HPs and stores it in HP data structures
     236             : 
     237             :         // METHODOLOGY EMPLOYED:
     238             :         // Uses "Get" routines to read in data.
     239             : 
     240             :         // REFERENCES:
     241             :         // (1) Lash.T.A.,1992.Simulation and Analysis of a Water loop Heat Pump System.
     242             :         // M.S. Thesis, University of Illinois at Urbana Champaign.
     243             :         // (2) Shenoy, Arun. 2004. Simulation, Modeling and Analysis of Water to Air Heat Pump.
     244             :         // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
     245             :         // Oklahoma State University. (downloadable from www.hvac.okstate.edu)
     246             :         // (3) Tang,C.C.. 2005. Modeling Packaged Heat Pumps in a Quasi-Steady
     247             :         // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
     248             :         // Oklahoma State University. (downloadable from www.hvac.okstate.edu)
     249             : 
     250             :         // SUBROUTINE PARAMETER DEFINITIONS:
     251             :         static constexpr std::string_view RoutineName("GetSimpleWatertoAirHPInput: "); // include trailing blank space
     252             : 
     253             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     254             :         int HPNum;           // The Water to Air HP that you are currently loading input into
     255             :         int NumCool;         // Counter for cooling coil
     256             :         int NumHeat;         // Counter for heating coil
     257             :         int WatertoAirHPNum; // Counter
     258             :         int NumAlphas;       // Number of variables in String format
     259             :         int NumNums;         // Number of variables in Numeric format
     260             :         int NumParams;       // Total number of input fields
     261          17 :         int MaxNums(0);      // Maximum number of numeric input fields
     262          17 :         int MaxAlphas(0);    // Maximum number of alpha input fields
     263             :         int IOStat;
     264          17 :         bool ErrorsFound(false);         // If errors detected in input
     265          34 :         std::string CurrentModuleObject; // for ease in getting objects
     266          34 :         Array1D_string AlphArray;        // Alpha input items for object
     267          34 :         Array1D_string cAlphaFields;     // Alpha field names
     268          34 :         Array1D_string cNumericFields;   // Numeric field names
     269          34 :         Array1D<Real64> NumArray;        // Numeric input items for object
     270          34 :         Array1D_bool lAlphaBlanks;       // Logical array, alpha field input BLANK = .TRUE.
     271          34 :         Array1D_bool lNumericBlanks;     // Logical array, numeric field input BLANK = .TRUE.
     272             : 
     273          17 :         NumCool = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Coil:Cooling:WaterToAirHeatPump:EquationFit");
     274          17 :         NumHeat = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Coil:Heating:WaterToAirHeatPump:EquationFit");
     275          17 :         state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs = NumCool + NumHeat;
     276          17 :         HPNum = 0;
     277             : 
     278          17 :         if (state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs <= 0) {
     279           0 :             ShowSevereError(state, "No Equipment found in SimWatertoAirHPSimple");
     280           0 :             ErrorsFound = true;
     281             :         }
     282             : 
     283             :         // Allocate Arrays
     284          17 :         if (state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs > 0) {
     285          17 :             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP.allocate(state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs);
     286          17 :             state.dataWaterToAirHeatPumpSimple->SimpleHPTimeStepFlag.dimension(state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs, true);
     287          17 :             state.dataHeatBal->HeatReclaimSimple_WAHPCoil.allocate(state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs);
     288             :         }
     289             : 
     290          34 :         state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     291          17 :             state, "Coil:Cooling:WaterToAirHeatPump:EquationFit", NumParams, NumAlphas, NumNums);
     292          17 :         MaxNums = max(MaxNums, NumNums);
     293          17 :         MaxAlphas = max(MaxAlphas, NumAlphas);
     294          34 :         state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     295          17 :             state, "Coil:Heating:WaterToAirHeatPump:EquationFit", NumParams, NumAlphas, NumNums);
     296          17 :         MaxNums = max(MaxNums, NumNums);
     297          17 :         MaxAlphas = max(MaxAlphas, NumAlphas);
     298          17 :         AlphArray.allocate(MaxAlphas);
     299          17 :         cAlphaFields.allocate(MaxAlphas);
     300          17 :         lAlphaBlanks.dimension(MaxAlphas, true);
     301          17 :         cNumericFields.allocate(MaxNums);
     302          17 :         lNumericBlanks.dimension(MaxNums, true);
     303          17 :         NumArray.dimension(MaxNums, 0.0);
     304             : 
     305             :         // Get the data for cooling coil
     306          17 :         CurrentModuleObject = "Coil:Cooling:WaterToAirHeatPump:EquationFit";
     307             : 
     308         150 :         for (WatertoAirHPNum = 1; WatertoAirHPNum <= NumCool; ++WatertoAirHPNum) {
     309             : 
     310         133 :             ++HPNum;
     311         133 :             auto &simpleWAHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum));
     312         133 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     313             :                                                                      CurrentModuleObject,
     314             :                                                                      HPNum,
     315             :                                                                      AlphArray,
     316             :                                                                      NumAlphas,
     317             :                                                                      NumArray,
     318             :                                                                      NumNums,
     319             :                                                                      IOStat,
     320             :                                                                      lNumericBlanks,
     321             :                                                                      lAlphaBlanks,
     322             :                                                                      cAlphaFields,
     323             :                                                                      cNumericFields);
     324             :             // ErrorsFound will be set to True if problem was found, left untouched otherwise
     325         133 :             GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, format("{} Name", CurrentModuleObject));
     326         133 :             simpleWAHP.Name = AlphArray(1);
     327         133 :             simpleWAHP.WAHPType = WatertoAirHP::Cooling;
     328         133 :             simpleWAHP.WAHPPlantType = DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit;
     329         133 :             simpleWAHP.RatedAirVolFlowRate = NumArray(1);
     330         133 :             simpleWAHP.RatedWaterVolFlowRate = NumArray(2);
     331         133 :             simpleWAHP.RatedCapCoolTotal = NumArray(3);
     332         133 :             simpleWAHP.RatedCapCoolSens = NumArray(4);
     333         133 :             simpleWAHP.RatedCOPCoolAtRatedCdts = NumArray(5);
     334         133 :             simpleWAHP.RatedEntWaterTemp = NumArray(6);
     335         133 :             simpleWAHP.RatedEntAirDrybulbTemp = NumArray(7);
     336         133 :             simpleWAHP.RatedEntAirWetbulbTemp = NumArray(8);
     337         133 :             simpleWAHP.TotalCoolCapCurveIndex = Curve::GetCurveIndex(state, AlphArray(6)); // convert curve name to number
     338         133 :             simpleWAHP.SensCoolCapCurveIndex = Curve::GetCurveIndex(state, AlphArray(7));  // convert curve name to number
     339         133 :             simpleWAHP.CoolPowCurveIndex = Curve::GetCurveIndex(state, AlphArray(8));      // convert curve name to number
     340         133 :             if (simpleWAHP.TotalCoolCapCurveIndex == 0) {
     341           0 :                 if (lAlphaBlanks(6)) {
     342           0 :                     ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, simpleWAHP.Name));
     343           0 :                     ShowContinueError(state, format("...required {} is blank.", cAlphaFields(6)));
     344             :                 } else {
     345           0 :                     ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, simpleWAHP.Name));
     346           0 :                     ShowContinueError(state, format("...not found {}=\"{}\"", cAlphaFields(6), AlphArray(6)));
     347             :                 }
     348           0 :                 ErrorsFound = true;
     349             :             } else {
     350         133 :                 ErrorsFound |= Curve::CheckCurveDims(state,
     351             :                                                      simpleWAHP.TotalCoolCapCurveIndex,
     352             :                                                      {4},
     353             :                                                      RoutineName,
     354             :                                                      CurrentModuleObject,
     355             :                                                      simpleWAHP.Name,
     356         133 :                                                      "Total Cooling Capacity Curve Name");
     357             :             }
     358         133 :             if (simpleWAHP.SensCoolCapCurveIndex == 0) {
     359           0 :                 if (lAlphaBlanks(7)) {
     360           0 :                     ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, simpleWAHP.Name));
     361           0 :                     ShowContinueError(state, format("...required {} is blank.", cAlphaFields(7)));
     362             :                 } else {
     363           0 :                     ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, simpleWAHP.Name));
     364           0 :                     ShowContinueError(state, format("...not found {}=\"{}\"", cAlphaFields(7), AlphArray(7)));
     365             :                 }
     366           0 :                 ErrorsFound = true;
     367             :             } else {
     368         133 :                 ErrorsFound |= Curve::CheckCurveDims(state,
     369             :                                                      simpleWAHP.SensCoolCapCurveIndex,
     370             :                                                      {5},
     371             :                                                      RoutineName,
     372             :                                                      CurrentModuleObject,
     373             :                                                      simpleWAHP.Name,
     374         133 :                                                      "Sensible Cooling Capacity Curve Name");
     375             :             }
     376         133 :             if (simpleWAHP.CoolPowCurveIndex == 0) {
     377           0 :                 if (lAlphaBlanks(8)) {
     378           0 :                     ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, simpleWAHP.Name));
     379           0 :                     ShowContinueError(state, format("...required {} is blank.", cAlphaFields(8)));
     380             :                 } else {
     381           0 :                     ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, simpleWAHP.Name));
     382           0 :                     ShowContinueError(state, format("...not found {}=\"{}\"", cAlphaFields(8), AlphArray(8)));
     383             :                 }
     384           0 :                 ErrorsFound = true;
     385             :             } else {
     386         133 :                 ErrorsFound |= Curve::CheckCurveDims(state,
     387             :                                                      simpleWAHP.CoolPowCurveIndex,
     388             :                                                      {4},
     389             :                                                      RoutineName,
     390             :                                                      CurrentModuleObject,
     391             :                                                      simpleWAHP.Name,
     392         133 :                                                      "Cooling Power Consumption Curve Name");
     393             :             }
     394         133 :             CheckSimpleWAHPRatedCurvesOutputs(state, simpleWAHP.Name);
     395         133 :             simpleWAHP.Twet_Rated = NumArray(9);
     396         133 :             simpleWAHP.Gamma_Rated = NumArray(10);
     397         133 :             state.dataHeatBal->HeatReclaimSimple_WAHPCoil(WatertoAirHPNum).Name = simpleWAHP.Name;
     398         133 :             state.dataHeatBal->HeatReclaimSimple_WAHPCoil(WatertoAirHPNum).SourceType = CurrentModuleObject;
     399             : 
     400         266 :             simpleWAHP.WaterInletNodeNum = GetOnlySingleNode(state,
     401         133 :                                                              AlphArray(2),
     402             :                                                              ErrorsFound,
     403             :                                                              DataLoopNode::ConnectionObjectType::CoilCoolingWaterToAirHeatPumpEquationFit,
     404             :                                                              simpleWAHP.Name,
     405             :                                                              DataLoopNode::NodeFluidType::Water,
     406             :                                                              DataLoopNode::ConnectionType::Inlet,
     407             :                                                              NodeInputManager::CompFluidStream::Secondary,
     408         133 :                                                              DataLoopNode::ObjectIsNotParent);
     409         266 :             simpleWAHP.WaterOutletNodeNum = GetOnlySingleNode(state,
     410         133 :                                                               AlphArray(3),
     411             :                                                               ErrorsFound,
     412             :                                                               DataLoopNode::ConnectionObjectType::CoilCoolingWaterToAirHeatPumpEquationFit,
     413             :                                                               simpleWAHP.Name,
     414             :                                                               DataLoopNode::NodeFluidType::Water,
     415             :                                                               DataLoopNode::ConnectionType::Outlet,
     416             :                                                               NodeInputManager::CompFluidStream::Secondary,
     417         133 :                                                               DataLoopNode::ObjectIsNotParent);
     418         266 :             simpleWAHP.AirInletNodeNum = GetOnlySingleNode(state,
     419         133 :                                                            AlphArray(4),
     420             :                                                            ErrorsFound,
     421             :                                                            DataLoopNode::ConnectionObjectType::CoilCoolingWaterToAirHeatPumpEquationFit,
     422             :                                                            simpleWAHP.Name,
     423             :                                                            DataLoopNode::NodeFluidType::Air,
     424             :                                                            DataLoopNode::ConnectionType::Inlet,
     425             :                                                            NodeInputManager::CompFluidStream::Primary,
     426         133 :                                                            DataLoopNode::ObjectIsNotParent);
     427         266 :             simpleWAHP.AirOutletNodeNum = GetOnlySingleNode(state,
     428         133 :                                                             AlphArray(5),
     429             :                                                             ErrorsFound,
     430             :                                                             DataLoopNode::ConnectionObjectType::CoilCoolingWaterToAirHeatPumpEquationFit,
     431             :                                                             simpleWAHP.Name,
     432             :                                                             DataLoopNode::NodeFluidType::Air,
     433             :                                                             DataLoopNode::ConnectionType::Outlet,
     434             :                                                             NodeInputManager::CompFluidStream::Primary,
     435         133 :                                                             DataLoopNode::ObjectIsNotParent);
     436             : 
     437         133 :             BranchNodeConnections::TestCompSet(state, CurrentModuleObject, simpleWAHP.Name, AlphArray(2), AlphArray(3), "Water Nodes");
     438         133 :             BranchNodeConnections::TestCompSet(state, CurrentModuleObject, simpleWAHP.Name, AlphArray(4), AlphArray(5), "Air Nodes");
     439             : 
     440             :             // Setup Report variables for the cooling coil
     441             :             // CurrentModuleObject = "Coil:Cooling:WaterToAirHeatPump:EquationFit"
     442         266 :             SetupOutputVariable(state,
     443             :                                 "Cooling Coil Electricity Energy",
     444             :                                 OutputProcessor::Unit::J,
     445             :                                 simpleWAHP.Energy,
     446             :                                 OutputProcessor::SOVTimeStepType::System,
     447             :                                 OutputProcessor::SOVStoreType::Summed,
     448             :                                 simpleWAHP.Name,
     449             :                                 _,
     450             :                                 "Electricity",
     451             :                                 "Cooling",
     452             :                                 _,
     453         133 :                                 "System");
     454         266 :             SetupOutputVariable(state,
     455             :                                 "Cooling Coil Total Cooling Energy",
     456             :                                 OutputProcessor::Unit::J,
     457             :                                 simpleWAHP.EnergyLoadTotal,
     458             :                                 OutputProcessor::SOVTimeStepType::System,
     459             :                                 OutputProcessor::SOVStoreType::Summed,
     460             :                                 simpleWAHP.Name,
     461             :                                 _,
     462             :                                 "ENERGYTRANSFER",
     463             :                                 "COOLINGCOILS",
     464             :                                 _,
     465         133 :                                 "System");
     466         266 :             SetupOutputVariable(state,
     467             :                                 "Cooling Coil Sensible Cooling Energy",
     468             :                                 OutputProcessor::Unit::J,
     469             :                                 simpleWAHP.EnergySensible,
     470             :                                 OutputProcessor::SOVTimeStepType::System,
     471             :                                 OutputProcessor::SOVStoreType::Summed,
     472         133 :                                 simpleWAHP.Name);
     473         266 :             SetupOutputVariable(state,
     474             :                                 "Cooling Coil Latent Cooling Energy",
     475             :                                 OutputProcessor::Unit::J,
     476             :                                 simpleWAHP.EnergyLatent,
     477             :                                 OutputProcessor::SOVTimeStepType::System,
     478             :                                 OutputProcessor::SOVStoreType::Summed,
     479         133 :                                 simpleWAHP.Name);
     480         266 :             SetupOutputVariable(state,
     481             :                                 "Cooling Coil Source Side Heat Transfer Energy",
     482             :                                 OutputProcessor::Unit::J,
     483             :                                 simpleWAHP.EnergySource,
     484             :                                 OutputProcessor::SOVTimeStepType::System,
     485             :                                 OutputProcessor::SOVStoreType::Summed,
     486             :                                 simpleWAHP.Name,
     487             :                                 _,
     488             :                                 "PLANTLOOPCOOLINGDEMAND",
     489             :                                 "COOLINGCOILS",
     490             :                                 _,
     491         133 :                                 "System");
     492             : 
     493             :             // create predefined report entries
     494         133 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilType, simpleWAHP.Name, CurrentModuleObject);
     495         266 :             OutputReportPredefined::PreDefTableEntry(
     496         133 :                 state, state.dataOutRptPredefined->pdchCoolCoilTotCap, simpleWAHP.Name, simpleWAHP.RatedCapCoolTotal);
     497         266 :             OutputReportPredefined::PreDefTableEntry(
     498         133 :                 state, state.dataOutRptPredefined->pdchCoolCoilSensCap, simpleWAHP.Name, simpleWAHP.RatedCapCoolSens);
     499         399 :             OutputReportPredefined::PreDefTableEntry(
     500         266 :                 state, state.dataOutRptPredefined->pdchCoolCoilLatCap, simpleWAHP.Name, simpleWAHP.RatedCapCoolTotal - simpleWAHP.RatedCapCoolSens);
     501         399 :             OutputReportPredefined::PreDefTableEntry(
     502         266 :                 state, state.dataOutRptPredefined->pdchCoolCoilSHR, simpleWAHP.Name, simpleWAHP.RatedCapCoolSens / simpleWAHP.RatedCapCoolTotal);
     503         399 :             OutputReportPredefined::PreDefTableEntry(
     504         266 :                 state, state.dataOutRptPredefined->pdchCoolCoilNomEff, simpleWAHP.Name, simpleWAHP.RatedPowerCool / simpleWAHP.RatedCapCoolTotal);
     505             : 
     506         133 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchWAHPType, simpleWAHP.Name, CurrentModuleObject);
     507             :         }
     508             : 
     509             :         // Get the data for heating coil
     510          17 :         CurrentModuleObject = "Coil:Heating:WaterToAirHeatPump:EquationFit";
     511             : 
     512         150 :         for (WatertoAirHPNum = 1; WatertoAirHPNum <= NumHeat; ++WatertoAirHPNum) {
     513             : 
     514         133 :             ++HPNum;
     515         133 :             auto &simpleWAHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum));
     516         133 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     517             :                                                                      CurrentModuleObject,
     518             :                                                                      WatertoAirHPNum,
     519             :                                                                      AlphArray,
     520             :                                                                      NumAlphas,
     521             :                                                                      NumArray,
     522             :                                                                      NumNums,
     523             :                                                                      IOStat,
     524             :                                                                      lNumericBlanks,
     525             :                                                                      lAlphaBlanks,
     526             :                                                                      cAlphaFields,
     527             :                                                                      cNumericFields);
     528             :             // ErrorsFound will be set to True if problem was found, left untouched otherwise
     529         133 :             GlobalNames::VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, format("{} Name", CurrentModuleObject));
     530         133 :             simpleWAHP.Name = AlphArray(1);
     531         133 :             simpleWAHP.WAHPType = WatertoAirHP::Heating;
     532         133 :             simpleWAHP.WAHPPlantType = DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit;
     533         133 :             simpleWAHP.RatedAirVolFlowRate = NumArray(1);
     534         133 :             simpleWAHP.RatedWaterVolFlowRate = NumArray(2);
     535         133 :             simpleWAHP.RatedCapHeat = NumArray(3);
     536         133 :             simpleWAHP.RatedCOPHeatAtRatedCdts = NumArray(4);
     537         133 :             simpleWAHP.RatedEntWaterTemp = NumArray(5);
     538         133 :             simpleWAHP.RatedEntAirDrybulbTemp = NumArray(6);
     539         133 :             simpleWAHP.RatioRatedHeatRatedTotCoolCap = NumArray(7);
     540         133 :             simpleWAHP.HeatCapCurveIndex = Curve::GetCurveIndex(state, AlphArray(6)); // convert curve name to number
     541         133 :             simpleWAHP.HeatPowCurveIndex = Curve::GetCurveIndex(state, AlphArray(7)); // convert curve name to number
     542         133 :             if (simpleWAHP.HeatCapCurveIndex == 0) {
     543           0 :                 if (lAlphaBlanks(6)) {
     544           0 :                     ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, simpleWAHP.Name));
     545           0 :                     ShowContinueError(state, format("...required {} is blank.", cAlphaFields(6)));
     546             :                 } else {
     547           0 :                     ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, simpleWAHP.Name));
     548           0 :                     ShowContinueError(state, format("...not found {}=\"{}\"", cAlphaFields(6), AlphArray(6)));
     549             :                 }
     550           0 :                 ErrorsFound = true;
     551             :             } else {
     552         133 :                 ErrorsFound |= Curve::CheckCurveDims(
     553         133 :                     state, simpleWAHP.HeatCapCurveIndex, {4}, RoutineName, CurrentModuleObject, simpleWAHP.Name, "Heating Capacity Curve Name");
     554             :             }
     555         133 :             if (simpleWAHP.HeatPowCurveIndex == 0) {
     556           0 :                 if (lAlphaBlanks(7)) {
     557           0 :                     ShowSevereError(state, format("{}{}=\"{}\", missing", RoutineName, CurrentModuleObject, simpleWAHP.Name));
     558           0 :                     ShowContinueError(state, format("...required {} is blank.", cAlphaFields(7)));
     559             :                 } else {
     560           0 :                     ShowSevereError(state, format("{}{}=\"{}\", invalid", RoutineName, CurrentModuleObject, simpleWAHP.Name));
     561           0 :                     ShowContinueError(state, format("...not found {}=\"{}\"", cAlphaFields(7), AlphArray(7)));
     562             :                 }
     563           0 :                 ErrorsFound = true;
     564             :             } else {
     565         133 :                 ErrorsFound |= Curve::CheckCurveDims(state,
     566             :                                                      simpleWAHP.HeatPowCurveIndex,
     567             :                                                      {4},
     568             :                                                      RoutineName,
     569             :                                                      CurrentModuleObject,
     570             :                                                      simpleWAHP.Name,
     571         133 :                                                      "Heating Power Consumption Curve Name");
     572             :             }
     573         133 :             CheckSimpleWAHPRatedCurvesOutputs(state, simpleWAHP.Name);
     574         266 :             simpleWAHP.WaterInletNodeNum = GetOnlySingleNode(state,
     575         133 :                                                              AlphArray(2),
     576             :                                                              ErrorsFound,
     577             :                                                              DataLoopNode::ConnectionObjectType::CoilHeatingWaterToAirHeatPumpEquationFit,
     578             :                                                              simpleWAHP.Name,
     579             :                                                              DataLoopNode::NodeFluidType::Water,
     580             :                                                              DataLoopNode::ConnectionType::Inlet,
     581             :                                                              NodeInputManager::CompFluidStream::Secondary,
     582         133 :                                                              DataLoopNode::ObjectIsNotParent);
     583         266 :             simpleWAHP.WaterOutletNodeNum = GetOnlySingleNode(state,
     584         133 :                                                               AlphArray(3),
     585             :                                                               ErrorsFound,
     586             :                                                               DataLoopNode::ConnectionObjectType::CoilHeatingWaterToAirHeatPumpEquationFit,
     587             :                                                               simpleWAHP.Name,
     588             :                                                               DataLoopNode::NodeFluidType::Water,
     589             :                                                               DataLoopNode::ConnectionType::Outlet,
     590             :                                                               NodeInputManager::CompFluidStream::Secondary,
     591         133 :                                                               DataLoopNode::ObjectIsNotParent);
     592         266 :             simpleWAHP.AirInletNodeNum = GetOnlySingleNode(state,
     593         133 :                                                            AlphArray(4),
     594             :                                                            ErrorsFound,
     595             :                                                            DataLoopNode::ConnectionObjectType::CoilHeatingWaterToAirHeatPumpEquationFit,
     596             :                                                            simpleWAHP.Name,
     597             :                                                            DataLoopNode::NodeFluidType::Air,
     598             :                                                            DataLoopNode::ConnectionType::Inlet,
     599             :                                                            NodeInputManager::CompFluidStream::Primary,
     600         133 :                                                            DataLoopNode::ObjectIsNotParent);
     601         266 :             simpleWAHP.AirOutletNodeNum = GetOnlySingleNode(state,
     602         133 :                                                             AlphArray(5),
     603             :                                                             ErrorsFound,
     604             :                                                             DataLoopNode::ConnectionObjectType::CoilHeatingWaterToAirHeatPumpEquationFit,
     605             :                                                             simpleWAHP.Name,
     606             :                                                             DataLoopNode::NodeFluidType::Air,
     607             :                                                             DataLoopNode::ConnectionType::Outlet,
     608             :                                                             NodeInputManager::CompFluidStream::Primary,
     609         133 :                                                             DataLoopNode::ObjectIsNotParent);
     610             : 
     611         133 :             BranchNodeConnections::TestCompSet(state, CurrentModuleObject, simpleWAHP.Name, AlphArray(2), AlphArray(3), "Water Nodes");
     612         133 :             BranchNodeConnections::TestCompSet(state, CurrentModuleObject, simpleWAHP.Name, AlphArray(4), AlphArray(5), "Air Nodes");
     613             : 
     614             :             // CurrentModuleObject = "Coil:Cooling:WaterToAirHeatPump:EquationFit"
     615         266 :             SetupOutputVariable(state,
     616             :                                 "Heating Coil Electricity Energy",
     617             :                                 OutputProcessor::Unit::J,
     618             :                                 simpleWAHP.Energy,
     619             :                                 OutputProcessor::SOVTimeStepType::System,
     620             :                                 OutputProcessor::SOVStoreType::Summed,
     621             :                                 simpleWAHP.Name,
     622             :                                 _,
     623             :                                 "Electricity",
     624             :                                 "Heating",
     625             :                                 _,
     626         133 :                                 "System");
     627         266 :             SetupOutputVariable(state,
     628             :                                 "Heating Coil Heating Energy",
     629             :                                 OutputProcessor::Unit::J,
     630             :                                 simpleWAHP.EnergyLoadTotal,
     631             :                                 OutputProcessor::SOVTimeStepType::System,
     632             :                                 OutputProcessor::SOVStoreType::Summed,
     633             :                                 simpleWAHP.Name,
     634             :                                 _,
     635             :                                 "ENERGYTRANSFER",
     636             :                                 "HEATINGCOILS",
     637             :                                 _,
     638         133 :                                 "System");
     639         266 :             SetupOutputVariable(state,
     640             :                                 "Heating Coil Source Side Heat Transfer Energy",
     641             :                                 OutputProcessor::Unit::J,
     642             :                                 simpleWAHP.EnergySource,
     643             :                                 OutputProcessor::SOVTimeStepType::System,
     644             :                                 OutputProcessor::SOVStoreType::Summed,
     645             :                                 simpleWAHP.Name,
     646             :                                 _,
     647             :                                 "PLANTLOOPHEATINGDEMAND",
     648             :                                 "HEATINGCOILS",
     649             :                                 _,
     650         133 :                                 "System");
     651             : 
     652             :             // create predefined report entries
     653         133 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilType, simpleWAHP.Name, CurrentModuleObject);
     654         133 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomCap, simpleWAHP.Name, simpleWAHP.RatedCapHeat);
     655         399 :             OutputReportPredefined::PreDefTableEntry(
     656         266 :                 state, state.dataOutRptPredefined->pdchHeatCoilNomEff, simpleWAHP.Name, simpleWAHP.RatedPowerHeat / simpleWAHP.RatedCapHeat);
     657             : 
     658         133 :             OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchWAHPType, simpleWAHP.Name, CurrentModuleObject);
     659             :         }
     660             : 
     661          17 :         AlphArray.deallocate();
     662          17 :         cAlphaFields.deallocate();
     663          17 :         lAlphaBlanks.deallocate();
     664          17 :         cNumericFields.deallocate();
     665          17 :         lNumericBlanks.deallocate();
     666          17 :         NumArray.deallocate();
     667             : 
     668          17 :         if (ErrorsFound) {
     669           0 :             ShowFatalError(state, format("{} Errors found getting input. Program terminates.", RoutineName));
     670             :         }
     671             : 
     672         283 :         for (HPNum = 1; HPNum <= state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs; ++HPNum) {
     673         266 :             auto &simpleWAHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum));
     674         266 :             if (simpleWAHP.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit) {
     675             :                 // COOLING COIL  Setup Report variables for the Heat Pump
     676         266 :                 SetupOutputVariable(state,
     677             :                                     "Cooling Coil Electricity Rate",
     678             :                                     OutputProcessor::Unit::W,
     679             :                                     simpleWAHP.Power,
     680             :                                     OutputProcessor::SOVTimeStepType::System,
     681             :                                     OutputProcessor::SOVStoreType::Average,
     682         133 :                                     simpleWAHP.Name);
     683         266 :                 SetupOutputVariable(state,
     684             :                                     "Cooling Coil Total Cooling Rate",
     685             :                                     OutputProcessor::Unit::W,
     686             :                                     simpleWAHP.QLoadTotal,
     687             :                                     OutputProcessor::SOVTimeStepType::System,
     688             :                                     OutputProcessor::SOVStoreType::Average,
     689         133 :                                     simpleWAHP.Name);
     690         266 :                 SetupOutputVariable(state,
     691             :                                     "Cooling Coil Sensible Cooling Rate",
     692             :                                     OutputProcessor::Unit::W,
     693             :                                     simpleWAHP.QSensible,
     694             :                                     OutputProcessor::SOVTimeStepType::System,
     695             :                                     OutputProcessor::SOVStoreType::Average,
     696         133 :                                     simpleWAHP.Name);
     697         266 :                 SetupOutputVariable(state,
     698             :                                     "Cooling Coil Latent Cooling Rate",
     699             :                                     OutputProcessor::Unit::W,
     700             :                                     simpleWAHP.QLatent,
     701             :                                     OutputProcessor::SOVTimeStepType::System,
     702             :                                     OutputProcessor::SOVStoreType::Average,
     703         133 :                                     simpleWAHP.Name);
     704         266 :                 SetupOutputVariable(state,
     705             :                                     "Cooling Coil Source Side Heat Transfer Rate",
     706             :                                     OutputProcessor::Unit::W,
     707             :                                     simpleWAHP.QSource,
     708             :                                     OutputProcessor::SOVTimeStepType::System,
     709             :                                     OutputProcessor::SOVStoreType::Average,
     710         133 :                                     simpleWAHP.Name);
     711         266 :                 SetupOutputVariable(state,
     712             :                                     "Cooling Coil Part Load Ratio",
     713             :                                     OutputProcessor::Unit::None,
     714             :                                     simpleWAHP.PartLoadRatio,
     715             :                                     OutputProcessor::SOVTimeStepType::System,
     716             :                                     OutputProcessor::SOVStoreType::Average,
     717         133 :                                     simpleWAHP.Name);
     718         266 :                 SetupOutputVariable(state,
     719             :                                     "Cooling Coil Runtime Fraction",
     720             :                                     OutputProcessor::Unit::None,
     721             :                                     simpleWAHP.RunFrac,
     722             :                                     OutputProcessor::SOVTimeStepType::System,
     723             :                                     OutputProcessor::SOVStoreType::Average,
     724         133 :                                     simpleWAHP.Name);
     725             : 
     726         266 :                 SetupOutputVariable(state,
     727             :                                     "Cooling Coil Air Mass Flow Rate",
     728             :                                     OutputProcessor::Unit::kg_s,
     729             :                                     simpleWAHP.AirMassFlowRate,
     730             :                                     OutputProcessor::SOVTimeStepType::System,
     731             :                                     OutputProcessor::SOVStoreType::Average,
     732         133 :                                     simpleWAHP.Name);
     733         266 :                 SetupOutputVariable(state,
     734             :                                     "Cooling Coil Air Inlet Temperature",
     735             :                                     OutputProcessor::Unit::C,
     736             :                                     simpleWAHP.InletAirDBTemp,
     737             :                                     OutputProcessor::SOVTimeStepType::System,
     738             :                                     OutputProcessor::SOVStoreType::Average,
     739         133 :                                     simpleWAHP.Name);
     740         266 :                 SetupOutputVariable(state,
     741             :                                     "Cooling Coil Air Inlet Humidity Ratio",
     742             :                                     OutputProcessor::Unit::kgWater_kgDryAir,
     743             :                                     simpleWAHP.InletAirHumRat,
     744             :                                     OutputProcessor::SOVTimeStepType::System,
     745             :                                     OutputProcessor::SOVStoreType::Average,
     746         133 :                                     simpleWAHP.Name);
     747         266 :                 SetupOutputVariable(state,
     748             :                                     "Cooling Coil Air Outlet Temperature",
     749             :                                     OutputProcessor::Unit::C,
     750             :                                     simpleWAHP.OutletAirDBTemp,
     751             :                                     OutputProcessor::SOVTimeStepType::System,
     752             :                                     OutputProcessor::SOVStoreType::Average,
     753         133 :                                     simpleWAHP.Name);
     754         266 :                 SetupOutputVariable(state,
     755             :                                     "Cooling Coil Air Outlet Humidity Ratio",
     756             :                                     OutputProcessor::Unit::kgWater_kgDryAir,
     757             :                                     simpleWAHP.OutletAirHumRat,
     758             :                                     OutputProcessor::SOVTimeStepType::System,
     759             :                                     OutputProcessor::SOVStoreType::Average,
     760         133 :                                     simpleWAHP.Name);
     761         266 :                 SetupOutputVariable(state,
     762             :                                     "Cooling Coil Source Side Mass Flow Rate",
     763             :                                     OutputProcessor::Unit::kg_s,
     764             :                                     simpleWAHP.WaterMassFlowRate,
     765             :                                     OutputProcessor::SOVTimeStepType::System,
     766             :                                     OutputProcessor::SOVStoreType::Average,
     767         133 :                                     simpleWAHP.Name);
     768         266 :                 SetupOutputVariable(state,
     769             :                                     "Cooling Coil Source Side Inlet Temperature",
     770             :                                     OutputProcessor::Unit::C,
     771             :                                     simpleWAHP.InletWaterTemp,
     772             :                                     OutputProcessor::SOVTimeStepType::System,
     773             :                                     OutputProcessor::SOVStoreType::Average,
     774         133 :                                     simpleWAHP.Name);
     775         266 :                 SetupOutputVariable(state,
     776             :                                     "Cooling Coil Source Side Outlet Temperature",
     777             :                                     OutputProcessor::Unit::C,
     778             :                                     simpleWAHP.OutletWaterTemp,
     779             :                                     OutputProcessor::SOVTimeStepType::System,
     780             :                                     OutputProcessor::SOVStoreType::Average,
     781         133 :                                     simpleWAHP.Name);
     782             : 
     783         133 :             } else if (simpleWAHP.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit) {
     784             :                 // HEATING COIL Setup Report variables for the Heat Pump
     785         266 :                 SetupOutputVariable(state,
     786             :                                     "Heating Coil Electricity Rate",
     787             :                                     OutputProcessor::Unit::W,
     788             :                                     simpleWAHP.Power,
     789             :                                     OutputProcessor::SOVTimeStepType::System,
     790             :                                     OutputProcessor::SOVStoreType::Average,
     791         133 :                                     simpleWAHP.Name);
     792         266 :                 SetupOutputVariable(state,
     793             :                                     "Heating Coil Heating Rate",
     794             :                                     OutputProcessor::Unit::W,
     795             :                                     simpleWAHP.QLoadTotal,
     796             :                                     OutputProcessor::SOVTimeStepType::System,
     797             :                                     OutputProcessor::SOVStoreType::Average,
     798         133 :                                     simpleWAHP.Name);
     799         266 :                 SetupOutputVariable(state,
     800             :                                     "Heating Coil Sensible Heating Rate",
     801             :                                     OutputProcessor::Unit::W,
     802             :                                     simpleWAHP.QSensible,
     803             :                                     OutputProcessor::SOVTimeStepType::System,
     804             :                                     OutputProcessor::SOVStoreType::Average,
     805         133 :                                     simpleWAHP.Name);
     806             : 
     807         266 :                 SetupOutputVariable(state,
     808             :                                     "Heating Coil Source Side Heat Transfer Rate",
     809             :                                     OutputProcessor::Unit::W,
     810             :                                     simpleWAHP.QSource,
     811             :                                     OutputProcessor::SOVTimeStepType::System,
     812             :                                     OutputProcessor::SOVStoreType::Average,
     813         133 :                                     simpleWAHP.Name);
     814         266 :                 SetupOutputVariable(state,
     815             :                                     "Heating Coil Part Load Ratio",
     816             :                                     OutputProcessor::Unit::None,
     817             :                                     simpleWAHP.PartLoadRatio,
     818             :                                     OutputProcessor::SOVTimeStepType::System,
     819             :                                     OutputProcessor::SOVStoreType::Average,
     820         133 :                                     simpleWAHP.Name);
     821         266 :                 SetupOutputVariable(state,
     822             :                                     "Heating Coil Runtime Fraction",
     823             :                                     OutputProcessor::Unit::None,
     824             :                                     simpleWAHP.RunFrac,
     825             :                                     OutputProcessor::SOVTimeStepType::System,
     826             :                                     OutputProcessor::SOVStoreType::Average,
     827         133 :                                     simpleWAHP.Name);
     828             : 
     829         266 :                 SetupOutputVariable(state,
     830             :                                     "Heating Coil Air Mass Flow Rate",
     831             :                                     OutputProcessor::Unit::kg_s,
     832             :                                     simpleWAHP.AirMassFlowRate,
     833             :                                     OutputProcessor::SOVTimeStepType::System,
     834             :                                     OutputProcessor::SOVStoreType::Average,
     835         133 :                                     simpleWAHP.Name);
     836         266 :                 SetupOutputVariable(state,
     837             :                                     "Heating Coil Air Inlet Temperature",
     838             :                                     OutputProcessor::Unit::C,
     839             :                                     simpleWAHP.InletAirDBTemp,
     840             :                                     OutputProcessor::SOVTimeStepType::System,
     841             :                                     OutputProcessor::SOVStoreType::Average,
     842         133 :                                     simpleWAHP.Name);
     843         266 :                 SetupOutputVariable(state,
     844             :                                     "Heating Coil Air Inlet Humidity Ratio",
     845             :                                     OutputProcessor::Unit::kgWater_kgDryAir,
     846             :                                     simpleWAHP.InletAirHumRat,
     847             :                                     OutputProcessor::SOVTimeStepType::System,
     848             :                                     OutputProcessor::SOVStoreType::Average,
     849         133 :                                     simpleWAHP.Name);
     850         266 :                 SetupOutputVariable(state,
     851             :                                     "Heating Coil Air Outlet Temperature",
     852             :                                     OutputProcessor::Unit::C,
     853             :                                     simpleWAHP.OutletAirDBTemp,
     854             :                                     OutputProcessor::SOVTimeStepType::System,
     855             :                                     OutputProcessor::SOVStoreType::Average,
     856         133 :                                     simpleWAHP.Name);
     857         266 :                 SetupOutputVariable(state,
     858             :                                     "Heating Coil Air Outlet Humidity Ratio",
     859             :                                     OutputProcessor::Unit::kgWater_kgDryAir,
     860             :                                     simpleWAHP.OutletAirHumRat,
     861             :                                     OutputProcessor::SOVTimeStepType::System,
     862             :                                     OutputProcessor::SOVStoreType::Average,
     863         133 :                                     simpleWAHP.Name);
     864         266 :                 SetupOutputVariable(state,
     865             :                                     "Heating Coil Source Side Mass Flow Rate",
     866             :                                     OutputProcessor::Unit::kg_s,
     867             :                                     simpleWAHP.WaterMassFlowRate,
     868             :                                     OutputProcessor::SOVTimeStepType::System,
     869             :                                     OutputProcessor::SOVStoreType::Average,
     870         133 :                                     simpleWAHP.Name);
     871         266 :                 SetupOutputVariable(state,
     872             :                                     "Heating Coil Source Side Inlet Temperature",
     873             :                                     OutputProcessor::Unit::C,
     874             :                                     simpleWAHP.InletWaterTemp,
     875             :                                     OutputProcessor::SOVTimeStepType::System,
     876             :                                     OutputProcessor::SOVStoreType::Average,
     877         133 :                                     simpleWAHP.Name);
     878         266 :                 SetupOutputVariable(state,
     879             :                                     "Heating Coil Source Side Outlet Temperature",
     880             :                                     OutputProcessor::Unit::C,
     881             :                                     simpleWAHP.OutletWaterTemp,
     882             :                                     OutputProcessor::SOVTimeStepType::System,
     883             :                                     OutputProcessor::SOVStoreType::Average,
     884         133 :                                     simpleWAHP.Name);
     885             :             }
     886             :         }
     887          17 :     }
     888             : 
     889             :     // Beginning Initialization Section of the Module
     890             :     //******************************************************************************
     891             : 
     892    39376595 :     void InitSimpleWatertoAirHP(EnergyPlusData &state,
     893             :                                 int const HPNum,                                 // Current HPNum under simulation
     894             :                                 Real64 const MaxONOFFCyclesperHour,              // Maximum cycling rate of heat pump [cycles/hr]
     895             :                                 Real64 const HPTimeConstant,                     // Heat pump time constant [s]
     896             :                                 Real64 const FanDelayTime,                       // Fan delay time, time delay for the HP's fan to
     897             :                                 Real64 const SensLoad,                           // Control zone sensible load[W]
     898             :                                 Real64 const LatentLoad,                         // Control zone latent load[W]
     899             :                                 [[maybe_unused]] int const CyclingScheme,        // fan operating mode
     900             :                                 [[maybe_unused]] Real64 const OnOffAirFlowRatio, // ratio of compressor on flow to average flow over time step
     901             :                                 bool const FirstHVACIteration                    // Iteration flag
     902             :     )
     903             :     {
     904             : 
     905             :         // SUBROUTINE INFORMATION:
     906             :         //       AUTHOR         Arun Shenoy
     907             :         //       DATE WRITTEN   Nov 2003
     908             :         //       RE-ENGINEERED  Kenneth Tang (Jan 2005)
     909             : 
     910             :         // PURPOSE OF THIS SUBROUTINE:
     911             :         // This subroutine is for initializations of the Simple Water to Air HP Components.
     912             : 
     913             :         // METHODOLOGY EMPLOYED:
     914             :         // Uses the status flags to trigger initializations.
     915             : 
     916             :         // SUBROUTINE PARAMETER DEFINITIONS:
     917             :         static constexpr std::string_view RoutineName("InitSimpleWatertoAirHP");
     918             : 
     919             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     920             :         int AirInletNode;            // Node Number of the air inlet
     921             :         int WaterInletNode;          // Node Number of the Water inlet
     922             :         Real64 RatedAirMassFlowRate; // coil rated air mass flow rates
     923             :         Real64 rho;                  // local fluid density
     924             :         bool errFlag;
     925             : 
     926    39376595 :         if (state.dataWaterToAirHeatPumpSimple->MyOneTimeFlag) {
     927             :             // initialize the environment and sizing flags
     928          17 :             state.dataWaterToAirHeatPumpSimple->MySizeFlag.allocate(state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs);
     929          17 :             state.dataWaterToAirHeatPumpSimple->MyEnvrnFlag.allocate(state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs);
     930          17 :             state.dataWaterToAirHeatPumpSimple->MyPlantScanFlag.allocate(state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs);
     931          17 :             state.dataWaterToAirHeatPumpSimple->MySizeFlag = true;
     932          17 :             state.dataWaterToAirHeatPumpSimple->MyEnvrnFlag = true;
     933          17 :             state.dataWaterToAirHeatPumpSimple->MyPlantScanFlag = true;
     934          17 :             state.dataWaterToAirHeatPumpSimple->MyOneTimeFlag = false;
     935             :         }
     936             : 
     937    39376595 :         auto &simpleWatertoAirHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum));
     938             : 
     939    39376595 :         if (state.dataWaterToAirHeatPumpSimple->MyPlantScanFlag(HPNum) && allocated(state.dataPlnt->PlantLoop)) {
     940         266 :             errFlag = false;
     941         266 :             PlantUtilities::ScanPlantLoopsForObject(
     942             :                 state, simpleWatertoAirHP.Name, simpleWatertoAirHP.WAHPPlantType, simpleWatertoAirHP.plantLoc, errFlag, _, _, _, _, _);
     943         266 :             if (errFlag) {
     944           0 :                 ShowFatalError(state, "InitSimpleWatertoAirHP: Program terminated for previous conditions.");
     945             :             }
     946         266 :             state.dataWaterToAirHeatPumpSimple->MyPlantScanFlag(HPNum) = false;
     947             :         }
     948             : 
     949    39376595 :         if (state.dataWaterToAirHeatPumpSimple->MySizeFlag(HPNum)) {
     950         319 :             if (!state.dataGlobal->SysSizingCalc && !state.dataWaterToAirHeatPumpSimple->MyPlantScanFlag(HPNum)) {
     951             :                 // do the sizing once.
     952         266 :                 SizeHVACWaterToAir(state, HPNum);
     953         266 :                 state.dataWaterToAirHeatPumpSimple->MySizeFlag(HPNum) = false;
     954             :             }
     955             :         }
     956             : 
     957    39376595 :         if (FirstHVACIteration) {
     958     1180521 :             if (state.dataWaterToAirHeatPumpSimple->SimpleHPTimeStepFlag(HPNum)) {
     959      285359 :                 if (simpleWatertoAirHP.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit) {
     960      285359 :                     if (simpleWatertoAirHP.CompanionHeatingCoilNum > 0) {
     961      285359 :                         if (simpleWatertoAirHP.WaterFlowMode) {
     962      156015 :                             simpleWatertoAirHP.LastOperatingMode = DataHVACGlobals::Cooling;
     963      156015 :                             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum).LastOperatingMode =
     964             :                                 DataHVACGlobals::Cooling;
     965      129344 :                         } else if (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum).WaterFlowMode) {
     966       73900 :                             simpleWatertoAirHP.LastOperatingMode = DataHVACGlobals::Heating;
     967       73900 :                             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum).LastOperatingMode =
     968             :                                 DataHVACGlobals::Heating;
     969             :                         }
     970      285359 :                         state.dataWaterToAirHeatPumpSimple->SimpleHPTimeStepFlag(simpleWatertoAirHP.CompanionHeatingCoilNum) = false;
     971             :                     } else {
     972           0 :                         if (simpleWatertoAirHP.WaterFlowMode) {
     973           0 :                             simpleWatertoAirHP.LastOperatingMode = DataHVACGlobals::Cooling;
     974             :                         }
     975             :                     }
     976      285359 :                     state.dataWaterToAirHeatPumpSimple->SimpleHPTimeStepFlag(HPNum) = false;
     977             :                 } else {
     978             :                     // it is a heating coil
     979           0 :                     if (simpleWatertoAirHP.CompanionCoolingCoilNum > 0) {
     980           0 :                         if (simpleWatertoAirHP.WaterFlowMode) {
     981           0 :                             simpleWatertoAirHP.LastOperatingMode = DataHVACGlobals::Heating;
     982           0 :                             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum).LastOperatingMode =
     983             :                                 DataHVACGlobals::Heating;
     984           0 :                         } else if (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum).WaterFlowMode) {
     985           0 :                             simpleWatertoAirHP.LastOperatingMode = DataHVACGlobals::Cooling;
     986           0 :                             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum).LastOperatingMode =
     987             :                                 DataHVACGlobals::Cooling;
     988             :                         }
     989           0 :                         state.dataWaterToAirHeatPumpSimple->SimpleHPTimeStepFlag(simpleWatertoAirHP.CompanionCoolingCoilNum) = false;
     990             :                     } else {
     991           0 :                         if (simpleWatertoAirHP.WaterFlowMode) {
     992           0 :                             simpleWatertoAirHP.LastOperatingMode = DataHVACGlobals::Heating;
     993             :                         }
     994             :                     }
     995           0 :                     state.dataWaterToAirHeatPumpSimple->SimpleHPTimeStepFlag(HPNum) = false;
     996             :                 }
     997             :             }
     998             :         } else {
     999    38196074 :             state.dataWaterToAirHeatPumpSimple->SimpleHPTimeStepFlag(HPNum) = true;
    1000    38196074 :             if (simpleWatertoAirHP.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit) {
    1001    19098037 :                 if (simpleWatertoAirHP.CompanionHeatingCoilNum > 0)
    1002    19098037 :                     state.dataWaterToAirHeatPumpSimple->SimpleHPTimeStepFlag(simpleWatertoAirHP.CompanionHeatingCoilNum) = true;
    1003             :             } else {
    1004    19098037 :                 if (simpleWatertoAirHP.CompanionCoolingCoilNum > 0)
    1005    19098037 :                     state.dataWaterToAirHeatPumpSimple->SimpleHPTimeStepFlag(simpleWatertoAirHP.CompanionCoolingCoilNum) = true;
    1006             :             }
    1007             :         }
    1008             : 
    1009             :         // Do the Begin Environment initializations
    1010    39376595 :         if (state.dataGlobal->BeginEnvrnFlag) {
    1011             : 
    1012       71528 :             if (state.dataWaterToAirHeatPumpSimple->MyEnvrnFlag(HPNum) && !state.dataWaterToAirHeatPumpSimple->MyPlantScanFlag(HPNum)) {
    1013             : 
    1014             :                 // Do the initializations to start simulation
    1015             : 
    1016        1776 :                 AirInletNode = simpleWatertoAirHP.AirInletNodeNum;
    1017        1776 :                 WaterInletNode = simpleWatertoAirHP.WaterInletNodeNum;
    1018             : 
    1019             :                 // Initialize all report variables to a known state at beginning of simulation
    1020        1776 :                 simpleWatertoAirHP.AirVolFlowRate = 0.0;
    1021        1776 :                 simpleWatertoAirHP.InletAirDBTemp = 0.0;
    1022        1776 :                 simpleWatertoAirHP.InletAirHumRat = 0.0;
    1023        1776 :                 simpleWatertoAirHP.OutletAirDBTemp = 0.0;
    1024        1776 :                 simpleWatertoAirHP.OutletAirHumRat = 0.0;
    1025        1776 :                 simpleWatertoAirHP.WaterVolFlowRate = 0.0;
    1026        1776 :                 simpleWatertoAirHP.WaterMassFlowRate = 0.0;
    1027        1776 :                 simpleWatertoAirHP.InletWaterTemp = 0.0;
    1028        1776 :                 simpleWatertoAirHP.InletWaterEnthalpy = 0.0;
    1029        1776 :                 simpleWatertoAirHP.OutletWaterEnthalpy = 0.0;
    1030        1776 :                 simpleWatertoAirHP.OutletWaterTemp = 0.0;
    1031        1776 :                 simpleWatertoAirHP.Power = 0.0;
    1032        1776 :                 simpleWatertoAirHP.QLoadTotal = 0.0;
    1033        1776 :                 simpleWatertoAirHP.QLoadTotalReport = 0.0;
    1034        1776 :                 simpleWatertoAirHP.QSensible = 0.0;
    1035        1776 :                 simpleWatertoAirHP.QLatent = 0.0;
    1036        1776 :                 simpleWatertoAirHP.QSource = 0.0;
    1037        1776 :                 simpleWatertoAirHP.Energy = 0.0;
    1038        1776 :                 simpleWatertoAirHP.EnergyLoadTotal = 0.0;
    1039        1776 :                 simpleWatertoAirHP.EnergySensible = 0.0;
    1040        1776 :                 simpleWatertoAirHP.EnergyLatent = 0.0;
    1041        1776 :                 simpleWatertoAirHP.EnergySource = 0.0;
    1042        1776 :                 simpleWatertoAirHP.COP = 0.0;
    1043        1776 :                 simpleWatertoAirHP.RunFrac = 0.0;
    1044        1776 :                 simpleWatertoAirHP.PartLoadRatio = 0.0;
    1045        1776 :                 simpleWatertoAirHP.MaxONOFFCyclesperHour = MaxONOFFCyclesperHour;
    1046        1776 :                 simpleWatertoAirHP.HPTimeConstant = HPTimeConstant;
    1047        1776 :                 simpleWatertoAirHP.FanDelayTime = FanDelayTime;
    1048             : 
    1049        1776 :                 if (simpleWatertoAirHP.RatedWaterVolFlowRate != DataSizing::AutoSize) {
    1050        3316 :                     rho = FluidProperties::GetDensityGlycol(state,
    1051        1658 :                                                             state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidName,
    1052             :                                                             DataGlobalConstants::InitConvTemp,
    1053        1658 :                                                             state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidIndex,
    1054             :                                                             RoutineName);
    1055             : 
    1056        1658 :                     simpleWatertoAirHP.DesignWaterMassFlowRate = rho * simpleWatertoAirHP.RatedWaterVolFlowRate;
    1057        1658 :                     PlantUtilities::InitComponentNodes(state,
    1058             :                                                        0.0,
    1059             :                                                        simpleWatertoAirHP.DesignWaterMassFlowRate,
    1060             :                                                        simpleWatertoAirHP.WaterInletNodeNum,
    1061             :                                                        simpleWatertoAirHP.WaterOutletNodeNum);
    1062             : 
    1063        1658 :                     if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Heating && simpleWatertoAirHP.CompanionCoolingCoilNum > 0) {
    1064         888 :                         state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum).DesignWaterMassFlowRate =
    1065         888 :                             rho *
    1066         888 :                             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum).RatedWaterVolFlowRate;
    1067        2664 :                         PlantUtilities::InitComponentNodes(
    1068             :                             state,
    1069             :                             0.0,
    1070         888 :                             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum)
    1071             :                                 .DesignWaterMassFlowRate,
    1072         888 :                             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum).WaterInletNodeNum,
    1073         888 :                             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum).WaterOutletNodeNum);
    1074             :                     }
    1075             :                 }
    1076             : 
    1077        1776 :                 simpleWatertoAirHP.SimFlag = true;
    1078             : 
    1079        1776 :                 state.dataWaterToAirHeatPumpSimple->MyEnvrnFlag(HPNum) = false;
    1080             :             }
    1081             : 
    1082             :         } // End If for the Begin Environment initializations
    1083             : 
    1084    39376595 :         if (!state.dataGlobal->BeginEnvrnFlag) {
    1085    39305067 :             state.dataWaterToAirHeatPumpSimple->MyEnvrnFlag(HPNum) = true;
    1086             :         }
    1087             : 
    1088             :         // Do the following initializations (every time step): This should be the info from
    1089             :         // the previous components outlets or the node data in this section.
    1090             :         // First set the conditions for the air into the heat pump model
    1091             : 
    1092             :         // Set water and air inlet nodes
    1093             : 
    1094    39376595 :         AirInletNode = simpleWatertoAirHP.AirInletNodeNum;
    1095    39376595 :         WaterInletNode = simpleWatertoAirHP.WaterInletNodeNum;
    1096             : 
    1097    39376595 :         if ((SensLoad != 0.0 || LatentLoad != 0.0) && (state.dataLoopNodes->Node(AirInletNode).MassFlowRate > 0.0)) {
    1098    14106304 :             simpleWatertoAirHP.WaterMassFlowRate = simpleWatertoAirHP.DesignWaterMassFlowRate;
    1099             : 
    1100    14106304 :             simpleWatertoAirHP.AirMassFlowRate = state.dataLoopNodes->Node(AirInletNode).MassFlowRate;
    1101             :             // If air flow is less than 25% rated flow. Then throw warning
    1102    14106304 :             RatedAirMassFlowRate =
    1103    56425216 :                 simpleWatertoAirHP.RatedAirVolFlowRate * Psychrometrics::PsyRhoAirFnPbTdbW(state,
    1104    14106304 :                                                                                            state.dataEnvrn->StdBaroPress,
    1105    14106304 :                                                                                            state.dataLoopNodes->Node(AirInletNode).Temp,
    1106    14106304 :                                                                                            state.dataLoopNodes->Node(AirInletNode).HumRat,
    1107             :                                                                                            RoutineName);
    1108    14106304 :             if (simpleWatertoAirHP.AirMassFlowRate < 0.25 * RatedAirMassFlowRate) {
    1109      775860 :                 ShowRecurringWarningErrorAtEnd(state,
    1110             :                                                "Actual air mass flow rate is smaller than 25% of water-to-air heat pump coil rated air flow rate.",
    1111      387930 :                                                state.dataWaterToAirHeatPumpSimple->AirflowErrPointer,
    1112             :                                                simpleWatertoAirHP.AirMassFlowRate,
    1113             :                                                simpleWatertoAirHP.AirMassFlowRate);
    1114             :             }
    1115    14106304 :             simpleWatertoAirHP.WaterFlowMode = true;
    1116             :         } else { // heat pump is off
    1117    25270291 :             simpleWatertoAirHP.WaterFlowMode = false;
    1118    25270291 :             simpleWatertoAirHP.WaterMassFlowRate = 0.0;
    1119    25270291 :             simpleWatertoAirHP.AirMassFlowRate = 0.0;
    1120    25270291 :             if ((simpleWatertoAirHP.WaterCyclingMode) == DataHVACGlobals::WaterConstant) {
    1121           0 :                 if (simpleWatertoAirHP.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit) {
    1122           0 :                     if (simpleWatertoAirHP.CompanionHeatingCoilNum > 0) {
    1123           0 :                         if (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum).QLoadTotal > 0.0) {
    1124             :                             // do nothing, there will be flow through this coil
    1125           0 :                         } else if (simpleWatertoAirHP.LastOperatingMode == DataHVACGlobals::Cooling) {
    1126             :                             // set the flow rate to full design flow
    1127           0 :                             simpleWatertoAirHP.WaterMassFlowRate = simpleWatertoAirHP.DesignWaterMassFlowRate;
    1128             :                         }
    1129             :                     } else {
    1130           0 :                         if (simpleWatertoAirHP.LastOperatingMode == DataHVACGlobals::Cooling) {
    1131             :                             // set the flow rate to full design flow
    1132           0 :                             simpleWatertoAirHP.WaterMassFlowRate = simpleWatertoAirHP.DesignWaterMassFlowRate;
    1133             :                         }
    1134             :                     }
    1135           0 :                 } else if (simpleWatertoAirHP.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit) {
    1136             :                     // It's a heating coil
    1137           0 :                     if (simpleWatertoAirHP.CompanionCoolingCoilNum > 0) {
    1138           0 :                         if (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum).QLoadTotal > 0.0) {
    1139             :                             // do nothing, there will be flow through this coil
    1140           0 :                         } else if (simpleWatertoAirHP.LastOperatingMode == DataHVACGlobals::Heating) {
    1141             :                             // set the flow rate to full design flow
    1142           0 :                             simpleWatertoAirHP.WaterMassFlowRate = simpleWatertoAirHP.DesignWaterMassFlowRate;
    1143             :                         }
    1144             :                     } else {
    1145           0 :                         if (simpleWatertoAirHP.LastOperatingMode == DataHVACGlobals::Heating) {
    1146             :                             // set the flow rate to full design flow
    1147           0 :                             simpleWatertoAirHP.WaterMassFlowRate = simpleWatertoAirHP.DesignWaterMassFlowRate;
    1148             :                         }
    1149             :                     }
    1150             :                 }
    1151             :             }
    1152             :         }
    1153             : 
    1154    39376595 :         PlantUtilities::SetComponentFlowRate(state,
    1155             :                                              simpleWatertoAirHP.WaterMassFlowRate,
    1156             :                                              simpleWatertoAirHP.WaterInletNodeNum,
    1157             :                                              simpleWatertoAirHP.WaterOutletNodeNum,
    1158             :                                              simpleWatertoAirHP.plantLoc);
    1159             : 
    1160    39376595 :         simpleWatertoAirHP.InletAirDBTemp = state.dataLoopNodes->Node(AirInletNode).Temp;
    1161    39376595 :         simpleWatertoAirHP.InletAirHumRat = state.dataLoopNodes->Node(AirInletNode).HumRat;
    1162    39376595 :         simpleWatertoAirHP.InletAirEnthalpy = state.dataLoopNodes->Node(AirInletNode).Enthalpy;
    1163    39376595 :         simpleWatertoAirHP.InletWaterTemp = state.dataLoopNodes->Node(WaterInletNode).Temp;
    1164    39376595 :         simpleWatertoAirHP.InletWaterEnthalpy = state.dataLoopNodes->Node(WaterInletNode).Enthalpy;
    1165    39376595 :         simpleWatertoAirHP.OutletWaterTemp = simpleWatertoAirHP.InletWaterTemp;
    1166    39376595 :         simpleWatertoAirHP.OutletWaterEnthalpy = simpleWatertoAirHP.InletWaterEnthalpy;
    1167             : 
    1168    39376595 :         simpleWatertoAirHP.MaxONOFFCyclesperHour = MaxONOFFCyclesperHour;
    1169    39376595 :         simpleWatertoAirHP.HPTimeConstant = HPTimeConstant;
    1170    39376595 :         simpleWatertoAirHP.FanDelayTime = FanDelayTime;
    1171             : 
    1172             :         // Outlet variables
    1173    39376595 :         simpleWatertoAirHP.Power = 0.0;
    1174    39376595 :         simpleWatertoAirHP.QLoadTotal = 0.0;
    1175    39376595 :         simpleWatertoAirHP.QLoadTotalReport = 0.0;
    1176    39376595 :         simpleWatertoAirHP.QSensible = 0.0;
    1177    39376595 :         simpleWatertoAirHP.QLatent = 0.0;
    1178    39376595 :         simpleWatertoAirHP.QSource = 0.0;
    1179    39376595 :         simpleWatertoAirHP.Energy = 0.0;
    1180    39376595 :         simpleWatertoAirHP.EnergyLoadTotal = 0.0;
    1181    39376595 :         simpleWatertoAirHP.EnergySensible = 0.0;
    1182    39376595 :         simpleWatertoAirHP.EnergyLatent = 0.0;
    1183    39376595 :         simpleWatertoAirHP.EnergySource = 0.0;
    1184    39376595 :         simpleWatertoAirHP.COP = 0.0;
    1185    39376595 :         state.dataHeatBal->HeatReclaimSimple_WAHPCoil(HPNum).AvailCapacity = 0.0;
    1186    39376595 :     }
    1187             : 
    1188         266 :     void SizeHVACWaterToAir(EnergyPlusData &state, int const HPNum)
    1189             :     {
    1190             : 
    1191             :         // SUBROUTINE INFORMATION:
    1192             :         //       AUTHOR         Richard Raustad, FSEC
    1193             :         //       DATE WRITTEN   June 2009
    1194             :         //       MODIFIED       August 2013 Daeho Kang, add component sizing table entries
    1195             : 
    1196             :         // PURPOSE OF THIS SUBROUTINE:
    1197             :         // This subroutine is for sizing WSHP Components for which nominal capacities
    1198             :         // and flow rates have not been specified in the input
    1199             : 
    1200             :         // METHODOLOGY EMPLOYED:
    1201             :         // Obtains heating capacities and flow rates from the zone or system sizing arrays.
    1202             : 
    1203         266 :         auto &ZoneEqSizing(state.dataSize->ZoneEqSizing);
    1204         266 :         auto &simpleWatertoAirHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum));
    1205             : 
    1206             :         // SUBROUTINE PARAMETER DEFINITIONS:
    1207             :         static constexpr std::string_view RoutineName("SizeWaterToAirCoil");
    1208             :         static constexpr std::string_view RoutineNameAlt("SizeHVACWaterToAir");
    1209             : 
    1210             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    1211             :         Real64 rhoair;
    1212             :         Real64 MixTemp;                   // Mixed air temperature at cooling design conditions
    1213             :         Real64 MixTempSys;                // Mixed air temperature at cooling design conditions at system air flow
    1214             :         Real64 HeatMixTemp;               // Mixed air temperature at heating design conditions
    1215             :         Real64 HeatMixTempSys;            // Mixed air temperature at heating design conditions at system air flow
    1216             :         Real64 MixHumRat;                 // Mixed air humidity ratio at cooling design conditions
    1217             :         Real64 MixHumRatSys;              // Mixed air humidity ratio at cooling design conditions at system air flow
    1218             :         Real64 HeatMixHumRat;             // Mixed air humidity ratio at heating design conditions
    1219             :         Real64 HeatMixHumRatSys;          // Mixed air humidity ratio at heating design conditions at system air flow
    1220             :         Real64 MixEnth;                   // Mixed air enthalpy at cooling design conditions
    1221             :         Real64 MixEnthSys;                // Mixed air enthalpy at cooling design conditions at system air flow
    1222             :         Real64 MixWetBulb;                // Mixed air wet-bulb temperature at cooling design conditions
    1223         266 :         Real64 RatedMixWetBulb = 0.0;     // Rated mixed air wetbulb temperature
    1224         266 :         Real64 RatedMixDryBulb = 0.0;     // Rated mixed air drybulb temperature
    1225         266 :         Real64 RatedHeatMixDryBulb = 0.0; // Rated mixed air drybulb temperature at heating design conditions
    1226             :         Real64 SupTemp;                   // Supply air temperature at cooling design conditions
    1227             :         Real64 HeatSupTemp;               // Supply air temperature at heating design conditions
    1228             :         Real64 SupHumRat;                 // Supply air humidity ratio at cooling design conditions
    1229             :         Real64 SupEnth;                   // Supply air enthalpy at cooling design conditions
    1230             :         Real64 OutTemp;                   // Outdoor aur dry-bulb temperature at cooling design conditions
    1231             :         Real64 ratioTDB;                  // Load-side dry-bulb temperature ratio at cooling design conditions
    1232             :         Real64 HeatratioTDB;              // Load-side dry-bulb temperature ratio at heating design conditions
    1233             :         Real64 ratioTWB;                  // Load-side wet-bulb temperature ratio at cooling design conditions
    1234             :         Real64 ratioTS;                   // Source-side temperature ratio at cooling design conditions
    1235             :         Real64 HeatratioTS;               // Source-side temperature ratio at heating design conditions
    1236             :         Real64 RatedratioTDB;             // Rated cooling load-side dry-bulb temperature ratio
    1237         266 :         Real64 RatedHeatratioTDB = 0.0;   // Rated cooling load-side dry-bulb temperature ratio
    1238             :         Real64 RatedratioTWB;             // Rated cooling load-side wet-bulb temperature ratio
    1239             :         Real64 RatedratioTS;              // Rated cooling source-side temperature ratio
    1240             :         Real64 RatedHeatratioTS;          // Rated heating source-side temperature ratio
    1241             :         Real64 OutAirFrac;                // Outdoor air fraction at cooling design conditions
    1242             :         Real64 OutAirFracSys;             // Outdoor air fraction at cooling design conditions at system air flow
    1243             :         Real64 HeatOutAirFrac;            // Outdoor air fraction at heating design conditions
    1244             :         Real64 HeatOutAirFracSys;         // Outdoor air fraction at heating design conditions at system air flow
    1245             :         Real64 VolFlowRate;
    1246             :         Real64 CoolCapAtPeak;                  // Load on the cooling coil at cooling design conditions
    1247             :         Real64 HeatCapAtPeak;                  // Load on the heating coil at heating design conditions
    1248         266 :         Real64 PeakTotCapTempModFac = 0.0;     // Peak total cooling capacity curve modifier
    1249         266 :         Real64 RatedTotCapTempModFac = 0.0;    // Rated total cooling capacity curve modifier
    1250         266 :         Real64 PeakHeatCapTempModFac = 0.0;    // Peak heating capacity curve modifier
    1251             :         Real64 DesignEntWaterTemp;             // Design entering coil water temperature
    1252             :         Real64 SensCapAtPeak;                  // Sensible load on the cooling coil at cooling design conditions
    1253         266 :         Real64 PeakSensCapTempModFac = 0.0;    // Peak sensible cooling capacity curve modifier
    1254         266 :         Real64 RatedSensCapTempModFac = 0.0;   // Rated sensible cooling capacity curve modifier
    1255         266 :         Real64 RatedHeatCapTempModFac = 0.0;   // Rated heating capacity curve modifier
    1256         266 :         Real64 RatedCoolPowerTempModFac = 0.0; // Rated cooling power curve modifier
    1257         266 :         Real64 RatedHeatPowerTempModFac = 0.0; // Rated heating power curve modifier
    1258             :         Real64 RatedCapCoolTotalDesCDD;        // Rated total cooling coil capacity determined at cooling design conditions
    1259         266 :         constexpr Real64 Tref(283.15);         // Refrence Temperature for performance curves,10C [K]
    1260             :         int TimeStepNumAtMax;
    1261             :         int DDNum;
    1262             :         int PltSizNum;
    1263             :         bool RatedCapCoolTotalAutoSized;
    1264             :         bool RatedCapCoolSensAutoSized;
    1265             :         bool ErrorsFound;
    1266         266 :         Real64 SystemCapacity = 0.0;
    1267             :         Real64 rho;
    1268             :         Real64 Cp;
    1269             :         bool IsAutoSize;                  // Indicator to autosize
    1270             :         bool HardSizeNoDesRun;            // Indicator to hardsize and no sizing run
    1271             :         Real64 RatedAirVolFlowRateDes;    // Autosized rated air flow for reporting
    1272             :         Real64 CoolingAirVolFlowRateDes;  // Cooling desing day air flow
    1273             :         Real64 HeatingAirVolFlowRateDes;  // Heating design day air flow
    1274             :         Real64 RatedAirVolFlowRateUser;   // Hardsized rated air flow for reporting
    1275             :         Real64 RatedCapCoolTotalDes;      // Autosized rated cooling capacity for reporting
    1276             :         Real64 RatedCapCoolTotalUser;     // Hardsized rated cooling capacity for reporting
    1277             :         Real64 RatedCapCoolSensDes;       // Autosized rated sensible cooling capacity for reporting
    1278             :         Real64 RatedCapCoolSensUser;      // Hardsized rated sensible cooling capacity for reporting
    1279             :         Real64 RatedCapHeatDes;           // Autosized rated heating capacity for reporting
    1280             :         Real64 RatedCapHeatUser;          // Hardsized rated heating capacity for reporting
    1281             :         Real64 RatedWaterVolFlowRateDes;  // Autosized rated water flow rate for reporting
    1282             :         Real64 RatedWaterVolFlowRateUser; // Hardsized rated water flow rate for reporting
    1283             :         Real64 RatedCapCoolHeatDD;        // Rated cooling coil capacity based on heating design conditions
    1284             :         bool SizingDesRunThisAirSys;      // true if a particular air system had a Sizing:System object and system sizing done
    1285             :         bool SizingDesRunThisZone;        // true if a particular zone had a Sizing:Zone object and zone sizing was done
    1286         266 :         Real64 HeatdTratio = 1.0;         // Temperature difference across coil adjustment factor
    1287         266 :         Real64 dHratio = 1.0;             // Enthalpy difference across coil adjustment factor
    1288             :         Real64 HeatOAFrac;                // Outdoor air fraction at heating design conditions
    1289             :         Real64 HeatOAFracSys;             // Outdoor air fraction at heating design conditions at system air flow
    1290             :         Real64 HeatOATemp;                // Outdoor air temperature at heating design conditions
    1291             :         Real64 OAFrac;                    // Outdooor air fraction
    1292             :         Real64 OAFracSys;                 // Outdoor air fraction at system air flow
    1293             :         Real64 OATemp;                    // Outdoor air temperature at cooling design conditions
    1294             :         Real64 OAHumRat;                  // Humidity ratio at cooling design conditions
    1295             : 
    1296         266 :         PltSizNum = 0;
    1297         266 :         ErrorsFound = false;
    1298         266 :         IsAutoSize = false;
    1299         266 :         if (state.dataSize->SysSizingRunDone || state.dataSize->ZoneSizingRunDone) {
    1300         236 :             HardSizeNoDesRun = false;
    1301             :         } else {
    1302          30 :             HardSizeNoDesRun = true;
    1303             :         }
    1304         266 :         if (state.dataSize->CurSysNum > 0) {
    1305         224 :             CheckThisAirSystemForSizing(state, state.dataSize->CurSysNum, SizingDesRunThisAirSys);
    1306             :         } else {
    1307          42 :             SizingDesRunThisAirSys = false;
    1308             :         }
    1309         266 :         if (state.dataSize->CurZoneEqNum > 0) {
    1310          42 :             CheckThisZoneForSizing(state, state.dataSize->CurZoneEqNum, SizingDesRunThisZone);
    1311             :         } else {
    1312         224 :             SizingDesRunThisZone = false;
    1313             :         }
    1314         266 :         RatedAirVolFlowRateDes = 0.0;
    1315         266 :         RatedAirVolFlowRateUser = 0.0;
    1316         266 :         CoolingAirVolFlowRateDes = 0.0;
    1317         266 :         HeatingAirVolFlowRateDes = 0.0;
    1318         266 :         RatedCapCoolTotalDes = 0.0;
    1319         266 :         RatedCapCoolTotalUser = 0.0;
    1320         266 :         RatedCapCoolSensDes = 0.0;
    1321         266 :         RatedCapCoolSensUser = 0.0;
    1322         266 :         RatedCapHeatDes = 0.0;
    1323         266 :         RatedCapHeatUser = 0.0;
    1324         266 :         RatedWaterVolFlowRateDes = 0.0;
    1325         266 :         RatedWaterVolFlowRateUser = 0.0;
    1326         532 :         std::string CompType = format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]);
    1327             : 
    1328         266 :         if (simpleWatertoAirHP.RatedAirVolFlowRate == DataSizing::AutoSize) {
    1329         236 :             IsAutoSize = true;
    1330             :         }
    1331         266 :         if (state.dataSize->CurSysNum > 0) {
    1332         224 :             if (!IsAutoSize && !SizingDesRunThisAirSys) { // Simulation continue
    1333          30 :                 HardSizeNoDesRun = true;
    1334          60 :                 if (simpleWatertoAirHP.RatedAirVolFlowRate > 0.0) {
    1335         120 :                     BaseSizer::reportSizerOutput(
    1336             :                         state,
    1337          60 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1338             :                         simpleWatertoAirHP.Name,
    1339             :                         "User-Specified Rated Air Flow Rate [m3/s]",
    1340          30 :                         simpleWatertoAirHP.RatedAirVolFlowRate);
    1341             :                 }
    1342             :             } else {
    1343         388 :                 CheckSysSizing(state,
    1344         388 :                                format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1345             :                                simpleWatertoAirHP.Name);
    1346         194 :                 if (state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow >= DataHVACGlobals::SmallAirVolFlow) {
    1347         194 :                     RatedAirVolFlowRateDes = state.dataSize->FinalSysSizing(state.dataSize->CurSysNum).DesMainVolFlow;
    1348         194 :                     CoolingAirVolFlowRateDes = state.dataSize->CalcSysSizing(state.dataSize->CurSysNum).DesCoolVolFlow;
    1349         194 :                     HeatingAirVolFlowRateDes = state.dataSize->CalcSysSizing(state.dataSize->CurSysNum).DesHeatVolFlow;
    1350             :                 } else {
    1351           0 :                     RatedAirVolFlowRateDes = 0.0;
    1352             :                 }
    1353             :             }
    1354          42 :         } else if (state.dataSize->CurZoneEqNum > 0) {
    1355          42 :             if (!IsAutoSize && !SizingDesRunThisZone) { // Simulation continue
    1356           0 :                 HardSizeNoDesRun = true;
    1357           0 :                 if (simpleWatertoAirHP.RatedAirVolFlowRate > 0.0) {
    1358           0 :                     BaseSizer::reportSizerOutput(
    1359             :                         state,
    1360           0 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1361             :                         simpleWatertoAirHP.Name,
    1362             :                         "User-Specified Rated Air Flow Rate [m3/s]",
    1363           0 :                         simpleWatertoAirHP.RatedAirVolFlowRate);
    1364             :                 }
    1365             :             } else {
    1366          84 :                 CheckZoneSizing(state,
    1367          84 :                                 format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1368             :                                 simpleWatertoAirHP.Name);
    1369          42 :                 RatedAirVolFlowRateDes = max(state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolVolFlow,
    1370          42 :                                              state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatVolFlow);
    1371          42 :                 CoolingAirVolFlowRateDes = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolVolFlow;
    1372          42 :                 HeatingAirVolFlowRateDes = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatVolFlow;
    1373          42 :                 if (RatedAirVolFlowRateDes < DataHVACGlobals::SmallAirVolFlow) {
    1374           0 :                     RatedAirVolFlowRateDes = 0.0;
    1375             :                 }
    1376             :             }
    1377             :         }
    1378         266 :         if (!HardSizeNoDesRun) {
    1379         236 :             if (IsAutoSize) {
    1380         236 :                 simpleWatertoAirHP.RatedAirVolFlowRate = RatedAirVolFlowRateDes;
    1381         944 :                 BaseSizer::reportSizerOutput(
    1382             :                     state,
    1383         472 :                     format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1384             :                     simpleWatertoAirHP.Name,
    1385             :                     "Design Size Rated Air Flow Rate [m3/s]",
    1386         236 :                     RatedAirVolFlowRateDes);
    1387             :             } else {
    1388           0 :                 if (simpleWatertoAirHP.RatedAirVolFlowRate > 0.0 && RatedAirVolFlowRateDes > 0.0 && !HardSizeNoDesRun) {
    1389           0 :                     RatedAirVolFlowRateUser = simpleWatertoAirHP.RatedAirVolFlowRate;
    1390           0 :                     BaseSizer::reportSizerOutput(
    1391             :                         state,
    1392           0 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1393             :                         simpleWatertoAirHP.Name,
    1394             :                         "Design Size Rated Air Flow Rate [m3/s]",
    1395             :                         RatedAirVolFlowRateDes,
    1396             :                         "User-Specified Rated Air Flow Rate [m3/s]",
    1397           0 :                         RatedAirVolFlowRateUser);
    1398           0 :                     if (state.dataGlobal->DisplayExtraWarnings) {
    1399           0 :                         if ((std::abs(RatedAirVolFlowRateDes - RatedAirVolFlowRateUser) / RatedAirVolFlowRateUser) >
    1400           0 :                             state.dataSize->AutoVsHardSizingThreshold) {
    1401           0 :                             ShowMessage(
    1402             :                                 state,
    1403           0 :                                 format("SizeHVACWaterToAir: Potential issue with equipment sizing for coil {}:WATERTOAIRHEATPUMP:EQUATIONFIT \"{}\"",
    1404           0 :                                        WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    1405           0 :                                        simpleWatertoAirHP.Name));
    1406           0 :                             ShowContinueError(state, format("User-Specified Rated Air Volume Flow Rate of {:.5R} [m3/s]", RatedAirVolFlowRateUser));
    1407           0 :                             ShowContinueError(state,
    1408           0 :                                               format("differs from Design Size Rated Air Volume Flow Rate of {:.5R} [m3/s]", RatedAirVolFlowRateDes));
    1409           0 :                             ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
    1410           0 :                             ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
    1411             :                         }
    1412             :                     }
    1413             :                 }
    1414             :             }
    1415             :         }
    1416             : 
    1417         266 :         RatedCapCoolTotalAutoSized = false;
    1418         266 :         RatedCapCoolSensAutoSized = false;
    1419             : 
    1420         266 :         Real64 FanCoolLoad = 0.0;
    1421         266 :         Real64 FanHeatLoad = FanCoolLoad;
    1422         266 :         if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Cooling) {
    1423             :             // size rated total cooling capacity
    1424         133 :             if (simpleWatertoAirHP.RatedCapCoolTotal == DataSizing::AutoSize) {
    1425         118 :                 RatedCapCoolTotalAutoSized = true;
    1426             :             }
    1427         133 :             if (SizingDesRunThisAirSys || SizingDesRunThisZone) HardSizeNoDesRun = false;
    1428         133 :             if (state.dataSize->CurSysNum > 0) {
    1429         112 :                 if (!RatedCapCoolTotalAutoSized && !SizingDesRunThisAirSys) { // Simulation continue
    1430          15 :                     HardSizeNoDesRun = true;
    1431          30 :                     if (simpleWatertoAirHP.RatedCapCoolTotal > 0.0) {
    1432          60 :                         BaseSizer::reportSizerOutput(
    1433             :                             state,
    1434          30 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1435             :                             simpleWatertoAirHP.Name,
    1436             :                             "User-Specified Rated Total Cooling Capacity [W]",
    1437          15 :                             simpleWatertoAirHP.RatedCapCoolTotal);
    1438             :                     }
    1439             :                 } else {
    1440         194 :                     CheckSysSizing(
    1441             :                         state,
    1442         194 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1443             :                         simpleWatertoAirHP.Name);
    1444          97 :                     if (CoolingAirVolFlowRateDes > 0.0) {
    1445          97 :                         VolFlowRate = CoolingAirVolFlowRateDes;
    1446             :                     } else {
    1447           0 :                         VolFlowRate = HeatingAirVolFlowRateDes; // system air flow
    1448             :                     }
    1449             :                     // cooling design day calculations
    1450          97 :                     if (VolFlowRate >= DataHVACGlobals::SmallAirVolFlow) {
    1451          97 :                         auto &finalSysSizing(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum));
    1452          97 :                         if (state.dataSize->CurOASysNum > 0) { // coil is in the OA stream
    1453           0 :                             MixTemp = finalSysSizing.OutTempAtCoolPeak;
    1454           0 :                             MixHumRat = finalSysSizing.OutHumRatAtCoolPeak;
    1455           0 :                             SupTemp = finalSysSizing.PrecoolTemp;
    1456           0 :                             SupHumRat = finalSysSizing.PrecoolHumRat;
    1457           0 :                             MixTempSys = MixTemp;
    1458           0 :                             MixHumRatSys = MixHumRat;
    1459             :                         } else { // coil is on the main air loop
    1460          97 :                             SupTemp = finalSysSizing.CoolSupTemp;
    1461          97 :                             SupHumRat = finalSysSizing.CoolSupHumRat;
    1462          97 :                             if (VolFlowRate > 0.0) {
    1463          97 :                                 OutAirFrac = finalSysSizing.DesOutAirVolFlow / VolFlowRate;
    1464          97 :                                 OutAirFracSys = finalSysSizing.DesOutAirVolFlow / RatedAirVolFlowRateDes;
    1465             :                             } else {
    1466           0 :                                 OutAirFrac = 1.0;
    1467           0 :                                 OutAirFracSys = OutAirFrac;
    1468             :                             }
    1469          97 :                             OutAirFrac = min(1.0, max(0.0, OutAirFrac));
    1470          97 :                             OutAirFracSys = min(1.0, max(0.0, OutAirFracSys));
    1471          97 :                             if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).NumOACoolCoils ==
    1472             :                                 0) { // there is no precooling of the OA stream
    1473          97 :                                 MixTemp = finalSysSizing.MixTempAtCoolPeak;
    1474          97 :                                 MixHumRat = finalSysSizing.MixHumRatAtCoolPeak;
    1475             :                                 // calculate mixed air temperature with system airflow
    1476          97 :                                 MixTempSys =
    1477          97 :                                     OutAirFracSys * finalSysSizing.OutTempAtCoolPeak + (1.0 - OutAirFracSys) * finalSysSizing.RetTempAtCoolPeak;
    1478          97 :                                 MixHumRatSys =
    1479          97 :                                     OutAirFracSys * finalSysSizing.OutHumRatAtCoolPeak + (1.0 - OutAirFracSys) * finalSysSizing.RetHumRatAtCoolPeak;
    1480             :                             } else { // there is precooling of OA stream
    1481           0 :                                 MixTemp = OutAirFrac * finalSysSizing.PrecoolTemp + (1.0 - OutAirFrac) * finalSysSizing.RetTempAtCoolPeak;
    1482           0 :                                 MixHumRat = OutAirFrac * finalSysSizing.PrecoolHumRat + (1.0 - OutAirFrac) * finalSysSizing.RetHumRatAtCoolPeak;
    1483             :                                 // calculate mixed air temperature with system airflow
    1484           0 :                                 MixTempSys = OutAirFracSys * finalSysSizing.PrecoolTemp + (1.0 - OutAirFracSys) * finalSysSizing.RetTempAtCoolPeak;
    1485           0 :                                 MixHumRatSys =
    1486           0 :                                     OutAirFracSys * finalSysSizing.PrecoolHumRat + (1.0 - OutAirFracSys) * finalSysSizing.RetHumRatAtCoolPeak;
    1487             :                             }
    1488             :                         }
    1489             :                         // supply air condition is capped with that of mixed air to avoid SHR > 1.0
    1490          97 :                         SupTemp = min(MixTemp, SupTemp);
    1491          97 :                         SupHumRat = min(MixHumRat, SupHumRat);
    1492          97 :                         rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, MixTemp, MixHumRat, RoutineName);
    1493          97 :                         MixEnth = Psychrometrics::PsyHFnTdbW(MixTemp, MixHumRat);
    1494          97 :                         MixEnthSys = Psychrometrics::PsyHFnTdbW(MixTempSys, MixHumRatSys);
    1495          97 :                         SupEnth = Psychrometrics::PsyHFnTdbW(SupTemp, SupHumRat);
    1496             :                         // determine the coil ratio of coil dT with system air flow to design heating air flow
    1497          97 :                         dHratio = (SupEnth - MixEnthSys) / (SupEnth - MixEnth);
    1498          97 :                         Real64 FanCoolLoad = 0.0;
    1499          97 :                         if (state.dataSize->DataFanEnumType > -1 && state.dataSize->DataFanIndex > -1) { // add fan heat to coil load
    1500          97 :                             switch (state.dataSize->DataFanEnumType) {
    1501          97 :                             case DataAirSystems::StructArrayLegacyFanModels: {
    1502          97 :                                 FanCoolLoad = Fans::FanDesHeatGain(state, state.dataSize->DataFanIndex, VolFlowRate);
    1503          97 :                                 break;
    1504             :                             }
    1505           0 :                             case DataAirSystems::ObjectVectorOOFanSystemModel: {
    1506           0 :                                 FanCoolLoad = state.dataHVACFan->fanObjs[state.dataSize->DataFanIndex]->getFanDesignHeatGain(state, VolFlowRate);
    1507           0 :                                 break;
    1508             :                             }
    1509           0 :                             case DataAirSystems::Invalid: {
    1510             :                                 // do nothing
    1511           0 :                                 break;
    1512             :                             }
    1513             :                             } // end switch
    1514          97 :                             Real64 CpAir = Psychrometrics::PsyCpAirFnW(MixHumRat);
    1515          97 :                             if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanLocation ==
    1516             :                                 DataAirSystems::FanPlacement::BlowThru) {
    1517          97 :                                 MixTemp += FanCoolLoad / (CpAir * rhoair * VolFlowRate); // this is now the temperature entering the coil
    1518           0 :                             } else if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanLocation ==
    1519             :                                        DataAirSystems::FanPlacement::DrawThru) {
    1520           0 :                                 SupTemp -= FanCoolLoad / (CpAir * rhoair * VolFlowRate); // this is now the temperature leaving the coil
    1521             :                             }
    1522             :                         }
    1523          97 :                         CoolCapAtPeak = (rhoair * VolFlowRate * (MixEnth - SupEnth)) +
    1524             :                                         FanCoolLoad; // load on the cooling coil which includes ventilation load and fan heat
    1525          97 :                         CoolCapAtPeak = max(0.0, CoolCapAtPeak);
    1526          97 :                         MixWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, MixTemp, MixHumRat, state.dataEnvrn->StdBaroPress, RoutineName);
    1527          97 :                         RatedMixWetBulb = simpleWatertoAirHP.RatedEntAirWetbulbTemp;
    1528             :                         // calculate temperatue ratio at design day peak conditions
    1529          97 :                         ratioTWB = (MixWetBulb + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1530         291 :                         PltSizNum = PlantUtilities::MyPlantSizingIndex(
    1531             :                             state,
    1532         194 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1533             :                             simpleWatertoAirHP.Name,
    1534             :                             simpleWatertoAirHP.WaterInletNodeNum,
    1535             :                             simpleWatertoAirHP.WaterOutletNodeNum,
    1536             :                             ErrorsFound,
    1537             :                             false);
    1538          97 :                         if (PltSizNum > 0) {
    1539          97 :                             DesignEntWaterTemp = state.dataSize->PlantSizData(PltSizNum).ExitTemp;
    1540          97 :                             ratioTS = (DesignEntWaterTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1541             :                         } else {
    1542           0 :                             ShowSevereError(state, "Autosizing of total cooling capacity requires a loop Sizing:Plant object");
    1543           0 :                             ShowContinueError(state, "Autosizing also requires physical connection to a plant or condenser loop.");
    1544           0 :                             ShowContinueError(state,
    1545           0 :                                               format("Occurs in COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT Object={}",
    1546           0 :                                                      WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    1547           0 :                                                      simpleWatertoAirHP.Name));
    1548           0 :                             ErrorsFound = true;
    1549             :                         }
    1550             :                         // calculate temperatue ratio at rated conditions
    1551          97 :                         RatedratioTWB = (RatedMixWetBulb + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1552          97 :                         RatedratioTS = (simpleWatertoAirHP.RatedEntWaterTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1553             :                         // determine curve modifiers at peak and rated conditions
    1554          97 :                         PeakTotCapTempModFac = Curve::CurveValue(state, simpleWatertoAirHP.TotalCoolCapCurveIndex, ratioTWB, ratioTS, 1.0, 1.0);
    1555          97 :                         RatedTotCapTempModFac =
    1556         194 :                             Curve::CurveValue(state, simpleWatertoAirHP.TotalCoolCapCurveIndex, RatedratioTWB, RatedratioTS, 1.0, 1.0);
    1557          97 :                         RatedCoolPowerTempModFac =
    1558         194 :                             Curve::CurveValue(state, simpleWatertoAirHP.CoolPowCurveIndex, RatedratioTWB, RatedratioTS, 1.0, 1.0);
    1559             :                         // calculate the rated total capacity based on peak conditions
    1560             :                         // note: the rated total capacity can be different than the total capacity at
    1561             :                         // rated conditions if the capacity curve isn't normalized at the rated
    1562             :                         // conditions
    1563          97 :                         RatedCapCoolTotalDes = (PeakTotCapTempModFac > 0.0) ? CoolCapAtPeak / PeakTotCapTempModFac : CoolCapAtPeak;
    1564             :                         // reporting
    1565         291 :                         state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirTemp(
    1566         194 :                             state, simpleWatertoAirHP.Name, CompType, MixTemp, state.dataSize->CurSysNum, state.dataSize->CurZoneEqNum);
    1567          97 :                         state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, simpleWatertoAirHP.Name, CompType, MixHumRat);
    1568          97 :                         state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, simpleWatertoAirHP.Name, CompType, SupTemp);
    1569          97 :                         state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirHumRat(state, simpleWatertoAirHP.Name, CompType, SupHumRat);
    1570             :                     } else {
    1571           0 :                         RatedCapCoolTotalDes = 0.0;
    1572             :                     }
    1573             :                 }
    1574          21 :             } else if (state.dataSize->CurZoneEqNum > 0) {
    1575          21 :                 if (!RatedCapCoolTotalAutoSized && !SizingDesRunThisZone) { // Simulation continue
    1576           0 :                     HardSizeNoDesRun = true;
    1577           0 :                     if (simpleWatertoAirHP.RatedCapCoolTotal > 0.0) {
    1578           0 :                         BaseSizer::reportSizerOutput(
    1579             :                             state,
    1580           0 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1581             :                             simpleWatertoAirHP.Name,
    1582             :                             "User-Specified Rated Total Cooling Capacity [W]",
    1583           0 :                             simpleWatertoAirHP.RatedCapCoolTotal);
    1584             :                     }
    1585             :                 } else {
    1586          42 :                     CheckZoneSizing(
    1587             :                         state,
    1588          42 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1589             :                         simpleWatertoAirHP.Name);
    1590          21 :                     if (CoolingAirVolFlowRateDes > 0.0) {
    1591          19 :                         VolFlowRate = CoolingAirVolFlowRateDes;
    1592             :                     } else {
    1593           2 :                         VolFlowRate = HeatingAirVolFlowRateDes; // system air flow
    1594             :                     }
    1595          21 :                     if (VolFlowRate >= DataHVACGlobals::SmallAirVolFlow) {
    1596             :                         // cooling design calculations
    1597          21 :                         if (state.dataSize->ZoneEqDXCoil) {
    1598          21 :                             if (ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) {
    1599           7 :                                 MixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInTemp;
    1600           7 :                                 MixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInHumRat;
    1601             :                                 // calculate mixed air temperature and humidity with system airflow
    1602           7 :                                 OAFrac = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA / CoolingAirVolFlowRateDes;
    1603           7 :                                 OAFracSys = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA / RatedAirVolFlowRateDes;
    1604          14 :                                 OATemp = (state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInTemp -
    1605           7 :                                           (1.0 - OAFrac) * state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneTempAtCoolPeak) /
    1606             :                                          OAFrac;
    1607          14 :                                 OAHumRat = (state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatCoilInHumRat -
    1608           7 :                                             (1.0 - OAFrac) * state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneHumRatAtHeatPeak) /
    1609             :                                            OAFrac;
    1610          14 :                                 MixTempSys = OAFracSys * OATemp +
    1611           7 :                                              (1.0 - OAFracSys) * state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneTempAtCoolPeak;
    1612          14 :                                 MixHumRatSys = OAFracSys * OAHumRat +
    1613           7 :                                                (1.0 - OAFracSys) * state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneHumRatAtHeatPeak;
    1614             :                             } else {
    1615          14 :                                 MixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneRetTempAtCoolPeak;
    1616          14 :                                 MixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneHumRatAtCoolPeak;
    1617          14 :                                 MixTempSys = MixTemp;
    1618          14 :                                 MixHumRatSys = MixHumRat;
    1619             :                             }
    1620             :                         } else {
    1621           0 :                             MixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInTemp;
    1622           0 :                             MixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInHumRat;
    1623           0 :                             MixTempSys = MixTemp;
    1624           0 :                             MixHumRatSys = MixHumRat;
    1625             :                         }
    1626          21 :                         SupTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).CoolDesTemp;
    1627          21 :                         SupHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).CoolDesHumRat;
    1628             :                         // supply air condition is capped with that of mixed air to avoid SHR > 1.0
    1629          21 :                         SupTemp = min(MixTemp, SupTemp);
    1630          21 :                         SupHumRat = min(MixHumRat, SupHumRat);
    1631          21 :                         TimeStepNumAtMax = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).TimeStepNumAtCoolMax;
    1632          21 :                         DDNum = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).CoolDDNum;
    1633          21 :                         if (DDNum > 0 && TimeStepNumAtMax > 0) {
    1634          21 :                             OutTemp = state.dataSize->DesDayWeath(DDNum).Temp(TimeStepNumAtMax);
    1635             :                         } else {
    1636           0 :                             OutTemp = 0.0;
    1637             :                         }
    1638          21 :                         rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, MixTemp, MixHumRat, RoutineName);
    1639          21 :                         MixEnth = Psychrometrics::PsyHFnTdbW(MixTemp, MixHumRat);
    1640          21 :                         MixEnthSys = Psychrometrics::PsyHFnTdbW(MixTempSys, MixHumRatSys);
    1641          21 :                         SupEnth = Psychrometrics::PsyHFnTdbW(SupTemp, SupHumRat);
    1642             :                         // determine the coil ratio of coil dH with system air flow to design heating air flow
    1643          21 :                         dHratio = (SupEnth - MixEnthSys) / (SupEnth - MixEnth);
    1644          21 :                         if (state.dataSize->DataFanEnumType > -1 && state.dataSize->DataFanIndex > -1) { // add fan heat to coil load
    1645          21 :                             switch (state.dataSize->DataFanEnumType) {
    1646          20 :                             case DataAirSystems::StructArrayLegacyFanModels: {
    1647          20 :                                 FanCoolLoad = Fans::FanDesHeatGain(state, state.dataSize->DataFanIndex, VolFlowRate);
    1648          20 :                                 break;
    1649             :                             }
    1650           1 :                             case DataAirSystems::ObjectVectorOOFanSystemModel: {
    1651           1 :                                 FanCoolLoad = state.dataHVACFan->fanObjs[state.dataSize->DataFanIndex]->getFanDesignHeatGain(state, VolFlowRate);
    1652           1 :                                 break;
    1653             :                             }
    1654           0 :                             case DataAirSystems::Invalid: {
    1655             :                                 // do nothing
    1656           0 :                                 break;
    1657             :                             }
    1658             :                             } // end switch
    1659          21 :                             Real64 CpAir = Psychrometrics::PsyCpAirFnW(MixHumRat);
    1660          21 :                             if (state.dataSize->DataFanPlacement == DataSizing::ZoneFanPlacement::BlowThru) {
    1661          14 :                                 MixTemp += FanCoolLoad / (CpAir * rhoair * VolFlowRate); // this is now the temperature entering the coil
    1662             :                             } else {
    1663           7 :                                 SupTemp -= FanCoolLoad / (CpAir * rhoair * VolFlowRate); // this is now the temperature leaving the coil
    1664             :                             }
    1665             :                         }
    1666          21 :                         CoolCapAtPeak = (rhoair * VolFlowRate * (MixEnth - SupEnth)) +
    1667             :                                         FanCoolLoad; // load on the cooling coil which includes ventilation load and fan heat
    1668          21 :                         CoolCapAtPeak = max(0.0, CoolCapAtPeak);
    1669          21 :                         MixWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, MixTemp, MixHumRat, state.dataEnvrn->StdBaroPress, RoutineName);
    1670          21 :                         RatedMixWetBulb = simpleWatertoAirHP.RatedEntAirWetbulbTemp;
    1671             :                         // calculate temperatue ratio at design day peak conditions
    1672          21 :                         ratioTWB = (MixWetBulb + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1673          63 :                         PltSizNum = PlantUtilities::MyPlantSizingIndex(
    1674             :                             state,
    1675          42 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1676             :                             simpleWatertoAirHP.Name,
    1677             :                             simpleWatertoAirHP.WaterInletNodeNum,
    1678             :                             simpleWatertoAirHP.WaterOutletNodeNum,
    1679             :                             ErrorsFound,
    1680             :                             false);
    1681          21 :                         if (PltSizNum > 0) {
    1682          21 :                             DesignEntWaterTemp = state.dataSize->PlantSizData(PltSizNum).ExitTemp;
    1683          21 :                             ratioTS = (DesignEntWaterTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1684             :                         } else {
    1685           0 :                             ShowSevereError(state, "Autosizing of total cooling capacity requires a loop Sizing:Plant object");
    1686           0 :                             ShowContinueError(state, "Autosizing also requires physical connection to a plant or condenser loop.");
    1687           0 :                             ShowContinueError(state,
    1688           0 :                                               format("Occurs in COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT Object={}",
    1689           0 :                                                      WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    1690           0 :                                                      simpleWatertoAirHP.Name));
    1691           0 :                             ErrorsFound = true;
    1692             :                         }
    1693             :                         // calculate temperatue ratio at rated conditions
    1694          21 :                         RatedratioTWB = (RatedMixWetBulb + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1695          21 :                         RatedratioTS = (simpleWatertoAirHP.RatedEntWaterTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1696             :                         // determine curve modifiers at peak and rated conditions
    1697          21 :                         PeakTotCapTempModFac = Curve::CurveValue(state, simpleWatertoAirHP.TotalCoolCapCurveIndex, ratioTWB, ratioTS, 1.0, 1.0);
    1698          21 :                         RatedTotCapTempModFac =
    1699          42 :                             Curve::CurveValue(state, simpleWatertoAirHP.TotalCoolCapCurveIndex, RatedratioTWB, RatedratioTS, 1.0, 1.0);
    1700          21 :                         RatedCoolPowerTempModFac =
    1701          42 :                             Curve::CurveValue(state, simpleWatertoAirHP.CoolPowCurveIndex, RatedratioTWB, RatedratioTS, 1.0, 1.0);
    1702             :                         // calculate the rated total capacity based on peak conditions
    1703             :                         // note: the rated total capacity can be different than the total capacity at
    1704             :                         // rated conditions if the capacity curve isn't normalized at the rated
    1705             :                         // conditions
    1706          21 :                         RatedCapCoolTotalDes = (PeakTotCapTempModFac > 0.0) ? CoolCapAtPeak / PeakTotCapTempModFac : CoolCapAtPeak;
    1707             :                         // reporting
    1708          63 :                         state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirTemp(
    1709          42 :                             state, simpleWatertoAirHP.Name, CompType, MixTemp, state.dataSize->CurSysNum, state.dataSize->CurZoneEqNum);
    1710          21 :                         state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, simpleWatertoAirHP.Name, CompType, MixHumRat);
    1711          21 :                         state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, simpleWatertoAirHP.Name, CompType, SupTemp);
    1712          21 :                         state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirHumRat(state, simpleWatertoAirHP.Name, CompType, SupHumRat);
    1713             :                     } else {
    1714           0 :                         RatedCapCoolTotalDes = 0.0;
    1715             :                     }
    1716             :                 }
    1717          21 :                 if (RatedCapCoolTotalDes < DataHVACGlobals::SmallLoad) {
    1718           0 :                     RatedCapCoolTotalDes = 0.0;
    1719             :                 }
    1720             :             }
    1721             :             // size rated sensible cooling capacity
    1722         133 :             if (simpleWatertoAirHP.RatedCapCoolSens == DataSizing::AutoSize && simpleWatertoAirHP.WAHPType == WatertoAirHP::Cooling) {
    1723         118 :                 RatedCapCoolSensAutoSized = true;
    1724             :             }
    1725         133 :             if (SizingDesRunThisAirSys || SizingDesRunThisZone) HardSizeNoDesRun = false;
    1726         133 :             if (state.dataSize->CurSysNum > 0) {
    1727         112 :                 if (!RatedCapCoolSensAutoSized && !SizingDesRunThisAirSys) { // Simulation continue
    1728          15 :                     HardSizeNoDesRun = true;
    1729          30 :                     if (simpleWatertoAirHP.RatedCapCoolSens > 0.0) {
    1730          60 :                         BaseSizer::reportSizerOutput(
    1731             :                             state,
    1732          30 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1733             :                             simpleWatertoAirHP.Name,
    1734             :                             "User-Specified Rated Sensible Cooling Capacity [W]",
    1735          15 :                             simpleWatertoAirHP.RatedCapCoolSens);
    1736             :                     }
    1737             :                 } else {
    1738         194 :                     CheckSysSizing(
    1739             :                         state,
    1740         194 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1741             :                         simpleWatertoAirHP.Name);
    1742          97 :                     if (CoolingAirVolFlowRateDes > 0.0) {
    1743          97 :                         VolFlowRate = CoolingAirVolFlowRateDes;
    1744             :                     } else {
    1745           0 :                         VolFlowRate = HeatingAirVolFlowRateDes; // system air flow
    1746             :                     }
    1747          97 :                     if (VolFlowRate >= DataHVACGlobals::SmallAirVolFlow) {
    1748          97 :                         auto &finalSysSizing(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum));
    1749          97 :                         if (state.dataSize->CurOASysNum > 0) { // coil is in the OA stream
    1750           0 :                             MixTemp = finalSysSizing.OutTempAtCoolPeak;
    1751           0 :                             MixHumRat = finalSysSizing.OutHumRatAtCoolPeak;
    1752           0 :                             SupTemp = finalSysSizing.PrecoolTemp;
    1753           0 :                             SupHumRat = finalSysSizing.PrecoolHumRat;
    1754             :                         } else { // coil is on the main air loop
    1755          97 :                             SupTemp = finalSysSizing.CoolSupTemp;
    1756          97 :                             SupHumRat = finalSysSizing.CoolSupHumRat;
    1757          97 :                             if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).NumOACoolCoils ==
    1758             :                                 0) { // there is no precooling of the OA stream
    1759          97 :                                 MixTemp = finalSysSizing.MixTempAtCoolPeak;
    1760          97 :                                 MixHumRat = finalSysSizing.MixHumRatAtCoolPeak;
    1761             :                             } else { // there is precooling of OA stream
    1762           0 :                                 if (VolFlowRate > 0.0) {
    1763           0 :                                     OutAirFrac = finalSysSizing.DesOutAirVolFlow / VolFlowRate;
    1764             :                                 } else {
    1765           0 :                                     OutAirFrac = 1.0;
    1766             :                                 }
    1767           0 :                                 OutAirFrac = min(1.0, max(0.0, OutAirFrac));
    1768           0 :                                 MixTemp = OutAirFrac * finalSysSizing.PrecoolTemp + (1.0 - OutAirFrac) * finalSysSizing.RetTempAtCoolPeak;
    1769           0 :                                 MixHumRat = OutAirFrac * finalSysSizing.PrecoolHumRat + (1.0 - OutAirFrac) * finalSysSizing.RetHumRatAtCoolPeak;
    1770             :                             }
    1771             :                         }
    1772             :                         // supply air condition is capped with that of mixed air to avoid SHR > 1.0
    1773          97 :                         SupTemp = min(MixTemp, SupTemp);
    1774          97 :                         SupHumRat = min(MixHumRat, SupHumRat);
    1775          97 :                         OutTemp = finalSysSizing.OutTempAtCoolPeak;
    1776          97 :                         rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, MixTemp, MixHumRat, RoutineName);
    1777          97 :                         MixEnth = Psychrometrics::PsyHFnTdbW(MixTemp, MixHumRat);
    1778          97 :                         SupEnth = Psychrometrics::PsyHFnTdbW(SupTemp, MixHumRat);
    1779          97 :                         Real64 FanCoolLoad = 0.0;
    1780          97 :                         if (state.dataSize->DataFanEnumType > -1 && state.dataSize->DataFanIndex > -1) { // add fan heat to coil load
    1781          97 :                             switch (state.dataSize->DataFanEnumType) {
    1782          97 :                             case DataAirSystems::StructArrayLegacyFanModels: {
    1783          97 :                                 FanCoolLoad = Fans::FanDesHeatGain(state, state.dataSize->DataFanIndex, VolFlowRate);
    1784          97 :                                 break;
    1785             :                             }
    1786           0 :                             case DataAirSystems::ObjectVectorOOFanSystemModel: {
    1787           0 :                                 FanCoolLoad = state.dataHVACFan->fanObjs[state.dataSize->DataFanIndex]->getFanDesignHeatGain(state, VolFlowRate);
    1788           0 :                                 break;
    1789             :                             }
    1790           0 :                             case DataAirSystems::Invalid: {
    1791             :                                 // do nothing
    1792           0 :                                 break;
    1793             :                             }
    1794             :                             } // end switch
    1795          97 :                             Real64 CpAir = Psychrometrics::PsyCpAirFnW(MixHumRat);
    1796          97 :                             if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanLocation ==
    1797             :                                 DataAirSystems::FanPlacement::BlowThru) {
    1798          97 :                                 MixTemp += FanCoolLoad / (CpAir * rhoair * VolFlowRate); // this is now the temperature entering the coil
    1799           0 :                             } else if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanLocation ==
    1800             :                                        DataAirSystems::FanPlacement::DrawThru) {
    1801           0 :                                 SupTemp -= FanCoolLoad / (CpAir * rhoair * VolFlowRate); // this is now the temperature leaving the coil
    1802             :                             }
    1803             :                         }
    1804             :                         // Sensible capacity is calculated from enthalpy difference with constant humidity ratio, i.e.,
    1805             :                         // there is only temperature difference between entering and leaving air enthalpy. Previously
    1806             :                         // it was calculated using m.cp.dT
    1807          97 :                         SensCapAtPeak = (rhoair * VolFlowRate * (MixEnth - SupEnth)) +
    1808             :                                         FanCoolLoad; // load on the cooling coil which includes ventilation load and fan heat (sensible)
    1809          97 :                         SensCapAtPeak = max(0.0, SensCapAtPeak);
    1810          97 :                         MixWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, MixTemp, MixHumRat, state.dataEnvrn->StdBaroPress, RoutineName);
    1811          97 :                         RatedMixWetBulb = simpleWatertoAirHP.RatedEntAirWetbulbTemp;
    1812          97 :                         RatedMixDryBulb = simpleWatertoAirHP.RatedEntAirDrybulbTemp;
    1813             :                         // calculate temperature ratios at design day peak conditions
    1814          97 :                         ratioTDB = (MixTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1815          97 :                         ratioTWB = (MixWetBulb + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1816         291 :                         PltSizNum = PlantUtilities::MyPlantSizingIndex(
    1817             :                             state,
    1818         194 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1819             :                             simpleWatertoAirHP.Name,
    1820             :                             simpleWatertoAirHP.WaterInletNodeNum,
    1821             :                             simpleWatertoAirHP.WaterOutletNodeNum,
    1822             :                             ErrorsFound,
    1823             :                             false);
    1824          97 :                         if (PltSizNum > 0) {
    1825          97 :                             DesignEntWaterTemp = state.dataSize->PlantSizData(PltSizNum).ExitTemp;
    1826          97 :                             ratioTS = (DesignEntWaterTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1827             :                         } else {
    1828           0 :                             ShowSevereError(state, "Autosizing of sensible cooling capacity requires a loop Sizing:Plant object");
    1829           0 :                             ShowContinueError(state, "Autosizing also requires physical connection to a plant or condenser loop.");
    1830           0 :                             ShowContinueError(state,
    1831           0 :                                               format("Occurs in COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT Object={}",
    1832           0 :                                                      WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    1833           0 :                                                      simpleWatertoAirHP.Name));
    1834           0 :                             ErrorsFound = true;
    1835             :                         }
    1836             :                         // calculate temperatue ratio at rated conditions
    1837          97 :                         RatedratioTDB = (RatedMixDryBulb + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1838          97 :                         RatedratioTWB = (RatedMixWetBulb + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1839          97 :                         RatedratioTS = (simpleWatertoAirHP.RatedEntWaterTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1840             :                         // determine curve modifiers at peak and rated conditions
    1841          97 :                         PeakSensCapTempModFac =
    1842         194 :                             Curve::CurveValue(state, simpleWatertoAirHP.SensCoolCapCurveIndex, ratioTDB, ratioTWB, ratioTS, 1.0, 1.0);
    1843          97 :                         RatedSensCapTempModFac =
    1844         194 :                             Curve::CurveValue(state, simpleWatertoAirHP.SensCoolCapCurveIndex, RatedratioTDB, RatedratioTWB, RatedratioTS, 1.0, 1.0);
    1845             :                         // calculate the rated sensible capacity based on peak conditions
    1846             :                         // note: the rated sensible capacity can be different than the sensible capacity
    1847             :                         // at rated conditions if the capacity curve isn't normalized at the rated
    1848             :                         // conditions
    1849          97 :                         RatedCapCoolSensDes = (PeakSensCapTempModFac > 0.0) ? SensCapAtPeak / PeakSensCapTempModFac : SensCapAtPeak;
    1850             :                     } else {
    1851           0 :                         RatedCapCoolSensDes = 0.0;
    1852             :                     }
    1853             :                 }
    1854          21 :             } else if (state.dataSize->CurZoneEqNum > 0) {
    1855          21 :                 if (!RatedCapCoolSensAutoSized && !SizingDesRunThisZone) { // Simulation continue
    1856           0 :                     HardSizeNoDesRun = true;
    1857           0 :                     if (simpleWatertoAirHP.RatedCapCoolSens > 0.0) {
    1858           0 :                         BaseSizer::reportSizerOutput(
    1859             :                             state,
    1860           0 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1861             :                             simpleWatertoAirHP.Name,
    1862             :                             "User-Specified Rated Sensible Cooling Capacity [W]",
    1863           0 :                             simpleWatertoAirHP.RatedCapCoolSens);
    1864             :                     }
    1865             :                 } else {
    1866          42 :                     CheckZoneSizing(
    1867             :                         state,
    1868          42 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1869             :                         simpleWatertoAirHP.Name);
    1870          21 :                     if (CoolingAirVolFlowRateDes > 0.0) {
    1871          19 :                         VolFlowRate = CoolingAirVolFlowRateDes;
    1872             :                     } else {
    1873           2 :                         VolFlowRate = HeatingAirVolFlowRateDes; // system air flow
    1874             :                     }
    1875          21 :                     if (VolFlowRate >= DataHVACGlobals::SmallAirVolFlow) {
    1876          21 :                         if (state.dataSize->ZoneEqDXCoil) {
    1877          21 :                             if (ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) {
    1878           7 :                                 MixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInTemp;
    1879           7 :                                 MixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInHumRat;
    1880             :                             } else {
    1881          14 :                                 MixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneRetTempAtCoolPeak;
    1882          14 :                                 MixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneHumRatAtCoolPeak;
    1883             :                             }
    1884             :                         } else {
    1885           0 :                             MixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInTemp;
    1886           0 :                             MixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesCoolCoilInHumRat;
    1887             :                         }
    1888          21 :                         SupTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).CoolDesTemp;
    1889          21 :                         SupHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).CoolDesHumRat;
    1890             :                         // supply air condition is capped with that of mixed air to avoid SHR > 1.0
    1891          21 :                         SupTemp = min(MixTemp, SupTemp);
    1892          21 :                         SupHumRat = min(MixHumRat, SupHumRat);
    1893          21 :                         TimeStepNumAtMax = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).TimeStepNumAtCoolMax;
    1894          21 :                         DDNum = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).CoolDDNum;
    1895          21 :                         if (DDNum > 0 && TimeStepNumAtMax > 0) {
    1896          21 :                             OutTemp = state.dataSize->DesDayWeath(DDNum).Temp(TimeStepNumAtMax);
    1897             :                         } else {
    1898           0 :                             OutTemp = 0.0;
    1899             :                         }
    1900          21 :                         rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, MixTemp, MixHumRat, RoutineName);
    1901          21 :                         MixEnth = Psychrometrics::PsyHFnTdbW(MixTemp, MixHumRat);
    1902          21 :                         SupEnth = Psychrometrics::PsyHFnTdbW(SupTemp, MixHumRat);
    1903          21 :                         Real64 FanCoolLoad = 0.0;
    1904          21 :                         if (state.dataSize->DataFanEnumType > -1 && state.dataSize->DataFanIndex > -1) { // add fan heat to coil load
    1905          21 :                             switch (state.dataSize->DataFanEnumType) {
    1906          20 :                             case DataAirSystems::StructArrayLegacyFanModels: {
    1907          20 :                                 FanCoolLoad = Fans::FanDesHeatGain(state, state.dataSize->DataFanIndex, VolFlowRate);
    1908          20 :                                 break;
    1909             :                             }
    1910           1 :                             case DataAirSystems::ObjectVectorOOFanSystemModel: {
    1911           1 :                                 FanCoolLoad = state.dataHVACFan->fanObjs[state.dataSize->DataFanIndex]->getFanDesignHeatGain(state, VolFlowRate);
    1912           1 :                                 break;
    1913             :                             }
    1914           0 :                             case DataAirSystems::Invalid: {
    1915             :                                 // do nothing
    1916           0 :                                 break;
    1917             :                             }
    1918             :                             } // end switch
    1919          21 :                             Real64 CpAir = Psychrometrics::PsyCpAirFnW(MixHumRat);
    1920          21 :                             if (state.dataSize->DataFanPlacement == DataSizing::ZoneFanPlacement::BlowThru) {
    1921          14 :                                 MixTemp += FanCoolLoad / (CpAir * rhoair * VolFlowRate); // this is now the temperature entering the coil
    1922             :                             } else {
    1923           7 :                                 SupTemp -= FanCoolLoad / (CpAir * rhoair * VolFlowRate); // this is now the temperature leaving the coil
    1924             :                             }
    1925             :                         }
    1926             :                         // Sensible capacity is calculated from enthalpy difference with constant humidity ratio, i.e.,
    1927             :                         // there is only temperature difference between entering and leaving air enthalpy. Previously
    1928             :                         // it was calculated using m.cp.dT
    1929          21 :                         SensCapAtPeak = (rhoair * VolFlowRate * (MixEnth - SupEnth)) +
    1930             :                                         FanCoolLoad; // load on the cooling coil which includes ventilation load and fan heat (sensible)
    1931          21 :                         SensCapAtPeak = max(0.0, SensCapAtPeak);
    1932          21 :                         MixWetBulb = Psychrometrics::PsyTwbFnTdbWPb(state, MixTemp, MixHumRat, state.dataEnvrn->StdBaroPress, RoutineName);
    1933          21 :                         RatedMixWetBulb = simpleWatertoAirHP.RatedEntAirWetbulbTemp;
    1934          21 :                         RatedMixDryBulb = simpleWatertoAirHP.RatedEntAirDrybulbTemp;
    1935             :                         // calculate temperature ratios at design day peak conditions
    1936          21 :                         ratioTDB = (MixTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1937          21 :                         ratioTWB = (MixWetBulb + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1938          63 :                         PltSizNum = PlantUtilities::MyPlantSizingIndex(
    1939             :                             state,
    1940          42 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    1941             :                             simpleWatertoAirHP.Name,
    1942             :                             simpleWatertoAirHP.WaterInletNodeNum,
    1943             :                             simpleWatertoAirHP.WaterOutletNodeNum,
    1944             :                             ErrorsFound,
    1945             :                             false);
    1946          21 :                         if (PltSizNum > 0) {
    1947          21 :                             DesignEntWaterTemp = state.dataSize->PlantSizData(PltSizNum).ExitTemp;
    1948          21 :                             ratioTS = (DesignEntWaterTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1949             :                         } else {
    1950           0 :                             ShowSevereError(state, "Autosizing of sensible cooling capacity requires a loop Sizing:Plant object");
    1951           0 :                             ShowContinueError(state, "Autosizing also requires physical connection to a plant or condenser loop.");
    1952           0 :                             ShowContinueError(state,
    1953           0 :                                               format("Occurs in COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT Object={}",
    1954           0 :                                                      WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    1955           0 :                                                      simpleWatertoAirHP.Name));
    1956           0 :                             ErrorsFound = true;
    1957             :                         }
    1958             :                         // calculate temperatue ratio at rated conditions
    1959          21 :                         RatedratioTDB = (RatedMixDryBulb + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1960          21 :                         RatedratioTWB = (RatedMixWetBulb + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1961          21 :                         RatedratioTS = (simpleWatertoAirHP.RatedEntWaterTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    1962          21 :                         PeakSensCapTempModFac =
    1963          42 :                             Curve::CurveValue(state, simpleWatertoAirHP.SensCoolCapCurveIndex, ratioTDB, ratioTWB, ratioTS, 1.0, 1.0);
    1964          21 :                         RatedSensCapTempModFac =
    1965          42 :                             Curve::CurveValue(state, simpleWatertoAirHP.SensCoolCapCurveIndex, RatedratioTDB, RatedratioTWB, RatedratioTS, 1.0, 1.0);
    1966             :                         // Check curve output when rated mixed air wetbulb is the design mixed air wetbulb
    1967             :                         // calculate the rated sensible capacity based on peak conditions
    1968             :                         // note: the rated sensible capacity can be different than the sensible capacity
    1969             :                         // at rated conditions if the capacity curve isn't normalized at the rated
    1970             :                         // conditions
    1971          21 :                         RatedCapCoolSensDes = (PeakSensCapTempModFac > 0.0) ? SensCapAtPeak / PeakSensCapTempModFac : SensCapAtPeak;
    1972             :                     } else {
    1973           0 :                         RatedCapCoolSensDes = 0.0;
    1974             :                     }
    1975             :                 }
    1976             :             }
    1977         133 :             if (RatedCapCoolSensDes < DataHVACGlobals::SmallLoad) {
    1978          15 :                 RatedCapCoolSensDes = 0.0;
    1979             :             }
    1980         133 :             if (RatedCapCoolTotalAutoSized && RatedCapCoolSensAutoSized) {
    1981         118 :                 if (RatedCapCoolSensDes > RatedCapCoolTotalDes) {
    1982           0 :                     RatedCapCoolTotalDes = RatedCapCoolSensDes;
    1983             :                 }
    1984             :             }
    1985         133 :             if (!HardSizeNoDesRun) {
    1986         118 :                 if (RatedCapCoolTotalAutoSized) {
    1987         118 :                     if (simpleWatertoAirHP.CompanionHeatingCoilNum > 0) {
    1988             :                         auto &companionHeatingCoil(
    1989         118 :                             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum));
    1990         236 :                         if (companionHeatingCoil.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit &&
    1991         118 :                             companionHeatingCoil.RatedCapHeat > 0) {
    1992             :                             // case 1: companion heating coil has a user-specified capacity
    1993             :                             // or has already been sized
    1994           0 :                             RatedCapCoolTotalDesCDD = RatedCapCoolTotalDes;
    1995           0 :                             RatedCapCoolHeatDD = companionHeatingCoil.RatedCapHeatAtRatedCdts / companionHeatingCoil.RatioRatedHeatRatedTotCoolCap /
    1996             :                                                  RatedTotCapTempModFac;
    1997           0 :                             if (RatedCapCoolHeatDD > RatedCapCoolTotalDesCDD) {
    1998             :                                 // re-base the cooling capacity
    1999           0 :                                 RatedCapCoolTotalDes = RatedCapCoolHeatDD;
    2000             : 
    2001             :                                 // adjust for system air flow -- capacity is based on heating design day calcs
    2002             :                                 // adjust by ratio of system to heating air flow rate and temperature delta across the coil at these different airflow
    2003           0 :                                 RatedCapCoolTotalDes *= (RatedAirVolFlowRateDes / HeatingAirVolFlowRateDes) * HeatdTratio;
    2004             : 
    2005           0 :                                 if (RatedCapCoolSensAutoSized) {
    2006             :                                     // adjust sensible capacity assuming that the SHR is constant
    2007           0 :                                     RatedCapCoolSensDes *= RatedCapCoolTotalDes / RatedCapCoolTotalDesCDD;
    2008             :                                 }
    2009             : 
    2010           0 :                                 simpleWatertoAirHP.RatedCapCoolTotal = RatedCapCoolTotalDes;
    2011           0 :                                 OutputReportPredefined::PreDefTableEntry(
    2012           0 :                                     state, state.dataOutRptPredefined->pdchWAHPDD, simpleWatertoAirHP.Name, "Heating");
    2013             :                             } else {
    2014             :                                 // adjust for system air flow -- capacity is based on cooling design day calcs
    2015             :                                 // adjust by ratio of system to cooling air flow rate and enthalpy delta across the coil at these different airflow
    2016           0 :                                 RatedCapCoolTotalDes *= (RatedAirVolFlowRateDes / CoolingAirVolFlowRateDes) * dHratio;
    2017             : 
    2018           0 :                                 simpleWatertoAirHP.RatedCapCoolTotal = RatedCapCoolTotalDes;
    2019           0 :                                 OutputReportPredefined::PreDefTableEntry(
    2020           0 :                                     state, state.dataOutRptPredefined->pdchWAHPDD, simpleWatertoAirHP.Name, "Cooling");
    2021             :                             }
    2022             :                             // Set the global DX cooling coil capacity variable for use by other objects
    2023           0 :                             state.dataSize->DXCoolCap = simpleWatertoAirHP.RatedCapCoolTotal;
    2024         236 :                         } else if (companionHeatingCoil.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit &&
    2025         118 :                                    companionHeatingCoil.RatedCapHeat == DataSizing::AutoSize) {
    2026             :                             // case 2: companion heating coil has not already been sized
    2027             :                             // we only pass the rated total cooling capacity determined
    2028             :                             // based on cooling design day which is used to decide if the
    2029             :                             // coil needs to be sized of the heating coil size
    2030             :                             //
    2031             :                             // no capcity adjustment based on system flow because the capacity could change
    2032             :                             // once the heating coil has been sized
    2033         118 :                             state.dataSize->DXCoolCap = RatedCapCoolTotalDes;
    2034           0 :                         } else if (companionHeatingCoil.WAHPPlantType != DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit) {
    2035             :                             // case 3: companion heating coil is not of the "equationfit" type and hence doesn't use the rated heating to cooling
    2036             :                             // coil capacity ratio
    2037             :                             // adjust for system air flow -- capacity is based on cooling design day calcs
    2038             :                             // adjust by ratio of system to cooling air flow rate and enthalpy delta across the coil at these different airflow
    2039           0 :                             RatedCapCoolTotalDes *= (RatedAirVolFlowRateDes / CoolingAirVolFlowRateDes) * dHratio;
    2040           0 :                             simpleWatertoAirHP.RatedCapCoolTotal = RatedCapCoolTotalDes;
    2041             :                             // Set the global DX cooling coil capacity variable for use by other objects
    2042           0 :                             state.dataSize->DXCoolCap = simpleWatertoAirHP.RatedCapCoolTotal;
    2043             :                         }
    2044             :                     } else {
    2045             :                         // adjust for system air flow -- capacity is based on cooling design day calcs
    2046             :                         // adjust by ratio of system to cooling air flow rate and enthalpy delta across the coil at these different airflow
    2047           0 :                         RatedCapCoolTotalDes *= (RatedAirVolFlowRateDes / CoolingAirVolFlowRateDes) * dHratio;
    2048             : 
    2049           0 :                         simpleWatertoAirHP.RatedCapCoolTotal = RatedCapCoolTotalDes;
    2050           0 :                         state.dataSize->DXCoolCap = simpleWatertoAirHP.RatedCapCoolTotal;
    2051             :                     }
    2052             :                     // size power
    2053         118 :                     simpleWatertoAirHP.RatedCapCoolAtRatedCdts = RatedCapCoolTotalDes * RatedTotCapTempModFac;
    2054         118 :                     simpleWatertoAirHP.RatedPowerCoolAtRatedCdts =
    2055         118 :                         simpleWatertoAirHP.RatedCapCoolAtRatedCdts / simpleWatertoAirHP.RatedCOPCoolAtRatedCdts;
    2056         118 :                     simpleWatertoAirHP.RatedPowerCool = simpleWatertoAirHP.RatedPowerCoolAtRatedCdts / RatedCoolPowerTempModFac;
    2057         118 :                     if (simpleWatertoAirHP.RatedCapCoolTotal != DataSizing::AutoSize) {
    2058           0 :                         BaseSizer::reportSizerOutput(
    2059             :                             state,
    2060           0 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2061             :                             simpleWatertoAirHP.Name,
    2062             :                             "Design Size Rated Total Cooling Capacity [W]",
    2063           0 :                             simpleWatertoAirHP.RatedCapCoolTotal);
    2064             :                     }
    2065         236 :                     OutputReportPredefined::PreDefTableEntry(
    2066         118 :                         state, state.dataOutRptPredefined->pdchWAHPRatedAirDBT, simpleWatertoAirHP.Name, RatedMixDryBulb);
    2067         236 :                     OutputReportPredefined::PreDefTableEntry(
    2068         118 :                         state, state.dataOutRptPredefined->pdchWAHPRatedAirWBT, simpleWatertoAirHP.Name, RatedMixWetBulb);
    2069         236 :                     OutputReportPredefined::PreDefTableEntry(
    2070         118 :                         state, state.dataOutRptPredefined->pdchWAHPRatedWtrT, simpleWatertoAirHP.Name, simpleWatertoAirHP.RatedEntWaterTemp);
    2071             :                 } else { // Hardsized with sizing data
    2072           0 :                     if (simpleWatertoAirHP.RatedCapCoolTotal > 0.0 && RatedCapCoolTotalDes > 0.0) {
    2073           0 :                         RatedCapCoolTotalUser = simpleWatertoAirHP.RatedCapCoolTotal;
    2074           0 :                         state.dataSize->DXCoolCap = simpleWatertoAirHP.RatedCapCoolTotal;
    2075           0 :                         simpleWatertoAirHP.RatedPowerCool = simpleWatertoAirHP.RatedCapCoolTotal / simpleWatertoAirHP.RatedCOPCoolAtRatedCdts;
    2076           0 :                         BaseSizer::reportSizerOutput(
    2077             :                             state,
    2078           0 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2079             :                             simpleWatertoAirHP.Name,
    2080             :                             "Design Size Rated Total Cooling Capacity [W]",
    2081             :                             RatedCapCoolTotalDes,
    2082             :                             "User-Specified Rated Total Cooling Capacity [W]",
    2083           0 :                             RatedCapCoolTotalUser);
    2084           0 :                         if (state.dataGlobal->DisplayExtraWarnings) {
    2085           0 :                             if ((std::abs(RatedCapCoolTotalDes - RatedCapCoolTotalUser) / RatedCapCoolTotalUser) >
    2086           0 :                                 state.dataSize->AutoVsHardSizingThreshold) {
    2087           0 :                                 ShowMessage(
    2088             :                                     state,
    2089           0 :                                     format("SizeHVACWaterToAir: Potential issue with equipment sizing for coil {}:WATERTOAIRHEATPUMP:EQUATIONFIT {}",
    2090           0 :                                            WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    2091           0 :                                            simpleWatertoAirHP.Name));
    2092           0 :                                 ShowContinueError(state, format("User-Specified Rated Total Cooling Capacity of {:.2R} [W]", RatedCapCoolTotalUser));
    2093           0 :                                 ShowContinueError(
    2094           0 :                                     state, format("differs from Design Size Rated Total Cooling Capacity of {:.2R} [W]", RatedCapCoolTotalDes));
    2095           0 :                                 ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
    2096           0 :                                 ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
    2097             :                             }
    2098             :                         }
    2099             :                     }
    2100             :                 }
    2101             :             } else {
    2102          15 :                 state.dataSize->DXCoolCap = simpleWatertoAirHP.RatedCapCoolTotal;
    2103             :                 // user provided inputs are assumed to be at rated conditions
    2104          15 :                 simpleWatertoAirHP.RatedPowerCool = simpleWatertoAirHP.RatedCapCoolTotal / simpleWatertoAirHP.RatedCOPCoolAtRatedCdts;
    2105          15 :                 simpleWatertoAirHP.RatedCapCoolAtRatedCdts = 0;
    2106          15 :                 simpleWatertoAirHP.RatedPowerCoolAtRatedCdts = 0;
    2107             :             }
    2108         133 :             if (simpleWatertoAirHP.RatedCapCoolTotal !=
    2109             :                 DataSizing::AutoSize) { // all cases except case 2 mentioned above (when EquationFit companion heating coil has not yet been sized)
    2110          30 :                 OutputReportPredefined::PreDefTableEntry(
    2111          15 :                     state, state.dataOutRptPredefined->pdchCoolCoilTotCap, simpleWatertoAirHP.Name, simpleWatertoAirHP.RatedCapCoolTotal);
    2112          45 :                 OutputReportPredefined::PreDefTableEntry(state,
    2113          15 :                                                          state.dataOutRptPredefined->pdchCoolCoilLatCap,
    2114             :                                                          simpleWatertoAirHP.Name,
    2115          15 :                                                          simpleWatertoAirHP.RatedCapCoolTotal - simpleWatertoAirHP.RatedCapCoolSens);
    2116          15 :                 if (simpleWatertoAirHP.RatedCapCoolTotal > 0) {
    2117          45 :                     OutputReportPredefined::PreDefTableEntry(state,
    2118          15 :                                                              state.dataOutRptPredefined->pdchCoolCoilSHR,
    2119             :                                                              simpleWatertoAirHP.Name,
    2120          15 :                                                              simpleWatertoAirHP.RatedCapCoolSens / simpleWatertoAirHP.RatedCapCoolTotal);
    2121             :                 } else {
    2122           0 :                     OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, simpleWatertoAirHP.Name, 0.0);
    2123             :                 }
    2124          15 :                 if (RatedCapCoolTotalAutoSized) {
    2125           0 :                     OutputReportPredefined::PreDefTableEntry(state,
    2126           0 :                                                              state.dataOutRptPredefined->pdchWAHPRatedCapAtRatedCdts,
    2127             :                                                              simpleWatertoAirHP.Name,
    2128             :                                                              simpleWatertoAirHP.RatedCapCoolAtRatedCdts);
    2129           0 :                     if (simpleWatertoAirHP.CompanionHeatingCoilNum > 0) {
    2130             :                         auto &companionHeatingCoil(
    2131           0 :                             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum));
    2132           0 :                         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchWAHPDD, companionHeatingCoil.Name, "Cooling");
    2133             :                     }
    2134             :                 }
    2135             :             } else {
    2136             :                 // set temporarily until companion heating coil is sized
    2137         118 :                 OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilTotCap, simpleWatertoAirHP.Name, 0.0);
    2138         118 :                 OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilLatCap, simpleWatertoAirHP.Name, 0.0);
    2139         118 :                 OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, simpleWatertoAirHP.Name, 0.0);
    2140         118 :                 OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilNomEff, simpleWatertoAirHP.Name, 0.0);
    2141             :             }
    2142         133 :             if (simpleWatertoAirHP.RatedCapCoolTotal != DataSizing::AutoSize) {
    2143          60 :                 state.dataRptCoilSelection->coilSelectionReportObj->setCoilCoolingCapacity(state,
    2144             :                                                                                            simpleWatertoAirHP.Name,
    2145             :                                                                                            CompType,
    2146             :                                                                                            simpleWatertoAirHP.RatedCapCoolTotal,
    2147             :                                                                                            RatedCapCoolTotalAutoSized,
    2148          15 :                                                                                            state.dataSize->CurSysNum,
    2149          15 :                                                                                            state.dataSize->CurZoneEqNum,
    2150          15 :                                                                                            state.dataSize->CurOASysNum,
    2151             :                                                                                            FanCoolLoad,
    2152             :                                                                                            PeakTotCapTempModFac,
    2153             :                                                                                            -999.0,
    2154             :                                                                                            -999.0);
    2155             :             }
    2156         133 :             if (!HardSizeNoDesRun) {
    2157         118 :                 if (RatedCapCoolSensAutoSized) {
    2158         118 :                     simpleWatertoAirHP.RatedCapCoolSens = RatedCapCoolSensDes;
    2159         118 :                     simpleWatertoAirHP.RatedCapCoolSensDesAtRatedCdts = RatedCapCoolSensDes * RatedSensCapTempModFac;
    2160         118 :                     if (simpleWatertoAirHP.RatedCapCoolTotal != DataSizing::AutoSize) {
    2161           0 :                         BaseSizer::reportSizerOutput(
    2162             :                             state,
    2163           0 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2164             :                             simpleWatertoAirHP.Name,
    2165             :                             "Design Size Rated Sensible Cooling Capacity [W]",
    2166           0 :                             RatedCapCoolSensDes);
    2167             :                     }
    2168             :                 } else {
    2169           0 :                     if (simpleWatertoAirHP.RatedCapCoolSens > 0.0 && RatedCapCoolSensDes > 0.0) {
    2170           0 :                         RatedCapCoolSensUser = simpleWatertoAirHP.RatedCapCoolSens;
    2171           0 :                         BaseSizer::reportSizerOutput(
    2172             :                             state,
    2173           0 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2174             :                             simpleWatertoAirHP.Name,
    2175             :                             "Design Size Rated Sensible Cooling Capacity [W]",
    2176             :                             RatedCapCoolSensDes,
    2177             :                             "User-Specified Rated Sensible Cooling Capacity [W]",
    2178           0 :                             RatedCapCoolSensUser);
    2179           0 :                         if (state.dataGlobal->DisplayExtraWarnings) {
    2180           0 :                             if ((std::abs(RatedCapCoolSensDes - RatedCapCoolSensUser) / RatedCapCoolSensUser) >
    2181           0 :                                 state.dataSize->AutoVsHardSizingThreshold) {
    2182           0 :                                 ShowMessage(
    2183             :                                     state,
    2184           0 :                                     format("SizeHVACWaterToAir: Potential issue with equipment sizing for coil {}:WATERTOAIRHEATPUMP:EQUATIONFIT {}",
    2185           0 :                                            WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    2186           0 :                                            simpleWatertoAirHP.Name));
    2187           0 :                                 ShowContinueError(state,
    2188           0 :                                                   format("User-Specified Rated Sensible Cooling Capacity of {:.2R} [W]", RatedCapCoolSensUser));
    2189           0 :                                 ShowContinueError(
    2190           0 :                                     state, format("differs from Design Size Rated Sensible Cooling Capacity of {:.2R} [W]", RatedCapCoolSensDes));
    2191           0 :                                 ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
    2192           0 :                                 ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
    2193             :                             }
    2194             :                         }
    2195             :                     }
    2196             :                 }
    2197             :             }
    2198         266 :             OutputReportPredefined::PreDefTableEntry(
    2199         133 :                 state, state.dataOutRptPredefined->pdchCoolCoilSensCap, simpleWatertoAirHP.Name, simpleWatertoAirHP.RatedCapCoolSens);
    2200         399 :             OutputReportPredefined::PreDefTableEntry(state,
    2201         133 :                                                      state.dataOutRptPredefined->pdchCoolCoilLatCap,
    2202             :                                                      simpleWatertoAirHP.Name,
    2203         133 :                                                      state.dataSize->DXCoolCap - simpleWatertoAirHP.RatedCapCoolSens);
    2204         133 :             if (RatedCapCoolSensAutoSized) {
    2205             : 
    2206         236 :                 OutputReportPredefined::PreDefTableEntry(state,
    2207         118 :                                                          state.dataOutRptPredefined->pdchWAHPRatedSensCapAtRatedCdts,
    2208             :                                                          simpleWatertoAirHP.Name,
    2209             :                                                          simpleWatertoAirHP.RatedCapCoolSensDesAtRatedCdts);
    2210             :             }
    2211         133 :             if (simpleWatertoAirHP.RatedCapCoolTotal != 0.0) {
    2212         399 :                 OutputReportPredefined::PreDefTableEntry(state,
    2213         133 :                                                          state.dataOutRptPredefined->pdchCoolCoilSHR,
    2214             :                                                          simpleWatertoAirHP.Name,
    2215         133 :                                                          simpleWatertoAirHP.RatedCapCoolSens / state.dataSize->DXCoolCap);
    2216             :             } else {
    2217           0 :                 OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchCoolCoilSHR, simpleWatertoAirHP.Name, 0.0);
    2218             :             }
    2219             :             // test autosized sensible and total cooling capacity for total > sensible
    2220         133 :             if ((RatedCapCoolSensAutoSized && RatedCapCoolTotalAutoSized) || RatedCapCoolSensAutoSized) {
    2221         236 :                 if (simpleWatertoAirHP.RatedCapCoolSensDesAtRatedCdts > simpleWatertoAirHP.RatedCapCoolAtRatedCdts) {
    2222           0 :                     ShowWarningError(state,
    2223           0 :                                      format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT \"{}\"",
    2224           0 :                                             WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    2225           0 :                                             simpleWatertoAirHP.Name));
    2226           0 :                     ShowContinueError(state, format("{}: Rated Sensible Cooling Capacity > Rated Total Cooling Capacity", RoutineName));
    2227           0 :                     ShowContinueError(state, "Both of these capacity inputs have been autosized.");
    2228           0 :                     ShowContinueError(
    2229             :                         state,
    2230           0 :                         format("Rated Sensible Cooling Capacity at Rated Conditions = {:.2T} W", simpleWatertoAirHP.RatedCapCoolSensDesAtRatedCdts));
    2231           0 :                     ShowContinueError(
    2232           0 :                         state, format("Rated Total Cooling Capacity at Rated Conditions    = {:.2T} W", simpleWatertoAirHP.RatedCapCoolAtRatedCdts));
    2233           0 :                     ShowContinueError(state, "See eio file for further details.");
    2234           0 :                     ShowContinueError(state, "Check Total and Sensible Cooling Capacity coefficients in curves to ensure they are accurate.");
    2235           0 :                     ShowContinueError(state, "Check Zone and System Sizing objects to verify sizing inputs.");
    2236           0 :                     ShowContinueError(state, "Sizing statistics:");
    2237           0 :                     ShowContinueError(state, format("Rated entering Air Wet-Bulb Temperature = {:.3T} C", RatedMixWetBulb));
    2238           0 :                     ShowContinueError(state, format("Peak entering Air Wet-Bulb Temperature = {:.3T} C", MixWetBulb));
    2239           0 :                     ShowContinueError(state, format("Entering Water Temperature used = {:.3T} C", simpleWatertoAirHP.RatedEntWaterTemp));
    2240           0 :                     ShowContinueError(state, "Design air and water flow rates = 1.0");
    2241           0 :                     ShowContinueError(
    2242           0 :                         state, format("Rated ratio of load-side air wet-bulb temperature to 283.15 C (Rated ratioTWB) = {:.3T}", RatedratioTWB));
    2243           0 :                     ShowContinueError(
    2244           0 :                         state, format("Rated ratio of source-side inlet water temperature to 283.15 C (Rated ratioTS)  = {:.3T}", RatedratioTS));
    2245           0 :                     ShowContinueError(state,
    2246           0 :                                       format("Peak ratio of load-side air wet-bulb temperature to 283.15 C (Peak ratioTWB) = {:.3T}", ratioTWB));
    2247           0 :                     ShowContinueError(state,
    2248           0 :                                       format("Peak ratio of source-side inlet water temperature to 283.15 C (Peak ratioTS)  = {:.3T}", ratioTS));
    2249           0 :                     ShowContinueError(state, format("Rated Total Cooling Capacity Modifier = {:.5T}", RatedTotCapTempModFac));
    2250           0 :                     ShowContinueError(state, format("Peak Design Total Cooling Capacity Modifier = {:.5T}", PeakTotCapTempModFac));
    2251           0 :                     ShowContinueError(state, format("Rated Sensible Cooling Capacity Modifier = {:.5T}", RatedSensCapTempModFac));
    2252           0 :                     ShowContinueError(state, format("Peak Design Sensible Cooling Capacity Modifier = {:.5T}", PeakSensCapTempModFac));
    2253           0 :                     ShowContinueError(state,
    2254             :                                       "...Rated Total Cooling Capacity at Rated Conditions = Total Peak Design Load * Rated Total "
    2255             :                                       "Cooling Capacity Modifier  / "
    2256             :                                       "Peak Design Total Cooling Capacity Modifier");
    2257           0 :                     ShowContinueError(state,
    2258             :                                       "...Rated Sensible Cooling Capacity at Rated Conditions = Peak Design Sensible Load * Rated "
    2259             :                                       "Sensible Cooling "
    2260             :                                       "Capacity Modifier  / Peak Design Sensible Cooling Capacity Modifier");
    2261           0 :                     ShowContinueError(state, "Carefully review the Load Side Total, Sensible, and Latent heat transfer rates");
    2262           0 :                     ShowContinueError(state, "... to ensure they meet the expected manufacturers performance specifications.");
    2263             :                 }
    2264          15 :             } else if (RatedCapCoolTotalAutoSized) {
    2265           0 :                 if (simpleWatertoAirHP.RatedCapCoolSensDesAtRatedCdts > simpleWatertoAirHP.RatedCapCoolAtRatedCdts) {
    2266           0 :                     ShowWarningError(state,
    2267           0 :                                      format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT \"{}\"",
    2268           0 :                                             WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    2269           0 :                                             simpleWatertoAirHP.Name));
    2270           0 :                     ShowContinueError(state, format("{}: Rated Sensible Cooling Capacity > Rated Total Cooling Capacity", RoutineName));
    2271           0 :                     ShowContinueError(state, "Only the Rated total capacity input is autosized, consider autosizing both inputs.");
    2272           0 :                     ShowContinueError(state, format("Rated Sensible Cooling Capacity = {:.2T} W", simpleWatertoAirHP.RatedCapCoolSensDesAtRatedCdts));
    2273           0 :                     ShowContinueError(state, format("Rated Total Cooling Capacity    = {:.2T} W", simpleWatertoAirHP.RatedCapCoolAtRatedCdts));
    2274           0 :                     ShowContinueError(state, "See eio file for further details.");
    2275           0 :                     ShowContinueError(state, "Check Total and Sensible Cooling Capacity coefficients in curves to ensure they are accurate.");
    2276           0 :                     ShowContinueError(state, "Check Zone and System Sizing objects to verify sizing inputs.");
    2277           0 :                     ShowContinueError(state, "Sizing statistics for Total Cooling Capacity:");
    2278           0 :                     ShowContinueError(state, format("Rated entering Air Wet-Bulb Temperature = {:.3T} C", RatedMixWetBulb));
    2279           0 :                     ShowContinueError(state, format("Peak entering Air Wet-Bulb Temperature = {:.3T} C", MixWetBulb));
    2280           0 :                     ShowContinueError(state, format("Entering Water Temperature used = {:.3T} C", simpleWatertoAirHP.RatedEntWaterTemp));
    2281           0 :                     ShowContinueError(state, "Design air and water flow rates = 1.0");
    2282           0 :                     ShowContinueError(
    2283           0 :                         state, format("Rated ratio of load-side air wet-bulb temperature to 283.15 C (Rated ratioTWB) = {:.3T}", RatedratioTWB));
    2284           0 :                     ShowContinueError(
    2285           0 :                         state, format("Rated ratio of source-side inlet water temperature to 283.15 C (Rated ratioTS)  = {:.3T}", RatedratioTS));
    2286           0 :                     ShowContinueError(state,
    2287           0 :                                       format("Peak ratio of load-side air wet-bulb temperature to 283.15 C (Peak ratioTWB) = {:.3T}", ratioTWB));
    2288           0 :                     ShowContinueError(state,
    2289           0 :                                       format("Peak ratio of source-side inlet water temperature to 283.15 C (Peak ratioTS)  = {:.3T}", ratioTS));
    2290           0 :                     ShowContinueError(state, format("Rated Total Cooling Capacity Modifier = {:.5T}", RatedTotCapTempModFac));
    2291           0 :                     ShowContinueError(state, format("Peak Design Total Cooling Capacity Modifier = {:.5T}", PeakTotCapTempModFac));
    2292           0 :                     ShowContinueError(state,
    2293             :                                       "...Rated Total Cooling Capacity at Rated Conditions = Total Peak Design Load * Rated Total "
    2294             :                                       "Cooling Capacity Modifier  / "
    2295             :                                       "Peak Design Total Cooling Capacity Modifier");
    2296           0 :                     ShowContinueError(state,
    2297             :                                       "...Rated Sensible Cooling Capacity at Rated Conditions = Peak Design Sensible Load * Rated "
    2298             :                                       "Sensible Cooling "
    2299             :                                       "Capacity Modifier  / Peak Design Sensible Cooling Capacity Modifier");
    2300           0 :                     ShowContinueError(state, "Carefully review the Load Side Total, Sensible, and Latent heat transfer rates");
    2301           0 :                     ShowContinueError(state, "... to ensure they meet the expected manufacturers performance specifications.");
    2302             :                 }
    2303             :             }
    2304             : 
    2305             :         } // Cooling Coil
    2306             : 
    2307         266 :         if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Heating) {
    2308             :             // size rated heating capacity
    2309         133 :             IsAutoSize = false;
    2310         133 :             if (simpleWatertoAirHP.RatedCapHeat == DataSizing::AutoSize) {
    2311         118 :                 IsAutoSize = true;
    2312             :             }
    2313         133 :             if (SizingDesRunThisAirSys || SizingDesRunThisZone) HardSizeNoDesRun = false;
    2314         133 :             if (IsAutoSize) {
    2315         118 :                 if (state.dataSize->CurSysNum > 0) {
    2316         194 :                     CheckSysSizing(
    2317             :                         state,
    2318         194 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2319             :                         simpleWatertoAirHP.Name);
    2320          97 :                     if (HeatingAirVolFlowRateDes > 0.0) {
    2321          97 :                         VolFlowRate = HeatingAirVolFlowRateDes;
    2322             :                     } else {
    2323           0 :                         VolFlowRate = CoolingAirVolFlowRateDes; // system air flow
    2324             :                     }
    2325             :                     // heating design day calculations
    2326          97 :                     if (VolFlowRate >= DataHVACGlobals::SmallAirVolFlow) {
    2327          97 :                         auto &finalSysSizing(state.dataSize->FinalSysSizing(state.dataSize->CurSysNum));
    2328          97 :                         if (state.dataSize->CurOASysNum > 0) { // coil is in the OA stream
    2329           0 :                             HeatMixTemp = finalSysSizing.HeatOutTemp;
    2330           0 :                             HeatMixHumRat = finalSysSizing.HeatOutHumRat;
    2331           0 :                             HeatSupTemp = finalSysSizing.PreheatTemp;
    2332             :                         } else { // coil is on the main air loop
    2333          97 :                             if (VolFlowRate > 0.0) {
    2334          97 :                                 HeatOutAirFrac = finalSysSizing.DesOutAirVolFlow / VolFlowRate;
    2335          97 :                                 HeatOutAirFracSys = finalSysSizing.DesOutAirVolFlow / RatedAirVolFlowRateDes;
    2336             :                             } else {
    2337           0 :                                 HeatOutAirFrac = 1.0;
    2338           0 :                                 HeatOutAirFracSys = HeatOutAirFrac;
    2339             :                             }
    2340          97 :                             HeatOutAirFrac = min(1.0, max(0.0, HeatOutAirFrac));
    2341          97 :                             HeatOutAirFracSys = min(1.0, max(0.0, HeatOutAirFracSys));
    2342          97 :                             HeatSupTemp = finalSysSizing.HeatSupTemp;
    2343          97 :                             if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).NumOAHeatCoils ==
    2344             :                                 0) { // there is no preheating of the OA stream
    2345          97 :                                 HeatMixTemp = HeatOutAirFrac * finalSysSizing.HeatOutTemp + (1.0 - HeatOutAirFrac) * finalSysSizing.HeatRetTemp;
    2346          97 :                                 HeatMixHumRat = HeatOutAirFrac * finalSysSizing.HeatOutHumRat + (1.0 - HeatOutAirFrac) * finalSysSizing.HeatRetHumRat;
    2347             :                                 // calculate mixed air temperature with system airflow
    2348          97 :                                 HeatMixTempSys =
    2349          97 :                                     HeatOutAirFracSys * finalSysSizing.HeatOutTemp + (1.0 - HeatOutAirFracSys) * finalSysSizing.HeatRetTemp;
    2350          97 :                                 HeatMixHumRatSys =
    2351          97 :                                     HeatOutAirFracSys * finalSysSizing.HeatOutHumRat + (1.0 - HeatOutAirFracSys) * finalSysSizing.HeatRetHumRat;
    2352             :                             } else { // there is preheating of OA stream
    2353           0 :                                 HeatOutAirFrac = min(1.0, max(0.0, HeatOutAirFrac));
    2354           0 :                                 HeatMixTemp = HeatOutAirFrac * finalSysSizing.PreheatTemp + (1.0 - HeatOutAirFrac) * finalSysSizing.HeatRetTemp;
    2355           0 :                                 HeatMixHumRat = HeatOutAirFrac * finalSysSizing.PreheatHumRat + (1.0 - HeatOutAirFrac) * finalSysSizing.HeatRetHumRat;
    2356             :                                 // calculate mixed air temperature with system airflow
    2357           0 :                                 HeatMixTempSys =
    2358           0 :                                     HeatOutAirFracSys * finalSysSizing.PreheatTemp + (1.0 - HeatOutAirFracSys) * finalSysSizing.HeatRetTemp;
    2359           0 :                                 HeatMixHumRatSys =
    2360           0 :                                     HeatOutAirFracSys * finalSysSizing.PreheatHumRat + (1.0 - HeatOutAirFracSys) * finalSysSizing.HeatRetHumRat;
    2361             :                             }
    2362             :                             // determine the coil ratio of coil dT with system air flow to design heating air flow
    2363          97 :                             HeatdTratio = (HeatSupTemp - HeatMixTempSys) / (HeatSupTemp - HeatMixTemp);
    2364             :                         }
    2365          97 :                         rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, HeatMixTemp, HeatMixHumRat, RoutineName);
    2366         194 :                         HeatCapAtPeak = rhoair * VolFlowRate * Psychrometrics::PsyCpAirFnW(DataPrecisionGlobals::constant_zero) *
    2367          97 :                                         (HeatSupTemp - HeatMixTemp);                                     // heating coil load
    2368          97 :                         if (state.dataSize->DataFanEnumType > -1 && state.dataSize->DataFanIndex > -1) { // remove fan heat to coil load
    2369          97 :                             switch (state.dataSize->DataFanEnumType) {
    2370          97 :                             case DataAirSystems::StructArrayLegacyFanModels: {
    2371          97 :                                 FanHeatLoad = Fans::FanDesHeatGain(state, state.dataSize->DataFanIndex, VolFlowRate);
    2372          97 :                                 break;
    2373             :                             }
    2374           0 :                             case DataAirSystems::ObjectVectorOOFanSystemModel: {
    2375           0 :                                 FanHeatLoad = state.dataHVACFan->fanObjs[state.dataSize->DataFanIndex]->getFanDesignHeatGain(state, VolFlowRate);
    2376           0 :                                 break;
    2377             :                             }
    2378           0 :                             case DataAirSystems::Invalid: {
    2379             :                                 // do nothing
    2380           0 :                                 break;
    2381             :                             }
    2382             :                             } // end switch
    2383          97 :                             Real64 CpAir = Psychrometrics::PsyCpAirFnW(HeatMixHumRat);
    2384          97 :                             if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanLocation ==
    2385             :                                 DataAirSystems::FanPlacement::BlowThru) {
    2386          97 :                                 HeatMixTemp += FanHeatLoad / (CpAir * rhoair * VolFlowRate); // this is now the temperature entering the coil
    2387           0 :                             } else if (state.dataAirSystemsData->PrimaryAirSystems(state.dataSize->CurSysNum).supFanLocation ==
    2388             :                                        DataAirSystems::FanPlacement::DrawThru) {
    2389           0 :                                 HeatSupTemp -= FanHeatLoad / (CpAir * rhoair * VolFlowRate); // this is now the temperature leaving the coil
    2390             :                             }
    2391             :                         }
    2392          97 :                         HeatCapAtPeak -= FanHeatLoad; // remove fan heat from heating coil load
    2393          97 :                         HeatCapAtPeak = max(0.0, HeatCapAtPeak);
    2394          97 :                         RatedHeatMixDryBulb = simpleWatertoAirHP.RatedEntAirDrybulbTemp;
    2395             :                         // calculate temperatue ratio at design day peak conditions
    2396          97 :                         HeatratioTDB = (HeatMixTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    2397         291 :                         PltSizNum = PlantUtilities::MyPlantSizingIndex(
    2398             :                             state,
    2399         194 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2400             :                             simpleWatertoAirHP.Name,
    2401             :                             simpleWatertoAirHP.WaterInletNodeNum,
    2402             :                             simpleWatertoAirHP.WaterOutletNodeNum,
    2403             :                             ErrorsFound,
    2404             :                             false);
    2405          97 :                         if (PltSizNum > 0) {
    2406          97 :                             DesignEntWaterTemp = state.dataSize->PlantSizData(PltSizNum).ExitTemp;
    2407          97 :                             HeatratioTS = (DesignEntWaterTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    2408             :                         } else {
    2409           0 :                             ShowSevereError(state, "Autosizing of heating capacity requires a loop Sizing:Plant object");
    2410           0 :                             ShowContinueError(state, "Autosizing also requires physical connection to a plant or condenser loop.");
    2411           0 :                             ShowContinueError(state,
    2412           0 :                                               format("Occurs in COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT Object={}",
    2413           0 :                                                      WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    2414           0 :                                                      simpleWatertoAirHP.Name));
    2415           0 :                             ErrorsFound = true;
    2416             :                         }
    2417             :                         // calculate temperatue ratio at refrence conditions
    2418          97 :                         RatedHeatratioTDB = (RatedHeatMixDryBulb + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    2419          97 :                         RatedHeatratioTS = (simpleWatertoAirHP.RatedEntWaterTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    2420             :                         // determine curve modifiers at peak and rated conditions
    2421          97 :                         PeakHeatCapTempModFac = Curve::CurveValue(state, simpleWatertoAirHP.HeatCapCurveIndex, HeatratioTDB, HeatratioTS, 1.0, 1.0);
    2422          97 :                         RatedHeatCapTempModFac =
    2423         194 :                             Curve::CurveValue(state, simpleWatertoAirHP.HeatCapCurveIndex, RatedHeatratioTDB, RatedHeatratioTS, 1.0, 1.0);
    2424             :                         // Check curve output when rated mixed air wetbulb is the design mixed air wetbulb
    2425          97 :                         if (RatedHeatMixDryBulb == HeatMixTemp) {
    2426           0 :                             if (RatedHeatCapTempModFac > 1.02 || RatedHeatCapTempModFac < 0.98) {
    2427           0 :                                 ShowWarningError(state,
    2428           0 :                                                  format("{} Coil:Heating:WaterToAirHeatPump:EquationFit={}", RoutineName, simpleWatertoAirHP.Name));
    2429           0 :                                 ShowContinueError(state,
    2430             :                                                   "Heating capacity as a function of temperature curve output is not equal to 1.0 (+ or - 2%) at "
    2431             :                                                   "rated conditions.");
    2432           0 :                                 ShowContinueError(state, format("Curve output at rated conditions = {:.3T}", RatedHeatCapTempModFac));
    2433             :                             }
    2434             :                         }
    2435             :                         // calculate the rated capacity based on peak conditions
    2436             :                         // note: the rated capacity can be different than the capacity at
    2437             :                         // rated conditions if the capacity curve isn't normalized at the
    2438             :                         // rated conditions
    2439          97 :                         RatedCapHeatDes = (PeakHeatCapTempModFac > 0.0) ? HeatCapAtPeak / PeakHeatCapTempModFac : HeatCapAtPeak;
    2440             :                     } else {
    2441           0 :                         RatedCapHeatDes = 0.0;
    2442             :                     }
    2443          21 :                 } else if (state.dataSize->CurZoneEqNum > 0) {
    2444          42 :                     CheckZoneSizing(
    2445             :                         state,
    2446          42 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2447             :                         simpleWatertoAirHP.Name);
    2448          21 :                     if (HeatingAirVolFlowRateDes > 0.0) {
    2449          21 :                         VolFlowRate = HeatingAirVolFlowRateDes;
    2450             :                     } else {
    2451           0 :                         VolFlowRate = CoolingAirVolFlowRateDes; // system air flow
    2452             :                     }
    2453          21 :                     if (VolFlowRate >= DataHVACGlobals::SmallAirVolFlow) {
    2454          21 :                         if (state.dataSize->ZoneEqDXCoil) {
    2455          21 :                             if (ZoneEqSizing(state.dataSize->CurZoneEqNum).OAVolFlow > 0.0) {
    2456           7 :                                 HeatMixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatCoilInTemp;
    2457           7 :                                 HeatMixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatCoilInHumRat;
    2458             :                                 // calculate mixed air temperature with system airflow
    2459           7 :                                 HeatOAFrac = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA / HeatingAirVolFlowRateDes;
    2460           7 :                                 HeatOAFracSys = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).MinOA / RatedAirVolFlowRateDes;
    2461           7 :                                 HeatOAFrac = min(1.0, max(0.0, HeatOAFrac));
    2462           7 :                                 HeatOAFracSys = min(1.0, max(0.0, HeatOAFracSys));
    2463          14 :                                 HeatOATemp = (state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatCoilInTemp -
    2464           7 :                                               (1.0 - HeatOAFrac) * state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneTempAtHeatPeak) /
    2465             :                                              HeatOAFrac;
    2466           7 :                                 HeatMixTempSys =
    2467           7 :                                     HeatOAFracSys * HeatOATemp +
    2468           7 :                                     (1.0 - HeatOAFracSys) * state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneTempAtHeatPeak;
    2469             :                             } else {
    2470          14 :                                 HeatMixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneRetTempAtHeatPeak;
    2471          14 :                                 HeatMixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).ZoneHumRatAtHeatPeak;
    2472          14 :                                 HeatMixTempSys = HeatMixTemp;
    2473             :                             }
    2474             :                         } else {
    2475           0 :                             HeatMixTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatCoilInTemp;
    2476           0 :                             HeatMixHumRat = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).DesHeatCoilInHumRat;
    2477           0 :                             HeatMixTempSys = HeatMixTemp;
    2478             :                         }
    2479          21 :                         HeatSupTemp = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum).HeatDesTemp;
    2480             :                         // determine the coil ratio of coil dT with system air flow to design heating air flow
    2481          21 :                         HeatdTratio = (HeatSupTemp - HeatMixTempSys) / (HeatSupTemp - HeatMixTemp);
    2482          21 :                         rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, state.dataEnvrn->StdBaroPress, HeatMixTemp, HeatMixHumRat, RoutineName);
    2483          42 :                         HeatCapAtPeak = rhoair * VolFlowRate * Psychrometrics::PsyCpAirFnW(DataPrecisionGlobals::constant_zero) *
    2484          21 :                                         (HeatSupTemp - HeatMixTemp);                                     // heating coil load
    2485          21 :                         if (state.dataSize->DataFanEnumType > -1 && state.dataSize->DataFanIndex > -1) { // add fan heat to coil load
    2486          21 :                             switch (state.dataSize->DataFanEnumType) {
    2487          20 :                             case DataAirSystems::StructArrayLegacyFanModels: {
    2488          20 :                                 FanHeatLoad = Fans::FanDesHeatGain(state, state.dataSize->DataFanIndex, VolFlowRate);
    2489          20 :                                 break;
    2490             :                             }
    2491           1 :                             case DataAirSystems::ObjectVectorOOFanSystemModel: {
    2492           1 :                                 FanHeatLoad = state.dataHVACFan->fanObjs[state.dataSize->DataFanIndex]->getFanDesignHeatGain(state, VolFlowRate);
    2493           1 :                                 break;
    2494             :                             }
    2495           0 :                             case DataAirSystems::Invalid: {
    2496             :                                 // do nothing
    2497           0 :                                 break;
    2498             :                             }
    2499             :                             } // end switch
    2500          21 :                             Real64 CpAir = Psychrometrics::PsyCpAirFnW(HeatMixHumRat);
    2501          21 :                             if (state.dataSize->DataFanPlacement == DataSizing::ZoneFanPlacement::BlowThru) {
    2502          14 :                                 HeatMixTemp += FanHeatLoad / (CpAir * rhoair * VolFlowRate); // this is now the temperature entering the coil
    2503             :                             } else {
    2504           7 :                                 HeatSupTemp -= FanHeatLoad / (CpAir * rhoair * VolFlowRate); // this is now the temperature leaving the coil
    2505             :                             }
    2506             :                         }
    2507          21 :                         HeatCapAtPeak -= FanHeatLoad; // remove fan heat from heating coil load
    2508          21 :                         HeatCapAtPeak = max(0.0, HeatCapAtPeak);
    2509          21 :                         RatedHeatMixDryBulb = simpleWatertoAirHP.RatedEntAirDrybulbTemp;
    2510             :                         // calculate temperatue ratio at design day peak conditions
    2511          21 :                         HeatratioTDB = (HeatMixTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    2512          63 :                         PltSizNum = PlantUtilities::MyPlantSizingIndex(
    2513             :                             state,
    2514          42 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2515             :                             simpleWatertoAirHP.Name,
    2516             :                             simpleWatertoAirHP.WaterInletNodeNum,
    2517             :                             simpleWatertoAirHP.WaterOutletNodeNum,
    2518             :                             ErrorsFound,
    2519             :                             false);
    2520          21 :                         if (PltSizNum > 0) {
    2521          21 :                             DesignEntWaterTemp = state.dataSize->PlantSizData(PltSizNum).ExitTemp;
    2522          21 :                             HeatratioTS = (DesignEntWaterTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    2523             :                         } else {
    2524           0 :                             ShowSevereError(state, "Autosizing of heating capacity requires a loop Sizing:Plant object");
    2525           0 :                             ShowContinueError(state, "Autosizing also requires physical connection to a plant or condenser loop.");
    2526           0 :                             ShowContinueError(state,
    2527           0 :                                               format("Occurs in COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT Object={}",
    2528           0 :                                                      WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    2529           0 :                                                      simpleWatertoAirHP.Name));
    2530           0 :                             ErrorsFound = true;
    2531             :                         }
    2532             :                         // calculate temperatue ratio at refrence conditions
    2533          21 :                         RatedHeatratioTDB = (RatedHeatMixDryBulb + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    2534          21 :                         RatedHeatratioTS = (simpleWatertoAirHP.RatedEntWaterTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref;
    2535             :                         // determine curve modifiers at peak and rated conditions
    2536          21 :                         PeakHeatCapTempModFac = Curve::CurveValue(state, simpleWatertoAirHP.HeatCapCurveIndex, HeatratioTDB, HeatratioTS, 1.0, 1.0);
    2537          21 :                         RatedHeatCapTempModFac =
    2538          42 :                             Curve::CurveValue(state, simpleWatertoAirHP.HeatCapCurveIndex, RatedHeatratioTDB, RatedHeatratioTS, 1.0, 1.0);
    2539          21 :                         RatedHeatPowerTempModFac =
    2540          42 :                             Curve::CurveValue(state, simpleWatertoAirHP.HeatPowCurveIndex, RatedHeatratioTDB, RatedHeatratioTS, 1.0, 1.0);
    2541             :                         // Check curve output when rated mixed air wetbulb is the design mixed air wetbulb
    2542          21 :                         if (RatedHeatMixDryBulb == HeatMixTemp) {
    2543           0 :                             if (RatedHeatCapTempModFac > 1.02 || RatedHeatCapTempModFac < 0.98) {
    2544           0 :                                 ShowWarningError(state,
    2545           0 :                                                  format("{} Coil:Heating:WaterToAirHeatPump:EquationFit={}", RoutineName, simpleWatertoAirHP.Name));
    2546           0 :                                 ShowContinueError(state,
    2547             :                                                   "Heating capacity as a function of temperature curve output is not equal to 1.0 (+ or - 2%) at "
    2548             :                                                   "rated conditions.");
    2549           0 :                                 ShowContinueError(state, format("Curve output at rated conditions = {:.3T}", RatedHeatCapTempModFac));
    2550             :                             }
    2551           0 :                             if (RatedHeatPowerTempModFac > 1.02 || RatedHeatPowerTempModFac < 0.98) {
    2552           0 :                                 ShowWarningError(state,
    2553           0 :                                                  format("{} Coil:Heating:WaterToAirHeatPump:EquationFit={}", RoutineName, simpleWatertoAirHP.Name));
    2554           0 :                                 ShowContinueError(
    2555             :                                     state,
    2556             :                                     "Heating power consumption as a function of temperature curve output is not equal to 1.0 (+ or - 2%) at "
    2557             :                                     "rated conditions.");
    2558           0 :                                 ShowContinueError(state, format("Curve output at rated conditions = {:.3T}", RatedHeatPowerTempModFac));
    2559             :                             }
    2560             :                         }
    2561             :                         // calculate the rated capacity based on peak conditions
    2562             :                         // note: the rated capacity can be different than the capacity at
    2563             :                         // rated conditions if the capacity curve isn't normalized at the
    2564             :                         // rated conditions
    2565          21 :                         RatedCapHeatDes = (PeakHeatCapTempModFac > 0.0) ? HeatCapAtPeak / PeakHeatCapTempModFac : HeatCapAtPeak;
    2566             :                     } else {
    2567           0 :                         RatedCapHeatDes = 0.0;
    2568             :                     }
    2569             :                 }
    2570             : 
    2571             :                 // determine adjusted cooling and heating coil capacity
    2572         118 :                 simpleWatertoAirHP.RatedCapHeatAtRatedCdts = RatedCapHeatDes * RatedHeatCapTempModFac;
    2573         118 :                 auto &companionCoolingCoil(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum));
    2574         236 :                 if (companionCoolingCoil.WAHPPlantType == DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit &&
    2575         118 :                     companionCoolingCoil.RatedCapCoolTotal == DataSizing::AutoSize) {
    2576             :                     // case 1: companion coil is also of EquationFit type and is being autosized
    2577         118 :                     RatedCapCoolTotalDes = state.dataSize->DXCoolCap;
    2578         118 :                     RatedTotCapTempModFac = companionCoolingCoil.RatedCapCoolAtRatedCdts / RatedCapCoolTotalDes;
    2579         118 :                     RatedCapCoolHeatDD =
    2580         118 :                         simpleWatertoAirHP.RatedCapHeatAtRatedCdts / simpleWatertoAirHP.RatioRatedHeatRatedTotCoolCap / RatedTotCapTempModFac;
    2581         118 :                     RatedCoolPowerTempModFac = companionCoolingCoil.RatedPowerCoolAtRatedCdts / companionCoolingCoil.RatedPowerCool;
    2582         118 :                     if (RatedCapCoolHeatDD > RatedCapCoolTotalDes) {
    2583             :                         // total cooling capacity
    2584           8 :                         RatedCapCoolTotalDes = RatedCapCoolHeatDD;
    2585             :                         // adjust for system air flow -- capacity is based on heating design day calcs
    2586             :                         // adjust by ratio of system to heating air flow rate and temperature delta across the coil at these different airflow
    2587           8 :                         RatedCapCoolTotalDes *= (RatedAirVolFlowRateDes / HeatingAirVolFlowRateDes) * HeatdTratio;
    2588             :                         // calculate ajustment factor over previous capacity for sensible capacity adjustment
    2589           8 :                         Real64 CapCoolAdjFac = RatedCapCoolTotalDes / state.dataSize->DXCoolCap;
    2590             :                         // update cooling coil rated capacity after adjustments based on heating coil size
    2591           8 :                         state.dataSize->DXCoolCap = RatedCapCoolTotalDes;
    2592             :                         // sensible cooling capacity
    2593           8 :                         RatedCapCoolSensDes = companionCoolingCoil.RatedCapCoolSens * CapCoolAdjFac; // Assume that SHR stays the same
    2594           8 :                         companionCoolingCoil.RatedCapCoolSensDesAtRatedCdts *= CapCoolAdjFac;
    2595           8 :                         companionCoolingCoil.RatedCapCoolSens = RatedCapCoolSensDes;
    2596             :                         // update Water-to-Air Heat Pumps output reports
    2597          16 :                         OutputReportPredefined::PreDefTableEntry(state,
    2598           8 :                                                                  state.dataOutRptPredefined->pdchWAHPRatedSensCapAtRatedCdts,
    2599             :                                                                  companionCoolingCoil.Name,
    2600             :                                                                  companionCoolingCoil.RatedCapCoolSensDesAtRatedCdts);
    2601           8 :                         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchWAHPDD, companionCoolingCoil.Name, "Heating");
    2602           8 :                         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchWAHPDD, simpleWatertoAirHP.Name, "Heating");
    2603             :                         // update Cooling Coils output reports
    2604          16 :                         OutputReportPredefined::PreDefTableEntry(state,
    2605           8 :                                                                  state.dataOutRptPredefined->pdchCoolCoilLatCap,
    2606             :                                                                  companionCoolingCoil.Name,
    2607             :                                                                  RatedCapCoolTotalDes - RatedCapCoolSensDes);
    2608          16 :                         OutputReportPredefined::PreDefTableEntry(state,
    2609           8 :                                                                  state.dataOutRptPredefined->pdchCoolCoilSHR,
    2610             :                                                                  companionCoolingCoil.Name,
    2611             :                                                                  RatedCapCoolSensDes / RatedCapCoolTotalDes);
    2612          16 :                         OutputReportPredefined::PreDefTableEntry(
    2613           8 :                             state, state.dataOutRptPredefined->pdchCoolCoilSensCap, companionCoolingCoil.Name, RatedCapCoolSensDes);
    2614             :                     } else {
    2615         110 :                         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchWAHPDD, companionCoolingCoil.Name, "Cooling");
    2616         110 :                         OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchWAHPDD, simpleWatertoAirHP.Name, "Cooling");
    2617             :                     }
    2618         118 :                     RatedCapHeatDes =
    2619         118 :                         RatedCapCoolTotalDes * RatedTotCapTempModFac * simpleWatertoAirHP.RatioRatedHeatRatedTotCoolCap / RatedHeatCapTempModFac;
    2620         118 :                     companionCoolingCoil.RatedCapCoolTotal = RatedCapCoolTotalDes;
    2621         118 :                     companionCoolingCoil.RatedCapCoolAtRatedCdts = RatedCapCoolTotalDes * RatedTotCapTempModFac;
    2622         118 :                     companionCoolingCoil.RatedPowerCoolAtRatedCdts =
    2623         118 :                         companionCoolingCoil.RatedCapCoolAtRatedCdts / companionCoolingCoil.RatedCOPCoolAtRatedCdts;
    2624         118 :                     companionCoolingCoil.RatedPowerCool = companionCoolingCoil.RatedPowerCoolAtRatedCdts / RatedCoolPowerTempModFac;
    2625             :                     // update Water-to-Air Heat Pumps output reports
    2626         236 :                     OutputReportPredefined::PreDefTableEntry(state,
    2627         118 :                                                              state.dataOutRptPredefined->pdchWAHPRatedCapAtRatedCdts,
    2628             :                                                              companionCoolingCoil.Name,
    2629             :                                                              companionCoolingCoil.RatedCapCoolAtRatedCdts);
    2630             :                     // update Cooling Coils output reports
    2631         236 :                     OutputReportPredefined::PreDefTableEntry(
    2632         118 :                         state, state.dataOutRptPredefined->pdchCoolCoilTotCap, companionCoolingCoil.Name, RatedCapCoolTotalDes);
    2633         472 :                     BaseSizer::reportSizerOutput(
    2634             :                         state,
    2635         236 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(companionCoolingCoil.WAHPType)]),
    2636             :                         companionCoolingCoil.Name,
    2637             :                         "Design Size Rated Total Cooling Capacity [W]",
    2638         118 :                         companionCoolingCoil.RatedCapCoolTotal);
    2639         472 :                     BaseSizer::reportSizerOutput(
    2640             :                         state,
    2641         236 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(companionCoolingCoil.WAHPType)]),
    2642             :                         companionCoolingCoil.Name,
    2643             :                         "Design Size Rated Sensible Cooling Capacity [W]",
    2644         236 :                         companionCoolingCoil.RatedCapCoolSens);
    2645           0 :                 } else if (companionCoolingCoil.WAHPPlantType ==
    2646             :                            DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit) { // case 2: companion coil is of EquationFit type but is
    2647             :                                                                                         // not autosized
    2648           0 :                     RatedCapHeatDes = companionCoolingCoil.RatedCapCoolTotal * simpleWatertoAirHP.RatioRatedHeatRatedTotCoolCap;
    2649             :                 } else { // case 3: companion type is different than EquationFit
    2650           0 :                     RatedCapHeatDes = state.dataSize->DXCoolCap;
    2651             :                 }
    2652             :                 // heating capacity final determination
    2653         118 :                 simpleWatertoAirHP.RatedCapHeat = RatedCapHeatDes;
    2654         118 :                 simpleWatertoAirHP.RatedCapHeatAtRatedCdts = RatedCapHeatDes * RatedHeatCapTempModFac;
    2655             : 
    2656             :                 // heating power calculations
    2657         118 :                 RatedHeatPowerTempModFac =
    2658         236 :                     Curve::CurveValue(state, simpleWatertoAirHP.HeatPowCurveIndex, RatedHeatratioTDB, RatedHeatratioTS, 1.0, 1.0);
    2659         118 :                 simpleWatertoAirHP.RatedPowerHeat =
    2660         118 :                     simpleWatertoAirHP.RatedCapHeatAtRatedCdts / (simpleWatertoAirHP.RatedCOPHeatAtRatedCdts * RatedHeatPowerTempModFac);
    2661             : 
    2662             :                 // update reports
    2663         236 :                 OutputReportPredefined::PreDefTableEntry(state,
    2664         118 :                                                          state.dataOutRptPredefined->pdchWAHPRatedCapAtRatedCdts,
    2665             :                                                          simpleWatertoAirHP.Name,
    2666             :                                                          simpleWatertoAirHP.RatedCapHeatAtRatedCdts);
    2667         236 :                 OutputReportPredefined::PreDefTableEntry(
    2668         118 :                     state, state.dataOutRptPredefined->pdchWAHPRatedAirDBT, simpleWatertoAirHP.Name, RatedHeatMixDryBulb);
    2669         236 :                 OutputReportPredefined::PreDefTableEntry(
    2670         118 :                     state, state.dataOutRptPredefined->pdchWAHPRatedWtrT, simpleWatertoAirHP.Name, simpleWatertoAirHP.RatedEntWaterTemp);
    2671         472 :                 BaseSizer::reportSizerOutput(
    2672             :                     state,
    2673         236 :                     format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2674             :                     simpleWatertoAirHP.Name,
    2675             :                     "Design Size Rated Heating Capacity [W]",
    2676         118 :                     simpleWatertoAirHP.RatedCapHeat);
    2677         236 :                 OutputReportPredefined::PreDefTableEntry(
    2678         118 :                     state, state.dataOutRptPredefined->pdchHeatCoilNomCap, simpleWatertoAirHP.Name, simpleWatertoAirHP.RatedCapHeat);
    2679         118 :                 if (simpleWatertoAirHP.RatedCapHeat != 0.0) {
    2680         354 :                     OutputReportPredefined::PreDefTableEntry(state,
    2681         118 :                                                              state.dataOutRptPredefined->pdchHeatCoilNomEff,
    2682             :                                                              simpleWatertoAirHP.Name,
    2683         118 :                                                              simpleWatertoAirHP.RatedPowerHeat / simpleWatertoAirHP.RatedCapHeat);
    2684             :                 } else {
    2685           0 :                     OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchHeatCoilNomEff, simpleWatertoAirHP.Name, 0.0);
    2686             :                 }
    2687             :             } else {
    2688          15 :                 if (simpleWatertoAirHP.RatedCapHeat > 0.0 && RatedCapHeatDes > 0.0 && !HardSizeNoDesRun) {
    2689           0 :                     RatedCapHeatUser = simpleWatertoAirHP.RatedCapHeat;
    2690           0 :                     BaseSizer::reportSizerOutput(
    2691             :                         state,
    2692           0 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2693             :                         simpleWatertoAirHP.Name,
    2694             :                         "Design Size Rated Heating Capacity [W]",
    2695             :                         RatedCapHeatDes,
    2696             :                         "User-Specified Rated Heating Capacity [W]",
    2697           0 :                         RatedCapHeatUser);
    2698           0 :                     if (state.dataGlobal->DisplayExtraWarnings) {
    2699           0 :                         if ((std::abs(RatedCapHeatDes - RatedCapHeatUser) / RatedCapHeatUser) > state.dataSize->AutoVsHardSizingThreshold) {
    2700           0 :                             ShowMessage(
    2701             :                                 state,
    2702           0 :                                 format("SizeHVACWaterToAir: Potential issue with equipment sizing for coil {}:WATERTOAIRHEATPUMP:EQUATIONFIT {}",
    2703           0 :                                        WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    2704           0 :                                        simpleWatertoAirHP.Name));
    2705           0 :                             ShowContinueError(state, format("User-Specified Rated Heating Capacity of {:.2R} [W]", RatedCapHeatUser));
    2706           0 :                             ShowContinueError(state, format("differs from Design Size Rated Heating Capacity of {:.2R} [W]", RatedCapHeatDes));
    2707           0 :                             ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
    2708           0 :                             ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
    2709             :                         }
    2710             :                     }
    2711             :                 } else {
    2712          15 :                     if (simpleWatertoAirHP.RatedCapHeat > 0.0) {
    2713          15 :                         RatedCapHeatUser = simpleWatertoAirHP.RatedCapHeat;
    2714          60 :                         BaseSizer::reportSizerOutput(
    2715             :                             state,
    2716          30 :                             format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2717             :                             simpleWatertoAirHP.Name,
    2718             :                             "User-Specified Rated Heating Capacity [W]",
    2719          15 :                             RatedCapHeatUser);
    2720             :                     }
    2721             :                 }
    2722             : 
    2723             :                 // user provided inputs are assumed to be at rated conditions
    2724          15 :                 simpleWatertoAirHP.RatedPowerHeat = simpleWatertoAirHP.RatedCapHeat / simpleWatertoAirHP.RatedCOPHeatAtRatedCdts;
    2725          15 :                 simpleWatertoAirHP.RatedCapHeatAtRatedCdts = 0;
    2726          15 :                 simpleWatertoAirHP.RatedPowerHeatAtRatedCdts = 0;
    2727             :             }
    2728             :             // Check that heat pump heating capacity is within 20% of cooling capacity. Check only for heating coil and report both.
    2729         133 :             if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Heating && simpleWatertoAirHP.CompanionCoolingCoilNum > 0) {
    2730         133 :                 auto &companionCoolingCoil(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum));
    2731         133 :                 if (companionCoolingCoil.RatedCapCoolTotal > 0.0) {
    2732             : 
    2733         133 :                     if (std::abs(companionCoolingCoil.RatedCapCoolTotal - simpleWatertoAirHP.RatedCapHeat) / companionCoolingCoil.RatedCapCoolTotal >
    2734             :                         0.2) {
    2735             : 
    2736           0 :                         ShowWarningError(state,
    2737           0 :                                          format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT {}",
    2738           0 :                                                 WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    2739           0 :                                                 simpleWatertoAirHP.Name));
    2740           0 :                         ShowContinueError(state,
    2741           0 :                                           format("...used with COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT {}",
    2742             :                                                  companionCoolingCoil.WAHPType,
    2743           0 :                                                  companionCoolingCoil.Name));
    2744           0 :                         ShowContinueError(state, "...heating capacity is disproportionate (> 20% different) to total cooling capacity");
    2745           0 :                         ShowContinueError(state, format("...heating capacity = {:.3T} W", simpleWatertoAirHP.RatedCapHeat));
    2746           0 :                         ShowContinueError(state, format("...cooling capacity = {:.3T} W", companionCoolingCoil.RatedCapCoolTotal));
    2747             :                     }
    2748             :                 }
    2749             :             }
    2750             : 
    2751         665 :             state.dataRptCoilSelection->coilSelectionReportObj->setCoilHeatingCapacity(
    2752             :                 state,
    2753             :                 simpleWatertoAirHP.Name,
    2754         266 :                 format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2755             :                 RatedCapHeatDes,
    2756             :                 IsAutoSize,
    2757         133 :                 state.dataSize->CurSysNum,
    2758         133 :                 state.dataSize->CurZoneEqNum,
    2759         133 :                 state.dataSize->CurOASysNum,
    2760             :                 FanCoolLoad,
    2761             :                 1.0, // RatedHeatCapTempModFac,
    2762             :                 -999.0,
    2763             :                 -999.0);
    2764             : 
    2765             :         } // Heating
    2766             : 
    2767             :         // size/report rated efficiency and power
    2768         266 :         if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Cooling) {
    2769         133 :             if (simpleWatertoAirHP.RatedPowerCool > 0) {
    2770         399 :                 OutputReportPredefined::PreDefTableEntry(state,
    2771         133 :                                                          state.dataOutRptPredefined->pdchCoolCoilNomEff,
    2772             :                                                          simpleWatertoAirHP.Name,
    2773         133 :                                                          simpleWatertoAirHP.RatedCapCoolTotal / simpleWatertoAirHP.RatedPowerCool);
    2774             :             }
    2775         133 :             if (IsAutoSize) {
    2776         236 :                 OutputReportPredefined::PreDefTableEntry(state,
    2777         118 :                                                          state.dataOutRptPredefined->pdchWAHPRatedPowerAtRatedCdts,
    2778             :                                                          simpleWatertoAirHP.Name,
    2779             :                                                          simpleWatertoAirHP.RatedPowerCoolAtRatedCdts);
    2780         118 :                 if (simpleWatertoAirHP.RatedPowerCoolAtRatedCdts > 0) {
    2781         354 :                     OutputReportPredefined::PreDefTableEntry(state,
    2782         118 :                                                              state.dataOutRptPredefined->pdchWAHPRatedCOPAtRatedCdts,
    2783             :                                                              simpleWatertoAirHP.Name,
    2784         118 :                                                              simpleWatertoAirHP.RatedCapCoolAtRatedCdts /
    2785         118 :                                                                  simpleWatertoAirHP.RatedPowerCoolAtRatedCdts);
    2786             :                 }
    2787             :             }
    2788         133 :         } else if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Heating) {
    2789             :             // heating coil power
    2790         133 :             simpleWatertoAirHP.RatedPowerHeatAtRatedCdts = simpleWatertoAirHP.RatedCapHeatAtRatedCdts / simpleWatertoAirHP.RatedCOPHeatAtRatedCdts;
    2791         133 :             if (simpleWatertoAirHP.RatedPowerHeat > 0) {
    2792         399 :                 OutputReportPredefined::PreDefTableEntry(state,
    2793         133 :                                                          state.dataOutRptPredefined->pdchHeatCoilNomEff,
    2794             :                                                          simpleWatertoAirHP.Name,
    2795         133 :                                                          simpleWatertoAirHP.RatedCapHeat / simpleWatertoAirHP.RatedPowerHeat);
    2796             :             }
    2797         133 :             if (IsAutoSize) {
    2798         236 :                 OutputReportPredefined::PreDefTableEntry(state,
    2799         118 :                                                          state.dataOutRptPredefined->pdchWAHPRatedPowerAtRatedCdts,
    2800             :                                                          simpleWatertoAirHP.Name,
    2801             :                                                          simpleWatertoAirHP.RatedPowerHeatAtRatedCdts);
    2802         118 :                 if (simpleWatertoAirHP.RatedPowerHeatAtRatedCdts > 0) {
    2803         354 :                     OutputReportPredefined::PreDefTableEntry(state,
    2804         118 :                                                              state.dataOutRptPredefined->pdchWAHPRatedCOPAtRatedCdts,
    2805             :                                                              simpleWatertoAirHP.Name,
    2806         118 :                                                              simpleWatertoAirHP.RatedCapHeatAtRatedCdts /
    2807         118 :                                                                  simpleWatertoAirHP.RatedPowerHeatAtRatedCdts);
    2808             :                 }
    2809             :             }
    2810             :             // re-calculate companion coil power
    2811         133 :             if (simpleWatertoAirHP.CompanionCoolingCoilNum > 0) {
    2812         133 :                 auto &companionCoolingCoil(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum));
    2813         133 :                 companionCoolingCoil.RatedPowerCoolAtRatedCdts =
    2814         133 :                     companionCoolingCoil.RatedCapCoolAtRatedCdts / companionCoolingCoil.RatedCOPCoolAtRatedCdts;
    2815         133 :                 if (companionCoolingCoil.RatedCapCoolTotal > 0) {
    2816         399 :                     OutputReportPredefined::PreDefTableEntry(state,
    2817         133 :                                                              state.dataOutRptPredefined->pdchCoolCoilNomEff,
    2818             :                                                              companionCoolingCoil.Name,
    2819         133 :                                                              companionCoolingCoil.RatedCapCoolTotal / companionCoolingCoil.RatedPowerCool);
    2820         133 :                     if (IsAutoSize) {
    2821         236 :                         OutputReportPredefined::PreDefTableEntry(state,
    2822         118 :                                                                  state.dataOutRptPredefined->pdchWAHPRatedPowerAtRatedCdts,
    2823             :                                                                  companionCoolingCoil.Name,
    2824             :                                                                  companionCoolingCoil.RatedPowerCoolAtRatedCdts);
    2825         118 :                         if (companionCoolingCoil.RatedPowerCoolAtRatedCdts > 0) {
    2826         354 :                             OutputReportPredefined::PreDefTableEntry(state,
    2827         118 :                                                                      state.dataOutRptPredefined->pdchWAHPRatedCOPAtRatedCdts,
    2828             :                                                                      companionCoolingCoil.Name,
    2829         118 :                                                                      companionCoolingCoil.RatedCapCoolAtRatedCdts /
    2830         118 :                                                                          companionCoolingCoil.RatedPowerCoolAtRatedCdts);
    2831             :                         }
    2832             :                     }
    2833             :                 }
    2834             :             }
    2835             :         }
    2836             : 
    2837             :         // Size water volumetric flow rate
    2838         266 :         IsAutoSize = false;
    2839         266 :         if (simpleWatertoAirHP.RatedWaterVolFlowRate == DataSizing::AutoSize) {
    2840         236 :             IsAutoSize = true;
    2841             :         }
    2842             : 
    2843             :         //   WSHP condenser can be on either a plant loop or condenser loop. Test each to find plant sizing number.
    2844             :         //   first check to see if coil is connected to a plant loop, no warning on this CALL
    2845         266 :         if (IsAutoSize) {
    2846         708 :             PltSizNum = PlantUtilities::MyPlantSizingIndex(
    2847             :                 state,
    2848         472 :                 format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2849             :                 simpleWatertoAirHP.Name,
    2850             :                 simpleWatertoAirHP.WaterInletNodeNum,
    2851             :                 simpleWatertoAirHP.WaterOutletNodeNum,
    2852             :                 ErrorsFound,
    2853             :                 false);
    2854             : 
    2855         236 :             if (PltSizNum > 0) {
    2856         708 :                 rho = FluidProperties::GetDensityGlycol(state,
    2857         236 :                                                         state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidName,
    2858         236 :                                                         state.dataSize->PlantSizData(PltSizNum).ExitTemp,
    2859         236 :                                                         state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidIndex,
    2860             :                                                         RoutineNameAlt);
    2861         708 :                 Cp = FluidProperties::GetSpecificHeatGlycol(state,
    2862         236 :                                                             state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidName,
    2863         236 :                                                             state.dataSize->PlantSizData(PltSizNum).ExitTemp,
    2864         236 :                                                             state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidIndex,
    2865             :                                                             RoutineNameAlt);
    2866             : 
    2867         236 :                 if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Heating) {
    2868         118 :                     RatedWaterVolFlowRateDes =
    2869         118 :                         simpleWatertoAirHP.RatedCapHeatAtRatedCdts / (state.dataSize->PlantSizData(PltSizNum).DeltaT * Cp * rho);
    2870         118 :                 } else if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Cooling) {
    2871             :                     //       use companion heating coil capacity to calculate volumetric flow rate
    2872         118 :                     if (simpleWatertoAirHP.CompanionHeatingCoilNum > 0) {
    2873             :                         auto &companionHeatingCoil(
    2874         118 :                             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum));
    2875         118 :                         if (companionHeatingCoil.RatedCapHeat == DataSizing::AutoSize) {
    2876         118 :                             SystemCapacity = simpleWatertoAirHP.RatedCapCoolTotal;
    2877             :                         } else {
    2878           0 :                             SystemCapacity = companionHeatingCoil.RatedCapHeat;
    2879             :                         }
    2880             :                     } else {
    2881           0 :                         SystemCapacity = simpleWatertoAirHP.RatedCapCoolAtRatedCdts;
    2882             :                     }
    2883             : 
    2884         118 :                     RatedWaterVolFlowRateDes = SystemCapacity / (state.dataSize->PlantSizData(PltSizNum).DeltaT * Cp * rho);
    2885             :                 }
    2886             :             } else {
    2887           0 :                 ShowSevereError(state, "Autosizing of water flow requires a loop Sizing:Plant object");
    2888           0 :                 ShowContinueError(state, "Autosizing also requires physical connection to a plant or condenser loop.");
    2889           0 :                 ShowContinueError(state,
    2890           0 :                                   format("Occurs in COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT Object={}",
    2891           0 :                                          WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)],
    2892           0 :                                          simpleWatertoAirHP.Name));
    2893           0 :                 ErrorsFound = true;
    2894             :             }
    2895             : 
    2896         236 :             if (SystemCapacity != DataSizing::AutoSize) {
    2897         118 :                 simpleWatertoAirHP.RatedWaterVolFlowRate = RatedWaterVolFlowRateDes;
    2898         472 :                 BaseSizer::reportSizerOutput(
    2899             :                     state,
    2900         236 :                     format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2901             :                     simpleWatertoAirHP.Name,
    2902             :                     "Design Size Rated Water Flow Rate [m3/s]",
    2903         118 :                     RatedWaterVolFlowRateDes);
    2904         118 :                 if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Heating && simpleWatertoAirHP.CompanionCoolingCoilNum > 0) {
    2905         118 :                     auto &companionCoolingCoil(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum));
    2906         118 :                     companionCoolingCoil.RatedWaterVolFlowRate = RatedWaterVolFlowRateDes;
    2907         472 :                     BaseSizer::reportSizerOutput(
    2908             :                         state,
    2909         236 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(companionCoolingCoil.WAHPType)]),
    2910             :                         companionCoolingCoil.Name,
    2911             :                         "Design Size Rated Water Flow Rate [m3/s]",
    2912         236 :                         RatedWaterVolFlowRateDes);
    2913           0 :                 } else if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Cooling && simpleWatertoAirHP.CompanionHeatingCoilNum > 0) {
    2914           0 :                     auto &companionHeatingCoil(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionHeatingCoilNum));
    2915           0 :                     companionHeatingCoil.RatedWaterVolFlowRate = RatedWaterVolFlowRateDes;
    2916           0 :                     BaseSizer::reportSizerOutput(
    2917             :                         state,
    2918           0 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(companionHeatingCoil.WAHPType)]),
    2919             :                         companionHeatingCoil.Name,
    2920             :                         "Design Size Rated Water Flow Rate [m3/s]",
    2921           0 :                         RatedWaterVolFlowRateDes);
    2922             :                 }
    2923             :             }
    2924             :         } else {
    2925          30 :             if (simpleWatertoAirHP.RatedWaterVolFlowRate > 0.0 && RatedWaterVolFlowRateDes > 0.0) {
    2926           0 :                 RatedWaterVolFlowRateUser = simpleWatertoAirHP.RatedWaterVolFlowRate;
    2927           0 :                 BaseSizer::reportSizerOutput(
    2928             :                     state,
    2929           0 :                     format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    2930             :                     simpleWatertoAirHP.Name,
    2931             :                     "Design Size Rated Water Flow Rate [m3/s]",
    2932             :                     RatedWaterVolFlowRateDes,
    2933             :                     "User-Specified Rated Water Flow Rate [m3/s]",
    2934           0 :                     RatedWaterVolFlowRateUser);
    2935           0 :                 if (state.dataGlobal->DisplayExtraWarnings) {
    2936           0 :                     if ((std::abs(RatedWaterVolFlowRateDes - RatedWaterVolFlowRateUser) / RatedWaterVolFlowRateUser) >
    2937           0 :                         state.dataSize->AutoVsHardSizingThreshold) {
    2938           0 :                         ShowMessage(state,
    2939           0 :                                     format("SizeHVACWaterToAir: Potential issue with equipment sizing for coil {}:WATERTOAIRHEATPUMP:EQUATIONFIT {}",
    2940             :                                            simpleWatertoAirHP.WAHPType,
    2941           0 :                                            simpleWatertoAirHP.Name));
    2942           0 :                         ShowContinueError(state, format("User-Specified Rated Water Flow Rate of {:.5R} [m3/s]", RatedWaterVolFlowRateUser));
    2943           0 :                         ShowContinueError(state, format("differs from Design Size Rated Water Flow Rate of {:.5R} [m3/s]", RatedWaterVolFlowRateDes));
    2944           0 :                         ShowContinueError(state, "This may, or may not, indicate mismatched component sizes.");
    2945           0 :                         ShowContinueError(state, "Verify that the value entered is intended and is consistent with other components.");
    2946             :                     }
    2947             :                 }
    2948             :             }
    2949             :         }
    2950             : 
    2951             :         // Save component design water volumetric flow rate.
    2952             :         // Use 1/2 flow since both cooling and heating coil will save flow yet only 1 will operate at a time
    2953         266 :         if (simpleWatertoAirHP.RatedWaterVolFlowRate > 0.0) {
    2954         148 :             if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Heating) {
    2955         133 :                 PlantUtilities::RegisterPlantCompDesignFlow(
    2956         133 :                     state, simpleWatertoAirHP.WaterInletNodeNum, 0.5 * simpleWatertoAirHP.RatedWaterVolFlowRate);
    2957         133 :                 if (simpleWatertoAirHP.CompanionCoolingCoilNum > 0) {
    2958         133 :                     auto &companionCoolingCoil(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(simpleWatertoAirHP.CompanionCoolingCoilNum));
    2959         133 :                     PlantUtilities::RegisterPlantCompDesignFlow(
    2960         133 :                         state, companionCoolingCoil.WaterInletNodeNum, 0.5 * simpleWatertoAirHP.RatedWaterVolFlowRate);
    2961             :                 }
    2962          15 :             } else if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Cooling) {
    2963          15 :                 PlantUtilities::RegisterPlantCompDesignFlow(
    2964          15 :                     state, simpleWatertoAirHP.WaterInletNodeNum, 0.5 * simpleWatertoAirHP.RatedWaterVolFlowRate);
    2965             :             }
    2966             :         }
    2967         266 :     }
    2968             : 
    2969    19688275 :     void CalcHPCoolingSimple(EnergyPlusData &state,
    2970             :                              int const HPNum,                            // Heat Pump Number
    2971             :                              int const CyclingScheme,                    // Fan/Compressor cycling scheme indicator
    2972             :                              Real64 const RuntimeFrac,                   // Runtime Fraction of compressor or percent on time (on-time/cycle time)
    2973             :                              [[maybe_unused]] Real64 const SensDemand,   // Cooling Sensible Demand [W] !unused1208
    2974             :                              [[maybe_unused]] Real64 const LatentDemand, // Cooling Latent Demand [W]
    2975             :                              DataHVACGlobals::CompressorOperation const CompressorOp, // compressor operation flag
    2976             :                              Real64 const PartLoadRatio,                              // compressor part load ratio
    2977             :                              [[maybe_unused]] Real64 const OnOffAirFlowRatio          // ratio of compressor on flow to average flow over time step
    2978             :     )
    2979             :     {
    2980             : 
    2981             :         //       AUTHOR         Arun Shenoy
    2982             :         //       DATE WRITTEN   Jan 2004
    2983             :         //       RE-ENGINEERED  Kenneth Tang (Jan 2005)
    2984             : 
    2985             :         // PURPOSE OF THIS SUBROUTINE:
    2986             :         // This subroutine is for simulating the cooling mode of the Water to Air HP Simple
    2987             : 
    2988             :         // METHODOLOGY EMPLOYED:
    2989             :         // Simulate the heat pump performance using the coefficients in quadlinear and quintlinear curves and rated conditions
    2990             :         // If the LatDegradModelSimFlag is enabled, the coil will be simulated twice:
    2991             :         // (1)first simulation at the rated conditions (2) second simulation at the
    2992             :         // actual operating conditions. Then call CalcEffectiveSHR and the effective SHR
    2993             :         // is adjusted.
    2994             :         // If the LatDegradModelSimFlag is disabled, the cooling coil is only simulated
    2995             :         // once at the actual operating conditions.
    2996             :         // Finally, adjust the heat pump outlet conditions based on the PartLoadRatio
    2997             :         // and RuntimeFrac.
    2998             : 
    2999             :         // REFERENCES:
    3000             :         // (1) Lash.T.A.,1992.Simulation and Analysis of a Water Loop Heat Pump System.
    3001             :         // M.S. Thesis, University of Illinois at Urbana Champaign.
    3002             :         // (2) Shenoy, Arun. 2004. Simulation, Modeling and Analysis of Water to Air Heat Pump.
    3003             :         // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
    3004             :         // Oklahoma State University. (downloadable from www.hvac.okstate.edu)
    3005             :         // (3) Tang,C.C.. 2005. Modeling Packaged Heat Pumps in a Quasi-Steady
    3006             :         // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
    3007             :         // Oklahoma State University. (downloadable from www.hvac.okstate.edu)
    3008             :         // (4) Henderson, H.I., K. Rengarajan.1996. A Model to Predict the Latent
    3009             :         // Capacity of Air Conditioners and Heat Pumps at Part-Load Conditions
    3010             :         // with Constant Fan Operation ASHRAE Transactions 102 (1), pp. 266-274.
    3011             : 
    3012    19688275 :         auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
    3013             : 
    3014             :         // SUBROUTINE PARAMETER DEFINITIONS:
    3015    19688275 :         constexpr Real64 Tref(283.15); // Reference Temperature for performance curves,10C [K]
    3016             :         static constexpr std::string_view RoutineName("CalcHPCoolingSimple");
    3017             :         static constexpr std::string_view RoutineNameSourceSideInletTemp("CalcHPCoolingSimple:SourceSideInletTemp");
    3018             : 
    3019             :         Real64 TotalCapRated;              // Rated Total Cooling Capacity [W]
    3020             :         Real64 SensCapRated;               // Rated Sensible Cooling Capacity [W]
    3021             :         Real64 CoolPowerRated;             // Rated Cooling Power Input[W]
    3022             :         Real64 AirVolFlowRateRated;        // Rated Air Volumetric Flow Rate [m3/s]
    3023             :         Real64 WaterVolFlowRateRated;      // Rated Water Volumetric Flow Rate [m3/s]
    3024             :         Real64 Twet_Rated;                 // Twet at rated conditions (coil air flow rate and air temperatures), sec
    3025             :         Real64 Gamma_Rated;                // Gamma at rated conditions (coil air flow rate and air temperatures)
    3026             :         Real64 SHRss;                      // Sensible heat ratio at steady state
    3027             :         Real64 SHReff;                     // Effective sensible heat ratio at part-load condition
    3028             :         Real64 ratioTDB;                   // Ratio of the inlet air dry bulb temperature to the rated conditions
    3029             :         Real64 ratioTWB;                   // Ratio of the inlet air wet bulb temperature to the rated conditions
    3030             :         Real64 ratioTS;                    // Ratio of the source side(water) inlet temperature to the rated conditions
    3031             :         Real64 ratioVL;                    // Ratio of the air flow rate to the rated conditions
    3032             :         Real64 ratioVS;                    // Ratio of the water flow rate to the rated conditions
    3033             :         Real64 CpWater;                    // Specific heat of water [J/kg_C]
    3034             :         Real64 CpAir;                      // Specific heat of air [J/kg_C]
    3035             :         Real64 LoadSideFullMassFlowRate;   // Load Side Full Load Mass Flow Rate [kg/s]
    3036             :         Real64 LoadSideFullOutletEnthalpy; // Load Side Full Load Outlet Air Enthalpy [J/kg]
    3037             :         Real64 ReportingConstant;
    3038             : 
    3039             :         bool LatDegradModelSimFlag;      // Latent degradation model simulation flag
    3040             :         int NumIteration;                // Iteration Counter
    3041             :         Real64 LoadSideInletDBTemp_Unit; // calc conditions for unit
    3042             :         Real64 LoadSideInletWBTemp_Unit; // calc conditions for unit
    3043             :         Real64 LoadSideInletHumRat_Unit; // calc conditions for unit
    3044             :         Real64 LoadSideInletEnth_Unit;   // calc conditions for unit
    3045             :         Real64 CpAir_Unit;               // calc conditions for unit
    3046             : 
    3047    19688275 :         if (state.dataWaterToAirHeatPumpSimple->firstTime) {
    3048             :             // Set indoor air conditions to the rated condition
    3049          17 :             state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp_Init = 26.7;
    3050          17 :             state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat_Init = 0.0111;
    3051          34 :             state.dataWaterToAirHeatPumpSimple->LoadSideInletEnth_Init = Psychrometrics::PsyHFnTdbW(
    3052          34 :                 state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp_Init, state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat_Init);
    3053          17 :             state.dataWaterToAirHeatPumpSimple->CpAir_Init =
    3054          17 :                 Psychrometrics::PsyCpAirFnW(state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat_Init);
    3055          17 :             state.dataWaterToAirHeatPumpSimple->firstTime = false;
    3056             :         }
    3057    19688275 :         state.dataWaterToAirHeatPumpSimple->LoadSideInletWBTemp_Init =
    3058    59064825 :             Psychrometrics::PsyTwbFnTdbWPb(state,
    3059    19688275 :                                            state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp_Init,
    3060    19688275 :                                            state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat_Init,
    3061    19688275 :                                            state.dataEnvrn->OutBaroPress,
    3062             :                                            RoutineName);
    3063             : 
    3064             :         //  LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability)
    3065             : 
    3066    19688275 :         auto &simpleWatertoAirHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum));
    3067             : 
    3068    19688275 :         TotalCapRated = simpleWatertoAirHP.RatedCapCoolTotal;
    3069    19688275 :         SensCapRated = simpleWatertoAirHP.RatedCapCoolSens;
    3070    19688275 :         CoolPowerRated = simpleWatertoAirHP.RatedPowerCool;
    3071    19688275 :         AirVolFlowRateRated = simpleWatertoAirHP.RatedAirVolFlowRate;
    3072    19688275 :         WaterVolFlowRateRated = simpleWatertoAirHP.RatedWaterVolFlowRate;
    3073             : 
    3074    19688275 :         Twet_Rated = simpleWatertoAirHP.Twet_Rated;
    3075    19688275 :         Gamma_Rated = simpleWatertoAirHP.Gamma_Rated;
    3076             : 
    3077    19688275 :         if (CyclingScheme == DataHVACGlobals::ContFanCycCoil) {
    3078     4653294 :             LoadSideFullMassFlowRate = simpleWatertoAirHP.AirMassFlowRate;
    3079             :         } else {
    3080             :             // default to cycling fan, cycling compressor, full load air flow
    3081    15034981 :             if (PartLoadRatio > 0.0) {
    3082     4099692 :                 LoadSideFullMassFlowRate = simpleWatertoAirHP.AirMassFlowRate / PartLoadRatio;
    3083             :             } else {
    3084    10935289 :                 LoadSideFullMassFlowRate = 0.0;
    3085             :             }
    3086             :         }
    3087    19688275 :         state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate = simpleWatertoAirHP.WaterMassFlowRate;
    3088    19688275 :         state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp = simpleWatertoAirHP.InletWaterTemp;
    3089    19688275 :         state.dataWaterToAirHeatPumpSimple->SourceSideInletEnth = simpleWatertoAirHP.InletWaterEnthalpy;
    3090    59064825 :         CpWater = FluidProperties::GetSpecificHeatGlycol(state,
    3091    19688275 :                                                          state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidName,
    3092    19688275 :                                                          state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp,
    3093    19688275 :                                                          state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidIndex,
    3094             :                                                          RoutineNameSourceSideInletTemp);
    3095             : 
    3096             :         // Check for flows, do not perform simulation if no flow in load side or source side.
    3097    19688275 :         if (state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate <= 0.0 || LoadSideFullMassFlowRate <= 0.0) {
    3098    11539283 :             simpleWatertoAirHP.SimFlag = false;
    3099    23086834 :             return;
    3100             :         } else {
    3101     8148992 :             simpleWatertoAirHP.SimFlag = true;
    3102             :         }
    3103             : 
    3104     8148992 :         if (CompressorOp == DataHVACGlobals::CompressorOperation::Off) {
    3105        8268 :             simpleWatertoAirHP.SimFlag = false;
    3106        8268 :             return;
    3107             :         }
    3108             : 
    3109             :         // Loop the calculation at least once depending whether the latent degradation model
    3110             :         // is enabled. 1st iteration to calculate the QLatent(rated) at (TDB,TWB)indoorair=(26.7C,19.4C)
    3111             :         // and 2nd iteration to calculate the  QLatent(actual)
    3112     8140724 :         if ((RuntimeFrac >= 1.0) || (Twet_Rated <= 0.0) || (Gamma_Rated <= 0.0)) {
    3113     8140724 :             LatDegradModelSimFlag = false;
    3114             :             // Set NumIteration=1 so that latent model would quit after 1 simulation with the actual condition
    3115     8140724 :             NumIteration = 1;
    3116             :         } else {
    3117           0 :             LatDegradModelSimFlag = true;
    3118             :             // Set NumIteration=0 so that latent model would simulate twice with rated and actual condition
    3119           0 :             NumIteration = 0;
    3120             :         }
    3121             : 
    3122             :         // Set indoor air conditions to the actual condition
    3123     8140724 :         LoadSideInletDBTemp_Unit = simpleWatertoAirHP.InletAirDBTemp;
    3124     8140724 :         LoadSideInletHumRat_Unit = simpleWatertoAirHP.InletAirHumRat;
    3125     8140724 :         LoadSideInletWBTemp_Unit =
    3126     8140724 :             Psychrometrics::PsyTwbFnTdbWPb(state, LoadSideInletDBTemp_Unit, LoadSideInletHumRat_Unit, state.dataEnvrn->OutBaroPress, RoutineName);
    3127     8140724 :         LoadSideInletEnth_Unit = simpleWatertoAirHP.InletAirEnthalpy;
    3128     8140724 :         CpAir_Unit = Psychrometrics::PsyCpAirFnW(LoadSideInletHumRat_Unit);
    3129             : 
    3130             :         while (true) {
    3131     8140724 :             ++NumIteration;
    3132     8140724 :             if (NumIteration == 1) {
    3133             :                 // Set indoor air conditions to the rated conditions
    3134           0 :                 state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp = state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp_Init;
    3135           0 :                 state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat = state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat_Init;
    3136           0 :                 state.dataWaterToAirHeatPumpSimple->LoadSideInletWBTemp = state.dataWaterToAirHeatPumpSimple->LoadSideInletWBTemp_Init;
    3137           0 :                 state.dataWaterToAirHeatPumpSimple->LoadSideInletEnth = state.dataWaterToAirHeatPumpSimple->LoadSideInletEnth_Init;
    3138           0 :                 CpAir = state.dataWaterToAirHeatPumpSimple->CpAir_Init;
    3139             :             } else {
    3140             :                 // Set indoor air conditions to the actual condition
    3141     8140724 :                 state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp = LoadSideInletDBTemp_Unit;
    3142     8140724 :                 state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat = LoadSideInletHumRat_Unit;
    3143     8140724 :                 state.dataWaterToAirHeatPumpSimple->LoadSideInletWBTemp = LoadSideInletWBTemp_Unit;
    3144     8140724 :                 state.dataWaterToAirHeatPumpSimple->LoadSideInletEnth = LoadSideInletEnth_Unit;
    3145     8140724 :                 CpAir = CpAir_Unit;
    3146             :             }
    3147             : 
    3148     8140724 :             ratioTDB = ((state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref);
    3149     8140724 :             ratioTWB = ((state.dataWaterToAirHeatPumpSimple->LoadSideInletWBTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref);
    3150     8140724 :             ratioTS = ((state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref);
    3151     8140724 :             ratioVL = (LoadSideFullMassFlowRate /
    3152    24422172 :                        (AirVolFlowRateRated * Psychrometrics::PsyRhoAirFnPbTdbW(state,
    3153     8140724 :                                                                                 state.dataEnvrn->StdBaroPress,
    3154     8140724 :                                                                                 state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp,
    3155     8140724 :                                                                                 state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat,
    3156             :                                                                                 RoutineName)));
    3157             : 
    3158     8140724 :             if (simpleWatertoAirHP.DesignWaterMassFlowRate > 0.0) {
    3159     8140724 :                 ratioVS = (state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate) / (simpleWatertoAirHP.DesignWaterMassFlowRate);
    3160             :             } else {
    3161           0 :                 ratioVS = 0.0;
    3162             :             }
    3163             : 
    3164     8140724 :             simpleWatertoAirHP.QLoadTotal =
    3165    16281448 :                 TotalCapRated * Curve::CurveValue(state, simpleWatertoAirHP.TotalCoolCapCurveIndex, ratioTWB, ratioTS, ratioVL, ratioVS);
    3166     8140724 :             simpleWatertoAirHP.QSensible =
    3167    16281448 :                 SensCapRated * Curve::CurveValue(state, simpleWatertoAirHP.SensCoolCapCurveIndex, ratioTDB, ratioTWB, ratioTS, ratioVL, ratioVS);
    3168     8140724 :             state.dataWaterToAirHeatPumpSimple->Winput =
    3169    16281448 :                 CoolPowerRated * Curve::CurveValue(state, simpleWatertoAirHP.CoolPowCurveIndex, ratioTWB, ratioTS, ratioVL, ratioVS);
    3170             : 
    3171             :             // Check if the Sensible Load is greater than the Total Cooling Load
    3172     8140724 :             if (simpleWatertoAirHP.QSensible > simpleWatertoAirHP.QLoadTotal) {
    3173     3094060 :                 simpleWatertoAirHP.QSensible = simpleWatertoAirHP.QLoadTotal;
    3174             :             }
    3175             : 
    3176     8140724 :             if (LatDegradModelSimFlag) {
    3177             :                 // Calculate for SHReff using the Latent Degradation Model
    3178           0 :                 if (NumIteration == 1) {
    3179           0 :                     state.dataWaterToAirHeatPumpSimple->QLatRated = simpleWatertoAirHP.QLoadTotal - simpleWatertoAirHP.QSensible;
    3180           0 :                 } else if (NumIteration == 2) {
    3181           0 :                     state.dataWaterToAirHeatPumpSimple->QLatActual = simpleWatertoAirHP.QLoadTotal - simpleWatertoAirHP.QSensible;
    3182           0 :                     SHRss = simpleWatertoAirHP.QSensible / simpleWatertoAirHP.QLoadTotal;
    3183           0 :                     SHReff = CalcEffectiveSHR(state,
    3184             :                                               HPNum,
    3185             :                                               SHRss,
    3186             :                                               CyclingScheme,
    3187             :                                               RuntimeFrac,
    3188           0 :                                               state.dataWaterToAirHeatPumpSimple->QLatRated,
    3189           0 :                                               state.dataWaterToAirHeatPumpSimple->QLatActual,
    3190           0 :                                               state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp,
    3191           0 :                                               state.dataWaterToAirHeatPumpSimple->LoadSideInletWBTemp);
    3192             :                     //       Update sensible capacity based on effective SHR
    3193           0 :                     simpleWatertoAirHP.QSensible = simpleWatertoAirHP.QLoadTotal * SHReff;
    3194           0 :                     break;
    3195             :                 }
    3196             :             } else {
    3197             :                 // Assume SHReff=SHRss
    3198     8140724 :                 SHReff = simpleWatertoAirHP.QSensible / simpleWatertoAirHP.QLoadTotal;
    3199     8140724 :                 break;
    3200             :             }
    3201             :         }
    3202             : 
    3203             :         // calculate coil outlet state variables
    3204     8140724 :         LoadSideFullOutletEnthalpy = state.dataWaterToAirHeatPumpSimple->LoadSideInletEnth - simpleWatertoAirHP.QLoadTotal / LoadSideFullMassFlowRate;
    3205     8140724 :         state.dataWaterToAirHeatPumpSimple->LoadSideOutletDBTemp =
    3206     8140724 :             state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp - simpleWatertoAirHP.QSensible / (LoadSideFullMassFlowRate * CpAir);
    3207     8140724 :         state.dataWaterToAirHeatPumpSimple->LoadSideOutletHumRat =
    3208     8140724 :             Psychrometrics::PsyWFnTdbH(state, state.dataWaterToAirHeatPumpSimple->LoadSideOutletDBTemp, LoadSideFullOutletEnthalpy, RoutineName);
    3209             :         // Actual outlet conditions are "average" for time step
    3210     8140724 :         if (CyclingScheme == DataHVACGlobals::ContFanCycCoil) {
    3211             :             // continuous fan, cycling compressor
    3212     4041210 :             simpleWatertoAirHP.OutletAirEnthalpy =
    3213     4041210 :                 PartLoadRatio * LoadSideFullOutletEnthalpy + (1.0 - PartLoadRatio) * state.dataWaterToAirHeatPumpSimple->LoadSideInletEnth;
    3214     8082420 :             simpleWatertoAirHP.OutletAirHumRat = PartLoadRatio * state.dataWaterToAirHeatPumpSimple->LoadSideOutletHumRat +
    3215     4041210 :                                                  (1.0 - PartLoadRatio) * state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat;
    3216     4041210 :             simpleWatertoAirHP.OutletAirDBTemp = Psychrometrics::PsyTdbFnHW(simpleWatertoAirHP.OutletAirEnthalpy, simpleWatertoAirHP.OutletAirHumRat);
    3217             :         } else {
    3218             :             // default to cycling fan, cycling compressor
    3219     4099514 :             simpleWatertoAirHP.OutletAirEnthalpy = LoadSideFullOutletEnthalpy;
    3220     4099514 :             simpleWatertoAirHP.OutletAirHumRat = state.dataWaterToAirHeatPumpSimple->LoadSideOutletHumRat;
    3221     4099514 :             simpleWatertoAirHP.OutletAirDBTemp = state.dataWaterToAirHeatPumpSimple->LoadSideOutletDBTemp;
    3222             :         }
    3223             : 
    3224             :         // scale heat transfer rates to PLR and power to RTF
    3225     8140724 :         simpleWatertoAirHP.QLoadTotal *= PartLoadRatio;
    3226    16281448 :         simpleWatertoAirHP.QLoadTotalReport = simpleWatertoAirHP.AirMassFlowRate *
    3227    16281448 :                                               (state.dataWaterToAirHeatPumpSimple->LoadSideInletEnth -
    3228     8140724 :                                                Psychrometrics::PsyHFnTdbW(simpleWatertoAirHP.OutletAirDBTemp,
    3229             :                                                                           simpleWatertoAirHP.OutletAirHumRat)); // Why doesn't this match QLoadTotal?
    3230     8140724 :         simpleWatertoAirHP.QSensible *= PartLoadRatio;
    3231     8140724 :         state.dataWaterToAirHeatPumpSimple->Winput *= RuntimeFrac;
    3232     8140724 :         simpleWatertoAirHP.QSource = simpleWatertoAirHP.QLoadTotalReport + state.dataWaterToAirHeatPumpSimple->Winput;
    3233     8140724 :         state.dataHeatBal->HeatReclaimSimple_WAHPCoil(HPNum).AvailCapacity = simpleWatertoAirHP.QSource;
    3234             : 
    3235             :         //  Add power to global variable so power can be summed by parent object
    3236     8140724 :         state.dataHVACGlobal->DXElecCoolingPower = state.dataWaterToAirHeatPumpSimple->Winput;
    3237             : 
    3238     8140724 :         ReportingConstant = TimeStepSys * DataGlobalConstants::SecInHour;
    3239     8140724 :         DataHeatBalance::HeatReclaimDataBase &HeatReclaim = state.dataHeatBal->HeatReclaimSimple_WAHPCoil(HPNum);
    3240     8140724 :         HeatReclaim.WaterHeatingDesuperheaterReclaimedHeatTotal = 0.0;
    3241     8140724 :         if (allocated(HeatReclaim.WaterHeatingDesuperheaterReclaimedHeat)) {
    3242       34404 :             for (auto &num : HeatReclaim.WaterHeatingDesuperheaterReclaimedHeat)
    3243       17202 :                 HeatReclaim.WaterHeatingDesuperheaterReclaimedHeatTotal += num;
    3244             :         }
    3245     8140724 :         simpleWatertoAirHP.QSource -= HeatReclaim.WaterHeatingDesuperheaterReclaimedHeatTotal;
    3246             : 
    3247             :         // Update heat pump data structure
    3248     8140724 :         simpleWatertoAirHP.Power = state.dataWaterToAirHeatPumpSimple->Winput;
    3249     8140724 :         simpleWatertoAirHP.QLoadTotal = simpleWatertoAirHP.QLoadTotalReport;
    3250     8140724 :         simpleWatertoAirHP.QLatent = simpleWatertoAirHP.QLoadTotalReport - simpleWatertoAirHP.QSensible;
    3251     8140724 :         simpleWatertoAirHP.Energy = state.dataWaterToAirHeatPumpSimple->Winput * ReportingConstant;
    3252     8140724 :         simpleWatertoAirHP.EnergyLoadTotal = simpleWatertoAirHP.QLoadTotalReport * ReportingConstant;
    3253     8140724 :         simpleWatertoAirHP.EnergySensible = simpleWatertoAirHP.QSensible * ReportingConstant;
    3254     8140724 :         simpleWatertoAirHP.EnergyLatent = (simpleWatertoAirHP.QLoadTotalReport - simpleWatertoAirHP.QSensible) * ReportingConstant;
    3255     8140724 :         simpleWatertoAirHP.EnergySource = simpleWatertoAirHP.QSource * ReportingConstant;
    3256     8140724 :         if (RuntimeFrac == 0.0) {
    3257      967870 :             simpleWatertoAirHP.COP = 0.0;
    3258             :         } else {
    3259     7172854 :             simpleWatertoAirHP.COP = simpleWatertoAirHP.QLoadTotalReport / state.dataWaterToAirHeatPumpSimple->Winput;
    3260             :         }
    3261     8140724 :         simpleWatertoAirHP.RunFrac = RuntimeFrac;
    3262     8140724 :         simpleWatertoAirHP.PartLoadRatio = PartLoadRatio;
    3263             : 
    3264     8140724 :         if ((simpleWatertoAirHP.WaterCyclingMode) == DataHVACGlobals::WaterCycling) {
    3265             :             // plant can lock flow at coil water inlet node, use design flow multiplied by PLR to calculate water mass flow rate
    3266     8140724 :             simpleWatertoAirHP.WaterMassFlowRate = simpleWatertoAirHP.DesignWaterMassFlowRate * PartLoadRatio;
    3267     8140724 :             PlantUtilities::SetComponentFlowRate(state,
    3268             :                                                  simpleWatertoAirHP.WaterMassFlowRate,
    3269             :                                                  simpleWatertoAirHP.WaterInletNodeNum,
    3270             :                                                  simpleWatertoAirHP.WaterOutletNodeNum,
    3271             :                                                  simpleWatertoAirHP.plantLoc);
    3272     8140724 :             if (simpleWatertoAirHP.WaterMassFlowRate > 0.0) {
    3273    13241700 :                 simpleWatertoAirHP.OutletWaterTemp = state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp +
    3274     6620850 :                                                      simpleWatertoAirHP.QSource / (simpleWatertoAirHP.WaterMassFlowRate * CpWater);
    3275     6620850 :                 simpleWatertoAirHP.OutletWaterEnthalpy =
    3276     6620850 :                     state.dataWaterToAirHeatPumpSimple->SourceSideInletEnth + simpleWatertoAirHP.QSource / simpleWatertoAirHP.WaterMassFlowRate;
    3277             :             }
    3278             :         } else {
    3279           0 :             if ((simpleWatertoAirHP.WaterCyclingMode) == DataHVACGlobals::WaterConstant) {
    3280           0 :                 if (simpleWatertoAirHP.WaterFlowMode) {
    3281           0 :                     simpleWatertoAirHP.WaterMassFlowRate = simpleWatertoAirHP.DesignWaterMassFlowRate;
    3282           0 :                     PlantUtilities::SetComponentFlowRate(state,
    3283             :                                                          simpleWatertoAirHP.WaterMassFlowRate,
    3284             :                                                          simpleWatertoAirHP.WaterInletNodeNum,
    3285             :                                                          simpleWatertoAirHP.WaterOutletNodeNum,
    3286             :                                                          simpleWatertoAirHP.plantLoc);
    3287             :                 } else {
    3288           0 :                     simpleWatertoAirHP.WaterMassFlowRate = state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate;
    3289             :                 }
    3290             :             } else {
    3291           0 :                 simpleWatertoAirHP.WaterMassFlowRate = state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate;
    3292             :             }
    3293           0 :             simpleWatertoAirHP.OutletWaterTemp = state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp +
    3294           0 :                                                  simpleWatertoAirHP.QSource / (state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate * CpWater);
    3295           0 :             simpleWatertoAirHP.OutletWaterEnthalpy = state.dataWaterToAirHeatPumpSimple->SourceSideInletEnth +
    3296           0 :                                                      simpleWatertoAirHP.QSource / state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate;
    3297             :         }
    3298             :     }
    3299             : 
    3300    19688320 :     void CalcHPHeatingSimple(EnergyPlusData &state,
    3301             :                              int const HPNum,                                         // Heat Pump Number
    3302             :                              int const CyclingScheme,                                 // Fan/Compressor cycling scheme indicator
    3303             :                              Real64 const RuntimeFrac,                                // Runtime Fraction of compressor
    3304             :                              [[maybe_unused]] Real64 const SensDemand,                // Sensible Demand [W] !unused1208
    3305             :                              DataHVACGlobals::CompressorOperation const CompressorOp, // compressor operation flag
    3306             :                              Real64 const PartLoadRatio,                              // compressor part load ratio
    3307             :                              [[maybe_unused]] Real64 const OnOffAirFlowRatio          // ratio of compressor on flow to average flow over time step
    3308             :     )
    3309             :     {
    3310             : 
    3311             :         //       AUTHOR         Arun Shenoy
    3312             :         //       DATE WRITTEN   Jan 2004
    3313             :         //       RE-ENGINEERED  Kenneth Tang (Jan 2005)
    3314             : 
    3315             :         // PURPOSE OF THIS SUBROUTINE:
    3316             :         // This subroutine is for simulating the heating mode of the Water to Air HP Simple
    3317             : 
    3318             :         // METHODOLOGY EMPLOYED:
    3319             :         // Simulate the heat pump performance using the coefficients in quadlinear and quintlinear curves and rated conditions
    3320             :         // Finally, adjust the heat pump outlet conditions based on the PartLoadRatio
    3321             :         // and RuntimeFrac.
    3322             : 
    3323             :         // REFERENCES:
    3324             :         // (1) Lash.T.A.,1992.Simulation and Analysis of a Water Loop Heat Pump System.
    3325             :         // M.S. Thesis, University of Illinois at Urbana Champaign.
    3326             :         // (2) Shenoy, Arun. 2004. Simulation, Modeling and Analysis of Water to Air Heat Pump.
    3327             :         // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
    3328             :         // Oklahoma State University. (downloadable from www.hvac.okstate.edu)
    3329             :         // (3) Tang,C.C.. 2005. Modeling Packaged Heat Pumps in a Quasi-Steady
    3330             :         // State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
    3331             :         // Oklahoma State University. (downloadable from www.hvac.okstate.edu)
    3332             : 
    3333    19688320 :         auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
    3334             : 
    3335             :         // SUBROUTINE PARAMETER DEFINITIONS:
    3336    19688320 :         Real64 constexpr Tref(283.15); // Reference Temperature for performance curves,10C [K]
    3337             :         static constexpr std::string_view RoutineName("CalcHPHeatingSimple");
    3338             :         static constexpr std::string_view RoutineNameSourceSideInletTemp("CalcHPHeatingSimple:SourceSideInletTemp");
    3339             : 
    3340             :         Real64 HeatCapRated;               // Rated Heating Capacity [W]
    3341             :         Real64 HeatPowerRated;             // Rated Heating Power Input[W]
    3342             :         Real64 AirVolFlowRateRated;        // Rated Air Volumetric Flow Rate [m3/s]
    3343             :         Real64 WaterVolFlowRateRated;      // Rated Water Volumetric Flow Rate [m3/s]
    3344             :         Real64 ratioTDB;                   // Ratio of the inlet air dry bulb temperature to the rated conditions
    3345             :         Real64 ratioTS;                    // Ratio of the source side (water) inlet temperature to the rated conditions
    3346             :         Real64 ratioVL;                    // Ratio of the load side flow rate to the rated conditions
    3347             :         Real64 ratioVS;                    // Ratio of the source side flow rate to the rated conditions
    3348             :         Real64 CpWater;                    // Specific heat of water [J/kg_C]
    3349             :         Real64 CpAir;                      // Specific heat of air [J/kg_C]
    3350             :         Real64 LoadSideFullMassFlowRate;   // Load Side Full Load Mass Flow Rate [kg/s]
    3351             :         Real64 LoadSideFullOutletEnthalpy; // Load Side Full Load Outlet Air Enthalpy [J/kg]
    3352             :         Real64 ReportingConstant;
    3353             : 
    3354             :         //  LOAD LOCAL VARIABLES FROM DATA STRUCTURE (for code readability)
    3355             : 
    3356    19688320 :         auto &simpleWatertoAirHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum));
    3357             : 
    3358    19688320 :         HeatCapRated = simpleWatertoAirHP.RatedCapHeat;
    3359    19688320 :         HeatPowerRated = simpleWatertoAirHP.RatedPowerHeat;
    3360    19688320 :         AirVolFlowRateRated = simpleWatertoAirHP.RatedAirVolFlowRate;
    3361    19688320 :         WaterVolFlowRateRated = simpleWatertoAirHP.RatedWaterVolFlowRate;
    3362    19688320 :         if (CyclingScheme == DataHVACGlobals::ContFanCycCoil) {
    3363     4653294 :             LoadSideFullMassFlowRate = simpleWatertoAirHP.AirMassFlowRate;
    3364             :         } else {
    3365             :             // default to cycling fan, cycling compressor, full load air flow
    3366    15035026 :             if (PartLoadRatio > 0.0) {
    3367     4951062 :                 LoadSideFullMassFlowRate = simpleWatertoAirHP.AirMassFlowRate / PartLoadRatio;
    3368             :             } else {
    3369    10083964 :                 LoadSideFullMassFlowRate = 0.0;
    3370             :             }
    3371             :         }
    3372    19688320 :         state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp = simpleWatertoAirHP.InletAirDBTemp;
    3373    19688320 :         state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat = simpleWatertoAirHP.InletAirHumRat;
    3374             : 
    3375    19688320 :         state.dataWaterToAirHeatPumpSimple->LoadSideInletWBTemp =
    3376    59064960 :             Psychrometrics::PsyTwbFnTdbWPb(state,
    3377    19688320 :                                            state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp,
    3378    19688320 :                                            state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat,
    3379    19688320 :                                            state.dataEnvrn->OutBaroPress,
    3380             :                                            RoutineName);
    3381    19688320 :         state.dataWaterToAirHeatPumpSimple->LoadSideInletEnth = simpleWatertoAirHP.InletAirEnthalpy;
    3382    19688320 :         CpAir = Psychrometrics::PsyCpAirFnW(state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat);
    3383    19688320 :         state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate = simpleWatertoAirHP.WaterMassFlowRate;
    3384    19688320 :         state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp = simpleWatertoAirHP.InletWaterTemp;
    3385    19688320 :         state.dataWaterToAirHeatPumpSimple->SourceSideInletEnth = simpleWatertoAirHP.InletWaterEnthalpy;
    3386    59064960 :         CpWater = FluidProperties::GetSpecificHeatGlycol(state,
    3387    19688320 :                                                          state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidName,
    3388    19688320 :                                                          state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp,
    3389    19688320 :                                                          state.dataPlnt->PlantLoop(simpleWatertoAirHP.plantLoc.loopNum).FluidIndex,
    3390             :                                                          RoutineNameSourceSideInletTemp);
    3391             : 
    3392             :         // Check for flows, do not perform simulation if no flow in load side or source side.
    3393    19688320 :         if (state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate <= 0.0 || LoadSideFullMassFlowRate <= 0.0) {
    3394    14582168 :             simpleWatertoAirHP.SimFlag = false;
    3395    29175630 :             return;
    3396             :         } else {
    3397     5106152 :             simpleWatertoAirHP.SimFlag = true;
    3398             :         }
    3399             : 
    3400     5106152 :         if (CompressorOp == DataHVACGlobals::CompressorOperation::Off) {
    3401       11294 :             simpleWatertoAirHP.SimFlag = false;
    3402       11294 :             return;
    3403             :         }
    3404             : 
    3405     5094858 :         ratioTDB = ((state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref);
    3406     5094858 :         ratioTS = ((state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp + state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) / Tref);
    3407     5094858 :         ratioVL = (LoadSideFullMassFlowRate /
    3408    15284574 :                    (AirVolFlowRateRated * Psychrometrics::PsyRhoAirFnPbTdbW(state,
    3409     5094858 :                                                                             state.dataEnvrn->StdBaroPress,
    3410     5094858 :                                                                             state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp,
    3411     5094858 :                                                                             state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat,
    3412             :                                                                             RoutineName)));
    3413     5094858 :         if (simpleWatertoAirHP.DesignWaterMassFlowRate > 0.0) {
    3414     5094858 :             ratioVS = (state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate) / (simpleWatertoAirHP.DesignWaterMassFlowRate);
    3415             :         } else {
    3416           0 :             ratioVS = 0.0;
    3417             :         }
    3418             : 
    3419     5094858 :         simpleWatertoAirHP.QLoadTotal =
    3420    10189716 :             HeatCapRated * Curve::CurveValue(state, simpleWatertoAirHP.HeatCapCurveIndex, ratioTDB, ratioTS, ratioVL, ratioVS);
    3421     5094858 :         simpleWatertoAirHP.QSensible = simpleWatertoAirHP.QLoadTotal;
    3422     5094858 :         state.dataWaterToAirHeatPumpSimple->Winput =
    3423    10189716 :             HeatPowerRated * Curve::CurveValue(state, simpleWatertoAirHP.HeatPowCurveIndex, ratioTDB, ratioTS, ratioVL, ratioVS);
    3424             : 
    3425             :         // calculate coil outlet state variables
    3426     5094858 :         LoadSideFullOutletEnthalpy = state.dataWaterToAirHeatPumpSimple->LoadSideInletEnth + simpleWatertoAirHP.QLoadTotal / LoadSideFullMassFlowRate;
    3427     5094858 :         state.dataWaterToAirHeatPumpSimple->LoadSideOutletDBTemp =
    3428     5094858 :             state.dataWaterToAirHeatPumpSimple->LoadSideInletDBTemp + simpleWatertoAirHP.QSensible / (LoadSideFullMassFlowRate * CpAir);
    3429     5094858 :         state.dataWaterToAirHeatPumpSimple->LoadSideOutletHumRat =
    3430     5094858 :             Psychrometrics::PsyWFnTdbH(state, state.dataWaterToAirHeatPumpSimple->LoadSideOutletDBTemp, LoadSideFullOutletEnthalpy, RoutineName);
    3431             : 
    3432             :         // Actual outlet conditions are "average" for time step
    3433     5094858 :         if (CyclingScheme == DataHVACGlobals::ContFanCycCoil) {
    3434             :             // continuous fan, cycling compressor
    3435      253808 :             simpleWatertoAirHP.OutletAirEnthalpy =
    3436      253808 :                 PartLoadRatio * LoadSideFullOutletEnthalpy + (1.0 - PartLoadRatio) * state.dataWaterToAirHeatPumpSimple->LoadSideInletEnth;
    3437      507616 :             simpleWatertoAirHP.OutletAirHumRat = PartLoadRatio * state.dataWaterToAirHeatPumpSimple->LoadSideOutletHumRat +
    3438      253808 :                                                  (1.0 - PartLoadRatio) * state.dataWaterToAirHeatPumpSimple->LoadSideInletHumRat;
    3439      253808 :             simpleWatertoAirHP.OutletAirDBTemp = Psychrometrics::PsyTdbFnHW(simpleWatertoAirHP.OutletAirEnthalpy, simpleWatertoAirHP.OutletAirHumRat);
    3440             :         } else {
    3441             :             // default to cycling fan, cycling compressor
    3442     4841050 :             simpleWatertoAirHP.OutletAirEnthalpy = LoadSideFullOutletEnthalpy;
    3443     4841050 :             simpleWatertoAirHP.OutletAirHumRat = state.dataWaterToAirHeatPumpSimple->LoadSideOutletHumRat;
    3444     4841050 :             simpleWatertoAirHP.OutletAirDBTemp = state.dataWaterToAirHeatPumpSimple->LoadSideOutletDBTemp;
    3445             :         }
    3446             : 
    3447             :         // scale heat transfer rates to PLR and power to RTF
    3448     5094858 :         simpleWatertoAirHP.QLoadTotal *= PartLoadRatio;
    3449     5094858 :         simpleWatertoAirHP.QLoadTotalReport = simpleWatertoAirHP.QLoadTotal;
    3450     5094858 :         simpleWatertoAirHP.QSensible *= PartLoadRatio;
    3451     5094858 :         state.dataWaterToAirHeatPumpSimple->Winput *= RuntimeFrac;
    3452     5094858 :         simpleWatertoAirHP.QSource = simpleWatertoAirHP.QLoadTotalReport - state.dataWaterToAirHeatPumpSimple->Winput;
    3453             : 
    3454             :         //  Add power to global variable so power can be summed by parent object
    3455     5094858 :         state.dataHVACGlobal->DXElecHeatingPower = state.dataWaterToAirHeatPumpSimple->Winput;
    3456             : 
    3457     5094858 :         ReportingConstant = TimeStepSys * DataGlobalConstants::SecInHour;
    3458             :         // Update heat pump data structure
    3459     5094858 :         simpleWatertoAirHP.Power = state.dataWaterToAirHeatPumpSimple->Winput;
    3460     5094858 :         simpleWatertoAirHP.QLoadTotal = simpleWatertoAirHP.QLoadTotalReport;
    3461     5094858 :         simpleWatertoAirHP.QSensible = simpleWatertoAirHP.QSensible;
    3462     5094858 :         simpleWatertoAirHP.Energy = state.dataWaterToAirHeatPumpSimple->Winput * ReportingConstant;
    3463     5094858 :         simpleWatertoAirHP.EnergyLoadTotal = simpleWatertoAirHP.QLoadTotalReport * ReportingConstant;
    3464     5094858 :         simpleWatertoAirHP.EnergySensible = simpleWatertoAirHP.QSensible * ReportingConstant;
    3465     5094858 :         simpleWatertoAirHP.EnergyLatent = 0.0;
    3466     5094858 :         simpleWatertoAirHP.EnergySource = simpleWatertoAirHP.QSource * ReportingConstant;
    3467     5094858 :         if (RuntimeFrac == 0.0) {
    3468       60688 :             simpleWatertoAirHP.COP = 0.0;
    3469             :         } else {
    3470     5034170 :             simpleWatertoAirHP.COP = simpleWatertoAirHP.QLoadTotalReport / state.dataWaterToAirHeatPumpSimple->Winput;
    3471             :         }
    3472     5094858 :         simpleWatertoAirHP.RunFrac = RuntimeFrac;
    3473     5094858 :         simpleWatertoAirHP.PartLoadRatio = PartLoadRatio;
    3474             : 
    3475     5094858 :         if ((simpleWatertoAirHP.WaterCyclingMode) == DataHVACGlobals::WaterCycling) {
    3476             :             // plant can lock flow at coil water inlet node, use design flow multiplied by PLR to calculate water mass flow rate
    3477     5094858 :             simpleWatertoAirHP.WaterMassFlowRate = simpleWatertoAirHP.DesignWaterMassFlowRate * PartLoadRatio;
    3478     5094858 :             PlantUtilities::SetComponentFlowRate(state,
    3479             :                                                  simpleWatertoAirHP.WaterMassFlowRate,
    3480             :                                                  simpleWatertoAirHP.WaterInletNodeNum,
    3481             :                                                  simpleWatertoAirHP.WaterOutletNodeNum,
    3482             :                                                  simpleWatertoAirHP.plantLoc);
    3483     5094858 :             if (simpleWatertoAirHP.WaterMassFlowRate > 0.0) {
    3484    10068372 :                 simpleWatertoAirHP.OutletWaterTemp = state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp -
    3485     5034186 :                                                      simpleWatertoAirHP.QSource / (simpleWatertoAirHP.WaterMassFlowRate * CpWater);
    3486     5034186 :                 simpleWatertoAirHP.OutletWaterEnthalpy =
    3487     5034186 :                     state.dataWaterToAirHeatPumpSimple->SourceSideInletEnth - simpleWatertoAirHP.QSource / simpleWatertoAirHP.WaterMassFlowRate;
    3488             :             }
    3489             :         } else {
    3490           0 :             if ((simpleWatertoAirHP.WaterCyclingMode) == DataHVACGlobals::WaterConstant) {
    3491           0 :                 if (simpleWatertoAirHP.WaterFlowMode) {
    3492           0 :                     simpleWatertoAirHP.WaterMassFlowRate = simpleWatertoAirHP.DesignWaterMassFlowRate;
    3493           0 :                     PlantUtilities::SetComponentFlowRate(state,
    3494             :                                                          simpleWatertoAirHP.WaterMassFlowRate,
    3495             :                                                          simpleWatertoAirHP.WaterInletNodeNum,
    3496             :                                                          simpleWatertoAirHP.WaterOutletNodeNum,
    3497             :                                                          simpleWatertoAirHP.plantLoc);
    3498             :                 } else {
    3499           0 :                     simpleWatertoAirHP.WaterMassFlowRate = state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate;
    3500             :                 }
    3501             :             } else {
    3502           0 :                 simpleWatertoAirHP.WaterMassFlowRate = state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate;
    3503             :             }
    3504           0 :             simpleWatertoAirHP.OutletWaterTemp = state.dataWaterToAirHeatPumpSimple->SourceSideInletTemp -
    3505           0 :                                                  simpleWatertoAirHP.QSource / (state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate * CpWater);
    3506           0 :             simpleWatertoAirHP.OutletWaterEnthalpy = state.dataWaterToAirHeatPumpSimple->SourceSideInletEnth -
    3507           0 :                                                      simpleWatertoAirHP.QSource / state.dataWaterToAirHeatPumpSimple->SourceSideMassFlowRate;
    3508             :         }
    3509             :     }
    3510             : 
    3511    39376595 :     void UpdateSimpleWatertoAirHP(EnergyPlusData &state, int const HPNum)
    3512             :     {
    3513             :         // SUBROUTINE INFORMATION:
    3514             :         //       AUTHOR         Arun Shenoy
    3515             :         //       DATE WRITTEN   Jan 2004
    3516             :         //       RE-ENGINEERED  Kenneth Tang (Jan 2005)
    3517             : 
    3518             :         // PURPOSE OF THIS SUBROUTINE:
    3519             :         // This subroutine updates the Water to Air Heat Pump outlet nodes.
    3520             : 
    3521             :         // METHODOLOGY EMPLOYED:
    3522             :         // Data is moved from the HP data structure to the HP outlet nodes.
    3523             : 
    3524    39376595 :         auto &TimeStepSys = state.dataHVACGlobal->TimeStepSys;
    3525             : 
    3526             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    3527             :         int AirInletNode;
    3528             :         int WaterInletNode;
    3529             :         int AirOutletNode;
    3530             :         int WaterOutletNode;
    3531             :         Real64 ReportingConstant;
    3532             : 
    3533    39376595 :         auto &simpleWatertoAirHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum));
    3534             : 
    3535    39376595 :         if (!simpleWatertoAirHP.SimFlag) {
    3536             :             // Heatpump is off; just pass through conditions
    3537    26141013 :             simpleWatertoAirHP.Power = 0.0;
    3538    26141013 :             simpleWatertoAirHP.QLoadTotal = 0.0;
    3539    26141013 :             simpleWatertoAirHP.QLoadTotalReport = 0.0;
    3540    26141013 :             simpleWatertoAirHP.QSensible = 0.0;
    3541    26141013 :             simpleWatertoAirHP.QLatent = 0.0;
    3542    26141013 :             simpleWatertoAirHP.QSource = 0.0;
    3543    26141013 :             simpleWatertoAirHP.Energy = 0.0;
    3544    26141013 :             simpleWatertoAirHP.EnergyLoadTotal = 0.0;
    3545    26141013 :             simpleWatertoAirHP.EnergySensible = 0.0;
    3546    26141013 :             simpleWatertoAirHP.EnergyLatent = 0.0;
    3547    26141013 :             simpleWatertoAirHP.EnergySource = 0.0;
    3548    26141013 :             simpleWatertoAirHP.COP = 0.0;
    3549    26141013 :             simpleWatertoAirHP.RunFrac = 0.0;
    3550    26141013 :             simpleWatertoAirHP.PartLoadRatio = 0.0;
    3551             : 
    3552    26141013 :             simpleWatertoAirHP.OutletAirDBTemp = simpleWatertoAirHP.InletAirDBTemp;
    3553    26141013 :             simpleWatertoAirHP.OutletAirHumRat = simpleWatertoAirHP.InletAirHumRat;
    3554    26141013 :             simpleWatertoAirHP.OutletAirEnthalpy = simpleWatertoAirHP.InletAirEnthalpy;
    3555    26141013 :             simpleWatertoAirHP.OutletWaterTemp = simpleWatertoAirHP.InletWaterTemp;
    3556    26141013 :             simpleWatertoAirHP.OutletWaterEnthalpy = simpleWatertoAirHP.InletWaterEnthalpy;
    3557             :         }
    3558             : 
    3559    39376595 :         AirInletNode = simpleWatertoAirHP.AirInletNodeNum;
    3560    39376595 :         WaterInletNode = simpleWatertoAirHP.WaterInletNodeNum;
    3561    39376595 :         AirOutletNode = simpleWatertoAirHP.AirOutletNodeNum;
    3562    39376595 :         WaterOutletNode = simpleWatertoAirHP.WaterOutletNodeNum;
    3563             : 
    3564             :         // Set the air outlet  nodes of the WatertoAirHPSimple
    3565    39376595 :         state.dataLoopNodes->Node(AirOutletNode).MassFlowRate = state.dataLoopNodes->Node(AirInletNode).MassFlowRate;
    3566    39376595 :         state.dataLoopNodes->Node(AirOutletNode).Temp = simpleWatertoAirHP.OutletAirDBTemp;
    3567    39376595 :         state.dataLoopNodes->Node(AirOutletNode).HumRat = simpleWatertoAirHP.OutletAirHumRat;
    3568    39376595 :         state.dataLoopNodes->Node(AirOutletNode).Enthalpy = simpleWatertoAirHP.OutletAirEnthalpy;
    3569             : 
    3570             :         // Set the air outlet nodes for properties that just pass through & not used
    3571    39376595 :         state.dataLoopNodes->Node(AirOutletNode).Quality = state.dataLoopNodes->Node(AirInletNode).Quality;
    3572    39376595 :         state.dataLoopNodes->Node(AirOutletNode).Press = state.dataLoopNodes->Node(AirInletNode).Press;
    3573    39376595 :         state.dataLoopNodes->Node(AirOutletNode).MassFlowRateMin = state.dataLoopNodes->Node(AirInletNode).MassFlowRateMin;
    3574    39376595 :         state.dataLoopNodes->Node(AirOutletNode).MassFlowRateMax = state.dataLoopNodes->Node(AirInletNode).MassFlowRateMax;
    3575    39376595 :         state.dataLoopNodes->Node(AirOutletNode).MassFlowRateMinAvail = state.dataLoopNodes->Node(AirInletNode).MassFlowRateMinAvail;
    3576    39376595 :         state.dataLoopNodes->Node(AirOutletNode).MassFlowRateMaxAvail = state.dataLoopNodes->Node(AirInletNode).MassFlowRateMaxAvail;
    3577             : 
    3578             :         // Set the water outlet node of the WatertoAirHPSimple
    3579             :         // Set the water outlet nodes for properties that just pass through & not used
    3580    39376595 :         PlantUtilities::SafeCopyPlantNode(state, WaterInletNode, WaterOutletNode);
    3581             : 
    3582    39376595 :         state.dataLoopNodes->Node(WaterOutletNode).Temp = simpleWatertoAirHP.OutletWaterTemp;
    3583    39376595 :         state.dataLoopNodes->Node(WaterOutletNode).Enthalpy = simpleWatertoAirHP.OutletWaterEnthalpy;
    3584             : 
    3585    39376595 :         ReportingConstant = TimeStepSys * DataGlobalConstants::SecInHour;
    3586    39376595 :         simpleWatertoAirHP.Energy = simpleWatertoAirHP.Power * ReportingConstant;
    3587    39376595 :         simpleWatertoAirHP.EnergyLoadTotal = simpleWatertoAirHP.QLoadTotal * ReportingConstant;
    3588    39376595 :         simpleWatertoAirHP.EnergySensible = simpleWatertoAirHP.QSensible * ReportingConstant;
    3589    39376595 :         simpleWatertoAirHP.EnergyLatent = simpleWatertoAirHP.QLatent * ReportingConstant;
    3590    39376595 :         simpleWatertoAirHP.EnergySource = simpleWatertoAirHP.QSource * ReportingConstant;
    3591             : 
    3592    39376595 :         if (state.dataContaminantBalance->Contaminant.CO2Simulation) {
    3593           0 :             state.dataLoopNodes->Node(AirOutletNode).CO2 = state.dataLoopNodes->Node(AirInletNode).CO2;
    3594             :         }
    3595    39376595 :         if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) {
    3596           0 :             state.dataLoopNodes->Node(AirOutletNode).GenContam = state.dataLoopNodes->Node(AirInletNode).GenContam;
    3597             :         }
    3598             : 
    3599    39376595 :         if (simpleWatertoAirHP.reportCoilFinalSizes) {
    3600    16253271 :             if (!state.dataGlobal->WarmupFlag && !state.dataGlobal->DoingHVACSizingSimulations && !state.dataGlobal->DoingSizing) {
    3601             : 
    3602         266 :                 if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Cooling) {
    3603         266 :                     state.dataRptCoilSelection->coilSelectionReportObj->setCoilFinalSizes(
    3604             :                         state,
    3605             :                         simpleWatertoAirHP.Name,
    3606         266 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    3607             :                         simpleWatertoAirHP.RatedCapCoolTotal,
    3608             :                         simpleWatertoAirHP.RatedCapCoolSens,
    3609             :                         simpleWatertoAirHP.RatedAirVolFlowRate,
    3610             :                         simpleWatertoAirHP.RatedWaterVolFlowRate);
    3611         133 :                 } else if (simpleWatertoAirHP.WAHPType == WatertoAirHP::Heating) {
    3612         266 :                     state.dataRptCoilSelection->coilSelectionReportObj->setCoilFinalSizes(
    3613             :                         state,
    3614             :                         simpleWatertoAirHP.Name,
    3615         266 :                         format("COIL:{}:WATERTOAIRHEATPUMP:EQUATIONFIT", WatertoAirHPNamesUC[static_cast<int>(simpleWatertoAirHP.WAHPType)]),
    3616             :                         simpleWatertoAirHP.RatedCapHeat,
    3617             :                         simpleWatertoAirHP.RatedCapHeat,
    3618             :                         simpleWatertoAirHP.RatedAirVolFlowRate,
    3619             :                         simpleWatertoAirHP.RatedWaterVolFlowRate);
    3620             :                 }
    3621         266 :                 simpleWatertoAirHP.reportCoilFinalSizes = false;
    3622             :             }
    3623             :         }
    3624    39376595 :     }
    3625             : 
    3626             :     //        End of Update subroutines for the WatertoAirHP Module
    3627             :     // *****************************************************************************
    3628             : 
    3629           0 :     Real64 CalcEffectiveSHR(EnergyPlusData &state,
    3630             :                             int const HPNum,         // Index number for cooling coil
    3631             :                             Real64 const SHRss,      // Steady-state sensible heat ratio
    3632             :                             int const CyclingScheme, // Fan/compressor cycling scheme indicator
    3633             :                             Real64 const RTF,        // Compressor run-time fraction
    3634             :                             Real64 const QLatRated,  // Rated latent capacity
    3635             :                             Real64 const QLatActual, // Actual latent capacity
    3636             :                             Real64 const EnteringDB, // Entering air dry-bulb temperature
    3637             :                             Real64 const EnteringWB  // Entering air wet-bulb temperature
    3638             :     )
    3639             :     {
    3640             : 
    3641             :         // FUNCTION INFORMATION:
    3642             :         //    AUTHOR         Richard Raustad, FSEC
    3643             :         //    DATE WRITTEN   September 2003
    3644             :         //    MODIFIED       Kenneth Tang (Aug 2004) Added capability for simulating CycFanCycCoil
    3645             : 
    3646             :         // PURPOSE OF THIS FUNCTION:
    3647             :         //    Adjust sensible heat ratio to account for degradation of DX coil latent
    3648             :         //    capacity at part-load (cycling) conditions.
    3649             : 
    3650             :         // METHODOLOGY EMPLOYED:
    3651             :         //    With model parameters entered by the user, the part-load latent performance
    3652             :         //    of a DX cooling coil is determined for a constant air flow system with
    3653             :         //    a cooling coil that cycles on/off. The model calculates the time
    3654             :         //    required for condensate to begin falling from the cooling coil.
    3655             :         //    Runtimes greater than this are integrated to a "part-load" latent
    3656             :         //    capacity which is used to determine the "part-load" sensible heat ratio.
    3657             :         //    See reference below for additional details (linear decay model, Eq. 8b).
    3658             : 
    3659             :         //    For cycling fan operation, a modified version of Henderson and Rengarajan (1996)
    3660             :         //    model is used by ultilizing the fan delay time as the time-off (or time duration
    3661             :         //    for the re-evaporation of moisture from time coil). Refer to Tang, C.C. (2005)
    3662             : 
    3663             :         // REFERENCES:
    3664             :         //    (1) Henderson, H.I., K. Rengarajan.1996. A Model to Predict the Latent
    3665             :         //    Capacity of Air Conditioners and Heat Pumps at Part-Load Conditions
    3666             :         //    with Constant Fan Operation ASHRAE Transactions 102 (1), pp. 266-274.
    3667             :         //    (2) Tang,C.C.. 2005. Modeling Packaged Heat Pumps in a Quasi-Steady
    3668             :         //    State Energy Simulation Program. M.S. Thesis, Department of Mechanical and Aerospace Engineering,
    3669             :         //    Oklahoma State University. (downloadable from www.hvac.okstate.edu)
    3670             : 
    3671             :         // Return value
    3672             :         Real64 SHReff; // Effective sensible heat ratio, includes degradation due to cycling effects
    3673             : 
    3674             :         // FUNCTION LOCAL VARIABLE DECLARATIONS:
    3675             :         Real64 Twet; // Nominal time for condensate to begin leaving the coil's condensate drain line
    3676             :         // at the current operating conditions (sec)
    3677             :         Real64 Gamma; // Initial moisture evaporation rate divided by steady-state AC latent capacity
    3678             :         // at the current operating conditions
    3679             :         Real64 Twet_Rated;            // Twet at rated conditions (coil air flow rate and air temperatures), sec
    3680             :         Real64 Gamma_Rated;           // Gamma at rated conditions (coil air flow rate and air temperatures)
    3681             :         Real64 Twet_max;              // Maximum allowed value for Twet
    3682             :         Real64 MaxONOFFCyclesperHour; // Maximum cycling rate of heat pump [cycles/hr]
    3683             :         Real64 HPTimeConstant;        // Heat pump time constant [s]
    3684             :         Real64 FanDelayTime;          // Fan delay time, time delay for the HP's fan to
    3685             :         // shut off after compressor cycle off  [s]
    3686             :         Real64 Ton;     // Coil on time (sec)
    3687             :         Real64 Toff;    // Coil off time (sec)
    3688             :         Real64 Toffa;   // Actual coil off time (sec). Equations valid for Toff <= (2.0 * Twet/Gamma)
    3689             :         Real64 aa;      // Intermediate variable
    3690             :         Real64 To1;     // Intermediate variable (first guess at To). To = time to the start of moisture removal
    3691             :         Real64 To2;     // Intermediate variable (second guess at To). To = time to the start of moisture removal
    3692             :         Real64 Error;   // Error for iteration (DO) loop
    3693             :         Real64 LHRmult; // Latent Heat Ratio (LHR) multiplier. The effective latent heat ratio LHR = (1-SHRss)*LHRmult
    3694             : 
    3695           0 :         auto &simpleWatertoAirHP(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum));
    3696             : 
    3697           0 :         Twet_Rated = simpleWatertoAirHP.Twet_Rated;
    3698           0 :         Gamma_Rated = simpleWatertoAirHP.Gamma_Rated;
    3699           0 :         MaxONOFFCyclesperHour = simpleWatertoAirHP.MaxONOFFCyclesperHour;
    3700           0 :         HPTimeConstant = simpleWatertoAirHP.HPTimeConstant;
    3701           0 :         FanDelayTime = simpleWatertoAirHP.FanDelayTime;
    3702             : 
    3703             :         //  No moisture evaporation (latent degradation) occurs for runtime fraction of 1.0
    3704             :         //  All latent degradation model parameters cause divide by 0.0 if not greater than 0.0
    3705             :         //  Latent degradation model parameters initialize to 0.0 meaning no evaporation model used.
    3706           0 :         if ((RTF >= 1.0) || (QLatRated == 0.0) || (QLatActual == 0.0) || (Twet_Rated <= 0.0) || (Gamma_Rated <= 0.0) ||
    3707           0 :             (MaxONOFFCyclesperHour <= 0.0) || (HPTimeConstant <= 0.0) || (RTF <= 0.0)) {
    3708           0 :             SHReff = SHRss;
    3709           0 :             return SHReff;
    3710             :         }
    3711             : 
    3712           0 :         Twet_max = 9999.0; // high limit for Twet
    3713             : 
    3714             :         //  Calculate the model parameters at the actual operating conditions
    3715           0 :         Twet = min(Twet_Rated * QLatRated / (QLatActual + 1.e-10), Twet_max);
    3716           0 :         Gamma = Gamma_Rated * QLatRated * (EnteringDB - EnteringWB) / ((26.7 - 19.4) * QLatActual + 1.e-10);
    3717             : 
    3718             :         //  Calculate the compressor on and off times using a converntional thermostat curve
    3719           0 :         Ton = 3600.0 / (4.0 * MaxONOFFCyclesperHour * (1.0 - RTF)); // duration of cooling coil on-cycle (sec)
    3720             : 
    3721           0 :         if ((CyclingScheme == DataHVACGlobals::CycFanCycCoil) && (FanDelayTime != 0.0)) {
    3722             :             // For CycFanCycCoil, moisture is evaporated from the cooling coil back to the air stream
    3723             :             // until the fan cycle off. Assume no evaporation from the coil after the fan shuts off.
    3724           0 :             Toff = FanDelayTime;
    3725             :         } else {
    3726             :             // For ContFanCycCoil, moisture is evaporated from the cooling coil back to the air stream
    3727             :             // for the entire heat pump off-cycle.
    3728           0 :             Toff = 3600.0 / (4.0 * MaxONOFFCyclesperHour * RTF); // duration of cooling coil off-cycle (sec)
    3729             :         }
    3730             : 
    3731             :         //  Cap Toff to meet the equation restriction
    3732           0 :         if (Gamma > 0.0) {
    3733           0 :             Toffa = min(Toff, 2.0 * Twet / Gamma);
    3734             :         } else {
    3735           0 :             Toffa = Toff;
    3736             :         }
    3737             : 
    3738             :         //  Use sucessive substitution to solve for To
    3739           0 :         aa = (Gamma * Toffa) - (0.25 / Twet) * pow_2(Gamma) * pow_2(Toffa);
    3740             : 
    3741           0 :         To1 = aa + HPTimeConstant;
    3742           0 :         Error = 1.0;
    3743           0 :         while (Error > 0.001) {
    3744           0 :             To2 = aa - HPTimeConstant * (std::exp(-To1 / HPTimeConstant) - 1.0);
    3745           0 :             Error = std::abs((To2 - To1) / To1);
    3746           0 :             To1 = To2;
    3747             :         }
    3748             : 
    3749             :         //  Adjust Sensible Heat Ratio (SHR) using Latent Heat Ratio (LHR) multiplier
    3750             :         //  Floating underflow errors occur when -Ton/HPTimeConstant is a large negative number.
    3751             :         //  Cap lower limit at -700 to avoid the underflow errors.
    3752           0 :         aa = std::exp(max(-700.0, -Ton / HPTimeConstant));
    3753             :         //  Calculate latent heat ratio multiplier
    3754           0 :         LHRmult = max(((Ton - To2) / (Ton + HPTimeConstant * (aa - 1.0))), 0.0);
    3755             : 
    3756             :         //  Calculate part-load or "effective" sensible heat ratio
    3757           0 :         SHReff = 1.0 - (1.0 - SHRss) * LHRmult;
    3758             : 
    3759           0 :         if (SHReff < SHRss) SHReff = SHRss; // Effective SHR can be less than the steady-state SHR
    3760           0 :         if (SHReff > 1.0) SHReff = 1.0;     // Effective sensible heat ratio can't be greater than 1.0
    3761             : 
    3762           0 :         return SHReff;
    3763             :     }
    3764             : 
    3765         267 :     int GetCoilIndex(EnergyPlusData &state,
    3766             :                      std::string const &CoilType, // must match coil types in this module
    3767             :                      std::string const &CoilName, // must match coil names for the coil type
    3768             :                      bool &ErrorsFound            // set to true if problem
    3769             :     )
    3770             :     {
    3771             : 
    3772             :         // FUNCTION INFORMATION:
    3773             :         //       AUTHOR         R. Raustad
    3774             :         //       DATE WRITTEN   August 2007
    3775             : 
    3776             :         // PURPOSE OF THIS FUNCTION:
    3777             :         // This function looks up the coil capacity for the given coil and returns it.  If
    3778             :         // incorrect coil type or name is given, ErrorsFound is returned as true and index is returned
    3779             :         // as zero.
    3780             : 
    3781             :         // Return value
    3782             :         int IndexNum; // returned index of matched coil
    3783             : 
    3784             :         // Obtains and Allocates WatertoAirHP related parameters from input file
    3785         267 :         if (state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag) { // First time subroutine has been entered
    3786          17 :             GetSimpleWatertoAirHPInput(state);
    3787          17 :             state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag = false;
    3788             :         }
    3789             : 
    3790         267 :         IndexNum = UtilityRoutines::FindItemInList(CoilName, state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP);
    3791             : 
    3792         267 :         if (IndexNum == 0) {
    3793           0 :             ShowSevereError(state, format("Could not find CoilType=\"{}\" with Name=\"{}\"", CoilType, CoilName));
    3794           0 :             ErrorsFound = true;
    3795             :         }
    3796             : 
    3797         267 :         return IndexNum;
    3798             :     }
    3799             : 
    3800         288 :     Real64 GetCoilCapacity(EnergyPlusData &state,
    3801             :                            std::string const &CoilType, // must match coil types in this module
    3802             :                            std::string const &CoilName, // must match coil names for the coil type
    3803             :                            bool &ErrorsFound            // set to true if problem
    3804             :     )
    3805             :     {
    3806             : 
    3807             :         // FUNCTION INFORMATION:
    3808             :         //       AUTHOR         Linda Lawrie
    3809             :         //       DATE WRITTEN   February 2006
    3810             : 
    3811             :         // PURPOSE OF THIS FUNCTION:
    3812             :         // This function looks up the coil capacity for the given coil and returns it.  If
    3813             :         // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned
    3814             :         // as negative.
    3815             : 
    3816             :         // Return value
    3817             :         Real64 CoilCapacity; // returned capacity of matched coil
    3818             : 
    3819             :         // FUNCTION LOCAL VARIABLE DECLARATIONS:
    3820             :         int WhichCoil;
    3821             : 
    3822             :         // Obtains and Allocates WatertoAirHP related parameters from input file
    3823         288 :         if (state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag) { // First time subroutine has been entered
    3824           0 :             GetSimpleWatertoAirHPInput(state);
    3825           0 :             state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag = false;
    3826             :         }
    3827             : 
    3828         709 :         if (UtilityRoutines::SameString(CoilType, "COIL:COOLING:WATERTOAIRHEATPUMP:EQUATIONFIT") ||
    3829         421 :             UtilityRoutines::SameString(CoilType, "COIL:HEATING:WATERTOAIRHEATPUMP:EQUATIONFIT")) {
    3830         288 :             WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP);
    3831         288 :             if (WhichCoil != 0) {
    3832         288 :                 if (UtilityRoutines::SameString(CoilType, "COIL:HEATING:WATERTOAIRHEATPUMP:EQUATIONFIT")) {
    3833         133 :                     CoilCapacity = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).RatedCapHeat;
    3834             :                 } else {
    3835         155 :                     CoilCapacity = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).RatedCapCoolTotal;
    3836             : 
    3837         155 :                     int companionHeatingCoil = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).CompanionHeatingCoilNum;
    3838         155 :                     if (companionHeatingCoil > 0) {
    3839         273 :                         if (CoilCapacity == DataSizing::AutoSize &&
    3840         118 :                             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(companionHeatingCoil).WAHPPlantType ==
    3841         118 :                                 DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit &&
    3842         391 :                             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(companionHeatingCoil).RatedCapHeat == DataSizing::AutoSize &&
    3843         118 :                             state.dataSize->DXCoolCap > 0) {
    3844             :                             // Heating coil has not yet been sized, returning the temporary cooling capacity
    3845          22 :                             CoilCapacity = state.dataSize->DXCoolCap;
    3846             :                         }
    3847             :                     }
    3848             :                 }
    3849             :             }
    3850             :         } else {
    3851           0 :             WhichCoil = 0;
    3852             :         }
    3853             : 
    3854         288 :         if (WhichCoil == 0) {
    3855           0 :             ShowSevereError(state, format("Could not find CoilType=\"{}\" with Name=\"{}\"", CoilType, CoilName));
    3856           0 :             ErrorsFound = true;
    3857           0 :             CoilCapacity = -1000.0;
    3858             :         }
    3859             : 
    3860         288 :         return CoilCapacity;
    3861             :     }
    3862             : 
    3863         222 :     Real64 GetCoilAirFlowRate(EnergyPlusData &state,
    3864             :                               std::string const &CoilType, // must match coil types in this module
    3865             :                               std::string const &CoilName, // must match coil names for the coil type
    3866             :                               bool &ErrorsFound            // set to true if problem
    3867             :     )
    3868             :     {
    3869             : 
    3870             :         // FUNCTION INFORMATION:
    3871             :         //       AUTHOR         Richard Raustad, FSEC
    3872             :         //       DATE WRITTEN   October 2011
    3873             : 
    3874             :         // PURPOSE OF THIS FUNCTION:
    3875             :         // This function looks up the coil air flow rate for the given coil and returns it.  If
    3876             :         // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned
    3877             :         // as negative.
    3878             : 
    3879             :         // Return value
    3880             :         Real64 CoilAirFlowRate; // returned air volume flow rate of matched coil
    3881             : 
    3882             :         // FUNCTION LOCAL VARIABLE DECLARATIONS:
    3883             :         int WhichCoil;
    3884             : 
    3885             :         // Obtains and Allocates WatertoAirHP related parameters from input file
    3886         222 :         if (state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag) { // First time subroutine has been entered
    3887           0 :             GetSimpleWatertoAirHPInput(state);
    3888           0 :             state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag = false;
    3889             :         }
    3890             : 
    3891         222 :         if (CoilType == "COIL:COOLING:WATERTOAIRHEATPUMP:EQUATIONFIT" || CoilType == "COIL:HEATING:WATERTOAIRHEATPUMP:EQUATIONFIT") {
    3892         222 :             WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP);
    3893         222 :             if (WhichCoil != 0) {
    3894         222 :                 CoilAirFlowRate = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).RatedAirVolFlowRate;
    3895             :             }
    3896             :         } else {
    3897           0 :             WhichCoil = 0;
    3898             :         }
    3899             : 
    3900         222 :         if (WhichCoil == 0) {
    3901           0 :             ShowSevereError(state, format("Could not find CoilType=\"{}\" with Name=\"{}\"", CoilType, CoilName));
    3902           0 :             ErrorsFound = true;
    3903           0 :             CoilAirFlowRate = -1000.0;
    3904             :         }
    3905             : 
    3906         222 :         return CoilAirFlowRate;
    3907             :     }
    3908             : 
    3909         222 :     int GetCoilInletNode(EnergyPlusData &state,
    3910             :                          std::string const &CoilType, // must match coil types in this module
    3911             :                          std::string const &CoilName, // must match coil names for the coil type
    3912             :                          bool &ErrorsFound            // set to true if problem
    3913             :     )
    3914             :     {
    3915             : 
    3916             :         // FUNCTION INFORMATION:
    3917             :         //       AUTHOR         Linda Lawrie
    3918             :         //       DATE WRITTEN   February 2006
    3919             : 
    3920             :         // PURPOSE OF THIS FUNCTION:
    3921             :         // This function looks up the given coil and returns the inlet node.  If
    3922             :         // incorrect coil type or name is given, ErrorsFound is returned as true and value is returned
    3923             :         // as zero.
    3924             : 
    3925             :         // Return value
    3926             :         int NodeNumber; // returned outlet node of matched coil
    3927             : 
    3928             :         // FUNCTION LOCAL VARIABLE DECLARATIONS:
    3929             :         int WhichCoil;
    3930             : 
    3931             :         // Obtains and Allocates WatertoAirHP related parameters from input file
    3932         222 :         if (state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag) { // First time subroutine has been entered
    3933           0 :             GetSimpleWatertoAirHPInput(state);
    3934           0 :             state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag = false;
    3935             :         }
    3936             : 
    3937         222 :         WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP);
    3938         222 :         if (WhichCoil != 0) {
    3939         222 :             NodeNumber = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).AirInletNodeNum;
    3940             :         }
    3941             : 
    3942         222 :         if (WhichCoil == 0) {
    3943           0 :             ShowSevereError(state, format("Could not find CoilType=\"{}\" with Name=\"{}\"", CoilType, CoilName));
    3944           0 :             ErrorsFound = true;
    3945           0 :             NodeNumber = 0;
    3946             :         }
    3947             : 
    3948         222 :         return NodeNumber;
    3949             :     }
    3950             : 
    3951         222 :     int GetCoilOutletNode(EnergyPlusData &state,
    3952             :                           std::string const &CoilType, // must match coil types in this module
    3953             :                           std::string const &CoilName, // must match coil names for the coil type
    3954             :                           bool &ErrorsFound            // set to true if problem
    3955             :     )
    3956             :     {
    3957             : 
    3958             :         // FUNCTION INFORMATION:
    3959             :         //       AUTHOR         R. Raustad
    3960             :         //       DATE WRITTEN   July 2007
    3961             : 
    3962             :         // PURPOSE OF THIS FUNCTION:
    3963             :         // This function looks up the given coil and returns the outlet node.  If
    3964             :         // incorrect coil type or name is given, ErrorsFound is returned as true and value is returned
    3965             :         // as zero.
    3966             : 
    3967             :         // Return value
    3968             :         int NodeNumber; // returned outlet node of matched coil
    3969             : 
    3970             :         // FUNCTION LOCAL VARIABLE DECLARATIONS:
    3971             :         int WhichCoil;
    3972             : 
    3973             :         // Obtains and Allocates WatertoAirHP related parameters from input file
    3974         222 :         if (state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag) { // First time subroutine has been entered
    3975           0 :             GetSimpleWatertoAirHPInput(state);
    3976           0 :             state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag = false;
    3977             :         }
    3978             : 
    3979         222 :         WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP);
    3980         222 :         if (WhichCoil != 0) {
    3981         222 :             NodeNumber = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).AirOutletNodeNum;
    3982             :         }
    3983             : 
    3984         222 :         if (WhichCoil == 0) {
    3985           0 :             ShowSevereError(state, format("Could not find CoilType=\"{}\" with Name=\"{}\"", CoilType, CoilName));
    3986           0 :             ErrorsFound = true;
    3987           0 :             NodeNumber = 0;
    3988             :         }
    3989             : 
    3990         222 :         return NodeNumber;
    3991             :     }
    3992             : 
    3993         133 :     void SetSimpleWSHPData(EnergyPlusData &state,
    3994             :                            int const SimpleWSHPNum,              // Number of OA Controller
    3995             :                            bool &ErrorsFound,                    // Set to true if certain errors found
    3996             :                            int const WaterCyclingMode,           // the coil water flow mode (cycling, constant or constantondemand)
    3997             :                            Optional_int CompanionCoolingCoilNum, // Index to cooling coil for heating coil = SimpleWSHPNum
    3998             :                            Optional_int CompanionHeatingCoilNum  // Index to heating coil for cooling coil = SimpleWSHPNum
    3999             :     )
    4000             :     {
    4001             : 
    4002             :         // SUBROUTINE INFORMATION:
    4003             :         //       AUTHOR         Richard Raustad
    4004             :         //       DATE WRITTEN   June 2009
    4005             : 
    4006             :         // PURPOSE OF THIS SUBROUTINE:
    4007             :         // This routine was designed to "push" information from a parent object to
    4008             :         // this WSHP coil object.
    4009             : 
    4010             :         // Obtains and Allocates WatertoAirHP related parameters from input file
    4011         133 :         if (state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag) { // First time subroutine has been entered
    4012           0 :             GetSimpleWatertoAirHPInput(state);
    4013           0 :             state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag = false;
    4014             :         }
    4015             : 
    4016         133 :         if (SimpleWSHPNum <= 0 || SimpleWSHPNum > state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs) {
    4017           0 :             ShowSevereError(state,
    4018           0 :                             format("SetSimpleWSHPData: called with WSHP Coil Number out of range={} should be >0 and <{}",
    4019             :                                    SimpleWSHPNum,
    4020           0 :                                    state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs));
    4021           0 :             ErrorsFound = true;
    4022           0 :             return;
    4023             :         }
    4024             : 
    4025         133 :         state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(SimpleWSHPNum).WaterCyclingMode = WaterCyclingMode;
    4026         133 :         if (present(CompanionCoolingCoilNum)) {
    4027           0 :             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(SimpleWSHPNum).CompanionCoolingCoilNum = CompanionCoolingCoilNum;
    4028           0 :             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(CompanionCoolingCoilNum).CompanionHeatingCoilNum = SimpleWSHPNum;
    4029           0 :             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(CompanionCoolingCoilNum).WaterCyclingMode = WaterCyclingMode;
    4030             :         }
    4031             : 
    4032         133 :         if (present(CompanionHeatingCoilNum)) {
    4033         133 :             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(SimpleWSHPNum).CompanionHeatingCoilNum = CompanionHeatingCoilNum;
    4034         133 :             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(CompanionHeatingCoilNum).CompanionCoolingCoilNum = SimpleWSHPNum;
    4035         133 :             state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(CompanionHeatingCoilNum).WaterCyclingMode = WaterCyclingMode;
    4036             :         }
    4037             :     }
    4038             : 
    4039         266 :     void CheckSimpleWAHPRatedCurvesOutputs(EnergyPlusData &state, std::string const &CoilName)
    4040             :     {
    4041             :         int WhichCoil;
    4042         266 :         constexpr Real64 Tref(283.15); // Refrence Temperature for performance curves,10C [K]
    4043             :         static constexpr std::string_view RoutineName("CheckSimpleWAHPRatedCurvesOutputs");
    4044             : 
    4045         266 :         WhichCoil = UtilityRoutines::FindItemInList(CoilName, state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP);
    4046             : 
    4047         266 :         if (WhichCoil != 0) {
    4048         266 :             if (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).WAHPType == WatertoAirHP::Cooling) {
    4049         133 :                 int TotalCoolCapCurveIndex = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).TotalCoolCapCurveIndex;
    4050         133 :                 int CoolPowCurveIndex = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).CoolPowCurveIndex;
    4051         133 :                 int SensCoolCapCurveIndex = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).SensCoolCapCurveIndex;
    4052         133 :                 if (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).RatedEntAirWetbulbTemp != DataSizing::AutoSize) {
    4053         266 :                     Real64 RatedratioTWB = (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).RatedEntAirWetbulbTemp +
    4054         266 :                                             state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) /
    4055         133 :                                            Tref;
    4056         266 :                     Real64 RatedratioTS = (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).RatedEntWaterTemp +
    4057         266 :                                            state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) /
    4058         133 :                                           Tref;
    4059         133 :                     Real64 RatedTotCapTempModFac = Curve::CurveValue(state, TotalCoolCapCurveIndex, RatedratioTWB, RatedratioTS, 1.0, 1.0);
    4060         133 :                     Real64 RatedCoolPowerTempModFac = Curve::CurveValue(state, CoolPowCurveIndex, RatedratioTWB, RatedratioTS, 1.0, 1.0);
    4061         133 :                     if (RatedTotCapTempModFac > 1.02 || RatedTotCapTempModFac < 0.98) {
    4062           0 :                         ShowWarningError(state,
    4063           0 :                                          format("{}: Coil:Cooling:WaterToAirHeatPump:EquationFit=\"{}\"",
    4064           0 :                                                 std::string{RoutineName},
    4065           0 :                                                 state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).Name));
    4066           0 :                         ShowContinueError(state,
    4067             :                                           "Total cooling capacity as a function of temperature curve output is not equal to 1.0 (+ or - 2%) at "
    4068             :                                           "rated conditions.");
    4069           0 :                         ShowContinueError(state, format("Curve output at rated conditions = {:.3T}", RatedTotCapTempModFac));
    4070             :                     }
    4071         133 :                     if (RatedCoolPowerTempModFac > 1.02 || RatedCoolPowerTempModFac < 0.98) {
    4072           0 :                         ShowWarningError(state,
    4073           0 :                                          format("{}: Coil:Cooling:WaterToAirHeatPump:EquationFit=\"{}\"",
    4074           0 :                                                 std::string{RoutineName},
    4075           0 :                                                 state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).Name));
    4076           0 :                         ShowContinueError(state,
    4077             :                                           "Cooling power consumption as a function of temperature curve output is not equal to 1.0 (+ or - 2%) at "
    4078             :                                           "rated conditions.");
    4079           0 :                         ShowContinueError(state, format("Curve output at rated conditions = {:.3T}", RatedCoolPowerTempModFac));
    4080             :                     }
    4081         133 :                     if (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).RatedEntAirDrybulbTemp != DataSizing::AutoSize) {
    4082         266 :                         Real64 RatedratioTDB = (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).RatedEntAirDrybulbTemp +
    4083         133 :                                                 state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) /
    4084         133 :                                                Tref;
    4085             :                         Real64 RatedSensCapTempModFac =
    4086         133 :                             Curve::CurveValue(state, SensCoolCapCurveIndex, RatedratioTDB, RatedratioTWB, RatedratioTS, 1.0, 1.0);
    4087         133 :                         if (RatedSensCapTempModFac > 1.02 || RatedSensCapTempModFac < 0.98) {
    4088           0 :                             ShowWarningError(state,
    4089           0 :                                              format("{}: Coil:Cooling:WaterToAirHeatPump:EquationFit=\"{}\"",
    4090           0 :                                                     std::string{RoutineName},
    4091           0 :                                                     state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).Name));
    4092           0 :                             ShowContinueError(
    4093             :                                 state,
    4094             :                                 "Sensible cooling capacity as a function of temperature curve output is not equal to 1.0 (+ or - 2%) at "
    4095             :                                 "rated conditions.");
    4096           0 :                             ShowContinueError(state, format("Curve output at rated conditions = {:.3T}", RatedSensCapTempModFac));
    4097             :                         }
    4098             :                     }
    4099             :                 }
    4100         133 :             } else if (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).WAHPType == WatertoAirHP::Heating) {
    4101         133 :                 if (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).RatedEntAirDrybulbTemp != DataSizing::AutoSize) {
    4102         133 :                     int HeatCapCurveIndex = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).HeatCapCurveIndex;
    4103         133 :                     int HeatPowCurveIndex = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).HeatPowCurveIndex;
    4104         266 :                     Real64 RatedHeatratioTDB = (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).RatedEntAirDrybulbTemp +
    4105         133 :                                                 state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) /
    4106         133 :                                                Tref;
    4107         266 :                     Real64 RatedHeatratioTS = (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).RatedEntWaterTemp +
    4108         266 :                                                state.dataWaterToAirHeatPumpSimple->CelsiustoKelvin) /
    4109         133 :                                               Tref;
    4110         133 :                     Real64 RatedHeatCapTempModFac = Curve::CurveValue(state, HeatCapCurveIndex, RatedHeatratioTDB, RatedHeatratioTS, 1.0, 1.0);
    4111         133 :                     Real64 RatedHeatPowerTempModFac = Curve::CurveValue(state, HeatPowCurveIndex, RatedHeatratioTDB, RatedHeatratioTS, 1.0, 1.0);
    4112         133 :                     if (RatedHeatCapTempModFac > 1.02 || RatedHeatCapTempModFac < 0.98) {
    4113           0 :                         ShowWarningError(state,
    4114           0 :                                          format("{}: Coil:Heating:WaterToAirHeatPump:EquationFit=\"{}\"",
    4115           0 :                                                 std::string{RoutineName},
    4116           0 :                                                 state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).Name));
    4117           0 :                         ShowContinueError(state,
    4118             :                                           "Heating capacity as a function of temperature curve output is not equal to 1.0 (+ or - 2%) at "
    4119             :                                           "rated conditions.");
    4120           0 :                         ShowContinueError(state, format("Curve output at rated conditions = {:.3T}", RatedHeatCapTempModFac));
    4121             :                     }
    4122         133 :                     if (RatedHeatPowerTempModFac > 1.02 || RatedHeatPowerTempModFac < 0.98) {
    4123           0 :                         ShowWarningError(state,
    4124           0 :                                          format("{}: Coil:Heating:WaterToAirHeatPump:EquationFit=\"{}\"",
    4125           0 :                                                 std::string{RoutineName},
    4126           0 :                                                 state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(WhichCoil).Name));
    4127           0 :                         ShowContinueError(state,
    4128             :                                           "Heating power consumption as a function of temperature curve output is not equal to 1.0 (+ or - 2%) at "
    4129             :                                           "rated conditions.");
    4130           0 :                         ShowContinueError(state, format("Curve output at rated conditions = {:.3T}", RatedHeatPowerTempModFac));
    4131             :                     }
    4132             :                 }
    4133             :             }
    4134             :         }
    4135         266 :     }
    4136             : } // namespace WaterToAirHeatPumpSimple
    4137             : 
    4138        2313 : } // namespace EnergyPlus

Generated by: LCOV version 1.13