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