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 SurfaceGroundHeatExchanger_hh_INCLUDED
49 : #define SurfaceGroundHeatExchanger_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/DataGlobalConstants.hh>
56 : #include <EnergyPlus/DataGlobals.hh>
57 : #include <EnergyPlus/EnergyPlus.hh>
58 : #include <EnergyPlus/PlantComponent.hh>
59 :
60 : namespace EnergyPlus {
61 :
62 : // Forward declarations
63 : struct EnergyPlusData;
64 :
65 : namespace SurfaceGroundHeatExchanger {
66 :
67 1 : struct SurfaceGroundHeatExchangerData : PlantComponent
68 : {
69 2 : ~SurfaceGroundHeatExchangerData() = default;
70 :
71 : std::string Name; // name of surface GHE
72 : std::string ConstructionName; // name of the associated construction
73 : std::string InletNode; // surface GHE inlet fluid node
74 : std::string OutletNode; // surface GHE outlet fluid node
75 : Real64 DesignMassFlowRate;
76 : Real64 TubeDiameter; // hydronic tube inside diameter
77 : Real64 TubeSpacing; // tube spacing
78 : Real64 SurfaceLength; // active length of surface GHE
79 : Real64 SurfaceWidth; // active width of surface GHE
80 : Real64 TopThermAbs; // Thermal absortivity of top layer
81 : Real64 TopSolarAbs; // solar absortivity of top layer
82 : Real64 BtmThermAbs; // Thermal absortivity of bottom layer
83 : int LowerSurfCond; // Type of lower surf. boundary condition
84 : int TubeCircuits; // number of circuits in total
85 : int ConstructionNum; // construction index number
86 : int InletNodeNum; // inlet node number
87 : int OutletNodeNum; // oulet node number
88 : DataSurfaces::SurfaceRoughness TopRoughness; // roughness of top layer
89 : DataSurfaces::SurfaceRoughness BtmRoughness; // roughness of bottom layer
90 : int FrozenErrIndex1; // recurring error index
91 : int FrozenErrIndex2; // recurring error index
92 : int ConvErrIndex1; // recurring error index
93 : int ConvErrIndex2; // recurring error index
94 : int ConvErrIndex3; // recurring error index
95 : // loop topology variables
96 : PlantLocation plantLoc;
97 :
98 : // QTF Constants
99 : Real64 TsrcConstCoef;
100 : Real64 TsrcVarCoef;
101 : Real64 QbtmConstCoef;
102 : Real64 QbtmVarCoef;
103 : Real64 QtopConstCoef;
104 : Real64 QtopVarCoef;
105 : // conventional CTF terms
106 : int NumCTFTerms; // number of terms for surface
107 : // could be allocated rather than hard dimensioning.
108 : Array1D<Real64> CTFin; // surf flux in ctf - X
109 : Array1D<Real64> CTFout; // surf flux in ctf - Z
110 : Array1D<Real64> CTFcross; // surf flux in ctf - Y
111 : Array1D<Real64> CTFflux; // surf flux in ctf - F
112 : // QTF coefficients
113 : Array1D<Real64> CTFSourceIn; // surf flux in ctf - Wi
114 : Array1D<Real64> CTFSourceOut; // surf flux out ctf - Wo
115 : Array1D<Real64> CTFTSourceOut; // surf flux in qtf - x
116 : Array1D<Real64> CTFTSourceIn; // surf flux in qtf - y
117 : Array1D<Real64> CTFTSourceQ; // surf flux in qtf - f
118 : // History data
119 : Array1D<Real64> TbtmHistory;
120 : Array1D<Real64> TtopHistory;
121 : Array1D<Real64> TsrcHistory;
122 : Array1D<Real64> QbtmHistory;
123 : Array1D<Real64> QtopHistory;
124 : Array1D<Real64> QsrcHistory;
125 : Real64 QSrc;
126 : Real64 QSrcAvg;
127 : Real64 LastQSrc;
128 : Real64 LastSysTimeElapsed;
129 : Real64 LastTimeStepSys;
130 :
131 : // Report data
132 : Real64 InletTemp; // water inlet temperature
133 : Real64 OutletTemp; // water outlet temperature
134 : Real64 MassFlowRate; // water mass flow rate
135 : Real64 TopSurfaceTemp; // Top surface temperature
136 : Real64 BtmSurfaceTemp; // Bottom surface temperature
137 : Real64 TopSurfaceFlux; // Top surface heat flux
138 : Real64 BtmSurfaceFlux; // Bottom surface heat flux
139 : Real64 HeatTransferRate; // total fluid heat transfer rate, Watts
140 : Real64 SurfHeatTransferRate; // total surface heat transfer rate, Watts
141 : Real64 Energy; // cumulative energy, Joules
142 : Real64 SurfEnergy; // cumulative energy, Joules
143 : Real64 SourceTemp; // Source temperature
144 :
145 : bool MyFlag;
146 : bool InitQTF;
147 : bool MyEnvrnFlag;
148 : Real64 SurfaceArea; // surface GHE surface area
149 : bool firstTimeThrough;
150 :
151 : // Default Constructor
152 1 : SurfaceGroundHeatExchangerData()
153 1 : : DesignMassFlowRate(0.0), TubeDiameter(0.0), TubeSpacing(0.0), SurfaceLength(0.0), SurfaceWidth(0.0), TopThermAbs(0.0), TopSolarAbs(0.0),
154 : BtmThermAbs(0.0), LowerSurfCond(0), TubeCircuits(0), ConstructionNum(0), InletNodeNum(0), OutletNodeNum(0),
155 : TopRoughness(DataSurfaces::SurfaceRoughness::Invalid), BtmRoughness(DataSurfaces::SurfaceRoughness::Invalid), FrozenErrIndex1(0),
156 : FrozenErrIndex2(0), ConvErrIndex1(0), ConvErrIndex2(0), ConvErrIndex3(0), plantLoc{}, TsrcConstCoef(0.0), TsrcVarCoef(0.0),
157 : QbtmConstCoef(0.0), QbtmVarCoef(0.0), QtopConstCoef(0.0), QtopVarCoef(0.0), NumCTFTerms(0),
158 : CTFin({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0), CTFout({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0),
159 : CTFcross({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0), CTFflux({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0),
160 : CTFSourceIn({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0), CTFSourceOut({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0),
161 : CTFTSourceOut({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0), CTFTSourceIn({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0),
162 : CTFTSourceQ({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0), TbtmHistory({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0),
163 : TtopHistory({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0), TsrcHistory({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0),
164 : QbtmHistory({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0), QtopHistory({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0),
165 : QsrcHistory({0, DataGlobalConstants::MaxCTFTerms - 1}, 0.0), QSrc(0.0), QSrcAvg(0.0), LastQSrc(0.0), LastSysTimeElapsed(0.0),
166 : LastTimeStepSys(0.0),
167 :
168 : InletTemp(0.0), OutletTemp(0.0), MassFlowRate(0.0), TopSurfaceTemp(0.0), BtmSurfaceTemp(0.0), TopSurfaceFlux(0.0), BtmSurfaceFlux(0.0),
169 : HeatTransferRate(0.0), SurfHeatTransferRate(0.0), Energy(0.0), SurfEnergy(0.0), SourceTemp(0.0),
170 :
171 1 : MyFlag(true), InitQTF(true), MyEnvrnFlag(true), SurfaceArea(0.0), firstTimeThrough(true)
172 : {
173 1 : }
174 :
175 : void simulate([[maybe_unused]] EnergyPlusData &state,
176 : const PlantLocation &calledFromLocation,
177 : bool FirstHVACIteration,
178 : Real64 &CurLoad,
179 : bool RunFlag) override;
180 :
181 : static PlantComponent *factory(EnergyPlusData &state, DataPlant::PlantEquipmentType objectType, std::string objectName);
182 :
183 : void InitSurfaceGroundHeatExchanger(EnergyPlusData &state);
184 :
185 : //==============================================================================
186 :
187 : void CalcSurfaceGroundHeatExchanger(EnergyPlusData &state, bool FirstHVACIteration // TRUE if 1st HVAC simulation of system timestep
188 : );
189 :
190 : //==============================================================================
191 :
192 : void CalcBottomFluxCoefficents(Real64 Tbottom, // current bottom (lower) surface temperature
193 : Real64 Ttop // current top (upper) surface temperature
194 : );
195 :
196 : //==============================================================================
197 :
198 : void CalcTopFluxCoefficents(Real64 Tbottom, // current bottom (lower) surface temperature
199 : Real64 Ttop // current top (upper) surface temperature
200 : );
201 :
202 : //==============================================================================
203 :
204 : void CalcSourceTempCoefficents(Real64 Tbottom, // current bottom (lower) surface temperature
205 : Real64 Ttop // current top (upper) surface temperature
206 : );
207 :
208 : //==============================================================================
209 :
210 : Real64 CalcSourceFlux(EnergyPlusData &state); // component number
211 :
212 : //==============================================================================
213 :
214 : void UpdateHistories(Real64 TopFlux, // current top (top) surface flux
215 : Real64 BottomFlux, // current bottom (bottom) surface flux
216 : Real64 SourceFlux, // current source surface flux
217 : Real64 SourceTemp // current source temperature
218 : );
219 :
220 : //==============================================================================
221 :
222 : Real64 CalcHXEffectTerm(EnergyPlusData &state,
223 : Real64 Temperature, // Temperature of water entering the surface, in C
224 : Real64 WaterMassFlow // Mass flow rate, in kg/s
225 : );
226 :
227 : //==============================================================================
228 :
229 : void CalcTopSurfTemp(Real64 FluxTop, // top surface flux
230 : Real64 &TempTop, // top surface temperature
231 : Real64 ThisDryBulb, // dry bulb temperature
232 : Real64 ThisWetBulb, // wet bulb temperature
233 : Real64 ThisSkyTemp, // sky temperature
234 : Real64 ThisBeamSolarRad, // beam solar radiation
235 : Real64 ThisDifSolarRad, // diffuse solar radiation
236 : Real64 ThisSolarDirCosVert, // vertical component of solar normal
237 : Real64 ThisWindSpeed, // wind speed
238 : bool ThisIsRain, // rain flag
239 : bool ThisIsSnow // snow flag
240 : );
241 :
242 : //==============================================================================
243 :
244 : void CalcBottomSurfTemp(Real64 FluxBtm, // bottom surface flux
245 : Real64 &TempBtm, // bottom surface temperature
246 : Real64 ThisDryBulb, // dry bulb temperature
247 : Real64 ThisWindSpeed, // wind speed
248 : Real64 ThisGroundTemp // ground temperature
249 : );
250 :
251 : //==============================================================================
252 :
253 : void UpdateSurfaceGroundHeatExchngr(EnergyPlusData &state); // Index for the surface
254 :
255 : //==============================================================================
256 :
257 : void ReportSurfaceGroundHeatExchngr(EnergyPlusData &state); // Index for the surface under consideration
258 :
259 : //==============================================================================
260 :
261 : void oneTimeInit(EnergyPlusData &state) override; // Empty function for pure virtual oneTimeInitFlag function
262 :
263 : void oneTimeInit_new(EnergyPlusData &state) override; // Empty function for pure virtual oneTimeInitFlag function
264 : };
265 :
266 : void GetSurfaceGroundHeatExchanger(EnergyPlusData &state);
267 :
268 : //==============================================================================
269 :
270 : } // namespace SurfaceGroundHeatExchanger
271 :
272 771 : struct SurfaceGroundHeatExchangersData : BaseGlobalStruct
273 : {
274 :
275 : // utility variables initialized once
276 : bool NoSurfaceGroundTempObjWarning = true; // This will cause a warning to be issued if no "surface" ground
277 : Real64 FlowRate = 0.0; // water mass flow rate
278 : Real64 TopSurfTemp = 0.0; // Top surface temperature
279 : Real64 BtmSurfTemp = 0.0; // Bottom surface temperature
280 : Real64 TopSurfFlux = 0.0; // Top surface heat flux
281 : Real64 BtmSurfFlux = 0.0; // Bottom surface heat flux
282 : Real64 SourceFlux = 0.0; // total heat transfer rate, Watts
283 : Array1D_bool CheckEquipName;
284 :
285 : // weather data records updated every zone time step
286 : Real64 PastBeamSolarRad = 0.0; // Previous beam normal solar irradiance
287 : Real64 PastSolarDirCosVert = 0.0; // Previous vertical component of solar normal
288 : Real64 PastDifSolarRad = 0.0; // Previous sky diffuse solar horizontal irradiance
289 : Real64 PastGroundTemp = 0.0; // Previous ground temperature
290 : bool PastIsRain = false; // Previous Surfaces are wet for this time interval
291 : bool PastIsSnow = false; // Previous Snow on the ground for this time interval
292 : Real64 PastOutDryBulbTemp = 0.0; // Previous outdoor air dry bulb temperature
293 : Real64 PastOutWetBulbTemp = 0.0; // Previous outdoor air wet bulb temperature
294 : Real64 PastSkyTemp = 0.0; // Previous sky temperature
295 : Real64 PastWindSpeed = 0.0; // Previous outdoor air wind speed
296 :
297 : bool GetInputFlag = true;
298 :
299 : // time keeping variables used for keeping track of average flux over each time step
300 : Array1D<Real64> QRadSysSrcAvg; // Average source over the time step
301 : Array1D<Real64> LastSysTimeElapsed; // record of system time
302 : Array1D<Real64> LastTimeStepSys; // previous time step size
303 : bool InitializeTempTop = false;
304 :
305 : Array1D<SurfaceGroundHeatExchanger::SurfaceGroundHeatExchangerData> SurfaceGHE;
306 : Real64 FluxTop; // top surface flux
307 : Real64 FluxBtm; // bottom surface flux
308 : Real64 TempBtm; // bottom surface temp
309 : Real64 TempTop; // top surface temp
310 :
311 0 : void clear_state() override
312 : {
313 0 : NoSurfaceGroundTempObjWarning = true;
314 0 : FlowRate = 0.0;
315 0 : TopSurfTemp = 0.0;
316 0 : BtmSurfTemp = 0.0;
317 0 : TopSurfFlux = 0.0;
318 0 : BtmSurfFlux = 0.0;
319 0 : SourceFlux = 0.0;
320 0 : CheckEquipName.clear();
321 0 : PastBeamSolarRad = 0.0;
322 0 : PastSolarDirCosVert = 0.0;
323 0 : PastDifSolarRad = 0.0;
324 0 : PastGroundTemp = 0.0;
325 0 : PastIsRain = false;
326 0 : PastIsSnow = false;
327 0 : PastOutDryBulbTemp = 0.0;
328 0 : PastOutWetBulbTemp = 0.0;
329 0 : PastSkyTemp = 0.0;
330 0 : PastWindSpeed = 0.0;
331 0 : GetInputFlag = true;
332 0 : QRadSysSrcAvg.clear();
333 0 : LastSysTimeElapsed.clear();
334 0 : LastTimeStepSys.clear();
335 0 : InitializeTempTop = false;
336 0 : SurfaceGHE.clear();
337 0 : }
338 :
339 : // Default Constructor
340 771 : SurfaceGroundHeatExchangersData() = default;
341 : };
342 : } // namespace EnergyPlus
343 :
344 : #endif
|