Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois,
2 : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 : // contributors. All rights reserved.
6 : //
7 : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 : // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 : //
13 : // Redistribution and use in source and binary forms, with or without modification, are permitted
14 : // provided that the following conditions are met:
15 : //
16 : // (1) Redistributions of source code must retain the above copyright notice, this list of
17 : // conditions and the following disclaimer.
18 : //
19 : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 : // conditions and the following disclaimer in the documentation and/or other materials
21 : // provided with the distribution.
22 : //
23 : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 : // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 : // used to endorse or promote products derived from this software without specific prior
26 : // written permission.
27 : //
28 : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 : // without changes from the version obtained under this License, or (ii) Licensee makes a
30 : // reference solely to the software portion of its product, Licensee must refer to the
31 : // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 : // obtained under this License and may not use a different name for the software. Except as
33 : // specifically required in this Section (4), Licensee shall not use in a company name, a
34 : // product name, in advertising, publicity, or other promotional activities any name, trade
35 : // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 : // similar designation, without the U.S. Department of Energy's prior written consent.
37 : //
38 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 : // POSSIBILITY OF SUCH DAMAGE.
47 :
48 : // C++ Headers
49 : #include <cmath>
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 : #include <ObjexxFCL/Fmath.hh>
54 : #include <ObjexxFCL/member.functions.hh>
55 :
56 : // EnergyPlus Headers
57 : #include <AirflowNetwork/Solver.hpp>
58 : #include <EnergyPlus/ConvectionCoefficients.hh>
59 : #include <EnergyPlus/Data/EnergyPlusData.hh>
60 : #include <EnergyPlus/DataEnvironment.hh>
61 : #include <EnergyPlus/DataHVACGlobals.hh>
62 : #include <EnergyPlus/DataHeatBalFanSys.hh>
63 : #include <EnergyPlus/DataHeatBalSurface.hh>
64 : #include <EnergyPlus/DataHeatBalance.hh>
65 : #include <EnergyPlus/DataLoopNode.hh>
66 : #include <EnergyPlus/DataRoomAirModel.hh>
67 : #include <EnergyPlus/DataSurfaces.hh>
68 : #include <EnergyPlus/DataZoneEquipment.hh>
69 : #include <EnergyPlus/DisplacementVentMgr.hh>
70 : #include <EnergyPlus/InternalHeatGains.hh>
71 : #include <EnergyPlus/Psychrometrics.hh>
72 : #include <EnergyPlus/ScheduleManager.hh>
73 : #include <EnergyPlus/UtilityRoutines.hh>
74 : #include <EnergyPlus/ZoneTempPredictorCorrector.hh>
75 :
76 : namespace EnergyPlus {
77 :
78 : namespace RoomAir {
79 :
80 : // MODULE INFORMATION:
81 : // AUTHOR G. Carrilho da Graca
82 : // DATE WRITTEN February 2004
83 : // MODIFIED na
84 : // RE-ENGINEERED na
85 :
86 : // PURPOSE OF THIS MODULE:
87 : // Routines that implement the UCSD Displacement Ventilation
88 :
89 : // Using/Aliasing
90 : using namespace DataLoopNode;
91 : using namespace DataEnvironment;
92 : using namespace DataHeatBalance;
93 : using namespace DataHeatBalSurface;
94 : using namespace DataSurfaces;
95 : using Convect::CalcDetailedHcInForDVModel;
96 :
97 0 : void ManageDispVent3Node(EnergyPlusData &state, int const ZoneNum) // index number for the specified zone
98 : {
99 :
100 : // SUBROUTINE INFORMATION:
101 : // AUTHOR G. Carrilho da Graca
102 : // DATE WRITTEN February 2004
103 :
104 : // PURPOSE OF THIS SUBROUTINE:
105 : // manage the UCSD Displacement Ventilation model
106 :
107 : // initialize Displacement Ventilation model
108 0 : InitDispVent3Node(state, ZoneNum);
109 :
110 : // perform Displacement Ventilation model calculations
111 0 : CalcDispVent3Node(state, ZoneNum);
112 0 : }
113 :
114 : //**************************************************************************************************
115 :
116 0 : void InitDispVent3Node(EnergyPlusData &state, int const ZoneNum)
117 : {
118 :
119 : // SUBROUTINE INFORMATION:
120 : // AUTHOR G. Carrilho da Graca
121 : // DATE WRITTEN February 2004
122 : // MODIFIED -
123 : // RE-ENGINEERED -
124 :
125 : // PURPOSE OF THIS SUBROUTINE:
126 : // Low Energy Cooling by Ventilation initialization subroutine.
127 : // All the data preparation needed to run the LECV models.
128 : // The subroutines sets up arrays with the locations in the main EnergyPlus surface array of
129 : // ceiling, windows, doors and walls. The zone maximum and minimum height is calculated.
130 :
131 : // Do the one time initializations
132 0 : if (state.dataDispVentMgr->InitUCSDDVMyOneTimeFlag) {
133 0 : state.dataDispVentMgr->MyEnvrnFlag.dimension(state.dataGlobal->NumOfZones, true);
134 0 : state.dataDispVentMgr->HeightFloorSubzoneTop = 0.2;
135 0 : state.dataDispVentMgr->ThickOccupiedSubzoneMin = 0.2;
136 0 : state.dataDispVentMgr->HeightIntMassDefault = 2.0;
137 0 : state.dataDispVentMgr->InitUCSDDVMyOneTimeFlag = false;
138 : }
139 :
140 : // Do the begin environment initializations
141 0 : if (state.dataGlobal->BeginEnvrnFlag && state.dataDispVentMgr->MyEnvrnFlag(ZoneNum)) {
142 0 : state.dataDispVentMgr->HAT_MX = 0.0;
143 0 : state.dataDispVentMgr->HAT_OC = 0.0;
144 0 : state.dataDispVentMgr->HA_MX = 0.0;
145 0 : state.dataDispVentMgr->HA_OC = 0.0;
146 0 : state.dataDispVentMgr->HAT_FLOOR = 0.0;
147 0 : state.dataDispVentMgr->HA_FLOOR = 0.0;
148 0 : state.dataDispVentMgr->MyEnvrnFlag(ZoneNum) = false;
149 : }
150 :
151 0 : if (!state.dataGlobal->BeginEnvrnFlag) {
152 0 : state.dataDispVentMgr->MyEnvrnFlag(ZoneNum) = true;
153 : }
154 :
155 : // initialize these module variables every timestep
156 0 : state.dataDispVentMgr->HeightIntMass = state.dataDispVentMgr->HeightIntMassDefault;
157 0 : }
158 :
159 : //**************************************************************************************************
160 :
161 1 : void HcDispVent3Node(EnergyPlusData &state, int const ZoneNum, Real64 const FractionHeight)
162 : {
163 :
164 : // SUBROUTINE INFORMATION:
165 : // AUTHOR G. Carrilho da Graca
166 : // DATE WRITTEN February 2004
167 : // MODIFIED -
168 : // RE-ENGINEERED -
169 :
170 : // PURPOSE OF THIS SUBROUTINE:
171 : // Main subroutine for convection calculation in the UCSD Displacement Ventilation model.
172 : // It calls CalcDetailedHcInForDVModel for convection coefficient
173 : // initial calculations and averages the final result comparing the position of the surface with
174 : // the interface subzone height.
175 :
176 : // Using/Aliasing
177 : using namespace DataEnvironment;
178 : using namespace DataHeatBalance;
179 :
180 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
181 : Real64 HLD; // Convection coefficient for the lower area of surface
182 : Real64 TmedDV; // Average temperature for DV
183 : Real64 Z1; // auxiliary var for lowest height
184 : Real64 Z2; // auxiliary var for highest height
185 : Real64 ZSupSurf; // highest height for this surface
186 : Real64 ZInfSurf; // lowest height for this surface
187 : Real64 HLU; // Convection coefficient for the upper area of surface
188 : Real64 LayH; // Height of the Occupied/Mixed subzone interface
189 : Real64 LayFrac; // Fraction height of the Occupied/Mixed subzone interface
190 :
191 1 : state.dataDispVentMgr->HAT_MX = 0.0;
192 1 : state.dataDispVentMgr->HAT_OC = 0.0;
193 1 : state.dataDispVentMgr->HA_MX = 0.0;
194 1 : state.dataDispVentMgr->HA_OC = 0.0;
195 1 : state.dataDispVentMgr->HAT_FLOOR = 0.0;
196 1 : state.dataDispVentMgr->HA_FLOOR = 0.0;
197 1 : auto &SurfTempIn(state.dataHeatBalSurf->SurfTempIn);
198 :
199 : // Is the air flow model for this zone set to UCSDDV Displacement Ventilation?
200 1 : if (state.dataRoomAir->IsZoneDispVent3Node(ZoneNum)) {
201 1 : LayFrac = FractionHeight;
202 1 : LayH = FractionHeight * (state.dataRoomAir->ZoneCeilingHeight2(ZoneNum) - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum));
203 : // WALL Hc, HA and HAT calculation
204 1 : for (int Ctd = state.dataRoomAir->PosZ_Wall(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Wall(ZoneNum).end; ++Ctd) {
205 0 : int SurfNum = state.dataRoomAir->APos_Wall(Ctd);
206 0 : if (SurfNum == 0) continue;
207 :
208 0 : auto const &surf = state.dataSurface->Surface(SurfNum);
209 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp;
210 0 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
211 0 : Z1 = minval(surf.Vertex, &Vector::z);
212 0 : Z2 = maxval(surf.Vertex, &Vector::z);
213 0 : ZSupSurf = Z2 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
214 0 : ZInfSurf = Z1 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
215 :
216 : // The Wall surface is in the upper subzone
217 0 : if (ZInfSurf > LayH) {
218 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
219 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
220 0 : state.dataRoomAir->HWall(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
221 0 : state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWall(Ctd);
222 0 : state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HWall(Ctd);
223 : }
224 :
225 : // The Wall surface is in the lower subzone
226 0 : if (ZSupSurf < LayH) {
227 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
228 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
229 0 : state.dataRoomAir->HWall(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
230 0 : state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWall(Ctd);
231 0 : state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HWall(Ctd);
232 : }
233 :
234 : // The Wall surface is partially in upper and partially in lower subzone
235 0 : if (ZInfSurf <= LayH && ZSupSurf >= LayH) {
236 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
237 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
238 0 : HLU = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
239 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
240 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
241 0 : HLD = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
242 0 : TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) /
243 0 : (ZSupSurf - ZInfSurf);
244 0 : state.dataRoomAir->HWall(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf);
245 0 : state.dataDispVentMgr->HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU;
246 0 : state.dataDispVentMgr->HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU;
247 0 : state.dataDispVentMgr->HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD;
248 0 : state.dataDispVentMgr->HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD;
249 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV;
250 : }
251 :
252 0 : state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HWall(Ctd);
253 :
254 : } // END WALL
255 :
256 : // WINDOW Hc, HA and HAT CALCULATION
257 1 : for (int Ctd = state.dataRoomAir->PosZ_Window(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Window(ZoneNum).end; ++Ctd) {
258 0 : int SurfNum = state.dataRoomAir->APos_Window(Ctd);
259 0 : if (SurfNum == 0) continue;
260 :
261 0 : auto const &surf = state.dataSurface->Surface(SurfNum);
262 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp;
263 0 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
264 0 : if (surf.Tilt > 10.0 && surf.Tilt < 170.0) { // Window Wall
265 0 : Z1 = minval(surf.Vertex, &Vector::z);
266 0 : Z2 = maxval(surf.Vertex, &Vector::z);
267 0 : ZSupSurf = Z2 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
268 0 : ZInfSurf = Z1 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
269 :
270 0 : if (ZInfSurf > LayH) {
271 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
272 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
273 0 : state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
274 0 : state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd);
275 0 : state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HWindow(Ctd);
276 : }
277 :
278 0 : if (ZSupSurf < LayH) {
279 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
280 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
281 0 : state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
282 0 : state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd);
283 0 : state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HWindow(Ctd);
284 : }
285 :
286 0 : if (ZInfSurf <= LayH && ZSupSurf >= LayH) {
287 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
288 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
289 0 : HLU = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
290 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
291 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
292 0 : HLD = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
293 0 : TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) /
294 0 : (ZSupSurf - ZInfSurf);
295 0 : state.dataRoomAir->HWindow(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf);
296 0 : state.dataDispVentMgr->HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU;
297 0 : state.dataDispVentMgr->HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU;
298 0 : state.dataDispVentMgr->HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD;
299 0 : state.dataDispVentMgr->HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD;
300 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV;
301 : }
302 : }
303 :
304 0 : if (surf.Tilt <= 10.0) { // Window Ceiling
305 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
306 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
307 0 : state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
308 0 : state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd);
309 0 : state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HWindow(Ctd);
310 : }
311 :
312 0 : if (surf.Tilt >= 170.0) { // Window Floor
313 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
314 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
315 0 : state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
316 0 : state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd);
317 0 : state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HWindow(Ctd);
318 : }
319 :
320 0 : state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HWindow(Ctd);
321 :
322 : } // END WINDOW
323 :
324 : // DOOR Hc, HA and HAT CALCULATION
325 4 : for (int Ctd = state.dataRoomAir->PosZ_Door(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Door(ZoneNum).end; ++Ctd) { // DOOR
326 3 : int SurfNum = state.dataRoomAir->APos_Door(Ctd);
327 3 : if (SurfNum == 0) continue;
328 :
329 3 : auto const &surf = state.dataSurface->Surface(SurfNum);
330 3 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp;
331 3 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
332 3 : if (surf.Tilt > 10.0 && surf.Tilt < 170.0) { // Door Wall
333 1 : Z1 = minval(surf.Vertex, &Vector::z);
334 1 : Z2 = maxval(surf.Vertex, &Vector::z);
335 1 : ZSupSurf = Z2 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
336 1 : ZInfSurf = Z1 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
337 :
338 1 : if (ZInfSurf > LayH) {
339 1 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
340 1 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
341 1 : state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
342 1 : state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd);
343 1 : state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HDoor(Ctd);
344 : }
345 :
346 1 : if (ZSupSurf < LayH) {
347 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
348 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
349 0 : state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
350 0 : state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd);
351 0 : state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HDoor(Ctd);
352 : }
353 :
354 1 : if (ZInfSurf <= LayH && ZSupSurf >= LayH) {
355 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
356 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
357 0 : HLU = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
358 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
359 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
360 0 : HLD = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
361 0 : TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) /
362 0 : (ZSupSurf - ZInfSurf);
363 0 : state.dataRoomAir->HDoor(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf);
364 0 : state.dataDispVentMgr->HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU;
365 0 : state.dataDispVentMgr->HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU;
366 0 : state.dataDispVentMgr->HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD;
367 0 : state.dataDispVentMgr->HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD;
368 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV;
369 : }
370 : }
371 :
372 3 : if (surf.Tilt <= 10.0) { // Door Ceiling
373 1 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
374 1 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
375 1 : state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
376 1 : state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd);
377 1 : state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HDoor(Ctd);
378 : }
379 :
380 3 : if (surf.Tilt >= 170.0) { // Door Floor
381 1 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
382 1 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
383 1 : state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
384 1 : state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd);
385 1 : state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HDoor(Ctd);
386 : }
387 :
388 3 : state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HDoor(Ctd);
389 :
390 : } // END DOOR
391 :
392 : // INTERNAL Hc, HA and HAT CALCULATION
393 1 : state.dataDispVentMgr->HeightIntMass =
394 1 : min(state.dataDispVentMgr->HeightIntMassDefault,
395 1 : (state.dataRoomAir->ZoneCeilingHeight2(ZoneNum) - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum)));
396 1 : for (int Ctd = state.dataRoomAir->PosZ_Internal(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Internal(ZoneNum).end; ++Ctd) {
397 0 : int SurfNum = state.dataRoomAir->APos_Internal(Ctd);
398 0 : if (SurfNum == 0) continue;
399 :
400 0 : auto const &surf = state.dataSurface->Surface(SurfNum);
401 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp;
402 0 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
403 0 : ZSupSurf = state.dataDispVentMgr->HeightIntMass;
404 0 : ZInfSurf = 0.0;
405 :
406 0 : if (ZSupSurf < LayH) {
407 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
408 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
409 0 : state.dataRoomAir->HInternal(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
410 0 : state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HInternal(Ctd);
411 0 : state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HInternal(Ctd);
412 : }
413 :
414 0 : if (ZInfSurf <= LayH && ZSupSurf >= LayH) {
415 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
416 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
417 0 : HLU = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
418 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
419 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
420 0 : HLD = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
421 0 : TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) /
422 0 : (ZSupSurf - ZInfSurf);
423 0 : state.dataRoomAir->HInternal(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf);
424 0 : state.dataDispVentMgr->HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU;
425 0 : state.dataDispVentMgr->HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU;
426 0 : state.dataDispVentMgr->HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD;
427 0 : state.dataDispVentMgr->HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD;
428 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV;
429 : }
430 :
431 0 : state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HInternal(Ctd);
432 : } // END INTERNAL
433 :
434 : // CEILING Hc, HA and HAT CALCULATION
435 1 : for (int Ctd = state.dataRoomAir->PosZ_Ceiling(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Ceiling(ZoneNum).end; ++Ctd) {
436 0 : int SurfNum = state.dataRoomAir->APos_Ceiling(Ctd);
437 0 : if (SurfNum == 0) continue;
438 :
439 0 : auto const &surf = state.dataSurface->Surface(SurfNum);
440 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp;
441 0 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
442 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
443 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
444 0 : state.dataRoomAir->HCeiling(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
445 0 : state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HCeiling(Ctd);
446 0 : state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HCeiling(Ctd);
447 0 : state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HCeiling(Ctd);
448 : } // END CEILING
449 :
450 : // FLOOR Hc, HA and HAT CALCULATION
451 1 : for (int Ctd = state.dataRoomAir->PosZ_Floor(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Floor(ZoneNum).end; ++Ctd) {
452 0 : int SurfNum = state.dataRoomAir->APos_Floor(Ctd);
453 0 : if (SurfNum == 0) continue;
454 :
455 0 : auto const &surf = state.dataSurface->Surface(SurfNum);
456 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp;
457 0 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
458 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTFloor(ZoneNum);
459 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
460 0 : state.dataRoomAir->HFloor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
461 0 : state.dataDispVentMgr->HAT_FLOOR += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HFloor(Ctd);
462 0 : state.dataDispVentMgr->HA_FLOOR += surf.Area * state.dataRoomAir->HFloor(Ctd);
463 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTFloor(ZoneNum);
464 0 : state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HFloor(Ctd);
465 : } // END FLOOR
466 : }
467 1 : }
468 :
469 : //**************************************************************************************************
470 :
471 1 : Real64 calculateThirdOrderFloorTemperature(Real64 temperatureHistoryTerm,
472 : Real64 HAT_floor,
473 : Real64 HA_floor,
474 : Real64 MCpT_Total,
475 : Real64 MCp_Total,
476 : Real64 occupiedTemp,
477 : Real64 nonAirSystemResponse,
478 : Real64 zoneMultiplier,
479 : Real64 airCap)
480 : {
481 1 : const Real64 elevenOverSix = 11.0 / 6.0;
482 1 : return (temperatureHistoryTerm + HAT_floor + MCpT_Total + 0.6 * occupiedTemp * MCp_Total + nonAirSystemResponse / zoneMultiplier) /
483 1 : (elevenOverSix * airCap + HA_floor + 1.6 * MCp_Total);
484 : }
485 :
486 0 : void CalcDispVent3Node(EnergyPlusData &state, int const ZoneNum) // Which Zonenum
487 : {
488 :
489 : // SUBROUTINE INFORMATION:
490 : // AUTHOR G. Carrilho da Graca
491 : // DATE WRITTEN February 2004
492 : // MODIFIED Brent Griffith June 2008 for new interpolation and time history
493 : // RE-ENGINEERED -
494 :
495 : // PURPOSE OF THIS SUBROUTINE:
496 : // Subroutine for displacement ventilation modelling.
497 : // This subroutine calculates the mixed subzone height, surface heat transfer coefficients and
498 : // room air equivalent temperatures and three space temperatures (floor subzone, occupied zone and upper,
499 : // mixed subzone temperature)
500 :
501 : // REFERENCES:
502 : // Model developed by Paul Linden (UCSD), G. Carrilho da Graca (UCSD) and P. Haves (LBL).
503 : // Work funded by the California Energy Comission. More information on the model can found in:
504 : // "Simplified Models for Heat Transfer in Rooms" G. Carrilho da Graca, Ph.D. thesis UCSD. December 2003.
505 :
506 : // Using/Aliasing
507 : using namespace DataEnvironment;
508 : using namespace DataHeatBalance;
509 :
510 0 : Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys;
511 0 : Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec;
512 :
513 : using Psychrometrics::PsyCpAirFnW;
514 : using Psychrometrics::PsyRhoAirFnPbTdbW;
515 :
516 : // SUBROUTINE PARAMETER DEFINITIONS:
517 0 : Real64 const OneThird(1.0 / 3.0);
518 0 : Real64 const MinFlow_pow_fac(std::pow(1.0 / 24.55 * 1.0, 1.0 / 0.6));
519 :
520 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
521 : Real64 HeightFrac; // Fractional height of transition between occupied and mixed subzones
522 : Real64 GainsFrac; // Fraction of lower subzone internal gains that mix as opposed to forming plumes
523 : Real64 ConvGains; // Total convective gains in the room
524 : Real64 ConvGainsOccupiedSubzone; // Total convective gains released in occupied subzone
525 : Real64 ConvGainsMixedSubzone; // Total convective gains released in mixed subzone
526 : Real64 MCp_Total; // Total capacity rate into the zone - assumed to enter at low level
527 : Real64 ZTAveraged;
528 : Real64 TempDiffCritRep; // Minimum temperature difference between mixed and occupied subzones for reporting
529 : bool MIXFLAG;
530 : Real64 MinFlow;
531 : Real64 NumPLPP; // Number of plumes per person
532 : Real64 MTGAUX;
533 : int ZoneEquipConfigNum;
534 : Real64 PowerInPlumes;
535 : Real64 SumSysMCp;
536 : Real64 SumSysMCpT;
537 : Real64 NodeTemp;
538 : Real64 MassFlowRate;
539 : Real64 CpAir;
540 : Real64 MCpT_Total;
541 : Real64 NumberOfPlumes;
542 : Real64 SumMCp;
543 : Real64 SumMCpT;
544 : Real64 TempHistTerm;
545 : Real64 PowerPerPlume;
546 : Real64 HeightMixedSubzoneAve; // Height of center of mixed air subzone
547 : Real64 HeightOccupiedSubzoneAve; // Height of center of occupied air subzone
548 : Real64 HeightFloorSubzoneAve; // Height of center of floor air subzone
549 : Real64 HeightThermostat; // Height of center of thermostat/temperature control sensor
550 : Real64 HeightComfort; // Height at which air temperature value is used to calculate comfort
551 : Real64 CeilingHeight;
552 : Real64 ZoneMult; // total zone multiplier
553 : int FlagApertures;
554 :
555 0 : auto &TempDepCoef = state.dataDispVentMgr->TempDepCoef;
556 0 : auto &TempIndCoef = state.dataDispVentMgr->TempIndCoef;
557 :
558 : Real64 RetAirGain;
559 0 : assert(state.dataRoomAir->AirModel.allocated());
560 :
561 : // Exact solution or Euler method
562 0 : if (state.dataHeatBal->ZoneAirSolutionAlgo != DataHeatBalance::SolutionAlgo::ThirdOrder) {
563 0 : if (state.dataHVACGlobal->ShortenTimeStepSysRoomAir && TimeStepSys < state.dataGlobal->TimeStepZone) {
564 0 : if (state.dataHVACGlobal->PreviousTimeStep < state.dataGlobal->TimeStepZone) {
565 0 : state.dataRoomAir->Zone1Floor(ZoneNum) = state.dataRoomAir->ZoneM2Floor(ZoneNum);
566 0 : state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZoneM2OC(ZoneNum);
567 0 : state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZoneM2MX(ZoneNum);
568 : } else {
569 0 : state.dataRoomAir->Zone1Floor(ZoneNum) = state.dataRoomAir->ZoneMXFloor(ZoneNum);
570 0 : state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZoneMXOC(ZoneNum);
571 0 : state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZoneMXMX(ZoneNum);
572 : }
573 : } else {
574 0 : state.dataRoomAir->Zone1Floor(ZoneNum) = state.dataRoomAir->ZTFloor(ZoneNum);
575 0 : state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZTOC(ZoneNum);
576 0 : state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum);
577 : }
578 : }
579 :
580 0 : auto &zone = state.dataHeatBal->Zone(ZoneNum);
581 :
582 0 : MIXFLAG = false;
583 0 : FlagApertures = 1;
584 0 : state.dataRoomAir->DispVent3NodeHcIn = state.dataHeatBalSurf->SurfHConvInt;
585 0 : CeilingHeight = state.dataRoomAir->ZoneCeilingHeight2(ZoneNum) - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
586 0 : ZoneMult = zone.Multiplier * zone.ListMultiplier;
587 0 : auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum);
588 :
589 0 : for (int Ctd = 1; Ctd <= state.dataRoomAir->TotDispVent3Node; ++Ctd) {
590 0 : auto &zoneDV3N = state.dataRoomAir->ZoneDispVent3Node(Ctd);
591 0 : if (ZoneNum == zoneDV3N.ZonePtr) {
592 0 : GainsFrac = zoneDV3N.gainsSched->getCurrentVal();
593 0 : NumPLPP = zoneDV3N.NumPlumesPerOcc;
594 0 : HeightThermostat = zoneDV3N.ThermostatHeight;
595 0 : HeightComfort = zoneDV3N.ComfortHeight;
596 0 : TempDiffCritRep = zoneDV3N.TempTrigger;
597 : }
598 : }
599 :
600 0 : ConvGainsOccupiedSubzone = InternalHeatGains::SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied);
601 :
602 0 : ConvGainsOccupiedSubzone += 0.5 * thisZoneHB.SysDepZoneLoadsLagged;
603 :
604 : // Add heat to return air if zonal system (no return air) or cycling system (return air frequently very
605 : // low or zero)
606 0 : if (zone.NoHeatToReturnAir) {
607 0 : RetAirGain = InternalHeatGains::SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied);
608 0 : ConvGainsOccupiedSubzone += RetAirGain;
609 : }
610 :
611 0 : ConvGainsMixedSubzone = InternalHeatGains::SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesMixedSubzone);
612 0 : ConvGainsMixedSubzone += state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum) + state.dataHeatBalFanSys->SumConvPool(ZoneNum) +
613 0 : 0.5 * thisZoneHB.SysDepZoneLoadsLagged;
614 0 : if (zone.NoHeatToReturnAir) {
615 0 : RetAirGain = InternalHeatGains::SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesMixedSubzone);
616 0 : ConvGainsMixedSubzone += RetAirGain;
617 : }
618 :
619 0 : ConvGains = ConvGainsOccupiedSubzone + ConvGainsMixedSubzone;
620 :
621 : // Make sure all types of internal gains have been gathered
622 0 : assert((int)(size(IntGainTypesOccupied) + size(IntGainTypesMixedSubzone) + size(ExcludedIntGainTypes)) ==
623 : (int)DataHeatBalance::IntGainType::Num);
624 :
625 : //=================== Entering air system temperature and flow====================
626 0 : SumSysMCp = 0.0;
627 0 : SumSysMCpT = 0.0;
628 : // Check to make sure if this is a controlled zone and determine ZoneEquipConfigNum
629 0 : ZoneEquipConfigNum = ZoneNum;
630 0 : if (state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).IsControlled) {
631 0 : for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).NumInletNodes; ++NodeNum) {
632 0 : NodeTemp = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).Temp;
633 0 : MassFlowRate = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).MassFlowRate;
634 0 : CpAir = PsyCpAirFnW(thisZoneHB.airHumRat);
635 0 : SumSysMCp += MassFlowRate * CpAir;
636 0 : SumSysMCpT += MassFlowRate * CpAir * NodeTemp;
637 : }
638 : }
639 :
640 0 : SumMCp = thisZoneHB.MCPI + thisZoneHB.MCPV + thisZoneHB.MCPM + thisZoneHB.MCPE + thisZoneHB.MCPC + thisZoneHB.MDotCPOA;
641 0 : SumMCpT =
642 0 : thisZoneHB.MCPTI + thisZoneHB.MCPTV + thisZoneHB.MCPTM + thisZoneHB.MCPTE + thisZoneHB.MCPTC + thisZoneHB.MDotCPOA * zone.OutDryBulbTemp;
643 0 : if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithoutDistribution) {
644 0 : SumMCp = state.afn->exchangeData(ZoneNum).SumMCp + state.afn->exchangeData(ZoneNum).SumMVCp + state.afn->exchangeData(ZoneNum).SumMMCp;
645 0 : SumMCpT =
646 0 : state.afn->exchangeData(ZoneNum).SumMCpT + state.afn->exchangeData(ZoneNum).SumMVCpT + state.afn->exchangeData(ZoneNum).SumMMCpT;
647 : }
648 :
649 0 : MCp_Total = SumMCp + SumSysMCp;
650 0 : MCpT_Total = SumMCpT + SumSysMCpT;
651 :
652 0 : if (state.dataHeatBal->TotPeople > 0) {
653 0 : int NumberOfOccupants = 0;
654 0 : NumberOfPlumes = 0.0;
655 0 : for (int Ctd = 1; Ctd <= state.dataHeatBal->TotPeople; ++Ctd) {
656 0 : if (state.dataHeatBal->People(Ctd).ZonePtr == ZoneNum) {
657 0 : NumberOfOccupants +=
658 0 : state.dataHeatBal->People(Ctd).NumberOfPeople; // *GetCurrentScheduleValue(state, People(Ctd)%NumberOfPeoplePtr)
659 0 : NumberOfPlumes = NumberOfOccupants * NumPLPP;
660 : }
661 : }
662 0 : if (NumberOfPlumes == 0.0) {
663 0 : NumberOfPlumes = 1.0;
664 : }
665 0 : PowerInPlumes = (1.0 - GainsFrac) * ConvGainsOccupiedSubzone;
666 0 : PowerPerPlume = PowerInPlumes / NumberOfPlumes;
667 : } else {
668 0 : NumberOfPlumes = 1.0;
669 0 : PowerInPlumes = (1.0 - GainsFrac) * ConvGainsOccupiedSubzone;
670 0 : PowerPerPlume = PowerInPlumes / NumberOfPlumes;
671 : }
672 :
673 : // When AirflowNetwork is used verify if bottom apertures are inflowing and upper apertures are
674 : // outflowing. The lower apertures have to be located below 0.8m and the upper apertures
675 : // have to be located above 1.8m.
676 :
677 0 : if (state.afn->NumOfLinksMultiZone > 0) {
678 0 : for (int Loop = 1; Loop <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++Loop) {
679 : // direct AirflowNetwork surface
680 0 : int afnSurfNum = state.dataRoomAir->AFNSurfaceCrossVent(Loop, ZoneNum);
681 0 : auto const &surfParams = state.dataRoomAir->SurfParametersCrossDispVent(afnSurfNum);
682 0 : auto const &afnLinkSimu = state.afn->AirflowNetworkLinkSimu(afnSurfNum);
683 0 : auto const &afnMzSurfData = state.afn->MultizoneSurfaceData(afnSurfNum);
684 0 : auto const &afnMzSurf = state.dataSurface->Surface(afnMzSurfData.SurfNum);
685 0 : if (afnMzSurf.Zone == ZoneNum) {
686 :
687 0 : if ((surfParams.Zmax < 0.8 && afnLinkSimu.VolFLOW > 0)) {
688 0 : FlagApertures = 0;
689 0 : break;
690 : }
691 0 : if (surfParams.Zmin > 1.8 && afnLinkSimu.VolFLOW2 > 0) {
692 0 : FlagApertures = 0;
693 0 : break;
694 : }
695 :
696 0 : if ((surfParams.Zmin > 0.8 && surfParams.Zmin < 1.8) || (surfParams.Zmax > 0.8 && surfParams.Zmax < 1.8)) {
697 0 : FlagApertures = 0;
698 0 : break;
699 : }
700 : // indirect AirflowNetwork surface; this is an interzone surface
701 : } else {
702 0 : auto const &afnZone = state.dataHeatBal->Zone(afnMzSurf.Zone);
703 0 : if (surfParams.Zmax + afnZone.OriginZ - zone.OriginZ < 0.8 && afnLinkSimu.VolFLOW2 > 0) {
704 0 : FlagApertures = 0;
705 0 : break;
706 : }
707 0 : if (surfParams.Zmin + afnZone.OriginZ - zone.OriginZ > 1.8 && afnLinkSimu.VolFLOW > 0) {
708 0 : FlagApertures = 0;
709 0 : break;
710 : }
711 0 : if ((surfParams.Zmin + afnZone.OriginZ - zone.OriginZ > 0.8 && surfParams.Zmin + afnZone.OriginZ - zone.OriginZ < 1.8) ||
712 0 : (surfParams.Zmax + afnZone.OriginZ - zone.OriginZ > 0.8 && surfParams.Zmax + afnZone.OriginZ - zone.OriginZ < 1.8)) {
713 0 : FlagApertures = 0;
714 0 : break;
715 : }
716 : }
717 : }
718 : }
719 :
720 0 : if ((PowerInPlumes == 0.0) || (MCpT_Total == 0.0) || FlagApertures == 0) {
721 : // The system will mix
722 0 : HeightFrac = 0.0;
723 : } else {
724 0 : Real64 const plume_fac(NumberOfPlumes * std::pow(PowerPerPlume, OneThird));
725 0 : HeightFrac = min(24.55 * std::pow(MCp_Total * 0.000833 / plume_fac, 0.6) / CeilingHeight, 1.0);
726 0 : for (int Ctd = 1; Ctd <= 4; ++Ctd) {
727 0 : HcDispVent3Node(state, ZoneNum, HeightFrac);
728 : // HeightFrac = min( 24.55 * std::pow( MCp_Total * 0.000833 / ( NumberOfPlumes * std::pow( PowerPerPlume, OneThird ) ), 0.6 ) /
729 : // CeilingHeight, 1.0 ); //Tuned This does not vary in loop EPTeam-replaces above (cause diffs) HeightFrac =
730 : // MIN(24.55d0*(MCp_Total*0.000833d0/(NumberOfPlumes*PowerPerPlume**(1.0d0/3.d0)))**0.6 / CeilingHeight , 1.0d0)
731 0 : state.dataRoomAir->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight;
732 0 : state.dataRoomAir->AIRRATFloor(ZoneNum) =
733 0 : zone.Volume * min(state.dataRoomAir->HeightTransition(ZoneNum), state.dataDispVentMgr->HeightFloorSubzoneTop) / CeilingHeight *
734 0 : zone.ZoneVolCapMultpSens *
735 0 : PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATFloor(ZoneNum), thisZoneHB.airHumRat) *
736 0 : PsyCpAirFnW(thisZoneHB.airHumRat) / TimeStepSysSec;
737 0 : state.dataRoomAir->AIRRATOC(ZoneNum) =
738 0 : zone.Volume * (state.dataRoomAir->HeightTransition(ZoneNum) - min(state.dataRoomAir->HeightTransition(ZoneNum), 0.2)) /
739 0 : CeilingHeight * zone.ZoneVolCapMultpSens *
740 0 : PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATOC(ZoneNum), thisZoneHB.airHumRat) *
741 0 : PsyCpAirFnW(thisZoneHB.airHumRat) / TimeStepSysSec;
742 0 : state.dataRoomAir->AIRRATMX(ZoneNum) =
743 0 : zone.Volume * (CeilingHeight - state.dataRoomAir->HeightTransition(ZoneNum)) / CeilingHeight * zone.ZoneVolCapMultpSens *
744 0 : PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATMX(ZoneNum), thisZoneHB.airHumRat) *
745 0 : PsyCpAirFnW(thisZoneHB.airHumRat) / TimeStepSysSec;
746 :
747 0 : if (state.dataHVACGlobal->UseZoneTimeStepHistory) {
748 0 : state.dataRoomAir->ZTMFloor(ZoneNum)[2] = state.dataRoomAir->XMATFloor(ZoneNum)[2];
749 0 : state.dataRoomAir->ZTMFloor(ZoneNum)[1] = state.dataRoomAir->XMATFloor(ZoneNum)[1];
750 0 : state.dataRoomAir->ZTMFloor(ZoneNum)[0] = state.dataRoomAir->XMATFloor(ZoneNum)[0];
751 :
752 0 : state.dataRoomAir->ZTMOC(ZoneNum)[2] = state.dataRoomAir->XMATOC(ZoneNum)[2];
753 0 : state.dataRoomAir->ZTMOC(ZoneNum)[1] = state.dataRoomAir->XMATOC(ZoneNum)[1];
754 0 : state.dataRoomAir->ZTMOC(ZoneNum)[0] = state.dataRoomAir->XMATOC(ZoneNum)[0];
755 :
756 0 : state.dataRoomAir->ZTMMX(ZoneNum)[2] = state.dataRoomAir->XMATMX(ZoneNum)[2];
757 0 : state.dataRoomAir->ZTMMX(ZoneNum)[1] = state.dataRoomAir->XMATMX(ZoneNum)[1];
758 0 : state.dataRoomAir->ZTMMX(ZoneNum)[0] = state.dataRoomAir->XMATMX(ZoneNum)[0];
759 :
760 : } else {
761 0 : state.dataRoomAir->ZTMFloor(ZoneNum)[2] = state.dataRoomAir->DSXMATFloor(ZoneNum)[2];
762 0 : state.dataRoomAir->ZTMFloor(ZoneNum)[1] = state.dataRoomAir->DSXMATFloor(ZoneNum)[1];
763 0 : state.dataRoomAir->ZTMFloor(ZoneNum)[0] = state.dataRoomAir->DSXMATFloor(ZoneNum)[0];
764 :
765 0 : state.dataRoomAir->ZTMOC(ZoneNum)[2] = state.dataRoomAir->DSXMATOC(ZoneNum)[2];
766 0 : state.dataRoomAir->ZTMOC(ZoneNum)[1] = state.dataRoomAir->DSXMATOC(ZoneNum)[1];
767 0 : state.dataRoomAir->ZTMOC(ZoneNum)[0] = state.dataRoomAir->DSXMATOC(ZoneNum)[0];
768 :
769 0 : state.dataRoomAir->ZTMMX(ZoneNum)[2] = state.dataRoomAir->DSXMATMX(ZoneNum)[2];
770 0 : state.dataRoomAir->ZTMMX(ZoneNum)[1] = state.dataRoomAir->DSXMATMX(ZoneNum)[1];
771 0 : state.dataRoomAir->ZTMMX(ZoneNum)[0] = state.dataRoomAir->DSXMATMX(ZoneNum)[0];
772 : }
773 :
774 0 : Real64 AirCap = state.dataRoomAir->AIRRATFloor(ZoneNum);
775 0 : TempHistTerm = AirCap * (3.0 * state.dataRoomAir->ZTMFloor(ZoneNum)[0] - (3.0 / 2.0) * state.dataRoomAir->ZTMFloor(ZoneNum)[1] +
776 0 : OneThird * state.dataRoomAir->ZTMFloor(ZoneNum)[2]);
777 0 : TempDepCoef = state.dataDispVentMgr->HA_FLOOR + MCp_Total;
778 0 : TempIndCoef = state.dataDispVentMgr->HAT_FLOOR + MCpT_Total + thisZoneHB.NonAirSystemResponse / ZoneMult;
779 0 : switch (state.dataHeatBal->ZoneAirSolutionAlgo) {
780 0 : case DataHeatBalance::SolutionAlgo::ThirdOrder: {
781 0 : state.dataRoomAir->ZTFloor(ZoneNum) = calculateThirdOrderFloorTemperature(TempHistTerm,
782 0 : state.dataDispVentMgr->HAT_FLOOR,
783 0 : state.dataDispVentMgr->HA_FLOOR,
784 : MCpT_Total,
785 : MCp_Total,
786 0 : state.dataRoomAir->ZTOC(ZoneNum),
787 : thisZoneHB.NonAirSystemResponse,
788 : ZoneMult,
789 : AirCap);
790 0 : } break;
791 0 : case DataHeatBalance::SolutionAlgo::AnalyticalSolution: {
792 0 : if (TempDepCoef == 0.0) { // B=0
793 0 : state.dataRoomAir->ZTFloor(ZoneNum) = state.dataRoomAir->Zone1Floor(ZoneNum) + TempIndCoef / AirCap;
794 : } else {
795 0 : state.dataRoomAir->ZTFloor(ZoneNum) =
796 0 : (state.dataRoomAir->Zone1Floor(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) +
797 0 : TempIndCoef / TempDepCoef;
798 : }
799 0 : } break;
800 0 : case DataHeatBalance::SolutionAlgo::EulerMethod: {
801 0 : state.dataRoomAir->ZTFloor(ZoneNum) = (AirCap * state.dataRoomAir->Zone1Floor(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef);
802 0 : } break;
803 0 : default:
804 0 : break;
805 : }
806 0 : AirCap = state.dataRoomAir->AIRRATOC(ZoneNum);
807 0 : TempHistTerm = AirCap * (3.0 * state.dataRoomAir->ZTMOC(ZoneNum)[0] - (3.0 / 2.0) * state.dataRoomAir->ZTMOC(ZoneNum)[1] +
808 0 : OneThird * state.dataRoomAir->ZTMOC(ZoneNum)[2]);
809 0 : TempDepCoef = state.dataDispVentMgr->HA_OC + MCp_Total;
810 0 : TempIndCoef = ConvGainsOccupiedSubzone * GainsFrac + state.dataDispVentMgr->HAT_OC + state.dataRoomAir->ZTFloor(ZoneNum) * MCp_Total;
811 0 : switch (state.dataHeatBal->ZoneAirSolutionAlgo) {
812 0 : case DataHeatBalance::SolutionAlgo::ThirdOrder: {
813 0 : state.dataRoomAir->ZTOC(ZoneNum) = (TempHistTerm + ConvGainsOccupiedSubzone * GainsFrac + state.dataDispVentMgr->HAT_OC +
814 0 : 1.6 * state.dataRoomAir->ZTFloor(ZoneNum) * MCp_Total) /
815 0 : ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_OC + 1.6 * MCp_Total);
816 0 : } break;
817 0 : case DataHeatBalance::SolutionAlgo::AnalyticalSolution: {
818 0 : if (TempDepCoef == 0.0) { // B=0
819 0 : state.dataRoomAir->ZTOC(ZoneNum) = state.dataRoomAir->Zone1OC(ZoneNum) + TempIndCoef / AirCap;
820 : } else {
821 0 : if (AirCap == 0.0) {
822 0 : state.dataRoomAir->ZTOC(ZoneNum) = TempIndCoef / TempDepCoef;
823 : } else {
824 0 : state.dataRoomAir->ZTOC(ZoneNum) =
825 0 : (state.dataRoomAir->Zone1OC(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) +
826 0 : TempIndCoef / TempDepCoef;
827 : }
828 : }
829 0 : } break;
830 0 : case DataHeatBalance::SolutionAlgo::EulerMethod: {
831 0 : state.dataRoomAir->ZTOC(ZoneNum) = (AirCap * state.dataRoomAir->Zone1OC(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef);
832 0 : } break;
833 0 : default:
834 0 : break;
835 : }
836 0 : AirCap = state.dataRoomAir->AIRRATMX(ZoneNum);
837 0 : TempHistTerm = AirCap * (3.0 * state.dataRoomAir->ZTMMX(ZoneNum)[0] - (3.0 / 2.0) * state.dataRoomAir->ZTMMX(ZoneNum)[1] +
838 0 : OneThird * state.dataRoomAir->ZTMMX(ZoneNum)[2]);
839 0 : TempDepCoef = state.dataDispVentMgr->HA_MX + MCp_Total;
840 0 : TempIndCoef = ConvGainsOccupiedSubzone * (1.0 - GainsFrac) + ConvGainsMixedSubzone + state.dataDispVentMgr->HAT_MX +
841 0 : state.dataRoomAir->ZTOC(ZoneNum) * MCp_Total;
842 0 : switch (state.dataHeatBal->ZoneAirSolutionAlgo) {
843 0 : case DataHeatBalance::SolutionAlgo::ThirdOrder: {
844 0 : state.dataRoomAir->ZTMX(ZoneNum) = (TempHistTerm + ConvGainsOccupiedSubzone * (1.0 - GainsFrac) + ConvGainsMixedSubzone +
845 0 : state.dataDispVentMgr->HAT_MX + state.dataRoomAir->ZTOC(ZoneNum) * MCp_Total) /
846 0 : ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_MX + MCp_Total);
847 0 : } break;
848 0 : case DataHeatBalance::SolutionAlgo::AnalyticalSolution: {
849 0 : if (TempDepCoef == 0.0) { // B=0
850 0 : state.dataRoomAir->ZTMX(ZoneNum) = state.dataRoomAir->Zone1MX(ZoneNum) + TempIndCoef / AirCap;
851 : } else {
852 0 : if (AirCap == 0.0) {
853 0 : state.dataRoomAir->ZTMX(ZoneNum) = TempIndCoef / TempDepCoef;
854 : } else {
855 0 : state.dataRoomAir->ZTMX(ZoneNum) =
856 0 : (state.dataRoomAir->Zone1MX(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) +
857 0 : TempIndCoef / TempDepCoef;
858 : }
859 : }
860 0 : } break;
861 0 : case DataHeatBalance::SolutionAlgo::EulerMethod: {
862 0 : state.dataRoomAir->ZTMX(ZoneNum) = (AirCap * state.dataRoomAir->Zone1MX(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef);
863 0 : } break;
864 0 : default:
865 0 : break;
866 : }
867 : }
868 :
869 : // MinFlow for interface layer at z = 1.0
870 0 : MinFlow = MinFlow_pow_fac * plume_fac;
871 : // EPTeam above replaces (cause diffs?) MinFlow = (1.0d0/24.55d0*1.0d0)**(1.0d0/0.6d0)*NumberOfPlumes*PowerPerPlume**(1.0/3.0)
872 0 : if (MinFlow != 0.0) {
873 0 : state.dataRoomAir->FracMinFlow(ZoneNum) = MCp_Total * 0.000833 / MinFlow;
874 : } else {
875 0 : state.dataRoomAir->FracMinFlow(ZoneNum) = 9.999;
876 : }
877 0 : state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true;
878 : }
879 :
880 : //=============================== M I X E D Calculation ==============================================
881 0 : if (state.dataRoomAir->ZTMX(ZoneNum) < state.dataRoomAir->ZTOC(ZoneNum) || MCp_Total <= 0.0 ||
882 0 : HeightFrac * CeilingHeight < (state.dataDispVentMgr->HeightFloorSubzoneTop + state.dataDispVentMgr->ThickOccupiedSubzoneMin)) {
883 0 : MIXFLAG = true;
884 0 : HeightFrac = 0.0;
885 0 : state.dataRoomAir->AvgTempGrad(ZoneNum) = 0.0;
886 0 : state.dataRoomAir->MaxTempGrad(ZoneNum) = 0.0;
887 0 : state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false;
888 0 : Real64 const thisZoneT1 = thisZoneHB.T1;
889 0 : Real64 AirCap = thisZoneHB.AirPowerCap;
890 0 : TempHistTerm = AirCap * (3.0 * thisZoneHB.ZTM[0] - (3.0 / 2.0) * thisZoneHB.ZTM[1] + OneThird * thisZoneHB.ZTM[2]);
891 :
892 0 : for (int Ctd = 1; Ctd <= 3; ++Ctd) {
893 0 : TempDepCoef = state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC + state.dataDispVentMgr->HA_FLOOR + MCp_Total;
894 0 : TempIndCoef =
895 0 : ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC + state.dataDispVentMgr->HAT_FLOOR + MCpT_Total;
896 0 : switch (state.dataHeatBal->ZoneAirSolutionAlgo) {
897 0 : case DataHeatBalance::SolutionAlgo::ThirdOrder: {
898 0 : ZTAveraged = (TempHistTerm + ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC +
899 0 : state.dataDispVentMgr->HAT_FLOOR + MCpT_Total) /
900 0 : ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC +
901 0 : state.dataDispVentMgr->HA_FLOOR + MCp_Total);
902 0 : } break;
903 0 : case DataHeatBalance::SolutionAlgo::AnalyticalSolution: {
904 0 : if (TempDepCoef == 0.0) { // B=0
905 0 : ZTAveraged = thisZoneT1 + TempIndCoef / AirCap;
906 : } else {
907 0 : ZTAveraged =
908 0 : (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef;
909 : }
910 0 : } break;
911 0 : case DataHeatBalance::SolutionAlgo::EulerMethod: {
912 0 : ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef);
913 0 : } break;
914 0 : default:
915 0 : break;
916 : }
917 0 : state.dataRoomAir->ZTOC(ZoneNum) = ZTAveraged;
918 0 : state.dataRoomAir->ZTMX(ZoneNum) = ZTAveraged;
919 0 : state.dataRoomAir->ZTFloor(ZoneNum) = ZTAveraged;
920 0 : HcDispVent3Node(state, ZoneNum, HeightFrac);
921 0 : TempDepCoef = state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC + state.dataDispVentMgr->HA_FLOOR + MCp_Total;
922 0 : TempIndCoef =
923 0 : ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC + state.dataDispVentMgr->HAT_FLOOR + MCpT_Total;
924 0 : switch (state.dataHeatBal->ZoneAirSolutionAlgo) {
925 0 : case DataHeatBalance::SolutionAlgo::ThirdOrder: {
926 0 : ZTAveraged = (TempHistTerm + ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC +
927 0 : state.dataDispVentMgr->HAT_FLOOR + MCpT_Total) /
928 0 : ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC +
929 0 : state.dataDispVentMgr->HA_FLOOR + MCp_Total);
930 0 : } break;
931 0 : case DataHeatBalance::SolutionAlgo::AnalyticalSolution: {
932 0 : if (TempDepCoef == 0.0) { // B=0
933 0 : ZTAveraged = thisZoneT1 + TempIndCoef / AirCap;
934 : } else {
935 0 : ZTAveraged =
936 0 : (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef;
937 : }
938 0 : } break;
939 0 : case DataHeatBalance::SolutionAlgo::EulerMethod: {
940 0 : ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef);
941 0 : } break;
942 0 : default:
943 0 : break;
944 : }
945 0 : state.dataRoomAir->ZTOC(ZoneNum) = ZTAveraged;
946 0 : state.dataRoomAir->ZTMX(ZoneNum) = ZTAveraged;
947 0 : state.dataRoomAir->ZTFloor(ZoneNum) = ZTAveraged;
948 : }
949 : }
950 : //=========================================================================================
951 :
952 : // Comfort temperature and temperature at the thermostat/temperature control sensor
953 :
954 0 : state.dataRoomAir->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight;
955 0 : HeightMixedSubzoneAve = (CeilingHeight + state.dataRoomAir->HeightTransition(ZoneNum)) / 2.0;
956 0 : HeightOccupiedSubzoneAve = (state.dataDispVentMgr->HeightFloorSubzoneTop + state.dataRoomAir->HeightTransition(ZoneNum)) / 2.0;
957 0 : HeightFloorSubzoneAve = state.dataDispVentMgr->HeightFloorSubzoneTop / 2.0;
958 :
959 : // Comfort temperature
960 :
961 0 : if (MIXFLAG) {
962 0 : state.dataRoomAir->TCMF(ZoneNum) = ZTAveraged;
963 : } else {
964 0 : if (HeightComfort >= 0.0 && HeightComfort < HeightFloorSubzoneAve) {
965 0 : ShowWarningError(state, format("Displacement ventilation comfort height is in floor subzone in Zone: {}", zone.Name));
966 0 : state.dataRoomAir->TCMF(ZoneNum) = state.dataRoomAir->ZTFloor(ZoneNum);
967 0 : } else if (HeightComfort >= HeightFloorSubzoneAve && HeightComfort < HeightOccupiedSubzoneAve) {
968 0 : state.dataRoomAir->TCMF(ZoneNum) = (state.dataRoomAir->ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightComfort) +
969 0 : state.dataRoomAir->ZTOC(ZoneNum) * (HeightComfort - HeightFloorSubzoneAve)) /
970 0 : (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve);
971 : //! TCMF(ZoneNum) = (ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightComfort) &
972 : //! + ZTMX(ZoneNum) * (HeightComfort - HeightFloorSubzoneAve)) &
973 : //! / (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve)
974 0 : } else if (HeightComfort >= HeightOccupiedSubzoneAve && HeightComfort < HeightMixedSubzoneAve) {
975 0 : state.dataRoomAir->TCMF(ZoneNum) = (state.dataRoomAir->ZTOC(ZoneNum) * (HeightMixedSubzoneAve - HeightComfort) +
976 0 : state.dataRoomAir->ZTMX(ZoneNum) * (HeightComfort - HeightOccupiedSubzoneAve)) /
977 0 : (HeightMixedSubzoneAve - HeightOccupiedSubzoneAve);
978 0 : } else if (HeightComfort >= HeightMixedSubzoneAve && HeightComfort <= CeilingHeight) {
979 0 : state.dataRoomAir->TCMF(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum);
980 : } else {
981 0 : ShowFatalError(state, format("Displacement ventilation comfort height is above ceiling or below floor in Zone: {}", zone.Name));
982 : }
983 : }
984 :
985 : // Temperature at the thermostat/temperature control sensor
986 :
987 0 : if (MIXFLAG) {
988 0 : state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = ZTAveraged;
989 : } else {
990 0 : if (HeightThermostat >= 0.0 && HeightThermostat < HeightFloorSubzoneAve) {
991 0 : ShowWarningError(state, format("Displacement thermostat is in floor subzone in Zone: {}", zone.Name));
992 0 : state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAir->ZTFloor(ZoneNum);
993 0 : } else if (HeightThermostat >= HeightFloorSubzoneAve && HeightThermostat < HeightOccupiedSubzoneAve) {
994 0 : state.dataHeatBalFanSys->TempTstatAir(ZoneNum) =
995 0 : (state.dataRoomAir->ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightThermostat) +
996 0 : state.dataRoomAir->ZTOC(ZoneNum) * (HeightThermostat - HeightFloorSubzoneAve)) /
997 0 : (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve);
998 : //! TempTstatAir(ZoneNum) = (ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightThermostat) &
999 : //! + ZTMX(ZoneNum) * (HeightThermostat - HeightFloorSubzoneAve)) &
1000 : //! / (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve)
1001 0 : } else if (HeightThermostat >= HeightOccupiedSubzoneAve && HeightThermostat < HeightMixedSubzoneAve) {
1002 0 : state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = (state.dataRoomAir->ZTOC(ZoneNum) * (HeightMixedSubzoneAve - HeightThermostat) +
1003 0 : state.dataRoomAir->ZTMX(ZoneNum) * (HeightThermostat - HeightOccupiedSubzoneAve)) /
1004 0 : (HeightMixedSubzoneAve - HeightOccupiedSubzoneAve);
1005 0 : } else if (HeightThermostat >= HeightMixedSubzoneAve && HeightThermostat <= CeilingHeight) {
1006 0 : state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum);
1007 : } else {
1008 0 : ShowFatalError(state, format("Displacement ventilation thermostat height is above ceiling or below floor in Zone: {}", zone.Name));
1009 : }
1010 : }
1011 :
1012 : // Temperature gradients
1013 :
1014 0 : if ((HeightMixedSubzoneAve - HeightFloorSubzoneAve) > 0.1) {
1015 0 : state.dataRoomAir->AvgTempGrad(ZoneNum) =
1016 0 : (state.dataRoomAir->ZTMX(ZoneNum) - state.dataRoomAir->ZTFloor(ZoneNum)) / (HeightMixedSubzoneAve - HeightFloorSubzoneAve);
1017 : } else {
1018 0 : state.dataRoomAir->AvgTempGrad(ZoneNum) = -9.999;
1019 : }
1020 0 : if ((HeightOccupiedSubzoneAve - HeightFloorSubzoneAve) > 0.1) {
1021 0 : state.dataRoomAir->MaxTempGrad(ZoneNum) =
1022 0 : (state.dataRoomAir->ZTOC(ZoneNum) - state.dataRoomAir->ZTFloor(ZoneNum)) / (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve);
1023 : } else {
1024 0 : state.dataRoomAir->MaxTempGrad(ZoneNum) = -9.999;
1025 : }
1026 0 : if ((HeightMixedSubzoneAve - HeightOccupiedSubzoneAve) > 0.1) {
1027 0 : MTGAUX = (state.dataRoomAir->ZTMX(ZoneNum) - state.dataRoomAir->ZTOC(ZoneNum)) / (HeightMixedSubzoneAve - HeightOccupiedSubzoneAve);
1028 : } else {
1029 0 : MTGAUX = -9.999;
1030 : }
1031 :
1032 0 : if (MTGAUX > state.dataRoomAir->MaxTempGrad(ZoneNum)) {
1033 0 : state.dataRoomAir->MaxTempGrad(ZoneNum) = MTGAUX;
1034 : }
1035 :
1036 0 : if (MIXFLAG) {
1037 0 : state.dataRoomAir->ZoneDispVent3NodeMixedFlag(ZoneNum) = 1;
1038 0 : state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false;
1039 : } else {
1040 0 : state.dataRoomAir->ZoneDispVent3NodeMixedFlag(ZoneNum) = 0;
1041 0 : state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true;
1042 : }
1043 :
1044 0 : if (state.dataZoneEquip->ZoneEquipConfig(ZoneNum).IsControlled) {
1045 0 : int ZoneNodeNum = zone.SystemZoneNodeNumber;
1046 0 : state.dataLoopNodes->Node(ZoneNodeNum).Temp = state.dataRoomAir->ZTMX(ZoneNum);
1047 : }
1048 :
1049 : // Mixed for reporting purposes
1050 0 : if ((MIXFLAG) || ((state.dataRoomAir->ZTMX(ZoneNum) - state.dataRoomAir->ZTOC(ZoneNum)) < TempDiffCritRep)) {
1051 0 : state.dataRoomAir->ZoneDispVent3NodeMixedFlagRep(ZoneNum) = 1.0;
1052 0 : state.dataRoomAir->FracMinFlow(ZoneNum) = -1.0;
1053 0 : state.dataRoomAir->HeightTransition(ZoneNum) = -9.999;
1054 0 : state.dataRoomAir->AvgTempGrad(ZoneNum) = -9.999;
1055 0 : state.dataRoomAir->MaxTempGrad(ZoneNum) = -9.999;
1056 : } else {
1057 0 : state.dataRoomAir->ZoneDispVent3NodeMixedFlagRep(ZoneNum) = 0.0;
1058 : }
1059 0 : }
1060 :
1061 : } // namespace RoomAir
1062 : } // namespace EnergyPlus
|