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 TARCOGOutput_hh_INCLUDED
49 : #define TARCOGOutput_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array2A.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/EnergyPlus.hh>
57 : #include <EnergyPlus/FileSystem.hh>
58 : #include <EnergyPlus/IOFiles.hh>
59 : #include <EnergyPlus/TARCOGGassesParams.hh>
60 : #include <EnergyPlus/TARCOGParams.hh>
61 :
62 : namespace EnergyPlus {
63 :
64 : namespace TARCOGOutput {
65 :
66 : struct Files
67 : {
68 : fs::path DBGD; // Debug directory
69 : bool WriteDebugOutput{false};
70 :
71 : fs::path WINCogFilePath{"test.w7"};
72 : InputOutputFile WINCogFile{WINCogFilePath};
73 :
74 : // Intermediate debug files
75 : fs::path TarcogIterationsFilePath{"TarcogIterations.dbg"};
76 : InputOutputFile TarcogIterationsFile{TarcogIterationsFilePath};
77 :
78 : fs::path IterationCSVFilePath{"IterationResults.csv"};
79 : InputOutputFile IterationCSVFile{IterationCSVFilePath};
80 :
81 : fs::path DebugOutputFilePath{"Tarcog.dbg"};
82 : InputOutputFile DebugOutputFile{DebugOutputFilePath};
83 : };
84 :
85 : void WriteInputArguments(EnergyPlusData &state,
86 : InputOutputFile &InArgumentsFile,
87 : fs::path const &DBGC,
88 : Real64 tout,
89 : Real64 tind,
90 : Real64 trmin,
91 : Real64 wso,
92 : int iwd,
93 : Real64 wsi,
94 : Real64 dir,
95 : Real64 outir,
96 : int isky,
97 : Real64 tsky,
98 : Real64 esky,
99 : Real64 fclr,
100 : Real64 VacuumPressure,
101 : Real64 VacuumMaxGapThickness,
102 : const Array1D_int &ibc,
103 : Real64 hout,
104 : Real64 hin,
105 : TARCOGGassesParams::Stdrd standard,
106 : TARCOGParams::TARCOGThermalModel ThermalMod,
107 : Real64 SDScalar,
108 : Real64 height,
109 : Real64 heightt,
110 : Real64 width,
111 : Real64 tilt,
112 : Real64 totsol,
113 : int nlayer,
114 : const Array1D<TARCOGParams::TARCOGLayerType> &LayerType,
115 : const Array1D<Real64> &thick,
116 : const Array1D<Real64> &scon,
117 : const Array1D<Real64> &asol,
118 : const Array1D<Real64> &tir,
119 : const Array1D<Real64> &emis,
120 : const Array1D<Real64> &Atop,
121 : const Array1D<Real64> &Abot,
122 : const Array1D<Real64> &Al,
123 : const Array1D<Real64> &Ar,
124 : const Array1D<Real64> &Ah,
125 : const Array1D<Real64> &SlatThick,
126 : const Array1D<Real64> &SlatWidth,
127 : const Array1D<Real64> &SlatAngle,
128 : const Array1D<Real64> &SlatCond,
129 : const Array1D<Real64> &SlatSpacing,
130 : const Array1D<Real64> &SlatCurve,
131 : const Array1D_int &nslice,
132 : const Array1D<Real64> &LaminateA,
133 : const Array1D<Real64> &LaminateB,
134 : const Array1D<Real64> &sumsol,
135 : const Array1D<Real64> &gap,
136 : const Array1D<Real64> &vvent,
137 : const Array1D<Real64> &tvent,
138 : const Array1D<Real64> &presure,
139 : const Array1D_int &nmix,
140 : Array2A_int iprop,
141 : Array2A<Real64> frct,
142 : Array2A<Real64> xgcon,
143 : Array2A<Real64> xgvis,
144 : Array2A<Real64> xgcp,
145 : const Array1D<Real64> &xwght);
146 :
147 : void WriteModifiedArguments(InputOutputFile &InArgumentsFile,
148 : fs::path const &DBGC,
149 : Real64 esky,
150 : Real64 trmout,
151 : Real64 trmin,
152 : Real64 ebsky,
153 : Real64 ebroom,
154 : Real64 Gout,
155 : Real64 Gin,
156 : int nlayer,
157 : const Array1D<TARCOGParams::TARCOGLayerType> &LayerType,
158 : const Array1D_int &nmix,
159 : Array2A<Real64> frct,
160 : const Array1D<Real64> &thick,
161 : const Array1D<Real64> &scon,
162 : const Array1D<Real64> &gap,
163 : Array2A<Real64> xgcon,
164 : Array2A<Real64> xgvis,
165 : Array2A<Real64> xgcp,
166 : const Array1D<Real64> &xwght);
167 :
168 : void WriteOutputArguments(InputOutputFile &OutArgumentsFile,
169 : fs::path const &DBGC,
170 : int nlayer,
171 : Real64 tamb,
172 : const Array1D<Real64> &q,
173 : const Array1D<Real64> &qv,
174 : const Array1D<Real64> &qcgas,
175 : const Array1D<Real64> &qrgas,
176 : const Array1D<Real64> &theta,
177 : const Array1D<Real64> &vfreevent,
178 : const Array1D<Real64> &vvent,
179 : const Array1D<Real64> &Keff,
180 : const Array1D<Real64> &ShadeGapKeffConv,
181 : Real64 troom,
182 : Real64 ufactor,
183 : Real64 shgc,
184 : Real64 sc,
185 : Real64 hflux,
186 : Real64 shgct,
187 : Real64 hcin,
188 : Real64 hrin,
189 : Real64 hcout,
190 : Real64 hrout,
191 : const Array1D<Real64> &Ra,
192 : const Array1D<Real64> &Nu,
193 : const Array1D<TARCOGParams::TARCOGLayerType> &LayerType,
194 : const Array1D<Real64> &Ebf,
195 : const Array1D<Real64> &Ebb,
196 : const Array1D<Real64> &Rf,
197 : const Array1D<Real64> &Rb,
198 : Real64 ebsky,
199 : Real64 Gout,
200 : Real64 ebroom,
201 : Real64 Gin,
202 : Real64 ShadeEmisRatioIn,
203 : Real64 ShadeEmisRatioOut,
204 : Real64 ShadeHcRatioIn,
205 : Real64 ShadeHcRatioOut,
206 : Real64 HcUnshadedIn,
207 : Real64 HcUnshadedOut,
208 : const Array1D<Real64> &hcgas,
209 : const Array1D<Real64> &hrgas,
210 : Real64 AchievedErrorTolerance,
211 : int NumOfIter);
212 :
213 : void WriteOutputEN673(InputOutputFile &OutArgumentsFile,
214 : fs::path const &DBGD,
215 : int const nlayer,
216 : Real64 const ufactor,
217 : Real64 const hout,
218 : Real64 const hin,
219 : const Array1D<Real64> &Ra,
220 : const Array1D<Real64> &Nu,
221 : const Array1D<Real64> &hg,
222 : const Array1D<Real64> &hr,
223 : const Array1D<Real64> &hs,
224 : int &nperr);
225 :
226 : void WriteTARCOGInputFile(EnergyPlusData &state,
227 : Files &files,
228 : std::string const &VerNum,
229 : Real64 tout,
230 : Real64 tind,
231 : Real64 trmin,
232 : Real64 wso,
233 : int iwd,
234 : Real64 wsi,
235 : Real64 dir,
236 : Real64 outir,
237 : int isky,
238 : Real64 tsky,
239 : Real64 esky,
240 : Real64 fclr,
241 : Real64 VacuumPressure,
242 : Real64 VacuumMaxGapThickness,
243 : TARCOGParams::DeflectionCalculation CalcDeflection,
244 : Real64 Pa,
245 : Real64 Pini,
246 : Real64 Tini,
247 : const Array1D_int &ibc,
248 : Real64 hout,
249 : Real64 hin,
250 : TARCOGGassesParams::Stdrd standard,
251 : TARCOGParams::TARCOGThermalModel ThermalMod,
252 : Real64 SDScalar,
253 : Real64 height,
254 : Real64 heightt,
255 : Real64 width,
256 : Real64 tilt,
257 : Real64 totsol,
258 : int nlayer,
259 : const Array1D<TARCOGParams::TARCOGLayerType> &LayerType,
260 : const Array1D<Real64> &thick,
261 : const Array1D<Real64> &scon,
262 : const Array1D<Real64> &YoungsMod,
263 : const Array1D<Real64> &PoissonsRat,
264 : const Array1D<Real64> &asol,
265 : const Array1D<Real64> &tir,
266 : const Array1D<Real64> &emis,
267 : const Array1D<Real64> &Atop,
268 : const Array1D<Real64> &Abot,
269 : const Array1D<Real64> &Al,
270 : const Array1D<Real64> &Ar,
271 : const Array1D<Real64> &Ah,
272 : const Array1D_int &SupportPillar,
273 : const Array1D<Real64> &PillarSpacing,
274 : const Array1D<Real64> &PillarRadius,
275 : const Array1D<Real64> &SlatThick,
276 : const Array1D<Real64> &SlatWidth,
277 : const Array1D<Real64> &SlatAngle,
278 : const Array1D<Real64> &SlatCond,
279 : const Array1D<Real64> &SlatSpacing,
280 : const Array1D<Real64> &SlatCurve,
281 : const Array1D_int &nslice,
282 : const Array1D<Real64> &gap,
283 : const Array1D<Real64> &GapDef,
284 : const Array1D<Real64> &vvent,
285 : const Array1D<Real64> &tvent,
286 : const Array1D<Real64> &presure,
287 : const Array1D_int &nmix,
288 : Array2A_int iprop,
289 : Array2A<Real64> frct,
290 : Array2A<Real64> xgcon,
291 : Array2A<Real64> xgvis,
292 : Array2A<Real64> xgcp,
293 : const Array1D<Real64> &xwght,
294 : const Array1D<Real64> &gama);
295 :
296 : void FinishDebugOutputFiles(Files &files, int nperr);
297 :
298 : void PrepDebugFilesAndVariables(
299 : EnergyPlusData &state, Files &files, fs::path const &Debug_dir, fs::path const &Debug_file, int Debug_mode, int win_ID, int igu_ID);
300 :
301 : } // namespace TARCOGOutput
302 :
303 : struct TARCOGOutputData : BaseGlobalStruct
304 : {
305 : int winID = 0;
306 : int iguID = 0;
307 :
308 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
309 : {
310 796 : }
311 :
312 0 : void clear_state() override
313 : {
314 0 : this->winID = 0;
315 0 : this->iguID = 0;
316 0 : }
317 : };
318 :
319 : } // namespace EnergyPlus
320 :
321 : #endif
|