Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois,
2 : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 : // contributors. All rights reserved.
6 : //
7 : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 : // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 : //
13 : // Redistribution and use in source and binary forms, with or without modification, are permitted
14 : // provided that the following conditions are met:
15 : //
16 : // (1) Redistributions of source code must retain the above copyright notice, this list of
17 : // conditions and the following disclaimer.
18 : //
19 : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 : // conditions and the following disclaimer in the documentation and/or other materials
21 : // provided with the distribution.
22 : //
23 : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 : // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 : // used to endorse or promote products derived from this software without specific prior
26 : // written permission.
27 : //
28 : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 : // without changes from the version obtained under this License, or (ii) Licensee makes a
30 : // reference solely to the software portion of its product, Licensee must refer to the
31 : // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 : // obtained under this License and may not use a different name for the software. Except as
33 : // specifically required in this Section (4), Licensee shall not use in a company name, a
34 : // product name, in advertising, publicity, or other promotional activities any name, trade
35 : // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 : // similar designation, without the U.S. Department of Energy's prior written consent.
37 : //
38 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 : // POSSIBILITY OF SUCH DAMAGE.
47 :
48 : #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 : 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 796 : WarmupConvergence() : PassFlag(4, 2), TestMaxTempValue(0.0), TestMinTempValue(0.0), TestMaxHeatLoadValue(0.0), TestMaxCoolLoadValue(0.0)
84 : {
85 796 : }
86 : };
87 :
88 : void ManageHeatBalance(EnergyPlusData &state);
89 :
90 : void GetHeatBalanceInput(EnergyPlusData &state);
91 :
92 : void CheckUsedConstructions(EnergyPlusData &state, [[maybe_unused]] 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 GetWindowGlassSpectralData(EnergyPlusData &state, bool &ErrorsFound); // set to true if errors found in input
103 :
104 : void GetConstructData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
105 :
106 : void GetBuildingData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
107 :
108 : void GetZoneData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
109 :
110 : void GetSpaceData(EnergyPlusData &state, bool &ErrorsFound);
111 :
112 : int GetGeneralSpaceTypeNum(EnergyPlusData &state);
113 :
114 : void GetZoneLocalEnvData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
115 :
116 : void ProcessZoneData(EnergyPlusData &state,
117 : std::string const &cCurrentModuleObject,
118 : int const ZoneLoop,
119 : Array1D_string const &cAlphaArgs,
120 : int const NumAlphas,
121 : Array1D<Real64> const &rNumericArgs,
122 : int const NumNumbers,
123 : Array1D_bool const &lNumericFieldBlanks, // Unused
124 : Array1D_bool const &lAlphaFieldBlanks,
125 : Array1D_string const &cAlphaFieldNames,
126 : Array1D_string const &cNumericFieldNames, // Unused
127 : bool &ErrorsFound // If errors found in input
128 : );
129 :
130 : void InitHeatBalance(EnergyPlusData &state);
131 :
132 : void AllocateZoneHeatBalArrays(EnergyPlusData &state);
133 :
134 : void AllocateHeatBalArrays(EnergyPlusData &state);
135 :
136 : void RecKeepHeatBalance(EnergyPlusData &state);
137 :
138 : void CheckWarmupConvergence(EnergyPlusData &state);
139 :
140 : void ReportWarmupConvergence(EnergyPlusData &state);
141 :
142 : void UpdateWindowFaceTempsNonBSDFWin(EnergyPlusData &state);
143 :
144 : void ReportHeatBalance(EnergyPlusData &state);
145 :
146 : void OpenShadingFile(EnergyPlusData &state);
147 :
148 : void GetFrameAndDividerData(EnergyPlusData &state); // set to true if errors found in input
149 :
150 : void SearchWindow5DataFile(EnergyPlusData &state,
151 : fs::path const &DesiredFilePath, // File path (or just name) that contains the Window5 constructions.
152 : std::string const &DesiredConstructionName, // Name that will be searched for in the Window5 data file
153 : bool &ConstructionFound, // True if DesiredConstructionName is in the Window5 data file
154 : bool &EOFonFile, // True if EOF during file read
155 : bool &ErrorsFound // True if there is a problem with the entry requested from the data file
156 : );
157 :
158 : void SetStormWindowControl(EnergyPlusData &state);
159 :
160 : void CreateFCfactorConstructions(EnergyPlusData &state,
161 : int &ConstrNum, // Counter for Constructions
162 : bool &ErrorsFound // If errors found in input
163 : );
164 :
165 : void CreateAirBoundaryConstructions(EnergyPlusData &state,
166 : int &ConstrNum, // Counter for Constructions
167 : bool &ErrorsFound // If errors found in input
168 : );
169 :
170 : void GetIncidentSolarMultiplier(EnergyPlusData &state, bool &ErrorsFound);
171 :
172 : void GetScheduledSurfaceGains(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
173 :
174 : void CheckScheduledSurfaceGains(EnergyPlusData &state, int const ZoneNum); // Zone number for which error check will be performed
175 :
176 : void CreateTCConstructions(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
177 :
178 : void SetupSimpleWindowGlazingSystem(EnergyPlusData &state, int &MaterNum);
179 :
180 : void SetupComplexFenestrationMaterialInput(EnergyPlusData &state,
181 : int &MaterNum, // num of material items thus far
182 : bool &ErrorsFound);
183 :
184 : void SetupComplexFenestrationStateInput(EnergyPlusData &state,
185 : int &ConstrNum, // num of construction items thus far
186 : bool &ErrorsFound);
187 :
188 : void InitConductionTransferFunctions(EnergyPlusData &state);
189 :
190 : } // namespace HeatBalanceManager
191 :
192 : struct HeatBalanceMgrData : BaseGlobalStruct
193 : {
194 :
195 : bool ManageHeatBalanceGetInputFlag = true;
196 : bool DoReport = false;
197 : bool ChangeSet = true; // Toggle for checking storm windows
198 : bool FirstWarmupWrite = true;
199 : bool WarmupConvergenceWarning = false;
200 : bool SizingWarmupConvergenceWarning = false;
201 : bool ReportWarmupConvergenceFirstWarmupWrite = true;
202 :
203 : std::string CurrentModuleObject; // to assist in getting input
204 : std::unordered_map<std::string, std::string> UniqueMaterialNames;
205 : std::unordered_map<std::string, std::string> UniqueConstructNames;
206 :
207 : // Real Variables for the Heat Balance Simulation
208 : // Variables used to determine warmup convergence
209 : Array1D<Real64> MaxCoolLoadPrevDay; // Max cooling load from the previous day
210 : Array1D<Real64> MaxCoolLoadZone; // Maximum zone cooling load from the current day
211 : Array1D<Real64> MaxHeatLoadPrevDay; // Max heating load from the previous day
212 : Array1D<Real64> MaxHeatLoadZone; // Maximum zone heating load from the current day
213 : Array1D<Real64> MaxTempPrevDay; // Max temperature from the previous day
214 : Array1D<Real64> MaxTempZone; // Maximum zone temperature from the current day
215 : Array1D<Real64> MinTempPrevDay; // Min temperature from the previous day
216 : Array1D<Real64> MinTempZone; // Minimum zone temperature from the current day
217 :
218 : // Variables used to report difference in temperature and load from the last two warmup days
219 : Array1D<Real64> WarmupTempDiff; // Temperature difference between the last two warmup days
220 : Array1D<Real64> WarmupLoadDiff; // Zone load differences between the last two warmup days
221 : Array1D<Real64> TempZoneSecPrevDay; // Zone air temperature from the second last warmup day
222 : Array1D<Real64> LoadZoneSecPrevDay; // Zone load from the second last warmup day
223 : Array1D<Real64> TempZonePrevDay; // Zone air temperature from the previous day
224 : Array1D<Real64> LoadZonePrevDay; // Zone load from the previuos day
225 : Array1D<Real64> TempZone; // Zone air temperature from the current warmup day
226 : Array1D<Real64> LoadZone; // Zone load from the current warmup day
227 :
228 : Array2D<Real64> TempZoneRpt; // Zone air temperature to report (average over all warmup days)
229 : Array1D<Real64> TempZoneRptStdDev; // Zone air temperature to report (std dev over all warmup days)
230 : Array2D<Real64> LoadZoneRpt; // Zone load to report (average over all warmup days)
231 : Array1D<Real64> LoadZoneRptStdDev; // Zone load to report (std dev over all warmup days)
232 : Array2D<Real64> MaxLoadZoneRpt; // Maximum zone load for reporting calcs
233 :
234 : int CountWarmupDayPoints; // Count of warmup timesteps (to achieve warmup)
235 :
236 : Array1D<HeatBalanceManager::WarmupConvergence> WarmupConvergenceValues;
237 : SurfaceOctreeCube surfaceOctree;
238 :
239 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
240 : {
241 796 : }
242 :
243 0 : void clear_state() override
244 : {
245 :
246 0 : ManageHeatBalanceGetInputFlag = true;
247 0 : UniqueMaterialNames.clear();
248 0 : UniqueConstructNames.clear();
249 0 : DoReport = false;
250 0 : ChangeSet = true;
251 0 : FirstWarmupWrite = true;
252 0 : WarmupConvergenceWarning = false;
253 0 : SizingWarmupConvergenceWarning = false;
254 0 : ReportWarmupConvergenceFirstWarmupWrite = true;
255 :
256 0 : CurrentModuleObject = std::string();
257 0 : MaxCoolLoadPrevDay.clear();
258 0 : MaxCoolLoadZone.clear();
259 0 : MaxHeatLoadPrevDay.clear();
260 0 : MaxHeatLoadZone.clear();
261 0 : MaxTempPrevDay.clear();
262 0 : MaxTempZone.clear();
263 0 : MinTempPrevDay.clear();
264 0 : MinTempZone.clear();
265 0 : WarmupTempDiff.clear();
266 0 : WarmupLoadDiff.clear();
267 0 : TempZoneSecPrevDay.clear();
268 0 : LoadZoneSecPrevDay.clear();
269 0 : TempZonePrevDay.clear();
270 0 : LoadZonePrevDay.clear();
271 0 : TempZone.clear();
272 0 : LoadZone.clear();
273 0 : TempZoneRpt.clear();
274 0 : TempZoneRptStdDev.clear();
275 0 : LoadZoneRpt.clear();
276 0 : LoadZoneRptStdDev.clear();
277 0 : MaxLoadZoneRpt.clear();
278 :
279 0 : CountWarmupDayPoints = int();
280 :
281 0 : WarmupConvergenceValues.clear();
282 0 : surfaceOctree = SurfaceOctreeCube();
283 0 : }
284 : };
285 :
286 : } // namespace EnergyPlus
287 :
288 : #endif
|