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) {
207 0 : continue;
208 : }
209 :
210 0 : auto const &surf = state.dataSurface->Surface(SurfNum);
211 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp;
212 0 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
213 0 : Z1 = minval(surf.Vertex, &Vector::z);
214 0 : Z2 = maxval(surf.Vertex, &Vector::z);
215 0 : ZSupSurf = Z2 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
216 0 : ZInfSurf = Z1 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
217 :
218 : // The Wall surface is in the upper subzone
219 0 : if (ZInfSurf > LayH) {
220 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
221 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
222 0 : state.dataRoomAir->HWall(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
223 0 : state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWall(Ctd);
224 0 : state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HWall(Ctd);
225 : }
226 :
227 : // The Wall surface is in the lower subzone
228 0 : if (ZSupSurf < LayH) {
229 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
230 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
231 0 : state.dataRoomAir->HWall(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
232 0 : state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWall(Ctd);
233 0 : state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HWall(Ctd);
234 : }
235 :
236 : // The Wall surface is partially in upper and partially in lower subzone
237 0 : if (ZInfSurf <= LayH && ZSupSurf >= LayH) {
238 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
239 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
240 0 : HLU = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
241 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
242 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
243 0 : HLD = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
244 0 : TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) /
245 0 : (ZSupSurf - ZInfSurf);
246 0 : state.dataRoomAir->HWall(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf);
247 0 : state.dataDispVentMgr->HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU;
248 0 : state.dataDispVentMgr->HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU;
249 0 : state.dataDispVentMgr->HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD;
250 0 : state.dataDispVentMgr->HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD;
251 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV;
252 : }
253 :
254 0 : state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HWall(Ctd);
255 :
256 : } // END WALL
257 :
258 : // WINDOW Hc, HA and HAT CALCULATION
259 1 : for (int Ctd = state.dataRoomAir->PosZ_Window(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Window(ZoneNum).end; ++Ctd) {
260 0 : int SurfNum = state.dataRoomAir->APos_Window(Ctd);
261 0 : if (SurfNum == 0) {
262 0 : continue;
263 : }
264 :
265 0 : auto const &surf = state.dataSurface->Surface(SurfNum);
266 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp;
267 0 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
268 0 : if (surf.Tilt > 10.0 && surf.Tilt < 170.0) { // Window Wall
269 0 : Z1 = minval(surf.Vertex, &Vector::z);
270 0 : Z2 = maxval(surf.Vertex, &Vector::z);
271 0 : ZSupSurf = Z2 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
272 0 : ZInfSurf = Z1 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
273 :
274 0 : if (ZInfSurf > LayH) {
275 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
276 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
277 0 : state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
278 0 : state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd);
279 0 : state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HWindow(Ctd);
280 : }
281 :
282 0 : if (ZSupSurf < LayH) {
283 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
284 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
285 0 : state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
286 0 : state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd);
287 0 : state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HWindow(Ctd);
288 : }
289 :
290 0 : if (ZInfSurf <= LayH && ZSupSurf >= LayH) {
291 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
292 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
293 0 : HLU = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
294 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
295 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
296 0 : HLD = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
297 0 : TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) /
298 0 : (ZSupSurf - ZInfSurf);
299 0 : state.dataRoomAir->HWindow(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf);
300 0 : state.dataDispVentMgr->HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU;
301 0 : state.dataDispVentMgr->HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU;
302 0 : state.dataDispVentMgr->HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD;
303 0 : state.dataDispVentMgr->HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD;
304 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV;
305 : }
306 : }
307 :
308 0 : if (surf.Tilt <= 10.0) { // Window Ceiling
309 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
310 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
311 0 : state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
312 0 : state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd);
313 0 : state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HWindow(Ctd);
314 : }
315 :
316 0 : if (surf.Tilt >= 170.0) { // Window Floor
317 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
318 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
319 0 : state.dataRoomAir->HWindow(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
320 0 : state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HWindow(Ctd);
321 0 : state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HWindow(Ctd);
322 : }
323 :
324 0 : state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HWindow(Ctd);
325 :
326 : } // END WINDOW
327 :
328 : // DOOR Hc, HA and HAT CALCULATION
329 4 : for (int Ctd = state.dataRoomAir->PosZ_Door(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Door(ZoneNum).end; ++Ctd) { // DOOR
330 3 : int SurfNum = state.dataRoomAir->APos_Door(Ctd);
331 3 : if (SurfNum == 0) {
332 0 : continue;
333 : }
334 :
335 3 : auto const &surf = state.dataSurface->Surface(SurfNum);
336 3 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp;
337 3 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
338 3 : if (surf.Tilt > 10.0 && surf.Tilt < 170.0) { // Door Wall
339 1 : Z1 = minval(surf.Vertex, &Vector::z);
340 1 : Z2 = maxval(surf.Vertex, &Vector::z);
341 1 : ZSupSurf = Z2 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
342 1 : ZInfSurf = Z1 - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
343 :
344 1 : if (ZInfSurf > LayH) {
345 1 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
346 1 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
347 1 : state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
348 1 : state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd);
349 1 : state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HDoor(Ctd);
350 : }
351 :
352 1 : if (ZSupSurf < LayH) {
353 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
354 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
355 0 : state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
356 0 : state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd);
357 0 : state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HDoor(Ctd);
358 : }
359 :
360 1 : if (ZInfSurf <= LayH && ZSupSurf >= LayH) {
361 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
362 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
363 0 : HLU = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
364 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
365 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
366 0 : HLD = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
367 0 : TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) /
368 0 : (ZSupSurf - ZInfSurf);
369 0 : state.dataRoomAir->HDoor(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf);
370 0 : state.dataDispVentMgr->HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU;
371 0 : state.dataDispVentMgr->HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU;
372 0 : state.dataDispVentMgr->HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD;
373 0 : state.dataDispVentMgr->HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD;
374 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV;
375 : }
376 : }
377 :
378 3 : if (surf.Tilt <= 10.0) { // Door Ceiling
379 1 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
380 1 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
381 1 : state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
382 1 : state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd);
383 1 : state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HDoor(Ctd);
384 : }
385 :
386 3 : if (surf.Tilt >= 170.0) { // Door Floor
387 1 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
388 1 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
389 1 : state.dataRoomAir->HDoor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
390 1 : state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HDoor(Ctd);
391 1 : state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HDoor(Ctd);
392 : }
393 :
394 3 : state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HDoor(Ctd);
395 :
396 : } // END DOOR
397 :
398 : // INTERNAL Hc, HA and HAT CALCULATION
399 1 : state.dataDispVentMgr->HeightIntMass =
400 1 : min(state.dataDispVentMgr->HeightIntMassDefault,
401 1 : (state.dataRoomAir->ZoneCeilingHeight2(ZoneNum) - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum)));
402 1 : for (int Ctd = state.dataRoomAir->PosZ_Internal(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Internal(ZoneNum).end; ++Ctd) {
403 0 : int SurfNum = state.dataRoomAir->APos_Internal(Ctd);
404 0 : if (SurfNum == 0) {
405 0 : continue;
406 : }
407 :
408 0 : auto const &surf = state.dataSurface->Surface(SurfNum);
409 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp;
410 0 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
411 0 : ZSupSurf = state.dataDispVentMgr->HeightIntMass;
412 0 : ZInfSurf = 0.0;
413 :
414 0 : if (ZSupSurf < LayH) {
415 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
416 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
417 0 : state.dataRoomAir->HInternal(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
418 0 : state.dataDispVentMgr->HAT_OC += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HInternal(Ctd);
419 0 : state.dataDispVentMgr->HA_OC += surf.Area * state.dataRoomAir->HInternal(Ctd);
420 : }
421 :
422 0 : if (ZInfSurf <= LayH && ZSupSurf >= LayH) {
423 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
424 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
425 0 : HLU = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
426 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTOC(ZoneNum);
427 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
428 0 : HLD = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
429 0 : TmedDV = ((ZSupSurf - LayH) * state.dataRoomAir->ZTMX(ZoneNum) + (LayH - ZInfSurf) * state.dataRoomAir->ZTOC(ZoneNum)) /
430 0 : (ZSupSurf - ZInfSurf);
431 0 : state.dataRoomAir->HInternal(Ctd) = ((LayH - ZInfSurf) * HLD + (ZSupSurf - LayH) * HLU) / (ZSupSurf - ZInfSurf);
432 0 : state.dataDispVentMgr->HAT_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLU;
433 0 : state.dataDispVentMgr->HA_MX += surf.Area * (ZSupSurf - LayH) / (ZSupSurf - ZInfSurf) * HLU;
434 0 : state.dataDispVentMgr->HAT_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * SurfTempIn(SurfNum) * HLD;
435 0 : state.dataDispVentMgr->HA_OC += surf.Area * (LayH - ZInfSurf) / (ZSupSurf - ZInfSurf) * HLD;
436 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = TmedDV;
437 : }
438 :
439 0 : state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HInternal(Ctd);
440 : } // END INTERNAL
441 :
442 : // CEILING Hc, HA and HAT CALCULATION
443 1 : for (int Ctd = state.dataRoomAir->PosZ_Ceiling(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Ceiling(ZoneNum).end; ++Ctd) {
444 0 : int SurfNum = state.dataRoomAir->APos_Ceiling(Ctd);
445 0 : if (SurfNum == 0) {
446 0 : continue;
447 : }
448 :
449 0 : auto const &surf = state.dataSurface->Surface(SurfNum);
450 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp;
451 0 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
452 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTMX(ZoneNum);
453 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
454 0 : state.dataRoomAir->HCeiling(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
455 0 : state.dataDispVentMgr->HAT_MX += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HCeiling(Ctd);
456 0 : state.dataDispVentMgr->HA_MX += surf.Area * state.dataRoomAir->HCeiling(Ctd);
457 0 : state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HCeiling(Ctd);
458 : } // END CEILING
459 :
460 : // FLOOR Hc, HA and HAT CALCULATION
461 1 : for (int Ctd = state.dataRoomAir->PosZ_Floor(ZoneNum).beg; Ctd <= state.dataRoomAir->PosZ_Floor(ZoneNum).end; ++Ctd) {
462 0 : int SurfNum = state.dataRoomAir->APos_Floor(Ctd);
463 0 : if (SurfNum == 0) {
464 0 : continue;
465 : }
466 :
467 0 : auto const &surf = state.dataSurface->Surface(SurfNum);
468 0 : state.dataSurface->SurfTAirRef(SurfNum) = DataSurfaces::RefAirTemp::AdjacentAirTemp;
469 0 : state.dataSurface->SurfTAirRefRpt(SurfNum) = DataSurfaces::SurfTAirRefReportVals[state.dataSurface->SurfTAirRef(SurfNum)];
470 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTFloor(ZoneNum);
471 0 : CalcDetailedHcInForDVModel(state, SurfNum, SurfTempIn, state.dataRoomAir->DispVent3NodeHcIn);
472 0 : state.dataRoomAir->HFloor(Ctd) = state.dataRoomAir->DispVent3NodeHcIn(SurfNum);
473 0 : state.dataDispVentMgr->HAT_FLOOR += surf.Area * SurfTempIn(SurfNum) * state.dataRoomAir->HFloor(Ctd);
474 0 : state.dataDispVentMgr->HA_FLOOR += surf.Area * state.dataRoomAir->HFloor(Ctd);
475 0 : state.dataHeatBal->SurfTempEffBulkAir(SurfNum) = state.dataRoomAir->ZTFloor(ZoneNum);
476 0 : state.dataRoomAir->DispVent3NodeHcIn(SurfNum) = state.dataRoomAir->HFloor(Ctd);
477 : } // END FLOOR
478 : }
479 1 : }
480 :
481 : //**************************************************************************************************
482 :
483 1 : Real64 calculateThirdOrderFloorTemperature(Real64 temperatureHistoryTerm,
484 : Real64 HAT_floor,
485 : Real64 HA_floor,
486 : Real64 MCpT_Total,
487 : Real64 MCp_Total,
488 : Real64 occupiedTemp,
489 : Real64 nonAirSystemResponse,
490 : Real64 zoneMultiplier,
491 : Real64 airCap)
492 : {
493 1 : const Real64 elevenOverSix = 11.0 / 6.0;
494 1 : return (temperatureHistoryTerm + HAT_floor + MCpT_Total + 0.6 * occupiedTemp * MCp_Total + nonAirSystemResponse / zoneMultiplier) /
495 1 : (elevenOverSix * airCap + HA_floor + 1.6 * MCp_Total);
496 : }
497 :
498 0 : void CalcDispVent3Node(EnergyPlusData &state, int const ZoneNum) // Which Zonenum
499 : {
500 :
501 : // SUBROUTINE INFORMATION:
502 : // AUTHOR G. Carrilho da Graca
503 : // DATE WRITTEN February 2004
504 : // MODIFIED Brent Griffith June 2008 for new interpolation and time history
505 : // RE-ENGINEERED -
506 :
507 : // PURPOSE OF THIS SUBROUTINE:
508 : // Subroutine for displacement ventilation modelling.
509 : // This subroutine calculates the mixed subzone height, surface heat transfer coefficients and
510 : // room air equivalent temperatures and three space temperatures (floor subzone, occupied zone and upper,
511 : // mixed subzone temperature)
512 :
513 : // REFERENCES:
514 : // Model developed by Paul Linden (UCSD), G. Carrilho da Graca (UCSD) and P. Haves (LBL).
515 : // Work funded by the California Energy Comission. More information on the model can found in:
516 : // "Simplified Models for Heat Transfer in Rooms" G. Carrilho da Graca, Ph.D. thesis UCSD. December 2003.
517 :
518 : // Using/Aliasing
519 : using namespace DataEnvironment;
520 : using namespace DataHeatBalance;
521 :
522 0 : Real64 TimeStepSys = state.dataHVACGlobal->TimeStepSys;
523 0 : Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec;
524 :
525 : using Psychrometrics::PsyCpAirFnW;
526 : using Psychrometrics::PsyRhoAirFnPbTdbW;
527 :
528 : // SUBROUTINE PARAMETER DEFINITIONS:
529 0 : Real64 const OneThird(1.0 / 3.0);
530 0 : Real64 const MinFlow_pow_fac(std::pow(1.0 / 24.55 * 1.0, 1.0 / 0.6));
531 :
532 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
533 : Real64 HeightFrac; // Fractional height of transition between occupied and mixed subzones
534 : Real64 GainsFrac; // Fraction of lower subzone internal gains that mix as opposed to forming plumes
535 : Real64 ConvGains; // Total convective gains in the room
536 : Real64 ConvGainsOccupiedSubzone; // Total convective gains released in occupied subzone
537 : Real64 ConvGainsMixedSubzone; // Total convective gains released in mixed subzone
538 : Real64 MCp_Total; // Total capacity rate into the zone - assumed to enter at low level
539 : Real64 ZTAveraged;
540 : Real64 TempDiffCritRep; // Minimum temperature difference between mixed and occupied subzones for reporting
541 : bool MIXFLAG;
542 : Real64 MinFlow;
543 : Real64 NumPLPP; // Number of plumes per person
544 : Real64 MTGAUX;
545 : int ZoneEquipConfigNum;
546 : Real64 PowerInPlumes;
547 : Real64 SumSysMCp;
548 : Real64 SumSysMCpT;
549 : Real64 NodeTemp;
550 : Real64 MassFlowRate;
551 : Real64 CpAir;
552 : Real64 MCpT_Total;
553 : Real64 NumberOfPlumes;
554 : Real64 SumMCp;
555 : Real64 SumMCpT;
556 : Real64 TempHistTerm;
557 : Real64 PowerPerPlume;
558 : Real64 HeightMixedSubzoneAve; // Height of center of mixed air subzone
559 : Real64 HeightOccupiedSubzoneAve; // Height of center of occupied air subzone
560 : Real64 HeightFloorSubzoneAve; // Height of center of floor air subzone
561 : Real64 HeightThermostat; // Height of center of thermostat/temperature control sensor
562 : Real64 HeightComfort; // Height at which air temperature value is used to calculate comfort
563 : Real64 CeilingHeight;
564 : Real64 ZoneMult; // total zone multiplier
565 : int FlagApertures;
566 :
567 0 : auto &TempDepCoef = state.dataDispVentMgr->TempDepCoef;
568 0 : auto &TempIndCoef = state.dataDispVentMgr->TempIndCoef;
569 :
570 : Real64 RetAirGain;
571 0 : assert(state.dataRoomAir->AirModel.allocated());
572 :
573 : // Exact solution or Euler method
574 0 : if (state.dataHeatBal->ZoneAirSolutionAlgo != DataHeatBalance::SolutionAlgo::ThirdOrder) {
575 0 : if (state.dataHVACGlobal->ShortenTimeStepSysRoomAir && TimeStepSys < state.dataGlobal->TimeStepZone) {
576 0 : if (state.dataHVACGlobal->PreviousTimeStep < state.dataGlobal->TimeStepZone) {
577 0 : state.dataRoomAir->Zone1Floor(ZoneNum) = state.dataRoomAir->ZoneM2Floor(ZoneNum);
578 0 : state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZoneM2OC(ZoneNum);
579 0 : state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZoneM2MX(ZoneNum);
580 : } else {
581 0 : state.dataRoomAir->Zone1Floor(ZoneNum) = state.dataRoomAir->ZoneMXFloor(ZoneNum);
582 0 : state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZoneMXOC(ZoneNum);
583 0 : state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZoneMXMX(ZoneNum);
584 : }
585 : } else {
586 0 : state.dataRoomAir->Zone1Floor(ZoneNum) = state.dataRoomAir->ZTFloor(ZoneNum);
587 0 : state.dataRoomAir->Zone1OC(ZoneNum) = state.dataRoomAir->ZTOC(ZoneNum);
588 0 : state.dataRoomAir->Zone1MX(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum);
589 : }
590 : }
591 :
592 0 : auto &zone = state.dataHeatBal->Zone(ZoneNum);
593 :
594 0 : MIXFLAG = false;
595 0 : FlagApertures = 1;
596 0 : state.dataRoomAir->DispVent3NodeHcIn = state.dataHeatBalSurf->SurfHConvInt;
597 0 : CeilingHeight = state.dataRoomAir->ZoneCeilingHeight2(ZoneNum) - state.dataRoomAir->ZoneCeilingHeight1(ZoneNum);
598 0 : ZoneMult = zone.Multiplier * zone.ListMultiplier;
599 0 : auto &thisZoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZoneNum);
600 :
601 0 : for (int Ctd = 1; Ctd <= state.dataRoomAir->TotDispVent3Node; ++Ctd) {
602 0 : auto &zoneDV3N = state.dataRoomAir->ZoneDispVent3Node(Ctd);
603 0 : if (ZoneNum == zoneDV3N.ZonePtr) {
604 0 : GainsFrac = zoneDV3N.gainsSched->getCurrentVal();
605 0 : NumPLPP = zoneDV3N.NumPlumesPerOcc;
606 0 : HeightThermostat = zoneDV3N.ThermostatHeight;
607 0 : HeightComfort = zoneDV3N.ComfortHeight;
608 0 : TempDiffCritRep = zoneDV3N.TempTrigger;
609 : }
610 : }
611 :
612 0 : ConvGainsOccupiedSubzone = InternalHeatGains::SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied);
613 :
614 0 : ConvGainsOccupiedSubzone += 0.5 * thisZoneHB.SysDepZoneLoadsLagged;
615 :
616 : // Add heat to return air if zonal system (no return air) or cycling system (return air frequently very
617 : // low or zero)
618 0 : if (zone.NoHeatToReturnAir) {
619 0 : RetAirGain = InternalHeatGains::SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesOccupied);
620 0 : ConvGainsOccupiedSubzone += RetAirGain;
621 : }
622 :
623 0 : ConvGainsMixedSubzone = InternalHeatGains::SumInternalConvectionGainsByTypes(state, ZoneNum, IntGainTypesMixedSubzone);
624 0 : ConvGainsMixedSubzone += state.dataHeatBalFanSys->SumConvHTRadSys(ZoneNum) + state.dataHeatBalFanSys->SumConvPool(ZoneNum) +
625 0 : 0.5 * thisZoneHB.SysDepZoneLoadsLagged;
626 0 : if (zone.NoHeatToReturnAir) {
627 0 : RetAirGain = InternalHeatGains::SumReturnAirConvectionGainsByTypes(state, ZoneNum, IntGainTypesMixedSubzone);
628 0 : ConvGainsMixedSubzone += RetAirGain;
629 : }
630 :
631 0 : ConvGains = ConvGainsOccupiedSubzone + ConvGainsMixedSubzone;
632 :
633 : // Make sure all types of internal gains have been gathered
634 0 : assert((int)(size(IntGainTypesOccupied) + size(IntGainTypesMixedSubzone) + size(ExcludedIntGainTypes)) ==
635 : (int)DataHeatBalance::IntGainType::Num);
636 :
637 : //=================== Entering air system temperature and flow====================
638 0 : SumSysMCp = 0.0;
639 0 : SumSysMCpT = 0.0;
640 : // Check to make sure if this is a controlled zone and determine ZoneEquipConfigNum
641 0 : ZoneEquipConfigNum = ZoneNum;
642 0 : if (state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).IsControlled) {
643 0 : for (int NodeNum = 1; NodeNum <= state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).NumInletNodes; ++NodeNum) {
644 0 : NodeTemp = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).Temp;
645 0 : MassFlowRate = state.dataLoopNodes->Node(state.dataZoneEquip->ZoneEquipConfig(ZoneEquipConfigNum).InletNode(NodeNum)).MassFlowRate;
646 0 : CpAir = PsyCpAirFnW(thisZoneHB.airHumRat);
647 0 : SumSysMCp += MassFlowRate * CpAir;
648 0 : SumSysMCpT += MassFlowRate * CpAir * NodeTemp;
649 : }
650 : }
651 :
652 0 : SumMCp = thisZoneHB.MCPI + thisZoneHB.MCPV + thisZoneHB.MCPM + thisZoneHB.MCPE + thisZoneHB.MCPC + thisZoneHB.MDotCPOA;
653 0 : SumMCpT =
654 0 : thisZoneHB.MCPTI + thisZoneHB.MCPTV + thisZoneHB.MCPTM + thisZoneHB.MCPTE + thisZoneHB.MCPTC + thisZoneHB.MDotCPOA * zone.OutDryBulbTemp;
655 0 : if (state.afn->simulation_control.type == AirflowNetwork::ControlType::MultizoneWithoutDistribution) {
656 0 : SumMCp = state.afn->exchangeData(ZoneNum).SumMCp + state.afn->exchangeData(ZoneNum).SumMVCp + state.afn->exchangeData(ZoneNum).SumMMCp;
657 0 : SumMCpT =
658 0 : state.afn->exchangeData(ZoneNum).SumMCpT + state.afn->exchangeData(ZoneNum).SumMVCpT + state.afn->exchangeData(ZoneNum).SumMMCpT;
659 : }
660 :
661 0 : MCp_Total = SumMCp + SumSysMCp;
662 0 : MCpT_Total = SumMCpT + SumSysMCpT;
663 :
664 0 : if (state.dataHeatBal->TotPeople > 0) {
665 0 : int NumberOfOccupants = 0;
666 0 : NumberOfPlumes = 0.0;
667 0 : for (int Ctd = 1; Ctd <= state.dataHeatBal->TotPeople; ++Ctd) {
668 0 : if (state.dataHeatBal->People(Ctd).ZonePtr == ZoneNum) {
669 0 : NumberOfOccupants +=
670 0 : state.dataHeatBal->People(Ctd).NumberOfPeople; // *GetCurrentScheduleValue(state, People(Ctd)%NumberOfPeoplePtr)
671 0 : NumberOfPlumes = NumberOfOccupants * NumPLPP;
672 : }
673 : }
674 0 : if (NumberOfPlumes == 0.0) {
675 0 : NumberOfPlumes = 1.0;
676 : }
677 0 : PowerInPlumes = (1.0 - GainsFrac) * ConvGainsOccupiedSubzone;
678 0 : PowerPerPlume = PowerInPlumes / NumberOfPlumes;
679 : } else {
680 0 : NumberOfPlumes = 1.0;
681 0 : PowerInPlumes = (1.0 - GainsFrac) * ConvGainsOccupiedSubzone;
682 0 : PowerPerPlume = PowerInPlumes / NumberOfPlumes;
683 : }
684 :
685 : // When AirflowNetwork is used verify if bottom apertures are inflowing and upper apertures are
686 : // outflowing. The lower apertures have to be located below 0.8m and the upper apertures
687 : // have to be located above 1.8m.
688 :
689 0 : if (state.afn->NumOfLinksMultiZone > 0) {
690 0 : for (int Loop = 1; Loop <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++Loop) {
691 : // direct AirflowNetwork surface
692 0 : int afnSurfNum = state.dataRoomAir->AFNSurfaceCrossVent(Loop, ZoneNum);
693 0 : auto const &surfParams = state.dataRoomAir->SurfParametersCrossDispVent(afnSurfNum);
694 0 : auto const &afnLinkSimu = state.afn->AirflowNetworkLinkSimu(afnSurfNum);
695 0 : auto const &afnMzSurfData = state.afn->MultizoneSurfaceData(afnSurfNum);
696 0 : auto const &afnMzSurf = state.dataSurface->Surface(afnMzSurfData.SurfNum);
697 0 : if (afnMzSurf.Zone == ZoneNum) {
698 :
699 0 : if ((surfParams.Zmax < 0.8 && afnLinkSimu.VolFLOW > 0)) {
700 0 : FlagApertures = 0;
701 0 : break;
702 : }
703 0 : if (surfParams.Zmin > 1.8 && afnLinkSimu.VolFLOW2 > 0) {
704 0 : FlagApertures = 0;
705 0 : break;
706 : }
707 :
708 0 : if ((surfParams.Zmin > 0.8 && surfParams.Zmin < 1.8) || (surfParams.Zmax > 0.8 && surfParams.Zmax < 1.8)) {
709 0 : FlagApertures = 0;
710 0 : break;
711 : }
712 : // indirect AirflowNetwork surface; this is an interzone surface
713 : } else {
714 0 : auto const &afnZone = state.dataHeatBal->Zone(afnMzSurf.Zone);
715 0 : if (surfParams.Zmax + afnZone.OriginZ - zone.OriginZ < 0.8 && afnLinkSimu.VolFLOW2 > 0) {
716 0 : FlagApertures = 0;
717 0 : break;
718 : }
719 0 : if (surfParams.Zmin + afnZone.OriginZ - zone.OriginZ > 1.8 && afnLinkSimu.VolFLOW > 0) {
720 0 : FlagApertures = 0;
721 0 : break;
722 : }
723 0 : if ((surfParams.Zmin + afnZone.OriginZ - zone.OriginZ > 0.8 && surfParams.Zmin + afnZone.OriginZ - zone.OriginZ < 1.8) ||
724 0 : (surfParams.Zmax + afnZone.OriginZ - zone.OriginZ > 0.8 && surfParams.Zmax + afnZone.OriginZ - zone.OriginZ < 1.8)) {
725 0 : FlagApertures = 0;
726 0 : break;
727 : }
728 : }
729 : }
730 : }
731 :
732 0 : if ((PowerInPlumes == 0.0) || (MCpT_Total == 0.0) || FlagApertures == 0) {
733 : // The system will mix
734 0 : HeightFrac = 0.0;
735 : } else {
736 0 : Real64 const plume_fac(NumberOfPlumes * std::pow(PowerPerPlume, OneThird));
737 0 : HeightFrac = min(24.55 * std::pow(MCp_Total * 0.000833 / plume_fac, 0.6) / CeilingHeight, 1.0);
738 0 : for (int Ctd = 1; Ctd <= 4; ++Ctd) {
739 0 : HcDispVent3Node(state, ZoneNum, HeightFrac);
740 : // HeightFrac = min( 24.55 * std::pow( MCp_Total * 0.000833 / ( NumberOfPlumes * std::pow( PowerPerPlume, OneThird ) ), 0.6 ) /
741 : // CeilingHeight, 1.0 ); //Tuned This does not vary in loop EPTeam-replaces above (cause diffs) HeightFrac =
742 : // MIN(24.55d0*(MCp_Total*0.000833d0/(NumberOfPlumes*PowerPerPlume**(1.0d0/3.d0)))**0.6 / CeilingHeight , 1.0d0)
743 0 : state.dataRoomAir->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight;
744 0 : state.dataRoomAir->AIRRATFloor(ZoneNum) =
745 0 : zone.Volume * min(state.dataRoomAir->HeightTransition(ZoneNum), state.dataDispVentMgr->HeightFloorSubzoneTop) / CeilingHeight *
746 0 : zone.ZoneVolCapMultpSens *
747 0 : PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATFloor(ZoneNum), thisZoneHB.airHumRat) *
748 0 : PsyCpAirFnW(thisZoneHB.airHumRat) / TimeStepSysSec;
749 0 : state.dataRoomAir->AIRRATOC(ZoneNum) =
750 0 : zone.Volume * (state.dataRoomAir->HeightTransition(ZoneNum) - min(state.dataRoomAir->HeightTransition(ZoneNum), 0.2)) /
751 0 : CeilingHeight * zone.ZoneVolCapMultpSens *
752 0 : PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATOC(ZoneNum), thisZoneHB.airHumRat) *
753 0 : PsyCpAirFnW(thisZoneHB.airHumRat) / TimeStepSysSec;
754 0 : state.dataRoomAir->AIRRATMX(ZoneNum) =
755 0 : zone.Volume * (CeilingHeight - state.dataRoomAir->HeightTransition(ZoneNum)) / CeilingHeight * zone.ZoneVolCapMultpSens *
756 0 : PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, state.dataRoomAir->MATMX(ZoneNum), thisZoneHB.airHumRat) *
757 0 : PsyCpAirFnW(thisZoneHB.airHumRat) / TimeStepSysSec;
758 :
759 0 : if (state.dataHVACGlobal->UseZoneTimeStepHistory) {
760 0 : state.dataRoomAir->ZTMFloor(ZoneNum)[2] = state.dataRoomAir->XMATFloor(ZoneNum)[2];
761 0 : state.dataRoomAir->ZTMFloor(ZoneNum)[1] = state.dataRoomAir->XMATFloor(ZoneNum)[1];
762 0 : state.dataRoomAir->ZTMFloor(ZoneNum)[0] = state.dataRoomAir->XMATFloor(ZoneNum)[0];
763 :
764 0 : state.dataRoomAir->ZTMOC(ZoneNum)[2] = state.dataRoomAir->XMATOC(ZoneNum)[2];
765 0 : state.dataRoomAir->ZTMOC(ZoneNum)[1] = state.dataRoomAir->XMATOC(ZoneNum)[1];
766 0 : state.dataRoomAir->ZTMOC(ZoneNum)[0] = state.dataRoomAir->XMATOC(ZoneNum)[0];
767 :
768 0 : state.dataRoomAir->ZTMMX(ZoneNum)[2] = state.dataRoomAir->XMATMX(ZoneNum)[2];
769 0 : state.dataRoomAir->ZTMMX(ZoneNum)[1] = state.dataRoomAir->XMATMX(ZoneNum)[1];
770 0 : state.dataRoomAir->ZTMMX(ZoneNum)[0] = state.dataRoomAir->XMATMX(ZoneNum)[0];
771 :
772 : } else {
773 0 : state.dataRoomAir->ZTMFloor(ZoneNum)[2] = state.dataRoomAir->DSXMATFloor(ZoneNum)[2];
774 0 : state.dataRoomAir->ZTMFloor(ZoneNum)[1] = state.dataRoomAir->DSXMATFloor(ZoneNum)[1];
775 0 : state.dataRoomAir->ZTMFloor(ZoneNum)[0] = state.dataRoomAir->DSXMATFloor(ZoneNum)[0];
776 :
777 0 : state.dataRoomAir->ZTMOC(ZoneNum)[2] = state.dataRoomAir->DSXMATOC(ZoneNum)[2];
778 0 : state.dataRoomAir->ZTMOC(ZoneNum)[1] = state.dataRoomAir->DSXMATOC(ZoneNum)[1];
779 0 : state.dataRoomAir->ZTMOC(ZoneNum)[0] = state.dataRoomAir->DSXMATOC(ZoneNum)[0];
780 :
781 0 : state.dataRoomAir->ZTMMX(ZoneNum)[2] = state.dataRoomAir->DSXMATMX(ZoneNum)[2];
782 0 : state.dataRoomAir->ZTMMX(ZoneNum)[1] = state.dataRoomAir->DSXMATMX(ZoneNum)[1];
783 0 : state.dataRoomAir->ZTMMX(ZoneNum)[0] = state.dataRoomAir->DSXMATMX(ZoneNum)[0];
784 : }
785 :
786 0 : Real64 AirCap = state.dataRoomAir->AIRRATFloor(ZoneNum);
787 0 : TempHistTerm = AirCap * (3.0 * state.dataRoomAir->ZTMFloor(ZoneNum)[0] - (3.0 / 2.0) * state.dataRoomAir->ZTMFloor(ZoneNum)[1] +
788 0 : OneThird * state.dataRoomAir->ZTMFloor(ZoneNum)[2]);
789 0 : TempDepCoef = state.dataDispVentMgr->HA_FLOOR + MCp_Total;
790 0 : TempIndCoef = state.dataDispVentMgr->HAT_FLOOR + MCpT_Total + thisZoneHB.NonAirSystemResponse / ZoneMult;
791 0 : switch (state.dataHeatBal->ZoneAirSolutionAlgo) {
792 0 : case DataHeatBalance::SolutionAlgo::ThirdOrder: {
793 0 : state.dataRoomAir->ZTFloor(ZoneNum) = calculateThirdOrderFloorTemperature(TempHistTerm,
794 0 : state.dataDispVentMgr->HAT_FLOOR,
795 0 : state.dataDispVentMgr->HA_FLOOR,
796 : MCpT_Total,
797 : MCp_Total,
798 0 : state.dataRoomAir->ZTOC(ZoneNum),
799 : thisZoneHB.NonAirSystemResponse,
800 : ZoneMult,
801 : AirCap);
802 0 : } break;
803 0 : case DataHeatBalance::SolutionAlgo::AnalyticalSolution: {
804 0 : if (TempDepCoef == 0.0) { // B=0
805 0 : state.dataRoomAir->ZTFloor(ZoneNum) = state.dataRoomAir->Zone1Floor(ZoneNum) + TempIndCoef / AirCap;
806 : } else {
807 0 : state.dataRoomAir->ZTFloor(ZoneNum) =
808 0 : (state.dataRoomAir->Zone1Floor(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) +
809 0 : TempIndCoef / TempDepCoef;
810 : }
811 0 : } break;
812 0 : case DataHeatBalance::SolutionAlgo::EulerMethod: {
813 0 : state.dataRoomAir->ZTFloor(ZoneNum) = (AirCap * state.dataRoomAir->Zone1Floor(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef);
814 0 : } break;
815 0 : default:
816 0 : break;
817 : }
818 0 : AirCap = state.dataRoomAir->AIRRATOC(ZoneNum);
819 0 : TempHistTerm = AirCap * (3.0 * state.dataRoomAir->ZTMOC(ZoneNum)[0] - (3.0 / 2.0) * state.dataRoomAir->ZTMOC(ZoneNum)[1] +
820 0 : OneThird * state.dataRoomAir->ZTMOC(ZoneNum)[2]);
821 0 : TempDepCoef = state.dataDispVentMgr->HA_OC + MCp_Total;
822 0 : TempIndCoef = ConvGainsOccupiedSubzone * GainsFrac + state.dataDispVentMgr->HAT_OC + state.dataRoomAir->ZTFloor(ZoneNum) * MCp_Total;
823 0 : switch (state.dataHeatBal->ZoneAirSolutionAlgo) {
824 0 : case DataHeatBalance::SolutionAlgo::ThirdOrder: {
825 0 : state.dataRoomAir->ZTOC(ZoneNum) = (TempHistTerm + ConvGainsOccupiedSubzone * GainsFrac + state.dataDispVentMgr->HAT_OC +
826 0 : 1.6 * state.dataRoomAir->ZTFloor(ZoneNum) * MCp_Total) /
827 0 : ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_OC + 1.6 * MCp_Total);
828 0 : } break;
829 0 : case DataHeatBalance::SolutionAlgo::AnalyticalSolution: {
830 0 : if (TempDepCoef == 0.0) { // B=0
831 0 : state.dataRoomAir->ZTOC(ZoneNum) = state.dataRoomAir->Zone1OC(ZoneNum) + TempIndCoef / AirCap;
832 : } else {
833 0 : if (AirCap == 0.0) {
834 0 : state.dataRoomAir->ZTOC(ZoneNum) = TempIndCoef / TempDepCoef;
835 : } else {
836 0 : state.dataRoomAir->ZTOC(ZoneNum) =
837 0 : (state.dataRoomAir->Zone1OC(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) +
838 0 : TempIndCoef / TempDepCoef;
839 : }
840 : }
841 0 : } break;
842 0 : case DataHeatBalance::SolutionAlgo::EulerMethod: {
843 0 : state.dataRoomAir->ZTOC(ZoneNum) = (AirCap * state.dataRoomAir->Zone1OC(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef);
844 0 : } break;
845 0 : default:
846 0 : break;
847 : }
848 0 : AirCap = state.dataRoomAir->AIRRATMX(ZoneNum);
849 0 : TempHistTerm = AirCap * (3.0 * state.dataRoomAir->ZTMMX(ZoneNum)[0] - (3.0 / 2.0) * state.dataRoomAir->ZTMMX(ZoneNum)[1] +
850 0 : OneThird * state.dataRoomAir->ZTMMX(ZoneNum)[2]);
851 0 : TempDepCoef = state.dataDispVentMgr->HA_MX + MCp_Total;
852 0 : TempIndCoef = ConvGainsOccupiedSubzone * (1.0 - GainsFrac) + ConvGainsMixedSubzone + state.dataDispVentMgr->HAT_MX +
853 0 : state.dataRoomAir->ZTOC(ZoneNum) * MCp_Total;
854 0 : switch (state.dataHeatBal->ZoneAirSolutionAlgo) {
855 0 : case DataHeatBalance::SolutionAlgo::ThirdOrder: {
856 0 : state.dataRoomAir->ZTMX(ZoneNum) = (TempHistTerm + ConvGainsOccupiedSubzone * (1.0 - GainsFrac) + ConvGainsMixedSubzone +
857 0 : state.dataDispVentMgr->HAT_MX + state.dataRoomAir->ZTOC(ZoneNum) * MCp_Total) /
858 0 : ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_MX + MCp_Total);
859 0 : } break;
860 0 : case DataHeatBalance::SolutionAlgo::AnalyticalSolution: {
861 0 : if (TempDepCoef == 0.0) { // B=0
862 0 : state.dataRoomAir->ZTMX(ZoneNum) = state.dataRoomAir->Zone1MX(ZoneNum) + TempIndCoef / AirCap;
863 : } else {
864 0 : if (AirCap == 0.0) {
865 0 : state.dataRoomAir->ZTMX(ZoneNum) = TempIndCoef / TempDepCoef;
866 : } else {
867 0 : state.dataRoomAir->ZTMX(ZoneNum) =
868 0 : (state.dataRoomAir->Zone1MX(ZoneNum) - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) +
869 0 : TempIndCoef / TempDepCoef;
870 : }
871 : }
872 0 : } break;
873 0 : case DataHeatBalance::SolutionAlgo::EulerMethod: {
874 0 : state.dataRoomAir->ZTMX(ZoneNum) = (AirCap * state.dataRoomAir->Zone1MX(ZoneNum) + TempIndCoef) / (AirCap + TempDepCoef);
875 0 : } break;
876 0 : default:
877 0 : break;
878 : }
879 : }
880 :
881 : // MinFlow for interface layer at z = 1.0
882 0 : MinFlow = MinFlow_pow_fac * plume_fac;
883 : // EPTeam above replaces (cause diffs?) MinFlow = (1.0d0/24.55d0*1.0d0)**(1.0d0/0.6d0)*NumberOfPlumes*PowerPerPlume**(1.0/3.0)
884 0 : if (MinFlow != 0.0) {
885 0 : state.dataRoomAir->FracMinFlow(ZoneNum) = MCp_Total * 0.000833 / MinFlow;
886 : } else {
887 0 : state.dataRoomAir->FracMinFlow(ZoneNum) = 9.999;
888 : }
889 0 : state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true;
890 : }
891 :
892 : //=============================== M I X E D Calculation ==============================================
893 0 : if (state.dataRoomAir->ZTMX(ZoneNum) < state.dataRoomAir->ZTOC(ZoneNum) || MCp_Total <= 0.0 ||
894 0 : HeightFrac * CeilingHeight < (state.dataDispVentMgr->HeightFloorSubzoneTop + state.dataDispVentMgr->ThickOccupiedSubzoneMin)) {
895 0 : MIXFLAG = true;
896 0 : HeightFrac = 0.0;
897 0 : state.dataRoomAir->AvgTempGrad(ZoneNum) = 0.0;
898 0 : state.dataRoomAir->MaxTempGrad(ZoneNum) = 0.0;
899 0 : state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false;
900 0 : Real64 const thisZoneT1 = thisZoneHB.T1;
901 0 : Real64 AirCap = thisZoneHB.AirPowerCap;
902 0 : TempHistTerm = AirCap * (3.0 * thisZoneHB.ZTM[0] - (3.0 / 2.0) * thisZoneHB.ZTM[1] + OneThird * thisZoneHB.ZTM[2]);
903 :
904 0 : for (int Ctd = 1; Ctd <= 3; ++Ctd) {
905 0 : TempDepCoef = state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC + state.dataDispVentMgr->HA_FLOOR + MCp_Total;
906 0 : TempIndCoef =
907 0 : ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC + state.dataDispVentMgr->HAT_FLOOR + MCpT_Total;
908 0 : switch (state.dataHeatBal->ZoneAirSolutionAlgo) {
909 0 : case DataHeatBalance::SolutionAlgo::ThirdOrder: {
910 0 : ZTAveraged = (TempHistTerm + ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC +
911 0 : state.dataDispVentMgr->HAT_FLOOR + MCpT_Total) /
912 0 : ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC +
913 0 : state.dataDispVentMgr->HA_FLOOR + MCp_Total);
914 0 : } break;
915 0 : case DataHeatBalance::SolutionAlgo::AnalyticalSolution: {
916 0 : if (TempDepCoef == 0.0) { // B=0
917 0 : ZTAveraged = thisZoneT1 + TempIndCoef / AirCap;
918 : } else {
919 0 : ZTAveraged =
920 0 : (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef;
921 : }
922 0 : } break;
923 0 : case DataHeatBalance::SolutionAlgo::EulerMethod: {
924 0 : ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef);
925 0 : } break;
926 0 : default:
927 0 : break;
928 : }
929 0 : state.dataRoomAir->ZTOC(ZoneNum) = ZTAveraged;
930 0 : state.dataRoomAir->ZTMX(ZoneNum) = ZTAveraged;
931 0 : state.dataRoomAir->ZTFloor(ZoneNum) = ZTAveraged;
932 0 : HcDispVent3Node(state, ZoneNum, HeightFrac);
933 0 : TempDepCoef = state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC + state.dataDispVentMgr->HA_FLOOR + MCp_Total;
934 0 : TempIndCoef =
935 0 : ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC + state.dataDispVentMgr->HAT_FLOOR + MCpT_Total;
936 0 : switch (state.dataHeatBal->ZoneAirSolutionAlgo) {
937 0 : case DataHeatBalance::SolutionAlgo::ThirdOrder: {
938 0 : ZTAveraged = (TempHistTerm + ConvGains + state.dataDispVentMgr->HAT_MX + state.dataDispVentMgr->HAT_OC +
939 0 : state.dataDispVentMgr->HAT_FLOOR + MCpT_Total) /
940 0 : ((11.0 / 6.0) * AirCap + state.dataDispVentMgr->HA_MX + state.dataDispVentMgr->HA_OC +
941 0 : state.dataDispVentMgr->HA_FLOOR + MCp_Total);
942 0 : } break;
943 0 : case DataHeatBalance::SolutionAlgo::AnalyticalSolution: {
944 0 : if (TempDepCoef == 0.0) { // B=0
945 0 : ZTAveraged = thisZoneT1 + TempIndCoef / AirCap;
946 : } else {
947 0 : ZTAveraged =
948 0 : (thisZoneT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef;
949 : }
950 0 : } break;
951 0 : case DataHeatBalance::SolutionAlgo::EulerMethod: {
952 0 : ZTAveraged = (AirCap * thisZoneT1 + TempIndCoef) / (AirCap + TempDepCoef);
953 0 : } break;
954 0 : default:
955 0 : break;
956 : }
957 0 : state.dataRoomAir->ZTOC(ZoneNum) = ZTAveraged;
958 0 : state.dataRoomAir->ZTMX(ZoneNum) = ZTAveraged;
959 0 : state.dataRoomAir->ZTFloor(ZoneNum) = ZTAveraged;
960 : }
961 : }
962 : //=========================================================================================
963 :
964 : // Comfort temperature and temperature at the thermostat/temperature control sensor
965 :
966 0 : state.dataRoomAir->HeightTransition(ZoneNum) = HeightFrac * CeilingHeight;
967 0 : HeightMixedSubzoneAve = (CeilingHeight + state.dataRoomAir->HeightTransition(ZoneNum)) / 2.0;
968 0 : HeightOccupiedSubzoneAve = (state.dataDispVentMgr->HeightFloorSubzoneTop + state.dataRoomAir->HeightTransition(ZoneNum)) / 2.0;
969 0 : HeightFloorSubzoneAve = state.dataDispVentMgr->HeightFloorSubzoneTop / 2.0;
970 :
971 : // Comfort temperature
972 :
973 0 : if (MIXFLAG) {
974 0 : state.dataRoomAir->TCMF(ZoneNum) = ZTAveraged;
975 : } else {
976 0 : if (HeightComfort >= 0.0 && HeightComfort < HeightFloorSubzoneAve) {
977 0 : ShowWarningError(state, format("Displacement ventilation comfort height is in floor subzone in Zone: {}", zone.Name));
978 0 : state.dataRoomAir->TCMF(ZoneNum) = state.dataRoomAir->ZTFloor(ZoneNum);
979 0 : } else if (HeightComfort >= HeightFloorSubzoneAve && HeightComfort < HeightOccupiedSubzoneAve) {
980 0 : state.dataRoomAir->TCMF(ZoneNum) = (state.dataRoomAir->ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightComfort) +
981 0 : state.dataRoomAir->ZTOC(ZoneNum) * (HeightComfort - HeightFloorSubzoneAve)) /
982 0 : (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve);
983 : //! TCMF(ZoneNum) = (ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightComfort) &
984 : //! + ZTMX(ZoneNum) * (HeightComfort - HeightFloorSubzoneAve)) &
985 : //! / (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve)
986 0 : } else if (HeightComfort >= HeightOccupiedSubzoneAve && HeightComfort < HeightMixedSubzoneAve) {
987 0 : state.dataRoomAir->TCMF(ZoneNum) = (state.dataRoomAir->ZTOC(ZoneNum) * (HeightMixedSubzoneAve - HeightComfort) +
988 0 : state.dataRoomAir->ZTMX(ZoneNum) * (HeightComfort - HeightOccupiedSubzoneAve)) /
989 0 : (HeightMixedSubzoneAve - HeightOccupiedSubzoneAve);
990 0 : } else if (HeightComfort >= HeightMixedSubzoneAve && HeightComfort <= CeilingHeight) {
991 0 : state.dataRoomAir->TCMF(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum);
992 : } else {
993 0 : ShowFatalError(state, format("Displacement ventilation comfort height is above ceiling or below floor in Zone: {}", zone.Name));
994 : }
995 : }
996 :
997 : // Temperature at the thermostat/temperature control sensor
998 :
999 0 : if (MIXFLAG) {
1000 0 : state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = ZTAveraged;
1001 : } else {
1002 0 : if (HeightThermostat >= 0.0 && HeightThermostat < HeightFloorSubzoneAve) {
1003 0 : ShowWarningError(state, format("Displacement thermostat is in floor subzone in Zone: {}", zone.Name));
1004 0 : state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAir->ZTFloor(ZoneNum);
1005 0 : } else if (HeightThermostat >= HeightFloorSubzoneAve && HeightThermostat < HeightOccupiedSubzoneAve) {
1006 0 : state.dataHeatBalFanSys->TempTstatAir(ZoneNum) =
1007 0 : (state.dataRoomAir->ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightThermostat) +
1008 0 : state.dataRoomAir->ZTOC(ZoneNum) * (HeightThermostat - HeightFloorSubzoneAve)) /
1009 0 : (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve);
1010 : //! TempTstatAir(ZoneNum) = (ZTFloor(ZoneNum) * (HeightOccupiedSubzoneAve - HeightThermostat) &
1011 : //! + ZTMX(ZoneNum) * (HeightThermostat - HeightFloorSubzoneAve)) &
1012 : //! / (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve)
1013 0 : } else if (HeightThermostat >= HeightOccupiedSubzoneAve && HeightThermostat < HeightMixedSubzoneAve) {
1014 0 : state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = (state.dataRoomAir->ZTOC(ZoneNum) * (HeightMixedSubzoneAve - HeightThermostat) +
1015 0 : state.dataRoomAir->ZTMX(ZoneNum) * (HeightThermostat - HeightOccupiedSubzoneAve)) /
1016 0 : (HeightMixedSubzoneAve - HeightOccupiedSubzoneAve);
1017 0 : } else if (HeightThermostat >= HeightMixedSubzoneAve && HeightThermostat <= CeilingHeight) {
1018 0 : state.dataHeatBalFanSys->TempTstatAir(ZoneNum) = state.dataRoomAir->ZTMX(ZoneNum);
1019 : } else {
1020 0 : ShowFatalError(state, format("Displacement ventilation thermostat height is above ceiling or below floor in Zone: {}", zone.Name));
1021 : }
1022 : }
1023 :
1024 : // Temperature gradients
1025 :
1026 0 : if ((HeightMixedSubzoneAve - HeightFloorSubzoneAve) > 0.1) {
1027 0 : state.dataRoomAir->AvgTempGrad(ZoneNum) =
1028 0 : (state.dataRoomAir->ZTMX(ZoneNum) - state.dataRoomAir->ZTFloor(ZoneNum)) / (HeightMixedSubzoneAve - HeightFloorSubzoneAve);
1029 : } else {
1030 0 : state.dataRoomAir->AvgTempGrad(ZoneNum) = -9.999;
1031 : }
1032 0 : if ((HeightOccupiedSubzoneAve - HeightFloorSubzoneAve) > 0.1) {
1033 0 : state.dataRoomAir->MaxTempGrad(ZoneNum) =
1034 0 : (state.dataRoomAir->ZTOC(ZoneNum) - state.dataRoomAir->ZTFloor(ZoneNum)) / (HeightOccupiedSubzoneAve - HeightFloorSubzoneAve);
1035 : } else {
1036 0 : state.dataRoomAir->MaxTempGrad(ZoneNum) = -9.999;
1037 : }
1038 0 : if ((HeightMixedSubzoneAve - HeightOccupiedSubzoneAve) > 0.1) {
1039 0 : MTGAUX = (state.dataRoomAir->ZTMX(ZoneNum) - state.dataRoomAir->ZTOC(ZoneNum)) / (HeightMixedSubzoneAve - HeightOccupiedSubzoneAve);
1040 : } else {
1041 0 : MTGAUX = -9.999;
1042 : }
1043 :
1044 0 : if (MTGAUX > state.dataRoomAir->MaxTempGrad(ZoneNum)) {
1045 0 : state.dataRoomAir->MaxTempGrad(ZoneNum) = MTGAUX;
1046 : }
1047 :
1048 0 : if (MIXFLAG) {
1049 0 : state.dataRoomAir->ZoneDispVent3NodeMixedFlag(ZoneNum) = 1;
1050 0 : state.dataRoomAir->AirModel(ZoneNum).SimAirModel = false;
1051 : } else {
1052 0 : state.dataRoomAir->ZoneDispVent3NodeMixedFlag(ZoneNum) = 0;
1053 0 : state.dataRoomAir->AirModel(ZoneNum).SimAirModel = true;
1054 : }
1055 :
1056 0 : if (state.dataZoneEquip->ZoneEquipConfig(ZoneNum).IsControlled) {
1057 0 : int ZoneNodeNum = zone.SystemZoneNodeNumber;
1058 0 : state.dataLoopNodes->Node(ZoneNodeNum).Temp = state.dataRoomAir->ZTMX(ZoneNum);
1059 : }
1060 :
1061 : // Mixed for reporting purposes
1062 0 : if ((MIXFLAG) || ((state.dataRoomAir->ZTMX(ZoneNum) - state.dataRoomAir->ZTOC(ZoneNum)) < TempDiffCritRep)) {
1063 0 : state.dataRoomAir->ZoneDispVent3NodeMixedFlagRep(ZoneNum) = 1.0;
1064 0 : state.dataRoomAir->FracMinFlow(ZoneNum) = -1.0;
1065 0 : state.dataRoomAir->HeightTransition(ZoneNum) = -9.999;
1066 0 : state.dataRoomAir->AvgTempGrad(ZoneNum) = -9.999;
1067 0 : state.dataRoomAir->MaxTempGrad(ZoneNum) = -9.999;
1068 : } else {
1069 0 : state.dataRoomAir->ZoneDispVent3NodeMixedFlagRep(ZoneNum) = 0.0;
1070 : }
1071 0 : }
1072 :
1073 : } // namespace RoomAir
1074 : } // namespace EnergyPlus
|