LCOV - code coverage report
Current view: top level - EnergyPlus - HVACHXAssistedCoolingCoil.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 54.4 % 759 413
Test Date: 2025-06-02 07:23:51 Functions: 65.0 % 20 13

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois,
       2              : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3              : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4              : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5              : // contributors. All rights reserved.
       6              : //
       7              : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8              : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9              : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10              : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11              : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12              : //
      13              : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14              : // provided that the following conditions are met:
      15              : //
      16              : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17              : //     conditions and the following disclaimer.
      18              : //
      19              : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20              : //     conditions and the following disclaimer in the documentation and/or other materials
      21              : //     provided with the distribution.
      22              : //
      23              : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24              : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25              : //     used to endorse or promote products derived from this software without specific prior
      26              : //     written permission.
      27              : //
      28              : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29              : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30              : //     reference solely to the software portion of its product, Licensee must refer to the
      31              : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32              : //     obtained under this License and may not use a different name for the software. Except as
      33              : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34              : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35              : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36              : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37              : //
      38              : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39              : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40              : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41              : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42              : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43              : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44              : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45              : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46              : // POSSIBILITY OF SUCH DAMAGE.
      47              : 
      48              : // C++ Headers
      49              : #include <cmath>
      50              : 
      51              : // ObjexxFCL Headers
      52              : #include <ObjexxFCL/Fmath.hh>
      53              : 
      54              : // EnergyPlus Headers
      55              : #include <EnergyPlus/BranchNodeConnections.hh>
      56              : #include <EnergyPlus/Coils/CoilCoolingDX.hh>
      57              : #include <EnergyPlus/DXCoils.hh>
      58              : #include <EnergyPlus/Data/EnergyPlusData.hh>
      59              : #include <EnergyPlus/DataHVACGlobals.hh>
      60              : #include <EnergyPlus/DataHeatBalance.hh>
      61              : #include <EnergyPlus/DataLoopNode.hh>
      62              : #include <EnergyPlus/GlobalNames.hh>
      63              : #include <EnergyPlus/HVACControllers.hh>
      64              : #include <EnergyPlus/HVACHXAssistedCoolingCoil.hh>
      65              : #include <EnergyPlus/HeatRecovery.hh>
      66              : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      67              : #include <EnergyPlus/NodeInputManager.hh>
      68              : #include <EnergyPlus/UtilityRoutines.hh>
      69              : #include <EnergyPlus/VariableSpeedCoils.hh>
      70              : #include <EnergyPlus/WaterCoils.hh>
      71              : 
      72              : namespace EnergyPlus {
      73              : 
      74              : namespace HVACHXAssistedCoolingCoil {
      75              :     // Module containing the simulation routines for a heat exchanger-
      76              :     // assisted cooling coil
      77              : 
      78              :     // MODULE INFORMATION:
      79              :     //       AUTHOR         Richard Raustad, FSEC
      80              :     //       DATE WRITTEN   Sept 2003
      81              : 
      82              :     // PURPOSE OF THIS MODULE:
      83              :     //  To encapsulate the data and algorithms required to
      84              :     //  manage the heat exchanger-assisted cooling coil compound component
      85              : 
      86              :     // METHODOLOGY EMPLOYED:
      87              :     //  Call the air-to-air heat exchanger and cooling coil repeatedly to converge
      88              :     //  on the solution instead of relying on the air loop manager for iterations
      89              : 
      90              :     // REFERENCES:
      91              :     // Kosar, D. 2006. Dehumidification Enhancements, ASHRAE Journal, Vol. 48, No. 2, February 2006.
      92              :     // Kosar, D. et al. 2006. Dehumidification Enhancement of Direct Expansion Systems Through Component
      93              :     //   Augmentation of the Cooling Coil. 15th Symposium on Improving Building Systems in Hot and Humid
      94              :     //   Climates, July 24-26, 2006.
      95              : 
      96       408362 :     void SimHXAssistedCoolingCoil(EnergyPlusData &state,
      97              :                                   std::string_view HXAssistedCoilName,   // Name of HXAssistedCoolingCoil
      98              :                                   bool const FirstHVACIteration,         // FirstHVACIteration flag
      99              :                                   HVAC::CompressorOp const compressorOp, // compressor operation; 1=on, 0=off
     100              :                                   Real64 const PartLoadRatio,            // Part load ratio of Coil:DX:CoolingBypassFactorEmpirical
     101              :                                   int &CompIndex,
     102              :                                   HVAC::FanOp const fanOp,                     // Allows the parent object to control fan operation
     103              :                                   ObjexxFCL::Optional_bool_const HXUnitEnable, // flag to enable heat exchanger heat recovery
     104              :                                   ObjexxFCL::Optional<Real64 const> OnOffAFR,  // Ratio of compressor ON air mass flow rate to AVERAGE over time step
     105              :                                   ObjexxFCL::Optional_bool_const EconomizerFlag,                  // OA sys or air loop economizer status
     106              :                                   ObjexxFCL::Optional<Real64> QTotOut,                            // the total cooling output of unit
     107              :                                   ObjexxFCL::Optional<HVAC::CoilMode const> DehumidificationMode, // Optional dehumbidication mode
     108              :                                   ObjexxFCL::Optional<Real64 const> LoadSHR                       // Optional CoilSHR pass over
     109              :     )
     110              :     {
     111              : 
     112              :         // SUBROUTINE INFORMATION:
     113              :         //       AUTHOR         Richard Raustad, FSEC
     114              :         //       DATE WRITTEN   Sept 2003
     115              : 
     116              :         // PURPOSE OF THIS SUBROUTINE:
     117              :         //  This subroutine manages the simulation of the
     118              :         //  cooling coil/heat exchanger combination.
     119              : 
     120              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     121              :         int HXAssistedCoilNum; // Index for HXAssistedCoolingCoil
     122              :         Real64 AirFlowRatio;   // Ratio of compressor ON air mass flow rate to AVEARAGE over time step
     123              :         bool HXUnitOn;         // flag to enable heat exchanger
     124              : 
     125              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
     126       408362 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
     127              :             // Get the HXAssistedCoolingCoil input
     128            0 :             GetHXAssistedCoolingCoilInput(state);
     129            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
     130              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
     131              :         }
     132              : 
     133              :         // Find the correct HXAssistedCoolingCoil number
     134       408362 :         if (CompIndex == 0) {
     135            5 :             HXAssistedCoilNum = Util::FindItemInList(HXAssistedCoilName, state.dataHVACAssistedCC->HXAssistedCoil);
     136            5 :             if (HXAssistedCoilNum == 0) {
     137            0 :                 ShowFatalError(state, format("HX Assisted Coil not found={}", HXAssistedCoilName));
     138              :             }
     139            5 :             CompIndex = HXAssistedCoilNum;
     140              :         } else {
     141       408357 :             HXAssistedCoilNum = CompIndex;
     142       408357 :             if (HXAssistedCoilNum > state.dataHVACAssistedCC->TotalNumHXAssistedCoils || HXAssistedCoilNum < 1) {
     143            0 :                 ShowFatalError(state,
     144            0 :                                format("SimHXAssistedCoolingCoil: Invalid CompIndex passed={}, Number of HX Assisted Cooling Coils={}, Coil name={}",
     145              :                                       HXAssistedCoilNum,
     146            0 :                                       state.dataHVACAssistedCC->TotalNumHXAssistedCoils,
     147              :                                       HXAssistedCoilName));
     148              :             }
     149       408357 :             if (state.dataHVACAssistedCC->CheckEquipName(HXAssistedCoilNum)) {
     150           11 :                 if (!HXAssistedCoilName.empty() && HXAssistedCoilName != state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name) {
     151            0 :                     ShowFatalError(state,
     152            0 :                                    format("SimHXAssistedCoolingCoil: Invalid CompIndex passed={}, Coil name={}, stored Coil Name for that index={}",
     153              :                                           HXAssistedCoilNum,
     154              :                                           HXAssistedCoilName,
     155            0 :                                           state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name));
     156              :                 }
     157           11 :                 state.dataHVACAssistedCC->CheckEquipName(HXAssistedCoilNum) = false;
     158              :             }
     159              :         }
     160              : 
     161              :         // Initialize HXAssistedCoolingCoil Flows
     162       408362 :         InitHXAssistedCoolingCoil(state, HXAssistedCoilNum);
     163              : 
     164       408362 :         if (present(HXUnitEnable)) {
     165       280973 :             HXUnitOn = HXUnitEnable;
     166              :         } else {
     167       127389 :             HXUnitOn = true;
     168              :         }
     169              : 
     170       408362 :         if (compressorOp == HVAC::CompressorOp::Off) {
     171        41138 :             HXUnitOn = false;
     172              :         }
     173              : 
     174              :         // Calculate the HXAssistedCoolingCoil performance and the coil outlet conditions
     175       408362 :         if (present(OnOffAFR)) {
     176       257737 :             AirFlowRatio = OnOffAFR;
     177              :         } else {
     178       150625 :             AirFlowRatio = 1.0;
     179              :         }
     180       461641 :         if (present(DehumidificationMode) && present(LoadSHR) &&
     181        53279 :             state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).CoolingCoilType_Num == HVAC::CoilDX_Cooling) {
     182            0 :             CalcHXAssistedCoolingCoil(state,
     183              :                                       HXAssistedCoilNum,
     184              :                                       FirstHVACIteration,
     185              :                                       compressorOp,
     186              :                                       PartLoadRatio,
     187              :                                       HXUnitOn,
     188              :                                       fanOp,
     189              :                                       AirFlowRatio,
     190              :                                       EconomizerFlag,
     191              :                                       DehumidificationMode,
     192              :                                       LoadSHR);
     193              :         } else {
     194       408362 :             CalcHXAssistedCoolingCoil(
     195              :                 state, HXAssistedCoilNum, FirstHVACIteration, compressorOp, PartLoadRatio, HXUnitOn, fanOp, AirFlowRatio, EconomizerFlag);
     196              :         }
     197              : 
     198              :         // Update the current HXAssistedCoil output
     199              :         //  Call UpdateHXAssistedCoolingCoil(HXAssistedCoilNum), not required. Updates done by the HX and cooling coil components.
     200              : 
     201              :         // Report the current HXAssistedCoil output
     202              :         //  Call ReportHXAssistedCoolingCoil(HXAssistedCoilNum), not required. No reporting variables for this compound component.
     203              : 
     204       408362 :         if (present(QTotOut)) {
     205       127389 :             int InletNodeNum = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).HXAssistedCoilInletNodeNum;
     206       127389 :             int OutletNodeNum = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).HXAssistedCoilOutletNodeNum;
     207       127389 :             Real64 AirMassFlow = state.dataLoopNodes->Node(OutletNodeNum).MassFlowRate;
     208       127389 :             QTotOut = AirMassFlow * (state.dataLoopNodes->Node(InletNodeNum).Enthalpy - state.dataLoopNodes->Node(OutletNodeNum).Enthalpy);
     209              :         }
     210       408362 :     }
     211              : 
     212              :     // Get Input Section of the Module
     213              :     //******************************************************************************
     214              : 
     215           11 :     void GetHXAssistedCoolingCoilInput(EnergyPlusData &state)
     216              :     {
     217              : 
     218              :         // SUBROUTINE INFORMATION:
     219              :         //       AUTHOR         Richard Raustad, FSEC
     220              :         //       DATE WRITTEN   Sept 2003
     221              : 
     222              :         // PURPOSE OF THIS SUBROUTINE:
     223              :         //  Obtains input data for this compount object and stores it in data structure
     224              : 
     225              :         // METHODOLOGY EMPLOYED:
     226              :         //  Uses "Get" routines to read in data.
     227              : 
     228              :         // SUBROUTINE PARAMETER DEFINITIONS:
     229              :         static constexpr std::string_view RoutineName("GetHXAssistedCoolingCoilInput: "); // include trailing blank space
     230              :         static constexpr std::string_view routineName = "GetHXAssistedCoolingCoilInput";
     231              : 
     232              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     233              :         int HXAssistedCoilNum;            // Index number of the HXAssistedCoolingCoil for which input data is being read from the idf
     234              :         int NumAlphas;                    // Number of alpha inputs
     235              :         int NumNums;                      // Number of number inputs
     236              :         int IOStat;                       // Return status from GetObjectItem call
     237           11 :         bool ErrorsFound(false);          // set TRUE if errors detected in input
     238              :         bool HXErrFlag;                   // Error flag for HX node numbers mining call
     239              :         bool CoolingCoilErrFlag;          // Error flag for cooling coil node numbers mining call
     240              :         int SupplyAirInletNode;           // supply air inlet node number mined from heat exchanger object (ExchCond structure)
     241              :         int SupplyAirOutletNode;          // supply air outlet node number mined from heat exchanger object (ExchCond structure)
     242              :         int SecondaryAirInletNode;        // secondary air inlet node number mined from heat exchanger object (ExchCond structure)
     243              :         int SecondaryAirOutletNode;       // secondary air outlet node number mined from heat exchanger object (ExchCond structure)
     244              :         int CoolingCoilInletNodeNum;      // air outlet node number of cooling coil, used for warning messages
     245              :         int CoolingCoilWaterInletNodeNum; // water coil water inlet node number used to find controller index
     246              :         int CoolingCoilOutletNodeNum;     // air outlet node number of cooling coil, used for warning messages
     247           11 :         std::string CurrentModuleObject;  // Object type for getting and error messages
     248           11 :         Array1D_string AlphArray;         // Alpha input items for object
     249           11 :         Array1D_string cAlphaFields;      // Alpha field names
     250           11 :         Array1D_string cNumericFields;    // Numeric field names
     251           11 :         Array1D<Real64> NumArray;         // Numeric input items for object
     252           11 :         Array1D_bool lAlphaBlanks;        // Logical array, alpha field input BLANK = .TRUE.
     253           11 :         Array1D_bool lNumericBlanks;      // Logical array, numeric field input BLANK = .TRUE.
     254           11 :         int TotalArgs(0);                 // Total number of alpha and numeric arguments (max) for a
     255              : 
     256              :         int NumHXAssistedDXCoils =
     257           11 :             state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "CoilSystem:Cooling:DX:HeatExchangerAssisted");
     258              :         int NumHXAssistedWaterCoils =
     259           11 :             state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "CoilSystem:Cooling:Water:HeatExchangerAssisted");
     260           11 :         state.dataHVACAssistedCC->TotalNumHXAssistedCoils = NumHXAssistedDXCoils + NumHXAssistedWaterCoils;
     261           11 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
     262           11 :             state.dataHVACAssistedCC->HXAssistedCoil.allocate(state.dataHVACAssistedCC->TotalNumHXAssistedCoils);
     263           11 :             state.dataHVACAssistedCC->HXAssistedCoilOutletTemp.allocate(state.dataHVACAssistedCC->TotalNumHXAssistedCoils);
     264           11 :             state.dataHVACAssistedCC->HXAssistedCoilOutletHumRat.allocate(state.dataHVACAssistedCC->TotalNumHXAssistedCoils);
     265           11 :             state.dataHVACAssistedCC->CheckEquipName.dimension(state.dataHVACAssistedCC->TotalNumHXAssistedCoils, true);
     266           11 :             state.dataHVACAssistedCC->UniqueHXAssistedCoilNames.reserve(state.dataHVACAssistedCC->TotalNumHXAssistedCoils);
     267              :         }
     268              : 
     269           11 :         state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     270              :             state, "CoilSystem:Cooling:DX:HeatExchangerAssisted", TotalArgs, NumAlphas, NumNums);
     271           11 :         int MaxNums = NumNums;
     272           11 :         int MaxAlphas = NumAlphas;
     273           11 :         state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     274              :             state, "CoilSystem:Cooling:Water:HeatExchangerAssisted", TotalArgs, NumAlphas, NumNums);
     275           11 :         MaxNums = max(MaxNums, NumNums);
     276           11 :         MaxAlphas = max(MaxAlphas, NumAlphas);
     277              : 
     278           11 :         AlphArray.allocate(MaxAlphas);
     279           11 :         cAlphaFields.allocate(MaxAlphas);
     280           11 :         cNumericFields.allocate(MaxNums);
     281           11 :         NumArray.dimension(MaxNums, 0.0);
     282           11 :         lAlphaBlanks.dimension(MaxAlphas, true);
     283           11 :         lNumericBlanks.dimension(MaxNums, true);
     284              : 
     285              :         // Get the data for the Coil:DX:CoolingHeatExchangerAssisted objects
     286           11 :         CurrentModuleObject = "CoilSystem:Cooling:DX:HeatExchangerAssisted";
     287              : 
     288           17 :         for (HXAssistedCoilNum = 1; HXAssistedCoilNum <= NumHXAssistedDXCoils; ++HXAssistedCoilNum) {
     289            6 :             auto &thisHXCoil = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum);
     290            6 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     291              :                                                                      CurrentModuleObject,
     292              :                                                                      HXAssistedCoilNum,
     293              :                                                                      AlphArray,
     294              :                                                                      NumAlphas,
     295              :                                                                      NumArray,
     296              :                                                                      NumNums,
     297              :                                                                      IOStat,
     298              :                                                                      lNumericBlanks,
     299              :                                                                      lAlphaBlanks,
     300              :                                                                      cAlphaFields,
     301              :                                                                      cNumericFields);
     302            6 :             GlobalNames::VerifyUniqueInterObjectName(
     303            6 :                 state, state.dataHVACAssistedCC->UniqueHXAssistedCoilNames, AlphArray(1), CurrentModuleObject, ErrorsFound);
     304              : 
     305            6 :             thisHXCoil.Name = AlphArray(1);
     306            6 :             thisHXCoil.hxType = static_cast<HVAC::HXType>(getEnumValue(HVAC::hxTypeNamesUC, AlphArray(2)));
     307            6 :             thisHXCoil.HeatExchangerName = AlphArray(3);
     308              : 
     309            6 :             thisHXCoil.CoolingCoilType = AlphArray(4);
     310            6 :             thisHXCoil.CoolingCoilName = AlphArray(5);
     311              : 
     312            6 :             if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX")) {
     313            1 :                 thisHXCoil.CoolingCoilType_Num = HVAC::CoilDX_Cooling;
     314            1 :                 thisHXCoil.HXAssistedCoilType = CurrentModuleObject;
     315            1 :                 thisHXCoil.HXAssistedCoilType_Num = HVAC::CoilDX_CoolingHXAssisted;
     316              : 
     317            1 :                 CoolingCoilErrFlag = false;
     318            1 :                 int coolingCoilIndex_temp = CoilCoolingDX::factory(state, thisHXCoil.CoolingCoilName);
     319            1 :                 thisHXCoil.CoolingCoilIndex = coolingCoilIndex_temp;
     320            1 :                 if (coolingCoilIndex_temp < 0) {
     321            0 :                     ShowContinueError(state, format("Occurs in {} = {}", CurrentModuleObject, AlphArray(5)));
     322            0 :                     CoolingCoilErrFlag = true;
     323            0 :                     ErrorsFound = true;
     324              :                 }
     325              : 
     326            1 :                 thisHXCoil.DXCoilNumOfSpeeds = state.dataCoilCoolingDX->coilCoolingDXs[coolingCoilIndex_temp].performance.normalMode.speeds.size();
     327            1 :                 if (thisHXCoil.DXCoilNumOfSpeeds < 1) {
     328            0 :                     CoolingCoilErrFlag = true;
     329              :                 }
     330            1 :                 if (CoolingCoilErrFlag) {
     331            0 :                     ShowContinueError(state, format("...occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     332            0 :                     ErrorsFound = true;
     333              :                 }
     334            5 :             } else if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX:SingleSpeed")) {
     335            4 :                 thisHXCoil.CoolingCoilType_Num = HVAC::CoilDX_CoolingSingleSpeed;
     336            4 :                 thisHXCoil.HXAssistedCoilType = CurrentModuleObject;
     337            4 :                 thisHXCoil.HXAssistedCoilType_Num = HVAC::CoilDX_CoolingHXAssisted;
     338            4 :                 CoolingCoilErrFlag = false;
     339            4 :                 DXCoils::GetDXCoilIndex(
     340            4 :                     state, thisHXCoil.CoolingCoilName, thisHXCoil.CoolingCoilIndex, CoolingCoilErrFlag, thisHXCoil.CoolingCoilType);
     341            4 :                 if (CoolingCoilErrFlag) {
     342            0 :                     ShowContinueError(state, format("...occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     343            0 :                     ErrorsFound = true;
     344              :                 }
     345            1 :             } else if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX:VariableSpeed")) {
     346            1 :                 thisHXCoil.CoolingCoilType_Num = HVAC::Coil_CoolingAirToAirVariableSpeed;
     347            1 :                 thisHXCoil.HXAssistedCoilType = CurrentModuleObject;
     348            1 :                 thisHXCoil.HXAssistedCoilType_Num = HVAC::CoilDX_CoolingHXAssisted;
     349            1 :                 CoolingCoilErrFlag = false;
     350            1 :                 thisHXCoil.CoolingCoilIndex = VariableSpeedCoils::GetCoilIndexVariableSpeed(state, AlphArray(4), AlphArray(5), CoolingCoilErrFlag);
     351              : 
     352            1 :                 if (CoolingCoilErrFlag) {
     353            0 :                     ShowContinueError(state, format("...occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     354            0 :                     ErrorsFound = true;
     355              :                 }
     356            1 :                 thisHXCoil.DXCoilNumOfSpeeds = VariableSpeedCoils::GetVSCoilNumOfSpeeds(state, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag);
     357            1 :                 if (CoolingCoilErrFlag) {
     358            0 :                     ShowContinueError(state, format("...occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     359            0 :                     ErrorsFound = true;
     360              :                 }
     361              :             } else {
     362            0 :                 ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name));
     363            0 :                 ShowContinueError(state, format("Invalid {}=\"{}\"", cAlphaFields(4), thisHXCoil.CoolingCoilType));
     364            0 :                 ErrorsFound = true;
     365              :             }
     366              : 
     367            6 :             HXErrFlag = false;
     368            6 :             SupplyAirInletNode = HeatRecovery::GetSupplyInletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag);
     369            6 :             if (HXErrFlag) {
     370            0 :                 ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     371              :             }
     372              : 
     373            6 :             HXErrFlag = false;
     374            6 :             SupplyAirOutletNode = HeatRecovery::GetSupplyOutletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag);
     375            6 :             if (HXErrFlag) {
     376            0 :                 ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     377              :             }
     378              : 
     379            6 :             HXErrFlag = false;
     380            6 :             SecondaryAirInletNode = HeatRecovery::GetSecondaryInletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag);
     381            6 :             if (HXErrFlag) {
     382            0 :                 ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     383              :             }
     384              : 
     385            6 :             HXErrFlag = false;
     386            6 :             SecondaryAirOutletNode = HeatRecovery::GetSecondaryOutletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag);
     387            6 :             if (HXErrFlag) {
     388            0 :                 ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     389              :             }
     390              : 
     391            6 :             if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX")) {
     392            1 :                 CoolingCoilInletNodeNum = state.dataCoilCoolingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].evapInletNodeIndex;
     393            1 :                 if (SupplyAirOutletNode != CoolingCoilInletNodeNum) {
     394            0 :                     ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name));
     395            0 :                     ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object.");
     396            0 :                     ShowContinueError(state,
     397            0 :                                       format("The supply air outlet node name in heat exchanger {}=\"{}\"",
     398            0 :                                              HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     399            0 :                                              thisHXCoil.HeatExchangerName));
     400            0 :                     ShowContinueError(
     401              :                         state,
     402            0 :                         format("must match the cooling coil inlet node name in {}=\"{}\"", thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName));
     403            0 :                     ShowContinueError(state,
     404            0 :                                       format("Heat exchanger supply air outlet node name=\"{}\"", state.dataLoopNodes->NodeID(SupplyAirOutletNode)));
     405            0 :                     ShowContinueError(state, format("Cooling coil air inlet node name=\"{}\"", state.dataLoopNodes->NodeID(CoolingCoilInletNodeNum)));
     406            0 :                     ErrorsFound = true;
     407              :                 }
     408              : 
     409            1 :                 CoolingCoilOutletNodeNum = state.dataCoilCoolingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].evapOutletNodeIndex;
     410            1 :                 if (SecondaryAirInletNode != CoolingCoilOutletNodeNum) {
     411            0 :                     ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name));
     412            0 :                     ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object.");
     413            0 :                     ShowContinueError(state,
     414            0 :                                       format("The secondary air inlet node name in heat exchanger {}=\"{}\"",
     415            0 :                                              HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     416            0 :                                              thisHXCoil.HeatExchangerName));
     417            0 :                     ShowContinueError(state,
     418            0 :                                       format("must match the cooling coil air outlet node name in {}=\"{}\"",
     419            0 :                                              thisHXCoil.CoolingCoilType,
     420            0 :                                              thisHXCoil.CoolingCoilName));
     421            0 :                     ShowContinueError(
     422            0 :                         state, format("Heat exchanger secondary air inlet node name =\"{}\".", state.dataLoopNodes->NodeID(SecondaryAirInletNode)));
     423            0 :                     ShowContinueError(state,
     424            0 :                                       format("Cooling coil air outlet node name =\"{}\".", state.dataLoopNodes->NodeID(CoolingCoilOutletNodeNum)));
     425            0 :                     ErrorsFound = true;
     426              :                 }
     427              : 
     428            5 :             } else if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX:SingleSpeed")) {
     429              :                 //         Check node names in heat exchanger and coil objects for consistency
     430            4 :                 CoolingCoilErrFlag = false;
     431              :                 CoolingCoilInletNodeNum =
     432            4 :                     DXCoils::GetCoilInletNode(state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag);
     433            4 :                 if (CoolingCoilErrFlag) {
     434            0 :                     ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     435              :                 }
     436            4 :                 if (SupplyAirOutletNode != CoolingCoilInletNodeNum) {
     437            0 :                     ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name));
     438            0 :                     ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object.");
     439            0 :                     ShowContinueError(state,
     440            0 :                                       format("The supply air outlet node name in heat exchanger = {}=\"{}\"",
     441            0 :                                              HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     442            0 :                                              thisHXCoil.HeatExchangerName));
     443            0 :                     ShowContinueError(
     444              :                         state,
     445            0 :                         format("must match the cooling coil inlet node name in = {}=\"{}\"", thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName));
     446            0 :                     ShowContinueError(state,
     447            0 :                                       format("Heat exchanger supply air outlet node name=\"{}\"", state.dataLoopNodes->NodeID(SupplyAirOutletNode)));
     448            0 :                     ShowContinueError(state, format("Cooling coil air inlet node name=\"{}\"", state.dataLoopNodes->NodeID(CoolingCoilInletNodeNum)));
     449            0 :                     ErrorsFound = true;
     450              :                 }
     451            4 :                 CoolingCoilErrFlag = false;
     452              :                 CoolingCoilOutletNodeNum =
     453            4 :                     DXCoils::GetCoilOutletNode(state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag);
     454            4 :                 if (CoolingCoilErrFlag) {
     455            0 :                     ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     456              :                 }
     457            4 :                 if (SecondaryAirInletNode != CoolingCoilOutletNodeNum) {
     458            0 :                     ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name));
     459            0 :                     ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object.");
     460            0 :                     ShowContinueError(state,
     461            0 :                                       format("The secondary air inlet node name in heat exchanger ={}=\"{}\"",
     462            0 :                                              HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     463            0 :                                              thisHXCoil.HeatExchangerName));
     464            0 :                     ShowContinueError(state,
     465            0 :                                       format("must match the cooling coil air outlet node name in = {}=\"{}\".",
     466            0 :                                              thisHXCoil.CoolingCoilType,
     467            0 :                                              thisHXCoil.CoolingCoilName));
     468            0 :                     ShowContinueError(
     469            0 :                         state, format("Heat exchanger secondary air inlet node name =\"{}\".", state.dataLoopNodes->NodeID(SecondaryAirInletNode)));
     470            0 :                     ShowContinueError(state,
     471            0 :                                       format("Cooling coil air outlet node name =\"{}\".", state.dataLoopNodes->NodeID(CoolingCoilOutletNodeNum)));
     472            0 :                     ErrorsFound = true;
     473              :                 }
     474              : 
     475            1 :             } else if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX:VariableSpeed")) {
     476              :                 //         Check node names in heat exchanger and coil objects for consistency
     477            1 :                 CoolingCoilErrFlag = false;
     478            2 :                 CoolingCoilInletNodeNum = VariableSpeedCoils::GetCoilInletNodeVariableSpeed(
     479            1 :                     state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag);
     480            1 :                 if (CoolingCoilErrFlag) {
     481            0 :                     ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     482              :                 }
     483            1 :                 if (SupplyAirOutletNode != CoolingCoilInletNodeNum) {
     484            0 :                     ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name));
     485            0 :                     ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object.");
     486            0 :                     ShowContinueError(state,
     487            0 :                                       format("The supply air outlet node name in heat exchanger = {}=\"{}\"",
     488            0 :                                              HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     489            0 :                                              thisHXCoil.HeatExchangerName));
     490            0 :                     ShowContinueError(
     491              :                         state,
     492            0 :                         format("must match the cooling coil inlet node name in = {}=\"{}\"", thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName));
     493            0 :                     ShowContinueError(state,
     494            0 :                                       format("Heat exchanger supply air outlet node name=\"{}\"", state.dataLoopNodes->NodeID(SupplyAirOutletNode)));
     495            0 :                     ShowContinueError(state, format("Cooling coil air inlet node name=\"{}\"", state.dataLoopNodes->NodeID(CoolingCoilInletNodeNum)));
     496            0 :                     ErrorsFound = true;
     497              :                 }
     498            1 :                 CoolingCoilErrFlag = false;
     499            2 :                 CoolingCoilOutletNodeNum = VariableSpeedCoils::GetCoilOutletNodeVariableSpeed(
     500            1 :                     state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag);
     501            1 :                 if (CoolingCoilErrFlag) {
     502            0 :                     ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     503              :                 }
     504            1 :                 if (SecondaryAirInletNode != CoolingCoilOutletNodeNum) {
     505            0 :                     ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name));
     506            0 :                     ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object.");
     507            0 :                     ShowContinueError(state,
     508            0 :                                       format("The secondary air inlet node name in heat exchanger ={}=\"{}\"",
     509            0 :                                              HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     510            0 :                                              thisHXCoil.HeatExchangerName));
     511            0 :                     ShowContinueError(state,
     512            0 :                                       format("must match the cooling coil air outlet node name in = {}=\"{}\".",
     513            0 :                                              thisHXCoil.CoolingCoilType,
     514            0 :                                              thisHXCoil.CoolingCoilName));
     515            0 :                     ShowContinueError(
     516            0 :                         state, format("Heat exchanger secondary air inlet node name =\"{}\".", state.dataLoopNodes->NodeID(SecondaryAirInletNode)));
     517            0 :                     ShowContinueError(state,
     518            0 :                                       format("Cooling coil air outlet node name =\"{}\".", state.dataLoopNodes->NodeID(CoolingCoilOutletNodeNum)));
     519            0 :                     ErrorsFound = true;
     520              :                 }
     521              :             }
     522              : 
     523           12 :             BranchNodeConnections::TestCompSet(state,
     524              :                                                thisHXCoil.HXAssistedCoilType,
     525              :                                                thisHXCoil.Name,
     526            6 :                                                state.dataLoopNodes->NodeID(SupplyAirInletNode),
     527            6 :                                                state.dataLoopNodes->NodeID(SecondaryAirOutletNode),
     528              :                                                "Air Nodes");
     529              : 
     530            6 :             thisHXCoil.HXAssistedCoilInletNodeNum =
     531            6 :                 NodeInputManager::GetOnlySingleNode(state,
     532            6 :                                                     state.dataLoopNodes->NodeID(SupplyAirInletNode),
     533              :                                                     ErrorsFound,
     534              :                                                     DataLoopNode::ConnectionObjectType::CoilSystemCoolingDXHeatExchangerAssisted,
     535            6 :                                                     thisHXCoil.Name,
     536              :                                                     DataLoopNode::NodeFluidType::Air,
     537              :                                                     DataLoopNode::ConnectionType::Inlet,
     538              :                                                     NodeInputManager::CompFluidStream::Primary,
     539              :                                                     DataLoopNode::ObjectIsParent);
     540              :             // no need to capture CoolingCoilInletNodeNum as the return value, it's not used anywhere
     541            6 :             NodeInputManager::GetOnlySingleNode(state,
     542            6 :                                                 state.dataLoopNodes->NodeID(SupplyAirOutletNode),
     543              :                                                 ErrorsFound,
     544              :                                                 DataLoopNode::ConnectionObjectType::CoilSystemCoolingDXHeatExchangerAssisted,
     545            6 :                                                 state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name,
     546              :                                                 DataLoopNode::NodeFluidType::Air,
     547              :                                                 DataLoopNode::ConnectionType::Internal,
     548              :                                                 NodeInputManager::CompFluidStream::Primary,
     549              :                                                 DataLoopNode::ObjectIsParent);
     550            6 :             thisHXCoil.HXExhaustAirInletNodeNum =
     551            6 :                 NodeInputManager::GetOnlySingleNode(state,
     552            6 :                                                     state.dataLoopNodes->NodeID(SecondaryAirInletNode),
     553              :                                                     ErrorsFound,
     554              :                                                     DataLoopNode::ConnectionObjectType::CoilSystemCoolingDXHeatExchangerAssisted,
     555            6 :                                                     thisHXCoil.Name,
     556              :                                                     DataLoopNode::NodeFluidType::Air,
     557              :                                                     DataLoopNode::ConnectionType::Internal,
     558              :                                                     NodeInputManager::CompFluidStream::Primary,
     559              :                                                     DataLoopNode::ObjectIsParent);
     560            6 :             thisHXCoil.HXAssistedCoilOutletNodeNum =
     561            6 :                 NodeInputManager::GetOnlySingleNode(state,
     562            6 :                                                     state.dataLoopNodes->NodeID(SecondaryAirOutletNode),
     563              :                                                     ErrorsFound,
     564              :                                                     DataLoopNode::ConnectionObjectType::CoilSystemCoolingDXHeatExchangerAssisted,
     565            6 :                                                     thisHXCoil.Name,
     566              :                                                     DataLoopNode::NodeFluidType::Air,
     567              :                                                     DataLoopNode::ConnectionType::Outlet,
     568              :                                                     NodeInputManager::CompFluidStream::Primary,
     569              :                                                     DataLoopNode::ObjectIsParent);
     570              : 
     571              :             // Add cooling coil to component sets array
     572           12 :             BranchNodeConnections::SetUpCompSets(state,
     573              :                                                  thisHXCoil.HXAssistedCoilType,
     574              :                                                  thisHXCoil.Name,
     575              :                                                  thisHXCoil.CoolingCoilType,
     576              :                                                  thisHXCoil.CoolingCoilName,
     577            6 :                                                  state.dataLoopNodes->NodeID(SupplyAirOutletNode),
     578            6 :                                                  state.dataLoopNodes->NodeID(SecondaryAirInletNode),
     579              :                                                  "Air Nodes");
     580              :             // Add heat exchanger to component sets array
     581           18 :             BranchNodeConnections::SetUpCompSets(state,
     582              :                                                  thisHXCoil.HXAssistedCoilType,
     583              :                                                  thisHXCoil.Name,
     584            6 :                                                  HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     585              :                                                  thisHXCoil.HeatExchangerName,
     586            6 :                                                  state.dataLoopNodes->NodeID(SupplyAirInletNode),
     587            6 :                                                  state.dataLoopNodes->NodeID(SupplyAirOutletNode),
     588              :                                                  "Process Air Nodes");
     589           18 :             BranchNodeConnections::SetUpCompSets(state,
     590              :                                                  thisHXCoil.HXAssistedCoilType,
     591              :                                                  thisHXCoil.Name,
     592            6 :                                                  HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     593              :                                                  thisHXCoil.HeatExchangerName,
     594            6 :                                                  state.dataLoopNodes->NodeID(SecondaryAirInletNode),
     595            6 :                                                  state.dataLoopNodes->NodeID(SecondaryAirOutletNode),
     596              :                                                  "Secondary Air Nodes");
     597              : 
     598              :         } // End of the Coil:DX:CoolingHXAssisted Loop
     599              : 
     600              :         // Get the data for the Coil:Water:CoolingHeatExchangerAssisted objects
     601           11 :         CurrentModuleObject = "CoilSystem:Cooling:Water:HeatExchangerAssisted";
     602              : 
     603           16 :         for (HXAssistedCoilNum = NumHXAssistedDXCoils + 1; HXAssistedCoilNum <= state.dataHVACAssistedCC->TotalNumHXAssistedCoils;
     604              :              ++HXAssistedCoilNum) {
     605            5 :             int thisWaterHXNum = HXAssistedCoilNum - NumHXAssistedDXCoils;
     606            5 :             auto &thisHXCoil = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum);
     607              : 
     608            5 :             state.dataInputProcessing->inputProcessor->getObjectItem(state,
     609              :                                                                      CurrentModuleObject,
     610              :                                                                      thisWaterHXNum,
     611              :                                                                      AlphArray,
     612              :                                                                      NumAlphas,
     613              :                                                                      NumArray,
     614              :                                                                      NumNums,
     615              :                                                                      IOStat,
     616              :                                                                      lNumericBlanks,
     617              :                                                                      lAlphaBlanks,
     618              :                                                                      cAlphaFields,
     619              :                                                                      cNumericFields);
     620              : 
     621            5 :             ErrorObjectHeader eoh{routineName, CurrentModuleObject, AlphArray(1)};
     622              : 
     623            5 :             GlobalNames::VerifyUniqueInterObjectName(
     624            5 :                 state, state.dataHVACAssistedCC->UniqueHXAssistedCoilNames, AlphArray(1), CurrentModuleObject, ErrorsFound);
     625              : 
     626            5 :             thisHXCoil.Name = AlphArray(1);
     627              : 
     628            5 :             thisHXCoil.hxType = static_cast<HVAC::HXType>(getEnumValue(HVAC::hxTypeNamesUC, AlphArray(2)));
     629            5 :             if (thisHXCoil.hxType == HVAC::HXType::Desiccant_Balanced) {
     630            0 :                 ShowSevereInvalidKey(state, eoh, cAlphaFields(2), AlphArray(2));
     631            0 :                 ErrorsFound = true;
     632              :             }
     633            5 :             thisHXCoil.HeatExchangerName = AlphArray(3);
     634            5 :             thisHXCoil.CoolingCoilType = AlphArray(4);
     635            5 :             thisHXCoil.CoolingCoilName = AlphArray(5);
     636              : 
     637            5 :             HXErrFlag = false;
     638            5 :             SupplyAirInletNode = HeatRecovery::GetSupplyInletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag);
     639            5 :             if (HXErrFlag) {
     640            0 :                 ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     641              :             }
     642              : 
     643            5 :             HXErrFlag = false;
     644            5 :             SupplyAirOutletNode = HeatRecovery::GetSupplyOutletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag);
     645            5 :             if (HXErrFlag) {
     646            0 :                 ShowContinueError(state, format("...Occurs in {}=\"{}", CurrentModuleObject, thisHXCoil.Name));
     647              :             }
     648              : 
     649            5 :             HXErrFlag = false;
     650            5 :             SecondaryAirInletNode = HeatRecovery::GetSecondaryInletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag);
     651            5 :             if (HXErrFlag) {
     652            0 :                 ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     653              :             }
     654              : 
     655            5 :             HXErrFlag = false;
     656            5 :             SecondaryAirOutletNode = HeatRecovery::GetSecondaryOutletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag);
     657            5 :             if (HXErrFlag) {
     658            0 :                 ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     659              :             }
     660              : 
     661           10 :             if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:Water") ||
     662           10 :                 Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:Water:DetailedGeometry")) {
     663            5 :                 if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:Water:DetailedGeometry")) {
     664            5 :                     thisHXCoil.CoolingCoilType_Num = HVAC::Coil_CoolingWaterDetailed;
     665            0 :                 } else if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:Water")) {
     666            0 :                     thisHXCoil.CoolingCoilType_Num = HVAC::Coil_CoolingWater;
     667              :                 }
     668              : 
     669            5 :                 thisHXCoil.HXAssistedCoilType = CurrentModuleObject;
     670            5 :                 thisHXCoil.HXAssistedCoilType_Num = HVAC::CoilWater_CoolingHXAssisted;
     671              : 
     672              :                 //         Check node names in heat exchanger and coil objects for consistency
     673            5 :                 CoolingCoilErrFlag = false;
     674              :                 CoolingCoilInletNodeNum =
     675            5 :                     WaterCoils::GetCoilInletNode(state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag);
     676              :                 CoolingCoilWaterInletNodeNum =
     677            5 :                     WaterCoils::GetCoilWaterInletNode(state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag);
     678            5 :                 HVACControllers::GetControllerNameAndIndex(
     679            5 :                     state, CoolingCoilWaterInletNodeNum, thisHXCoil.ControllerName, thisHXCoil.ControllerIndex, CoolingCoilErrFlag);
     680            5 :                 if (CoolingCoilErrFlag) {
     681            0 :                     ShowContinueError(state, format("...occurs in {} \"{}\"", CurrentModuleObject, thisHXCoil.Name));
     682              :                 }
     683            5 :                 if (SupplyAirOutletNode != CoolingCoilInletNodeNum) {
     684            0 :                     ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name));
     685            0 :                     ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object.");
     686            0 :                     ShowContinueError(state,
     687            0 :                                       format("The supply air outlet node name in heat exchanger = {}=\"{}\"",
     688            0 :                                              HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     689            0 :                                              thisHXCoil.HeatExchangerName));
     690            0 :                     ShowContinueError(
     691              :                         state,
     692            0 :                         format("must match the cooling coil inlet node name in = {}=\"{}\"", thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName));
     693            0 :                     ShowContinueError(state,
     694            0 :                                       format("Heat exchanger supply air outlet node name =\"{}\"", state.dataLoopNodes->NodeID(SupplyAirOutletNode)));
     695            0 :                     ShowContinueError(state,
     696            0 :                                       format("Cooling coil air inlet node name = \"{}\"", state.dataLoopNodes->NodeID(CoolingCoilInletNodeNum)));
     697            0 :                     ErrorsFound = true;
     698              :                 }
     699            5 :                 CoolingCoilErrFlag = false;
     700              :                 CoolingCoilOutletNodeNum =
     701            5 :                     WaterCoils::GetCoilOutletNode(state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag);
     702            5 :                 if (CoolingCoilErrFlag) {
     703            0 :                     ShowContinueError(state, format("...occurs in {} \"{}\"", CurrentModuleObject, thisHXCoil.Name));
     704              :                 }
     705            5 :                 if (SecondaryAirInletNode != CoolingCoilOutletNodeNum) {
     706            0 :                     ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name));
     707            0 :                     ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object.");
     708            0 :                     ShowContinueError(state,
     709            0 :                                       format("The secondary air inlet node name in heat exchanger = {}=\"{}\"",
     710            0 :                                              HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     711            0 :                                              thisHXCoil.HeatExchangerName));
     712            0 :                     ShowContinueError(state,
     713            0 :                                       format("must match the cooling coil air outlet node name in = {}=\"{}\".",
     714            0 :                                              thisHXCoil.CoolingCoilType,
     715            0 :                                              thisHXCoil.CoolingCoilName));
     716            0 :                     ShowContinueError(
     717            0 :                         state, format("Heat exchanger secondary air inlet node name = \"{}\".", state.dataLoopNodes->NodeID(SecondaryAirInletNode)));
     718            0 :                     ShowContinueError(state,
     719            0 :                                       format("Cooling coil air outlet node name = \"{}\".", state.dataLoopNodes->NodeID(CoolingCoilOutletNodeNum)));
     720            0 :                     ErrorsFound = true;
     721              :                 }
     722              : 
     723              :             } else {
     724            0 :                 ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name));
     725            0 :                 ShowContinueError(state, format("Invalid {}=\"{}\"", cAlphaFields(4), thisHXCoil.CoolingCoilType));
     726            0 :                 ErrorsFound = true;
     727              :             }
     728           10 :             BranchNodeConnections::TestCompSet(state,
     729              :                                                thisHXCoil.HXAssistedCoilType,
     730              :                                                thisHXCoil.Name,
     731            5 :                                                state.dataLoopNodes->NodeID(SupplyAirInletNode),
     732            5 :                                                state.dataLoopNodes->NodeID(SecondaryAirOutletNode),
     733              :                                                "Air Nodes");
     734              : 
     735            5 :             thisHXCoil.HXAssistedCoilInletNodeNum =
     736            5 :                 NodeInputManager::GetOnlySingleNode(state,
     737            5 :                                                     state.dataLoopNodes->NodeID(SupplyAirInletNode),
     738              :                                                     ErrorsFound,
     739              :                                                     DataLoopNode::ConnectionObjectType::CoilSystemCoolingWaterHeatExchangerAssisted,
     740            5 :                                                     thisHXCoil.Name,
     741              :                                                     DataLoopNode::NodeFluidType::Air,
     742              :                                                     DataLoopNode::ConnectionType::Inlet,
     743              :                                                     NodeInputManager::CompFluidStream::Primary,
     744              :                                                     DataLoopNode::ObjectIsParent);
     745              :             // no need to capture CoolingCoilInletNodeNum as the return value, it's not used anywhere
     746            5 :             NodeInputManager::GetOnlySingleNode(state,
     747            5 :                                                 state.dataLoopNodes->NodeID(SupplyAirOutletNode),
     748              :                                                 ErrorsFound,
     749              :                                                 DataLoopNode::ConnectionObjectType::CoilSystemCoolingWaterHeatExchangerAssisted,
     750            5 :                                                 state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name,
     751              :                                                 DataLoopNode::NodeFluidType::Air,
     752              :                                                 DataLoopNode::ConnectionType::Internal,
     753              :                                                 NodeInputManager::CompFluidStream::Primary,
     754              :                                                 DataLoopNode::ObjectIsParent);
     755            5 :             thisHXCoil.HXExhaustAirInletNodeNum =
     756            5 :                 NodeInputManager::GetOnlySingleNode(state,
     757            5 :                                                     state.dataLoopNodes->NodeID(SecondaryAirInletNode),
     758              :                                                     ErrorsFound,
     759              :                                                     DataLoopNode::ConnectionObjectType::CoilSystemCoolingWaterHeatExchangerAssisted,
     760            5 :                                                     thisHXCoil.Name,
     761              :                                                     DataLoopNode::NodeFluidType::Air,
     762              :                                                     DataLoopNode::ConnectionType::Internal,
     763              :                                                     NodeInputManager::CompFluidStream::Primary,
     764              :                                                     DataLoopNode::ObjectIsParent);
     765            5 :             thisHXCoil.HXAssistedCoilOutletNodeNum =
     766            5 :                 NodeInputManager::GetOnlySingleNode(state,
     767            5 :                                                     state.dataLoopNodes->NodeID(SecondaryAirOutletNode),
     768              :                                                     ErrorsFound,
     769              :                                                     DataLoopNode::ConnectionObjectType::CoilSystemCoolingWaterHeatExchangerAssisted,
     770            5 :                                                     thisHXCoil.Name,
     771              :                                                     DataLoopNode::NodeFluidType::Air,
     772              :                                                     DataLoopNode::ConnectionType::Outlet,
     773              :                                                     NodeInputManager::CompFluidStream::Primary,
     774              :                                                     DataLoopNode::ObjectIsParent);
     775              : 
     776              :             // Add cooling coil to component sets array
     777           10 :             BranchNodeConnections::SetUpCompSets(state,
     778              :                                                  thisHXCoil.HXAssistedCoilType,
     779              :                                                  thisHXCoil.Name,
     780              :                                                  thisHXCoil.CoolingCoilType,
     781              :                                                  thisHXCoil.CoolingCoilName,
     782            5 :                                                  state.dataLoopNodes->NodeID(SupplyAirOutletNode),
     783            5 :                                                  state.dataLoopNodes->NodeID(SecondaryAirInletNode),
     784              :                                                  "Air Nodes");
     785              :             // Add heat exchanger to component sets array
     786           15 :             BranchNodeConnections::SetUpCompSets(state,
     787              :                                                  thisHXCoil.HXAssistedCoilType,
     788              :                                                  thisHXCoil.Name,
     789            5 :                                                  HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     790              :                                                  thisHXCoil.HeatExchangerName,
     791            5 :                                                  state.dataLoopNodes->NodeID(SupplyAirInletNode),
     792            5 :                                                  state.dataLoopNodes->NodeID(SupplyAirOutletNode),
     793              :                                                  "Process Air Nodes");
     794           15 :             BranchNodeConnections::SetUpCompSets(state,
     795              :                                                  thisHXCoil.HXAssistedCoilType,
     796              :                                                  thisHXCoil.Name,
     797            5 :                                                  HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     798              :                                                  thisHXCoil.HeatExchangerName,
     799            5 :                                                  state.dataLoopNodes->NodeID(SecondaryAirInletNode),
     800            5 :                                                  state.dataLoopNodes->NodeID(SecondaryAirOutletNode),
     801              :                                                  "Secondary Air Nodes");
     802              : 
     803              :         } // End of the Coil:Water:CoolingHXAssisted Loop
     804              : 
     805           11 :         AlphArray.deallocate();
     806           11 :         cAlphaFields.deallocate();
     807           11 :         cNumericFields.deallocate();
     808           11 :         NumArray.deallocate();
     809           11 :         lAlphaBlanks.deallocate();
     810           11 :         lNumericBlanks.deallocate();
     811              : 
     812           11 :         if (ErrorsFound) {
     813            0 :             ShowFatalError(state, format("{}Previous error condition causes termination.", RoutineName));
     814              :         }
     815           11 :     }
     816              : 
     817              :     // End of Get Input subroutines for this Module
     818              :     //******************************************************************************
     819              : 
     820              :     // Beginning Initialization Section of the Module
     821              :     //******************************************************************************
     822              : 
     823       408362 :     void InitHXAssistedCoolingCoil(EnergyPlusData &state, int const HXAssistedCoilNum) // index for HXAssistedCoolingCoil
     824              :     {
     825              : 
     826              :         // SUBROUTINE INFORMATION:
     827              :         //       AUTHOR         Richard Raustad, FSEC
     828              :         //       DATE WRITTEN   Sep 2003
     829              :         //       MODIFIED       R. Raustad, June 2007 now using FullLoadOutletConditions from DX Coil data structure
     830              : 
     831              :         // PURPOSE OF THIS SUBROUTINE:
     832              :         //  This subroutine is for initializations of the HXAssistedCoolingCoil components
     833              : 
     834              :         // METHODOLOGY EMPLOYED:
     835              :         //  Uses the status flags to trigger initializations.
     836              : 
     837              :         // Do these initializations every time
     838       408362 :         auto &thisHXCoil = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum);
     839       408362 :         thisHXCoil.MassFlowRate = state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).MassFlowRate;
     840              : 
     841       408362 :         if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_Cooling) {
     842              :             //
     843              :             // state.dataCoilCoolingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex]
     844              :             //     .outletAirDryBulbTemp = 0.0;
     845              :             // state.dataCoilCoolingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].outletAirHumRat =
     846              :             //     0.0;
     847       379231 :         } else if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) {
     848       219211 :             state.dataDXCoils->DXCoilFullLoadOutAirTemp(thisHXCoil.CoolingCoilIndex) = 0.0;
     849       219211 :             state.dataDXCoils->DXCoilFullLoadOutAirHumRat(thisHXCoil.CoolingCoilIndex) = 0.0;
     850       160020 :         } else if (thisHXCoil.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) {
     851              :             //
     852              :         }
     853       408362 :     }
     854              : 
     855              :     // End Initialization Section of the Module
     856              :     //******************************************************************************
     857              : 
     858       429260 :     void CalcHXAssistedCoolingCoil(EnergyPlusData &state,
     859              :                                    int const HXAssistedCoilNum,                    // Index number for HXAssistedCoolingCoil
     860              :                                    bool const FirstHVACIteration,                  // FirstHVACIteration flag
     861              :                                    HVAC::CompressorOp const compressorOp,          // compressor operation; 1=on, 0=off
     862              :                                    Real64 const PartLoadRatio,                     // Cooling coil part load ratio
     863              :                                    bool const HXUnitOn,                            // Flag to enable heat exchanger
     864              :                                    HVAC::FanOp const fanOp,                        // Allows parent object to control fan operation
     865              :                                    ObjexxFCL::Optional<Real64 const> OnOffAirFlow, // Ratio of compressor ON air mass flow to AVERAGE over time step
     866              :                                    ObjexxFCL::Optional_bool_const EconomizerFlag,  // OA (or airloop) econommizer status
     867              :                                    ObjexxFCL::Optional<HVAC::CoilMode const> DehumidificationMode, // Optional dehumbidication mode
     868              :                                    [[maybe_unused]] ObjexxFCL::Optional<Real64 const> LoadSHR      // Optional coil SHR pass over
     869              :     )
     870              :     {
     871              : 
     872              :         // SUBROUTINE INFORMATION:
     873              :         //       AUTHOR         Richard Raustad, FSEC
     874              :         //       DATE WRITTEN   Sept 2003
     875              : 
     876              :         // PURPOSE OF THIS SUBROUTINE:
     877              :         //  This subroutine models the cooling coil/air-to-air heat exchanger
     878              :         //  combination. The cooling coil exiting air temperature is used as
     879              :         //  an indicator of convergence.
     880              : 
     881              :         // SUBROUTINE PARAMETER DEFINITIONS:
     882       429260 :         int constexpr MaxIter(50); // Maximum number of iterations
     883              : 
     884              :         int CompanionCoilIndexNum; // Index to DX coil
     885              : 
     886       429260 :         auto &thisHXCoil = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum);
     887       429260 :         Real64 AirMassFlow = thisHXCoil.MassFlowRate;
     888       429260 :         Real64 Error = 1.0;       // Initialize error (CoilOutputTemp last iteration minus current CoilOutputTemp)
     889       429260 :         Real64 ErrorLast = Error; // initialize variable used to test loop termination
     890       429260 :         int Iter = 0;             // Initialize iteration counter to zero
     891              : 
     892              :         // Set mass flow rate at inlet of exhaust side of heat exchanger to supply side air mass flow rate entering this compound object
     893       429260 :         state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).MassFlowRate = AirMassFlow;
     894              : 
     895       429260 :         if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_Cooling || thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed ||
     896       180918 :             thisHXCoil.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) {
     897       301871 :             CompanionCoilIndexNum = thisHXCoil.CoolingCoilIndex;
     898              :         } else {
     899       127389 :             CompanionCoilIndexNum = 0;
     900              :         }
     901              : 
     902              :         // First call to RegulaFalsi uses PLR=0. Nodes are typically setup at full output on this call.
     903              :         // A large number of iterations are required to get to result (~36 iterations to get to PLR=0 node conditions).
     904              :         // Reset node data to minimize iteration. This initialization reduces the number of iterations by 50%.
     905              :         // CAUTION: Do not use Node(x) = Node(y) here, this can overwrite the coil outlet node setpoint.
     906       429260 :         if (PartLoadRatio == 0.0) {
     907       291218 :             state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).Temp =
     908       291218 :                 state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).Temp;
     909       291218 :             state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).HumRat =
     910       291218 :                 state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).HumRat;
     911       291218 :             state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).Enthalpy =
     912       291218 :                 state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).Enthalpy;
     913       291218 :             state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).MassFlowRate =
     914       291218 :                 state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).MassFlowRate;
     915              :         }
     916              : 
     917              :         // Force at least 2 iterations to pass outlet node information
     918      1651426 :         while ((std::abs(Error) > 0.0005 && Iter <= MaxIter) || Iter < 2) {
     919              : 
     920      2444332 :             HeatRecovery::SimHeatRecovery(state,
     921              :                                           thisHXCoil.HeatExchangerName,
     922              :                                           FirstHVACIteration,
     923      1222166 :                                           thisHXCoil.HeatExchangerIndex,
     924              :                                           fanOp,
     925              :                                           PartLoadRatio,
     926              :                                           HXUnitOn,
     927              :                                           CompanionCoilIndexNum,
     928              :                                           _,
     929              :                                           EconomizerFlag,
     930              :                                           _,
     931      1222166 :                                           thisHXCoil.CoolingCoilType_Num);
     932              : 
     933      1222166 :             if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_Cooling) {
     934              : 
     935        58569 :                 int coolingCoilIndex = thisHXCoil.CoolingCoilIndex;
     936              : 
     937        58569 :                 int mSingleMode = state.dataCoilCoolingDX->coilCoolingDXs[coolingCoilIndex].getNumModes();
     938        58569 :                 bool singleMode = (mSingleMode == 1);
     939              : 
     940        58569 :                 Real64 mCoolingSpeedNum = state.dataCoilCoolingDX->coilCoolingDXs[coolingCoilIndex]
     941        58569 :                                               .performance.normalMode.speeds.size(); // used the same for the original variable speed coil
     942              : 
     943        58569 :                 HVAC::CoilMode coilMode = HVAC::CoilMode::Normal;
     944        58569 :                 if (state.dataCoilCoolingDX->coilCoolingDXs[coolingCoilIndex].SubcoolReheatFlag) {
     945            0 :                     coilMode = HVAC::CoilMode::SubcoolReheat;
     946        58569 :                 } else if (DehumidificationMode == HVAC::CoilMode::Enhanced) {
     947            0 :                     coilMode = HVAC::CoilMode::Enhanced;
     948              :                 }
     949              : 
     950        58569 :                 Real64 CoilPLR = 1.0;
     951        58569 :                 if (compressorOp == HVAC::CompressorOp::Off) {
     952            0 :                     mCoolingSpeedNum = 1; // Bypass mixed-speed calculations in called functions
     953              :                 } else {
     954        58569 :                     if (singleMode) {
     955        58569 :                         CoilPLR =
     956        58569 :                             (mCoolingSpeedNum == 1) ? PartLoadRatio : 0.0; // singleMode allows cycling, but not part load operation at higher speeds
     957              :                     } else {
     958            0 :                         CoilPLR = PartLoadRatio;
     959              :                     }
     960              :                 }
     961              : 
     962        58569 :                 state.dataCoilCoolingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].simulate(state,
     963              :                                                                                               coilMode, // partially implemented for HXAssistedCoil
     964              :                                                                                               mCoolingSpeedNum,
     965              :                                                                                               CoilPLR,
     966              :                                                                                               fanOp,
     967              :                                                                                               singleMode); //
     968              : 
     969      1163597 :             } else if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) {
     970       946092 :                 DXCoils::SimDXCoil(state,
     971              :                                    thisHXCoil.CoolingCoilName,
     972              :                                    compressorOp,
     973              :                                    FirstHVACIteration,
     974       473046 :                                    thisHXCoil.CoolingCoilIndex,
     975              :                                    fanOp,
     976              :                                    PartLoadRatio,
     977              :                                    OnOffAirFlow);
     978       690551 :             } else if (thisHXCoil.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) {
     979       198279 :                 Real64 QZnReq(-1.0);           // Zone load (W), input to variable-speed DX coil
     980       198279 :                 Real64 QLatReq(0.0);           // Zone latent load, input to variable-speed DX coil
     981       198279 :                 Real64 OnOffAirFlowRatio(1.0); // ratio of compressor on flow to average flow over time step
     982       198279 :                 HVAC::CompressorOp compressorOn = compressorOp;
     983       198279 :                 if (PartLoadRatio == 0.0) {
     984        33350 :                     compressorOn = HVAC::CompressorOp::Off;
     985              :                 }
     986       198279 :                 VariableSpeedCoils::SimVariableSpeedCoils(state,
     987              :                                                           thisHXCoil.CoolingCoilName,
     988       198279 :                                                           thisHXCoil.CoolingCoilIndex,
     989              :                                                           fanOp,
     990              :                                                           compressorOn,
     991              :                                                           PartLoadRatio,
     992              :                                                           thisHXCoil.DXCoilNumOfSpeeds,
     993              :                                                           QZnReq,
     994              :                                                           QLatReq,
     995              :                                                           OnOffAirFlowRatio); // call vs coil model at top speed.
     996              :             } else {
     997       492272 :                 WaterCoils::SimulateWaterCoilComponents(state, thisHXCoil.CoolingCoilName, FirstHVACIteration, thisHXCoil.CoolingCoilIndex);
     998              :             }
     999              : 
    1000      1222166 :             Error = state.dataHVACAssistedCC->CoilOutputTempLast - state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).Temp;
    1001      1222166 :             if (Iter > 40) { // check for oscillation (one of these being negative and one positive) before hitting max iteration limit
    1002          209 :                 if (Error + ErrorLast < 0.000001) {
    1003           25 :                     Error = 0.0; // result bounced back and forth with same positive and negative result, no possible solution without this check
    1004              :                 }
    1005              :             }
    1006      1222166 :             ErrorLast = Error;
    1007      1222166 :             state.dataHVACAssistedCC->CoilOutputTempLast = state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).Temp;
    1008      1222166 :             ++Iter;
    1009              :         }
    1010              : 
    1011              :         // Write excessive iteration warning messages
    1012       429260 :         if (Iter > MaxIter) {
    1013           18 :             if (thisHXCoil.MaxIterCounter < 1) {
    1014            1 :                 ++thisHXCoil.MaxIterCounter;
    1015            2 :                 ShowWarningError(state,
    1016            2 :                                  format("{} \"{}\" -- Exceeded max iterations ({}) while calculating operating conditions.",
    1017            1 :                                         thisHXCoil.HXAssistedCoilType,
    1018            1 :                                         thisHXCoil.Name,
    1019              :                                         MaxIter));
    1020            3 :                 ShowContinueErrorTimeStamp(state, "");
    1021              :             } else {
    1022          136 :                 ShowRecurringWarningErrorAtEnd(state,
    1023           34 :                                                thisHXCoil.HXAssistedCoilType + " \"" + thisHXCoil.Name +
    1024              :                                                    "\" -- Exceeded max iterations error continues...",
    1025           17 :                                                thisHXCoil.MaxIterIndex);
    1026              :             }
    1027              :         }
    1028              : 
    1029       429260 :         state.dataHVACAssistedCC->HXAssistedCoilOutletTemp(HXAssistedCoilNum) =
    1030       429260 :             state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilOutletNodeNum).Temp;
    1031       429260 :         state.dataHVACAssistedCC->HXAssistedCoilOutletHumRat(HXAssistedCoilNum) =
    1032       429260 :             state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilOutletNodeNum).HumRat;
    1033       429260 :     }
    1034              : 
    1035              :     //        End of Reporting subroutines for the HXAssistedCoil Module
    1036              :     // *****************************************************************************
    1037              : 
    1038            6 :     void GetHXDXCoilIndex(
    1039              :         EnergyPlusData &state, std::string const &HXDXCoilName, int &HXDXCoilIndex, bool &ErrorsFound, std::string_view const CurrentModuleObject)
    1040              :     {
    1041              : 
    1042              :         // SUBROUTINE INFORMATION:
    1043              :         //       AUTHOR         Richard Raustad
    1044              :         //       DATE WRITTEN   August 2007
    1045              : 
    1046              :         // PURPOSE OF THIS SUBROUTINE:
    1047              :         // This subroutine sets an index for a given HX Assisted Cooling Coil -- issues error message if that
    1048              :         // HX is not a legal HX Assisted Cooling Coil.
    1049              : 
    1050              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1051            6 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1052              :             // Get the HXAssistedCoolingCoil input
    1053            0 :             GetHXAssistedCoolingCoilInput(state);
    1054            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1055              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1056              :         }
    1057              : 
    1058            6 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1059            6 :             HXDXCoilIndex = Util::FindItem(HXDXCoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1060              :         } else {
    1061            0 :             HXDXCoilIndex = 0;
    1062              :         }
    1063              : 
    1064            6 :         if (HXDXCoilIndex == 0) {
    1065            0 :             if (!CurrentModuleObject.empty()) {
    1066            0 :                 ShowSevereError(state, fmt::format("{}, GetHXDXCoilIndex: HX Assisted Cooling Coil not found={}", CurrentModuleObject, HXDXCoilName));
    1067              :             } else {
    1068            0 :                 ShowSevereError(state, format("GetHXDXCoilIndex: HX Assisted Cooling Coil not found={}", HXDXCoilName));
    1069              :             }
    1070            0 :             ErrorsFound = true;
    1071              :         }
    1072            6 :     }
    1073              : 
    1074            0 :     void CheckHXAssistedCoolingCoilSchedule(EnergyPlusData &state,
    1075              :                                             [[maybe_unused]] std::string const &CompType, // unused1208
    1076              :                                             std::string_view CompName,
    1077              :                                             Real64 &Value,
    1078              :                                             int &CompIndex)
    1079              :     {
    1080              : 
    1081              :         // SUBROUTINE INFORMATION:
    1082              :         //       AUTHOR         Linda Lawrie
    1083              :         //       DATE WRITTEN   October 2005
    1084              : 
    1085              :         // PURPOSE OF THIS SUBROUTINE:
    1086              :         // This routine provides a method for outside routines to check if
    1087              :         // the hx assisted cooling coil is scheduled to be on.
    1088              : 
    1089              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    1090              :         int HXAssistedCoilNum;
    1091              : 
    1092              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1093            0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1094              :             // Get the HXAssistedCoolingCoil input
    1095            0 :             GetHXAssistedCoolingCoilInput(state);
    1096            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1097              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1098              :         }
    1099              : 
    1100              :         // Find the correct Coil number
    1101            0 :         if (CompIndex == 0) {
    1102            0 :             if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1103            0 :                 HXAssistedCoilNum = Util::FindItem(CompName, state.dataHVACAssistedCC->HXAssistedCoil);
    1104              :             } else {
    1105            0 :                 HXAssistedCoilNum = 0;
    1106              :             }
    1107              : 
    1108            0 :             if (HXAssistedCoilNum == 0) {
    1109            0 :                 ShowFatalError(state, format("CheckHXAssistedCoolingCoilSchedule: HX Assisted Coil not found={}", CompName));
    1110              :             }
    1111            0 :             CompIndex = HXAssistedCoilNum;
    1112            0 :             Value = 1.0; // not scheduled?
    1113              :         } else {
    1114            0 :             HXAssistedCoilNum = CompIndex;
    1115            0 :             if (HXAssistedCoilNum > state.dataHVACAssistedCC->TotalNumHXAssistedCoils || HXAssistedCoilNum < 1) {
    1116            0 :                 ShowFatalError(state,
    1117            0 :                                format("CheckHXAssistedCoolingCoilSchedule: Invalid CompIndex passed={}, Number of Heating Coils={}, Coil name={}",
    1118              :                                       HXAssistedCoilNum,
    1119            0 :                                       state.dataHVACAssistedCC->TotalNumHXAssistedCoils,
    1120              :                                       CompName));
    1121              :             }
    1122            0 :             if (CompName != state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name) {
    1123            0 :                 ShowFatalError(
    1124              :                     state,
    1125            0 :                     format("CheckHXAssistedCoolingCoilSchedule: Invalid CompIndex passed={}, Coil name={}, stored Coil Name for that index={}",
    1126              :                            HXAssistedCoilNum,
    1127              :                            CompName,
    1128            0 :                            state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name));
    1129              :             }
    1130              : 
    1131            0 :             Value = 1.0; // not scheduled?
    1132              :         }
    1133            0 :     }
    1134              : 
    1135            6 :     Real64 GetCoilCapacity(EnergyPlusData &state,
    1136              :                            std::string const &CoilType, // must match coil types in this module
    1137              :                            std::string const &CoilName, // must match coil names for the coil type
    1138              :                            bool &ErrorsFound            // set to true if problem
    1139              :     )
    1140              :     {
    1141              : 
    1142              :         // FUNCTION INFORMATION:
    1143              :         //       AUTHOR         Linda Lawrie
    1144              :         //       DATE WRITTEN   February 2006
    1145              : 
    1146              :         // PURPOSE OF THIS FUNCTION:
    1147              :         // This function looks up the coil capacity for the given coil and returns it.  If
    1148              :         // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned
    1149              :         // as negative.
    1150              : 
    1151              :         // Return value
    1152            6 :         Real64 CoilCapacity(0.0); // returned capacity of matched coil
    1153              : 
    1154              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1155            6 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1156              :             // Get the HXAssistedCoolingCoil input
    1157            0 :             GetHXAssistedCoolingCoilInput(state);
    1158            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1159              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1160              :         }
    1161              : 
    1162            6 :         bool errFlag = false;
    1163              : 
    1164            6 :         int WhichCoil = 0;
    1165            6 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1166            6 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1167              :         }
    1168              : 
    1169            6 :         if (Util::SameString(CoilType, "CoilSystem:Cooling:DX:HeatExchangerAssisted")) {
    1170            6 :             if (WhichCoil != 0) {
    1171              :                 // coil does not have capacity in input so mine information from DX cooling coil
    1172              : 
    1173            6 :                 if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::CoilDX_Cooling) {
    1174            1 :                     int coolingCoilDXIndex = state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilIndex;
    1175            1 :                     CoilCapacity = state.dataCoilCoolingDX->coilCoolingDXs[coolingCoilDXIndex].performance.normalMode.ratedGrossTotalCap;
    1176            5 :                 } else if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) {
    1177            4 :                     CoilCapacity = DXCoils::GetCoilCapacity(state,
    1178            4 :                                                             state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType,
    1179            4 :                                                             state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName,
    1180              :                                                             errFlag);
    1181            1 :                 } else if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) {
    1182              :                     CoilCapacity =
    1183            1 :                         VariableSpeedCoils::GetCoilCapacityVariableSpeed(state,
    1184            1 :                                                                          state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType,
    1185            1 :                                                                          state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName,
    1186              :                                                                          errFlag);
    1187              :                 }
    1188            6 :                 if (errFlag) {
    1189            0 :                     ShowRecurringWarningErrorAtEnd(
    1190            0 :                         state, "Requested DX Coil from CoilSystem:Cooling:DX:HeatExchangerAssisted not found", state.dataHVACAssistedCC->ErrCount);
    1191              :                 }
    1192              :             }
    1193            0 :         } else if (Util::SameString(CoilType, "CoilSystem:Cooling:Water:HeatExchangerAssisted")) {
    1194            0 :             if (WhichCoil != 0) {
    1195              :                 // coil does not have capacity in input so mine information from DX cooling coil
    1196            0 :                 CoilCapacity = WaterCoils::GetWaterCoilCapacity(state,
    1197            0 :                                                                 state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType,
    1198            0 :                                                                 state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName,
    1199              :                                                                 errFlag);
    1200            0 :                 if (errFlag) {
    1201            0 :                     ShowRecurringWarningErrorAtEnd(
    1202            0 :                         state, "Requested DX Coil from CoilSystem:Cooling:DX:HeatExchangerAssisted not found", state.dataHVACAssistedCC->ErrCount);
    1203              :                 }
    1204              :             }
    1205              :         } else {
    1206            0 :             WhichCoil = 0;
    1207              :         }
    1208              : 
    1209            6 :         if (WhichCoil == 0) {
    1210            0 :             ShowSevereError(state, format("GetCoilCapacity: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1211            0 :             ShowContinueError(state, "... Coil Capacity returned as -1000.");
    1212            0 :             ErrorsFound = true;
    1213            0 :             CoilCapacity = -1000.0;
    1214              :         }
    1215              : 
    1216            6 :         if (errFlag) {
    1217            0 :             ErrorsFound = true;
    1218              :         }
    1219              : 
    1220            6 :         return CoilCapacity;
    1221              :     }
    1222              : 
    1223            6 :     int GetCoilGroupTypeNum(EnergyPlusData &state,
    1224              :                             std::string const &CoilType, // must match coil types in this module
    1225              :                             std::string const &CoilName, // must match coil names for the coil type
    1226              :                             bool &ErrorsFound,           // set to true if problem
    1227              :                             bool const PrintWarning      // prints warning message if true
    1228              :     )
    1229              :     {
    1230              : 
    1231              :         // FUNCTION INFORMATION:
    1232              :         //       AUTHOR         R. Raustad - FSEC
    1233              :         //       DATE WRITTEN   August 2008
    1234              : 
    1235              :         // PURPOSE OF THIS FUNCTION:
    1236              :         // This function looks up the HX coil type and returns it (CoilDX_CoolingHXAssisted, CoilWater_CoolingHXAssisted)
    1237              :         // If incorrect coil type or name is given, ErrorsFound is returned as true.
    1238              : 
    1239              :         // FUNCTION LOCAL VARIABLE DECLARATIONS:
    1240              :         int WhichCoil;
    1241              : 
    1242              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1243            6 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1244              :             // Get the HXAssistedCoolingCoil input
    1245            5 :             GetHXAssistedCoolingCoilInput(state);
    1246            5 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1247              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1248              :         }
    1249              : 
    1250            6 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1251            6 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1252              :         } else {
    1253            0 :             WhichCoil = 0;
    1254              :         }
    1255              : 
    1256            6 :         if (WhichCoil != 0) {
    1257              :             // coil does not have capacity in input so mine information from DX cooling coil
    1258            6 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).HXAssistedCoilType_Num;
    1259              :         } else {
    1260            0 :             if (PrintWarning) {
    1261            0 :                 ShowSevereError(state, format("GetCoilGroupTypeNum: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1262              :             }
    1263            0 :             ErrorsFound = true;
    1264            0 :             return 0;
    1265              :         }
    1266              :     }
    1267              : 
    1268            0 :     int GetCoilObjectTypeNum(EnergyPlusData &state,
    1269              :                              std::string const &CoilType, // must match coil types in this module
    1270              :                              std::string const &CoilName, // must match coil names for the coil type
    1271              :                              bool &ErrorsFound,           // set to true if problem
    1272              :                              bool const PrintWarning      // prints warning message if true
    1273              :     )
    1274              :     {
    1275              : 
    1276              :         // FUNCTION INFORMATION:
    1277              :         //       AUTHOR         R. Raustad - FSEC
    1278              :         //       DATE WRITTEN   April 2009
    1279              : 
    1280              :         // PURPOSE OF THIS FUNCTION:
    1281              :         // This function looks up the coil object type for the given coil and returns it.  If
    1282              :         // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned
    1283              :         // as negative.
    1284              : 
    1285              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1286            0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1287              :             // Get the HXAssistedCoolingCoil input
    1288            0 :             GetHXAssistedCoolingCoilInput(state);
    1289            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1290              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1291              :         }
    1292              : 
    1293            0 :         int WhichCoil = 0;
    1294            0 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1295            0 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1296              :         }
    1297              : 
    1298            0 :         if (WhichCoil != 0) {
    1299            0 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num;
    1300              :         } else {
    1301            0 :             if (PrintWarning) {
    1302            0 :                 ShowSevereError(state, format("GetCoilObjectTypeNum: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1303              :             }
    1304            0 :             ErrorsFound = true;
    1305            0 :             return 0;
    1306              :         }
    1307              :     }
    1308              : 
    1309            6 :     int GetCoilInletNode(EnergyPlusData &state,
    1310              :                          std::string_view CoilType,   // must match coil types in this module
    1311              :                          std::string const &CoilName, // must match coil names for the coil type
    1312              :                          bool &ErrorsFound            // set to true if problem
    1313              :     )
    1314              :     {
    1315              : 
    1316              :         // FUNCTION INFORMATION:
    1317              :         //       AUTHOR         Linda Lawrie
    1318              :         //       DATE WRITTEN   February 2006
    1319              : 
    1320              :         // PURPOSE OF THIS FUNCTION:
    1321              :         // This function looks up the given coil and returns the inlet node number.  If
    1322              :         // incorrect coil type or name is given, ErrorsFound is returned as true and node number is returned
    1323              :         // as zero.
    1324              : 
    1325              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1326            6 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1327              :             // Get the HXAssistedCoolingCoil input
    1328            0 :             GetHXAssistedCoolingCoilInput(state);
    1329            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1330              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1331              :         }
    1332              : 
    1333            6 :         int WhichCoil = 0;
    1334            6 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1335            6 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1336              :         }
    1337              : 
    1338            6 :         if (WhichCoil != 0) {
    1339            6 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).HXAssistedCoilInletNodeNum;
    1340              :         } else {
    1341            0 :             ShowSevereError(state, format("GetCoilInletNode: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1342            0 :             ErrorsFound = true;
    1343            0 :             return 0;
    1344              :         }
    1345              :     }
    1346              : 
    1347            0 :     int GetCoilWaterInletNode(EnergyPlusData &state,
    1348              :                               std::string const &CoilType, // must match coil types in this module
    1349              :                               std::string const &CoilName, // must match coil names for the coil type
    1350              :                               bool &ErrorsFound            // set to true if problem
    1351              :     )
    1352              :     {
    1353              : 
    1354              :         // FUNCTION INFORMATION:
    1355              :         //       AUTHOR         Linda Lawrie
    1356              :         //       DATE WRITTEN   April 2011
    1357              : 
    1358              :         // PURPOSE OF THIS FUNCTION:
    1359              :         // This function looks up the given coil and returns the inlet node number.  If
    1360              :         // incorrect coil type or name is given, ErrorsFound is returned as true and node number is returned
    1361              :         // as zero.
    1362              : 
    1363              :         // Return value
    1364              :         int NodeNumber; // returned node number of matched coil
    1365              : 
    1366              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1367            0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1368              :             // Get the HXAssistedCoolingCoil input
    1369            0 :             GetHXAssistedCoolingCoilInput(state);
    1370            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1371              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1372              :         }
    1373              : 
    1374            0 :         int WhichCoil = 0;
    1375            0 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1376            0 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1377              :         }
    1378              : 
    1379            0 :         if (WhichCoil != 0) {
    1380            0 :             if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::Coil_CoolingWater) {
    1381            0 :                 NodeNumber = WaterCoils::GetCoilWaterInletNode(state,
    1382            0 :                                                                state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType,
    1383            0 :                                                                state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName,
    1384              :                                                                ErrorsFound);
    1385            0 :             } else if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::Coil_CoolingWaterDetailed) {
    1386            0 :                 NodeNumber = WaterCoils::GetCoilWaterInletNode(state,
    1387            0 :                                                                state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType,
    1388            0 :                                                                state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName,
    1389              :                                                                ErrorsFound);
    1390              :             } else { // even though validated in Get, still check.
    1391            0 :                 ShowSevereError(state,
    1392            0 :                                 format("GetCoilWaterInletNode: Invalid Cooling Coil for HX Assisted Coil, Type=\"{}\" Name=\"{}\"",
    1393            0 :                                        state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType,
    1394              :                                        CoilName));
    1395            0 :                 ErrorsFound = true;
    1396            0 :                 NodeNumber = 0; // Autodesk:Return Added line to set return value
    1397              :             }
    1398              :         } else {
    1399            0 :             ShowSevereError(state, format("GetCoilInletNode: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1400            0 :             ErrorsFound = true;
    1401            0 :             NodeNumber = 0;
    1402              :         }
    1403              : 
    1404            0 :         return NodeNumber;
    1405              :     }
    1406              : 
    1407            6 :     int GetCoilOutletNode(EnergyPlusData &state,
    1408              :                           std::string_view CoilType,   // must match coil types in this module
    1409              :                           std::string const &CoilName, // must match coil names for the coil type
    1410              :                           bool &ErrorsFound            // set to true if problem
    1411              :     )
    1412              :     {
    1413              : 
    1414              :         // FUNCTION INFORMATION:
    1415              :         //       AUTHOR         R. Raustad
    1416              :         //       DATE WRITTEN   August 2006
    1417              : 
    1418              :         // PURPOSE OF THIS FUNCTION:
    1419              :         // This function looks up the given coil and returns the outlet node number.  If
    1420              :         // incorrect coil type or name is given, ErrorsFound is returned as true and node number is returned
    1421              :         // as zero.
    1422              : 
    1423              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1424            6 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1425              :             // Get the HXAssistedCoolingCoil input
    1426            0 :             GetHXAssistedCoolingCoilInput(state);
    1427            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1428              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1429              :         }
    1430              : 
    1431            6 :         int WhichCoil = 0;
    1432            6 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1433            6 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1434              :         }
    1435              : 
    1436            6 :         if (WhichCoil != 0) {
    1437            6 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).HXAssistedCoilOutletNodeNum;
    1438              :         } else {
    1439            0 :             ShowSevereError(state, format("GetCoilOutletNode: Could not find Coil, Type=\"{}\" Name=\"{}", CoilType, CoilName));
    1440            0 :             ErrorsFound = true;
    1441            0 :             return 0;
    1442              :         }
    1443              :     }
    1444              : 
    1445            6 :     std::string GetHXDXCoilType(EnergyPlusData &state,
    1446              :                                 std::string const &CoilType, // must match coil types in this module
    1447              :                                 std::string const &CoilName, // must match coil names for the coil type
    1448              :                                 bool &ErrorsFound            // set to true if problem
    1449              :     )
    1450              :     {
    1451              : 
    1452              :         // FUNCTION INFORMATION:
    1453              :         //       AUTHOR         R. Raustad, FSEC
    1454              :         //       DATE WRITTEN   September 2015
    1455              : 
    1456              :         // PURPOSE OF THIS FUNCTION:
    1457              :         // This function looks up the given coil and returns the cooling coil type.  If
    1458              :         // incorrect coil type or name is given, ErrorsFound is returned as true and the name
    1459              :         // is returned as blank
    1460              : 
    1461              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1462            6 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1463              :             // Get the HXAssistedCoolingCoil input
    1464            0 :             GetHXAssistedCoolingCoilInput(state);
    1465            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1466              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1467              :         }
    1468              : 
    1469            6 :         int WhichCoil = 0;
    1470            6 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1471            6 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1472              :         }
    1473              : 
    1474            6 :         if (WhichCoil != 0) {
    1475            6 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType;
    1476              :         } else {
    1477            0 :             ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1478            0 :             ErrorsFound = true;
    1479            0 :             return "";
    1480              :         }
    1481              :     }
    1482              : 
    1483           15 :     std::string GetHXDXCoilName(EnergyPlusData &state,
    1484              :                                 std::string_view CoilType,   // must match coil types in this module
    1485              :                                 std::string const &CoilName, // must match coil names for the coil type
    1486              :                                 bool &ErrorsFound            // set to true if problem
    1487              :     )
    1488              :     {
    1489              : 
    1490              :         // FUNCTION INFORMATION:
    1491              :         //       AUTHOR         Linda Lawrie
    1492              :         //       DATE WRITTEN   February 2006
    1493              : 
    1494              :         // PURPOSE OF THIS FUNCTION:
    1495              :         // This function looks up the given coil and returns the cooling coil name.  If
    1496              :         // incorrect coil type or name is given, ErrorsFound is returned as true and the name
    1497              :         // is returned as blank
    1498              : 
    1499              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1500           15 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1501              :             // Get the HXAssistedCoolingCoil input
    1502            0 :             GetHXAssistedCoolingCoilInput(state);
    1503            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1504              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1505              :         }
    1506              : 
    1507           15 :         int WhichCoil = 0;
    1508           15 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1509           15 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1510              :         }
    1511              : 
    1512           15 :         if (WhichCoil != 0) {
    1513           15 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName;
    1514              :         } else {
    1515            0 :             ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1516            0 :             ErrorsFound = true;
    1517            0 :             return "";
    1518              :         }
    1519              :     }
    1520              : 
    1521            0 :     int GetActualDXCoilIndex(EnergyPlusData &state,
    1522              :                              std::string const &CoilType, // must match coil types in this module
    1523              :                              std::string const &CoilName, // must match coil names for the coil type
    1524              :                              bool &ErrorsFound            // set to true if problem
    1525              :     )
    1526              :     {
    1527              : 
    1528              :         // FUNCTION INFORMATION:
    1529              :         //       AUTHOR         Linda Lawrie
    1530              :         //       DATE WRITTEN   February 2006
    1531              : 
    1532              :         // PURPOSE OF THIS FUNCTION:
    1533              :         // This function looks up the given coil and returns the cooling coil name.  If
    1534              :         // incorrect coil type or name is given, ErrorsFound is returned as true and the name
    1535              :         // is returned as blank
    1536              : 
    1537              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1538            0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1539              :             // Get the HXAssistedCoolingCoil input
    1540            0 :             GetHXAssistedCoolingCoilInput(state);
    1541            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1542              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1543              :         }
    1544              : 
    1545            0 :         int WhichCoil = 0;
    1546            0 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1547            0 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1548              :         }
    1549              : 
    1550            0 :         if (WhichCoil != 0) {
    1551              :             // this should be the index to the DX cooling coil object, not the HXAssisted object
    1552            0 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilIndex;
    1553              :         } else {
    1554            0 :             ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1555            0 :             ErrorsFound = true;
    1556            0 :             return 0;
    1557              :         }
    1558              :     }
    1559              : 
    1560            5 :     std::string GetHXCoilType(EnergyPlusData &state,
    1561              :                               std::string const &CoilType, // must match coil types in this module
    1562              :                               std::string const &CoilName, // must match coil names for the coil type
    1563              :                               bool &ErrorsFound            // set to true if problem
    1564              :     )
    1565              :     {
    1566              : 
    1567              :         // FUNCTION INFORMATION:
    1568              :         //       AUTHOR         Fred Buhl
    1569              :         //       DATE WRITTEN   June 2009
    1570              : 
    1571              :         // PURPOSE OF THIS FUNCTION:
    1572              :         // This function looks up the given coil and returns the cooling coil type.  If
    1573              :         // incorrect coil type or name is given, ErrorsFound is returned as true and the cooling
    1574              :         // coil type is returned as blank.
    1575              : 
    1576              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1577            5 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1578              :             // Get the HXAssistedCoolingCoil input
    1579            0 :             GetHXAssistedCoolingCoilInput(state);
    1580            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1581              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1582              :         }
    1583              : 
    1584            5 :         int WhichCoil = 0;
    1585            5 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1586            5 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1587              :         }
    1588              : 
    1589            5 :         if (WhichCoil != 0) {
    1590            5 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType;
    1591              :         } else {
    1592            0 :             ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1593            0 :             ErrorsFound = true;
    1594            0 :             return "";
    1595              :         }
    1596              :     }
    1597              : 
    1598            0 :     void GetHXCoilTypeAndName(EnergyPlusData &state,
    1599              :                               std::string const &CoilType,  // must match coil types in this module
    1600              :                               std::string const &CoilName,  // must match coil names for the coil type
    1601              :                               bool &ErrorsFound,            // set to true if problem
    1602              :                               std::string &CoolingCoilType, // returned type of cooling coil
    1603              :                               std::string &CoolingCoilName  // returned name of cooling coil
    1604              :     )
    1605              :     {
    1606              : 
    1607              :         // SUBROUTINE INFORMATION:
    1608              :         //       AUTHOR         Linda Lawrie
    1609              :         //       DATE WRITTEN   Oct 2011
    1610              : 
    1611              :         // PURPOSE OF THIS SUBROUTINE:
    1612              :         // Need to get child coil type and name.
    1613              : 
    1614              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1615            0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1616              :             // Get the HXAssistedCoolingCoil input
    1617            0 :             GetHXAssistedCoolingCoilInput(state);
    1618            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1619              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1620              :         }
    1621              : 
    1622            0 :         int WhichCoil = 0;
    1623            0 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1624            0 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1625              :         }
    1626              : 
    1627            0 :         if (WhichCoil != 0) {
    1628            0 :             CoolingCoilType = state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType;
    1629            0 :             CoolingCoilName = state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName;
    1630              :         } else {
    1631            0 :             ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1632            0 :             ErrorsFound = true;
    1633            0 :             CoolingCoilType = "";
    1634            0 :             CoolingCoilName = "";
    1635              :         }
    1636            0 :     }
    1637              : 
    1638            0 :     Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state,
    1639              :                                    std::string_view CoilType,   // must match coil types in this module
    1640              :                                    std::string const &CoilName, // must match coil names for the coil type
    1641              :                                    bool &ErrorsFound            // set to true if problem
    1642              :     )
    1643              :     {
    1644              : 
    1645              :         // FUNCTION INFORMATION:
    1646              :         //       AUTHOR         Linda Lawrie
    1647              :         //       DATE WRITTEN   November 2006
    1648              :         //       MODIFIED       R. Raustad, April 2009 - added water coil ELSE IF
    1649              : 
    1650              :         // PURPOSE OF THIS FUNCTION:
    1651              :         // This function looks up the max water flow rate for the given coil and returns it.  If
    1652              :         // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned
    1653              :         // as negative.
    1654              : 
    1655              :         // Return value
    1656              :         Real64 MaxWaterFlowRate; // returned max water flow rate of matched coil
    1657              : 
    1658              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1659            0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1660              :             // Get the HXAssistedCoolingCoil input
    1661            0 :             GetHXAssistedCoolingCoilInput(state);
    1662            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1663              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1664              :         }
    1665              : 
    1666            0 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1667              : 
    1668            0 :             int WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1669              : 
    1670            0 :             if (Util::SameString(CoilType, "CoilSystem:Cooling:DX:HeatExchangerAssisted")) {
    1671            0 :                 if (WhichCoil != 0) {
    1672              :                     // coil does not specify MaxWaterFlowRate
    1673            0 :                     MaxWaterFlowRate = 0.0;
    1674            0 :                     ShowRecurringWarningErrorAtEnd(state,
    1675              :                                                    "Requested Max Water Flow Rate from CoilSystem:Cooling:DX:HeatExchangerAssisted N/A",
    1676            0 :                                                    state.dataHVACAssistedCC->ErrCount2);
    1677              :                 }
    1678            0 :             } else if (Util::SameString(CoilType, "CoilSystem:Cooling:Water:HeatExchangerAssisted")) {
    1679            0 :                 if (WhichCoil != 0) {
    1680              :                     MaxWaterFlowRate =
    1681            0 :                         WaterCoils::GetCoilMaxWaterFlowRate(state, CoilType, GetHXDXCoilName(state, CoilType, CoilName, ErrorsFound), ErrorsFound);
    1682              :                 }
    1683              :             } else {
    1684            0 :                 WhichCoil = 0;
    1685              :             }
    1686              : 
    1687            0 :             if (WhichCoil == 0) {
    1688            0 :                 ShowSevereError(state, format("GetCoilMaxWaterFlowRate: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1689            0 :                 ErrorsFound = true;
    1690            0 :                 MaxWaterFlowRate = -1000.0;
    1691              :             }
    1692              :         } else {
    1693            0 :             ShowSevereError(state, format("GetCoilMaxWaterFlowRate: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1694            0 :             ErrorsFound = true;
    1695            0 :             MaxWaterFlowRate = -1000.0;
    1696              :         }
    1697              : 
    1698            0 :         return MaxWaterFlowRate;
    1699              :     }
    1700              : 
    1701            0 :     Real64 GetHXCoilAirFlowRate(EnergyPlusData &state,
    1702              :                                 std::string const &CoilType, // must match coil types in this module
    1703              :                                 std::string const &CoilName, // must match coil names for the coil type
    1704              :                                 bool &ErrorsFound            // set to true if problem
    1705              :     )
    1706              :     {
    1707              : 
    1708              :         // FUNCTION INFORMATION:
    1709              :         //       AUTHOR         Richard Raustad
    1710              :         //       DATE WRITTEN   September 2013
    1711              : 
    1712              :         // PURPOSE OF THIS FUNCTION:
    1713              :         // This function looks up the max air flow rate for the given HX and returns it.  If
    1714              :         // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned
    1715              :         // as negative.
    1716              : 
    1717              :         // Return value
    1718              :         Real64 MaxAirFlowRate; // returned max air flow rate of matched HX
    1719              : 
    1720              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1721            0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1722              :             // Get the HXAssistedCoolingCoil input
    1723            0 :             GetHXAssistedCoolingCoilInput(state);
    1724            0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1725              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1726              :         }
    1727              : 
    1728            0 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1729              : 
    1730            0 :             int WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1731              : 
    1732            0 :             if (Util::SameString(CoilType, "CoilSystem:Cooling:DX:HeatExchangerAssisted") ||
    1733            0 :                 Util::SameString(CoilType, "CoilSystem:Cooling:Water:HeatExchangerAssisted")) {
    1734            0 :                 if (WhichCoil != 0) {
    1735              :                     MaxAirFlowRate =
    1736            0 :                         HeatRecovery::GetSupplyAirFlowRate(state, state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).HeatExchangerName, ErrorsFound);
    1737              :                 }
    1738              :             } else {
    1739            0 :                 WhichCoil = 0;
    1740              :             }
    1741              : 
    1742            0 :             if (WhichCoil == 0) {
    1743            0 :                 ShowSevereError(state, format("GetHXCoilAirFlowRate: Could not find HX, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1744            0 :                 ErrorsFound = true;
    1745            0 :                 MaxAirFlowRate = -1000.0;
    1746              :             }
    1747              :         } else {
    1748            0 :             ShowSevereError(state, format("GetHXCoilAirFlowRate: Could not find HX, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1749            0 :             ErrorsFound = true;
    1750            0 :             MaxAirFlowRate = -1000.0;
    1751              :         }
    1752              : 
    1753            0 :         return MaxAirFlowRate;
    1754              :     }
    1755              : 
    1756            1 :     bool VerifyHeatExchangerParent(EnergyPlusData &state,
    1757              :                                    std::string const &HXType, // must match coil types in this module
    1758              :                                    std::string const &HXName  // must match coil names for the coil type
    1759              :     )
    1760              :     {
    1761              : 
    1762              :         // FUNCTION INFORMATION:
    1763              :         //       AUTHOR         Lixing Gu
    1764              :         //       DATE WRITTEN   January 2009
    1765              : 
    1766              :         // PURPOSE OF THIS FUNCTION:
    1767              :         // This function looks up the given heat exchanger name and type and returns true or false.
    1768              : 
    1769              :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1770            1 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1771              :             // Get the HXAssistedCoolingCoil input
    1772            1 :             GetHXAssistedCoolingCoilInput(state);
    1773            1 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1774              :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1775              :         }
    1776              : 
    1777            1 :         int WhichCoil = 0;
    1778            1 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1779            1 :             WhichCoil = Util::FindItem(HXName, state.dataHVACAssistedCC->HXAssistedCoil, &HXAssistedCoilParameters::HeatExchangerName);
    1780              :         }
    1781              : 
    1782            1 :         if (WhichCoil != 0) {
    1783            1 :             if (Util::SameString(HVAC::hxTypeNames[(int)state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).hxType], HXType)) {
    1784            1 :                 return true;
    1785              :             }
    1786              :         }
    1787            0 :         return false;
    1788              :     }
    1789              : 
    1790              :     //        End of Utility subroutines for the HXAssistedCoil Module
    1791              :     // *****************************************************************************
    1792              : 
    1793              : } // namespace HVACHXAssistedCoolingCoil
    1794              : 
    1795              : } // namespace EnergyPlus
        

Generated by: LCOV version 2.0-1