LCOV - code coverage report
Current view: top level - EnergyPlus - DataWater.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 21 36 58.3 %
Date: 2023-01-17 19:17:23 Functions: 13 17 76.5 %

          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 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             :         IrrSchedDesign, // mode of Irrigation determination is Scheduled Design
      84             :         IrrSmartSched,  // 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          15 :     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             :         int TempSchedID;                      // index "pointer" to schedule
     160             :         AmbientTempType AmbientTempIndicator; // Indicator for ambient tank losses (SCHEDULE, ZONE, EXTERIOR)
     161             :         int AmbientTempSchedule;              // Schedule index pointer
     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           5 :         StorageTankDataStruct()
     199           5 :             : MaxCapacity(0.0), OverflowMode(Overflow::Invalid), OverflowTankID(0), OverflowTankSupplyARRID(0), ValveOnCapacity(0.0),
     200             :               ValveOffCapacity(0.0), LastTimeStepFilling(false), ControlSupply(ControlSupplyType::Invalid), GroundWellID(0), SupplyTankID(0),
     201             :               SupplyTankDemandARRID(0), BackupMainsCapacity(0.0), InitialVolume(0.0), MaxInFlowRate(0.0), MaxOutFlowRate(0.0),
     202             :               ThermalMode(TankThermalMode::Invalid), InitialTankTemp(20.0), TempSchedID(0), AmbientTempIndicator(AmbientTempType::Invalid),
     203             :               AmbientTempSchedule(0), ZoneID(0), UValue(0.0), SurfArea(0.0), InternalMassID(0), ThisTimeStepVolume(0.0), LastTimeStepVolume(0.0),
     204             :               LastTimeStepTemp(0.0), NumWaterSupplies(0), NumWaterDemands(0), VdotFromTank(0.0), VdotToTank(0.0), VdotOverflow(0.0), VolOverflow(0.0),
     205             :               NetVdot(0.0), Twater(0.0), TouterSkin(0.0), TwaterOverflow(0.0), MainsDrawVdot(0.0), MainsDrawVol(0.0), SkinLossPower(0.0),
     206           5 :               SkinLossEnergy(0.0), SkinLossConvect(0.0), SkinLossRadiat(0.0)
     207             :         {
     208           5 :         }
     209             :     };
     210             : 
     211           6 :     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             :         int LossFactorSchedID;         // index "pointer" to 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           2 :         RainfallCollectorDataStruct()
     235           2 :             : StorageTankID(0), StorageTankSupplyARRID(0), LossFactorMode(RainLossFactor::Invalid), LossFactor(0.0), LossFactorSchedID(0),
     236           2 :               MaxCollectRate(0.0), NumCollectSurfs(0), HorizArea(0.0), VdotAvail(0.0), VolCollected(0.0), MeanHeight(0.0)
     237             :         {
     238           2 :         }
     239             :     };
     240             : 
     241           6 :     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             :         int WaterTableDepthSchedID;
     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           2 :             : StorageTankID(0), StorageTankSupplyARRID(0), PumpDepth(0.0), PumpNomVolFlowRate(0.0), PumpNomHead(0.0), PumpNomPowerUse(0.0),
     269             :               PumpEfficiency(0.0), WellRecoveryRate(0.0), NomWellStorageVol(0.0), GroundwaterTableMode(GroundWaterTable::Invalid),
     270             :               WaterTableDepth(0.0), WaterTableDepthSchedID(0), VdotRequest(0.0), VdotDelivered(0.0), VolDelivered(0.0), PumpPower(0.0),
     271           2 :               PumpEnergy(0.0)
     272             :         {
     273           2 :         }
     274             :     };
     275             : 
     276             :     struct SiteRainFallDataStruct
     277             :     {
     278             :         // Members
     279             :         RainfallMode ModeID; // type of rainfall modeling
     280             :         Real64 DesignAnnualRain;
     281             :         int RainSchedID;
     282             :         Real64 NomAnnualRain;
     283             :         // calculated and from elsewhere.
     284             :         Real64 CurrentRate;
     285             :         Real64 CurrentAmount;                                      //  units of m
     286             :         std::array<Real64, 12> MonthlyTotalPrecInWeather = {0.0};  // Monthly total rain in weather file [mm]
     287             :         std::array<Real64, 12> MonthlyTotalPrecInSitePrec = {0.0}; // Monthly total rain in site:precipitation [mm]
     288             :         std::array<int, 12> numRainyHoursInWeather = {0};          // Monthly number of rainy hours
     289             : 
     290             :         // Default Constructor
     291         771 :         SiteRainFallDataStruct()
     292         771 :             : ModeID(RainfallMode::None), DesignAnnualRain(0.0), RainSchedID(0), NomAnnualRain(0.0), CurrentRate(0.0), CurrentAmount(0.0)
     293             :         {
     294         771 :         }
     295             :     };
     296             : 
     297             :     struct IrrigationDataStruct
     298             :     {
     299             :         // Members
     300             :         IrrigationMode ModeID; // type of irrigation modeling
     301             :         int IrrSchedID;
     302             :         Real64 ScheduledAmount;
     303             :         Real64 ActualAmount;
     304             :         Real64 IrrigationThreshold; // percent at which no irrigation happens (smart schedule)
     305             : 
     306             :         // Default Constructor
     307         771 :         IrrigationDataStruct() : ModeID(IrrigationMode::Invalid), IrrSchedID(0), ScheduledAmount(0.0), ActualAmount(0.0), IrrigationThreshold(0.4)
     308             :         {
     309         771 :         }
     310             :     };
     311             : 
     312             : } // namespace DataWater
     313             : 
     314        1542 : struct DataWaterData : BaseGlobalStruct
     315             : {
     316             : 
     317             :     DataWater::SiteRainFallDataStruct
     318             :         RainFall; // type of rainfall modeling | design annual rain | rain sched id | nominal annual rain | current rate | current amount
     319             :     DataWater::IrrigationDataStruct
     320             :         Irrigation; // type of irrigation modeling | Irrigation schedule id | scheduled amount | actual amount | irrigation threshold
     321             :     Array1D<DataWater::StorageTankDataStruct> WaterStorage;
     322             :     Array1D<DataWater::RainfallCollectorDataStruct> RainCollector;
     323             :     Array1D<DataWater::GroundwaterWellDataStruct> GroundwaterWell;
     324             : 
     325             :     int NumWaterStorageTanks = 0; // number of water Storage tanks in model
     326             :     int NumRainCollectors = 0;    // number of rainfall collectors in model
     327             :     int NumGroundWaterWells = 0;  // number of
     328             :     int NumSiteRainFall = 0;
     329             :     bool AnyWaterSystemsInModel = false;    // control flag set true if any water systems
     330             :     bool WaterSystemGetInputCalled = false; // set true once input data gotten.
     331             :     bool AnyIrrigationInModel = false;      // control flag set true if irrigation input for ecoroof DJS PSU Dec 2006
     332             :     int PrecipOverwrittenByRainFlag = 0;    // recurring warning index when the rain flag is on but the liquidprecipitation = 0
     333             : 
     334           0 :     void clear_state() override
     335             :     {
     336           0 :         RainFall = {};
     337           0 :         Irrigation = {};
     338           0 :         WaterStorage.deallocate();
     339           0 :         RainCollector.deallocate();
     340           0 :         GroundwaterWell.deallocate();
     341           0 :         NumWaterStorageTanks = 0;
     342           0 :         NumRainCollectors = 0;
     343           0 :         NumGroundWaterWells = 0;
     344           0 :         NumSiteRainFall = 0;
     345           0 :         AnyWaterSystemsInModel = false;
     346           0 :         WaterSystemGetInputCalled = false;
     347           0 :         AnyIrrigationInModel = false;
     348           0 :         PrecipOverwrittenByRainFlag = 0;
     349           0 :     }
     350             : };
     351             : 
     352             : } // namespace EnergyPlus
     353             : 
     354             : #endif

Generated by: LCOV version 1.13