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 : #ifndef GroundHeatExchangers_hh_INCLUDED
49 : #define GroundHeatExchangers_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // JSON Headers
55 : #include <nlohmann/json.hpp>
56 :
57 : // EnergyPlus Headers
58 : #include <EnergyPlus/Data/BaseData.hh>
59 : #include <EnergyPlus/DataGlobals.hh>
60 : #include <EnergyPlus/EnergyPlus.hh>
61 : #include <EnergyPlus/GroundTemperatureModeling/BaseGroundTemperatureModel.hh>
62 : #include <EnergyPlus/Plant/Enums.hh>
63 : #include <EnergyPlus/Plant/PlantLocation.hh>
64 : #include <EnergyPlus/PlantComponent.hh>
65 :
66 : namespace EnergyPlus {
67 :
68 : // Forward declarations
69 : struct EnergyPlusData;
70 :
71 : namespace GroundHeatExchangers {
72 :
73 : struct ThermophysicalProps // LCOV_EXCL_LINE
74 : {
75 : // Destructor
76 146 : virtual ~ThermophysicalProps() = default;
77 :
78 : Real64 k; // Thermal conductivity [W/m-K]
79 : Real64 rho; // Density [kg/m3]
80 : Real64 cp; // Specific heat [J/kg-K]
81 : Real64 rhoCp; // Specific heat capacity [J/kg-K]
82 : Real64 diffusivity; // Thermal diffusivity [m2/s]
83 :
84 146 : ThermophysicalProps() : k(0.0), rho(0.0), cp(0.0), rhoCp(0.0), diffusivity(0.0)
85 : {
86 146 : }
87 : };
88 :
89 : struct PipeProps : ThermophysicalProps // LCOV_EXCL_LINE
90 : {
91 : // Destructor
92 58 : ~PipeProps() override = default;
93 :
94 : // Members
95 : Real64 outDia; // Outer diameter of the pipe [m]
96 : Real64 innerDia; // Inner diameter of the pipe [m]
97 : Real64 outRadius; // Outer radius of the pipe [m]
98 : Real64 innerRadius; // Inner radius of the pipe [m]
99 : Real64 thickness; // Thickness of the pipe wall [m]
100 :
101 58 : PipeProps() : outDia(0.0), innerDia(0.0), outRadius(0.0), innerRadius(0.0), thickness(0.0)
102 : {
103 58 : }
104 : };
105 :
106 : struct GLHEVertProps
107 : {
108 : // Destructor
109 28 : ~GLHEVertProps() = default;
110 :
111 : // Members
112 : std::string const moduleName = "GroundHeatExchanger:Vertical:Properties";
113 : std::string name; // Name
114 : Real64 bhTopDepth; // Depth of top of borehole {m}
115 : Real64 bhLength; // Length of borehole from top of borehole {m}
116 : Real64 bhDiameter; // Diameter of borehole {m}
117 : ThermophysicalProps grout; // Grout properties
118 : PipeProps pipe; // Pipe properties
119 : Real64 bhUTubeDist; // U-tube, shank-to-shank spacing {m}
120 :
121 9 : GLHEVertProps() : bhTopDepth(0.0), bhLength(0.0), bhDiameter(0.0), bhUTubeDist(0.0)
122 : {
123 3 : }
124 :
125 : GLHEVertProps(EnergyPlusData &state, std::string const &objName, nlohmann::json const &j);
126 : };
127 :
128 : struct MyCartesian
129 : {
130 : // Destructor
131 : ~MyCartesian() = default;
132 :
133 : Real64 x;
134 : Real64 y;
135 : Real64 z;
136 :
137 47736 : MyCartesian() : x(0.0), y(0.0), z(0.0)
138 : {
139 47736 : }
140 : };
141 :
142 : struct GLHEVertSingle
143 : {
144 : // Destructor
145 74 : ~GLHEVertSingle() = default;
146 :
147 : // Members
148 : std::string const moduleName = "GroundHeatExchanger:Vertical:Single";
149 : std::string name; // Name
150 : Real64 xLoc; // X-direction location {m}
151 : Real64 yLoc; // Y-direction location {m}
152 : Real64 dl_i; // Discretized bh length between points
153 : Real64 dl_ii; // Discretized bh length between points
154 : Real64 dl_j; // Discretized bh length between points
155 : std::shared_ptr<GLHEVertProps> props; // Properties
156 : std::vector<MyCartesian>
157 : pointLocations_i; // Discretized point locations for when computing temperature response of other boreholes on this bh
158 : std::vector<MyCartesian> pointLocations_ii; // Discretized point locations for when computing temperature response of this bh on itself
159 : std::vector<MyCartesian>
160 : pointLocations_j; // Discretized point locations for when other bh are computing the temperature response of this bh on themselves
161 :
162 180 : GLHEVertSingle() : xLoc(0.0), yLoc(0.0), dl_i(0.0), dl_ii(0.0), dl_j(0.0)
163 : {
164 60 : }
165 :
166 : GLHEVertSingle(EnergyPlusData &state, std::string const &objName, nlohmann::json const &j);
167 : };
168 :
169 : struct GLHEVertArray
170 : {
171 : // Destructor
172 16 : ~GLHEVertArray() = default;
173 :
174 : // Members
175 : std::string const moduleName = "GroundHeatExchanger:Vertical:Array";
176 : std::string name; // Name
177 : int numBHinXDirection; // Number of boreholes in X direction
178 : int numBHinYDirection; // Number of boreholes in Y direction
179 : Real64 bhSpacing; // Borehole center-to-center spacing {m}
180 : std::shared_ptr<GLHEVertProps> props; // Properties
181 :
182 : GLHEVertArray() : numBHinXDirection(0), numBHinYDirection(0), bhSpacing(0.0)
183 : {
184 : }
185 :
186 : GLHEVertArray(EnergyPlusData &state, std::string const &objName, nlohmann::json const &j);
187 : };
188 :
189 : struct GLHEResponseFactors
190 : {
191 : // Destructor
192 31 : ~GLHEResponseFactors() = default;
193 :
194 : // Members
195 : std::string const moduleName = "GroundHeatExchanger:ResponseFactors";
196 : std::string name; // Name
197 : int numBoreholes; // Number of boreholes
198 : int numGFuncPairs; // Number of g-function pairs
199 : Real64 gRefRatio; // Reference ratio of g-function set
200 : Real64 maxSimYears; // Maximum length of simulation in years
201 : std::vector<Real64> time; // response time in seconds
202 : std::vector<Real64> LNTTS; // natural log of non-dimensional time Ln(t/ts)
203 : std::vector<Real64> GFNC; // g-function (non-dimensional temperature response factors)
204 : std::shared_ptr<GLHEVertProps> props; // Properties
205 : std::vector<std::shared_ptr<GLHEVertSingle>> myBorholes; // Boreholes used by this response factors object
206 :
207 75 : GLHEResponseFactors() : numBoreholes(0), numGFuncPairs(0), gRefRatio(0.0), maxSimYears(0.0)
208 : {
209 25 : }
210 :
211 : GLHEResponseFactors(EnergyPlusData &state, std::string const &objName, nlohmann::json const &j);
212 : };
213 :
214 : struct GLHEBase : PlantComponent // LCOV_EXCL_LINE
215 : {
216 : // Destructor
217 30 : virtual ~GLHEBase() = default;
218 :
219 : // Members
220 : bool available; // need an array of logicals--load identifiers of available equipment
221 : bool on; // simulate the machine at it's operating part load ratio
222 : std::string name; // user identifier
223 : PlantLocation plantLoc;
224 : int inletNodeNum; // Node number on the inlet side of the plant
225 : int outletNodeNum; // Node number on the outlet side of the plant
226 : ThermophysicalProps soil;
227 : PipeProps pipe;
228 : ThermophysicalProps grout;
229 : std::shared_ptr<GLHEResponseFactors> myRespFactors;
230 : Real64 designFlow; // Design volumetric flow rate [m3/s]
231 : Real64 designMassFlow; // Design mass flow rate [kg/s]
232 : Real64 tempGround; // The far field temperature of the ground [degC]
233 : Array1D<Real64> QnMonthlyAgg; // Monthly aggregated normalized heat extraction/rejection rate [W/m]
234 : Array1D<Real64> QnHr; // Hourly aggregated normalized heat extraction/rejection rate [W/m]
235 : Array1D<Real64> QnSubHr; // Contains the sub-hourly heat extraction/rejection rate normalized by the total active length of bore holes [W/m]
236 : int prevHour;
237 : int AGG; // Minimum Hourly History required
238 : int SubAGG; // Minimum sub-hourly History
239 : Array1D_int LastHourN; // Stores the Previous hour's N for past hours until the minimum sub-hourly history
240 : Real64 bhTemp; // [degC]
241 : Real64 massFlowRate; // [kg/s]
242 : Real64 outletTemp; // [degC]
243 : Real64 inletTemp; // [degC]
244 : Real64 aveFluidTemp; // [degC]
245 : Real64 QGLHE; // [W] heat transfer rate
246 : bool myEnvrnFlag;
247 : bool gFunctionsExist;
248 : Real64 lastQnSubHr;
249 : Real64 HXResistance; // The thermal resistance of the GHX, (K per W/m)
250 : Real64 totalTubeLength; // The total length of pipe. NumBoreholes * BoreholeDepth OR Pi * Dcoil * NumCoils
251 : Real64 timeSS; // Steady state time
252 : Real64 timeSSFactor; // Steady state time factor for calculation
253 : GroundTemp::BaseGroundTempsModel *groundTempModel; // non-owning pointer
254 :
255 : // some statics pulled out into member variables
256 : bool firstTime;
257 : int numErrorCalls;
258 : Real64 ToutNew;
259 : int PrevN; // The saved value of N at previous time step
260 : bool updateCurSimTime; // Used to reset the CurSimTime to reset after WarmupFlag
261 : bool triggerDesignDayReset;
262 : bool needToSetupOutputVars;
263 :
264 30 : GLHEBase()
265 30 : : available(false), on(false), plantLoc{}, inletNodeNum(0), outletNodeNum(0), designFlow(0.0), designMassFlow(0.0), tempGround(0.0),
266 60 : prevHour(1), AGG(0), SubAGG(0), bhTemp(0.0), massFlowRate(0.0), outletTemp(0.0), inletTemp(0.0), aveFluidTemp(0.0), QGLHE(0.0),
267 30 : myEnvrnFlag(true), gFunctionsExist(false), lastQnSubHr(0.0), HXResistance(0.0), totalTubeLength(0.0), timeSS(0.0), timeSSFactor(0.0),
268 30 : firstTime(true), numErrorCalls(0), ToutNew(19.375), PrevN(1), updateCurSimTime(true), triggerDesignDayReset(false),
269 60 : needToSetupOutputVars(true)
270 : {
271 30 : }
272 :
273 : virtual void calcGFunctions(EnergyPlusData &state) = 0;
274 :
275 : void calcAggregateLoad(EnergyPlusData &state);
276 :
277 : void updateGHX(EnergyPlusData &state);
278 :
279 : void calcGroundHeatExchanger(EnergyPlusData &state);
280 :
281 : static inline bool isEven(int val);
282 :
283 : [[nodiscard]] Real64 interpGFunc(Real64) const;
284 :
285 : void makeThisGLHECacheAndCompareWithFileCache(EnergyPlusData &state);
286 :
287 : virtual void makeThisGLHECacheStruct() = 0;
288 :
289 : virtual void readCacheFileAndCompareWithThisGLHECache(EnergyPlusData &state) = 0;
290 :
291 : void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
292 :
293 : void simulate([[maybe_unused]] EnergyPlusData &state,
294 : const PlantLocation &calledFromLocation,
295 : bool FirstHVACIteration,
296 : Real64 &CurLoad,
297 : bool RunFlag) override;
298 :
299 : static GLHEBase *factory(EnergyPlusData &state, DataPlant::PlantEquipmentType objectType, std::string const &objectName);
300 :
301 : virtual Real64 getGFunc(Real64) = 0;
302 :
303 : virtual void initGLHESimVars(EnergyPlusData &state) = 0;
304 :
305 : virtual Real64 calcHXResistance(EnergyPlusData &state) = 0;
306 :
307 : virtual void getAnnualTimeConstant() = 0;
308 :
309 : virtual void initEnvironment(EnergyPlusData &state, Real64 CurTime) = 0;
310 :
311 : void setupOutput(EnergyPlusData &state);
312 : };
313 :
314 : enum class GFuncCalcMethod
315 : {
316 : Invalid = -1,
317 : UniformHeatFlux,
318 : UniformBoreholeWallTemp,
319 : Num
320 : };
321 :
322 : struct GLHEVert : GLHEBase // LCOV_EXCL_LINE
323 : {
324 :
325 : // Destructor
326 25 : ~GLHEVert() override = default;
327 :
328 : // Members
329 : std::string const moduleName = "GroundHeatExchanger:System";
330 : Real64 bhDiameter; // Diameter of borehole {m}
331 : Real64 bhRadius; // Radius of borehole {m}
332 : Real64 bhLength; // Length of borehole {m}
333 : Real64 bhUTubeDist; // Distance between u-tube legs {m}
334 : GFuncCalcMethod gFuncCalcMethod;
335 :
336 : // Parameters for the multipole method
337 : Real64 theta_1;
338 : Real64 theta_2;
339 : Real64 theta_3;
340 : Real64 sigma;
341 :
342 : nlohmann::json myCacheData;
343 :
344 : std::vector<Real64> GFNC_shortTimestep;
345 : std::vector<Real64> LNTTS_shortTimestep;
346 :
347 3 : GLHEVert()
348 6 : : bhDiameter(0.0), bhRadius(0.0), bhLength(0.0), bhUTubeDist(0.0), gFuncCalcMethod(GFuncCalcMethod::Invalid), theta_1(0.0), theta_2(0.0),
349 9 : theta_3(0.0), sigma(0.0)
350 : {
351 3 : }
352 :
353 : GLHEVert(EnergyPlusData &state, std::string const &objName, nlohmann::json const &j);
354 :
355 : static std::vector<Real64> distances(MyCartesian const &point_i, MyCartesian const &point_j);
356 :
357 : Real64 calcResponse(std::vector<Real64> const &dists, Real64 currTime);
358 :
359 : Real64 integral(MyCartesian const &point_i, std::shared_ptr<GLHEVertSingle> const &bh_j, Real64 currTime);
360 :
361 : Real64 doubleIntegral(std::shared_ptr<GLHEVertSingle> const &bh_i, std::shared_ptr<GLHEVertSingle> const &bh_j, Real64 currTime);
362 :
363 : void calcShortTimestepGFunctions(EnergyPlusData &state);
364 :
365 : void calcLongTimestepGFunctions(EnergyPlusData &state);
366 :
367 : void calcGFunctions(EnergyPlusData &state) override;
368 :
369 : void calcUniformHeatFluxGFunctions(EnergyPlusData &state);
370 :
371 : void calcUniformBHWallTempGFunctions(EnergyPlusData &state);
372 :
373 : Real64 calcHXResistance(EnergyPlusData &state) override;
374 :
375 : void initGLHESimVars(EnergyPlusData &state) override;
376 :
377 : void getAnnualTimeConstant() override;
378 :
379 : Real64 getGFunc(Real64 time) override;
380 :
381 : void makeThisGLHECacheStruct() override;
382 :
383 : void readCacheFileAndCompareWithThisGLHECache(EnergyPlusData &state) override;
384 :
385 : void writeGLHECacheToFile(EnergyPlusData &state) const;
386 :
387 : Real64 calcBHAverageResistance(EnergyPlusData &state);
388 :
389 : Real64 calcBHTotalInternalResistance(EnergyPlusData &state);
390 :
391 : Real64 calcBHGroutResistance(EnergyPlusData &state);
392 :
393 : Real64 calcPipeConductionResistance();
394 :
395 : Real64 calcPipeConvectionResistance(EnergyPlusData &state);
396 :
397 : static Real64 frictionFactor(Real64 reynoldsNum);
398 :
399 : Real64 calcPipeResistance(EnergyPlusData &state);
400 :
401 : void combineShortAndLongTimestepGFunctions();
402 :
403 : void initEnvironment(EnergyPlusData &state, [[maybe_unused]] Real64 CurTime) override;
404 :
405 : void oneTimeInit(EnergyPlusData &state) override;
406 :
407 : void oneTimeInit_new(EnergyPlusData &state) override;
408 :
409 : void setupTimeVectors();
410 : };
411 :
412 : struct GLHESlinky : GLHEBase // LCOV_EXCL_LINE
413 : {
414 :
415 : // Destructor
416 5 : ~GLHESlinky() override = default;
417 :
418 : // Members
419 : std::string const moduleName = "GroundHeatExchanger:Slinky";
420 : bool verticalConfig; // HX Configuration Flag
421 : Real64 coilDiameter; // Diameter of the slinky coils [m]
422 : Real64 coilPitch; // Center-to-center slinky coil spacing [m]
423 : Real64 coilDepth; // Average depth of the coil [m]
424 : Real64 trenchDepth; // Trench depth from ground surface to trench bottom [m]
425 : Real64 trenchLength; // Length of single trench [m]
426 : int numTrenches; // Number of parallel trenches [m]
427 : Real64 trenchSpacing; // Spacing between parallel trenches [m]
428 : int numCoils; // Number of coils
429 : int monthOfMinSurfTemp;
430 : Real64 maxSimYears;
431 : Real64 minSurfTemp;
432 : Array1D<Real64> X0;
433 : Array1D<Real64> Y0;
434 : Real64 Z0;
435 :
436 4 : GLHESlinky()
437 8 : : verticalConfig(false), coilDiameter(0.0), coilPitch(0.0), coilDepth(0.0), trenchDepth(0.0), trenchLength(0.0), numTrenches(0),
438 12 : trenchSpacing(0.0), numCoils(0), monthOfMinSurfTemp(0), maxSimYears(0.0), minSurfTemp(0.0), Z0(0.0)
439 : {
440 4 : }
441 :
442 : GLHESlinky(EnergyPlusData &state, std::string const &objName, nlohmann::json const &j);
443 :
444 : Real64 calcHXResistance(EnergyPlusData &state) override;
445 :
446 : void calcGFunctions(EnergyPlusData &state) override;
447 :
448 : void initGLHESimVars(EnergyPlusData &state) override;
449 :
450 : void getAnnualTimeConstant() override;
451 :
452 : Real64 doubleIntegral(int m, int n, int m1, int n1, Real64 t, int I0, int J0);
453 :
454 : Real64 integral(int m, int n, int m1, int n1, Real64 t, Real64 eta, int J0);
455 :
456 : Real64 distance(int m, int n, int m1, int n1, Real64 eta, Real64 theta);
457 :
458 : Real64 distanceToFictRing(int m, int n, int m1, int n1, Real64 eta, Real64 theta);
459 :
460 : Real64 distToCenter(int m, int n, int m1, int n1);
461 :
462 : Real64 nearFieldResponseFunction(int m, int n, int m1, int n1, Real64 eta, Real64 theta, Real64 t);
463 :
464 : Real64 midFieldResponseFunction(int m, int n, int m1, int n1, Real64 t);
465 :
466 : Real64 getGFunc(Real64 time) override;
467 :
468 : void makeThisGLHECacheStruct() override;
469 :
470 : void readCacheFileAndCompareWithThisGLHECache(EnergyPlusData &state) override;
471 :
472 : void initEnvironment(EnergyPlusData &state, Real64 CurTime) override;
473 :
474 : void oneTimeInit(EnergyPlusData &state) override;
475 :
476 : void oneTimeInit_new(EnergyPlusData &state) override;
477 : };
478 :
479 : void GetGroundHeatExchangerInput(EnergyPlusData &state);
480 :
481 : std::shared_ptr<GLHEResponseFactors> BuildAndGetResponseFactorObjectFromArray(EnergyPlusData &state,
482 : std::shared_ptr<GLHEVertArray> const &arrayObjectPtr);
483 :
484 : std::shared_ptr<GLHEResponseFactors>
485 : BuildAndGetResponseFactorsObjectFromSingleBHs(EnergyPlusData &state, std::vector<std::shared_ptr<GLHEVertSingle>> const &singleBHsForRFVect);
486 :
487 : void SetupBHPointsForResponseFactorsObject(const std::shared_ptr<GLHEResponseFactors> &thisRF);
488 :
489 : std::shared_ptr<GLHEResponseFactors> GetResponseFactor(EnergyPlusData &state, std::string const &objectName);
490 :
491 : std::shared_ptr<GLHEVertSingle> GetSingleBH(EnergyPlusData &state, std::string const &objectName);
492 :
493 : std::shared_ptr<GLHEVertProps> GetVertProps(EnergyPlusData &state, std::string const &objectName);
494 :
495 : std::shared_ptr<GLHEVertArray> GetVertArray(EnergyPlusData &state, std::string const &objectName);
496 :
497 : std::vector<Real64> TDMA(std::vector<Real64> const &a, std::vector<Real64> const &b, std::vector<Real64> &c, std::vector<Real64> &d);
498 :
499 : } // namespace GroundHeatExchangers
500 :
501 : struct GroundHeatExchangerData : BaseGlobalStruct
502 : {
503 :
504 : int numVerticalGLHEs = 0;
505 : int numSlinkyGLHEs = 0;
506 : int numVertArray = 0;
507 : int numVertProps = 0;
508 : int numResponseFactors = 0;
509 : int numSingleBorehole = 0;
510 : int N = 1; // COUNTER OF TIME STEP
511 : Real64 currentSimTime = 0.0; // Current simulation time in hours
512 : int locHourOfDay = 0;
513 : int locDayOfSim = 0;
514 : bool GetInput = true;
515 : int numAutoGeneratedResponseFactors = 0;
516 :
517 : Array1D<Real64> prevTimeSteps; // This is used to store only the Last Few time step's time
518 : // to enable the calculation of the sub-hourly contribution..
519 : // Recommended size, the product of Minimum sub-hourly history required and
520 : // the maximum no of system time steps in an hour
521 :
522 : // Object Data
523 : std::vector<GroundHeatExchangers::GLHEVert> verticalGLHE;
524 : std::vector<GroundHeatExchangers::GLHESlinky> slinkyGLHE;
525 : std::vector<std::shared_ptr<GroundHeatExchangers::GLHEVertArray>> vertArraysVector;
526 : std::vector<std::shared_ptr<GroundHeatExchangers::GLHEVertProps>> vertPropsVector;
527 : std::vector<std::shared_ptr<GroundHeatExchangers::GLHEResponseFactors>> responseFactorsVector;
528 : std::vector<std::shared_ptr<GroundHeatExchangers::GLHEVertSingle>> singleBoreholesVector;
529 :
530 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
531 : {
532 2126 : }
533 :
534 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
535 : {
536 1152 : }
537 :
538 2100 : void clear_state() override
539 : {
540 2100 : this->numVerticalGLHEs = 0;
541 2100 : this->numSlinkyGLHEs = 0;
542 2100 : this->numVertArray = 0;
543 2100 : this->numVertProps = 0;
544 2100 : this->numResponseFactors = 0;
545 2100 : this->numSingleBorehole = 0;
546 2100 : this->N = 1;
547 2100 : this->currentSimTime = 0.0;
548 2100 : this->locHourOfDay = 0;
549 2100 : this->locDayOfSim = 0;
550 2100 : this->GetInput = true;
551 2100 : this->numAutoGeneratedResponseFactors = 0;
552 2100 : this->prevTimeSteps.deallocate();
553 2100 : this->verticalGLHE.clear();
554 2100 : this->slinkyGLHE.clear();
555 2100 : this->vertArraysVector.clear();
556 2100 : this->vertPropsVector.clear();
557 2100 : this->responseFactorsVector.clear();
558 2100 : this->singleBoreholesVector.clear();
559 2100 : }
560 : };
561 :
562 : } // namespace EnergyPlus
563 :
564 : #endif
|