LCOV - code coverage report
Current view: top level - EnergyPlus - EcoRoofManager.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 1 54 1.9 %
Date: 2023-01-17 19:17:23 Functions: 1 2 50.0 %

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

Generated by: LCOV version 1.13