Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2023, The Board of Trustees of the University of Illinois,
2 : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 : // contributors. All rights reserved.
6 : //
7 : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 : // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 : //
13 : // Redistribution and use in source and binary forms, with or without modification, are permitted
14 : // provided that the following conditions are met:
15 : //
16 : // (1) Redistributions of source code must retain the above copyright notice, this list of
17 : // conditions and the following disclaimer.
18 : //
19 : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 : // conditions and the following disclaimer in the documentation and/or other materials
21 : // provided with the distribution.
22 : //
23 : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 : // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 : // used to endorse or promote products derived from this software without specific prior
26 : // written permission.
27 : //
28 : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 : // without changes from the version obtained under this License, or (ii) Licensee makes a
30 : // reference solely to the software portion of its product, Licensee must refer to the
31 : // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 : // obtained under this License and may not use a different name for the software. Except as
33 : // specifically required in this Section (4), Licensee shall not use in a company name, a
34 : // product name, in advertising, publicity, or other promotional activities any name, trade
35 : // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 : // similar designation, without the U.S. Department of Energy's prior written consent.
37 : //
38 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 : // POSSIBILITY OF SUCH DAMAGE.
47 :
48 : #ifndef HeatBalanceSurfaceManager_hh_INCLUDED
49 : #define HeatBalanceSurfaceManager_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Optional.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/DataWindowEquivalentLayer.hh>
57 : #include <EnergyPlus/EnergyPlus.hh>
58 : #include <EnergyPlus/WeatherManager.hh>
59 :
60 : #include "WCETarcog.hpp"
61 :
62 : namespace EnergyPlus {
63 :
64 : // Forward declarations
65 : struct EnergyPlusData;
66 :
67 : namespace DataSurfaces {
68 : struct SurfaceData;
69 : }
70 : namespace DataHeatBalance {
71 : struct ZoneData;
72 : }
73 :
74 : namespace HeatBalanceSurfaceManager {
75 :
76 : // Initialization routines for module
77 :
78 : // Algorithms for the module
79 : // These old external subroutines have been moved into the namespace and are no longer externals
80 : // CalcHeatBalanceOutsideSurf ! The heat balance routines are now public because the
81 : // CalcHeatBalanceInsideSurf ! radiant systems need access to them in order to simulate
82 :
83 : // Record Keeping/Utility Routines for Module
84 :
85 : // Reporting routines for module
86 :
87 : // Functions
88 :
89 : void ManageSurfaceHeatBalance(EnergyPlusData &state);
90 :
91 : // Beginning Initialization Section of the Module
92 : //******************************************************************************
93 :
94 : void InitSurfaceHeatBalance(EnergyPlusData &state);
95 :
96 : void GatherForPredefinedReport(EnergyPlusData &state);
97 :
98 : void AllocateSurfaceHeatBalArrays(EnergyPlusData &state);
99 :
100 : void InitThermalAndFluxHistories(EnergyPlusData &state);
101 :
102 : void EvalOutsideMovableInsulation(EnergyPlusData &state);
103 :
104 : void EvalInsideMovableInsulation(EnergyPlusData &state);
105 :
106 : void InitSolarHeatGains(EnergyPlusData &state);
107 :
108 : void InitIntSolarDistribution(EnergyPlusData &state);
109 :
110 : void ComputeIntThermalAbsorpFactors(EnergyPlusData &state);
111 :
112 : void ComputeIntSWAbsorpFactors(EnergyPlusData &state);
113 :
114 : void ComputeDifSolExcZonesWIZWindows(EnergyPlusData &state, int NumberOfEnclosures); // Number of solar enclosures
115 :
116 : void InitEMSControlledSurfaceProperties(EnergyPlusData &state);
117 :
118 : void InitEMSControlledConstructions(EnergyPlusData &state);
119 :
120 : // End Initialization Section of the Module
121 : //******************************************************************************
122 :
123 : // Begin Algorithm Section of the Module
124 : //******************************************************************************
125 :
126 : // Beginning of Record Keeping subroutines for the HB Module
127 : // *****************************************************************************
128 :
129 : void UpdateIntermediateSurfaceHeatBalanceResults(EnergyPlusData &state, Optional_int_const ZoneToResimulate = _);
130 :
131 : void UpdateNonRepresentativeSurfaceResults(EnergyPlusData &state, Optional_int_const ZoneToResimulate = _);
132 :
133 : void UpdateFinalSurfaceHeatBalance(EnergyPlusData &state);
134 :
135 : void UpdateThermalHistories(EnergyPlusData &state);
136 :
137 : void CalculateZoneMRT(EnergyPlusData &state,
138 : Optional_int_const ZoneToResimulate = _); // if passed in, then only calculate surfaces that have this zone
139 :
140 : // End of Record Keeping subroutines for the HB Module
141 : // *****************************************************************************
142 :
143 : // Beginning of Reporting subroutines for the HB Module
144 : // *****************************************************************************
145 :
146 : void ReportSurfaceHeatBalance(EnergyPlusData &state);
147 :
148 : void ReportNonRepresentativeSurfaceResults(EnergyPlusData &state);
149 :
150 : void ReportIntMovInsInsideSurfTemp(EnergyPlusData &state);
151 :
152 : void CalcThermalResilience(EnergyPlusData &state);
153 :
154 : void ReportThermalResilience(EnergyPlusData &state);
155 :
156 : void ReportCO2Resilience(EnergyPlusData &state);
157 :
158 : void ReportVisualResilience(EnergyPlusData &state);
159 :
160 : // End of Reporting subroutines for the HB Module
161 :
162 : // Formerly EXTERNAL SUBROUTINES (heavily related to HeatBalanceSurfaceManager) but now moved into namespace HeatBalanceSurfaceManager
163 :
164 : void CalcHeatBalanceOutsideSurf(EnergyPlusData &state,
165 : Optional_int_const ZoneToResimulate = _); // if passed in, then only calculate surfaces that have this zone
166 :
167 : Real64 GetSurfQdotRadHVACInPerArea(EnergyPlusData &state, int SurfNum);
168 :
169 : Real64 GetQdotConvOutPerArea(EnergyPlusData &state, const int SurfNum);
170 :
171 : void CalcHeatBalanceInsideSurf(EnergyPlusData &state,
172 : Optional_int_const ZoneToResimulate = _); // if passed in, then only calculate surfaces that have this zone
173 :
174 : void CalcHeatBalanceInsideSurf2(EnergyPlusData &state,
175 : const std::vector<int> &HTSurfs, // Heat transfer surfaces to simulate (opaque and windows)
176 : const std::vector<int> &IZSurfs, // Interzone heat transfer surfaces to simulate
177 : const std::vector<int> &HTNonWindowSurfs, // Non-window heat transfer surfaces to simulate
178 : const std::vector<int> &HTWindowSurfs, // Window heat transfer surfaces to simulate
179 : Optional_int_const ZoneToResimulate = _);
180 :
181 : void CalcHeatBalanceInsideSurf2CTFOnly(EnergyPlusData &state,
182 : const int FirstZone, // First zone to simulate
183 : const int LastZone, // Last zone to simulate
184 : const std::vector<int> &IZSurfs, // Last zone to simulate
185 : Optional_int_const ZoneToResimulate = _);
186 :
187 : void
188 : TestSurfTempCalcHeatBalanceInsideSurf(EnergyPlusData &state, Real64 TH12, int const SurfNum, DataHeatBalance::ZoneData &zone, int WarmupSurfTemp);
189 :
190 : void CalcOutsideSurfTemp(EnergyPlusData &state,
191 : int SurfNum, // Surface number DO loop counter
192 : int ZoneNum, // Zone number the current surface is attached to
193 : int ConstrNum, // Construction index for the current surface
194 : Real64 HMovInsul, // "Convection" coefficient of movable insulation
195 : Real64 TempExt, // Exterior temperature boundary condition
196 : bool &ErrorFlag // Error flag for movable insulation problem
197 : );
198 :
199 : void CalcExteriorVentedCavity(EnergyPlusData &state, int SurfNum); // index of surface
200 :
201 : void GatherComponentLoadsSurfAbsFact(EnergyPlusData &state);
202 :
203 : Real64 GetSurfIncidentSolarMultiplier(EnergyPlusData &state, int SurfNum);
204 :
205 : void InitSurfacePropertyViewFactors(EnergyPlusData &state);
206 :
207 : void GetGroundSurfacesTemperatureAverage(EnergyPlusData &state);
208 :
209 : void GetGroundSurfacesReflectanceAverage(EnergyPlusData &state);
210 :
211 : void ReSetGroundSurfacesViewFactor(EnergyPlusData &state, int const SurfNum);
212 :
213 : } // namespace HeatBalanceSurfaceManager
214 :
215 1542 : struct HeatBalSurfMgr : BaseGlobalStruct
216 : {
217 :
218 : Array1D<Real64> QExt1; // Heat flux at the exterior surface during first time step/series
219 : Array1D<Real64> QInt1; // Heat flux at the interior surface during first time step/series
220 : Array1D<Real64> TempInt1; // Temperature of interior surface during first time step/series
221 : Array1D<Real64> TempExt1; // Temperature of exterior surface during first time step/series
222 : Array1D<Real64> Qsrc1; // Heat source/sink (during first time step/series)
223 : Array1D<Real64> Tsrc1; // Temperature at source/sink (during first time step/series)
224 : Array1D<Real64> Tuser1; // Temperature at the user specified location (during first time step/series)
225 : Array1D<Real64> SumTime; // Amount of time that has elapsed from start of master history to
226 :
227 : Array1D<Real64> SurfaceAE; // Product of area and emissivity for each surface
228 : Array1D<Real64> ZoneAESum; // Sum of area times emissivity for all zone surfaces
229 :
230 : Array2D<Real64> DiffuseArray;
231 :
232 : Real64 curQL = 0.0; // radiant value prior to adjustment for pulse for load component report
233 : Real64 adjQL = 0.0; // radiant value including adjustment for pulse for load component report
234 :
235 : bool ManageSurfaceHeatBalancefirstTime = true;
236 : bool InitSurfaceHeatBalancefirstTime = true;
237 : bool UpdateThermalHistoriesFirstTimeFlag = true;
238 : bool CalculateZoneMRTfirstTime = true; // Flag for first time calculations
239 : bool reportThermalResilienceFirstTime = true;
240 : bool reportVarHeatIndex = false;
241 : bool reportVarHumidex = false;
242 : bool hasPierceSET = true;
243 : bool reportCO2ResilienceFirstTime = true;
244 : bool reportVisualResilienceFirstTime = true;
245 : std::vector<Real64> lowSETLongestHours;
246 : std::vector<Real64> highSETLongestHours;
247 : std::vector<int> lowSETLongestStart;
248 : std::vector<int> highSETLongestStart;
249 : bool calcHeatBalInsideSurfFirstTime = true;
250 : bool calcHeatBalInsideSurfCTFOnlyFirstTime = true;
251 : int calcHeatBalInsideSurfErrCount = 0;
252 : int calcHeatBalInsideSurfErrPointer = 0;
253 : int calcHeatBalInsideSurfWarmupErrCount = 0;
254 : bool calcHeatBalInsideSurEnvrnFlag = true;
255 : Array1D<Real64> RefAirTemp; // inside surface convection reference air temperatures
256 : Array1D<Real64> AbsDiffWin =
257 : Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL); // Diffuse solar absorptance of glass layers //Tuned Made static
258 : Array1D<Real64> AbsDiffWinGnd =
259 : Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL); // Ground diffuse solar absorptance of glass layers //Tuned Made static
260 : Array1D<Real64> AbsDiffWinSky =
261 : Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL); // Sky diffuse solar absorptance of glass layers //Tuned Made static
262 :
263 0 : void clear_state() override
264 : {
265 0 : QExt1.clear();
266 0 : QInt1.clear();
267 0 : TempInt1.clear();
268 0 : TempExt1.clear();
269 0 : Qsrc1.clear();
270 0 : Tsrc1.clear();
271 0 : Tuser1.clear();
272 0 : SumTime.clear();
273 :
274 0 : SurfaceAE.clear();
275 0 : ZoneAESum.clear();
276 :
277 0 : DiffuseArray.clear();
278 0 : curQL = 0.0;
279 0 : adjQL = 0.0;
280 :
281 0 : ManageSurfaceHeatBalancefirstTime = true;
282 0 : InitSurfaceHeatBalancefirstTime = true;
283 0 : UpdateThermalHistoriesFirstTimeFlag = true;
284 0 : CalculateZoneMRTfirstTime = true;
285 0 : reportThermalResilienceFirstTime = true;
286 0 : reportVarHeatIndex = false;
287 0 : reportVarHumidex = false;
288 0 : hasPierceSET = true;
289 0 : reportCO2ResilienceFirstTime = true;
290 0 : reportVisualResilienceFirstTime = true;
291 0 : lowSETLongestHours.clear();
292 0 : highSETLongestHours.clear();
293 0 : lowSETLongestStart.clear();
294 0 : highSETLongestStart.clear();
295 0 : calcHeatBalInsideSurfFirstTime = true;
296 0 : calcHeatBalInsideSurfCTFOnlyFirstTime = true;
297 0 : calcHeatBalInsideSurfErrCount = 0;
298 0 : calcHeatBalInsideSurfErrPointer = 0;
299 0 : calcHeatBalInsideSurfWarmupErrCount = 0;
300 0 : calcHeatBalInsideSurEnvrnFlag = true;
301 0 : RefAirTemp.clear();
302 0 : AbsDiffWin = Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL);
303 0 : AbsDiffWinGnd = Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL);
304 0 : AbsDiffWinSky = Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL);
305 0 : }
306 : };
307 :
308 : } // namespace EnergyPlus
309 :
310 : #endif
|