Skip to content

Commit

Permalink
move remaining const ints in DataWater to enums
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchute committed Oct 28, 2020
1 parent b1e3bdc commit 4f960e6
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 167 deletions.
1 change: 0 additions & 1 deletion src/EnergyPlus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ SET( SRC
DataVectorTypes.hh
DataViewFactorInformation.cc
DataViewFactorInformation.hh
DataWater.cc
DataWater.hh
DataWindowEquivalentLayer.cc
DataWindowEquivalentLayer.hh
Expand Down
79 changes: 0 additions & 79 deletions src/EnergyPlus/DataWater.cc

This file was deleted.

52 changes: 31 additions & 21 deletions src/EnergyPlus/DataWater.hh
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,31 @@ namespace EnergyPlus {

namespace DataWater {

// MODULE PARAMETER DEFINITION

extern int const ScheduledTankTemp; // tank water temperature is user input via schedule
extern int const TankZoneThermalCoupled; // tank water temperature is modeled using simple UA
enum class TankThermalMode {
Unassigned,
ScheduledTankTemp, // tank water temperature is user input via schedule
TankZoneThermalCoupled // tank water temperature is modeled using simple UA
};

extern int const RainSchedDesign; // mode of Rainfall determination is Scheduled Design
extern int const IrrSchedDesign; // mode of Irrigation determination is Scheduled Design (DJS -PSU)
extern int const IrrSmartSched; // mode of irrigation DJS - PSU
enum class RainfallMode {
Unassigned,
RainSchedDesign, // mode of Rainfall determination is Scheduled Design
IrrSchedDesign, // mode of Irrigation determination is Scheduled Design
IrrSmartSched // mode of irrigation
};

extern int const ConstantRainLossFactor;
extern int const ScheduledRainLossFactor;
enum class RainLossFactor {
Unassigned,
Constant,
Scheduled
};

extern int const AmbientTempSchedule; // ambient temperature around tank (or HPWH inlet air) is scheduled
extern int const AmbientTempZone; // tank is located in a zone or HPWH inlet air is zone air only
extern int const AmbientTempExterior; // tank is located outdoors or HPWH inlet air is outdoor air only
enum class AmbientTempType {
Unassigned,
Schedule, // ambient temperature around tank (or HPWH inlet air) is scheduled
Zone, // tank is located in a zone or HPWH inlet air is zone air only
Exterior // tank is located outdoors or HPWH inlet air is outdoor air only
};

enum class GroundWaterTable {
Unassigned,
Expand Down Expand Up @@ -120,10 +130,10 @@ namespace DataWater {
Real64 InitialVolume; // water in tank at start of simulation period [m3]
Real64 MaxInFlowRate; // limit on rate of inlet [m3/s]
Real64 MaxOutFlowRate; // limit on rate of outlet [m3/s]
int ThermalMode;
TankThermalMode ThermalMode;
Real64 InitialTankTemp; // initial tank temperature [C]
int TempSchedID; // index "pointer" to schedule
int AmbientTempIndicator; // Indicator for ambient tank losses (SCHEDULE, ZONE, EXTERIOR)
AmbientTempType AmbientTempIndicator; // Indicator for ambient tank losses (SCHEDULE, ZONE, EXTERIOR)
int AmbientTempSchedule; // Schedule index pointer
int ZoneID; // index "pointer" to zone where tank is
Real64 UValue; // U-value for tank [W/m2-k]
Expand Down Expand Up @@ -164,7 +174,7 @@ namespace DataWater {
StorageTankDataStruct()
: MaxCapacity(0.0), OverflowMode(Overflow::Unassigned), OverflowTankID(0), OverflowTankSupplyARRID(0), ValveOnCapacity(0.0), ValveOffCapacity(0.0),
ControlSupplyType(ControlSupplyType::Unassigned), GroundWellID(0), SupplyTankID(0), SupplyTankDemandARRID(0), BackupMainsCapacity(0.0), InitialVolume(0.0),
MaxInFlowRate(0.0), MaxOutFlowRate(0.0), ThermalMode(0), InitialTankTemp(20.0), TempSchedID(0), AmbientTempIndicator(0),
MaxInFlowRate(0.0), MaxOutFlowRate(0.0), ThermalMode(TankThermalMode::Unassigned), InitialTankTemp(20.0), TempSchedID(0), AmbientTempIndicator(AmbientTempType::Unassigned),
AmbientTempSchedule(0), ZoneID(0), UValue(0.0), SurfArea(0.0), InternalMassID(0), ThisTimeStepVolume(0.0), LastTimeStepVolume(0.0),
LastTimeStepTemp(0.0), NumWaterSupplies(0), NumWaterDemands(0), VdotFromTank(0.0), VdotToTank(0.0), VdotOverflow(0.0), VolOverflow(0.0),
NetVdot(0.0), Twater(0.0), TouterSkin(0.0), TwaterOverflow(0.0), MainsDrawVdot(0.0), MainsDrawVol(0.0), SkinLossPower(0.0),
Expand All @@ -181,7 +191,7 @@ namespace DataWater {
std::string StorageTankName;
int StorageTankID; // index "pointer" to storage tank array
int StorageTankSupplyARRID;
int LossFactorMode; // control how loss factor(s) are entered
RainLossFactor LossFactorMode; // control how loss factor(s) are entered
Real64 LossFactor; // loss factor when constant
int LossFactorSchedID; // index "pointer" to schedule
Real64 MaxCollectRate;
Expand All @@ -196,7 +206,7 @@ namespace DataWater {

// Default Constructor
RainfallCollectorDataStruct()
: StorageTankID(0), StorageTankSupplyARRID(0), LossFactorMode(0), LossFactor(0.0), LossFactorSchedID(0), MaxCollectRate(0.0),
: StorageTankID(0), StorageTankSupplyARRID(0), LossFactorMode(RainLossFactor::Unassigned), LossFactor(0.0), LossFactorSchedID(0), MaxCollectRate(0.0),
NumCollectSurfs(0), HorizArea(0.0), VdotAvail(0.0), VolCollected(0.0), MeanHeight(0.0)
{
}
Expand Down Expand Up @@ -239,7 +249,7 @@ namespace DataWater {
struct SiteRainFallDataStruct
{
// Members
int ModeID; // type of rainfall modeling
RainfallMode ModeID; // type of rainfall modeling
Real64 DesignAnnualRain;
int RainSchedID;
Real64 NomAnnualRain;
Expand All @@ -248,22 +258,22 @@ namespace DataWater {
Real64 CurrentAmount;

// Default Constructor
SiteRainFallDataStruct() : ModeID(0), DesignAnnualRain(0.0), RainSchedID(0), NomAnnualRain(0.0), CurrentRate(0.0), CurrentAmount(0.0)
SiteRainFallDataStruct() : ModeID(RainfallMode::Unassigned), DesignAnnualRain(0.0), RainSchedID(0), NomAnnualRain(0.0), CurrentRate(0.0), CurrentAmount(0.0)
{
}
};

struct IrrigationDataStruct
{
// Members
int ModeID; // type of irrigation modeling
RainfallMode ModeID; // type of irrigation modeling
int IrrSchedID;
Real64 ScheduledAmount;
Real64 ActualAmount;
Real64 IrrigationThreshold; // percent at which no irrigation happens (smart schedule)

// Default Constructor
IrrigationDataStruct() : ModeID(0), IrrSchedID(0), ScheduledAmount(0.0), ActualAmount(0.0), IrrigationThreshold(0.4)
IrrigationDataStruct() : ModeID(RainfallMode::Unassigned), IrrSchedID(0), ScheduledAmount(0.0), ActualAmount(0.0), IrrigationThreshold(0.4)
{
}
};
Expand Down
19 changes: 3 additions & 16 deletions src/EnergyPlus/EcoRoofManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,6 @@ namespace EcoRoofManager {
using namespace DataGlobals;
using namespace DataLoopNode;
using namespace DataHeatBalance;
using DataWater::IrrSchedDesign;
using DataWater::IrrSmartSched;
using DataWater::RainSchedDesign;
// Use statements for access to subroutines in other modules

// Data
// MODULE PARAMETER DEFINITIONS
// na

// DERIVED TYPE DEFINITIONS
// na

// MODULE VARIABLE DECLARATIONS:

Real64 CumRunoff(0.0); // Cumulative runoff, updated each time step (m) mult by roof area to get volume
Real64 CumET(0.0); // Cumulative evapotranspiration from soil and plants (m)
Expand Down Expand Up @@ -859,7 +846,7 @@ namespace EcoRoofManager {
CurrentPrecipitation = 0.0; // first initialize to zero
}
CurrentPrecipitation = 0.0; // first initialize to zero
if (state.dataWaterData->RainFall.ModeID == RainSchedDesign) {
if (state.dataWaterData->RainFall.ModeID == DataWater::RainfallMode::RainSchedDesign) {
CurrentPrecipitation = state.dataWaterData->RainFall.CurrentAmount; // units of m
Moisture += CurrentPrecipitation / TopDepth; // x (m) evenly put into top layer
if (!WarmupFlag) {
Expand All @@ -870,11 +857,11 @@ namespace EcoRoofManager {
// NEXT Add Irrigation to surface soil moisture variable (if a schedule exists)
CurrentIrrigation = 0.0; // first initialize to zero
state.dataWaterData->Irrigation.ActualAmount = 0.0;
if (state.dataWaterData->Irrigation.ModeID == IrrSchedDesign) {
if (state.dataWaterData->Irrigation.ModeID == DataWater::RainfallMode::IrrSchedDesign) {
CurrentIrrigation = state.dataWaterData->Irrigation.ScheduledAmount; // units of m
state.dataWaterData->Irrigation.ActualAmount = CurrentIrrigation;
// elseif (Irrigation%ModeID ==IrrSmartSched .and. moisture .lt. 0.4d0*MoistureMax) then
} else if (state.dataWaterData->Irrigation.ModeID == IrrSmartSched && Moisture < state.dataWaterData->Irrigation.IrrigationThreshold * MoistureMax) {
} else if (state.dataWaterData->Irrigation.ModeID == DataWater::RainfallMode::IrrSmartSched && Moisture < state.dataWaterData->Irrigation.IrrigationThreshold * MoistureMax) {
// Smart schedule only irrigates when scheduled AND the soil is less than 40% saturated
CurrentIrrigation = state.dataWaterData->Irrigation.ScheduledAmount; // units of m
state.dataWaterData->Irrigation.ActualAmount = CurrentIrrigation;
Expand Down
Loading

5 comments on commit 4f960e6

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global_dataWater (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: Build Failed

Failures:\n

API Test Summary

  • Failed: 6
  • notrun: 3

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global_dataWater (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: Build Failed

Failures:\n

integration Test Summary

  • Passed: 2
  • Failed: 720

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global_dataWater (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: Build Failed

Failures:\n

API Test Summary

  • Failed: 6
  • notrun: 3

integration Test Summary

  • Passed: 2
  • Failed: 720

regression Test Summary

  • Passed: 735
  • Failed: 2

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global_dataWater (mitchute) - x86_64-MacOS-10.15-clang-11.0.0: OK (2986 of 2986 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global_dataWater (mitchute) - Win64-Windows-10-VisualStudio-16: OK (2241 of 2242 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1085
  • Failed: 1

Build Badge Test Badge

Please sign in to comment.