Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois,
2 : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 : // contributors. All rights reserved.
6 : //
7 : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 : // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 : //
13 : // Redistribution and use in source and binary forms, with or without modification, are permitted
14 : // provided that the following conditions are met:
15 : //
16 : // (1) Redistributions of source code must retain the above copyright notice, this list of
17 : // conditions and the following disclaimer.
18 : //
19 : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 : // conditions and the following disclaimer in the documentation and/or other materials
21 : // provided with the distribution.
22 : //
23 : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 : // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 : // used to endorse or promote products derived from this software without specific prior
26 : // written permission.
27 : //
28 : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 : // without changes from the version obtained under this License, or (ii) Licensee makes a
30 : // reference solely to the software portion of its product, Licensee must refer to the
31 : // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 : // obtained under this License and may not use a different name for the software. Except as
33 : // specifically required in this Section (4), Licensee shall not use in a company name, a
34 : // product name, in advertising, publicity, or other promotional activities any name, trade
35 : // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 : // similar designation, without the U.S. Department of Energy's prior written consent.
37 : //
38 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 : // POSSIBILITY OF SUCH DAMAGE.
47 :
48 : // ObjexxFCL Headers
49 : #include <ObjexxFCL/Array1D.hh>
50 : #include <ObjexxFCL/Optional.hh>
51 :
52 : // EnergyPlus Headers
53 : #include <EnergyPlus/BranchNodeConnections.hh>
54 : #include <EnergyPlus/Data/EnergyPlusData.hh>
55 : #include <EnergyPlus/DataEnvironment.hh>
56 : #include <EnergyPlus/DataHVACGlobals.hh>
57 : #include <EnergyPlus/DataSizing.hh>
58 : #include <EnergyPlus/GeneralRoutines.hh>
59 : #include <EnergyPlus/GlobalNames.hh>
60 : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
61 : #include <EnergyPlus/IntegratedHeatPump.hh>
62 : #include <EnergyPlus/NodeInputManager.hh>
63 : #include <EnergyPlus/OutputProcessor.hh>
64 : #include <EnergyPlus/Plant/DataPlant.hh>
65 : #include <EnergyPlus/UtilityRoutines.hh>
66 : #include <EnergyPlus/VariableSpeedCoils.hh>
67 : #include <EnergyPlus/WaterThermalTanks.hh>
68 :
69 : namespace EnergyPlus::IntegratedHeatPump {
70 :
71 : // Using/Aliasing
72 : using namespace DataLoopNode;
73 :
74 : Real64 constexpr WaterDensity(986.0); // standard water density at 60 C
75 :
76 0 : void SimIHP(EnergyPlusData &state,
77 : std::string_view CompName, // Coil Name
78 : int &CompIndex, // Index for Component name
79 : HVAC::FanOp const fanOp, // Continuous fan OR cycling compressor
80 : HVAC::CompressorOp const compressorOp, // compressor on/off. 0 = off; 1= on
81 : Real64 const PartLoadFrac, // part load fraction
82 : int const SpeedNum, // compressor speed number
83 : Real64 const SpeedRatio, // compressor speed ratio
84 : Real64 const SensLoad, // Sensible demand load [W]
85 : Real64 const LatentLoad, // Latent demand load [W]
86 : bool const IsCallbyWH, // whether the call from the water heating loop or air loop, true = from water heating loop
87 : [[maybe_unused]] bool const FirstHVACIteration, // TRUE if First iteration of simulation
88 : ObjexxFCL::Optional<Real64 const> OnOffAirFlowRat // ratio of comp on to comp off air flow rate
89 : )
90 : {
91 :
92 : // AUTHOR Bo Shen, ORNL
93 : // DATE WRITTEN March 2016
94 : // RE-ENGINEERED na
95 :
96 : // PURPOSE OF THIS SUBROUTINE:
97 : // This subroutine manages variable-speed integrated Air source heat pump simulation.
98 :
99 : // Using/Aliasing
100 : using VariableSpeedCoils::InitVarSpeedCoil;
101 : using VariableSpeedCoils::SimVariableSpeedCoils;
102 : using VariableSpeedCoils::UpdateVarSpeedCoil;
103 :
104 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
105 0 : int DXCoilNum(0); // The IHP No that you are currently dealing with
106 :
107 : // Obtains and Allocates ASIHP related parameters from input file
108 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
109 0 : GetIHPInput(state);
110 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
111 : }
112 :
113 0 : if (CompIndex == 0) {
114 0 : DXCoilNum = Util::FindItemInList(CompName, state.dataIntegratedHP->IntegratedHeatPumps);
115 0 : if (DXCoilNum == 0) {
116 0 : ShowFatalError(state, format("Integrated Heat Pump not found={}", CompName));
117 : }
118 0 : CompIndex = DXCoilNum;
119 : } else {
120 0 : DXCoilNum = CompIndex;
121 0 : if (DXCoilNum > static_cast<int>(state.dataIntegratedHP->IntegratedHeatPumps.size()) || DXCoilNum < 1) {
122 0 : ShowFatalError(state,
123 0 : format("SimIHP: Invalid CompIndex passed={}, Number of Integrated HPs={}, IHP name={}",
124 : DXCoilNum,
125 0 : state.dataIntegratedHP->IntegratedHeatPumps.size(),
126 : CompName));
127 : }
128 0 : if (!CompName.empty() && CompName != state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum).Name) {
129 0 : ShowFatalError(state,
130 0 : format("SimIHP: Invalid CompIndex passed={}, Integrated HP name={}, stored Integrated HP Name for that index={}",
131 : DXCoilNum,
132 : CompName,
133 0 : state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum).Name));
134 : }
135 : };
136 :
137 0 : auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum);
138 :
139 0 : if (!ihp.IHPCoilsSized) SizeIHP(state, DXCoilNum);
140 :
141 0 : InitializeIHP(state, DXCoilNum);
142 :
143 0 : Real64 airMassFlowRate = state.dataLoopNodes->Node(ihp.AirCoolInletNodeNum).MassFlowRate;
144 0 : ihp.AirLoopFlowRate = airMassFlowRate;
145 :
146 0 : switch (ihp.CurMode) {
147 0 : case IHPOperationMode::SpaceClg:
148 0 : if (!IsCallbyWH) // process when called from air loop
149 : {
150 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHCoolCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
151 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
152 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHHeatCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
153 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
154 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
155 0 : SimVariableSpeedCoils(state, std::string(), ihp.DWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
156 :
157 0 : SimVariableSpeedCoils(state,
158 0 : std::string(),
159 0 : ihp.SCCoilIndex,
160 : fanOp,
161 : compressorOp,
162 : PartLoadFrac,
163 : SpeedNum,
164 : SpeedRatio,
165 : SensLoad,
166 : LatentLoad,
167 : OnOffAirFlowRat);
168 :
169 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
170 :
171 0 : ihp.AirFlowSavInAirLoop = airMassFlowRate;
172 : }
173 :
174 0 : ihp.TankSourceWaterMassFlowRate = 0.0;
175 0 : break;
176 0 : case IHPOperationMode::SpaceHtg:
177 0 : if (!IsCallbyWH) // process when called from air loop
178 : {
179 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHCoolCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
180 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
181 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHHeatCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
182 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
183 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
184 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
185 0 : SimVariableSpeedCoils(state, std::string(), ihp.DWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
186 :
187 0 : SimVariableSpeedCoils(state,
188 0 : std::string(),
189 0 : ihp.SHCoilIndex,
190 : fanOp,
191 : compressorOp,
192 : PartLoadFrac,
193 : SpeedNum,
194 : SpeedRatio,
195 : SensLoad,
196 : LatentLoad,
197 : OnOffAirFlowRat);
198 :
199 0 : ihp.AirFlowSavInAirLoop = airMassFlowRate;
200 : }
201 0 : ihp.TankSourceWaterMassFlowRate = 0.0;
202 0 : break;
203 0 : case IHPOperationMode::DedicatedWaterHtg:
204 0 : if (IsCallbyWH) // process when called from water loop
205 : {
206 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHCoolCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
207 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
208 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHHeatCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
209 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
210 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
211 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
212 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
213 :
214 0 : SimVariableSpeedCoils(state,
215 0 : std::string(),
216 0 : ihp.DWHCoilIndex,
217 : fanOp,
218 : compressorOp,
219 : PartLoadFrac,
220 : SpeedNum,
221 : SpeedRatio,
222 : SensLoad,
223 : LatentLoad,
224 : OnOffAirFlowRat);
225 : // IntegratedHeatPumps(DXCoilNum).TotalHeatingEnergyRate =
226 : // VarSpeedCoil(IntegratedHeatPumps(DXCoilNum).DWHCoilIndex).TotalHeatingEnergyRate;
227 : }
228 :
229 0 : ihp.TankSourceWaterMassFlowRate = state.dataLoopNodes->Node(ihp.WaterInletNodeNum).MassFlowRate;
230 0 : break;
231 0 : case IHPOperationMode::SCWHMatchSC:
232 0 : if (!IsCallbyWH) // process when called from air loop
233 : {
234 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHCoolCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
235 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
236 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHHeatCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
237 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
238 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
239 0 : SimVariableSpeedCoils(state, std::string(), ihp.DWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
240 :
241 0 : SimVariableSpeedCoils(state,
242 0 : std::string(),
243 0 : ihp.SCWHCoilIndex,
244 : fanOp,
245 : compressorOp,
246 : PartLoadFrac,
247 : SpeedNum,
248 : SpeedRatio,
249 : SensLoad,
250 : LatentLoad,
251 : OnOffAirFlowRat);
252 :
253 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
254 :
255 0 : ihp.AirFlowSavInAirLoop = airMassFlowRate;
256 : }
257 :
258 0 : ihp.TankSourceWaterMassFlowRate = state.dataLoopNodes->Node(ihp.WaterInletNodeNum).MassFlowRate;
259 :
260 0 : break;
261 0 : case IHPOperationMode::SCWHMatchWH:
262 0 : if (IsCallbyWH) // process when called from water loop
263 : {
264 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHCoolCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
265 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
266 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHHeatCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
267 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
268 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
269 0 : SimVariableSpeedCoils(state, std::string(), ihp.DWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
270 :
271 0 : SimVariableSpeedCoils(state,
272 0 : std::string(),
273 0 : ihp.SCWHCoilIndex,
274 : fanOp,
275 : compressorOp,
276 : PartLoadFrac,
277 : SpeedNum,
278 : SpeedRatio,
279 : SensLoad,
280 : LatentLoad,
281 : OnOffAirFlowRat);
282 :
283 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
284 :
285 0 : ihp.AirFlowSavInWaterLoop = airMassFlowRate;
286 : }
287 :
288 0 : ihp.TankSourceWaterMassFlowRate = state.dataLoopNodes->Node(ihp.WaterInletNodeNum).MassFlowRate;
289 0 : break;
290 0 : case IHPOperationMode::SpaceClgDedicatedWaterHtg:
291 0 : if (!IsCallbyWH) // process when called from air loop
292 : {
293 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHHeatCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
294 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
295 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
296 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
297 0 : SimVariableSpeedCoils(state, std::string(), ihp.DWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
298 :
299 0 : SimVariableSpeedCoils(state,
300 0 : std::string(),
301 0 : ihp.SCDWHWHCoilIndex,
302 : fanOp,
303 : compressorOp,
304 : PartLoadFrac,
305 : SpeedNum,
306 : SpeedRatio,
307 : SensLoad,
308 : LatentLoad,
309 : OnOffAirFlowRat);
310 0 : SimVariableSpeedCoils(state,
311 0 : std::string(),
312 0 : ihp.SCDWHCoolCoilIndex,
313 : fanOp,
314 : compressorOp,
315 : PartLoadFrac,
316 : SpeedNum,
317 : SpeedRatio,
318 : SensLoad,
319 : LatentLoad,
320 : OnOffAirFlowRat);
321 :
322 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
323 :
324 0 : ihp.AirFlowSavInAirLoop = airMassFlowRate;
325 : }
326 :
327 0 : ihp.TankSourceWaterMassFlowRate = state.dataLoopNodes->Node(ihp.WaterInletNodeNum).MassFlowRate;
328 0 : break;
329 0 : case IHPOperationMode::SHDWHElecHeatOff:
330 : case IHPOperationMode::SHDWHElecHeatOn:
331 0 : if (!IsCallbyWH) // process when called from air loop
332 : {
333 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHCoolCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
334 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
335 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
336 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
337 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
338 0 : SimVariableSpeedCoils(state, std::string(), ihp.DWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
339 :
340 0 : SimVariableSpeedCoils(state,
341 0 : std::string(),
342 0 : ihp.SHDWHWHCoilIndex,
343 : fanOp,
344 : compressorOp,
345 : PartLoadFrac,
346 : SpeedNum,
347 : SpeedRatio,
348 : SensLoad,
349 : LatentLoad,
350 : OnOffAirFlowRat);
351 0 : SimVariableSpeedCoils(state,
352 0 : std::string(),
353 0 : ihp.SHDWHHeatCoilIndex,
354 : fanOp,
355 : compressorOp,
356 : PartLoadFrac,
357 : SpeedNum,
358 : SpeedRatio,
359 : SensLoad,
360 : LatentLoad,
361 : OnOffAirFlowRat);
362 :
363 0 : ihp.AirFlowSavInAirLoop = airMassFlowRate;
364 : }
365 :
366 0 : ihp.TankSourceWaterMassFlowRate = state.dataLoopNodes->Node(ihp.WaterInletNodeNum).MassFlowRate;
367 0 : break;
368 0 : case IHPOperationMode::Idle:
369 : default: // clear up
370 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHCoolCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
371 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
372 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHHeatCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
373 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
374 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
375 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
376 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
377 0 : SimVariableSpeedCoils(state, std::string(), ihp.DWHCoilIndex, fanOp, compressorOp, 0.0, 1, 0.0, 0.0, 0.0, OnOffAirFlowRat);
378 0 : ihp.TankSourceWaterMassFlowRate = 0.0;
379 0 : ihp.AirFlowSavInAirLoop = 0.0;
380 0 : ihp.AirFlowSavInWaterLoop = 0.0;
381 0 : break;
382 : }
383 :
384 0 : UpdateIHP(state, DXCoilNum);
385 0 : }
386 :
387 1 : void GetIHPInput(EnergyPlusData &state)
388 : {
389 :
390 : // SUBROUTINE INFORMATION:
391 : // AUTHOR Bo Shen
392 : // DATE WRITTEN December, 2015
393 : // RE-ENGINEERED na
394 :
395 : // PURPOSE OF THIS SUBROUTINE:
396 : // Obtains input data for Integrated HPs and stores it in IHP data structures
397 :
398 : // METHODOLOGY EMPLOYED:
399 : // Uses "Get" routines to read in data.
400 :
401 : // Using/Aliasing
402 : using namespace NodeInputManager;
403 : using BranchNodeConnections::OverrideNodeConnectionType;
404 : using BranchNodeConnections::RegisterNodeConnection;
405 : using BranchNodeConnections::SetUpCompSets;
406 : using BranchNodeConnections::TestCompSet;
407 : using GlobalNames::VerifyUniqueCoilName;
408 : using VariableSpeedCoils::GetCoilIndexVariableSpeed;
409 :
410 : // SUBROUTINE PARAMETER DEFINITIONS:
411 : static constexpr std::string_view RoutineName("GetIHPInput: "); // include trailing blank space
412 :
413 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
414 : int NumAlphas; // Number of variables in String format
415 : int NumNums; // Number of variables in Numeric format
416 : int NumParams; // Total number of input fields
417 1 : int MaxNums(0); // Maximum number of numeric input fields
418 1 : int MaxAlphas(0); // Maximum number of alpha input fields
419 1 : std::string CurrentModuleObject; // for ease in getting objects
420 1 : Array1D_string AlphArray; // Alpha input items for object
421 1 : Array1D_string cAlphaFields; // Alpha field names
422 1 : Array1D_string cNumericFields; // Numeric field names
423 1 : Array1D<Real64> NumArray; // Numeric input items for object
424 1 : Array1D_bool lAlphaBlanks; // Logical array, alpha field input BLANK = .TRUE.
425 1 : Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE.
426 :
427 1 : bool ErrorsFound(false); // If errors detected in input
428 : bool IsNotOK; // Flag to verify name
429 : bool errFlag;
430 : int IOStat;
431 :
432 1 : int NumASIHPs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE");
433 :
434 1 : if (NumASIHPs <= 0) return;
435 :
436 : // Allocate Arrays
437 1 : state.dataIntegratedHP->IntegratedHeatPumps.allocate(NumASIHPs);
438 :
439 : // air-source integrated heat pump
440 1 : state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE", NumParams, NumAlphas, NumNums);
441 1 : MaxNums = max(MaxNums, NumNums);
442 1 : MaxAlphas = max(MaxAlphas, NumAlphas);
443 :
444 1 : AlphArray.allocate(MaxAlphas);
445 1 : cAlphaFields.allocate(MaxAlphas);
446 1 : lAlphaBlanks.dimension(MaxAlphas, true);
447 1 : cNumericFields.allocate(MaxNums);
448 1 : lNumericBlanks.dimension(MaxNums, true);
449 1 : NumArray.dimension(MaxNums, 0.0);
450 :
451 : // Get the data for air-source IHPs
452 1 : CurrentModuleObject = "COILSYSTEM:INTEGRATEDHEATPUMP:AIRSOURCE"; // for reporting
453 :
454 2 : for (int CoilCounter = 1; CoilCounter <= NumASIHPs; ++CoilCounter) {
455 :
456 1 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
457 : CurrentModuleObject,
458 : CoilCounter,
459 : AlphArray,
460 : NumAlphas,
461 : NumArray,
462 : NumNums,
463 : IOStat,
464 : lNumericBlanks,
465 : lAlphaBlanks,
466 : cAlphaFields,
467 : cNumericFields);
468 :
469 : // ErrorsFound will be set to True if problem was found, left untouched otherwise
470 1 : VerifyUniqueCoilName(state, CurrentModuleObject, AlphArray(1), ErrorsFound, CurrentModuleObject + " Name");
471 :
472 1 : auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(CoilCounter);
473 :
474 1 : ihp.Name = AlphArray(1);
475 1 : ihp.IHPtype = "AIRSOURCE_IHP";
476 :
477 : // AlphArray( 2 ) is the water sensor node
478 :
479 1 : ihp.SCCoilType = "COIL:COOLING:DX:VARIABLESPEED";
480 1 : ihp.SCCoilName = AlphArray(3);
481 1 : ihp.SCCoilTypeNum = DataLoopNode::ConnectionObjectType::CoilCoolingDXVariableSpeed;
482 :
483 1 : ValidateComponent(state, ihp.SCCoilType, ihp.SCCoilName, IsNotOK, CurrentModuleObject);
484 1 : if (IsNotOK) {
485 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
486 0 : ErrorsFound = true;
487 : } else {
488 1 : errFlag = false;
489 1 : ihp.SCCoilIndex = GetCoilIndexVariableSpeed(state, ihp.SCCoilType, ihp.SCCoilName, errFlag);
490 1 : if (errFlag) {
491 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
492 0 : ErrorsFound = true;
493 : }
494 : }
495 :
496 1 : ihp.SHCoilType = "COIL:HEATING:DX:VARIABLESPEED";
497 1 : ihp.SHCoilName = AlphArray(4);
498 1 : ihp.SHCoilTypeNum = DataLoopNode::ConnectionObjectType::CoilHeatingDXVariableSpeed;
499 :
500 1 : ValidateComponent(state, ihp.SHCoilType, ihp.SHCoilName, IsNotOK, CurrentModuleObject);
501 1 : if (IsNotOK) {
502 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
503 0 : ErrorsFound = true;
504 : } else {
505 1 : errFlag = false;
506 1 : ihp.SHCoilIndex = GetCoilIndexVariableSpeed(state, ihp.SHCoilType, ihp.SHCoilName, errFlag);
507 1 : if (errFlag) {
508 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
509 0 : ErrorsFound = true;
510 : }
511 : }
512 :
513 1 : ihp.DWHCoilType = "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED";
514 1 : ihp.DWHCoilName = AlphArray(5);
515 1 : ihp.DWHCoilTypeNum = DataLoopNode::ConnectionObjectType::CoilWaterHeatingAirToWaterHeatPumpVariableSpeed;
516 :
517 1 : ValidateComponent(state, ihp.DWHCoilType, ihp.DWHCoilName, IsNotOK, CurrentModuleObject);
518 1 : if (IsNotOK) {
519 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
520 0 : ErrorsFound = true;
521 : } else {
522 1 : errFlag = false;
523 1 : ihp.DWHCoilIndex = GetCoilIndexVariableSpeed(state, ihp.DWHCoilType, ihp.DWHCoilName, errFlag);
524 1 : if (errFlag) {
525 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
526 0 : ErrorsFound = true;
527 : }
528 : }
529 :
530 1 : ihp.SCWHCoilType = "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED";
531 1 : ihp.SCWHCoilName = AlphArray(6);
532 1 : ihp.SCWHCoilTypeNum = DataLoopNode::ConnectionObjectType::CoilWaterHeatingAirToWaterHeatPumpVariableSpeed;
533 :
534 1 : ValidateComponent(state, ihp.SCWHCoilType, ihp.SCWHCoilName, IsNotOK, CurrentModuleObject);
535 1 : if (IsNotOK) {
536 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
537 0 : ErrorsFound = true;
538 : } else {
539 1 : errFlag = false;
540 1 : ihp.SCWHCoilIndex = GetCoilIndexVariableSpeed(state, ihp.SCWHCoilType, ihp.SCWHCoilName, errFlag);
541 1 : if (errFlag) {
542 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
543 0 : ErrorsFound = true;
544 : }
545 : }
546 :
547 1 : ihp.SCDWHCoolCoilType = "COIL:COOLING:DX:VARIABLESPEED";
548 1 : ihp.SCDWHCoolCoilName = AlphArray(7);
549 1 : ihp.SCDWHCoolCoilTypeNum = DataLoopNode::ConnectionObjectType::CoilCoolingDXVariableSpeed;
550 :
551 1 : ValidateComponent(state, ihp.SCDWHCoolCoilType, ihp.SCDWHCoolCoilName, IsNotOK, CurrentModuleObject);
552 1 : if (IsNotOK) {
553 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
554 0 : ErrorsFound = true;
555 : } else {
556 1 : errFlag = false;
557 1 : ihp.SCDWHCoolCoilIndex = GetCoilIndexVariableSpeed(state, ihp.SCDWHCoolCoilType, ihp.SCDWHCoolCoilName, errFlag);
558 1 : if (errFlag) {
559 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
560 0 : ErrorsFound = true;
561 : }
562 : }
563 :
564 1 : ihp.SCDWHWHCoilType = "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED";
565 1 : ihp.SCDWHWHCoilName = AlphArray(8);
566 1 : ihp.SCDWHWHCoilTypeNum = DataLoopNode::ConnectionObjectType::CoilWaterHeatingAirToWaterHeatPumpVariableSpeed;
567 :
568 1 : ValidateComponent(state, ihp.SCDWHWHCoilType, ihp.SCDWHWHCoilName, IsNotOK, CurrentModuleObject);
569 1 : if (IsNotOK) {
570 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
571 0 : ErrorsFound = true;
572 : } else {
573 1 : errFlag = false;
574 1 : ihp.SCDWHWHCoilIndex = GetCoilIndexVariableSpeed(state, ihp.SCDWHWHCoilType, ihp.SCDWHWHCoilName, errFlag);
575 1 : if (errFlag) {
576 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
577 0 : ErrorsFound = true;
578 : } else {
579 1 : state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHWHCoilIndex).bIsDesuperheater = true;
580 : }
581 : }
582 :
583 1 : ihp.SHDWHHeatCoilType = "COIL:HEATING:DX:VARIABLESPEED";
584 1 : ihp.SHDWHHeatCoilName = AlphArray(9);
585 1 : ihp.SHDWHHeatCoilTypeNum = DataLoopNode::ConnectionObjectType::CoilHeatingDXVariableSpeed;
586 :
587 1 : ValidateComponent(state, ihp.SHDWHHeatCoilType, ihp.SHDWHHeatCoilName, IsNotOK, CurrentModuleObject);
588 1 : if (IsNotOK) {
589 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
590 0 : ErrorsFound = true;
591 : } else {
592 1 : errFlag = false;
593 1 : ihp.SHDWHHeatCoilIndex = GetCoilIndexVariableSpeed(state, ihp.SHDWHHeatCoilType, ihp.SHDWHHeatCoilName, errFlag);
594 1 : if (errFlag) {
595 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
596 0 : ErrorsFound = true;
597 : }
598 : }
599 :
600 1 : ihp.SHDWHWHCoilType = "COIL:WATERHEATING:AIRTOWATERHEATPUMP:VARIABLESPEED";
601 1 : ihp.SHDWHWHCoilName = AlphArray(10);
602 1 : ihp.SHDWHWHCoilTypeNum = DataLoopNode::ConnectionObjectType::CoilWaterHeatingAirToWaterHeatPumpVariableSpeed;
603 :
604 1 : ValidateComponent(state, ihp.SHDWHWHCoilType, ihp.SHDWHWHCoilName, IsNotOK, CurrentModuleObject);
605 1 : if (IsNotOK) {
606 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
607 0 : ErrorsFound = true;
608 : } else {
609 1 : errFlag = false;
610 1 : ihp.SHDWHWHCoilIndex = GetCoilIndexVariableSpeed(state, ihp.SHDWHWHCoilType, ihp.SHDWHWHCoilName, errFlag);
611 1 : if (errFlag) {
612 0 : ShowContinueError(state, format("...specified in {}=\"{}\".", CurrentModuleObject, AlphArray(1)));
613 0 : ErrorsFound = true;
614 : } else {
615 1 : state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHWHCoilIndex).bIsDesuperheater = true;
616 : }
617 : }
618 :
619 1 : ihp.TindoorOverCoolAllow = NumArray(1);
620 1 : ihp.TambientOverCoolAllow = NumArray(2);
621 1 : ihp.TindoorWHHighPriority = NumArray(3);
622 1 : ihp.TambientWHHighPriority = NumArray(4);
623 1 : ihp.ModeMatchSCWH = int(NumArray(5));
624 1 : ihp.MinSpedSCWH = int(NumArray(6));
625 1 : ihp.WaterVolSCDWH = NumArray(7);
626 1 : ihp.MinSpedSCDWH = int(NumArray(8));
627 1 : ihp.TimeLimitSHDWH = NumArray(9);
628 1 : ihp.MinSpedSHDWH = int(NumArray(10));
629 :
630 : // Due to the overlapping coil objects, compsets and node registrations are handled as follows:
631 : // 1. The ASIHP coil object is registered as four different coils, Name+" Cooling Coil", Name+" Heating Coil",
632 : // Name+" Outdoor Coil", and Name+" Water Coil"
633 : // 2. For each of these four coils, TestCompSet is called once to register it as a child object
634 : // 3. For each of these four coils, RegisterNodeConnection is called twice to register the inlet and outlet nodes
635 : // RegisterNodeConnection is used instead of GetOnlySingleNode because the node names are not inputs here
636 : // 4. The parent objects that reference the ASIHP coil must use the appropriate name suffixes when calling SetUpCompSets
637 : // 5. The ASIHP calls SetUpCompSets to register the various child coils. This is important so that the system energy
638 : // use is collected in SystemReports::CalcSystemEnergyUse
639 : // 6. The child coil inlet/outlet node connections are reset to connection type "Internal" to avoid duplicate node problems
640 : // using OverrideNodeConnectionType
641 :
642 : // cooling coil air node connections
643 1 : int ChildCoilIndex = ihp.SCCoilIndex;
644 1 : int InNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirInletNodeNum;
645 1 : int OutNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirOutletNodeNum;
646 1 : std::string InNodeName = state.dataLoopNodes->NodeID(InNode);
647 1 : std::string OutNodeName = state.dataLoopNodes->NodeID(OutNode);
648 :
649 1 : ihp.AirCoolInletNodeNum = InNode;
650 1 : ihp.AirHeatInletNodeNum = OutNode;
651 :
652 1 : TestCompSet(state, CurrentModuleObject, ihp.Name + " Cooling Coil", InNodeName, OutNodeName, "Cooling Air Nodes");
653 3 : RegisterNodeConnection(state,
654 : InNode,
655 1 : state.dataLoopNodes->NodeID(InNode),
656 : DataLoopNode::ConnectionObjectType::CoilSystemIntegratedHeatPumpAirSource,
657 2 : ihp.Name + " Cooling Coil",
658 : DataLoopNode::ConnectionType::Inlet,
659 : NodeInputManager::CompFluidStream::Primary,
660 : ObjectIsNotParent,
661 : ErrorsFound);
662 3 : RegisterNodeConnection(state,
663 : OutNode,
664 1 : state.dataLoopNodes->NodeID(OutNode),
665 : DataLoopNode::ConnectionObjectType::CoilSystemIntegratedHeatPumpAirSource,
666 2 : ihp.Name + " Cooling Coil",
667 : DataLoopNode::ConnectionType::Outlet,
668 : NodeInputManager::CompFluidStream::Primary,
669 : ObjectIsNotParent,
670 : ErrorsFound);
671 :
672 1 : SetUpCompSets(state, CurrentModuleObject, ihp.Name + " Cooling Coil", ihp.SCCoilType, ihp.SCCoilName, InNodeName, OutNodeName);
673 1 : OverrideNodeConnectionType(state,
674 : InNode,
675 : InNodeName,
676 : ihp.SCCoilTypeNum,
677 1 : ihp.SCCoilName,
678 : DataLoopNode::ConnectionType::Internal,
679 : NodeInputManager::CompFluidStream::Primary,
680 : ObjectIsNotParent,
681 : ErrorsFound);
682 1 : OverrideNodeConnectionType(state,
683 : OutNode,
684 : OutNodeName,
685 : ihp.SCCoilTypeNum,
686 1 : ihp.SCCoilName,
687 : DataLoopNode::ConnectionType::Internal,
688 : NodeInputManager::CompFluidStream::Primary,
689 : ObjectIsNotParent,
690 : ErrorsFound);
691 :
692 2 : if ((state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCWHCoilIndex).AirInletNodeNum != InNode) ||
693 1 : (state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCWHCoilIndex).AirOutletNodeNum != OutNode)) {
694 0 : ShowContinueError(state, format("Mistaken air node connection: {}{}-wrong coil node names.", CurrentModuleObject, ihp.SCWHCoilName));
695 0 : ErrorsFound = true;
696 : }
697 1 : SetUpCompSets(state, CurrentModuleObject, ihp.Name + " Cooling Coil", ihp.SCWHCoilType, ihp.SCWHCoilName, InNodeName, OutNodeName);
698 1 : OverrideNodeConnectionType(state,
699 : InNode,
700 : InNodeName,
701 : ihp.SCWHCoilTypeNum,
702 1 : ihp.SCWHCoilName,
703 : DataLoopNode::ConnectionType::Internal,
704 : NodeInputManager::CompFluidStream::Primary,
705 : ObjectIsNotParent,
706 : ErrorsFound);
707 1 : OverrideNodeConnectionType(state,
708 : OutNode,
709 : OutNodeName,
710 : ihp.SCWHCoilTypeNum,
711 1 : ihp.SCWHCoilName,
712 : DataLoopNode::ConnectionType::Internal,
713 : NodeInputManager::CompFluidStream::Primary,
714 : ObjectIsNotParent,
715 : ErrorsFound);
716 :
717 2 : if ((state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHCoolCoilIndex).AirInletNodeNum != InNode) ||
718 1 : (state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHCoolCoilIndex).AirOutletNodeNum != OutNode)) {
719 0 : ShowContinueError(state, format("Mistaken air node connection: {}{}-wrong coil node names.", CurrentModuleObject, ihp.SCDWHCoolCoilName));
720 0 : ErrorsFound = true;
721 : }
722 1 : SetUpCompSets(state, CurrentModuleObject, ihp.Name + " Cooling Coil", ihp.SCDWHCoolCoilType, ihp.SCDWHCoolCoilName, InNodeName, OutNodeName);
723 1 : OverrideNodeConnectionType(state,
724 : InNode,
725 : InNodeName,
726 : ihp.SCDWHCoolCoilTypeNum,
727 1 : ihp.SCDWHCoolCoilName,
728 : DataLoopNode::ConnectionType::Internal,
729 : NodeInputManager::CompFluidStream::Primary,
730 : ObjectIsNotParent,
731 : ErrorsFound);
732 1 : OverrideNodeConnectionType(state,
733 : OutNode,
734 : OutNodeName,
735 : ihp.SCDWHCoolCoilTypeNum,
736 1 : ihp.SCDWHCoolCoilName,
737 : DataLoopNode::ConnectionType::Internal,
738 : NodeInputManager::CompFluidStream::Primary,
739 : ObjectIsNotParent,
740 : ErrorsFound);
741 :
742 : // heating coil air node connections
743 1 : ChildCoilIndex = ihp.SHCoilIndex;
744 :
745 1 : InNode = ihp.AirHeatInletNodeNum;
746 1 : OutNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirOutletNodeNum;
747 1 : ihp.AirOutletNodeNum = OutNode;
748 1 : InNodeName = state.dataLoopNodes->NodeID(InNode);
749 1 : OutNodeName = state.dataLoopNodes->NodeID(OutNode);
750 1 : if (state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirInletNodeNum != InNode) {
751 0 : ShowContinueError(state,
752 0 : format("Mistaken air node connection: {}- cooling coil outlet mismatches heating coil inlet.", CurrentModuleObject));
753 0 : ErrorsFound = true;
754 : }
755 1 : TestCompSet(state, CurrentModuleObject, ihp.Name + " Heating Coil", InNodeName, OutNodeName, "Heating Air Nodes");
756 3 : RegisterNodeConnection(state,
757 : InNode,
758 1 : state.dataLoopNodes->NodeID(InNode),
759 : DataLoopNode::ConnectionObjectType::CoilSystemIntegratedHeatPumpAirSource,
760 2 : ihp.Name + " Heating Coil",
761 : DataLoopNode::ConnectionType::Inlet,
762 : NodeInputManager::CompFluidStream::Primary,
763 : ObjectIsNotParent,
764 : ErrorsFound);
765 3 : RegisterNodeConnection(state,
766 : OutNode,
767 1 : state.dataLoopNodes->NodeID(OutNode),
768 : DataLoopNode::ConnectionObjectType::CoilSystemIntegratedHeatPumpAirSource,
769 2 : ihp.Name + " Heating Coil",
770 : DataLoopNode::ConnectionType::Outlet,
771 : NodeInputManager::CompFluidStream::Primary,
772 : ObjectIsNotParent,
773 : ErrorsFound);
774 :
775 1 : SetUpCompSets(state, CurrentModuleObject, ihp.Name + " Heating Coil", ihp.SHCoilType, ihp.SHCoilName, InNodeName, OutNodeName);
776 1 : OverrideNodeConnectionType(state,
777 : InNode,
778 : InNodeName,
779 : ihp.SHCoilTypeNum,
780 1 : ihp.SHCoilName,
781 : DataLoopNode::ConnectionType::Internal,
782 : NodeInputManager::CompFluidStream::Primary,
783 : ObjectIsNotParent,
784 : ErrorsFound);
785 1 : OverrideNodeConnectionType(state,
786 : OutNode,
787 : OutNodeName,
788 : ihp.SHCoilTypeNum,
789 1 : ihp.SHCoilName,
790 : DataLoopNode::ConnectionType::Internal,
791 : NodeInputManager::CompFluidStream::Primary,
792 : ObjectIsNotParent,
793 : ErrorsFound);
794 :
795 2 : if ((state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHHeatCoilIndex).AirInletNodeNum != InNode) ||
796 1 : (state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHHeatCoilIndex).AirOutletNodeNum != OutNode)) {
797 0 : ShowContinueError(state,
798 0 : format("Mistaken air node connection: {}:{}-wrong coil node names.", CurrentModuleObject, ihp.SHDWHHeatCoilName));
799 0 : ErrorsFound = true;
800 : }
801 1 : SetUpCompSets(state, CurrentModuleObject, ihp.Name + " Heating Coil", ihp.SHDWHHeatCoilType, ihp.SHDWHHeatCoilName, InNodeName, OutNodeName);
802 1 : OverrideNodeConnectionType(state,
803 : InNode,
804 : InNodeName,
805 : ihp.SHDWHHeatCoilTypeNum,
806 1 : ihp.SHDWHHeatCoilName,
807 : DataLoopNode::ConnectionType::Internal,
808 : NodeInputManager::CompFluidStream::Primary,
809 : ObjectIsNotParent,
810 : ErrorsFound);
811 1 : OverrideNodeConnectionType(state,
812 : OutNode,
813 : OutNodeName,
814 : ihp.SHDWHHeatCoilTypeNum,
815 1 : ihp.SHDWHHeatCoilName,
816 : DataLoopNode::ConnectionType::Internal,
817 : NodeInputManager::CompFluidStream::Primary,
818 : ObjectIsNotParent,
819 : ErrorsFound);
820 :
821 : // water node connections
822 1 : ChildCoilIndex = ihp.SCWHCoilIndex;
823 :
824 1 : InNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).WaterInletNodeNum;
825 1 : OutNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).WaterOutletNodeNum;
826 1 : InNodeName = state.dataLoopNodes->NodeID(InNode);
827 1 : OutNodeName = state.dataLoopNodes->NodeID(OutNode);
828 1 : ihp.WaterInletNodeNum = InNode;
829 1 : ihp.WaterOutletNodeNum = OutNode;
830 2 : if ((state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHWHCoilIndex).WaterInletNodeNum != InNode) ||
831 1 : (state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHWHCoilIndex).WaterOutletNodeNum != OutNode)) {
832 0 : ShowContinueError(state, format("Mistaken air node connection: {}:{}-wrong coil node names.", CurrentModuleObject, ihp.SCDWHWHCoilName));
833 0 : ErrorsFound = true;
834 : }
835 :
836 1 : TestCompSet(state, CurrentModuleObject, ihp.Name + " Water Coil", InNodeName, OutNodeName, "Water Nodes");
837 3 : RegisterNodeConnection(state,
838 : InNode,
839 1 : state.dataLoopNodes->NodeID(InNode),
840 : DataLoopNode::ConnectionObjectType::CoilSystemIntegratedHeatPumpAirSource,
841 2 : ihp.Name + " Water Coil",
842 : DataLoopNode::ConnectionType::Inlet,
843 : NodeInputManager::CompFluidStream::Primary,
844 : ObjectIsNotParent,
845 : ErrorsFound);
846 3 : RegisterNodeConnection(state,
847 : OutNode,
848 1 : state.dataLoopNodes->NodeID(InNode),
849 : DataLoopNode::ConnectionObjectType::CoilSystemIntegratedHeatPumpAirSource,
850 2 : ihp.Name + " Water Coil",
851 : DataLoopNode::ConnectionType::Outlet,
852 : NodeInputManager::CompFluidStream::Primary,
853 : ObjectIsNotParent,
854 : ErrorsFound);
855 :
856 1 : SetUpCompSets(state, CurrentModuleObject, ihp.Name + " Water Coil", ihp.SCWHCoilType, ihp.SCWHCoilName, InNodeName, OutNodeName);
857 1 : OverrideNodeConnectionType(state,
858 : InNode,
859 : InNodeName,
860 : ihp.SCWHCoilTypeNum,
861 1 : ihp.SCWHCoilName,
862 : DataLoopNode::ConnectionType::Internal,
863 : NodeInputManager::CompFluidStream::Secondary,
864 : ObjectIsNotParent,
865 : ErrorsFound);
866 1 : OverrideNodeConnectionType(state,
867 : OutNode,
868 : OutNodeName,
869 : ihp.SCWHCoilTypeNum,
870 1 : ihp.SCWHCoilName,
871 : DataLoopNode::ConnectionType::Internal,
872 : NodeInputManager::CompFluidStream::Secondary,
873 : ObjectIsNotParent,
874 : ErrorsFound);
875 :
876 1 : SetUpCompSets(state, CurrentModuleObject, ihp.Name + " Water Coil", ihp.SCDWHWHCoilType, ihp.SCDWHWHCoilName, InNodeName, OutNodeName);
877 1 : OverrideNodeConnectionType(state,
878 : InNode,
879 : InNodeName,
880 : ihp.SCDWHWHCoilTypeNum,
881 1 : ihp.SCDWHWHCoilName,
882 : DataLoopNode::ConnectionType::Internal,
883 : NodeInputManager::CompFluidStream::Secondary,
884 : ObjectIsNotParent,
885 : ErrorsFound);
886 1 : OverrideNodeConnectionType(state,
887 : OutNode,
888 : OutNodeName,
889 : ihp.SCDWHWHCoilTypeNum,
890 1 : ihp.SCDWHWHCoilName,
891 : DataLoopNode::ConnectionType::Internal,
892 : NodeInputManager::CompFluidStream::Secondary,
893 : ObjectIsNotParent,
894 : ErrorsFound);
895 :
896 2 : if ((state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHWHCoilIndex).WaterInletNodeNum != InNode) ||
897 1 : (state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHWHCoilIndex).WaterOutletNodeNum != OutNode)) {
898 0 : ShowContinueError(state, format("Mistaken air node connection: {}:{}-wrong coil node names.", CurrentModuleObject, ihp.SHDWHWHCoilName));
899 0 : ErrorsFound = true;
900 : }
901 1 : SetUpCompSets(state, CurrentModuleObject, ihp.Name + " Water Coil", ihp.SHDWHWHCoilType, ihp.SHDWHWHCoilName, InNodeName, OutNodeName);
902 1 : OverrideNodeConnectionType(state,
903 : InNode,
904 : InNodeName,
905 : ihp.SHDWHWHCoilTypeNum,
906 1 : ihp.SHDWHWHCoilName,
907 : DataLoopNode::ConnectionType::Internal,
908 : NodeInputManager::CompFluidStream::Secondary,
909 : ObjectIsNotParent,
910 : ErrorsFound);
911 1 : OverrideNodeConnectionType(state,
912 : OutNode,
913 : OutNodeName,
914 : ihp.SHDWHWHCoilTypeNum,
915 1 : ihp.SHDWHWHCoilName,
916 : DataLoopNode::ConnectionType::Internal,
917 : NodeInputManager::CompFluidStream::Secondary,
918 : ObjectIsNotParent,
919 : ErrorsFound);
920 :
921 2 : if ((state.dataVariableSpeedCoils->VarSpeedCoil(ihp.DWHCoilIndex).WaterInletNodeNum != InNode) ||
922 1 : (state.dataVariableSpeedCoils->VarSpeedCoil(ihp.DWHCoilIndex).WaterOutletNodeNum != OutNode)) {
923 0 : ShowContinueError(state, format("Mistaken air node connection: {}:{}-wrong coil node names.", CurrentModuleObject, ihp.DWHCoilName));
924 0 : ErrorsFound = true;
925 : }
926 1 : SetUpCompSets(state, CurrentModuleObject, ihp.Name + " Water Coil", ihp.DWHCoilType, ihp.DWHCoilName, InNodeName, OutNodeName);
927 1 : OverrideNodeConnectionType(state,
928 : InNode,
929 : InNodeName,
930 : ihp.DWHCoilTypeNum,
931 1 : ihp.DWHCoilName,
932 : DataLoopNode::ConnectionType::Internal,
933 : NodeInputManager::CompFluidStream::Secondary,
934 : ObjectIsNotParent,
935 : ErrorsFound);
936 1 : OverrideNodeConnectionType(state,
937 : OutNode,
938 : OutNodeName,
939 : ihp.DWHCoilTypeNum,
940 1 : ihp.DWHCoilName,
941 : DataLoopNode::ConnectionType::Internal,
942 : NodeInputManager::CompFluidStream::Secondary,
943 : ObjectIsNotParent,
944 : ErrorsFound);
945 :
946 1 : ihp.WaterTankoutNod = GetOnlySingleNode(state,
947 1 : AlphArray(2),
948 : ErrorsFound,
949 : DataLoopNode::ConnectionObjectType::CoilSystemIntegratedHeatPumpAirSource,
950 1 : AlphArray(1),
951 : DataLoopNode::NodeFluidType::Water,
952 : DataLoopNode::ConnectionType::Sensor,
953 : NodeInputManager::CompFluidStream::Secondary,
954 : ObjectIsNotParent);
955 :
956 : // outdoor air node connections for water heating coils
957 : // DWH, SCDWH, SHDWH coils have the same outdoor air nodes
958 1 : ChildCoilIndex = ihp.DWHCoilIndex;
959 1 : InNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirInletNodeNum;
960 1 : OutNode = state.dataVariableSpeedCoils->VarSpeedCoil(ChildCoilIndex).AirOutletNodeNum;
961 1 : InNodeName = state.dataLoopNodes->NodeID(InNode);
962 1 : OutNodeName = state.dataLoopNodes->NodeID(OutNode);
963 1 : ihp.ODAirInletNodeNum = InNode;
964 1 : ihp.ODAirOutletNodeNum = OutNode;
965 2 : if ((state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHWHCoilIndex).AirInletNodeNum != InNode) ||
966 1 : (state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHWHCoilIndex).AirOutletNodeNum != OutNode)) {
967 0 : ShowContinueError(state, format("Mistaken air node connection: {}:{}-wrong coil node names.", CurrentModuleObject, ihp.SCDWHWHCoilName));
968 0 : ErrorsFound = true;
969 : }
970 :
971 1 : TestCompSet(state, CurrentModuleObject, ihp.Name + " Outdoor Coil", InNodeName, OutNodeName, "Outdoor Air Nodes");
972 3 : RegisterNodeConnection(state,
973 : InNode,
974 1 : state.dataLoopNodes->NodeID(InNode),
975 : DataLoopNode::ConnectionObjectType::CoilSystemIntegratedHeatPumpAirSource,
976 2 : ihp.Name + " Outdoor Coil",
977 : DataLoopNode::ConnectionType::Inlet,
978 : NodeInputManager::CompFluidStream::Primary,
979 : ObjectIsNotParent,
980 : ErrorsFound);
981 3 : RegisterNodeConnection(state,
982 : OutNode,
983 1 : state.dataLoopNodes->NodeID(InNode),
984 : DataLoopNode::ConnectionObjectType::CoilSystemIntegratedHeatPumpAirSource,
985 2 : ihp.Name + " Outdoor Coil",
986 : DataLoopNode::ConnectionType::Outlet,
987 : NodeInputManager::CompFluidStream::Primary,
988 : ObjectIsNotParent,
989 : ErrorsFound);
990 :
991 1 : SetUpCompSets(state, CurrentModuleObject, ihp.Name + " Outdoor Coil", ihp.DWHCoilType, ihp.DWHCoilName, InNodeName, OutNodeName);
992 1 : OverrideNodeConnectionType(state,
993 : InNode,
994 : InNodeName,
995 : ihp.DWHCoilTypeNum,
996 1 : ihp.DWHCoilName,
997 : DataLoopNode::ConnectionType::Internal,
998 : NodeInputManager::CompFluidStream::Primary,
999 : ObjectIsNotParent,
1000 : ErrorsFound);
1001 1 : OverrideNodeConnectionType(state,
1002 : OutNode,
1003 : OutNodeName,
1004 : ihp.DWHCoilTypeNum,
1005 1 : ihp.DWHCoilName,
1006 : DataLoopNode::ConnectionType::Internal,
1007 : NodeInputManager::CompFluidStream::Primary,
1008 : ObjectIsNotParent,
1009 : ErrorsFound);
1010 :
1011 1 : SetUpCompSets(state, CurrentModuleObject, ihp.Name + " Outdoor Coil", ihp.SCDWHWHCoilType, ihp.SCDWHWHCoilName, InNodeName, OutNodeName);
1012 1 : OverrideNodeConnectionType(state,
1013 : InNode,
1014 : InNodeName,
1015 : ihp.SCDWHWHCoilTypeNum,
1016 1 : ihp.SCDWHWHCoilName,
1017 : DataLoopNode::ConnectionType::Internal,
1018 : NodeInputManager::CompFluidStream::Primary,
1019 : ObjectIsNotParent,
1020 : ErrorsFound);
1021 1 : OverrideNodeConnectionType(state,
1022 : OutNode,
1023 : OutNodeName,
1024 : ihp.SCDWHWHCoilTypeNum,
1025 1 : ihp.SCDWHWHCoilName,
1026 : DataLoopNode::ConnectionType::Internal,
1027 : NodeInputManager::CompFluidStream::Primary,
1028 : ObjectIsNotParent,
1029 : ErrorsFound);
1030 :
1031 : // why was this here
1032 : // state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHWHCoilIndex).AirInletNodeNum = InNode;
1033 : // state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHWHCoilIndex).AirOutletNodeNum = OutNode;
1034 :
1035 2 : if ((state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHWHCoilIndex).AirInletNodeNum != InNode) ||
1036 1 : (state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHWHCoilIndex).AirOutletNodeNum != OutNode)) {
1037 0 : ShowContinueError(state, format("Mistaken air node connection: {}:{}-wrong coil node names.", CurrentModuleObject, ihp.SHDWHWHCoilName));
1038 0 : ErrorsFound = true;
1039 : }
1040 1 : SetUpCompSets(state, CurrentModuleObject, ihp.Name + " Outdoor Coil", ihp.SHDWHWHCoilType, ihp.SHDWHWHCoilName, InNodeName, OutNodeName);
1041 1 : OverrideNodeConnectionType(state,
1042 : InNode,
1043 : InNodeName,
1044 : ihp.SHDWHWHCoilTypeNum,
1045 1 : ihp.SHDWHWHCoilName,
1046 : DataLoopNode::ConnectionType::Internal,
1047 : NodeInputManager::CompFluidStream::Primary,
1048 : ObjectIsNotParent,
1049 : ErrorsFound);
1050 1 : OverrideNodeConnectionType(state,
1051 : OutNode,
1052 : OutNodeName,
1053 : ihp.SHDWHWHCoilTypeNum,
1054 1 : ihp.SHDWHWHCoilName,
1055 : DataLoopNode::ConnectionType::Internal,
1056 : NodeInputManager::CompFluidStream::Primary,
1057 : ObjectIsNotParent,
1058 : ErrorsFound);
1059 :
1060 1 : ihp.IHPCoilsSized = false;
1061 1 : ihp.CoolVolFlowScale = 1.0; // scale coil flow rates to match the parent fan object
1062 1 : ihp.HeatVolFlowScale = 1.0; // scale coil flow rates to match the parent fan object
1063 1 : ihp.CurMode = IHPOperationMode::Idle;
1064 1 : ihp.MaxHeatAirMassFlow = 1e10;
1065 1 : ihp.MaxHeatAirVolFlow = 1e10;
1066 1 : ihp.MaxCoolAirMassFlow = 1e10;
1067 1 : ihp.MaxCoolAirVolFlow = 1e10;
1068 1 : }
1069 :
1070 1 : if (ErrorsFound) {
1071 0 : ShowFatalError(state,
1072 0 : format("{} Errors found in getting {} input. Preceding condition(s) causes termination.", RoutineName, CurrentModuleObject));
1073 : }
1074 :
1075 2 : for (int CoilCounter = 1; CoilCounter <= NumASIHPs; ++CoilCounter) {
1076 :
1077 1 : auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(CoilCounter);
1078 :
1079 : // set up output variables, not reported in the individual coil models
1080 2 : SetupOutputVariable(state,
1081 : "Integrated Heat Pump Air Loop Mass Flow Rate",
1082 : Constant::Units::kg_s,
1083 1 : ihp.AirLoopFlowRate,
1084 : OutputProcessor::TimeStepType::System,
1085 : OutputProcessor::StoreType::Average,
1086 1 : ihp.Name);
1087 2 : SetupOutputVariable(state,
1088 : "Integrated Heat Pump Condenser Water Mass Flow Rate",
1089 : Constant::Units::kg_s,
1090 1 : ihp.TankSourceWaterMassFlowRate,
1091 : OutputProcessor::TimeStepType::System,
1092 : OutputProcessor::StoreType::Average,
1093 1 : ihp.Name);
1094 2 : SetupOutputVariable(state,
1095 : "Integrated Heat Pump Air Total Cooling Rate",
1096 : Constant::Units::W,
1097 1 : ihp.TotalCoolingRate,
1098 : OutputProcessor::TimeStepType::System,
1099 : OutputProcessor::StoreType::Average,
1100 1 : ihp.Name);
1101 2 : SetupOutputVariable(state,
1102 : "Integrated Heat Pump Air Heating Rate",
1103 : Constant::Units::W,
1104 1 : ihp.TotalSpaceHeatingRate,
1105 : OutputProcessor::TimeStepType::System,
1106 : OutputProcessor::StoreType::Average,
1107 1 : ihp.Name);
1108 2 : SetupOutputVariable(state,
1109 : "Integrated Heat Pump Water Heating Rate",
1110 : Constant::Units::W,
1111 1 : ihp.TotalWaterHeatingRate,
1112 : OutputProcessor::TimeStepType::System,
1113 : OutputProcessor::StoreType::Average,
1114 1 : ihp.Name);
1115 2 : SetupOutputVariable(state,
1116 : "Integrated Heat Pump Electricity Rate",
1117 : Constant::Units::W,
1118 1 : ihp.TotalPower,
1119 : OutputProcessor::TimeStepType::System,
1120 : OutputProcessor::StoreType::Average,
1121 1 : ihp.Name);
1122 2 : SetupOutputVariable(state,
1123 : "Integrated Heat Pump Air Latent Cooling Rate",
1124 : Constant::Units::W,
1125 1 : ihp.TotalLatentLoad,
1126 : OutputProcessor::TimeStepType::System,
1127 : OutputProcessor::StoreType::Average,
1128 1 : ihp.Name);
1129 2 : SetupOutputVariable(state,
1130 : "Integrated Heat Pump Source Heat Transfer Rate",
1131 : Constant::Units::W,
1132 1 : ihp.Qsource,
1133 : OutputProcessor::TimeStepType::System,
1134 : OutputProcessor::StoreType::Average,
1135 1 : ihp.Name);
1136 2 : SetupOutputVariable(state,
1137 : "Integrated Heat Pump COP",
1138 : Constant::Units::None,
1139 1 : ihp.TotalCOP,
1140 : OutputProcessor::TimeStepType::System,
1141 : OutputProcessor::StoreType::Average,
1142 1 : ihp.Name);
1143 2 : SetupOutputVariable(state,
1144 : "Integrated Heat Pump Electricity Energy",
1145 : Constant::Units::J,
1146 1 : ihp.Energy,
1147 : OutputProcessor::TimeStepType::System,
1148 : OutputProcessor::StoreType::Sum,
1149 1 : ihp.Name);
1150 2 : SetupOutputVariable(state,
1151 : "Integrated Heat Pump Air Total Cooling Energy",
1152 : Constant::Units::J,
1153 1 : ihp.EnergyLoadTotalCooling,
1154 : OutputProcessor::TimeStepType::System,
1155 : OutputProcessor::StoreType::Sum,
1156 1 : ihp.Name);
1157 2 : SetupOutputVariable(state,
1158 : "Integrated Heat Pump Air Heating Energy",
1159 : Constant::Units::J,
1160 1 : ihp.EnergyLoadTotalHeating,
1161 : OutputProcessor::TimeStepType::System,
1162 : OutputProcessor::StoreType::Sum,
1163 1 : ihp.Name);
1164 2 : SetupOutputVariable(state,
1165 : "Integrated Heat Pump Water Heating Energy",
1166 : Constant::Units::J,
1167 1 : ihp.EnergyLoadTotalWaterHeating,
1168 : OutputProcessor::TimeStepType::System,
1169 : OutputProcessor::StoreType::Sum,
1170 1 : ihp.Name);
1171 2 : SetupOutputVariable(state,
1172 : "Integrated Heat Pump Air Latent Cooling Energy",
1173 : Constant::Units::J,
1174 1 : ihp.EnergyLatent,
1175 : OutputProcessor::TimeStepType::System,
1176 : OutputProcessor::StoreType::Sum,
1177 1 : ihp.Name);
1178 2 : SetupOutputVariable(state,
1179 : "Integrated Heat Pump Source Heat Transfer Energy",
1180 : Constant::Units::J,
1181 1 : ihp.EnergySource,
1182 : OutputProcessor::TimeStepType::System,
1183 : OutputProcessor::StoreType::Sum,
1184 1 : ihp.Name);
1185 : }
1186 1 : }
1187 :
1188 0 : void SizeIHP(EnergyPlusData &state, int const DXCoilNum)
1189 : {
1190 : using DataSizing::AutoSize;
1191 : using VariableSpeedCoils::SetVarSpeedCoilData;
1192 : using VariableSpeedCoils::SimVariableSpeedCoils;
1193 : using VariableSpeedCoils::SizeVarSpeedCoil;
1194 :
1195 0 : bool ErrorsFound = false;
1196 0 : Real64 RatedCapacity(0.0); // rated building cooling load
1197 :
1198 : // Obtains and Allocates AS-IHP related parameters from input file
1199 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1200 0 : GetIHPInput(state);
1201 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1202 : };
1203 :
1204 0 : if (DXCoilNum > static_cast<int>(state.dataIntegratedHP->IntegratedHeatPumps.size()) || DXCoilNum < 1) {
1205 0 : ShowFatalError(state,
1206 0 : format("SizeIHP: Invalid CompIndex passed={}, Number of Integrated HPs={}, IHP name=AS-IHP",
1207 : DXCoilNum,
1208 0 : state.dataIntegratedHP->IntegratedHeatPumps.size()));
1209 : }
1210 :
1211 0 : if (state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum).IHPCoilsSized) {
1212 0 : return;
1213 : }
1214 :
1215 0 : auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum);
1216 :
1217 : // associate SC coil with SH coil
1218 0 : bool errFlag = false;
1219 0 : SetVarSpeedCoilData(state, ihp.SCCoilIndex, errFlag, _, ihp.SHCoilIndex);
1220 0 : if (errFlag) {
1221 0 : ShowSevereError(state, format(R"(SizeIHP: Could not match cooling coil"{}" with heating coil="{}")", ihp.SCCoilName, ihp.SHCoilName));
1222 0 : ErrorsFound = true;
1223 : };
1224 :
1225 0 : errFlag = false;
1226 0 : SizeVarSpeedCoil(state, ihp.SCCoilIndex, errFlag); // size cooling coil
1227 0 : if (errFlag) {
1228 0 : ShowSevereError(state, format("SizeIHP: failed to size SC coil\"{}\"", ihp.SCCoilName));
1229 0 : ErrorsFound = true;
1230 : } else {
1231 0 : RatedCapacity = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCCoilIndex).RatedCapCoolTotal;
1232 : };
1233 :
1234 0 : errFlag = false;
1235 0 : SizeVarSpeedCoil(state, ihp.SHCoilIndex, errFlag); // size heating coil
1236 0 : if (errFlag) {
1237 0 : ShowSevereError(state, format("SizeIHP: failed to size SH coil\"{}\"", ihp.SHCoilName));
1238 0 : ErrorsFound = true;
1239 : };
1240 :
1241 : // pass SC coil capacity to SCDWH cool coil
1242 0 : if (state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHCoolCoilIndex).RatedCapCoolTotal == AutoSize) {
1243 0 : state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHCoolCoilIndex).RatedCapCoolTotal = RatedCapacity;
1244 : };
1245 :
1246 : // associate SCDWH air coil to SHDWH air coil
1247 0 : errFlag = false;
1248 0 : SetVarSpeedCoilData(state, ihp.SCDWHCoolCoilIndex, errFlag, _, ihp.SHDWHHeatCoilIndex);
1249 : // size SCDWH air coil
1250 0 : SizeVarSpeedCoil(state, ihp.SCDWHCoolCoilIndex, errFlag);
1251 0 : if (errFlag) {
1252 0 : ShowSevereError(state, format("SizeIHP: failed to size SCDWH cooling coil\"{}\"", ihp.SCDWHCoolCoilName));
1253 0 : ErrorsFound = true;
1254 : };
1255 :
1256 : // size SHDWH air coil
1257 0 : errFlag = false;
1258 0 : SizeVarSpeedCoil(state, ihp.SHDWHHeatCoilIndex, errFlag);
1259 0 : if (errFlag) {
1260 0 : ShowSevereError(state, format("SizeIHP: failed to size SHDWH heating coil\"{}\"", ihp.SHDWHHeatCoilName));
1261 0 : ErrorsFound = true;
1262 : };
1263 :
1264 : // size the water coils below
1265 : // size SCWH water coil
1266 0 : if (state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCWHCoilIndex).RatedCapWH == AutoSize) {
1267 0 : state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCWHCoilIndex).RatedCapWH =
1268 0 : RatedCapacity / (1.0 - 1.0 / state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCWHCoilIndex).RatedCOPHeat);
1269 : }
1270 :
1271 0 : errFlag = false;
1272 0 : SizeVarSpeedCoil(state, ihp.SCWHCoilIndex, errFlag);
1273 0 : if (errFlag) {
1274 0 : ShowSevereError(state, format("SizeIHP: failed to size SCWH coil\"{}\"", ihp.SCWHCoilName));
1275 0 : ErrorsFound = true;
1276 : };
1277 :
1278 : // size DWH water coil
1279 0 : if (state.dataVariableSpeedCoils->VarSpeedCoil(ihp.DWHCoilIndex).RatedCapWH == AutoSize) {
1280 0 : state.dataVariableSpeedCoils->VarSpeedCoil(ihp.DWHCoilIndex).RatedCapWH = RatedCapacity;
1281 : }
1282 :
1283 0 : errFlag = false;
1284 0 : SizeVarSpeedCoil(state, ihp.DWHCoilIndex, errFlag);
1285 0 : if (errFlag) {
1286 0 : ShowSevereError(state, format("SizeIHP: failed to size DWH coil\"{}\"", ihp.DWHCoilName));
1287 0 : ErrorsFound = true;
1288 : };
1289 :
1290 : // size SCDWH water coil
1291 0 : if (state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHWHCoilIndex).RatedCapWH == AutoSize) {
1292 0 : state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHWHCoilIndex).RatedCapWH = RatedCapacity * 0.13;
1293 : }
1294 :
1295 0 : errFlag = false;
1296 0 : SizeVarSpeedCoil(state, ihp.SCDWHWHCoilIndex, errFlag);
1297 0 : if (errFlag) {
1298 0 : ShowSevereError(state, format("SizeIHP: failed to size SCDWH water heating coil\"{}\"", ihp.SCDWHWHCoilName));
1299 0 : ErrorsFound = true;
1300 : };
1301 :
1302 : // size SHDWH water coil
1303 0 : if (state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHWHCoilIndex).RatedCapWH == AutoSize) {
1304 0 : state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHWHCoilIndex).RatedCapWH = RatedCapacity * 0.1;
1305 : }
1306 :
1307 0 : errFlag = false;
1308 0 : SizeVarSpeedCoil(state, ihp.SHDWHWHCoilIndex, errFlag);
1309 0 : if (errFlag) {
1310 0 : ShowSevereError(state, format("SizeIHP: failed to size SHDWH water heating coil\"{}\"", ihp.SHDWHWHCoilName));
1311 0 : ErrorsFound = true;
1312 : };
1313 :
1314 0 : if (ErrorsFound) {
1315 0 : ShowFatalError(state, "Program terminates due to preceding condition(s).");
1316 : }
1317 :
1318 0 : ihp.IHPCoilsSized = true;
1319 : }
1320 :
1321 0 : void InitializeIHP(EnergyPlusData &state, int const DXCoilNum)
1322 : {
1323 : // Obtains and Allocates AS-IHP related parameters from input file
1324 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1325 0 : GetIHPInput(state);
1326 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1327 : }
1328 :
1329 0 : if (DXCoilNum > static_cast<int>(state.dataIntegratedHP->IntegratedHeatPumps.size()) || DXCoilNum < 1) {
1330 0 : ShowFatalError(state,
1331 0 : format("InitializeIHP: Invalid CompIndex passed={}, Number of Integrated HPs={}, IHP name=AS-IHP",
1332 : DXCoilNum,
1333 0 : state.dataIntegratedHP->IntegratedHeatPumps.size()));
1334 : }
1335 :
1336 0 : auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum);
1337 :
1338 0 : ihp.AirLoopFlowRate = 0.0; // air loop mass flow rate [kg/s]
1339 0 : ihp.TankSourceWaterMassFlowRate = 0.0; // water loop mass flow rate [kg/s]
1340 0 : ihp.TotalCoolingRate = 0.0; // total cooling rate [w]
1341 0 : ihp.TotalWaterHeatingRate = 0.0; // total water heating rate [w]
1342 0 : ihp.TotalSpaceHeatingRate = 0.0; // total space heating rate [w]
1343 0 : ihp.TotalPower = 0.0; // total power consumption [w]
1344 0 : ihp.TotalLatentLoad = 0.0; // total latent cooling rate [w]
1345 0 : ihp.Qsource = 0.0; // source energy rate, [w]
1346 0 : ihp.Energy = 0.0; // total electric energy consumption [J]
1347 0 : ihp.EnergyLoadTotalCooling = 0.0; // total cooling energy [J]
1348 0 : ihp.EnergyLoadTotalHeating = 0.0; // total heating energy [J]
1349 0 : ihp.EnergyLoadTotalWaterHeating = 0.0; // total heating energy [J]
1350 0 : ihp.EnergyLatent = 0.0; // total latent energy [J]
1351 0 : ihp.EnergySource = 0.0; // total source energy
1352 0 : ihp.TotalCOP = 0.0;
1353 0 : }
1354 :
1355 0 : void UpdateIHP(EnergyPlusData &state, int const DXCoilNum)
1356 : {
1357 0 : Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec;
1358 :
1359 : // Obtains and Allocates AS-IHP related parameters from input file
1360 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1361 0 : GetIHPInput(state);
1362 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1363 : }
1364 :
1365 0 : if (DXCoilNum > static_cast<int>(state.dataIntegratedHP->IntegratedHeatPumps.size()) || DXCoilNum < 1) {
1366 0 : ShowFatalError(state,
1367 0 : format("UpdateIHP: Invalid CompIndex passed={}, Number of Integrated HPs={}, IHP name=AS-IHP",
1368 : DXCoilNum,
1369 0 : state.dataIntegratedHP->IntegratedHeatPumps.size()));
1370 : }
1371 :
1372 0 : auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum);
1373 :
1374 0 : switch (ihp.CurMode) {
1375 0 : case IHPOperationMode::SpaceClg:
1376 0 : ihp.TotalCoolingRate = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCCoilIndex).QLoadTotal; // total cooling rate [w]
1377 0 : ihp.TotalWaterHeatingRate = 0.0; // total water heating rate [w]
1378 0 : ihp.TotalSpaceHeatingRate = 0.0; // total space heating rate [w]
1379 0 : ihp.TotalPower = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCCoilIndex).Power; // total power consumption [w]
1380 0 : ihp.TotalLatentLoad = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCCoilIndex).QLatent; // total latent cooling rate [w]
1381 0 : ihp.Qsource = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCCoilIndex).QSource; // source energy rate, [w]
1382 0 : break;
1383 0 : case IHPOperationMode::SpaceHtg:
1384 0 : ihp.TotalCoolingRate = 0.0; // total cooling rate [w]
1385 0 : ihp.TotalWaterHeatingRate = 0.0; // total water heating rate [w]
1386 0 : ihp.TotalSpaceHeatingRate = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHCoilIndex).QLoadTotal; // total space heating rate [w]
1387 0 : ihp.TotalPower = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHCoilIndex).Power; // total power consumption [w]
1388 0 : ihp.TotalLatentLoad = 0.0; // total latent cooling rate [w]
1389 0 : ihp.Qsource = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHCoilIndex).QSource; // source energy rate, [w]
1390 0 : break;
1391 0 : case IHPOperationMode::DedicatedWaterHtg:
1392 0 : ihp.TotalCoolingRate = 0.0; // total cooling rate [w]
1393 0 : ihp.TotalWaterHeatingRate = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.DWHCoilIndex).QSource; // total water heating rate [w]
1394 0 : ihp.TotalSpaceHeatingRate = 0.0; // total space heating rate [w]
1395 0 : ihp.TotalPower = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.DWHCoilIndex).Power; // total power consumption [w]
1396 0 : ihp.TotalLatentLoad = 0.0; // total latent cooling rate [w]
1397 0 : ihp.Qsource = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.DWHCoilIndex).QLoadTotal; // source energy rate, [w]
1398 0 : break;
1399 0 : case IHPOperationMode::SCWHMatchSC:
1400 : case IHPOperationMode::SCWHMatchWH:
1401 0 : ihp.TotalCoolingRate = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCWHCoilIndex).QLoadTotal; // total cooling rate [w]
1402 0 : ihp.TotalWaterHeatingRate = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCWHCoilIndex).QSource; // total water heating rate [w]
1403 0 : ihp.TotalSpaceHeatingRate = 0.0; // total space heating rate [w]
1404 0 : ihp.TotalPower = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCWHCoilIndex).Power; // total power consumption [w]
1405 0 : ihp.TotalLatentLoad = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCWHCoilIndex).QLatent; // total latent cooling rate [w]
1406 0 : ihp.Qsource = 0.0; // source energy rate, [w]
1407 0 : break;
1408 0 : case IHPOperationMode::SpaceClgDedicatedWaterHtg:
1409 0 : ihp.TotalCoolingRate = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHCoolCoilIndex).QLoadTotal; // total cooling rate [w]
1410 0 : ihp.TotalSpaceHeatingRate = 0.0; // total space heating rate [w]
1411 0 : ihp.TotalPower = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHCoolCoilIndex).Power; // total power consumption [w]
1412 0 : ihp.TotalLatentLoad = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHCoolCoilIndex).QLatent; // total latent cooling rate [w]
1413 0 : ihp.Qsource = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHCoolCoilIndex).QSource; // source energy rate, [w]
1414 :
1415 0 : ihp.TotalWaterHeatingRate = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHWHCoilIndex).QSource; // total water heating rate [w]
1416 :
1417 0 : break;
1418 0 : case IHPOperationMode::SHDWHElecHeatOff:
1419 : case IHPOperationMode::SHDWHElecHeatOn:
1420 0 : ihp.TotalCoolingRate = 0.0; // total cooling rate [w]
1421 0 : ihp.TotalSpaceHeatingRate = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHHeatCoilIndex).QLoadTotal; // total space heating rate [w]
1422 0 : ihp.TotalPower = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHHeatCoilIndex).Power; // total power consumption [w]
1423 0 : ihp.TotalLatentLoad = 0.0; // total latent cooling rate [w]
1424 0 : ihp.Qsource = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHHeatCoilIndex).QSource; // source energy rate, [w]
1425 :
1426 0 : ihp.TotalWaterHeatingRate = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHWHCoilIndex).QSource; // total water heating rate [w]
1427 :
1428 0 : break;
1429 0 : case IHPOperationMode::Idle:
1430 : default:
1431 0 : break;
1432 : }
1433 :
1434 0 : ihp.Energy = ihp.TotalPower * TimeStepSysSec; // total electric energy consumption [J]
1435 0 : ihp.EnergyLoadTotalCooling = ihp.TotalCoolingRate * TimeStepSysSec; // total cooling energy [J]
1436 0 : ihp.EnergyLoadTotalHeating = ihp.TotalSpaceHeatingRate * TimeStepSysSec; // total heating energy [J]
1437 0 : ihp.EnergyLoadTotalWaterHeating = ihp.TotalWaterHeatingRate * TimeStepSysSec; // total heating energy [J]
1438 0 : ihp.EnergyLatent = ihp.TotalLatentLoad * TimeStepSysSec; // total latent energy [J]
1439 0 : ihp.EnergySource = ihp.Qsource * TimeStepSysSec; // total source energy
1440 :
1441 0 : if (ihp.TotalPower > 0.0) {
1442 0 : Real64 TotalDelivery = ihp.TotalCoolingRate + ihp.TotalSpaceHeatingRate + ihp.TotalWaterHeatingRate;
1443 0 : ihp.TotalCOP = TotalDelivery / ihp.TotalPower;
1444 : }
1445 0 : }
1446 :
1447 0 : void DecideWorkMode(EnergyPlusData &state,
1448 : int const DXCoilNum,
1449 : Real64 const SensLoad, // Sensible demand load [W]
1450 : Real64 const LatentLoad // Latent demand load [W]
1451 : ) // shall be called from a air loop parent
1452 : {
1453 : // AUTHOR Bo Shen, ORNL
1454 : // DATE WRITTEN March 2016
1455 : // RE-ENGINEERED na
1456 :
1457 : // PURPOSE OF THIS SUBROUTINE:
1458 : // This subroutine determine the IHP working mode in the next time step,
1459 : // it should be called by an air loop parent object, when FirstHVACIteration == true
1460 :
1461 : // Using/Aliasing
1462 : using HVAC::SmallLoad;
1463 : using WaterThermalTanks::GetWaterThermalTankInput;
1464 :
1465 0 : Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec;
1466 :
1467 0 : Real64 MyLoad(0.0);
1468 0 : Real64 WHHeatTimeSav(0.0); // time accumulation for water heating
1469 0 : Real64 WHHeatVolSave(0.0); // volume accumulation for water heating
1470 :
1471 : // Obtains and Allocates AS-IHP related parameters from input file
1472 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1473 0 : GetIHPInput(state);
1474 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1475 : }
1476 :
1477 0 : if (DXCoilNum > static_cast<int>(state.dataIntegratedHP->IntegratedHeatPumps.size()) || DXCoilNum < 1) {
1478 0 : ShowFatalError(state,
1479 0 : format("DecideWorkMode: Invalid CompIndex passed={}, Number of Integrated HPs={}, IHP name=AS-IHP",
1480 : DXCoilNum,
1481 0 : state.dataIntegratedHP->IntegratedHeatPumps.size()));
1482 : }
1483 :
1484 0 : auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum);
1485 :
1486 0 : if (ihp.IHPCoilsSized == false) SizeIHP(state, DXCoilNum);
1487 :
1488 : // decide working mode at the first moment
1489 : // check if there is a water heating call
1490 0 : ihp.IsWHCallAvail = false;
1491 0 : ihp.CheckWHCall = true; // set checking flag
1492 0 : if (ihp.WHtankID == 0) // not initialized yet
1493 : {
1494 0 : ihp.IsWHCallAvail = false;
1495 : } else {
1496 0 : state.dataLoopNodes->Node(ihp.WaterInletNodeNum).MassFlowRate = GetWaterVolFlowRateIHP(state, DXCoilNum, 1.0, 1.0) * WaterDensity;
1497 0 : state.dataLoopNodes->Node(ihp.WaterOutletNodeNum).Temp = state.dataLoopNodes->Node(ihp.WaterInletNodeNum).Temp;
1498 :
1499 0 : DataPlant::PlantEquipmentType tankType = ihp.WHtankType;
1500 :
1501 0 : switch (tankType) {
1502 0 : case DataPlant::PlantEquipmentType::WtrHeaterMixed:
1503 : case DataPlant::PlantEquipmentType::WtrHeaterStratified:
1504 : case DataPlant::PlantEquipmentType::ChilledWaterTankMixed:
1505 : case DataPlant::PlantEquipmentType::ChilledWaterTankStratified:
1506 :
1507 : {
1508 0 : int tankIDX = WaterThermalTanks::getTankIDX(state, ihp.WHtankName, ihp.WHtankID);
1509 0 : auto &tank = state.dataWaterThermalTanks->WaterThermalTank(tankIDX);
1510 0 : tank.callerLoopNum = ihp.LoopNum;
1511 0 : PlantLocation A(0, DataPlant::LoopSideLocation::Invalid, 0, 0);
1512 0 : tank.simulate(state, A, true, MyLoad, true);
1513 0 : tank.callerLoopNum = 0;
1514 :
1515 0 : break;
1516 : }
1517 0 : case DataPlant::PlantEquipmentType::HeatPumpWtrHeaterPumped:
1518 : case DataPlant::PlantEquipmentType::HeatPumpWtrHeaterWrapped:
1519 :
1520 : {
1521 0 : int hpIDX = WaterThermalTanks::getHPTankIDX(state, ihp.WHtankName, ihp.WHtankID);
1522 0 : auto &HPWH = state.dataWaterThermalTanks->HPWaterHeater(hpIDX);
1523 0 : int tankIDX = HPWH.WaterHeaterTankNum;
1524 0 : auto &tank = state.dataWaterThermalTanks->WaterThermalTank(tankIDX);
1525 0 : tank.callerLoopNum = ihp.LoopNum;
1526 0 : ihp.WHtankType = tankType;
1527 0 : PlantLocation A(0, DataPlant::LoopSideLocation::Invalid, 0, 0);
1528 0 : HPWH.simulate(state, A, true, MyLoad, true);
1529 0 : tank.callerLoopNum = 0;
1530 0 : break;
1531 : }
1532 0 : default:
1533 0 : break;
1534 : }
1535 : }
1536 0 : ihp.CheckWHCall = false; // clear checking flag
1537 :
1538 : // keep the water heating time and volume history
1539 0 : WHHeatTimeSav = ihp.SHDWHRunTime;
1540 0 : if (IHPOperationMode::SpaceClgDedicatedWaterHtg == ihp.CurMode) {
1541 0 : WHHeatVolSave = ihp.WaterFlowAccumVol +
1542 0 : state.dataLoopNodes->Node(ihp.WaterTankoutNod).MassFlowRate / 983.0 * TimeStepSysSec; // 983 - water density at 60 C
1543 : } else {
1544 0 : WHHeatVolSave = 0.0;
1545 : }
1546 :
1547 : // clear the accumulation amount for other modes
1548 0 : ihp.SHDWHRunTime = 0.0;
1549 0 : ihp.WaterFlowAccumVol = 0.0;
1550 :
1551 0 : if (!ihp.IsWHCallAvail) // no water heating call
1552 : {
1553 0 : if ((SensLoad < (-1.0 * SmallLoad)) || (LatentLoad < (-1.0 * SmallLoad))) // space cooling mode
1554 : {
1555 0 : ihp.CurMode = IHPOperationMode::SpaceClg;
1556 0 : } else if (SensLoad > SmallLoad) {
1557 0 : if ((ihp.ControlledZoneTemp > ihp.TindoorOverCoolAllow) &&
1558 0 : (state.dataEnvrn->OutDryBulbTemp > ihp.TambientOverCoolAllow)) // used for cooling season, avoid heating after SCWH mode
1559 0 : ihp.CurMode = IHPOperationMode::Idle;
1560 : else
1561 0 : ihp.CurMode = IHPOperationMode::SpaceHtg;
1562 : } else {
1563 0 : ihp.CurMode = IHPOperationMode::Idle;
1564 : }
1565 : }
1566 : // below has water heating calls
1567 0 : else if ((SensLoad < (-1.0 * SmallLoad)) || (LatentLoad < (-1.0 * SmallLoad))) // simultaneous SC and WH calls
1568 : {
1569 0 : if (WHHeatVolSave < ihp.WaterVolSCDWH) // small water heating amount
1570 : {
1571 0 : ihp.CurMode = IHPOperationMode::SpaceClgDedicatedWaterHtg;
1572 0 : ihp.WaterFlowAccumVol = WHHeatVolSave;
1573 : } else {
1574 0 : if (1 == ihp.ModeMatchSCWH) // water heating priority
1575 0 : ihp.CurMode = IHPOperationMode::SCWHMatchWH;
1576 : else // space cooling priority
1577 0 : ihp.CurMode = IHPOperationMode::SCWHMatchSC;
1578 : };
1579 :
1580 0 : } else if ((ihp.ControlledZoneTemp > ihp.TindoorOverCoolAllow) &&
1581 0 : (state.dataEnvrn->OutDryBulbTemp > ihp.TambientOverCoolAllow)) // over-cooling allowed, water heating priority
1582 : {
1583 0 : ihp.CurMode = IHPOperationMode::SCWHMatchWH;
1584 0 : } else if ((ihp.ControlledZoneTemp > ihp.TindoorWHHighPriority) &&
1585 0 : (state.dataEnvrn->OutDryBulbTemp > ihp.TambientWHHighPriority)) // ignore space heating request
1586 : {
1587 0 : ihp.CurMode = IHPOperationMode::DedicatedWaterHtg;
1588 0 : } else if (SensLoad > SmallLoad) {
1589 0 : ihp.SHDWHRunTime = WHHeatTimeSav + TimeStepSysSec;
1590 :
1591 0 : if (WHHeatTimeSav > ihp.TimeLimitSHDWH) {
1592 0 : ihp.CurMode = IHPOperationMode::SHDWHElecHeatOn;
1593 : } else {
1594 0 : ihp.CurMode = IHPOperationMode::SHDWHElecHeatOff;
1595 : };
1596 : } else {
1597 0 : ihp.CurMode = IHPOperationMode::DedicatedWaterHtg;
1598 : }
1599 :
1600 : // clear up, important
1601 0 : ClearCoils(state, DXCoilNum);
1602 0 : }
1603 :
1604 0 : void ClearCoils(EnergyPlusData &state, int const DXCoilNum)
1605 : {
1606 : using VariableSpeedCoils::SimVariableSpeedCoils;
1607 :
1608 : // Obtains and Allocates WatertoAirHP related parameters from input file
1609 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1610 0 : GetIHPInput(state);
1611 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1612 : }
1613 :
1614 0 : if (DXCoilNum > static_cast<int>(state.dataIntegratedHP->IntegratedHeatPumps.size()) || DXCoilNum < 1) {
1615 0 : ShowFatalError(state,
1616 0 : format("ClearCoils: Invalid CompIndex passed={}, Number of Integrated HPs={}, IHP name=AS-IHP",
1617 : DXCoilNum,
1618 0 : state.dataIntegratedHP->IntegratedHeatPumps.size()));
1619 : }
1620 :
1621 0 : auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum);
1622 :
1623 : // clear up
1624 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHCoolCoilIndex, HVAC::FanOp::Cycling, HVAC::CompressorOp::On, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
1625 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCDWHWHCoilIndex, HVAC::FanOp::Cycling, HVAC::CompressorOp::On, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
1626 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHHeatCoilIndex, HVAC::FanOp::Cycling, HVAC::CompressorOp::On, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
1627 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHDWHWHCoilIndex, HVAC::FanOp::Cycling, HVAC::CompressorOp::On, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
1628 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCWHCoilIndex, HVAC::FanOp::Cycling, HVAC::CompressorOp::On, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
1629 0 : SimVariableSpeedCoils(state, std::string(), ihp.SCCoilIndex, HVAC::FanOp::Cycling, HVAC::CompressorOp::On, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
1630 0 : SimVariableSpeedCoils(state, std::string(), ihp.SHCoilIndex, HVAC::FanOp::Cycling, HVAC::CompressorOp::On, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
1631 0 : SimVariableSpeedCoils(state, std::string(), ihp.DWHCoilIndex, HVAC::FanOp::Cycling, HVAC::CompressorOp::On, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
1632 0 : }
1633 :
1634 2 : IHPOperationMode GetCurWorkMode(EnergyPlusData &state, int const DXCoilNum)
1635 : {
1636 : // Obtains and Allocates WatertoAirHP related parameters from input file
1637 2 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1638 0 : GetIHPInput(state);
1639 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1640 : }
1641 :
1642 2 : if (DXCoilNum > static_cast<int>(state.dataIntegratedHP->IntegratedHeatPumps.size()) || DXCoilNum < 1) {
1643 3 : ShowFatalError(state,
1644 4 : format("GetCurWorkMode: Invalid CompIndex passed={}, Number of Integrated HPs={}, IHP name=AS-IHP",
1645 : DXCoilNum,
1646 2 : state.dataIntegratedHP->IntegratedHeatPumps.size()));
1647 : }
1648 :
1649 1 : if (state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum).IHPCoilsSized == false) SizeIHP(state, DXCoilNum);
1650 :
1651 1 : return (state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum).CurMode);
1652 : }
1653 :
1654 0 : bool IHPInModel(EnergyPlusData &state)
1655 : {
1656 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) {
1657 0 : GetIHPInput(state);
1658 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1659 : }
1660 0 : return !state.dataIntegratedHP->IntegratedHeatPumps.empty();
1661 : }
1662 :
1663 2 : int GetCoilIndexIHP(EnergyPlusData &state,
1664 : std::string const &CoilType, // must match coil types in this module
1665 : std::string const &CoilName, // must match coil names for the coil type
1666 : bool &ErrorsFound // set to true if problem
1667 : )
1668 : {
1669 :
1670 : // FUNCTION INFORMATION:
1671 : // AUTHOR Bo Shen
1672 : // DATE WRITTEN March 2016
1673 : // MODIFIED na
1674 : // RE-ENGINEERED na
1675 :
1676 : // PURPOSE OF THIS FUNCTION:
1677 : // This function looks up the coil index for the given coil and returns it. If
1678 : // incorrect coil type or name is given, ErrorsFound is returned as true and index is returned
1679 : // as zero.
1680 :
1681 : // Return value
1682 : int IndexNum; // returned index of matched coil
1683 :
1684 : // Obtains and Allocates WatertoAirHP related parameters from input file
1685 2 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1686 0 : GetIHPInput(state);
1687 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1688 : }
1689 :
1690 2 : IndexNum = Util::FindItemInList(CoilName, state.dataIntegratedHP->IntegratedHeatPumps);
1691 :
1692 2 : if (IndexNum == 0) {
1693 1 : ShowSevereError(state, format(R"(GetCoilIndexIHP: Could not find CoilType="{}" with Name="{}")", CoilType, CoilName));
1694 1 : ErrorsFound = true;
1695 : }
1696 :
1697 2 : return IndexNum;
1698 : }
1699 :
1700 2 : int GetCoilInletNodeIHP(EnergyPlusData &state,
1701 : std::string const &CoilType, // must match coil types in this module
1702 : std::string const &CoilName, // must match coil names for the coil type
1703 : bool &ErrorsFound // set to true if problem
1704 : )
1705 : {
1706 : // FUNCTION INFORMATION:
1707 : // AUTHOR Bo Shen
1708 : // DATE WRITTEN March 2016
1709 : // MODIFIED na
1710 : // RE-ENGINEERED na
1711 :
1712 : // PURPOSE OF THIS FUNCTION:
1713 : // This function looks up the given coil and returns the inlet node. If
1714 : // incorrect coil type or name is given, ErrorsFound is returned as true and value is returned
1715 : // as zero.
1716 :
1717 : // Return value
1718 2 : int NodeNumber(0); // returned outlet node of matched coil
1719 :
1720 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
1721 : int WhichCoil;
1722 :
1723 : // Obtains and Allocates WatertoAirHP related parameters from input file
1724 2 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1725 0 : GetIHPInput(state);
1726 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1727 : }
1728 :
1729 2 : WhichCoil = Util::FindItemInList(CoilName, state.dataIntegratedHP->IntegratedHeatPumps);
1730 2 : if (WhichCoil != 0) {
1731 1 : NodeNumber = state.dataIntegratedHP->IntegratedHeatPumps(WhichCoil).AirCoolInletNodeNum;
1732 : }
1733 :
1734 2 : if (WhichCoil == 0) {
1735 1 : ShowSevereError(state, format(R"(GetCoilInletNodeIHP: Could not find CoilType="{}" with Name="{}")", CoilType, CoilName));
1736 1 : ErrorsFound = true;
1737 1 : NodeNumber = 0;
1738 : }
1739 :
1740 2 : return NodeNumber;
1741 : }
1742 :
1743 0 : int GetDWHCoilInletNodeIHP(EnergyPlusData &state,
1744 : std::string const &CoilType, // must match coil types in this module
1745 : std::string const &CoilName, // must match coil names for the coil type
1746 : bool &ErrorsFound // set to true if problem
1747 : )
1748 : {
1749 : // FUNCTION INFORMATION:
1750 : // AUTHOR Bo Shen
1751 : // DATE WRITTEN July 2016
1752 : // MODIFIED na
1753 : // RE-ENGINEERED na
1754 :
1755 : // PURPOSE OF THIS FUNCTION:
1756 : // This function looks up the given coil and returns the inlet node. If
1757 : // incorrect coil type or name is given, ErrorsFound is returned as true and value is returned
1758 : // as zero.
1759 :
1760 : // Return value
1761 0 : int NodeNumber(0); // returned outlet node of matched coil
1762 :
1763 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
1764 : int WhichCoil;
1765 :
1766 : // Obtains and Allocates WatertoAirHP related parameters from input file
1767 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1768 0 : GetIHPInput(state);
1769 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1770 : }
1771 :
1772 0 : WhichCoil = Util::FindItemInList(CoilName, state.dataIntegratedHP->IntegratedHeatPumps);
1773 0 : if (WhichCoil != 0) {
1774 0 : NodeNumber = state.dataIntegratedHP->IntegratedHeatPumps(WhichCoil).ODAirInletNodeNum;
1775 : }
1776 :
1777 0 : if (WhichCoil == 0) {
1778 0 : ShowSevereError(state, format(R"(GetCoilInletNodeIHP: Could not find CoilType="{}" with Name="{}")", CoilType, CoilName));
1779 0 : ErrorsFound = true;
1780 0 : NodeNumber = 0;
1781 : }
1782 :
1783 0 : return NodeNumber;
1784 : }
1785 :
1786 0 : int GetDWHCoilOutletNodeIHP(EnergyPlusData &state,
1787 : std::string const &CoilType, // must match coil types in this module
1788 : std::string const &CoilName, // must match coil names for the coil type
1789 : bool &ErrorsFound // set to true if problem
1790 : )
1791 : {
1792 : // FUNCTION INFORMATION:
1793 : // AUTHOR Bo Shen
1794 : // DATE WRITTEN July 2016
1795 : // MODIFIED na
1796 : // RE-ENGINEERED na
1797 :
1798 : // PURPOSE OF THIS FUNCTION:
1799 : // This function looks up the given coil and returns the outlet node. If
1800 : // incorrect coil type or name is given, ErrorsFound is returned as true and value is returned
1801 : // as zero.
1802 :
1803 : // Return value
1804 0 : int NodeNumber(0); // returned outlet node of matched coil
1805 :
1806 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
1807 : int WhichCoil;
1808 :
1809 : // Obtains and Allocates WatertoAirHP related parameters from input file
1810 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1811 0 : GetIHPInput(state);
1812 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1813 : }
1814 :
1815 0 : WhichCoil = Util::FindItemInList(CoilName, state.dataIntegratedHP->IntegratedHeatPumps);
1816 0 : if (WhichCoil != 0) {
1817 0 : NodeNumber = state.dataIntegratedHP->IntegratedHeatPumps(WhichCoil).ODAirOutletNodeNum;
1818 : }
1819 :
1820 0 : if (WhichCoil == 0) {
1821 0 : ShowSevereError(state, format(R"(GetCoilInletNodeIHP: Could not find CoilType="{}" with Name="{}")", CoilType, CoilName));
1822 0 : ErrorsFound = true;
1823 0 : NodeNumber = 0;
1824 : }
1825 :
1826 0 : return NodeNumber;
1827 : }
1828 :
1829 0 : int GetIHPDWHCoilPLFFPLR(EnergyPlusData &state,
1830 : std::string const &CoilType, // must match coil types in this module
1831 : std::string const &CoilName, // must match coil names for the coil type
1832 : [[maybe_unused]] IHPOperationMode const Mode, // mode coil type
1833 : bool &ErrorsFound // set to true if problem
1834 : )
1835 : {
1836 : // FUNCTION INFORMATION:
1837 : // AUTHOR Bo Shen
1838 : // DATE WRITTEN March, 2016
1839 : // MODIFIED na
1840 : // RE-ENGINEERED na
1841 :
1842 : // PURPOSE OF THIS FUNCTION:
1843 : // This function looks up the given coil and returns PLR curve index. If
1844 : // incorrect coil type or name is given, ErrorsFound is returned as true and value is returned
1845 : // as zero.
1846 :
1847 : // Using/Aliasing
1848 : using VariableSpeedCoils::GetVSCoilPLFFPLR;
1849 :
1850 : // Return value
1851 0 : int PLRNumber(0); // returned outlet node of matched coil
1852 :
1853 : // Obtains and Allocates WatertoAirHP related parameters from input file
1854 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1855 0 : GetIHPInput(state);
1856 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1857 : }
1858 :
1859 0 : int WhichCoil = Util::FindItemInList(CoilName, state.dataIntegratedHP->IntegratedHeatPumps);
1860 0 : if (WhichCoil != 0) {
1861 :
1862 0 : auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(WhichCoil);
1863 :
1864 : // this will be called by HPWH parent
1865 0 : if (ihp.DWHCoilIndex > 0)
1866 0 : PLRNumber = GetVSCoilPLFFPLR(state, ihp.DWHCoilType, ihp.DWHCoilName, ErrorsFound);
1867 : else
1868 0 : PLRNumber = GetVSCoilPLFFPLR(state, ihp.SCWHCoilType, ihp.SCWHCoilName, ErrorsFound);
1869 : } else {
1870 0 : WhichCoil = 0;
1871 : }
1872 :
1873 0 : if (WhichCoil == 0) {
1874 0 : ShowSevereError(state, format(R"(GetIHPDWHCoilPLFFPLR: Could not find CoilType="{}" with Name="{}")", CoilType, CoilName));
1875 0 : ErrorsFound = true;
1876 0 : PLRNumber = 0;
1877 : }
1878 :
1879 0 : return PLRNumber;
1880 : }
1881 :
1882 0 : Real64 GetDWHCoilCapacityIHP(EnergyPlusData &state,
1883 : std::string const &CoilType, // must match coil types in this module
1884 : std::string const &CoilName, // must match coil names for the coil type
1885 : [[maybe_unused]] IHPOperationMode const Mode, // mode coil type
1886 : bool &ErrorsFound // set to true if problem
1887 : )
1888 : {
1889 :
1890 : // FUNCTION INFORMATION:
1891 : // AUTHOR Bo Shen
1892 : // DATE WRITTEN Jan 2016
1893 : // MODIFIED na
1894 : // RE-ENGINEERED na
1895 :
1896 : // PURPOSE OF THIS FUNCTION:
1897 : // This function looks up the rated coil capacity at the nominal speed level for the given coil and returns it. If
1898 : // incorrect coil type or name is given, ErrorsFound is returned as true and capacity is returned
1899 : // as negative.
1900 :
1901 : // Using/Aliasing
1902 : using VariableSpeedCoils::GetCoilCapacityVariableSpeed;
1903 :
1904 : // Return value
1905 : Real64 CoilCapacity; // returned capacity of matched coil
1906 :
1907 : // Obtains and Allocates WatertoAirHP related parameters from input file
1908 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1909 0 : GetIHPInput(state);
1910 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1911 : }
1912 :
1913 0 : int WhichCoil = Util::FindItemInList(CoilName, state.dataIntegratedHP->IntegratedHeatPumps);
1914 0 : if (WhichCoil != 0) {
1915 :
1916 0 : auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(WhichCoil);
1917 :
1918 0 : if (ihp.IHPCoilsSized == false) SizeIHP(state, WhichCoil);
1919 :
1920 0 : if (ihp.DWHCoilIndex > 0) {
1921 0 : CoilCapacity = GetCoilCapacityVariableSpeed(state, ihp.DWHCoilType, ihp.DWHCoilName, ErrorsFound);
1922 : } else {
1923 0 : CoilCapacity = GetCoilCapacityVariableSpeed(state, ihp.SCWHCoilType, ihp.SCWHCoilName, ErrorsFound);
1924 : }
1925 : } else {
1926 0 : WhichCoil = 0;
1927 : }
1928 :
1929 0 : if (WhichCoil == 0) {
1930 0 : ShowSevereError(state, format(R"(GetCoilCapacityVariableSpeed: Could not find CoilType="{}" with Name="{}")", CoilType, CoilName));
1931 0 : ErrorsFound = true;
1932 0 : CoilCapacity = -1000.0;
1933 : }
1934 :
1935 0 : return CoilCapacity;
1936 : }
1937 :
1938 10 : int GetLowSpeedNumIHP(EnergyPlusData &state, int const DXCoilNum)
1939 : {
1940 10 : int SpeedNum(0);
1941 :
1942 : // Obtains and Allocates WatertoAirHP related parameters from input file
1943 10 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1944 0 : GetIHPInput(state);
1945 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1946 : }
1947 :
1948 10 : if (DXCoilNum > static_cast<int>(state.dataIntegratedHP->IntegratedHeatPumps.size()) || DXCoilNum < 1) {
1949 3 : ShowFatalError(state,
1950 4 : format("GetLowSpeedNumIHP: Invalid CompIndex passed={}, Number of Integrated HPs={}, IHP name=AS-IHP",
1951 : DXCoilNum,
1952 2 : state.dataIntegratedHP->IntegratedHeatPumps.size()));
1953 : }
1954 :
1955 9 : auto const &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum);
1956 :
1957 9 : switch (ihp.CurMode) {
1958 4 : case IHPOperationMode::Idle:
1959 : case IHPOperationMode::SpaceClg:
1960 : case IHPOperationMode::SpaceHtg:
1961 : case IHPOperationMode::DedicatedWaterHtg:
1962 4 : SpeedNum = 1;
1963 4 : break;
1964 2 : case IHPOperationMode::SCWHMatchSC:
1965 : case IHPOperationMode::SCWHMatchWH:
1966 2 : SpeedNum = ihp.MinSpedSCWH;
1967 2 : break;
1968 1 : case IHPOperationMode::SpaceClgDedicatedWaterHtg:
1969 1 : SpeedNum = ihp.MinSpedSCDWH;
1970 1 : break;
1971 2 : case IHPOperationMode::SHDWHElecHeatOff:
1972 : case IHPOperationMode::SHDWHElecHeatOn:
1973 2 : SpeedNum = ihp.MinSpedSHDWH;
1974 2 : break;
1975 0 : default:
1976 0 : SpeedNum = 1;
1977 0 : break;
1978 : }
1979 :
1980 9 : return (SpeedNum);
1981 : }
1982 :
1983 10 : int GetMaxSpeedNumIHP(EnergyPlusData &state, int const DXCoilNum)
1984 : {
1985 : // Obtains and Allocates WatertoAirHP related parameters from input file
1986 10 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
1987 0 : GetIHPInput(state);
1988 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
1989 : }
1990 :
1991 10 : if (DXCoilNum > static_cast<int>(state.dataIntegratedHP->IntegratedHeatPumps.size()) || DXCoilNum < 1) {
1992 3 : ShowFatalError(state,
1993 4 : format("GetMaxSpeedNumIHP: Invalid CompIndex passed={}, Number of Integrated HPs={}, IHP name=AS-IHP",
1994 : DXCoilNum,
1995 2 : state.dataIntegratedHP->IntegratedHeatPumps.size()));
1996 : }
1997 :
1998 9 : int SpeedNum(0);
1999 9 : auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum);
2000 :
2001 9 : switch (ihp.CurMode) {
2002 2 : case IHPOperationMode::Idle:
2003 : case IHPOperationMode::SpaceClg:
2004 2 : SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCCoilIndex).NumOfSpeeds;
2005 2 : break;
2006 1 : case IHPOperationMode::SpaceHtg:
2007 1 : SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHCoilIndex).NumOfSpeeds;
2008 1 : break;
2009 1 : case IHPOperationMode::DedicatedWaterHtg:
2010 1 : SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.DWHCoilIndex).NumOfSpeeds;
2011 1 : break;
2012 2 : case IHPOperationMode::SCWHMatchSC:
2013 : case IHPOperationMode::SCWHMatchWH:
2014 2 : SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCWHCoilIndex).NumOfSpeeds;
2015 2 : break;
2016 1 : case IHPOperationMode::SpaceClgDedicatedWaterHtg:
2017 1 : SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHCoolCoilIndex).NumOfSpeeds;
2018 1 : break;
2019 2 : case IHPOperationMode::SHDWHElecHeatOff:
2020 : case IHPOperationMode::SHDWHElecHeatOn:
2021 2 : SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHHeatCoilIndex).NumOfSpeeds;
2022 2 : break;
2023 0 : default:
2024 0 : SpeedNum = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCCoilIndex).NumOfSpeeds;
2025 0 : break;
2026 : }
2027 :
2028 9 : return (SpeedNum);
2029 : }
2030 :
2031 0 : Real64 GetAirVolFlowRateIHP(EnergyPlusData &state,
2032 : int const DXCoilNum,
2033 : int const SpeedNum,
2034 : Real64 const SpeedRatio,
2035 : bool const IsCallbyWH // whether the call from the water heating loop or air loop, true = from water heating loop
2036 : )
2037 : {
2038 0 : int IHPCoilIndex(0);
2039 0 : Real64 AirVolFlowRate(0.0);
2040 0 : Real64 FlowScale(1.0);
2041 0 : bool IsResultFlow(false); // IsResultFlow = true, the air flow rate will be from a simultaneous mode, won't be re-calculated
2042 :
2043 : // Obtains and Allocates WatertoAirHP related parameters from input file
2044 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
2045 0 : GetIHPInput(state);
2046 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
2047 : }
2048 :
2049 0 : if (DXCoilNum > static_cast<int>(state.dataIntegratedHP->IntegratedHeatPumps.size()) || DXCoilNum < 1) {
2050 0 : ShowFatalError(state,
2051 0 : format("GetAirVolFlowRateIHP: Invalid CompIndex passed={}, Number of Integrated HPs={}, IHP name=AS-IHP",
2052 : DXCoilNum,
2053 0 : state.dataIntegratedHP->IntegratedHeatPumps.size()));
2054 : }
2055 :
2056 0 : auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum);
2057 :
2058 0 : if (!ihp.IHPCoilsSized) SizeIHP(state, DXCoilNum);
2059 :
2060 0 : FlowScale = 0.0;
2061 0 : switch (ihp.CurMode) {
2062 0 : case IHPOperationMode::Idle:
2063 0 : IHPCoilIndex = ihp.SCCoilIndex;
2064 0 : break;
2065 0 : case IHPOperationMode::SpaceClg:
2066 0 : IHPCoilIndex = ihp.SCCoilIndex;
2067 0 : if (!IsCallbyWH) // call from air loop
2068 : {
2069 0 : FlowScale = ihp.CoolVolFlowScale;
2070 : }
2071 :
2072 0 : break;
2073 0 : case IHPOperationMode::SpaceHtg:
2074 0 : IHPCoilIndex = ihp.SHCoilIndex;
2075 0 : if (!IsCallbyWH) // call from air loop
2076 : {
2077 0 : FlowScale = ihp.HeatVolFlowScale;
2078 : }
2079 0 : break;
2080 0 : case IHPOperationMode::DedicatedWaterHtg:
2081 0 : IHPCoilIndex = ihp.DWHCoilIndex;
2082 0 : FlowScale = 1.0;
2083 0 : break;
2084 0 : case IHPOperationMode::SCWHMatchSC:
2085 0 : IHPCoilIndex = ihp.SCWHCoilIndex;
2086 0 : FlowScale = ihp.CoolVolFlowScale;
2087 0 : if (IsCallbyWH) // call from water loop
2088 : {
2089 0 : IsResultFlow = true;
2090 0 : AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCWHCoilIndex).AirVolFlowRate;
2091 : }
2092 0 : break;
2093 0 : case IHPOperationMode::SCWHMatchWH:
2094 0 : IHPCoilIndex = ihp.SCWHCoilIndex;
2095 0 : FlowScale = ihp.CoolVolFlowScale;
2096 0 : if (!IsCallbyWH) {
2097 0 : IsResultFlow = true;
2098 0 : AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCWHCoilIndex).AirVolFlowRate;
2099 : }
2100 0 : break;
2101 0 : case IHPOperationMode::SpaceClgDedicatedWaterHtg:
2102 0 : IHPCoilIndex = ihp.SCDWHCoolCoilIndex;
2103 0 : FlowScale = ihp.CoolVolFlowScale;
2104 0 : if (IsCallbyWH) {
2105 0 : IsResultFlow = true;
2106 0 : AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SCDWHCoolCoilIndex).AirVolFlowRate;
2107 : }
2108 0 : break;
2109 0 : case IHPOperationMode::SHDWHElecHeatOff:
2110 : case IHPOperationMode::SHDWHElecHeatOn:
2111 0 : IHPCoilIndex = ihp.SHDWHHeatCoilIndex;
2112 0 : FlowScale = ihp.HeatVolFlowScale;
2113 0 : if (IsCallbyWH) {
2114 0 : IsResultFlow = true;
2115 0 : AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(ihp.SHDWHHeatCoilIndex).AirVolFlowRate;
2116 : }
2117 0 : break;
2118 0 : default:
2119 0 : IHPCoilIndex = ihp.SCCoilIndex;
2120 0 : FlowScale = 0.0;
2121 0 : break;
2122 : }
2123 :
2124 0 : if (!IsResultFlow) {
2125 0 : if (1 == SpeedNum)
2126 0 : AirVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(SpeedNum);
2127 : else
2128 0 : AirVolFlowRate = SpeedRatio * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(SpeedNum) +
2129 0 : (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirVolFlowRate(SpeedNum - 1);
2130 :
2131 0 : AirVolFlowRate = AirVolFlowRate * FlowScale;
2132 : }
2133 :
2134 0 : if (AirVolFlowRate > ihp.MaxCoolAirVolFlow) AirVolFlowRate = ihp.MaxCoolAirVolFlow;
2135 0 : if (AirVolFlowRate > ihp.MaxHeatAirVolFlow) AirVolFlowRate = ihp.MaxHeatAirVolFlow;
2136 :
2137 0 : return (AirVolFlowRate);
2138 : }
2139 :
2140 0 : Real64 GetWaterVolFlowRateIHP(EnergyPlusData &state, int const DXCoilNum, int const SpeedNum, Real64 const SpeedRatio)
2141 : {
2142 0 : int IHPCoilIndex(0);
2143 0 : Real64 WaterVolFlowRate(0.0);
2144 :
2145 : // Obtains and Allocates WatertoAirHP related parameters from input file
2146 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
2147 0 : GetIHPInput(state);
2148 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
2149 : }
2150 :
2151 0 : if (DXCoilNum > static_cast<int>(state.dataIntegratedHP->IntegratedHeatPumps.size()) || DXCoilNum < 1) {
2152 0 : ShowFatalError(state,
2153 0 : format("GetWaterVolFlowRateIHP: Invalid CompIndex passed={}, Number of Integrated HPs={}, IHP name=AS-IHP",
2154 : DXCoilNum,
2155 0 : state.dataIntegratedHP->IntegratedHeatPumps.size()));
2156 : }
2157 :
2158 0 : auto const &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum);
2159 :
2160 0 : if (!ihp.IHPCoilsSized) SizeIHP(state, DXCoilNum);
2161 :
2162 0 : switch (ihp.CurMode) {
2163 0 : case IHPOperationMode::Idle:
2164 : case IHPOperationMode::SpaceClg:
2165 : case IHPOperationMode::SpaceHtg:
2166 0 : WaterVolFlowRate = 0.0;
2167 0 : break;
2168 0 : case IHPOperationMode::DedicatedWaterHtg:
2169 0 : IHPCoilIndex = ihp.DWHCoilIndex;
2170 0 : if (1 == SpeedNum)
2171 0 : WaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum);
2172 : else
2173 0 : WaterVolFlowRate = SpeedRatio * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum) +
2174 0 : (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum - 1);
2175 0 : break;
2176 0 : case IHPOperationMode::SCWHMatchSC:
2177 : case IHPOperationMode::SCWHMatchWH:
2178 0 : IHPCoilIndex = ihp.SCWHCoilIndex;
2179 0 : if (1 == SpeedNum)
2180 0 : WaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum);
2181 : else
2182 0 : WaterVolFlowRate = SpeedRatio * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum) +
2183 0 : (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum - 1);
2184 0 : break;
2185 0 : case IHPOperationMode::SpaceClgDedicatedWaterHtg:
2186 0 : IHPCoilIndex = ihp.SCDWHWHCoilIndex;
2187 0 : if (1 == SpeedNum)
2188 0 : WaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum);
2189 : else
2190 0 : WaterVolFlowRate = SpeedRatio * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum) +
2191 0 : (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum - 1);
2192 0 : break;
2193 0 : case IHPOperationMode::SHDWHElecHeatOff:
2194 : case IHPOperationMode::SHDWHElecHeatOn:
2195 0 : IHPCoilIndex = ihp.SHDWHWHCoilIndex;
2196 0 : if (1 == SpeedNum)
2197 0 : WaterVolFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum);
2198 : else
2199 0 : WaterVolFlowRate = SpeedRatio * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum) +
2200 0 : (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedWaterVolFlowRate(SpeedNum - 1);
2201 0 : break;
2202 0 : default:
2203 0 : WaterVolFlowRate = 0.0;
2204 0 : break;
2205 : }
2206 :
2207 0 : return (WaterVolFlowRate);
2208 : }
2209 :
2210 0 : Real64 GetAirMassFlowRateIHP(EnergyPlusData &state,
2211 : int const DXCoilNum,
2212 : int const SpeedNum,
2213 : Real64 const SpeedRatio,
2214 : bool const IsCallbyWH // whether the call from the water heating loop or air loop, true = from water heating loop
2215 : )
2216 : {
2217 0 : int IHPCoilIndex(0);
2218 0 : Real64 AirMassFlowRate(0.0);
2219 0 : Real64 FlowScale(1.0);
2220 0 : bool IsResultFlow(false); // IsResultFlow = true, the air flow rate will be from a simultaneous mode, won't be re-calculated
2221 :
2222 : // Obtains and Allocates WatertoAirHP related parameters from input file
2223 0 : if (state.dataIntegratedHP->GetCoilsInputFlag) { // First time subroutine has been entered
2224 0 : GetIHPInput(state);
2225 0 : state.dataIntegratedHP->GetCoilsInputFlag = false;
2226 : }
2227 :
2228 0 : if (DXCoilNum > static_cast<int>(state.dataIntegratedHP->IntegratedHeatPumps.size()) || DXCoilNum < 1) {
2229 0 : ShowFatalError(state,
2230 0 : format("GetAirMassFlowRateIHP: Invalid CompIndex passed={}, Number of Integrated HPs={}, IHP name=AS-IHP",
2231 : DXCoilNum,
2232 0 : state.dataIntegratedHP->IntegratedHeatPumps.size()));
2233 : }
2234 :
2235 0 : auto &ihp = state.dataIntegratedHP->IntegratedHeatPumps(DXCoilNum);
2236 :
2237 0 : if (!ihp.IHPCoilsSized) SizeIHP(state, DXCoilNum);
2238 :
2239 0 : FlowScale = 0.0;
2240 0 : switch (ihp.CurMode) {
2241 0 : case IHPOperationMode::Idle:
2242 0 : IHPCoilIndex = ihp.SCCoilIndex;
2243 0 : AirMassFlowRate = 0.0;
2244 0 : break;
2245 0 : case IHPOperationMode::SpaceClg:
2246 0 : IHPCoilIndex = ihp.SCCoilIndex;
2247 0 : if (!IsCallbyWH) {
2248 0 : FlowScale = ihp.CoolVolFlowScale;
2249 : } else {
2250 0 : IsResultFlow = true;
2251 0 : AirMassFlowRate = ihp.AirFlowSavInAirLoop;
2252 : }
2253 0 : break;
2254 0 : case IHPOperationMode::SpaceHtg:
2255 0 : IHPCoilIndex = ihp.SHCoilIndex;
2256 0 : if (!IsCallbyWH) {
2257 0 : FlowScale = ihp.HeatVolFlowScale;
2258 : } else {
2259 0 : IsResultFlow = true;
2260 0 : AirMassFlowRate = ihp.AirFlowSavInAirLoop;
2261 : }
2262 0 : break;
2263 0 : case IHPOperationMode::DedicatedWaterHtg:
2264 0 : IHPCoilIndex = ihp.DWHCoilIndex;
2265 0 : FlowScale = 1.0;
2266 0 : break;
2267 0 : case IHPOperationMode::SCWHMatchSC:
2268 0 : IHPCoilIndex = ihp.SCWHCoilIndex;
2269 0 : FlowScale = ihp.CoolVolFlowScale;
2270 0 : state.dataLoopNodes->Node(ihp.WaterInletNodeNum).MassFlowRate = GetWaterVolFlowRateIHP(state, DXCoilNum, SpeedNum, SpeedRatio) * WaterDensity;
2271 0 : if (IsCallbyWH) {
2272 0 : IsResultFlow = true;
2273 0 : AirMassFlowRate = ihp.AirFlowSavInAirLoop;
2274 : }
2275 0 : break;
2276 0 : case IHPOperationMode::SCWHMatchWH:
2277 0 : IHPCoilIndex = ihp.SCWHCoilIndex;
2278 0 : FlowScale = ihp.CoolVolFlowScale;
2279 0 : if (!IsCallbyWH) {
2280 0 : IsResultFlow = true;
2281 0 : AirMassFlowRate = ihp.AirFlowSavInWaterLoop;
2282 : }
2283 0 : break;
2284 0 : case IHPOperationMode::SpaceClgDedicatedWaterHtg:
2285 0 : IHPCoilIndex = ihp.SCDWHCoolCoilIndex;
2286 0 : FlowScale = ihp.CoolVolFlowScale;
2287 0 : state.dataLoopNodes->Node(ihp.WaterInletNodeNum).MassFlowRate = GetWaterVolFlowRateIHP(state, DXCoilNum, SpeedNum, SpeedRatio) * WaterDensity;
2288 0 : if (IsCallbyWH) {
2289 0 : IsResultFlow = true;
2290 0 : AirMassFlowRate = ihp.AirFlowSavInAirLoop;
2291 : }
2292 0 : break;
2293 0 : case IHPOperationMode::SHDWHElecHeatOff:
2294 : case IHPOperationMode::SHDWHElecHeatOn:
2295 0 : IHPCoilIndex = ihp.SHDWHHeatCoilIndex;
2296 0 : FlowScale = ihp.HeatVolFlowScale;
2297 0 : state.dataLoopNodes->Node(ihp.WaterInletNodeNum).MassFlowRate = GetWaterVolFlowRateIHP(state, DXCoilNum, SpeedNum, SpeedRatio) * WaterDensity;
2298 0 : if (IsCallbyWH) {
2299 0 : IsResultFlow = true;
2300 0 : AirMassFlowRate = ihp.AirFlowSavInAirLoop;
2301 : }
2302 0 : break;
2303 0 : default:
2304 0 : IHPCoilIndex = ihp.SCCoilIndex;
2305 0 : FlowScale = 0.0;
2306 0 : break;
2307 : }
2308 :
2309 0 : if (!IsResultFlow) {
2310 0 : if (SpeedNum == 1) {
2311 0 : AirMassFlowRate = state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(SpeedNum);
2312 : } else {
2313 0 : AirMassFlowRate = SpeedRatio * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(SpeedNum) +
2314 0 : (1.0 - SpeedRatio) * state.dataVariableSpeedCoils->VarSpeedCoil(IHPCoilIndex).MSRatedAirMassFlowRate(SpeedNum - 1);
2315 : }
2316 :
2317 0 : AirMassFlowRate = AirMassFlowRate * FlowScale;
2318 : }
2319 :
2320 0 : if (AirMassFlowRate > ihp.MaxCoolAirMassFlow) {
2321 0 : AirMassFlowRate = ihp.MaxCoolAirMassFlow;
2322 : }
2323 0 : if (AirMassFlowRate > ihp.MaxHeatAirMassFlow) {
2324 0 : AirMassFlowRate = ihp.MaxHeatAirMassFlow;
2325 : }
2326 :
2327 : // set max air flow rate
2328 0 : state.dataLoopNodes->Node(ihp.AirCoolInletNodeNum).MassFlowRateMax = AirMassFlowRate;
2329 0 : state.dataLoopNodes->Node(ihp.AirHeatInletNodeNum).MassFlowRateMax = AirMassFlowRate;
2330 0 : state.dataLoopNodes->Node(ihp.AirOutletNodeNum).MassFlowRateMax = AirMassFlowRate;
2331 :
2332 0 : return AirMassFlowRate;
2333 : }
2334 :
2335 : } // namespace EnergyPlus::IntegratedHeatPump
|