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 EcoRoofManager_hh_INCLUDED
49 : #define EcoRoofManager_hh_INCLUDED
50 :
51 : // EnergyPlus Headers
52 : #include <EnergyPlus/Data/BaseData.hh>
53 : #include <EnergyPlus/EnergyPlus.hh>
54 :
55 : namespace EnergyPlus {
56 :
57 : // Forward declarations
58 : struct EnergyPlusData;
59 :
60 : namespace EcoRoofManager {
61 :
62 : // Functions
63 :
64 : void CalcEcoRoof(EnergyPlusData &state,
65 : int const SurfNum, // Indicator of Surface Number for the current surface
66 : int const ConstrNum, // Indicator for construction index for the current surface
67 : Real64 &TempExt // Exterior temperature boundary condition
68 : );
69 :
70 : void initEcoRoofFirstTime(EnergyPlusData &state, int const SurfNum, int const ConstrNum);
71 :
72 : void initEcoRoof(EnergyPlusData &state, int const SurfNum, int const ConstrNum);
73 :
74 : void UpdateSoilProps(EnergyPlusData &state,
75 : Real64 &Moisture,
76 : Real64 &MeanRootMoisture,
77 : Real64 const MoistureMax,
78 : Real64 const MoistureResidual,
79 : Real64 const SoilThickness,
80 : Real64 const Vfluxf, // Water mass flux from vegetation [m/s]
81 : Real64 const Vfluxg, // Water mass flux from soil surface [m/s]
82 : int const ConstrNum, // Indicator for construction index for the current surface
83 : Real64 &Alphag,
84 : int const unit, // unused1208
85 : Real64 const Tg, // unused1208
86 : Real64 const Tf, // unused1208
87 : Real64 const Qsoil // unused1208
88 : );
89 :
90 : void CalculateEcoRoofSolar(EnergyPlusData &state,
91 : Real64 &RS, // Solar radiation on a horizontal surface (roof)
92 : Real64 &f1, // Solar term in Stomatal Resistance
93 : int const SurfNum);
94 :
95 : } // namespace EcoRoofManager
96 :
97 : struct EcoRoofManagerData : BaseGlobalStruct
98 : {
99 :
100 : Real64 CumRunoff; // Cumulative runoff, updated each time step (m) mult by roof area to get volume
101 : Real64 CumET; // Cumulative evapotranspiration from soil and plants (m)
102 : Real64 CumPrecip;
103 : Real64 CumIrrigation; // Cumulative irrigation, updated each time step (m) mult by roof area to get volume
104 : std::array<Real64, 12> MonthlyIrrigation = {0.0}; // accumulator for monthly irrigation ActualAmount in mm
105 : Real64 CurrentRunoff;
106 : Real64 CurrentET;
107 : Real64 CurrentPrecipitation; // units of (m) per timestep
108 : Real64 CurrentIrrigation; // units of (m) per timestep
109 :
110 : Real64 Tfold; // leaf temperature from the previous time step
111 : Real64 Tgold; // ground temperature from the previous time step
112 : bool EcoRoofbeginFlag = true;
113 : bool CalcEcoRoofMyEnvrnFlag = true;
114 :
115 : // static variables extracted from functions
116 : int FirstEcoSurf = 0; // Indicates lowest numbered surface that is an ecoroof, used to determine WHEN to updatesoilProps...
117 : bool QuickConductionSurf = false; // indicator for quick conduction surface
118 : Real64 LAI = 0.2; // Leaf area index
119 : Real64 epsilonf = 0.95; // Leaf Emisivity
120 : Real64 epsilong = 0.95; // Soil Emisivity
121 : Real64 Alphag = 0.3; // Ground Albedo
122 : Real64 Alphaf = 0.2; // Leaf Albedo (reflectivity to solar radiation)
123 : Real64 e0 = 2.0; // Windless lower limit of exchange coefficient (from FASST docs)
124 : Real64 RH = 50.0; // Relative humidity (%)
125 : Real64 Pa = 101325.0; // Atmospheric Pressure (PA)
126 : Real64 Tg = 10.0; // Ground Surface temperature C ***** FROM PREVIOUS TIME STEP
127 : Real64 Tf = 10.0; // Leaf temperature C ***** FROM PREVIOUS TIME STEP
128 : Real64 Zf = 0.2; // Height of plants (m)
129 : // DJS Oct 2007 release - note I got rid of the initialization of moisture and meanrootmoisture here as these
130 : // values are now set at beginning of each new DD and each new warm-up loop.
131 : Real64 Moisture = 0.0; // m^3/m^3.The moisture content in the soil is the value provided by a user
132 : Real64 MoistureResidual =
133 : 0.05; // m^3/m^3. Residual & maximum water contents are unique to each material. See Frankenstein et al (2004b) for data.
134 : Real64 MoistureMax = 0.5; // Maximum volumetric moisture content (porosity) m^3/m^3
135 : Real64 MeanRootMoisture = 0.0; // Mean value of root moisture m^3/m^3
136 : Real64 SoilThickness = 0.2; // Soil thickness (m)
137 : Real64 StomatalResistanceMin = 0.0; // s/m . ! Minimum stomatal resistance is unique for each veg. type.
138 : Real64 f3 = 1.0; // As the value of gd for tall grass is 0, then f3 = 1
139 : // ECMWF 2002 CY25R1 report has gd=0.0 for all veg except trees where gd=0.03.
140 : Real64 Zog = 0.001; // Ground roughness length scale (m)
141 : Real64 Za = 2.0; // Instrument height where atmospheric wind speed is measured (m)
142 : Real64 Lf = 0.0; // latent heat flux
143 : Real64 Vfluxf = 0.0; // Water evapotr. rate associated with latent heat from vegetation [m/s]
144 : Real64 Qsoil = 0.0; // heat flux from the soil layer
145 : Real64 sheatf = 0.0; // sensible heat flux coeff for foliage (W/m^2K)
146 : Real64 sensiblef = 0.0; // sensible heat transfer TO foliage (W/m^2) DJS Jan 2011
147 : Real64 sheatg = 0.0; // intermediate calculation variable - sensible flux coef (W/m^2K for ground)
148 : Real64 sensibleg = 0.0; // sensible heat flux TO ground (w/m^2) DJS Jan 2011
149 : Real64 Lg = 0.0; // latent heat flux from ground surface
150 : Real64 Vfluxg = 0.0; // Water evapotr. rate associated with latent heat from ground surface [m/s]
151 : Real64 TopDepth = 0.0; // Thickness of "near-surface" soil layer
152 : Real64 RootDepth = 0.0; // Thickness of "root zone" soil layer //Autodesk Was used uninitialized
153 : // Note TopDepth+RootDepth = thickness of ecoroof soil layer
154 : Real64 TimeStepZoneSec = 0.0; // Seconds per TimeStep
155 : Real64 DryCond = 0.0; // Dry soil value of conductivity
156 : Real64 DryDens = 0.0; // Dry soil value of density
157 : Real64 DryAbsorp = 0.0; // Dry soil value of solar absorptance (1-albedo)
158 : Real64 DrySpecHeat = 0.0; // Dry soil value of specific heat
159 : bool UpdatebeginFlag = true; // one time flag
160 : Real64 CapillaryPotentialTop = -3.8997; // This variable keeps track of the capillary potential of the soil in both layers and time (m)
161 : Real64 CapillaryPotentialRoot = -3.8997; // This variable keeps track of the capillary potential of the soil in both layers and time (m)
162 : Real64 SoilHydroConductivityTop = 8.72e-6; // This is the soil water conductivity in the soil (m/s)
163 : Real64 SoilHydroConductivityRoot = 8.72e-6; // This is the soil water conductivity in the soil (m/s)
164 : Real64 SoilConductivityAveTop = 8.72e-6; // This is the average soil water conductivity (m/s)
165 : Real64 SoilConductivityAveRoot = 8.72e-6;
166 : Real64 RelativeSoilSaturationTop =
167 : 0.0; // Relative Soil Saturation (soil moisture-residual soil moisture)/(saturation soil moisture-residual soil moisture)
168 : Real64 RelativeSoilSaturationRoot = 0.0;
169 : Real64 TestMoisture = 0.15; // This makes sure that the moisture cannot change by too much in each step
170 : int ErrIndex = 0;
171 :
172 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
173 : {
174 2126 : }
175 :
176 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
177 : {
178 1152 : }
179 :
180 2100 : void clear_state() override
181 : {
182 2100 : this->EcoRoofbeginFlag = true;
183 2100 : this->CalcEcoRoofMyEnvrnFlag = true;
184 2100 : this->FirstEcoSurf = 0;
185 2100 : this->QuickConductionSurf = false;
186 2100 : this->LAI = 0.2;
187 2100 : this->epsilonf = 0.95;
188 2100 : this->epsilong = 0.95;
189 2100 : this->Alphag = 0.3;
190 2100 : this->Alphaf = 0.2;
191 2100 : this->e0 = 2.0;
192 2100 : this->RH = 50.0;
193 2100 : this->Pa = 101325.0;
194 2100 : this->Tg = 10.0;
195 2100 : this->Tf = 10.0;
196 2100 : this->Zf = 0.2;
197 2100 : this->Moisture = 0.0;
198 2100 : this->MoistureResidual = 0.05;
199 2100 : this->MoistureMax = 0.5;
200 2100 : this->MeanRootMoisture = 0.0;
201 2100 : this->SoilThickness = 0.2;
202 2100 : this->StomatalResistanceMin = 0.0;
203 2100 : this->f3 = 1.0;
204 2100 : this->Zog = 0.001;
205 2100 : this->Za = 2.0;
206 2100 : this->Lf = 0.0;
207 2100 : this->Vfluxf = 0.0;
208 2100 : this->Qsoil = 0.0;
209 2100 : this->sheatf = 0.0;
210 2100 : this->sensiblef = 0.0;
211 2100 : this->sheatg = 0.0;
212 2100 : this->sensibleg = 0.0;
213 2100 : this->Lg = 0.0;
214 2100 : this->Vfluxg = 0.0;
215 2100 : this->TopDepth = 0.0;
216 2100 : this->RootDepth = 0.0;
217 : // Note TopDepth+RootDepth = thickness of e
218 2100 : this->TimeStepZoneSec = 0.0;
219 2100 : this->DryCond = 0.0;
220 2100 : this->DryDens = 0.0;
221 2100 : this->DryAbsorp = 0.0;
222 2100 : this->DrySpecHeat = 0.0;
223 2100 : this->UpdatebeginFlag = true;
224 2100 : this->CapillaryPotentialTop = -3.8997;
225 2100 : this->CapillaryPotentialRoot = -3.8997;
226 2100 : this->SoilHydroConductivityTop = 8.72e-6;
227 2100 : this->SoilHydroConductivityRoot = 8.72e-6;
228 2100 : this->SoilConductivityAveTop = 8.72e-6;
229 2100 : this->SoilConductivityAveRoot = 8.72e-6;
230 2100 : this->RelativeSoilSaturationTop = 0.0;
231 2100 : this->RelativeSoilSaturationRoot = 0.0;
232 2100 : this->TestMoisture = 0.15;
233 2100 : this->ErrIndex = 0;
234 2100 : }
235 : };
236 :
237 : } // namespace EnergyPlus
238 :
239 : #endif
|