LCOV - code coverage report
Current view: top level - EnergyPlus - DataWater.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 90.5 % 42 38
Test Date: 2025-05-22 16:09:37 Functions: 87.5 % 8 7

            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 DataWater_hh_INCLUDED
      49              : #define DataWater_hh_INCLUDED
      50              : 
      51              : // ObjexxFCL Headers
      52              : #include <ObjexxFCL/Array1D.hh>
      53              : 
      54              : // EnergyPlus Headers
      55              : #include <EnergyPlus/Data/BaseData.hh>
      56              : #include <EnergyPlus/DataGlobals.hh>
      57              : #include <EnergyPlus/EnergyPlus.hh>
      58              : 
      59              : namespace EnergyPlus {
      60              : 
      61              : namespace DataWater {
      62              : 
      63              :     enum class TankThermalMode
      64              :     {
      65              :         Invalid = -1,
      66              :         Scheduled,   // tank water temperature is user input via schedule
      67              :         ZoneCoupled, // tank water temperature is modeled using simple UA
      68              :         Num
      69              :     };
      70              : 
      71              :     enum class RainfallMode
      72              :     {
      73              :         Invalid = -1,
      74              :         None,
      75              :         RainSchedDesign, // mode of Rainfall determination is Scheduled Design
      76              :         EPWPrecipitation,
      77              :         Num
      78              :     };
      79              : 
      80              :     enum class IrrigationMode
      81              :     {
      82              :         Invalid = -1,
      83              :         SchedDesign, // mode of Irrigation determination is Scheduled Design
      84              :         SmartSched,  // mode of irrigation
      85              :         Num
      86              :     };
      87              : 
      88              :     enum class RainLossFactor
      89              :     {
      90              :         Invalid = -1,
      91              :         Constant,
      92              :         Scheduled,
      93              :         Num
      94              :     };
      95              : 
      96              :     enum class AmbientTempType
      97              :     {
      98              :         Invalid = -1,
      99              :         Schedule, // ambient temperature around tank (or HPWH inlet air) is scheduled
     100              :         Zone,     // tank is located in a zone or HPWH inlet air is zone air only
     101              :         Exterior, // tank is located outdoors or HPWH inlet air is outdoor air only
     102              :         Num
     103              :     };
     104              : 
     105              :     enum class GroundWaterTable
     106              :     {
     107              :         Invalid = -1,
     108              :         Constant,
     109              :         Scheduled,
     110              :         Num
     111              :     };
     112              : 
     113              :     enum class ControlSupplyType
     114              :     {
     115              :         Invalid = -1,
     116              :         NoControlLevel,
     117              :         MainsFloatValve,
     118              :         WellFloatValve,
     119              :         WellFloatMainsBackup,
     120              :         OtherTankFloatValve,
     121              :         TankMainsBackup,
     122              :         Num
     123              :     };
     124              : 
     125              :     enum class Overflow
     126              :     {
     127              :         Invalid = -1,
     128              :         Discarded,
     129              :         ToTank,
     130              :         Num
     131              :     };
     132              : 
     133              :     struct StorageTankDataStruct
     134              :     {
     135              :         // Members
     136              :         // user input data
     137              :         std::string Name;                   // name of this Storage Tank
     138              :         std::string QualitySubCategoryName; // name of water subcategory
     139              :         //   INTEGER                      :: QualitySubCategory = 0 !
     140              :         Real64 MaxCapacity; // tank capacity Limit [m3]
     141              :         Overflow OverflowMode;
     142              :         std::string OverflowTankName;
     143              :         int OverflowTankID;
     144              :         int OverflowTankSupplyARRID;
     145              :         Real64 ValveOnCapacity;   // tank capacity at lower control range [m3]
     146              :         Real64 ValveOffCapacity;  // tank capacity at upper control range [m3]
     147              :         bool LastTimeStepFilling; // Indicates that tank was filling up at last timestep, to determine whether to continue until ValveOffCapacity
     148              :         ControlSupplyType ControlSupply; // mode for tank controlled resupply
     149              :         int GroundWellID;                // index "pointer" to well if present
     150              :         std::string SupplyTankName;
     151              :         int SupplyTankID;
     152              :         int SupplyTankDemandARRID;
     153              :         Real64 BackupMainsCapacity;
     154              :         Real64 InitialVolume;  // water in tank at start of simulation period [m3]
     155              :         Real64 MaxInFlowRate;  // limit on rate of inlet [m3/s]
     156              :         Real64 MaxOutFlowRate; // limit on rate of outlet [m3/s]
     157              :         TankThermalMode ThermalMode;
     158              :         Real64 InitialTankTemp;                      // initial tank temperature [C]
     159              :         Sched::Schedule *tempSched = nullptr;        // temp schedule
     160              :         AmbientTempType AmbientTempIndicator;        // Indicator for ambient tank losses (SCHEDULE, ZONE, EXTERIOR)
     161              :         Sched::Schedule *ambientTempSched = nullptr; // Ambient temp schedule
     162              :         int ZoneID;                                  // index "pointer" to zone where tank is
     163              :         Real64 UValue;                               // U-value for tank [W/m2-k]
     164              :         Real64 SurfArea;                             // surface are of tank on Zone side... [m2]
     165              :         int InternalMassID;                          // index "pointer" to internal mass object for thermal coupling
     166              :         std::string SurfMaterialName;                // surface properties
     167              :         // calculated data and from elsewhere
     168              :         Real64 ThisTimeStepVolume;
     169              :         Real64 LastTimeStepVolume;
     170              :         Real64 LastTimeStepTemp; // previous temperature of tank water
     171              :         int NumWaterSupplies;
     172              :         Array1D<Real64> VdotAvailSupply; // Each supply component has its own term
     173              :         Array1D<Real64> TwaterSupply;    // Each supply component has its own term
     174              :         Array1D_string SupplyCompNames;
     175              :         Array1D_string SupplyCompTypes;
     176              :         int NumWaterDemands;
     177              :         Array1D<Real64> VdotRequestDemand; // each demand componennt has a slot
     178              :         Array1D<Real64> VdotAvailDemand;   // each demand componennt has a slot
     179              :         Array1D_string DemandCompNames;
     180              :         Array1D_string DemandCompTypes;
     181              :         Real64 VdotFromTank;
     182              :         Real64 VdotToTank;
     183              :         Real64 VdotOverflow;
     184              :         Real64 VolOverflow;
     185              :         // report variables
     186              :         Real64 NetVdot;
     187              :         Real64 Twater;
     188              :         Real64 TouterSkin;
     189              :         Real64 TwaterOverflow;
     190              :         Real64 MainsDrawVdot;
     191              :         Real64 MainsDrawVol;
     192              :         Real64 SkinLossPower;   // heat loss to surrounding zone [W]
     193              :         Real64 SkinLossEnergy;  // heat loss to surround zone [J]
     194              :         Real64 SkinLossConvect; // convective heat loss to zone [W]
     195              :         Real64 SkinLossRadiat;  // radiative heat loss to zone [W}
     196              : 
     197              :         // Default Constructor
     198            4 :         StorageTankDataStruct()
     199           12 :             : MaxCapacity(0.0), OverflowMode(Overflow::Invalid), OverflowTankID(0), OverflowTankSupplyARRID(0), ValveOnCapacity(0.0),
     200            8 :               ValveOffCapacity(0.0), LastTimeStepFilling(false), ControlSupply(ControlSupplyType::Invalid), GroundWellID(0), SupplyTankID(0),
     201            4 :               SupplyTankDemandARRID(0), BackupMainsCapacity(0.0), InitialVolume(0.0), MaxInFlowRate(0.0), MaxOutFlowRate(0.0),
     202            4 :               ThermalMode(TankThermalMode::Invalid), InitialTankTemp(20.0), AmbientTempIndicator(AmbientTempType::Invalid), ZoneID(0), UValue(0.0),
     203            8 :               SurfArea(0.0), InternalMassID(0), ThisTimeStepVolume(0.0), LastTimeStepVolume(0.0), LastTimeStepTemp(0.0), NumWaterSupplies(0),
     204            8 :               NumWaterDemands(0), VdotFromTank(0.0), VdotToTank(0.0), VdotOverflow(0.0), VolOverflow(0.0), NetVdot(0.0), Twater(0.0), TouterSkin(0.0),
     205            4 :               TwaterOverflow(0.0), MainsDrawVdot(0.0), MainsDrawVol(0.0), SkinLossPower(0.0), SkinLossEnergy(0.0), SkinLossConvect(0.0),
     206            4 :               SkinLossRadiat(0.0)
     207              :         {
     208            4 :         }
     209              :     };
     210              : 
     211              :     struct RainfallCollectorDataStruct
     212              :     {
     213              :         // Members
     214              :         // user input data
     215              :         std::string Name; // name of this rain collector
     216              :         std::string StorageTankName;
     217              :         int StorageTankID; // index "pointer" to storage tank array
     218              :         int StorageTankSupplyARRID;
     219              :         RainLossFactor LossFactorMode;              // control how loss factor(s) are entered
     220              :         Real64 LossFactor;                          // loss factor when constant
     221              :         Sched::Schedule *lossFactorSched = nullptr; // schedule
     222              :         Real64 MaxCollectRate;
     223              :         int NumCollectSurfs; // number of surfaces used in the collector
     224              :         Array1D_string SurfName;
     225              :         Array1D_int SurfID;
     226              :         // calculated and from elsewhere
     227              :         Real64 HorizArea; // area of surfaces in the vertical normal direction
     228              :         Real64 VdotAvail;
     229              :         Real64 VolCollected;
     230              :         std::array<Real64, 12> VolCollectedMonthly = {0.0}; // Monthly rain water collected in mm;
     231              :         Real64 MeanHeight;
     232              : 
     233              :         // Default Constructor
     234            0 :         RainfallCollectorDataStruct()
     235            0 :             : StorageTankID(0), StorageTankSupplyARRID(0), LossFactorMode(RainLossFactor::Invalid), LossFactor(0.0), MaxCollectRate(0.0),
     236            0 :               NumCollectSurfs(0), HorizArea(0.0), VdotAvail(0.0), VolCollected(0.0), MeanHeight(0.0)
     237              :         {
     238            0 :         }
     239              :     };
     240              : 
     241              :     struct GroundwaterWellDataStruct
     242              :     {
     243              :         // Members
     244              :         // user input data
     245              :         std::string Name; // name of this
     246              :         std::string StorageTankName;
     247              :         int StorageTankID;          // index "pointer" to water storage tank
     248              :         int StorageTankSupplyARRID; // index "pointer" to storage supply arrays
     249              :         Real64 PumpDepth;           // depth of pump  [m]
     250              :         Real64 PumpNomVolFlowRate;  // nominal flow rate of pump [m3/s]
     251              :         Real64 PumpNomHead;         // design nominal capacity of pump
     252              :         Real64 PumpNomPowerUse;     // design nominal power of pump at nom capacity
     253              :         Real64 PumpEfficiency;
     254              :         Real64 WellRecoveryRate;               // rate at which groundwater can enter well [m3/s]
     255              :         Real64 NomWellStorageVol;              // water storage in well at average water table depth [m3]
     256              :         GroundWaterTable GroundwaterTableMode; // method of determining water table depth
     257              :         Real64 WaterTableDepth;
     258              :         Sched::Schedule *waterTableDepthSched = nullptr;
     259              :         // calculated and from elsewhere
     260              :         Real64 VdotRequest;   // rate of flow over timestep requested by tank
     261              :         Real64 VdotDelivered; // rate of flow provided [m3/s]
     262              :         Real64 VolDelivered;  // water provided [m3]
     263              :         Real64 PumpPower;
     264              :         Real64 PumpEnergy;
     265              : 
     266              :         // Default Constructor
     267            2 :         GroundwaterWellDataStruct()
     268            4 :             : StorageTankID(0), StorageTankSupplyARRID(0), PumpDepth(0.0), PumpNomVolFlowRate(0.0), PumpNomHead(0.0), PumpNomPowerUse(0.0),
     269            2 :               PumpEfficiency(0.0), WellRecoveryRate(0.0), NomWellStorageVol(0.0), GroundwaterTableMode(GroundWaterTable::Invalid),
     270            2 :               WaterTableDepth(0.0), VdotRequest(0.0), VdotDelivered(0.0), VolDelivered(0.0), PumpPower(0.0), PumpEnergy(0.0)
     271              :         {
     272            2 :         }
     273              :     };
     274              : 
     275              :     struct SiteRainFallDataStruct
     276              :     {
     277              :         // Members
     278              :         RainfallMode ModeID; // type of rainfall modeling
     279              :         Real64 DesignAnnualRain;
     280              :         Sched::Schedule *rainSched = nullptr;
     281              :         Real64 NomAnnualRain;
     282              :         // calculated and from elsewhere.
     283              :         Real64 CurrentRate;
     284              :         Real64 CurrentAmount;                                      //  units of m
     285              :         std::array<Real64, 12> MonthlyTotalPrecInWeather = {0.0};  // Monthly total rain in weather file [mm]
     286              :         std::array<Real64, 12> MonthlyTotalPrecInSitePrec = {0.0}; // Monthly total rain in site:precipitation [mm]
     287              :         std::array<int, 12> numRainyHoursInWeather = {0};          // Monthly number of rainy hours
     288              : 
     289              :         // Default Constructor
     290         4229 :         SiteRainFallDataStruct() : ModeID(RainfallMode::None), DesignAnnualRain(0.0), NomAnnualRain(0.0), CurrentRate(0.0), CurrentAmount(0.0)
     291              :         {
     292         4229 :         }
     293              :     };
     294              : 
     295              :     struct IrrigationDataStruct
     296              :     {
     297              :         // Members
     298              :         IrrigationMode ModeID; // type of irrigation modeling
     299              :         Sched::Schedule *irrSched = nullptr;
     300              :         Real64 ScheduledAmount;
     301              :         Real64 ActualAmount;
     302              :         Real64 IrrigationThreshold; // percent at which no irrigation happens (smart schedule)
     303              : 
     304              :         // Default Constructor
     305         4229 :         IrrigationDataStruct() : ModeID(IrrigationMode::Invalid), ScheduledAmount(0.0), ActualAmount(0.0), IrrigationThreshold(0.4)
     306              :         {
     307         4229 :         }
     308              :     };
     309              : 
     310              : } // namespace DataWater
     311              : 
     312              : struct DataWaterData : BaseGlobalStruct
     313              : {
     314              : 
     315              :     DataWater::SiteRainFallDataStruct
     316              :         RainFall; // type of rainfall modeling | design annual rain | rain sched id | nominal annual rain | current rate | current amount
     317              :     DataWater::IrrigationDataStruct
     318              :         Irrigation; // type of irrigation modeling | Irrigation schedule id | scheduled amount | actual amount | irrigation threshold
     319              :     Array1D<DataWater::StorageTankDataStruct> WaterStorage;
     320              :     Array1D<DataWater::RainfallCollectorDataStruct> RainCollector;
     321              :     Array1D<DataWater::GroundwaterWellDataStruct> GroundwaterWell;
     322              : 
     323              :     int NumWaterStorageTanks = 0; // number of water Storage tanks in model
     324              :     int NumRainCollectors = 0;    // number of rainfall collectors in model
     325              :     int NumGroundWaterWells = 0;  // number of
     326              :     int NumSiteRainFall = 0;
     327              :     bool AnyWaterSystemsInModel = false;    // control flag set true if any water systems
     328              :     bool WaterSystemGetInputCalled = false; // set true once input data gotten.
     329              :     bool AnyIrrigationInModel = false;      // control flag set true if irrigation input for ecoroof DJS PSU Dec 2006
     330              :     int PrecipOverwrittenByRainFlag = 0;    // recurring warning index when the rain flag is on but the liquidprecipitation = 0
     331              : 
     332         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     333              :     {
     334         2126 :     }
     335              : 
     336         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     337              :     {
     338         1152 :     }
     339              : 
     340         2100 :     void clear_state() override
     341              :     {
     342         2100 :         RainFall = {};
     343         2100 :         Irrigation = {};
     344         2100 :         WaterStorage.deallocate();
     345         2100 :         RainCollector.deallocate();
     346         2100 :         GroundwaterWell.deallocate();
     347         2100 :         NumWaterStorageTanks = 0;
     348         2100 :         NumRainCollectors = 0;
     349         2100 :         NumGroundWaterWells = 0;
     350         2100 :         NumSiteRainFall = 0;
     351         2100 :         AnyWaterSystemsInModel = false;
     352         2100 :         WaterSystemGetInputCalled = false;
     353         2100 :         AnyIrrigationInModel = false;
     354         2100 :         PrecipOverwrittenByRainFlag = 0;
     355         2100 :     }
     356              : };
     357              : 
     358              : } // namespace EnergyPlus
     359              : 
     360              : #endif
        

Generated by: LCOV version 2.0-1