Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2023, The Board of Trustees of the University of Illinois,
2 : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 : // contributors. All rights reserved.
6 : //
7 : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 : // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 : //
13 : // Redistribution and use in source and binary forms, with or without modification, are permitted
14 : // provided that the following conditions are met:
15 : //
16 : // (1) Redistributions of source code must retain the above copyright notice, this list of
17 : // conditions and the following disclaimer.
18 : //
19 : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 : // conditions and the following disclaimer in the documentation and/or other materials
21 : // provided with the distribution.
22 : //
23 : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 : // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 : // used to endorse or promote products derived from this software without specific prior
26 : // written permission.
27 : //
28 : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 : // without changes from the version obtained under this License, or (ii) Licensee makes a
30 : // reference solely to the software portion of its product, Licensee must refer to the
31 : // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 : // obtained under this License and may not use a different name for the software. Except as
33 : // specifically required in this Section (4), Licensee shall not use in a company name, a
34 : // product name, in advertising, publicity, or other promotional activities any name, trade
35 : // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 : // similar designation, without the U.S. Department of Energy's prior written consent.
37 : //
38 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 : // POSSIBILITY OF SUCH DAMAGE.
47 :
48 : // C++ Headers
49 : #include <algorithm>
50 : #include <cmath>
51 : #include <string>
52 :
53 : // ObjexxFCL Headers
54 : #include <ObjexxFCL/Array.functions.hh>
55 : #include <ObjexxFCL/Fmath.hh>
56 :
57 : // EnergyPlus Headers
58 : #include <AirflowNetwork/Solver.hpp>
59 : #include <EnergyPlus/BaseboardElectric.hh>
60 : #include <EnergyPlus/BaseboardRadiator.hh>
61 : #include <EnergyPlus/ChilledCeilingPanelSimple.hh>
62 : #include <EnergyPlus/CoolTower.hh>
63 : #include <EnergyPlus/Data/EnergyPlusData.hh>
64 : #include <EnergyPlus/DataAirLoop.hh>
65 : #include <EnergyPlus/DataAirSystems.hh>
66 : #include <EnergyPlus/DataContaminantBalance.hh>
67 : #include <EnergyPlus/DataConvergParams.hh>
68 : #include <EnergyPlus/DataDaylighting.hh>
69 : #include <EnergyPlus/DataDefineEquip.hh>
70 : #include <EnergyPlus/DataEnvironment.hh>
71 : #include <EnergyPlus/DataGlobalConstants.hh>
72 : #include <EnergyPlus/DataHVACGlobals.hh>
73 : #include <EnergyPlus/DataHeatBalFanSys.hh>
74 : #include <EnergyPlus/DataHeatBalance.hh>
75 : #include <EnergyPlus/DataLoopNode.hh>
76 : #include <EnergyPlus/DataRoomAirModel.hh>
77 : #include <EnergyPlus/DataSizing.hh>
78 : #include <EnergyPlus/DataSurfaces.hh>
79 : #include <EnergyPlus/DataZoneEnergyDemands.hh>
80 : #include <EnergyPlus/DataZoneEquipment.hh>
81 : #include <EnergyPlus/DisplayRoutines.hh>
82 : #include <EnergyPlus/EMSManager.hh>
83 : #include <EnergyPlus/EarthTube.hh>
84 : #include <EnergyPlus/ElectricBaseboardRadiator.hh>
85 : #include <EnergyPlus/EvaporativeCoolers.hh>
86 : #include <EnergyPlus/ExhaustAirSystemManager.hh>
87 : #include <EnergyPlus/FanCoilUnits.hh>
88 : #include <EnergyPlus/Fans.hh>
89 : #include <EnergyPlus/General.hh>
90 : #include <EnergyPlus/HVACInterfaceManager.hh>
91 : #include <EnergyPlus/HVACStandAloneERV.hh>
92 : #include <EnergyPlus/HVACVariableRefrigerantFlow.hh>
93 : #include <EnergyPlus/HWBaseboardRadiator.hh>
94 : #include <EnergyPlus/HeatRecovery.hh>
95 : #include <EnergyPlus/HighTempRadiantSystem.hh>
96 : #include <EnergyPlus/HybridUnitaryAirConditioners.hh>
97 : #include <EnergyPlus/InternalHeatGains.hh>
98 : #include <EnergyPlus/LowTempRadiantSystem.hh>
99 : #include <EnergyPlus/OutdoorAirUnit.hh>
100 : #include <EnergyPlus/Psychrometrics.hh>
101 : #include <EnergyPlus/PurchasedAirManager.hh>
102 : #include <EnergyPlus/RefrigeratedCase.hh>
103 : #include <EnergyPlus/ReturnAirPathManager.hh>
104 : #include <EnergyPlus/ScheduleManager.hh>
105 : #include <EnergyPlus/SplitterComponent.hh>
106 : #include <EnergyPlus/SteamBaseboardRadiator.hh>
107 : #include <EnergyPlus/SwimmingPool.hh>
108 : #include <EnergyPlus/SystemAvailabilityManager.hh>
109 : #include <EnergyPlus/ThermalChimney.hh>
110 : #include <EnergyPlus/UnitHeater.hh>
111 : #include <EnergyPlus/UnitVentilator.hh>
112 : #include <EnergyPlus/UserDefinedComponents.hh>
113 : #include <EnergyPlus/UtilityRoutines.hh>
114 : #include <EnergyPlus/VentilatedSlab.hh>
115 : #include <EnergyPlus/WaterThermalTanks.hh>
116 : #include <EnergyPlus/WindowAC.hh>
117 : #include <EnergyPlus/ZoneAirLoopEquipmentManager.hh>
118 : #include <EnergyPlus/ZoneDehumidifier.hh>
119 : #include <EnergyPlus/ZoneEquipmentManager.hh>
120 : #include <EnergyPlus/ZonePlenum.hh>
121 : #include <EnergyPlus/ZoneTempPredictorCorrector.hh>
122 :
123 : namespace EnergyPlus::ZoneEquipmentManager {
124 :
125 : // Module containing the routines dealing with the Zone Equipment Manager.
126 :
127 : // MODULE INFORMATION:
128 : // AUTHOR Russ Taylor
129 : // DATE WRITTEN Unknown
130 : // MODIFIED na
131 : // RE-ENGINEERED na
132 :
133 : // PURPOSE OF THIS MODULE:
134 : // This module manages the zone equipment.
135 :
136 : // Using/Aliasing
137 : using namespace DataSizing;
138 : using namespace DataZoneEquipment;
139 : // Use statements for access to subroutines in other modules
140 : using Psychrometrics::PsyCpAirFnW;
141 : using Psychrometrics::PsyHFnTdbW;
142 : using Psychrometrics::PsyHgAirFnWTdb;
143 : using Psychrometrics::PsyRhoAirFnPbTdbW;
144 : using Psychrometrics::PsyWFnTdbRhPb;
145 : using Psychrometrics::PsyWFnTdpPb;
146 :
147 7037806 : void ManageZoneEquipment(EnergyPlusData &state,
148 : bool const FirstHVACIteration,
149 : bool &SimZone, // Set to false at the end of the routine
150 : bool &SimAir // Eventually set to true via SimZoneEquipment if AirLoop must be resimulated
151 : )
152 : {
153 :
154 : // SUBROUTINE INFORMATION:
155 : // AUTHOR Russ Taylor
156 : // DATE WRITTEN May 1997
157 :
158 : // PURPOSE OF THIS SUBROUTINE:
159 : // Calls the zone thermal control simulations and the interfaces (water-air, refrigerant-air, steam-air, electric-electric, water-water, etc)
160 :
161 7037806 : if (state.dataZoneEquipmentManager->GetZoneEquipmentInputFlag) {
162 771 : GetZoneEquipment(state);
163 771 : state.dataZoneEquipmentManager->GetZoneEquipmentInputFlag = false;
164 771 : state.dataZoneEquip->ZoneEquipInputsFilled = true;
165 : }
166 :
167 7037806 : InitZoneEquipment(state, FirstHVACIteration);
168 :
169 7037806 : if (state.dataGlobal->ZoneSizingCalc) {
170 987244 : SizeZoneEquipment(state);
171 : } else {
172 6050562 : SimZoneEquipment(state, FirstHVACIteration, SimAir);
173 6050562 : state.dataZoneEquip->ZoneEquipSimulatedOnce = true;
174 : }
175 :
176 7037806 : UpdateZoneEquipment(state, SimAir);
177 :
178 7037806 : SimZone = false;
179 7037806 : }
180 :
181 771 : void GetZoneEquipment(EnergyPlusData &state)
182 : {
183 :
184 : // SUBROUTINE INFORMATION:
185 : // AUTHOR Russ Taylor
186 : // DATE WRITTEN June 1997
187 : // MODIFIED Aug 2003, FCW: set ZoneEquipConfig number for each zone
188 :
189 : // PURPOSE OF THIS SUBROUTINE:
190 : // Get all the system related equipment which may be attached to a zone
191 :
192 771 : if (!state.dataZoneEquip->ZoneEquipInputsFilled) {
193 127 : GetZoneEquipmentData(state);
194 : }
195 :
196 771 : state.dataZoneEquipmentManager->NumOfTimeStepInDay = state.dataGlobal->NumOfTimeStepInHour * 24;
197 :
198 771 : int MaxNumOfEquipTypes = 0;
199 5585 : for (int Counter = 1; Counter <= state.dataGlobal->NumOfZones; ++Counter) {
200 4814 : if (!state.dataZoneEquip->ZoneEquipConfig(Counter).IsControlled) continue;
201 4104 : MaxNumOfEquipTypes = max(MaxNumOfEquipTypes, state.dataZoneEquip->ZoneEquipList(Counter).NumOfEquipTypes);
202 : }
203 :
204 771 : state.dataZoneEquipmentManager->PrioritySimOrder.allocate(MaxNumOfEquipTypes);
205 771 : }
206 :
207 7037806 : void InitZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration) // unused 1208
208 : {
209 :
210 : // SUBROUTINE INFORMATION:
211 : // AUTHOR Russ Taylor
212 : // DATE WRITTEN Nov 1997
213 :
214 : // PURPOSE OF THIS SUBROUTINE:
215 : // This subroutine initializes the zone equipment prior to simulation.
216 :
217 7037806 : if (state.dataZoneEquipmentManager->InitZoneEquipmentOneTimeFlag) {
218 771 : state.dataZoneEquipmentManager->InitZoneEquipmentOneTimeFlag = false;
219 771 : state.dataSize->ZoneEqSizing.allocate(state.dataGlobal->NumOfZones);
220 : // setup zone equipment sequenced demand storage
221 5585 : for (int ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) {
222 4814 : if (!state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).IsControlled) continue;
223 4104 : if (state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).EquipListIndex == 0) continue;
224 : int ZoneEquipCount =
225 4104 : state.dataZoneEquip->ZoneEquipList(state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).EquipListIndex).NumOfEquipTypes;
226 4104 : auto &thisZoneSysEnergyDemand = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum);
227 4104 : thisZoneSysEnergyDemand.NumZoneEquipment = ZoneEquipCount;
228 4104 : thisZoneSysEnergyDemand.SequencedOutputRequired.allocate(ZoneEquipCount);
229 4104 : thisZoneSysEnergyDemand.SequencedOutputRequiredToHeatingSP.allocate(ZoneEquipCount);
230 4104 : thisZoneSysEnergyDemand.SequencedOutputRequiredToCoolingSP.allocate(ZoneEquipCount);
231 4104 : auto &thisZoneSysMoistureDemand = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(ControlledZoneNum);
232 4104 : thisZoneSysMoistureDemand.NumZoneEquipment = ZoneEquipCount;
233 4104 : thisZoneSysMoistureDemand.SequencedOutputRequired.allocate(ZoneEquipCount);
234 4104 : thisZoneSysMoistureDemand.SequencedOutputRequiredToHumidSP.allocate(ZoneEquipCount);
235 4104 : thisZoneSysMoistureDemand.SequencedOutputRequiredToDehumidSP.allocate(ZoneEquipCount);
236 4104 : state.dataSize->ZoneEqSizing(ControlledZoneNum).SizingMethod.allocate(DataHVACGlobals::NumOfSizingTypes);
237 4104 : state.dataSize->ZoneEqSizing(ControlledZoneNum).SizingMethod = 0;
238 4104 : if (state.dataHeatBal->doSpaceHeatBalanceSimulation || state.dataHeatBal->doSpaceHeatBalanceSizing) {
239 10 : for (int spaceNum : state.dataHeatBal->Zone(ControlledZoneNum).spaceIndexes) {
240 5 : auto &thisSpaceSysEnergyDemand = state.dataZoneEnergyDemand->spaceSysEnergyDemand(spaceNum);
241 5 : thisSpaceSysEnergyDemand.NumZoneEquipment = ZoneEquipCount;
242 5 : thisSpaceSysEnergyDemand.SequencedOutputRequired.allocate(ZoneEquipCount);
243 5 : thisSpaceSysEnergyDemand.SequencedOutputRequiredToHeatingSP.allocate(ZoneEquipCount);
244 5 : thisSpaceSysEnergyDemand.SequencedOutputRequiredToCoolingSP.allocate(ZoneEquipCount);
245 5 : auto &thisSpaceSysMoistureDemand = state.dataZoneEnergyDemand->spaceSysMoistureDemand(spaceNum);
246 5 : thisSpaceSysMoistureDemand.NumZoneEquipment = ZoneEquipCount;
247 5 : thisSpaceSysMoistureDemand.SequencedOutputRequired.allocate(ZoneEquipCount);
248 5 : thisSpaceSysMoistureDemand.SequencedOutputRequiredToHumidSP.allocate(ZoneEquipCount);
249 5 : thisSpaceSysMoistureDemand.SequencedOutputRequiredToDehumidSP.allocate(ZoneEquipCount);
250 : }
251 : }
252 : }
253 : }
254 :
255 : // Do the Begin Environment initializations
256 7037806 : if (state.dataZoneEquipmentManager->InitZoneEquipmentEnvrnFlag && state.dataGlobal->BeginEnvrnFlag) {
257 :
258 6218 : state.dataZoneEquip->ZoneEquipAvail = DataHVACGlobals::NoAction;
259 :
260 6218 : if (allocated(state.dataHVACGlobal->ZoneComp)) {
261 86310 : for (int ZoneEquipType = 1; ZoneEquipType <= NumValidSysAvailZoneComponents; ++ZoneEquipType) {
262 80556 : if (allocated(state.dataHVACGlobal->ZoneComp(ZoneEquipType).ZoneCompAvailMgrs)) {
263 1152 : auto &zoneComp = state.dataHVACGlobal->ZoneComp(ZoneEquipType);
264 7420 : for (int ZoneCompNum = 1; ZoneCompNum <= zoneComp.TotalNumComp; ++ZoneCompNum) {
265 6268 : zoneComp.ZoneCompAvailMgrs(ZoneCompNum).AvailStatus = DataHVACGlobals::NoAction;
266 6268 : zoneComp.ZoneCompAvailMgrs(ZoneCompNum).StartTime = 0;
267 6268 : zoneComp.ZoneCompAvailMgrs(ZoneCompNum).StopTime = 0;
268 : }
269 : }
270 : }
271 : }
272 52491 : for (int ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) {
273 46273 : if (!state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).IsControlled) continue;
274 :
275 40055 : auto &zoneNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode);
276 40055 : zoneNode.Temp = 20.0;
277 40055 : zoneNode.MassFlowRate = 0.0;
278 40055 : zoneNode.Quality = 1.0;
279 40055 : zoneNode.Press = state.dataEnvrn->OutBaroPress;
280 40055 : zoneNode.HumRat = state.dataEnvrn->OutHumRat;
281 40055 : zoneNode.Enthalpy = PsyHFnTdbW(zoneNode.Temp, zoneNode.HumRat);
282 40055 : if (state.dataContaminantBalance->Contaminant.CO2Simulation) {
283 302 : zoneNode.CO2 = state.dataContaminantBalance->OutdoorCO2;
284 : }
285 40055 : if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) {
286 117 : zoneNode.GenContam = state.dataContaminantBalance->OutdoorGC;
287 : }
288 :
289 81765 : for (int ZoneInNode = 1; ZoneInNode <= state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).NumInletNodes; ++ZoneInNode) {
290 41710 : auto &inNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).InletNode(ZoneInNode));
291 41710 : inNode.Temp = 20.0;
292 41710 : inNode.MassFlowRate = 0.0;
293 41710 : inNode.Quality = 1.0;
294 41710 : inNode.Press = state.dataEnvrn->OutBaroPress;
295 41710 : inNode.HumRat = state.dataEnvrn->OutHumRat;
296 41710 : inNode.Enthalpy = PsyHFnTdbW(inNode.Temp, inNode.HumRat);
297 41710 : if (state.dataContaminantBalance->Contaminant.CO2Simulation) {
298 266 : inNode.CO2 = state.dataContaminantBalance->OutdoorCO2;
299 : }
300 41710 : if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) {
301 81 : inNode.GenContam = state.dataContaminantBalance->OutdoorGC;
302 : }
303 : }
304 :
305 48067 : for (int ZoneExhNode = 1; ZoneExhNode <= state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).NumExhaustNodes; ++ZoneExhNode) {
306 :
307 8012 : auto &exhNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ExhaustNode(ZoneExhNode));
308 8012 : exhNode.Temp = 20.0;
309 8012 : exhNode.MassFlowRate = 0.0;
310 8012 : exhNode.Quality = 1.0;
311 8012 : exhNode.Press = state.dataEnvrn->OutBaroPress;
312 8012 : exhNode.HumRat = state.dataEnvrn->OutHumRat;
313 8012 : exhNode.Enthalpy = PsyHFnTdbW(exhNode.Temp, exhNode.HumRat);
314 8012 : if (state.dataContaminantBalance->Contaminant.CO2Simulation) {
315 130 : exhNode.CO2 = state.dataContaminantBalance->OutdoorCO2;
316 : }
317 8012 : if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) {
318 30 : exhNode.GenContam = state.dataContaminantBalance->OutdoorGC;
319 : }
320 : }
321 :
322 : // BG CR 7122 following resets return air node.
323 40055 : int NumRetNodes = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).NumReturnNodes;
324 40055 : if (NumRetNodes > 0) {
325 80147 : for (int nodeCount = 1; nodeCount <= NumRetNodes; ++nodeCount) {
326 40101 : auto &returnNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ReturnNode(nodeCount));
327 40101 : returnNode.Temp = 20.0;
328 40101 : returnNode.MassFlowRate = 0.0;
329 40101 : returnNode.Quality = 1.0;
330 40101 : returnNode.Press = state.dataEnvrn->OutBaroPress;
331 40101 : returnNode.HumRat = state.dataEnvrn->OutHumRat;
332 40101 : returnNode.Enthalpy = PsyHFnTdbW(returnNode.Temp, returnNode.HumRat);
333 40101 : if (state.dataContaminantBalance->Contaminant.CO2Simulation) {
334 302 : returnNode.CO2 = state.dataContaminantBalance->OutdoorCO2;
335 : }
336 40101 : if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) {
337 117 : returnNode.GenContam = state.dataContaminantBalance->OutdoorGC;
338 : }
339 : }
340 : }
341 : }
342 :
343 6218 : state.dataZoneEquipmentManager->InitZoneEquipmentEnvrnFlag = false;
344 : }
345 :
346 7037806 : if (!state.dataGlobal->BeginEnvrnFlag) {
347 7002895 : state.dataZoneEquipmentManager->InitZoneEquipmentEnvrnFlag = true;
348 : }
349 :
350 : // do the HVAC time step initializations
351 :
352 61768559 : for (int ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) {
353 54730753 : if (!state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).IsControlled) continue;
354 46736683 : auto &zoneNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode);
355 46736683 : state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ExcessZoneExh = 0.0;
356 :
357 46736683 : if (FirstHVACIteration) {
358 28131103 : for (int ZoneExhNode = 1; ZoneExhNode <= state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).NumExhaustNodes; ++ZoneExhNode) {
359 4251062 : auto &exhNode = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ExhaustNode(ZoneExhNode));
360 4251062 : exhNode.Temp = zoneNode.Temp;
361 4251062 : exhNode.HumRat = zoneNode.HumRat;
362 4251062 : exhNode.Enthalpy = zoneNode.Enthalpy;
363 4251062 : exhNode.Press = zoneNode.Press;
364 4251062 : exhNode.Quality = zoneNode.Quality;
365 4251062 : exhNode.MassFlowRate = 0.0;
366 4251062 : exhNode.MassFlowRateMaxAvail = 0.0;
367 4251062 : exhNode.MassFlowRateMinAvail = 0.0;
368 4251062 : if (state.dataContaminantBalance->Contaminant.CO2Simulation) {
369 112483 : exhNode.CO2 = zoneNode.CO2;
370 : }
371 4251062 : if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) {
372 73670 : exhNode.GenContam = zoneNode.GenContam;
373 : }
374 : }
375 : }
376 : }
377 :
378 18028640 : for (int airLoop = 1; airLoop <= state.dataHVACGlobal->NumPrimaryAirSys; ++airLoop) {
379 10990834 : auto &airLoopFlow = state.dataAirLoop->AirLoopFlow(airLoop);
380 10990834 : airLoopFlow.SupFlow = 0.0;
381 10990834 : airLoopFlow.ZoneRetFlow = 0.0;
382 10990834 : airLoopFlow.SysRetFlow = 0.0;
383 10990834 : airLoopFlow.RecircFlow = 0.0;
384 10990834 : airLoopFlow.LeakFlow = 0.0;
385 10990834 : airLoopFlow.ExcessZoneExhFlow = 0.0;
386 : }
387 7037806 : }
388 :
389 987244 : void SizeZoneEquipment(EnergyPlusData &state)
390 : {
391 :
392 : // SUBROUTINE INFORMATION:
393 : // AUTHOR Fred Buhl
394 : // DATE WRITTEN December 2000
395 :
396 : // PURPOSE OF THIS SUBROUTINE:
397 : // Performs the zone sizing calculations and fills the zone sizing
398 : // data arrays with the results of the calculation.
399 :
400 : // METHODOLOGY EMPLOYED:
401 : // Using the input from Zone Sizing objects and the Zone Equipment input,
402 : // for each controlled zone this subroutine performs a "purchased air" calculation
403 : // and saves the results in the zone sizing data arrays.
404 :
405 : static constexpr std::string_view RoutineName("SizeZoneEquipment");
406 :
407 : int SupplyAirNode1; // node number of 1st zone supply air node
408 : int SupplyAirNode2; // node number of 2nd zone supply air node
409 : int SupplyAirNode; // node number of supply air node for ideal air system
410 : Real64 DeltaTemp; // difference between supply air temp and zone temp [C]
411 : Real64 CpAir; // heat capacity of air [J/kg-C]
412 : Real64 SysOutputProvided; // system sensible output [W]
413 : Real64 LatOutputProvided; // system latent output [kg/s]
414 : Real64 Temp; // inlet temperature [C]
415 : Real64 HumRat; // inlet humidity ratio [kg water/kg dry air]
416 : Real64 Enthalpy; // inlet specific enthalpy [J/kg]
417 : Real64 MassFlowRate; // inlet mass flow rate [kg/s]
418 : Real64 RetTemp; // zone return temperature [C]
419 987244 : Real64 DOASMassFlowRate(0.0); // DOAS air mass flow rate for sizing [kg/s]
420 987244 : Real64 DOASSupplyTemp(0.0); // DOAS supply air temperature [C]
421 987244 : Real64 DOASSupplyHumRat(0.0); // DOAS supply air humidity ratio [kgWater/kgDryAir]
422 987244 : Real64 DOASCpAir(0.0); // heat capacity of DOAS air [J/kg-C]
423 987244 : Real64 DOASSysOutputProvided(0.0); // heating / cooling provided by DOAS system [W]
424 987244 : Real64 TotDOASSysOutputProvided(0.0); // total DOAS load on the zone [W]
425 : Real64 HR90H; // humidity ratio at DOAS high setpoint temperature and 90% relative humidity [kg Water / kg Dry Air]
426 : Real64 HR90L; // humidity ratio at DOAS low setpoint temperature and 90% relative humidity [kg Water / kg Dry Air]
427 :
428 987244 : auto &Node(state.dataLoopNodes->Node);
429 :
430 987244 : if (state.dataZoneEquipmentManager->SizeZoneEquipmentOneTimeFlag) {
431 406 : SetUpZoneSizingArrays(state);
432 406 : state.dataZoneEquipmentManager->SizeZoneEquipmentOneTimeFlag = false;
433 : }
434 :
435 10835687 : for (int ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) {
436 9848443 : auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum);
437 9848443 : auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ControlledZoneNum);
438 9848443 : if (!zoneEquipConfig.IsControlled) continue;
439 :
440 : // use reference to eliminate lots of long lines in this function, after initial commit, so reviewers can see changes
441 8551307 : auto &calcZoneSizing = state.dataSize->CalcZoneSizing(state.dataSize->CurOverallSimDay, ControlledZoneNum);
442 8551307 : auto &zoneSysEnergyDemand = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum);
443 8551307 : auto &zoneSysMoistureDemand = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(ControlledZoneNum);
444 8551307 : auto &zone = state.dataHeatBal->Zone(ControlledZoneNum);
445 :
446 8551307 : thisZoneHB.NonAirSystemResponse = 0.0;
447 8551307 : thisZoneHB.SysDepZoneLoads = 0.0;
448 8551307 : if (state.dataHeatBal->doSpaceHeatBalance) {
449 32240 : for (int spaceNum : state.dataHeatBal->Zone(ControlledZoneNum).spaceIndexes) {
450 : // SpaceHB ToDo: For now allocate by space volume frac
451 16120 : state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).NonAirSystemResponse = 0.0;
452 16120 : state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).SysDepZoneLoads = 0.0;
453 : }
454 : }
455 8551307 : SysOutputProvided = 0.0;
456 8551307 : LatOutputProvided = 0.0;
457 8551307 : InitSystemOutputRequired(state, ControlledZoneNum, true);
458 8551307 : int ZoneNode = zoneEquipConfig.ZoneNode;
459 8551307 : SupplyAirNode = 0;
460 8551307 : SupplyAirNode1 = 0;
461 8551307 : SupplyAirNode2 = 0;
462 : // save raw zone loads without impact of outdoor air
463 8551307 : Real64 LatOutputProvidedNoDOAS = zoneSysMoistureDemand.RemainingOutputRequired;
464 8551307 : Real64 SysOutputProvidedNoDOAS = zoneSysEnergyDemand.RemainingOutputRequired;
465 : // if Tstat deadband is true then load will be reported as 0
466 8551307 : if (state.dataZoneEnergyDemand->DeadBandOrSetback(ControlledZoneNum)) SysOutputProvidedNoDOAS = 0.0;
467 : // replicate deadband flag - zone condition is either below the humidistat or above the dehumidistat set point
468 : // using logic: NOT (!) (there is a load)
469 : // Pretty sure this could just be if (OutputRequiredToHumidifyingSP < 0 && OutputRequiredToDehumidifyingSP > 0)
470 16991225 : if (!((zoneSysMoistureDemand.OutputRequiredToHumidifyingSP > 0.0 && zoneSysMoistureDemand.OutputRequiredToDehumidifyingSP > 0.0) ||
471 8660075 : (zoneSysMoistureDemand.OutputRequiredToHumidifyingSP < 0.0 && zoneSysMoistureDemand.OutputRequiredToDehumidifyingSP < 0.0))) {
472 8316708 : LatOutputProvidedNoDOAS = 0.0;
473 : }
474 :
475 : // calculate DOAS heating/cooling effect
476 8551307 : if (calcZoneSizing.AccountForDOAS) {
477 : // check for adequate number of supply nodes
478 176224 : if (zoneEquipConfig.NumInletNodes >= 2) {
479 133870 : SupplyAirNode1 = zoneEquipConfig.InletNode(1);
480 133870 : SupplyAirNode2 = zoneEquipConfig.InletNode(2);
481 42354 : } else if (zoneEquipConfig.NumInletNodes >= 1) {
482 42354 : SupplyAirNode1 = zoneEquipConfig.InletNode(1);
483 42354 : SupplyAirNode2 = 0;
484 : } else {
485 0 : ShowSevereError(state,
486 0 : std::string{RoutineName} + ": to account for the effect a Dedicated Outside Air System on zone equipment sizing");
487 0 : ShowContinueError(state, "there must be at least one zone air inlet node");
488 0 : ShowFatalError(state, "Previous severe error causes abort ");
489 : }
490 : // set the DOAS mass flow rate and supply temperature and humidity ratio
491 176224 : HR90H = PsyWFnTdbRhPb(state, calcZoneSizing.DOASHighSetpoint, 0.9, state.dataEnvrn->StdBaroPress);
492 176224 : HR90L = PsyWFnTdbRhPb(state, calcZoneSizing.DOASLowSetpoint, 0.9, state.dataEnvrn->StdBaroPress);
493 176224 : DOASMassFlowRate = state.dataSize->CalcFinalZoneSizing(ControlledZoneNum).MinOA;
494 528672 : CalcDOASSupCondsForSizing(state,
495 176224 : state.dataEnvrn->OutDryBulbTemp,
496 176224 : state.dataEnvrn->OutHumRat,
497 : calcZoneSizing.DOASControlStrategy,
498 : calcZoneSizing.DOASLowSetpoint,
499 : calcZoneSizing.DOASHighSetpoint,
500 : HR90H,
501 : HR90L,
502 : DOASSupplyTemp,
503 : DOASSupplyHumRat);
504 176224 : DOASCpAir = PsyCpAirFnW(DOASSupplyHumRat);
505 176224 : DOASSysOutputProvided = DOASMassFlowRate * DOASCpAir * (DOASSupplyTemp - Node(ZoneNode).Temp);
506 176224 : TotDOASSysOutputProvided =
507 176224 : DOASMassFlowRate * (PsyHFnTdbW(DOASSupplyTemp, DOASSupplyHumRat) - PsyHFnTdbW(Node(ZoneNode).Temp, Node(ZoneNode).HumRat));
508 176224 : Real64 DOASLatOutputProvided = 0.0;
509 176224 : if (calcZoneSizing.zoneLatentSizing) {
510 0 : DOASLatOutputProvided = DOASMassFlowRate * (DOASSupplyHumRat - Node(ZoneNode).HumRat); // kgw/s
511 : }
512 :
513 176224 : UpdateSystemOutputRequired(state, ControlledZoneNum, DOASSysOutputProvided, DOASLatOutputProvided);
514 176224 : Node(SupplyAirNode1).Temp = DOASSupplyTemp;
515 176224 : Node(SupplyAirNode1).HumRat = DOASSupplyHumRat;
516 176224 : Node(SupplyAirNode1).MassFlowRate = DOASMassFlowRate;
517 176224 : Node(SupplyAirNode1).Enthalpy = PsyHFnTdbW(DOASSupplyTemp, DOASSupplyHumRat);
518 176224 : calcZoneSizing.DOASHeatAdd = DOASSysOutputProvided;
519 176224 : calcZoneSizing.DOASLatAdd = TotDOASSysOutputProvided - DOASSysOutputProvided;
520 176224 : SupplyAirNode = SupplyAirNode2;
521 176224 : calcZoneSizing.DOASSupMassFlow = DOASMassFlowRate;
522 176224 : calcZoneSizing.DOASSupTemp = DOASSupplyTemp;
523 176224 : calcZoneSizing.DOASSupHumRat = DOASSupplyHumRat;
524 176224 : if (DOASSysOutputProvided > 0.0) {
525 3485 : calcZoneSizing.DOASHeatLoad = DOASSysOutputProvided;
526 3485 : calcZoneSizing.DOASCoolLoad = 0.0;
527 3485 : calcZoneSizing.DOASTotCoolLoad = 0.0;
528 : } else {
529 172739 : calcZoneSizing.DOASCoolLoad = DOASSysOutputProvided;
530 172739 : calcZoneSizing.DOASTotCoolLoad = TotDOASSysOutputProvided;
531 172739 : calcZoneSizing.DOASHeatLoad = 0.0;
532 : }
533 :
534 : } else {
535 8375083 : if (zoneEquipConfig.NumInletNodes > 0) {
536 8210866 : SupplyAirNode = zoneEquipConfig.InletNode(1);
537 : } else {
538 164217 : SupplyAirNode = 0;
539 : }
540 : }
541 :
542 : // Sign convention: SysOutputProvided <0 Supply air is heated on entering zone (zone is cooled)
543 : // SysOutputProvided >0 Supply air is cooled on entering zone (zone is heated)
544 15615262 : if (!state.dataZoneEnergyDemand->DeadBandOrSetback(ControlledZoneNum) &&
545 7063955 : std::abs(state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputRequired) > DataHVACGlobals::SmallLoad) {
546 : // Determine design supply air temperture and design supply air temperature difference
547 7054961 : if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputRequired < 0.0) { // Cooling case
548 : // If the user specify the design cooling supply air temperature, then
549 3741184 : if (calcZoneSizing.ZnCoolDgnSAMethod == SupplyAirTemperature) {
550 3741184 : Temp = calcZoneSizing.CoolDesTemp;
551 3741184 : HumRat = calcZoneSizing.CoolDesHumRat;
552 3741184 : DeltaTemp = Temp - Node(ZoneNode).Temp;
553 3741184 : if (zone.HasAdjustedReturnTempByITE && !(state.dataGlobal->BeginSimFlag)) {
554 2802 : DeltaTemp = Temp - zone.AdjustedReturnTempByITE;
555 : }
556 : // If the user specify the design cooling supply air temperature difference, then
557 : } else {
558 0 : DeltaTemp = -std::abs(calcZoneSizing.CoolDesTempDiff);
559 0 : Temp = DeltaTemp + Node(ZoneNode).Temp;
560 0 : if (zone.HasAdjustedReturnTempByITE && !(state.dataGlobal->BeginSimFlag)) {
561 0 : Temp = DeltaTemp + zone.AdjustedReturnTempByITE;
562 : }
563 0 : HumRat = calcZoneSizing.CoolDesHumRat;
564 : }
565 : } else { // Heating Case
566 : // If the user specify the design heating supply air temperature, then
567 3313777 : if (calcZoneSizing.ZnHeatDgnSAMethod == SupplyAirTemperature) {
568 3313777 : Temp = calcZoneSizing.HeatDesTemp;
569 3313777 : HumRat = calcZoneSizing.HeatDesHumRat;
570 3313777 : DeltaTemp = Temp - Node(ZoneNode).Temp;
571 : // If the user specify the design heating supply air temperature difference, then
572 : } else {
573 0 : DeltaTemp = std::abs(calcZoneSizing.HeatDesTempDiff);
574 0 : Temp = DeltaTemp + Node(ZoneNode).Temp;
575 0 : HumRat = calcZoneSizing.HeatDesHumRat;
576 : }
577 : }
578 :
579 7054961 : Enthalpy = PsyHFnTdbW(Temp, HumRat);
580 7054961 : SysOutputProvided = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputRequired;
581 7054961 : CpAir = PsyCpAirFnW(HumRat);
582 7054961 : if (std::abs(DeltaTemp) > DataHVACGlobals::SmallTempDiff) {
583 : //!!PH/WFB/LKL (UCDV model) MassFlowRate = SysOutputProvided / (CpAir*DeltaTemp)
584 7054961 : MassFlowRate = max(SysOutputProvided / (CpAir * DeltaTemp), 0.0);
585 : } else {
586 0 : MassFlowRate = 0.0;
587 : }
588 :
589 7054961 : if (calcZoneSizing.SupplyAirAdjustFactor > 1.0) {
590 0 : MassFlowRate *= calcZoneSizing.SupplyAirAdjustFactor;
591 : }
592 : } else {
593 :
594 1496346 : Temp = Node(ZoneNode).Temp;
595 1496346 : HumRat = Node(ZoneNode).HumRat;
596 1496346 : Enthalpy = Node(ZoneNode).Enthalpy;
597 1496346 : MassFlowRate = 0.0;
598 : }
599 :
600 8551307 : if (SysOutputProvided > 0.0) {
601 3313777 : calcZoneSizing.HeatLoad = SysOutputProvided;
602 3313777 : calcZoneSizing.HeatMassFlow = MassFlowRate;
603 3313777 : calcZoneSizing.CoolLoad = 0.0;
604 3313777 : calcZoneSizing.CoolMassFlow = 0.0;
605 5237530 : } else if (SysOutputProvided < 0.0) {
606 3741184 : calcZoneSizing.CoolLoad = -SysOutputProvided;
607 3741184 : calcZoneSizing.CoolMassFlow = MassFlowRate;
608 3741184 : calcZoneSizing.HeatLoad = 0.0;
609 3741184 : calcZoneSizing.HeatMassFlow = 0.0;
610 : } else {
611 1496346 : calcZoneSizing.CoolLoad = 0.0;
612 1496346 : calcZoneSizing.CoolMassFlow = 0.0;
613 1496346 : calcZoneSizing.HeatLoad = 0.0;
614 1496346 : calcZoneSizing.HeatMassFlow = 0.0;
615 : }
616 8551307 : calcZoneSizing.HeatZoneTemp = Node(ZoneNode).Temp;
617 8551307 : calcZoneSizing.HeatZoneHumRat = Node(ZoneNode).HumRat;
618 8551307 : calcZoneSizing.CoolZoneTemp = Node(ZoneNode).Temp;
619 8551307 : calcZoneSizing.CoolZoneHumRat = Node(ZoneNode).HumRat;
620 8551307 : calcZoneSizing.HeatOutTemp = state.dataEnvrn->OutDryBulbTemp;
621 8551307 : calcZoneSizing.HeatOutHumRat = state.dataEnvrn->OutHumRat;
622 8551307 : calcZoneSizing.CoolOutTemp = state.dataEnvrn->OutDryBulbTemp;
623 8551307 : calcZoneSizing.CoolOutHumRat = state.dataEnvrn->OutHumRat;
624 :
625 8551307 : Real64 LatentAirMassFlow = 0.0;
626 8551307 : Real64 MoistureLoad = 0.0;
627 8551307 : Real64 HgAir = PsyHgAirFnWTdb(Node(ZoneNode).HumRat, Node(ZoneNode).Temp);
628 8551307 : if (calcZoneSizing.zoneLatentSizing) {
629 : // replicate deadband flag - zone condition is either below the humidistat or above the dehumidistat set point
630 36361 : if ((zoneSysMoistureDemand.OutputRequiredToHumidifyingSP > 0.0 && zoneSysMoistureDemand.OutputRequiredToDehumidifyingSP > 0.0) ||
631 31636 : (zoneSysMoistureDemand.OutputRequiredToHumidifyingSP < 0.0 && zoneSysMoistureDemand.OutputRequiredToDehumidifyingSP < 0.0)) {
632 18910 : LatOutputProvided = zoneSysMoistureDemand.RemainingOutputRequired;
633 : }
634 20543 : Real64 DeltaHumRat = 0.0; // positive LatOutputProvided means humidification load
635 20543 : if (LatOutputProvided < 0.0) { // use SA humrat - zone humrat, or delta humrat based on user choice
636 28370 : DeltaHumRat = (calcZoneSizing.ZnLatCoolDgnSAMethod == SupplyAirHumidityRatio)
637 28370 : ? (calcZoneSizing.LatentCoolDesHumRat - Node(ZoneNode).HumRat)
638 14185 : : -calcZoneSizing.CoolDesHumRatDiff;
639 6358 : } else if (LatOutputProvided > 0.0) {
640 9450 : DeltaHumRat = (calcZoneSizing.ZnLatHeatDgnSAMethod == SupplyAirHumidityRatio)
641 4725 : ? (calcZoneSizing.LatentHeatDesHumRat - Node(ZoneNode).HumRat)
642 : : calcZoneSizing.HeatDesHumRatDiff;
643 : }
644 20543 : if (std::abs(DeltaHumRat) > DataHVACGlobals::VerySmallMassFlow) LatentAirMassFlow = std::max(0.0, LatOutputProvided / DeltaHumRat);
645 20543 : MoistureLoad = LatOutputProvided * HgAir;
646 :
647 20543 : if (MassFlowRate > 0.0) {
648 16161 : HumRat = Node(ZoneNode).HumRat + LatOutputProvided / MassFlowRate;
649 16161 : CpAir = PsyCpAirFnW(HumRat);
650 16161 : Temp = (SysOutputProvided / (MassFlowRate * CpAir)) + Node(ZoneNode).Temp;
651 16161 : Enthalpy = PsyHFnTdbW(Temp, HumRat);
652 4382 : } else if (LatentAirMassFlow > 0.0) {
653 : // if there is no sensible load then still need to hold zone RH at set point
654 : // no need to recalculate T, Sensible load = 0 so T = T,zone
655 4377 : HumRat = Node(ZoneNode).HumRat + LatOutputProvided / LatentAirMassFlow;
656 4377 : Enthalpy = PsyHFnTdbW(Temp, HumRat);
657 4377 : MassFlowRate = (LatentAirMassFlow > DataHVACGlobals::VerySmallMassFlow) ? LatentAirMassFlow : 0.0;
658 : }
659 :
660 20543 : calcZoneSizing.HeatLatentLoad = (LatOutputProvided > 0.0) ? MoistureLoad : 0.0;
661 20543 : calcZoneSizing.ZoneHeatLatentMassFlow = (LatOutputProvided > 0.0) ? LatentAirMassFlow : 0.0;
662 20543 : calcZoneSizing.CoolLatentLoad = (LatOutputProvided < 0.0) ? -MoistureLoad : 0.0;
663 20543 : calcZoneSizing.ZoneCoolLatentMassFlow = (LatOutputProvided < 0.0) ? LatentAirMassFlow : 0.0;
664 20543 : calcZoneSizing.HeatLoadNoDOAS = (SysOutputProvidedNoDOAS > 0.0) ? SysOutputProvidedNoDOAS : 0.0;
665 20543 : calcZoneSizing.CoolLoadNoDOAS = (SysOutputProvidedNoDOAS < 0.0) ? -SysOutputProvidedNoDOAS : 0.0;
666 20543 : calcZoneSizing.HeatLatentLoadNoDOAS = (LatOutputProvidedNoDOAS > 0.0) ? LatOutputProvidedNoDOAS * HgAir : 0.0;
667 20543 : calcZoneSizing.CoolLatentLoadNoDOAS = (LatOutputProvidedNoDOAS < 0.0) ? -LatOutputProvidedNoDOAS * HgAir : 0.0;
668 : }
669 :
670 8551307 : if (SupplyAirNode > 0) {
671 8344736 : Node(SupplyAirNode).Temp = Temp;
672 8344736 : Node(SupplyAirNode).HumRat = HumRat;
673 8344736 : Node(SupplyAirNode).Enthalpy = Enthalpy;
674 8344736 : Node(SupplyAirNode).MassFlowRate = MassFlowRate;
675 : } else {
676 206571 : thisZoneHB.NonAirSystemResponse = SysOutputProvided;
677 206571 : if (state.dataHeatBal->doSpaceHeatBalance) {
678 0 : for (int spaceNum : state.dataHeatBal->Zone(ControlledZoneNum).spaceIndexes) {
679 : // SpaceHB ToDo: For now allocate by space volume frac
680 0 : state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).NonAirSystemResponse =
681 0 : thisZoneHB.NonAirSystemResponse * state.dataHeatBal->space(spaceNum).fracZoneVolume;
682 : }
683 : }
684 206571 : if (calcZoneSizing.zoneLatentSizing) {
685 0 : int ZoneMult = zone.Multiplier * zone.ListMultiplier;
686 0 : thisZoneHB.ZoneLatentGain += (LatOutputProvided * HgAir) / ZoneMult;
687 : }
688 : }
689 :
690 8551307 : UpdateSystemOutputRequired(state, ControlledZoneNum, SysOutputProvided, LatOutputProvided);
691 : }
692 :
693 987244 : CalcZoneMassBalance(state, true);
694 :
695 987244 : CalcZoneLeavingConditions(state, true);
696 :
697 10835687 : for (int ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) {
698 :
699 9848443 : auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum);
700 9848443 : if (!zoneEquipConfig.IsControlled) continue;
701 8551307 : auto &calcZoneSizing = state.dataSize->CalcZoneSizing(state.dataSize->CurOverallSimDay, ControlledZoneNum);
702 :
703 : // MJW for now - use first return node, make a separate commit to add a dimension to all of the sizing rettemp variables
704 8551307 : int ReturnNode = (zoneEquipConfig.NumReturnNodes > 0) ? zoneEquipConfig.ReturnNode(1) : 0;
705 8551307 : int ZoneNode = zoneEquipConfig.ZoneNode;
706 8551307 : RetTemp = (ReturnNode > 0) ? Node(ReturnNode).Temp : Node(ZoneNode).Temp;
707 8551307 : auto &zoneTstatSP = state.dataHeatBalFanSys->TempZoneThermostatSetPoint(ControlledZoneNum);
708 8551307 : if (calcZoneSizing.HeatLoad > 0.0) {
709 3313777 : calcZoneSizing.HeatZoneRetTemp = RetTemp;
710 3313777 : calcZoneSizing.HeatTstatTemp = (zoneTstatSP > 0.0) ? zoneTstatSP : state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ControlledZoneNum);
711 3313777 : calcZoneSizing.CoolTstatTemp = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ControlledZoneNum);
712 5237530 : } else if (calcZoneSizing.CoolLoad > 0.0) {
713 3741184 : calcZoneSizing.CoolZoneRetTemp = RetTemp;
714 3741184 : calcZoneSizing.CoolTstatTemp = (zoneTstatSP > 0.0) ? zoneTstatSP : state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ControlledZoneNum);
715 3741184 : calcZoneSizing.HeatTstatTemp = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ControlledZoneNum);
716 : } else {
717 1496346 : calcZoneSizing.CoolZoneRetTemp = RetTemp;
718 1496346 : calcZoneSizing.HeatTstatTemp = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(ControlledZoneNum);
719 1496346 : calcZoneSizing.CoolTstatTemp = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(ControlledZoneNum);
720 : }
721 : }
722 987244 : }
723 :
724 176224 : void CalcDOASSupCondsForSizing(EnergyPlusData &state,
725 : Real64 OutDB, // outside air temperature [C]
726 : Real64 OutHR, // outside humidity ratio [kg Water / kg Dry Air]
727 : int DOASControl, // dedicated outside air control strategy
728 : Real64 DOASLowTemp, // DOAS low setpoint [C]
729 : Real64 DOASHighTemp, // DOAS high setpoint [C]
730 : Real64 W90H, // humidity ratio at DOAS high setpoint temperature and 90% relative humidity [kg Water / kg Dry Air]
731 : Real64 W90L, // humidity ratio at DOAS low setpoint temperature and 90% relative humidity [kg Water / kg Dry Air]
732 : Real64 &DOASSupTemp, // DOAS supply temperature [C]
733 : Real64 &DOASSupHR // DOAS Supply Humidity ratio [kg Water / kg Dry Air]
734 : )
735 : {
736 : // FUNCTION INFORMATION:
737 : // AUTHOR Fred Buhl
738 : // DATE WRITTEN March 2015
739 :
740 : // PURPOSE OF THIS FUNCTION:
741 : // This function calculates supply conditions for the direct outside air system (DOAS) sizing calculations
742 :
743 : // METHODOLOGY EMPLOYED:
744 : // the supply temperature and humidity ratio are set depending on the design control method and the outside air temperature
745 :
746 : // REFERENCES:
747 : // Consult the "DOAS Effect On Zone Sizing" new feature proposal and design documents
748 :
749 : // SUBROUTINE PARAMETER DEFINITIONS:
750 : static constexpr std::string_view RoutineName("CalcDOASSupCondsForSizing");
751 :
752 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
753 :
754 176224 : DOASSupTemp = 0.0;
755 176224 : DOASSupHR = 0.0;
756 : // neutral supply air
757 176224 : if (DOASControl == 1) {
758 10420 : if (OutDB < DOASLowTemp) {
759 4225 : DOASSupTemp = DOASLowTemp;
760 4225 : DOASSupHR = OutHR;
761 6195 : } else if (OutDB > DOASHighTemp) {
762 4655 : DOASSupTemp = DOASHighTemp;
763 4655 : DOASSupHR = min(OutHR, W90H);
764 : } else {
765 1540 : DOASSupTemp = OutDB;
766 1540 : DOASSupHR = OutHR;
767 : }
768 : }
769 :
770 : // neutral dehumidified supply air
771 165804 : else if (DOASControl == 2) { //
772 0 : if (OutDB < DOASLowTemp) {
773 0 : DOASSupTemp = DOASHighTemp;
774 0 : DOASSupHR = OutHR;
775 : } else {
776 0 : DOASSupTemp = DOASHighTemp;
777 0 : DOASSupHR = min(OutHR, W90L);
778 : }
779 : }
780 :
781 : // cold supply air
782 165804 : else if (DOASControl == 3) {
783 165804 : if (OutDB < DOASLowTemp) {
784 57783 : DOASSupTemp = DOASHighTemp;
785 57783 : DOASSupHR = OutHR;
786 : } else {
787 108021 : DOASSupTemp = DOASLowTemp;
788 108021 : DOASSupHR = min(OutHR, W90L);
789 : }
790 : } else {
791 0 : ShowFatalError(state, std::string{RoutineName} + ":illegal DOAS design control strategy");
792 : }
793 176224 : }
794 :
795 406 : void SetUpZoneSizingArrays(EnergyPlusData &state)
796 : {
797 :
798 : // SUBROUTINE INFORMATION:
799 : // AUTHOR Fred Buhl
800 : // DATE WRITTEN December 2000
801 :
802 : // PURPOSE OF THIS SUBROUTINE:
803 : // Allocate and fill the ZoneSizing data array.
804 :
805 : // METHODOLOGY EMPLOYED:
806 : // Obtains data from Zone Sizing and Zone Equipment objects already input.
807 :
808 : int NumOfTimeStepInDay; // number of zone time steps in a day
809 : int DesDayNum; // design day index
810 : // unused INTEGER :: DesDayEnvrnNum ! design day index
811 : int ZoneSizNum; // zone sizing input index
812 : Real64 TotPeopleInZone; // total (maximum) number of people in a zone
813 : int PeopleNum; // index of People structure
814 406 : Real64 OAFromPeople(0.0); // min OA calculated from zone occupancy [m3/s]
815 406 : Real64 OAFromArea(0.0); // min OA calculated from zone area and OA flow per area [m3/s]
816 406 : bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine
817 406 : Real64 SchMax(0.0); // maximum people multiplier value
818 : Real64 OAVolumeFlowRate; // outside air flow rate (m3/s)
819 : bool UseOccSchFlag; // flag to use occupancy schedule when calculating OA
820 : bool UseMinOASchFlag; // flag to use min OA schedule when calculating OA
821 :
822 : // TODO MJW: Punt for now, sometimes unit test will get here and need these to be allocated, but simulations need them sooner
823 406 : if (!state.dataHeatBal->ZoneIntGain.allocated()) {
824 0 : DataHeatBalance::AllocateIntGains(state);
825 : }
826 :
827 3698 : for (int ZoneSizIndex = 1; ZoneSizIndex <= state.dataSize->NumZoneSizingInput; ++ZoneSizIndex) {
828 3292 : int ZoneIndex = UtilityRoutines::FindItemInList(state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneName, state.dataHeatBal->Zone);
829 3292 : if (ZoneIndex == 0) {
830 0 : ShowSevereError(state,
831 0 : "SetUpZoneSizingArrays: Sizing:Zone=\"" + state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneName +
832 : "\" references unknown zone");
833 0 : ErrorsFound = true;
834 : }
835 7549 : if (std::any_of(state.dataZoneEquip->ZoneEquipConfig.begin(), state.dataZoneEquip->ZoneEquipConfig.end(), [](EquipConfiguration const &e) {
836 : return e.IsControlled;
837 4257 : })) {
838 6584 : ZoneIndex = UtilityRoutines::FindItemInList(
839 6584 : state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneName, state.dataZoneEquip->ZoneEquipConfig, &EquipConfiguration::ZoneName);
840 3292 : if (ZoneIndex == 0) {
841 1 : if (!state.dataGlobal->isPulseZoneSizing) {
842 3 : ShowWarningError(state,
843 2 : "SetUpZoneSizingArrays: Requested Sizing for Zone=\"" + state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneName +
844 : "\", Zone is not found in the Controlled Zones List");
845 : }
846 : } else {
847 3291 : state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneNum = ZoneIndex;
848 : }
849 4154 : if (state.dataSize->ZoneSizingInput(ZoneSizIndex).CoolAirDesMethod == FromDDCalc ||
850 862 : state.dataSize->ZoneSizingInput(ZoneSizIndex).HeatAirDesMethod == FromDDCalc) {
851 3292 : if (!ZoneTempPredictorCorrector::VerifyThermostatInZone(state, state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneName)) {
852 4 : if (!state.dataGlobal->isPulseZoneSizing) {
853 12 : ShowWarningError(state,
854 8 : "SetUpZoneSizingArrays: Requested Sizing for Zone=\"" +
855 12 : state.dataSize->ZoneSizingInput(ZoneSizIndex).ZoneName +
856 : "\", Zone has no thermostat (ref: ZoneControl:Thermostat, et al)");
857 : }
858 : }
859 : }
860 : } else {
861 0 : ShowSevereError(state, "SetUpZoneSizingArrays: Zone Sizing is requested but there are no ZoneHVAC:EquipmentConnections statements.");
862 0 : ErrorsFound = true;
863 : }
864 : }
865 :
866 : // Put Auto Sizing of Sizing:Zone inputs here!
867 406 : AutoCalcDOASControlStrategy(state);
868 :
869 406 : state.dataSize->ZoneSizing.allocate(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfZones);
870 406 : state.dataSize->FinalZoneSizing.allocate(state.dataGlobal->NumOfZones);
871 406 : state.dataSize->CalcZoneSizing.allocate(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays, state.dataGlobal->NumOfZones);
872 406 : state.dataSize->CalcFinalZoneSizing.allocate(state.dataGlobal->NumOfZones);
873 406 : state.dataSize->TermUnitFinalZoneSizing.allocate(state.dataSize->NumAirTerminalUnits);
874 406 : state.dataSize->DesDayWeath.allocate(state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays);
875 406 : NumOfTimeStepInDay = state.dataGlobal->NumOfTimeStepInHour * 24;
876 406 : state.dataZoneEquipmentManager->AvgData.allocate(NumOfTimeStepInDay);
877 406 : state.dataSize->CoolPeakDateHrMin.allocate(state.dataGlobal->NumOfZones);
878 406 : state.dataSize->HeatPeakDateHrMin.allocate(state.dataGlobal->NumOfZones);
879 406 : state.dataSize->LatCoolPeakDateHrMin.allocate(state.dataGlobal->NumOfZones);
880 406 : state.dataSize->LatHeatPeakDateHrMin.allocate(state.dataGlobal->NumOfZones);
881 406 : state.dataSize->ZoneSizThermSetPtHi.allocate(state.dataGlobal->NumOfZones);
882 406 : state.dataSize->ZoneSizThermSetPtLo.allocate(state.dataGlobal->NumOfZones);
883 :
884 406 : state.dataSize->CoolPeakDateHrMin = "";
885 406 : state.dataSize->HeatPeakDateHrMin = "";
886 406 : state.dataSize->LatCoolPeakDateHrMin = "";
887 406 : state.dataSize->LatHeatPeakDateHrMin = "";
888 :
889 406 : state.dataSize->ZoneSizThermSetPtHi = 0.0;
890 406 : state.dataSize->ZoneSizThermSetPtLo = 1000.0;
891 :
892 1279 : for (DesDayNum = 1; DesDayNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++DesDayNum) {
893 873 : auto &thisDesDayWeather = state.dataSize->DesDayWeath(DesDayNum);
894 873 : thisDesDayWeather.Temp.allocate(state.dataGlobal->NumOfTimeStepInHour * 24);
895 873 : thisDesDayWeather.HumRat.allocate(state.dataGlobal->NumOfTimeStepInHour * 24);
896 873 : thisDesDayWeather.Press.allocate(state.dataGlobal->NumOfTimeStepInHour * 24);
897 873 : thisDesDayWeather.Temp = 0.0;
898 873 : thisDesDayWeather.HumRat = 0.0;
899 873 : thisDesDayWeather.Press = 0.0;
900 : }
901 : // Fill zone sizing arrays from input array
902 1279 : for (DesDayNum = 1; DesDayNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++DesDayNum) {
903 8972 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
904 8099 : auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum);
905 8099 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
906 7157 : auto &zoneSizing = state.dataSize->ZoneSizing(DesDayNum, CtrlZoneNum);
907 7157 : auto &calcZoneSizing = state.dataSize->CalcZoneSizing(DesDayNum, CtrlZoneNum);
908 7157 : zoneSizing.ZoneName = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneName;
909 7157 : zoneSizing.ZoneNum = CtrlZoneNum;
910 7157 : calcZoneSizing.ZoneName = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneName;
911 7157 : calcZoneSizing.ZoneNum = CtrlZoneNum;
912 : // For each Zone Sizing object, find the corresponding controlled zone
913 7157 : ZoneSizNum = UtilityRoutines::FindItemInList(zoneEquipConfig.ZoneName, state.dataSize->ZoneSizingInput, &ZoneSizingInputData::ZoneName);
914 7157 : if (ZoneSizNum > 0) { // move data from zone sizing input
915 7099 : auto &zoneSizingInput = state.dataSize->ZoneSizingInput(ZoneSizNum);
916 7099 : zoneSizing.ZnCoolDgnSAMethod = zoneSizingInput.ZnCoolDgnSAMethod;
917 7099 : zoneSizing.ZnHeatDgnSAMethod = zoneSizingInput.ZnHeatDgnSAMethod;
918 7099 : zoneSizing.CoolDesTemp = zoneSizingInput.CoolDesTemp;
919 7099 : zoneSizing.HeatDesTemp = zoneSizingInput.HeatDesTemp;
920 7099 : zoneSizing.CoolDesTempDiff = zoneSizingInput.CoolDesTempDiff;
921 7099 : zoneSizing.HeatDesTempDiff = zoneSizingInput.HeatDesTempDiff;
922 7099 : zoneSizing.CoolDesHumRat = zoneSizingInput.CoolDesHumRat;
923 7099 : zoneSizing.HeatDesHumRat = zoneSizingInput.HeatDesHumRat;
924 7099 : zoneSizing.CoolAirDesMethod = zoneSizingInput.CoolAirDesMethod;
925 7099 : zoneSizing.HeatAirDesMethod = zoneSizingInput.HeatAirDesMethod;
926 7099 : zoneSizing.InpDesCoolAirFlow = zoneSizingInput.DesCoolAirFlow;
927 7099 : zoneSizing.DesCoolMinAirFlowPerArea = zoneSizingInput.DesCoolMinAirFlowPerArea;
928 7099 : zoneSizing.DesCoolMinAirFlow = zoneSizingInput.DesCoolMinAirFlow;
929 7099 : zoneSizing.DesCoolMinAirFlowFrac = zoneSizingInput.DesCoolMinAirFlowFrac;
930 7099 : zoneSizing.InpDesHeatAirFlow = zoneSizingInput.DesHeatAirFlow;
931 7099 : zoneSizing.DesHeatMaxAirFlowPerArea = zoneSizingInput.DesHeatMaxAirFlowPerArea;
932 7099 : zoneSizing.DesHeatMaxAirFlow = zoneSizingInput.DesHeatMaxAirFlow;
933 7099 : zoneSizing.DesHeatMaxAirFlowFrac = zoneSizingInput.DesHeatMaxAirFlowFrac;
934 7099 : zoneSizing.HeatSizingFactor = zoneSizingInput.HeatSizingFactor;
935 7099 : zoneSizing.CoolSizingFactor = zoneSizingInput.CoolSizingFactor;
936 7099 : zoneSizing.AccountForDOAS = zoneSizingInput.AccountForDOAS;
937 7099 : zoneSizing.DOASControlStrategy = zoneSizingInput.DOASControlStrategy;
938 7099 : zoneSizing.DOASLowSetpoint = zoneSizingInput.DOASLowSetpoint;
939 7099 : zoneSizing.DOASHighSetpoint = zoneSizingInput.DOASHighSetpoint;
940 7099 : zoneSizing.zoneSizingMethod = zoneSizingInput.zoneSizingMethod;
941 7099 : zoneSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing;
942 7099 : zoneSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint;
943 7099 : zoneSizing.zoneRHHumidifySetPoint = zoneSizingInput.zoneRHHumidifySetPoint;
944 7099 : zoneSizing.zoneRHDehumidifySchIndex = zoneSizingInput.zoneRHDehumidifySchIndex;
945 7099 : zoneSizing.zoneRHHumidifySchIndex = zoneSizingInput.zoneRHHumidifySchIndex;
946 7099 : zoneSizing.ZnLatCoolDgnSAMethod = zoneSizingInput.ZnLatCoolDgnSAMethod;
947 7099 : zoneSizing.ZnLatHeatDgnSAMethod = zoneSizingInput.ZnLatHeatDgnSAMethod;
948 7099 : calcZoneSizing.ZnCoolDgnSAMethod = zoneSizingInput.ZnCoolDgnSAMethod;
949 7099 : calcZoneSizing.ZnHeatDgnSAMethod = zoneSizingInput.ZnHeatDgnSAMethod;
950 7099 : calcZoneSizing.CoolDesTemp = zoneSizingInput.CoolDesTemp;
951 7099 : calcZoneSizing.HeatDesTemp = zoneSizingInput.HeatDesTemp;
952 7099 : calcZoneSizing.CoolDesTempDiff = zoneSizingInput.CoolDesTempDiff;
953 7099 : calcZoneSizing.HeatDesTempDiff = zoneSizingInput.HeatDesTempDiff;
954 7099 : calcZoneSizing.CoolDesHumRat = zoneSizingInput.CoolDesHumRat;
955 7099 : calcZoneSizing.HeatDesHumRat = zoneSizingInput.HeatDesHumRat;
956 7099 : calcZoneSizing.CoolAirDesMethod = zoneSizingInput.CoolAirDesMethod;
957 7099 : calcZoneSizing.HeatAirDesMethod = zoneSizingInput.HeatAirDesMethod;
958 7099 : calcZoneSizing.InpDesCoolAirFlow = zoneSizingInput.DesCoolAirFlow;
959 7099 : calcZoneSizing.DesCoolMinAirFlowPerArea = zoneSizingInput.DesCoolMinAirFlowPerArea;
960 7099 : calcZoneSizing.DesCoolMinAirFlow = zoneSizingInput.DesCoolMinAirFlow;
961 7099 : calcZoneSizing.DesCoolMinAirFlowFrac = zoneSizingInput.DesCoolMinAirFlowFrac;
962 7099 : calcZoneSizing.InpDesHeatAirFlow = zoneSizingInput.DesHeatAirFlow;
963 7099 : calcZoneSizing.DesHeatMaxAirFlowPerArea = zoneSizingInput.DesHeatMaxAirFlowPerArea;
964 7099 : calcZoneSizing.DesHeatMaxAirFlow = zoneSizingInput.DesHeatMaxAirFlow;
965 7099 : calcZoneSizing.DesHeatMaxAirFlowFrac = zoneSizingInput.DesHeatMaxAirFlowFrac;
966 7099 : calcZoneSizing.HeatSizingFactor = zoneSizingInput.HeatSizingFactor;
967 7099 : calcZoneSizing.CoolSizingFactor = zoneSizingInput.CoolSizingFactor;
968 7099 : calcZoneSizing.AccountForDOAS = zoneSizingInput.AccountForDOAS;
969 7099 : calcZoneSizing.DOASControlStrategy = zoneSizingInput.DOASControlStrategy;
970 7099 : calcZoneSizing.DOASLowSetpoint = zoneSizingInput.DOASLowSetpoint;
971 7099 : calcZoneSizing.DOASHighSetpoint = zoneSizingInput.DOASHighSetpoint;
972 7099 : calcZoneSizing.zoneSizingMethod = zoneSizingInput.zoneSizingMethod;
973 7099 : calcZoneSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing;
974 7099 : calcZoneSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint;
975 7099 : calcZoneSizing.zoneRHHumidifySetPoint = zoneSizingInput.zoneRHHumidifySetPoint;
976 7099 : calcZoneSizing.zoneRHDehumidifySchIndex = zoneSizingInput.zoneRHDehumidifySchIndex;
977 7099 : calcZoneSizing.zoneRHHumidifySchIndex = zoneSizingInput.zoneRHHumidifySchIndex;
978 7099 : calcZoneSizing.ZnLatCoolDgnSAMethod = zoneSizingInput.ZnLatCoolDgnSAMethod;
979 7099 : calcZoneSizing.LatentCoolDesHumRat = zoneSizingInput.LatentCoolDesHumRat;
980 7099 : calcZoneSizing.CoolDesHumRatDiff = zoneSizingInput.CoolDesHumRatDiff;
981 7099 : calcZoneSizing.ZnLatHeatDgnSAMethod = zoneSizingInput.ZnLatHeatDgnSAMethod;
982 7099 : calcZoneSizing.LatentHeatDesHumRat = zoneSizingInput.LatentHeatDesHumRat;
983 7099 : calcZoneSizing.HeatDesHumRatDiff = zoneSizingInput.HeatDesHumRatDiff;
984 : } else { // Every controlled zone must be simulated, so set missing inputs to the first
985 58 : auto &zoneSizingInput = state.dataSize->ZoneSizingInput(1);
986 : // LKL I think this is sufficient for warning -- no need for array
987 58 : if (DesDayNum == 1) {
988 29 : if (!state.dataGlobal->isPulseZoneSizing) {
989 87 : ShowWarningError(state,
990 58 : "SetUpZoneSizingArrays: Sizing for Zone=\"" + state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneName +
991 87 : "\" will use Sizing:Zone specifications listed for Zone=\"" + zoneSizingInput.ZoneName + "\".");
992 : }
993 : // Following needs to be implemented first:
994 : // CALL ShowContinueError(state, ' A better option would be to set up global ZoneList objects for Sizing:Zone
995 : // objects.')
996 : }
997 58 : zoneSizing.ZnCoolDgnSAMethod = zoneSizingInput.ZnCoolDgnSAMethod;
998 58 : zoneSizing.ZnHeatDgnSAMethod = zoneSizingInput.ZnHeatDgnSAMethod;
999 58 : zoneSizing.CoolDesTemp = zoneSizingInput.CoolDesTemp;
1000 58 : zoneSizing.HeatDesTemp = zoneSizingInput.HeatDesTemp;
1001 58 : zoneSizing.CoolDesTempDiff = zoneSizingInput.CoolDesTempDiff;
1002 58 : zoneSizing.HeatDesTempDiff = zoneSizingInput.HeatDesTempDiff;
1003 58 : zoneSizing.CoolDesHumRat = zoneSizingInput.CoolDesHumRat;
1004 58 : zoneSizing.HeatDesHumRat = zoneSizingInput.HeatDesHumRat;
1005 58 : zoneSizing.CoolAirDesMethod = zoneSizingInput.CoolAirDesMethod;
1006 58 : zoneSizing.HeatAirDesMethod = zoneSizingInput.HeatAirDesMethod;
1007 58 : zoneSizing.InpDesCoolAirFlow = zoneSizingInput.DesCoolAirFlow;
1008 58 : zoneSizing.DesCoolMinAirFlowPerArea = zoneSizingInput.DesCoolMinAirFlowPerArea;
1009 58 : zoneSizing.DesCoolMinAirFlow = zoneSizingInput.DesCoolMinAirFlow;
1010 58 : zoneSizing.DesCoolMinAirFlowFrac = zoneSizingInput.DesCoolMinAirFlowFrac;
1011 58 : zoneSizing.InpDesHeatAirFlow = zoneSizingInput.DesHeatAirFlow;
1012 58 : zoneSizing.DesHeatMaxAirFlowPerArea = zoneSizingInput.DesHeatMaxAirFlowPerArea;
1013 58 : zoneSizing.DesHeatMaxAirFlow = zoneSizingInput.DesHeatMaxAirFlow;
1014 58 : zoneSizing.DesHeatMaxAirFlowFrac = zoneSizingInput.DesHeatMaxAirFlowFrac;
1015 58 : zoneSizing.HeatSizingFactor = zoneSizingInput.HeatSizingFactor;
1016 58 : zoneSizing.CoolSizingFactor = zoneSizingInput.CoolSizingFactor;
1017 58 : zoneSizing.AccountForDOAS = zoneSizingInput.AccountForDOAS;
1018 58 : zoneSizing.DOASControlStrategy = zoneSizingInput.DOASControlStrategy;
1019 58 : zoneSizing.DOASLowSetpoint = zoneSizingInput.DOASLowSetpoint;
1020 58 : zoneSizing.DOASHighSetpoint = zoneSizingInput.DOASHighSetpoint;
1021 58 : zoneSizing.zoneSizingMethod = zoneSizingInput.zoneSizingMethod;
1022 58 : zoneSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing;
1023 58 : zoneSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint;
1024 58 : zoneSizing.zoneRHHumidifySetPoint = zoneSizingInput.zoneRHHumidifySetPoint;
1025 58 : zoneSizing.zoneRHDehumidifySchIndex = zoneSizingInput.zoneRHDehumidifySchIndex;
1026 58 : zoneSizing.zoneRHHumidifySchIndex = zoneSizingInput.zoneRHHumidifySchIndex;
1027 58 : zoneSizing.ZnLatCoolDgnSAMethod = zoneSizingInput.ZnLatCoolDgnSAMethod;
1028 58 : zoneSizing.LatentCoolDesHumRat = zoneSizingInput.LatentCoolDesHumRat;
1029 58 : zoneSizing.CoolDesHumRatDiff = zoneSizingInput.CoolDesHumRatDiff;
1030 58 : zoneSizing.ZnLatHeatDgnSAMethod = zoneSizingInput.ZnLatHeatDgnSAMethod;
1031 58 : zoneSizing.LatentHeatDesHumRat = zoneSizingInput.LatentHeatDesHumRat;
1032 58 : zoneSizing.HeatDesHumRatDiff = zoneSizingInput.HeatDesHumRatDiff;
1033 58 : calcZoneSizing.ZnCoolDgnSAMethod = zoneSizingInput.ZnCoolDgnSAMethod;
1034 58 : calcZoneSizing.ZnHeatDgnSAMethod = zoneSizingInput.ZnHeatDgnSAMethod;
1035 58 : calcZoneSizing.CoolDesTemp = zoneSizingInput.CoolDesTemp;
1036 58 : calcZoneSizing.HeatDesTemp = zoneSizingInput.HeatDesTemp;
1037 58 : calcZoneSizing.CoolDesTempDiff = zoneSizingInput.CoolDesTempDiff;
1038 58 : calcZoneSizing.HeatDesTempDiff = zoneSizingInput.HeatDesTempDiff;
1039 58 : calcZoneSizing.CoolDesHumRat = zoneSizingInput.CoolDesHumRat;
1040 58 : calcZoneSizing.HeatDesHumRat = zoneSizingInput.HeatDesHumRat;
1041 58 : calcZoneSizing.CoolAirDesMethod = zoneSizingInput.CoolAirDesMethod;
1042 58 : calcZoneSizing.HeatAirDesMethod = zoneSizingInput.HeatAirDesMethod;
1043 58 : calcZoneSizing.InpDesCoolAirFlow = zoneSizingInput.DesCoolAirFlow;
1044 58 : calcZoneSizing.DesCoolMinAirFlowPerArea = zoneSizingInput.DesCoolMinAirFlowPerArea;
1045 58 : calcZoneSizing.DesCoolMinAirFlow = zoneSizingInput.DesCoolMinAirFlow;
1046 58 : calcZoneSizing.DesCoolMinAirFlowFrac = zoneSizingInput.DesCoolMinAirFlowFrac;
1047 58 : calcZoneSizing.InpDesHeatAirFlow = zoneSizingInput.DesHeatAirFlow;
1048 58 : calcZoneSizing.DesHeatMaxAirFlowPerArea = zoneSizingInput.DesHeatMaxAirFlowPerArea;
1049 58 : calcZoneSizing.DesHeatMaxAirFlow = zoneSizingInput.DesHeatMaxAirFlow;
1050 58 : calcZoneSizing.DesHeatMaxAirFlowFrac = zoneSizingInput.DesHeatMaxAirFlowFrac;
1051 58 : calcZoneSizing.HeatSizingFactor = zoneSizingInput.HeatSizingFactor;
1052 58 : calcZoneSizing.CoolSizingFactor = zoneSizingInput.CoolSizingFactor;
1053 58 : calcZoneSizing.AccountForDOAS = zoneSizingInput.AccountForDOAS;
1054 58 : calcZoneSizing.DOASControlStrategy = zoneSizingInput.DOASControlStrategy;
1055 58 : calcZoneSizing.DOASLowSetpoint = zoneSizingInput.DOASLowSetpoint;
1056 58 : calcZoneSizing.DOASHighSetpoint = zoneSizingInput.DOASHighSetpoint;
1057 58 : calcZoneSizing.zoneSizingMethod = zoneSizingInput.zoneSizingMethod;
1058 58 : calcZoneSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing;
1059 58 : calcZoneSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint;
1060 58 : calcZoneSizing.zoneRHHumidifySetPoint = zoneSizingInput.zoneRHHumidifySetPoint;
1061 58 : calcZoneSizing.zoneRHDehumidifySchIndex = zoneSizingInput.zoneRHDehumidifySchIndex;
1062 58 : calcZoneSizing.zoneRHHumidifySchIndex = zoneSizingInput.zoneRHHumidifySchIndex;
1063 58 : calcZoneSizing.ZnLatCoolDgnSAMethod = zoneSizingInput.ZnLatCoolDgnSAMethod;
1064 58 : calcZoneSizing.LatentCoolDesHumRat = zoneSizingInput.LatentCoolDesHumRat;
1065 58 : calcZoneSizing.CoolDesHumRatDiff = zoneSizingInput.CoolDesHumRatDiff;
1066 58 : calcZoneSizing.ZnLatHeatDgnSAMethod = zoneSizingInput.ZnLatHeatDgnSAMethod;
1067 58 : calcZoneSizing.LatentHeatDesHumRat = zoneSizingInput.LatentHeatDesHumRat;
1068 58 : calcZoneSizing.HeatDesHumRatDiff = zoneSizingInput.HeatDesHumRatDiff;
1069 : }
1070 7157 : zoneSizing.allocateMemberArrays(NumOfTimeStepInDay);
1071 7157 : calcZoneSizing.allocateMemberArrays(NumOfTimeStepInDay);
1072 : }
1073 : }
1074 :
1075 4195 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
1076 3789 : auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum);
1077 3789 : auto &finalZoneSizing = state.dataSize->FinalZoneSizing(CtrlZoneNum);
1078 3789 : auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(CtrlZoneNum);
1079 3789 : if (!zoneEquipConfig.IsControlled) continue;
1080 3320 : finalZoneSizing.ZoneName = zoneEquipConfig.ZoneName;
1081 3320 : finalZoneSizing.ZoneNum = CtrlZoneNum;
1082 3320 : calcFinalZoneSizing.ZoneName = zoneEquipConfig.ZoneName;
1083 3320 : calcFinalZoneSizing.ZoneNum = CtrlZoneNum;
1084 3320 : ZoneSizNum = UtilityRoutines::FindItemInList(zoneEquipConfig.ZoneName, state.dataSize->ZoneSizingInput, &ZoneSizingInputData::ZoneName);
1085 3320 : if (ZoneSizNum > 0) { // move data from zone sizing input
1086 3291 : auto &zoneSizingInput = state.dataSize->ZoneSizingInput(ZoneSizNum);
1087 3291 : finalZoneSizing.ZnCoolDgnSAMethod = zoneSizingInput.ZnCoolDgnSAMethod;
1088 3291 : finalZoneSizing.ZnHeatDgnSAMethod = zoneSizingInput.ZnHeatDgnSAMethod;
1089 3291 : finalZoneSizing.CoolDesTemp = zoneSizingInput.CoolDesTemp;
1090 3291 : finalZoneSizing.HeatDesTemp = zoneSizingInput.HeatDesTemp;
1091 3291 : finalZoneSizing.CoolDesTempDiff = zoneSizingInput.CoolDesTempDiff;
1092 3291 : finalZoneSizing.HeatDesTempDiff = zoneSizingInput.HeatDesTempDiff;
1093 3291 : finalZoneSizing.CoolDesHumRat = zoneSizingInput.CoolDesHumRat;
1094 3291 : finalZoneSizing.HeatDesHumRat = zoneSizingInput.HeatDesHumRat;
1095 3291 : finalZoneSizing.ZoneAirDistributionIndex = zoneSizingInput.ZoneAirDistributionIndex;
1096 3291 : finalZoneSizing.ZoneDesignSpecOAIndex = zoneSizingInput.ZoneDesignSpecOAIndex;
1097 3291 : finalZoneSizing.CoolAirDesMethod = zoneSizingInput.CoolAirDesMethod;
1098 3291 : finalZoneSizing.HeatAirDesMethod = zoneSizingInput.HeatAirDesMethod;
1099 3291 : finalZoneSizing.InpDesCoolAirFlow = zoneSizingInput.DesCoolAirFlow;
1100 3291 : finalZoneSizing.DesCoolMinAirFlowPerArea = zoneSizingInput.DesCoolMinAirFlowPerArea;
1101 3291 : finalZoneSizing.DesCoolMinAirFlow = zoneSizingInput.DesCoolMinAirFlow;
1102 3291 : finalZoneSizing.DesCoolMinAirFlowFrac = zoneSizingInput.DesCoolMinAirFlowFrac;
1103 3291 : finalZoneSizing.InpDesHeatAirFlow = zoneSizingInput.DesHeatAirFlow;
1104 3291 : finalZoneSizing.DesHeatMaxAirFlowPerArea = zoneSizingInput.DesHeatMaxAirFlowPerArea;
1105 3291 : finalZoneSizing.DesHeatMaxAirFlow = zoneSizingInput.DesHeatMaxAirFlow;
1106 3291 : finalZoneSizing.DesHeatMaxAirFlowFrac = zoneSizingInput.DesHeatMaxAirFlowFrac;
1107 3291 : finalZoneSizing.HeatSizingFactor = zoneSizingInput.HeatSizingFactor;
1108 3291 : finalZoneSizing.CoolSizingFactor = zoneSizingInput.CoolSizingFactor;
1109 3291 : finalZoneSizing.AccountForDOAS = zoneSizingInput.AccountForDOAS;
1110 3291 : finalZoneSizing.DOASControlStrategy = zoneSizingInput.DOASControlStrategy;
1111 3291 : finalZoneSizing.DOASLowSetpoint = zoneSizingInput.DOASLowSetpoint;
1112 3291 : finalZoneSizing.DOASHighSetpoint = zoneSizingInput.DOASHighSetpoint;
1113 3291 : finalZoneSizing.ZoneADEffCooling = zoneSizingInput.ZoneADEffCooling;
1114 3291 : finalZoneSizing.ZoneADEffHeating = zoneSizingInput.ZoneADEffHeating;
1115 3291 : finalZoneSizing.ZoneSecondaryRecirculation = zoneSizingInput.ZoneSecondaryRecirculation;
1116 3291 : finalZoneSizing.ZoneVentilationEff = zoneSizingInput.ZoneVentilationEff;
1117 3291 : finalZoneSizing.zoneSizingMethod = zoneSizingInput.zoneSizingMethod;
1118 3291 : finalZoneSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing;
1119 3291 : finalZoneSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint;
1120 3291 : finalZoneSizing.zoneRHHumidifySetPoint = zoneSizingInput.zoneRHHumidifySetPoint;
1121 3291 : finalZoneSizing.zoneRHDehumidifySchIndex = zoneSizingInput.zoneRHDehumidifySchIndex;
1122 3291 : finalZoneSizing.zoneRHHumidifySchIndex = zoneSizingInput.zoneRHHumidifySchIndex;
1123 3291 : finalZoneSizing.ZnLatCoolDgnSAMethod = zoneSizingInput.ZnLatCoolDgnSAMethod;
1124 3291 : finalZoneSizing.LatentCoolDesHumRat = zoneSizingInput.LatentCoolDesHumRat;
1125 3291 : finalZoneSizing.CoolDesHumRatDiff = zoneSizingInput.CoolDesHumRatDiff;
1126 3291 : finalZoneSizing.ZnLatHeatDgnSAMethod = zoneSizingInput.ZnLatHeatDgnSAMethod;
1127 3291 : finalZoneSizing.LatentHeatDesHumRat = zoneSizingInput.LatentHeatDesHumRat;
1128 3291 : finalZoneSizing.HeatDesHumRatDiff = zoneSizingInput.HeatDesHumRatDiff;
1129 3291 : calcFinalZoneSizing.ZnCoolDgnSAMethod = zoneSizingInput.ZnCoolDgnSAMethod;
1130 3291 : calcFinalZoneSizing.ZnHeatDgnSAMethod = zoneSizingInput.ZnHeatDgnSAMethod;
1131 3291 : calcFinalZoneSizing.CoolDesTemp = zoneSizingInput.CoolDesTemp;
1132 3291 : calcFinalZoneSizing.HeatDesTemp = zoneSizingInput.HeatDesTemp;
1133 3291 : calcFinalZoneSizing.CoolDesTempDiff = zoneSizingInput.CoolDesTempDiff;
1134 3291 : calcFinalZoneSizing.HeatDesTempDiff = zoneSizingInput.HeatDesTempDiff;
1135 3291 : calcFinalZoneSizing.CoolDesHumRat = zoneSizingInput.CoolDesHumRat;
1136 3291 : calcFinalZoneSizing.HeatDesHumRat = zoneSizingInput.HeatDesHumRat;
1137 3291 : calcFinalZoneSizing.ZoneAirDistributionIndex = zoneSizingInput.ZoneAirDistributionIndex;
1138 3291 : calcFinalZoneSizing.ZoneDesignSpecOAIndex = zoneSizingInput.ZoneDesignSpecOAIndex;
1139 3291 : calcFinalZoneSizing.CoolAirDesMethod = zoneSizingInput.CoolAirDesMethod;
1140 3291 : calcFinalZoneSizing.HeatAirDesMethod = zoneSizingInput.HeatAirDesMethod;
1141 3291 : calcFinalZoneSizing.InpDesCoolAirFlow = zoneSizingInput.DesCoolAirFlow;
1142 3291 : calcFinalZoneSizing.DesCoolMinAirFlowPerArea = zoneSizingInput.DesCoolMinAirFlowPerArea;
1143 3291 : calcFinalZoneSizing.DesCoolMinAirFlow = zoneSizingInput.DesCoolMinAirFlow;
1144 3291 : calcFinalZoneSizing.DesCoolMinAirFlowFrac = zoneSizingInput.DesCoolMinAirFlowFrac;
1145 3291 : calcFinalZoneSizing.InpDesHeatAirFlow = zoneSizingInput.DesHeatAirFlow;
1146 3291 : calcFinalZoneSizing.DesHeatMaxAirFlowPerArea = zoneSizingInput.DesHeatMaxAirFlowPerArea;
1147 3291 : calcFinalZoneSizing.DesHeatMaxAirFlow = zoneSizingInput.DesHeatMaxAirFlow;
1148 3291 : calcFinalZoneSizing.DesHeatMaxAirFlowFrac = zoneSizingInput.DesHeatMaxAirFlowFrac;
1149 3291 : calcFinalZoneSizing.HeatSizingFactor = zoneSizingInput.HeatSizingFactor;
1150 3291 : calcFinalZoneSizing.CoolSizingFactor = zoneSizingInput.CoolSizingFactor;
1151 3291 : calcFinalZoneSizing.AccountForDOAS = zoneSizingInput.AccountForDOAS;
1152 3291 : calcFinalZoneSizing.DOASControlStrategy = zoneSizingInput.DOASControlStrategy;
1153 3291 : calcFinalZoneSizing.DOASLowSetpoint = zoneSizingInput.DOASLowSetpoint;
1154 3291 : calcFinalZoneSizing.DOASHighSetpoint = zoneSizingInput.DOASHighSetpoint;
1155 3291 : calcFinalZoneSizing.ZoneADEffCooling = zoneSizingInput.ZoneADEffCooling;
1156 3291 : calcFinalZoneSizing.ZoneADEffHeating = zoneSizingInput.ZoneADEffHeating;
1157 3291 : calcFinalZoneSizing.zoneSizingMethod = zoneSizingInput.zoneSizingMethod;
1158 3291 : calcFinalZoneSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing;
1159 3291 : calcFinalZoneSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint;
1160 3291 : calcFinalZoneSizing.zoneRHHumidifySetPoint = zoneSizingInput.zoneRHHumidifySetPoint;
1161 3291 : calcFinalZoneSizing.zoneRHDehumidifySchIndex = zoneSizingInput.zoneRHDehumidifySchIndex;
1162 3291 : calcFinalZoneSizing.zoneRHHumidifySchIndex = zoneSizingInput.zoneRHHumidifySchIndex;
1163 3291 : calcFinalZoneSizing.ZnLatCoolDgnSAMethod = zoneSizingInput.ZnLatCoolDgnSAMethod;
1164 3291 : calcFinalZoneSizing.LatentCoolDesHumRat = zoneSizingInput.LatentCoolDesHumRat;
1165 3291 : calcFinalZoneSizing.CoolDesHumRatDiff = zoneSizingInput.CoolDesHumRatDiff;
1166 3291 : calcFinalZoneSizing.ZnLatHeatDgnSAMethod = zoneSizingInput.ZnLatHeatDgnSAMethod;
1167 3291 : calcFinalZoneSizing.LatentHeatDesHumRat = zoneSizingInput.LatentHeatDesHumRat;
1168 3291 : calcFinalZoneSizing.HeatDesHumRatDiff = zoneSizingInput.HeatDesHumRatDiff;
1169 : } else { // Every controlled zone must be simulated, so set missing inputs to the first
1170 29 : auto &zoneSizingInput = state.dataSize->ZoneSizingInput(1);
1171 29 : finalZoneSizing.ZnCoolDgnSAMethod = zoneSizingInput.ZnCoolDgnSAMethod;
1172 29 : finalZoneSizing.ZnHeatDgnSAMethod = zoneSizingInput.ZnHeatDgnSAMethod;
1173 29 : finalZoneSizing.CoolDesTemp = zoneSizingInput.CoolDesTemp;
1174 29 : finalZoneSizing.HeatDesTemp = zoneSizingInput.HeatDesTemp;
1175 29 : finalZoneSizing.CoolDesTempDiff = zoneSizingInput.CoolDesTempDiff;
1176 29 : finalZoneSizing.HeatDesTempDiff = zoneSizingInput.HeatDesTempDiff;
1177 29 : finalZoneSizing.CoolDesHumRat = zoneSizingInput.CoolDesHumRat;
1178 29 : finalZoneSizing.HeatDesHumRat = zoneSizingInput.HeatDesHumRat;
1179 29 : finalZoneSizing.ZoneAirDistributionIndex = zoneSizingInput.ZoneAirDistributionIndex;
1180 29 : finalZoneSizing.ZoneDesignSpecOAIndex = zoneSizingInput.ZoneDesignSpecOAIndex;
1181 29 : finalZoneSizing.CoolAirDesMethod = zoneSizingInput.CoolAirDesMethod;
1182 29 : finalZoneSizing.HeatAirDesMethod = zoneSizingInput.HeatAirDesMethod;
1183 29 : finalZoneSizing.InpDesCoolAirFlow = zoneSizingInput.DesCoolAirFlow;
1184 29 : finalZoneSizing.DesCoolMinAirFlowPerArea = zoneSizingInput.DesCoolMinAirFlowPerArea;
1185 29 : finalZoneSizing.DesCoolMinAirFlow = zoneSizingInput.DesCoolMinAirFlow;
1186 29 : finalZoneSizing.DesCoolMinAirFlowFrac = zoneSizingInput.DesCoolMinAirFlowFrac;
1187 29 : finalZoneSizing.InpDesHeatAirFlow = zoneSizingInput.DesHeatAirFlow;
1188 29 : finalZoneSizing.DesHeatMaxAirFlowPerArea = zoneSizingInput.DesHeatMaxAirFlowPerArea;
1189 29 : finalZoneSizing.DesHeatMaxAirFlow = zoneSizingInput.DesHeatMaxAirFlow;
1190 29 : finalZoneSizing.DesHeatMaxAirFlowFrac = zoneSizingInput.DesHeatMaxAirFlowFrac;
1191 29 : finalZoneSizing.HeatSizingFactor = zoneSizingInput.HeatSizingFactor;
1192 29 : finalZoneSizing.CoolSizingFactor = zoneSizingInput.CoolSizingFactor;
1193 29 : finalZoneSizing.AccountForDOAS = zoneSizingInput.AccountForDOAS;
1194 29 : finalZoneSizing.DOASControlStrategy = zoneSizingInput.DOASControlStrategy;
1195 29 : finalZoneSizing.DOASLowSetpoint = zoneSizingInput.DOASLowSetpoint;
1196 29 : finalZoneSizing.DOASHighSetpoint = zoneSizingInput.DOASHighSetpoint;
1197 29 : finalZoneSizing.ZoneADEffCooling = zoneSizingInput.ZoneADEffCooling;
1198 29 : finalZoneSizing.ZoneADEffHeating = zoneSizingInput.ZoneADEffHeating;
1199 29 : finalZoneSizing.ZoneSecondaryRecirculation = zoneSizingInput.ZoneSecondaryRecirculation;
1200 29 : finalZoneSizing.ZoneVentilationEff = zoneSizingInput.ZoneVentilationEff;
1201 29 : finalZoneSizing.zoneSizingMethod = zoneSizingInput.zoneSizingMethod;
1202 29 : finalZoneSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing;
1203 29 : finalZoneSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint;
1204 29 : finalZoneSizing.zoneRHHumidifySetPoint = zoneSizingInput.zoneRHHumidifySetPoint;
1205 29 : finalZoneSizing.zoneRHDehumidifySchIndex = zoneSizingInput.zoneRHDehumidifySchIndex;
1206 29 : finalZoneSizing.zoneRHHumidifySchIndex = zoneSizingInput.zoneRHHumidifySchIndex;
1207 29 : finalZoneSizing.ZnLatCoolDgnSAMethod = zoneSizingInput.ZnLatCoolDgnSAMethod;
1208 29 : finalZoneSizing.LatentCoolDesHumRat = zoneSizingInput.LatentCoolDesHumRat;
1209 29 : finalZoneSizing.CoolDesHumRatDiff = zoneSizingInput.CoolDesHumRatDiff;
1210 29 : finalZoneSizing.ZnLatHeatDgnSAMethod = zoneSizingInput.ZnLatHeatDgnSAMethod;
1211 29 : finalZoneSizing.LatentHeatDesHumRat = zoneSizingInput.LatentHeatDesHumRat;
1212 29 : finalZoneSizing.HeatDesHumRatDiff = zoneSizingInput.HeatDesHumRatDiff;
1213 29 : calcFinalZoneSizing.ZnCoolDgnSAMethod = zoneSizingInput.ZnCoolDgnSAMethod;
1214 29 : calcFinalZoneSizing.ZnHeatDgnSAMethod = zoneSizingInput.ZnHeatDgnSAMethod;
1215 29 : calcFinalZoneSizing.CoolDesTemp = zoneSizingInput.CoolDesTemp;
1216 29 : calcFinalZoneSizing.HeatDesTemp = zoneSizingInput.HeatDesTemp;
1217 29 : calcFinalZoneSizing.CoolDesTempDiff = zoneSizingInput.CoolDesTempDiff;
1218 29 : calcFinalZoneSizing.HeatDesTempDiff = zoneSizingInput.HeatDesTempDiff;
1219 29 : calcFinalZoneSizing.CoolDesHumRat = zoneSizingInput.CoolDesHumRat;
1220 29 : calcFinalZoneSizing.HeatDesHumRat = zoneSizingInput.HeatDesHumRat;
1221 29 : calcFinalZoneSizing.ZoneAirDistributionIndex = zoneSizingInput.ZoneAirDistributionIndex;
1222 29 : calcFinalZoneSizing.ZoneDesignSpecOAIndex = zoneSizingInput.ZoneDesignSpecOAIndex;
1223 29 : calcFinalZoneSizing.CoolAirDesMethod = zoneSizingInput.CoolAirDesMethod;
1224 29 : calcFinalZoneSizing.HeatAirDesMethod = zoneSizingInput.HeatAirDesMethod;
1225 29 : calcFinalZoneSizing.InpDesCoolAirFlow = zoneSizingInput.DesCoolAirFlow;
1226 29 : calcFinalZoneSizing.DesCoolMinAirFlowPerArea = zoneSizingInput.DesCoolMinAirFlowPerArea;
1227 29 : calcFinalZoneSizing.DesCoolMinAirFlow = zoneSizingInput.DesCoolMinAirFlow;
1228 29 : calcFinalZoneSizing.DesCoolMinAirFlowFrac = zoneSizingInput.DesCoolMinAirFlowFrac;
1229 29 : calcFinalZoneSizing.InpDesHeatAirFlow = zoneSizingInput.DesHeatAirFlow;
1230 29 : calcFinalZoneSizing.DesHeatMaxAirFlowPerArea = zoneSizingInput.DesHeatMaxAirFlowPerArea;
1231 29 : calcFinalZoneSizing.DesHeatMaxAirFlow = zoneSizingInput.DesHeatMaxAirFlow;
1232 29 : calcFinalZoneSizing.DesHeatMaxAirFlowFrac = zoneSizingInput.DesHeatMaxAirFlowFrac;
1233 29 : calcFinalZoneSizing.HeatSizingFactor = zoneSizingInput.HeatSizingFactor;
1234 29 : calcFinalZoneSizing.CoolSizingFactor = zoneSizingInput.CoolSizingFactor;
1235 29 : calcFinalZoneSizing.AccountForDOAS = zoneSizingInput.AccountForDOAS;
1236 29 : calcFinalZoneSizing.DOASControlStrategy = zoneSizingInput.DOASControlStrategy;
1237 29 : calcFinalZoneSizing.DOASLowSetpoint = zoneSizingInput.DOASLowSetpoint;
1238 29 : calcFinalZoneSizing.DOASHighSetpoint = zoneSizingInput.DOASHighSetpoint;
1239 29 : calcFinalZoneSizing.ZoneADEffCooling = zoneSizingInput.ZoneADEffCooling;
1240 29 : calcFinalZoneSizing.ZoneADEffHeating = zoneSizingInput.ZoneADEffHeating;
1241 29 : calcFinalZoneSizing.zoneSizingMethod = zoneSizingInput.zoneSizingMethod;
1242 29 : calcFinalZoneSizing.zoneLatentSizing = zoneSizingInput.zoneLatentSizing;
1243 29 : calcFinalZoneSizing.zoneRHDehumidifySetPoint = zoneSizingInput.zoneRHDehumidifySetPoint;
1244 29 : calcFinalZoneSizing.zoneRHHumidifySetPoint = zoneSizingInput.zoneRHHumidifySetPoint;
1245 29 : calcFinalZoneSizing.zoneRHDehumidifySchIndex = zoneSizingInput.zoneRHDehumidifySchIndex;
1246 29 : calcFinalZoneSizing.zoneRHHumidifySchIndex = zoneSizingInput.zoneRHHumidifySchIndex;
1247 29 : calcFinalZoneSizing.ZnLatCoolDgnSAMethod = zoneSizingInput.ZnLatCoolDgnSAMethod;
1248 29 : calcFinalZoneSizing.LatentCoolDesHumRat = zoneSizingInput.LatentCoolDesHumRat;
1249 29 : calcFinalZoneSizing.CoolDesHumRatDiff = zoneSizingInput.CoolDesHumRatDiff;
1250 29 : calcFinalZoneSizing.ZnLatHeatDgnSAMethod = zoneSizingInput.ZnLatHeatDgnSAMethod;
1251 29 : calcFinalZoneSizing.LatentHeatDesHumRat = zoneSizingInput.LatentHeatDesHumRat;
1252 29 : calcFinalZoneSizing.HeatDesHumRatDiff = zoneSizingInput.HeatDesHumRatDiff;
1253 : }
1254 3320 : finalZoneSizing.allocateMemberArrays(NumOfTimeStepInDay);
1255 3320 : calcFinalZoneSizing.allocateMemberArrays(NumOfTimeStepInDay);
1256 :
1257 : // setup CalcFinalZoneSizing structure for use with EMS, some as sensors, some as actuators
1258 3320 : if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
1259 :
1260 : // actuate REAL(r64) :: DesHeatMassFlow = 0.0d0 ! zone design heating air mass flow rate [kg/s]
1261 2949 : SetupEMSInternalVariable(
1262 1966 : state, "Final Zone Design Heating Air Mass Flow Rate", finalZoneSizing.ZoneName, "[kg/s]", finalZoneSizing.DesHeatMassFlow);
1263 2949 : SetupEMSInternalVariable(state,
1264 : "Intermediate Zone Design Heating Air Mass Flow Rate",
1265 : calcFinalZoneSizing.ZoneName,
1266 : "[kg/s]",
1267 1966 : calcFinalZoneSizing.DesHeatMassFlow);
1268 2949 : SetupEMSActuator(state,
1269 : "Sizing:Zone",
1270 : calcFinalZoneSizing.ZoneName,
1271 : "Zone Design Heating Air Mass Flow Rate",
1272 : "[kg/s]",
1273 : calcFinalZoneSizing.EMSOverrideDesHeatMassOn,
1274 1966 : calcFinalZoneSizing.EMSValueDesHeatMassFlow);
1275 :
1276 2949 : SetupEMSInternalVariable(
1277 1966 : state, "Final Zone Design Cooling Air Mass Flow Rate", finalZoneSizing.ZoneName, "[kg/s]", finalZoneSizing.DesCoolMassFlow);
1278 2949 : SetupEMSInternalVariable(state,
1279 : "Intermediate Zone Design Cooling Air Mass Flow Rate",
1280 : calcFinalZoneSizing.ZoneName,
1281 : "[kg/s]",
1282 1966 : calcFinalZoneSizing.DesCoolMassFlow);
1283 2949 : SetupEMSActuator(state,
1284 : "Sizing:Zone",
1285 : calcFinalZoneSizing.ZoneName,
1286 : "Zone Design Cooling Air Mass Flow Rate",
1287 : "[kg/s]",
1288 : calcFinalZoneSizing.EMSOverrideDesCoolMassOn,
1289 1966 : calcFinalZoneSizing.EMSValueDesCoolMassFlow);
1290 :
1291 983 : SetupEMSInternalVariable(state, "Final Zone Design Heating Load", finalZoneSizing.ZoneName, "[W]", finalZoneSizing.DesHeatLoad);
1292 2949 : SetupEMSInternalVariable(
1293 1966 : state, "Intermediate Zone Design Heating Load", calcFinalZoneSizing.ZoneName, "[W]", calcFinalZoneSizing.DesHeatLoad);
1294 2949 : SetupEMSActuator(state,
1295 : "Sizing:Zone",
1296 : calcFinalZoneSizing.ZoneName,
1297 : "Zone Design Heating Load",
1298 : "[W]",
1299 : calcFinalZoneSizing.EMSOverrideDesHeatLoadOn,
1300 1966 : calcFinalZoneSizing.EMSValueDesHeatLoad);
1301 :
1302 983 : SetupEMSInternalVariable(state, "Final Zone Design Cooling Load", finalZoneSizing.ZoneName, "[W]", finalZoneSizing.DesCoolLoad);
1303 2949 : SetupEMSInternalVariable(
1304 1966 : state, "Intermediate Zone Design Cooling Load", calcFinalZoneSizing.ZoneName, "[W]", calcFinalZoneSizing.DesCoolLoad);
1305 2949 : SetupEMSActuator(state,
1306 : "Sizing:Zone",
1307 : calcFinalZoneSizing.ZoneName,
1308 : "Zone Design Cooling Load",
1309 : "[W]",
1310 : calcFinalZoneSizing.EMSOverrideDesCoolLoadOn,
1311 1966 : calcFinalZoneSizing.EMSValueDesCoolLoad);
1312 :
1313 2949 : SetupEMSInternalVariable(
1314 1966 : state, "Final Zone Design Heating Air Density", finalZoneSizing.ZoneName, "[kg/m3]", finalZoneSizing.DesHeatDens);
1315 2949 : SetupEMSInternalVariable(
1316 1966 : state, "Intermediate Zone Design Heating Air Density", calcFinalZoneSizing.ZoneName, "[kg/m3]", calcFinalZoneSizing.DesHeatDens);
1317 2949 : SetupEMSInternalVariable(
1318 1966 : state, "Final Zone Design Cooling Air Density", finalZoneSizing.ZoneName, "[kg/m3]", finalZoneSizing.DesCoolDens);
1319 2949 : SetupEMSInternalVariable(
1320 1966 : state, "Intermediate Zone Design Cooling Air Density", calcFinalZoneSizing.ZoneName, "[kg/m3]", calcFinalZoneSizing.DesCoolDens);
1321 :
1322 2949 : SetupEMSInternalVariable(
1323 1966 : state, "Final Zone Design Heating Volume Flow", finalZoneSizing.ZoneName, "[m3/s]", finalZoneSizing.DesHeatVolFlow);
1324 2949 : SetupEMSInternalVariable(
1325 1966 : state, "Intermediate Zone Design Heating Volume Flow", calcFinalZoneSizing.ZoneName, "[m3/s]", calcFinalZoneSizing.DesHeatVolFlow);
1326 2949 : SetupEMSActuator(state,
1327 : "Sizing:Zone",
1328 : calcFinalZoneSizing.ZoneName,
1329 : "Zone Design Heating Vol Flow",
1330 : "[m3/s]",
1331 : calcFinalZoneSizing.EMSOverrideDesHeatVolOn,
1332 1966 : calcFinalZoneSizing.EMSValueDesHeatVolFlow);
1333 :
1334 2949 : SetupEMSInternalVariable(
1335 1966 : state, "Final Zone Design Cooling Volume Flow", finalZoneSizing.ZoneName, "[m3/s]", finalZoneSizing.DesCoolVolFlow);
1336 2949 : SetupEMSInternalVariable(
1337 1966 : state, "Intermediate Zone Design Cooling Volume Flow", calcFinalZoneSizing.ZoneName, "[m3/s]", calcFinalZoneSizing.DesCoolVolFlow);
1338 2949 : SetupEMSActuator(state,
1339 : "Sizing:Zone",
1340 : calcFinalZoneSizing.ZoneName,
1341 : "Zone Design Cooling Vol Flow",
1342 : "[m3/s]",
1343 : calcFinalZoneSizing.EMSOverrideDesCoolVolOn,
1344 1966 : calcFinalZoneSizing.EMSValueDesCoolVolFlow);
1345 :
1346 2949 : SetupEMSInternalVariable(
1347 1966 : state, "Zone Outdoor Air Design Volume Flow Rate", calcFinalZoneSizing.ZoneName, "[m3/s]", calcFinalZoneSizing.MinOA);
1348 : }
1349 : }
1350 :
1351 : // Populate DesignSpecification:OutdoorAir:SpaceList spaces
1352 406 : bool dsoaError = false;
1353 4155 : for (int oaIndex = 1; oaIndex <= state.dataSize->NumOARequirements; ++oaIndex) {
1354 3749 : auto &thisOAReq = state.dataSize->OARequirements(oaIndex);
1355 : // If this is a DesignSpecification:OutdoorAir:SpaceList check to make sure spaces are valid and belong to this zone
1356 3749 : if (thisOAReq.numDSOA > 0) {
1357 3 : for (int spaceCounter = 1; spaceCounter <= thisOAReq.numDSOA; ++spaceCounter) {
1358 4 : std::string thisSpaceName = thisOAReq.dsoaSpaceNames(spaceCounter);
1359 2 : int thisSpaceNum = UtilityRoutines::FindItemInList(thisSpaceName, state.dataHeatBal->space);
1360 2 : if (thisSpaceNum > 0) {
1361 2 : thisOAReq.dsoaSpaceIndexes.emplace_back(thisSpaceNum);
1362 : } else {
1363 0 : ShowSevereError(state, "SetUpZoneSizingArrays: DesignSpecification:OutdoorAir:SpaceList=" + thisOAReq.Name);
1364 0 : ShowContinueError(state, "Space Name=" + thisSpaceName + " not found.");
1365 0 : dsoaError = true;
1366 0 : ErrorsFound = true;
1367 : }
1368 : // Check for duplicate spaces
1369 3 : for (int loop = 1; loop <= int(thisOAReq.dsoaSpaceIndexes.size()) - 1; ++loop) {
1370 1 : if (thisSpaceNum == thisOAReq.dsoaSpaceIndexes(loop)) {
1371 0 : ShowSevereError(state, "SetUpZoneSizingArrays: DesignSpecification:OutdoorAir:SpaceList=" + thisOAReq.Name);
1372 0 : ShowContinueError(state, "Space Name=" + thisSpaceName + " appears more than once in the list.");
1373 0 : dsoaError = true;
1374 0 : ErrorsFound = true;
1375 : }
1376 : }
1377 : }
1378 : }
1379 : }
1380 :
1381 : // Use the max occupancy data from the PEOPLE structure to calculate design min OA for each zone
1382 : // Calculate the zone design minimum outside air flow rate from the 3 Zone Sizing OA inputs and
1383 : // from the specified OA method
1384 4195 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
1385 3789 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
1386 3320 : auto &thisZone = state.dataHeatBal->Zone(CtrlZoneNum);
1387 3320 : auto &finalZoneSizing = state.dataSize->FinalZoneSizing(CtrlZoneNum);
1388 3320 : auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(CtrlZoneNum);
1389 : // Use the max occupancy PEOPLE structure to calculate design min OA for each zone from the outside air flow per person input
1390 3320 : TotPeopleInZone = 0.0;
1391 3320 : Real64 ZoneMinOccupancy = 0.;
1392 3320 : int DSOAPtr = finalZoneSizing.ZoneDesignSpecOAIndex; // index to DesignSpecification:OutdoorAir object
1393 3320 : if ((DSOAPtr > 0) && !dsoaError) {
1394 3302 : auto &thisOAReq = state.dataSize->OARequirements(DSOAPtr);
1395 : // If this is a DesignSpecification:OutdoorAir:SpaceList check to make sure spaces are valid and belong to this zone
1396 3302 : if (thisOAReq.numDSOA > 0) {
1397 3 : for (int spaceCounter = 1; spaceCounter <= thisOAReq.numDSOA; ++spaceCounter) {
1398 4 : std::string thisSpaceName = thisOAReq.dsoaSpaceNames(spaceCounter);
1399 2 : int thisSpaceNum = thisOAReq.dsoaSpaceIndexes(spaceCounter);
1400 2 : if (thisSpaceNum > 0) {
1401 2 : if (state.dataHeatBal->space(thisSpaceNum).zoneNum != CtrlZoneNum) {
1402 0 : ShowSevereError(state, format("SetUpZoneSizingArrays: DesignSpecification:OutdoorAir:SpaceList={}", thisOAReq.Name));
1403 0 : ShowContinueError(state, format("is invalid for Sizing:Zone={}", finalZoneSizing.ZoneName));
1404 0 : ShowContinueError(state, "All spaces in the list must be part of this zone.");
1405 0 : ErrorsFound = true;
1406 : }
1407 : }
1408 : }
1409 : }
1410 :
1411 3302 : finalZoneSizing.DesOAFlowPPer = thisOAReq.desFlowPerZonePerson(state, CtrlZoneNum);
1412 3302 : finalZoneSizing.DesOAFlowPerArea = thisOAReq.desFlowPerZoneArea(state, CtrlZoneNum);
1413 : }
1414 :
1415 93247 : for (PeopleNum = 1; PeopleNum <= state.dataHeatBal->TotPeople; ++PeopleNum) {
1416 89927 : if (state.dataHeatBal->People(PeopleNum).ZonePtr == CtrlZoneNum) {
1417 3116 : auto &people = state.dataHeatBal->People(PeopleNum);
1418 3116 : TotPeopleInZone += (people.NumberOfPeople * thisZone.Multiplier * thisZone.ListMultiplier);
1419 3116 : SchMax = ScheduleManager::GetScheduleMaxValue(state, people.NumberOfPeoplePtr);
1420 3116 : if (SchMax > 0) {
1421 3088 : finalZoneSizing.ZonePeakOccupancy = TotPeopleInZone * SchMax;
1422 : } else {
1423 28 : finalZoneSizing.ZonePeakOccupancy = TotPeopleInZone;
1424 : }
1425 3116 : ZoneMinOccupancy += TotPeopleInZone * ScheduleManager::GetScheduleMinValue(state, people.NumberOfPeoplePtr);
1426 : }
1427 : }
1428 3320 : finalZoneSizing.TotalZoneFloorArea = (thisZone.FloorArea * thisZone.Multiplier * thisZone.ListMultiplier);
1429 3320 : OAFromPeople = finalZoneSizing.DesOAFlowPPer * TotPeopleInZone;
1430 3320 : OAFromArea = finalZoneSizing.DesOAFlowPerArea * finalZoneSizing.TotalZoneFloorArea;
1431 3320 : finalZoneSizing.TotPeopleInZone = TotPeopleInZone;
1432 3320 : finalZoneSizing.TotalOAFromPeople = OAFromPeople;
1433 3320 : finalZoneSizing.TotalOAFromArea = OAFromArea;
1434 :
1435 : // save Voz for predefined outdoor air summary report
1436 3320 : Real64 MinEz = std::min(finalZoneSizing.ZoneADEffCooling, finalZoneSizing.ZoneADEffHeating);
1437 3320 : if (MinEz == 0) {
1438 0 : MinEz = 1.0; // if not calculated assume 1.0 ventilation effectiveness
1439 : }
1440 3320 : state.dataHeatBal->ZonePreDefRep(CtrlZoneNum).VozMin = (ZoneMinOccupancy * finalZoneSizing.DesOAFlowPPer + OAFromArea) / MinEz;
1441 :
1442 : // Calculate the design min OA flow rate for this zone
1443 3320 : UseOccSchFlag = false;
1444 3320 : UseMinOASchFlag = false;
1445 3320 : state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneDesignSpecOAIndex = DSOAPtr; // store for later use
1446 3320 : state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneAirDistributionIndex = finalZoneSizing.ZoneAirDistributionIndex; // store for later use
1447 3320 : if (!dsoaError) {
1448 3320 : OAVolumeFlowRate = DataSizing::calcDesignSpecificationOutdoorAir(state, DSOAPtr, CtrlZoneNum, UseOccSchFlag, UseMinOASchFlag);
1449 : } else {
1450 0 : OAVolumeFlowRate = 0.0;
1451 : }
1452 :
1453 : // Zone(ZoneIndex)%Multiplier and Zone(ZoneIndex)%ListMultiplier applied in CalcDesignSpecificationOutdoorAir
1454 3320 : finalZoneSizing.MinOA = OAVolumeFlowRate;
1455 3320 : calcFinalZoneSizing.MinOA = OAVolumeFlowRate;
1456 3320 : if (finalZoneSizing.ZoneADEffCooling > 0.0 || finalZoneSizing.ZoneADEffHeating > 0.0) {
1457 3320 : finalZoneSizing.MinOA /= min(finalZoneSizing.ZoneADEffCooling, finalZoneSizing.ZoneADEffHeating);
1458 3320 : calcFinalZoneSizing.MinOA = finalZoneSizing.MinOA;
1459 : }
1460 : // calculated zone design flow rates automatically take into account zone multipliers, since the zone
1461 : // loads are multiplied (in ZoneTempPredictorCorrector.cc). Flow rates derived directly from
1462 : // user inputs need to be explicitly multiplied by the zone multipliers.
1463 3320 : finalZoneSizing.DesCoolMinAirFlow2 =
1464 3320 : finalZoneSizing.DesCoolMinAirFlowPerArea * thisZone.FloorArea * thisZone.Multiplier * thisZone.ListMultiplier;
1465 3320 : calcFinalZoneSizing.DesCoolMinAirFlow2 =
1466 3320 : calcFinalZoneSizing.DesCoolMinAirFlowPerArea * thisZone.FloorArea * thisZone.Multiplier * thisZone.ListMultiplier;
1467 3320 : finalZoneSizing.DesHeatMaxAirFlow2 =
1468 3320 : finalZoneSizing.DesHeatMaxAirFlowPerArea * thisZone.FloorArea * thisZone.Multiplier * thisZone.ListMultiplier;
1469 3320 : calcFinalZoneSizing.DesHeatMaxAirFlow2 =
1470 3320 : calcFinalZoneSizing.DesHeatMaxAirFlowPerArea * thisZone.FloorArea * thisZone.Multiplier * thisZone.ListMultiplier;
1471 3320 : int zoneMultiplier = thisZone.Multiplier * thisZone.ListMultiplier;
1472 3320 : finalZoneSizing.DesCoolMinAirFlow *= zoneMultiplier;
1473 3320 : calcFinalZoneSizing.DesCoolMinAirFlow *= zoneMultiplier;
1474 3320 : finalZoneSizing.DesHeatMaxAirFlow *= zoneMultiplier;
1475 3320 : calcFinalZoneSizing.DesHeatMaxAirFlow *= zoneMultiplier;
1476 3320 : finalZoneSizing.InpDesCoolAirFlow *= zoneMultiplier;
1477 3320 : calcFinalZoneSizing.InpDesCoolAirFlow *= zoneMultiplier;
1478 3320 : finalZoneSizing.InpDesHeatAirFlow *= zoneMultiplier;
1479 3320 : calcFinalZoneSizing.InpDesHeatAirFlow *= zoneMultiplier;
1480 :
1481 10477 : for (DesDayNum = 1; DesDayNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++DesDayNum) {
1482 7157 : auto &zoneSizing = state.dataSize->ZoneSizing(DesDayNum, CtrlZoneNum);
1483 7157 : zoneSizing.MinOA = finalZoneSizing.MinOA;
1484 7157 : state.dataSize->CalcZoneSizing(DesDayNum, CtrlZoneNum).MinOA = calcFinalZoneSizing.MinOA;
1485 7157 : zoneSizing.DesCoolMinAirFlow2 = finalZoneSizing.DesCoolMinAirFlow2;
1486 7157 : state.dataSize->CalcZoneSizing(DesDayNum, CtrlZoneNum).DesCoolMinAirFlow2 = calcFinalZoneSizing.DesCoolMinAirFlow2;
1487 7157 : zoneSizing.DesCoolMinAirFlow = finalZoneSizing.DesCoolMinAirFlow;
1488 7157 : state.dataSize->CalcZoneSizing(DesDayNum, CtrlZoneNum).DesCoolMinAirFlow = calcFinalZoneSizing.DesCoolMinAirFlow;
1489 7157 : zoneSizing.DesHeatMaxAirFlow2 = finalZoneSizing.DesHeatMaxAirFlow2;
1490 7157 : state.dataSize->CalcZoneSizing(DesDayNum, CtrlZoneNum).DesHeatMaxAirFlow2 = calcFinalZoneSizing.DesHeatMaxAirFlow2;
1491 7157 : zoneSizing.DesHeatMaxAirFlow = finalZoneSizing.DesHeatMaxAirFlow;
1492 7157 : state.dataSize->CalcZoneSizing(DesDayNum, CtrlZoneNum).DesHeatMaxAirFlow = calcFinalZoneSizing.DesHeatMaxAirFlow;
1493 : }
1494 : }
1495 : // Formats
1496 406 : print(state.files.eio, "! <Load Timesteps in Zone Design Calculation Averaging Window>, Value\n");
1497 : static constexpr std::string_view Format_891(" Load Timesteps in Zone Design Calculation Averaging Window, {:4}\n");
1498 406 : print(state.files.eio, Format_891, state.dataSize->NumTimeStepsInAvg);
1499 406 : print(state.files.eio, "! <Heating Sizing Factor Information>, Sizing Factor ID, Value\n");
1500 : static constexpr std::string_view Format_991(" Heating Sizing Factor Information, Global, {:12.5N}\n");
1501 406 : print(state.files.eio, Format_991, state.dataSize->GlobalHeatSizingFactor);
1502 4195 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
1503 3789 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
1504 3320 : if (state.dataSize->FinalZoneSizing(CtrlZoneNum).HeatSizingFactor != 1.0) {
1505 : static constexpr std::string_view Format_992(" Heating Sizing Factor Information, Zone {}, {:12.5N}\n");
1506 4542 : print(state.files.eio,
1507 : Format_992,
1508 2271 : state.dataSize->FinalZoneSizing(CtrlZoneNum).ZoneName,
1509 2271 : state.dataSize->FinalZoneSizing(CtrlZoneNum).HeatSizingFactor);
1510 : }
1511 : }
1512 406 : print(state.files.eio, "! <Cooling Sizing Factor Information>, Sizing Factor ID, Value\n");
1513 : static constexpr std::string_view Format_994(" Cooling Sizing Factor Information, Global, {:12.5N}\n");
1514 406 : print(state.files.eio, Format_994, state.dataSize->GlobalCoolSizingFactor);
1515 4195 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
1516 3789 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
1517 3320 : if (state.dataSize->FinalZoneSizing(CtrlZoneNum).CoolSizingFactor != 1.0) {
1518 : static constexpr std::string_view Format_995(" Cooling Sizing Factor Information, Zone {}, {:12.5N}\n");
1519 4526 : print(state.files.eio,
1520 : Format_995,
1521 2263 : state.dataSize->FinalZoneSizing(CtrlZoneNum).ZoneName,
1522 2263 : state.dataSize->FinalZoneSizing(CtrlZoneNum).CoolSizingFactor);
1523 : }
1524 : }
1525 406 : if (ErrorsFound) {
1526 0 : ShowFatalError(state, "SetUpZoneSizingArrays: Errors found in Sizing:Zone input");
1527 : }
1528 406 : }
1529 :
1530 23 : void RezeroZoneSizingArrays(EnergyPlusData &state)
1531 : {
1532 : // Zero zone sizing arrays between the pulse and normal sizing.
1533 23 : DisplayString(state, "Re-zeroing zone sizing arrays");
1534 :
1535 161 : for (int ctrlZoneNum = 1; ctrlZoneNum <= state.dataGlobal->NumOfZones; ++ctrlZoneNum) {
1536 414 : for (int desDayNum = 1; desDayNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++desDayNum) {
1537 276 : state.dataSize->ZoneSizing(desDayNum, ctrlZoneNum).zeroMemberData();
1538 276 : state.dataSize->CalcZoneSizing(desDayNum, ctrlZoneNum).zeroMemberData();
1539 : }
1540 138 : state.dataSize->CalcFinalZoneSizing(ctrlZoneNum).zeroMemberData();
1541 138 : state.dataSize->FinalZoneSizing(ctrlZoneNum).zeroMemberData();
1542 : }
1543 23 : }
1544 :
1545 134847 : void UpdateZoneSizing(EnergyPlusData &state, DataGlobalConstants::CallIndicator const CallIndicator)
1546 : {
1547 :
1548 : // SUBROUTINE INFORMATION:
1549 : // AUTHOR Fred Buhl
1550 : // DATE WRITTEN December 2000
1551 :
1552 : // PURPOSE OF THIS SUBROUTINE:
1553 : // Update the result variables of the zone sizing calculation
1554 :
1555 : // METHODOLOGY EMPLOYED:
1556 : // CallIndicator = 1 (BeginDay) zero the result arrays
1557 : // CallIndicator = 2 (DuringDay) fill arrays, averaging over 1 zone time step
1558 : // CallIndicator = 3 (EndDay) calculate daily maxima
1559 : // CallIndicator = 4 (EndZoneSizingCalc) write out results
1560 :
1561 : // SUBROUTINE PARAMETER DEFINITIONS:
1562 :
1563 : static constexpr std::string_view RoutineName("UpdateZoneSizing");
1564 :
1565 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
1566 : int DesDayNum; // design day index
1567 : int TimeStepIndex; // zone time step index
1568 : int TimeStepInDay; // zone time step in day
1569 : int I; // write statement index
1570 : int HourCounter; // Hour Counter
1571 : int TimeStepCounter; // Time Step Counter
1572 : int Minutes; // Current Minutes Counter
1573 : int HourPrint; // Hour to print (timestamp)
1574 : Real64 OAFrac; // outside air fraction
1575 : int TimeStepAtPeak; // time step number at heat or cool peak
1576 : int TimeStepAtPeakF; // time step number at heat or cool peak (final)
1577 : int DDNum; // Design Day index
1578 : int DDNumF; // Design Day index (final)
1579 : Real64 TotCoolSizMult; // combines user cooling design flow input with zone sizing multiplier
1580 : Real64 TotHeatSizMult; // combines user heating design flow input with zone sizing multiplier
1581 : Real64 MinOAMass; // zone minimum outside air mass flow rate kg/s
1582 : Real64 MaxHeatVolFlow; // max of user specified design heating max flow [m3/s]
1583 : Real64 SupplyTemp; // supply air temperature [C]
1584 : Real64 DeltaTemp; // supply air delta temperature [deltaC]
1585 :
1586 134847 : switch (CallIndicator) {
1587 917 : case DataGlobalConstants::CallIndicator::BeginDay: {
1588 9280 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
1589 :
1590 8363 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
1591 7377 : auto &calcZoneSizing = state.dataSize->CalcZoneSizing(state.dataSize->CurOverallSimDay, CtrlZoneNum);
1592 :
1593 7377 : calcZoneSizing.CoolDesDay = state.dataEnvrn->EnvironmentName;
1594 7377 : calcZoneSizing.HeatDesDay = state.dataEnvrn->EnvironmentName;
1595 7377 : calcZoneSizing.DesHeatDens = state.dataEnvrn->StdRhoAir;
1596 7377 : calcZoneSizing.DesCoolDens = state.dataEnvrn->StdRhoAir;
1597 7377 : calcZoneSizing.HeatDDNum = state.dataSize->CurOverallSimDay;
1598 7377 : calcZoneSizing.CoolDDNum = state.dataSize->CurOverallSimDay;
1599 7377 : calcZoneSizing.CoolNoDOASDesDay = state.dataEnvrn->EnvironmentName;
1600 7377 : calcZoneSizing.HeatNoDOASDesDay = state.dataEnvrn->EnvironmentName;
1601 7377 : calcZoneSizing.LatCoolDesDay = state.dataEnvrn->EnvironmentName;
1602 7377 : calcZoneSizing.LatHeatDesDay = state.dataEnvrn->EnvironmentName;
1603 7377 : calcZoneSizing.LatCoolNoDOASDesDay = state.dataEnvrn->EnvironmentName;
1604 7377 : calcZoneSizing.LatHeatNoDOASDesDay = state.dataEnvrn->EnvironmentName;
1605 7377 : calcZoneSizing.CoolNoDOASDDNum = state.dataSize->CurOverallSimDay;
1606 7377 : calcZoneSizing.HeatNoDOASDDNum = state.dataSize->CurOverallSimDay;
1607 7377 : calcZoneSizing.LatentCoolDDNum = state.dataSize->CurOverallSimDay;
1608 7377 : calcZoneSizing.LatentHeatDDNum = state.dataSize->CurOverallSimDay;
1609 7377 : calcZoneSizing.LatentCoolNoDOASDDNum = state.dataSize->CurOverallSimDay;
1610 7377 : calcZoneSizing.LatentHeatNoDOASDDNum = state.dataSize->CurOverallSimDay;
1611 7377 : calcZoneSizing.CoolSizingType = "Cooling"; // string reported to eio
1612 7377 : calcZoneSizing.HeatSizingType = "Heating"; // string reported to eio
1613 917 : }
1614 917 : } break;
1615 131701 : case DataGlobalConstants::CallIndicator::DuringDay: {
1616 131701 : TimeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep;
1617 :
1618 131701 : Real64 FracTimeStepZone = state.dataHVACGlobal->FracTimeStepZone;
1619 : // save the results of the ideal zone component calculation in the CalcZoneSizing sequence variables
1620 1342340 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
1621 1210639 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
1622 :
1623 1066192 : auto &zoneSizing = state.dataSize->ZoneSizing(state.dataSize->CurOverallSimDay, CtrlZoneNum);
1624 1066192 : auto &calcZoneSizing = state.dataSize->CalcZoneSizing(state.dataSize->CurOverallSimDay, CtrlZoneNum);
1625 1066192 : auto &zoneThermostatHi = state.dataHeatBalFanSys->ZoneThermostatSetPointHi(CtrlZoneNum);
1626 1066192 : auto &zoneThermostatLo = state.dataHeatBalFanSys->ZoneThermostatSetPointLo(CtrlZoneNum);
1627 1066192 : if (zoneThermostatHi > 0.0 && zoneThermostatHi > state.dataSize->ZoneSizThermSetPtHi(CtrlZoneNum)) {
1628 3501 : state.dataSize->ZoneSizThermSetPtHi(CtrlZoneNum) = zoneThermostatHi;
1629 : }
1630 1066192 : if (zoneThermostatLo > 0.0 && zoneThermostatLo < state.dataSize->ZoneSizThermSetPtLo(CtrlZoneNum)) {
1631 4667 : state.dataSize->ZoneSizThermSetPtLo(CtrlZoneNum) = zoneThermostatLo;
1632 : }
1633 1066192 : zoneSizing.DesHeatSetPtSeq(TimeStepInDay) = zoneThermostatLo;
1634 1066192 : zoneSizing.HeatTstatTempSeq(TimeStepInDay) = calcZoneSizing.HeatTstatTemp;
1635 1066192 : zoneSizing.DesCoolSetPtSeq(TimeStepInDay) = zoneThermostatHi;
1636 1066192 : zoneSizing.CoolTstatTempSeq(TimeStepInDay) = calcZoneSizing.CoolTstatTemp;
1637 1066192 : calcZoneSizing.HeatFlowSeq(TimeStepInDay) += calcZoneSizing.HeatMassFlow * FracTimeStepZone;
1638 1066192 : calcZoneSizing.HeatLoadSeq(TimeStepInDay) += calcZoneSizing.HeatLoad * FracTimeStepZone;
1639 1066192 : calcZoneSizing.HeatZoneTempSeq(TimeStepInDay) += calcZoneSizing.HeatZoneTemp * FracTimeStepZone;
1640 1066192 : calcZoneSizing.HeatOutTempSeq(TimeStepInDay) += calcZoneSizing.HeatOutTemp * FracTimeStepZone;
1641 1066192 : calcZoneSizing.HeatZoneRetTempSeq(TimeStepInDay) += calcZoneSizing.HeatZoneRetTemp * FracTimeStepZone;
1642 1066192 : calcZoneSizing.HeatZoneHumRatSeq(TimeStepInDay) += calcZoneSizing.HeatZoneHumRat * FracTimeStepZone;
1643 1066192 : calcZoneSizing.HeatOutHumRatSeq(TimeStepInDay) += calcZoneSizing.HeatOutHumRat * FracTimeStepZone;
1644 1066192 : calcZoneSizing.CoolFlowSeq(TimeStepInDay) += calcZoneSizing.CoolMassFlow * FracTimeStepZone;
1645 1066192 : calcZoneSizing.CoolLoadSeq(TimeStepInDay) += calcZoneSizing.CoolLoad * FracTimeStepZone;
1646 1066192 : calcZoneSizing.CoolZoneTempSeq(TimeStepInDay) += calcZoneSizing.CoolZoneTemp * FracTimeStepZone;
1647 1066192 : calcZoneSizing.CoolOutTempSeq(TimeStepInDay) += calcZoneSizing.CoolOutTemp * FracTimeStepZone;
1648 1066192 : calcZoneSizing.CoolZoneRetTempSeq(TimeStepInDay) += calcZoneSizing.CoolZoneRetTemp * FracTimeStepZone;
1649 1066192 : calcZoneSizing.CoolZoneHumRatSeq(TimeStepInDay) += calcZoneSizing.CoolZoneHumRat * FracTimeStepZone;
1650 1066192 : calcZoneSizing.CoolOutHumRatSeq(TimeStepInDay) += calcZoneSizing.CoolOutHumRat * FracTimeStepZone;
1651 1066192 : calcZoneSizing.DOASHeatLoadSeq(TimeStepInDay) += calcZoneSizing.DOASHeatLoad * FracTimeStepZone;
1652 1066192 : calcZoneSizing.DOASCoolLoadSeq(TimeStepInDay) += calcZoneSizing.DOASCoolLoad * FracTimeStepZone;
1653 1066192 : calcZoneSizing.DOASHeatAddSeq(TimeStepInDay) += calcZoneSizing.DOASHeatAdd * FracTimeStepZone;
1654 1066192 : calcZoneSizing.DOASLatAddSeq(TimeStepInDay) += calcZoneSizing.DOASLatAdd * FracTimeStepZone;
1655 1066192 : calcZoneSizing.DOASSupMassFlowSeq(TimeStepInDay) += calcZoneSizing.DOASSupMassFlow * FracTimeStepZone;
1656 1066192 : calcZoneSizing.DOASSupTempSeq(TimeStepInDay) += calcZoneSizing.DOASSupTemp * FracTimeStepZone;
1657 1066192 : calcZoneSizing.DOASSupHumRatSeq(TimeStepInDay) += calcZoneSizing.DOASSupHumRat * FracTimeStepZone;
1658 1066192 : calcZoneSizing.DOASTotCoolLoadSeq(TimeStepInDay) += calcZoneSizing.DOASTotCoolLoad * FracTimeStepZone;
1659 1066192 : if (calcZoneSizing.zoneLatentSizing) {
1660 2716 : calcZoneSizing.LatentHeatLoadSeq(TimeStepInDay) += calcZoneSizing.HeatLatentLoad * FracTimeStepZone;
1661 2716 : calcZoneSizing.LatentHeatFlowSeq(TimeStepInDay) += calcZoneSizing.ZoneHeatLatentMassFlow * FracTimeStepZone;
1662 2716 : calcZoneSizing.LatentCoolLoadSeq(TimeStepInDay) += calcZoneSizing.CoolLatentLoad * FracTimeStepZone;
1663 2716 : calcZoneSizing.LatentCoolFlowSeq(TimeStepInDay) += calcZoneSizing.ZoneCoolLatentMassFlow * FracTimeStepZone;
1664 2716 : calcZoneSizing.CoolLatentLoadNoDOASSeq(TimeStepInDay) += calcZoneSizing.CoolLatentLoadNoDOAS * FracTimeStepZone;
1665 2716 : calcZoneSizing.HeatLatentLoadNoDOASSeq(TimeStepInDay) += calcZoneSizing.HeatLatentLoadNoDOAS * FracTimeStepZone;
1666 2716 : calcZoneSizing.CoolLoadNoDOASSeq(TimeStepInDay) += calcZoneSizing.CoolLoadNoDOAS * FracTimeStepZone;
1667 2716 : calcZoneSizing.HeatLoadNoDOASSeq(TimeStepInDay) += calcZoneSizing.HeatLoadNoDOAS * FracTimeStepZone;
1668 : }
1669 131701 : }
1670 131701 : } break;
1671 1801 : case DataGlobalConstants::CallIndicator::EndDay: {
1672 : // average some of the zone sequences to reduce peakiness
1673 18386 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
1674 16585 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
1675 14613 : auto &calcZoneSizing(state.dataSize->CalcZoneSizing(state.dataSize->CurOverallSimDay, CtrlZoneNum));
1676 14613 : General::MovingAvg(calcZoneSizing.CoolFlowSeq, state.dataSize->NumTimeStepsInAvg);
1677 14613 : General::MovingAvg(calcZoneSizing.CoolLoadSeq, state.dataSize->NumTimeStepsInAvg);
1678 14613 : General::MovingAvg(calcZoneSizing.HeatFlowSeq, state.dataSize->NumTimeStepsInAvg);
1679 14613 : General::MovingAvg(calcZoneSizing.HeatLoadSeq, state.dataSize->NumTimeStepsInAvg);
1680 14613 : General::MovingAvg(calcZoneSizing.CoolZoneRetTempSeq, state.dataSize->NumTimeStepsInAvg);
1681 14613 : General::MovingAvg(calcZoneSizing.HeatZoneRetTempSeq, state.dataSize->NumTimeStepsInAvg);
1682 14613 : General::MovingAvg(calcZoneSizing.DOASHeatAddSeq, state.dataSize->NumTimeStepsInAvg);
1683 14613 : General::MovingAvg(calcZoneSizing.DOASLatAddSeq, state.dataSize->NumTimeStepsInAvg);
1684 14613 : General::MovingAvg(calcZoneSizing.CoolLatentLoadNoDOASSeq, state.dataSize->NumTimeStepsInAvg);
1685 14613 : General::MovingAvg(calcZoneSizing.HeatLatentLoadNoDOASSeq, state.dataSize->NumTimeStepsInAvg);
1686 14613 : General::MovingAvg(calcZoneSizing.CoolLoadNoDOASSeq, state.dataSize->NumTimeStepsInAvg);
1687 14613 : General::MovingAvg(calcZoneSizing.HeatLoadNoDOASSeq, state.dataSize->NumTimeStepsInAvg);
1688 :
1689 14613 : if (calcZoneSizing.zoneLatentSizing) {
1690 52 : General::MovingAvg(calcZoneSizing.LatentHeatLoadSeq, state.dataSize->NumTimeStepsInAvg);
1691 52 : General::MovingAvg(calcZoneSizing.LatentHeatFlowSeq, state.dataSize->NumTimeStepsInAvg);
1692 52 : General::MovingAvg(calcZoneSizing.LatentCoolLoadSeq, state.dataSize->NumTimeStepsInAvg);
1693 52 : General::MovingAvg(calcZoneSizing.LatentCoolFlowSeq, state.dataSize->NumTimeStepsInAvg);
1694 : }
1695 : }
1696 :
1697 1801 : auto &desDayWeath = state.dataSize->DesDayWeath(state.dataSize->CurOverallSimDay);
1698 18386 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
1699 16585 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
1700 14613 : auto &calcZoneSizing = state.dataSize->CalcZoneSizing(state.dataSize->CurOverallSimDay, CtrlZoneNum);
1701 14613 : auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(CtrlZoneNum);
1702 14613 : calcFinalZoneSizing.CoolSizingType = calcZoneSizing.CoolSizingType;
1703 14613 : calcFinalZoneSizing.HeatSizingType = calcZoneSizing.HeatSizingType;
1704 :
1705 : // save the sequence values at the heating peak
1706 1822629 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
1707 1808016 : if (calcZoneSizing.HeatLoadSeq(TimeStepIndex) > calcZoneSizing.DesHeatLoad) {
1708 129485 : calcZoneSizing.DesHeatLoad = calcZoneSizing.HeatLoadSeq(TimeStepIndex);
1709 129485 : calcZoneSizing.DesHeatMassFlow = calcZoneSizing.HeatFlowSeq(TimeStepIndex);
1710 129485 : calcZoneSizing.ZoneTempAtHeatPeak = calcZoneSizing.HeatZoneTempSeq(TimeStepIndex);
1711 129485 : calcZoneSizing.OutTempAtHeatPeak = calcZoneSizing.HeatOutTempSeq(TimeStepIndex);
1712 129485 : calcZoneSizing.ZoneRetTempAtHeatPeak = calcZoneSizing.HeatZoneRetTempSeq(TimeStepIndex);
1713 129485 : calcZoneSizing.ZoneHumRatAtHeatPeak = calcZoneSizing.HeatZoneHumRatSeq(TimeStepIndex);
1714 129485 : calcZoneSizing.OutHumRatAtHeatPeak = calcZoneSizing.HeatOutHumRatSeq(TimeStepIndex);
1715 129485 : calcZoneSizing.TimeStepNumAtHeatMax = TimeStepIndex;
1716 : }
1717 : }
1718 : // save the sequence values at the latent heating peak
1719 14613 : if (calcZoneSizing.zoneLatentSizing) {
1720 5044 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
1721 4992 : if (calcZoneSizing.LatentHeatLoadSeq(TimeStepIndex) > calcZoneSizing.DesLatentHeatLoad) {
1722 68 : calcZoneSizing.DesLatentHeatLoad = calcZoneSizing.LatentHeatLoadSeq(TimeStepIndex);
1723 68 : calcZoneSizing.DesLatentHeatMassFlow = calcZoneSizing.LatentHeatFlowSeq(TimeStepIndex);
1724 68 : calcZoneSizing.ZoneHeatLatentMassFlow = calcZoneSizing.LatentHeatFlowSeq(TimeStepIndex);
1725 68 : calcZoneSizing.ZoneTempAtLatentHeatPeak = calcZoneSizing.HeatZoneTempSeq(TimeStepIndex);
1726 68 : calcZoneSizing.OutTempAtLatentHeatPeak = calcZoneSizing.HeatOutTempSeq(TimeStepIndex);
1727 68 : calcZoneSizing.ZoneHumRatAtLatentHeatPeak = calcZoneSizing.HeatZoneHumRatSeq(TimeStepIndex);
1728 68 : calcZoneSizing.OutHumRatAtLatentHeatPeak = calcZoneSizing.HeatOutHumRatSeq(TimeStepIndex);
1729 68 : calcZoneSizing.ZoneRetTempAtLatentHeatPeak = calcZoneSizing.HeatZoneRetTempSeq(TimeStepIndex);
1730 68 : calcZoneSizing.TimeStepNumAtLatentHeatMax = TimeStepIndex;
1731 : }
1732 : }
1733 : }
1734 1822629 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
1735 : // select largest load from NoDOAS arrays
1736 1808016 : if (calcZoneSizing.HeatLoadNoDOASSeq(TimeStepIndex) > calcZoneSizing.DesHeatLoadNoDOAS) {
1737 557 : calcZoneSizing.DesHeatLoadNoDOAS = calcZoneSizing.HeatLoadNoDOASSeq(TimeStepIndex);
1738 557 : calcZoneSizing.TimeStepNumAtHeatNoDOASMax = TimeStepIndex;
1739 : }
1740 1808016 : if (calcZoneSizing.HeatLatentLoadNoDOASSeq(TimeStepIndex) > calcZoneSizing.DesLatentHeatLoadNoDOAS) {
1741 68 : calcZoneSizing.DesLatentHeatLoadNoDOAS = calcZoneSizing.HeatLatentLoadNoDOASSeq(TimeStepIndex);
1742 68 : calcZoneSizing.TimeStepNumAtLatentHeatNoDOASMax = TimeStepIndex;
1743 : }
1744 1808016 : if (calcZoneSizing.CoolLoadNoDOASSeq(TimeStepIndex) > calcZoneSizing.DesCoolLoadNoDOAS) {
1745 323 : calcZoneSizing.DesCoolLoadNoDOAS = calcZoneSizing.CoolLoadNoDOASSeq(TimeStepIndex);
1746 323 : calcZoneSizing.TimeStepNumAtCoolNoDOASMax = TimeStepIndex;
1747 : }
1748 1808016 : if (calcZoneSizing.CoolLatentLoadNoDOASSeq(TimeStepIndex) > calcZoneSizing.DesLatentCoolLoadNoDOAS) {
1749 283 : calcZoneSizing.DesLatentCoolLoadNoDOAS = calcZoneSizing.CoolLatentLoadNoDOASSeq(TimeStepIndex);
1750 283 : calcZoneSizing.TimeStepNumAtLatentCoolNoDOASMax = TimeStepIndex;
1751 : }
1752 : }
1753 14613 : if (calcZoneSizing.DesHeatMassFlow > 0.0) {
1754 3422 : calcZoneSizing.DesHeatVolFlow = calcZoneSizing.DesHeatMassFlow / calcZoneSizing.DesHeatDens;
1755 3422 : OAFrac = calcZoneSizing.MinOA / max(calcZoneSizing.DesHeatVolFlow, DataHVACGlobals::SmallMassFlow);
1756 3422 : OAFrac = min(1.0, max(0.0, OAFrac));
1757 3422 : TimeStepAtPeak = calcZoneSizing.TimeStepNumAtHeatMax;
1758 3422 : calcZoneSizing.DesHeatCoilInTemp = OAFrac * desDayWeath.Temp(TimeStepAtPeak) + (1.0 - OAFrac) * calcZoneSizing.ZoneTempAtHeatPeak;
1759 3422 : calcZoneSizing.DesHeatCoilInHumRat =
1760 3422 : OAFrac * desDayWeath.HumRat(TimeStepAtPeak) + (1.0 - OAFrac) * calcZoneSizing.ZoneHumRatAtHeatPeak;
1761 : }
1762 14613 : if (calcZoneSizing.zoneLatentSizing && calcZoneSizing.DesLatentHeatMassFlow > 0.0) {
1763 16 : calcZoneSizing.DesLatentHeatVolFlow = calcZoneSizing.DesLatentHeatMassFlow / state.dataEnvrn->StdRhoAir;
1764 16 : OAFrac = calcZoneSizing.MinOA / max(calcZoneSizing.DesHeatVolFlow, DataHVACGlobals::SmallMassFlow);
1765 16 : OAFrac = min(1.0, max(0.0, OAFrac));
1766 16 : TimeStepAtPeak = calcZoneSizing.TimeStepNumAtLatentHeatMax;
1767 16 : calcZoneSizing.DesLatentHeatCoilInTemp =
1768 16 : OAFrac * desDayWeath.Temp(TimeStepAtPeak) + (1.0 - OAFrac) * calcZoneSizing.ZoneTempAtHeatPeak;
1769 16 : calcZoneSizing.DesLatentHeatCoilInHumRat =
1770 16 : OAFrac * desDayWeath.HumRat(TimeStepAtPeak) + (1.0 - OAFrac) * calcZoneSizing.ZoneHumRatAtHeatPeak;
1771 : }
1772 : // save the sequence values at the cooling peak
1773 1822629 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
1774 1808016 : if (calcZoneSizing.CoolLoadSeq(TimeStepIndex) > calcZoneSizing.DesCoolLoad) {
1775 138332 : calcZoneSizing.DesCoolLoad = calcZoneSizing.CoolLoadSeq(TimeStepIndex);
1776 138332 : calcZoneSizing.DesCoolMassFlow = calcZoneSizing.CoolFlowSeq(TimeStepIndex);
1777 138332 : calcZoneSizing.ZoneTempAtCoolPeak = calcZoneSizing.CoolZoneTempSeq(TimeStepIndex);
1778 138332 : calcZoneSizing.OutTempAtCoolPeak = calcZoneSizing.CoolOutTempSeq(TimeStepIndex);
1779 138332 : calcZoneSizing.ZoneRetTempAtCoolPeak = calcZoneSizing.CoolZoneRetTempSeq(TimeStepIndex);
1780 138332 : calcZoneSizing.ZoneHumRatAtCoolPeak = calcZoneSizing.CoolZoneHumRatSeq(TimeStepIndex);
1781 138332 : calcZoneSizing.OutHumRatAtCoolPeak = calcZoneSizing.CoolOutHumRatSeq(TimeStepIndex);
1782 138332 : calcZoneSizing.TimeStepNumAtCoolMax = TimeStepIndex;
1783 : }
1784 : }
1785 14613 : if (calcZoneSizing.zoneLatentSizing) {
1786 5044 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
1787 4992 : if (calcZoneSizing.LatentCoolLoadSeq(TimeStepIndex) > calcZoneSizing.DesLatentCoolLoad) {
1788 283 : calcZoneSizing.DesLatentCoolLoad = calcZoneSizing.LatentCoolLoadSeq(TimeStepIndex);
1789 283 : calcZoneSizing.DesLatentCoolMassFlow = calcZoneSizing.LatentCoolFlowSeq(TimeStepIndex);
1790 283 : calcZoneSizing.ZoneTempAtLatentCoolPeak = calcZoneSizing.CoolZoneTempSeq(TimeStepIndex);
1791 283 : calcZoneSizing.OutTempAtLatentCoolPeak = calcZoneSizing.CoolOutTempSeq(TimeStepIndex);
1792 283 : calcZoneSizing.ZoneHumRatAtLatentCoolPeak = calcZoneSizing.CoolZoneHumRatSeq(TimeStepIndex);
1793 283 : calcZoneSizing.OutHumRatAtLatentCoolPeak = calcZoneSizing.CoolOutHumRatSeq(TimeStepIndex);
1794 283 : calcZoneSizing.ZoneRetTempAtLatentCoolPeak = calcZoneSizing.CoolZoneRetTempSeq(TimeStepIndex);
1795 283 : calcZoneSizing.TimeStepNumAtLatentCoolMax = TimeStepIndex;
1796 : }
1797 : }
1798 : }
1799 14613 : if (calcZoneSizing.DesCoolMassFlow > 0.0) {
1800 3981 : calcZoneSizing.DesCoolVolFlow = calcZoneSizing.DesCoolMassFlow / calcZoneSizing.DesCoolDens;
1801 3981 : OAFrac = calcZoneSizing.MinOA / max(calcZoneSizing.DesCoolVolFlow, DataHVACGlobals::SmallMassFlow);
1802 3981 : OAFrac = min(1.0, max(0.0, OAFrac));
1803 3981 : TimeStepAtPeak = calcZoneSizing.TimeStepNumAtCoolMax;
1804 3981 : calcZoneSizing.DesCoolCoilInTemp = OAFrac * desDayWeath.Temp(TimeStepAtPeak) + (1.0 - OAFrac) * calcZoneSizing.ZoneTempAtCoolPeak;
1805 3981 : calcZoneSizing.DesCoolCoilInHumRat =
1806 3981 : OAFrac * desDayWeath.HumRat(TimeStepAtPeak) + (1.0 - OAFrac) * calcZoneSizing.ZoneHumRatAtCoolPeak;
1807 : }
1808 14613 : if (calcZoneSizing.zoneLatentSizing && calcZoneSizing.DesLatentCoolMassFlow > 0.0) {
1809 19 : calcZoneSizing.DesLatentCoolVolFlow = calcZoneSizing.DesLatentCoolMassFlow / state.dataEnvrn->StdRhoAir;
1810 19 : OAFrac = calcZoneSizing.MinOA / max(calcZoneSizing.DesCoolVolFlow, DataHVACGlobals::SmallMassFlow);
1811 19 : OAFrac = min(1.0, max(0.0, OAFrac));
1812 19 : TimeStepAtPeak = calcZoneSizing.TimeStepNumAtLatentCoolMax;
1813 19 : calcZoneSizing.DesLatentCoolCoilInTemp =
1814 19 : OAFrac * desDayWeath.Temp(TimeStepAtPeak) + (1.0 - OAFrac) * calcZoneSizing.ZoneTempAtCoolPeak;
1815 19 : calcZoneSizing.DesLatentCoolCoilInHumRat =
1816 19 : OAFrac * desDayWeath.HumRat(TimeStepAtPeak) + (1.0 - OAFrac) * calcZoneSizing.ZoneHumRatAtCoolPeak;
1817 : }
1818 : // from all the design periods, choose the one needing the most heating and save all its design variables in CalcFinalZoneSizing
1819 14613 : if (calcZoneSizing.DesHeatVolFlow > calcFinalZoneSizing.DesHeatVolFlow) {
1820 3246 : calcFinalZoneSizing.DesHeatVolFlow = calcZoneSizing.DesHeatVolFlow;
1821 3246 : calcFinalZoneSizing.DesHeatLoad = calcZoneSizing.DesHeatLoad;
1822 3246 : calcFinalZoneSizing.DesHeatMassFlow = calcZoneSizing.DesHeatMassFlow;
1823 3246 : calcFinalZoneSizing.HeatDesDay = calcZoneSizing.HeatDesDay;
1824 3246 : calcFinalZoneSizing.DesHeatDens = calcZoneSizing.DesHeatDens;
1825 3246 : calcFinalZoneSizing.HeatFlowSeq = calcZoneSizing.HeatFlowSeq;
1826 3246 : calcFinalZoneSizing.HeatLoadSeq = calcZoneSizing.HeatLoadSeq;
1827 3246 : calcFinalZoneSizing.HeatZoneTempSeq = calcZoneSizing.HeatZoneTempSeq;
1828 3246 : calcFinalZoneSizing.HeatOutTempSeq = calcZoneSizing.HeatOutTempSeq;
1829 3246 : calcFinalZoneSizing.HeatZoneRetTempSeq = calcZoneSizing.HeatZoneRetTempSeq;
1830 3246 : calcFinalZoneSizing.HeatZoneHumRatSeq = calcZoneSizing.HeatZoneHumRatSeq;
1831 3246 : calcFinalZoneSizing.HeatOutHumRatSeq = calcZoneSizing.HeatOutHumRatSeq;
1832 3246 : calcFinalZoneSizing.ZoneTempAtHeatPeak = calcZoneSizing.ZoneTempAtHeatPeak;
1833 3246 : calcFinalZoneSizing.OutTempAtHeatPeak = calcZoneSizing.OutTempAtHeatPeak;
1834 3246 : calcFinalZoneSizing.ZoneRetTempAtHeatPeak = calcZoneSizing.ZoneRetTempAtHeatPeak;
1835 3246 : calcFinalZoneSizing.ZoneHumRatAtHeatPeak = calcZoneSizing.ZoneHumRatAtHeatPeak;
1836 3246 : calcFinalZoneSizing.OutHumRatAtHeatPeak = calcZoneSizing.OutHumRatAtHeatPeak;
1837 3246 : calcFinalZoneSizing.HeatDDNum = calcZoneSizing.HeatDDNum;
1838 3246 : calcFinalZoneSizing.cHeatDDDate = desDayWeath.DateString;
1839 3246 : calcFinalZoneSizing.TimeStepNumAtHeatMax = calcZoneSizing.TimeStepNumAtHeatMax;
1840 3246 : calcFinalZoneSizing.DesHeatCoilInTemp = calcZoneSizing.DesHeatCoilInTemp;
1841 3246 : calcFinalZoneSizing.DesHeatCoilInHumRat = calcZoneSizing.DesHeatCoilInHumRat;
1842 : } else {
1843 11367 : calcFinalZoneSizing.DesHeatDens = state.dataEnvrn->StdRhoAir;
1844 : // save design heating load when the there is design heating load and the design heating volume flow rate is zero, i.e., when
1845 : // design heating volume flow rate is set to zero due to heating supply air temp less than zone thermostat temperature
1846 11367 : if (calcZoneSizing.DesHeatLoad > calcFinalZoneSizing.DesHeatLoad) {
1847 0 : calcFinalZoneSizing.DesHeatLoad = calcZoneSizing.DesHeatLoad;
1848 0 : calcFinalZoneSizing.HeatDesDay = calcZoneSizing.HeatDesDay;
1849 0 : calcFinalZoneSizing.HeatLoadSeq = calcZoneSizing.HeatLoadSeq;
1850 0 : calcFinalZoneSizing.HeatZoneTempSeq = calcZoneSizing.HeatZoneTempSeq;
1851 0 : calcFinalZoneSizing.HeatOutTempSeq = calcZoneSizing.HeatOutTempSeq;
1852 0 : calcFinalZoneSizing.HeatZoneRetTempSeq = calcZoneSizing.HeatZoneRetTempSeq;
1853 0 : calcFinalZoneSizing.HeatZoneHumRatSeq = calcZoneSizing.HeatZoneHumRatSeq;
1854 0 : calcFinalZoneSizing.HeatOutHumRatSeq = calcZoneSizing.HeatOutHumRatSeq;
1855 0 : calcFinalZoneSizing.ZoneTempAtHeatPeak = calcZoneSizing.ZoneTempAtHeatPeak;
1856 0 : calcFinalZoneSizing.OutTempAtHeatPeak = calcZoneSizing.OutTempAtHeatPeak;
1857 0 : calcFinalZoneSizing.ZoneRetTempAtHeatPeak = calcZoneSizing.ZoneRetTempAtHeatPeak;
1858 0 : calcFinalZoneSizing.ZoneHumRatAtHeatPeak = calcZoneSizing.ZoneHumRatAtHeatPeak;
1859 0 : calcFinalZoneSizing.OutHumRatAtHeatPeak = calcZoneSizing.OutHumRatAtHeatPeak;
1860 0 : calcFinalZoneSizing.HeatDDNum = calcZoneSizing.HeatDDNum;
1861 0 : calcFinalZoneSizing.cHeatDDDate = desDayWeath.DateString;
1862 0 : calcFinalZoneSizing.TimeStepNumAtHeatMax = calcZoneSizing.TimeStepNumAtHeatMax;
1863 0 : calcFinalZoneSizing.DesHeatCoilInTemp = calcZoneSizing.DesHeatCoilInTemp;
1864 0 : calcFinalZoneSizing.DesHeatCoilInHumRat = calcZoneSizing.DesHeatCoilInHumRat;
1865 0 : calcFinalZoneSizing.HeatTstatTemp = calcZoneSizing.HeatTstatTemp;
1866 : }
1867 : }
1868 14613 : if (calcZoneSizing.zoneLatentSizing) {
1869 : // from all the design periods, choose the one needing the most latent heating and save all its design variables in
1870 : // CalcFinalZoneSizing
1871 52 : if (calcZoneSizing.DesLatentHeatVolFlow > calcFinalZoneSizing.DesLatentHeatVolFlow) {
1872 14 : calcFinalZoneSizing.DesLatentHeatVolFlow = calcZoneSizing.DesLatentHeatVolFlow;
1873 14 : calcFinalZoneSizing.DesLatentHeatMassFlow = calcZoneSizing.ZoneHeatLatentMassFlow;
1874 14 : calcFinalZoneSizing.DesLatentHeatLoad = calcZoneSizing.DesLatentHeatLoad;
1875 14 : calcFinalZoneSizing.ZoneTempAtLatentHeatPeak = calcZoneSizing.ZoneTempAtLatentHeatPeak;
1876 14 : calcFinalZoneSizing.ZoneHumRatAtLatentHeatPeak = calcZoneSizing.ZoneHumRatAtLatentHeatPeak;
1877 14 : calcFinalZoneSizing.ZoneRetTempAtLatentHeatPeak = calcZoneSizing.ZoneRetTempAtLatentHeatPeak;
1878 14 : calcFinalZoneSizing.DesLatentHeatCoilInTemp = calcZoneSizing.DesLatentHeatCoilInTemp;
1879 14 : calcFinalZoneSizing.DesLatentHeatCoilInHumRat = calcZoneSizing.DesLatentHeatCoilInHumRat;
1880 14 : calcFinalZoneSizing.LatHeatDesDay = calcZoneSizing.LatHeatDesDay;
1881 14 : calcFinalZoneSizing.cLatentHeatDDDate = desDayWeath.DateString;
1882 14 : calcFinalZoneSizing.LatentHeatDDNum = calcZoneSizing.LatentHeatDDNum;
1883 14 : calcFinalZoneSizing.TimeStepNumAtLatentHeatMax = calcZoneSizing.TimeStepNumAtLatentHeatMax;
1884 14 : calcFinalZoneSizing.LatentHeatLoadSeq = calcZoneSizing.LatentHeatLoadSeq;
1885 14 : calcFinalZoneSizing.LatentHeatFlowSeq = calcZoneSizing.LatentHeatFlowSeq;
1886 : } else {
1887 : // save design latent heating load when the there is design load and the design volume flow rate is zero, i.e., when
1888 : // design latent heating volume flow rate is set to zero due to heating supply air humrat is less than zone humidistat humrat
1889 38 : if (calcZoneSizing.DesLatentHeatLoad > calcFinalZoneSizing.DesLatentHeatLoad) {
1890 0 : calcFinalZoneSizing.DesLatentHeatLoad = calcZoneSizing.DesLatentHeatLoad;
1891 0 : calcFinalZoneSizing.cLatentHeatDDDate = desDayWeath.DateString;
1892 0 : calcFinalZoneSizing.LatentHeatDDNum = calcZoneSizing.LatentHeatDDNum;
1893 0 : calcFinalZoneSizing.TimeStepNumAtLatentHeatMax = calcZoneSizing.TimeStepNumAtLatentHeatMax;
1894 0 : calcFinalZoneSizing.LatentHeatLoadSeq = calcZoneSizing.LatentHeatLoadSeq;
1895 0 : calcFinalZoneSizing.LatentHeatFlowSeq = calcZoneSizing.LatentHeatFlowSeq;
1896 : }
1897 : }
1898 : }
1899 : // select largest load from NoDOAS arrays
1900 14613 : if (calcZoneSizing.DesHeatLoadNoDOAS > calcFinalZoneSizing.DesHeatLoadNoDOAS) {
1901 13 : calcFinalZoneSizing.DesHeatLoadNoDOAS = calcZoneSizing.DesHeatLoadNoDOAS;
1902 13 : calcFinalZoneSizing.HeatLoadNoDOASSeq = calcZoneSizing.HeatLoadNoDOASSeq;
1903 13 : calcFinalZoneSizing.HeatNoDOASDDNum = calcZoneSizing.HeatNoDOASDDNum;
1904 13 : calcFinalZoneSizing.HeatNoDOASDesDay = calcZoneSizing.HeatNoDOASDesDay;
1905 13 : calcFinalZoneSizing.TimeStepNumAtHeatNoDOASMax = calcZoneSizing.TimeStepNumAtHeatNoDOASMax;
1906 : }
1907 14613 : if (calcZoneSizing.DesLatentHeatLoadNoDOAS > calcFinalZoneSizing.DesLatentHeatLoadNoDOAS) {
1908 14 : calcFinalZoneSizing.DesLatentHeatLoadNoDOAS = calcZoneSizing.DesLatentHeatLoadNoDOAS;
1909 14 : calcFinalZoneSizing.HeatLatentLoadNoDOASSeq = calcZoneSizing.HeatLatentLoadNoDOASSeq;
1910 14 : calcFinalZoneSizing.LatentHeatNoDOASDDNum = calcZoneSizing.LatentHeatNoDOASDDNum;
1911 14 : calcFinalZoneSizing.LatHeatNoDOASDesDay = calcZoneSizing.LatHeatNoDOASDesDay;
1912 14 : calcFinalZoneSizing.TimeStepNumAtLatentHeatNoDOASMax = calcZoneSizing.TimeStepNumAtLatentHeatNoDOASMax;
1913 : }
1914 : // from all the design periods, choose the one needing the most Cooling and save all its design variables in CalcFinalZoneSizing
1915 14613 : if (calcZoneSizing.DesCoolVolFlow > calcFinalZoneSizing.DesCoolVolFlow) {
1916 3558 : calcFinalZoneSizing.DesCoolVolFlow = calcZoneSizing.DesCoolVolFlow;
1917 3558 : calcFinalZoneSizing.DesCoolLoad = calcZoneSizing.DesCoolLoad;
1918 3558 : calcFinalZoneSizing.DesCoolMassFlow = calcZoneSizing.DesCoolMassFlow;
1919 3558 : calcFinalZoneSizing.CoolDesDay = calcZoneSizing.CoolDesDay;
1920 3558 : calcFinalZoneSizing.DesCoolDens = calcZoneSizing.DesCoolDens;
1921 3558 : calcFinalZoneSizing.CoolFlowSeq = calcZoneSizing.CoolFlowSeq;
1922 3558 : calcFinalZoneSizing.CoolLoadSeq = calcZoneSizing.CoolLoadSeq;
1923 3558 : calcFinalZoneSizing.CoolZoneTempSeq = calcZoneSizing.CoolZoneTempSeq;
1924 3558 : calcFinalZoneSizing.CoolOutTempSeq = calcZoneSizing.CoolOutTempSeq;
1925 3558 : calcFinalZoneSizing.CoolZoneRetTempSeq = calcZoneSizing.CoolZoneRetTempSeq;
1926 3558 : calcFinalZoneSizing.CoolZoneHumRatSeq = calcZoneSizing.CoolZoneHumRatSeq;
1927 3558 : calcFinalZoneSizing.CoolOutHumRatSeq = calcZoneSizing.CoolOutHumRatSeq;
1928 3558 : calcFinalZoneSizing.ZoneTempAtCoolPeak = calcZoneSizing.ZoneTempAtCoolPeak;
1929 3558 : calcFinalZoneSizing.OutTempAtCoolPeak = calcZoneSizing.OutTempAtCoolPeak;
1930 3558 : calcFinalZoneSizing.ZoneRetTempAtCoolPeak = calcZoneSizing.ZoneRetTempAtCoolPeak;
1931 3558 : calcFinalZoneSizing.ZoneHumRatAtCoolPeak = calcZoneSizing.ZoneHumRatAtCoolPeak;
1932 3558 : calcFinalZoneSizing.OutHumRatAtCoolPeak = calcZoneSizing.OutHumRatAtCoolPeak;
1933 3558 : calcFinalZoneSizing.CoolDDNum = calcZoneSizing.CoolDDNum;
1934 3558 : calcFinalZoneSizing.cCoolDDDate = desDayWeath.DateString;
1935 3558 : calcFinalZoneSizing.TimeStepNumAtCoolMax = calcZoneSizing.TimeStepNumAtCoolMax;
1936 3558 : calcFinalZoneSizing.DesCoolCoilInTemp = calcZoneSizing.DesCoolCoilInTemp;
1937 3558 : calcFinalZoneSizing.DesCoolCoilInHumRat = calcZoneSizing.DesCoolCoilInHumRat;
1938 : } else {
1939 11055 : calcFinalZoneSizing.DesCoolDens = state.dataEnvrn->StdRhoAir;
1940 : // save design cooling load when the there is design cooling load and the design cooling volume flow rate is zero, i.e., when
1941 : // design cooling volume flow rate is set to zero due to cooling supply air temp greater than zone thermostat temperature
1942 11055 : if (calcZoneSizing.DesCoolLoad > calcFinalZoneSizing.DesCoolLoad) {
1943 0 : calcFinalZoneSizing.DesCoolLoad = calcZoneSizing.DesCoolLoad;
1944 0 : calcFinalZoneSizing.CoolDesDay = calcZoneSizing.CoolDesDay;
1945 0 : calcFinalZoneSizing.CoolLoadSeq = calcZoneSizing.CoolLoadSeq;
1946 0 : calcFinalZoneSizing.CoolZoneTempSeq = calcZoneSizing.CoolZoneTempSeq;
1947 0 : calcFinalZoneSizing.CoolOutTempSeq = calcZoneSizing.CoolOutTempSeq;
1948 0 : calcFinalZoneSizing.CoolZoneRetTempSeq = calcZoneSizing.CoolZoneRetTempSeq;
1949 0 : calcFinalZoneSizing.CoolZoneHumRatSeq = calcZoneSizing.CoolZoneHumRatSeq;
1950 0 : calcFinalZoneSizing.CoolOutHumRatSeq = calcZoneSizing.CoolOutHumRatSeq;
1951 0 : calcFinalZoneSizing.ZoneTempAtCoolPeak = calcZoneSizing.ZoneTempAtCoolPeak;
1952 0 : calcFinalZoneSizing.OutTempAtCoolPeak = calcZoneSizing.OutTempAtCoolPeak;
1953 0 : calcFinalZoneSizing.ZoneRetTempAtCoolPeak = calcZoneSizing.ZoneRetTempAtCoolPeak;
1954 0 : calcFinalZoneSizing.ZoneHumRatAtCoolPeak = calcZoneSizing.ZoneHumRatAtCoolPeak;
1955 0 : calcFinalZoneSizing.OutHumRatAtCoolPeak = calcZoneSizing.OutHumRatAtCoolPeak;
1956 0 : calcFinalZoneSizing.CoolDDNum = calcZoneSizing.CoolDDNum;
1957 0 : calcFinalZoneSizing.cCoolDDDate = desDayWeath.DateString;
1958 0 : calcFinalZoneSizing.TimeStepNumAtCoolMax = calcZoneSizing.TimeStepNumAtCoolMax;
1959 0 : calcFinalZoneSizing.DesCoolCoilInTemp = calcZoneSizing.DesCoolCoilInTemp;
1960 0 : calcFinalZoneSizing.DesCoolCoilInHumRat = calcZoneSizing.DesCoolCoilInHumRat;
1961 0 : calcFinalZoneSizing.CoolTstatTemp = calcZoneSizing.CoolTstatTemp;
1962 : }
1963 : }
1964 14613 : if (calcZoneSizing.zoneLatentSizing) {
1965 : // from all the design periods, choose the one needing the most Latent Cooling and save all its design variables in
1966 : // CalcFinalZoneSizing
1967 52 : if (calcZoneSizing.DesLatentCoolVolFlow > calcFinalZoneSizing.DesLatentCoolVolFlow) {
1968 19 : calcFinalZoneSizing.DesLatentCoolVolFlow = calcZoneSizing.DesLatentCoolVolFlow;
1969 19 : calcFinalZoneSizing.DesLatentCoolMassFlow = calcZoneSizing.DesLatentCoolMassFlow;
1970 19 : calcFinalZoneSizing.DesLatentCoolLoad = calcZoneSizing.DesLatentCoolLoad;
1971 19 : calcFinalZoneSizing.ZoneTempAtLatentCoolPeak = calcZoneSizing.ZoneTempAtLatentCoolPeak;
1972 19 : calcFinalZoneSizing.ZoneHumRatAtLatentCoolPeak = calcZoneSizing.ZoneHumRatAtLatentCoolPeak;
1973 19 : calcFinalZoneSizing.ZoneRetTempAtLatentCoolPeak = calcZoneSizing.ZoneRetTempAtLatentCoolPeak;
1974 19 : calcFinalZoneSizing.DesLatentCoolCoilInTemp = calcZoneSizing.DesLatentCoolCoilInTemp;
1975 19 : calcFinalZoneSizing.DesLatentCoolCoilInHumRat = calcZoneSizing.DesLatentCoolCoilInHumRat;
1976 19 : calcFinalZoneSizing.LatCoolDesDay = calcZoneSizing.LatCoolDesDay;
1977 19 : calcFinalZoneSizing.cLatentCoolDDDate = desDayWeath.DateString;
1978 19 : calcFinalZoneSizing.LatentCoolDDNum = calcZoneSizing.LatentCoolDDNum;
1979 19 : calcFinalZoneSizing.TimeStepNumAtLatentCoolMax = calcZoneSizing.TimeStepNumAtLatentCoolMax;
1980 19 : calcFinalZoneSizing.LatentCoolLoadSeq = calcZoneSizing.LatentCoolLoadSeq;
1981 19 : calcFinalZoneSizing.LatentCoolFlowSeq = calcZoneSizing.LatentCoolFlowSeq;
1982 : } else {
1983 : // save design latent cooling load when the there is design load and the design volume flow rate is zero, i.e., when
1984 : // design latent cooling volume flow rate is set to zero due to cooling supply air humrat is greater than zone humidistat humrat
1985 33 : if (calcZoneSizing.DesLatentCoolLoad > calcFinalZoneSizing.DesLatentCoolLoad) {
1986 0 : calcFinalZoneSizing.DesLatentCoolLoad = calcZoneSizing.DesLatentCoolLoad;
1987 0 : calcFinalZoneSizing.cLatentCoolDDDate = desDayWeath.DateString;
1988 0 : calcFinalZoneSizing.LatentCoolDDNum = calcZoneSizing.LatentCoolDDNum;
1989 0 : calcFinalZoneSizing.LatCoolDesDay = calcZoneSizing.LatCoolDesDay;
1990 0 : calcFinalZoneSizing.TimeStepNumAtLatentCoolMax = calcZoneSizing.TimeStepNumAtLatentCoolMax;
1991 0 : calcFinalZoneSizing.LatentCoolLoadSeq = calcZoneSizing.LatentCoolLoadSeq;
1992 : }
1993 : }
1994 : }
1995 14613 : if (calcZoneSizing.DesCoolLoadNoDOAS > calcFinalZoneSizing.DesCoolLoadNoDOAS) {
1996 13 : calcFinalZoneSizing.DesCoolLoadNoDOAS = calcZoneSizing.DesCoolLoadNoDOAS;
1997 13 : calcFinalZoneSizing.CoolLoadNoDOASSeq = calcZoneSizing.CoolLoadNoDOASSeq;
1998 13 : calcFinalZoneSizing.CoolNoDOASDDNum = calcZoneSizing.CoolNoDOASDDNum;
1999 13 : calcFinalZoneSizing.CoolNoDOASDesDay = calcZoneSizing.CoolNoDOASDesDay;
2000 13 : calcFinalZoneSizing.TimeStepNumAtCoolNoDOASMax = calcZoneSizing.TimeStepNumAtCoolNoDOASMax;
2001 : }
2002 14613 : if (calcZoneSizing.DesLatentCoolLoadNoDOAS > calcFinalZoneSizing.DesLatentCoolLoadNoDOAS) {
2003 19 : calcFinalZoneSizing.DesLatentCoolLoadNoDOAS = calcZoneSizing.DesLatentCoolLoadNoDOAS;
2004 19 : calcFinalZoneSizing.CoolLatentLoadNoDOASSeq = calcZoneSizing.CoolLatentLoadNoDOASSeq;
2005 19 : calcFinalZoneSizing.LatentCoolNoDOASDDNum = calcZoneSizing.LatentCoolNoDOASDDNum;
2006 19 : calcFinalZoneSizing.LatCoolNoDOASDesDay = calcZoneSizing.LatCoolNoDOASDesDay;
2007 19 : calcFinalZoneSizing.TimeStepNumAtLatentCoolNoDOASMax = calcZoneSizing.TimeStepNumAtLatentCoolNoDOASMax;
2008 : }
2009 : // save heat peak conditions when there is no design heating load or design heating volume flow rate, i.e., when
2010 : // zone temperature is always greater than the zone heating thermostat temperature
2011 14613 : if (calcFinalZoneSizing.DesHeatLoad == 0) {
2012 4272 : bool FirstIteration = true;
2013 520464 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
2014 516192 : if ((calcZoneSizing.HeatZoneTempSeq(TimeStepIndex) < calcZoneSizing.ZoneTempAtHeatPeak) || FirstIteration) {
2015 19334 : calcZoneSizing.ZoneTempAtHeatPeak = calcZoneSizing.HeatZoneTempSeq(TimeStepIndex);
2016 19334 : calcZoneSizing.OutTempAtHeatPeak = calcZoneSizing.HeatOutTempSeq(TimeStepIndex);
2017 19334 : calcZoneSizing.ZoneRetTempAtHeatPeak = calcZoneSizing.HeatZoneRetTempSeq(TimeStepIndex);
2018 19334 : calcZoneSizing.ZoneHumRatAtHeatPeak = calcZoneSizing.HeatZoneHumRatSeq(TimeStepIndex);
2019 19334 : calcZoneSizing.OutHumRatAtHeatPeak = calcZoneSizing.HeatOutHumRatSeq(TimeStepIndex);
2020 19334 : calcZoneSizing.TimeStepNumAtHeatMax = TimeStepIndex;
2021 19334 : FirstIteration = false;
2022 : }
2023 : }
2024 4272 : if (calcZoneSizing.OutTempAtHeatPeak <= calcFinalZoneSizing.OutTempAtHeatPeak) {
2025 3729 : calcFinalZoneSizing.HeatDesDay = calcZoneSizing.HeatDesDay;
2026 3729 : calcFinalZoneSizing.HeatZoneTempSeq = calcZoneSizing.HeatZoneTempSeq;
2027 3729 : calcFinalZoneSizing.HeatOutTempSeq = calcZoneSizing.HeatOutTempSeq;
2028 3729 : calcFinalZoneSizing.HeatZoneRetTempSeq = calcZoneSizing.HeatZoneRetTempSeq;
2029 3729 : calcFinalZoneSizing.HeatZoneHumRatSeq = calcZoneSizing.HeatZoneHumRatSeq;
2030 3729 : calcFinalZoneSizing.HeatOutHumRatSeq = calcZoneSizing.HeatOutHumRatSeq;
2031 3729 : calcFinalZoneSizing.ZoneTempAtHeatPeak = calcZoneSizing.ZoneTempAtHeatPeak;
2032 3729 : calcFinalZoneSizing.OutTempAtHeatPeak = calcZoneSizing.OutTempAtHeatPeak;
2033 3729 : calcFinalZoneSizing.ZoneRetTempAtHeatPeak = calcZoneSizing.ZoneRetTempAtHeatPeak;
2034 3729 : calcFinalZoneSizing.ZoneHumRatAtHeatPeak = calcZoneSizing.ZoneHumRatAtHeatPeak;
2035 3729 : calcFinalZoneSizing.OutHumRatAtHeatPeak = calcZoneSizing.OutHumRatAtHeatPeak;
2036 3729 : calcFinalZoneSizing.HeatDDNum = calcZoneSizing.HeatDDNum;
2037 3729 : calcFinalZoneSizing.cHeatDDDate = desDayWeath.DateString;
2038 3729 : calcFinalZoneSizing.TimeStepNumAtHeatMax = calcZoneSizing.TimeStepNumAtHeatMax;
2039 3729 : calcFinalZoneSizing.DesHeatCoilInTemp = calcZoneSizing.DesHeatCoilInTemp;
2040 3729 : calcFinalZoneSizing.DesHeatCoilInHumRat = calcZoneSizing.DesHeatCoilInHumRat;
2041 3729 : calcFinalZoneSizing.HeatTstatTemp = calcZoneSizing.HeatTstatTemp;
2042 3729 : FirstIteration = false;
2043 : }
2044 : }
2045 14613 : if (calcFinalZoneSizing.zoneLatentSizing && calcFinalZoneSizing.DesLatentHeatLoad == 0) {
2046 30 : bool FirstIteration = true;
2047 2910 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
2048 2880 : if (calcZoneSizing.HeatZoneTempSeq(TimeStepIndex) < calcZoneSizing.ZoneTempAtLatentHeatPeak || FirstIteration) {
2049 82 : calcZoneSizing.ZoneTempAtLatentHeatPeak = calcZoneSizing.HeatZoneTempSeq(TimeStepIndex);
2050 82 : calcZoneSizing.OutTempAtLatentHeatPeak = calcZoneSizing.HeatOutTempSeq(TimeStepIndex);
2051 82 : calcZoneSizing.OutHumRatAtLatentHeatPeak = calcZoneSizing.HeatOutHumRatSeq(TimeStepIndex);
2052 : }
2053 2880 : if (calcZoneSizing.HeatOutTempSeq(TimeStepIndex) <= calcFinalZoneSizing.OutTempAtLatentHeatPeak) {
2054 1920 : calcFinalZoneSizing.OutTempAtLatentHeatPeak = calcZoneSizing.HeatOutTempSeq(TimeStepIndex);
2055 1920 : calcFinalZoneSizing.OutHumRatAtLatentHeatPeak = calcZoneSizing.HeatOutHumRatSeq(TimeStepIndex);
2056 1920 : calcFinalZoneSizing.LatHeatDesDay = calcZoneSizing.LatHeatDesDay;
2057 1920 : calcFinalZoneSizing.LatentHeatDDNum = calcZoneSizing.LatentHeatDDNum;
2058 1920 : calcFinalZoneSizing.cLatentHeatDDDate = desDayWeath.DateString;
2059 1920 : calcFinalZoneSizing.TimeStepNumAtLatentHeatMax = calcZoneSizing.TimeStepNumAtLatentHeatMax;
2060 : }
2061 2880 : FirstIteration = false;
2062 : }
2063 : }
2064 : // save cool peak conditions when there is no design cooling load or design cooling volume flow rate, i.e., when
2065 : // zone temperature is always less than the zone cooling thermostat temperature
2066 14613 : if (calcFinalZoneSizing.DesCoolLoad == 0) {
2067 9830 : bool FirstIteration = true;
2068 1217030 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
2069 1207200 : if ((calcZoneSizing.CoolZoneTempSeq(TimeStepIndex) > calcZoneSizing.ZoneTempAtCoolPeak) || FirstIteration) {
2070 95562 : calcZoneSizing.ZoneTempAtCoolPeak = calcZoneSizing.CoolZoneTempSeq(TimeStepIndex);
2071 95562 : calcZoneSizing.OutTempAtCoolPeak = calcZoneSizing.CoolOutTempSeq(TimeStepIndex);
2072 95562 : calcZoneSizing.ZoneRetTempAtCoolPeak = calcZoneSizing.CoolZoneRetTempSeq(TimeStepIndex);
2073 95562 : calcZoneSizing.ZoneHumRatAtCoolPeak = calcZoneSizing.CoolZoneHumRatSeq(TimeStepIndex);
2074 95562 : calcZoneSizing.OutHumRatAtCoolPeak = calcZoneSizing.CoolOutHumRatSeq(TimeStepIndex);
2075 95562 : calcZoneSizing.TimeStepNumAtCoolMax = TimeStepIndex;
2076 95562 : FirstIteration = false;
2077 : }
2078 : }
2079 9830 : if (calcZoneSizing.OutTempAtCoolPeak > calcFinalZoneSizing.OutTempAtCoolPeak) {
2080 282 : calcFinalZoneSizing.CoolDesDay = calcZoneSizing.CoolDesDay;
2081 282 : calcFinalZoneSizing.CoolZoneTempSeq = calcZoneSizing.CoolZoneTempSeq;
2082 282 : calcFinalZoneSizing.CoolOutTempSeq = calcZoneSizing.CoolOutTempSeq;
2083 282 : calcFinalZoneSizing.CoolZoneRetTempSeq = calcZoneSizing.CoolZoneRetTempSeq;
2084 282 : calcFinalZoneSizing.CoolZoneHumRatSeq = calcZoneSizing.CoolZoneHumRatSeq;
2085 282 : calcFinalZoneSizing.CoolOutHumRatSeq = calcZoneSizing.CoolOutHumRatSeq;
2086 282 : calcFinalZoneSizing.ZoneTempAtCoolPeak = calcZoneSizing.ZoneTempAtCoolPeak;
2087 282 : calcFinalZoneSizing.OutTempAtCoolPeak = calcZoneSizing.OutTempAtCoolPeak;
2088 282 : calcFinalZoneSizing.ZoneRetTempAtCoolPeak = calcZoneSizing.ZoneRetTempAtCoolPeak;
2089 282 : calcFinalZoneSizing.ZoneHumRatAtCoolPeak = calcZoneSizing.ZoneHumRatAtCoolPeak;
2090 282 : calcFinalZoneSizing.OutHumRatAtCoolPeak = calcZoneSizing.OutHumRatAtCoolPeak;
2091 282 : calcFinalZoneSizing.CoolDDNum = calcZoneSizing.CoolDDNum;
2092 282 : calcFinalZoneSizing.cCoolDDDate = desDayWeath.DateString;
2093 282 : calcFinalZoneSizing.TimeStepNumAtCoolMax = calcZoneSizing.TimeStepNumAtCoolMax;
2094 282 : calcFinalZoneSizing.DesCoolCoilInTemp = calcZoneSizing.DesCoolCoilInTemp;
2095 282 : calcFinalZoneSizing.DesCoolCoilInHumRat = calcZoneSizing.DesCoolCoilInHumRat;
2096 282 : calcFinalZoneSizing.CoolTstatTemp = calcZoneSizing.CoolTstatTemp;
2097 : }
2098 : }
2099 14613 : if (calcFinalZoneSizing.zoneLatentSizing && calcFinalZoneSizing.DesLatentCoolLoad == 0) {
2100 27 : bool FirstIteration = true;
2101 2619 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
2102 2592 : if (calcZoneSizing.CoolZoneTempSeq(TimeStepIndex) > calcZoneSizing.ZoneTempAtLatentCoolPeak || FirstIteration) {
2103 43 : calcZoneSizing.ZoneTempAtLatentCoolPeak = calcZoneSizing.CoolZoneTempSeq(TimeStepIndex);
2104 43 : calcZoneSizing.OutTempAtLatentCoolPeak = calcZoneSizing.CoolOutTempSeq(TimeStepIndex);
2105 43 : calcZoneSizing.OutHumRatAtLatentCoolPeak = calcZoneSizing.CoolOutHumRatSeq(TimeStepIndex);
2106 43 : FirstIteration = false;
2107 : }
2108 2592 : if (calcZoneSizing.OutTempAtLatentCoolPeak >= calcFinalZoneSizing.OutTempAtLatentCoolPeak) {
2109 2016 : calcFinalZoneSizing.LatCoolDesDay = calcZoneSizing.LatCoolDesDay;
2110 2016 : calcFinalZoneSizing.LatentCoolDDNum = calcZoneSizing.LatentCoolDDNum;
2111 2016 : calcFinalZoneSizing.cLatentCoolDDDate = desDayWeath.DateString;
2112 2016 : calcFinalZoneSizing.TimeStepNumAtLatentCoolMax = calcZoneSizing.TimeStepNumAtLatentCoolMax;
2113 : }
2114 : }
2115 : }
2116 1801 : }
2117 1801 : } break;
2118 428 : case DataGlobalConstants::CallIndicator::EndZoneSizingCalc: {
2119 : // candidate EMS calling point to customize CalcFinalZoneSizing
2120 : bool anyEMSRan;
2121 428 : EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::ZoneSizing, anyEMSRan, ObjexxFCL::Optional_int_const());
2122 :
2123 : // now apply EMS overrides (if any)
2124 428 : if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
2125 1122 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
2126 1067 : auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(CtrlZoneNum);
2127 1067 : if (calcFinalZoneSizing.EMSOverrideDesHeatMassOn) {
2128 0 : if (calcFinalZoneSizing.DesHeatMassFlow > 0.0) calcFinalZoneSizing.DesHeatMassFlow = calcFinalZoneSizing.EMSValueDesHeatMassFlow;
2129 : }
2130 1067 : if (calcFinalZoneSizing.EMSOverrideDesCoolMassOn) {
2131 0 : if (calcFinalZoneSizing.DesCoolMassFlow > 0.0) calcFinalZoneSizing.DesCoolMassFlow = calcFinalZoneSizing.EMSValueDesCoolMassFlow;
2132 : }
2133 1067 : if (calcFinalZoneSizing.EMSOverrideDesHeatLoadOn) {
2134 0 : if (calcFinalZoneSizing.DesHeatLoad > 0.0) calcFinalZoneSizing.DesHeatLoad = calcFinalZoneSizing.EMSValueDesHeatLoad;
2135 : }
2136 1067 : if (calcFinalZoneSizing.EMSOverrideDesCoolLoadOn) {
2137 0 : if (calcFinalZoneSizing.DesCoolLoad > 0.0) calcFinalZoneSizing.DesCoolLoad = calcFinalZoneSizing.EMSValueDesCoolLoad;
2138 : }
2139 1067 : if (calcFinalZoneSizing.EMSOverrideDesHeatVolOn) {
2140 0 : if (calcFinalZoneSizing.DesHeatVolFlow > 0.0) calcFinalZoneSizing.DesHeatVolFlow = calcFinalZoneSizing.EMSValueDesHeatVolFlow;
2141 : }
2142 1067 : if (calcFinalZoneSizing.EMSOverrideDesCoolVolOn) {
2143 0 : if (calcFinalZoneSizing.DesCoolVolFlow > 0.0) calcFinalZoneSizing.DesCoolVolFlow = calcFinalZoneSizing.EMSValueDesCoolVolFlow;
2144 : }
2145 : }
2146 : }
2147 :
2148 428 : if (!state.dataGlobal->isPulseZoneSizing) {
2149 :
2150 4188 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
2151 3783 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
2152 3315 : auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(CtrlZoneNum);
2153 3315 : if (std::abs(calcFinalZoneSizing.DesCoolLoad) <= 1.e-8) {
2154 80 : ShowWarningError(state, "Calculated design cooling load for zone=" + calcFinalZoneSizing.ZoneName + " is zero.");
2155 80 : ShowContinueError(state, "Check Sizing:Zone and ZoneControl:Thermostat inputs.");
2156 : }
2157 3315 : if (std::abs(calcFinalZoneSizing.DesHeatLoad) <= 1.e-8) {
2158 188 : ShowWarningError(state, "Calculated design heating load for zone=" + calcFinalZoneSizing.ZoneName + " is zero.");
2159 188 : ShowContinueError(state, "Check Sizing:Zone and ZoneControl:Thermostat inputs.");
2160 : }
2161 : }
2162 :
2163 405 : print(state.files.zsz, "Time");
2164 4188 : for (I = 1; I <= state.dataGlobal->NumOfZones; ++I) {
2165 3783 : if (!state.dataZoneEquip->ZoneEquipConfig(I).IsControlled) continue;
2166 3315 : auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(I);
2167 :
2168 : static constexpr std::string_view ZSizeFmt11("{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{"
2169 : "}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}{}{}:{}{}");
2170 82875 : print(state.files.zsz,
2171 : ZSizeFmt11,
2172 3315 : state.dataSize->SizingFileColSep,
2173 3315 : state.dataSize->CalcFinalZoneSizing(I).ZoneName,
2174 3315 : state.dataSize->CalcFinalZoneSizing(I).HeatDesDay,
2175 : ":Des Heat Load [W]",
2176 3315 : state.dataSize->SizingFileColSep,
2177 3315 : state.dataSize->CalcFinalZoneSizing(I).ZoneName,
2178 3315 : state.dataSize->CalcFinalZoneSizing(I).CoolDesDay,
2179 : ":Des Sens Cool Load [W]",
2180 3315 : state.dataSize->SizingFileColSep,
2181 3315 : state.dataSize->CalcFinalZoneSizing(I).ZoneName,
2182 3315 : state.dataSize->CalcFinalZoneSizing(I).HeatDesDay,
2183 : ":Des Heat Mass Flow [kg/s]",
2184 3315 : state.dataSize->SizingFileColSep,
2185 3315 : state.dataSize->CalcFinalZoneSizing(I).ZoneName,
2186 3315 : state.dataSize->CalcFinalZoneSizing(I).CoolDesDay,
2187 : ":Des Cool Mass Flow [kg/s]",
2188 3315 : state.dataSize->SizingFileColSep,
2189 : calcFinalZoneSizing.ZoneName,
2190 : calcFinalZoneSizing.LatHeatDesDay,
2191 : ":Des Latent Heat Load [W]",
2192 3315 : state.dataSize->SizingFileColSep,
2193 : calcFinalZoneSizing.ZoneName,
2194 : calcFinalZoneSizing.LatCoolDesDay,
2195 : ":Des Latent Cool Load [W]",
2196 3315 : state.dataSize->SizingFileColSep,
2197 : calcFinalZoneSizing.ZoneName,
2198 : calcFinalZoneSizing.LatHeatDesDay,
2199 : ":Des Latent Heat Mass Flow [kg/s]",
2200 3315 : state.dataSize->SizingFileColSep,
2201 : calcFinalZoneSizing.ZoneName,
2202 : calcFinalZoneSizing.LatCoolDesDay,
2203 : ":Des Latent Cool Mass Flow [kg/s]",
2204 3315 : state.dataSize->SizingFileColSep,
2205 : calcFinalZoneSizing.ZoneName,
2206 : calcFinalZoneSizing.HeatNoDOASDesDay,
2207 : ":Des Heat Load No DOAS [W]",
2208 3315 : state.dataSize->SizingFileColSep,
2209 : calcFinalZoneSizing.ZoneName,
2210 : calcFinalZoneSizing.CoolNoDOASDesDay,
2211 : ":Des Sens Cool Load No DOAS [W]",
2212 3315 : state.dataSize->SizingFileColSep,
2213 : calcFinalZoneSizing.ZoneName,
2214 : calcFinalZoneSizing.LatHeatNoDOASDesDay,
2215 : ":Des Latent Heat Load No DOAS [W]",
2216 3315 : state.dataSize->SizingFileColSep,
2217 : calcFinalZoneSizing.ZoneName,
2218 : calcFinalZoneSizing.LatCoolNoDOASDesDay,
2219 : ":Des Latent Cool Load No DOAS [W]",
2220 3315 : state.dataSize->SizingFileColSep,
2221 : calcFinalZoneSizing.ZoneName,
2222 : calcFinalZoneSizing.HeatDesDay,
2223 : ":Heating Zone Temperature [C]",
2224 3315 : state.dataSize->SizingFileColSep,
2225 : calcFinalZoneSizing.ZoneName,
2226 : calcFinalZoneSizing.HeatDesDay,
2227 : ":Heating Zone Relative Humidity [%]",
2228 3315 : state.dataSize->SizingFileColSep,
2229 : calcFinalZoneSizing.ZoneName,
2230 : calcFinalZoneSizing.CoolDesDay,
2231 : ":Cooling Zone Temperature [C]",
2232 3315 : state.dataSize->SizingFileColSep,
2233 : calcFinalZoneSizing.ZoneName,
2234 : calcFinalZoneSizing.CoolDesDay,
2235 : ":Cooling Zone Relative Humidity [%]");
2236 :
2237 : // Should this be done only if there is a cooling load? Or would this message help determine why there was no load?
2238 3315 : if (std::abs(state.dataSize->CalcFinalZoneSizing(I).DesCoolLoad) > 1.e-8) {
2239 : // check for low cooling delta T from supply to zone to see if air volume flow rate might be excessively high
2240 3235 : if (state.dataSize->CalcFinalZoneSizing(I).ZnCoolDgnSAMethod == SupplyAirTemperature) {
2241 3235 : SupplyTemp = state.dataSize->CalcFinalZoneSizing(I).CoolDesTemp;
2242 3235 : DeltaTemp = SupplyTemp - state.dataSize->CalcFinalZoneSizing(I).ZoneTempAtCoolPeak;
2243 : } else {
2244 0 : DeltaTemp = -std::abs(state.dataSize->CalcFinalZoneSizing(I).CoolDesTempDiff);
2245 0 : SupplyTemp = DeltaTemp + state.dataSize->CalcFinalZoneSizing(I).ZoneTempAtCoolPeak;
2246 : }
2247 :
2248 : // check for low delta T to avoid very high flow rates
2249 3235 : if (std::abs(DeltaTemp) < 5.0 && std::abs(DeltaTemp) > DataHVACGlobals::SmallTempDiff) { // Vdot exceeds 1200 cfm/ton @ DT=5
2250 2 : if (std::abs(DeltaTemp) >= 2.0) { // Vdot exceeds 3000 cfm/ton @ DT=2
2251 2 : ShowWarningError(state, "UpdateZoneSizing: Cooling supply air temperature (calculated) within 5C of zone temperature");
2252 : } else {
2253 0 : ShowSevereError(state, "UpdateZoneSizing: Cooling supply air temperature (calculated) within 2C of zone temperature");
2254 : }
2255 2 : ShowContinueError(state, "...check zone thermostat set point and design supply air temperatures");
2256 2 : ShowContinueError(state, format("...zone name = {}", state.dataSize->CalcFinalZoneSizing(I).ZoneName));
2257 6 : ShowContinueError(state,
2258 4 : format("...design sensible cooling load = {:.2R} W", state.dataSize->CalcFinalZoneSizing(I).DesCoolLoad));
2259 6 : ShowContinueError(state,
2260 4 : format("...thermostat set point temp = {:.3R} C", state.dataSize->CalcFinalZoneSizing(I).CoolTstatTemp));
2261 6 : ShowContinueError(
2262 4 : state, format("...zone temperature = {:.3R} C", state.dataSize->CalcFinalZoneSizing(I).ZoneTempAtCoolPeak));
2263 2 : ShowContinueError(state, format("...supply air temperature = {:.3R} C", SupplyTemp));
2264 2 : ShowContinueError(state, format("...temperature difference = {:.5R} C", DeltaTemp));
2265 6 : ShowContinueError(
2266 4 : state, format("...calculated volume flow rate = {:.5R} m3/s", (state.dataSize->CalcFinalZoneSizing(I).DesCoolVolFlow)));
2267 6 : ShowContinueError(
2268 4 : state, format("...calculated mass flow rate = {:.5R} kg/s", (state.dataSize->CalcFinalZoneSizing(I).DesCoolMassFlow)));
2269 2 : if (SupplyTemp > state.dataSize->CalcFinalZoneSizing(I).ZoneTempAtCoolPeak)
2270 0 : ShowContinueError(
2271 : state, "...Note: supply air temperature should be less than zone temperature during cooling air flow calculations");
2272 6466 : } else if (std::abs(DeltaTemp) > DataHVACGlobals::SmallTempDiff &&
2273 3233 : SupplyTemp > state.dataSize->CalcFinalZoneSizing(I).ZoneTempAtCoolPeak) {
2274 0 : ShowSevereError(
2275 : state, "UpdateZoneSizing: Supply air temperature is greater than zone temperature during cooling air flow calculations");
2276 0 : ShowContinueError(
2277 0 : state, format("...calculated volume flow rate = {:.5R} m3/s", (state.dataSize->CalcFinalZoneSizing(I).DesCoolVolFlow)));
2278 0 : ShowContinueError(
2279 0 : state, format("...calculated mass flow rate = {:.5R} kg/s", (state.dataSize->CalcFinalZoneSizing(I).DesCoolMassFlow)));
2280 0 : ShowContinueError(state,
2281 0 : format("...thermostat set point temp = {:.3R} C", state.dataSize->CalcFinalZoneSizing(I).CoolTstatTemp));
2282 0 : ShowContinueError(
2283 0 : state, format("...zone temperature = {:.3R} C", state.dataSize->CalcFinalZoneSizing(I).ZoneTempAtCoolPeak));
2284 0 : ShowContinueError(state, format("...supply air temperature = {:.3R} C", SupplyTemp));
2285 0 : ShowContinueError(state, "...occurs in zone = " + state.dataSize->CalcFinalZoneSizing(I).ZoneName);
2286 0 : ShowContinueError(
2287 : state, "...Note: supply air temperature should be less than zone temperature during cooling air flow calculations");
2288 : }
2289 : }
2290 : // Should this be done only if there is a heating load? Or would this message help determine why there was no load?
2291 3315 : if (std::abs(state.dataSize->CalcFinalZoneSizing(I).DesHeatLoad) > 1.e-8) { // ABS() ?
2292 : // check for low cooling delta T from supply to zone to see if air volume flow rate might be excessively high
2293 3127 : if (state.dataSize->CalcFinalZoneSizing(I).ZnHeatDgnSAMethod == SupplyAirTemperature) {
2294 3127 : SupplyTemp = state.dataSize->CalcFinalZoneSizing(I).HeatDesTemp;
2295 3127 : DeltaTemp = SupplyTemp - state.dataSize->CalcFinalZoneSizing(I).ZoneTempAtHeatPeak;
2296 : } else {
2297 0 : DeltaTemp = state.dataSize->CalcFinalZoneSizing(I).HeatDesTempDiff;
2298 0 : SupplyTemp = DeltaTemp + state.dataSize->CalcFinalZoneSizing(I).ZoneTempAtHeatPeak;
2299 : }
2300 :
2301 3127 : if (std::abs(DeltaTemp) < 5.0 && std::abs(DeltaTemp) > DataHVACGlobals::SmallTempDiff) { // Vdot exceeds 1200 cfm/ton @ DT=5
2302 0 : if (std::abs(DeltaTemp) >= 2.0) { // Vdot exceeds 3000 cfm/ton @ DT=2
2303 0 : ShowWarningError(state, "UpdateZoneSizing: Heating supply air temperature (calculated) within 5C of zone temperature");
2304 : } else {
2305 0 : ShowSevereError(state, "UpdateZoneSizing: Heating supply air temperature (calculated) within 2C of zone temperature");
2306 : }
2307 0 : ShowContinueError(state, "...check zone thermostat set point and design supply air temperatures");
2308 0 : ShowContinueError(state, format("...zone name = {}", state.dataSize->CalcFinalZoneSizing(I).ZoneName));
2309 0 : ShowContinueError(state,
2310 0 : format("...design heating load = {:.2R} W", state.dataSize->CalcFinalZoneSizing(I).DesHeatLoad));
2311 0 : ShowContinueError(state,
2312 0 : format("...thermostat set point temp = {:.3R} C", state.dataSize->CalcFinalZoneSizing(I).HeatTstatTemp));
2313 0 : ShowContinueError(
2314 0 : state, format("...zone temperature = {:.3R} C", state.dataSize->CalcFinalZoneSizing(I).ZoneTempAtHeatPeak));
2315 0 : ShowContinueError(state, format("...supply air temperature = {:.3R} C", SupplyTemp));
2316 0 : ShowContinueError(state, format("...temperature difference = {:.5R} C", DeltaTemp));
2317 0 : ShowContinueError(
2318 0 : state, format("...calculated volume flow rate = {:.5R} m3/s", (state.dataSize->CalcFinalZoneSizing(I).DesHeatVolFlow)));
2319 0 : ShowContinueError(
2320 0 : state, format("...calculated mass flow rate = {:.5R} kg/s", (state.dataSize->CalcFinalZoneSizing(I).DesHeatMassFlow)));
2321 0 : if (SupplyTemp < state.dataSize->CalcFinalZoneSizing(I).ZoneTempAtHeatPeak)
2322 0 : ShowContinueError(state,
2323 : "...Note: supply air temperature should be greater than zone temperature during heating air "
2324 : "flow calculations");
2325 6254 : } else if (std::abs(DeltaTemp) > DataHVACGlobals::SmallTempDiff &&
2326 3127 : SupplyTemp < state.dataSize->CalcFinalZoneSizing(I).ZoneTempAtHeatPeak) {
2327 0 : ShowSevereError(
2328 : state, "UpdateZoneSizing: Supply air temperature is less than zone temperature during heating air flow calculations");
2329 0 : ShowContinueError(state,
2330 0 : format("...calculated design heating volume flow rate = {:.5R} m3/s",
2331 0 : (state.dataSize->CalcFinalZoneSizing(I).DesHeatVolFlow)));
2332 0 : ShowContinueError(state,
2333 0 : format("...calculated design heating mass flow rate = {:.5R} kg/s",
2334 0 : (state.dataSize->CalcFinalZoneSizing(I).DesHeatMassFlow)));
2335 0 : ShowContinueError(state,
2336 0 : format("...thermostat set point temp = {:.3R} C", state.dataSize->CalcFinalZoneSizing(I).HeatTstatTemp));
2337 0 : ShowContinueError(
2338 0 : state, format("...zone temperature = {:.3R} C", state.dataSize->CalcFinalZoneSizing(I).ZoneTempAtHeatPeak));
2339 0 : ShowContinueError(state, format("...supply air temperature = {:.3R} C", SupplyTemp));
2340 0 : ShowContinueError(state, "...occurs in zone = " + state.dataSize->CalcFinalZoneSizing(I).ZoneName);
2341 0 : ShowContinueError(state,
2342 : "...Note: supply air temperature should be greater than zone temperature during heating air "
2343 : "flow calculations");
2344 : }
2345 : }
2346 : }
2347 :
2348 405 : print(state.files.zsz, "\n");
2349 : // HourFrac = 0.0
2350 405 : Minutes = 0;
2351 405 : TimeStepIndex = 0;
2352 10125 : for (HourCounter = 1; HourCounter <= 24; ++HourCounter) {
2353 60432 : for (TimeStepCounter = 1; TimeStepCounter <= state.dataGlobal->NumOfTimeStepInHour; ++TimeStepCounter) {
2354 50712 : ++TimeStepIndex;
2355 50712 : Minutes += state.dataGlobal->MinutesPerTimeStep;
2356 50712 : if (Minutes == 60) {
2357 9720 : Minutes = 0;
2358 9720 : HourPrint = HourCounter;
2359 : } else {
2360 40992 : HourPrint = HourCounter - 1;
2361 : }
2362 513720 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
2363 463008 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
2364 409296 : auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(CtrlZoneNum);
2365 409296 : if (TimeStepIndex == calcFinalZoneSizing.TimeStepNumAtHeatMax) {
2366 3315 : state.dataSize->HeatPeakDateHrMin(CtrlZoneNum) =
2367 6630 : calcFinalZoneSizing.cHeatDDDate + ' ' + format(PeakHrMinFmt, HourPrint, Minutes);
2368 : }
2369 409296 : if (TimeStepIndex == calcFinalZoneSizing.TimeStepNumAtCoolMax) {
2370 3315 : state.dataSize->CoolPeakDateHrMin(CtrlZoneNum) =
2371 6630 : calcFinalZoneSizing.cCoolDDDate + ' ' + format(PeakHrMinFmt, HourPrint, Minutes);
2372 : }
2373 409296 : if (TimeStepIndex == calcFinalZoneSizing.TimeStepNumAtLatentHeatMax) {
2374 5 : state.dataSize->LatHeatPeakDateHrMin(CtrlZoneNum) =
2375 10 : calcFinalZoneSizing.cLatentHeatDDDate + ' ' + format(PeakHrMinFmt, HourPrint, Minutes);
2376 : }
2377 409296 : if (TimeStepIndex == calcFinalZoneSizing.TimeStepNumAtLatentCoolMax) {
2378 8 : state.dataSize->LatCoolPeakDateHrMin(CtrlZoneNum) =
2379 16 : calcFinalZoneSizing.cLatentCoolDDDate + ' ' + format(PeakHrMinFmt, HourPrint, Minutes);
2380 : }
2381 : }
2382 :
2383 : static constexpr std::string_view ZSizeFmt20("{:02}:{:02}:00");
2384 50712 : print(state.files.zsz, ZSizeFmt20, HourPrint, Minutes);
2385 513720 : for (I = 1; I <= state.dataGlobal->NumOfZones; ++I) {
2386 463008 : if (!state.dataZoneEquip->ZoneEquipConfig(I).IsControlled) continue;
2387 409296 : auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(I);
2388 : static constexpr std::string_view ZSizeFmt21(
2389 : "{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12."
2390 : "6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}");
2391 409296 : Real64 ZoneRHHeat = 0.0;
2392 409296 : Real64 ZoneRHCool = 0.0;
2393 409296 : Real64 ZoneTHeat = 0.0;
2394 409296 : Real64 ZoneTCool = 0.0;
2395 409296 : if (calcFinalZoneSizing.HeatDDNum > 0) {
2396 408768 : ZoneTHeat = state.dataSize->CalcZoneSizing(calcFinalZoneSizing.HeatDDNum, I).HeatZoneTempSeq(TimeStepIndex);
2397 1635072 : ZoneRHHeat = Psychrometrics::PsyRhFnTdbWPb(
2398 : state,
2399 408768 : state.dataSize->CalcZoneSizing(calcFinalZoneSizing.HeatDDNum, I).HeatZoneTempSeq(TimeStepIndex),
2400 408768 : state.dataSize->CalcZoneSizing(calcFinalZoneSizing.HeatDDNum, I).HeatZoneHumRatSeq(TimeStepIndex),
2401 817536 : state.dataEnvrn->OutBaroPress) *
2402 : 100.0;
2403 : }
2404 409296 : if (calcFinalZoneSizing.CoolDDNum > 0) {
2405 409296 : ZoneTCool = state.dataSize->CalcZoneSizing(calcFinalZoneSizing.CoolDDNum, I).CoolZoneTempSeq(TimeStepIndex);
2406 1637184 : ZoneRHCool = Psychrometrics::PsyRhFnTdbWPb(
2407 : state,
2408 409296 : state.dataSize->CalcZoneSizing(calcFinalZoneSizing.CoolDDNum, I).CoolZoneTempSeq(TimeStepIndex),
2409 409296 : state.dataSize->CalcZoneSizing(calcFinalZoneSizing.CoolDDNum, I).CoolZoneHumRatSeq(TimeStepIndex),
2410 818592 : state.dataEnvrn->OutBaroPress) *
2411 : 100.0;
2412 : }
2413 6548736 : print(state.files.zsz,
2414 : ZSizeFmt21,
2415 409296 : state.dataSize->SizingFileColSep,
2416 : calcFinalZoneSizing.HeatLoadSeq(TimeStepIndex),
2417 409296 : state.dataSize->SizingFileColSep,
2418 : calcFinalZoneSizing.CoolLoadSeq(TimeStepIndex),
2419 409296 : state.dataSize->SizingFileColSep,
2420 : calcFinalZoneSizing.HeatFlowSeq(TimeStepIndex),
2421 409296 : state.dataSize->SizingFileColSep,
2422 : calcFinalZoneSizing.CoolFlowSeq(TimeStepIndex),
2423 409296 : state.dataSize->SizingFileColSep,
2424 : calcFinalZoneSizing.LatentHeatLoadSeq(TimeStepIndex),
2425 409296 : state.dataSize->SizingFileColSep,
2426 : calcFinalZoneSizing.LatentCoolLoadSeq(TimeStepIndex),
2427 409296 : state.dataSize->SizingFileColSep,
2428 : calcFinalZoneSizing.LatentHeatFlowSeq(TimeStepIndex),
2429 409296 : state.dataSize->SizingFileColSep,
2430 : calcFinalZoneSizing.LatentCoolFlowSeq(TimeStepIndex),
2431 409296 : state.dataSize->SizingFileColSep,
2432 : calcFinalZoneSizing.HeatLoadNoDOASSeq(TimeStepIndex),
2433 409296 : state.dataSize->SizingFileColSep,
2434 : calcFinalZoneSizing.CoolLoadNoDOASSeq(TimeStepIndex),
2435 409296 : state.dataSize->SizingFileColSep,
2436 : calcFinalZoneSizing.HeatLatentLoadNoDOASSeq(TimeStepIndex),
2437 409296 : state.dataSize->SizingFileColSep,
2438 : calcFinalZoneSizing.CoolLatentLoadNoDOASSeq(TimeStepIndex),
2439 409296 : state.dataSize->SizingFileColSep,
2440 : ZoneTHeat,
2441 409296 : state.dataSize->SizingFileColSep,
2442 : ZoneRHHeat,
2443 409296 : state.dataSize->SizingFileColSep,
2444 : ZoneTCool,
2445 409296 : state.dataSize->SizingFileColSep,
2446 : ZoneRHCool);
2447 : }
2448 50712 : print(state.files.zsz, "\n");
2449 : }
2450 : }
2451 405 : print(state.files.zsz, "Peak");
2452 :
2453 4188 : for (I = 1; I <= state.dataGlobal->NumOfZones; ++I) {
2454 3783 : if (!state.dataZoneEquip->ZoneEquipConfig(I).IsControlled) continue;
2455 3315 : auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(I);
2456 :
2457 : static constexpr std::string_view ZSizeFmt31("{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{:12."
2458 : "6E}{}{:12.6E}{}{:12.6E}{}{:12.6E}{}{}{}{}");
2459 53040 : print(state.files.zsz,
2460 : ZSizeFmt31,
2461 3315 : state.dataSize->SizingFileColSep,
2462 : calcFinalZoneSizing.DesHeatLoad,
2463 3315 : state.dataSize->SizingFileColSep,
2464 : calcFinalZoneSizing.DesCoolLoad,
2465 3315 : state.dataSize->SizingFileColSep,
2466 : calcFinalZoneSizing.DesHeatMassFlow,
2467 3315 : state.dataSize->SizingFileColSep,
2468 : calcFinalZoneSizing.DesCoolMassFlow,
2469 3315 : state.dataSize->SizingFileColSep,
2470 : calcFinalZoneSizing.DesLatentHeatLoad,
2471 3315 : state.dataSize->SizingFileColSep,
2472 : calcFinalZoneSizing.DesLatentCoolLoad,
2473 3315 : state.dataSize->SizingFileColSep,
2474 : calcFinalZoneSizing.DesLatentHeatMassFlow,
2475 3315 : state.dataSize->SizingFileColSep,
2476 : calcFinalZoneSizing.DesLatentCoolMassFlow,
2477 3315 : state.dataSize->SizingFileColSep,
2478 : calcFinalZoneSizing.DesHeatLoadNoDOAS,
2479 3315 : state.dataSize->SizingFileColSep,
2480 : calcFinalZoneSizing.DesCoolLoadNoDOAS,
2481 3315 : state.dataSize->SizingFileColSep,
2482 : calcFinalZoneSizing.DesLatentHeatLoadNoDOAS,
2483 3315 : state.dataSize->SizingFileColSep,
2484 : calcFinalZoneSizing.DesLatentCoolLoadNoDOAS,
2485 3315 : state.dataSize->SizingFileColSep,
2486 3315 : state.dataSize->SizingFileColSep,
2487 3315 : state.dataSize->SizingFileColSep,
2488 3315 : state.dataSize->SizingFileColSep);
2489 : }
2490 405 : print(state.files.zsz, "\n");
2491 :
2492 405 : print(state.files.zsz, "\nPeak Vol Flow (m3/s)");
2493 4188 : for (I = 1; I <= state.dataGlobal->NumOfZones; ++I) {
2494 3783 : if (!state.dataZoneEquip->ZoneEquipConfig(I).IsControlled) continue;
2495 3315 : auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(I);
2496 : static constexpr std::string_view ZSizeFmt41("{}{}{}{:12.6E}{}{:12.6E}{}{}{}{:12.6E}{}{:12.6E}{}{}{}{}{}{}{}{}");
2497 53040 : print(state.files.zsz,
2498 : ZSizeFmt41,
2499 3315 : state.dataSize->SizingFileColSep,
2500 3315 : state.dataSize->SizingFileColSep,
2501 3315 : state.dataSize->SizingFileColSep,
2502 : calcFinalZoneSizing.DesHeatVolFlow,
2503 3315 : state.dataSize->SizingFileColSep,
2504 : calcFinalZoneSizing.DesCoolVolFlow,
2505 3315 : state.dataSize->SizingFileColSep,
2506 3315 : state.dataSize->SizingFileColSep,
2507 3315 : state.dataSize->SizingFileColSep,
2508 : calcFinalZoneSizing.DesLatentHeatVolFlow,
2509 3315 : state.dataSize->SizingFileColSep,
2510 : calcFinalZoneSizing.DesLatentCoolVolFlow,
2511 3315 : state.dataSize->SizingFileColSep,
2512 3315 : state.dataSize->SizingFileColSep,
2513 3315 : state.dataSize->SizingFileColSep,
2514 3315 : state.dataSize->SizingFileColSep,
2515 3315 : state.dataSize->SizingFileColSep,
2516 3315 : state.dataSize->SizingFileColSep,
2517 3315 : state.dataSize->SizingFileColSep,
2518 3315 : state.dataSize->SizingFileColSep);
2519 : }
2520 405 : print(state.files.zsz, "\n");
2521 405 : state.files.zsz.close();
2522 : }
2523 :
2524 428 : if (!state.dataGlobal->isPulseZoneSizing) {
2525 : // Move sizing data into final sizing array according to sizing method
2526 4188 : for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
2527 3783 : if (!state.dataZoneEquip->ZoneEquipConfig(zoneNum).IsControlled) continue;
2528 : // if this zone does not use latent sizing, skip zone and retain sensible load variables
2529 3315 : if (!state.dataSize->CalcFinalZoneSizing(zoneNum).zoneLatentSizing) continue;
2530 8 : auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(zoneNum);
2531 :
2532 : // latent sizing data has the same variables as sensible sizing data
2533 : // if the user has specified latent sizing, move the latent sizing data into the final calc arrays
2534 : // this method allows all upstream sizing functions to use the same data as before (e.g., DesCoolVolFlow)
2535 : // if sensible sizing, use sensible data. if latent sizing, use latent data (if there is latent data).
2536 : // if sensible or latent sizing, use larger of sensible and latent based on volume flow rate
2537 :
2538 16 : if ((calcFinalZoneSizing.zoneSizingMethod == ZoneSizing::Latent && calcFinalZoneSizing.DesLatentCoolVolFlow > 0.0) ||
2539 16 : (calcFinalZoneSizing.zoneSizingMethod == ZoneSizing::SensibleAndLatent &&
2540 8 : calcFinalZoneSizing.DesLatentCoolLoad > calcFinalZoneSizing.DesCoolLoad)) {
2541 5 : state.dataHeatBal->isAnyLatentLoad = true;
2542 5 : calcFinalZoneSizing.CoolSizingType = "Latent Cooling"; // string reported to eio
2543 5 : calcFinalZoneSizing.DesCoolVolFlow = calcFinalZoneSizing.DesLatentCoolVolFlow;
2544 5 : calcFinalZoneSizing.DesCoolMassFlow = calcFinalZoneSizing.DesLatentCoolMassFlow;
2545 5 : calcFinalZoneSizing.DesCoolLoad = calcFinalZoneSizing.DesLatentCoolLoad;
2546 5 : calcFinalZoneSizing.CoolDesDay = calcFinalZoneSizing.LatCoolDesDay;
2547 5 : calcFinalZoneSizing.cCoolDDDate = calcFinalZoneSizing.cLatentCoolDDDate;
2548 5 : calcFinalZoneSizing.CoolDDNum = calcFinalZoneSizing.LatentCoolDDNum;
2549 5 : calcFinalZoneSizing.TimeStepNumAtCoolMax = calcFinalZoneSizing.TimeStepNumAtLatentCoolMax;
2550 5 : calcFinalZoneSizing.CoolFlowSeq = calcFinalZoneSizing.LatentCoolFlowSeq;
2551 5 : calcFinalZoneSizing.DesCoolCoilInTemp = calcFinalZoneSizing.DesLatentCoolCoilInTemp;
2552 5 : calcFinalZoneSizing.DesCoolCoilInHumRat = calcFinalZoneSizing.DesLatentCoolCoilInHumRat;
2553 5 : calcFinalZoneSizing.ZoneRetTempAtCoolPeak = calcFinalZoneSizing.ZoneRetTempAtLatentCoolPeak;
2554 5 : calcFinalZoneSizing.ZoneTempAtCoolPeak = calcFinalZoneSizing.ZoneTempAtLatentCoolPeak;
2555 5 : calcFinalZoneSizing.ZoneHumRatAtCoolPeak = calcFinalZoneSizing.ZoneHumRatAtLatentCoolPeak;
2556 5 : state.dataSize->CoolPeakDateHrMin(zoneNum) = state.dataSize->LatCoolPeakDateHrMin(zoneNum);
2557 :
2558 : // the zone supply air humrat used for latent sizing is required to adequately size coil capacity
2559 5 : if (calcFinalZoneSizing.ZnLatCoolDgnSAMethod == SupplyAirHumidityRatio) {
2560 0 : calcFinalZoneSizing.CoolDesHumRat = calcFinalZoneSizing.LatentCoolDesHumRat;
2561 : } else {
2562 5 : calcFinalZoneSizing.CoolDesHumRat = calcFinalZoneSizing.ZoneHumRatAtLatentCoolPeak - calcFinalZoneSizing.CoolDesHumRatDiff;
2563 : }
2564 :
2565 5 : if (calcFinalZoneSizing.LatentCoolDDNum > 0) {
2566 5 : auto &calcZoneSizing = state.dataSize->CalcZoneSizing(calcFinalZoneSizing.LatentCoolDDNum, zoneNum);
2567 5 : calcZoneSizing.DesCoolVolFlow = calcZoneSizing.DesLatentCoolVolFlow;
2568 5 : calcZoneSizing.DesCoolMassFlow = calcZoneSizing.DesLatentCoolMassFlow;
2569 5 : calcZoneSizing.DesCoolLoad = calcZoneSizing.DesLatentCoolLoad;
2570 5 : calcZoneSizing.CoolDesDay = calcZoneSizing.LatCoolDesDay;
2571 5 : calcZoneSizing.cCoolDDDate = calcFinalZoneSizing.cLatentCoolDDDate; // this has correct CoolDDDate
2572 5 : calcZoneSizing.CoolDDNum = calcZoneSizing.LatentCoolDDNum;
2573 5 : calcZoneSizing.TimeStepNumAtCoolMax = calcZoneSizing.TimeStepNumAtLatentCoolMax;
2574 5 : calcZoneSizing.CoolFlowSeq = calcZoneSizing.LatentCoolFlowSeq;
2575 5 : calcZoneSizing.DesCoolCoilInTemp = calcZoneSizing.DesLatentCoolCoilInTemp;
2576 5 : calcZoneSizing.DesCoolCoilInHumRat = calcZoneSizing.DesLatentCoolCoilInHumRat;
2577 5 : calcZoneSizing.ZoneRetTempAtCoolPeak = calcZoneSizing.ZoneRetTempAtLatentCoolPeak;
2578 5 : calcZoneSizing.ZoneTempAtCoolPeak = calcZoneSizing.ZoneTempAtLatentCoolPeak;
2579 5 : calcZoneSizing.ZoneHumRatAtCoolPeak = calcZoneSizing.ZoneHumRatAtLatentCoolPeak;
2580 5 : state.dataSize->CoolPeakDateHrMin(zoneNum) = state.dataSize->LatCoolPeakDateHrMin(zoneNum);
2581 :
2582 : // the zone supply air humrat used for latent sizing is required to adequately size coil capacity
2583 5 : if (calcZoneSizing.ZnLatCoolDgnSAMethod == SupplyAirHumidityRatio) {
2584 0 : calcZoneSizing.CoolDesHumRat = calcZoneSizing.LatentCoolDesHumRat;
2585 : } else {
2586 5 : calcZoneSizing.CoolDesHumRat = calcZoneSizing.ZoneHumRatAtLatentCoolPeak - calcZoneSizing.CoolDesHumRatDiff;
2587 : }
2588 : }
2589 : }
2590 16 : if ((calcFinalZoneSizing.zoneSizingMethod == ZoneSizing::Latent && calcFinalZoneSizing.DesLatentHeatVolFlow > 0.0) ||
2591 16 : (calcFinalZoneSizing.zoneSizingMethod == ZoneSizing::SensibleAndLatent &&
2592 8 : calcFinalZoneSizing.DesLatentHeatLoad > calcFinalZoneSizing.DesHeatLoad)) {
2593 :
2594 0 : calcFinalZoneSizing.HeatSizingType = "Latent Heating"; // string reported to eio
2595 0 : calcFinalZoneSizing.DesHeatVolFlow = calcFinalZoneSizing.DesLatentHeatVolFlow;
2596 0 : calcFinalZoneSizing.DesHeatMassFlow = calcFinalZoneSizing.DesLatentHeatMassFlow;
2597 0 : calcFinalZoneSizing.DesHeatLoad = calcFinalZoneSizing.DesLatentHeatLoad;
2598 0 : calcFinalZoneSizing.HeatDesDay = calcFinalZoneSizing.LatHeatDesDay;
2599 0 : calcFinalZoneSizing.cHeatDDDate = calcFinalZoneSizing.cLatentHeatDDDate;
2600 0 : calcFinalZoneSizing.HeatDDNum = calcFinalZoneSizing.LatentHeatDDNum;
2601 0 : calcFinalZoneSizing.TimeStepNumAtHeatMax = calcFinalZoneSizing.TimeStepNumAtLatentHeatMax;
2602 0 : calcFinalZoneSizing.HeatFlowSeq = calcFinalZoneSizing.LatentHeatFlowSeq;
2603 0 : calcFinalZoneSizing.DesHeatCoilInTemp = calcFinalZoneSizing.DesLatentHeatCoilInTemp;
2604 0 : calcFinalZoneSizing.DesHeatCoilInHumRat = calcFinalZoneSizing.DesLatentHeatCoilInHumRat;
2605 0 : calcFinalZoneSizing.ZoneRetTempAtHeatPeak = calcFinalZoneSizing.ZoneRetTempAtLatentHeatPeak;
2606 0 : calcFinalZoneSizing.ZoneTempAtHeatPeak = calcFinalZoneSizing.ZoneTempAtLatentHeatPeak;
2607 0 : calcFinalZoneSizing.ZoneHumRatAtHeatPeak = calcFinalZoneSizing.ZoneHumRatAtLatentHeatPeak;
2608 0 : state.dataSize->HeatPeakDateHrMin(zoneNum) = state.dataSize->LatHeatPeakDateHrMin(zoneNum);
2609 :
2610 : // will this cause sizing issues with heating coils since SA humrat is higher than zone humrat?
2611 : // use zone humrat instead? this value would size humidifiers well, but what about heating coils?
2612 : // not sure at this point if heating should reset HeatDesHumRat
2613 0 : if (calcFinalZoneSizing.ZnLatHeatDgnSAMethod == SupplyAirHumidityRatio) {
2614 0 : calcFinalZoneSizing.HeatDesHumRat = calcFinalZoneSizing.LatentHeatDesHumRat;
2615 : } else {
2616 0 : calcFinalZoneSizing.HeatDesHumRat = calcFinalZoneSizing.ZoneHumRatAtLatentHeatPeak + calcFinalZoneSizing.HeatDesHumRatDiff;
2617 : }
2618 :
2619 0 : if (calcFinalZoneSizing.LatentHeatDDNum > 0) {
2620 0 : auto &calcZoneSizing = state.dataSize->CalcZoneSizing(calcFinalZoneSizing.LatentHeatDDNum, zoneNum);
2621 0 : calcZoneSizing.DesHeatVolFlow = calcZoneSizing.DesLatentHeatVolFlow;
2622 0 : calcZoneSizing.DesHeatMassFlow = calcZoneSizing.DesLatentHeatMassFlow;
2623 0 : calcZoneSizing.DesHeatLoad = calcZoneSizing.DesLatentHeatLoad;
2624 0 : calcZoneSizing.HeatDesDay = calcZoneSizing.LatHeatDesDay;
2625 0 : calcZoneSizing.cHeatDDDate = calcFinalZoneSizing.cLatentHeatDDDate; // this has correct HeatDDDate
2626 0 : calcZoneSizing.HeatDDNum = calcZoneSizing.LatentHeatDDNum;
2627 0 : calcZoneSizing.TimeStepNumAtHeatMax = calcZoneSizing.TimeStepNumAtLatentHeatMax;
2628 0 : calcZoneSizing.HeatFlowSeq = calcZoneSizing.LatentHeatFlowSeq;
2629 0 : calcZoneSizing.DesHeatCoilInTemp = calcZoneSizing.DesLatentHeatCoilInTemp;
2630 0 : calcZoneSizing.DesHeatCoilInHumRat = calcZoneSizing.DesLatentHeatCoilInHumRat;
2631 0 : calcZoneSizing.ZoneRetTempAtHeatPeak = calcZoneSizing.ZoneRetTempAtLatentHeatPeak;
2632 0 : calcZoneSizing.ZoneTempAtHeatPeak = calcZoneSizing.ZoneTempAtLatentHeatPeak;
2633 0 : calcZoneSizing.ZoneHumRatAtHeatPeak = calcZoneSizing.ZoneHumRatAtLatentHeatPeak;
2634 0 : state.dataSize->HeatPeakDateHrMin(zoneNum) = state.dataSize->LatHeatPeakDateHrMin(zoneNum);
2635 :
2636 : // the zone supply air humrat used for latent sizing is required to adequately size coil capacity
2637 : // not sure at this point if heating should reset HeatDesHumRat
2638 0 : if (calcZoneSizing.ZnLatHeatDgnSAMethod == SupplyAirHumidityRatio) {
2639 0 : calcZoneSizing.HeatDesHumRat = calcZoneSizing.LatentHeatDesHumRat;
2640 : } else {
2641 0 : calcZoneSizing.HeatDesHumRat = calcZoneSizing.ZoneHumRatAtLatentHeatPeak + calcZoneSizing.HeatDesHumRatDiff;
2642 : }
2643 : }
2644 : }
2645 : }
2646 : }
2647 :
2648 : // Move data from Calc arrays to user modified arrays
2649 :
2650 8791 : for (std::size_t i = 0; i < state.dataSize->ZoneSizing.size(); ++i) {
2651 8363 : auto &z(state.dataSize->ZoneSizing[i]);
2652 8363 : auto &c(state.dataSize->CalcZoneSizing[i]);
2653 8363 : z.CoolDesDay = c.CoolDesDay;
2654 8363 : z.HeatDesDay = c.HeatDesDay;
2655 8363 : z.DesHeatDens = c.DesHeatDens;
2656 8363 : z.DesCoolDens = c.DesCoolDens;
2657 8363 : z.HeatDDNum = c.HeatDDNum;
2658 8363 : z.CoolDDNum = c.CoolDDNum;
2659 :
2660 8363 : z.DesHeatLoad = c.DesHeatLoad;
2661 8363 : z.DesHeatMassFlow = c.DesHeatMassFlow;
2662 8363 : z.ZoneTempAtHeatPeak = c.ZoneTempAtHeatPeak;
2663 8363 : z.OutTempAtHeatPeak = c.OutTempAtHeatPeak;
2664 8363 : z.ZoneRetTempAtHeatPeak = c.ZoneRetTempAtHeatPeak;
2665 8363 : z.ZoneHumRatAtHeatPeak = c.ZoneHumRatAtHeatPeak;
2666 8363 : z.OutHumRatAtHeatPeak = c.OutHumRatAtHeatPeak;
2667 8363 : z.TimeStepNumAtHeatMax = c.TimeStepNumAtHeatMax;
2668 8363 : z.DesHeatVolFlow = c.DesHeatVolFlow;
2669 8363 : z.DesHeatCoilInTemp = c.DesHeatCoilInTemp;
2670 8363 : z.DesHeatCoilInHumRat = c.DesHeatCoilInHumRat;
2671 8363 : z.CoolDesHumRat = c.CoolDesHumRat;
2672 :
2673 8363 : z.DesCoolLoad = c.DesCoolLoad;
2674 8363 : z.DesCoolMassFlow = c.DesCoolMassFlow;
2675 8363 : z.ZoneTempAtCoolPeak = c.ZoneTempAtCoolPeak;
2676 8363 : z.OutTempAtCoolPeak = c.OutTempAtCoolPeak;
2677 8363 : z.ZoneRetTempAtCoolPeak = c.ZoneRetTempAtCoolPeak;
2678 8363 : z.ZoneHumRatAtCoolPeak = c.ZoneHumRatAtCoolPeak;
2679 8363 : z.OutHumRatAtCoolPeak = c.OutHumRatAtCoolPeak;
2680 8363 : z.TimeStepNumAtCoolMax = c.TimeStepNumAtCoolMax;
2681 8363 : z.DesCoolVolFlow = c.DesCoolVolFlow;
2682 8363 : z.DesCoolCoilInTemp = c.DesCoolCoilInTemp;
2683 8363 : z.DesCoolCoilInHumRat = c.DesCoolCoilInHumRat;
2684 : }
2685 :
2686 4349 : for (std::size_t i = 0; i < state.dataSize->FinalZoneSizing.size(); ++i) {
2687 3921 : auto &z(state.dataSize->FinalZoneSizing[i]);
2688 3921 : auto &c(state.dataSize->CalcFinalZoneSizing[i]);
2689 3921 : z.CoolDesDay = c.CoolDesDay;
2690 3921 : z.HeatDesDay = c.HeatDesDay;
2691 3921 : z.DesHeatDens = c.DesHeatDens;
2692 3921 : z.DesCoolDens = c.DesCoolDens;
2693 3921 : z.HeatDDNum = c.HeatDDNum;
2694 3921 : z.CoolDDNum = c.CoolDDNum;
2695 :
2696 3921 : z.DesHeatLoad = c.DesHeatLoad;
2697 3921 : z.NonAirSysDesHeatLoad = c.DesHeatLoad;
2698 3921 : z.DesHeatMassFlow = c.DesHeatMassFlow;
2699 3921 : z.ZoneTempAtHeatPeak = c.ZoneTempAtHeatPeak;
2700 3921 : z.OutTempAtHeatPeak = c.OutTempAtHeatPeak;
2701 3921 : z.ZoneRetTempAtHeatPeak = c.ZoneRetTempAtHeatPeak;
2702 3921 : z.ZoneHumRatAtHeatPeak = c.ZoneHumRatAtHeatPeak;
2703 3921 : z.OutHumRatAtHeatPeak = c.OutHumRatAtHeatPeak;
2704 3921 : z.TimeStepNumAtHeatMax = c.TimeStepNumAtHeatMax;
2705 3921 : z.DesHeatVolFlow = c.DesHeatVolFlow;
2706 3921 : z.NonAirSysDesHeatVolFlow = c.DesHeatVolFlow;
2707 3921 : z.DesHeatCoilInTemp = c.DesHeatCoilInTemp;
2708 3921 : z.DesHeatCoilInHumRat = c.DesHeatCoilInHumRat;
2709 3921 : z.CoolDesHumRat = c.CoolDesHumRat;
2710 :
2711 3921 : z.DesCoolLoad = c.DesCoolLoad;
2712 3921 : z.NonAirSysDesCoolLoad = c.DesCoolLoad;
2713 3921 : z.DesCoolMassFlow = c.DesCoolMassFlow;
2714 3921 : z.ZoneTempAtCoolPeak = c.ZoneTempAtCoolPeak;
2715 3921 : z.OutTempAtCoolPeak = c.OutTempAtCoolPeak;
2716 3921 : z.ZoneRetTempAtCoolPeak = c.ZoneRetTempAtCoolPeak;
2717 3921 : z.ZoneHumRatAtCoolPeak = c.ZoneHumRatAtCoolPeak;
2718 3921 : z.OutHumRatAtCoolPeak = c.OutHumRatAtCoolPeak;
2719 3921 : z.TimeStepNumAtCoolMax = c.TimeStepNumAtCoolMax;
2720 3921 : z.DesCoolVolFlow = c.DesCoolVolFlow;
2721 3921 : z.NonAirSysDesCoolVolFlow = c.DesCoolVolFlow;
2722 3921 : z.DesCoolCoilInTemp = c.DesCoolCoilInTemp;
2723 3921 : z.DesCoolCoilInHumRat = c.DesCoolCoilInHumRat;
2724 : }
2725 :
2726 1345 : for (DesDayNum = 1; DesDayNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++DesDayNum) {
2727 9280 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
2728 8363 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
2729 7377 : auto &zoneSizing = state.dataSize->ZoneSizing(DesDayNum, CtrlZoneNum);
2730 7377 : auto &calcZoneSizing = state.dataSize->CalcZoneSizing(DesDayNum, CtrlZoneNum);
2731 921537 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
2732 914160 : zoneSizing.HeatFlowSeq(TimeStepIndex) = calcZoneSizing.HeatFlowSeq(TimeStepIndex);
2733 914160 : zoneSizing.HeatLoadSeq(TimeStepIndex) = calcZoneSizing.HeatLoadSeq(TimeStepIndex);
2734 914160 : zoneSizing.CoolFlowSeq(TimeStepIndex) = calcZoneSizing.CoolFlowSeq(TimeStepIndex);
2735 914160 : zoneSizing.CoolLoadSeq(TimeStepIndex) = calcZoneSizing.CoolLoadSeq(TimeStepIndex);
2736 914160 : zoneSizing.HeatZoneTempSeq(TimeStepIndex) = calcZoneSizing.HeatZoneTempSeq(TimeStepIndex);
2737 914160 : zoneSizing.HeatOutTempSeq(TimeStepIndex) = calcZoneSizing.HeatOutTempSeq(TimeStepIndex);
2738 914160 : zoneSizing.HeatZoneRetTempSeq(TimeStepIndex) = calcZoneSizing.HeatZoneRetTempSeq(TimeStepIndex);
2739 914160 : zoneSizing.HeatZoneHumRatSeq(TimeStepIndex) = calcZoneSizing.HeatZoneHumRatSeq(TimeStepIndex);
2740 914160 : zoneSizing.HeatOutHumRatSeq(TimeStepIndex) = calcZoneSizing.HeatOutHumRatSeq(TimeStepIndex);
2741 914160 : zoneSizing.CoolZoneTempSeq(TimeStepIndex) = calcZoneSizing.CoolZoneTempSeq(TimeStepIndex);
2742 914160 : zoneSizing.CoolOutTempSeq(TimeStepIndex) = calcZoneSizing.CoolOutTempSeq(TimeStepIndex);
2743 914160 : zoneSizing.CoolZoneRetTempSeq(TimeStepIndex) = calcZoneSizing.CoolZoneRetTempSeq(TimeStepIndex);
2744 914160 : zoneSizing.CoolZoneHumRatSeq(TimeStepIndex) = calcZoneSizing.CoolZoneHumRatSeq(TimeStepIndex);
2745 914160 : zoneSizing.CoolOutHumRatSeq(TimeStepIndex) = calcZoneSizing.CoolOutHumRatSeq(TimeStepIndex);
2746 : }
2747 : }
2748 : }
2749 :
2750 4349 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
2751 3921 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
2752 3430 : auto &finalZoneSizing = state.dataSize->FinalZoneSizing(CtrlZoneNum);
2753 3430 : auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(CtrlZoneNum);
2754 423766 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
2755 420336 : finalZoneSizing.HeatFlowSeq(TimeStepIndex) = calcFinalZoneSizing.HeatFlowSeq(TimeStepIndex);
2756 420336 : finalZoneSizing.HeatLoadSeq(TimeStepIndex) = calcFinalZoneSizing.HeatLoadSeq(TimeStepIndex);
2757 420336 : finalZoneSizing.CoolFlowSeq(TimeStepIndex) = calcFinalZoneSizing.CoolFlowSeq(TimeStepIndex);
2758 420336 : finalZoneSizing.CoolLoadSeq(TimeStepIndex) = calcFinalZoneSizing.CoolLoadSeq(TimeStepIndex);
2759 420336 : finalZoneSizing.HeatZoneTempSeq(TimeStepIndex) = calcFinalZoneSizing.HeatZoneTempSeq(TimeStepIndex);
2760 420336 : finalZoneSizing.HeatOutTempSeq(TimeStepIndex) = calcFinalZoneSizing.HeatOutTempSeq(TimeStepIndex);
2761 420336 : finalZoneSizing.HeatZoneRetTempSeq(TimeStepIndex) = calcFinalZoneSizing.HeatZoneRetTempSeq(TimeStepIndex);
2762 420336 : finalZoneSizing.HeatZoneHumRatSeq(TimeStepIndex) = calcFinalZoneSizing.HeatZoneHumRatSeq(TimeStepIndex);
2763 420336 : finalZoneSizing.HeatOutHumRatSeq(TimeStepIndex) = calcFinalZoneSizing.HeatOutHumRatSeq(TimeStepIndex);
2764 420336 : finalZoneSizing.CoolZoneTempSeq(TimeStepIndex) = calcFinalZoneSizing.CoolZoneTempSeq(TimeStepIndex);
2765 420336 : finalZoneSizing.CoolOutTempSeq(TimeStepIndex) = calcFinalZoneSizing.CoolOutTempSeq(TimeStepIndex);
2766 420336 : finalZoneSizing.CoolZoneRetTempSeq(TimeStepIndex) = calcFinalZoneSizing.CoolZoneRetTempSeq(TimeStepIndex);
2767 420336 : finalZoneSizing.CoolZoneHumRatSeq(TimeStepIndex) = calcFinalZoneSizing.CoolZoneHumRatSeq(TimeStepIndex);
2768 420336 : finalZoneSizing.CoolOutHumRatSeq(TimeStepIndex) = calcFinalZoneSizing.CoolOutHumRatSeq(TimeStepIndex);
2769 : }
2770 : }
2771 4349 : for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) {
2772 3921 : if (!state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).IsControlled) continue;
2773 3430 : auto &finalZoneSizing = state.dataSize->FinalZoneSizing(CtrlZoneNum);
2774 3430 : auto &calcFinalZoneSizing = state.dataSize->CalcFinalZoneSizing(CtrlZoneNum);
2775 : // update non air system design load and air flow to include the sizing factor
2776 3430 : finalZoneSizing.NonAirSysDesCoolLoad *= finalZoneSizing.CoolSizingFactor;
2777 3430 : finalZoneSizing.NonAirSysDesCoolVolFlow *= finalZoneSizing.CoolSizingFactor; // NonAirSysDesCoolVolFlow not currently used
2778 : // Now take into account the user specified sizing factor and user specified cooling design air flow rate
2779 3430 : TotCoolSizMult = 0.0;
2780 : // Calculate a sizing factor from the user specified cooling design air flow rate
2781 3434 : if (finalZoneSizing.InpDesCoolAirFlow > 0.0 && finalZoneSizing.CoolAirDesMethod == InpDesAirFlow &&
2782 4 : finalZoneSizing.DesCoolVolFlow > 0.0) {
2783 4 : TotCoolSizMult = (finalZoneSizing.InpDesCoolAirFlow / finalZoneSizing.DesCoolVolFlow) * finalZoneSizing.CoolSizingFactor;
2784 : // If no user specified cooling design air flow rate input, use the user specified szing factor
2785 : } else {
2786 3426 : TotCoolSizMult = finalZoneSizing.CoolSizingFactor;
2787 : }
2788 : // If the cooling sizing multiplier is not 1, adjust the cooling design data
2789 3430 : if (std::abs(TotCoolSizMult - 1.0) > 0.00001) {
2790 2259 : if (finalZoneSizing.DesCoolVolFlow > 0.0) {
2791 2182 : TimeStepAtPeak = finalZoneSizing.TimeStepNumAtCoolMax;
2792 2182 : DDNum = finalZoneSizing.CoolDDNum;
2793 2182 : finalZoneSizing.DesCoolVolFlow = calcFinalZoneSizing.DesCoolVolFlow * TotCoolSizMult;
2794 2182 : finalZoneSizing.DesCoolMassFlow = calcFinalZoneSizing.DesCoolMassFlow * TotCoolSizMult;
2795 2182 : finalZoneSizing.DesCoolLoad = calcFinalZoneSizing.DesCoolLoad * TotCoolSizMult;
2796 2182 : finalZoneSizing.CoolFlowSeq = calcFinalZoneSizing.CoolFlowSeq * TotCoolSizMult;
2797 2182 : finalZoneSizing.CoolLoadSeq = calcFinalZoneSizing.CoolLoadSeq * TotCoolSizMult;
2798 2182 : OAFrac = finalZoneSizing.MinOA / finalZoneSizing.DesCoolVolFlow;
2799 2182 : OAFrac = min(1.0, max(0.0, OAFrac));
2800 2182 : finalZoneSizing.DesCoolCoilInTemp =
2801 2182 : OAFrac * state.dataSize->DesDayWeath(DDNum).Temp(TimeStepAtPeak) + (1.0 - OAFrac) * finalZoneSizing.ZoneTempAtCoolPeak;
2802 2182 : finalZoneSizing.DesCoolCoilInHumRat =
2803 2182 : OAFrac * state.dataSize->DesDayWeath(DDNum).HumRat(TimeStepAtPeak) + (1.0 - OAFrac) * finalZoneSizing.ZoneHumRatAtCoolPeak;
2804 : } else {
2805 77 : finalZoneSizing.DesCoolVolFlow = finalZoneSizing.InpDesCoolAirFlow;
2806 77 : finalZoneSizing.DesCoolMassFlow = finalZoneSizing.DesCoolVolFlow * finalZoneSizing.DesCoolDens;
2807 : }
2808 6950 : for (DDNum = 1; DDNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++DDNum) {
2809 4691 : auto &zoneSizing = state.dataSize->ZoneSizing(DDNum, CtrlZoneNum);
2810 4691 : if (zoneSizing.DesCoolVolFlow > 0.0) {
2811 2431 : TimeStepAtPeak = zoneSizing.TimeStepNumAtCoolMax;
2812 2431 : auto &calcZoneSizing = state.dataSize->CalcZoneSizing(DDNum, CtrlZoneNum);
2813 2431 : auto &desDayWeath = state.dataSize->DesDayWeath(DDNum);
2814 2431 : zoneSizing.DesCoolVolFlow = calcZoneSizing.DesCoolVolFlow * TotCoolSizMult;
2815 2431 : zoneSizing.DesCoolMassFlow = calcZoneSizing.DesCoolMassFlow * TotCoolSizMult;
2816 2431 : zoneSizing.DesCoolLoad = calcZoneSizing.DesCoolLoad * TotCoolSizMult;
2817 2431 : zoneSizing.CoolFlowSeq = calcZoneSizing.CoolFlowSeq * TotCoolSizMult;
2818 2431 : zoneSizing.CoolLoadSeq = calcZoneSizing.CoolLoadSeq * TotCoolSizMult;
2819 2431 : OAFrac = zoneSizing.MinOA / zoneSizing.DesCoolVolFlow;
2820 2431 : OAFrac = min(1.0, max(0.0, OAFrac));
2821 2431 : zoneSizing.DesCoolCoilInTemp = OAFrac * desDayWeath.Temp(TimeStepAtPeak) + (1.0 - OAFrac) * zoneSizing.ZoneTempAtCoolPeak;
2822 2431 : zoneSizing.DesCoolCoilInHumRat =
2823 2431 : OAFrac * desDayWeath.HumRat(TimeStepAtPeak) + (1.0 - OAFrac) * zoneSizing.ZoneHumRatAtCoolPeak;
2824 : } else {
2825 2260 : zoneSizing.DesCoolVolFlow = zoneSizing.InpDesCoolAirFlow;
2826 2260 : zoneSizing.DesCoolMassFlow = zoneSizing.DesCoolVolFlow * zoneSizing.DesCoolDens;
2827 : }
2828 : // Save cooling flows without MinOA for use later
2829 4691 : zoneSizing.CoolFlowSeqNoOA = zoneSizing.CoolFlowSeq;
2830 4691 : zoneSizing.DesCoolVolFlowNoOA = zoneSizing.DesCoolVolFlow;
2831 4691 : zoneSizing.DesCoolMassFlowNoOA = zoneSizing.DesCoolMassFlow;
2832 : }
2833 : }
2834 : // Save a set of design cooling air flow rates greater than or equal to the specified minimums without MinOA
2835 : {
2836 3430 : Real64 MaxOfMinCoolVolFlowNoOA = 0.0; // max of the user specified design cooling minimum flows without min OA flow [m3/s]
2837 3430 : if (finalZoneSizing.CoolAirDesMethod == DesAirFlowWithLim) {
2838 954 : MaxOfMinCoolVolFlowNoOA = max(finalZoneSizing.DesCoolMinAirFlow, finalZoneSizing.DesCoolMinAirFlow2);
2839 : }
2840 3430 : Real64 MaxOfMinCoolMassFlowNoOA =
2841 : MaxOfMinCoolVolFlowNoOA *
2842 3430 : finalZoneSizing.DesCoolDens; // max of the user specified design cooling minimum flows without min OA flow [m3/s]
2843 3430 : finalZoneSizing.DesCoolVolFlowNoOA = finalZoneSizing.DesCoolVolFlow;
2844 3430 : finalZoneSizing.DesCoolMassFlowNoOA = finalZoneSizing.DesCoolMassFlow;
2845 3430 : if (MaxOfMinCoolVolFlowNoOA > finalZoneSizing.DesCoolVolFlowNoOA) {
2846 195 : finalZoneSizing.DesCoolVolFlowNoOA = MaxOfMinCoolVolFlowNoOA;
2847 195 : finalZoneSizing.DesCoolMassFlowNoOA = MaxOfMinCoolMassFlowNoOA;
2848 : }
2849 423766 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
2850 420336 : finalZoneSizing.CoolFlowSeqNoOA(TimeStepIndex) = finalZoneSizing.CoolFlowSeq(TimeStepIndex);
2851 420336 : if (MaxOfMinCoolMassFlowNoOA > finalZoneSizing.CoolFlowSeqNoOA(TimeStepIndex)) {
2852 60590 : finalZoneSizing.CoolFlowSeqNoOA(TimeStepIndex) = MaxOfMinCoolMassFlowNoOA;
2853 : }
2854 : }
2855 10807 : for (DDNum = 1; DDNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++DDNum) {
2856 7377 : auto &zoneSizing = state.dataSize->ZoneSizing(DDNum, CtrlZoneNum);
2857 7377 : zoneSizing.DesCoolVolFlowNoOA = zoneSizing.DesCoolVolFlow;
2858 7377 : zoneSizing.DesCoolMassFlowNoOA = zoneSizing.DesCoolMassFlow;
2859 7377 : MaxOfMinCoolVolFlowNoOA = max(zoneSizing.DesCoolMinAirFlow, zoneSizing.DesCoolMinAirFlow);
2860 7377 : MaxOfMinCoolMassFlowNoOA = MaxOfMinCoolVolFlowNoOA * zoneSizing.DesCoolDens;
2861 7377 : if (MaxOfMinCoolVolFlowNoOA > zoneSizing.DesCoolVolFlow) {
2862 613 : zoneSizing.DesCoolVolFlowNoOA = MaxOfMinCoolVolFlowNoOA;
2863 613 : zoneSizing.DesCoolMassFlowNoOA = MaxOfMinCoolMassFlowNoOA;
2864 : }
2865 921537 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
2866 914160 : zoneSizing.CoolFlowSeqNoOA(TimeStepIndex) = zoneSizing.CoolFlowSeq(TimeStepIndex);
2867 914160 : if (MaxOfMinCoolMassFlowNoOA > zoneSizing.CoolFlowSeq(TimeStepIndex)) {
2868 102755 : zoneSizing.CoolFlowSeqNoOA(TimeStepIndex) = MaxOfMinCoolMassFlowNoOA;
2869 : }
2870 : }
2871 : }
2872 : }
2873 :
2874 : // Now make sure that the design cooling air flow rates are greater than or equal to the specified minimums including MinOA
2875 : {
2876 3430 : Real64 MaxOfMinCoolVolFlow = 0.0; // max of the user specified design cooling minimum flows and min OA flow [m3/s]
2877 3430 : if (finalZoneSizing.CoolAirDesMethod == DesAirFlowWithLim) {
2878 954 : MaxOfMinCoolVolFlow = max(finalZoneSizing.DesCoolMinAirFlow, finalZoneSizing.DesCoolMinAirFlow2, finalZoneSizing.MinOA);
2879 : } else {
2880 2476 : MaxOfMinCoolVolFlow = finalZoneSizing.MinOA;
2881 : }
2882 3430 : Real64 MaxOfMinCoolMassFlow =
2883 : MaxOfMinCoolVolFlow *
2884 3430 : finalZoneSizing.DesCoolDens; // max of the user specified design cooling minimum flows and min OA flow [kg/s]
2885 3430 : if (MaxOfMinCoolVolFlow > finalZoneSizing.DesCoolVolFlow) {
2886 293 : finalZoneSizing.DesCoolVolFlow = MaxOfMinCoolVolFlow;
2887 293 : finalZoneSizing.DesCoolMassFlow = MaxOfMinCoolMassFlow;
2888 : }
2889 423766 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
2890 420336 : if (MaxOfMinCoolMassFlow > finalZoneSizing.CoolFlowSeq(TimeStepIndex)) {
2891 154476 : finalZoneSizing.CoolFlowSeq(TimeStepIndex) = MaxOfMinCoolMassFlow;
2892 : }
2893 : }
2894 10807 : for (DDNum = 1; DDNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++DDNum) {
2895 7377 : auto &zoneSizing = state.dataSize->ZoneSizing(DDNum, CtrlZoneNum);
2896 7377 : MaxOfMinCoolVolFlow = max(zoneSizing.DesCoolMinAirFlow, zoneSizing.DesCoolMinAirFlow, zoneSizing.MinOA);
2897 7377 : MaxOfMinCoolMassFlow = MaxOfMinCoolVolFlow * zoneSizing.DesCoolDens;
2898 7377 : if (MaxOfMinCoolVolFlow > zoneSizing.DesCoolVolFlow) {
2899 3688 : zoneSizing.DesCoolVolFlow = MaxOfMinCoolVolFlow;
2900 3688 : zoneSizing.DesCoolMassFlow = MaxOfMinCoolMassFlow;
2901 : }
2902 921537 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
2903 914160 : if (MaxOfMinCoolMassFlow > zoneSizing.CoolFlowSeq(TimeStepIndex)) {
2904 592186 : zoneSizing.CoolFlowSeq(TimeStepIndex) = MaxOfMinCoolMassFlow;
2905 : }
2906 : }
2907 : }
2908 : }
2909 : // IF cooling flow rate is 0, this data may be used to size a HP so initialize DDNum, TimeStepatPeak, and sizing data (end of IF)
2910 3430 : if (finalZoneSizing.DesCoolLoad == 0) {
2911 : // Check CoolDDNum and TimeStepNumAtCoolMax value and default to 1 if not set, carried over from previous code
2912 80 : if (calcFinalZoneSizing.CoolDDNum == 0) {
2913 0 : calcFinalZoneSizing.CoolDDNum = 1;
2914 : }
2915 80 : if (calcFinalZoneSizing.TimeStepNumAtCoolMax == 0) {
2916 0 : calcFinalZoneSizing.TimeStepNumAtCoolMax = 1;
2917 : }
2918 80 : finalZoneSizing.TimeStepNumAtCoolMax = calcFinalZoneSizing.TimeStepNumAtCoolMax;
2919 80 : finalZoneSizing.CoolDDNum = calcFinalZoneSizing.CoolDDNum;
2920 80 : finalZoneSizing.CoolDesDay = calcFinalZoneSizing.CoolDesDay;
2921 80 : DDNumF = finalZoneSizing.CoolDDNum;
2922 80 : auto &zoneSizingF = state.dataSize->ZoneSizing(DDNumF, CtrlZoneNum);
2923 80 : TimeStepAtPeakF = finalZoneSizing.TimeStepNumAtCoolMax;
2924 :
2925 : // initialize sizing conditions if they have not been set (i.e., no corresponding load) to zone condition
2926 : // issue 6006, heating coils sizing to 0 when no heating load in zone
2927 80 : if (zoneSizingF.DesCoolSetPtSeq.empty()) {
2928 0 : ShowSevereError(state,
2929 0 : std::string{RoutineName} +
2930 0 : ": Thermostat cooling set point temperatures are not initialized for Zone = " + finalZoneSizing.ZoneName);
2931 0 : ShowFatalError(state, "Please send your input file to the EnergyPlus support/development team for further investigation.");
2932 : } else {
2933 80 : finalZoneSizing.ZoneTempAtCoolPeak = *std::min_element(zoneSizingF.DesCoolSetPtSeq.begin(), zoneSizingF.DesCoolSetPtSeq.end());
2934 : }
2935 80 : finalZoneSizing.OutTempAtCoolPeak = *std::min_element(zoneSizingF.CoolOutTempSeq.begin(), zoneSizingF.CoolOutTempSeq.end());
2936 80 : finalZoneSizing.OutHumRatAtCoolPeak = zoneSizingF.CoolOutHumRatSeq(TimeStepAtPeakF);
2937 80 : finalZoneSizing.ZoneHumRatAtCoolPeak = zoneSizingF.CoolDesHumRat;
2938 80 : calcFinalZoneSizing.ZoneTempAtCoolPeak = zoneSizingF.CoolZoneTempSeq(TimeStepAtPeakF);
2939 80 : calcFinalZoneSizing.ZoneHumRatAtCoolPeak = zoneSizingF.CoolZoneHumRatSeq(TimeStepAtPeakF);
2940 80 : calcFinalZoneSizing.ZoneRetTempAtCoolPeak = calcFinalZoneSizing.ZoneTempAtCoolPeak;
2941 80 : finalZoneSizing.DesCoolCoilInTemp = finalZoneSizing.ZoneTempAtCoolPeak;
2942 80 : finalZoneSizing.DesCoolCoilInHumRat = finalZoneSizing.ZoneHumRatAtCoolPeak;
2943 80 : finalZoneSizing.ZoneRetTempAtCoolPeak = finalZoneSizing.ZoneTempAtCoolPeak;
2944 : }
2945 : // update non air system design load and air flow to include the sizing factor
2946 3430 : finalZoneSizing.NonAirSysDesHeatLoad *= finalZoneSizing.HeatSizingFactor;
2947 3430 : finalZoneSizing.NonAirSysDesHeatVolFlow *= finalZoneSizing.HeatSizingFactor;
2948 : // Now take into account the user specified sizing factor or user specified heating design air flow rate (which overrides the
2949 : // sizing factor)
2950 3430 : TotHeatSizMult = 0.0;
2951 : // Calculate a sizing factor from the user specified heating design air flow rate
2952 3430 : if (finalZoneSizing.InpDesHeatAirFlow > 0.0 && finalZoneSizing.HeatAirDesMethod == InpDesAirFlow &&
2953 0 : finalZoneSizing.DesHeatVolFlow > 0.0) {
2954 0 : TotHeatSizMult = (finalZoneSizing.InpDesHeatAirFlow / finalZoneSizing.DesHeatVolFlow) * finalZoneSizing.HeatSizingFactor;
2955 : // Calculate a sizing factor from the user specified max heating design air flow rates
2956 3430 : } else if (finalZoneSizing.HeatAirDesMethod == DesAirFlowWithLim && finalZoneSizing.DesHeatVolFlow > 0.0) {
2957 0 : MaxHeatVolFlow = max(finalZoneSizing.DesHeatMaxAirFlow,
2958 : finalZoneSizing.DesHeatMaxAirFlow2,
2959 0 : finalZoneSizing.DesCoolVolFlow * finalZoneSizing.DesHeatMaxAirFlowFrac);
2960 0 : if (MaxHeatVolFlow < finalZoneSizing.DesHeatVolFlow) {
2961 0 : TotHeatSizMult = (MaxHeatVolFlow / finalZoneSizing.DesHeatVolFlow) * finalZoneSizing.HeatSizingFactor;
2962 : } else {
2963 0 : TotHeatSizMult = finalZoneSizing.HeatSizingFactor;
2964 : }
2965 : // If no user specified heating design air flow rate input, use the user specified sizing factor
2966 : } else {
2967 3430 : TotHeatSizMult = finalZoneSizing.HeatSizingFactor;
2968 : }
2969 :
2970 3430 : if (std::abs(TotHeatSizMult - 1.0) > 0.00001) {
2971 2266 : if (finalZoneSizing.DesHeatVolFlow > 0.0) {
2972 2198 : auto &desDayWeath = state.dataSize->DesDayWeath(finalZoneSizing.HeatDDNum);
2973 2198 : finalZoneSizing.DesHeatVolFlow = calcFinalZoneSizing.DesHeatVolFlow * TotHeatSizMult;
2974 2198 : finalZoneSizing.DesHeatMassFlow = calcFinalZoneSizing.DesHeatMassFlow * TotHeatSizMult;
2975 2198 : finalZoneSizing.DesHeatLoad = calcFinalZoneSizing.DesHeatLoad * TotHeatSizMult;
2976 2198 : finalZoneSizing.HeatFlowSeq = calcFinalZoneSizing.HeatFlowSeq * TotHeatSizMult;
2977 2198 : finalZoneSizing.HeatLoadSeq = calcFinalZoneSizing.HeatLoadSeq * TotHeatSizMult;
2978 2198 : OAFrac = finalZoneSizing.MinOA / finalZoneSizing.DesHeatVolFlow;
2979 2198 : OAFrac = min(1.0, max(0.0, OAFrac));
2980 2198 : finalZoneSizing.DesHeatCoilInTemp =
2981 2198 : OAFrac * desDayWeath.Temp(finalZoneSizing.TimeStepNumAtHeatMax) + (1.0 - OAFrac) * finalZoneSizing.ZoneTempAtHeatPeak;
2982 2198 : finalZoneSizing.DesHeatCoilInHumRat =
2983 2198 : OAFrac * desDayWeath.HumRat(finalZoneSizing.TimeStepNumAtHeatMax) + (1.0 - OAFrac) * finalZoneSizing.ZoneHumRatAtHeatPeak;
2984 : } else {
2985 68 : finalZoneSizing.DesHeatVolFlow = finalZoneSizing.InpDesHeatAirFlow;
2986 68 : finalZoneSizing.DesHeatMassFlow = finalZoneSizing.DesHeatVolFlow * finalZoneSizing.DesHeatDens;
2987 : }
2988 6971 : for (DDNum = 1; DDNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++DDNum) {
2989 4705 : auto &zoneSizingDD = state.dataSize->ZoneSizing(DDNum, CtrlZoneNum);
2990 4705 : if (zoneSizingDD.DesHeatVolFlow > 0.0) {
2991 2261 : auto &calcZoneSizing = state.dataSize->CalcZoneSizing(DDNum, CtrlZoneNum);
2992 2261 : TimeStepAtPeak = zoneSizingDD.TimeStepNumAtHeatMax;
2993 2261 : zoneSizingDD.DesHeatVolFlow = calcZoneSizing.DesHeatVolFlow * TotHeatSizMult;
2994 2261 : zoneSizingDD.DesHeatMassFlow = calcZoneSizing.DesHeatMassFlow * TotHeatSizMult;
2995 2261 : zoneSizingDD.DesHeatLoad = calcZoneSizing.DesHeatLoad * TotHeatSizMult;
2996 2261 : zoneSizingDD.HeatFlowSeq = calcZoneSizing.HeatFlowSeq * TotHeatSizMult;
2997 2261 : zoneSizingDD.HeatLoadSeq = calcZoneSizing.HeatLoadSeq * TotHeatSizMult;
2998 2261 : OAFrac = zoneSizingDD.MinOA / zoneSizingDD.DesHeatVolFlow;
2999 2261 : OAFrac = min(1.0, max(0.0, OAFrac));
3000 2261 : zoneSizingDD.DesHeatCoilInTemp =
3001 2261 : OAFrac * state.dataSize->DesDayWeath(DDNum).Temp(TimeStepAtPeak) + (1.0 - OAFrac) * zoneSizingDD.ZoneTempAtHeatPeak;
3002 2261 : zoneSizingDD.DesHeatCoilInHumRat =
3003 2261 : OAFrac * state.dataSize->DesDayWeath(DDNum).HumRat(TimeStepAtPeak) + (1.0 - OAFrac) * zoneSizingDD.ZoneHumRatAtHeatPeak;
3004 : } else {
3005 2444 : zoneSizingDD.DesHeatVolFlow = zoneSizingDD.InpDesHeatAirFlow;
3006 2444 : zoneSizingDD.DesHeatMassFlow = zoneSizingDD.DesHeatVolFlow * zoneSizingDD.DesHeatDens;
3007 : }
3008 : // Save heating flows without MinOA for use later
3009 4705 : zoneSizingDD.HeatFlowSeqNoOA = zoneSizingDD.HeatFlowSeq;
3010 4705 : zoneSizingDD.DesHeatVolFlowNoOA = zoneSizingDD.DesHeatVolFlow;
3011 4705 : zoneSizingDD.DesHeatMassFlowNoOA = zoneSizingDD.DesHeatMassFlow;
3012 : }
3013 : }
3014 :
3015 : // Save a set of design heating air flow rates before the MinOA adjustment
3016 : // just in FinalZoneSizing to use for TermUnit sizing adjustments in SizingManager::UpdateTermUnitFinalZoneSizing
3017 3430 : finalZoneSizing.DesHeatVolFlowNoOA = finalZoneSizing.DesHeatVolFlow;
3018 3430 : finalZoneSizing.DesHeatMassFlowNoOA = finalZoneSizing.DesHeatMassFlow;
3019 423766 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
3020 420336 : finalZoneSizing.HeatFlowSeqNoOA(TimeStepIndex) = finalZoneSizing.HeatFlowSeq(TimeStepIndex);
3021 : }
3022 :
3023 : // Now make sure that the design heating air flow rates are greater than or equal to MinOA
3024 3430 : MinOAMass = finalZoneSizing.MinOA * finalZoneSizing.DesHeatDens;
3025 3430 : if (finalZoneSizing.MinOA > finalZoneSizing.DesHeatVolFlow) {
3026 1043 : finalZoneSizing.DesHeatVolFlow = finalZoneSizing.MinOA;
3027 1043 : finalZoneSizing.DesHeatMassFlow = MinOAMass;
3028 : }
3029 423766 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
3030 420336 : if (MinOAMass > finalZoneSizing.HeatFlowSeq(TimeStepIndex)) {
3031 136210 : finalZoneSizing.HeatFlowSeq(TimeStepIndex) = MinOAMass;
3032 : }
3033 : }
3034 10807 : for (DDNum = 1; DDNum <= state.dataEnvrn->TotDesDays + state.dataEnvrn->TotRunDesPersDays; ++DDNum) {
3035 7377 : auto &zoneSizingDD = state.dataSize->ZoneSizing(DDNum, CtrlZoneNum);
3036 7377 : MinOAMass = zoneSizingDD.MinOA * zoneSizingDD.DesHeatDens;
3037 7377 : if (zoneSizingDD.MinOA > zoneSizingDD.DesHeatVolFlow) {
3038 4797 : zoneSizingDD.DesHeatVolFlow = zoneSizingDD.MinOA;
3039 4797 : zoneSizingDD.DesHeatMassFlow = MinOAMass;
3040 : }
3041 921537 : for (TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) {
3042 914160 : if (MinOAMass > zoneSizingDD.HeatFlowSeq(TimeStepIndex)) {
3043 607466 : zoneSizingDD.HeatFlowSeq(TimeStepIndex) = MinOAMass;
3044 : }
3045 : }
3046 : }
3047 : // IF heating flow rate is 0, this data may be used to size a HP so initialize DDNum, TimeStepatPeak, and sizing data
3048 3430 : if (finalZoneSizing.DesHeatLoad == 0) {
3049 : // Check HDDNum and TimeStepNumAtHeatMax value and default to 1 if not set, carried over from previous code
3050 188 : if (calcFinalZoneSizing.HeatDDNum == 0) {
3051 4 : calcFinalZoneSizing.HeatDDNum = 1;
3052 : }
3053 188 : if (calcFinalZoneSizing.TimeStepNumAtHeatMax == 0) {
3054 0 : calcFinalZoneSizing.TimeStepNumAtHeatMax = 1;
3055 : }
3056 188 : finalZoneSizing.TimeStepNumAtHeatMax = calcFinalZoneSizing.TimeStepNumAtHeatMax;
3057 188 : finalZoneSizing.HeatDDNum = calcFinalZoneSizing.HeatDDNum;
3058 188 : finalZoneSizing.HeatDesDay = calcFinalZoneSizing.HeatDesDay;
3059 188 : DDNumF = finalZoneSizing.HeatDDNum;
3060 188 : auto &zoneSizingDDF = state.dataSize->ZoneSizing(DDNumF, CtrlZoneNum);
3061 188 : TimeStepAtPeakF = finalZoneSizing.TimeStepNumAtHeatMax;
3062 :
3063 : // initialize sizing conditions if they have not been set (i.e., no corresponding load) to zone condition
3064 : // issue 6006, heating coils sizing to 0 when no heating load in zone
3065 188 : if (zoneSizingDDF.DesHeatSetPtSeq.empty()) {
3066 0 : ShowSevereError(state,
3067 0 : format("{}: Thermostat heating set point temperatures not initialized for Zone = {}",
3068 : RoutineName,
3069 0 : finalZoneSizing.ZoneName));
3070 0 : ShowFatalError(state, "Please send your input file to the EnergyPlus support/development team for further investigation.");
3071 : } else {
3072 188 : finalZoneSizing.ZoneTempAtHeatPeak =
3073 188 : *std::max_element(zoneSizingDDF.DesHeatSetPtSeq.begin(), zoneSizingDDF.DesHeatSetPtSeq.end());
3074 : }
3075 188 : finalZoneSizing.OutTempAtHeatPeak = *std::min_element(zoneSizingDDF.HeatOutTempSeq.begin(), zoneSizingDDF.HeatOutTempSeq.end());
3076 188 : finalZoneSizing.OutHumRatAtHeatPeak = zoneSizingDDF.HeatOutHumRatSeq(TimeStepAtPeakF);
3077 188 : finalZoneSizing.ZoneHumRatAtHeatPeak = zoneSizingDDF.HeatDesHumRat;
3078 188 : calcFinalZoneSizing.ZoneTempAtHeatPeak = zoneSizingDDF.HeatZoneTempSeq(TimeStepAtPeakF);
3079 188 : calcFinalZoneSizing.ZoneHumRatAtHeatPeak = zoneSizingDDF.HeatZoneHumRatSeq(TimeStepAtPeakF);
3080 188 : calcFinalZoneSizing.ZoneRetTempAtHeatPeak = calcFinalZoneSizing.ZoneTempAtHeatPeak;
3081 188 : finalZoneSizing.DesHeatCoilInTemp = finalZoneSizing.ZoneTempAtHeatPeak;
3082 188 : finalZoneSizing.DesHeatCoilInHumRat = finalZoneSizing.ZoneHumRatAtHeatPeak;
3083 188 : finalZoneSizing.ZoneRetTempAtHeatPeak = finalZoneSizing.ZoneTempAtHeatPeak;
3084 : }
3085 :
3086 : // set the zone minimum cooling supply air flow rate. This will be used for autosizing VAV terminal unit
3087 : // minimum flow rates (comment seems incorrect, really used as a minimum lower limit for the maximum air flow)
3088 3430 : finalZoneSizing.DesCoolVolFlowMin = max(finalZoneSizing.DesCoolMinAirFlow,
3089 : finalZoneSizing.DesCoolMinAirFlow2,
3090 3430 : finalZoneSizing.DesCoolVolFlow * finalZoneSizing.DesCoolMinAirFlowFrac);
3091 : // set the zone maximum heating supply air flow rate. This will be used for autosizing VAV terminal unit
3092 : // max heating flow rates
3093 3430 : finalZoneSizing.DesHeatVolFlowMax =
3094 3430 : max(finalZoneSizing.DesHeatMaxAirFlow,
3095 : finalZoneSizing.DesHeatMaxAirFlow2,
3096 3430 : max(finalZoneSizing.DesCoolVolFlow, finalZoneSizing.DesHeatVolFlow) * finalZoneSizing.DesHeatMaxAirFlowFrac);
3097 : // Determine the design cooling supply air temperature if the supply air temperature difference is specified by user.
3098 3430 : if (finalZoneSizing.ZnCoolDgnSAMethod == TemperatureDifference) {
3099 0 : finalZoneSizing.CoolDesTemp = finalZoneSizing.ZoneTempAtCoolPeak - std::abs(finalZoneSizing.CoolDesTempDiff);
3100 : }
3101 : // Determine the design heating supply air temperature if the supply air temperature difference is specified by user.
3102 3430 : if (finalZoneSizing.ZnHeatDgnSAMethod == TemperatureDifference) {
3103 0 : finalZoneSizing.HeatDesTemp = finalZoneSizing.ZoneTempAtHeatPeak + std::abs(finalZoneSizing.HeatDesTempDiff);
3104 : }
3105 428 : }
3106 428 : } break;
3107 0 : default:
3108 0 : break;
3109 : }
3110 134847 : }
3111 :
3112 6050562 : void SimZoneEquipment(EnergyPlusData &state, bool const FirstHVACIteration, bool &SimAir)
3113 : {
3114 :
3115 : // SUBROUTINE INFORMATION:
3116 : // AUTHOR Russ Taylor
3117 : // DATE WRITTEN May 1997
3118 : // MODIFIED Raustad/Shirey, FSEC, June 2003
3119 : // MODIFIED Gu, FSEC, Jan. 2004, Don Shirey, Aug 2009 (LatOutputProvided)
3120 : // July 2012, Chandan Sharma - FSEC: Added zone sys avail managers
3121 :
3122 : // PURPOSE OF THIS SUBROUTINE:
3123 : // This subroutine is responsible for determining
3124 : // how much of each type of energy every zone requires.
3125 : // In effect, this subroutine defines and simulates all
3126 : // the system types and in the case of hybrid systems
3127 : // which use more than one type of energy must determine
3128 : // how to apportion the load. An example of a hybrid system
3129 : // is a water loop heat pump with supplemental air. In
3130 : // this case, a zone will require water from the loop and
3131 : // cooled or heated air from the air system. A simpler
3132 : // example would be a VAV system with baseboard heaters
3133 :
3134 : // METHODOLOGY EMPLOYED:
3135 : // 1. Determine zone load - this is zone temperature dependent
3136 : // 2. Determine balance point - the temperature at which the
3137 : // zone load is balanced by the system output. The way the
3138 : // balance point is determined will be different depending on
3139 : // the type of system being simulated.
3140 : // 3. Calculate zone energy requirements
3141 :
3142 6050562 : bool SupPathInletChanged(false);
3143 : Real64 SysOutputProvided; // sensible output delivered by zone equipment (W)
3144 : Real64 LatOutputProvided; // latent output delivered by zone equipment (kg/s)
3145 : Real64 AirSysOutput;
3146 : Real64 NonAirSysOutput;
3147 :
3148 : // Determine flow rate and temperature of supply air based on type of damper
3149 :
3150 6050562 : bool FirstCall = true; // indicates first call to supply air path components
3151 6050562 : bool ErrorFlag = false;
3152 :
3153 16500761 : for (int SupplyAirPathNum = 1; SupplyAirPathNum <= state.dataZoneEquip->NumSupplyAirPaths; ++SupplyAirPathNum) {
3154 :
3155 20936248 : for (int CompNum = 1; CompNum <= state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).NumOfComponents; ++CompNum) {
3156 :
3157 10486049 : switch (state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).ComponentTypeEnum(CompNum)) {
3158 10446465 : case DataZoneEquipment::AirLoopHVACZone::Splitter: { // 'AirLoopHVAC:ZoneSplitter'
3159 :
3160 10446465 : if (!(state.afn->AirflowNetworkFanActivated && state.afn->distribution_simulated)) {
3161 20307326 : SplitterComponent::SimAirLoopSplitter(state,
3162 10153663 : state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).ComponentName(CompNum),
3163 : FirstHVACIteration,
3164 : FirstCall,
3165 : SupPathInletChanged,
3166 10153663 : state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).ComponentIndex(CompNum));
3167 : }
3168 :
3169 10446465 : break;
3170 : }
3171 39584 : case DataZoneEquipment::AirLoopHVACZone::SupplyPlenum: { // 'AirLoopHVAC:SupplyPlenum'
3172 :
3173 118752 : ZonePlenum::SimAirZonePlenum(state,
3174 39584 : state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).ComponentName(CompNum),
3175 : DataZoneEquipment::AirLoopHVACZone::SupplyPlenum,
3176 39584 : state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).ComponentIndex(CompNum),
3177 : FirstHVACIteration,
3178 : FirstCall,
3179 : SupPathInletChanged);
3180 :
3181 39584 : break;
3182 : }
3183 0 : default: {
3184 0 : ShowSevereError(state, "Error found in Supply Air Path=" + state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).Name);
3185 0 : ShowContinueError(state,
3186 0 : "Invalid Supply Air Path Component=" + state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).ComponentType(CompNum));
3187 0 : ShowFatalError(state, "Preceding condition causes termination.");
3188 :
3189 0 : break;
3190 : }
3191 : }
3192 : }
3193 : }
3194 :
3195 6050562 : FirstCall = false;
3196 :
3197 : // Simulate all of the pools. These have a potential impact on surface heat balances, zone air heat balances, and moisture balances.
3198 : // These should be simulated first so that any systems or zone equipment devices deal with the effects of the pool properly.
3199 6050562 : SwimmingPool::SimSwimmingPool(state, FirstHVACIteration);
3200 :
3201 : // Loop over all the primary air loop; simulate their components (equipment)
3202 : // and controllers
3203 6050562 : if (state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance) {
3204 7403 : if (FirstHVACIteration) {
3205 3590 : CalcAirFlowSimple(state, 0);
3206 : } else {
3207 7626 : CalcAirFlowSimple(
3208 7626 : state, 0, state.dataHeatBal->ZoneAirMassFlow.AdjustZoneMixingFlow, state.dataHeatBal->ZoneAirMassFlow.AdjustZoneInfiltrationFlow);
3209 : }
3210 : }
3211 :
3212 50932872 : for (int ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) {
3213 :
3214 44882310 : if (!state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).IsControlled) continue;
3215 38185376 : auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ControlledZoneNum);
3216 :
3217 38185376 : thisZoneHB.NonAirSystemResponse = 0.0;
3218 38185376 : thisZoneHB.SysDepZoneLoads = 0.0;
3219 38185376 : auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum);
3220 38185376 : zoneEquipConfig.ZoneExh = 0.0;
3221 38185376 : zoneEquipConfig.ZoneExhBalanced = 0.0;
3222 38185376 : zoneEquipConfig.PlenumMassFlow = 0.0;
3223 38185376 : state.dataSize->CurZoneEqNum = ControlledZoneNum;
3224 :
3225 38185376 : InitSystemOutputRequired(state, ControlledZoneNum, FirstHVACIteration, true);
3226 :
3227 38185376 : auto &TurnFansOn = state.dataHVACGlobal->TurnFansOn;
3228 38185376 : auto &TurnFansOff = state.dataHVACGlobal->TurnFansOff;
3229 38185376 : auto &TurnZoneFansOnlyOn = state.dataHVACGlobal->TurnZoneFansOnlyOn;
3230 :
3231 : // Air loop system availability manager status only applies to PIU and exhaust fans
3232 : // Reset fan SAM operation flags for zone fans.
3233 38185376 : TurnFansOn = false;
3234 38185376 : TurnZoneFansOnlyOn = false;
3235 38185376 : TurnFansOff = false;
3236 :
3237 80924470 : for (int EquipTypeNum = 1; EquipTypeNum <= state.dataZoneEquip->ZoneEquipList(ControlledZoneNum).NumOfEquipTypes; ++EquipTypeNum) {
3238 :
3239 42739094 : state.dataHVACGlobal->UnbalExhMassFlow = 0.0;
3240 42739094 : state.dataHVACGlobal->BalancedExhMassFlow = 0.0;
3241 42739094 : state.dataHVACGlobal->PlenumInducedMassFlow = 0.0;
3242 42739094 : const int EquipPtr = state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipPtr;
3243 42739094 : SysOutputProvided = 0.0;
3244 42739094 : LatOutputProvided = 0.0;
3245 42739094 : state.dataSize->DataCoolCoilCap = 0.0; // reset global variable used only for heat pumps (i.e., DX cooling and heating coils)
3246 :
3247 : // Reset ZoneEqSizing data (because these may change from one equipment type to the next)
3248 42739094 : if (state.dataZoneEquipmentManager->FirstPassZoneEquipFlag) {
3249 4640 : auto &zoneEqSizing = state.dataSize->ZoneEqSizing(ControlledZoneNum);
3250 :
3251 4640 : zoneEqSizing.AirVolFlow = 0.0;
3252 4640 : zoneEqSizing.MaxHWVolFlow = 0.0;
3253 4640 : zoneEqSizing.MaxCWVolFlow = 0.0;
3254 4640 : zoneEqSizing.OAVolFlow = 0.0;
3255 4640 : zoneEqSizing.DesCoolingLoad = 0.0;
3256 4640 : zoneEqSizing.DesHeatingLoad = 0.0;
3257 4640 : zoneEqSizing.CoolingAirVolFlow = 0.0;
3258 4640 : zoneEqSizing.HeatingAirVolFlow = 0.0;
3259 4640 : zoneEqSizing.SystemAirVolFlow = 0.0;
3260 4640 : zoneEqSizing.AirFlow = false;
3261 4640 : zoneEqSizing.CoolingAirFlow = false;
3262 4640 : zoneEqSizing.HeatingAirFlow = false;
3263 4640 : zoneEqSizing.SystemAirFlow = false;
3264 4640 : zoneEqSizing.Capacity = false;
3265 4640 : zoneEqSizing.CoolingCapacity = false;
3266 4640 : zoneEqSizing.HeatingCapacity = false;
3267 4640 : zoneEqSizing.SystemCapacity = false;
3268 4640 : zoneEqSizing.DesignSizeFromParent = false;
3269 : }
3270 :
3271 42739094 : const int ZoneEquipTypeNum = state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipTypeEnum;
3272 :
3273 42739094 : auto &zoneEquipList = state.dataZoneEquip->ZoneEquipList(state.dataSize->CurZoneEqNum);
3274 :
3275 42739094 : const int ZoneCompNum = zoneEquipList.EquipIndex(EquipPtr);
3276 :
3277 42739094 : bool ValidSAMComp = false;
3278 :
3279 42739094 : if (ZoneEquipTypeNum <= NumValidSysAvailZoneComponents) ValidSAMComp = true;
3280 :
3281 42739094 : auto &ZoneComp = state.dataHVACGlobal->ZoneComp;
3282 :
3283 42739094 : if (ZoneCompNum > 0 && ValidSAMComp) {
3284 :
3285 5277063 : SystemAvailabilityManager::GetZoneEqAvailabilityManager(state, ZoneEquipTypeNum, ZoneCompNum, ErrorFlag);
3286 :
3287 10554126 : if (ZoneComp(ZoneEquipTypeNum).ZoneCompAvailMgrs(ZoneCompNum).AvailStatus == DataHVACGlobals::CycleOn) {
3288 5592 : state.dataHVACGlobal->ZoneCompTurnFansOn = true;
3289 5592 : state.dataHVACGlobal->ZoneCompTurnFansOff = false;
3290 5271471 : } else if (ZoneComp(ZoneEquipTypeNum).ZoneCompAvailMgrs(ZoneCompNum).AvailStatus == DataHVACGlobals::ForceOff) {
3291 2780 : state.dataHVACGlobal->ZoneCompTurnFansOn = false;
3292 2780 : state.dataHVACGlobal->ZoneCompTurnFansOff = true;
3293 : } else {
3294 5268691 : state.dataHVACGlobal->ZoneCompTurnFansOn = TurnFansOn;
3295 5268691 : state.dataHVACGlobal->ZoneCompTurnFansOff = TurnFansOff;
3296 : }
3297 : } else {
3298 37462031 : state.dataHVACGlobal->ZoneCompTurnFansOn = TurnFansOn;
3299 37462031 : state.dataHVACGlobal->ZoneCompTurnFansOff = TurnFansOff;
3300 : }
3301 :
3302 42739094 : switch (ZoneEquipTypeNum) {
3303 33630410 : case ZoneEquip::AirDistUnit: { // 'ZoneHVAC:AirDistributionUnit'
3304 : // Air loop system availability manager status only applies to PIU and exhaust fans
3305 : // Check to see if System Availability Managers are asking for fans to cycle on or shut off
3306 : // and set fan on/off flags accordingly.
3307 48783766 : if (state.dataZoneEquip->ZoneEquipAvail(ControlledZoneNum) == DataHVACGlobals::CycleOn ||
3308 15153356 : state.dataZoneEquip->ZoneEquipAvail(ControlledZoneNum) == DataHVACGlobals::CycleOnZoneFansOnly) {
3309 18477054 : TurnFansOn = true;
3310 : }
3311 33630410 : if (state.dataZoneEquip->ZoneEquipAvail(ControlledZoneNum) == DataHVACGlobals::CycleOnZoneFansOnly) {
3312 : // Currently used only by parallel powered induction unit
3313 0 : TurnZoneFansOnlyOn = true;
3314 : }
3315 33630410 : if (state.dataZoneEquip->ZoneEquipAvail(ControlledZoneNum) == DataHVACGlobals::ForceOff) {
3316 1733524 : TurnFansOff = true;
3317 : }
3318 :
3319 67260820 : ZoneAirLoopEquipmentManager::ManageZoneAirLoopEquipment(state,
3320 33630410 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3321 : FirstHVACIteration,
3322 : AirSysOutput,
3323 : NonAirSysOutput,
3324 : LatOutputProvided,
3325 : ControlledZoneNum,
3326 : zoneEquipList.EquipIndex(EquipPtr));
3327 :
3328 : // reset status flags for other zone equipment
3329 33630410 : TurnFansOn = false;
3330 33630410 : TurnZoneFansOnlyOn = false;
3331 33630410 : TurnFansOff = false;
3332 :
3333 33630410 : thisZoneHB.NonAirSystemResponse += NonAirSysOutput;
3334 33630410 : SysOutputProvided = NonAirSysOutput + AirSysOutput;
3335 33630410 : } break;
3336 224938 : case ZoneEquip::VRFTerminalUnit: { // 'ZoneHVAC:TerminalUnit:VariableRefrigerantFlow'
3337 224938 : bool HeatingActive = false;
3338 224938 : bool CoolingActive = false;
3339 224938 : int constexpr OAUnitNum = 0;
3340 224938 : Real64 constexpr OAUCoilOutTemp = 0.0;
3341 224938 : bool constexpr ZoneEquipment = true;
3342 449876 : HVACVariableRefrigerantFlow::SimulateVRF(state,
3343 224938 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3344 : FirstHVACIteration,
3345 : ControlledZoneNum,
3346 : zoneEquipList.EquipIndex(EquipPtr),
3347 : HeatingActive,
3348 : CoolingActive,
3349 : OAUnitNum,
3350 : OAUCoilOutTemp,
3351 : ZoneEquipment,
3352 : SysOutputProvided,
3353 224938 : LatOutputProvided);
3354 224938 : } break;
3355 139638 : case ZoneEquip::WindowAC: { // 'ZoneHVAC:WindowAirConditioner'
3356 279276 : WindowAC::SimWindowAC(state,
3357 139638 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3358 : ControlledZoneNum,
3359 : FirstHVACIteration,
3360 : SysOutputProvided,
3361 : LatOutputProvided,
3362 : zoneEquipList.EquipIndex(EquipPtr));
3363 139638 : } break;
3364 1253912 : case ZoneEquip::PkgTermHPAirToAir: // 'ZoneHVAC:PackagedTerminalHeatPump'
3365 : case ZoneEquip::PkgTermACAirToAir: // 'ZoneHVAC:PackagedTerminalAirConditioner'
3366 : case ZoneEquip::PkgTermHPWaterToAir: // 'ZoneHVAC:WaterToAirHeatPump'
3367 : case ZoneEquip::ZoneUnitarySys: { // 'AirloopHVAC:UnitarySystem'
3368 1253912 : int AirLoopNum = 0;
3369 1253912 : bool HeatingActive = false;
3370 1253912 : bool CoolingActive = false;
3371 1253912 : int OAUnitNum = 0;
3372 1253912 : Real64 OAUCoilOutTemp = 0.0;
3373 1253912 : bool ZoneEquipFlag = true;
3374 3761736 : zoneEquipList.compPointer[EquipPtr]->simulate(state,
3375 1253912 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3376 : FirstHVACIteration,
3377 : AirLoopNum,
3378 : zoneEquipList.EquipIndex(EquipPtr),
3379 : HeatingActive,
3380 : CoolingActive,
3381 : OAUnitNum,
3382 : OAUCoilOutTemp,
3383 : ZoneEquipFlag,
3384 : SysOutputProvided,
3385 2507824 : LatOutputProvided);
3386 1253912 : } break;
3387 112664 : case ZoneEquip::ZoneDXDehumidifier: { // 'ZoneHVAC:Dehumidifier:DX'
3388 225328 : ZoneDehumidifier::SimZoneDehumidifier(state,
3389 112664 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3390 : ControlledZoneNum,
3391 : FirstHVACIteration,
3392 : SysOutputProvided,
3393 : LatOutputProvided,
3394 : zoneEquipList.EquipIndex(EquipPtr));
3395 :
3396 112664 : thisZoneHB.SysDepZoneLoads += SysOutputProvided;
3397 :
3398 112664 : SysOutputProvided = 0.0; // Reset to 0.0 since this equipment is controlled based on zone humidity level (not
3399 : // temperature) SysOutputProvided amount was already sent above to
3400 : // next Predict-Correct series of calcs via SysDepZoneLoads
3401 112664 : } break;
3402 514191 : case ZoneEquip::FanCoil4Pipe: { // 'ZoneHVAC:FourPipeFanCoil'
3403 1028382 : FanCoilUnits::SimFanCoilUnit(state,
3404 514191 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3405 : ControlledZoneNum,
3406 : FirstHVACIteration,
3407 : SysOutputProvided,
3408 : LatOutputProvided,
3409 : zoneEquipList.EquipIndex(EquipPtr));
3410 514191 : } break;
3411 165565 : case ZoneEquip::UnitVentilator: { // 'ZoneHVAC:UnitVentilator'
3412 331130 : UnitVentilator::SimUnitVentilator(state,
3413 165565 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3414 : ControlledZoneNum,
3415 : FirstHVACIteration,
3416 : SysOutputProvided,
3417 : LatOutputProvided,
3418 : zoneEquipList.EquipIndex(EquipPtr));
3419 165565 : } break;
3420 638739 : case ZoneEquip::UnitHeater: { // 'ZoneHVAC:UnitHeater'
3421 1277478 : UnitHeater::SimUnitHeater(state,
3422 638739 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3423 : ControlledZoneNum,
3424 : FirstHVACIteration,
3425 : SysOutputProvided,
3426 : LatOutputProvided,
3427 : zoneEquipList.EquipIndex(EquipPtr));
3428 638739 : } break;
3429 1291226 : case ZoneEquip::PurchasedAir: { // 'ZoneHVAC:IdealLoadsAirSystem'
3430 2582452 : PurchasedAirManager::SimPurchasedAir(state,
3431 1291226 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3432 : SysOutputProvided,
3433 : LatOutputProvided,
3434 : FirstHVACIteration,
3435 : ControlledZoneNum,
3436 : zoneEquipList.EquipIndex(EquipPtr));
3437 1291226 : } break;
3438 89527 : case ZoneEquip::BBWater: { // 'ZoneHVAC:Baseboard:RadiantConvective:Water'
3439 179054 : HWBaseboardRadiator::SimHWBaseboard(state,
3440 89527 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3441 : ControlledZoneNum,
3442 : FirstHVACIteration,
3443 : SysOutputProvided,
3444 : zoneEquipList.EquipIndex(EquipPtr));
3445 :
3446 89527 : thisZoneHB.NonAirSystemResponse += SysOutputProvided;
3447 89527 : LatOutputProvided = 0.0; // This baseboard does not add/remove any latent heat
3448 89527 : } break;
3449 7420 : case ZoneEquip::BBSteam: { // 'ZoneHVAC:Baseboard:RadiantConvective:Steam'
3450 14840 : SteamBaseboardRadiator::SimSteamBaseboard(state,
3451 7420 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3452 : ControlledZoneNum,
3453 : FirstHVACIteration,
3454 : SysOutputProvided,
3455 : zoneEquipList.EquipIndex(EquipPtr));
3456 :
3457 7420 : thisZoneHB.NonAirSystemResponse += SysOutputProvided;
3458 7420 : LatOutputProvided = 0.0; // This baseboard does not add/remove any latent heat
3459 7420 : } break;
3460 170169 : case ZoneEquip::BBWaterConvective: { // 'ZoneHVAC:Baseboard:Convective:Water'
3461 340338 : BaseboardRadiator::SimBaseboard(state,
3462 170169 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3463 : ControlledZoneNum,
3464 : FirstHVACIteration,
3465 : SysOutputProvided,
3466 : zoneEquipList.EquipIndex(EquipPtr));
3467 :
3468 170169 : thisZoneHB.NonAirSystemResponse += SysOutputProvided;
3469 170169 : LatOutputProvided = 0.0; // This baseboard does not add/remove any latent heat
3470 170169 : } break;
3471 316599 : case ZoneEquip::BBElectricConvective: { // 'ZoneHVAC:Baseboard:Convective:Electric'
3472 633198 : BaseboardElectric::SimElectricBaseboard(state,
3473 316599 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3474 : ControlledZoneNum,
3475 : SysOutputProvided,
3476 : zoneEquipList.EquipIndex(EquipPtr));
3477 :
3478 316599 : thisZoneHB.NonAirSystemResponse += SysOutputProvided;
3479 316599 : LatOutputProvided = 0.0; // This baseboard does not add/remove any latent heat
3480 316599 : } break;
3481 22551 : case ZoneEquip::CoolingPanel: { // 'ZoneHVAC:CoolingPanel:RadiantConvective:Water'
3482 45102 : CoolingPanelSimple::SimCoolingPanel(state,
3483 22551 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3484 : ControlledZoneNum,
3485 : FirstHVACIteration,
3486 : SysOutputProvided,
3487 : zoneEquipList.EquipIndex(EquipPtr));
3488 :
3489 22551 : thisZoneHB.NonAirSystemResponse += SysOutputProvided;
3490 22551 : LatOutputProvided = 0.0; // This cooling panel does not add/remove any latent heat
3491 22551 : } break;
3492 128052 : case ZoneEquip::HiTempRadiant: { // 'ZoneHVAC:HighTemperatureRadiant'
3493 256104 : HighTempRadiantSystem::SimHighTempRadiantSystem(state,
3494 128052 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3495 : FirstHVACIteration,
3496 : SysOutputProvided,
3497 : zoneEquipList.EquipIndex(EquipPtr));
3498 128052 : LatOutputProvided = 0.0; // This baseboard currently sends its latent heat gain directly to predictor/corrector
3499 : // via SumLatentHTRadSys... so setting LatOutputProvided = 0.0
3500 128052 : } break;
3501 684904 : case ZoneEquip::LoTempRadiant: { // 'ZoneHVAC:LowTemperatureRadiant:VariableFlow',
3502 : // 'ZoneHVAC:LowTemperatureRadiant:ConstantFlow'
3503 : // 'ZoneHVAC:LowTemperatureRadiant:Electric'
3504 1369808 : LowTempRadiantSystem::SimLowTempRadiantSystem(state,
3505 684904 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3506 : FirstHVACIteration,
3507 : SysOutputProvided,
3508 : zoneEquipList.EquipIndex(EquipPtr));
3509 684904 : LatOutputProvided = 0.0; // This baseboard does not add/remove any latent heat
3510 684904 : } break;
3511 1632157 : case ZoneEquip::ZoneExhaustFan: { // 'Fan:ZoneExhaust'
3512 : // Air loop system availability manager status only applies to PIU and exhaust fans
3513 : // Check to see if System Availability Managers are asking for fans to cycle on or shut off
3514 : // and set fan on/off flags accordingly.
3515 2355144 : if (state.dataZoneEquip->ZoneEquipAvail(ControlledZoneNum) == DataHVACGlobals::CycleOn ||
3516 722987 : state.dataZoneEquip->ZoneEquipAvail(ControlledZoneNum) == DataHVACGlobals::CycleOnZoneFansOnly) {
3517 909170 : TurnFansOn = true;
3518 : }
3519 1632157 : if (state.dataZoneEquip->ZoneEquipAvail(ControlledZoneNum) == DataHVACGlobals::ForceOff) {
3520 49632 : TurnFansOff = true;
3521 : }
3522 :
3523 3264314 : Fans::SimulateFanComponents(state,
3524 1632157 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3525 : FirstHVACIteration,
3526 : zoneEquipList.EquipIndex(EquipPtr));
3527 :
3528 : // reset status flags for other zone equipment
3529 1632157 : TurnFansOn = false;
3530 1632157 : TurnFansOff = false;
3531 1632157 : } break;
3532 0 : case ZoneEquip::HeatXchngr: { // 'HeatExchanger:AirToAir:FlatPlate'
3533 0 : HeatRecovery::SimHeatRecovery(state,
3534 0 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3535 : FirstHVACIteration,
3536 : zoneEquipList.EquipIndex(EquipPtr),
3537 : DataHVACGlobals::ContFanCycCoil);
3538 0 : } break;
3539 758119 : case ZoneEquip::ERVStandAlone: { // 'ZoneHVAC:EnergyRecoveryVentilator'
3540 1516238 : HVACStandAloneERV::SimStandAloneERV(state,
3541 758119 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3542 : ControlledZoneNum,
3543 : FirstHVACIteration,
3544 : SysOutputProvided,
3545 : LatOutputProvided,
3546 : zoneEquipList.EquipIndex(EquipPtr));
3547 758119 : } break;
3548 256753 : case ZoneEquip::HPWaterHeater: { // 'WaterHeater:HeatPump:PumpedCondenser'
3549 513506 : WaterThermalTanks::SimHeatPumpWaterHeater(state,
3550 256753 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3551 : FirstHVACIteration,
3552 : SysOutputProvided,
3553 : LatOutputProvided,
3554 256753 : state.dataZoneEquip->ZoneEquipList(ControlledZoneNum).EquipIndex(EquipPtr));
3555 256753 : } break;
3556 106951 : case ZoneEquip::VentilatedSlab: { // 'ZoneHVAC:VentilatedSlab'
3557 213902 : VentilatedSlab::SimVentilatedSlab(state,
3558 106951 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3559 : ControlledZoneNum,
3560 : FirstHVACIteration,
3561 : SysOutputProvided,
3562 : LatOutputProvided,
3563 : zoneEquipList.EquipIndex(EquipPtr));
3564 106951 : } break;
3565 66066 : case ZoneEquip::OutdoorAirUnit: { // 'ZoneHVAC:OutdoorAirUnit'
3566 132132 : OutdoorAirUnit::SimOutdoorAirUnit(state,
3567 66066 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3568 : ControlledZoneNum,
3569 : FirstHVACIteration,
3570 : SysOutputProvided,
3571 : LatOutputProvided,
3572 : zoneEquipList.EquipIndex(EquipPtr));
3573 66066 : } break;
3574 9956 : case ZoneEquip::BBElectric: { // 'ZoneHVAC:Baseboard:RadiantConvective:Electric'
3575 19912 : ElectricBaseboardRadiator::SimElecBaseboard(state,
3576 9956 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3577 : ControlledZoneNum,
3578 : FirstHVACIteration,
3579 : SysOutputProvided,
3580 : zoneEquipList.EquipIndex(EquipPtr));
3581 :
3582 9956 : thisZoneHB.NonAirSystemResponse += SysOutputProvided;
3583 9956 : LatOutputProvided = 0.0; // This baseboard does not add/remove any latent heat
3584 9956 : } break;
3585 353160 : case ZoneEquip::RefrigerationAirChillerSet: { // 'ZoneHVAC:RefrigerationChillerSet'
3586 706320 : RefrigeratedCase::SimAirChillerSet(state,
3587 353160 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3588 : ControlledZoneNum,
3589 : FirstHVACIteration,
3590 : SysOutputProvided,
3591 : LatOutputProvided,
3592 : zoneEquipList.EquipIndex(EquipPtr));
3593 :
3594 353160 : thisZoneHB.NonAirSystemResponse += SysOutputProvided;
3595 353160 : } break;
3596 24690 : case ZoneEquip::UserDefinedZoneHVACForcedAir: {
3597 49380 : UserDefinedComponents::SimZoneAirUserDefined(state,
3598 24690 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3599 : ControlledZoneNum,
3600 : SysOutputProvided,
3601 : LatOutputProvided,
3602 : zoneEquipList.EquipIndex(EquipPtr));
3603 24690 : } break;
3604 127940 : case ZoneEquip::ZoneEvaporativeCoolerUnit: {
3605 255880 : EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(state,
3606 127940 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3607 : ControlledZoneNum,
3608 : SysOutputProvided,
3609 : LatOutputProvided,
3610 : zoneEquipList.EquipIndex(EquipPtr));
3611 127940 : } break;
3612 12797 : case ZoneEquip::ZoneHybridEvaporativeCooler: {
3613 25594 : HybridUnitaryAirConditioners::SimZoneHybridUnitaryAirConditioners(
3614 : state,
3615 12797 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum).EquipName,
3616 : ControlledZoneNum,
3617 : SysOutputProvided,
3618 : LatOutputProvided,
3619 : zoneEquipList.EquipIndex(EquipPtr));
3620 12797 : } break;
3621 0 : default:
3622 0 : break;
3623 : }
3624 :
3625 42739094 : zoneEquipConfig.ZoneExh +=
3626 85478188 : (state.dataHVACGlobal->UnbalExhMassFlow +
3627 42739094 : state.dataHVACGlobal->BalancedExhMassFlow); // This is the total "exhaust" flow from equipment such as a zone exhaust fan
3628 42739094 : zoneEquipConfig.ZoneExhBalanced += state.dataHVACGlobal->BalancedExhMassFlow;
3629 42739094 : zoneEquipConfig.PlenumMassFlow += state.dataHVACGlobal->PlenumInducedMassFlow;
3630 :
3631 : // Store available capacities for load distribution calculations
3632 42739094 : if (FirstHVACIteration && (zoneEquipList.LoadDistScheme != DataZoneEquipment::LoadDist::Sequential)) {
3633 23760 : if (SysOutputProvided > 0.0) {
3634 7577 : zoneEquipList.HeatingCapacity(EquipPtr) = SysOutputProvided;
3635 : } else {
3636 16183 : zoneEquipList.CoolingCapacity(EquipPtr) = SysOutputProvided;
3637 : }
3638 : }
3639 :
3640 42739094 : UpdateSystemOutputRequired(state, ControlledZoneNum, SysOutputProvided, LatOutputProvided, EquipTypeNum);
3641 42739094 : state.dataSize->CurTermUnitSizingNum = 0;
3642 : } // zone equipment loop
3643 38185376 : if (state.dataHeatBal->doSpaceHeatBalance) {
3644 36600 : for (int spaceNum : state.dataHeatBal->Zone(ControlledZoneNum).spaceIndexes) {
3645 : // SpaceHB ToDo: For now allocate by space volume frac
3646 18300 : state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum).NonAirSystemResponse =
3647 18300 : thisZoneHB.NonAirSystemResponse * state.dataHeatBal->space(spaceNum).fracZoneVolume;
3648 : }
3649 : }
3650 : } // End of controlled zone loop
3651 6050562 : state.dataSize->CurZoneEqNum = 0;
3652 6050562 : state.dataZoneEquipmentManager->FirstPassZoneEquipFlag = false;
3653 :
3654 : // This is the call to the Supply Air Path after the components are simulated to update
3655 : // the path inlets
3656 :
3657 : // Process supply air path components in reverse order
3658 16500761 : for (int SupplyAirPathNum = 1; SupplyAirPathNum <= state.dataZoneEquip->NumSupplyAirPaths; ++SupplyAirPathNum) {
3659 :
3660 10450199 : SupPathInletChanged = false;
3661 :
3662 20936248 : for (int CompNum = state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).NumOfComponents; CompNum >= 1; --CompNum) {
3663 10486049 : switch (state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).ComponentTypeEnum(CompNum)) {
3664 10446465 : case DataZoneEquipment::AirLoopHVACZone::Splitter: { // 'AirLoopHVAC:ZoneSplitter'
3665 10446465 : if (!(state.afn->AirflowNetworkFanActivated && state.afn->distribution_simulated)) {
3666 20307326 : SplitterComponent::SimAirLoopSplitter(state,
3667 10153663 : state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).ComponentName(CompNum),
3668 : FirstHVACIteration,
3669 : FirstCall,
3670 : SupPathInletChanged,
3671 10153663 : state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).ComponentIndex(CompNum));
3672 : }
3673 10446465 : } break;
3674 39584 : case DataZoneEquipment::AirLoopHVACZone::SupplyPlenum: { // 'AirLoopHVAC:SupplyPlenum'
3675 118752 : ZonePlenum::SimAirZonePlenum(state,
3676 39584 : state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).ComponentName(CompNum),
3677 : DataZoneEquipment::AirLoopHVACZone::SupplyPlenum,
3678 39584 : state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).ComponentIndex(CompNum),
3679 : FirstHVACIteration,
3680 : FirstCall,
3681 : SupPathInletChanged);
3682 :
3683 39584 : } break;
3684 0 : default: {
3685 0 : ShowSevereError(state, "Error found in Supply Air Path=" + state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).Name);
3686 0 : ShowContinueError(state,
3687 0 : "Invalid Supply Air Path Component=" + state.dataZoneEquip->SupplyAirPath(SupplyAirPathNum).ComponentType(CompNum));
3688 0 : ShowFatalError(state, "Preceding condition causes termination.");
3689 0 : } break;
3690 : }
3691 : }
3692 :
3693 10450199 : if (SupPathInletChanged) {
3694 : // If the supply air path inlet conditions have been changed, the Air Loop must be resimulated
3695 1981318 : SimAir = true;
3696 : }
3697 :
3698 : } // end of the Supply Air Path DO Loop
3699 :
3700 6050562 : ExhaustAirSystemManager::SimZoneHVACExhaustControls(state);
3701 :
3702 6050562 : ExhaustAirSystemManager::SimExhaustAirSystem(state, FirstHVACIteration);
3703 :
3704 6050562 : CalcZoneMassBalance(state, FirstHVACIteration);
3705 :
3706 6050562 : CalcZoneLeavingConditions(state, FirstHVACIteration);
3707 :
3708 6050562 : ReturnAirPathManager::SimReturnAirPath(state);
3709 6050562 : }
3710 :
3711 84918402 : void SetZoneEquipSimOrder(EnergyPlusData &state, int const ControlledZoneNum)
3712 : {
3713 :
3714 : // SUBROUTINE INFORMATION:
3715 : // AUTHOR Russ Taylor
3716 : // DATE WRITTEN May 1997
3717 :
3718 : // PURPOSE OF THIS SUBROUTINE:
3719 : // Set simulation priorities based on user specified priorities and
3720 : // required conditions (heating or cooling).
3721 :
3722 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
3723 : int CurEqHeatingPriority; // Used to make sure "optimization features" on compilers don't defeat purpose of this routine
3724 : int CurEqCoolingPriority; // Used to make sure "optimization features" on compilers don't defeat purpose of this routine
3725 :
3726 84918402 : auto &zeq(state.dataZoneEquip->ZoneEquipList(ControlledZoneNum));
3727 84918402 : int const NumOfEquipTypes(zeq.NumOfEquipTypes);
3728 180042601 : for (int EquipTypeNum = 1; EquipTypeNum <= NumOfEquipTypes; ++EquipTypeNum) {
3729 95124199 : auto &pso(state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum));
3730 95124199 : pso.EquipType = zeq.EquipType(EquipTypeNum);
3731 95124199 : pso.EquipName = zeq.EquipName(EquipTypeNum);
3732 95124199 : pso.EquipTypeEnum = zeq.EquipTypeEnum(EquipTypeNum);
3733 95124199 : pso.CoolingPriority = zeq.CoolingPriority(EquipTypeNum);
3734 95124199 : pso.HeatingPriority = zeq.HeatingPriority(EquipTypeNum);
3735 95124199 : pso.EquipPtr = EquipTypeNum;
3736 : }
3737 117331180 : for (int EquipTypeNum = NumOfEquipTypes + 1, EquipTypeNum_end = state.dataZoneEquipmentManager->PrioritySimOrder.u();
3738 117331180 : EquipTypeNum <= EquipTypeNum_end;
3739 : ++EquipTypeNum) { // Reset unused upper array portion
3740 32412778 : auto &pso(state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum));
3741 32412778 : pso.EquipType.clear();
3742 32412778 : pso.EquipName.clear();
3743 32412778 : pso.EquipTypeEnum = 0;
3744 32412778 : pso.EquipPtr = 0;
3745 : }
3746 :
3747 180042601 : for (int EquipTypeNum = 1; EquipTypeNum <= NumOfEquipTypes; ++EquipTypeNum) {
3748 95124199 : auto &pso(state.dataZoneEquipmentManager->PrioritySimOrder(EquipTypeNum));
3749 :
3750 95124199 : CurEqHeatingPriority = pso.HeatingPriority;
3751 95124199 : CurEqCoolingPriority = pso.CoolingPriority;
3752 :
3753 202512839 : for (int ComparedEquipTypeNum = EquipTypeNum; ComparedEquipTypeNum <= NumOfEquipTypes; ++ComparedEquipTypeNum) {
3754 107388640 : auto &psc(state.dataZoneEquipmentManager->PrioritySimOrder(ComparedEquipTypeNum));
3755 :
3756 216621089 : if ((CurEqCoolingPriority > psc.CoolingPriority &&
3757 215688395 : state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputRequired < 0.0) ||
3758 107483023 : (CurEqHeatingPriority > psc.HeatingPriority &&
3759 1509988 : state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ControlledZoneNum).RemainingOutputRequired >= 0.0)) {
3760 :
3761 : // Tuned C++ string swap avoids copying
3762 2326720 : pso.EquipType.swap(psc.EquipType);
3763 2326720 : pso.EquipName.swap(psc.EquipName);
3764 2326720 : std::swap(pso.EquipPtr, psc.EquipPtr);
3765 2326720 : std::swap(pso.EquipTypeEnum, psc.EquipTypeEnum);
3766 2326720 : std::swap(pso.CoolingPriority, psc.CoolingPriority);
3767 2326720 : std::swap(pso.HeatingPriority, psc.HeatingPriority);
3768 :
3769 2326720 : CurEqCoolingPriority = pso.CoolingPriority;
3770 2326720 : CurEqHeatingPriority = pso.HeatingPriority;
3771 : }
3772 : }
3773 : }
3774 84918402 : }
3775 :
3776 93469709 : void InitSystemOutputRequired(EnergyPlusData &state, int const ZoneNum, bool const FirstHVACIteration, bool const ResetSimOrder)
3777 : {
3778 :
3779 : // SUBROUTINE INFORMATION:
3780 : // AUTHOR Russ Taylor
3781 : // DATE WRITTEN May 1997
3782 : // MODIFIED Don Shirey, Aug 2009 (latent/moisture additions)
3783 :
3784 : // PURPOSE OF THIS SUBROUTINE:
3785 : // Initialize remaining output required variables
3786 :
3787 : // METHODOLOGY EMPLOYED:
3788 : // Initialize remaining output variables using predictor calculations
3789 280409127 : initOutputRequired(state,
3790 : ZoneNum,
3791 93469709 : state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum),
3792 93469709 : state.dataZoneEnergyDemand->ZoneSysMoistureDemand(ZoneNum),
3793 : FirstHVACIteration,
3794 : ResetSimOrder);
3795 : // SpaceHB TODO: This may need more work
3796 93469709 : if (state.dataHeatBal->doSpaceHeatBalance) {
3797 137680 : for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
3798 206520 : initOutputRequired(state,
3799 : ZoneNum,
3800 68840 : state.dataZoneEnergyDemand->spaceSysEnergyDemand(spaceNum),
3801 68840 : state.dataZoneEnergyDemand->spaceSysMoistureDemand(spaceNum),
3802 : FirstHVACIteration,
3803 : ResetSimOrder,
3804 : spaceNum);
3805 : }
3806 : }
3807 :
3808 93469709 : DistributeSystemOutputRequired(state, ZoneNum, FirstHVACIteration);
3809 93469709 : }
3810 :
3811 93538549 : void initOutputRequired(EnergyPlusData &state,
3812 : int const ZoneNum,
3813 : DataZoneEnergyDemands::ZoneSystemSensibleDemand &energy,
3814 : DataZoneEnergyDemands::ZoneSystemMoistureDemand &moisture,
3815 : bool const FirstHVACIteration,
3816 : bool const ResetSimOrder,
3817 : int spaceNum)
3818 : {
3819 93538549 : energy.RemainingOutputRequired = energy.TotalOutputRequired;
3820 93538549 : energy.UnadjRemainingOutputRequired = energy.TotalOutputRequired;
3821 93538549 : energy.RemainingOutputReqToHeatSP = energy.OutputRequiredToHeatingSP;
3822 93538549 : energy.UnadjRemainingOutputReqToHeatSP = energy.OutputRequiredToHeatingSP;
3823 93538549 : energy.RemainingOutputReqToCoolSP = energy.OutputRequiredToCoolingSP;
3824 93538549 : energy.UnadjRemainingOutputReqToCoolSP = energy.OutputRequiredToCoolingSP;
3825 :
3826 93538549 : moisture.RemainingOutputRequired = moisture.TotalOutputRequired;
3827 93538549 : moisture.UnadjRemainingOutputRequired = moisture.TotalOutputRequired;
3828 93538549 : moisture.RemainingOutputReqToHumidSP = moisture.OutputRequiredToHumidifyingSP;
3829 93538549 : moisture.UnadjRemainingOutputReqToHumidSP = moisture.OutputRequiredToHumidifyingSP;
3830 93538549 : moisture.RemainingOutputReqToDehumidSP = moisture.OutputRequiredToDehumidifyingSP;
3831 93538549 : moisture.UnadjRemainingOutputReqToDehumidSP = moisture.OutputRequiredToDehumidifyingSP;
3832 :
3833 93538549 : if (ResetSimOrder && spaceNum == 0) {
3834 84918402 : SetZoneEquipSimOrder(state, ZoneNum);
3835 : }
3836 :
3837 : // If one sequenced load is allocated, then all have been allocated in InitZoneEquipment
3838 93538549 : if (allocated(energy.SequencedOutputRequired)) {
3839 : // Check if controlled first, because if it's not, there is no zone equipment list
3840 93538549 : if (!state.dataHeatBal->Zone(ZoneNum).IsControlled || state.dataGlobal->ZoneSizingCalc) {
3841 : // init each sequenced demand to the full output
3842 17133711 : energy.SequencedOutputRequired = energy.TotalOutputRequired; // array assignment
3843 17133711 : energy.SequencedOutputRequiredToHeatingSP = energy.OutputRequiredToHeatingSP; // array assignment
3844 17133711 : energy.SequencedOutputRequiredToCoolingSP = energy.OutputRequiredToCoolingSP; // array assignment
3845 : // init each sequenced demand to the full output
3846 17133711 : moisture.SequencedOutputRequired = moisture.TotalOutputRequired; // array assignment
3847 17133711 : moisture.SequencedOutputRequiredToHumidSP = moisture.OutputRequiredToHumidifyingSP; // array assignment
3848 17133711 : moisture.SequencedOutputRequiredToDehumidSP = moisture.OutputRequiredToDehumidifyingSP; // array assignment
3849 76404838 : } else if (FirstHVACIteration) {
3850 30674048 : auto loadDistType = state.dataZoneEquip->ZoneEquipList(ZoneNum).LoadDistScheme;
3851 30674048 : if ((loadDistType == DataZoneEquipment::LoadDist::Sequential) || (loadDistType == DataZoneEquipment::LoadDist::Uniform)) {
3852 : // init each sequenced demand to the full output
3853 30658208 : energy.SequencedOutputRequired = energy.TotalOutputRequired; // array assignment
3854 30658208 : energy.SequencedOutputRequiredToHeatingSP = energy.OutputRequiredToHeatingSP; // array assignment
3855 30658208 : energy.SequencedOutputRequiredToCoolingSP = energy.OutputRequiredToCoolingSP; // array assignment
3856 : // init each sequenced demand to the full output
3857 30658208 : moisture.SequencedOutputRequired = moisture.TotalOutputRequired; // array assignment
3858 30658208 : moisture.SequencedOutputRequiredToHumidSP = moisture.OutputRequiredToHumidifyingSP; // array assignment
3859 30658208 : moisture.SequencedOutputRequiredToDehumidSP = moisture.OutputRequiredToDehumidifyingSP; // array assignment
3860 15840 : } else if ((loadDistType == DataZoneEquipment::LoadDist::UniformPLR) ||
3861 : (loadDistType == DataZoneEquipment::LoadDist::SequentialUniformPLR)) {
3862 : // init each sequenced demand to the zone design load in order to get available capacities from equipment
3863 : // SpaceHB TODO: This may need more work
3864 15840 : if (energy.TotalOutputRequired >= 0.0) {
3865 5416 : energy.SequencedOutputRequired = state.dataSize->FinalZoneSizing(ZoneNum).DesHeatLoad; // array assignment
3866 : } else {
3867 10424 : energy.SequencedOutputRequired = -state.dataSize->FinalZoneSizing(ZoneNum).DesCoolLoad; // array assignment
3868 : }
3869 15840 : if (energy.TotalOutputRequired >= 0.0) {
3870 5416 : energy.SequencedOutputRequiredToHeatingSP = state.dataSize->FinalZoneSizing(ZoneNum).DesHeatLoad; // array assignment
3871 : } else {
3872 10424 : energy.SequencedOutputRequiredToHeatingSP = -state.dataSize->FinalZoneSizing(ZoneNum).DesCoolLoad; // array assignment
3873 : }
3874 15840 : if (energy.TotalOutputRequired >= 0.0) {
3875 5416 : energy.SequencedOutputRequiredToCoolingSP = state.dataSize->FinalZoneSizing(ZoneNum).DesHeatLoad; // array assignment
3876 : } else {
3877 10424 : energy.SequencedOutputRequiredToCoolingSP = -state.dataSize->FinalZoneSizing(ZoneNum).DesCoolLoad; // array assignment
3878 : }
3879 : // init each sequenced moisture demand to the full output
3880 15840 : moisture.SequencedOutputRequired = moisture.TotalOutputRequired; // array assignment
3881 15840 : moisture.SequencedOutputRequiredToHumidSP = moisture.OutputRequiredToHumidifyingSP; // array assignment
3882 15840 : moisture.SequencedOutputRequiredToDehumidSP = moisture.OutputRequiredToDehumidifyingSP; // array assignment
3883 : }
3884 : } else {
3885 : // init first sequenced sensible demand to the full output
3886 45730790 : energy.SequencedOutputRequired(1) = energy.TotalOutputRequired;
3887 45730790 : energy.SequencedOutputRequiredToHeatingSP(1) = energy.OutputRequiredToHeatingSP;
3888 45730790 : energy.SequencedOutputRequiredToCoolingSP(1) = energy.OutputRequiredToCoolingSP;
3889 : // init first sequenced moisture demand to the full output
3890 45730790 : moisture.SequencedOutputRequired(1) = moisture.TotalOutputRequired;
3891 45730790 : moisture.SequencedOutputRequiredToHumidSP(1) = moisture.OutputRequiredToHumidifyingSP;
3892 45730790 : moisture.SequencedOutputRequiredToDehumidSP(1) = moisture.OutputRequiredToDehumidifyingSP;
3893 : }
3894 : }
3895 :
3896 93538549 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = state.dataZoneEnergyDemand->DeadBandOrSetback(ZoneNum);
3897 93538549 : }
3898 :
3899 93469709 : void DistributeSystemOutputRequired(EnergyPlusData &state, int const ZoneNum, bool const FirstHVACIteration)
3900 : {
3901 : // Distribute zone equipment loads according to load distribution scheme
3902 :
3903 : // Do nothing if this zone is uncontrolled or doing zone sizing
3904 93469709 : if (!state.dataHeatBal->Zone(ZoneNum).IsControlled) return;
3905 93469709 : if (state.dataGlobal->ZoneSizingCalc) return;
3906 :
3907 : // Do nothing on FirstHVACIteration if not UniformLoading and not SequentialLoading
3908 107016526 : if (FirstHVACIteration && (state.dataZoneEquip->ZoneEquipList(ZoneNum).LoadDistScheme != DataZoneEquipment::LoadDist::Uniform) &&
3909 30648288 : (state.dataZoneEquip->ZoneEquipList(ZoneNum).LoadDistScheme != DataZoneEquipment::LoadDist::Sequential)) {
3910 15840 : return;
3911 : }
3912 :
3913 152704796 : distributeOutputRequired(
3914 152704796 : state, ZoneNum, state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum), state.dataZoneEnergyDemand->ZoneSysMoistureDemand(ZoneNum));
3915 : // SpaceHB TODO: This may need more work
3916 76352398 : if (state.dataHeatBal->doSpaceHeatBalance) {
3917 73200 : for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
3918 73200 : distributeOutputRequired(state,
3919 : ZoneNum,
3920 36600 : state.dataZoneEnergyDemand->spaceSysEnergyDemand(spaceNum),
3921 36600 : state.dataZoneEnergyDemand->spaceSysMoistureDemand(spaceNum));
3922 : }
3923 : }
3924 : }
3925 :
3926 76388998 : void distributeOutputRequired(EnergyPlusData &state,
3927 : int const ZoneNum,
3928 : DataZoneEnergyDemands::ZoneSystemSensibleDemand &energy,
3929 : DataZoneEnergyDemands::ZoneSystemMoistureDemand &moisture)
3930 : {
3931 76388998 : auto &thisZEqList(state.dataZoneEquip->ZoneEquipList(ZoneNum));
3932 76388998 : Real64 heatLoadRatio = 1.0;
3933 76388998 : Real64 coolLoadRatio = 1.0;
3934 76388998 : Real64 availCap = 0.0;
3935 76388998 : Real64 plr = 1.0;
3936 76388998 : int numOperating = 0;
3937 :
3938 76388998 : switch (thisZEqList.LoadDistScheme) {
3939 76318198 : case DataZoneEquipment::LoadDist::Sequential:
3940 : // Nothing to do here for this case
3941 : {
3942 : // Set the load (with load fraction) for the first equipment in priority order
3943 76318198 : constexpr int priorityNum = 1;
3944 76318198 : const int &equipNum = state.dataZoneEquipmentManager->PrioritySimOrder(priorityNum).EquipPtr;
3945 :
3946 : // Determine whether we're heating or cooling and choose the appropriate fraction
3947 76318198 : const Real64 heatLoadRatio = thisZEqList.SequentialHeatingFraction(state, equipNum);
3948 76318198 : const Real64 coolLoadRatio = thisZEqList.SequentialCoolingFraction(state, equipNum);
3949 76318198 : const Real64 loadRatio = (energy.TotalOutputRequired >= 0.0) ? heatLoadRatio : coolLoadRatio;
3950 :
3951 : // Energy loads
3952 76318198 : energy.SequencedOutputRequired(priorityNum) = energy.TotalOutputRequired * loadRatio;
3953 76318198 : energy.SequencedOutputRequiredToHeatingSP(priorityNum) = energy.OutputRequiredToHeatingSP * loadRatio;
3954 76318198 : energy.SequencedOutputRequiredToCoolingSP(priorityNum) = energy.OutputRequiredToCoolingSP * loadRatio;
3955 76318198 : energy.RemainingOutputRequired = energy.SequencedOutputRequired(priorityNum);
3956 76318198 : energy.RemainingOutputReqToHeatSP = energy.SequencedOutputRequiredToHeatingSP(priorityNum);
3957 76318198 : energy.RemainingOutputReqToCoolSP = energy.SequencedOutputRequiredToCoolingSP(priorityNum);
3958 :
3959 : // Moisture loads
3960 76318198 : moisture.SequencedOutputRequired(priorityNum) = moisture.TotalOutputRequired * loadRatio;
3961 76318198 : moisture.SequencedOutputRequiredToHumidSP(priorityNum) = moisture.OutputRequiredToHumidifyingSP * loadRatio;
3962 76318198 : moisture.SequencedOutputRequiredToDehumidSP(priorityNum) = moisture.OutputRequiredToDehumidifyingSP * loadRatio;
3963 76318198 : moisture.RemainingOutputRequired = moisture.SequencedOutputRequired(priorityNum);
3964 76318198 : moisture.RemainingOutputReqToHumidSP = moisture.SequencedOutputRequiredToHumidSP(priorityNum);
3965 76318198 : moisture.RemainingOutputReqToDehumidSP = moisture.SequencedOutputRequiredToDehumidSP(priorityNum);
3966 :
3967 76318198 : break;
3968 : }
3969 15822 : case DataZoneEquipment::LoadDist::Uniform:
3970 : // Distribute load uniformly across all active equipment
3971 15822 : if (thisZEqList.NumAvailHeatEquip > 0) {
3972 15822 : heatLoadRatio = 1.0 / thisZEqList.NumAvailHeatEquip;
3973 : } else {
3974 0 : heatLoadRatio = 1.0;
3975 : }
3976 15822 : if (thisZEqList.NumAvailCoolEquip > 0) {
3977 15822 : coolLoadRatio = 1.0 / thisZEqList.NumAvailCoolEquip;
3978 : } else {
3979 0 : coolLoadRatio = 1.0;
3980 : }
3981 47466 : for (int equipNum = 1.0; equipNum <= thisZEqList.NumOfEquipTypes; ++equipNum) {
3982 31644 : if (energy.TotalOutputRequired >= 0.0) {
3983 10804 : if (thisZEqList.HeatingPriority(equipNum) > 0) {
3984 10804 : energy.SequencedOutputRequired(equipNum) = energy.TotalOutputRequired * heatLoadRatio;
3985 10804 : energy.SequencedOutputRequiredToHeatingSP(equipNum) = energy.OutputRequiredToHeatingSP * heatLoadRatio;
3986 10804 : energy.SequencedOutputRequiredToCoolingSP(equipNum) = energy.OutputRequiredToCoolingSP * heatLoadRatio;
3987 10804 : moisture.SequencedOutputRequired(equipNum) = moisture.TotalOutputRequired * heatLoadRatio;
3988 10804 : moisture.SequencedOutputRequiredToHumidSP(equipNum) = moisture.OutputRequiredToHumidifyingSP * heatLoadRatio;
3989 10804 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = moisture.OutputRequiredToDehumidifyingSP * heatLoadRatio;
3990 : } else {
3991 0 : energy.SequencedOutputRequired(equipNum) = 0.0;
3992 0 : energy.SequencedOutputRequiredToHeatingSP(equipNum) = 0.0;
3993 0 : energy.SequencedOutputRequiredToCoolingSP(equipNum) = 0.0;
3994 0 : moisture.SequencedOutputRequired(equipNum) = 0.0;
3995 0 : moisture.SequencedOutputRequiredToHumidSP(equipNum) = 0.0;
3996 0 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = 0.0;
3997 : }
3998 : } else {
3999 20840 : if (thisZEqList.CoolingPriority(equipNum) > 0) {
4000 20840 : energy.SequencedOutputRequired(equipNum) = energy.TotalOutputRequired * coolLoadRatio;
4001 20840 : energy.SequencedOutputRequiredToHeatingSP(equipNum) = energy.OutputRequiredToHeatingSP * coolLoadRatio;
4002 20840 : energy.SequencedOutputRequiredToCoolingSP(equipNum) = energy.OutputRequiredToCoolingSP * coolLoadRatio;
4003 20840 : moisture.SequencedOutputRequired(equipNum) = moisture.TotalOutputRequired * coolLoadRatio;
4004 20840 : moisture.SequencedOutputRequiredToHumidSP(equipNum) = moisture.OutputRequiredToHumidifyingSP * coolLoadRatio;
4005 20840 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = moisture.OutputRequiredToDehumidifyingSP * coolLoadRatio;
4006 : } else {
4007 0 : energy.SequencedOutputRequired(equipNum) = 0.0;
4008 0 : energy.SequencedOutputRequiredToHeatingSP(equipNum) = 0.0;
4009 0 : energy.SequencedOutputRequiredToCoolingSP(equipNum) = 0.0;
4010 0 : moisture.SequencedOutputRequired(equipNum) = 0.0;
4011 0 : moisture.SequencedOutputRequiredToHumidSP(equipNum) = 0.0;
4012 0 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = 0.0;
4013 : }
4014 : }
4015 15822 : }
4016 15822 : break;
4017 23538 : case DataZoneEquipment::LoadDist::UniformPLR:
4018 : // Distribute load at uniform PLR across all active equipment
4019 23538 : if (energy.TotalOutputRequired >= 0.0) {
4020 23742 : for (int equipNum = 1.0; equipNum <= thisZEqList.NumOfEquipTypes; ++equipNum) {
4021 15828 : if (thisZEqList.HeatingPriority(equipNum) > 0) availCap += thisZEqList.HeatingCapacity(equipNum);
4022 : }
4023 7914 : if (availCap > 0.0) {
4024 7880 : plr = energy.TotalOutputRequired / availCap;
4025 : } else {
4026 34 : plr = 0.0;
4027 : }
4028 : } else {
4029 46872 : for (int equipNum = 1.0; equipNum <= thisZEqList.NumOfEquipTypes; ++equipNum) {
4030 31248 : if (thisZEqList.CoolingPriority(equipNum) > 0) availCap += thisZEqList.CoolingCapacity(equipNum);
4031 : }
4032 15624 : if (availCap < 0.0) {
4033 15624 : plr = energy.TotalOutputRequired / availCap;
4034 : } else {
4035 0 : plr = 0.0;
4036 : }
4037 : }
4038 23538 : if (plr <= 0.0) break; // Don't change anything
4039 69588 : for (int equipNum = 1.0; equipNum <= thisZEqList.NumOfEquipTypes; ++equipNum) {
4040 46392 : if (energy.TotalOutputRequired >= 0.0) {
4041 15144 : if (thisZEqList.HeatingPriority(equipNum) > 0) {
4042 15144 : energy.SequencedOutputRequired(equipNum) = thisZEqList.HeatingCapacity(equipNum) * plr;
4043 15144 : energy.SequencedOutputRequiredToHeatingSP(equipNum) = thisZEqList.HeatingCapacity(equipNum) * plr;
4044 15144 : energy.SequencedOutputRequiredToCoolingSP(equipNum) = thisZEqList.HeatingCapacity(equipNum) * plr;
4045 15144 : if (energy.OutputRequiredToHeatingSP != 0.0) {
4046 15144 : moisture.SequencedOutputRequired(equipNum) =
4047 15144 : moisture.TotalOutputRequired * (thisZEqList.HeatingCapacity(equipNum) * plr) / energy.OutputRequiredToHeatingSP;
4048 15144 : moisture.SequencedOutputRequiredToHumidSP(equipNum) =
4049 15144 : moisture.OutputRequiredToHumidifyingSP * (thisZEqList.HeatingCapacity(equipNum) * plr) / energy.OutputRequiredToHeatingSP;
4050 : } else {
4051 0 : moisture.SequencedOutputRequired(equipNum) = moisture.TotalOutputRequired * plr;
4052 0 : moisture.SequencedOutputRequiredToHumidSP(equipNum) = moisture.OutputRequiredToHumidifyingSP * plr;
4053 : }
4054 15144 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = 0.0;
4055 : } else {
4056 0 : energy.SequencedOutputRequired(equipNum) = 0.0;
4057 0 : energy.SequencedOutputRequiredToHeatingSP(equipNum) = 0.0;
4058 0 : energy.SequencedOutputRequiredToCoolingSP(equipNum) = 0.0;
4059 0 : moisture.SequencedOutputRequired(equipNum) = 0.0;
4060 0 : moisture.SequencedOutputRequiredToHumidSP(equipNum) = 0.0;
4061 0 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = 0.0;
4062 : }
4063 : } else {
4064 31248 : if (thisZEqList.CoolingPriority(equipNum) > 0) {
4065 31248 : energy.SequencedOutputRequired(equipNum) = thisZEqList.CoolingCapacity(equipNum) * plr;
4066 31248 : energy.SequencedOutputRequiredToHeatingSP(equipNum) = thisZEqList.CoolingCapacity(equipNum) * plr;
4067 31248 : energy.SequencedOutputRequiredToCoolingSP(equipNum) = thisZEqList.CoolingCapacity(equipNum) * plr;
4068 31248 : if (energy.OutputRequiredToCoolingSP != 0.0) {
4069 31248 : moisture.SequencedOutputRequired(equipNum) =
4070 31248 : moisture.TotalOutputRequired * (thisZEqList.CoolingCapacity(equipNum) * plr) / energy.OutputRequiredToCoolingSP;
4071 93744 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = moisture.OutputRequiredToDehumidifyingSP *
4072 62496 : (thisZEqList.CoolingCapacity(equipNum) * plr) /
4073 31248 : energy.OutputRequiredToCoolingSP;
4074 : } else {
4075 0 : moisture.SequencedOutputRequired(equipNum) = moisture.TotalOutputRequired * plr;
4076 0 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = moisture.OutputRequiredToDehumidifyingSP * plr;
4077 : }
4078 31248 : moisture.SequencedOutputRequiredToHumidSP(equipNum) = 0.0;
4079 : } else {
4080 0 : energy.SequencedOutputRequired(equipNum) = 0.0;
4081 0 : energy.SequencedOutputRequiredToHeatingSP(equipNum) = 0.0;
4082 0 : energy.SequencedOutputRequiredToCoolingSP(equipNum) = 0.0;
4083 0 : moisture.SequencedOutputRequired(equipNum) = 0.0;
4084 0 : moisture.SequencedOutputRequiredToHumidSP(equipNum) = 0.0;
4085 0 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = 0.0;
4086 : }
4087 : }
4088 23196 : }
4089 23196 : break;
4090 31440 : case DataZoneEquipment::LoadDist::SequentialUniformPLR:
4091 : // Determine how many pieces of equipment are required to meet the current load,
4092 : // then distribute load at uniform PLR across all active equipment
4093 31440 : if (energy.TotalOutputRequired >= 0.0) {
4094 : // For heating capacities and TotalOutputRequired are positive
4095 31824 : for (int equipNum = 1.0; equipNum <= thisZEqList.NumOfEquipTypes; ++equipNum) {
4096 21216 : if ((thisZEqList.HeatingCapacity(equipNum) > 0.0) && (availCap < energy.TotalOutputRequired)) {
4097 19208 : if (thisZEqList.HeatingPriority(equipNum) > 0) availCap += thisZEqList.HeatingCapacity(equipNum);
4098 19208 : ++numOperating;
4099 : }
4100 : }
4101 10608 : if (availCap > 0.0) {
4102 10096 : plr = energy.TotalOutputRequired / availCap;
4103 : } else {
4104 512 : plr = 0.0;
4105 512 : numOperating = 0;
4106 : }
4107 : } else {
4108 62496 : for (int equipNum = 1.0; equipNum <= thisZEqList.NumOfEquipTypes; ++equipNum) {
4109 : // For cooling capacities and TotalOutputRequired are negative
4110 41664 : if ((thisZEqList.CoolingCapacity(equipNum) < 0.0) && (availCap > energy.TotalOutputRequired)) {
4111 26416 : if (thisZEqList.CoolingPriority(equipNum) > 0) availCap += thisZEqList.CoolingCapacity(equipNum);
4112 26416 : ++numOperating;
4113 : }
4114 : }
4115 20832 : if (availCap < 0.0) {
4116 20832 : plr = energy.TotalOutputRequired / availCap;
4117 : } else {
4118 0 : plr = 0.0;
4119 0 : numOperating = 0;
4120 : }
4121 : }
4122 31440 : if (plr <= 0.0) break; // Don't change anything
4123 : // Set loads for operating equipment
4124 76552 : for (int equipNum = 1.0; equipNum <= numOperating; ++equipNum) {
4125 45624 : if (energy.TotalOutputRequired >= 0.0) {
4126 19208 : if (thisZEqList.HeatingPriority(equipNum) > 0) {
4127 19208 : energy.SequencedOutputRequired(equipNum) = thisZEqList.HeatingCapacity(equipNum) * plr;
4128 19208 : energy.SequencedOutputRequiredToHeatingSP(equipNum) = thisZEqList.HeatingCapacity(equipNum) * plr;
4129 19208 : energy.SequencedOutputRequiredToCoolingSP(equipNum) = thisZEqList.HeatingCapacity(equipNum) * plr;
4130 19208 : if (energy.OutputRequiredToHeatingSP != 0.0) {
4131 19208 : moisture.SequencedOutputRequired(equipNum) =
4132 19208 : moisture.TotalOutputRequired * (thisZEqList.HeatingCapacity(equipNum) * plr) / energy.OutputRequiredToHeatingSP;
4133 19208 : moisture.SequencedOutputRequiredToHumidSP(equipNum) =
4134 19208 : moisture.OutputRequiredToHumidifyingSP * (thisZEqList.HeatingCapacity(equipNum) * plr) / energy.OutputRequiredToHeatingSP;
4135 : } else {
4136 0 : moisture.SequencedOutputRequired(equipNum) = moisture.TotalOutputRequired * plr;
4137 0 : moisture.SequencedOutputRequiredToHumidSP(equipNum) = moisture.OutputRequiredToHumidifyingSP * plr;
4138 : }
4139 19208 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = 0.0;
4140 : } else {
4141 0 : energy.SequencedOutputRequired(equipNum) = 0.0;
4142 0 : energy.SequencedOutputRequiredToHeatingSP(equipNum) = 0.0;
4143 0 : energy.SequencedOutputRequiredToCoolingSP(equipNum) = 0.0;
4144 0 : moisture.SequencedOutputRequired(equipNum) = 0.0;
4145 0 : moisture.SequencedOutputRequiredToHumidSP(equipNum) = 0.0;
4146 0 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = 0.0;
4147 : }
4148 : } else {
4149 26416 : if (thisZEqList.CoolingPriority(equipNum) > 0) {
4150 26416 : energy.SequencedOutputRequired(equipNum) = thisZEqList.CoolingCapacity(equipNum) * plr;
4151 26416 : energy.SequencedOutputRequiredToHeatingSP(equipNum) = thisZEqList.CoolingCapacity(equipNum) * plr;
4152 26416 : energy.SequencedOutputRequiredToCoolingSP(equipNum) = thisZEqList.CoolingCapacity(equipNum) * plr;
4153 26416 : if (energy.OutputRequiredToCoolingSP != 0.0) {
4154 26416 : moisture.SequencedOutputRequired(equipNum) =
4155 26416 : moisture.TotalOutputRequired * (thisZEqList.CoolingCapacity(equipNum) * plr) / energy.OutputRequiredToCoolingSP;
4156 79248 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = moisture.OutputRequiredToDehumidifyingSP *
4157 52832 : (thisZEqList.CoolingCapacity(equipNum) * plr) /
4158 26416 : energy.OutputRequiredToCoolingSP;
4159 : } else {
4160 0 : moisture.SequencedOutputRequired(equipNum) = moisture.TotalOutputRequired * plr;
4161 0 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = moisture.OutputRequiredToDehumidifyingSP * plr;
4162 : }
4163 26416 : moisture.SequencedOutputRequiredToHumidSP(equipNum) = 0.0;
4164 : } else {
4165 0 : energy.SequencedOutputRequired(equipNum) = 0.0;
4166 0 : energy.SequencedOutputRequiredToHeatingSP(equipNum) = 0.0;
4167 0 : energy.SequencedOutputRequiredToCoolingSP(equipNum) = 0.0;
4168 0 : moisture.SequencedOutputRequired(equipNum) = 0.0;
4169 0 : moisture.SequencedOutputRequiredToHumidSP(equipNum) = 0.0;
4170 0 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = 0.0;
4171 : }
4172 : }
4173 30928 : }
4174 : // Set loads to zero for remaining equipment
4175 47160 : for (int equipNum = numOperating + 1; equipNum <= thisZEqList.NumOfEquipTypes; ++equipNum) {
4176 16232 : energy.SequencedOutputRequired(equipNum) = 0.0;
4177 16232 : energy.SequencedOutputRequiredToHeatingSP(equipNum) = 0.0;
4178 16232 : energy.SequencedOutputRequiredToCoolingSP(equipNum) = 0.0;
4179 16232 : moisture.SequencedOutputRequired(equipNum) = 0.0;
4180 16232 : moisture.SequencedOutputRequiredToHumidSP(equipNum) = 0.0;
4181 16232 : moisture.SequencedOutputRequiredToDehumidSP(equipNum) = 0.0;
4182 30928 : }
4183 30928 : break;
4184 0 : default:
4185 0 : ShowFatalError(state, "DistributeSystemOutputRequired: Illegal load distribution scheme type.");
4186 0 : break;
4187 : }
4188 : // For every load distribution scheme except SequentialLoad
4189 : // set the remaining loads to the first equipment type's load to support equipment types that don't use the sequenced loads
4190 76388998 : if (thisZEqList.LoadDistScheme != DataZoneEquipment::LoadDist::Sequential) {
4191 70800 : energy.RemainingOutputRequired = energy.SequencedOutputRequired(1);
4192 70800 : moisture.RemainingOutputRequired = moisture.SequencedOutputRequired(1);
4193 70800 : energy.RemainingOutputReqToHeatSP = energy.SequencedOutputRequiredToHeatingSP(1);
4194 70800 : moisture.RemainingOutputReqToHumidSP = moisture.SequencedOutputRequiredToHumidSP(1);
4195 70800 : energy.RemainingOutputReqToCoolSP = energy.SequencedOutputRequiredToCoolingSP(1);
4196 70800 : moisture.RemainingOutputReqToDehumidSP = moisture.SequencedOutputRequiredToDehumidSP(1);
4197 : }
4198 76388998 : }
4199 :
4200 51466625 : void UpdateSystemOutputRequired(EnergyPlusData &state,
4201 : int const ZoneNum,
4202 : Real64 const SysOutputProvided, // sensible output provided by zone equipment (W)
4203 : Real64 const LatOutputProvided, // latent output provided by zone equipment (kg/s)
4204 : Optional_int_const EquipPriorityNum // index in PrioritySimOrder for this update
4205 : )
4206 : {
4207 :
4208 : // SUBROUTINE INFORMATION:
4209 : // AUTHOR Russ Taylor
4210 : // DATE WRITTEN Unknown
4211 : // MODIFIED B. Griffith Sept 2011, add storage of requirements by sequence
4212 :
4213 51466625 : auto &energy(state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum));
4214 51466625 : auto &moisture(state.dataZoneEnergyDemand->ZoneSysMoistureDemand(ZoneNum));
4215 :
4216 : // If zone is uncontrolled use original method for remaining output
4217 51466625 : if (!state.dataHeatBal->Zone(ZoneNum).IsControlled) {
4218 : // SequentialLoading, use original method for remaining output
4219 0 : energy.UnadjRemainingOutputRequired -= SysOutputProvided;
4220 0 : energy.RemainingOutputRequired = energy.UnadjRemainingOutputRequired;
4221 0 : energy.UnadjRemainingOutputReqToHeatSP -= SysOutputProvided;
4222 0 : energy.RemainingOutputReqToHeatSP = energy.UnadjRemainingOutputReqToHeatSP;
4223 0 : energy.UnadjRemainingOutputReqToCoolSP -= SysOutputProvided;
4224 0 : energy.RemainingOutputReqToCoolSP = energy.UnadjRemainingOutputReqToCoolSP;
4225 : // Latent output updates
4226 0 : moisture.UnadjRemainingOutputRequired -= LatOutputProvided;
4227 0 : moisture.RemainingOutputRequired = moisture.UnadjRemainingOutputRequired;
4228 0 : moisture.UnadjRemainingOutputReqToHumidSP -= LatOutputProvided;
4229 0 : moisture.RemainingOutputReqToHumidSP = moisture.UnadjRemainingOutputReqToHumidSP;
4230 0 : moisture.UnadjRemainingOutputReqToDehumidSP -= LatOutputProvided;
4231 0 : moisture.RemainingOutputReqToDehumidSP = moisture.UnadjRemainingOutputReqToDehumidSP;
4232 :
4233 : // re-evaluate if loads are now such that in dead band or set back
4234 0 : switch (state.dataHeatBalFanSys->TempControlType(ZoneNum)) {
4235 0 : case DataHVACGlobals::ThermostatType::Uncontrolled:
4236 : // uncontrolled zone; shouldn't ever get here, but who knows
4237 0 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false;
4238 0 : break;
4239 0 : case DataHVACGlobals::ThermostatType::SingleHeating:
4240 0 : if ((energy.RemainingOutputRequired - 1.0) < 0.0) {
4241 0 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true;
4242 : } else {
4243 0 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false;
4244 : }
4245 0 : break;
4246 0 : case DataHVACGlobals::ThermostatType::SingleCooling:
4247 0 : if ((energy.RemainingOutputRequired + 1.0) > 0.0) {
4248 0 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true;
4249 : } else {
4250 0 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false;
4251 : }
4252 0 : break;
4253 0 : case DataHVACGlobals::ThermostatType::SingleHeatCool:
4254 0 : if (energy.RemainingOutputReqToHeatSP < 0.0 && energy.RemainingOutputReqToCoolSP > 0.0) {
4255 0 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true;
4256 : } else {
4257 0 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false;
4258 : }
4259 0 : break;
4260 0 : case DataHVACGlobals::ThermostatType::DualSetPointWithDeadBand:
4261 0 : if (energy.RemainingOutputReqToHeatSP < 0.0 && energy.RemainingOutputReqToCoolSP > 0.0) {
4262 0 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true;
4263 : } else {
4264 0 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false;
4265 : }
4266 0 : break;
4267 0 : default:
4268 0 : break;
4269 : }
4270 :
4271 0 : if (present(EquipPriorityNum)) {
4272 : // now store remaining load at the by sequence level
4273 0 : if (EquipPriorityNum + 1 <= energy.NumZoneEquipment) {
4274 0 : energy.SequencedOutputRequired(EquipPriorityNum + 1) = energy.RemainingOutputRequired;
4275 0 : moisture.SequencedOutputRequired(EquipPriorityNum + 1) = moisture.RemainingOutputRequired;
4276 : }
4277 :
4278 0 : if (state.dataZoneEquipmentManager->PrioritySimOrder(EquipPriorityNum).HeatingPriority + 1 <= energy.NumZoneEquipment) {
4279 0 : energy.SequencedOutputRequiredToHeatingSP(state.dataZoneEquipmentManager->PrioritySimOrder(EquipPriorityNum).HeatingPriority + 1) =
4280 0 : energy.RemainingOutputReqToHeatSP;
4281 0 : moisture.SequencedOutputRequiredToHumidSP(state.dataZoneEquipmentManager->PrioritySimOrder(EquipPriorityNum).HeatingPriority + 1) =
4282 0 : moisture.RemainingOutputReqToHumidSP;
4283 : }
4284 0 : if (state.dataZoneEquipmentManager->PrioritySimOrder(EquipPriorityNum).CoolingPriority + 1 <= energy.NumZoneEquipment) {
4285 0 : energy.SequencedOutputRequiredToCoolingSP(state.dataZoneEquipmentManager->PrioritySimOrder(EquipPriorityNum).CoolingPriority + 1) =
4286 0 : energy.RemainingOutputReqToCoolSP;
4287 0 : moisture.SequencedOutputRequiredToDehumidSP(state.dataZoneEquipmentManager->PrioritySimOrder(EquipPriorityNum).CoolingPriority + 1) =
4288 0 : moisture.RemainingOutputReqToDehumidSP;
4289 : }
4290 : }
4291 0 : return;
4292 : }
4293 :
4294 : // Sensible output updates
4295 51466625 : auto &thisZEqList(state.dataZoneEquip->ZoneEquipList(ZoneNum));
4296 51466625 : switch (thisZEqList.LoadDistScheme) {
4297 51368081 : case DataZoneEquipment::LoadDist::Sequential: {
4298 : // Subtract the system output from the unadjusted loads required
4299 51368081 : energy.UnadjRemainingOutputRequired -= SysOutputProvided;
4300 51368081 : energy.UnadjRemainingOutputReqToHeatSP -= SysOutputProvided;
4301 51368081 : energy.UnadjRemainingOutputReqToCoolSP -= SysOutputProvided;
4302 51368081 : moisture.UnadjRemainingOutputRequired -= LatOutputProvided;
4303 51368081 : moisture.UnadjRemainingOutputReqToHumidSP -= LatOutputProvided;
4304 51368081 : moisture.UnadjRemainingOutputReqToDehumidSP -= LatOutputProvided;
4305 :
4306 51368081 : if (present(EquipPriorityNum) && EquipPriorityNum < thisZEqList.NumOfEquipTypes) {
4307 :
4308 : // Look up the next system in priority order
4309 4510398 : int nextEquipPriorityNum = EquipPriorityNum + 1;
4310 4510398 : const int &nextSystem = state.dataZoneEquipmentManager->PrioritySimOrder(nextEquipPriorityNum).EquipPtr;
4311 :
4312 : // Determine the load ratio based on whether we're heating or cooling
4313 6701161 : const Real64 loadRatio = (energy.TotalOutputRequired >= 0.0) ? thisZEqList.SequentialHeatingFraction(state, nextSystem)
4314 6701161 : : thisZEqList.SequentialCoolingFraction(state, nextSystem);
4315 :
4316 : // Update the zone energy demands
4317 4510398 : energy.RemainingOutputRequired = loadRatio * energy.UnadjRemainingOutputRequired;
4318 4510398 : energy.RemainingOutputReqToHeatSP = loadRatio * energy.UnadjRemainingOutputReqToHeatSP;
4319 4510398 : energy.RemainingOutputReqToCoolSP = loadRatio * energy.UnadjRemainingOutputReqToCoolSP;
4320 4510398 : moisture.RemainingOutputRequired = loadRatio * moisture.UnadjRemainingOutputRequired;
4321 4510398 : moisture.RemainingOutputReqToHumidSP = loadRatio * moisture.UnadjRemainingOutputReqToHumidSP;
4322 4510398 : moisture.RemainingOutputReqToDehumidSP = loadRatio * moisture.UnadjRemainingOutputReqToDehumidSP;
4323 :
4324 : // now store remaining load at the sequence level
4325 4510398 : energy.SequencedOutputRequired(nextEquipPriorityNum) = energy.RemainingOutputRequired;
4326 4510398 : energy.SequencedOutputRequiredToHeatingSP(nextEquipPriorityNum) = energy.RemainingOutputReqToHeatSP;
4327 4510398 : energy.SequencedOutputRequiredToCoolingSP(nextEquipPriorityNum) = energy.RemainingOutputReqToCoolSP;
4328 4510398 : moisture.SequencedOutputRequired(nextEquipPriorityNum) = moisture.RemainingOutputRequired;
4329 4510398 : moisture.SequencedOutputRequiredToHumidSP(nextEquipPriorityNum) = moisture.RemainingOutputReqToHumidSP;
4330 4510398 : moisture.SequencedOutputRequiredToDehumidSP(nextEquipPriorityNum) = moisture.RemainingOutputReqToDehumidSP;
4331 : } else {
4332 : // SequentialLoading, use original method for remaining output
4333 46857683 : energy.RemainingOutputRequired = energy.UnadjRemainingOutputRequired;
4334 46857683 : energy.RemainingOutputReqToHeatSP = energy.UnadjRemainingOutputReqToHeatSP;
4335 46857683 : energy.RemainingOutputReqToCoolSP = energy.UnadjRemainingOutputReqToCoolSP;
4336 : // Latent output updates
4337 46857683 : moisture.RemainingOutputRequired = moisture.UnadjRemainingOutputRequired;
4338 46857683 : moisture.RemainingOutputReqToHumidSP = moisture.UnadjRemainingOutputReqToHumidSP;
4339 46857683 : moisture.RemainingOutputReqToDehumidSP = moisture.UnadjRemainingOutputReqToDehumidSP;
4340 : }
4341 :
4342 : // re-evaluate if loads are now such that in dead band or set back
4343 51368081 : switch (state.dataHeatBalFanSys->TempControlType(ZoneNum)) {
4344 1000424 : case DataHVACGlobals::ThermostatType::Uncontrolled:
4345 : // uncontrolled zone; shouldn't ever get here, but who knows
4346 1000424 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false;
4347 1000424 : break;
4348 4101319 : case DataHVACGlobals::ThermostatType::SingleHeating:
4349 4101319 : if ((energy.RemainingOutputRequired - 1.0) < 0.0) {
4350 2626129 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true;
4351 : } else {
4352 1475190 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false;
4353 : }
4354 4101319 : break;
4355 4941227 : case DataHVACGlobals::ThermostatType::SingleCooling:
4356 4941227 : if ((energy.RemainingOutputRequired + 1.0) > 0.0) {
4357 3380717 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true;
4358 : } else {
4359 1560510 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false;
4360 : }
4361 4941227 : break;
4362 181728 : case DataHVACGlobals::ThermostatType::SingleHeatCool:
4363 181728 : if (energy.RemainingOutputReqToHeatSP < 0.0 && energy.RemainingOutputReqToCoolSP > 0.0) {
4364 0 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true;
4365 : } else {
4366 181728 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false;
4367 : }
4368 181728 : break;
4369 41143383 : case DataHVACGlobals::ThermostatType::DualSetPointWithDeadBand:
4370 41143383 : if (energy.RemainingOutputReqToHeatSP < 0.0 && energy.RemainingOutputReqToCoolSP > 0.0) {
4371 14510197 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = true;
4372 : } else {
4373 26633186 : state.dataZoneEnergyDemand->CurDeadBandOrSetback(ZoneNum) = false;
4374 : }
4375 41143383 : break;
4376 0 : default:
4377 0 : break;
4378 : }
4379 :
4380 51368081 : } break;
4381 98544 : case DataZoneEquipment::LoadDist::Uniform:
4382 : case DataZoneEquipment::LoadDist::UniformPLR:
4383 : case DataZoneEquipment::LoadDist::SequentialUniformPLR:
4384 : // For every load distribution scheme except SequentialLoad, do not touch the sequenced loads,
4385 : // but set the remaining loads to the next equipment type's load to support equipment types that don't use the sequenced loads
4386 98544 : if (present(EquipPriorityNum)) {
4387 86640 : if (EquipPriorityNum + 1 <= energy.NumZoneEquipment) {
4388 43320 : energy.RemainingOutputRequired = energy.SequencedOutputRequired(EquipPriorityNum + 1);
4389 43320 : moisture.RemainingOutputRequired = moisture.SequencedOutputRequired(EquipPriorityNum + 1);
4390 : }
4391 :
4392 86640 : if (state.dataZoneEquipmentManager->PrioritySimOrder(EquipPriorityNum).HeatingPriority + 1 <= energy.NumZoneEquipment) {
4393 43320 : energy.RemainingOutputReqToHeatSP =
4394 43320 : energy.SequencedOutputRequiredToHeatingSP(state.dataZoneEquipmentManager->PrioritySimOrder(EquipPriorityNum).HeatingPriority + 1);
4395 43320 : moisture.RemainingOutputReqToHumidSP =
4396 43320 : moisture.SequencedOutputRequiredToHumidSP(state.dataZoneEquipmentManager->PrioritySimOrder(EquipPriorityNum).HeatingPriority + 1);
4397 : }
4398 86640 : if (state.dataZoneEquipmentManager->PrioritySimOrder(EquipPriorityNum).CoolingPriority + 1 <= energy.NumZoneEquipment) {
4399 43320 : energy.RemainingOutputReqToCoolSP =
4400 43320 : energy.SequencedOutputRequiredToCoolingSP(state.dataZoneEquipmentManager->PrioritySimOrder(EquipPriorityNum).CoolingPriority + 1);
4401 43320 : moisture.RemainingOutputReqToDehumidSP = moisture.SequencedOutputRequiredToDehumidSP(
4402 43320 : state.dataZoneEquipmentManager->PrioritySimOrder(EquipPriorityNum).CoolingPriority + 1);
4403 : }
4404 : }
4405 98544 : break;
4406 0 : default:
4407 0 : ShowFatalError(state, "UpdateSystemOutputRequired: Illegal load distribution scheme type.");
4408 0 : break;
4409 : }
4410 : }
4411 :
4412 7037806 : void CalcZoneMassBalance(EnergyPlusData &state, bool const FirstHVACIteration)
4413 : {
4414 :
4415 : // SUBROUTINE INFORMATION:
4416 : // AUTHOR Russ Taylor
4417 : // DATE WRITTEN May 1997
4418 :
4419 : // PURPOSE OF THIS SUBROUTINE:
4420 : // Perform zone mass balance to get outlet air flow conditions.
4421 :
4422 : // METHODOLOGY EMPLOYED:
4423 : // Mass continuity equation.
4424 :
4425 7037806 : int constexpr IterMax(25);
4426 7037806 : Real64 constexpr ConvergenceTolerance(0.000010);
4427 :
4428 7037806 : state.dataHVACGlobal->ZoneMassBalanceHVACReSim = false;
4429 7037806 : int Iteration = 0;
4430 7037806 : Real64 BuildingZoneMixingFlow = 0.0;
4431 7037806 : Real64 BuildingZoneMixingFlowOld = 0.0;
4432 7037806 : Real64 BuildingZoneReturnFlow = 0.0;
4433 7037806 : Real64 BuildingZoneReturnFlowOld = 0.0;
4434 :
4435 7037806 : auto &Node(state.dataLoopNodes->Node);
4436 :
4437 : // Total loop supply and recirc flows (these have been zeroed earlier in InitZoneEquipment
4438 40668216 : for (int airDistUnit = 1; airDistUnit <= (int)state.dataDefineEquipment->AirDistUnit.size(); ++airDistUnit) {
4439 33630410 : auto &airDisUnit = state.dataDefineEquipment->AirDistUnit(airDistUnit);
4440 33630410 : if (airDisUnit.AirLoopNum > 0) {
4441 33501742 : auto &airLoopFlow = state.dataAirLoop->AirLoopFlow(airDisUnit.AirLoopNum);
4442 33501742 : airLoopFlow.SupFlow += airDisUnit.MassFlowRateSup;
4443 33501742 : airLoopFlow.RecircFlow += airDisUnit.MassFlowRatePlenInd;
4444 33501742 : airLoopFlow.LeakFlow += airDisUnit.MassFlowRateDnStrLk + airDisUnit.MassFlowRateUpStrLk;
4445 : }
4446 : }
4447 :
4448 : // Set max OA flow and frac for systems which are all OA (no OASys)
4449 18028640 : for (int airLoop = 1; airLoop <= state.dataHVACGlobal->NumPrimaryAirSys; ++airLoop) {
4450 10990834 : if (state.dataAirSystemsData->PrimaryAirSystems(airLoop).isAllOA) {
4451 15046 : auto &airLoopFlow = state.dataAirLoop->AirLoopFlow(airLoop);
4452 15046 : airLoopFlow.MaxOutAir = airLoopFlow.SupFlow;
4453 15046 : airLoopFlow.OAFlow = airLoopFlow.SupFlow;
4454 15046 : airLoopFlow.OAFrac = 1.0;
4455 : }
4456 : }
4457 :
4458 106580 : do {
4459 7144386 : if (state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance) {
4460 : // These are also reset in ZoneEquipmentManager::InitZoneEquipment, reset again here for each zone mass balance iteration
4461 191986 : for (int airLoop = 1; airLoop <= state.dataHVACGlobal->NumPrimaryAirSys; ++airLoop) {
4462 71559 : auto &airLoopFlow = state.dataAirLoop->AirLoopFlow(airLoop);
4463 71559 : airLoopFlow.ZoneRetFlow = 0.0;
4464 71559 : airLoopFlow.SysRetFlow = 0.0;
4465 71559 : airLoopFlow.ExcessZoneExhFlow = 0.0;
4466 : }
4467 842989 : for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) {
4468 722562 : if (!state.dataZoneEquip->ZoneEquipConfig(ZoneNum).IsControlled) continue;
4469 602135 : state.dataHeatBalFanSys->ZoneInfiltrationFlag(ZoneNum) = false;
4470 602135 : state.dataHeatBal->MassConservation(ZoneNum).IncludeInfilToZoneMassBal = 0.0;
4471 602135 : state.dataHeatBal->MassConservation(ZoneNum).RetMassFlowRate = 0.0;
4472 602135 : state.dataZoneEquip->ZoneEquipConfig(ZoneNum).ExcessZoneExh = 0.0;
4473 : }
4474 : }
4475 7144386 : BuildingZoneMixingFlowOld = BuildingZoneMixingFlow;
4476 7144386 : BuildingZoneMixingFlow = 0.0;
4477 :
4478 7144386 : BuildingZoneReturnFlowOld = BuildingZoneReturnFlow;
4479 7144386 : BuildingZoneReturnFlow = 0.0;
4480 :
4481 62514619 : for (int ZoneNum1 = 1; ZoneNum1 <= state.dataGlobal->NumOfZones; ++ZoneNum1) {
4482 55370233 : if (!state.dataZoneEquip->ZoneEquipConfig(ZoneNum1).IsControlled) continue;
4483 47269583 : int ZoneNum = ZoneNum1;
4484 47269583 : if (state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance) ZoneNum = state.dataHeatBalFanSys->ZoneReOrder(ZoneNum1);
4485 47269583 : auto &massConservation = state.dataHeatBal->MassConservation(ZoneNum);
4486 47269583 : auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(ZoneNum);
4487 47269583 : zoneEquipConfig.TotInletAirMassFlowRate = 0.0;
4488 47269583 : Real64 TotInletAirMassFlowRateMax = 0.0;
4489 47269583 : Real64 TotInletAirMassFlowRateMaxAvail = 0.0;
4490 47269583 : Real64 TotInletAirMassFlowRateMin = 0.0;
4491 47269583 : Real64 TotInletAirMassFlowRateMinAvail = 0.0;
4492 47269583 : Real64 TotInletAirMassFlowRate = 0.0;
4493 47269583 : Real64 TotExhaustAirMassFlowRate = 0.0;
4494 :
4495 47269583 : zoneEquipConfig.TotExhaustAirMassFlowRate = 0.0;
4496 :
4497 47269583 : Real64 ZoneMixingAirMassFlowRate = 0.0;
4498 47269583 : Real64 ZoneMixingNetAirMassFlowRate = 0.0;
4499 47269583 : Real64 ZoneReturnAirMassFlowRate = 0.0;
4500 :
4501 95699795 : for (int NodeNum = 1; NodeNum <= zoneEquipConfig.NumInletNodes; ++NodeNum) {
4502 : {
4503 48430212 : auto const &thisNode(Node(zoneEquipConfig.InletNode(NodeNum)));
4504 48430212 : zoneEquipConfig.TotInletAirMassFlowRate += thisNode.MassFlowRate;
4505 48430212 : TotInletAirMassFlowRateMax += thisNode.MassFlowRateMax;
4506 48430212 : TotInletAirMassFlowRateMaxAvail += thisNode.MassFlowRateMaxAvail;
4507 48430212 : TotInletAirMassFlowRateMin += thisNode.MassFlowRateMin;
4508 48430212 : TotInletAirMassFlowRateMinAvail += thisNode.MassFlowRateMinAvail;
4509 : }
4510 : }
4511 :
4512 47269583 : TotInletAirMassFlowRate = zoneEquipConfig.TotInletAirMassFlowRate;
4513 :
4514 55271978 : for (int NodeNum = 1; NodeNum <= zoneEquipConfig.NumExhaustNodes; ++NodeNum) {
4515 :
4516 8002395 : if (state.afn->AirflowNetworkNumOfExhFan == 0) {
4517 7378605 : zoneEquipConfig.TotExhaustAirMassFlowRate += Node(zoneEquipConfig.ExhaustNode(NodeNum)).MassFlowRate;
4518 : }
4519 : }
4520 47269583 : TotExhaustAirMassFlowRate = zoneEquipConfig.TotExhaustAirMassFlowRate;
4521 :
4522 : // Include zone mixing mass flow rate
4523 47269583 : if (state.dataHeatBalFanSys->ZoneMassBalanceFlag(ZoneNum)) {
4524 602135 : int NumRetNodes = zoneEquipConfig.NumReturnNodes;
4525 1204270 : for (int NodeNumHere = 1; NodeNumHere <= NumRetNodes; ++NodeNumHere) {
4526 602135 : int RetNode = zoneEquipConfig.ReturnNode(NodeNumHere);
4527 602135 : if (RetNode > 0) {
4528 602135 : ZoneReturnAirMassFlowRate += Node(RetNode).MassFlowRate;
4529 : }
4530 : }
4531 : // Set zone mixing incoming mass flow rate
4532 1135035 : if ((Iteration == 0) || state.dataHeatBal->ZoneAirMassFlow.ZoneFlowAdjustment == DataHeatBalance::AdjustmentType::AdjustReturnOnly ||
4533 532900 : state.dataHeatBal->ZoneAirMassFlow.ZoneFlowAdjustment == DataHeatBalance::AdjustmentType::AdjustReturnThenMixing) {
4534 69235 : ZoneMixingAirMassFlowRate = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum).MixingMassFlowZone;
4535 : } else {
4536 532900 : ZoneMixingAirMassFlowRate = max(0.0,
4537 532900 : ZoneReturnAirMassFlowRate + TotExhaustAirMassFlowRate - TotInletAirMassFlowRate +
4538 532900 : massConservation.MixingSourceMassFlowRate);
4539 : }
4540 602135 : CalcZoneMixingFlowRateOfReceivingZone(state, ZoneNum, ZoneMixingAirMassFlowRate);
4541 602135 : ZoneMixingNetAirMassFlowRate = massConservation.MixingMassFlowRate - massConservation.MixingSourceMassFlowRate;
4542 : }
4543 47269583 : auto &zoneNode = Node(zoneEquipConfig.ZoneNode);
4544 47269583 : zoneNode.MassFlowRate = TotInletAirMassFlowRate;
4545 47269583 : zoneNode.MassFlowRateMax = TotInletAirMassFlowRateMax;
4546 47269583 : zoneNode.MassFlowRateMaxAvail = TotInletAirMassFlowRateMaxAvail;
4547 47269583 : zoneNode.MassFlowRateMin = TotInletAirMassFlowRateMin;
4548 47269583 : zoneNode.MassFlowRateMinAvail = TotInletAirMassFlowRateMinAvail;
4549 :
4550 : // Calculate standard return air flow rate using default method of inlets minus exhausts adjusted for "balanced" exhaust flow
4551 47269583 : Real64 StdTotalReturnMassFlow =
4552 47269583 : TotInletAirMassFlowRate + ZoneMixingNetAirMassFlowRate - (TotExhaustAirMassFlowRate - zoneEquipConfig.ZoneExhBalanced);
4553 :
4554 47269583 : if (!state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance) {
4555 46667448 : if (StdTotalReturnMassFlow < 0.0) {
4556 215977 : zoneEquipConfig.ExcessZoneExh = -StdTotalReturnMassFlow;
4557 215977 : StdTotalReturnMassFlow = 0.0;
4558 : } else {
4559 46451471 : zoneEquipConfig.ExcessZoneExh = 0.0;
4560 : }
4561 : } else {
4562 602135 : zoneEquipConfig.ExcessZoneExh = 0.0;
4563 602135 : StdTotalReturnMassFlow = max(0.0, StdTotalReturnMassFlow);
4564 : }
4565 :
4566 47269583 : Real64 FinalTotalReturnMassFlow = 0;
4567 47269583 : CalcZoneReturnFlows(state, ZoneNum, StdTotalReturnMassFlow, FinalTotalReturnMassFlow);
4568 47269583 : if (state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance) {
4569 : // set mass conservation variables
4570 602135 : massConservation.InMassFlowRate = TotInletAirMassFlowRate;
4571 602135 : massConservation.ExhMassFlowRate = TotExhaustAirMassFlowRate;
4572 :
4573 602135 : if (state.dataHeatBal->ZoneAirMassFlow.ZoneFlowAdjustment == DataHeatBalance::AdjustmentType::AdjustMixingOnly ||
4574 0 : state.dataHeatBal->ZoneAirMassFlow.ZoneFlowAdjustment == DataHeatBalance::AdjustmentType::AdjustMixingThenReturn) {
4575 602135 : ZoneReturnAirMassFlowRate = FinalTotalReturnMassFlow;
4576 602135 : Real64 AdjustedTotalReturnMassFlow = 0;
4577 602135 : massConservation.RetMassFlowRate = FinalTotalReturnMassFlow;
4578 602135 : ZoneReturnAirMassFlowRate = FinalTotalReturnMassFlow;
4579 602135 : if (state.dataHeatBal->ZoneAirMassFlow.ZoneFlowAdjustment == DataHeatBalance::AdjustmentType::AdjustMixingThenReturn) {
4580 :
4581 : // Calculate return air flow rate using mass conservation equation
4582 0 : AdjustedTotalReturnMassFlow = max(0.0, TotInletAirMassFlowRate - TotExhaustAirMassFlowRate + ZoneMixingNetAirMassFlowRate);
4583 0 : AdjustedTotalReturnMassFlow = min(AdjustedTotalReturnMassFlow, zoneEquipConfig.AirLoopDesSupply);
4584 : // add adjust zone return node air flow calc
4585 0 : CalcZoneReturnFlows(state, ZoneNum, AdjustedTotalReturnMassFlow, FinalTotalReturnMassFlow);
4586 0 : massConservation.RetMassFlowRate = FinalTotalReturnMassFlow;
4587 0 : ZoneReturnAirMassFlowRate = FinalTotalReturnMassFlow;
4588 : }
4589 : // Set zone infiltration air flow rate
4590 602135 : CalcZoneInfiltrationFlows(state, ZoneNum, ZoneReturnAirMassFlowRate);
4591 :
4592 0 : } else if (state.dataHeatBal->ZoneAirMassFlow.ZoneFlowAdjustment == DataHeatBalance::AdjustmentType::AdjustReturnOnly ||
4593 0 : state.dataHeatBal->ZoneAirMassFlow.ZoneFlowAdjustment == DataHeatBalance::AdjustmentType::AdjustReturnThenMixing) {
4594 :
4595 0 : Real64 AdjustedTotalReturnMassFlow = 0;
4596 : // Calculate return air flow rate using mass conservation equation
4597 0 : AdjustedTotalReturnMassFlow = max(0.0, TotInletAirMassFlowRate - TotExhaustAirMassFlowRate + ZoneMixingNetAirMassFlowRate);
4598 0 : AdjustedTotalReturnMassFlow = min(AdjustedTotalReturnMassFlow, zoneEquipConfig.AirLoopDesSupply);
4599 :
4600 : // add adjust zone return node air flow calculation
4601 0 : CalcZoneReturnFlows(state, ZoneNum, AdjustedTotalReturnMassFlow, FinalTotalReturnMassFlow);
4602 0 : massConservation.RetMassFlowRate = FinalTotalReturnMassFlow;
4603 0 : ZoneReturnAirMassFlowRate = FinalTotalReturnMassFlow;
4604 :
4605 0 : if (state.dataHeatBal->ZoneAirMassFlow.ZoneFlowAdjustment == DataHeatBalance::AdjustmentType::AdjustReturnThenMixing) {
4606 0 : ZoneMixingAirMassFlowRate = max(0.0,
4607 0 : ZoneReturnAirMassFlowRate + TotExhaustAirMassFlowRate - TotInletAirMassFlowRate +
4608 0 : massConservation.MixingSourceMassFlowRate);
4609 0 : CalcZoneMixingFlowRateOfReceivingZone(state, ZoneNum, ZoneMixingAirMassFlowRate);
4610 0 : ZoneMixingNetAirMassFlowRate = massConservation.MixingMassFlowRate - massConservation.MixingSourceMassFlowRate;
4611 :
4612 : // Calculate return air flow rate using mass conservation equation
4613 0 : AdjustedTotalReturnMassFlow = max(0.0, TotInletAirMassFlowRate - TotExhaustAirMassFlowRate + ZoneMixingNetAirMassFlowRate);
4614 0 : AdjustedTotalReturnMassFlow = min(AdjustedTotalReturnMassFlow, zoneEquipConfig.AirLoopDesSupply);
4615 :
4616 : // add adjust zone return node air flow calc
4617 0 : CalcZoneReturnFlows(state, ZoneNum, AdjustedTotalReturnMassFlow, FinalTotalReturnMassFlow);
4618 0 : massConservation.RetMassFlowRate = FinalTotalReturnMassFlow;
4619 0 : ZoneReturnAirMassFlowRate = FinalTotalReturnMassFlow;
4620 : }
4621 :
4622 : // Set zone infiltration air flow rate
4623 0 : CalcZoneInfiltrationFlows(state, ZoneNum, ZoneReturnAirMassFlowRate);
4624 : } else {
4625 : // if infiltration treatment method is not None
4626 : // Set zone infiltration air flow rate
4627 0 : CalcZoneInfiltrationFlows(state, ZoneNum, ZoneReturnAirMassFlowRate);
4628 : }
4629 : }
4630 :
4631 47269583 : BuildingZoneMixingFlow += massConservation.MixingMassFlowRate;
4632 47269583 : BuildingZoneReturnFlow += massConservation.RetMassFlowRate;
4633 :
4634 : // Accumulate airloop total return flows and allocate excess exhaust flows
4635 94628169 : for (int returnNum = 1; returnNum <= zoneEquipConfig.NumReturnNodes; ++returnNum) {
4636 47358586 : int retNode = zoneEquipConfig.ReturnNode(returnNum);
4637 47358586 : int airLoop = zoneEquipConfig.ReturnNodeAirLoopNum(returnNum);
4638 47358586 : if (airLoop > 0) {
4639 33872485 : state.dataAirLoop->AirLoopFlow(airLoop).ZoneRetFlow += Node(retNode).MassFlowRate;
4640 33872485 : if (zoneEquipConfig.TotAvailAirLoopOA > 0.0) {
4641 31222070 : state.dataAirLoop->AirLoopFlow(airLoop).ExcessZoneExhFlow +=
4642 31222070 : zoneEquipConfig.ExcessZoneExh * state.dataAirLoop->AirLoopFlow(airLoop).MaxOutAir / zoneEquipConfig.TotAvailAirLoopOA;
4643 : }
4644 : }
4645 : }
4646 : }
4647 :
4648 : // adjust the zone return air flow rates to match any excess zone exhaust flows
4649 18199378 : for (int airLoopNum = 1; airLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++airLoopNum) {
4650 11054992 : auto &thisAirLoopFlow(state.dataAirLoop->AirLoopFlow(airLoopNum));
4651 11054992 : Real64 adjZoneRetFlow = max(0.0, thisAirLoopFlow.ZoneRetFlow - thisAirLoopFlow.ExcessZoneExhFlow);
4652 11054992 : if (thisAirLoopFlow.ZoneRetFlow > 0.0) {
4653 8958332 : thisAirLoopFlow.ZoneRetFlowRatio = adjZoneRetFlow / thisAirLoopFlow.ZoneRetFlow;
4654 : } else {
4655 2096660 : thisAirLoopFlow.ZoneRetFlowRatio = 1.0;
4656 : }
4657 11054992 : thisAirLoopFlow.ZoneRetFlow = 0.0; // reset to zero and re-accumulate below
4658 : }
4659 :
4660 62514619 : for (int zoneNum = 1; zoneNum <= state.dataGlobal->NumOfZones; ++zoneNum) {
4661 55370233 : auto &thisZoneEquip(state.dataZoneEquip->ZoneEquipConfig(zoneNum));
4662 55370233 : auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum);
4663 55370233 : if (!thisZoneEquip.IsControlled) continue;
4664 47269583 : int numRetNodes = thisZoneEquip.NumReturnNodes;
4665 47269583 : Real64 totalZoneReturnMassFlow = 0.0;
4666 94628169 : for (int returnNum = 1; returnNum <= numRetNodes; ++returnNum) {
4667 47358586 : int retNode = thisZoneEquip.ReturnNode(returnNum);
4668 47358586 : int airLoopNum = thisZoneEquip.ReturnNodeAirLoopNum(returnNum);
4669 47358586 : if (retNode > 0) {
4670 47358586 : if (airLoopNum > 0) {
4671 33872485 : auto &thisAirLoopFlow(state.dataAirLoop->AirLoopFlow(airLoopNum));
4672 33872485 : Node(retNode).MassFlowRate *= thisAirLoopFlow.ZoneRetFlowRatio;
4673 33872485 : thisAirLoopFlow.ZoneRetFlow += Node(retNode).MassFlowRate;
4674 : }
4675 47358586 : totalZoneReturnMassFlow += Node(retNode).MassFlowRate;
4676 : }
4677 : }
4678 : // Check zone flow balance but not when zone air mass balance is active
4679 179351670 : if (!state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance && !state.dataGlobal->DoingSizing &&
4680 120350643 : !state.dataGlobal->DoingHVACSizingSimulations && !state.dataGlobal->WarmupFlag && !FirstHVACIteration) {
4681 3203753 : if (!thisZoneEquip.FlowError) {
4682 : // Net system flows first (sum leaving flows, less entering flows)
4683 3196306 : Real64 sysUnbalExhaust = (thisZoneEquip.TotExhaustAirMassFlowRate - thisZoneEquip.ZoneExhBalanced);
4684 3196306 : Real64 sysUnbalancedFlow = sysUnbalExhaust + totalZoneReturnMassFlow - thisZoneEquip.TotInletAirMassFlowRate;
4685 3196306 : if (sysUnbalancedFlow > DataHVACGlobals::SmallMassFlow) {
4686 : // Now include infiltration, ventilation, and mixing flows (these are all entering the zone, so subtract them)
4687 11 : Real64 incomingFlow = thisZoneHB.OAMFL + thisZoneHB.VAMFL + thisZoneHB.MixingMassFlowZone;
4688 11 : Real64 unbalancedFlow = max(0.0, sysUnbalancedFlow - incomingFlow);
4689 11 : if (unbalancedFlow > DataHVACGlobals::SmallMassFlow) {
4690 : // Re-check on volume basis - use current zone density for incoming, standard density for HVAC sys
4691 11 : Real64 zoneTemp = Node(thisZoneEquip.ZoneNode).Temp;
4692 11 : Real64 zoneHumRat = Node(thisZoneEquip.ZoneNode).HumRat;
4693 11 : Real64 rhoZone = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, zoneTemp, zoneHumRat, "CalcZoneMassBalance");
4694 11 : Real64 incomingVolFlow = incomingFlow / rhoZone;
4695 11 : Real64 sysUnbalancedVolFlow = sysUnbalancedFlow / state.dataEnvrn->StdRhoAir;
4696 11 : Real64 unbalancedVolFlow = max(0.0, sysUnbalancedVolFlow - incomingVolFlow);
4697 11 : if (unbalancedVolFlow > DataHVACGlobals::SmallAirVolFlow) {
4698 33 : ShowWarningError(state,
4699 22 : "In zone " + thisZoneEquip.ZoneName +
4700 : " there is unbalanced air flow. Load due to induced outdoor air is neglected.");
4701 11 : ShowContinueErrorTimeStamp(state, "");
4702 33 : ShowContinueError(state,
4703 22 : format(" Flows [m3/s]: Inlets: {:.6R} Unbalanced exhausts: {:.6R} Returns: {:.6R}",
4704 22 : thisZoneEquip.TotInletAirMassFlowRate / state.dataEnvrn->StdRhoAir,
4705 22 : sysUnbalExhaust / state.dataEnvrn->StdRhoAir,
4706 33 : totalZoneReturnMassFlow / state.dataEnvrn->StdRhoAir));
4707 33 : ShowContinueError(state,
4708 22 : format(" Infiltration: {:.6R} Zone Ventilation: {:.6R} Mixing (incoming): {:.6R}",
4709 22 : thisZoneHB.OAMFL / rhoZone,
4710 22 : thisZoneHB.VAMFL / rhoZone,
4711 33 : thisZoneHB.MixingMassFlowZone / rhoZone));
4712 33 : ShowContinueError(
4713 : state,
4714 22 : format(" Imbalance (excess outflow): {:.6R} Total system OA flow (for all airloops serving this zone): {:.6R}",
4715 : unbalancedVolFlow,
4716 22 : thisZoneEquip.TotAvailAirLoopOA / state.dataEnvrn->StdRhoAir));
4717 11 : ShowContinueError(state, " This error will only be reported once per zone.");
4718 11 : thisZoneEquip.FlowError = true;
4719 : }
4720 : }
4721 : }
4722 : }
4723 : }
4724 : }
4725 :
4726 : // update the
4727 7144386 : if (Iteration > 0) {
4728 106580 : Real64 totalResidual = 0.0;
4729 106580 : totalResidual =
4730 106580 : std::abs(BuildingZoneMixingFlow - BuildingZoneMixingFlowOld) + std::abs(BuildingZoneReturnFlow - BuildingZoneReturnFlowOld);
4731 106580 : if (totalResidual < ConvergenceTolerance) {
4732 11249 : state.dataHVACGlobal->ZoneMassBalanceHVACReSim = false;
4733 11249 : break;
4734 : } else {
4735 95331 : state.dataHVACGlobal->ZoneMassBalanceHVACReSim = true;
4736 : }
4737 : }
4738 7133137 : if (!state.dataHeatBal->ZoneAirMassFlow.EnforceZoneMassBalance) break;
4739 109178 : Iteration += 1;
4740 :
4741 109178 : } while (Iteration < IterMax);
4742 : // Set system return flows
4743 18028640 : for (int AirLoopNum = 1; AirLoopNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++AirLoopNum) {
4744 10990834 : auto &thisAirLoopFlow(state.dataAirLoop->AirLoopFlow(AirLoopNum));
4745 10990834 : thisAirLoopFlow.SysRetFlow = thisAirLoopFlow.ZoneRetFlow - thisAirLoopFlow.RecircFlow + thisAirLoopFlow.LeakFlow;
4746 : }
4747 7037806 : }
4748 :
4749 47269583 : void CalcZoneReturnFlows(EnergyPlusData &state,
4750 : int const ZoneNum,
4751 : Real64 &ExpTotalReturnMassFlow, // Expected total return air mass flow rate
4752 : Real64 &FinalTotalReturnMassFlow // Final total return air mass flow rate
4753 : )
4754 : {
4755 47269583 : auto &thisZoneEquip(state.dataZoneEquip->ZoneEquipConfig(ZoneNum));
4756 47269583 : int numRetNodes = thisZoneEquip.NumReturnNodes;
4757 47269583 : Real64 totReturnFlow = 0.0; // Total flow to all return nodes in the zone (kg/s)
4758 47269583 : Real64 totVarReturnFlow =
4759 : 0.0; // Total variable return flow, for return nodes connected to an airloop with an OA system or not with specified flow (kg/s)
4760 47269583 : Real64 returnSchedFrac = ScheduleManager::GetCurrentScheduleValue(state, thisZoneEquip.ReturnFlowSchedPtrNum);
4761 47269583 : thisZoneEquip.FixedReturnFlow = false;
4762 47269583 : FinalTotalReturnMassFlow = 0.0;
4763 47269583 : thisZoneEquip.TotAvailAirLoopOA = 0.0;
4764 :
4765 : // Set initial flow rate for each return node
4766 94628169 : for (int returnNum = 1; returnNum <= numRetNodes; ++returnNum) {
4767 47358586 : int retNode = thisZoneEquip.ReturnNode(returnNum);
4768 :
4769 47358586 : if (retNode > 0) {
4770 47358586 : Real64 returnNodeMassFlow = 0.0;
4771 47358586 : auto &retNodeData(state.dataLoopNodes->Node(retNode));
4772 :
4773 47358586 : int inletNum = thisZoneEquip.ReturnNodeInletNum(returnNum); // which inlet node matches this return node (same airloop)
4774 47358586 : int ADUNum = 0;
4775 47358586 : if (inletNum > 0) ADUNum = thisZoneEquip.InletNodeADUNum(inletNum);
4776 47358586 : int airLoop = thisZoneEquip.ReturnNodeAirLoopNum(returnNum);
4777 47358586 : Real64 airLoopReturnFrac = 1.0;
4778 47358586 : if (airLoop > 0) {
4779 : // Establish corresponding airloop inlet(s) mass flow rate and set return node max/min/maxavail
4780 33872485 : Real64 inletMassFlow = 0.0;
4781 33872485 : int maxMinNodeNum = 0;
4782 33872485 : auto &thisAirLoopFlow(state.dataAirLoop->AirLoopFlow(airLoop));
4783 33872485 : if (ADUNum > 0) {
4784 : // Zone return node could carry supply flow to zone without leaks plus any induced flow from plenum (but don't include other
4785 : // secondary flows from exhaust nodes)
4786 67280124 : inletMassFlow = state.dataDefineEquipment->AirDistUnit(ADUNum).MassFlowRateZSup +
4787 33640062 : state.dataDefineEquipment->AirDistUnit(ADUNum).MassFlowRatePlenInd;
4788 33640062 : maxMinNodeNum = state.dataDefineEquipment->AirDistUnit(ADUNum).OutletNodeNum;
4789 232423 : } else if (inletNum > 0) {
4790 : // If not connected to an ADU, then use the inlet node flow
4791 232423 : inletMassFlow = state.dataLoopNodes->Node(thisZoneEquip.InletNode(inletNum)).MassFlowRate;
4792 232423 : maxMinNodeNum = thisZoneEquip.InletNode(inletNum);
4793 : }
4794 33872485 : if (maxMinNodeNum > 0) {
4795 33872485 : auto const &maxMinNodeData(state.dataLoopNodes->Node(maxMinNodeNum));
4796 33872485 : retNodeData.MassFlowRateMax = maxMinNodeData.MassFlowRateMax;
4797 33872485 : retNodeData.MassFlowRateMin = maxMinNodeData.MassFlowRateMin;
4798 33872485 : retNodeData.MassFlowRateMaxAvail = maxMinNodeData.MassFlowRateMaxAvail;
4799 : } else {
4800 0 : auto const &zoneNodeData(state.dataLoopNodes->Node(thisZoneEquip.ZoneNode));
4801 0 : retNodeData.MassFlowRateMax = zoneNodeData.MassFlowRateMax;
4802 0 : retNodeData.MassFlowRateMin = zoneNodeData.MassFlowRateMin;
4803 0 : retNodeData.MassFlowRateMaxAvail = zoneNodeData.MassFlowRateMaxAvail;
4804 : }
4805 :
4806 33872485 : airLoopReturnFrac = thisAirLoopFlow.DesReturnFrac;
4807 33872485 : if (state.dataAirSystemsData->PrimaryAirSystems(airLoop).OASysExists && (thisAirLoopFlow.MaxOutAir > 0.0)) {
4808 : // Set return flow as fraction of matching inlet node flow if there is an OA system and available OA flow > 0.0
4809 31222070 : returnNodeMassFlow = airLoopReturnFrac * inletMassFlow;
4810 31222070 : thisZoneEquip.TotAvailAirLoopOA += thisAirLoopFlow.MaxOutAir;
4811 : } else {
4812 : // Set return flow to matching inlet node flow
4813 2650415 : returnNodeMassFlow = inletMassFlow;
4814 2650415 : thisZoneEquip.FixedReturnFlow(returnNum) = true;
4815 : }
4816 : } else {
4817 13486101 : returnNodeMassFlow = 0.0;
4818 : }
4819 :
4820 : // Return node 1 is special
4821 47358586 : if (returnNum == 1) {
4822 : // Make no return air flow adjustments during sizing
4823 47265926 : if ((state.dataGlobal->DoingSizing) && numRetNodes == 1) {
4824 8745743 : returnNodeMassFlow = ExpTotalReturnMassFlow;
4825 8745743 : if (airLoop > 0) {
4826 0 : if (!state.dataAirSystemsData->PrimaryAirSystems(airLoop).OASysExists ||
4827 0 : (state.dataAirLoop->AirLoopFlow(airLoop).MaxOutAir == 0.0)) {
4828 0 : ExpTotalReturnMassFlow = max(0.0, ExpTotalReturnMassFlow - thisZoneEquip.ZoneExhBalanced + thisZoneEquip.ZoneExh);
4829 0 : returnNodeMassFlow = ExpTotalReturnMassFlow;
4830 : }
4831 : }
4832 38520183 : } else if (!state.dataGlobal->DoingSizing) {
4833 38500338 : if (thisZoneEquip.NumReturnFlowBasisNodes > 0) {
4834 : // Set base return air flow rate for node 1 using basis node flow rates
4835 0 : Real64 basisNodesMassFlow = 0.0;
4836 0 : for (int nodeNum = 1; nodeNum <= thisZoneEquip.NumReturnFlowBasisNodes; ++nodeNum) {
4837 0 : basisNodesMassFlow += state.dataLoopNodes->Node(thisZoneEquip.ReturnFlowBasisNode(nodeNum)).MassFlowRate;
4838 : }
4839 0 : returnNodeMassFlow = max(0.0, (basisNodesMassFlow * returnSchedFrac));
4840 0 : thisZoneEquip.FixedReturnFlow(returnNum) = true;
4841 : } else {
4842 : // If only 1 return node, use the standard return mass flow
4843 38500338 : if ((numRetNodes == 1) && !thisZoneEquip.FixedReturnFlow(returnNum)) {
4844 35922738 : returnNodeMassFlow = max(0.0, (ExpTotalReturnMassFlow * returnSchedFrac * airLoopReturnFrac));
4845 : }
4846 : }
4847 : }
4848 : }
4849 47358586 : totReturnFlow += returnNodeMassFlow;
4850 47358586 : retNodeData.MassFlowRate = returnNodeMassFlow;
4851 47358586 : retNodeData.MassFlowRateMinAvail = 0.0;
4852 47358586 : if (!thisZoneEquip.FixedReturnFlow(returnNum)) totVarReturnFlow += returnNodeMassFlow;
4853 : }
4854 : }
4855 :
4856 : // if zone mass balance true, set to expected return flow
4857 47269583 : if (state.dataHeatBal->ZoneAirMassFlow.ZoneFlowAdjustment != DataHeatBalance::AdjustmentType::NoAdjustReturnAndMixing) {
4858 : // applies zone return flow schedule multiplier
4859 602135 : ExpTotalReturnMassFlow = returnSchedFrac * ExpTotalReturnMassFlow;
4860 : // set air flow rate for each return node
4861 602135 : Real64 zoneTotReturnFlow = 0.0;
4862 602135 : Real64 returnNodeMassFlow = 0.0;
4863 1204270 : for (int returnNum = 1; returnNum <= numRetNodes; ++returnNum) {
4864 602135 : int retNode = thisZoneEquip.ReturnNode(returnNum);
4865 602135 : if (retNode > 0) {
4866 602135 : if (numRetNodes == 1) {
4867 602135 : returnNodeMassFlow = ExpTotalReturnMassFlow;
4868 : } else { // multiple return nodes
4869 0 : if (ExpTotalReturnMassFlow > 0.0) {
4870 0 : Real64 returnAdjFactor = state.dataLoopNodes->Node(retNode).MassFlowRate / ExpTotalReturnMassFlow;
4871 0 : returnNodeMassFlow = returnAdjFactor * ExpTotalReturnMassFlow;
4872 : } else {
4873 0 : returnNodeMassFlow = 0.0;
4874 : }
4875 : }
4876 : }
4877 602135 : zoneTotReturnFlow += returnNodeMassFlow;
4878 : }
4879 : // Adjust return node flows if zone total return flow is > 0
4880 602135 : if (zoneTotReturnFlow > 0.0) {
4881 994032 : for (int returnNum = 1; returnNum <= numRetNodes; ++returnNum) {
4882 497016 : int retNode = thisZoneEquip.ReturnNode(returnNum);
4883 497016 : if (retNode > 0) {
4884 497016 : if (numRetNodes == 1) {
4885 : // set it to expected return flows
4886 497016 : state.dataLoopNodes->Node(retNode).MassFlowRate = ExpTotalReturnMassFlow;
4887 497016 : FinalTotalReturnMassFlow = ExpTotalReturnMassFlow;
4888 : } else { // multiple return nodes, adjust nodes flow
4889 0 : Real64 newReturnFlow = 0.0;
4890 0 : Real64 returnAdjFactor = ExpTotalReturnMassFlow / zoneTotReturnFlow;
4891 0 : Real64 curReturnFlow = state.dataLoopNodes->Node(retNode).MassFlowRate;
4892 0 : newReturnFlow = curReturnFlow * returnAdjFactor;
4893 0 : state.dataLoopNodes->Node(retNode).MassFlowRate = newReturnFlow;
4894 0 : FinalTotalReturnMassFlow += newReturnFlow;
4895 : }
4896 : }
4897 : }
4898 : } else {
4899 105119 : FinalTotalReturnMassFlow = ExpTotalReturnMassFlow;
4900 : }
4901 : } else {
4902 : // Adjust return flows if greater than expected (i.e. there is exhaust or mixing flow reducing the total available for return)
4903 46667448 : if ((totReturnFlow > ExpTotalReturnMassFlow) && (totVarReturnFlow > 0.0)) {
4904 0 : Real64 newReturnFlow = 0.0;
4905 0 : Real64 returnAdjFactor = (1 - ((totReturnFlow - ExpTotalReturnMassFlow) / totVarReturnFlow)); // Return flow adjustment factor
4906 0 : for (int returnNum = 1; returnNum <= numRetNodes; ++returnNum) {
4907 0 : int retNode = thisZoneEquip.ReturnNode(returnNum);
4908 0 : Real64 curReturnFlow = state.dataLoopNodes->Node(retNode).MassFlowRate;
4909 0 : if (retNode > 0) {
4910 0 : if (!thisZoneEquip.FixedReturnFlow(returnNum)) {
4911 0 : newReturnFlow = curReturnFlow * returnAdjFactor;
4912 0 : FinalTotalReturnMassFlow += newReturnFlow;
4913 0 : state.dataLoopNodes->Node(retNode).MassFlowRate = newReturnFlow;
4914 : } else {
4915 0 : FinalTotalReturnMassFlow += curReturnFlow;
4916 : }
4917 : }
4918 0 : }
4919 : } else {
4920 46667448 : FinalTotalReturnMassFlow = totReturnFlow;
4921 : }
4922 : }
4923 47269583 : }
4924 :
4925 602135 : void CalcZoneInfiltrationFlows(EnergyPlusData &state,
4926 : int const ZoneNum, // current zone index
4927 : Real64 &ZoneReturnAirMassFlowRate // zone total zone return air mass flow rate
4928 : )
4929 : {
4930 602135 : Real64 constexpr ConvergenceTolerance(0.000010);
4931 602135 : Real64 ZoneInfiltrationMassFlowRate = 0.0;
4932 602135 : auto &massConservation = state.dataHeatBal->MassConservation(ZoneNum);
4933 :
4934 : // Set zone infiltration flow rate
4935 602135 : if (state.dataHeatBal->ZoneAirMassFlow.InfiltrationTreatment != DataHeatBalance::InfiltrationFlow::No) {
4936 602135 : if (massConservation.InfiltrationPtr > 0) {
4937 481708 : if (massConservation.IsOnlySourceZone ||
4938 0 : (state.dataHeatBal->ZoneAirMassFlow.InfiltrationForZones == DataHeatBalance::InfiltrationZoneType::AllZones)) {
4939 1445124 : ZoneInfiltrationMassFlowRate = massConservation.MixingSourceMassFlowRate - massConservation.MixingMassFlowRate +
4940 963416 : state.dataZoneEquip->ZoneEquipConfig(ZoneNum).TotExhaustAirMassFlowRate + ZoneReturnAirMassFlowRate -
4941 481708 : state.dataZoneEquip->ZoneEquipConfig(ZoneNum).TotInletAirMassFlowRate;
4942 481708 : if (state.dataHeatBal->ZoneAirMassFlow.InfiltrationTreatment == DataHeatBalance::InfiltrationFlow::Adjust) {
4943 426560 : if (std::abs(ZoneInfiltrationMassFlowRate) > ConvergenceTolerance) {
4944 426539 : state.dataHeatBalFanSys->ZoneInfiltrationFlag(ZoneNum) = true;
4945 426539 : massConservation.InfiltrationMassFlowRate = ZoneInfiltrationMassFlowRate;
4946 426539 : massConservation.IncludeInfilToZoneMassBal = 1;
4947 426539 : state.dataHeatBal->Infiltration(massConservation.InfiltrationPtr).MassFlowRate = ZoneInfiltrationMassFlowRate;
4948 426539 : state.dataHeatBal->Infiltration(massConservation.InfiltrationPtr).MassFlowRate =
4949 426539 : max(0.0, state.dataHeatBal->Infiltration(massConservation.InfiltrationPtr).MassFlowRate);
4950 : } else {
4951 21 : massConservation.InfiltrationMassFlowRate = 0.0;
4952 21 : state.dataHeatBal->Infiltration(massConservation.InfiltrationPtr).MassFlowRate = 0.0;
4953 : }
4954 55148 : } else if (state.dataHeatBal->ZoneAirMassFlow.InfiltrationTreatment == DataHeatBalance::InfiltrationFlow::Add) {
4955 55148 : if (ZoneInfiltrationMassFlowRate > ConvergenceTolerance) {
4956 18588 : state.dataHeatBalFanSys->ZoneInfiltrationFlag(ZoneNum) = true;
4957 18588 : massConservation.InfiltrationMassFlowRate = ZoneInfiltrationMassFlowRate;
4958 18588 : massConservation.IncludeInfilToZoneMassBal = 1;
4959 18588 : state.dataHeatBal->Infiltration(massConservation.InfiltrationPtr).MassFlowRate += ZoneInfiltrationMassFlowRate;
4960 : } else {
4961 36560 : massConservation.InfiltrationMassFlowRate = 0.0;
4962 : }
4963 0 : } else if (state.dataHeatBal->ZoneAirMassFlow.InfiltrationTreatment == DataHeatBalance::InfiltrationFlow::No) {
4964 0 : massConservation.InfiltrationMassFlowRate = 0.0;
4965 : }
4966 : } else {
4967 0 : if (state.dataHeatBal->ZoneAirMassFlow.InfiltrationTreatment == DataHeatBalance::InfiltrationFlow::Adjust) {
4968 0 : massConservation.InfiltrationMassFlowRate = state.dataHeatBal->Infiltration(massConservation.InfiltrationPtr).MassFlowRate;
4969 0 : } else if (state.dataHeatBal->ZoneAirMassFlow.InfiltrationTreatment == DataHeatBalance::InfiltrationFlow::Add) {
4970 0 : massConservation.InfiltrationMassFlowRate = 0.0;
4971 0 : } else if (state.dataHeatBal->ZoneAirMassFlow.InfiltrationTreatment == DataHeatBalance::InfiltrationFlow::No) {
4972 0 : massConservation.InfiltrationMassFlowRate = 0.0;
4973 : }
4974 : }
4975 : } else {
4976 : // Zone has no infiltration objects
4977 120427 : massConservation.InfiltrationMassFlowRate = 0.0;
4978 : }
4979 : }
4980 602135 : }
4981 :
4982 7037806 : void CalcZoneLeavingConditions(EnergyPlusData &state, bool const FirstHVACIteration)
4983 : {
4984 :
4985 : // SUBROUTINE INFORMATION:
4986 : // AUTHOR Richard Liesen
4987 : // DATE WRITTEN January 2001
4988 : // MODIFIED June 2003, FCW: add heat from airflow window to return air
4989 :
4990 : // PURPOSE OF THIS SUBROUTINE:
4991 : // Perform zone upate of the leaving conditions.
4992 :
4993 : // METHODOLOGY EMPLOYED:
4994 : // Energy Balance.
4995 :
4996 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
4997 : Real64 TempRetAir; // Return air temperature [C]
4998 : Real64 TempZoneAir; // Zone air temperature [C]
4999 : Real64 SumRetAirLatentGainRate;
5000 :
5001 61768559 : for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) {
5002 54730753 : if (!state.dataZoneEquip->ZoneEquipConfig(ZoneNum).IsControlled) continue;
5003 : // A return air system may not exist for certain systems; Therefore when no return node exists
5004 : // there is no update. Of course if there is no return air system then you cannot update
5005 : // the energy for the return air heat gain from the lights statements.
5006 46736683 : if (state.dataZoneEquip->ZoneEquipConfig(ZoneNum).NumReturnNodes == 0) continue;
5007 46733026 : int ZoneNode = state.dataZoneEquip->ZoneEquipConfig(ZoneNum).ZoneNode;
5008 46733026 : int ZoneMult = state.dataHeatBal->Zone(ZoneNum).Multiplier * state.dataHeatBal->Zone(ZoneNum).ListMultiplier;
5009 46733026 : auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum);
5010 93558712 : for (int nodeCount = 1; nodeCount <= state.dataZoneEquip->ZoneEquipConfig(ZoneNum).NumReturnNodes; ++nodeCount) {
5011 46825686 : int ReturnNode = state.dataZoneEquip->ZoneEquipConfig(ZoneNum).ReturnNode(nodeCount);
5012 46825686 : int ReturnNodeExhaustNum = state.dataZoneEquip->ZoneEquipConfig(ZoneNum).ReturnNodeExhaustNodeNum(nodeCount);
5013 :
5014 : // RETURN AIR HEAT GAIN from the Lights statement; this heat gain is stored in
5015 : // Add sensible heat gain from refrigerated cases with under case returns
5016 46825686 : Real64 QRetAir = InternalHeatGains::zoneSumAllReturnAirConvectionGains(state, ZoneNum, ReturnNode);
5017 :
5018 : // Need to add the energy to the return air from lights and from airflow windows. Where the heat
5019 : // is added depends on if there is system flow or not. If there is system flow the heat is added
5020 : // to the Zone Return Node. If there is no system flow then the heat is added back to the zone in the
5021 : // Correct step through the SysDepZoneLoads variable.
5022 :
5023 46825686 : Real64 MassFlowRA = state.dataLoopNodes->Node(ReturnNode).MassFlowRate / ZoneMult;
5024 46825686 : if (ReturnNodeExhaustNum > 0 && state.dataLoopNodes->Node(ReturnNodeExhaustNum).MassFlowRate > 0.0) {
5025 2885 : MassFlowRA += state.dataLoopNodes->Node(ReturnNodeExhaustNum).MassFlowRate;
5026 : }
5027 :
5028 : // user defined room air model may feed temp that differs from zone node
5029 46825686 : if (allocated(state.dataRoomAirMod->AirPatternZoneInfo)) {
5030 57258 : if ((state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).IsUsed) && (!state.dataGlobal->BeginEnvrnFlag)) {
5031 56898 : TempZoneAir = state.dataRoomAirMod->AirPatternZoneInfo(ZoneNum).Tleaving;
5032 56898 : TempRetAir = TempZoneAir;
5033 : } else {
5034 360 : TempZoneAir = state.dataLoopNodes->Node(ZoneNode).Temp;
5035 360 : TempRetAir = TempZoneAir;
5036 : }
5037 : } else {
5038 46768428 : TempZoneAir = state.dataLoopNodes->Node(ZoneNode).Temp;
5039 46768428 : TempRetAir = TempZoneAir;
5040 : }
5041 :
5042 46825686 : Real64 WinGapFlowToRA = 0.0; // Mass flow to return air from all airflow windows in zone [kg/s]
5043 46825686 : Real64 WinGapTtoRA = 0.0; // Temp of outlet flow mixture to return air from all airflow windows in zone [C]
5044 46825686 : Real64 WinGapFlowTtoRA = 0.0; // Sum of mass flow times outlet temp for all airflow windows in zone [(kg/s)-C]
5045 :
5046 46825686 : if (state.dataHeatBal->Zone(ZoneNum).HasAirFlowWindowReturn) {
5047 0 : for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) {
5048 0 : auto &thisSpace = state.dataHeatBal->space(spaceNum);
5049 0 : for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) {
5050 0 : if (state.dataSurface->SurfWinAirflowThisTS(SurfNum) > 0.0 &&
5051 0 : state.dataSurface->SurfWinAirflowDestination(SurfNum) == DataSurfaces::WindowAirFlowDestination::Return) {
5052 0 : Real64 FlowThisTS = PsyRhoAirFnPbTdbW(state,
5053 0 : state.dataEnvrn->OutBaroPress,
5054 0 : state.dataSurface->SurfWinTAirflowGapOutlet(SurfNum),
5055 0 : state.dataLoopNodes->Node(ZoneNode).HumRat) *
5056 0 : state.dataSurface->SurfWinAirflowThisTS(SurfNum) * state.dataSurface->Surface(SurfNum).Width;
5057 0 : WinGapFlowToRA += FlowThisTS;
5058 0 : WinGapFlowTtoRA += FlowThisTS * state.dataSurface->SurfWinTAirflowGapOutlet(SurfNum);
5059 : }
5060 : }
5061 : }
5062 : }
5063 46825686 : if (WinGapFlowToRA > 0.0) WinGapTtoRA = WinGapFlowTtoRA / WinGapFlowToRA;
5064 : // the flag NoHeatToReturnAir is TRUE if the system is zonal only or is central with on/off air flow. In these
5065 : // cases the heat to return air is treated as a zone heat gain and dealt with in CalcZoneSums in
5066 : // MODULE ZoneTempPredictorCorrector.
5067 46825686 : if (!state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) {
5068 39937712 : Real64 CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneNode).HumRat);
5069 39937712 : if (MassFlowRA > 0.0) {
5070 33014466 : if (WinGapFlowToRA > 0.0) {
5071 : // Add heat-to-return from window gap airflow
5072 0 : if (MassFlowRA >= WinGapFlowToRA) {
5073 0 : TempRetAir = (WinGapFlowTtoRA + (MassFlowRA - WinGapFlowToRA) * TempZoneAir) / MassFlowRA;
5074 : } else {
5075 : // All of return air comes from flow through airflow windows
5076 0 : TempRetAir = WinGapTtoRA;
5077 : // Put heat from window airflow that exceeds return air flow into zone air
5078 0 : thisZoneHB.SysDepZoneLoads += (WinGapFlowToRA - MassFlowRA) * CpAir * (WinGapTtoRA - TempZoneAir);
5079 : }
5080 : }
5081 : // Add heat-to-return from lights
5082 33014466 : TempRetAir += QRetAir / (MassFlowRA * CpAir);
5083 33014466 : if (TempRetAir > DataHVACGlobals::RetTempMax) {
5084 14956 : state.dataLoopNodes->Node(ReturnNode).Temp = DataHVACGlobals::RetTempMax;
5085 14956 : if (!state.dataGlobal->ZoneSizingCalc) {
5086 3406 : thisZoneHB.SysDepZoneLoads += CpAir * MassFlowRA * (TempRetAir - DataHVACGlobals::RetTempMax);
5087 : }
5088 32999510 : } else if (TempRetAir < DataHVACGlobals::RetTempMin) {
5089 24 : state.dataLoopNodes->Node(ReturnNode).Temp = DataHVACGlobals::RetTempMin;
5090 24 : if (!state.dataGlobal->ZoneSizingCalc) {
5091 20 : thisZoneHB.SysDepZoneLoads += CpAir * MassFlowRA * (TempRetAir - DataHVACGlobals::RetTempMin);
5092 : }
5093 : } else {
5094 32999486 : state.dataLoopNodes->Node(ReturnNode).Temp = TempRetAir;
5095 : }
5096 33014466 : if (ReturnNodeExhaustNum > 0 && state.dataLoopNodes->Node(ReturnNodeExhaustNum).MassFlowRate > 0.0 && QRetAir > 0.0) {
5097 2885 : if (state.dataZoneEquip->ZoneEquipConfig(ZoneNum).SharedExhaustNode(nodeCount) != LightReturnExhaustConfig::Shared) {
5098 2885 : state.dataLoopNodes->Node(ReturnNodeExhaustNum).Temp = TempRetAir;
5099 : } else {
5100 0 : state.dataLoopNodes->Node(ReturnNodeExhaustNum).Temp += QRetAir / (MassFlowRA * CpAir);
5101 : }
5102 : }
5103 : } else { // No return air flow
5104 : // Assign all heat-to-return from window gap airflow to zone air
5105 6923246 : if (WinGapFlowToRA > 0.0) thisZoneHB.SysDepZoneLoads += WinGapFlowToRA * CpAir * (WinGapTtoRA - TempZoneAir);
5106 : // Assign all heat-to-return from lights to zone air
5107 6923246 : if (QRetAir > 0.0) thisZoneHB.SysDepZoneLoads += QRetAir;
5108 6923246 : state.dataLoopNodes->Node(ReturnNode).Temp = state.dataLoopNodes->Node(ZoneNode).Temp;
5109 : }
5110 : } else {
5111 : // update the return air node for zonal and central on/off systems
5112 6887974 : state.dataLoopNodes->Node(ReturnNode).Temp = state.dataLoopNodes->Node(ZoneNode).Temp;
5113 : }
5114 :
5115 : // Update the rest of the Return Air Node conditions, if the return air system exists!
5116 46825686 : state.dataLoopNodes->Node(ReturnNode).Press = state.dataLoopNodes->Node(ZoneNode).Press;
5117 :
5118 : // Include impact of under case returns for refrigerated display case when updating the return air node humidity
5119 46825686 : if (!state.dataHeatBal->Zone(ZoneNum).NoHeatToReturnAir) {
5120 39937712 : if (MassFlowRA > 0) {
5121 33014466 : SumRetAirLatentGainRate = InternalHeatGains::SumAllReturnAirLatentGains(state, ZoneNum, ReturnNode);
5122 33014466 : Real64 H2OHtOfVap = PsyHgAirFnWTdb(state.dataLoopNodes->Node(ZoneNode).HumRat, state.dataLoopNodes->Node(ReturnNode).Temp);
5123 33014466 : state.dataLoopNodes->Node(ReturnNode).HumRat =
5124 33014466 : state.dataLoopNodes->Node(ZoneNode).HumRat + (SumRetAirLatentGainRate / (H2OHtOfVap * MassFlowRA));
5125 : } else {
5126 : // If no mass flow rate exists, include the latent HVAC case credit with the latent Zone case credit
5127 6923246 : state.dataLoopNodes->Node(ReturnNode).HumRat = state.dataLoopNodes->Node(ZoneNode).HumRat;
5128 6923246 : state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToZone +=
5129 6923246 : state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToHVAC;
5130 : // shouldn't the HVAC term be zeroed out then?
5131 6923246 : SumRetAirLatentGainRate = InternalHeatGains::SumAllReturnAirLatentGains(state, ZoneNum, ReturnNode);
5132 6923246 : thisZoneHB.ZoneLatentGain += SumRetAirLatentGainRate;
5133 : }
5134 : } else {
5135 6887974 : state.dataLoopNodes->Node(ReturnNode).HumRat = state.dataLoopNodes->Node(ZoneNode).HumRat;
5136 6887974 : state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToZone += state.dataHeatBal->RefrigCaseCredit(ZoneNum).LatCaseCreditToHVAC;
5137 : // shouldn't the HVAC term be zeroed out then?
5138 6887974 : SumRetAirLatentGainRate = InternalHeatGains::SumAllReturnAirLatentGains(state, ZoneNum, ReturnNode);
5139 6887974 : thisZoneHB.ZoneLatentGain += SumRetAirLatentGainRate;
5140 : }
5141 :
5142 46825686 : state.dataLoopNodes->Node(ReturnNode).Enthalpy =
5143 46825686 : PsyHFnTdbW(state.dataLoopNodes->Node(ReturnNode).Temp, state.dataLoopNodes->Node(ReturnNode).HumRat);
5144 :
5145 46825686 : if (state.dataContaminantBalance->Contaminant.CO2Simulation)
5146 674792 : state.dataLoopNodes->Node(ReturnNode).CO2 = state.dataLoopNodes->Node(ZoneNode).CO2;
5147 46825686 : if (state.dataContaminantBalance->Contaminant.GenericContamSimulation)
5148 529395 : state.dataLoopNodes->Node(ReturnNode).GenContam = state.dataLoopNodes->Node(ZoneNode).GenContam;
5149 :
5150 : } // End of check for a return air node, which implies a return air system.
5151 :
5152 : // Reset current deadband flags, remaining output required, so no impact beyond zone equipment
5153 46733026 : InitSystemOutputRequired(state, ZoneNum, FirstHVACIteration, true);
5154 : }
5155 7037806 : }
5156 :
5157 7037806 : void UpdateZoneEquipment(EnergyPlusData &state, bool &SimAir)
5158 : {
5159 : // SUBROUTINE INFORMATION:
5160 : // AUTHOR Russ Taylor
5161 : // DATE WRITTEN Nov 1997
5162 :
5163 : // PURPOSE OF THIS SUBROUTINE:
5164 : // This subroutine performs the update for Zone Equipment Management.
5165 : // Specifically, it transfers the conditions from the zone equipment return air nodes across
5166 : // to the air loop side, allowing for multiple return air nodes
5167 :
5168 : // Transfer the conditions from the zone equipment return air nodes across
5169 : // to the air loop side, allowing for multiple return air nodes
5170 18028640 : for (int ZoneGroupNum = 1; ZoneGroupNum <= state.dataHVACGlobal->NumPrimaryAirSys; ++ZoneGroupNum) {
5171 21981668 : for (int RetAirPathNum = 1; RetAirPathNum <= state.dataAirLoop->AirToZoneNodeInfo(ZoneGroupNum).NumReturnNodes; ++RetAirPathNum) {
5172 21981668 : HVACInterfaceManager::UpdateHVACInterface(state,
5173 : ZoneGroupNum,
5174 : DataConvergParams::CalledFrom::AirSystemDemandSide,
5175 10990834 : state.dataAirLoop->AirToZoneNodeInfo(ZoneGroupNum).ZoneEquipReturnNodeNum(RetAirPathNum),
5176 10990834 : state.dataAirLoop->AirToZoneNodeInfo(ZoneGroupNum).AirLoopReturnNodeNum(RetAirPathNum),
5177 : SimAir);
5178 : }
5179 : }
5180 7037806 : }
5181 :
5182 3631401 : void CalcAirFlowSimple(EnergyPlusData &state,
5183 : int const SysTimestepLoop, // System time step index
5184 : bool const AdjustZoneMixingFlowFlag, // holds zone mixing air flow calc status
5185 : bool const AdjustZoneInfiltrationFlowFlag // holds zone mixing air flow calc status
5186 : )
5187 : {
5188 : // SUBROUTINE INFORMATION:
5189 : // AUTHOR Legacy Code
5190 : // MODIFIED Shirey, Jan 2008 (MIXING objects, use avg. conditions for Cp, Air Density and Hfg)
5191 : // MODIFIED L. Lawrie and L. GU, Jan. 2008 (Allow multiple infiltration and ventilation objects)
5192 : // B. Griffith. Jan 2009 add infiltration, residential basic/sherman-grimsrud and enhanced/AIM2
5193 : // L. Lawrie - March 2009 - move ventilation electric calculation to this routine (for
5194 : // Electricity Net.
5195 : // L. Gu - Dec. 2009 - Added a new ventilation object to calculate flow rate based on wind and stack
5196 : // effect through an opening.
5197 : // MODIFIED Stovall - Aug 2011 (add refrigerator door mixing)
5198 :
5199 : // PURPOSE OF THIS SUBROUTINE:
5200 : // This subroutine calculates the air component of the heat balance.
5201 :
5202 3631401 : constexpr Real64 StdGravity(9.80665); // The acceleration of gravity at the sea level (m/s2)
5203 : static constexpr std::string_view RoutineNameVentilation("CalcAirFlowSimple:Ventilation");
5204 : static constexpr std::string_view RoutineNameMixing("CalcAirFlowSimple:Mixing");
5205 : static constexpr std::string_view RoutineNameCrossMixing("CalcAirFlowSimple:CrossMixing");
5206 : static constexpr std::string_view RoutineNameRefrigerationDoorMixing("CalcAirFlowSimple:RefrigerationDoorMixing");
5207 : static constexpr std::string_view RoutineNameInfiltration("CalcAirFlowSimple:Infiltration");
5208 : static constexpr std::string_view RoutineNameZoneAirBalance("CalcAirFlowSimple:ZoneAirBalance");
5209 :
5210 31605338 : for (auto &thisZoneHB : state.dataZoneTempPredictorCorrector->zoneHeatBalance) {
5211 27973937 : thisZoneHB.MCPM = 0.0;
5212 27973937 : thisZoneHB.MCPTM = 0.0;
5213 27973937 : thisZoneHB.MCPTI = 0.0;
5214 27973937 : thisZoneHB.MCPI = 0.0;
5215 27973937 : thisZoneHB.OAMFL = 0.0;
5216 27973937 : thisZoneHB.MCPTV = 0.0;
5217 27973937 : thisZoneHB.MCPV = 0.0;
5218 27973937 : thisZoneHB.VAMFL = 0.0;
5219 27973937 : thisZoneHB.MDotCPOA = 0.0;
5220 27973937 : thisZoneHB.MDotOA = 0.0;
5221 27973937 : thisZoneHB.MCPThermChim = 0.0;
5222 27973937 : thisZoneHB.ThermChimAMFL = 0.0;
5223 27973937 : thisZoneHB.MCPTThermChim = 0.0;
5224 27973937 : thisZoneHB.MixingMassFlowZone = 0.0;
5225 27973937 : thisZoneHB.MixingMassFlowXHumRat = 0.0;
5226 : }
5227 3631401 : if (state.dataHeatBal->doSpaceHeatBalance) {
5228 35014 : for (auto &thisSpaceHB : state.dataZoneTempPredictorCorrector->spaceHeatBalance) {
5229 30012 : thisSpaceHB.MCPM = 0.0;
5230 30012 : thisSpaceHB.MCPTM = 0.0;
5231 30012 : thisSpaceHB.MCPTI = 0.0;
5232 30012 : thisSpaceHB.MCPI = 0.0;
5233 30012 : thisSpaceHB.OAMFL = 0.0;
5234 30012 : thisSpaceHB.MCPTV = 0.0;
5235 30012 : thisSpaceHB.MCPV = 0.0;
5236 30012 : thisSpaceHB.VAMFL = 0.0;
5237 30012 : thisSpaceHB.MDotCPOA = 0.0;
5238 30012 : thisSpaceHB.MDotOA = 0.0;
5239 30012 : thisSpaceHB.MCPThermChim = 0.0;
5240 30012 : thisSpaceHB.ThermChimAMFL = 0.0;
5241 30012 : thisSpaceHB.MCPTThermChim = 0.0;
5242 30012 : thisSpaceHB.MixingMassFlowZone = 0.0;
5243 30012 : thisSpaceHB.MixingMassFlowXHumRat = 0.0;
5244 : }
5245 : }
5246 3690166 : if (state.dataContaminantBalance->Contaminant.CO2Simulation &&
5247 58765 : state.dataHeatBal->TotMixing + state.dataHeatBal->TotCrossMixing + state.dataHeatBal->TotRefDoorMixing > 0)
5248 17655 : state.dataContaminantBalance->MixingMassFlowCO2 = 0.0;
5249 3654879 : if (state.dataContaminantBalance->Contaminant.GenericContamSimulation &&
5250 23478 : state.dataHeatBal->TotMixing + state.dataHeatBal->TotCrossMixing + state.dataHeatBal->TotRefDoorMixing > 0)
5251 17655 : state.dataContaminantBalance->MixingMassFlowGC = 0.0;
5252 :
5253 3631401 : Real64 IVF = 0.0; // DESIGN INFILTRATION FLOW RATE (M**3/SEC)
5254 3631401 : Real64 VVF = 0.0; // DESIGN VENTILATION FLOW RATE (M**3/SEC)
5255 :
5256 3631401 : if (!state.dataHeatBal->AirFlowFlag) return;
5257 : // AirflowNetwork Multizone field /= SIMPLE
5258 3790249 : if (!(state.afn->simulation_control.type == AirflowNetwork::ControlType::NoMultizoneOrDistribution ||
5259 158848 : state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation)) {
5260 152186 : return;
5261 : }
5262 :
5263 3479215 : EarthTube::ManageEarthTube(state);
5264 3479215 : CoolTower::ManageCoolTower(state);
5265 3479215 : ThermalChimney::ManageThermalChimney(state);
5266 :
5267 : // Assign zone air temperature
5268 30951107 : for (auto &thisZoneHB : state.dataZoneTempPredictorCorrector->zoneHeatBalance) {
5269 27471892 : thisZoneHB.MixingMAT = thisZoneHB.MAT;
5270 27471892 : thisZoneHB.MixingHumRat = thisZoneHB.ZoneAirHumRat;
5271 : // This is only temporary fix for CR8867. (L. Gu 8/12)
5272 27471892 : if (SysTimestepLoop == 1) {
5273 2682962 : thisZoneHB.MixingMAT = thisZoneHB.XMPT;
5274 2682962 : thisZoneHB.MixingHumRat = thisZoneHB.WZoneTimeMinusP;
5275 : }
5276 : }
5277 3479215 : if (state.dataHeatBal->doSpaceHeatBalance) {
5278 35014 : for (auto &thisSpaceHB : state.dataZoneTempPredictorCorrector->spaceHeatBalance) {
5279 30012 : thisSpaceHB.MixingMAT = thisSpaceHB.MAT;
5280 30012 : thisSpaceHB.MixingHumRat = thisSpaceHB.ZoneAirHumRat;
5281 : // This is only temporary fix for CR8867. (L. Gu 8/12)
5282 30012 : if (SysTimestepLoop == 1) {
5283 2478 : thisSpaceHB.MixingMAT = thisSpaceHB.XMPT;
5284 2478 : thisSpaceHB.MixingHumRat = thisSpaceHB.WZoneTimeMinusP;
5285 : }
5286 : }
5287 : }
5288 :
5289 : // Initialization of ZoneAirBalance
5290 3479215 : if (state.dataHeatBal->TotZoneAirBalance > 0) {
5291 28710 : for (auto &e : state.dataHeatBal->ZoneAirBalance) {
5292 14355 : e.BalMassFlowRate = 0.0;
5293 14355 : e.InfMassFlowRate = 0.0;
5294 14355 : e.NatMassFlowRate = 0.0;
5295 14355 : e.ExhMassFlowRate = 0.0;
5296 14355 : e.IntMassFlowRate = 0.0;
5297 14355 : e.ERVMassFlowRate = 0.0;
5298 : }
5299 : }
5300 :
5301 3479215 : if (state.dataHeatBal->TotVentilation > 0) {
5302 1469703 : for (auto &e : state.dataHeatBal->ZnAirRpt) {
5303 1254582 : e.VentilFanElec = 0.0;
5304 : }
5305 : }
5306 :
5307 : // Process the scheduled Ventilation for air heat balance
5308 4144431 : for (int j = 1; j <= state.dataHeatBal->TotVentilation; ++j) {
5309 665216 : auto &thisVentilation = state.dataHeatBal->Ventilation(j);
5310 665216 : int zoneNum = thisVentilation.ZonePtr;
5311 665216 : auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum);
5312 665216 : Real64 thisMixingMAT = 0.0;
5313 665216 : if (state.dataHeatBal->doSpaceHeatBalance) {
5314 0 : thisMixingMAT = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisVentilation.spaceIndex).MixingMAT;
5315 : } else {
5316 665216 : thisMixingMAT = thisZoneHB.MixingMAT;
5317 : }
5318 665216 : thisVentilation.FanPower = 0.0;
5319 665216 : thisVentilation.MCP = 0.0;
5320 :
5321 665216 : Real64 TempExt = state.dataHeatBal->Zone(zoneNum).OutDryBulbTemp;
5322 665216 : Real64 WindSpeedExt = state.dataHeatBal->Zone(zoneNum).WindSpeed;
5323 665216 : Real64 WindDirExt = state.dataHeatBal->Zone(zoneNum).WindDir;
5324 665216 : Real64 thisMCPV = 0.0;
5325 665216 : Real64 thisVAMFL = 0.0;
5326 665216 : Real64 thisMCPTV = 0.0;
5327 :
5328 : // Use air node information linked to the zone if defined
5329 665216 : Real64 HumRatExt = 0.0;
5330 665216 : Real64 EnthalpyExt = 0.0;
5331 665216 : if (state.dataHeatBal->Zone(zoneNum).LinkedOutAirNode > 0) {
5332 0 : HumRatExt = state.dataLoopNodes->Node(state.dataHeatBal->Zone(zoneNum).LinkedOutAirNode).HumRat;
5333 0 : EnthalpyExt = state.dataLoopNodes->Node(state.dataHeatBal->Zone(zoneNum).LinkedOutAirNode).Enthalpy;
5334 : } else {
5335 665216 : HumRatExt = state.dataEnvrn->OutHumRat;
5336 665216 : EnthalpyExt = state.dataEnvrn->OutEnthalpy;
5337 : }
5338 : Real64 AirDensity =
5339 665216 : PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, TempExt, HumRatExt, RoutineNameVentilation); // Density of air (kg/m^3)
5340 665216 : Real64 CpAir = PsyCpAirFnW(HumRatExt);
5341 :
5342 : // Hybrid ventilation global control
5343 665216 : int I = 0;
5344 665216 : if (thisVentilation.HybridControlType == DataHeatBalance::HybridCtrlType::Global && thisVentilation.HybridControlMasterNum > 0) {
5345 2657 : I = thisVentilation.HybridControlMasterNum;
5346 5314 : if (j == I) {
5347 1457 : thisVentilation.HybridControlMasterStatus = false;
5348 : }
5349 : } else {
5350 662559 : I = j;
5351 : }
5352 665216 : auto &hybridControlVentilation = state.dataHeatBal->Ventilation(I);
5353 : // Hybrid controlled zone MAT
5354 665216 : Real64 hybridControlZoneMAT = state.dataZoneTempPredictorCorrector->zoneHeatBalance(hybridControlVentilation.ZonePtr).MixingMAT;
5355 :
5356 : // Check scheduled temperatures
5357 665216 : if (hybridControlVentilation.MinIndoorTempSchedPtr > 0) {
5358 36161 : hybridControlVentilation.MinIndoorTemperature =
5359 36161 : ScheduleManager::GetCurrentScheduleValue(state, hybridControlVentilation.MinIndoorTempSchedPtr);
5360 : }
5361 665216 : if (hybridControlVentilation.MaxIndoorTempSchedPtr > 0) {
5362 36161 : hybridControlVentilation.MaxIndoorTemperature =
5363 36161 : ScheduleManager::GetCurrentScheduleValue(state, hybridControlVentilation.MaxIndoorTempSchedPtr);
5364 : }
5365 : // Ensure the minimum indoor temperature <= the maximum indoor temperature
5366 665216 : if (hybridControlVentilation.MinIndoorTempSchedPtr > 0 || hybridControlVentilation.MaxIndoorTempSchedPtr > 0) {
5367 36161 : if (hybridControlVentilation.MinIndoorTemperature > hybridControlVentilation.MaxIndoorTemperature) {
5368 0 : ++hybridControlVentilation.IndoorTempErrCount;
5369 0 : if (hybridControlVentilation.IndoorTempErrCount < 2) {
5370 0 : ShowWarningError(
5371 : state,
5372 0 : "Ventilation indoor temperature control: The minimum indoor temperature is above the maximum indoor temperature in " +
5373 : hybridControlVentilation.Name);
5374 0 : ShowContinueError(state, "The minimum indoor temperature is set to the maximum indoor temperature. Simulation continues.");
5375 0 : ShowContinueErrorTimeStamp(state, " Occurrence info:");
5376 : } else {
5377 0 : ShowRecurringWarningErrorAtEnd(state,
5378 : "The minimum indoor temperature is still above the maximum indoor temperature",
5379 : hybridControlVentilation.IndoorTempErrIndex,
5380 : hybridControlVentilation.MinIndoorTemperature,
5381 : hybridControlVentilation.MinIndoorTemperature);
5382 : }
5383 0 : hybridControlVentilation.MinIndoorTemperature = hybridControlVentilation.MaxIndoorTemperature;
5384 : }
5385 : }
5386 665216 : if (hybridControlVentilation.MinOutdoorTempSchedPtr > 0) {
5387 36161 : hybridControlVentilation.MinOutdoorTemperature =
5388 36161 : ScheduleManager::GetCurrentScheduleValue(state, hybridControlVentilation.MinOutdoorTempSchedPtr);
5389 : }
5390 665216 : if (hybridControlVentilation.MaxOutdoorTempSchedPtr > 0) {
5391 36161 : hybridControlVentilation.MaxOutdoorTemperature =
5392 36161 : ScheduleManager::GetCurrentScheduleValue(state, hybridControlVentilation.MaxOutdoorTempSchedPtr);
5393 : }
5394 : // Ensure the minimum outdoor temperature <= the maximum outdoor temperature
5395 665216 : if (hybridControlVentilation.MinOutdoorTempSchedPtr > 0 || hybridControlVentilation.MaxOutdoorTempSchedPtr > 0) {
5396 36161 : if (hybridControlVentilation.MinOutdoorTemperature > hybridControlVentilation.MaxOutdoorTemperature) {
5397 0 : ++hybridControlVentilation.OutdoorTempErrCount;
5398 0 : if (hybridControlVentilation.OutdoorTempErrCount < 2) {
5399 0 : ShowWarningError(state,
5400 : "Ventilation outdoor temperature control: The minimum outdoor temperature is above the maximum outdoor "
5401 0 : "temperature in " +
5402 : hybridControlVentilation.Name);
5403 0 : ShowContinueError(state, "The minimum outdoor temperature is set to the maximum outdoor temperature. Simulation continues.");
5404 0 : ShowContinueErrorTimeStamp(state, " Occurrence info:");
5405 : } else {
5406 0 : ShowRecurringWarningErrorAtEnd(state,
5407 : "The minimum outdoor temperature is still above the maximum outdoor temperature",
5408 : hybridControlVentilation.OutdoorTempErrIndex,
5409 : hybridControlVentilation.MinOutdoorTemperature,
5410 : hybridControlVentilation.MinOutdoorTemperature);
5411 : }
5412 0 : hybridControlVentilation.MinIndoorTemperature = hybridControlVentilation.MaxIndoorTemperature;
5413 : }
5414 : }
5415 665216 : if (hybridControlVentilation.DeltaTempSchedPtr > 0) {
5416 36161 : hybridControlVentilation.DelTemperature = ScheduleManager::GetCurrentScheduleValue(state, hybridControlVentilation.DeltaTempSchedPtr);
5417 : }
5418 : // Skip this if the zone is below the minimum indoor temperature limit
5419 665216 : if ((hybridControlZoneMAT < hybridControlVentilation.MinIndoorTemperature) && (!thisVentilation.EMSSimpleVentOn)) continue;
5420 : // Skip this if the zone is above the maximum indoor temperature limit
5421 618801 : if ((hybridControlZoneMAT > hybridControlVentilation.MaxIndoorTemperature) && (!thisVentilation.EMSSimpleVentOn)) continue;
5422 : // Skip if below the temperature difference limit (3/12/03 Negative DelTemperature allowed now)
5423 617209 : if (((hybridControlZoneMAT - TempExt) < hybridControlVentilation.DelTemperature) && (!thisVentilation.EMSSimpleVentOn)) continue;
5424 : // Skip this if the outdoor temperature is below the minimum outdoor temperature limit
5425 507555 : if ((TempExt < hybridControlVentilation.MinOutdoorTemperature) && (!thisVentilation.EMSSimpleVentOn)) continue;
5426 : // Skip this if the outdoor temperature is above the maximum outdoor temperature limit
5427 312207 : if ((TempExt > hybridControlVentilation.MaxOutdoorTemperature) && (!thisVentilation.EMSSimpleVentOn)) continue;
5428 : // Skip this if the outdoor wind speed is above the maximum windspeed limit
5429 230692 : if ((WindSpeedExt > hybridControlVentilation.MaxWindSpeed) && (!thisVentilation.EMSSimpleVentOn)) continue;
5430 :
5431 : // Hybrid ventilation controls
5432 230692 : if ((thisVentilation.HybridControlType == DataHeatBalance::HybridCtrlType::Close) && (!thisVentilation.EMSSimpleVentOn)) continue;
5433 221317 : if (thisVentilation.HybridControlType == DataHeatBalance::HybridCtrlType::Global && thisVentilation.HybridControlMasterNum > 0) {
5434 2067 : if (j == I) thisVentilation.HybridControlMasterStatus = true;
5435 : }
5436 :
5437 221317 : if (thisVentilation.ModelType == DataHeatBalance::VentilationModelType::DesignFlowRate) {
5438 : // CR6845 if calculated < 0, don't propagate.
5439 114302 : VVF = thisVentilation.DesignLevel * ScheduleManager::GetCurrentScheduleValue(state, thisVentilation.SchedPtr);
5440 :
5441 114302 : if (thisVentilation.EMSSimpleVentOn) VVF = thisVentilation.EMSimpleVentFlowRate;
5442 :
5443 114302 : if (VVF < 0.0) VVF = 0.0;
5444 228604 : thisVentilation.MCP = VVF * AirDensity * CpAir *
5445 228604 : (thisVentilation.ConstantTermCoef + std::abs(TempExt - thisMixingMAT) * thisVentilation.TemperatureTermCoef +
5446 114302 : WindSpeedExt * (thisVentilation.VelocityTermCoef + WindSpeedExt * thisVentilation.VelocitySQTermCoef));
5447 114302 : if (thisVentilation.MCP < 0.0) thisVentilation.MCP = 0.0;
5448 114302 : Real64 VAMFL_temp = thisVentilation.MCP / CpAir;
5449 114302 : if (state.dataHeatBal->Zone(zoneNum).zoneOAQuadratureSum) {
5450 1672 : auto &thisZoneAirBalance = state.dataHeatBal->ZoneAirBalance(state.dataHeatBal->Zone(zoneNum).zoneOABalanceIndex);
5451 1672 : switch (thisVentilation.FanType) {
5452 : // ventilation type based calculation
5453 0 : case DataHeatBalance::VentilationType::Exhaust: {
5454 0 : thisZoneAirBalance.ExhMassFlowRate += VAMFL_temp;
5455 0 : } break;
5456 0 : case DataHeatBalance::VentilationType::Intake: {
5457 0 : thisZoneAirBalance.IntMassFlowRate += VAMFL_temp;
5458 0 : } break;
5459 0 : case DataHeatBalance::VentilationType::Natural: {
5460 0 : thisZoneAirBalance.NatMassFlowRate += VAMFL_temp;
5461 0 : } break;
5462 1672 : case DataHeatBalance::VentilationType::Balanced: {
5463 1672 : thisZoneAirBalance.BalMassFlowRate += VAMFL_temp;
5464 1672 : } break;
5465 0 : default:
5466 0 : break;
5467 : }
5468 : } else {
5469 112630 : thisMCPV = thisVentilation.MCP;
5470 112630 : thisVAMFL = VAMFL_temp;
5471 : }
5472 114302 : if (thisVentilation.FanEfficiency > 0.0) {
5473 114302 : thisVentilation.FanPower = VAMFL_temp * thisVentilation.FanPressure / (thisVentilation.FanEfficiency * AirDensity);
5474 114302 : if (thisVentilation.FanType == DataHeatBalance::VentilationType::Balanced) thisVentilation.FanPower *= 2.0;
5475 : // calc electric
5476 114302 : if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithDistributionOnlyDuringFanOperation) {
5477 : // CR7608 IF (.not. TurnFansOn .or. .not. AirflowNetworkZoneFlag(zoneNum)) &
5478 6960 : if (!state.dataGlobal->KickOffSimulation) {
5479 16963 : if (!(state.dataZoneEquip->ZoneEquipAvail(zoneNum) == DataHVACGlobals::CycleOn ||
5480 10753 : state.dataZoneEquip->ZoneEquipAvail(zoneNum) == DataHVACGlobals::CycleOnZoneFansOnly) ||
5481 3824 : !state.afn->AirflowNetworkZoneFlag(zoneNum))
5482 3105 : state.dataHeatBal->ZnAirRpt(zoneNum).VentilFanElec +=
5483 3105 : thisVentilation.FanPower * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
5484 31 : } else if (!state.afn->AirflowNetworkZoneFlag(zoneNum)) {
5485 0 : state.dataHeatBal->ZnAirRpt(zoneNum).VentilFanElec +=
5486 0 : thisVentilation.FanPower * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
5487 : }
5488 : } else {
5489 107342 : state.dataHeatBal->ZnAirRpt(zoneNum).VentilFanElec +=
5490 107342 : thisVentilation.FanPower * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
5491 : }
5492 : }
5493 : // Intake fans will add some heat to the air, raising the temperature for an intake fan...
5494 209415 : if (thisVentilation.FanType == DataHeatBalance::VentilationType::Intake ||
5495 95113 : thisVentilation.FanType == DataHeatBalance::VentilationType::Balanced) {
5496 89466 : Real64 OutletAirEnthalpy = 0.0;
5497 89466 : if (VAMFL_temp == 0.0) {
5498 12375 : OutletAirEnthalpy = EnthalpyExt;
5499 : } else {
5500 77091 : if (thisVentilation.FanPower > 0.0) {
5501 77091 : if (thisVentilation.FanType == DataHeatBalance::VentilationType::Balanced) {
5502 70277 : OutletAirEnthalpy = EnthalpyExt + thisVentilation.FanPower / VAMFL_temp / 2.0; // Half fan power to calculate inlet T
5503 : } else {
5504 6814 : OutletAirEnthalpy = EnthalpyExt + thisVentilation.FanPower / VAMFL_temp;
5505 : }
5506 : } else {
5507 0 : OutletAirEnthalpy = EnthalpyExt;
5508 : }
5509 : }
5510 89466 : thisVentilation.AirTemp = Psychrometrics::PsyTdbFnHW(OutletAirEnthalpy, HumRatExt);
5511 : } else {
5512 24836 : thisVentilation.AirTemp = TempExt;
5513 : }
5514 114302 : if (!state.dataHeatBal->Zone(zoneNum).zoneOAQuadratureSum) thisMCPTV = thisVentilation.MCP * thisVentilation.AirTemp;
5515 107015 : } else if (thisVentilation.ModelType == DataHeatBalance::VentilationModelType::WindAndStack) {
5516 107015 : Real64 Cw = 0.0; // Opening effectivenss
5517 107015 : Real64 Cd = 0.0; // Discharge coefficent
5518 107015 : Real64 angle = 0.0; // Angle between wind direction and effective angle
5519 107015 : Real64 Qw = 0.0; // Volumetric flow driven by wind
5520 107015 : Real64 Qst = 0.0; // Volumetric flow driven by stack effect
5521 107015 : if (thisVentilation.OpenEff != DataGlobalConstants::AutoCalculate) {
5522 1235 : Cw = thisVentilation.OpenEff;
5523 : } else {
5524 : // linear interpolation between effective angle and wind direction
5525 105780 : angle = std::abs(WindDirExt - thisVentilation.EffAngle);
5526 105780 : if (angle > 180.0) angle -= 180.0;
5527 105780 : Cw = 0.55 + angle / 180.0 * (0.3 - 0.55);
5528 : }
5529 107015 : if (thisVentilation.DiscCoef != DataGlobalConstants::AutoCalculate) {
5530 1235 : Cd = thisVentilation.DiscCoef;
5531 : } else {
5532 105780 : Cd = 0.40 + 0.0045 * std::abs(TempExt - thisMixingMAT);
5533 : }
5534 107015 : Qw = Cw * thisVentilation.OpenArea * ScheduleManager::GetCurrentScheduleValue(state, thisVentilation.OpenAreaSchedPtr) * WindSpeedExt;
5535 214030 : Qst = Cd * thisVentilation.OpenArea * ScheduleManager::GetCurrentScheduleValue(state, thisVentilation.OpenAreaSchedPtr) *
5536 107015 : std::sqrt(2.0 * 9.81 * thisVentilation.DH * std::abs(TempExt - thisMixingMAT) / (thisMixingMAT + 273.15));
5537 107015 : VVF = std::sqrt(Qw * Qw + Qst * Qst);
5538 107015 : if (thisVentilation.EMSSimpleVentOn) VVF = thisVentilation.EMSimpleVentFlowRate;
5539 107015 : if (VVF < 0.0) VVF = 0.0;
5540 107015 : thisVentilation.MCP = VVF * AirDensity * CpAir;
5541 107015 : if (thisVentilation.MCP < 0.0) thisVentilation.MCP = 0.0;
5542 107015 : if (state.dataHeatBal->Zone(zoneNum).zoneOAQuadratureSum) {
5543 0 : state.dataHeatBal->ZoneAirBalance(state.dataHeatBal->Zone(zoneNum).zoneOABalanceIndex).NatMassFlowRate += thisVentilation.MCP / CpAir;
5544 : } else {
5545 107015 : thisMCPV = thisVentilation.MCP;
5546 107015 : thisVAMFL = thisVentilation.MCP / CpAir;
5547 107015 : thisVentilation.AirTemp = TempExt;
5548 107015 : thisMCPTV = thisVentilation.MCP * thisVentilation.AirTemp;
5549 : }
5550 : }
5551 : // Accumulate for zone and space
5552 221317 : thisZoneHB.MCPV += thisMCPV;
5553 221317 : thisZoneHB.VAMFL += thisVAMFL;
5554 221317 : thisZoneHB.MCPTV += thisMCPTV;
5555 221317 : if (state.dataHeatBal->doSpaceHeatBalance) {
5556 0 : auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisVentilation.spaceIndex);
5557 0 : thisSpaceHB.MCPV += thisMCPV;
5558 0 : thisSpaceHB.VAMFL += thisVAMFL;
5559 0 : thisSpaceHB.MCPTV += thisMCPTV;
5560 : }
5561 : }
5562 :
5563 : // Process Mixing
5564 4144541 : for (int j = 1; j <= state.dataHeatBal->TotMixing; ++j) {
5565 665326 : auto &thisMixing = state.dataHeatBal->Mixing(j);
5566 665326 : int thisZoneNum = thisMixing.ZonePtr;
5567 665326 : auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisZoneNum);
5568 665326 : int fromZoneNum = thisMixing.FromZone;
5569 665326 : Real64 TD = thisMixing.DeltaTemperature; // Delta Temp limit
5570 665326 : thisMixing.ReportFlag = false;
5571 :
5572 : // Get scheduled delta temperature
5573 665326 : if (thisMixing.DeltaTempSchedPtr > 0) {
5574 23489 : TD = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.DeltaTempSchedPtr);
5575 : }
5576 665326 : Real64 TZN = 0.0; // Temperature of this Zone/Space
5577 665326 : Real64 TZM = 0.0; // Temperature of From Zone/Space
5578 665326 : Real64 HumRatZN = 0.0; // HumRat of this Zone/Space
5579 665326 : Real64 HumRatZM = 0.0; // HumRat of From Zone/Space
5580 665326 : if (state.dataHeatBal->doSpaceHeatBalance) {
5581 0 : auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisMixing.spaceIndex);
5582 0 : auto &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisMixing.fromSpaceIndex);
5583 0 : TZN = thisSpaceHB.MixingMAT; // Temperature of this Space
5584 0 : TZM = fromSpaceHB.MixingMAT; // Temperature of From Space
5585 0 : HumRatZN = thisSpaceHB.MixingHumRat; // HumRat of this Space
5586 0 : HumRatZM = fromSpaceHB.MixingHumRat; // HumRat of From Space
5587 : } else {
5588 665326 : auto &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(fromZoneNum);
5589 665326 : TZN = thisZoneHB.MixingMAT; // Temperature of this zone
5590 665326 : TZM = fromZoneHB.MixingMAT; // Temperature of From Zone
5591 665326 : HumRatZN = thisZoneHB.MixingHumRat; // HumRat of this zone
5592 665326 : HumRatZM = fromZoneHB.MixingHumRat; // HumRat of From Zone
5593 : }
5594 665326 : Real64 thisMCPM = 0.0;
5595 665326 : Real64 thisMCPTM = 0.0;
5596 665326 : Real64 thisMixingMassFlow = 0.0;
5597 665326 : Real64 thisMixingMassFlowXHumRat = 0.0;
5598 :
5599 : // Hybrid ventilation controls
5600 665326 : if (thisMixing.HybridControlType == DataHeatBalance::HybridCtrlType::Close) continue;
5601 : // Check temperature limit
5602 654259 : bool MixingLimitFlag = false;
5603 :
5604 : // Hybrid ventilation global control
5605 654259 : int I = 0;
5606 654259 : if (thisMixing.HybridControlType == DataHeatBalance::HybridCtrlType::Global && thisMixing.HybridControlMasterNum > 0) {
5607 2057 : I = thisMixing.HybridControlMasterNum;
5608 2057 : if (!state.dataHeatBal->Ventilation(I).HybridControlMasterStatus) continue;
5609 : } else {
5610 : // Ensure the minimum indoor temperature <= the maximum indoor temperature
5611 652202 : Real64 MixingTmin = 0.0;
5612 652202 : Real64 MixingTmax = 0.0;
5613 652202 : if (thisMixing.MinIndoorTempSchedPtr > 0) MixingTmin = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.MinIndoorTempSchedPtr);
5614 652202 : if (thisMixing.MaxIndoorTempSchedPtr > 0) MixingTmax = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.MaxIndoorTempSchedPtr);
5615 652202 : if (thisMixing.MinIndoorTempSchedPtr > 0 && thisMixing.MaxIndoorTempSchedPtr > 0) {
5616 10365 : if (MixingTmin > MixingTmax) {
5617 0 : ++thisMixing.IndoorTempErrCount;
5618 0 : if (thisMixing.IndoorTempErrCount < 2) {
5619 0 : ShowWarningError(state,
5620 0 : "Mixing zone temperature control: The minimum zone temperature is above the maximum zone temperature in " +
5621 : thisMixing.Name);
5622 0 : ShowContinueError(state, "The minimum zone temperature is set to the maximum zone temperature. Simulation continues.");
5623 0 : ShowContinueErrorTimeStamp(state, " Occurrence info:");
5624 : } else {
5625 0 : ShowRecurringWarningErrorAtEnd(state,
5626 : "The minimum zone temperature is still above the maximum zone temperature",
5627 : thisMixing.IndoorTempErrIndex,
5628 : MixingTmin,
5629 : MixingTmin);
5630 : }
5631 0 : MixingTmin = MixingTmax;
5632 : }
5633 : }
5634 652202 : if (thisMixing.MinIndoorTempSchedPtr > 0) {
5635 10365 : if (TZN < MixingTmin) MixingLimitFlag = true;
5636 : }
5637 652202 : if (thisMixing.MaxIndoorTempSchedPtr > 0) {
5638 10365 : if (TZN > MixingTmax) MixingLimitFlag = true;
5639 : }
5640 : // Ensure the minimum source temperature <= the maximum source temperature
5641 652202 : if (thisMixing.MinSourceTempSchedPtr > 0) MixingTmin = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.MinSourceTempSchedPtr);
5642 652202 : if (thisMixing.MaxSourceTempSchedPtr > 0) MixingTmax = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.MaxSourceTempSchedPtr);
5643 652202 : if (thisMixing.MinSourceTempSchedPtr > 0 && thisMixing.MaxSourceTempSchedPtr > 0) {
5644 10365 : if (MixingTmin > MixingTmax) {
5645 0 : ++thisMixing.SourceTempErrCount;
5646 0 : if (thisMixing.SourceTempErrCount < 2) {
5647 0 : ShowWarningError(
5648 : state,
5649 0 : "Mixing source temperature control: The minimum source temperature is above the maximum source temperature in " +
5650 : thisMixing.Name);
5651 0 : ShowContinueError(state, "The minimum source temperature is set to the maximum source temperature. Simulation continues.");
5652 0 : ShowContinueErrorTimeStamp(state, " Occurrence info:");
5653 : } else {
5654 0 : ShowRecurringWarningErrorAtEnd(state,
5655 : "The minimum source temperature is still above the maximum source temperature",
5656 : thisMixing.SourceTempErrIndex,
5657 : MixingTmin,
5658 : MixingTmin);
5659 : }
5660 0 : MixingTmin = MixingTmax;
5661 : }
5662 : }
5663 652202 : if (thisMixing.MinSourceTempSchedPtr > 0) {
5664 10365 : if (TZM < MixingTmin) MixingLimitFlag = true;
5665 : }
5666 652202 : if (thisMixing.MaxSourceTempSchedPtr > 0) {
5667 10365 : if (TZM > MixingTmax) MixingLimitFlag = true;
5668 : }
5669 : // Ensure the minimum outdoor temperature <= the maximum outdoor temperature
5670 652202 : Real64 TempExt = state.dataHeatBal->Zone(thisZoneNum).OutDryBulbTemp;
5671 652202 : if (thisMixing.MinOutdoorTempSchedPtr > 0)
5672 10365 : MixingTmin = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.MinOutdoorTempSchedPtr);
5673 652202 : if (thisMixing.MaxOutdoorTempSchedPtr > 0)
5674 10365 : MixingTmax = ScheduleManager::GetCurrentScheduleValue(state, thisMixing.MaxOutdoorTempSchedPtr);
5675 652202 : if (thisMixing.MinOutdoorTempSchedPtr > 0 && thisMixing.MaxOutdoorTempSchedPtr > 0) {
5676 10365 : if (MixingTmin > MixingTmax) {
5677 0 : ++thisMixing.OutdoorTempErrCount;
5678 0 : if (thisMixing.OutdoorTempErrCount < 2) {
5679 0 : ShowWarningError(state,
5680 : "Mixing outdoor temperature control: The minimum outdoor temperature is above the maximum outdoor "
5681 0 : "temperature in " +
5682 : thisMixing.Name);
5683 0 : ShowContinueError(state, "The minimum outdoor temperature is set to the maximum source temperature. Simulation continues.");
5684 0 : ShowContinueErrorTimeStamp(state, " Occurrence info:");
5685 : } else {
5686 0 : ShowRecurringWarningErrorAtEnd(state,
5687 : "The minimum outdoor temperature is still above the maximum outdoor temperature",
5688 : thisMixing.OutdoorTempErrIndex,
5689 : MixingTmin,
5690 : MixingTmin);
5691 : }
5692 0 : MixingTmin = MixingTmax;
5693 : }
5694 : }
5695 652202 : if (thisMixing.MinOutdoorTempSchedPtr > 0) {
5696 10365 : if (TempExt < MixingTmin) MixingLimitFlag = true;
5697 : }
5698 652202 : if (thisMixing.MaxOutdoorTempSchedPtr > 0) {
5699 10365 : if (TempExt > MixingTmax) MixingLimitFlag = true;
5700 : }
5701 : }
5702 :
5703 653807 : if (thisMixing.HybridControlType != DataHeatBalance::HybridCtrlType::Global && MixingLimitFlag) continue;
5704 653807 : if (thisMixing.HybridControlType == DataHeatBalance::HybridCtrlType::Global) TD = 0.0;
5705 :
5706 : // Per Jan 17, 2008 conference call, agreed to use average conditions for Rho, Cp and Hfg
5707 1961421 : Real64 AirDensity = PsyRhoAirFnPbTdbW(
5708 2615228 : state, state.dataEnvrn->OutBaroPress, (TZN + TZM) / 2.0, (HumRatZN + HumRatZM) / 2.0, RoutineNameMixing); // Density of air (kg/m^3)
5709 653807 : Real64 CpAir = PsyCpAirFnW((HumRatZN + HumRatZM) / 2.0); // Use average conditions
5710 :
5711 : // If TD equals zero (default) set coefficients for full mixing otherwise test
5712 : // for mixing conditions if user input delta temp > 0, then from zone temp (TZM)
5713 : // must be td degrees warmer than zone temp (TZN). If user input delta temp < 0,
5714 : // then from zone temp (TZM) must be TD degrees cooler than zone temp (TZN).
5715 653807 : if (TD < 0.0) {
5716 0 : if (TZM < TZN + TD) {
5717 :
5718 0 : thisMixing.DesiredAirFlowRate = thisMixing.DesiredAirFlowRateSaved;
5719 0 : if (state.dataHeatBalFanSys->ZoneMassBalanceFlag(thisZoneNum) && AdjustZoneMixingFlowFlag) {
5720 0 : if (thisMixing.MixingMassFlowRate > 0.0) {
5721 0 : thisMixing.DesiredAirFlowRate = thisMixing.MixingMassFlowRate / AirDensity;
5722 : }
5723 : }
5724 0 : thisMixing.MixingMassFlowRate = thisMixing.DesiredAirFlowRate * AirDensity;
5725 :
5726 0 : thisMCPM = thisMixing.MixingMassFlowRate * CpAir;
5727 0 : thisMCPTM = thisMCPM * TZN;
5728 :
5729 : // Now to determine the moisture conditions
5730 0 : thisMixingMassFlow = thisMixing.DesiredAirFlowRate * AirDensity;
5731 0 : thisMixingMassFlowXHumRat = thisMixing.DesiredAirFlowRate * AirDensity * HumRatZM;
5732 0 : if (state.dataContaminantBalance->Contaminant.CO2Simulation) {
5733 0 : state.dataContaminantBalance->MixingMassFlowCO2(thisZoneNum) +=
5734 0 : thisMixing.DesiredAirFlowRate * AirDensity * state.dataContaminantBalance->ZoneAirCO2(fromZoneNum);
5735 : }
5736 0 : if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) {
5737 0 : state.dataContaminantBalance->MixingMassFlowGC(thisZoneNum) +=
5738 0 : thisMixing.DesiredAirFlowRate * AirDensity * state.dataContaminantBalance->ZoneAirGC(fromZoneNum);
5739 : }
5740 0 : thisMixing.ReportFlag = true;
5741 : }
5742 653807 : } else if (TD > 0.0) {
5743 7492 : if (TZM > TZN + TD) {
5744 0 : thisMixing.DesiredAirFlowRate = thisMixing.DesiredAirFlowRateSaved;
5745 0 : if (state.dataHeatBalFanSys->ZoneMassBalanceFlag(thisZoneNum) && AdjustZoneMixingFlowFlag) {
5746 0 : if (thisMixing.MixingMassFlowRate > 0.0) {
5747 0 : thisMixing.DesiredAirFlowRate = thisMixing.MixingMassFlowRate / AirDensity;
5748 : }
5749 : }
5750 0 : thisMixing.MixingMassFlowRate = thisMixing.DesiredAirFlowRate * AirDensity;
5751 :
5752 0 : thisMCPM = thisMixing.MixingMassFlowRate * CpAir;
5753 0 : thisMCPTM = thisMCPM * TZM;
5754 : // Now to determine the moisture conditions
5755 0 : thisMixingMassFlow = thisMixing.MixingMassFlowRate;
5756 0 : thisMixingMassFlowXHumRat = thisMixing.MixingMassFlowRate * HumRatZM;
5757 0 : if (state.dataContaminantBalance->Contaminant.CO2Simulation) {
5758 0 : state.dataContaminantBalance->MixingMassFlowCO2(thisZoneNum) +=
5759 0 : thisMixing.MixingMassFlowRate * state.dataContaminantBalance->ZoneAirCO2(fromZoneNum);
5760 : }
5761 0 : if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) {
5762 0 : state.dataContaminantBalance->MixingMassFlowGC(thisZoneNum) +=
5763 0 : thisMixing.MixingMassFlowRate * state.dataContaminantBalance->ZoneAirGC(fromZoneNum);
5764 : }
5765 0 : thisMixing.ReportFlag = true;
5766 : }
5767 646315 : } else if (TD == 0.0) {
5768 646315 : thisMixing.DesiredAirFlowRate = thisMixing.DesiredAirFlowRateSaved;
5769 646315 : if (state.dataHeatBalFanSys->ZoneMassBalanceFlag(thisZoneNum) && AdjustZoneMixingFlowFlag) {
5770 15252 : if (thisMixing.MixingMassFlowRate > 0.0) {
5771 14268 : thisMixing.DesiredAirFlowRate = thisMixing.MixingMassFlowRate / AirDensity;
5772 : }
5773 : }
5774 646315 : thisMixing.MixingMassFlowRate = thisMixing.DesiredAirFlowRate * AirDensity;
5775 :
5776 646315 : thisMCPM = thisMixing.MixingMassFlowRate * CpAir;
5777 646315 : thisMCPTM = thisMCPM * TZM;
5778 : // Now to determine the moisture conditions
5779 646315 : thisMixingMassFlow = thisMixing.MixingMassFlowRate;
5780 646315 : thisMixingMassFlowXHumRat = thisMixing.MixingMassFlowRate * HumRatZM;
5781 646315 : if (state.dataContaminantBalance->Contaminant.CO2Simulation) {
5782 0 : state.dataContaminantBalance->MixingMassFlowCO2(thisZoneNum) +=
5783 0 : thisMixing.MixingMassFlowRate * state.dataContaminantBalance->ZoneAirCO2(fromZoneNum);
5784 : }
5785 646315 : if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) {
5786 0 : state.dataContaminantBalance->MixingMassFlowGC(thisZoneNum) +=
5787 0 : thisMixing.MixingMassFlowRate * state.dataContaminantBalance->ZoneAirGC(fromZoneNum);
5788 : }
5789 646315 : thisMixing.ReportFlag = true;
5790 : }
5791 : // Accumulate for zone and space
5792 653807 : thisZoneHB.MCPM += thisMCPM;
5793 653807 : thisZoneHB.MCPTM += thisMCPTM;
5794 653807 : thisZoneHB.MixingMassFlowZone += thisMixingMassFlow;
5795 653807 : thisZoneHB.MixingMassFlowXHumRat += thisMixingMassFlowXHumRat;
5796 653807 : if (state.dataHeatBal->doSpaceHeatBalance) {
5797 0 : auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisMixing.spaceIndex);
5798 0 : thisSpaceHB.MCPM += thisMCPM;
5799 0 : thisSpaceHB.MCPTM += thisMCPTM;
5800 0 : thisSpaceHB.MixingMassFlowZone += thisMixingMassFlow;
5801 0 : thisSpaceHB.MixingMassFlowXHumRat += thisMixingMassFlowXHumRat;
5802 : }
5803 : }
5804 :
5805 : // COMPUTE CROSS ZONE
5806 : // AIR MIXING
5807 3522882 : for (int j = 1; j <= state.dataHeatBal->TotCrossMixing; ++j) {
5808 43667 : auto &thisCrossMixing = state.dataHeatBal->CrossMixing(j);
5809 43667 : int thisZoneNum = thisCrossMixing.ZonePtr;
5810 43667 : thisCrossMixing.ReportFlag = false;
5811 43667 : auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(thisZoneNum);
5812 43667 : int fromZoneNum = thisCrossMixing.FromZone;
5813 43667 : auto &fromZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(fromZoneNum);
5814 43667 : Real64 TD = thisCrossMixing.DeltaTemperature; // Delta Temp limit
5815 : // Get scheduled delta temperature
5816 43667 : if (thisCrossMixing.DeltaTempSchedPtr > 0) {
5817 0 : TD = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.DeltaTempSchedPtr);
5818 : }
5819 43667 : Real64 thisMCPxM = 0.0;
5820 43667 : Real64 thisMCPTxM = 0.0;
5821 43667 : Real64 thisXMixingMassFlow = 0.0;
5822 43667 : Real64 thisXMixingMassFlowXHumRat = 0.0;
5823 43667 : Real64 fromMCPxM = 0.0;
5824 43667 : Real64 fromMCPTxM = 0.0;
5825 43667 : Real64 fromXMixingMassFlowXHumRat = 0.0;
5826 :
5827 43667 : if (TD >= 0.0) {
5828 43667 : Real64 TZN = 0.0; // Temperature of this Zone/Space
5829 43667 : Real64 TZM = 0.0; // Temperature of From Zone/Space
5830 43667 : Real64 HumRatZN = 0.0; // HumRat of this Zone/Space
5831 43667 : Real64 HumRatZM = 0.0; // HumRat of From Zone/Space
5832 43667 : if (state.dataHeatBal->doSpaceHeatBalance) {
5833 0 : auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.spaceIndex);
5834 0 : auto &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.fromSpaceIndex);
5835 0 : TZN = thisSpaceHB.MixingMAT; // Temperature of this Space
5836 0 : TZM = fromSpaceHB.MixingMAT; // Temperature of From Space
5837 0 : HumRatZN = thisSpaceHB.MixingHumRat; // HumRat of this Space
5838 0 : HumRatZM = fromSpaceHB.MixingHumRat; // HumRat of From Space
5839 : } else {
5840 43667 : TZN = thisZoneHB.MixingMAT; // Temperature of this zone
5841 43667 : TZM = fromZoneHB.MixingMAT; // Temperature of From Zone
5842 43667 : HumRatZN = thisZoneHB.MixingHumRat; // HumRat of this zone
5843 43667 : HumRatZM = fromZoneHB.MixingHumRat; // HumRat of From Zone
5844 : }
5845 : // Check temperature limit
5846 43667 : bool MixingLimitFlag = false;
5847 : // Ensure the minimum indoor temperature <= the maximum indoor temperature
5848 43667 : Real64 MixingTmin = 0.0;
5849 43667 : Real64 MixingTmax = 0.0;
5850 43667 : if (thisCrossMixing.MinIndoorTempSchedPtr > 0)
5851 7492 : MixingTmin = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.MinIndoorTempSchedPtr);
5852 43667 : if (thisCrossMixing.MaxIndoorTempSchedPtr > 0)
5853 7492 : MixingTmax = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.MaxIndoorTempSchedPtr);
5854 43667 : if (thisCrossMixing.MinIndoorTempSchedPtr > 0 && thisCrossMixing.MaxIndoorTempSchedPtr > 0) {
5855 7492 : if (MixingTmin > MixingTmax) {
5856 0 : ++thisCrossMixing.IndoorTempErrCount;
5857 0 : if (thisCrossMixing.IndoorTempErrCount < 2) {
5858 0 : ShowWarningError(
5859 : state,
5860 0 : "CrossMixing zone temperature control: The minimum zone temperature is above the maximum zone temperature in " +
5861 : thisCrossMixing.Name);
5862 0 : ShowContinueError(state, "The minimum zone temperature is set to the maximum zone temperature. Simulation continues.");
5863 0 : ShowContinueErrorTimeStamp(state, " Occurrence info:");
5864 : } else {
5865 0 : ShowRecurringWarningErrorAtEnd(state,
5866 : "The minimum zone temperature is still above the maximum zone temperature",
5867 : thisCrossMixing.IndoorTempErrIndex,
5868 : MixingTmin,
5869 : MixingTmin);
5870 : }
5871 0 : MixingTmin = MixingTmax;
5872 : }
5873 : }
5874 43667 : if (thisCrossMixing.MinIndoorTempSchedPtr > 0) {
5875 7492 : if (TZN < MixingTmin) MixingLimitFlag = true;
5876 : }
5877 43667 : if (thisCrossMixing.MaxIndoorTempSchedPtr > 0) {
5878 7492 : if (TZN > MixingTmax) MixingLimitFlag = true;
5879 : }
5880 : // Ensure the minimum source temperature <= the maximum source temperature
5881 43667 : if (thisCrossMixing.MinSourceTempSchedPtr > 0)
5882 7492 : MixingTmin = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.MinSourceTempSchedPtr);
5883 43667 : if (thisCrossMixing.MaxSourceTempSchedPtr > 0)
5884 7492 : MixingTmax = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.MaxSourceTempSchedPtr);
5885 43667 : if (thisCrossMixing.MinSourceTempSchedPtr > 0 && thisCrossMixing.MaxSourceTempSchedPtr > 0) {
5886 7492 : if (MixingTmin > MixingTmax) {
5887 0 : ++thisCrossMixing.SourceTempErrCount;
5888 0 : if (thisCrossMixing.SourceTempErrCount < 2) {
5889 0 : ShowWarningError(state,
5890 : "CrossMixing source temperature control: The minimum source temperature is above the maximum source "
5891 0 : "temperature in " +
5892 : thisCrossMixing.Name);
5893 0 : ShowContinueError(state, "The minimum source temperature is set to the maximum source temperature. Simulation continues.");
5894 0 : ShowContinueErrorTimeStamp(state, " Occurrence info:");
5895 : } else {
5896 0 : ShowRecurringWarningErrorAtEnd(state,
5897 : "The minimum source temperature is still above the maximum source temperature",
5898 : thisCrossMixing.SourceTempErrIndex,
5899 : MixingTmin,
5900 : MixingTmin);
5901 : }
5902 0 : MixingTmin = MixingTmax;
5903 : }
5904 : }
5905 43667 : if (thisCrossMixing.MinSourceTempSchedPtr > 0) {
5906 7492 : if (TZM < MixingTmin) MixingLimitFlag = true;
5907 : }
5908 43667 : if (thisCrossMixing.MaxSourceTempSchedPtr > 0) {
5909 7492 : if (TZM > MixingTmax) MixingLimitFlag = true;
5910 : }
5911 : // Ensure the minimum outdoor temperature <= the maximum outdoor temperature
5912 43667 : Real64 TempExt = state.dataHeatBal->Zone(thisZoneNum).OutDryBulbTemp;
5913 43667 : if (thisCrossMixing.MinOutdoorTempSchedPtr > 0)
5914 7492 : MixingTmin = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.MinOutdoorTempSchedPtr);
5915 43667 : if (thisCrossMixing.MaxOutdoorTempSchedPtr > 0)
5916 7492 : MixingTmax = ScheduleManager::GetCurrentScheduleValue(state, thisCrossMixing.MaxOutdoorTempSchedPtr);
5917 43667 : if (thisCrossMixing.MinOutdoorTempSchedPtr > 0 && thisCrossMixing.MaxOutdoorTempSchedPtr > 0) {
5918 7492 : if (MixingTmin > MixingTmax) {
5919 0 : ++thisCrossMixing.OutdoorTempErrCount;
5920 0 : if (thisCrossMixing.OutdoorTempErrCount < 2) {
5921 0 : ShowWarningError(state,
5922 : "CrossMixing outdoor temperature control: The minimum outdoor temperature is above the maximum outdoor "
5923 0 : "temperature in " +
5924 0 : state.dataHeatBal->Mixing(j).Name);
5925 0 : ShowContinueError(state, "The minimum outdoor temperature is set to the maximum source temperature. Simulation continues.");
5926 0 : ShowContinueErrorTimeStamp(state, " Occurrence info:");
5927 : } else {
5928 0 : ShowRecurringWarningErrorAtEnd(state,
5929 : "The minimum outdoor temperature is still above the maximum outdoor temperature",
5930 : thisCrossMixing.OutdoorTempErrIndex,
5931 : MixingTmin,
5932 : MixingTmin);
5933 : }
5934 0 : MixingTmin = MixingTmax;
5935 : }
5936 : }
5937 43667 : if (thisCrossMixing.MinOutdoorTempSchedPtr > 0) {
5938 7492 : if (TempExt < MixingTmin) MixingLimitFlag = true;
5939 : }
5940 43667 : if (thisCrossMixing.MaxOutdoorTempSchedPtr > 0) {
5941 7492 : if (TempExt > MixingTmax) MixingLimitFlag = true;
5942 : }
5943 43667 : if (MixingLimitFlag) continue;
5944 :
5945 43667 : if ((TD == 0.0 || (TD > 0.0 && (TZM - TZN) >= TD))) {
5946 31478 : thisCrossMixing.ReportFlag = true;
5947 : }
5948 :
5949 43667 : if ((TD <= 0.0) || ((TD > 0.0) && (TZM - TZN >= TD))) {
5950 : // SET COEFFICIENTS .
5951 31478 : Real64 Tavg = (TZN + TZM) / 2.0;
5952 31478 : Real64 Wavg = (HumRatZN + HumRatZM) / 2.0;
5953 31478 : Real64 AirDensity = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, Tavg, Wavg, RoutineNameCrossMixing);
5954 31478 : Real64 CpAir = PsyCpAirFnW(Wavg);
5955 31478 : thisXMixingMassFlow = thisCrossMixing.DesiredAirFlowRate * AirDensity;
5956 31478 : thisMCPxM = thisXMixingMassFlow * CpAir;
5957 :
5958 31478 : fromMCPxM = thisMCPxM;
5959 31478 : thisMCPTxM = thisMCPxM * TZM;
5960 31478 : fromMCPTxM = fromMCPxM * TZN;
5961 :
5962 : // Now to determine the moisture conditions
5963 31478 : fromXMixingMassFlowXHumRat = thisXMixingMassFlow * HumRatZN;
5964 31478 : thisXMixingMassFlowXHumRat = thisXMixingMassFlow * HumRatZM;
5965 :
5966 31478 : if (state.dataContaminantBalance->Contaminant.CO2Simulation) {
5967 0 : state.dataContaminantBalance->MixingMassFlowCO2(fromZoneNum) +=
5968 0 : thisXMixingMassFlow * state.dataContaminantBalance->ZoneAirCO2(thisZoneNum);
5969 0 : state.dataContaminantBalance->MixingMassFlowCO2(thisZoneNum) +=
5970 0 : thisXMixingMassFlow * state.dataContaminantBalance->ZoneAirCO2(fromZoneNum);
5971 : }
5972 31478 : if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) {
5973 0 : state.dataContaminantBalance->MixingMassFlowGC(fromZoneNum) +=
5974 0 : thisXMixingMassFlow * state.dataContaminantBalance->ZoneAirGC(thisZoneNum);
5975 0 : state.dataContaminantBalance->MixingMassFlowGC(thisZoneNum) +=
5976 0 : thisXMixingMassFlow * state.dataContaminantBalance->ZoneAirGC(fromZoneNum);
5977 : }
5978 : }
5979 : }
5980 : // Accumulate for zone and space
5981 43667 : thisZoneHB.MCPM += thisMCPxM;
5982 43667 : thisZoneHB.MCPTM += thisMCPTxM;
5983 43667 : thisZoneHB.MixingMassFlowZone += thisXMixingMassFlow;
5984 43667 : thisZoneHB.MixingMassFlowXHumRat += thisXMixingMassFlowXHumRat;
5985 43667 : fromZoneHB.MCPM += fromMCPxM;
5986 43667 : fromZoneHB.MCPTM += fromMCPTxM;
5987 43667 : fromZoneHB.MixingMassFlowZone += thisXMixingMassFlow;
5988 43667 : fromZoneHB.MixingMassFlowXHumRat += fromXMixingMassFlowXHumRat;
5989 43667 : if (state.dataHeatBal->doSpaceHeatBalance) {
5990 0 : auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.spaceIndex);
5991 0 : auto &fromSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisCrossMixing.fromSpaceIndex);
5992 0 : thisSpaceHB.MCPM += thisMCPxM;
5993 0 : thisSpaceHB.MCPTM += thisMCPTxM;
5994 0 : thisSpaceHB.MixingMassFlowZone += thisXMixingMassFlow;
5995 0 : thisSpaceHB.MixingMassFlowXHumRat += thisXMixingMassFlowXHumRat;
5996 0 : fromSpaceHB.MCPM += fromMCPxM;
5997 0 : fromSpaceHB.MCPTM += fromMCPTxM;
5998 0 : fromSpaceHB.MixingMassFlowZone += thisXMixingMassFlow;
5999 0 : fromSpaceHB.MixingMassFlowXHumRat += fromXMixingMassFlowXHumRat;
6000 : }
6001 : }
6002 :
6003 : // COMPUTE REFRIGERATION DOOR
6004 : // AIR MIXING
6005 3479215 : if (state.dataHeatBal->TotRefDoorMixing > 0) {
6006 : // Zone loops structured in getinput so only do each pair of zones bounding door once, even if multiple doors in one zone
6007 247170 : for (int ZoneA = 1; ZoneA <= (state.dataGlobal->NumOfZones - 1); ++ZoneA) {
6008 229515 : if (!state.dataHeatBal->RefDoorMixing(ZoneA).RefDoorMixFlag) continue;
6009 88275 : auto &zoneAHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneA);
6010 88275 : Real64 TZoneA = zoneAHB.MixingMAT;
6011 88275 : Real64 HumRatZoneA = zoneAHB.MixingHumRat;
6012 88275 : Real64 AirDensityZoneA = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, TZoneA, HumRatZoneA, RoutineNameRefrigerationDoorMixing);
6013 88275 : Real64 CpAirZoneA = PsyCpAirFnW(HumRatZoneA);
6014 141240 : for (int j = 1; j <= state.dataHeatBal->RefDoorMixing(ZoneA).NumRefDoorConnections; ++j) {
6015 52965 : int ZoneB = state.dataHeatBal->RefDoorMixing(ZoneA).MateZonePtr(j);
6016 52965 : auto &zoneBHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneB);
6017 52965 : Real64 TZoneB = zoneBHB.MixingMAT;
6018 52965 : Real64 HumRatZoneB = zoneBHB.MixingHumRat;
6019 52965 : Real64 CpAirZoneB = PsyCpAirFnW(HumRatZoneB);
6020 52965 : Real64 Tavg = (TZoneA + TZoneB) / 2.0;
6021 52965 : Real64 Wavg = (HumRatZoneA + HumRatZoneB) / 2.0;
6022 52965 : Real64 AirDensityAvg = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, Tavg, Wavg, RoutineNameRefrigerationDoorMixing);
6023 : // following variables used for refrigeration door mixing and all defined in EngRef
6024 52965 : Real64 MassFlowDryAir = 0.0;
6025 52965 : Real64 FDens = 0.0;
6026 52965 : Real64 Fb = 0.0;
6027 :
6028 52965 : if (state.dataHeatBal->RefDoorMixing(ZoneA).EMSRefDoorMixingOn(j)) {
6029 0 : MassFlowDryAir = state.dataHeatBal->RefDoorMixing(ZoneA).VolRefDoorFlowRate(j) * AirDensityAvg;
6030 : } else {
6031 : Real64 AirDensityZoneB =
6032 52965 : PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, TZoneB, HumRatZoneB, RoutineNameRefrigerationDoorMixing);
6033 52965 : Real64 SchedDoorOpen = ScheduleManager::GetCurrentScheduleValue(state, state.dataHeatBal->RefDoorMixing(ZoneA).OpenSchedPtr(j));
6034 52965 : if (SchedDoorOpen == 0.0) continue;
6035 28326 : Real64 DoorHeight = state.dataHeatBal->RefDoorMixing(ZoneA).DoorHeight(j);
6036 28326 : Real64 DoorArea = state.dataHeatBal->RefDoorMixing(ZoneA).DoorArea(j);
6037 28326 : Real64 DoorProt = state.dataHeatBal->RefDoorMixing(ZoneA).Protection(j);
6038 28326 : if (AirDensityZoneA >= AirDensityZoneB) {
6039 : // Mass of dry air flow between zones is equal,
6040 : // but have to calc directionally to avoid sqrt(neg number)
6041 660 : FDens = std::pow(2.0 / (1.0 + std::pow(AirDensityZoneA / AirDensityZoneB, 1.0 / 3.0)), 1.5);
6042 1320 : Fb = 0.221 * DoorArea * AirDensityZoneA * FDens *
6043 660 : std::sqrt((1.0 - AirDensityZoneB / AirDensityZoneA) * StdGravity * DoorHeight);
6044 : } else { // ZoneADens < ZoneBDens
6045 27666 : FDens = std::pow(2.0 / (1.0 + std::pow(AirDensityZoneB / AirDensityZoneA, 1.0 / 3.0)), 1.5);
6046 55332 : Fb = 0.221 * DoorArea * AirDensityZoneB * FDens *
6047 27666 : std::sqrt((1.0 - AirDensityZoneA / AirDensityZoneB) * StdGravity * DoorHeight);
6048 : } // ZoneADens .GE. ZoneBDens
6049 : // FFlow = Doorway flow factor, is determined by temperature difference
6050 28326 : Real64 FFlow = 1.1;
6051 28326 : if (std::abs(TZoneA - TZoneB) > 11.0) FFlow = 0.8;
6052 28326 : MassFlowDryAir = Fb * SchedDoorOpen * FFlow * (1.0 - DoorProt);
6053 28326 : state.dataHeatBal->RefDoorMixing(ZoneA).VolRefDoorFlowRate(j) = MassFlowDryAir / AirDensityAvg;
6054 : // Note - VolRefDoorFlowRate is used ONLY for reporting purposes, where it is
6055 : // used with the avg density to generate a reported mass flow
6056 : // Considering the small values typical for HumRat, this is not far off.
6057 : } // EMSRefDoorMixingOn
6058 :
6059 28326 : Real64 MassFlowToA = MassFlowDryAir * (1.0 + HumRatZoneB);
6060 28326 : Real64 MassFlowToB = MassFlowDryAir * (1.0 + HumRatZoneA);
6061 28326 : Real64 MassFlowXCpToA = MassFlowToA * CpAirZoneB;
6062 28326 : Real64 MassFlowXCpToB = MassFlowToB * CpAirZoneA;
6063 28326 : Real64 MassFlowXCpXTempToA = MassFlowXCpToA * TZoneB;
6064 28326 : Real64 MassFlowXCpXTempToB = MassFlowXCpToB * TZoneA;
6065 28326 : Real64 MassFlowXHumRatToA = MassFlowToA * HumRatZoneB;
6066 28326 : Real64 MassFlowXHumRatToB = MassFlowToB * HumRatZoneA;
6067 :
6068 28326 : zoneAHB.MCPM += MassFlowXCpToA;
6069 28326 : zoneBHB.MCPM += MassFlowXCpToB;
6070 28326 : zoneAHB.MCPTM += MassFlowXCpXTempToA;
6071 28326 : zoneBHB.MCPTM += MassFlowXCpXTempToB;
6072 28326 : zoneAHB.MixingMassFlowZone += MassFlowToA;
6073 28326 : zoneBHB.MixingMassFlowZone += MassFlowToB;
6074 28326 : zoneAHB.MixingMassFlowXHumRat += MassFlowXHumRatToA;
6075 28326 : zoneBHB.MixingMassFlowXHumRat += MassFlowXHumRatToB;
6076 28326 : if (state.dataHeatBal->doSpaceHeatBalance) {
6077 : // ZoneRefrigerationDoorMixing has no space information, just zones
6078 : // Allocate mixing flows by space volume fraction of zone volume
6079 0 : for (int spaceNum : state.dataHeatBal->Zone(ZoneA).spaceIndexes) {
6080 0 : Real64 spaceFrac = state.dataHeatBal->space(spaceNum).fracZoneVolume;
6081 0 : auto &spaceAHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum);
6082 0 : spaceAHB.MCPM += MassFlowXCpToA * spaceFrac;
6083 0 : spaceAHB.MCPTM += MassFlowXCpXTempToA * spaceFrac;
6084 0 : spaceAHB.MixingMassFlowZone += MassFlowToA * spaceFrac;
6085 0 : spaceAHB.MixingMassFlowXHumRat += MassFlowXHumRatToA * spaceFrac;
6086 : }
6087 0 : for (int spaceNum : state.dataHeatBal->Zone(ZoneB).spaceIndexes) {
6088 0 : Real64 spaceFrac = state.dataHeatBal->space(spaceNum).fracZoneVolume;
6089 0 : auto &spaceBHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(spaceNum);
6090 0 : spaceBHB.MCPM += MassFlowXCpToB * spaceFrac;
6091 0 : spaceBHB.MCPTM += MassFlowXCpXTempToB * spaceFrac;
6092 0 : spaceBHB.MixingMassFlowZone += MassFlowToB * spaceFrac;
6093 0 : spaceBHB.MixingMassFlowXHumRat += MassFlowXHumRatToB * spaceFrac;
6094 : }
6095 : }
6096 :
6097 : // Now to determine the CO2 and generic contaminant conditions
6098 28326 : if (state.dataContaminantBalance->Contaminant.CO2Simulation) {
6099 28326 : state.dataContaminantBalance->MixingMassFlowCO2(ZoneA) += MassFlowToA * state.dataContaminantBalance->ZoneAirCO2(ZoneB);
6100 28326 : state.dataContaminantBalance->MixingMassFlowCO2(ZoneB) += MassFlowToB * state.dataContaminantBalance->ZoneAirCO2(ZoneA);
6101 : }
6102 28326 : if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) {
6103 28326 : state.dataContaminantBalance->MixingMassFlowGC(ZoneA) += MassFlowToA * state.dataContaminantBalance->ZoneAirGC(ZoneB);
6104 28326 : state.dataContaminantBalance->MixingMassFlowGC(ZoneB) += MassFlowToB * state.dataContaminantBalance->ZoneAirGC(ZoneA);
6105 : }
6106 :
6107 : } // J=1,RefDoorMixing(ZoneA)%NumRefDoorConnections
6108 : } // ZoneA=1,(NumOfZones - 1)
6109 : } //(TotRefrigerationDoorMixing > 0) THEN
6110 :
6111 : // Process the scheduled Infiltration for air heat balance depending on model type
6112 23962333 : for (int j = 1; j <= state.dataHeatBal->TotInfiltration; ++j) {
6113 :
6114 20483118 : auto &thisInfiltration = state.dataHeatBal->Infiltration(j);
6115 20483118 : int NZ = state.dataHeatBal->Infiltration(j).ZonePtr;
6116 20483118 : auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(NZ);
6117 20483118 : Real64 tempInt = 0.0;
6118 20483118 : if (state.dataHeatBal->doSpaceHeatBalance) {
6119 25010 : tempInt = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisInfiltration.spaceIndex).MixingMAT;
6120 : } else {
6121 20458108 : tempInt = thisZoneHB.MixingMAT;
6122 : }
6123 :
6124 20483118 : Real64 TempExt = state.dataHeatBal->Zone(NZ).OutDryBulbTemp;
6125 20483118 : Real64 WindSpeedExt = state.dataHeatBal->Zone(NZ).WindSpeed;
6126 :
6127 : // Use air node information linked to the zone if defined
6128 20483118 : Real64 HumRatExt = 0.0;
6129 20483118 : if (state.dataHeatBal->Zone(NZ).LinkedOutAirNode > 0) {
6130 1836 : HumRatExt = state.dataLoopNodes->Node(state.dataHeatBal->Zone(NZ).LinkedOutAirNode).HumRat;
6131 : } else {
6132 20481282 : HumRatExt = state.dataEnvrn->OutHumRat;
6133 : }
6134 :
6135 20483118 : Real64 AirDensity = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, TempExt, HumRatExt, RoutineNameInfiltration);
6136 20483118 : Real64 CpAir = PsyCpAirFnW(HumRatExt);
6137 20483118 : Real64 MCpI_temp = 0.0;
6138 20483118 : Real64 scheduleFrac = ScheduleManager::GetCurrentScheduleValue(state, thisInfiltration.SchedPtr);
6139 20483118 : if (scheduleFrac > 0.0) {
6140 : // CR7751 should maybe use code below, indoor conditions instead of outdoor conditions
6141 : // AirDensity = PsyRhoAirFnPbTdbW(state, OutBaroPress, MixingMAT(NZ), MixingHumRat(NZ))
6142 : // CpAir = PsyCpAirFnW(MixingHumRat(NZ),MixingMAT(NZ))
6143 17368797 : switch (thisInfiltration.ModelType) {
6144 17336185 : case DataHeatBalance::InfiltrationModelType::DesignFlowRate: {
6145 17336185 : IVF = thisInfiltration.DesignLevel * scheduleFrac;
6146 : // CR6845 if calculated < 0.0, don't propagate
6147 17336185 : if (IVF < 0.0) IVF = 0.0;
6148 34672370 : MCpI_temp = IVF * AirDensity * CpAir *
6149 34672370 : (thisInfiltration.ConstantTermCoef + std::abs(TempExt - tempInt) * thisInfiltration.TemperatureTermCoef +
6150 17336185 : WindSpeedExt * (thisInfiltration.VelocityTermCoef + WindSpeedExt * thisInfiltration.VelocitySQTermCoef));
6151 :
6152 17336185 : if (MCpI_temp < 0.0) MCpI_temp = 0.0;
6153 17336185 : thisInfiltration.VolumeFlowRate = MCpI_temp / AirDensity / CpAir;
6154 17336185 : } break;
6155 16306 : case DataHeatBalance::InfiltrationModelType::ShermanGrimsrud: {
6156 : // Sherman Grimsrud model as formulated in ASHRAE HoF
6157 16306 : WindSpeedExt = state.dataEnvrn->WindSpeed; // formulated to use wind at Meterological Station rather than local
6158 32612 : IVF = scheduleFrac * thisInfiltration.LeakageArea / 1000.0 *
6159 32612 : std::sqrt(thisInfiltration.BasicStackCoefficient * std::abs(TempExt - tempInt) +
6160 16306 : thisInfiltration.BasicWindCoefficient * pow_2(WindSpeedExt));
6161 16306 : if (IVF < 0.0) IVF = 0.0;
6162 16306 : MCpI_temp = IVF * AirDensity * CpAir;
6163 16306 : if (MCpI_temp < 0.0) MCpI_temp = 0.0;
6164 16306 : thisInfiltration.VolumeFlowRate = MCpI_temp / AirDensity / CpAir;
6165 16306 : } break;
6166 16306 : case DataHeatBalance::InfiltrationModelType::AIM2: {
6167 : // Walker Wilson model as formulated in ASHRAE HoF
6168 16306 : IVF =
6169 48918 : scheduleFrac * std::sqrt(pow_2(thisInfiltration.FlowCoefficient * thisInfiltration.AIM2StackCoefficient *
6170 16306 : std::pow(std::abs(TempExt - tempInt), thisInfiltration.PressureExponent)) +
6171 32612 : pow_2(thisInfiltration.FlowCoefficient * thisInfiltration.AIM2WindCoefficient *
6172 16306 : std::pow(thisInfiltration.ShelterFactor * WindSpeedExt, 2.0 * thisInfiltration.PressureExponent)));
6173 16306 : if (IVF < 0.0) IVF = 0.0;
6174 16306 : MCpI_temp = IVF * AirDensity * CpAir;
6175 16306 : if (MCpI_temp < 0.0) MCpI_temp = 0.0;
6176 16306 : thisInfiltration.VolumeFlowRate = MCpI_temp / AirDensity / CpAir;
6177 16306 : } break;
6178 0 : default:
6179 0 : break;
6180 : }
6181 : } else {
6182 3114321 : thisInfiltration.VolumeFlowRate = 0.0;
6183 3114321 : MCpI_temp = 0.0;
6184 : }
6185 :
6186 20483118 : if (AdjustZoneInfiltrationFlowFlag && state.dataHeatBalFanSys->ZoneInfiltrationFlag(NZ)) {
6187 10486 : if (state.dataHeatBal->ZoneAirMassFlow.InfiltrationTreatment == DataHeatBalance::InfiltrationFlow::Adjust) {
6188 7696 : if (thisInfiltration.MassFlowRate > 0.0 || thisInfiltration.ModelType == DataHeatBalance::InfiltrationModelType::DesignFlowRate) {
6189 : // For DesignFlowRate, allow exfiltraion
6190 7696 : thisInfiltration.VolumeFlowRate = thisInfiltration.MassFlowRate / AirDensity;
6191 7696 : MCpI_temp = thisInfiltration.VolumeFlowRate * AirDensity * CpAir;
6192 : }
6193 : }
6194 10486 : if (state.dataHeatBal->ZoneAirMassFlow.InfiltrationTreatment == DataHeatBalance::InfiltrationFlow::Add) {
6195 2790 : thisInfiltration.VolumeFlowRate =
6196 2790 : thisInfiltration.VolumeFlowRate + state.dataHeatBal->MassConservation(NZ).InfiltrationMassFlowRate / AirDensity;
6197 2790 : MCpI_temp = thisInfiltration.VolumeFlowRate * AirDensity * CpAir;
6198 : }
6199 : }
6200 20483118 : thisInfiltration.MassFlowRate = thisInfiltration.VolumeFlowRate * AirDensity;
6201 :
6202 20483118 : if (thisInfiltration.EMSOverrideOn) {
6203 2628 : IVF = thisInfiltration.EMSAirFlowRateValue;
6204 2628 : if (IVF < 0.0) IVF = 0.0;
6205 2628 : MCpI_temp = IVF * AirDensity * CpAir;
6206 2628 : if (MCpI_temp < 0.0) MCpI_temp = 0.0;
6207 : }
6208 :
6209 20483118 : if (state.dataHeatBal->Zone(NZ).zoneOAQuadratureSum) {
6210 14355 : state.dataHeatBal->ZoneAirBalance(state.dataHeatBal->Zone(NZ).zoneOABalanceIndex).InfMassFlowRate += MCpI_temp / CpAir;
6211 : } else {
6212 20468763 : thisInfiltration.MCpI_temp = MCpI_temp;
6213 20468763 : thisZoneHB.MCPI += MCpI_temp;
6214 20468763 : thisZoneHB.OAMFL += MCpI_temp / CpAir;
6215 20468763 : thisZoneHB.MCPTI += MCpI_temp * TempExt;
6216 20468763 : if (state.dataHeatBal->doSpaceHeatBalance) {
6217 25010 : auto &thisSpaceHB = state.dataZoneTempPredictorCorrector->spaceHeatBalance(thisInfiltration.spaceIndex);
6218 25010 : thisSpaceHB.MCPI += MCpI_temp;
6219 25010 : thisSpaceHB.OAMFL += MCpI_temp / CpAir;
6220 25010 : thisSpaceHB.MCPTI += MCpI_temp * TempExt;
6221 : }
6222 : }
6223 : }
6224 :
6225 : // Add infiltration rate enhanced by the existence of thermal chimney
6226 30951107 : for (auto &thisZoneHB : state.dataZoneTempPredictorCorrector->zoneHeatBalance) {
6227 27471892 : thisZoneHB.MCPI += thisZoneHB.MCPThermChim;
6228 27471892 : thisZoneHB.OAMFL += thisZoneHB.ThermChimAMFL;
6229 27471892 : thisZoneHB.MCPTI += thisZoneHB.MCPTThermChim;
6230 : }
6231 3479215 : if (state.dataHeatBal->doSpaceHeatBalance) {
6232 35014 : for (auto &thisSpaceHB : state.dataZoneTempPredictorCorrector->spaceHeatBalance) {
6233 30012 : thisSpaceHB.MCPI += thisSpaceHB.MCPThermChim;
6234 30012 : thisSpaceHB.OAMFL += thisSpaceHB.ThermChimAMFL;
6235 30012 : thisSpaceHB.MCPTI += thisSpaceHB.MCPTThermChim;
6236 : }
6237 : }
6238 :
6239 : // Calculate combined outdoor air flows
6240 3493570 : for (auto &thisZoneAirBalance : state.dataHeatBal->ZoneAirBalance) {
6241 14355 : if (thisZoneAirBalance.BalanceMethod == DataHeatBalance::AirBalance::Quadrature) {
6242 14355 : if (!thisZoneAirBalance.OneTimeFlag) GetStandAloneERVNodes(state, thisZoneAirBalance);
6243 14355 : if (thisZoneAirBalance.NumOfERVs > 0) {
6244 0 : for (int I = 1; I <= thisZoneAirBalance.NumOfERVs; ++I) {
6245 0 : Real64 MassFlowDiff = state.dataLoopNodes->Node(thisZoneAirBalance.ERVExhaustNode(I)).MassFlowRate -
6246 0 : state.dataLoopNodes->Node(thisZoneAirBalance.ERVInletNode(I)).MassFlowRate;
6247 0 : if (MassFlowDiff > 0.0) {
6248 0 : thisZoneAirBalance.ERVMassFlowRate += MassFlowDiff;
6249 : }
6250 : }
6251 : }
6252 14355 : int NZ = thisZoneAirBalance.ZonePtr;
6253 14355 : auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(NZ);
6254 : // Use air node information linked to the zone if defined
6255 14355 : Real64 HumRatExt = 0.0;
6256 14355 : if (state.dataHeatBal->Zone(NZ).LinkedOutAirNode > 0) {
6257 0 : HumRatExt = state.dataLoopNodes->Node(state.dataHeatBal->Zone(NZ).LinkedOutAirNode).HumRat;
6258 : } else {
6259 14355 : HumRatExt = state.dataEnvrn->OutHumRat;
6260 : }
6261 28710 : Real64 AirDensity = Psychrometrics::PsyRhoAirFnPbTdbW(
6262 43065 : state, state.dataEnvrn->OutBaroPress, state.dataHeatBal->Zone(NZ).OutDryBulbTemp, HumRatExt, RoutineNameZoneAirBalance);
6263 14355 : Real64 CpAir = Psychrometrics::PsyCpAirFnW(HumRatExt);
6264 14355 : thisZoneAirBalance.ERVMassFlowRate *= AirDensity;
6265 57420 : thisZoneHB.MDotOA = std::sqrt(pow_2(thisZoneAirBalance.NatMassFlowRate) + pow_2(thisZoneAirBalance.IntMassFlowRate) +
6266 43065 : pow_2(thisZoneAirBalance.ExhMassFlowRate) + pow_2(thisZoneAirBalance.ERVMassFlowRate) +
6267 14355 : pow_2(thisZoneAirBalance.InfMassFlowRate) +
6268 28710 : pow_2(AirDensity * thisZoneAirBalance.InducedAirRate *
6269 28710 : ScheduleManager::GetCurrentScheduleValue(state, thisZoneAirBalance.InducedAirSchedPtr))) +
6270 14355 : thisZoneAirBalance.BalMassFlowRate;
6271 14355 : thisZoneHB.MDotCPOA = thisZoneHB.MDotOA * CpAir;
6272 : }
6273 : }
6274 : }
6275 :
6276 1 : void GetStandAloneERVNodes(EnergyPlusData &state, DataHeatBalance::ZoneAirBalanceData &thisZoneAirBalance)
6277 : {
6278 :
6279 : // SUBROUTINE INFORMATION:
6280 : // AUTHOR Lixing Gu
6281 : // DATE WRITTEN July 2010
6282 :
6283 : // PURPOSE OF THIS SUBROUTINE:
6284 : // This subroutine gets node numbers of stand alone ERVs to calculate combined outdoor air flows.
6285 :
6286 : // METHODOLOGY EMPLOYED:
6287 : // Uses program data structures ZoneEquipInfo
6288 :
6289 1 : if (allocated(state.dataZoneEquip->ZoneEquipList)) {
6290 1 : int ZoneNum = thisZoneAirBalance.ZonePtr;
6291 1 : thisZoneAirBalance.OneTimeFlag = true;
6292 1 : if (state.dataZoneEquip->ZoneEquipList(ZoneNum).NumOfEquipTypes > 0) {
6293 2 : for (int I = 1; I <= state.dataZoneEquip->ZoneEquipList(ZoneNum).NumOfEquipTypes; ++I) {
6294 1 : if (state.dataZoneEquip->ZoneEquipList(ZoneNum).EquipTypeEnum(I) == DataZoneEquipment::ZoneEquip::ERVStandAlone) {
6295 0 : ++thisZoneAirBalance.NumOfERVs;
6296 : }
6297 : }
6298 1 : if (thisZoneAirBalance.NumOfERVs > 0) {
6299 0 : thisZoneAirBalance.ERVInletNode.allocate(thisZoneAirBalance.NumOfERVs);
6300 0 : thisZoneAirBalance.ERVExhaustNode.allocate(thisZoneAirBalance.NumOfERVs);
6301 0 : int j = 1;
6302 0 : for (int I = 1; I <= state.dataZoneEquip->ZoneEquipList(ZoneNum).NumOfEquipTypes; ++I) {
6303 0 : if (state.dataZoneEquip->ZoneEquipList(ZoneNum).EquipTypeEnum(I) == DataZoneEquipment::ZoneEquip::ERVStandAlone) {
6304 0 : thisZoneAirBalance.ERVInletNode(j) =
6305 0 : HVACStandAloneERV::GetStandAloneERVOutAirNode(state, state.dataZoneEquip->ZoneEquipList(ZoneNum).EquipIndex(I));
6306 0 : thisZoneAirBalance.ERVExhaustNode(j) =
6307 0 : HVACStandAloneERV::GetStandAloneERVReturnAirNode(state, state.dataZoneEquip->ZoneEquipList(ZoneNum).EquipIndex(I));
6308 0 : ++j;
6309 : }
6310 : }
6311 : }
6312 : }
6313 : }
6314 1 : }
6315 :
6316 602135 : void CalcZoneMixingFlowRateOfReceivingZone(EnergyPlusData &state, int const ZoneNum, Real64 &ZoneMixingMassFlowRate)
6317 : {
6318 :
6319 : // SUBROUTINE INFORMATION:
6320 : // AUTHOR Bereket Nigusse
6321 : // DATE WRITTEN February 2014
6322 :
6323 : // PURPOSE OF THIS SUBROUTINE:
6324 : // This subroutine updates the receiving zone mixing flow rate to ensures the zone air mass balance.
6325 :
6326 602135 : auto &massConservation = state.dataHeatBal->MassConservation(ZoneNum);
6327 :
6328 602135 : Real64 MixingMassFlowRate = 0.0; // current zone mixing mass flow rate, [kg/s]
6329 602135 : int NumOfReceivingZoneMixingObjects = massConservation.NumReceivingZonesMixingObject;
6330 602135 : if (NumOfReceivingZoneMixingObjects > 0) {
6331 : // distribute the total zone mixing flow rate to the source zones
6332 602135 : for (int Loop = 1; Loop <= NumOfReceivingZoneMixingObjects; ++Loop) {
6333 481708 : int MixingNum = massConservation.ZoneMixingReceivingPtr(Loop);
6334 481708 : state.dataHeatBal->Mixing(MixingNum).MixingMassFlowRate = massConservation.ZoneMixingReceivingFr(Loop) * ZoneMixingMassFlowRate;
6335 481708 : MixingMassFlowRate += state.dataHeatBal->Mixing(MixingNum).MixingMassFlowRate;
6336 481708 : CalcZoneMixingFlowRateOfSourceZone(state, state.dataHeatBal->Mixing(MixingNum).FromZone);
6337 : }
6338 : }
6339 602135 : massConservation.MixingMassFlowRate = MixingMassFlowRate;
6340 602135 : ZoneMixingMassFlowRate = MixingMassFlowRate;
6341 602135 : }
6342 :
6343 481708 : void CalcZoneMixingFlowRateOfSourceZone(EnergyPlusData &state, int const ZoneNum)
6344 : {
6345 :
6346 : // SUBROUTINE INFORMATION:
6347 : // AUTHOR Bereket Nigusse
6348 : // DATE WRITTEN February 2014
6349 :
6350 : // PURPOSE OF THIS SUBROUTINE:
6351 : // This subroutine calculates the zone mixing flow rate such that it ensures the zone air mass balance.
6352 :
6353 481708 : auto &massConservation = state.dataHeatBal->MassConservation(ZoneNum);
6354 :
6355 481708 : Real64 ZoneSourceMassFlowRate = 0.0; // current zone as a source mass flow rate for zone mixing in other zones, [kg/s]
6356 481708 : int NumOfSourceZoneMixingObjects = massConservation.NumSourceZonesMixingObject;
6357 481708 : if (NumOfSourceZoneMixingObjects > 0) {
6358 963416 : for (int ZoneMixingNum = 1; ZoneMixingNum <= NumOfSourceZoneMixingObjects; ++ZoneMixingNum) {
6359 481708 : int MixingNum = massConservation.ZoneMixingSourcesPtr(ZoneMixingNum);
6360 2408540 : for (int Loop = 1; Loop <= state.dataHeatBal->TotMixing; ++Loop) {
6361 1926832 : if (Loop == MixingNum) {
6362 481708 : ZoneSourceMassFlowRate += state.dataHeatBal->Mixing(Loop).MixingMassFlowRate;
6363 : }
6364 : }
6365 : }
6366 : }
6367 481708 : massConservation.MixingSourceMassFlowRate = ZoneSourceMassFlowRate;
6368 481708 : }
6369 :
6370 406 : void AutoCalcDOASControlStrategy(EnergyPlusData &state)
6371 : {
6372 : // SUBROUTINE INFORMATION:
6373 : // AUTHOR Fred Buhl
6374 : // DATE WRITTEN March 2016
6375 :
6376 : // PURPOSE OF THIS Function:
6377 : // This subroutine does the autosizing calculations for the Sizing:Zone DOAS input.
6378 :
6379 : // REFERENCES:
6380 : // See IO Ref for suggested values
6381 :
6382 406 : bool headerAlreadyPrinted = false;
6383 406 : bool ErrorsFound = false;
6384 3698 : for (int ZoneSizIndex = 1; ZoneSizIndex <= state.dataSize->NumZoneSizingInput; ++ZoneSizIndex) {
6385 3292 : if (state.dataSize->ZoneSizingInput(ZoneSizIndex).AccountForDOAS) {
6386 55 : auto &zoneSizingInput = state.dataSize->ZoneSizingInput(ZoneSizIndex);
6387 55 : if (zoneSizingInput.DOASControlStrategy == DOANeutralSup) {
6388 5 : if (zoneSizingInput.DOASLowSetpoint == AutoSize && zoneSizingInput.DOASHighSetpoint == AutoSize) {
6389 0 : zoneSizingInput.DOASLowSetpoint = 21.1;
6390 0 : zoneSizingInput.DOASHighSetpoint = 23.9;
6391 5 : } else if (zoneSizingInput.DOASLowSetpoint == AutoSize && zoneSizingInput.DOASHighSetpoint > 0.0) {
6392 0 : zoneSizingInput.DOASLowSetpoint = zoneSizingInput.DOASHighSetpoint - 2.8;
6393 5 : } else if (zoneSizingInput.DOASLowSetpoint > 0.0 && zoneSizingInput.DOASHighSetpoint == AutoSize) {
6394 0 : zoneSizingInput.DOASHighSetpoint = zoneSizingInput.DOASLowSetpoint + 2.8;
6395 : }
6396 5 : ReportZoneSizingDOASInputs(state,
6397 : zoneSizingInput.ZoneName,
6398 : "NeutralSupplyAir",
6399 : zoneSizingInput.DOASLowSetpoint,
6400 : zoneSizingInput.DOASHighSetpoint,
6401 : headerAlreadyPrinted);
6402 50 : } else if (zoneSizingInput.DOASControlStrategy == DOANeutralDehumSup) {
6403 0 : if (zoneSizingInput.DOASLowSetpoint == AutoSize && zoneSizingInput.DOASHighSetpoint == AutoSize) {
6404 0 : zoneSizingInput.DOASLowSetpoint = 14.4;
6405 0 : zoneSizingInput.DOASHighSetpoint = 22.2;
6406 0 : } else if (zoneSizingInput.DOASLowSetpoint == AutoSize && zoneSizingInput.DOASHighSetpoint > 0.0) {
6407 0 : zoneSizingInput.DOASLowSetpoint = 14.4;
6408 0 : } else if (zoneSizingInput.DOASLowSetpoint > 0.0 && zoneSizingInput.DOASHighSetpoint == AutoSize) {
6409 0 : zoneSizingInput.DOASHighSetpoint = 22.2;
6410 : }
6411 0 : ReportZoneSizingDOASInputs(state,
6412 : zoneSizingInput.ZoneName,
6413 : "NeutralDehumidifiedSupplyAir",
6414 : zoneSizingInput.DOASLowSetpoint,
6415 : zoneSizingInput.DOASHighSetpoint,
6416 : headerAlreadyPrinted);
6417 50 : } else if (zoneSizingInput.DOASControlStrategy == DOACoolSup) {
6418 50 : if (zoneSizingInput.DOASLowSetpoint == AutoSize && zoneSizingInput.DOASHighSetpoint == AutoSize) {
6419 0 : zoneSizingInput.DOASLowSetpoint = 12.2;
6420 0 : zoneSizingInput.DOASHighSetpoint = 14.4;
6421 50 : } else if (zoneSizingInput.DOASLowSetpoint == AutoSize && zoneSizingInput.DOASHighSetpoint > 0.0) {
6422 0 : zoneSizingInput.DOASLowSetpoint = zoneSizingInput.DOASHighSetpoint - 2.2;
6423 50 : } else if (zoneSizingInput.DOASLowSetpoint > 0.0 && zoneSizingInput.DOASHighSetpoint == AutoSize) {
6424 0 : zoneSizingInput.DOASHighSetpoint = zoneSizingInput.DOASLowSetpoint + 2.2;
6425 : }
6426 50 : ReportZoneSizingDOASInputs(state,
6427 : zoneSizingInput.ZoneName,
6428 : "ColdSupplyAir",
6429 : zoneSizingInput.DOASLowSetpoint,
6430 : zoneSizingInput.DOASHighSetpoint,
6431 : headerAlreadyPrinted);
6432 : }
6433 55 : if (zoneSizingInput.DOASLowSetpoint > zoneSizingInput.DOASHighSetpoint) {
6434 0 : ShowSevereError(state, "For Sizing:Zone = " + zoneSizingInput.ZoneName);
6435 0 : ShowContinueError(state, "... Dedicated Outside Air Low Setpoint for Design must be less than the High Setpoint");
6436 0 : ErrorsFound = true;
6437 : }
6438 : }
6439 : }
6440 406 : if (ErrorsFound) {
6441 0 : ShowFatalError(state, "Errors found in DOAS sizing input. Program terminates.");
6442 : }
6443 406 : }
6444 :
6445 55 : void ReportZoneSizingDOASInputs(EnergyPlusData &state,
6446 : std::string const &ZoneName, // the name of the zone
6447 : std::string const &DOASCtrlStrategy, // DOAS control strategy
6448 : Real64 const DOASLowTemp, // DOAS design low setpoint temperature [C]
6449 : Real64 const DOASHighTemp, // DOAS design high setpoint temperature [C]
6450 : bool &headerAlreadyPrinted)
6451 : {
6452 :
6453 : // SUBROUTINE INFORMATION:
6454 : // AUTHOR Fred Buhl
6455 : // DATE WRITTEN March 2016
6456 :
6457 : // PURPOSE OF THIS SUBROUTINE:
6458 : // This subroutine writes the DOAS Sizing:Zone input for 1 zone to the eio file
6459 :
6460 : // Formats
6461 : static constexpr std::string_view Format_990(
6462 : "! <Zone Sizing DOAS Inputs>, Zone Name, DOAS Design Control Strategy, DOAS Design Low Setpoint Temperature "
6463 : "{C}, DOAS Design High Setpoint Temperature {C} ");
6464 :
6465 55 : if (!headerAlreadyPrinted) {
6466 15 : print(state.files.eio, "{}\n", Format_990);
6467 15 : headerAlreadyPrinted = true;
6468 : }
6469 :
6470 : static constexpr std::string_view Format_991(" Zone Sizing DOAS Inputs, {}, {}, {:.3R}, {:.3R}\n");
6471 55 : print(state.files.eio, Format_991, ZoneName, DOASCtrlStrategy, DOASLowTemp, DOASHighTemp);
6472 :
6473 : // BSLLC Start
6474 : // if ( sqlite ) {
6475 : // state.dataSQLiteProcedures->sqlite->addSQLiteZoneSizingRecord( ZoneName, LoadType, CalcDesLoad, UserDesLoad, CalcDesFlow,
6476 : // UserDesFlow, DesDayName, PeakHrMin,
6477 : // PeakTemp, PeakHumRat, MinOAVolFlow, DOASHeatAddRate );
6478 : // }
6479 : // BSLLC Finish
6480 55 : }
6481 :
6482 2313 : } // namespace EnergyPlus::ZoneEquipmentManager
|