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 HeatBalanceManager_hh_INCLUDED
49 : #define HeatBalanceManager_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 : #include <ObjexxFCL/Array2D.hh>
54 :
55 : // EnergyPlus Headers
56 : #include <EnergyPlus/Data/BaseData.hh>
57 : #include <EnergyPlus/EnergyPlus.hh>
58 : #include <EnergyPlus/FileSystem.hh>
59 : #include <EnergyPlus/SurfaceOctree.hh>
60 :
61 : namespace EnergyPlus {
62 :
63 : // Forward declarations
64 : struct EnergyPlusData;
65 :
66 : namespace HeatBalanceManager {
67 :
68 10399 : struct WarmupConvergence
69 : {
70 : // Members
71 : Array1D_int PassFlag; // one flag (1=Fail), (2=Pass) for each of the 4 conditions of convergence from
72 : // warmup (PassFlag(1)=Max Temp, PassFlag(2)=Min Temp, PassFlag(3)=Max Heat Load
73 : // PassFlag(4)=Max Cool Load)
74 : // Following are stored test values for temperature and loads convergence
75 : Real64 TestMaxTempValue; // Max Temperature convergence value=ABS(MaxTempPrevDay(ZoneNum)-MaxTempZone(ZoneNum))
76 : Real64 TestMinTempValue; // Min Temperature convergence value=ABS(MinTempPrevDay(ZoneNum)-MinTempZone(ZoneNum))
77 : Real64 TestMaxHeatLoadValue; // Max Heat Load convergence value=
78 : // ABS((MaxHeatLoadZone(ZoneNum)-MaxHeatLoadPrevDay(ZoneNum))/MaxHeatLoadZone(ZoneNum))
79 : Real64 TestMaxCoolLoadValue; // Max Cool Load convergence value=
80 : // ABS((MaxCoolLoadZone(ZoneNum)-MaxCoolLoadPrevDay(ZoneNum))/MaxCoolLoadZone(ZoneNum))
81 :
82 : // Default Constructor
83 771 : WarmupConvergence() : PassFlag(4, 2), TestMaxTempValue(0.0), TestMinTempValue(0.0), TestMaxHeatLoadValue(0.0), TestMaxCoolLoadValue(0.0)
84 : {
85 771 : }
86 : };
87 :
88 : void ManageHeatBalance(EnergyPlusData &state);
89 :
90 : void GetHeatBalanceInput(EnergyPlusData &state);
91 :
92 : void CheckUsedConstructions(EnergyPlusData &state, bool &ErrorsFound);
93 :
94 : bool CheckValidSimulationObjects(EnergyPlusData &state);
95 :
96 : void SetPreConstructionInputParameters(EnergyPlusData &state);
97 :
98 : void GetProjectControlData(EnergyPlusData &state, bool &ErrorsFound); // Set to true if errors detected during getting data
99 :
100 : void GetSiteAtmosphereData(EnergyPlusData &state, bool &ErrorsFound);
101 :
102 : void GetMaterialData(EnergyPlusData &state, bool &ErrorsFound); // set to true if errors found in input
103 :
104 : void GetWindowGlassSpectralData(EnergyPlusData &state, bool &ErrorsFound); // set to true if errors found in input
105 :
106 : void ValidateMaterialRoughness(EnergyPlusData &state,
107 : int const MaterNum, // Which Material number being validated.
108 : std::string const &Roughness, // Roughness String
109 : bool &ErrorsFound // If errors found
110 : );
111 :
112 : void GetConstructData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
113 :
114 : void GetBuildingData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
115 :
116 : void GetZoneData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
117 :
118 : void GetSpaceData(EnergyPlusData &state, bool &ErrorsFound);
119 :
120 : int GetGeneralSpaceTypeNum(EnergyPlusData &state);
121 :
122 : void GetZoneLocalEnvData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
123 :
124 : void ProcessZoneData(EnergyPlusData &state,
125 : std::string const &cCurrentModuleObject,
126 : int const ZoneLoop,
127 : Array1D_string const &cAlphaArgs,
128 : int &NumAlphas,
129 : Array1D<Real64> const &rNumericArgs,
130 : int &NumNumbers,
131 : Array1D_bool const &lNumericFieldBlanks, // Unused
132 : Array1D_bool const &lAlphaFieldBlanks,
133 : Array1D_string const &cAlphaFieldNames,
134 : Array1D_string const &cNumericFieldNames, // Unused
135 : bool &ErrorsFound // If errors found in input
136 : );
137 :
138 : void InitHeatBalance(EnergyPlusData &state);
139 :
140 : void AllocateZoneHeatBalArrays(EnergyPlusData &state);
141 :
142 : void AllocateHeatBalArrays(EnergyPlusData &state);
143 :
144 : void RecKeepHeatBalance(EnergyPlusData &state);
145 :
146 : void CheckWarmupConvergence(EnergyPlusData &state);
147 :
148 : void ReportWarmupConvergence(EnergyPlusData &state);
149 :
150 : void UpdateWindowFaceTempsNonBSDFWin(EnergyPlusData &state);
151 :
152 : void ReportHeatBalance(EnergyPlusData &state);
153 :
154 : void OpenShadingFile(EnergyPlusData &state);
155 :
156 : void GetFrameAndDividerData(EnergyPlusData &state, bool &ErrorsFound); // set to true if errors found in input
157 :
158 : void SearchWindow5DataFile(EnergyPlusData &state,
159 : fs::path const &DesiredFilePath, // File path (or just name) that contains the Window5 constructions.
160 : std::string const &DesiredConstructionName, // Name that will be searched for in the Window5 data file
161 : bool &ConstructionFound, // True if DesiredConstructionName is in the Window5 data file
162 : bool &EOFonFile, // True if EOF during file read
163 : bool &ErrorsFound // True if there is a problem with the entry requested from the data file
164 : );
165 :
166 : void SetStormWindowControl(EnergyPlusData &state);
167 :
168 : void CreateFCfactorConstructions(EnergyPlusData &state,
169 : int &ConstrNum, // Counter for Constructions
170 : bool &ErrorsFound // If errors found in input
171 : );
172 :
173 : void CreateAirBoundaryConstructions(EnergyPlusData &state,
174 : int &ConstrNum, // Counter for Constructions
175 : bool &ErrorsFound // If errors found in input
176 : );
177 :
178 : void GetIncidentSolarMultiplier(EnergyPlusData &state, bool &ErrorsFound);
179 :
180 : void GetScheduledSurfaceGains(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
181 :
182 : void CheckScheduledSurfaceGains(EnergyPlusData &state, int const ZoneNum); // Zone number for which error check will be performed
183 :
184 : void CreateTCConstructions(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
185 :
186 : void SetupSimpleWindowGlazingSystem(EnergyPlusData &state, int &MaterNum);
187 :
188 : void SetupComplexFenestrationMaterialInput(EnergyPlusData &state,
189 : int &MaterNum, // num of material items thus far
190 : bool &ErrorsFound);
191 :
192 : void SetupComplexFenestrationStateInput(EnergyPlusData &state,
193 : int &ConstrNum, // num of construction items thus far
194 : bool &ErrorsFound);
195 :
196 : void InitConductionTransferFunctions(EnergyPlusData &state);
197 :
198 : } // namespace HeatBalanceManager
199 :
200 1542 : struct HeatBalanceMgrData : BaseGlobalStruct
201 : {
202 :
203 : bool ManageHeatBalanceGetInputFlag = true;
204 : bool DoReport = false;
205 : bool ChangeSet = true; // Toggle for checking storm windows
206 : bool FirstWarmupWrite = true;
207 : bool WarmupConvergenceWarning = false;
208 : bool SizingWarmupConvergenceWarning = false;
209 : bool ReportWarmupConvergenceFirstWarmupWrite = true;
210 :
211 : std::string CurrentModuleObject; // to assist in getting input
212 : std::unordered_map<std::string, std::string> UniqueMaterialNames;
213 : std::unordered_map<std::string, std::string> UniqueConstructNames;
214 :
215 : // Real Variables for the Heat Balance Simulation
216 : // Variables used to determine warmup convergence
217 : Array1D<Real64> MaxCoolLoadPrevDay; // Max cooling load from the previous day
218 : Array1D<Real64> MaxCoolLoadZone; // Maximum zone cooling load from the current day
219 : Array1D<Real64> MaxHeatLoadPrevDay; // Max heating load from the previous day
220 : Array1D<Real64> MaxHeatLoadZone; // Maximum zone heating load from the current day
221 : Array1D<Real64> MaxTempPrevDay; // Max temperature from the previous day
222 : Array1D<Real64> MaxTempZone; // Maximum zone temperature from the current day
223 : Array1D<Real64> MinTempPrevDay; // Min temperature from the previous day
224 : Array1D<Real64> MinTempZone; // Minimum zone temperature from the current day
225 :
226 : // Variables used to report difference in temperature and load from the last two warmup days
227 : Array1D<Real64> WarmupTempDiff; // Temperature difference between the last two warmup days
228 : Array1D<Real64> WarmupLoadDiff; // Zone load differences between the last two warmup days
229 : Array1D<Real64> TempZoneSecPrevDay; // Zone air temperature from the second last warmup day
230 : Array1D<Real64> LoadZoneSecPrevDay; // Zone load from the second last warmup day
231 : Array1D<Real64> TempZonePrevDay; // Zone air temperature from the previous day
232 : Array1D<Real64> LoadZonePrevDay; // Zone load from the previuos day
233 : Array1D<Real64> TempZone; // Zone air temperature from the current warmup day
234 : Array1D<Real64> LoadZone; // Zone load from the current warmup day
235 :
236 : Array2D<Real64> TempZoneRpt; // Zone air temperature to report (average over all warmup days)
237 : Array1D<Real64> TempZoneRptStdDev; // Zone air temperature to report (std dev over all warmup days)
238 : Array2D<Real64> LoadZoneRpt; // Zone load to report (average over all warmup days)
239 : Array1D<Real64> LoadZoneRptStdDev; // Zone load to report (std dev over all warmup days)
240 : Array2D<Real64> MaxLoadZoneRpt; // Maximum zone load for reporting calcs
241 :
242 : int CountWarmupDayPoints; // Count of warmup timesteps (to achieve warmup)
243 :
244 : Array1D<HeatBalanceManager::WarmupConvergence> WarmupConvergenceValues;
245 : SurfaceOctreeCube surfaceOctree;
246 :
247 0 : void clear_state() override
248 : {
249 :
250 0 : ManageHeatBalanceGetInputFlag = true;
251 0 : UniqueMaterialNames.clear();
252 0 : UniqueConstructNames.clear();
253 0 : DoReport = false;
254 0 : ChangeSet = true;
255 0 : FirstWarmupWrite = true;
256 0 : WarmupConvergenceWarning = false;
257 0 : SizingWarmupConvergenceWarning = false;
258 0 : ReportWarmupConvergenceFirstWarmupWrite = true;
259 :
260 0 : CurrentModuleObject = std::string();
261 0 : MaxCoolLoadPrevDay.clear();
262 0 : MaxCoolLoadZone.clear();
263 0 : MaxHeatLoadPrevDay.clear();
264 0 : MaxHeatLoadZone.clear();
265 0 : MaxTempPrevDay.clear();
266 0 : MaxTempZone.clear();
267 0 : MinTempPrevDay.clear();
268 0 : MinTempZone.clear();
269 0 : WarmupTempDiff.clear();
270 0 : WarmupLoadDiff.clear();
271 0 : TempZoneSecPrevDay.clear();
272 0 : LoadZoneSecPrevDay.clear();
273 0 : TempZonePrevDay.clear();
274 0 : LoadZonePrevDay.clear();
275 0 : TempZone.clear();
276 0 : LoadZone.clear();
277 0 : TempZoneRpt.clear();
278 0 : TempZoneRptStdDev.clear();
279 0 : LoadZoneRpt.clear();
280 0 : LoadZoneRptStdDev.clear();
281 0 : MaxLoadZoneRpt.clear();
282 :
283 0 : CountWarmupDayPoints = int();
284 :
285 0 : WarmupConvergenceValues.clear();
286 0 : surfaceOctree = SurfaceOctreeCube();
287 0 : }
288 : };
289 :
290 : } // namespace EnergyPlus
291 :
292 : #endif
|