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