LCOV - code coverage report
Current view: top level - EnergyPlus - HVACHXAssistedCoolingCoil.cc (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 412 758 54.4 %
Date: 2024-08-23 23:50:59 Functions: 13 20 65.0 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois,
       2             : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3             : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4             : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5             : // contributors. All rights reserved.
       6             : //
       7             : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8             : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9             : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10             : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11             : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12             : //
      13             : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14             : // provided that the following conditions are met:
      15             : //
      16             : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17             : //     conditions and the following disclaimer.
      18             : //
      19             : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20             : //     conditions and the following disclaimer in the documentation and/or other materials
      21             : //     provided with the distribution.
      22             : //
      23             : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24             : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25             : //     used to endorse or promote products derived from this software without specific prior
      26             : //     written permission.
      27             : //
      28             : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29             : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30             : //     reference solely to the software portion of its product, Licensee must refer to the
      31             : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32             : //     obtained under this License and may not use a different name for the software. Except as
      33             : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34             : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35             : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36             : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37             : //
      38             : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39             : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40             : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41             : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42             : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43             : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44             : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45             : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46             : // POSSIBILITY OF SUCH DAMAGE.
      47             : 
      48             : // 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      400043 :     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      400043 :         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      400043 :         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      400038 :             HXAssistedCoilNum = CompIndex;
     142      400038 :             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      400038 :             if (state.dataHVACAssistedCC->CheckEquipName(HXAssistedCoilNum)) {
     150          10 :                 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          10 :                 state.dataHVACAssistedCC->CheckEquipName(HXAssistedCoilNum) = false;
     158             :             }
     159             :         }
     160             : 
     161             :         // Initialize HXAssistedCoolingCoil Flows
     162      400043 :         InitHXAssistedCoolingCoil(state, HXAssistedCoilNum);
     163             : 
     164      400043 :         if (present(HXUnitEnable)) {
     165      273380 :             HXUnitOn = HXUnitEnable;
     166             :         } else {
     167      126663 :             HXUnitOn = true;
     168             :         }
     169             : 
     170      400043 :         if (compressorOp == HVAC::CompressorOp::Off) {
     171       37853 :             HXUnitOn = false;
     172             :         }
     173             : 
     174             :         // Calculate the HXAssistedCoolingCoil performance and the coil outlet conditions
     175      400043 :         if (present(OnOffAFR)) {
     176      253016 :             AirFlowRatio = OnOffAFR;
     177             :         } else {
     178      147027 :             AirFlowRatio = 1.0;
     179             :         }
     180      445729 :         if (present(DehumidificationMode) && present(LoadSHR) &&
     181       45686 :             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      400043 :             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      400043 :         if (present(QTotOut)) {
     205      126663 :             int InletNodeNum = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).HXAssistedCoilInletNodeNum;
     206      126663 :             int OutletNodeNum = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).HXAssistedCoilOutletNodeNum;
     207      126663 :             Real64 AirMassFlow = state.dataLoopNodes->Node(OutletNodeNum).MassFlowRate;
     208      126663 :             QTotOut = AirMassFlow * (state.dataLoopNodes->Node(InletNodeNum).Enthalpy - state.dataLoopNodes->Node(OutletNodeNum).Enthalpy);
     209             :         }
     210      400043 :     }
     211             : 
     212             :     // Get Input Section of the Module
     213             :     //******************************************************************************
     214             : 
     215          10 :     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          10 :         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          10 :         std::string CurrentModuleObject;  // Object type for getting and error messages
     248          10 :         Array1D_string AlphArray;         // Alpha input items for object
     249          10 :         Array1D_string cAlphaFields;      // Alpha field names
     250          10 :         Array1D_string cNumericFields;    // Numeric field names
     251          10 :         Array1D<Real64> NumArray;         // Numeric input items for object
     252          10 :         Array1D_bool lAlphaBlanks;        // Logical array, alpha field input BLANK = .TRUE.
     253          10 :         Array1D_bool lNumericBlanks;      // Logical array, numeric field input BLANK = .TRUE.
     254          10 :         int TotalArgs(0);                 // Total number of alpha and numeric arguments (max) for a
     255             : 
     256             :         int NumHXAssistedDXCoils =
     257          10 :             state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "CoilSystem:Cooling:DX:HeatExchangerAssisted");
     258             :         int NumHXAssistedWaterCoils =
     259          10 :             state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "CoilSystem:Cooling:Water:HeatExchangerAssisted");
     260          10 :         state.dataHVACAssistedCC->TotalNumHXAssistedCoils = NumHXAssistedDXCoils + NumHXAssistedWaterCoils;
     261          10 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
     262          10 :             state.dataHVACAssistedCC->HXAssistedCoil.allocate(state.dataHVACAssistedCC->TotalNumHXAssistedCoils);
     263          10 :             state.dataHVACAssistedCC->HXAssistedCoilOutletTemp.allocate(state.dataHVACAssistedCC->TotalNumHXAssistedCoils);
     264          10 :             state.dataHVACAssistedCC->HXAssistedCoilOutletHumRat.allocate(state.dataHVACAssistedCC->TotalNumHXAssistedCoils);
     265          10 :             state.dataHVACAssistedCC->CheckEquipName.dimension(state.dataHVACAssistedCC->TotalNumHXAssistedCoils, true);
     266          10 :             state.dataHVACAssistedCC->UniqueHXAssistedCoilNames.reserve(state.dataHVACAssistedCC->TotalNumHXAssistedCoils);
     267             :         }
     268             : 
     269          10 :         state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     270             :             state, "CoilSystem:Cooling:DX:HeatExchangerAssisted", TotalArgs, NumAlphas, NumNums);
     271          10 :         int MaxNums = NumNums;
     272          10 :         int MaxAlphas = NumAlphas;
     273          10 :         state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(
     274             :             state, "CoilSystem:Cooling:Water:HeatExchangerAssisted", TotalArgs, NumAlphas, NumNums);
     275          10 :         MaxNums = max(MaxNums, NumNums);
     276          10 :         MaxAlphas = max(MaxAlphas, NumAlphas);
     277             : 
     278          10 :         AlphArray.allocate(MaxAlphas);
     279          10 :         cAlphaFields.allocate(MaxAlphas);
     280          10 :         cNumericFields.allocate(MaxNums);
     281          10 :         NumArray.dimension(MaxNums, 0.0);
     282          10 :         lAlphaBlanks.dimension(MaxAlphas, true);
     283          10 :         lNumericBlanks.dimension(MaxNums, true);
     284             : 
     285             :         // Get the data for the Coil:DX:CoolingHeatExchangerAssisted objects
     286          10 :         CurrentModuleObject = "CoilSystem:Cooling:DX:HeatExchangerAssisted";
     287             : 
     288          15 :         for (HXAssistedCoilNum = 1; HXAssistedCoilNum <= NumHXAssistedDXCoils; ++HXAssistedCoilNum) {
     289           5 :             auto &thisHXCoil = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum);
     290           5 :             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           5 :             GlobalNames::VerifyUniqueInterObjectName(
     303           5 :                 state, state.dataHVACAssistedCC->UniqueHXAssistedCoilNames, AlphArray(1), CurrentModuleObject, ErrorsFound);
     304             : 
     305           5 :             thisHXCoil.Name = AlphArray(1);
     306           5 :             thisHXCoil.hxType = static_cast<HVAC::HXType>(getEnumValue(HVAC::hxTypeNamesUC, AlphArray(2)));
     307           5 :             thisHXCoil.HeatExchangerName = AlphArray(3);
     308             : 
     309           5 :             thisHXCoil.CoolingCoilType = AlphArray(4);
     310           5 :             thisHXCoil.CoolingCoilName = AlphArray(5);
     311             : 
     312           5 :             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.dataCoilCooingDX->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           4 :             } else if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX:SingleSpeed")) {
     335           3 :                 thisHXCoil.CoolingCoilType_Num = HVAC::CoilDX_CoolingSingleSpeed;
     336           3 :                 thisHXCoil.HXAssistedCoilType = CurrentModuleObject;
     337           3 :                 thisHXCoil.HXAssistedCoilType_Num = HVAC::CoilDX_CoolingHXAssisted;
     338           3 :                 CoolingCoilErrFlag = false;
     339           3 :                 DXCoils::GetDXCoilIndex(
     340           3 :                     state, thisHXCoil.CoolingCoilName, thisHXCoil.CoolingCoilIndex, CoolingCoilErrFlag, thisHXCoil.CoolingCoilType);
     341           3 :                 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           5 :             HXErrFlag = false;
     368           5 :             SupplyAirInletNode = HeatRecovery::GetSupplyInletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag);
     369           5 :             if (HXErrFlag) {
     370           0 :                 ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     371             :             }
     372             : 
     373           5 :             HXErrFlag = false;
     374           5 :             SupplyAirOutletNode = HeatRecovery::GetSupplyOutletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag);
     375           5 :             if (HXErrFlag) {
     376           0 :                 ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     377             :             }
     378             : 
     379           5 :             HXErrFlag = false;
     380           5 :             SecondaryAirInletNode = HeatRecovery::GetSecondaryInletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag);
     381           5 :             if (HXErrFlag) {
     382           0 :                 ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     383             :             }
     384             : 
     385           5 :             HXErrFlag = false;
     386           5 :             SecondaryAirOutletNode = HeatRecovery::GetSecondaryOutletNode(state, thisHXCoil.HeatExchangerName, HXErrFlag);
     387           5 :             if (HXErrFlag) {
     388           0 :                 ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     389             :             }
     390             : 
     391           5 :             if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX")) {
     392           1 :                 CoolingCoilInletNodeNum = state.dataCoilCooingDX->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.dataCoilCooingDX->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           4 :             } else if (Util::SameString(thisHXCoil.CoolingCoilType, "Coil:Cooling:DX:SingleSpeed")) {
     429             :                 //         Check node names in heat exchanger and coil objects for consistency
     430           3 :                 CoolingCoilErrFlag = false;
     431             :                 CoolingCoilInletNodeNum =
     432           3 :                     DXCoils::GetCoilInletNode(state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag);
     433           3 :                 if (CoolingCoilErrFlag) {
     434           0 :                     ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     435             :                 }
     436           3 :                 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           3 :                 CoolingCoilErrFlag = false;
     452             :                 CoolingCoilOutletNodeNum =
     453           3 :                     DXCoils::GetCoilOutletNode(state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag);
     454           3 :                 if (CoolingCoilErrFlag) {
     455           0 :                     ShowContinueError(state, format("...Occurs in {}=\"{}\"", CurrentModuleObject, thisHXCoil.Name));
     456             :                 }
     457           3 :                 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          10 :             BranchNodeConnections::TestCompSet(state,
     524             :                                                thisHXCoil.HXAssistedCoilType,
     525             :                                                thisHXCoil.Name,
     526           5 :                                                state.dataLoopNodes->NodeID(SupplyAirInletNode),
     527           5 :                                                state.dataLoopNodes->NodeID(SecondaryAirOutletNode),
     528             :                                                "Air Nodes");
     529             : 
     530           5 :             thisHXCoil.HXAssistedCoilInletNodeNum =
     531           5 :                 NodeInputManager::GetOnlySingleNode(state,
     532           5 :                                                     state.dataLoopNodes->NodeID(SupplyAirInletNode),
     533             :                                                     ErrorsFound,
     534             :                                                     DataLoopNode::ConnectionObjectType::CoilSystemCoolingDXHeatExchangerAssisted,
     535           5 :                                                     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           5 :             NodeInputManager::GetOnlySingleNode(state,
     542           5 :                                                 state.dataLoopNodes->NodeID(SupplyAirOutletNode),
     543             :                                                 ErrorsFound,
     544             :                                                 DataLoopNode::ConnectionObjectType::CoilSystemCoolingDXHeatExchangerAssisted,
     545           5 :                                                 state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name,
     546             :                                                 DataLoopNode::NodeFluidType::Air,
     547             :                                                 DataLoopNode::ConnectionType::Internal,
     548             :                                                 NodeInputManager::CompFluidStream::Primary,
     549             :                                                 DataLoopNode::ObjectIsParent);
     550           5 :             thisHXCoil.HXExhaustAirInletNodeNum =
     551           5 :                 NodeInputManager::GetOnlySingleNode(state,
     552           5 :                                                     state.dataLoopNodes->NodeID(SecondaryAirInletNode),
     553             :                                                     ErrorsFound,
     554             :                                                     DataLoopNode::ConnectionObjectType::CoilSystemCoolingDXHeatExchangerAssisted,
     555           5 :                                                     thisHXCoil.Name,
     556             :                                                     DataLoopNode::NodeFluidType::Air,
     557             :                                                     DataLoopNode::ConnectionType::Internal,
     558             :                                                     NodeInputManager::CompFluidStream::Primary,
     559             :                                                     DataLoopNode::ObjectIsParent);
     560           5 :             thisHXCoil.HXAssistedCoilOutletNodeNum =
     561           5 :                 NodeInputManager::GetOnlySingleNode(state,
     562           5 :                                                     state.dataLoopNodes->NodeID(SecondaryAirOutletNode),
     563             :                                                     ErrorsFound,
     564             :                                                     DataLoopNode::ConnectionObjectType::CoilSystemCoolingDXHeatExchangerAssisted,
     565           5 :                                                     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          10 :             BranchNodeConnections::SetUpCompSets(state,
     573             :                                                  thisHXCoil.HXAssistedCoilType,
     574             :                                                  thisHXCoil.Name,
     575             :                                                  thisHXCoil.CoolingCoilType,
     576             :                                                  thisHXCoil.CoolingCoilName,
     577           5 :                                                  state.dataLoopNodes->NodeID(SupplyAirOutletNode),
     578           5 :                                                  state.dataLoopNodes->NodeID(SecondaryAirInletNode),
     579             :                                                  "Air Nodes");
     580             :             // Add heat exchanger to component sets array
     581          15 :             BranchNodeConnections::SetUpCompSets(state,
     582             :                                                  thisHXCoil.HXAssistedCoilType,
     583             :                                                  thisHXCoil.Name,
     584           5 :                                                  HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     585             :                                                  thisHXCoil.HeatExchangerName,
     586           5 :                                                  state.dataLoopNodes->NodeID(SupplyAirInletNode),
     587           5 :                                                  state.dataLoopNodes->NodeID(SupplyAirOutletNode),
     588             :                                                  "Process Air Nodes");
     589          15 :             BranchNodeConnections::SetUpCompSets(state,
     590             :                                                  thisHXCoil.HXAssistedCoilType,
     591             :                                                  thisHXCoil.Name,
     592           5 :                                                  HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     593             :                                                  thisHXCoil.HeatExchangerName,
     594           5 :                                                  state.dataLoopNodes->NodeID(SecondaryAirInletNode),
     595           5 :                                                  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          10 :         CurrentModuleObject = "CoilSystem:Cooling:Water:HeatExchangerAssisted";
     602             : 
     603          15 :         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) ShowContinueError(state, format("...occurs in {} \"{}\"", CurrentModuleObject, thisHXCoil.Name));
     681           5 :                 if (SupplyAirOutletNode != CoolingCoilInletNodeNum) {
     682           0 :                     ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name));
     683           0 :                     ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object.");
     684           0 :                     ShowContinueError(state,
     685           0 :                                       format("The supply air outlet node name in heat exchanger = {}=\"{}\"",
     686           0 :                                              HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     687           0 :                                              thisHXCoil.HeatExchangerName));
     688           0 :                     ShowContinueError(
     689             :                         state,
     690           0 :                         format("must match the cooling coil inlet node name in = {}=\"{}\"", thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName));
     691           0 :                     ShowContinueError(state,
     692           0 :                                       format("Heat exchanger supply air outlet node name =\"{}\"", state.dataLoopNodes->NodeID(SupplyAirOutletNode)));
     693           0 :                     ShowContinueError(state,
     694           0 :                                       format("Cooling coil air inlet node name = \"{}\"", state.dataLoopNodes->NodeID(CoolingCoilInletNodeNum)));
     695           0 :                     ErrorsFound = true;
     696             :                 }
     697           5 :                 CoolingCoilErrFlag = false;
     698             :                 CoolingCoilOutletNodeNum =
     699           5 :                     WaterCoils::GetCoilOutletNode(state, thisHXCoil.CoolingCoilType, thisHXCoil.CoolingCoilName, CoolingCoilErrFlag);
     700           5 :                 if (CoolingCoilErrFlag) ShowContinueError(state, format("...occurs in {} \"{}\"", CurrentModuleObject, thisHXCoil.Name));
     701           5 :                 if (SecondaryAirInletNode != CoolingCoilOutletNodeNum) {
     702           0 :                     ShowSevereError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name));
     703           0 :                     ShowContinueError(state, "Node names are inconsistent in heat exchanger and cooling coil object.");
     704           0 :                     ShowContinueError(state,
     705           0 :                                       format("The secondary air inlet node name in heat exchanger = {}=\"{}\"",
     706           0 :                                              HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     707           0 :                                              thisHXCoil.HeatExchangerName));
     708           0 :                     ShowContinueError(state,
     709           0 :                                       format("must match the cooling coil air outlet node name in = {}=\"{}\".",
     710           0 :                                              thisHXCoil.CoolingCoilType,
     711           0 :                                              thisHXCoil.CoolingCoilName));
     712           0 :                     ShowContinueError(
     713           0 :                         state, format("Heat exchanger secondary air inlet node name = \"{}\".", state.dataLoopNodes->NodeID(SecondaryAirInletNode)));
     714           0 :                     ShowContinueError(state,
     715           0 :                                       format("Cooling coil air outlet node name = \"{}\".", state.dataLoopNodes->NodeID(CoolingCoilOutletNodeNum)));
     716           0 :                     ErrorsFound = true;
     717             :                 }
     718             : 
     719             :             } else {
     720           0 :                 ShowWarningError(state, format("{}{}=\"{}\"", RoutineName, CurrentModuleObject, thisHXCoil.Name));
     721           0 :                 ShowContinueError(state, format("Invalid {}=\"{}\"", cAlphaFields(4), thisHXCoil.CoolingCoilType));
     722           0 :                 ErrorsFound = true;
     723             :             }
     724          10 :             BranchNodeConnections::TestCompSet(state,
     725             :                                                thisHXCoil.HXAssistedCoilType,
     726             :                                                thisHXCoil.Name,
     727           5 :                                                state.dataLoopNodes->NodeID(SupplyAirInletNode),
     728           5 :                                                state.dataLoopNodes->NodeID(SecondaryAirOutletNode),
     729             :                                                "Air Nodes");
     730             : 
     731           5 :             thisHXCoil.HXAssistedCoilInletNodeNum =
     732           5 :                 NodeInputManager::GetOnlySingleNode(state,
     733           5 :                                                     state.dataLoopNodes->NodeID(SupplyAirInletNode),
     734             :                                                     ErrorsFound,
     735             :                                                     DataLoopNode::ConnectionObjectType::CoilSystemCoolingWaterHeatExchangerAssisted,
     736           5 :                                                     thisHXCoil.Name,
     737             :                                                     DataLoopNode::NodeFluidType::Air,
     738             :                                                     DataLoopNode::ConnectionType::Inlet,
     739             :                                                     NodeInputManager::CompFluidStream::Primary,
     740             :                                                     DataLoopNode::ObjectIsParent);
     741             :             // no need to capture CoolingCoilInletNodeNum as the return value, it's not used anywhere
     742           5 :             NodeInputManager::GetOnlySingleNode(state,
     743           5 :                                                 state.dataLoopNodes->NodeID(SupplyAirOutletNode),
     744             :                                                 ErrorsFound,
     745             :                                                 DataLoopNode::ConnectionObjectType::CoilSystemCoolingWaterHeatExchangerAssisted,
     746           5 :                                                 state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name,
     747             :                                                 DataLoopNode::NodeFluidType::Air,
     748             :                                                 DataLoopNode::ConnectionType::Internal,
     749             :                                                 NodeInputManager::CompFluidStream::Primary,
     750             :                                                 DataLoopNode::ObjectIsParent);
     751           5 :             thisHXCoil.HXExhaustAirInletNodeNum =
     752           5 :                 NodeInputManager::GetOnlySingleNode(state,
     753           5 :                                                     state.dataLoopNodes->NodeID(SecondaryAirInletNode),
     754             :                                                     ErrorsFound,
     755             :                                                     DataLoopNode::ConnectionObjectType::CoilSystemCoolingWaterHeatExchangerAssisted,
     756           5 :                                                     thisHXCoil.Name,
     757             :                                                     DataLoopNode::NodeFluidType::Air,
     758             :                                                     DataLoopNode::ConnectionType::Internal,
     759             :                                                     NodeInputManager::CompFluidStream::Primary,
     760             :                                                     DataLoopNode::ObjectIsParent);
     761           5 :             thisHXCoil.HXAssistedCoilOutletNodeNum =
     762           5 :                 NodeInputManager::GetOnlySingleNode(state,
     763           5 :                                                     state.dataLoopNodes->NodeID(SecondaryAirOutletNode),
     764             :                                                     ErrorsFound,
     765             :                                                     DataLoopNode::ConnectionObjectType::CoilSystemCoolingWaterHeatExchangerAssisted,
     766           5 :                                                     thisHXCoil.Name,
     767             :                                                     DataLoopNode::NodeFluidType::Air,
     768             :                                                     DataLoopNode::ConnectionType::Outlet,
     769             :                                                     NodeInputManager::CompFluidStream::Primary,
     770             :                                                     DataLoopNode::ObjectIsParent);
     771             : 
     772             :             // Add cooling coil to component sets array
     773          10 :             BranchNodeConnections::SetUpCompSets(state,
     774             :                                                  thisHXCoil.HXAssistedCoilType,
     775             :                                                  thisHXCoil.Name,
     776             :                                                  thisHXCoil.CoolingCoilType,
     777             :                                                  thisHXCoil.CoolingCoilName,
     778           5 :                                                  state.dataLoopNodes->NodeID(SupplyAirOutletNode),
     779           5 :                                                  state.dataLoopNodes->NodeID(SecondaryAirInletNode),
     780             :                                                  "Air Nodes");
     781             :             // Add heat exchanger to component sets array
     782          15 :             BranchNodeConnections::SetUpCompSets(state,
     783             :                                                  thisHXCoil.HXAssistedCoilType,
     784             :                                                  thisHXCoil.Name,
     785           5 :                                                  HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     786             :                                                  thisHXCoil.HeatExchangerName,
     787           5 :                                                  state.dataLoopNodes->NodeID(SupplyAirInletNode),
     788           5 :                                                  state.dataLoopNodes->NodeID(SupplyAirOutletNode),
     789             :                                                  "Process Air Nodes");
     790          15 :             BranchNodeConnections::SetUpCompSets(state,
     791             :                                                  thisHXCoil.HXAssistedCoilType,
     792             :                                                  thisHXCoil.Name,
     793           5 :                                                  HVAC::hxTypeNames[(int)thisHXCoil.hxType],
     794             :                                                  thisHXCoil.HeatExchangerName,
     795           5 :                                                  state.dataLoopNodes->NodeID(SecondaryAirInletNode),
     796           5 :                                                  state.dataLoopNodes->NodeID(SecondaryAirOutletNode),
     797             :                                                  "Secondary Air Nodes");
     798             : 
     799             :         } // End of the Coil:Water:CoolingHXAssisted Loop
     800             : 
     801          10 :         AlphArray.deallocate();
     802          10 :         cAlphaFields.deallocate();
     803          10 :         cNumericFields.deallocate();
     804          10 :         NumArray.deallocate();
     805          10 :         lAlphaBlanks.deallocate();
     806          10 :         lNumericBlanks.deallocate();
     807             : 
     808          10 :         if (ErrorsFound) {
     809           0 :             ShowFatalError(state, format("{}Previous error condition causes termination.", RoutineName));
     810             :         }
     811          10 :     }
     812             : 
     813             :     // End of Get Input subroutines for this Module
     814             :     //******************************************************************************
     815             : 
     816             :     // Beginning Initialization Section of the Module
     817             :     //******************************************************************************
     818             : 
     819      400043 :     void InitHXAssistedCoolingCoil(EnergyPlusData &state, int const HXAssistedCoilNum) // index for HXAssistedCoolingCoil
     820             :     {
     821             : 
     822             :         // SUBROUTINE INFORMATION:
     823             :         //       AUTHOR         Richard Raustad, FSEC
     824             :         //       DATE WRITTEN   Sep 2003
     825             :         //       MODIFIED       R. Raustad, June 2007 now using FullLoadOutletConditions from DX Coil data structure
     826             : 
     827             :         // PURPOSE OF THIS SUBROUTINE:
     828             :         //  This subroutine is for initializations of the HXAssistedCoolingCoil components
     829             : 
     830             :         // METHODOLOGY EMPLOYED:
     831             :         //  Uses the status flags to trigger initializations.
     832             : 
     833             :         // Do these initializations every time
     834      400043 :         auto &thisHXCoil = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum);
     835      400043 :         thisHXCoil.MassFlowRate = state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).MassFlowRate;
     836             : 
     837      400043 :         if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_Cooling) {
     838             :             //
     839             :             // state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex]
     840             :             //     .outletAirDryBulbTemp = 0.0;
     841             :             // state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].outletAirHumRat =
     842             :             //     0.0;
     843      370912 :         } else if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) {
     844      211618 :             state.dataDXCoils->DXCoilFullLoadOutAirTemp(thisHXCoil.CoolingCoilIndex) = 0.0;
     845      211618 :             state.dataDXCoils->DXCoilFullLoadOutAirHumRat(thisHXCoil.CoolingCoilIndex) = 0.0;
     846      159294 :         } else if (thisHXCoil.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) {
     847             :             //
     848             :         }
     849      400043 :     }
     850             : 
     851             :     // End Initialization Section of the Module
     852             :     //******************************************************************************
     853             : 
     854      420941 :     void CalcHXAssistedCoolingCoil(EnergyPlusData &state,
     855             :                                    int const HXAssistedCoilNum,                    // Index number for HXAssistedCoolingCoil
     856             :                                    bool const FirstHVACIteration,                  // FirstHVACIteration flag
     857             :                                    HVAC::CompressorOp const compressorOp,          // compressor operation; 1=on, 0=off
     858             :                                    Real64 const PartLoadRatio,                     // Cooling coil part load ratio
     859             :                                    bool const HXUnitOn,                            // Flag to enable heat exchanger
     860             :                                    HVAC::FanOp const fanOp,                        // Allows parent object to control fan operation
     861             :                                    ObjexxFCL::Optional<Real64 const> OnOffAirFlow, // Ratio of compressor ON air mass flow to AVERAGE over time step
     862             :                                    ObjexxFCL::Optional_bool_const EconomizerFlag,  // OA (or airloop) econommizer status
     863             :                                    ObjexxFCL::Optional<HVAC::CoilMode const> DehumidificationMode, // Optional dehumbidication mode
     864             :                                    [[maybe_unused]] ObjexxFCL::Optional<Real64 const> LoadSHR      // Optional coil SHR pass over
     865             :     )
     866             :     {
     867             : 
     868             :         // SUBROUTINE INFORMATION:
     869             :         //       AUTHOR         Richard Raustad, FSEC
     870             :         //       DATE WRITTEN   Sept 2003
     871             : 
     872             :         // PURPOSE OF THIS SUBROUTINE:
     873             :         //  This subroutine models the cooling coil/air-to-air heat exchanger
     874             :         //  combination. The cooling coil exiting air temperature is used as
     875             :         //  an indicator of convergence.
     876             : 
     877             :         // SUBROUTINE PARAMETER DEFINITIONS:
     878      420941 :         int constexpr MaxIter(50); // Maximum number of iterations
     879             : 
     880             :         int CompanionCoilIndexNum; // Index to DX coil
     881             : 
     882      420941 :         auto &thisHXCoil = state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum);
     883      420941 :         Real64 AirMassFlow = thisHXCoil.MassFlowRate;
     884      420941 :         Real64 Error = 1.0;       // Initialize error (CoilOutputTemp last iteration minus current CoilOutputTemp)
     885      420941 :         Real64 ErrorLast = Error; // initialize variable used to test loop termination
     886      420941 :         int Iter = 0;             // Initialize iteration counter to zero
     887             : 
     888             :         // Set mass flow rate at inlet of exhaust side of heat exchanger to supply side air mass flow rate entering this compound object
     889      420941 :         state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).MassFlowRate = AirMassFlow;
     890             : 
     891      420941 :         if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_Cooling || thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed ||
     892      180192 :             thisHXCoil.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) {
     893      294278 :             CompanionCoilIndexNum = thisHXCoil.CoolingCoilIndex;
     894             :         } else {
     895      126663 :             CompanionCoilIndexNum = 0;
     896             :         }
     897             : 
     898             :         // First call to RegulaFalsi uses PLR=0. Nodes are typically setup at full output on this call.
     899             :         // A large number of iterations are required to get to result (~36 iterations to get to PLR=0 node conditions).
     900             :         // Reset node data to minimize iteration. This initialization reduces the number of iterations by 50%.
     901             :         // CAUTION: Do not use Node(x) = Node(y) here, this can overwrite the coil outlet node setpoint.
     902      420941 :         if (PartLoadRatio == 0.0) {
     903      285771 :             state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).Temp =
     904      285771 :                 state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).Temp;
     905      285771 :             state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).HumRat =
     906      285771 :                 state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).HumRat;
     907      285771 :             state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).Enthalpy =
     908      285771 :                 state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).Enthalpy;
     909      285771 :             state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).MassFlowRate =
     910      285771 :                 state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilInletNodeNum).MassFlowRate;
     911             :         }
     912             : 
     913             :         // Force at least 2 iterations to pass outlet node information
     914     1615599 :         while ((std::abs(Error) > 0.0005 && Iter <= MaxIter) || Iter < 2) {
     915             : 
     916     2389316 :             HeatRecovery::SimHeatRecovery(state,
     917             :                                           thisHXCoil.HeatExchangerName,
     918             :                                           FirstHVACIteration,
     919     1194658 :                                           thisHXCoil.HeatExchangerIndex,
     920             :                                           fanOp,
     921             :                                           PartLoadRatio,
     922             :                                           HXUnitOn,
     923             :                                           CompanionCoilIndexNum,
     924             :                                           _,
     925             :                                           EconomizerFlag,
     926             :                                           _,
     927     1194658 :                                           thisHXCoil.CoolingCoilType_Num);
     928             : 
     929     1194658 :             if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_Cooling) {
     930             : 
     931       58569 :                 int coolingCoilIndex = thisHXCoil.CoolingCoilIndex;
     932             : 
     933       58569 :                 int mSingleMode = state.dataCoilCooingDX->coilCoolingDXs[coolingCoilIndex].getNumModes();
     934       58569 :                 bool singleMode = (mSingleMode == 1);
     935             : 
     936       58569 :                 Real64 mCoolingSpeedNum = state.dataCoilCooingDX->coilCoolingDXs[coolingCoilIndex]
     937       58569 :                                               .performance.normalMode.speeds.size(); // used the same for the original variable speed coil
     938             : 
     939       58569 :                 HVAC::CoilMode coilMode = HVAC::CoilMode::Normal;
     940       58569 :                 if (state.dataCoilCooingDX->coilCoolingDXs[coolingCoilIndex].SubcoolReheatFlag) {
     941           0 :                     coilMode = HVAC::CoilMode::SubcoolReheat;
     942       58569 :                 } else if (DehumidificationMode == HVAC::CoilMode::Enhanced) {
     943           0 :                     coilMode = HVAC::CoilMode::Enhanced;
     944             :                 }
     945             : 
     946       58569 :                 Real64 mCoolingSpeedRatio = 0.0; // used same setting as the original variable speed coil
     947       58569 :                 Real64 mCoolCompPartLoadRatio = (compressorOp == HVAC::CompressorOp::On) ? 1.0 : 0.0;
     948             : 
     949             :                 Real64 CoilPLR;
     950       58569 :                 if (mCoolingSpeedNum > 1) {
     951           0 :                     if (mSingleMode == 0) {
     952           0 :                         mCoolCompPartLoadRatio = (compressorOp == HVAC::CompressorOp::On) ? 1.0 : 0.0;
     953             :                     } else {
     954           0 :                         mCoolCompPartLoadRatio = PartLoadRatio * ((compressorOp == HVAC::CompressorOp::On) ? 1.0 : 0.0);
     955           0 :                         mCoolingSpeedRatio = 1.0;
     956             :                     }
     957           0 :                     CoilPLR = 1.0;
     958             :                 } else {
     959       58569 :                     mCoolingSpeedRatio = 1.0;
     960       58569 :                     CoilPLR = PartLoadRatio * ((compressorOp == HVAC::CompressorOp::On) ? 1.0 : 0.0);
     961             :                 }
     962             : 
     963       58569 :                 state.dataCoilCooingDX->coilCoolingDXs[thisHXCoil.CoolingCoilIndex].simulate(state,
     964             :                                                                                              coilMode, // partially implemented for HXAssistedCoil
     965             :                                                                                              CoilPLR,  // PartLoadRatio,
     966             :                                                                                              mCoolingSpeedNum,
     967             :                                                                                              mCoolingSpeedRatio,
     968             :                                                                                              fanOp,
     969             :                                                                                              singleMode); //
     970             : 
     971     1136089 :             } else if (thisHXCoil.CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) {
     972      893980 :                 DXCoils::SimDXCoil(state,
     973             :                                    thisHXCoil.CoolingCoilName,
     974             :                                    compressorOp,
     975             :                                    FirstHVACIteration,
     976      446990 :                                    thisHXCoil.CoolingCoilIndex,
     977             :                                    fanOp,
     978             :                                    PartLoadRatio,
     979             :                                    OnOffAirFlow);
     980      689099 :             } else if (thisHXCoil.CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) {
     981      198279 :                 Real64 QZnReq(-1.0);           // Zone load (W), input to variable-speed DX coil
     982      198279 :                 Real64 QLatReq(0.0);           // Zone latent load, input to variable-speed DX coil
     983      198279 :                 Real64 OnOffAirFlowRatio(1.0); // ratio of compressor on flow to average flow over time step
     984      198279 :                 HVAC::CompressorOp compressorOn = compressorOp;
     985      198279 :                 if (PartLoadRatio == 0.0) compressorOn = HVAC::CompressorOp::Off;
     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      490820 :                 WaterCoils::SimulateWaterCoilComponents(state, thisHXCoil.CoolingCoilName, FirstHVACIteration, thisHXCoil.CoolingCoilIndex);
     998             :             }
     999             : 
    1000     1194658 :             Error = state.dataHVACAssistedCC->CoilOutputTempLast - state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).Temp;
    1001     1194658 :             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     1194658 :             ErrorLast = Error;
    1006     1194658 :             state.dataHVACAssistedCC->CoilOutputTempLast = state.dataLoopNodes->Node(thisHXCoil.HXExhaustAirInletNodeNum).Temp;
    1007     1194658 :             ++Iter;
    1008             :         }
    1009             : 
    1010             :         // Write excessive iteration warning messages
    1011      420941 :         if (Iter > MaxIter) {
    1012          18 :             if (thisHXCoil.MaxIterCounter < 1) {
    1013           1 :                 ++thisHXCoil.MaxIterCounter;
    1014           2 :                 ShowWarningError(state,
    1015           2 :                                  format("{} \"{}\" -- Exceeded max iterations ({}) while calculating operating conditions.",
    1016           1 :                                         thisHXCoil.HXAssistedCoilType,
    1017           1 :                                         thisHXCoil.Name,
    1018             :                                         MaxIter));
    1019           1 :                 ShowContinueErrorTimeStamp(state, "");
    1020             :             } else {
    1021          51 :                 ShowRecurringWarningErrorAtEnd(state,
    1022          34 :                                                thisHXCoil.HXAssistedCoilType + " \"" + thisHXCoil.Name +
    1023             :                                                    "\" -- Exceeded max iterations error continues...",
    1024          17 :                                                thisHXCoil.MaxIterIndex);
    1025             :             }
    1026             :         }
    1027             : 
    1028      420941 :         state.dataHVACAssistedCC->HXAssistedCoilOutletTemp(HXAssistedCoilNum) =
    1029      420941 :             state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilOutletNodeNum).Temp;
    1030      420941 :         state.dataHVACAssistedCC->HXAssistedCoilOutletHumRat(HXAssistedCoilNum) =
    1031      420941 :             state.dataLoopNodes->Node(thisHXCoil.HXAssistedCoilOutletNodeNum).HumRat;
    1032      420941 :     }
    1033             : 
    1034             :     //        End of Reporting subroutines for the HXAssistedCoil Module
    1035             :     // *****************************************************************************
    1036             : 
    1037           5 :     void GetHXDXCoilIndex(
    1038             :         EnergyPlusData &state, std::string const &HXDXCoilName, int &HXDXCoilIndex, bool &ErrorsFound, std::string_view const CurrentModuleObject)
    1039             :     {
    1040             : 
    1041             :         // SUBROUTINE INFORMATION:
    1042             :         //       AUTHOR         Richard Raustad
    1043             :         //       DATE WRITTEN   August 2007
    1044             : 
    1045             :         // PURPOSE OF THIS SUBROUTINE:
    1046             :         // This subroutine sets an index for a given HX Assisted Cooling Coil -- issues error message if that
    1047             :         // HX is not a legal HX Assisted Cooling Coil.
    1048             : 
    1049             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1050           5 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1051             :             // Get the HXAssistedCoolingCoil input
    1052           0 :             GetHXAssistedCoolingCoilInput(state);
    1053           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1054             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1055             :         }
    1056             : 
    1057           5 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1058           5 :             HXDXCoilIndex = Util::FindItem(HXDXCoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1059             :         } else {
    1060           0 :             HXDXCoilIndex = 0;
    1061             :         }
    1062             : 
    1063           5 :         if (HXDXCoilIndex == 0) {
    1064           0 :             if (!CurrentModuleObject.empty()) {
    1065           0 :                 ShowSevereError(state, fmt::format("{}, GetHXDXCoilIndex: HX Assisted Cooling Coil not found={}", CurrentModuleObject, HXDXCoilName));
    1066             :             } else {
    1067           0 :                 ShowSevereError(state, format("GetHXDXCoilIndex: HX Assisted Cooling Coil not found={}", HXDXCoilName));
    1068             :             }
    1069           0 :             ErrorsFound = true;
    1070             :         }
    1071           5 :     }
    1072             : 
    1073           0 :     void CheckHXAssistedCoolingCoilSchedule(EnergyPlusData &state,
    1074             :                                             [[maybe_unused]] std::string const &CompType, // unused1208
    1075             :                                             std::string_view CompName,
    1076             :                                             Real64 &Value,
    1077             :                                             int &CompIndex)
    1078             :     {
    1079             : 
    1080             :         // SUBROUTINE INFORMATION:
    1081             :         //       AUTHOR         Linda Lawrie
    1082             :         //       DATE WRITTEN   October 2005
    1083             : 
    1084             :         // PURPOSE OF THIS SUBROUTINE:
    1085             :         // This routine provides a method for outside routines to check if
    1086             :         // the hx assisted cooling coil is scheduled to be on.
    1087             : 
    1088             :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    1089             :         int HXAssistedCoilNum;
    1090             : 
    1091             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1092           0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1093             :             // Get the HXAssistedCoolingCoil input
    1094           0 :             GetHXAssistedCoolingCoilInput(state);
    1095           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1096             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1097             :         }
    1098             : 
    1099             :         // Find the correct Coil number
    1100           0 :         if (CompIndex == 0) {
    1101           0 :             if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1102           0 :                 HXAssistedCoilNum = Util::FindItem(CompName, state.dataHVACAssistedCC->HXAssistedCoil);
    1103             :             } else {
    1104           0 :                 HXAssistedCoilNum = 0;
    1105             :             }
    1106             : 
    1107           0 :             if (HXAssistedCoilNum == 0) {
    1108           0 :                 ShowFatalError(state, format("CheckHXAssistedCoolingCoilSchedule: HX Assisted Coil not found={}", CompName));
    1109             :             }
    1110           0 :             CompIndex = HXAssistedCoilNum;
    1111           0 :             Value = 1.0; // not scheduled?
    1112             :         } else {
    1113           0 :             HXAssistedCoilNum = CompIndex;
    1114           0 :             if (HXAssistedCoilNum > state.dataHVACAssistedCC->TotalNumHXAssistedCoils || HXAssistedCoilNum < 1) {
    1115           0 :                 ShowFatalError(state,
    1116           0 :                                format("CheckHXAssistedCoolingCoilSchedule: Invalid CompIndex passed={}, Number of Heating Coils={}, Coil name={}",
    1117             :                                       HXAssistedCoilNum,
    1118           0 :                                       state.dataHVACAssistedCC->TotalNumHXAssistedCoils,
    1119             :                                       CompName));
    1120             :             }
    1121           0 :             if (CompName != state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name) {
    1122           0 :                 ShowFatalError(
    1123             :                     state,
    1124           0 :                     format("CheckHXAssistedCoolingCoilSchedule: Invalid CompIndex passed={}, Coil name={}, stored Coil Name for that index={}",
    1125             :                            HXAssistedCoilNum,
    1126             :                            CompName,
    1127           0 :                            state.dataHVACAssistedCC->HXAssistedCoil(HXAssistedCoilNum).Name));
    1128             :             }
    1129             : 
    1130           0 :             Value = 1.0; // not scheduled?
    1131             :         }
    1132           0 :     }
    1133             : 
    1134           5 :     Real64 GetCoilCapacity(EnergyPlusData &state,
    1135             :                            std::string const &CoilType, // must match coil types in this module
    1136             :                            std::string const &CoilName, // must match coil names for the coil type
    1137             :                            bool &ErrorsFound            // set to true if problem
    1138             :     )
    1139             :     {
    1140             : 
    1141             :         // FUNCTION INFORMATION:
    1142             :         //       AUTHOR         Linda Lawrie
    1143             :         //       DATE WRITTEN   February 2006
    1144             : 
    1145             :         // PURPOSE OF THIS FUNCTION:
    1146             :         // This function looks up the coil capacity for the given coil and returns it.  If
    1147             :         // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned
    1148             :         // as negative.
    1149             : 
    1150             :         // Return value
    1151           5 :         Real64 CoilCapacity(0.0); // returned capacity of matched coil
    1152             : 
    1153             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1154           5 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1155             :             // Get the HXAssistedCoolingCoil input
    1156           0 :             GetHXAssistedCoolingCoilInput(state);
    1157           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1158             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1159             :         }
    1160             : 
    1161           5 :         bool errFlag = false;
    1162             : 
    1163           5 :         int WhichCoil = 0;
    1164           5 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1165           5 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1166             :         }
    1167             : 
    1168           5 :         if (Util::SameString(CoilType, "CoilSystem:Cooling:DX:HeatExchangerAssisted")) {
    1169           5 :             if (WhichCoil != 0) {
    1170             :                 // coil does not have capacity in input so mine information from DX cooling coil
    1171             : 
    1172           5 :                 if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::CoilDX_Cooling) {
    1173           1 :                     int coolingCoilDXIndex = state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilIndex;
    1174           1 :                     CoilCapacity = state.dataCoilCooingDX->coilCoolingDXs[coolingCoilDXIndex].performance.normalMode.ratedGrossTotalCap;
    1175           4 :                 } else if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::CoilDX_CoolingSingleSpeed) {
    1176           3 :                     CoilCapacity = DXCoils::GetCoilCapacity(state,
    1177           3 :                                                             state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType,
    1178           3 :                                                             state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName,
    1179             :                                                             errFlag);
    1180           1 :                 } else if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::Coil_CoolingAirToAirVariableSpeed) {
    1181             :                     CoilCapacity =
    1182           1 :                         VariableSpeedCoils::GetCoilCapacityVariableSpeed(state,
    1183           1 :                                                                          state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType,
    1184           1 :                                                                          state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName,
    1185             :                                                                          errFlag);
    1186             :                 }
    1187           5 :                 if (errFlag) {
    1188           0 :                     ShowRecurringWarningErrorAtEnd(
    1189           0 :                         state, "Requested DX Coil from CoilSystem:Cooling:DX:HeatExchangerAssisted not found", state.dataHVACAssistedCC->ErrCount);
    1190             :                 }
    1191             :             }
    1192           0 :         } else if (Util::SameString(CoilType, "CoilSystem:Cooling:Water:HeatExchangerAssisted")) {
    1193           0 :             if (WhichCoil != 0) {
    1194             :                 // coil does not have capacity in input so mine information from DX cooling coil
    1195           0 :                 CoilCapacity = WaterCoils::GetWaterCoilCapacity(state,
    1196           0 :                                                                 state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType,
    1197           0 :                                                                 state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName,
    1198             :                                                                 errFlag);
    1199           0 :                 if (errFlag) {
    1200           0 :                     ShowRecurringWarningErrorAtEnd(
    1201           0 :                         state, "Requested DX Coil from CoilSystem:Cooling:DX:HeatExchangerAssisted not found", state.dataHVACAssistedCC->ErrCount);
    1202             :                 }
    1203             :             }
    1204             :         } else {
    1205           0 :             WhichCoil = 0;
    1206             :         }
    1207             : 
    1208           5 :         if (WhichCoil == 0) {
    1209           0 :             ShowSevereError(state, format("GetCoilCapacity: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1210           0 :             ShowContinueError(state, "... Coil Capacity returned as -1000.");
    1211           0 :             ErrorsFound = true;
    1212           0 :             CoilCapacity = -1000.0;
    1213             :         }
    1214             : 
    1215           5 :         if (errFlag) ErrorsFound = true;
    1216             : 
    1217           5 :         return CoilCapacity;
    1218             :     }
    1219             : 
    1220           5 :     int GetCoilGroupTypeNum(EnergyPlusData &state,
    1221             :                             std::string const &CoilType, // must match coil types in this module
    1222             :                             std::string const &CoilName, // must match coil names for the coil type
    1223             :                             bool &ErrorsFound,           // set to true if problem
    1224             :                             bool const PrintWarning      // prints warning message if true
    1225             :     )
    1226             :     {
    1227             : 
    1228             :         // FUNCTION INFORMATION:
    1229             :         //       AUTHOR         R. Raustad - FSEC
    1230             :         //       DATE WRITTEN   August 2008
    1231             : 
    1232             :         // PURPOSE OF THIS FUNCTION:
    1233             :         // This function looks up the HX coil type and returns it (CoilDX_CoolingHXAssisted, CoilWater_CoolingHXAssisted)
    1234             :         // If incorrect coil type or name is given, ErrorsFound is returned as true.
    1235             : 
    1236             :         // FUNCTION LOCAL VARIABLE DECLARATIONS:
    1237             :         int WhichCoil;
    1238             : 
    1239             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1240           5 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1241             :             // Get the HXAssistedCoolingCoil input
    1242           4 :             GetHXAssistedCoolingCoilInput(state);
    1243           4 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1244             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1245             :         }
    1246             : 
    1247           5 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1248           5 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1249             :         } else {
    1250           0 :             WhichCoil = 0;
    1251             :         }
    1252             : 
    1253           5 :         if (WhichCoil != 0) {
    1254             :             // coil does not have capacity in input so mine information from DX cooling coil
    1255           5 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).HXAssistedCoilType_Num;
    1256             :         } else {
    1257           0 :             if (PrintWarning) {
    1258           0 :                 ShowSevereError(state, format("GetCoilGroupTypeNum: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1259             :             }
    1260           0 :             ErrorsFound = true;
    1261           0 :             return 0;
    1262             :         }
    1263             :     }
    1264             : 
    1265           0 :     int GetCoilObjectTypeNum(EnergyPlusData &state,
    1266             :                              std::string const &CoilType, // must match coil types in this module
    1267             :                              std::string const &CoilName, // must match coil names for the coil type
    1268             :                              bool &ErrorsFound,           // set to true if problem
    1269             :                              bool const PrintWarning      // prints warning message if true
    1270             :     )
    1271             :     {
    1272             : 
    1273             :         // FUNCTION INFORMATION:
    1274             :         //       AUTHOR         R. Raustad - FSEC
    1275             :         //       DATE WRITTEN   April 2009
    1276             : 
    1277             :         // PURPOSE OF THIS FUNCTION:
    1278             :         // This function looks up the coil object type for the given coil and returns it.  If
    1279             :         // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned
    1280             :         // as negative.
    1281             : 
    1282             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1283           0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1284             :             // Get the HXAssistedCoolingCoil input
    1285           0 :             GetHXAssistedCoolingCoilInput(state);
    1286           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1287             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1288             :         }
    1289             : 
    1290           0 :         int WhichCoil = 0;
    1291           0 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1292           0 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1293             :         }
    1294             : 
    1295           0 :         if (WhichCoil != 0) {
    1296           0 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num;
    1297             :         } else {
    1298           0 :             if (PrintWarning) {
    1299           0 :                 ShowSevereError(state, format("GetCoilObjectTypeNum: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1300             :             }
    1301           0 :             ErrorsFound = true;
    1302           0 :             return 0;
    1303             :         }
    1304             :     }
    1305             : 
    1306           5 :     int GetCoilInletNode(EnergyPlusData &state,
    1307             :                          std::string_view CoilType,   // must match coil types in this module
    1308             :                          std::string const &CoilName, // must match coil names for the coil type
    1309             :                          bool &ErrorsFound            // set to true if problem
    1310             :     )
    1311             :     {
    1312             : 
    1313             :         // FUNCTION INFORMATION:
    1314             :         //       AUTHOR         Linda Lawrie
    1315             :         //       DATE WRITTEN   February 2006
    1316             : 
    1317             :         // PURPOSE OF THIS FUNCTION:
    1318             :         // This function looks up the given coil and returns the inlet node number.  If
    1319             :         // incorrect coil type or name is given, ErrorsFound is returned as true and node number is returned
    1320             :         // as zero.
    1321             : 
    1322             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1323           5 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1324             :             // Get the HXAssistedCoolingCoil input
    1325           0 :             GetHXAssistedCoolingCoilInput(state);
    1326           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1327             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1328             :         }
    1329             : 
    1330           5 :         int WhichCoil = 0;
    1331           5 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1332           5 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1333             :         }
    1334             : 
    1335           5 :         if (WhichCoil != 0) {
    1336           5 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).HXAssistedCoilInletNodeNum;
    1337             :         } else {
    1338           0 :             ShowSevereError(state, format("GetCoilInletNode: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1339           0 :             ErrorsFound = true;
    1340           0 :             return 0;
    1341             :         }
    1342             :     }
    1343             : 
    1344           0 :     int GetCoilWaterInletNode(EnergyPlusData &state,
    1345             :                               std::string const &CoilType, // must match coil types in this module
    1346             :                               std::string const &CoilName, // must match coil names for the coil type
    1347             :                               bool &ErrorsFound            // set to true if problem
    1348             :     )
    1349             :     {
    1350             : 
    1351             :         // FUNCTION INFORMATION:
    1352             :         //       AUTHOR         Linda Lawrie
    1353             :         //       DATE WRITTEN   April 2011
    1354             : 
    1355             :         // PURPOSE OF THIS FUNCTION:
    1356             :         // This function looks up the given coil and returns the inlet node number.  If
    1357             :         // incorrect coil type or name is given, ErrorsFound is returned as true and node number is returned
    1358             :         // as zero.
    1359             : 
    1360             :         // Return value
    1361             :         int NodeNumber; // returned node number of matched coil
    1362             : 
    1363             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1364           0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1365             :             // Get the HXAssistedCoolingCoil input
    1366           0 :             GetHXAssistedCoolingCoilInput(state);
    1367           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1368             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1369             :         }
    1370             : 
    1371           0 :         int WhichCoil = 0;
    1372           0 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1373           0 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1374             :         }
    1375             : 
    1376           0 :         if (WhichCoil != 0) {
    1377           0 :             if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::Coil_CoolingWater) {
    1378           0 :                 NodeNumber = WaterCoils::GetCoilWaterInletNode(state,
    1379           0 :                                                                state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType,
    1380           0 :                                                                state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName,
    1381             :                                                                ErrorsFound);
    1382           0 :             } else if (state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType_Num == HVAC::Coil_CoolingWaterDetailed) {
    1383           0 :                 NodeNumber = WaterCoils::GetCoilWaterInletNode(state,
    1384           0 :                                                                state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType,
    1385           0 :                                                                state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName,
    1386             :                                                                ErrorsFound);
    1387             :             } else { // even though validated in Get, still check.
    1388           0 :                 ShowSevereError(state,
    1389           0 :                                 format("GetCoilWaterInletNode: Invalid Cooling Coil for HX Assisted Coil, Type=\"{}\" Name=\"{}\"",
    1390           0 :                                        state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType,
    1391             :                                        CoilName));
    1392           0 :                 ErrorsFound = true;
    1393           0 :                 NodeNumber = 0; // Autodesk:Return Added line to set return value
    1394             :             }
    1395             :         } else {
    1396           0 :             ShowSevereError(state, format("GetCoilInletNode: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1397           0 :             ErrorsFound = true;
    1398           0 :             NodeNumber = 0;
    1399             :         }
    1400             : 
    1401           0 :         return NodeNumber;
    1402             :     }
    1403             : 
    1404           5 :     int GetCoilOutletNode(EnergyPlusData &state,
    1405             :                           std::string_view CoilType,   // must match coil types in this module
    1406             :                           std::string const &CoilName, // must match coil names for the coil type
    1407             :                           bool &ErrorsFound            // set to true if problem
    1408             :     )
    1409             :     {
    1410             : 
    1411             :         // FUNCTION INFORMATION:
    1412             :         //       AUTHOR         R. Raustad
    1413             :         //       DATE WRITTEN   August 2006
    1414             : 
    1415             :         // PURPOSE OF THIS FUNCTION:
    1416             :         // This function looks up the given coil and returns the outlet node number.  If
    1417             :         // incorrect coil type or name is given, ErrorsFound is returned as true and node number is returned
    1418             :         // as zero.
    1419             : 
    1420             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1421           5 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1422             :             // Get the HXAssistedCoolingCoil input
    1423           0 :             GetHXAssistedCoolingCoilInput(state);
    1424           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1425             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1426             :         }
    1427             : 
    1428           5 :         int WhichCoil = 0;
    1429           5 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1430           5 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1431             :         }
    1432             : 
    1433           5 :         if (WhichCoil != 0) {
    1434           5 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).HXAssistedCoilOutletNodeNum;
    1435             :         } else {
    1436           0 :             ShowSevereError(state, format("GetCoilOutletNode: Could not find Coil, Type=\"{}\" Name=\"{}", CoilType, CoilName));
    1437           0 :             ErrorsFound = true;
    1438           0 :             return 0;
    1439             :         }
    1440             :     }
    1441             : 
    1442           5 :     std::string GetHXDXCoilType(EnergyPlusData &state,
    1443             :                                 std::string const &CoilType, // must match coil types in this module
    1444             :                                 std::string const &CoilName, // must match coil names for the coil type
    1445             :                                 bool &ErrorsFound            // set to true if problem
    1446             :     )
    1447             :     {
    1448             : 
    1449             :         // FUNCTION INFORMATION:
    1450             :         //       AUTHOR         R. Raustad, FSEC
    1451             :         //       DATE WRITTEN   September 2015
    1452             : 
    1453             :         // PURPOSE OF THIS FUNCTION:
    1454             :         // This function looks up the given coil and returns the cooling coil type.  If
    1455             :         // incorrect coil type or name is given, ErrorsFound is returned as true and the name
    1456             :         // is returned as blank
    1457             : 
    1458             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1459           5 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1460             :             // Get the HXAssistedCoolingCoil input
    1461           0 :             GetHXAssistedCoolingCoilInput(state);
    1462           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1463             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1464             :         }
    1465             : 
    1466           5 :         int WhichCoil = 0;
    1467           5 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1468           5 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1469             :         }
    1470             : 
    1471           5 :         if (WhichCoil != 0) {
    1472           5 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType;
    1473             :         } else {
    1474           0 :             ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1475           0 :             ErrorsFound = true;
    1476           0 :             return "";
    1477             :         }
    1478             :     }
    1479             : 
    1480          13 :     std::string GetHXDXCoilName(EnergyPlusData &state,
    1481             :                                 std::string_view CoilType,   // must match coil types in this module
    1482             :                                 std::string const &CoilName, // must match coil names for the coil type
    1483             :                                 bool &ErrorsFound            // set to true if problem
    1484             :     )
    1485             :     {
    1486             : 
    1487             :         // FUNCTION INFORMATION:
    1488             :         //       AUTHOR         Linda Lawrie
    1489             :         //       DATE WRITTEN   February 2006
    1490             : 
    1491             :         // PURPOSE OF THIS FUNCTION:
    1492             :         // This function looks up the given coil and returns the cooling coil name.  If
    1493             :         // incorrect coil type or name is given, ErrorsFound is returned as true and the name
    1494             :         // is returned as blank
    1495             : 
    1496             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1497          13 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1498             :             // Get the HXAssistedCoolingCoil input
    1499           0 :             GetHXAssistedCoolingCoilInput(state);
    1500           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1501             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1502             :         }
    1503             : 
    1504          13 :         int WhichCoil = 0;
    1505          13 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1506          13 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1507             :         }
    1508             : 
    1509          13 :         if (WhichCoil != 0) {
    1510          13 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName;
    1511             :         } else {
    1512           0 :             ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1513           0 :             ErrorsFound = true;
    1514           0 :             return "";
    1515             :         }
    1516             :     }
    1517             : 
    1518           0 :     int GetActualDXCoilIndex(EnergyPlusData &state,
    1519             :                              std::string const &CoilType, // must match coil types in this module
    1520             :                              std::string const &CoilName, // must match coil names for the coil type
    1521             :                              bool &ErrorsFound            // set to true if problem
    1522             :     )
    1523             :     {
    1524             : 
    1525             :         // FUNCTION INFORMATION:
    1526             :         //       AUTHOR         Linda Lawrie
    1527             :         //       DATE WRITTEN   February 2006
    1528             : 
    1529             :         // PURPOSE OF THIS FUNCTION:
    1530             :         // This function looks up the given coil and returns the cooling coil name.  If
    1531             :         // incorrect coil type or name is given, ErrorsFound is returned as true and the name
    1532             :         // is returned as blank
    1533             : 
    1534             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1535           0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1536             :             // Get the HXAssistedCoolingCoil input
    1537           0 :             GetHXAssistedCoolingCoilInput(state);
    1538           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1539             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1540             :         }
    1541             : 
    1542           0 :         int WhichCoil = 0;
    1543           0 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1544           0 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1545             :         }
    1546             : 
    1547           0 :         if (WhichCoil != 0) {
    1548             :             // this should be the index to the DX cooling coil object, not the HXAssisted object
    1549           0 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilIndex;
    1550             :         } else {
    1551           0 :             ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1552           0 :             ErrorsFound = true;
    1553           0 :             return 0;
    1554             :         }
    1555             :     }
    1556             : 
    1557           5 :     std::string GetHXCoilType(EnergyPlusData &state,
    1558             :                               std::string const &CoilType, // must match coil types in this module
    1559             :                               std::string const &CoilName, // must match coil names for the coil type
    1560             :                               bool &ErrorsFound            // set to true if problem
    1561             :     )
    1562             :     {
    1563             : 
    1564             :         // FUNCTION INFORMATION:
    1565             :         //       AUTHOR         Fred Buhl
    1566             :         //       DATE WRITTEN   June 2009
    1567             : 
    1568             :         // PURPOSE OF THIS FUNCTION:
    1569             :         // This function looks up the given coil and returns the cooling coil type.  If
    1570             :         // incorrect coil type or name is given, ErrorsFound is returned as true and the cooling
    1571             :         // coil type is returned as blank.
    1572             : 
    1573             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1574           5 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1575             :             // Get the HXAssistedCoolingCoil input
    1576           0 :             GetHXAssistedCoolingCoilInput(state);
    1577           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1578             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1579             :         }
    1580             : 
    1581           5 :         int WhichCoil = 0;
    1582           5 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1583           5 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1584             :         }
    1585             : 
    1586           5 :         if (WhichCoil != 0) {
    1587           5 :             return state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType;
    1588             :         } else {
    1589           0 :             ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1590           0 :             ErrorsFound = true;
    1591           0 :             return "";
    1592             :         }
    1593             :     }
    1594             : 
    1595           0 :     void GetHXCoilTypeAndName(EnergyPlusData &state,
    1596             :                               std::string const &CoilType,  // must match coil types in this module
    1597             :                               std::string const &CoilName,  // must match coil names for the coil type
    1598             :                               bool &ErrorsFound,            // set to true if problem
    1599             :                               std::string &CoolingCoilType, // returned type of cooling coil
    1600             :                               std::string &CoolingCoilName  // returned name of cooling coil
    1601             :     )
    1602             :     {
    1603             : 
    1604             :         // SUBROUTINE INFORMATION:
    1605             :         //       AUTHOR         Linda Lawrie
    1606             :         //       DATE WRITTEN   Oct 2011
    1607             : 
    1608             :         // PURPOSE OF THIS SUBROUTINE:
    1609             :         // Need to get child coil type and name.
    1610             : 
    1611             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1612           0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1613             :             // Get the HXAssistedCoolingCoil input
    1614           0 :             GetHXAssistedCoolingCoilInput(state);
    1615           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1616             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1617             :         }
    1618             : 
    1619           0 :         int WhichCoil = 0;
    1620           0 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1621           0 :             WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1622             :         }
    1623             : 
    1624           0 :         if (WhichCoil != 0) {
    1625           0 :             CoolingCoilType = state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilType;
    1626           0 :             CoolingCoilName = state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).CoolingCoilName;
    1627             :         } else {
    1628           0 :             ShowSevereError(state, format("Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1629           0 :             ErrorsFound = true;
    1630           0 :             CoolingCoilType = "";
    1631           0 :             CoolingCoilName = "";
    1632             :         }
    1633           0 :     }
    1634             : 
    1635           0 :     Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state,
    1636             :                                    std::string_view CoilType,   // must match coil types in this module
    1637             :                                    std::string const &CoilName, // must match coil names for the coil type
    1638             :                                    bool &ErrorsFound            // set to true if problem
    1639             :     )
    1640             :     {
    1641             : 
    1642             :         // FUNCTION INFORMATION:
    1643             :         //       AUTHOR         Linda Lawrie
    1644             :         //       DATE WRITTEN   November 2006
    1645             :         //       MODIFIED       R. Raustad, April 2009 - added water coil ELSE IF
    1646             : 
    1647             :         // PURPOSE OF THIS FUNCTION:
    1648             :         // This function looks up the max water flow rate for the given coil and returns it.  If
    1649             :         // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned
    1650             :         // as negative.
    1651             : 
    1652             :         // Return value
    1653             :         Real64 MaxWaterFlowRate; // returned max water flow rate of matched coil
    1654             : 
    1655             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1656           0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1657             :             // Get the HXAssistedCoolingCoil input
    1658           0 :             GetHXAssistedCoolingCoilInput(state);
    1659           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1660             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1661             :         }
    1662             : 
    1663           0 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1664             : 
    1665           0 :             int WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1666             : 
    1667           0 :             if (Util::SameString(CoilType, "CoilSystem:Cooling:DX:HeatExchangerAssisted")) {
    1668           0 :                 if (WhichCoil != 0) {
    1669             :                     // coil does not specify MaxWaterFlowRate
    1670           0 :                     MaxWaterFlowRate = 0.0;
    1671           0 :                     ShowRecurringWarningErrorAtEnd(state,
    1672             :                                                    "Requested Max Water Flow Rate from CoilSystem:Cooling:DX:HeatExchangerAssisted N/A",
    1673           0 :                                                    state.dataHVACAssistedCC->ErrCount2);
    1674             :                 }
    1675           0 :             } else if (Util::SameString(CoilType, "CoilSystem:Cooling:Water:HeatExchangerAssisted")) {
    1676           0 :                 if (WhichCoil != 0) {
    1677             :                     MaxWaterFlowRate =
    1678           0 :                         WaterCoils::GetCoilMaxWaterFlowRate(state, CoilType, GetHXDXCoilName(state, CoilType, CoilName, ErrorsFound), ErrorsFound);
    1679             :                 }
    1680             :             } else {
    1681           0 :                 WhichCoil = 0;
    1682             :             }
    1683             : 
    1684           0 :             if (WhichCoil == 0) {
    1685           0 :                 ShowSevereError(state, format("GetCoilMaxWaterFlowRate: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1686           0 :                 ErrorsFound = true;
    1687           0 :                 MaxWaterFlowRate = -1000.0;
    1688             :             }
    1689             :         } else {
    1690           0 :             ShowSevereError(state, format("GetCoilMaxWaterFlowRate: Could not find Coil, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1691           0 :             ErrorsFound = true;
    1692           0 :             MaxWaterFlowRate = -1000.0;
    1693             :         }
    1694             : 
    1695           0 :         return MaxWaterFlowRate;
    1696             :     }
    1697             : 
    1698           0 :     Real64 GetHXCoilAirFlowRate(EnergyPlusData &state,
    1699             :                                 std::string const &CoilType, // must match coil types in this module
    1700             :                                 std::string const &CoilName, // must match coil names for the coil type
    1701             :                                 bool &ErrorsFound            // set to true if problem
    1702             :     )
    1703             :     {
    1704             : 
    1705             :         // FUNCTION INFORMATION:
    1706             :         //       AUTHOR         Richard Raustad
    1707             :         //       DATE WRITTEN   September 2013
    1708             : 
    1709             :         // PURPOSE OF THIS FUNCTION:
    1710             :         // This function looks up the max air flow rate for the given HX and returns it.  If
    1711             :         // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned
    1712             :         // as negative.
    1713             : 
    1714             :         // Return value
    1715             :         Real64 MaxAirFlowRate; // returned max air flow rate of matched HX
    1716             : 
    1717             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1718           0 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1719             :             // Get the HXAssistedCoolingCoil input
    1720           0 :             GetHXAssistedCoolingCoilInput(state);
    1721           0 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1722             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1723             :         }
    1724             : 
    1725           0 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1726             : 
    1727           0 :             int WhichCoil = Util::FindItem(CoilName, state.dataHVACAssistedCC->HXAssistedCoil);
    1728             : 
    1729           0 :             if (Util::SameString(CoilType, "CoilSystem:Cooling:DX:HeatExchangerAssisted") ||
    1730           0 :                 Util::SameString(CoilType, "CoilSystem:Cooling:Water:HeatExchangerAssisted")) {
    1731           0 :                 if (WhichCoil != 0) {
    1732             :                     MaxAirFlowRate =
    1733           0 :                         HeatRecovery::GetSupplyAirFlowRate(state, state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).HeatExchangerName, ErrorsFound);
    1734             :                 }
    1735             :             } else {
    1736           0 :                 WhichCoil = 0;
    1737             :             }
    1738             : 
    1739           0 :             if (WhichCoil == 0) {
    1740           0 :                 ShowSevereError(state, format("GetHXCoilAirFlowRate: Could not find HX, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1741           0 :                 ErrorsFound = true;
    1742           0 :                 MaxAirFlowRate = -1000.0;
    1743             :             }
    1744             :         } else {
    1745           0 :             ShowSevereError(state, format("GetHXCoilAirFlowRate: Could not find HX, Type=\"{}\" Name=\"{}\"", CoilType, CoilName));
    1746           0 :             ErrorsFound = true;
    1747           0 :             MaxAirFlowRate = -1000.0;
    1748             :         }
    1749             : 
    1750           0 :         return MaxAirFlowRate;
    1751             :     }
    1752             : 
    1753           1 :     bool VerifyHeatExchangerParent(EnergyPlusData &state,
    1754             :                                    std::string const &HXType, // must match coil types in this module
    1755             :                                    std::string const &HXName  // must match coil names for the coil type
    1756             :     )
    1757             :     {
    1758             : 
    1759             :         // FUNCTION INFORMATION:
    1760             :         //       AUTHOR         Lixing Gu
    1761             :         //       DATE WRITTEN   January 2009
    1762             : 
    1763             :         // PURPOSE OF THIS FUNCTION:
    1764             :         // This function looks up the given heat exchanger name and type and returns true or false.
    1765             : 
    1766             :         // Obtains and allocates HXAssistedCoolingCoil related parameters from input file
    1767           1 :         if (state.dataHVACAssistedCC->GetCoilsInputFlag) { // First time subroutine has been called, get input data
    1768             :             // Get the HXAssistedCoolingCoil input
    1769           1 :             GetHXAssistedCoolingCoilInput(state);
    1770           1 :             state.dataHVACAssistedCC->GetCoilsInputFlag =
    1771             :                 false; // Set logic flag to disallow getting the input data on future calls to this subroutine
    1772             :         }
    1773             : 
    1774           1 :         int WhichCoil = 0;
    1775           1 :         if (state.dataHVACAssistedCC->TotalNumHXAssistedCoils > 0) {
    1776           1 :             WhichCoil = Util::FindItem(HXName, state.dataHVACAssistedCC->HXAssistedCoil, &HXAssistedCoilParameters::HeatExchangerName);
    1777             :         }
    1778             : 
    1779           1 :         if (WhichCoil != 0) {
    1780           1 :             if (Util::SameString(HVAC::hxTypeNames[(int)state.dataHVACAssistedCC->HXAssistedCoil(WhichCoil).hxType], HXType)) {
    1781           1 :                 return true;
    1782             :             }
    1783             :         }
    1784           0 :         return false;
    1785             :     }
    1786             : 
    1787             :     //        End of Utility subroutines for the HXAssistedCoil Module
    1788             :     // *****************************************************************************
    1789             : 
    1790             : } // namespace HVACHXAssistedCoolingCoil
    1791             : 
    1792             : } // namespace EnergyPlus

Generated by: LCOV version 1.14