LCOV - code coverage report
Current view: top level - EnergyPlus - HVACHXAssistedCoolingCoil.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 44.5 % 755 336
Test Date: 2025-05-22 16:09:37 Functions: 55.0 % 20 11

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

Generated by: LCOV version 2.0-1