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