From 7ce6e8810b55d54ef3d76af878698e40bb9b8341 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Tue, 27 Oct 2020 09:43:25 -0600 Subject: [PATCH 1/6] WaterStorage to state --- src/EnergyPlus/Coils/CoilCoolingDX.cc | 12 +- src/EnergyPlus/CondenserLoopTowers.cc | 4 +- src/EnergyPlus/CoolTower.cc | 4 +- src/EnergyPlus/DXCoils.cc | 22 +- src/EnergyPlus/Data/CommonIncludes.hh | 1 + src/EnergyPlus/Data/EnergyPlusData.cc | 2 + src/EnergyPlus/Data/EnergyPlusData.hh | 2 + src/EnergyPlus/DataWater.cc | 2 - src/EnergyPlus/DataWater.hh | 11 +- src/EnergyPlus/EvaporativeCoolers.cc | 12 +- src/EnergyPlus/EvaporativeCoolers.hh | 2 +- src/EnergyPlus/EvaporativeFluidCoolers.cc | 4 +- src/EnergyPlus/Humidifiers.cc | 8 +- src/EnergyPlus/OutputReportTabular.cc | 8 +- src/EnergyPlus/PackagedThermalStorageCoil.cc | 17 +- src/EnergyPlus/PackagedThermalStorageCoil.hh | 2 +- src/EnergyPlus/RefrigeratedCase.cc | 16 +- src/EnergyPlus/RefrigeratedCase.hh | 4 +- src/EnergyPlus/UserDefinedComponents.cc | 32 +- src/EnergyPlus/UserDefinedComponents.hh | 8 +- src/EnergyPlus/VariableSpeedCoils.cc | 3 +- src/EnergyPlus/WaterCoils.cc | 5 +- src/EnergyPlus/WaterManager.cc | 520 +++++++++---------- src/EnergyPlus/WaterManager.hh | 13 +- src/EnergyPlus/WaterUse.cc | 16 +- src/EnergyPlus/WaterUse.hh | 2 +- src/EnergyPlus/ZoneDehumidifier.cc | 5 +- 27 files changed, 361 insertions(+), 376 deletions(-) diff --git a/src/EnergyPlus/Coils/CoilCoolingDX.cc b/src/EnergyPlus/Coils/CoilCoolingDX.cc index 9f613579eb4..d341946baa5 100644 --- a/src/EnergyPlus/Coils/CoilCoolingDX.cc +++ b/src/EnergyPlus/Coils/CoilCoolingDX.cc @@ -497,11 +497,11 @@ void CoilCoolingDX::simulate(EnergyPlus::EnergyPlusData &state, int useAlternate Real64 outHumidityRatio = evapOutletNode.HumRat; this->condensateVolumeFlow = max(0.0, (evapInletNode.MassFlowRate * (inHumidityRatio - outHumidityRatio) / waterDensity)); this->condensateVolumeConsumption = this->condensateVolumeFlow * reportingConstant; - DataWater::WaterStorage(this->condensateTankIndex).VdotAvailSupply(this->condensateTankSupplyARRID) = this->condensateVolumeFlow; - DataWater::WaterStorage(this->condensateTankIndex).TwaterSupply(this->condensateTankSupplyARRID) = evapOutletNode.Temp; + state.dataWaterData->WaterStorage(this->condensateTankIndex).VdotAvailSupply(this->condensateTankSupplyARRID) = this->condensateVolumeFlow; + state.dataWaterData->WaterStorage(this->condensateTankIndex).TwaterSupply(this->condensateTankSupplyARRID) = evapOutletNode.Temp; } else { - DataWater::WaterStorage(this->condensateTankIndex).VdotAvailSupply(this->condensateTankSupplyARRID) = 0.0; - DataWater::WaterStorage(this->condensateTankIndex).TwaterSupply(this->condensateTankSupplyARRID) = evapOutletNode.Temp; + state.dataWaterData->WaterStorage(this->condensateTankIndex).VdotAvailSupply(this->condensateTankSupplyARRID) = 0.0; + state.dataWaterData->WaterStorage(this->condensateTankIndex).TwaterSupply(this->condensateTankSupplyARRID) = evapOutletNode.Temp; } } @@ -519,10 +519,10 @@ void CoilCoolingDX::simulate(EnergyPlus::EnergyPlusData &state, int useAlternate if (useAlternateMode == DataHVACGlobals::coilNormalMode) { this->evapCondPumpElecPower = this->performance.normalMode.getCurrentEvapCondPumpPower(speedNum); } - DataWater::WaterStorage(this->evaporativeCondSupplyTankIndex).VdotRequestDemand(this->evaporativeCondSupplyTankARRID) = + state.dataWaterData->WaterStorage(this->evaporativeCondSupplyTankIndex).VdotRequestDemand(this->evaporativeCondSupplyTankARRID) = this->evaporativeCondSupplyTankVolumeFlow; } else { - DataWater::WaterStorage(this->evaporativeCondSupplyTankIndex).VdotRequestDemand(this->evaporativeCondSupplyTankARRID) = 0.0; + state.dataWaterData->WaterStorage(this->evaporativeCondSupplyTankIndex).VdotRequestDemand(this->evaporativeCondSupplyTankARRID) = 0.0; } } diff --git a/src/EnergyPlus/CondenserLoopTowers.cc b/src/EnergyPlus/CondenserLoopTowers.cc index bf0f88a4d44..97e415d9c9b 100644 --- a/src/EnergyPlus/CondenserLoopTowers.cc +++ b/src/EnergyPlus/CondenserLoopTowers.cc @@ -5844,10 +5844,10 @@ namespace CondenserLoopTowers { if (this->SuppliedByWaterSystem) { // set demand request - DataWater::WaterStorage(this->WaterTankID).VdotRequestDemand(this->WaterTankDemandARRID) = makeUpVdot; + state.dataWaterData->WaterStorage(this->WaterTankID).VdotRequestDemand(this->WaterTankDemandARRID) = makeUpVdot; Real64 const AvailTankVdot = - DataWater::WaterStorage(this->WaterTankID).VdotAvailDemand(this->WaterTankDemandARRID); // check what tank can currently provide + state.dataWaterData->WaterStorage(this->WaterTankID).VdotAvailDemand(this->WaterTankDemandARRID); // check what tank can currently provide tankSupplyVdot = makeUpVdot; // init if (AvailTankVdot < makeUpVdot) { // calculate starved flow diff --git a/src/EnergyPlus/CoolTower.cc b/src/EnergyPlus/CoolTower.cc index 6b955a4c3e2..170ae8e4cf2 100644 --- a/src/EnergyPlus/CoolTower.cc +++ b/src/EnergyPlus/CoolTower.cc @@ -691,13 +691,13 @@ namespace CoolTower { // Set the demand request for supply water from water storage tank (if needed) if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterSupplyMode == WaterSupplyMode::FromTank) { - WaterStorage(state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterSupTankID).VdotRequestDemand(state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterTankDemandARRID) = + state.dataWaterData->WaterStorage(state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterSupTankID).VdotRequestDemand(state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterTankDemandARRID) = state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterConsumpRate; } // check if should be starved by restricted flow from tank if (state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterSupplyMode == WaterSupplyMode::FromTank) { - AvailWaterRate = WaterStorage(state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterSupTankID) + AvailWaterRate = state.dataWaterData->WaterStorage(state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterSupTankID) .VdotAvailDemand(state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterTankDemandARRID); if (AvailWaterRate < state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterConsumpRate) { state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterStarvMakeupRate = state.dataCoolTower->CoolTowerSys(CoolTowerNum).CoolTWaterConsumpRate - AvailWaterRate; diff --git a/src/EnergyPlus/DXCoils.cc b/src/EnergyPlus/DXCoils.cc index f85c89759eb..6cc1a30b0b9 100644 --- a/src/EnergyPlus/DXCoils.cc +++ b/src/EnergyPlus/DXCoils.cc @@ -8395,7 +8395,6 @@ namespace DXCoils { using DataHVACGlobals::HPWHCrankcaseDBTemp; using DataHVACGlobals::SysTimeElapsed; using DataHVACGlobals::TimeStepSys; - using DataWater::WaterStorage; using General::CreateSysTimeIntervalString; using General::RoundSigDigits; using General::TrimSigDigits; @@ -9312,7 +9311,7 @@ namespace DXCoils { // set water system demand request (if needed) if (DXCoil(DXCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = + state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = DXCoil(DXCoilNum).EvapWaterConsumpRate; } @@ -9385,7 +9384,6 @@ namespace DXCoils { using DataHVACGlobals::HPWHCrankcaseDBTemp; using DataHVACGlobals::SysTimeElapsed; using DataHVACGlobals::TimeStepSys; - using DataWater::WaterStorage; using General::CreateSysTimeIntervalString; using General::RoundSigDigits; using General::TrimSigDigits; @@ -9971,7 +9969,7 @@ namespace DXCoils { // set water system demand request (if needed) if (DXCoil(DXCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = + state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = DXCoil(DXCoilNum).EvapWaterConsumpRate; } @@ -10496,8 +10494,6 @@ namespace DXCoils { using CurveManager::CurveValue; using DataHeatBalFanSys::ZoneAirHumRat; using DataHeatBalFanSys::ZT; - using DataWater::WaterStorage; - // USE ScheduleManager, ONLY: GetCurrentScheduleValue // SUBROUTINE ARGUMENT DEFINITIONS: // SpeedRatio varies between 1.0 (maximum speed) and 0.0 (minimum speed) @@ -10933,7 +10929,7 @@ namespace DXCoils { // set water system demand request (if needed) if (DXCoil(DXCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = + state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = DXCoil(DXCoilNum).EvapWaterConsumpRate; } @@ -11711,7 +11707,6 @@ namespace DXCoils { using DataHVACGlobals::MSHPMassFlowRateHigh; using DataHVACGlobals::MSHPMassFlowRateLow; using DataHVACGlobals::MSHPWasteHeat; - using DataWater::WaterStorage; using General::RoundSigDigits; using General::TrimSigDigits; @@ -12451,7 +12446,7 @@ namespace DXCoils { DXCoil(DXCoilNum).EvapCondPumpElecPower = EvapCondPumpElecPower; // set water system demand request (if needed) if (DXCoil(DXCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = + state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = DXCoil(DXCoilNum).EvapWaterConsumpRate; } @@ -12543,7 +12538,6 @@ namespace DXCoils { using DataHVACGlobals::MSHPMassFlowRateHigh; using DataHVACGlobals::MSHPMassFlowRateLow; using DataHVACGlobals::MSHPWasteHeat; - using DataWater::WaterStorage; using General::RoundSigDigits; using General::TrimSigDigits; @@ -13287,7 +13281,6 @@ namespace DXCoils { using DataHVACGlobals::DXElecCoolingPower; using DataHVACGlobals::DXElecHeatingPower; using DataHVACGlobals::TimeStepSys; - using DataWater::WaterStorage; using Psychrometrics::RhoH2O; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: @@ -13390,9 +13383,9 @@ namespace DXCoils { DXCoil(DXCoilNum).CondensateVdot = max(0.0, (DXCoil(DXCoilNum).InletAirMassFlowRate * (SpecHumIn - SpecHumOut) / RhoWater)); DXCoil(DXCoilNum).CondensateVol = DXCoil(DXCoilNum).CondensateVdot * ReportingConstant; - WaterStorage(DXCoil(DXCoilNum).CondensateTankID).VdotAvailSupply(DXCoil(DXCoilNum).CondensateTankSupplyARRID) = + state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).CondensateTankID).VdotAvailSupply(DXCoil(DXCoilNum).CondensateTankSupplyARRID) = DXCoil(DXCoilNum).CondensateVdot; - WaterStorage(DXCoil(DXCoilNum).CondensateTankID).TwaterSupply(DXCoil(DXCoilNum).CondensateTankSupplyARRID) = + state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).CondensateTankID).TwaterSupply(DXCoil(DXCoilNum).CondensateTankSupplyARRID) = DXCoil(DXCoilNum).OutletAirTemp; } @@ -15680,7 +15673,6 @@ namespace DXCoils { using DataHVACGlobals::HPWHCrankcaseDBTemp; using DataHVACGlobals::SysTimeElapsed; using DataHVACGlobals::TimeStepSys; - using DataWater::WaterStorage; using General::CreateSysTimeIntervalString; using General::RoundSigDigits; using General::TrimSigDigits; @@ -16093,7 +16085,7 @@ namespace DXCoils { // set water system demand request (if needed) if (DXCoil(DXCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = + state.dataWaterData->WaterStorage(DXCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(DXCoil(DXCoilNum).EvapWaterTankDemandARRID) = DXCoil(DXCoilNum).EvapWaterConsumpRate; } diff --git a/src/EnergyPlus/Data/CommonIncludes.hh b/src/EnergyPlus/Data/CommonIncludes.hh index cca462b50f5..83d7f7d076f 100644 --- a/src/EnergyPlus/Data/CommonIncludes.hh +++ b/src/EnergyPlus/Data/CommonIncludes.hh @@ -78,6 +78,7 @@ #include #include #include +#include #include #include #include diff --git a/src/EnergyPlus/Data/EnergyPlusData.cc b/src/EnergyPlus/Data/EnergyPlusData.cc index bddd329f6a1..47dc07af9ad 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.cc +++ b/src/EnergyPlus/Data/EnergyPlusData.cc @@ -104,6 +104,7 @@ namespace EnergyPlus { this->dataVariableSpeedCoils = std::unique_ptr(new VariableSpeedCoilsData); this->dataVentilatedSlab = std::unique_ptr(new VentilatedSlabData); this->dataWaterCoils = std::unique_ptr(new WaterCoilsData); + this->dataWaterData = std::unique_ptr(new DataWaterData); this->dataWaterManager = std::unique_ptr(new WaterManagerData); this->dataWaterThermalTanks = std::unique_ptr(new WaterThermalTanksData); this->dataWaterToAirHeatPump = std::unique_ptr(new WaterToAirHeatPumpData); @@ -171,6 +172,7 @@ namespace EnergyPlus { this->dataVariableSpeedCoils->clear_state(); this->dataVentilatedSlab->clear_state(); this->dataWaterCoils->clear_state(); + this->dataWaterData->clear_state(); this->dataWaterManager->clear_state(); this->dataWaterThermalTanks->clear_state(); this->dataWaterToAirHeatPump->clear_state(); diff --git a/src/EnergyPlus/Data/EnergyPlusData.hh b/src/EnergyPlus/Data/EnergyPlusData.hh index d1a1e20e308..491e5f49324 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.hh +++ b/src/EnergyPlus/Data/EnergyPlusData.hh @@ -89,6 +89,7 @@ struct CTElectricGeneratorData; struct CurveManagerData; struct DataAirLoopData; struct DataGlobal; +struct DataWaterData; struct ExteriorEnergyUseData; struct FansData; struct PipesData; @@ -160,6 +161,7 @@ struct EnergyPlusData : BaseGlobalStruct { std::unique_ptr dataCurveManager; std::unique_ptr dataAirLoop; std::unique_ptr dataGlobal; + std::unique_ptr dataWaterData; std::unique_ptr dataExteriorEnergyUse; std::unique_ptr dataFans; std::unique_ptr dataPipes; diff --git a/src/EnergyPlus/DataWater.cc b/src/EnergyPlus/DataWater.cc index df9d229d94a..682c7277b8c 100644 --- a/src/EnergyPlus/DataWater.cc +++ b/src/EnergyPlus/DataWater.cc @@ -129,7 +129,6 @@ namespace DataWater { AnyIrrigationInModel = false; RainFall = {}; Irrigation = {}; - WaterStorage.deallocate(); RainCollector.deallocate(); GroundwaterWell.deallocate(); } @@ -138,7 +137,6 @@ namespace DataWater { SiteRainFallDataStruct RainFall; // type of rainfall modeling | design annual rain | rain sched id | nominal annual rain | current rate | current amount IrrigationDataStruct Irrigation; // type of irrigation modeling | Irrigation schedule id | scheduled amount | actual amount | irrigation threshold - Array1D WaterStorage; Array1D RainCollector; Array1D GroundwaterWell; diff --git a/src/EnergyPlus/DataWater.hh b/src/EnergyPlus/DataWater.hh index 2404891461a..20538e66abf 100644 --- a/src/EnergyPlus/DataWater.hh +++ b/src/EnergyPlus/DataWater.hh @@ -283,12 +283,21 @@ namespace DataWater { RainFall; // type of rainfall modeling | design annual rain | rain sched id | nominal annual rain | current rate | current amount extern IrrigationDataStruct Irrigation; // type of irrigation modeling | Irrigation schedule id | scheduled amount | actual amount | irrigation threshold - extern Array1D WaterStorage; extern Array1D RainCollector; extern Array1D GroundwaterWell; } // namespace DataWater +struct DataWaterData : BaseGlobalStruct { + + Array1D WaterStorage; + + void clear_state() override { + WaterStorage.deallocate(); + } +}; + + } // namespace EnergyPlus #endif diff --git a/src/EnergyPlus/EvaporativeCoolers.cc b/src/EnergyPlus/EvaporativeCoolers.cc index 042796773ac..f4c009531c9 100644 --- a/src/EnergyPlus/EvaporativeCoolers.cc +++ b/src/EnergyPlus/EvaporativeCoolers.cc @@ -259,7 +259,7 @@ namespace EvaporativeCoolers { } } // Update the current Evap Cooler to the outlet nodes - UpdateEvapCooler(EvapCoolNum); + UpdateEvapCooler(state, EvapCoolNum); // Report the current Evap Cooler ReportEvapCooler(EvapCoolNum); @@ -2146,7 +2146,7 @@ namespace EvaporativeCoolers { auto const SELECT_CASE_var(EvapCond(EvapCoolNum).evapCoolerType); if (SELECT_CASE_var == EvapCoolerType::IndirectRDDSpecial) { CalcIndirectResearchSpecialEvapCooler(state, EvapCoolNum); - UpdateEvapCooler(EvapCoolNum); + UpdateEvapCooler(state, EvapCoolNum); FullOutput = Node(InletNode).MassFlowRate * (PsyHFnTdbW(Node(OutletNode).Temp, Node(InletNode).HumRat) - PsyHFnTdbW(Node(InletNode).Temp, Node(InletNode).HumRat)); @@ -2158,7 +2158,7 @@ namespace EvaporativeCoolers { } else if (SELECT_CASE_var == EvapCoolerType::DirectResearchSpecial) { CalcDirectResearchSpecialEvapCooler(state, EvapCoolNum); - UpdateEvapCooler(EvapCoolNum); + UpdateEvapCooler(state, EvapCoolNum); FullOutput = Node(OutletNode).Temp - Node(InletNode).Temp; ReqOutput = EvapCond(EvapCoolNum).DesiredOutletTemp - Node(InletNode).Temp; @@ -3420,7 +3420,7 @@ namespace EvaporativeCoolers { // Beginning of Update subroutines for the EvapCooler Module // ***************************************************************************** - void UpdateEvapCooler(int const EvapCoolNum) + void UpdateEvapCooler(EnergyPlusData &state, int const EvapCoolNum) { // SUBROUTINE INFORMATION: @@ -3491,13 +3491,13 @@ namespace EvaporativeCoolers { // Set the demand request for supply water from water storage tank (if needed) if (EvapCond(EvapCoolNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - WaterStorage(EvapCond(EvapCoolNum).EvapWaterSupTankID).VdotRequestDemand(EvapCond(EvapCoolNum).EvapWaterTankDemandARRID) = + state.dataWaterData->WaterStorage(EvapCond(EvapCoolNum).EvapWaterSupTankID).VdotRequestDemand(EvapCond(EvapCoolNum).EvapWaterTankDemandARRID) = EvapCond(EvapCoolNum).EvapWaterConsumpRate; } // check if should be starved by restricted flow from tank if (EvapCond(EvapCoolNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - AvailWaterRate = WaterStorage(EvapCond(EvapCoolNum).EvapWaterSupTankID).VdotAvailDemand(EvapCond(EvapCoolNum).EvapWaterTankDemandARRID); + AvailWaterRate = state.dataWaterData->WaterStorage(EvapCond(EvapCoolNum).EvapWaterSupTankID).VdotAvailDemand(EvapCond(EvapCoolNum).EvapWaterTankDemandARRID); if (AvailWaterRate < EvapCond(EvapCoolNum).EvapWaterConsumpRate) { EvapCond(EvapCoolNum).EvapWaterStarvMakupRate = EvapCond(EvapCoolNum).EvapWaterConsumpRate - AvailWaterRate; EvapCond(EvapCoolNum).EvapWaterConsumpRate = AvailWaterRate; diff --git a/src/EnergyPlus/EvaporativeCoolers.hh b/src/EnergyPlus/EvaporativeCoolers.hh index c7cbb5c189d..4e705cea4cc 100644 --- a/src/EnergyPlus/EvaporativeCoolers.hh +++ b/src/EnergyPlus/EvaporativeCoolers.hh @@ -427,7 +427,7 @@ namespace EvaporativeCoolers { // Beginning of Update subroutines for the EvapCooler Module // ***************************************************************************** - void UpdateEvapCooler(int EvapCoolNum); + void UpdateEvapCooler(EnergyPlusData &state, int EvapCoolNum); // End of Update subroutines for the EvapCooler Module // ***************************************************************************** diff --git a/src/EnergyPlus/EvaporativeFluidCoolers.cc b/src/EnergyPlus/EvaporativeFluidCoolers.cc index 9f87e27ff17..95efa5d88b5 100644 --- a/src/EnergyPlus/EvaporativeFluidCoolers.cc +++ b/src/EnergyPlus/EvaporativeFluidCoolers.cc @@ -2428,10 +2428,10 @@ namespace EvaporativeFluidCoolers { if (this->SuppliedByWaterSystem) { // set demand request - DataWater::WaterStorage(this->WaterTankID).VdotRequestDemand(this->WaterTankDemandARRID) = this->MakeUpVdot; + state.dataWaterData->WaterStorage(this->WaterTankID).VdotRequestDemand(this->WaterTankDemandARRID) = this->MakeUpVdot; Real64 AvailTankVdot = - DataWater::WaterStorage(this->WaterTankID).VdotAvailDemand(this->WaterTankDemandARRID); // check what tank can currently provide + state.dataWaterData->WaterStorage(this->WaterTankID).VdotAvailDemand(this->WaterTankDemandARRID); // check what tank can currently provide this->TankSupplyVdot = this->MakeUpVdot; // init if (AvailTankVdot < this->MakeUpVdot) { // calculate starved flow diff --git a/src/EnergyPlus/Humidifiers.cc b/src/EnergyPlus/Humidifiers.cc index bc223c2f360..0847af80334 100644 --- a/src/EnergyPlus/Humidifiers.cc +++ b/src/EnergyPlus/Humidifiers.cc @@ -1160,7 +1160,6 @@ namespace Humidifiers { // Using/Aliasing using CurveManager::CurveValue; using DataEnvironment::WaterMainsTemp; - using DataWater::WaterStorage; using FluidProperties::FindGlycol; using FluidProperties::FindRefrigerant; using FluidProperties::GetSatEnthalpyRefrig; @@ -1248,7 +1247,7 @@ namespace Humidifiers { GasUseRateAtRatedEff = (WaterAdd / NomCap) * NomPower; } else if (InletWaterTempOption == VariableInletWaterTemperature) { if (SuppliedByWaterSystem) { // use water use storage tank supply temperature - CurMakeupWaterTemp = WaterStorage(WaterTankID).TwaterSupply(TankSupplyID); + CurMakeupWaterTemp = state.dataWaterData->WaterStorage(WaterTankID).TwaterSupply(TankSupplyID); } else { // use water main temperature CurMakeupWaterTemp = WaterMainsTemp; } @@ -1302,7 +1301,6 @@ namespace Humidifiers { // Using/Aliasing using DataHVACGlobals::TimeStepSys; - using DataWater::WaterStorage; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: @@ -1323,9 +1321,9 @@ namespace Humidifiers { // set demand request in WaterStorage if needed. if (SuppliedByWaterSystem) { - WaterStorage(WaterTankID).VdotRequestDemand(WaterTankDemandARRID) = WaterConsRate; + state.dataWaterData->WaterStorage(WaterTankID).VdotRequestDemand(WaterTankDemandARRID) = WaterConsRate; - AvailTankVdot = WaterStorage(WaterTankID).VdotAvailDemand(WaterTankDemandARRID); // check what tank can currently provide + AvailTankVdot = state.dataWaterData->WaterStorage(WaterTankID).VdotAvailDemand(WaterTankDemandARRID); // check what tank can currently provide StarvedVdot = 0.0; TankSupplyVdot = WaterConsRate; // init diff --git a/src/EnergyPlus/OutputReportTabular.cc b/src/EnergyPlus/OutputReportTabular.cc index 3b90cbeda7d..343c8564fb1 100644 --- a/src/EnergyPlus/OutputReportTabular.cc +++ b/src/EnergyPlus/OutputReportTabular.cc @@ -7458,7 +7458,6 @@ namespace OutputReportTabular { using DataHVACGlobals::deviationFromSetPtThresholdClg; using DataHVACGlobals::deviationFromSetPtThresholdHtg; using DataWater::StorageTankDataStruct; - using DataWater::WaterStorage; using OutputProcessor::EndUseCategory; using OutputProcessor::MaxNumSubcategories; using ScheduleManager::GetScheduleName; @@ -8968,9 +8967,9 @@ namespace OutputReportTabular { tableBody(1, 3) = RealToStr(gatherWellwater / waterConversionFactor, 2); tableBody(1, 4) = RealToStr(totalOnsiteWater / waterConversionFactor, 2); - if (allocated(WaterStorage)) { - initialStorage = sum(WaterStorage, &StorageTankDataStruct::InitialVolume); - finalStorage = sum(WaterStorage, &StorageTankDataStruct::ThisTimeStepVolume); + if (allocated(state.dataWaterData->WaterStorage)) { + initialStorage = sum(state.dataWaterData->WaterStorage, &StorageTankDataStruct::InitialVolume); + finalStorage = sum(state.dataWaterData->WaterStorage, &StorageTankDataStruct::ThisTimeStepVolume); StorageChange = initialStorage - finalStorage; } else { initialStorage = 0.0; @@ -9504,7 +9503,6 @@ namespace OutputReportTabular { // na // Using/Aliasing - using DataWater::WaterStorage; using OutputProcessor::EndUseCategory; using OutputProcessor::MaxNumSubcategories; diff --git a/src/EnergyPlus/PackagedThermalStorageCoil.cc b/src/EnergyPlus/PackagedThermalStorageCoil.cc index ffce8424afa..1b5b7398efd 100644 --- a/src/EnergyPlus/PackagedThermalStorageCoil.cc +++ b/src/EnergyPlus/PackagedThermalStorageCoil.cc @@ -2765,7 +2765,7 @@ namespace PackagedThermalStorageCoil { if (TESCoil(TESCoilNum).CondenserType == EvapCooled) { UpdateEvaporativeCondenserBasinHeater(TESCoilNum); - UpdateEvaporativeCondenserWaterUse(TESCoilNum, CondInletHumRat, TESCoil(TESCoilNum).CondAirInletNodeNum); + UpdateEvaporativeCondenserWaterUse(state, TESCoilNum, CondInletHumRat, TESCoil(TESCoilNum).CondAirInletNodeNum); } } @@ -3196,7 +3196,7 @@ namespace PackagedThermalStorageCoil { if (TESCoil(TESCoilNum).CondenserType == EvapCooled) { UpdateEvaporativeCondenserBasinHeater(TESCoilNum); - UpdateEvaporativeCondenserWaterUse(TESCoilNum, CondInletHumRat, TESCoil(TESCoilNum).CondAirInletNodeNum); + UpdateEvaporativeCondenserWaterUse(state, TESCoilNum, CondInletHumRat, TESCoil(TESCoilNum).CondAirInletNodeNum); } } @@ -3584,7 +3584,7 @@ namespace PackagedThermalStorageCoil { if (TESCoil(TESCoilNum).CondenserType == EvapCooled) { UpdateEvaporativeCondenserBasinHeater(TESCoilNum); - UpdateEvaporativeCondenserWaterUse(TESCoilNum, CondInletHumRat, TESCoil(TESCoilNum).CondAirInletNodeNum); + UpdateEvaporativeCondenserWaterUse(state, TESCoilNum, CondInletHumRat, TESCoil(TESCoilNum).CondAirInletNodeNum); } } @@ -3769,7 +3769,7 @@ namespace PackagedThermalStorageCoil { if (TESCoil(TESCoilNum).CondenserType == EvapCooled) { UpdateEvaporativeCondenserBasinHeater(TESCoilNum); - UpdateEvaporativeCondenserWaterUse(TESCoilNum, CondInletHumRat, TESCoil(TESCoilNum).CondAirInletNodeNum); + UpdateEvaporativeCondenserWaterUse(state, TESCoilNum, CondInletHumRat, TESCoil(TESCoilNum).CondAirInletNodeNum); } } @@ -4075,7 +4075,7 @@ namespace PackagedThermalStorageCoil { if (TESCoil(TESCoilNum).CondenserType == EvapCooled) { UpdateEvaporativeCondenserBasinHeater(TESCoilNum); UpdateEvaporativeCondenserWaterUse( - TESCoilNum, Node(TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat, TESCoil(TESCoilNum).CondAirInletNodeNum); + state, TESCoilNum, Node(TESCoil(TESCoilNum).CondAirInletNodeNum).HumRat, TESCoil(TESCoilNum).CondAirInletNodeNum); } } @@ -4841,7 +4841,7 @@ namespace PackagedThermalStorageCoil { TESCoil(TESCoilNum).ElectEvapCondBasinHeaterEnergy = TESCoil(TESCoilNum).ElectEvapCondBasinHeaterPower * TimeStepSys * DataGlobalConstants::SecInHour(); } - void UpdateEvaporativeCondenserWaterUse(int const TESCoilNum, Real64 const HumRatAfterEvap, int const InletNodeNum) + void UpdateEvaporativeCondenserWaterUse(EnergyPlusData &state, int const TESCoilNum, Real64 const HumRatAfterEvap, int const InletNodeNum) { // SUBROUTINE INFORMATION: @@ -4860,7 +4860,6 @@ namespace PackagedThermalStorageCoil { // na // Using/Aliasing - using DataWater::WaterStorage; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: @@ -4884,13 +4883,13 @@ namespace PackagedThermalStorageCoil { // Set the demand request for supply water from water storage tank (if needed) if (TESCoil(TESCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - WaterStorage(TESCoil(TESCoilNum).EvapWaterSupTankID).VdotRequestDemand(TESCoil(TESCoilNum).EvapWaterTankDemandARRID) = + state.dataWaterData->WaterStorage(TESCoil(TESCoilNum).EvapWaterSupTankID).VdotRequestDemand(TESCoil(TESCoilNum).EvapWaterTankDemandARRID) = TESCoil(TESCoilNum).EvapWaterConsumpRate; } // check if should be starved by restricted flow from tank if (TESCoil(TESCoilNum).EvapWaterSupplyMode == WaterSupplyFromTank) { - AvailWaterRate = WaterStorage(TESCoil(TESCoilNum).EvapWaterSupTankID).VdotAvailDemand(TESCoil(TESCoilNum).EvapWaterTankDemandARRID); + AvailWaterRate = state.dataWaterData->WaterStorage(TESCoil(TESCoilNum).EvapWaterSupTankID).VdotAvailDemand(TESCoil(TESCoilNum).EvapWaterTankDemandARRID); if (AvailWaterRate < TESCoil(TESCoilNum).EvapWaterConsumpRate) { TESCoil(TESCoilNum).EvapWaterStarvMakupRate = TESCoil(TESCoilNum).EvapWaterConsumpRate - AvailWaterRate; TESCoil(TESCoilNum).EvapWaterConsumpRate = AvailWaterRate; diff --git a/src/EnergyPlus/PackagedThermalStorageCoil.hh b/src/EnergyPlus/PackagedThermalStorageCoil.hh index 2828565bb60..7d4ba8b2911 100644 --- a/src/EnergyPlus/PackagedThermalStorageCoil.hh +++ b/src/EnergyPlus/PackagedThermalStorageCoil.hh @@ -482,7 +482,7 @@ namespace PackagedThermalStorageCoil { void UpdateEvaporativeCondenserBasinHeater(int const TESCoilNum); - void UpdateEvaporativeCondenserWaterUse(int const TESCoilNum, Real64 const HumRatAfterEvap, int const InletNodeNum); + void UpdateEvaporativeCondenserWaterUse(EnergyPlusData &state, int const TESCoilNum, Real64 const HumRatAfterEvap, int const InletNodeNum); void GetTESCoilIndex(EnergyPlusData &state, std::string const &CoilName, int &CoilIndex, bool &ErrorsFound, Optional_string_const CurrentModuleObject = _); diff --git a/src/EnergyPlus/RefrigeratedCase.cc b/src/EnergyPlus/RefrigeratedCase.cc index c0eca731f9e..b8ff5d186e8 100644 --- a/src/EnergyPlus/RefrigeratedCase.cc +++ b/src/EnergyPlus/RefrigeratedCase.cc @@ -553,7 +553,7 @@ namespace RefrigeratedCase { // Therefore... if ((!HaveCasesOrWalkins) && (!UseSysTimeStep)) { // Zero requests for cooling water from plant or tank - ZeroHVACValues(); + ZeroHVACValues(state); return; } // Following case should never occur, but just for completeness: @@ -569,7 +569,7 @@ namespace RefrigeratedCase { if (HaveRefrigRacks) { for (int RackNum = 1; RackNum <= DataHeatBalance::NumRefrigeratedRacks; ++RackNum) { RefrigRack(RackNum).CalcRackSystem(state); - RefrigRack(RackNum).ReportRackSystem(RackNum); + RefrigRack(RackNum).ReportRackSystem(state, RackNum); } } @@ -9641,7 +9641,7 @@ namespace RefrigeratedCase { } // rack heat rejection to zone } - void RefrigRackData::ReportRackSystem(int const RackNum) + void RefrigRackData::ReportRackSystem(EnergyPlusData &state, int const RackNum) { // SUBROUTINE INFORMATION: @@ -9686,7 +9686,7 @@ namespace RefrigeratedCase { if (this->EvapWaterSupplyMode == WaterSupplyFromTank) { int DemandARRID = this->EvapWaterTankDemandARRID; int RackTankID = this->EvapWaterSupTankID; - DataWater::WaterStorage(RackTankID).VdotRequestDemand(DemandARRID) = this->EvapWaterConsumpRate; + state.dataWaterData->WaterStorage(RackTankID).VdotRequestDemand(DemandARRID) = this->EvapWaterConsumpRate; } SumZoneImpacts(); @@ -11663,7 +11663,7 @@ namespace RefrigeratedCase { // set water system demand request (if needed) if (condenser.EvapWaterSupplyMode == WaterSupplyFromTank) { - DataWater::WaterStorage(condenser.EvapWaterSupTankID).VdotRequestDemand(condenser.EvapWaterTankDemandARRID) = + state.dataWaterData->WaterStorage(condenser.EvapWaterSupTankID).VdotRequestDemand(condenser.EvapWaterTankDemandARRID) = condenser.EvapWaterConsumpRate; } } @@ -14916,7 +14916,7 @@ namespace RefrigeratedCase { if (!state.dataGlobal->BeginEnvrnFlag) FigureRefrigerationZoneGainsMyEnvrnFlag = true; } - void ZeroHVACValues() + void ZeroHVACValues(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -14950,7 +14950,7 @@ namespace RefrigeratedCase { if (RefrigRack(RackNum).EvapWaterSupplyMode == WaterSupplyFromTank) { DemandARRID = RefrigRack(RackNum).EvapWaterTankDemandARRID; int TankID = RefrigRack(RackNum).EvapWaterSupTankID; - DataWater::WaterStorage(TankID).VdotRequestDemand(DemandARRID) = 0.0; + state.dataWaterData->WaterStorage(TankID).VdotRequestDemand(DemandARRID) = 0.0; } } } // RackNum @@ -14973,7 +14973,7 @@ namespace RefrigeratedCase { if (Condenser(CondID).EvapWaterSupplyMode == WaterSupplyFromTank) { DemandARRID = Condenser(CondID).EvapWaterTankDemandARRID; int TankID = Condenser(CondID).EvapWaterSupTankID; - DataWater::WaterStorage(TankID).VdotRequestDemand(DemandARRID) = 0.0; + state.dataWaterData->WaterStorage(TankID).VdotRequestDemand(DemandARRID) = 0.0; } } } // ICond diff --git a/src/EnergyPlus/RefrigeratedCase.hh b/src/EnergyPlus/RefrigeratedCase.hh index dda4119f15a..d7467829817 100644 --- a/src/EnergyPlus/RefrigeratedCase.hh +++ b/src/EnergyPlus/RefrigeratedCase.hh @@ -367,7 +367,7 @@ namespace RefrigeratedCase { void CalcRackSystem(EnergyPlusData &state); - void ReportRackSystem(int RackNum); + void ReportRackSystem(EnergyPlusData &state, int RackNum); static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName); @@ -1563,7 +1563,7 @@ namespace RefrigeratedCase { void FigureRefrigerationZoneGains(EnergyPlusData &state); - void ZeroHVACValues(); + void ZeroHVACValues(EnergyPlusData &state); } // namespace RefrigeratedCase diff --git a/src/EnergyPlus/UserDefinedComponents.cc b/src/EnergyPlus/UserDefinedComponents.cc index ab47394db29..94e8d01ed69 100644 --- a/src/EnergyPlus/UserDefinedComponents.cc +++ b/src/EnergyPlus/UserDefinedComponents.cc @@ -210,7 +210,7 @@ namespace UserDefinedComponents { EnergyPlus::PluginManagement::pluginManager->runSingleUserDefinedPlugin(state, this->simPluginLocation); } - this->report(thisLoop); + this->report(state, thisLoop); } void SimCoilUserDefined(EnergyPlusData &state, @@ -287,7 +287,7 @@ namespace UserDefinedComponents { EnergyPlus::PluginManagement::pluginManager->runSingleUserDefinedPlugin(state, state.dataUserDefinedComponents->UserCoil(CompNum).simPluginLocation); } - state.dataUserDefinedComponents->UserCoil(CompNum).report(); + state.dataUserDefinedComponents->UserCoil(CompNum).report(state); if (AirLoopNum != -1) { // IF the system is not an equipment of outdoor air unit // determine if heating or cooling on primary air stream @@ -383,7 +383,7 @@ namespace UserDefinedComponents { EnergyPlus::PluginManagement::pluginManager->runSingleUserDefinedPlugin(state, state.dataUserDefinedComponents->UserZoneAirHVAC(CompNum).simPluginLocation); } - state.dataUserDefinedComponents->UserZoneAirHVAC(CompNum).report(); + state.dataUserDefinedComponents->UserZoneAirHVAC(CompNum).report(state); // calculate delivered capacity Real64 AirMassFlow = min(DataLoopNode::Node(state.dataUserDefinedComponents->UserZoneAirHVAC(CompNum).ZoneAir.InletNodeNum).MassFlowRate, @@ -479,7 +479,7 @@ namespace UserDefinedComponents { EnergyPlus::PluginManagement::pluginManager->runSingleUserDefinedPlugin(state, state.dataUserDefinedComponents->UserAirTerminal(CompNum).simPluginLocation); } - state.dataUserDefinedComponents->UserAirTerminal(CompNum).report(); + state.dataUserDefinedComponents->UserAirTerminal(CompNum).report(state); } void GetUserDefinedPlantComponents(EnergyPlusData &state) @@ -2355,7 +2355,7 @@ namespace UserDefinedComponents { } } - void UserPlantComponentStruct::report(int const LoopNum) + void UserPlantComponentStruct::report(EnergyPlusData &state, int const LoopNum) { // SUBROUTINE INFORMATION: @@ -2393,11 +2393,11 @@ namespace UserDefinedComponents { } if (this->Water.SuppliedByWaterSystem) { - DataWater::WaterStorage(this->Water.SupplyTankID).VdotRequestDemand(this->Water.SupplyTankDemandARRID) = this->Water.SupplyVdotRequest; + state.dataWaterData->WaterStorage(this->Water.SupplyTankID).VdotRequestDemand(this->Water.SupplyTankDemandARRID) = this->Water.SupplyVdotRequest; } if (this->Water.CollectsToWaterSystem) { - DataWater::WaterStorage(this->Water.CollectionTankID).VdotAvailSupply(this->Water.CollectionTankSupplyARRID) = this->Water.CollectedVdot; + state.dataWaterData->WaterStorage(this->Water.CollectionTankID).VdotAvailSupply(this->Water.CollectionTankSupplyARRID) = this->Water.CollectedVdot; } if (this->Loop(LoopNum).HowLoadServed == DataPlant::HowMet_ByNominalCapLowOutLimit) { @@ -2417,7 +2417,7 @@ namespace UserDefinedComponents { } } - void UserCoilComponentStruct::report() + void UserCoilComponentStruct::report(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -2459,15 +2459,15 @@ namespace UserDefinedComponents { } if (this->Water.SuppliedByWaterSystem) { - DataWater::WaterStorage(this->Water.SupplyTankID).VdotRequestDemand(this->Water.SupplyTankDemandARRID) = this->Water.SupplyVdotRequest; + state.dataWaterData->WaterStorage(this->Water.SupplyTankID).VdotRequestDemand(this->Water.SupplyTankDemandARRID) = this->Water.SupplyVdotRequest; } if (this->Water.CollectsToWaterSystem) { - DataWater::WaterStorage(this->Water.CollectionTankID).VdotAvailSupply(this->Water.CollectionTankSupplyARRID) = this->Water.CollectedVdot; + state.dataWaterData->WaterStorage(this->Water.CollectionTankID).VdotAvailSupply(this->Water.CollectionTankSupplyARRID) = this->Water.CollectedVdot; } } - void UserZoneHVACForcedAirComponentStruct::report() + void UserZoneHVACForcedAirComponentStruct::report(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -2511,15 +2511,15 @@ namespace UserDefinedComponents { } if (this->Water.SuppliedByWaterSystem) { - DataWater::WaterStorage(this->Water.SupplyTankID).VdotRequestDemand(this->Water.SupplyTankDemandARRID) = this->Water.SupplyVdotRequest; + state.dataWaterData->WaterStorage(this->Water.SupplyTankID).VdotRequestDemand(this->Water.SupplyTankDemandARRID) = this->Water.SupplyVdotRequest; } if (this->Water.CollectsToWaterSystem) { - DataWater::WaterStorage(this->Water.CollectionTankID).VdotAvailSupply(this->Water.CollectionTankSupplyARRID) = this->Water.CollectedVdot; + state.dataWaterData->WaterStorage(this->Water.CollectionTankID).VdotAvailSupply(this->Water.CollectionTankSupplyARRID) = this->Water.CollectedVdot; } } - void UserAirTerminalComponentStruct::report() + void UserAirTerminalComponentStruct::report(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -2559,11 +2559,11 @@ namespace UserDefinedComponents { } if (this->Water.SuppliedByWaterSystem) { - DataWater::WaterStorage(this->Water.SupplyTankID).VdotRequestDemand(this->Water.SupplyTankDemandARRID) = this->Water.SupplyVdotRequest; + state.dataWaterData->WaterStorage(this->Water.SupplyTankID).VdotRequestDemand(this->Water.SupplyTankDemandARRID) = this->Water.SupplyVdotRequest; } if (this->Water.CollectsToWaterSystem) { - DataWater::WaterStorage(this->Water.CollectionTankID).VdotAvailSupply(this->Water.CollectionTankSupplyARRID) = this->Water.CollectedVdot; + state.dataWaterData->WaterStorage(this->Water.CollectionTankID).VdotAvailSupply(this->Water.CollectionTankSupplyARRID) = this->Water.CollectedVdot; } } diff --git a/src/EnergyPlus/UserDefinedComponents.hh b/src/EnergyPlus/UserDefinedComponents.hh index 6a5a55f2640..9204185c308 100644 --- a/src/EnergyPlus/UserDefinedComponents.hh +++ b/src/EnergyPlus/UserDefinedComponents.hh @@ -196,7 +196,7 @@ namespace UserDefinedComponents { void initialize(EnergyPlusData &state, int LoopNum, Real64 MyLoad); - void report(int LoopNum); + void report(EnergyPlusData &state, int LoopNum); }; struct UserCoilComponentStruct @@ -222,7 +222,7 @@ namespace UserDefinedComponents { void initialize(EnergyPlusData &state); - void report(); + void report(EnergyPlusData &state); }; struct UserZoneHVACForcedAirComponentStruct @@ -254,7 +254,7 @@ namespace UserDefinedComponents { void initialize(EnergyPlusData &state, int ZoneNum); - void report(); + void report(EnergyPlusData &state); }; struct UserAirTerminalComponentStruct @@ -288,7 +288,7 @@ namespace UserDefinedComponents { void initialize(EnergyPlusData &state, int ZoneNum); - void report(); + void report(EnergyPlusData &state); }; void SimCoilUserDefined(EnergyPlusData &state, diff --git a/src/EnergyPlus/VariableSpeedCoils.cc b/src/EnergyPlus/VariableSpeedCoils.cc index d8245ac222b..bb56a9ee49a 100644 --- a/src/EnergyPlus/VariableSpeedCoils.cc +++ b/src/EnergyPlus/VariableSpeedCoils.cc @@ -4892,7 +4892,6 @@ namespace VariableSpeedCoils { using DataHVACGlobals::DXElecCoolingPower; using DataHVACGlobals::TimeStepSys; using DataPlant::PlantLoop; - using DataWater::WaterStorage; using FluidProperties::GetSpecificHeatGlycol; using Psychrometrics::PsyCpAirFnW; using Psychrometrics::PsyHFnTdbW; @@ -5415,7 +5414,7 @@ namespace VariableSpeedCoils { // set water system demand request (if needed) if (state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupplyMode == state.dataVariableSpeedCoils->WaterSupplyFromTank) { - WaterStorage(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterTankDemandARRID) = + state.dataWaterData->WaterStorage(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterSupTankID).VdotRequestDemand(state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterTankDemandARRID) = state.dataVariableSpeedCoils->VarSpeedCoil(DXCoilNum).EvapWaterConsumpRate; } } diff --git a/src/EnergyPlus/WaterCoils.cc b/src/EnergyPlus/WaterCoils.cc index c8abd07e259..b81197f711b 100644 --- a/src/EnergyPlus/WaterCoils.cc +++ b/src/EnergyPlus/WaterCoils.cc @@ -4739,7 +4739,6 @@ namespace WaterCoils { // na // Using/Aliasing - using DataWater::WaterStorage; // Locals // SUBROUTINE ARGUMENT DEFINITIONS: @@ -4816,9 +4815,9 @@ namespace WaterCoils { state.dataWaterCoils->WaterCoil(CoilNum).CondensateVdot = max(0.0, (state.dataWaterCoils->WaterCoil(CoilNum).InletAirMassFlowRate * (SpecHumIn - SpecHumOut) / RhoWater)); state.dataWaterCoils->WaterCoil(CoilNum).CondensateVol = state.dataWaterCoils->WaterCoil(CoilNum).CondensateVdot * ReportingConstant; - WaterStorage(state.dataWaterCoils->WaterCoil(CoilNum).CondensateTankID).VdotAvailSupply(state.dataWaterCoils->WaterCoil(CoilNum).CondensateTankSupplyARRID) = + state.dataWaterData->WaterStorage(state.dataWaterCoils->WaterCoil(CoilNum).CondensateTankID).VdotAvailSupply(state.dataWaterCoils->WaterCoil(CoilNum).CondensateTankSupplyARRID) = state.dataWaterCoils->WaterCoil(CoilNum).CondensateVdot; - WaterStorage(state.dataWaterCoils->WaterCoil(CoilNum).CondensateTankID).TwaterSupply(state.dataWaterCoils->WaterCoil(CoilNum).CondensateTankSupplyARRID) = + state.dataWaterData->WaterStorage(state.dataWaterCoils->WaterCoil(CoilNum).CondensateTankID).TwaterSupply(state.dataWaterCoils->WaterCoil(CoilNum).CondensateTankSupplyARRID) = state.dataWaterCoils->WaterCoil(CoilNum).OutletAirTemp; } } diff --git a/src/EnergyPlus/WaterManager.cc b/src/EnergyPlus/WaterManager.cc index f5dd2a71beb..6afa4abccf3 100644 --- a/src/EnergyPlus/WaterManager.cc +++ b/src/EnergyPlus/WaterManager.cc @@ -135,11 +135,11 @@ namespace WaterManager { } // tank loop for (RainColNum = 1; RainColNum <= NumRainCollectors; ++RainColNum) { - CalcRainCollector(RainColNum); + CalcRainCollector(state, RainColNum); } for (WellNum = 1; WellNum <= NumGroundWaterWells; ++WellNum) { - CalcGroundwaterWell(WellNum); + CalcGroundwaterWell(state, WellNum); } // call the tanks again to get updated rain and well activity @@ -255,7 +255,7 @@ namespace WaterManager { NumWaterStorageTanks = inputProcessor->getNumObjectsFound(cCurrentModuleObject); if (NumWaterStorageTanks > 0) { AnyWaterSystemsInModel = true; - if (!(allocated(WaterStorage))) WaterStorage.allocate(NumWaterStorageTanks); + if (!(allocated(state.dataWaterData->WaterStorage))) state.dataWaterData->WaterStorage.allocate(NumWaterStorageTanks); for (Item = 1; Item <= NumWaterStorageTanks; ++Item) { inputProcessor->getObjectItem(state, @@ -271,110 +271,94 @@ namespace WaterManager { cAlphaFieldNames, cNumericFieldNames); AnyWaterSystemsInModel = true; - WaterStorage(Item).Name = cAlphaArgs(1); + state.dataWaterData->WaterStorage(Item).Name = cAlphaArgs(1); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); objNameMsg = cCurrentModuleObject + " = " + cAlphaArgs(1); - WaterStorage(Item).QualitySubCategoryName = cAlphaArgs(2); - // If (UtilityRoutines::SameString(cAlphaArgs(2), 'Mains')) Then - // WaterStorage(Item)%QualitySubCategory = MainsWater - // ELSEIF (UtilityRoutines::SameString(cAlphaArgs(2), 'RAINWATER')) Then - // WaterStorage(Item)%QualitySubCategory = RainWater - // ELSEIF (UtilityRoutines::SameString(cAlphaArgs(2), 'GREYWATER')) Then - // WaterStorage(Item)%QualitySubCategory = GreyWater - // ELSEIF (UtilityRoutines::SameString(cAlphaArgs(2), 'WELLWATER')) Then - // WaterStorage(Item)%QualitySubCategory = WellWater - // ELSEIF (UtilityRoutines::SameString(cAlphaArgs(2), 'BLACKWATER')) Then - // WaterStorage(Item)%QualitySubCategory = BlackWater - - // ELSE - // CALL ShowSevereError('Invalid '//TRIM(cAlphaFieldNames(2))//'='//TRIM(cAlphaArgs(2))) - // CALL ShowContinueError('Entered in '//TRIM(cCurrentModuleObject)//'='//TRIM(cAlphaArgs(1))) - // ErrorsFound = .TRUE. - // ENDIF - - WaterStorage(Item).MaxCapacity = rNumericArgs(1); - if (WaterStorage(Item).MaxCapacity == 0.0) { // default - WaterStorage(Item).MaxCapacity = DataGlobalConstants::BigNumber(); + state.dataWaterData->WaterStorage(Item).QualitySubCategoryName = cAlphaArgs(2); + + state.dataWaterData->WaterStorage(Item).MaxCapacity = rNumericArgs(1); + if (state.dataWaterData->WaterStorage(Item).MaxCapacity == 0.0) { // default + state.dataWaterData->WaterStorage(Item).MaxCapacity = DataGlobalConstants::BigNumber(); } - WaterStorage(Item).InitialVolume = rNumericArgs(2); - WaterStorage(Item).MaxInFlowRate = rNumericArgs(3); - if (WaterStorage(Item).MaxInFlowRate == 0.0) { // default - WaterStorage(Item).MaxInFlowRate = DataGlobalConstants::BigNumber(); + state.dataWaterData->WaterStorage(Item).InitialVolume = rNumericArgs(2); + state.dataWaterData->WaterStorage(Item).MaxInFlowRate = rNumericArgs(3); + if (state.dataWaterData->WaterStorage(Item).MaxInFlowRate == 0.0) { // default + state.dataWaterData->WaterStorage(Item).MaxInFlowRate = DataGlobalConstants::BigNumber(); } - WaterStorage(Item).MaxOutFlowRate = rNumericArgs(4); - if (WaterStorage(Item).MaxOutFlowRate == 0.0) { // default - WaterStorage(Item).MaxOutFlowRate = DataGlobalConstants::BigNumber(); + state.dataWaterData->WaterStorage(Item).MaxOutFlowRate = rNumericArgs(4); + if (state.dataWaterData->WaterStorage(Item).MaxOutFlowRate == 0.0) { // default + state.dataWaterData->WaterStorage(Item).MaxOutFlowRate = DataGlobalConstants::BigNumber(); } - WaterStorage(Item).OverflowTankName = cAlphaArgs(3); // setup later + state.dataWaterData->WaterStorage(Item).OverflowTankName = cAlphaArgs(3); // setup later if (UtilityRoutines::SameString(cAlphaArgs(4), "None")) { - WaterStorage(Item).ControlSupplyType = NoControlLevel; + state.dataWaterData->WaterStorage(Item).ControlSupplyType = NoControlLevel; } else if (UtilityRoutines::SameString(cAlphaArgs(4), "Mains")) { - WaterStorage(Item).ControlSupplyType = MainsFloatValve; + state.dataWaterData->WaterStorage(Item).ControlSupplyType = MainsFloatValve; } else if (UtilityRoutines::SameString(cAlphaArgs(4), "GroundwaterWell")) { - WaterStorage(Item).ControlSupplyType = WellFloatValve; + state.dataWaterData->WaterStorage(Item).ControlSupplyType = WellFloatValve; } else if (UtilityRoutines::SameString(cAlphaArgs(4), "OtherTank")) { - WaterStorage(Item).ControlSupplyType = OtherTankFloatValve; + state.dataWaterData->WaterStorage(Item).ControlSupplyType = OtherTankFloatValve; } else { ShowSevereError("Invalid " + cAlphaFieldNames(4) + '=' + cAlphaArgs(4)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; } - WaterStorage(Item).ValveOnCapacity = rNumericArgs(5); - WaterStorage(Item).ValveOffCapacity = rNumericArgs(6); - if (WaterStorage(Item).ControlSupplyType != NoControlLevel) { - if (WaterStorage(Item).ValveOffCapacity < WaterStorage(Item).ValveOnCapacity) { + state.dataWaterData->WaterStorage(Item).ValveOnCapacity = rNumericArgs(5); + state.dataWaterData->WaterStorage(Item).ValveOffCapacity = rNumericArgs(6); + if (state.dataWaterData->WaterStorage(Item).ControlSupplyType != NoControlLevel) { + if (state.dataWaterData->WaterStorage(Item).ValveOffCapacity < state.dataWaterData->WaterStorage(Item).ValveOnCapacity) { ShowSevereError("Invalid " + cNumericFieldNames(5) + " and/or " + cNumericFieldNames(6)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ShowContinueError(cNumericFieldNames(6) + " must be greater than " + cNumericFieldNames(5)); ShowContinueError("Check value for " + cNumericFieldNames(5) + " = " + - RoundSigDigits(WaterStorage(Item).ValveOnCapacity, 5)); + RoundSigDigits(state.dataWaterData->WaterStorage(Item).ValveOnCapacity, 5)); ShowContinueError("which must be lower than " + cNumericFieldNames(6) + " = " + - RoundSigDigits(WaterStorage(Item).ValveOffCapacity, 5)); + RoundSigDigits(state.dataWaterData->WaterStorage(Item).ValveOffCapacity, 5)); ErrorsFound = true; } } - WaterStorage(Item).BackupMainsCapacity = rNumericArgs(7); - if (WaterStorage(Item).BackupMainsCapacity > 0.0) { // add backup to well and other thank supply - if (WaterStorage(Item).ControlSupplyType == WellFloatValve) { - WaterStorage(Item).ControlSupplyType = WellFloatMainsBackup; + state.dataWaterData->WaterStorage(Item).BackupMainsCapacity = rNumericArgs(7); + if (state.dataWaterData->WaterStorage(Item).BackupMainsCapacity > 0.0) { // add backup to well and other thank supply + if (state.dataWaterData->WaterStorage(Item).ControlSupplyType == WellFloatValve) { + state.dataWaterData->WaterStorage(Item).ControlSupplyType = WellFloatMainsBackup; } - if (WaterStorage(Item).ControlSupplyType == OtherTankFloatValve) { - WaterStorage(Item).ControlSupplyType = TankMainsBackup; + if (state.dataWaterData->WaterStorage(Item).ControlSupplyType == OtherTankFloatValve) { + state.dataWaterData->WaterStorage(Item).ControlSupplyType = TankMainsBackup; } } - WaterStorage(Item).SupplyTankName = cAlphaArgs(5); // set up later + state.dataWaterData->WaterStorage(Item).SupplyTankName = cAlphaArgs(5); // set up later if (UtilityRoutines::SameString(cAlphaArgs(6), "ScheduledTemperature")) { - WaterStorage(Item).ThermalMode = ScheduledTankTemp; + state.dataWaterData->WaterStorage(Item).ThermalMode = ScheduledTankTemp; } else if (UtilityRoutines::SameString(cAlphaArgs(6), "ThermalModel")) { - WaterStorage(Item).ThermalMode = TankZoneThermalCoupled; + state.dataWaterData->WaterStorage(Item).ThermalMode = TankZoneThermalCoupled; } else { ShowSevereError("Invalid " + cAlphaFieldNames(6) + '=' + cAlphaArgs(6)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); } - if (WaterStorage(Item).ThermalMode == ScheduledTankTemp) { - WaterStorage(Item).TempSchedID = GetScheduleIndex(state, cAlphaArgs(7)); - if (WaterStorage(Item).TempSchedID == 0) { + if (state.dataWaterData->WaterStorage(Item).ThermalMode == ScheduledTankTemp) { + state.dataWaterData->WaterStorage(Item).TempSchedID = GetScheduleIndex(state, cAlphaArgs(7)); + if (state.dataWaterData->WaterStorage(Item).TempSchedID == 0) { ShowSevereError("Invalid " + cAlphaFieldNames(7) + '=' + cAlphaArgs(7)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; } - tmpMin = GetScheduleMinValue(WaterStorage(Item).TempSchedID); + tmpMin = GetScheduleMinValue(state.dataWaterData->WaterStorage(Item).TempSchedID); if (tmpMin < 0.0) { ShowSevereError("Invalid " + cAlphaFieldNames(7) + '=' + cAlphaArgs(7)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ShowContinueError("Found storage tank temperature schedule value less than 0.0 in " + objNameMsg); ErrorsFound = true; } - tmpMax = GetScheduleMaxValue(WaterStorage(Item).TempSchedID); + tmpMax = GetScheduleMaxValue(state.dataWaterData->WaterStorage(Item).TempSchedID); if (tmpMax > 100.0) { ShowSevereError("Invalid " + cAlphaFieldNames(7) + '=' + cAlphaArgs(7)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); @@ -383,33 +367,33 @@ namespace WaterManager { } } - if (WaterStorage(Item).ThermalMode == TankZoneThermalCoupled) { + if (state.dataWaterData->WaterStorage(Item).ThermalMode == TankZoneThermalCoupled) { if (UtilityRoutines::SameString(cAlphaArgs(8), "Schedule")) { - WaterStorage(Item).AmbientTempIndicator = AmbientTempSchedule; + state.dataWaterData->WaterStorage(Item).AmbientTempIndicator = AmbientTempSchedule; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "Zone")) { - WaterStorage(Item).AmbientTempIndicator = AmbientTempZone; + state.dataWaterData->WaterStorage(Item).AmbientTempIndicator = AmbientTempZone; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "Outdoors")) { - WaterStorage(Item).AmbientTempIndicator = AmbientTempExterior; + state.dataWaterData->WaterStorage(Item).AmbientTempIndicator = AmbientTempExterior; } else { ShowSevereError("Invalid " + cAlphaFieldNames(8) + '=' + cAlphaArgs(8)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; } - WaterStorage(Item).AmbientTempSchedule = GetScheduleIndex(state, cAlphaArgs(9)); - if ((WaterStorage(Item).AmbientTempSchedule == 0) && (WaterStorage(Item).AmbientTempIndicator == AmbientTempSchedule)) { + state.dataWaterData->WaterStorage(Item).AmbientTempSchedule = GetScheduleIndex(state, cAlphaArgs(9)); + if ((state.dataWaterData->WaterStorage(Item).AmbientTempSchedule == 0) && (state.dataWaterData->WaterStorage(Item).AmbientTempIndicator == AmbientTempSchedule)) { ShowSevereError("Invalid " + cAlphaFieldNames(9) + '=' + cAlphaArgs(9)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; } - WaterStorage(Item).ZoneID = UtilityRoutines::FindItemInList(cAlphaArgs(10), Zone); - if ((WaterStorage(Item).ZoneID == 0) && (WaterStorage(Item).AmbientTempIndicator == AmbientTempZone)) { + state.dataWaterData->WaterStorage(Item).ZoneID = UtilityRoutines::FindItemInList(cAlphaArgs(10), Zone); + if ((state.dataWaterData->WaterStorage(Item).ZoneID == 0) && (state.dataWaterData->WaterStorage(Item).AmbientTempIndicator == AmbientTempZone)) { ShowSevereError("Invalid " + cAlphaFieldNames(10) + '=' + cAlphaArgs(10)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; } - WaterStorage(Item).SurfArea = rNumericArgs(8); - WaterStorage(Item).UValue = rNumericArgs(9); - WaterStorage(Item).SurfMaterialName = cAlphaArgs(11); + state.dataWaterData->WaterStorage(Item).SurfArea = rNumericArgs(8); + state.dataWaterData->WaterStorage(Item).UValue = rNumericArgs(9); + state.dataWaterData->WaterStorage(Item).SurfMaterialName = cAlphaArgs(11); // todo verify material collect and store useful data from it. } } @@ -440,7 +424,7 @@ namespace WaterManager { objNameMsg = cCurrentModuleObject + " Named " + cAlphaArgs(1); RainCollector(Item).StorageTankName = cAlphaArgs(2); - RainCollector(Item).StorageTankID = UtilityRoutines::FindItemInList(cAlphaArgs(2), WaterStorage); + RainCollector(Item).StorageTankID = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataWaterData->WaterStorage); if (RainCollector(Item).StorageTankID == 0) { ShowSevereError("Invalid " + cAlphaFieldNames(2) + '=' + cAlphaArgs(2)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); @@ -522,7 +506,7 @@ namespace WaterManager { RainCollector(Item).MeanHeight = tmpNumerator / tmpDenominator; // now set up tank supply connection - InternalSetupTankSupplyComponent(RainCollector(Item).Name, + InternalSetupTankSupplyComponent(state, RainCollector(Item).Name, cCurrentModuleObject, RainCollector(Item).StorageTankName, ErrorsFound, @@ -554,14 +538,14 @@ namespace WaterManager { objNameMsg = cCurrentModuleObject + " Named " + cAlphaArgs(1); GroundwaterWell(Item).StorageTankName = cAlphaArgs(2); - InternalSetupTankSupplyComponent(GroundwaterWell(Item).Name, + InternalSetupTankSupplyComponent(state, GroundwaterWell(Item).Name, cCurrentModuleObject, GroundwaterWell(Item).StorageTankName, ErrorsFound, GroundwaterWell(Item).StorageTankID, GroundwaterWell(Item).StorageTankSupplyARRID); - if (allocated(WaterStorage)) WaterStorage(GroundwaterWell(Item).StorageTankID).GroundWellID = Item; + if (allocated(state.dataWaterData->WaterStorage)) state.dataWaterData->WaterStorage(GroundwaterWell(Item).StorageTankID).GroundWellID = Item; GroundwaterWell(Item).PumpDepth = rNumericArgs(1); GroundwaterWell(Item).PumpNomVolFlowRate = rNumericArgs(2); @@ -599,53 +583,53 @@ namespace WaterManager { if (NumWaterStorageTanks > 0) { for (Item = 1; Item <= NumWaterStorageTanks; ++Item) { // check that all storage tanks with ground well controls actually had wells pointing to them - if ((WaterStorage(Item).ControlSupplyType == WellFloatValve) || (WaterStorage(Item).ControlSupplyType == WellFloatMainsBackup)) { - if (WaterStorage(Item).GroundWellID == 0) { - ShowSevereError(cCurrentModuleObject + "= \"" + WaterStorage(Item).Name + + if ((state.dataWaterData->WaterStorage(Item).ControlSupplyType == WellFloatValve) || (state.dataWaterData->WaterStorage(Item).ControlSupplyType == WellFloatMainsBackup)) { + if (state.dataWaterData->WaterStorage(Item).GroundWellID == 0) { + ShowSevereError(cCurrentModuleObject + "= \"" + state.dataWaterData->WaterStorage(Item).Name + "\" does not have a WaterUse:Well (groundwater well) that names it."); ErrorsFound = true; } } // setup tanks whose level is controlled by supply from another tank - if ((WaterStorage(Item).ControlSupplyType == OtherTankFloatValve) || (WaterStorage(Item).ControlSupplyType == TankMainsBackup)) { - WaterStorage(Item).SupplyTankID = UtilityRoutines::FindItemInList(WaterStorage(Item).SupplyTankName, WaterStorage); - if (WaterStorage(Item).SupplyTankID == 0) { - ShowSevereError("Other tank called " + WaterStorage(Item).SupplyTankName + " not found for " + cCurrentModuleObject + - " Named " + WaterStorage(Item).Name); // TODO rename point + if ((state.dataWaterData->WaterStorage(Item).ControlSupplyType == OtherTankFloatValve) || (state.dataWaterData->WaterStorage(Item).ControlSupplyType == TankMainsBackup)) { + state.dataWaterData->WaterStorage(Item).SupplyTankID = UtilityRoutines::FindItemInList(state.dataWaterData->WaterStorage(Item).SupplyTankName, state.dataWaterData->WaterStorage); + if (state.dataWaterData->WaterStorage(Item).SupplyTankID == 0) { + ShowSevereError("Other tank called " + state.dataWaterData->WaterStorage(Item).SupplyTankName + " not found for " + cCurrentModuleObject + + " Named " + state.dataWaterData->WaterStorage(Item).Name); // TODO rename point ErrorsFound = true; } - InternalSetupTankDemandComponent(WaterStorage(Item).Name, + InternalSetupTankDemandComponent(state, state.dataWaterData->WaterStorage(Item).Name, cCurrentModuleObject, - WaterStorage(Item).SupplyTankName, + state.dataWaterData->WaterStorage(Item).SupplyTankName, ErrorsFound, - WaterStorage(Item).SupplyTankID, - WaterStorage(Item).SupplyTankDemandARRID); + state.dataWaterData->WaterStorage(Item).SupplyTankID, + state.dataWaterData->WaterStorage(Item).SupplyTankDemandARRID); // call to setup tank supply as well - InternalSetupTankSupplyComponent( - WaterStorage(Item).SupplyTankName, cCurrentModuleObject, WaterStorage(Item).Name, ErrorsFound, Dummy, Dummy); + InternalSetupTankSupplyComponent(state, + state.dataWaterData->WaterStorage(Item).SupplyTankName, cCurrentModuleObject, state.dataWaterData->WaterStorage(Item).Name, ErrorsFound, Dummy, Dummy); } // setup overflow inputs - WaterStorage(Item).OverflowTankID = UtilityRoutines::FindItemInList(WaterStorage(Item).OverflowTankName, WaterStorage); - if (WaterStorage(Item).OverflowTankID == 0) { + state.dataWaterData->WaterStorage(Item).OverflowTankID = UtilityRoutines::FindItemInList(state.dataWaterData->WaterStorage(Item).OverflowTankName, state.dataWaterData->WaterStorage); + if (state.dataWaterData->WaterStorage(Item).OverflowTankID == 0) { // if blank, then okay it is discarded. but if not blank then error - if (is_blank(WaterStorage(Item).OverflowTankName)) { - WaterStorage(Item).OverflowMode = OverflowDiscarded; + if (is_blank(state.dataWaterData->WaterStorage(Item).OverflowTankName)) { + state.dataWaterData->WaterStorage(Item).OverflowMode = OverflowDiscarded; } else { - ShowSevereError("Overflow tank name of " + WaterStorage(Item).OverflowTankName + " not found for " + - cCurrentModuleObject + " Named " + WaterStorage(Item).Name); + ShowSevereError("Overflow tank name of " + state.dataWaterData->WaterStorage(Item).OverflowTankName + " not found for " + + cCurrentModuleObject + " Named " + state.dataWaterData->WaterStorage(Item).Name); ErrorsFound = true; } } else { - WaterStorage(Item).OverflowMode = OverflowToTank; + state.dataWaterData->WaterStorage(Item).OverflowMode = OverflowToTank; } - if (WaterStorage(Item).OverflowMode == OverflowToTank) { - InternalSetupTankSupplyComponent(WaterStorage(Item).Name, + if (state.dataWaterData->WaterStorage(Item).OverflowMode == OverflowToTank) { + InternalSetupTankSupplyComponent(state, state.dataWaterData->WaterStorage(Item).Name, cCurrentModuleObject, - WaterStorage(Item).OverflowTankName, + state.dataWaterData->WaterStorage(Item).OverflowTankName, ErrorsFound, - WaterStorage(Item).OverflowTankID, - WaterStorage(Item).OverflowTankSupplyARRID); + state.dataWaterData->WaterStorage(Item).OverflowTankID, + state.dataWaterData->WaterStorage(Item).OverflowTankSupplyARRID); } } } @@ -745,82 +729,82 @@ namespace WaterManager { // this next one is a measure of the state of water in the tank, not a flux of m3 that needs to be summed SetupOutputVariable(state, "Water System Storage Tank Volume", OutputProcessor::Unit::m3, - WaterStorage(Item).ThisTimeStepVolume, + state.dataWaterData->WaterStorage(Item).ThisTimeStepVolume, "System", "Average", - WaterStorage(Item).Name); + state.dataWaterData->WaterStorage(Item).Name); SetupOutputVariable(state, "Water System Storage Tank Net Volume Flow Rate", OutputProcessor::Unit::m3_s, - WaterStorage(Item).NetVdot, + state.dataWaterData->WaterStorage(Item).NetVdot, "System", "Average", - WaterStorage(Item).Name); + state.dataWaterData->WaterStorage(Item).Name); SetupOutputVariable(state, "Water System Storage Tank Inlet Volume Flow Rate", OutputProcessor::Unit::m3_s, - WaterStorage(Item).VdotToTank, + state.dataWaterData->WaterStorage(Item).VdotToTank, "System", "Average", - WaterStorage(Item).Name); + state.dataWaterData->WaterStorage(Item).Name); SetupOutputVariable(state, "Water System Storage Tank Outlet Volume Flow Rate", OutputProcessor::Unit::m3_s, - WaterStorage(Item).VdotFromTank, + state.dataWaterData->WaterStorage(Item).VdotFromTank, "System", "Average", - WaterStorage(Item).Name); + state.dataWaterData->WaterStorage(Item).Name); SetupOutputVariable(state, "Water System Storage Tank Mains Water Volume", OutputProcessor::Unit::m3, - WaterStorage(Item).MainsDrawVol, + state.dataWaterData->WaterStorage(Item).MainsDrawVol, "System", "Sum", - WaterStorage(Item).Name, + state.dataWaterData->WaterStorage(Item).Name, _, "MainsWater", "WaterSystem", - WaterStorage(Item).QualitySubCategoryName, + state.dataWaterData->WaterStorage(Item).QualitySubCategoryName, "System"); SetupOutputVariable(state, "Water System Storage Tank Mains Water Volume Flow Rate", OutputProcessor::Unit::m3_s, - WaterStorage(Item).MainsDrawVdot, + state.dataWaterData->WaterStorage(Item).MainsDrawVdot, "System", "Average", - WaterStorage(Item).Name); + state.dataWaterData->WaterStorage(Item).Name); SetupOutputVariable(state, "Water System Storage Tank Water Temperature", OutputProcessor::Unit::C, - WaterStorage(Item).Twater, + state.dataWaterData->WaterStorage(Item).Twater, "System", "Average", - WaterStorage(Item).Name); + state.dataWaterData->WaterStorage(Item).Name); SetupOutputVariable(state, "Water System Storage Tank Overflow Volume Flow Rate", OutputProcessor::Unit::m3_s, - WaterStorage(Item).VdotOverflow, + state.dataWaterData->WaterStorage(Item).VdotOverflow, "System", "Average", - WaterStorage(Item).Name); - if (WaterStorage(Item).OverflowMode == OverflowDiscarded) { + state.dataWaterData->WaterStorage(Item).Name); + if (state.dataWaterData->WaterStorage(Item).OverflowMode == OverflowDiscarded) { SetupOutputVariable(state, "Water System Storage Tank Overflow Water Volume", OutputProcessor::Unit::m3, - WaterStorage(Item).VolOverflow, + state.dataWaterData->WaterStorage(Item).VolOverflow, "System", "Sum", - WaterStorage(Item).Name); + state.dataWaterData->WaterStorage(Item).Name); // ResourceTypeKey='Water', & // EndUseKey='WaterSystems', & - // EndUseSubkey=WaterStorage(item)%QualitySubCategoryName ,& + // EndUseSubkey=state.dataWaterData->WaterStorage(item)%QualitySubCategoryName ,& // GroupKey='System') } else { SetupOutputVariable(state, "Water System Storage Tank Overflow Water Volume", OutputProcessor::Unit::m3, - WaterStorage(Item).VolOverflow, + state.dataWaterData->WaterStorage(Item).VolOverflow, "System", "Sum", - WaterStorage(Item).Name); + state.dataWaterData->WaterStorage(Item).Name); } SetupOutputVariable(state, "Water System Storage Tank Overflow Temperature", OutputProcessor::Unit::C, - WaterStorage(Item).TwaterOverflow, + state.dataWaterData->WaterStorage(Item).TwaterOverflow, "System", "Average", - WaterStorage(Item).Name); + state.dataWaterData->WaterStorage(Item).Name); } if (NumSiteRainFall == 1) { // CurrentModuleObject='Site:Precipitation' @@ -1115,57 +1099,57 @@ namespace WaterManager { } overflowVdot = 0.0; - if (WaterStorage(TankNum).NumWaterSupplies > 0) { - OrigVdotSupplyAvail = sum(WaterStorage(TankNum).VdotAvailSupply); + if (state.dataWaterData->WaterStorage(TankNum).NumWaterSupplies > 0) { + OrigVdotSupplyAvail = sum(state.dataWaterData->WaterStorage(TankNum).VdotAvailSupply); } else { OrigVdotSupplyAvail = 0.0; } TotVdotSupplyAvail = OrigVdotSupplyAvail; // Init - if (TotVdotSupplyAvail > WaterStorage(TankNum).MaxInFlowRate) { + if (TotVdotSupplyAvail > state.dataWaterData->WaterStorage(TankNum).MaxInFlowRate) { // pipe/filter rate constraints on inlet - overflowVdot = TotVdotSupplyAvail - WaterStorage(TankNum).MaxInFlowRate; + overflowVdot = TotVdotSupplyAvail - state.dataWaterData->WaterStorage(TankNum).MaxInFlowRate; overflowTwater = - sum(WaterStorage(TankNum).VdotAvailSupply * WaterStorage(TankNum).TwaterSupply) / sum(WaterStorage(TankNum).VdotAvailSupply); - TotVdotSupplyAvail = WaterStorage(TankNum).MaxInFlowRate; + sum(state.dataWaterData->WaterStorage(TankNum).VdotAvailSupply * state.dataWaterData->WaterStorage(TankNum).TwaterSupply) / sum(state.dataWaterData->WaterStorage(TankNum).VdotAvailSupply); + TotVdotSupplyAvail = state.dataWaterData->WaterStorage(TankNum).MaxInFlowRate; } TotVolSupplyAvail = TotVdotSupplyAvail * TimeStepSys * DataGlobalConstants::SecInHour(); overflowVol = overflowVdot * TimeStepSys * DataGlobalConstants::SecInHour(); underflowVdot = 0.0; - if (WaterStorage(TankNum).NumWaterDemands > 0) { - OrigVdotDemandRequest = sum(WaterStorage(TankNum).VdotRequestDemand); + if (state.dataWaterData->WaterStorage(TankNum).NumWaterDemands > 0) { + OrigVdotDemandRequest = sum(state.dataWaterData->WaterStorage(TankNum).VdotRequestDemand); } else { OrigVdotDemandRequest = 0.0; } OrigVolDemandRequest = OrigVdotDemandRequest * TimeStepSys * DataGlobalConstants::SecInHour(); TotVdotDemandAvail = OrigVdotDemandRequest; // initialize to satisfied then modify if needed - if (TotVdotDemandAvail > WaterStorage(TankNum).MaxOutFlowRate) { + if (TotVdotDemandAvail > state.dataWaterData->WaterStorage(TankNum).MaxOutFlowRate) { // pipe/filter rate constraints on outlet - underflowVdot = OrigVdotDemandRequest - WaterStorage(TankNum).MaxOutFlowRate; - TotVdotDemandAvail = WaterStorage(TankNum).MaxOutFlowRate; + underflowVdot = OrigVdotDemandRequest - state.dataWaterData->WaterStorage(TankNum).MaxOutFlowRate; + TotVdotDemandAvail = state.dataWaterData->WaterStorage(TankNum).MaxOutFlowRate; } TotVolDemandAvail = TotVdotDemandAvail * (TimeStepSys * DataGlobalConstants::SecInHour()); NetVdotAdd = TotVdotSupplyAvail - TotVdotDemandAvail; NetVolAdd = NetVdotAdd * (TimeStepSys * DataGlobalConstants::SecInHour()); - VolumePredict = WaterStorage(TankNum).LastTimeStepVolume + NetVolAdd; + VolumePredict = state.dataWaterData->WaterStorage(TankNum).LastTimeStepVolume + NetVolAdd; // would tank capacity be exceeded? - TotVolAllowed = WaterStorage(TankNum).MaxCapacity - WaterStorage(TankNum).LastTimeStepVolume; - if (VolumePredict > WaterStorage(TankNum).MaxCapacity) { // too much + TotVolAllowed = state.dataWaterData->WaterStorage(TankNum).MaxCapacity - state.dataWaterData->WaterStorage(TankNum).LastTimeStepVolume; + if (VolumePredict > state.dataWaterData->WaterStorage(TankNum).MaxCapacity) { // too much // added overflow to inlet rate limit, new temperature model - OverFillVolume = (VolumePredict - WaterStorage(TankNum).MaxCapacity); - overflowTwater = (overflowTwater * overflowVol + OverFillVolume * WaterStorage(TankNum).Twater) / (overflowVol + OverFillVolume); + OverFillVolume = (VolumePredict - state.dataWaterData->WaterStorage(TankNum).MaxCapacity); + overflowTwater = (overflowTwater * overflowVol + OverFillVolume * state.dataWaterData->WaterStorage(TankNum).Twater) / (overflowVol + OverFillVolume); overflowVol += OverFillVolume; NetVolAdd -= OverFillVolume; NetVdotAdd = NetVolAdd / (TimeStepSys * DataGlobalConstants::SecInHour()); - VolumePredict = WaterStorage(TankNum).MaxCapacity; + VolumePredict = state.dataWaterData->WaterStorage(TankNum).MaxCapacity; } // Is tank too low to meet the request? if (VolumePredict < 0.0) { - AvailVolume = WaterStorage(TankNum).LastTimeStepVolume + TotVolSupplyAvail; + AvailVolume = state.dataWaterData->WaterStorage(TankNum).LastTimeStepVolume + TotVolSupplyAvail; AvailVolume = max(0.0, AvailVolume); TotVolDemandAvail = AvailVolume; TotVdotDemandAvail = AvailVolume / (TimeStepSys * DataGlobalConstants::SecInHour()); @@ -1178,73 +1162,73 @@ namespace WaterManager { if (TotVdotDemandAvail < OrigVdotDemandRequest) { // starvation // even distribution if (OrigVdotDemandRequest > 0.0) { - WaterStorage(TankNum).VdotAvailDemand = (TotVdotDemandAvail / OrigVdotDemandRequest) * WaterStorage(TankNum).VdotRequestDemand; + state.dataWaterData->WaterStorage(TankNum).VdotAvailDemand = (TotVdotDemandAvail / OrigVdotDemandRequest) * state.dataWaterData->WaterStorage(TankNum).VdotRequestDemand; } else { - WaterStorage(TankNum).VdotAvailDemand = 0.0; + state.dataWaterData->WaterStorage(TankNum).VdotAvailDemand = 0.0; } } else { // requested demand can be served - if (WaterStorage(TankNum).NumWaterDemands > 0) { - WaterStorage(TankNum).VdotAvailDemand = WaterStorage(TankNum).VdotRequestDemand; + if (state.dataWaterData->WaterStorage(TankNum).NumWaterDemands > 0) { + state.dataWaterData->WaterStorage(TankNum).VdotAvailDemand = state.dataWaterData->WaterStorage(TankNum).VdotRequestDemand; } } // is tank lower than float valve on capacity and requesting fill from controlled supplier? FillVolRequest = 0.0; - if ((VolumePredict) < WaterStorage(TankNum).ValveOnCapacity) { // turn on supply to fill tank - FillVolRequest = WaterStorage(TankNum).ValveOffCapacity - VolumePredict; + if ((VolumePredict) < state.dataWaterData->WaterStorage(TankNum).ValveOnCapacity) { // turn on supply to fill tank + FillVolRequest = state.dataWaterData->WaterStorage(TankNum).ValveOffCapacity - VolumePredict; // set mains draws for float on (all the way to Float off) - if (WaterStorage(TankNum).ControlSupplyType == MainsFloatValve) { + if (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == MainsFloatValve) { - WaterStorage(TankNum).MainsDrawVdot = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); + state.dataWaterData->WaterStorage(TankNum).MainsDrawVdot = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); NetVolAdd = FillVolRequest; } // set demand request in supplying tank if needed - if ((WaterStorage(TankNum).ControlSupplyType == OtherTankFloatValve) || (WaterStorage(TankNum).ControlSupplyType == TankMainsBackup)) { - WaterStorage(WaterStorage(TankNum).SupplyTankID).VdotRequestDemand(WaterStorage(TankNum).SupplyTankDemandARRID) = + if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == OtherTankFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == TankMainsBackup)) { + state.dataWaterData->WaterStorage(state.dataWaterData->WaterStorage(TankNum).SupplyTankID).VdotRequestDemand(state.dataWaterData->WaterStorage(TankNum).SupplyTankDemandARRID) = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); } // set demand request in groundwater well if needed - if ((WaterStorage(TankNum).ControlSupplyType == WellFloatValve) || (WaterStorage(TankNum).ControlSupplyType == WellFloatMainsBackup)) { - GroundwaterWell(WaterStorage(TankNum).GroundWellID).VdotRequest = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); + if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatMainsBackup)) { + GroundwaterWell(state.dataWaterData->WaterStorage(TankNum).GroundWellID).VdotRequest = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); } } // set mains flow if mains backup active - if ((VolumePredict) < WaterStorage(TankNum).BackupMainsCapacity) { // turn on supply - if ((WaterStorage(TankNum).ControlSupplyType == WellFloatMainsBackup) || (WaterStorage(TankNum).ControlSupplyType == TankMainsBackup)) { - FillVolRequest = WaterStorage(TankNum).ValveOffCapacity - VolumePredict; - WaterStorage(TankNum).MainsDrawVdot = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); + if ((VolumePredict) < state.dataWaterData->WaterStorage(TankNum).BackupMainsCapacity) { // turn on supply + if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatMainsBackup) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == TankMainsBackup)) { + FillVolRequest = state.dataWaterData->WaterStorage(TankNum).ValveOffCapacity - VolumePredict; + state.dataWaterData->WaterStorage(TankNum).MainsDrawVdot = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); NetVolAdd = FillVolRequest; } } - WaterStorage(TankNum).ThisTimeStepVolume = WaterStorage(TankNum).LastTimeStepVolume + NetVolAdd; - WaterStorage(TankNum).VdotOverflow = overflowVol / (TimeStepSys * DataGlobalConstants::SecInHour()); - WaterStorage(TankNum).VolOverflow = overflowVol; - WaterStorage(TankNum).TwaterOverflow = overflowTwater; - WaterStorage(TankNum).NetVdot = NetVolAdd / (TimeStepSys * DataGlobalConstants::SecInHour()); - WaterStorage(TankNum).MainsDrawVol = WaterStorage(TankNum).MainsDrawVdot * (TimeStepSys * DataGlobalConstants::SecInHour()); - WaterStorage(TankNum).VdotToTank = TotVdotSupplyAvail; - WaterStorage(TankNum).VdotFromTank = TotVdotDemandAvail; + state.dataWaterData->WaterStorage(TankNum).ThisTimeStepVolume = state.dataWaterData->WaterStorage(TankNum).LastTimeStepVolume + NetVolAdd; + state.dataWaterData->WaterStorage(TankNum).VdotOverflow = overflowVol / (TimeStepSys * DataGlobalConstants::SecInHour()); + state.dataWaterData->WaterStorage(TankNum).VolOverflow = overflowVol; + state.dataWaterData->WaterStorage(TankNum).TwaterOverflow = overflowTwater; + state.dataWaterData->WaterStorage(TankNum).NetVdot = NetVolAdd / (TimeStepSys * DataGlobalConstants::SecInHour()); + state.dataWaterData->WaterStorage(TankNum).MainsDrawVol = state.dataWaterData->WaterStorage(TankNum).MainsDrawVdot * (TimeStepSys * DataGlobalConstants::SecInHour()); + state.dataWaterData->WaterStorage(TankNum).VdotToTank = TotVdotSupplyAvail; + state.dataWaterData->WaterStorage(TankNum).VdotFromTank = TotVdotDemandAvail; { - auto const SELECT_CASE_var(WaterStorage(TankNum).ThermalMode); + auto const SELECT_CASE_var(state.dataWaterData->WaterStorage(TankNum).ThermalMode); if (SELECT_CASE_var == ScheduledTankTemp) { - WaterStorage(TankNum).Twater = GetCurrentScheduleValue(WaterStorage(TankNum).TempSchedID); - WaterStorage(TankNum).TouterSkin = WaterStorage(TankNum).Twater; + state.dataWaterData->WaterStorage(TankNum).Twater = GetCurrentScheduleValue(state.dataWaterData->WaterStorage(TankNum).TempSchedID); + state.dataWaterData->WaterStorage(TankNum).TouterSkin = state.dataWaterData->WaterStorage(TankNum).Twater; } else if (SELECT_CASE_var == TankZoneThermalCoupled) { ShowFatalError("WaterUse:Storage (Water Storage Tank) zone thermal model incomplete"); } } // set supply avail data from overflows in Receiving tank - if (WaterStorage(TankNum).OverflowMode == OverflowToTank) { - WaterStorage(WaterStorage(TankNum).OverflowTankID).VdotAvailSupply(WaterStorage(TankNum).OverflowTankSupplyARRID) = - WaterStorage(TankNum).VdotOverflow; - WaterStorage(WaterStorage(TankNum).OverflowTankID).TwaterSupply(WaterStorage(TankNum).OverflowTankSupplyARRID) = - WaterStorage(TankNum).TwaterOverflow; + if (state.dataWaterData->WaterStorage(TankNum).OverflowMode == OverflowToTank) { + state.dataWaterData->WaterStorage(state.dataWaterData->WaterStorage(TankNum).OverflowTankID).VdotAvailSupply(state.dataWaterData->WaterStorage(TankNum).OverflowTankSupplyARRID) = + state.dataWaterData->WaterStorage(TankNum).VdotOverflow; + state.dataWaterData->WaterStorage(state.dataWaterData->WaterStorage(TankNum).OverflowTankID).TwaterSupply(state.dataWaterData->WaterStorage(TankNum).OverflowTankSupplyARRID) = + state.dataWaterData->WaterStorage(TankNum).TwaterOverflow; } } @@ -1275,10 +1259,11 @@ namespace WaterManager { GetWaterManagerInput(state); } - InternalSetupTankSupplyComponent(CompName, CompType, TankName, ErrorsFound, TankIndex, WaterSupplyIndex); + InternalSetupTankSupplyComponent(state, CompName, CompType, TankName, ErrorsFound, TankIndex, WaterSupplyIndex); } - void InternalSetupTankSupplyComponent(std::string const &CompName, + void InternalSetupTankSupplyComponent(EnergyPlusData &state, + std::string const &CompName, std::string const &CompType, std::string const &TankName, bool &ErrorsFound, @@ -1307,52 +1292,52 @@ namespace WaterManager { Array1D_string oldSupplyCompTypes; // LOGICAL , SAVE :: MyOneTimeFlag = .TRUE. - TankIndex = UtilityRoutines::FindItemInList(TankName, WaterStorage); + TankIndex = UtilityRoutines::FindItemInList(TankName, state.dataWaterData->WaterStorage); if (TankIndex == 0) { ShowSevereError("WaterUse:Storage (Water Storage Tank) =\"" + TankName + "\" not found in " + CompType + " called " + CompName); ErrorsFound = true; return; // So we don't pass TankIndex=0 } - oldNumSupply = WaterStorage(TankIndex).NumWaterSupplies; + oldNumSupply = state.dataWaterData->WaterStorage(TankIndex).NumWaterSupplies; if (oldNumSupply > 0) { // do array push if (allocated(oldSupplyCompNames)) oldSupplyCompNames.deallocate(); oldSupplyCompNames.allocate(oldNumSupply); if (allocated(oldSupplyCompTypes)) oldSupplyCompTypes.deallocate(); oldSupplyCompTypes.allocate(oldNumSupply); - if (allocated(WaterStorage(TankIndex).SupplyCompNames)) { - oldSupplyCompNames = WaterStorage(TankIndex).SupplyCompNames; - WaterStorage(TankIndex).SupplyCompNames.deallocate(); - WaterStorage(TankIndex).SupplyCompNames.allocate(oldNumSupply + 1); - WaterStorage(TankIndex).SupplyCompNames({1, oldNumSupply}) = oldSupplyCompNames; // array assignment - WaterStorage(TankIndex).SupplyCompNames(oldNumSupply + 1) = CompName; + if (allocated(state.dataWaterData->WaterStorage(TankIndex).SupplyCompNames)) { + oldSupplyCompNames = state.dataWaterData->WaterStorage(TankIndex).SupplyCompNames; + state.dataWaterData->WaterStorage(TankIndex).SupplyCompNames.deallocate(); + state.dataWaterData->WaterStorage(TankIndex).SupplyCompNames.allocate(oldNumSupply + 1); + state.dataWaterData->WaterStorage(TankIndex).SupplyCompNames({1, oldNumSupply}) = oldSupplyCompNames; // array assignment + state.dataWaterData->WaterStorage(TankIndex).SupplyCompNames(oldNumSupply + 1) = CompName; } - if (allocated(WaterStorage(TankIndex).SupplyCompTypes)) { - oldSupplyCompTypes = WaterStorage(TankIndex).SupplyCompTypes; - WaterStorage(TankIndex).SupplyCompTypes.deallocate(); - WaterStorage(TankIndex).SupplyCompTypes.allocate(oldNumSupply + 1); - WaterStorage(TankIndex).SupplyCompTypes({1, oldNumSupply}) = oldSupplyCompTypes; // array assignment - WaterStorage(TankIndex).SupplyCompTypes(oldNumSupply + 1) = CompType; + if (allocated(state.dataWaterData->WaterStorage(TankIndex).SupplyCompTypes)) { + oldSupplyCompTypes = state.dataWaterData->WaterStorage(TankIndex).SupplyCompTypes; + state.dataWaterData->WaterStorage(TankIndex).SupplyCompTypes.deallocate(); + state.dataWaterData->WaterStorage(TankIndex).SupplyCompTypes.allocate(oldNumSupply + 1); + state.dataWaterData->WaterStorage(TankIndex).SupplyCompTypes({1, oldNumSupply}) = oldSupplyCompTypes; // array assignment + state.dataWaterData->WaterStorage(TankIndex).SupplyCompTypes(oldNumSupply + 1) = CompType; } - WaterStorage(TankIndex).VdotAvailSupply.deallocate(); - WaterStorage(TankIndex).VdotAvailSupply.allocate(oldNumSupply + 1); - WaterStorage(TankIndex).VdotAvailSupply = 0.0; // initialize - WaterStorage(TankIndex).TwaterSupply.deallocate(); - WaterStorage(TankIndex).TwaterSupply.allocate(oldNumSupply + 1); - WaterStorage(TankIndex).TwaterSupply = 0.0; // initialize + state.dataWaterData->WaterStorage(TankIndex).VdotAvailSupply.deallocate(); + state.dataWaterData->WaterStorage(TankIndex).VdotAvailSupply.allocate(oldNumSupply + 1); + state.dataWaterData->WaterStorage(TankIndex).VdotAvailSupply = 0.0; // initialize + state.dataWaterData->WaterStorage(TankIndex).TwaterSupply.deallocate(); + state.dataWaterData->WaterStorage(TankIndex).TwaterSupply.allocate(oldNumSupply + 1); + state.dataWaterData->WaterStorage(TankIndex).TwaterSupply = 0.0; // initialize WaterSupplyIndex = oldNumSupply + 1; - ++WaterStorage(TankIndex).NumWaterSupplies; + ++state.dataWaterData->WaterStorage(TankIndex).NumWaterSupplies; } else { // first time (no push) - WaterStorage(TankIndex).VdotAvailSupply.allocate(1); - WaterStorage(TankIndex).VdotAvailSupply = 0.0; // initialize - WaterStorage(TankIndex).TwaterSupply.allocate(1); - WaterStorage(TankIndex).TwaterSupply = 0.0; // initialize - WaterStorage(TankIndex).SupplyCompNames.allocate(1); - WaterStorage(TankIndex).SupplyCompNames(1) = CompName; - WaterStorage(TankIndex).SupplyCompTypes.allocate(1); - WaterStorage(TankIndex).SupplyCompTypes(1) = CompType; + state.dataWaterData->WaterStorage(TankIndex).VdotAvailSupply.allocate(1); + state.dataWaterData->WaterStorage(TankIndex).VdotAvailSupply = 0.0; // initialize + state.dataWaterData->WaterStorage(TankIndex).TwaterSupply.allocate(1); + state.dataWaterData->WaterStorage(TankIndex).TwaterSupply = 0.0; // initialize + state.dataWaterData->WaterStorage(TankIndex).SupplyCompNames.allocate(1); + state.dataWaterData->WaterStorage(TankIndex).SupplyCompNames(1) = CompName; + state.dataWaterData->WaterStorage(TankIndex).SupplyCompTypes.allocate(1); + state.dataWaterData->WaterStorage(TankIndex).SupplyCompTypes(1) = CompType; WaterSupplyIndex = 1; - WaterStorage(TankIndex).NumWaterSupplies = 1; + state.dataWaterData->WaterStorage(TankIndex).NumWaterSupplies = 1; } } @@ -1383,10 +1368,11 @@ namespace WaterManager { GetWaterManagerInput(state); } - InternalSetupTankDemandComponent(CompName, CompType, TankName, ErrorsFound, TankIndex, WaterDemandIndex); + InternalSetupTankDemandComponent(state, CompName, CompType, TankName, ErrorsFound, TankIndex, WaterDemandIndex); } - void InternalSetupTankDemandComponent(std::string const &CompName, + void InternalSetupTankDemandComponent(EnergyPlusData &state, + std::string const &CompName, std::string const &CompType, std::string const &TankName, bool &ErrorsFound, @@ -1415,59 +1401,59 @@ namespace WaterManager { Array1D_string oldDemandCompTypes; // LOGICAL , SAVE :: MyOneTimeFlag = .TRUE. - TankIndex = UtilityRoutines::FindItemInList(TankName, WaterStorage); + TankIndex = UtilityRoutines::FindItemInList(TankName, state.dataWaterData->WaterStorage); if (TankIndex == 0) { ShowSevereError("WaterUse:Storage (Water Storage Tank) =\"" + TankName + "\" not found in " + CompType + " called " + CompName); ErrorsFound = true; return; } - oldNumDemand = WaterStorage(TankIndex).NumWaterDemands; + oldNumDemand = state.dataWaterData->WaterStorage(TankIndex).NumWaterDemands; if (oldNumDemand > 0) { // do array push if (allocated(oldDemandCompNames)) oldDemandCompNames.deallocate(); oldDemandCompNames.allocate(oldNumDemand); if (allocated(oldDemandCompTypes)) oldDemandCompTypes.deallocate(); oldDemandCompTypes.allocate(oldNumDemand); - if (allocated(WaterStorage(TankIndex).DemandCompNames)) { - oldDemandCompNames = WaterStorage(TankIndex).DemandCompNames; - WaterStorage(TankIndex).DemandCompNames.deallocate(); - WaterStorage(TankIndex).DemandCompNames.allocate(oldNumDemand + 1); - WaterStorage(TankIndex).DemandCompNames({1, oldNumDemand}) = oldDemandCompNames; // array assignment - WaterStorage(TankIndex).DemandCompNames(oldNumDemand + 1) = CompName; + if (allocated(state.dataWaterData->WaterStorage(TankIndex).DemandCompNames)) { + oldDemandCompNames = state.dataWaterData->WaterStorage(TankIndex).DemandCompNames; + state.dataWaterData->WaterStorage(TankIndex).DemandCompNames.deallocate(); + state.dataWaterData->WaterStorage(TankIndex).DemandCompNames.allocate(oldNumDemand + 1); + state.dataWaterData->WaterStorage(TankIndex).DemandCompNames({1, oldNumDemand}) = oldDemandCompNames; // array assignment + state.dataWaterData->WaterStorage(TankIndex).DemandCompNames(oldNumDemand + 1) = CompName; } - if (allocated(WaterStorage(TankIndex).DemandCompTypes)) { - oldDemandCompTypes = WaterStorage(TankIndex).DemandCompTypes; - WaterStorage(TankIndex).DemandCompTypes.deallocate(); - WaterStorage(TankIndex).DemandCompTypes.allocate(oldNumDemand + 1); - WaterStorage(TankIndex).DemandCompTypes({1, oldNumDemand}) = oldDemandCompTypes; // array assignment - WaterStorage(TankIndex).DemandCompTypes(oldNumDemand + 1) = CompType; + if (allocated(state.dataWaterData->WaterStorage(TankIndex).DemandCompTypes)) { + oldDemandCompTypes = state.dataWaterData->WaterStorage(TankIndex).DemandCompTypes; + state.dataWaterData->WaterStorage(TankIndex).DemandCompTypes.deallocate(); + state.dataWaterData->WaterStorage(TankIndex).DemandCompTypes.allocate(oldNumDemand + 1); + state.dataWaterData->WaterStorage(TankIndex).DemandCompTypes({1, oldNumDemand}) = oldDemandCompTypes; // array assignment + state.dataWaterData->WaterStorage(TankIndex).DemandCompTypes(oldNumDemand + 1) = CompType; } - WaterStorage(TankIndex).VdotRequestDemand.deallocate(); - WaterStorage(TankIndex).VdotRequestDemand.allocate(oldNumDemand + 1); - WaterStorage(TankIndex).VdotRequestDemand = 0.0; // initialize + state.dataWaterData->WaterStorage(TankIndex).VdotRequestDemand.deallocate(); + state.dataWaterData->WaterStorage(TankIndex).VdotRequestDemand.allocate(oldNumDemand + 1); + state.dataWaterData->WaterStorage(TankIndex).VdotRequestDemand = 0.0; // initialize - WaterStorage(TankIndex).VdotAvailDemand.deallocate(); - WaterStorage(TankIndex).VdotAvailDemand.allocate(oldNumDemand + 1); - WaterStorage(TankIndex).VdotAvailDemand = 0.0; // initialize + state.dataWaterData->WaterStorage(TankIndex).VdotAvailDemand.deallocate(); + state.dataWaterData->WaterStorage(TankIndex).VdotAvailDemand.allocate(oldNumDemand + 1); + state.dataWaterData->WaterStorage(TankIndex).VdotAvailDemand = 0.0; // initialize WaterDemandIndex = oldNumDemand + 1; - ++WaterStorage(TankIndex).NumWaterDemands; + ++state.dataWaterData->WaterStorage(TankIndex).NumWaterDemands; } else { // first time (no push) - WaterStorage(TankIndex).VdotRequestDemand.allocate(1); - WaterStorage(TankIndex).VdotRequestDemand = 0.0; // initialize - WaterStorage(TankIndex).VdotAvailDemand.allocate(1); - WaterStorage(TankIndex).VdotAvailDemand = 0.0; // initialize - WaterStorage(TankIndex).DemandCompNames.allocate(1); - WaterStorage(TankIndex).DemandCompNames(1) = CompName; - WaterStorage(TankIndex).DemandCompTypes.allocate(1); - WaterStorage(TankIndex).DemandCompTypes(1) = CompType; - WaterStorage(TankIndex).NumWaterDemands = 1; + state.dataWaterData->WaterStorage(TankIndex).VdotRequestDemand.allocate(1); + state.dataWaterData->WaterStorage(TankIndex).VdotRequestDemand = 0.0; // initialize + state.dataWaterData->WaterStorage(TankIndex).VdotAvailDemand.allocate(1); + state.dataWaterData->WaterStorage(TankIndex).VdotAvailDemand = 0.0; // initialize + state.dataWaterData->WaterStorage(TankIndex).DemandCompNames.allocate(1); + state.dataWaterData->WaterStorage(TankIndex).DemandCompNames(1) = CompName; + state.dataWaterData->WaterStorage(TankIndex).DemandCompTypes.allocate(1); + state.dataWaterData->WaterStorage(TankIndex).DemandCompTypes(1) = CompType; + state.dataWaterData->WaterStorage(TankIndex).NumWaterDemands = 1; WaterDemandIndex = 1; } } - void CalcRainCollector(int const RainColNum) // Index of rain collector + void CalcRainCollector(EnergyPlusData &state, int const RainColNum) // Index of rain collector { // SUBROUTINE INFORMATION: @@ -1512,9 +1498,9 @@ namespace WaterManager { // If (.NOT.(IsRain)) Then ! is it raining now? No don't use this flag since precip schedule might differ from weather file if (RainFall.CurrentRate <= 0.0) { // set available supply rate in WaterStorage - WaterStorage(RainCollector(RainColNum).StorageTankID).VdotAvailSupply(RainCollector(RainColNum).StorageTankSupplyARRID) = 0.0; + state.dataWaterData->WaterStorage(RainCollector(RainColNum).StorageTankID).VdotAvailSupply(RainCollector(RainColNum).StorageTankSupplyARRID) = 0.0; // temperature of water supply is modeled as the same as outdoor drybulb. - WaterStorage(RainCollector(RainColNum).StorageTankID).TwaterSupply(RainCollector(RainColNum).StorageTankSupplyARRID) = 0.0; + state.dataWaterData->WaterStorage(RainCollector(RainColNum).StorageTankID).TwaterSupply(RainCollector(RainColNum).StorageTankSupplyARRID) = 0.0; RainCollector(RainColNum).VdotAvail = 0.0; RainCollector(RainColNum).VolCollected = 0.0; @@ -1539,10 +1525,10 @@ namespace WaterManager { } // set available supply rate in WaterStorage - WaterStorage(RainCollector(RainColNum).StorageTankID).VdotAvailSupply(RainCollector(RainColNum).StorageTankSupplyARRID) = VdotAvail; + state.dataWaterData->WaterStorage(RainCollector(RainColNum).StorageTankID).VdotAvailSupply(RainCollector(RainColNum).StorageTankSupplyARRID) = VdotAvail; // temperature of water supply is modeled as the same as outdoor drybulb. - WaterStorage(RainCollector(RainColNum).StorageTankID).TwaterSupply(RainCollector(RainColNum).StorageTankSupplyARRID) = + state.dataWaterData->WaterStorage(RainCollector(RainColNum).StorageTankID).TwaterSupply(RainCollector(RainColNum).StorageTankSupplyARRID) = OutWetBulbTempAt(RainCollector(RainColNum).MeanHeight); RainCollector(RainColNum).VdotAvail = VdotAvail; @@ -1550,7 +1536,7 @@ namespace WaterManager { } } - void CalcGroundwaterWell(int const WellNum) // Index of well + void CalcGroundwaterWell(EnergyPlusData &state, int const WellNum) // Index of well { // SUBROUTINE INFORMATION: @@ -1595,18 +1581,18 @@ namespace WaterManager { if (GroundwaterWell(WellNum).VdotRequest > 0.0) { if (GroundwaterWell(WellNum).VdotRequest >= GroundwaterWell(WellNum).PumpNomVolFlowRate) { // run flat out - WaterStorage(GroundwaterWell(WellNum).StorageTankID).VdotAvailSupply(GroundwaterWell(WellNum).StorageTankSupplyARRID) = + state.dataWaterData->WaterStorage(GroundwaterWell(WellNum).StorageTankID).VdotAvailSupply(GroundwaterWell(WellNum).StorageTankSupplyARRID) = GroundwaterWell(WellNum).PumpNomVolFlowRate; - WaterStorage(GroundwaterWell(WellNum).StorageTankID).TwaterSupply(GroundwaterWell(WellNum).StorageTankSupplyARRID) = GroundTemp_Deep; + state.dataWaterData->WaterStorage(GroundwaterWell(WellNum).StorageTankID).TwaterSupply(GroundwaterWell(WellNum).StorageTankSupplyARRID) = GroundTemp_Deep; VdotDelivered = GroundwaterWell(WellNum).PumpNomVolFlowRate; PumpPower = GroundwaterWell(WellNum).PumpNomPowerUse; } // the run at part load to just meet request if (GroundwaterWell(WellNum).VdotRequest < GroundwaterWell(WellNum).PumpNomVolFlowRate) { - WaterStorage(GroundwaterWell(WellNum).StorageTankID).VdotAvailSupply(GroundwaterWell(WellNum).StorageTankSupplyARRID) = + state.dataWaterData->WaterStorage(GroundwaterWell(WellNum).StorageTankID).VdotAvailSupply(GroundwaterWell(WellNum).StorageTankSupplyARRID) = GroundwaterWell(WellNum).VdotRequest; - WaterStorage(GroundwaterWell(WellNum).StorageTankID).TwaterSupply(GroundwaterWell(WellNum).StorageTankSupplyARRID) = GroundTemp_Deep; + state.dataWaterData->WaterStorage(GroundwaterWell(WellNum).StorageTankID).TwaterSupply(GroundwaterWell(WellNum).StorageTankSupplyARRID) = GroundTemp_Deep; VdotDelivered = GroundwaterWell(WellNum).VdotRequest; PumpPower = @@ -1649,15 +1635,15 @@ namespace WaterManager { if (state.dataGlobal->BeginEnvrnFlag && state.dataWaterManager->MyEnvrnFlag) { for (TankNum = 1; TankNum <= NumWaterStorageTanks; ++TankNum) { - WaterStorage(TankNum).LastTimeStepVolume = WaterStorage(TankNum).InitialVolume; - WaterStorage(TankNum).ThisTimeStepVolume = WaterStorage(TankNum).InitialVolume; + state.dataWaterData->WaterStorage(TankNum).LastTimeStepVolume = state.dataWaterData->WaterStorage(TankNum).InitialVolume; + state.dataWaterData->WaterStorage(TankNum).ThisTimeStepVolume = state.dataWaterData->WaterStorage(TankNum).InitialVolume; } if ((!DoingSizing) && (!KickOffSimulation) && state.dataWaterManager->MyTankDemandCheckFlag) { if (NumWaterStorageTanks > 0) { for (TankNum = 1; TankNum <= NumWaterStorageTanks; ++TankNum) { - if (WaterStorage(TankNum).NumWaterDemands == 0) { + if (state.dataWaterData->WaterStorage(TankNum).NumWaterDemands == 0) { ShowWarningError("Found WaterUse:Storage that has nothing connected to draw water from it."); - ShowContinueError("Occurs for WaterUse:Storage = " + WaterStorage(TankNum).Name); + ShowContinueError("Occurs for WaterUse:Storage = " + state.dataWaterData->WaterStorage(TankNum).Name); ShowContinueError("Check that input for water consuming components specifies a water supply tank."); } } @@ -1674,35 +1660,35 @@ namespace WaterManager { if (state.dataWaterManager->MyWarmupFlag && (!WarmupFlag)) { // do environment inits. just went out of warmup mode for (TankNum = 1; TankNum <= NumWaterStorageTanks; ++TankNum) { - WaterStorage(TankNum).LastTimeStepVolume = WaterStorage(TankNum).InitialVolume; - WaterStorage(TankNum).ThisTimeStepVolume = WaterStorage(TankNum).InitialVolume; - WaterStorage(TankNum).LastTimeStepTemp = WaterStorage(TankNum).InitialTankTemp; + state.dataWaterData->WaterStorage(TankNum).LastTimeStepVolume = state.dataWaterData->WaterStorage(TankNum).InitialVolume; + state.dataWaterData->WaterStorage(TankNum).ThisTimeStepVolume = state.dataWaterData->WaterStorage(TankNum).InitialVolume; + state.dataWaterData->WaterStorage(TankNum).LastTimeStepTemp = state.dataWaterData->WaterStorage(TankNum).InitialTankTemp; } state.dataWaterManager->MyWarmupFlag = false; } for (TankNum = 1; TankNum <= NumWaterStorageTanks; ++TankNum) { // main location for inits for new timestep. - WaterStorage(TankNum).LastTimeStepVolume = max(WaterStorage(TankNum).ThisTimeStepVolume, 0.0); - WaterStorage(TankNum).MainsDrawVdot = 0.0; - WaterStorage(TankNum).MainsDrawVol = 0.0; - WaterStorage(TankNum).NetVdot = 0.0; - WaterStorage(TankNum).VdotFromTank = 0.0; - WaterStorage(TankNum).VdotToTank = 0.0; - if (WaterStorage(TankNum).NumWaterDemands > 0) { + state.dataWaterData->WaterStorage(TankNum).LastTimeStepVolume = max(state.dataWaterData->WaterStorage(TankNum).ThisTimeStepVolume, 0.0); + state.dataWaterData->WaterStorage(TankNum).MainsDrawVdot = 0.0; + state.dataWaterData->WaterStorage(TankNum).MainsDrawVol = 0.0; + state.dataWaterData->WaterStorage(TankNum).NetVdot = 0.0; + state.dataWaterData->WaterStorage(TankNum).VdotFromTank = 0.0; + state.dataWaterData->WaterStorage(TankNum).VdotToTank = 0.0; + if (state.dataWaterData->WaterStorage(TankNum).NumWaterDemands > 0) { // don't reset the requested demand, it is up to the other components to update it themselves // WaterStorage( TankNum ).VdotRequestDemand = 0.0; // the available demand is calculated here in the calc routine, so its fine to initialize it - WaterStorage(TankNum).VdotAvailDemand = 0.0; + state.dataWaterData->WaterStorage(TankNum).VdotAvailDemand = 0.0; } - WaterStorage(TankNum).VdotOverflow = 0.0; - if (WaterStorage(TankNum).NumWaterSupplies > 0) { + state.dataWaterData->WaterStorage(TankNum).VdotOverflow = 0.0; + if (state.dataWaterData->WaterStorage(TankNum).NumWaterSupplies > 0) { // TODO: Figure out what to do with this...the available supply should be updated by the components // This was an issue because the coil supply was being stomped by this assignment to zero, so no tank action was happening - WaterStorage(TankNum).VdotAvailSupply = 0.0; + state.dataWaterData->WaterStorage(TankNum).VdotAvailSupply = 0.0; } - if ((WaterStorage(TankNum).ControlSupplyType == WellFloatValve) || (WaterStorage(TankNum).ControlSupplyType == WellFloatMainsBackup)) { - if (allocated(GroundwaterWell)) GroundwaterWell(WaterStorage(TankNum).GroundWellID).VdotRequest = 0.0; + if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatMainsBackup)) { + if (allocated(GroundwaterWell)) GroundwaterWell(state.dataWaterData->WaterStorage(TankNum).GroundWellID).VdotRequest = 0.0; } } // tank loop diff --git a/src/EnergyPlus/WaterManager.hh b/src/EnergyPlus/WaterManager.hh index 635d0089c02..5f8be2939e8 100644 --- a/src/EnergyPlus/WaterManager.hh +++ b/src/EnergyPlus/WaterManager.hh @@ -83,30 +83,33 @@ namespace WaterManager { int &TankIndex, int &WaterSupplyIndex); - void InternalSetupTankSupplyComponent(std::string const &CompName, + void InternalSetupTankSupplyComponent(EnergyPlusData &state, + std::string const &CompName, std::string const &CompType, std::string const &TankName, bool &ErrorsFound, int &TankIndex, int &WaterSupplyIndex); - void SetupTankDemandComponent(EnergyPlusData &state, std::string const &CompName, + void SetupTankDemandComponent(EnergyPlusData &state, + std::string const &CompName, std::string const &CompType, std::string const &TankName, bool &ErrorsFound, int &TankIndex, int &WaterDemandIndex); - void InternalSetupTankDemandComponent(std::string const &CompName, + void InternalSetupTankDemandComponent(EnergyPlusData &state, + std::string const &CompName, std::string const &CompType, std::string const &TankName, bool &ErrorsFound, int &TankIndex, int &WaterDemandIndex); - void CalcRainCollector(int const RainColNum); // Index of rain collector + void CalcRainCollector(EnergyPlusData &state, int const RainColNum); // Index of rain collector - void CalcGroundwaterWell(int const WellNum); // Index of well + void CalcGroundwaterWell(EnergyPlusData &state, int const WellNum); // Index of well void UpdateWaterManager(EnergyPlusData &state); diff --git a/src/EnergyPlus/WaterUse.cc b/src/EnergyPlus/WaterUse.cc index 15ab60c14bc..c42ef1482c7 100644 --- a/src/EnergyPlus/WaterUse.cc +++ b/src/EnergyPlus/WaterUse.cc @@ -157,7 +157,7 @@ namespace WaterUse { state.dataWaterUse->WaterConnections(WaterConnNum).CalcConnectionsFlowRates(state, FirstHVACIteration); state.dataWaterUse->WaterConnections(WaterConnNum).CalcConnectionsDrainTemp(state); - state.dataWaterUse->WaterConnections(WaterConnNum).CalcConnectionsHeatRecovery(); + state.dataWaterUse->WaterConnections(WaterConnNum).CalcConnectionsHeatRecovery(state); if (state.dataWaterUse->WaterConnections(WaterConnNum).TempError < Tolerance) { break; @@ -252,7 +252,7 @@ namespace WaterUse { this->CalcConnectionsFlowRates(state, FirstHVACIteration); this->CalcConnectionsDrainTemp(state); - this->CalcConnectionsHeatRecovery(); + this->CalcConnectionsHeatRecovery(state); if (this->TempError < Tolerance) { break; @@ -997,7 +997,7 @@ namespace WaterUse { // Set the cold water temperature if (this->SupplyTankNum > 0) { - this->ColdSupplyTemp = DataWater::WaterStorage(this->SupplyTankNum).Twater; + this->ColdSupplyTemp = state.dataWaterData->WaterStorage(this->SupplyTankNum).Twater; } else if (this->ColdTempSchedule > 0) { this->ColdSupplyTemp = ScheduleManager::GetCurrentScheduleValue(this->ColdTempSchedule); @@ -1133,12 +1133,12 @@ namespace WaterUse { if (this->SupplyTankNum > 0) { // Set the demand request for supply water from water storage tank this->ColdVolFlowRate = this->ColdMassFlowRate / Psychrometrics::RhoH2O(DataGlobalConstants::InitConvTemp()); - DataWater::WaterStorage(this->SupplyTankNum).VdotRequestDemand(this->TankDemandID) = this->ColdVolFlowRate; + state.dataWaterData->WaterStorage(this->SupplyTankNum).VdotRequestDemand(this->TankDemandID) = this->ColdVolFlowRate; // Check if cold flow rate should be starved by restricted flow from tank // Currently, the tank flow is not really starved--water continues to flow at the tank water temperature // But the user can see the error by comparing report variables for TankVolFlowRate < ColdVolFlowRate - this->TankVolFlowRate = DataWater::WaterStorage(this->SupplyTankNum).VdotAvailDemand(this->TankDemandID); + this->TankVolFlowRate = state.dataWaterData->WaterStorage(this->SupplyTankNum).VdotAvailDemand(this->TankDemandID); this->TankMassFlowRate = this->TankVolFlowRate * Psychrometrics::RhoH2O(DataGlobalConstants::InitConvTemp()); } } @@ -1173,7 +1173,7 @@ namespace WaterUse { this->DrainVolFlowRate = this->DrainMassFlowRate * Psychrometrics::RhoH2O(DataGlobalConstants::InitConvTemp()); } - void WaterConnectionsType::CalcConnectionsHeatRecovery() + void WaterConnectionsType::CalcConnectionsHeatRecovery(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -1243,8 +1243,8 @@ namespace WaterUse { this->WasteTemp = this->DrainTemp - this->RecoveryRate / (Psychrometrics::CPHW(DataGlobalConstants::InitConvTemp()) * this->TotalMassFlowRate); if (this->RecoveryTankNum > 0) { - DataWater::WaterStorage(this->RecoveryTankNum).VdotAvailSupply(this->TankSupplyID) = this->DrainVolFlowRate; - DataWater::WaterStorage(this->RecoveryTankNum).TwaterSupply(this->TankSupplyID) = this->WasteTemp; + state.dataWaterData->WaterStorage(this->RecoveryTankNum).VdotAvailSupply(this->TankSupplyID) = this->DrainVolFlowRate; + state.dataWaterData->WaterStorage(this->RecoveryTankNum).TwaterSupply(this->TankSupplyID) = this->WasteTemp; } { diff --git a/src/EnergyPlus/WaterUse.hh b/src/EnergyPlus/WaterUse.hh index 7c263a0dfd3..f57d2d27c0f 100644 --- a/src/EnergyPlus/WaterUse.hh +++ b/src/EnergyPlus/WaterUse.hh @@ -235,7 +235,7 @@ namespace WaterUse { void CalcConnectionsDrainTemp(EnergyPlusData &state); - void CalcConnectionsHeatRecovery(); + void CalcConnectionsHeatRecovery(EnergyPlusData &state); void UpdateWaterConnections(); diff --git a/src/EnergyPlus/ZoneDehumidifier.cc b/src/EnergyPlus/ZoneDehumidifier.cc index baaef2ab725..216bbc92cd0 100644 --- a/src/EnergyPlus/ZoneDehumidifier.cc +++ b/src/EnergyPlus/ZoneDehumidifier.cc @@ -1047,7 +1047,6 @@ namespace ZoneDehumidifier { // Using/Aliasing using DataHVACGlobals::TimeStepSys; - using DataWater::WaterStorage; using Psychrometrics::RhoH2O; // Locals @@ -1092,10 +1091,10 @@ namespace ZoneDehumidifier { state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).DehumidCondVol = state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).DehumidCondVolFlowRate * ReportingConstant; - WaterStorage(state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).CondensateTankID).VdotAvailSupply(state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).CondensateTankSupplyARRID) = + state.dataWaterData->WaterStorage(state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).CondensateTankID).VdotAvailSupply(state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).CondensateTankSupplyARRID) = state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).DehumidCondVolFlowRate; // Assume water outlet temp = air outlet temp.... same assumption in other places in code (e.g., water coil component) - WaterStorage(state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).CondensateTankID).TwaterSupply(state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).CondensateTankSupplyARRID) = OutletAirTemp; + state.dataWaterData->WaterStorage(state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).CondensateTankID).TwaterSupply(state.dataZoneDehumidifier->ZoneDehumid(DehumidNum).CondensateTankSupplyARRID) = OutletAirTemp; } } From c352fcb2f5eabb2e8b8706bb36d8140c5bab36ce Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Tue, 27 Oct 2020 15:48:14 -0600 Subject: [PATCH 2/6] more DataWater to state --- src/EnergyPlus/DataWater.cc | 11 - src/EnergyPlus/DataWater.hh | 17 +- src/EnergyPlus/EcoRoofManager.cc | 21 +- src/EnergyPlus/WaterManager.cc | 300 +++++++++++------------ src/EnergyPlus/WaterManager.hh | 4 +- tst/EnergyPlus/unit/WaterManager.unit.cc | 12 +- 6 files changed, 175 insertions(+), 190 deletions(-) diff --git a/src/EnergyPlus/DataWater.cc b/src/EnergyPlus/DataWater.cc index 682c7277b8c..7a90ffa4669 100644 --- a/src/EnergyPlus/DataWater.cc +++ b/src/EnergyPlus/DataWater.cc @@ -127,19 +127,8 @@ namespace DataWater { AnyWaterSystemsInModel = false; WaterSystemGetInputCalled = false; AnyIrrigationInModel = false; - RainFall = {}; - Irrigation = {}; - RainCollector.deallocate(); - GroundwaterWell.deallocate(); } - // Object Data - SiteRainFallDataStruct - RainFall; // type of rainfall modeling | design annual rain | rain sched id | nominal annual rain | current rate | current amount - IrrigationDataStruct Irrigation; // type of irrigation modeling | Irrigation schedule id | scheduled amount | actual amount | irrigation threshold - Array1D RainCollector; - Array1D GroundwaterWell; - } // namespace DataWater } // namespace EnergyPlus diff --git a/src/EnergyPlus/DataWater.hh b/src/EnergyPlus/DataWater.hh index 20538e66abf..c2f15634ece 100644 --- a/src/EnergyPlus/DataWater.hh +++ b/src/EnergyPlus/DataWater.hh @@ -278,26 +278,25 @@ namespace DataWater { } }; - // Object Data - extern SiteRainFallDataStruct - RainFall; // type of rainfall modeling | design annual rain | rain sched id | nominal annual rain | current rate | current amount - extern IrrigationDataStruct - Irrigation; // type of irrigation modeling | Irrigation schedule id | scheduled amount | actual amount | irrigation threshold - extern Array1D RainCollector; - extern Array1D GroundwaterWell; - } // namespace DataWater struct DataWaterData : BaseGlobalStruct { + DataWater::SiteRainFallDataStruct RainFall; // type of rainfall modeling | design annual rain | rain sched id | nominal annual rain | current rate | current amount + DataWater::IrrigationDataStruct Irrigation; // type of irrigation modeling | Irrigation schedule id | scheduled amount | actual amount | irrigation threshold Array1D WaterStorage; + Array1D RainCollector; + Array1D GroundwaterWell; void clear_state() override { + RainFall = {}; + Irrigation = {}; WaterStorage.deallocate(); + RainCollector.deallocate(); + GroundwaterWell.deallocate(); } }; - } // namespace EnergyPlus #endif diff --git a/src/EnergyPlus/EcoRoofManager.cc b/src/EnergyPlus/EcoRoofManager.cc index 7d2bc5b9ef6..dcd9d09c4df 100644 --- a/src/EnergyPlus/EcoRoofManager.cc +++ b/src/EnergyPlus/EcoRoofManager.cc @@ -100,10 +100,8 @@ namespace EcoRoofManager { using namespace DataGlobals; using namespace DataLoopNode; using namespace DataHeatBalance; - using DataWater::Irrigation; using DataWater::IrrSchedDesign; using DataWater::IrrSmartSched; - using DataWater::RainFall; using DataWater::RainSchedDesign; // Use statements for access to subroutines in other modules @@ -720,7 +718,6 @@ namespace EcoRoofManager { using namespace DataGlobals; using namespace DataEnvironment; using namespace DataSurfaces; - using DataWater::RainFall; using General::RoundSigDigits; // Locals @@ -862,8 +859,8 @@ namespace EcoRoofManager { CurrentPrecipitation = 0.0; // first initialize to zero } CurrentPrecipitation = 0.0; // first initialize to zero - if (RainFall.ModeID == RainSchedDesign) { - CurrentPrecipitation = RainFall.CurrentAmount; // units of m + if (state.dataWaterData->RainFall.ModeID == RainSchedDesign) { + CurrentPrecipitation = state.dataWaterData->RainFall.CurrentAmount; // units of m Moisture += CurrentPrecipitation / TopDepth; // x (m) evenly put into top layer if (!WarmupFlag) { CumPrecip += CurrentPrecipitation; @@ -872,15 +869,15 @@ namespace EcoRoofManager { // NEXT Add Irrigation to surface soil moisture variable (if a schedule exists) CurrentIrrigation = 0.0; // first initialize to zero - Irrigation.ActualAmount = 0.0; - if (Irrigation.ModeID == IrrSchedDesign) { - CurrentIrrigation = Irrigation.ScheduledAmount; // units of m - Irrigation.ActualAmount = CurrentIrrigation; + state.dataWaterData->Irrigation.ActualAmount = 0.0; + if (state.dataWaterData->Irrigation.ModeID == 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 (Irrigation.ModeID == IrrSmartSched && Moisture < Irrigation.IrrigationThreshold * MoistureMax) { + } else if (state.dataWaterData->Irrigation.ModeID == IrrSmartSched && Moisture < state.dataWaterData->Irrigation.IrrigationThreshold * MoistureMax) { // Smart schedule only irrigates when scheduled AND the soil is less than 40% saturated - CurrentIrrigation = Irrigation.ScheduledAmount; // units of m - Irrigation.ActualAmount = CurrentIrrigation; + CurrentIrrigation = state.dataWaterData->Irrigation.ScheduledAmount; // units of m + state.dataWaterData->Irrigation.ActualAmount = CurrentIrrigation; } Moisture += CurrentIrrigation / TopDepth; // irrigation in (m)/timestep put into top layer diff --git a/src/EnergyPlus/WaterManager.cc b/src/EnergyPlus/WaterManager.cc index 6afa4abccf3..0dfa727f141 100644 --- a/src/EnergyPlus/WaterManager.cc +++ b/src/EnergyPlus/WaterManager.cc @@ -166,8 +166,8 @@ namespace WaterManager { UpdateWaterManager(state); - UpdatePrecipitation(); - UpdateIrrigation(); + UpdatePrecipitation(state); + UpdateIrrigation(state); } void GetWaterManagerInput(EnergyPlusData &state) @@ -402,8 +402,8 @@ namespace WaterManager { cCurrentModuleObject = "WaterUse:RainCollector"; NumRainCollectors = inputProcessor->getNumObjectsFound(cCurrentModuleObject); if (NumRainCollectors > 0) { - if (!(allocated(RainCollector))) RainCollector.allocate(NumRainCollectors); - // allow exensible reference to surfaces. + if (!(allocated(state.dataWaterData->RainCollector))) state.dataWaterData->RainCollector.allocate(NumRainCollectors); + // allow extensible reference to surfaces. AnyWaterSystemsInModel = true; for (Item = 1; Item <= NumRainCollectors; ++Item) { @@ -419,72 +419,72 @@ namespace WaterManager { _, cAlphaFieldNames, cNumericFieldNames); - RainCollector(Item).Name = cAlphaArgs(1); + state.dataWaterData->RainCollector(Item).Name = cAlphaArgs(1); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); objNameMsg = cCurrentModuleObject + " Named " + cAlphaArgs(1); - RainCollector(Item).StorageTankName = cAlphaArgs(2); - RainCollector(Item).StorageTankID = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataWaterData->WaterStorage); - if (RainCollector(Item).StorageTankID == 0) { + state.dataWaterData->RainCollector(Item).StorageTankName = cAlphaArgs(2); + state.dataWaterData->RainCollector(Item).StorageTankID = UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataWaterData->WaterStorage); + if (state.dataWaterData->RainCollector(Item).StorageTankID == 0) { ShowSevereError("Invalid " + cAlphaFieldNames(2) + '=' + cAlphaArgs(2)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; } if (UtilityRoutines::SameString(cAlphaArgs(3), "Constant")) { - RainCollector(Item).LossFactorMode = ConstantRainLossFactor; + state.dataWaterData->RainCollector(Item).LossFactorMode = ConstantRainLossFactor; } else if (UtilityRoutines::SameString(cAlphaArgs(3), "Scheduled")) { - RainCollector(Item).LossFactorMode = ScheduledRainLossFactor; + state.dataWaterData->RainCollector(Item).LossFactorMode = ScheduledRainLossFactor; } else { ShowSevereError("Invalid " + cAlphaFieldNames(3) + '=' + cAlphaArgs(3)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; } - RainCollector(Item).LossFactor = rNumericArgs(1); - if (RainCollector(Item).LossFactor > 1.0) { + state.dataWaterData->RainCollector(Item).LossFactor = rNumericArgs(1); + if (state.dataWaterData->RainCollector(Item).LossFactor > 1.0) { ShowWarningError("Invalid " + cNumericFieldNames(1) + '=' + RoundSigDigits(rNumericArgs(1), 2)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ShowContinueError("found rain water collection loss factor greater than 1.0, simulation continues"); } - if (RainCollector(Item).LossFactor < 0.0) { + if (state.dataWaterData->RainCollector(Item).LossFactor < 0.0) { ShowSevereError("Invalid " + cNumericFieldNames(1) + '=' + RoundSigDigits(rNumericArgs(1), 2)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ShowContinueError("found rain water collection loss factor less than 0.0"); ErrorsFound = true; } - if (RainCollector(Item).LossFactorMode == ScheduledRainLossFactor) { - RainCollector(Item).LossFactorSchedID = GetScheduleIndex(state, cAlphaArgs(4)); - if (RainCollector(Item).LossFactorSchedID == 0) { + if (state.dataWaterData->RainCollector(Item).LossFactorMode == ScheduledRainLossFactor) { + state.dataWaterData->RainCollector(Item).LossFactorSchedID = GetScheduleIndex(state, cAlphaArgs(4)); + if (state.dataWaterData->RainCollector(Item).LossFactorSchedID == 0) { ShowSevereError("Invalid " + cAlphaFieldNames(4) + '=' + cAlphaArgs(4)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; } - if (GetScheduleMinValue(RainCollector(Item).LossFactorSchedID) < 0.0) { + if (GetScheduleMinValue(state.dataWaterData->RainCollector(Item).LossFactorSchedID) < 0.0) { ShowSevereError("Invalid " + cAlphaFieldNames(4) + '=' + cAlphaArgs(4)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ShowContinueError("found rain water collection loss factor schedule value less than 0.0 in " + objNameMsg); ErrorsFound = true; } - if (GetScheduleMaxValue(RainCollector(Item).LossFactorSchedID) > 1.0) { + if (GetScheduleMaxValue(state.dataWaterData->RainCollector(Item).LossFactorSchedID) > 1.0) { ShowWarningError("Potentially invalid " + cAlphaFieldNames(4) + '=' + cAlphaArgs(4)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ShowContinueError("found rain water collection loss factor schedule value greater than 1.0, simulation continues"); // allowing it to continue } } - RainCollector(Item).MaxCollectRate = rNumericArgs(1); - if (RainCollector(Item).MaxCollectRate == 0.0) RainCollector(Item).MaxCollectRate = 100000000000.0; + state.dataWaterData->RainCollector(Item).MaxCollectRate = rNumericArgs(1); + if (state.dataWaterData->RainCollector(Item).MaxCollectRate == 0.0) state.dataWaterData->RainCollector(Item).MaxCollectRate = 100000000000.0; // number of surfaces is extensible and = NumAlphas - alphaOffset alphaOffset = 4; // update this if more alphas inserted ahead of extensible surface listing - RainCollector(Item).NumCollectSurfs = NumAlphas - alphaOffset; - RainCollector(Item).SurfName.allocate(RainCollector(Item).NumCollectSurfs); - RainCollector(Item).SurfID.allocate(RainCollector(Item).NumCollectSurfs); - for (SurfNum = 1; SurfNum <= RainCollector(Item).NumCollectSurfs; ++SurfNum) { - RainCollector(Item).SurfName(SurfNum) = cAlphaArgs(SurfNum + alphaOffset); - RainCollector(Item).SurfID(SurfNum) = UtilityRoutines::FindItemInList(cAlphaArgs(SurfNum + alphaOffset), Surface); - if (RainCollector(Item).SurfID(SurfNum) == 0) { + state.dataWaterData->RainCollector(Item).NumCollectSurfs = NumAlphas - alphaOffset; + state.dataWaterData->RainCollector(Item).SurfName.allocate(state.dataWaterData->RainCollector(Item).NumCollectSurfs); + state.dataWaterData->RainCollector(Item).SurfID.allocate(state.dataWaterData->RainCollector(Item).NumCollectSurfs); + for (SurfNum = 1; SurfNum <= state.dataWaterData->RainCollector(Item).NumCollectSurfs; ++SurfNum) { + state.dataWaterData->RainCollector(Item).SurfName(SurfNum) = cAlphaArgs(SurfNum + alphaOffset); + state.dataWaterData->RainCollector(Item).SurfID(SurfNum) = UtilityRoutines::FindItemInList(cAlphaArgs(SurfNum + alphaOffset), Surface); + if (state.dataWaterData->RainCollector(Item).SurfID(SurfNum) == 0) { ShowSevereError("Invalid " + cAlphaFieldNames(SurfNum + alphaOffset) + '=' + cAlphaArgs(SurfNum + alphaOffset)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; @@ -495,23 +495,23 @@ namespace WaterManager { tmpArea = 0.0; tmpNumerator = 0.0; tmpDenominator = 0.0; - for (SurfNum = 1; SurfNum <= RainCollector(Item).NumCollectSurfs; ++SurfNum) { - ThisSurf = RainCollector(Item).SurfID(SurfNum); + for (SurfNum = 1; SurfNum <= state.dataWaterData->RainCollector(Item).NumCollectSurfs; ++SurfNum) { + ThisSurf = state.dataWaterData->RainCollector(Item).SurfID(SurfNum); tmpArea += Surface(ThisSurf).GrossArea * Surface(ThisSurf).CosTilt; tmpNumerator += Surface(ThisSurf).Centroid.z * Surface(ThisSurf).GrossArea; tmpDenominator += Surface(ThisSurf).GrossArea; } - RainCollector(Item).HorizArea = tmpArea; + state.dataWaterData->RainCollector(Item).HorizArea = tmpArea; // now setup vertical hieght above ground for height dependent outdoor temps - RainCollector(Item).MeanHeight = tmpNumerator / tmpDenominator; + state.dataWaterData->RainCollector(Item).MeanHeight = tmpNumerator / tmpDenominator; // now set up tank supply connection - InternalSetupTankSupplyComponent(state, RainCollector(Item).Name, + InternalSetupTankSupplyComponent(state, state.dataWaterData->RainCollector(Item).Name, cCurrentModuleObject, - RainCollector(Item).StorageTankName, + state.dataWaterData->RainCollector(Item).StorageTankName, ErrorsFound, - RainCollector(Item).StorageTankID, - RainCollector(Item).StorageTankSupplyARRID); + state.dataWaterData->RainCollector(Item).StorageTankID, + state.dataWaterData->RainCollector(Item).StorageTankSupplyARRID); } } // (NumRainCollectors > 0) @@ -519,7 +519,7 @@ namespace WaterManager { NumGroundWaterWells = inputProcessor->getNumObjectsFound(cCurrentModuleObject); if (NumGroundWaterWells > 0) { AnyWaterSystemsInModel = true; - GroundwaterWell.allocate(NumGroundWaterWells); + state.dataWaterData->GroundwaterWell.allocate(NumGroundWaterWells); for (Item = 1; Item <= NumGroundWaterWells; ++Item) { inputProcessor->getObjectItem(state, cCurrentModuleObject, @@ -533,33 +533,33 @@ namespace WaterManager { lAlphaFieldBlanks, cAlphaFieldNames, cNumericFieldNames); - GroundwaterWell(Item).Name = cAlphaArgs(1); + state.dataWaterData->GroundwaterWell(Item).Name = cAlphaArgs(1); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); objNameMsg = cCurrentModuleObject + " Named " + cAlphaArgs(1); - GroundwaterWell(Item).StorageTankName = cAlphaArgs(2); + state.dataWaterData->GroundwaterWell(Item).StorageTankName = cAlphaArgs(2); - InternalSetupTankSupplyComponent(state, GroundwaterWell(Item).Name, + InternalSetupTankSupplyComponent(state, state.dataWaterData->GroundwaterWell(Item).Name, cCurrentModuleObject, - GroundwaterWell(Item).StorageTankName, + state.dataWaterData->GroundwaterWell(Item).StorageTankName, ErrorsFound, - GroundwaterWell(Item).StorageTankID, - GroundwaterWell(Item).StorageTankSupplyARRID); - - if (allocated(state.dataWaterData->WaterStorage)) state.dataWaterData->WaterStorage(GroundwaterWell(Item).StorageTankID).GroundWellID = Item; - - GroundwaterWell(Item).PumpDepth = rNumericArgs(1); - GroundwaterWell(Item).PumpNomVolFlowRate = rNumericArgs(2); - GroundwaterWell(Item).PumpNomHead = rNumericArgs(3); - GroundwaterWell(Item).PumpNomPowerUse = rNumericArgs(4); - GroundwaterWell(Item).PumpEfficiency = rNumericArgs(5); - GroundwaterWell(Item).WellRecoveryRate = rNumericArgs(6); - GroundwaterWell(Item).NomWellStorageVol = rNumericArgs(7); + state.dataWaterData->GroundwaterWell(Item).StorageTankID, + state.dataWaterData->GroundwaterWell(Item).StorageTankSupplyARRID); + + if (allocated(state.dataWaterData->WaterStorage)) state.dataWaterData->WaterStorage(state.dataWaterData->GroundwaterWell(Item).StorageTankID).GroundWellID = Item; + + state.dataWaterData->GroundwaterWell(Item).PumpDepth = rNumericArgs(1); + state.dataWaterData->GroundwaterWell(Item).PumpNomVolFlowRate = rNumericArgs(2); + state.dataWaterData->GroundwaterWell(Item).PumpNomHead = rNumericArgs(3); + state.dataWaterData->GroundwaterWell(Item).PumpNomPowerUse = rNumericArgs(4); + state.dataWaterData->GroundwaterWell(Item).PumpEfficiency = rNumericArgs(5); + state.dataWaterData->GroundwaterWell(Item).WellRecoveryRate = rNumericArgs(6); + state.dataWaterData->GroundwaterWell(Item).NomWellStorageVol = rNumericArgs(7); if (UtilityRoutines::SameString(cAlphaArgs(3), "Constant")) { - GroundwaterWell(Item).GroundwaterTableMode = ConstantWaterTable; + state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode = ConstantWaterTable; } else if (UtilityRoutines::SameString(cAlphaArgs(3), "Scheduled")) { - GroundwaterWell(Item).GroundwaterTableMode = ScheduledWaterTable; + state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode = ScheduledWaterTable; } else if (lAlphaFieldBlanks(3)) { - GroundwaterWell(Item).GroundwaterTableMode = 0; + state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode = 0; } else { ShowSevereError("Invalid " + cAlphaFieldNames(3) + '=' + cAlphaArgs(3)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); @@ -567,10 +567,10 @@ namespace WaterManager { } // N8, \field water table depth - GroundwaterWell(Item).WaterTableDepth = rNumericArgs(8); + state.dataWaterData->GroundwaterWell(Item).WaterTableDepth = rNumericArgs(8); // A4; \field water table depth schedule - GroundwaterWell(Item).WaterTableDepthSchedID = GetScheduleIndex(state, cAlphaArgs(4)); - if ((GroundwaterWell(Item).GroundwaterTableMode == ScheduledWaterTable) && (GroundwaterWell(Item).WaterTableDepthSchedID == 0)) { + state.dataWaterData->GroundwaterWell(Item).WaterTableDepthSchedID = GetScheduleIndex(state, cAlphaArgs(4)); + if ((state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode == ScheduledWaterTable) && (state.dataWaterData->GroundwaterWell(Item).WaterTableDepthSchedID == 0)) { ShowSevereError("Invalid " + cAlphaFieldNames(4) + '=' + cAlphaArgs(4)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; @@ -646,25 +646,25 @@ namespace WaterManager { inputProcessor->getObjectItem(state, cCurrentModuleObject, 1, cAlphaArgs, NumAlphas, rNumericArgs, NumNumbers, IOStatus); if (UtilityRoutines::SameString(cAlphaArgs(1), "ScheduleAndDesignLevel")) { - RainFall.ModeID = RainSchedDesign; + state.dataWaterData->RainFall.ModeID = RainSchedDesign; } else { ShowSevereError("Precipitation Model Type of " + cCurrentModuleObject + " is incorrect."); ShowContinueError("Only available option is ScheduleAndDesignLevel."); ErrorsFound = true; } - RainFall.RainSchedID = GetScheduleIndex(state, cAlphaArgs(2)); - if ((RainFall.RainSchedID == 0) && (RainFall.ModeID == RainSchedDesign)) { + state.dataWaterData->RainFall.RainSchedID = GetScheduleIndex(state, cAlphaArgs(2)); + if ((state.dataWaterData->RainFall.RainSchedID == 0) && (state.dataWaterData->RainFall.ModeID == RainSchedDesign)) { ShowSevereError("Schedule not found for " + cCurrentModuleObject + " object"); ErrorsFound = true; - } else if ((RainFall.RainSchedID != 0) && (RainFall.ModeID == RainSchedDesign)) { - if (!CheckScheduleValueMinMax(RainFall.RainSchedID, ">=", 0.0)) { + } else if ((state.dataWaterData->RainFall.RainSchedID != 0) && (state.dataWaterData->RainFall.ModeID == RainSchedDesign)) { + if (!CheckScheduleValueMinMax(state.dataWaterData->RainFall.RainSchedID, ">=", 0.0)) { ShowSevereError("Schedule=" + cAlphaArgs(2) + " for " + cCurrentModuleObject + " object has values < 0."); ErrorsFound = true; } } - RainFall.DesignAnnualRain = rNumericArgs(1); - RainFall.NomAnnualRain = rNumericArgs(2); + state.dataWaterData->RainFall.DesignAnnualRain = rNumericArgs(1); + state.dataWaterData->RainFall.NomAnnualRain = rNumericArgs(2); } cCurrentModuleObject = "RoofIrrigation"; @@ -678,19 +678,19 @@ namespace WaterManager { AnyIrrigationInModel = true; inputProcessor->getObjectItem(state, cCurrentModuleObject, 1, cAlphaArgs, NumAlphas, rNumericArgs, NumNumbers, IOStatus); if (UtilityRoutines::SameString(cAlphaArgs(1), "Schedule")) { - Irrigation.ModeID = IrrSchedDesign; + state.dataWaterData->Irrigation.ModeID = IrrSchedDesign; } else if (UtilityRoutines::SameString(cAlphaArgs(1), "SmartSchedule")) { - Irrigation.ModeID = IrrSmartSched; + state.dataWaterData->Irrigation.ModeID = IrrSmartSched; } else { ShowSevereError("Type of " + cCurrentModuleObject + " is incorrect. Options are Schedule or SmartSchedule"); ErrorsFound = true; } - Irrigation.IrrSchedID = GetScheduleIndex(state, cAlphaArgs(2)); - if ((Irrigation.IrrSchedID == 0) && ((Irrigation.ModeID == IrrSchedDesign) || Irrigation.ModeID == IrrSmartSched)) { + state.dataWaterData->Irrigation.IrrSchedID = GetScheduleIndex(state, cAlphaArgs(2)); + if ((state.dataWaterData->Irrigation.IrrSchedID == 0) && ((state.dataWaterData->Irrigation.ModeID == IrrSchedDesign) || state.dataWaterData->Irrigation.ModeID == IrrSmartSched)) { ShowSevereError("Schedule not found for " + cCurrentModuleObject + " object"); ErrorsFound = true; - } else if ((Irrigation.IrrSchedID == 0) && (Irrigation.ModeID == IrrSchedDesign)) { - if (!CheckScheduleValueMinMax(Irrigation.IrrSchedID, ">=", 0.0)) { + } else if ((state.dataWaterData->Irrigation.IrrSchedID == 0) && (state.dataWaterData->Irrigation.ModeID == IrrSchedDesign)) { + if (!CheckScheduleValueMinMax(state.dataWaterData->Irrigation.IrrSchedID, ">=", 0.0)) { ShowSevereError("Schedule=" + cAlphaArgs(2) + " for " + cCurrentModuleObject + " object has values < 0."); ErrorsFound = true; } @@ -698,13 +698,13 @@ namespace WaterManager { // If we later add a designannualirrigation and a nominalannualirrigation variable (for scaling) those // would be assigned here... as with the Rainfall... - Irrigation.IrrigationThreshold = 0.4; - if (Irrigation.ModeID == IrrSmartSched && NumNumbers > 0) { + state.dataWaterData->Irrigation.IrrigationThreshold = 0.4; + if (state.dataWaterData->Irrigation.ModeID == IrrSmartSched && NumNumbers > 0) { if (rNumericArgs(1) > 100.0 || rNumericArgs(1) < 0.0) { ShowSevereError("Irrigation threshold for " + cCurrentModuleObject + " object has values > 100 or < 0."); ErrorsFound = true; } else { - Irrigation.IrrigationThreshold = rNumericArgs(1) / 100.0; + state.dataWaterData->Irrigation.IrrigationThreshold = rNumericArgs(1) / 100.0; } } @@ -809,21 +809,21 @@ namespace WaterManager { if (NumSiteRainFall == 1) { // CurrentModuleObject='Site:Precipitation' SetupOutputVariable(state, - "Site Precipitation Rate", OutputProcessor::Unit::m_s, RainFall.CurrentRate, "System", "Average", "Site:Precipitation"); + "Site Precipitation Rate", OutputProcessor::Unit::m_s, state.dataWaterData->RainFall.CurrentRate, "System", "Average", "Site:Precipitation"); SetupOutputVariable(state, - "Site Precipitation Depth", OutputProcessor::Unit::m, RainFall.CurrentAmount, "System", "Sum", "Site:Precipitation"); + "Site Precipitation Depth", OutputProcessor::Unit::m, state.dataWaterData->RainFall.CurrentAmount, "System", "Sum", "Site:Precipitation"); } if (NumIrrigation == 1) { // CurrentModuleObject='RoofIrrigation' SetupOutputVariable(state, "Water System Roof Irrigation Scheduled Depth", OutputProcessor::Unit::m, - Irrigation.ScheduledAmount, + state.dataWaterData->Irrigation.ScheduledAmount, "System", "Sum", "RoofIrrigation"); SetupOutputVariable(state, "Water System Roof Irrigation Actual Depth", OutputProcessor::Unit::m, - Irrigation.ActualAmount, + state.dataWaterData->Irrigation.ActualAmount, "System", "Sum", "RoofIrrigation"); @@ -832,16 +832,16 @@ namespace WaterManager { for (Item = 1; Item <= NumRainCollectors; ++Item) { // CurrentModuleObject='WaterUse:RainCollector' SetupOutputVariable(state, "Water System Rainwater Collector Volume Flow Rate", OutputProcessor::Unit::m3_s, - RainCollector(Item).VdotAvail, + state.dataWaterData->RainCollector(Item).VdotAvail, "System", "Average", - RainCollector(Item).Name); + state.dataWaterData->RainCollector(Item).Name); SetupOutputVariable(state, "Water System Rainwater Collector Volume", OutputProcessor::Unit::m3, - RainCollector(Item).VolCollected, + state.dataWaterData->RainCollector(Item).VolCollected, "System", "Sum", - RainCollector(Item).Name, + state.dataWaterData->RainCollector(Item).Name, _, "OnSiteWater", "Rainwater", @@ -852,22 +852,22 @@ namespace WaterManager { for (Item = 1; Item <= NumGroundWaterWells; ++Item) { // CurrentModuleObject='WaterUse:Well' SetupOutputVariable(state, "Water System Groundwater Well Requested Volume Flow Rate", OutputProcessor::Unit::m3_s, - GroundwaterWell(Item).VdotRequest, + state.dataWaterData->GroundwaterWell(Item).VdotRequest, "System", "Average", - GroundwaterWell(Item).Name); + state.dataWaterData->GroundwaterWell(Item).Name); SetupOutputVariable(state, "Water System Groundwater Well Volume Flow Rate", OutputProcessor::Unit::m3_s, - GroundwaterWell(Item).VdotDelivered, + state.dataWaterData->GroundwaterWell(Item).VdotDelivered, "System", "Average", - GroundwaterWell(Item).Name); + state.dataWaterData->GroundwaterWell(Item).Name); SetupOutputVariable(state, "Water System Groundwater Well Volume", OutputProcessor::Unit::m3, - GroundwaterWell(Item).VolDelivered, + state.dataWaterData->GroundwaterWell(Item).VolDelivered, "System", "Sum", - GroundwaterWell(Item).Name, + state.dataWaterData->GroundwaterWell(Item).Name, _, "OnSiteWater", "Wellwater", @@ -875,16 +875,16 @@ namespace WaterManager { "System"); SetupOutputVariable(state, "Water System Groundwater Well Pump Electricity Rate", OutputProcessor::Unit::W, - GroundwaterWell(Item).PumpPower, + state.dataWaterData->GroundwaterWell(Item).PumpPower, "System", "Average", - GroundwaterWell(Item).Name); + state.dataWaterData->GroundwaterWell(Item).Name); SetupOutputVariable(state, "Water System Groundwater Well Pump Electricity Energy", OutputProcessor::Unit::J, - GroundwaterWell(Item).PumpEnergy, + state.dataWaterData->GroundwaterWell(Item).PumpEnergy, "System", "Sum", - GroundwaterWell(Item).Name, + state.dataWaterData->GroundwaterWell(Item).Name, _, "Electricity", "WaterSystems", @@ -895,7 +895,7 @@ namespace WaterManager { } // my one time flag block } - void UpdatePrecipitation() + void UpdatePrecipitation(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -936,19 +936,19 @@ namespace WaterManager { Real64 schedRate; Real64 ScaleFactor; - if (RainFall.ModeID == RainSchedDesign) { - schedRate = GetCurrentScheduleValue(RainFall.RainSchedID); // m/hr - if (RainFall.NomAnnualRain > 0.0){ - ScaleFactor = RainFall.DesignAnnualRain / RainFall.NomAnnualRain; + if (state.dataWaterData->RainFall.ModeID == RainSchedDesign) { + schedRate = GetCurrentScheduleValue(state.dataWaterData->RainFall.RainSchedID); // m/hr + if (state.dataWaterData->RainFall.NomAnnualRain > 0.0){ + ScaleFactor = state.dataWaterData->RainFall.DesignAnnualRain / state.dataWaterData->RainFall.NomAnnualRain; } else { ScaleFactor = 0.0; } - RainFall.CurrentRate = schedRate * ScaleFactor / DataGlobalConstants::SecInHour(); // convert to m/s - RainFall.CurrentAmount = RainFall.CurrentRate * (TimeStepSys * DataGlobalConstants::SecInHour()); + state.dataWaterData->RainFall.CurrentRate = schedRate * ScaleFactor / DataGlobalConstants::SecInHour(); // convert to m/s + state.dataWaterData->RainFall.CurrentAmount = state.dataWaterData->RainFall.CurrentRate * (TimeStepSys * DataGlobalConstants::SecInHour()); } } - void UpdateIrrigation() + void UpdateIrrigation(EnergyPlusData &state) { // SUBROUTINE INFORMATION: @@ -989,15 +989,15 @@ namespace WaterManager { Real64 schedRate; // REAL(r64) :: ScaleFactor - Irrigation.ScheduledAmount = 0.0; + state.dataWaterData->Irrigation.ScheduledAmount = 0.0; - if (Irrigation.ModeID == IrrSchedDesign) { - schedRate = GetCurrentScheduleValue(Irrigation.IrrSchedID); // m/hr - Irrigation.ScheduledAmount = schedRate * (TimeStepSys * DataGlobalConstants::SecInHour()) / DataGlobalConstants::SecInHour(); // convert to m/timestep + if (state.dataWaterData->Irrigation.ModeID == IrrSchedDesign) { + schedRate = GetCurrentScheduleValue(state.dataWaterData->Irrigation.IrrSchedID); // m/hr + state.dataWaterData->Irrigation.ScheduledAmount = schedRate * (TimeStepSys * DataGlobalConstants::SecInHour()) / DataGlobalConstants::SecInHour(); // convert to m/timestep - } else if (Irrigation.ModeID == IrrSmartSched) { - schedRate = GetCurrentScheduleValue(Irrigation.IrrSchedID); // m/hr - Irrigation.ScheduledAmount = schedRate * (TimeStepSys * DataGlobalConstants::SecInHour()) / DataGlobalConstants::SecInHour(); // convert to m/timestep + } else if (state.dataWaterData->Irrigation.ModeID == IrrSmartSched) { + schedRate = GetCurrentScheduleValue(state.dataWaterData->Irrigation.IrrSchedID); // m/hr + state.dataWaterData->Irrigation.ScheduledAmount = schedRate * (TimeStepSys * DataGlobalConstants::SecInHour()) / DataGlobalConstants::SecInHour(); // convert to m/timestep } } @@ -1191,7 +1191,7 @@ namespace WaterManager { // set demand request in groundwater well if needed if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatMainsBackup)) { - GroundwaterWell(state.dataWaterData->WaterStorage(TankNum).GroundWellID).VdotRequest = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); + state.dataWaterData->GroundwaterWell(state.dataWaterData->WaterStorage(TankNum).GroundWellID).VdotRequest = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); } } @@ -1496,43 +1496,43 @@ namespace WaterManager { Real64 VdotAvail; // If (.NOT.(IsRain)) Then ! is it raining now? No don't use this flag since precip schedule might differ from weather file - if (RainFall.CurrentRate <= 0.0) { + if (state.dataWaterData->RainFall.CurrentRate <= 0.0) { // set available supply rate in WaterStorage - state.dataWaterData->WaterStorage(RainCollector(RainColNum).StorageTankID).VdotAvailSupply(RainCollector(RainColNum).StorageTankSupplyARRID) = 0.0; + state.dataWaterData->WaterStorage(state.dataWaterData->RainCollector(RainColNum).StorageTankID).VdotAvailSupply(state.dataWaterData->RainCollector(RainColNum).StorageTankSupplyARRID) = 0.0; // temperature of water supply is modeled as the same as outdoor drybulb. - state.dataWaterData->WaterStorage(RainCollector(RainColNum).StorageTankID).TwaterSupply(RainCollector(RainColNum).StorageTankSupplyARRID) = 0.0; + state.dataWaterData->WaterStorage(state.dataWaterData->RainCollector(RainColNum).StorageTankID).TwaterSupply(state.dataWaterData->RainCollector(RainColNum).StorageTankSupplyARRID) = 0.0; - RainCollector(RainColNum).VdotAvail = 0.0; - RainCollector(RainColNum).VolCollected = 0.0; + state.dataWaterData->RainCollector(RainColNum).VdotAvail = 0.0; + state.dataWaterData->RainCollector(RainColNum).VolCollected = 0.0; } else { { - auto const SELECT_CASE_var(RainCollector(RainColNum).LossFactorMode); + auto const SELECT_CASE_var(state.dataWaterData->RainCollector(RainColNum).LossFactorMode); if (SELECT_CASE_var == ConstantRainLossFactor) { - LossFactor = RainCollector(RainColNum).LossFactor; + LossFactor = state.dataWaterData->RainCollector(RainColNum).LossFactor; } else if (SELECT_CASE_var == ScheduledRainLossFactor) { - LossFactor = GetCurrentScheduleValue(RainCollector(RainColNum).LossFactorSchedID); + LossFactor = GetCurrentScheduleValue(state.dataWaterData->RainCollector(RainColNum).LossFactorSchedID); } else { assert(false); } } - VdotAvail = RainFall.CurrentRate * RainCollector(RainColNum).HorizArea * (1.0 - LossFactor); + VdotAvail = state.dataWaterData->RainFall.CurrentRate * state.dataWaterData->RainCollector(RainColNum).HorizArea * (1.0 - LossFactor); - if (VdotAvail > RainCollector(RainColNum).MaxCollectRate) { - VdotAvail = RainCollector(RainColNum).MaxCollectRate; + if (VdotAvail > state.dataWaterData->RainCollector(RainColNum).MaxCollectRate) { + VdotAvail = state.dataWaterData->RainCollector(RainColNum).MaxCollectRate; } // set available supply rate in WaterStorage - state.dataWaterData->WaterStorage(RainCollector(RainColNum).StorageTankID).VdotAvailSupply(RainCollector(RainColNum).StorageTankSupplyARRID) = VdotAvail; + state.dataWaterData->WaterStorage(state.dataWaterData->RainCollector(RainColNum).StorageTankID).VdotAvailSupply(state.dataWaterData->RainCollector(RainColNum).StorageTankSupplyARRID) = VdotAvail; // temperature of water supply is modeled as the same as outdoor drybulb. - state.dataWaterData->WaterStorage(RainCollector(RainColNum).StorageTankID).TwaterSupply(RainCollector(RainColNum).StorageTankSupplyARRID) = - OutWetBulbTempAt(RainCollector(RainColNum).MeanHeight); + state.dataWaterData->WaterStorage(state.dataWaterData->RainCollector(RainColNum).StorageTankID).TwaterSupply(state.dataWaterData->RainCollector(RainColNum).StorageTankSupplyARRID) = + OutWetBulbTempAt(state.dataWaterData->RainCollector(RainColNum).MeanHeight); - RainCollector(RainColNum).VdotAvail = VdotAvail; - RainCollector(RainColNum).VolCollected = VdotAvail * TimeStepSys * DataGlobalConstants::SecInHour(); + state.dataWaterData->RainCollector(RainColNum).VdotAvail = VdotAvail; + state.dataWaterData->RainCollector(RainColNum).VolCollected = VdotAvail * TimeStepSys * DataGlobalConstants::SecInHour(); } } @@ -1578,32 +1578,32 @@ namespace WaterManager { VdotDelivered = 0.0; PumpPower = 0.0; - if (GroundwaterWell(WellNum).VdotRequest > 0.0) { - - if (GroundwaterWell(WellNum).VdotRequest >= GroundwaterWell(WellNum).PumpNomVolFlowRate) { // run flat out - state.dataWaterData->WaterStorage(GroundwaterWell(WellNum).StorageTankID).VdotAvailSupply(GroundwaterWell(WellNum).StorageTankSupplyARRID) = - GroundwaterWell(WellNum).PumpNomVolFlowRate; - state.dataWaterData->WaterStorage(GroundwaterWell(WellNum).StorageTankID).TwaterSupply(GroundwaterWell(WellNum).StorageTankSupplyARRID) = GroundTemp_Deep; - VdotDelivered = GroundwaterWell(WellNum).PumpNomVolFlowRate; - PumpPower = GroundwaterWell(WellNum).PumpNomPowerUse; + if (state.dataWaterData->GroundwaterWell(WellNum).VdotRequest > 0.0) { + + if (state.dataWaterData->GroundwaterWell(WellNum).VdotRequest >= state.dataWaterData->GroundwaterWell(WellNum).PumpNomVolFlowRate) { // run flat out + state.dataWaterData->WaterStorage(state.dataWaterData->GroundwaterWell(WellNum).StorageTankID).VdotAvailSupply(state.dataWaterData->GroundwaterWell(WellNum).StorageTankSupplyARRID) = + state.dataWaterData->GroundwaterWell(WellNum).PumpNomVolFlowRate; + state.dataWaterData->WaterStorage(state.dataWaterData->GroundwaterWell(WellNum).StorageTankID).TwaterSupply(state.dataWaterData->GroundwaterWell(WellNum).StorageTankSupplyARRID) = GroundTemp_Deep; + VdotDelivered = state.dataWaterData->GroundwaterWell(WellNum).PumpNomVolFlowRate; + PumpPower = state.dataWaterData->GroundwaterWell(WellNum).PumpNomPowerUse; } // the run at part load to just meet request - if (GroundwaterWell(WellNum).VdotRequest < GroundwaterWell(WellNum).PumpNomVolFlowRate) { - state.dataWaterData->WaterStorage(GroundwaterWell(WellNum).StorageTankID).VdotAvailSupply(GroundwaterWell(WellNum).StorageTankSupplyARRID) = - GroundwaterWell(WellNum).VdotRequest; - state.dataWaterData->WaterStorage(GroundwaterWell(WellNum).StorageTankID).TwaterSupply(GroundwaterWell(WellNum).StorageTankSupplyARRID) = GroundTemp_Deep; + if (state.dataWaterData->GroundwaterWell(WellNum).VdotRequest < state.dataWaterData->GroundwaterWell(WellNum).PumpNomVolFlowRate) { + state.dataWaterData->WaterStorage(state.dataWaterData->GroundwaterWell(WellNum).StorageTankID).VdotAvailSupply(state.dataWaterData->GroundwaterWell(WellNum).StorageTankSupplyARRID) = + state.dataWaterData->GroundwaterWell(WellNum).VdotRequest; + state.dataWaterData->WaterStorage(state.dataWaterData->GroundwaterWell(WellNum).StorageTankID).TwaterSupply(state.dataWaterData->GroundwaterWell(WellNum).StorageTankSupplyARRID) = GroundTemp_Deep; - VdotDelivered = GroundwaterWell(WellNum).VdotRequest; + VdotDelivered = state.dataWaterData->GroundwaterWell(WellNum).VdotRequest; PumpPower = - GroundwaterWell(WellNum).PumpNomPowerUse * GroundwaterWell(WellNum).VdotRequest / GroundwaterWell(WellNum).PumpNomVolFlowRate; + state.dataWaterData->GroundwaterWell(WellNum).PumpNomPowerUse * state.dataWaterData->GroundwaterWell(WellNum).VdotRequest / state.dataWaterData->GroundwaterWell(WellNum).PumpNomVolFlowRate; } } - GroundwaterWell(WellNum).VdotDelivered = VdotDelivered; - GroundwaterWell(WellNum).VolDelivered = VdotDelivered * TimeStepSys * DataGlobalConstants::SecInHour(); - GroundwaterWell(WellNum).PumpPower = PumpPower; - GroundwaterWell(WellNum).PumpEnergy = PumpPower * TimeStepSys * DataGlobalConstants::SecInHour(); + state.dataWaterData->GroundwaterWell(WellNum).VdotDelivered = VdotDelivered; + state.dataWaterData->GroundwaterWell(WellNum).VolDelivered = VdotDelivered * TimeStepSys * DataGlobalConstants::SecInHour(); + state.dataWaterData->GroundwaterWell(WellNum).PumpPower = PumpPower; + state.dataWaterData->GroundwaterWell(WellNum).PumpEnergy = PumpPower * TimeStepSys * DataGlobalConstants::SecInHour(); } void UpdateWaterManager(EnergyPlusData &state) @@ -1688,23 +1688,23 @@ namespace WaterManager { state.dataWaterData->WaterStorage(TankNum).VdotAvailSupply = 0.0; } if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatMainsBackup)) { - if (allocated(GroundwaterWell)) GroundwaterWell(state.dataWaterData->WaterStorage(TankNum).GroundWellID).VdotRequest = 0.0; + if (allocated(state.dataWaterData->GroundwaterWell)) state.dataWaterData->GroundwaterWell(state.dataWaterData->WaterStorage(TankNum).GroundWellID).VdotRequest = 0.0; } } // tank loop for (RainColNum = 1; RainColNum <= NumRainCollectors; ++RainColNum) { - RainCollector(RainColNum).VdotAvail = 0.0; - RainCollector(RainColNum).VolCollected = 0.0; + state.dataWaterData->RainCollector(RainColNum).VdotAvail = 0.0; + state.dataWaterData->RainCollector(RainColNum).VolCollected = 0.0; } for (WellNum = 1; WellNum <= NumGroundWaterWells; ++WellNum) { // re init calculated vars - GroundwaterWell(WellNum).VdotRequest = 0.0; - GroundwaterWell(WellNum).VdotDelivered = 0.0; - GroundwaterWell(WellNum).VolDelivered = 0.0; - GroundwaterWell(WellNum).PumpPower = 0.0; - GroundwaterWell(WellNum).PumpEnergy = 0.0; + state.dataWaterData->GroundwaterWell(WellNum).VdotRequest = 0.0; + state.dataWaterData->GroundwaterWell(WellNum).VdotDelivered = 0.0; + state.dataWaterData->GroundwaterWell(WellNum).VolDelivered = 0.0; + state.dataWaterData->GroundwaterWell(WellNum).PumpPower = 0.0; + state.dataWaterData->GroundwaterWell(WellNum).PumpEnergy = 0.0; } } diff --git a/src/EnergyPlus/WaterManager.hh b/src/EnergyPlus/WaterManager.hh index 5f8be2939e8..63fe151f86e 100644 --- a/src/EnergyPlus/WaterManager.hh +++ b/src/EnergyPlus/WaterManager.hh @@ -68,9 +68,9 @@ namespace WaterManager { void GetWaterManagerInput(EnergyPlusData &state); - void UpdatePrecipitation(); + void UpdatePrecipitation(EnergyPlusData &state); - void UpdateIrrigation(); + void UpdateIrrigation(EnergyPlusData &state); void SizeWaterManager(); diff --git a/tst/EnergyPlus/unit/WaterManager.unit.cc b/tst/EnergyPlus/unit/WaterManager.unit.cc index 40e88f4a333..7f3e716f8b3 100644 --- a/tst/EnergyPlus/unit/WaterManager.unit.cc +++ b/tst/EnergyPlus/unit/WaterManager.unit.cc @@ -80,15 +80,15 @@ TEST_F(EnergyPlusFixture, WaterManager_NormalAnnualPrecipitation) ScheduleManager::Schedule(1).CurrentValue = 1.0; - WaterManager::UpdatePrecipitation(); + WaterManager::UpdatePrecipitation(state); Real64 ExpectedNomAnnualRain = 0.80771; Real64 ExpectedCurrentRate = 1.0 * (0.75 / 0.80771) / DataGlobalConstants::SecInHour(); - Real64 NomAnnualRain = DataWater::RainFall.NomAnnualRain; + Real64 NomAnnualRain = state.dataWaterData->RainFall.NomAnnualRain; EXPECT_NEAR(NomAnnualRain, ExpectedNomAnnualRain, 0.000001); - Real64 CurrentRate = DataWater::RainFall.CurrentRate; + Real64 CurrentRate = state.dataWaterData->RainFall.CurrentRate; EXPECT_NEAR(CurrentRate, ExpectedCurrentRate, 0.000001); } @@ -113,11 +113,11 @@ TEST_F(EnergyPlusFixture, WaterManager_ZeroAnnualPrecipitation) ScheduleManager::Schedule(1).CurrentValue = 1.0; - WaterManager::UpdatePrecipitation(); + WaterManager::UpdatePrecipitation(state); - Real64 NomAnnualRain = DataWater::RainFall.NomAnnualRain; + Real64 NomAnnualRain = state.dataWaterData->RainFall.NomAnnualRain; EXPECT_NEAR(NomAnnualRain, 0.0, 0.000001); - Real64 CurrentRate = DataWater::RainFall.CurrentRate; + Real64 CurrentRate = state.dataWaterData->RainFall.CurrentRate; EXPECT_NEAR(CurrentRate, 0.0, 0.000001); } From c31323e5669e64cc50fe4900ddd9874b9918b3ed Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Tue, 27 Oct 2020 20:22:09 -0600 Subject: [PATCH 3/6] move remaining DataWater to state --- src/EnergyPlus/DataWater.cc | 22 -------- src/EnergyPlus/DataWater.hh | 28 +++++----- src/EnergyPlus/StateManagement.cc | 2 - src/EnergyPlus/WaterManager.cc | 90 +++++++++++++++---------------- 4 files changed, 60 insertions(+), 82 deletions(-) diff --git a/src/EnergyPlus/DataWater.cc b/src/EnergyPlus/DataWater.cc index 7a90ffa4669..5f5615b3d59 100644 --- a/src/EnergyPlus/DataWater.cc +++ b/src/EnergyPlus/DataWater.cc @@ -107,28 +107,6 @@ namespace DataWater { int const OverflowDiscarded(601); int const OverflowToTank(602); - // DERIVED TYPE DEFINITIONS: - - // MODULE VARIABLE DECLARATIONS: - int NumWaterStorageTanks(0); // number of water Storage tanks in model - int NumRainCollectors(0); // number of rainfall collectors in model - int NumGroundWaterWells(0); // number of - int NumSiteRainFall(0); - bool AnyWaterSystemsInModel(false); // control flag set true if any water systems - bool WaterSystemGetInputCalled(false); // set true once input data gotten. - bool AnyIrrigationInModel(false); // control flag set true if irrigation input for ecoroof DJS PSU Dec 2006 - - void clear_state() - { - NumWaterStorageTanks = 0; - NumRainCollectors = 0; - NumGroundWaterWells = 0; - NumSiteRainFall = 0; - AnyWaterSystemsInModel = false; - WaterSystemGetInputCalled = false; - AnyIrrigationInModel = false; - } - } // namespace DataWater } // namespace EnergyPlus diff --git a/src/EnergyPlus/DataWater.hh b/src/EnergyPlus/DataWater.hh index c2f15634ece..c052541a96d 100644 --- a/src/EnergyPlus/DataWater.hh +++ b/src/EnergyPlus/DataWater.hh @@ -94,19 +94,6 @@ namespace DataWater { extern int const OverflowDiscarded; extern int const OverflowToTank; - // DERIVED TYPE DEFINITIONS: - - // MODULE VARIABLE DECLARATIONS: - extern int NumWaterStorageTanks; // number of water Storage tanks in model - extern int NumRainCollectors; // number of rainfall collectors in model - extern int NumGroundWaterWells; // number of - extern int NumSiteRainFall; - extern bool AnyWaterSystemsInModel; // control flag set true if any water systems - extern bool WaterSystemGetInputCalled; // set true once input data gotten. - extern bool AnyIrrigationInModel; // control flag set true if irrigation input for ecoroof DJS PSU Dec 2006 - - void clear_state(); - struct StorageTankDataStruct { // Members @@ -288,12 +275,27 @@ struct DataWaterData : BaseGlobalStruct { Array1D RainCollector; Array1D GroundwaterWell; + int NumWaterStorageTanks = 0; // number of water Storage tanks in model + int NumRainCollectors = 0; // number of rainfall collectors in model + int NumGroundWaterWells = 0; // number of + int NumSiteRainFall = 0; + bool AnyWaterSystemsInModel = false; // control flag set true if any water systems + bool WaterSystemGetInputCalled = false; // set true once input data gotten. + bool AnyIrrigationInModel = false; // control flag set true if irrigation input for ecoroof DJS PSU Dec 2006 + void clear_state() override { RainFall = {}; Irrigation = {}; WaterStorage.deallocate(); RainCollector.deallocate(); GroundwaterWell.deallocate(); + NumWaterStorageTanks = 0; + NumRainCollectors = 0; + NumGroundWaterWells = 0; + NumSiteRainFall = 0; + AnyWaterSystemsInModel = false; + WaterSystemGetInputCalled = false; + AnyIrrigationInModel = false; } }; diff --git a/src/EnergyPlus/StateManagement.cc b/src/EnergyPlus/StateManagement.cc index 8cebb53b40d..d854dc58cbd 100644 --- a/src/EnergyPlus/StateManagement.cc +++ b/src/EnergyPlus/StateManagement.cc @@ -87,7 +87,6 @@ #include #include #include -#include #include #include #include @@ -252,7 +251,6 @@ void EnergyPlus::clearAllStates(EnergyPlusData &state) DataSystemVariables::clear_state(); DataUCSDSharedData::clear_state(); DataViewFactorInformation::clear_state(); - DataWater::clear_state(); DataZoneControls::clear_state(); DataZoneEnergyDemands::clear_state(); DataZoneEquipment::clear_state(); diff --git a/src/EnergyPlus/WaterManager.cc b/src/EnergyPlus/WaterManager.cc index 0dfa727f141..19962260d05 100644 --- a/src/EnergyPlus/WaterManager.cc +++ b/src/EnergyPlus/WaterManager.cc @@ -125,25 +125,25 @@ namespace WaterManager { state.dataWaterManager->GetInputFlag = false; } - if (!(AnyWaterSystemsInModel)) return; + if (!(state.dataWaterData->AnyWaterSystemsInModel)) return; // this is the main water manager // first call all the water storage tanks // (these called first to make control decisions) - for (TankNum = 1; TankNum <= NumWaterStorageTanks; ++TankNum) { + for (TankNum = 1; TankNum <= state.dataWaterData->NumWaterStorageTanks; ++TankNum) { CalcWaterStorageTank(state, TankNum); } // tank loop - for (RainColNum = 1; RainColNum <= NumRainCollectors; ++RainColNum) { + for (RainColNum = 1; RainColNum <= state.dataWaterData->NumRainCollectors; ++RainColNum) { CalcRainCollector(state, RainColNum); } - for (WellNum = 1; WellNum <= NumGroundWaterWells; ++WellNum) { + for (WellNum = 1; WellNum <= state.dataWaterData->NumGroundWaterWells; ++WellNum) { CalcGroundwaterWell(state, WellNum); } // call the tanks again to get updated rain and well activity - for (TankNum = 1; TankNum <= NumWaterStorageTanks; ++TankNum) { + for (TankNum = 1; TankNum <= state.dataWaterData->NumWaterStorageTanks; ++TankNum) { CalcWaterStorageTank(state, TankNum); } // tank loop @@ -162,7 +162,7 @@ namespace WaterManager { // PURPOSE OF THIS SUBROUTINE: // - if (!(AnyWaterSystemsInModel)) return; + if (!(state.dataWaterData->AnyWaterSystemsInModel)) return; UpdateWaterManager(state); @@ -220,7 +220,7 @@ namespace WaterManager { int NumIrrigation; int Dummy; - if ((state.dataWaterManager->MyOneTimeFlag) && (!(WaterSystemGetInputCalled))) { // big block for entire subroutine + if ((state.dataWaterManager->MyOneTimeFlag) && (!(state.dataWaterData->WaterSystemGetInputCalled))) { // big block for entire subroutine cCurrentModuleObject = "WaterUse:Storage"; inputProcessor->getObjectDefMaxArgs(cCurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); @@ -252,12 +252,12 @@ namespace WaterManager { state.dataWaterManager->MyOneTimeFlag = false; cCurrentModuleObject = "WaterUse:Storage"; - NumWaterStorageTanks = inputProcessor->getNumObjectsFound(cCurrentModuleObject); - if (NumWaterStorageTanks > 0) { - AnyWaterSystemsInModel = true; - if (!(allocated(state.dataWaterData->WaterStorage))) state.dataWaterData->WaterStorage.allocate(NumWaterStorageTanks); + state.dataWaterData->NumWaterStorageTanks = inputProcessor->getNumObjectsFound(cCurrentModuleObject); + if (state.dataWaterData->NumWaterStorageTanks > 0) { + state.dataWaterData->AnyWaterSystemsInModel = true; + if (!(allocated(state.dataWaterData->WaterStorage))) state.dataWaterData->WaterStorage.allocate(state.dataWaterData->NumWaterStorageTanks); - for (Item = 1; Item <= NumWaterStorageTanks; ++Item) { + for (Item = 1; Item <= state.dataWaterData->NumWaterStorageTanks; ++Item) { inputProcessor->getObjectItem(state, cCurrentModuleObject, Item, @@ -270,7 +270,7 @@ namespace WaterManager { _, cAlphaFieldNames, cNumericFieldNames); - AnyWaterSystemsInModel = true; + state.dataWaterData->AnyWaterSystemsInModel = true; state.dataWaterData->WaterStorage(Item).Name = cAlphaArgs(1); UtilityRoutines::IsNameEmpty(cAlphaArgs(1), cCurrentModuleObject, ErrorsFound); objNameMsg = cCurrentModuleObject + " = " + cAlphaArgs(1); @@ -400,13 +400,13 @@ namespace WaterManager { } // num water storage tanks > 0 cCurrentModuleObject = "WaterUse:RainCollector"; - NumRainCollectors = inputProcessor->getNumObjectsFound(cCurrentModuleObject); - if (NumRainCollectors > 0) { - if (!(allocated(state.dataWaterData->RainCollector))) state.dataWaterData->RainCollector.allocate(NumRainCollectors); + state.dataWaterData->NumRainCollectors = inputProcessor->getNumObjectsFound(cCurrentModuleObject); + if (state.dataWaterData->NumRainCollectors > 0) { + if (!(allocated(state.dataWaterData->RainCollector))) state.dataWaterData->RainCollector.allocate(state.dataWaterData->NumRainCollectors); // allow extensible reference to surfaces. - AnyWaterSystemsInModel = true; + state.dataWaterData->AnyWaterSystemsInModel = true; - for (Item = 1; Item <= NumRainCollectors; ++Item) { + for (Item = 1; Item <= state.dataWaterData->NumRainCollectors; ++Item) { inputProcessor->getObjectItem(state, cCurrentModuleObject, Item, @@ -516,11 +516,11 @@ namespace WaterManager { } // (NumRainCollectors > 0) cCurrentModuleObject = "WaterUse:Well"; - NumGroundWaterWells = inputProcessor->getNumObjectsFound(cCurrentModuleObject); - if (NumGroundWaterWells > 0) { - AnyWaterSystemsInModel = true; - state.dataWaterData->GroundwaterWell.allocate(NumGroundWaterWells); - for (Item = 1; Item <= NumGroundWaterWells; ++Item) { + state.dataWaterData->NumGroundWaterWells = inputProcessor->getNumObjectsFound(cCurrentModuleObject); + if (state.dataWaterData->NumGroundWaterWells > 0) { + state.dataWaterData->AnyWaterSystemsInModel = true; + state.dataWaterData->GroundwaterWell.allocate(state.dataWaterData->NumGroundWaterWells); + for (Item = 1; Item <= state.dataWaterData->NumGroundWaterWells; ++Item) { inputProcessor->getObjectItem(state, cCurrentModuleObject, Item, @@ -580,8 +580,8 @@ namespace WaterManager { // do some water tank setup cCurrentModuleObject = "WaterUse:Storage"; - if (NumWaterStorageTanks > 0) { - for (Item = 1; Item <= NumWaterStorageTanks; ++Item) { + if (state.dataWaterData->NumWaterStorageTanks > 0) { + for (Item = 1; Item <= state.dataWaterData->NumWaterStorageTanks; ++Item) { // check that all storage tanks with ground well controls actually had wells pointing to them if ((state.dataWaterData->WaterStorage(Item).ControlSupplyType == WellFloatValve) || (state.dataWaterData->WaterStorage(Item).ControlSupplyType == WellFloatMainsBackup)) { if (state.dataWaterData->WaterStorage(Item).GroundWellID == 0) { @@ -635,14 +635,14 @@ namespace WaterManager { } cCurrentModuleObject = "Site:Precipitation"; - NumSiteRainFall = inputProcessor->getNumObjectsFound(cCurrentModuleObject); - if (NumSiteRainFall > 1) { // throw error + state.dataWaterData->NumSiteRainFall = inputProcessor->getNumObjectsFound(cCurrentModuleObject); + if (state.dataWaterData->NumSiteRainFall > 1) { // throw error ShowSevereError("Only one " + cCurrentModuleObject + " object is allowed"); ErrorsFound = true; } - if (NumSiteRainFall == 1) { - AnyWaterSystemsInModel = true; + if (state.dataWaterData->NumSiteRainFall == 1) { + state.dataWaterData->AnyWaterSystemsInModel = true; inputProcessor->getObjectItem(state, cCurrentModuleObject, 1, cAlphaArgs, NumAlphas, rNumericArgs, NumNumbers, IOStatus); if (UtilityRoutines::SameString(cAlphaArgs(1), "ScheduleAndDesignLevel")) { @@ -675,7 +675,7 @@ namespace WaterManager { } if (NumIrrigation == 1) { - AnyIrrigationInModel = true; + state.dataWaterData->AnyIrrigationInModel = true; inputProcessor->getObjectItem(state, cCurrentModuleObject, 1, cAlphaArgs, NumAlphas, rNumericArgs, NumNumbers, IOStatus); if (UtilityRoutines::SameString(cAlphaArgs(1), "Schedule")) { state.dataWaterData->Irrigation.ModeID = IrrSchedDesign; @@ -710,8 +710,8 @@ namespace WaterManager { } // NumIrrigation ==1 - AnyWaterSystemsInModel = true; - WaterSystemGetInputCalled = true; + state.dataWaterData->AnyWaterSystemsInModel = true; + state.dataWaterData->WaterSystemGetInputCalled = true; state.dataWaterManager->MyOneTimeFlag = false; cAlphaFieldNames.deallocate(); @@ -725,7 +725,7 @@ namespace WaterManager { ShowFatalError("Errors found in processing input for water manager objects"); } // , CurrentModuleObject='WaterUse:Storage' - for (Item = 1; Item <= NumWaterStorageTanks; ++Item) { + for (Item = 1; Item <= state.dataWaterData->NumWaterStorageTanks; ++Item) { // this next one is a measure of the state of water in the tank, not a flux of m3 that needs to be summed SetupOutputVariable(state, "Water System Storage Tank Volume", OutputProcessor::Unit::m3, @@ -807,7 +807,7 @@ namespace WaterManager { state.dataWaterData->WaterStorage(Item).Name); } - if (NumSiteRainFall == 1) { // CurrentModuleObject='Site:Precipitation' + if (state.dataWaterData->NumSiteRainFall == 1) { // CurrentModuleObject='Site:Precipitation' SetupOutputVariable(state, "Site Precipitation Rate", OutputProcessor::Unit::m_s, state.dataWaterData->RainFall.CurrentRate, "System", "Average", "Site:Precipitation"); SetupOutputVariable(state, @@ -829,7 +829,7 @@ namespace WaterManager { "RoofIrrigation"); } - for (Item = 1; Item <= NumRainCollectors; ++Item) { // CurrentModuleObject='WaterUse:RainCollector' + for (Item = 1; Item <= state.dataWaterData->NumRainCollectors; ++Item) { // CurrentModuleObject='WaterUse:RainCollector' SetupOutputVariable(state, "Water System Rainwater Collector Volume Flow Rate", OutputProcessor::Unit::m3_s, state.dataWaterData->RainCollector(Item).VdotAvail, @@ -849,7 +849,7 @@ namespace WaterManager { "System"); } - for (Item = 1; Item <= NumGroundWaterWells; ++Item) { // CurrentModuleObject='WaterUse:Well' + for (Item = 1; Item <= state.dataWaterData->NumGroundWaterWells; ++Item) { // CurrentModuleObject='WaterUse:Well' SetupOutputVariable(state, "Water System Groundwater Well Requested Volume Flow Rate", OutputProcessor::Unit::m3_s, state.dataWaterData->GroundwaterWell(Item).VdotRequest, @@ -1255,7 +1255,7 @@ namespace WaterManager { // METHODOLOGY EMPLOYED: // push the VdotAvailToTank array and return - if (!(WaterSystemGetInputCalled)) { + if (!(state.dataWaterData->WaterSystemGetInputCalled)) { GetWaterManagerInput(state); } @@ -1364,7 +1364,7 @@ namespace WaterManager { // METHODOLOGY EMPLOYED: // push the VdotAvailToTank array and return - if (!(WaterSystemGetInputCalled)) { + if (!(state.dataWaterData->WaterSystemGetInputCalled)) { GetWaterManagerInput(state); } @@ -1633,14 +1633,14 @@ namespace WaterManager { int WellNum; if (state.dataGlobal->BeginEnvrnFlag && state.dataWaterManager->MyEnvrnFlag) { - for (TankNum = 1; TankNum <= NumWaterStorageTanks; ++TankNum) { + for (TankNum = 1; TankNum <= state.dataWaterData->NumWaterStorageTanks; ++TankNum) { state.dataWaterData->WaterStorage(TankNum).LastTimeStepVolume = state.dataWaterData->WaterStorage(TankNum).InitialVolume; state.dataWaterData->WaterStorage(TankNum).ThisTimeStepVolume = state.dataWaterData->WaterStorage(TankNum).InitialVolume; } if ((!DoingSizing) && (!KickOffSimulation) && state.dataWaterManager->MyTankDemandCheckFlag) { - if (NumWaterStorageTanks > 0) { - for (TankNum = 1; TankNum <= NumWaterStorageTanks; ++TankNum) { + if (state.dataWaterData->NumWaterStorageTanks > 0) { + for (TankNum = 1; TankNum <= state.dataWaterData->NumWaterStorageTanks; ++TankNum) { if (state.dataWaterData->WaterStorage(TankNum).NumWaterDemands == 0) { ShowWarningError("Found WaterUse:Storage that has nothing connected to draw water from it."); ShowContinueError("Occurs for WaterUse:Storage = " + state.dataWaterData->WaterStorage(TankNum).Name); @@ -1659,7 +1659,7 @@ namespace WaterManager { } if (state.dataWaterManager->MyWarmupFlag && (!WarmupFlag)) { // do environment inits. just went out of warmup mode - for (TankNum = 1; TankNum <= NumWaterStorageTanks; ++TankNum) { + for (TankNum = 1; TankNum <= state.dataWaterData->NumWaterStorageTanks; ++TankNum) { state.dataWaterData->WaterStorage(TankNum).LastTimeStepVolume = state.dataWaterData->WaterStorage(TankNum).InitialVolume; state.dataWaterData->WaterStorage(TankNum).ThisTimeStepVolume = state.dataWaterData->WaterStorage(TankNum).InitialVolume; state.dataWaterData->WaterStorage(TankNum).LastTimeStepTemp = state.dataWaterData->WaterStorage(TankNum).InitialTankTemp; @@ -1667,7 +1667,7 @@ namespace WaterManager { state.dataWaterManager->MyWarmupFlag = false; } - for (TankNum = 1; TankNum <= NumWaterStorageTanks; ++TankNum) { + for (TankNum = 1; TankNum <= state.dataWaterData->NumWaterStorageTanks; ++TankNum) { // main location for inits for new timestep. state.dataWaterData->WaterStorage(TankNum).LastTimeStepVolume = max(state.dataWaterData->WaterStorage(TankNum).ThisTimeStepVolume, 0.0); state.dataWaterData->WaterStorage(TankNum).MainsDrawVdot = 0.0; @@ -1692,13 +1692,13 @@ namespace WaterManager { } } // tank loop - for (RainColNum = 1; RainColNum <= NumRainCollectors; ++RainColNum) { + for (RainColNum = 1; RainColNum <= state.dataWaterData->NumRainCollectors; ++RainColNum) { state.dataWaterData->RainCollector(RainColNum).VdotAvail = 0.0; state.dataWaterData->RainCollector(RainColNum).VolCollected = 0.0; } - for (WellNum = 1; WellNum <= NumGroundWaterWells; ++WellNum) { + for (WellNum = 1; WellNum <= state.dataWaterData->NumGroundWaterWells; ++WellNum) { // re init calculated vars state.dataWaterData->GroundwaterWell(WellNum).VdotRequest = 0.0; state.dataWaterData->GroundwaterWell(WellNum).VdotDelivered = 0.0; From b1e3bdc2f27568e06d5a229df9c295da87fc24bf Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Wed, 28 Oct 2020 08:27:56 -0600 Subject: [PATCH 4/6] move some DataWater const ints to enums --- src/EnergyPlus/DataWater.cc | 33 ----- src/EnergyPlus/DataWater.hh | 47 ++++--- src/EnergyPlus/WaterManager.cc | 236 ++++----------------------------- src/EnergyPlus/WaterManager.hh | 4 - 4 files changed, 50 insertions(+), 270 deletions(-) diff --git a/src/EnergyPlus/DataWater.cc b/src/EnergyPlus/DataWater.cc index 5f5615b3d59..11b32054cdc 100644 --- a/src/EnergyPlus/DataWater.cc +++ b/src/EnergyPlus/DataWater.cc @@ -60,26 +60,6 @@ namespace DataWater { // MODIFIED D. Sailor -- to add ecoroof irrigation // RE-ENGINEERED na - // PURPOSE OF THIS MODULE: - // This data-only module is a repository for the variables that relate specifically - // to the management of water in the simulation - - // METHODOLOGY EMPLOYED: - // - - // REFERENCES: - // na - - // OTHER NOTES: - // na - - // Using/Aliasing - // Data - // -only module should be available to other modules and routines. - // Thus, all variables in this module must be PUBLI - - // MODULE PARAMETER DEFINITION - int const ScheduledTankTemp(101); // tank water temperature is user input via schedule int const TankZoneThermalCoupled(102); // tank water temperature is modeled using simple UA @@ -94,19 +74,6 @@ namespace DataWater { int const AmbientTempZone(2); // tank is located in a zone or HPWH inlet air is zone air only int const AmbientTempExterior(3); // tank is located outdoors or HPWH inlet air is outdoor air only - int const ConstantWaterTable(401); - int const ScheduledWaterTable(402); - - int const NoControlLevel(501); - int const MainsFloatValve(502); - int const WellFloatValve(503); - int const WellFloatMainsBackup(504); - int const OtherTankFloatValve(505); - int const TankMainsBackup(506); - - int const OverflowDiscarded(601); - int const OverflowToTank(602); - } // namespace DataWater } // namespace EnergyPlus diff --git a/src/EnergyPlus/DataWater.hh b/src/EnergyPlus/DataWater.hh index c052541a96d..2db164ea297 100644 --- a/src/EnergyPlus/DataWater.hh +++ b/src/EnergyPlus/DataWater.hh @@ -59,12 +59,6 @@ namespace EnergyPlus { namespace DataWater { - // Using/Aliasing - - // Data - // -only module should be available to other modules and routines. - // Thus, all variables in this module must be PUBLI - // MODULE PARAMETER DEFINITION extern int const ScheduledTankTemp; // tank water temperature is user input via schedule @@ -81,18 +75,27 @@ namespace DataWater { 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 - extern int const ConstantWaterTable; - extern int const ScheduledWaterTable; + enum class GroundWaterTable { + Unassigned, + ConstantWaterTable, + ScheduledWaterTable + }; - extern int const NoControlLevel; - extern int const MainsFloatValve; - extern int const WellFloatValve; - extern int const WellFloatMainsBackup; - extern int const OtherTankFloatValve; - extern int const TankMainsBackup; + enum class ControlSupplyType { + Unassigned, + NoControlLevel, + MainsFloatValve, + WellFloatValve, + WellFloatMainsBackup, + OtherTankFloatValve, + TankMainsBackup + }; - extern int const OverflowDiscarded; - extern int const OverflowToTank; + enum class Overflow { + Unassigned, + Discarded, + ToTank + }; struct StorageTankDataStruct { @@ -102,13 +105,13 @@ namespace DataWater { std::string QualitySubCategoryName; // name of water subcategory // INTEGER :: QualitySubCategory = 0 ! Real64 MaxCapacity; // tank capacity Limit [m3] - int OverflowMode; + Overflow OverflowMode; std::string OverflowTankName; int OverflowTankID; int OverflowTankSupplyARRID; Real64 ValveOnCapacity; // tank capacity at lower control range [m3] Real64 ValveOffCapacity; // tank capacity at upper control range [m3] - int ControlSupplyType; // mode for tank controlled resupply + ControlSupplyType ControlSupplyType; // mode for tank controlled resupply int GroundWellID; // index "pointer" to well if present std::string SupplyTankName; int SupplyTankID; @@ -159,8 +162,8 @@ namespace DataWater { // Default Constructor StorageTankDataStruct() - : MaxCapacity(0.0), OverflowMode(0), OverflowTankID(0), OverflowTankSupplyARRID(0), ValveOnCapacity(0.0), ValveOffCapacity(0.0), - ControlSupplyType(0), GroundWellID(0), SupplyTankID(0), SupplyTankDemandARRID(0), BackupMainsCapacity(0.0), InitialVolume(0.0), + : 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), 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), @@ -214,7 +217,7 @@ namespace DataWater { Real64 PumpEfficiency; Real64 WellRecoveryRate; // rate at which groundwater can enter well [m3/s] Real64 NomWellStorageVol; // water storage in well at average water table depth [m3] - int GroundwaterTableMode; // method of determining water table depth + GroundWaterTable GroundwaterTableMode; // method of determining water table depth Real64 WaterTableDepth; int WaterTableDepthSchedID; // calculated and from elsewhere @@ -227,7 +230,7 @@ namespace DataWater { // Default Constructor GroundwaterWellDataStruct() : StorageTankID(0), StorageTankSupplyARRID(0), PumpDepth(0.0), PumpNomVolFlowRate(0.0), PumpNomHead(0.0), PumpNomPowerUse(0.0), - PumpEfficiency(0.0), WellRecoveryRate(0.0), NomWellStorageVol(0.0), GroundwaterTableMode(0), WaterTableDepth(0.0), + PumpEfficiency(0.0), WellRecoveryRate(0.0), NomWellStorageVol(0.0), GroundwaterTableMode(GroundWaterTable::Unassigned), WaterTableDepth(0.0), WaterTableDepthSchedID(0), VdotRequest(0.0), VdotDelivered(0.0), VolDelivered(0.0), PumpPower(0.0), PumpEnergy(0.0) { } diff --git a/src/EnergyPlus/WaterManager.cc b/src/EnergyPlus/WaterManager.cc index 19962260d05..d2b9c8ec993 100644 --- a/src/EnergyPlus/WaterManager.cc +++ b/src/EnergyPlus/WaterManager.cc @@ -146,8 +146,6 @@ namespace WaterManager { for (TankNum = 1; TankNum <= state.dataWaterData->NumWaterStorageTanks; ++TankNum) { CalcWaterStorageTank(state, TankNum); } // tank loop - - ReportWaterManager(); } void ManageWaterInits(EnergyPlusData &state) @@ -179,9 +177,6 @@ namespace WaterManager { // MODIFIED na // RE-ENGINEERED na - // PURPOSE OF THIS SUBROUTINE: - // - // Using/Aliasing using DataHeatBalance::Zone; using DataSurfaces::Surface; @@ -296,13 +291,13 @@ namespace WaterManager { state.dataWaterData->WaterStorage(Item).OverflowTankName = cAlphaArgs(3); // setup later if (UtilityRoutines::SameString(cAlphaArgs(4), "None")) { - state.dataWaterData->WaterStorage(Item).ControlSupplyType = NoControlLevel; + state.dataWaterData->WaterStorage(Item).ControlSupplyType = DataWater::ControlSupplyType::NoControlLevel; } else if (UtilityRoutines::SameString(cAlphaArgs(4), "Mains")) { - state.dataWaterData->WaterStorage(Item).ControlSupplyType = MainsFloatValve; + state.dataWaterData->WaterStorage(Item).ControlSupplyType = DataWater::ControlSupplyType::MainsFloatValve; } else if (UtilityRoutines::SameString(cAlphaArgs(4), "GroundwaterWell")) { - state.dataWaterData->WaterStorage(Item).ControlSupplyType = WellFloatValve; + state.dataWaterData->WaterStorage(Item).ControlSupplyType = DataWater::ControlSupplyType::WellFloatValve; } else if (UtilityRoutines::SameString(cAlphaArgs(4), "OtherTank")) { - state.dataWaterData->WaterStorage(Item).ControlSupplyType = OtherTankFloatValve; + state.dataWaterData->WaterStorage(Item).ControlSupplyType = DataWater::ControlSupplyType::OtherTankFloatValve; } else { ShowSevereError("Invalid " + cAlphaFieldNames(4) + '=' + cAlphaArgs(4)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); @@ -310,7 +305,7 @@ namespace WaterManager { } state.dataWaterData->WaterStorage(Item).ValveOnCapacity = rNumericArgs(5); state.dataWaterData->WaterStorage(Item).ValveOffCapacity = rNumericArgs(6); - if (state.dataWaterData->WaterStorage(Item).ControlSupplyType != NoControlLevel) { + if (state.dataWaterData->WaterStorage(Item).ControlSupplyType != DataWater::ControlSupplyType::NoControlLevel) { if (state.dataWaterData->WaterStorage(Item).ValveOffCapacity < state.dataWaterData->WaterStorage(Item).ValveOnCapacity) { ShowSevereError("Invalid " + cNumericFieldNames(5) + " and/or " + cNumericFieldNames(6)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); @@ -325,11 +320,11 @@ namespace WaterManager { state.dataWaterData->WaterStorage(Item).BackupMainsCapacity = rNumericArgs(7); if (state.dataWaterData->WaterStorage(Item).BackupMainsCapacity > 0.0) { // add backup to well and other thank supply - if (state.dataWaterData->WaterStorage(Item).ControlSupplyType == WellFloatValve) { - state.dataWaterData->WaterStorage(Item).ControlSupplyType = WellFloatMainsBackup; + if (state.dataWaterData->WaterStorage(Item).ControlSupplyType == DataWater::ControlSupplyType::WellFloatValve) { + state.dataWaterData->WaterStorage(Item).ControlSupplyType = DataWater::ControlSupplyType::WellFloatMainsBackup; } - if (state.dataWaterData->WaterStorage(Item).ControlSupplyType == OtherTankFloatValve) { - state.dataWaterData->WaterStorage(Item).ControlSupplyType = TankMainsBackup; + if (state.dataWaterData->WaterStorage(Item).ControlSupplyType == DataWater::ControlSupplyType::OtherTankFloatValve) { + state.dataWaterData->WaterStorage(Item).ControlSupplyType = DataWater::ControlSupplyType::TankMainsBackup; } } @@ -555,11 +550,11 @@ namespace WaterManager { state.dataWaterData->GroundwaterWell(Item).WellRecoveryRate = rNumericArgs(6); state.dataWaterData->GroundwaterWell(Item).NomWellStorageVol = rNumericArgs(7); if (UtilityRoutines::SameString(cAlphaArgs(3), "Constant")) { - state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode = ConstantWaterTable; + state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode = DataWater::GroundWaterTable::ConstantWaterTable; } else if (UtilityRoutines::SameString(cAlphaArgs(3), "Scheduled")) { - state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode = ScheduledWaterTable; + state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode = DataWater::GroundWaterTable::ScheduledWaterTable; } else if (lAlphaFieldBlanks(3)) { - state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode = 0; + state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode = DataWater::GroundWaterTable::Unassigned; } else { ShowSevereError("Invalid " + cAlphaFieldNames(3) + '=' + cAlphaArgs(3)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); @@ -570,7 +565,7 @@ namespace WaterManager { state.dataWaterData->GroundwaterWell(Item).WaterTableDepth = rNumericArgs(8); // A4; \field water table depth schedule state.dataWaterData->GroundwaterWell(Item).WaterTableDepthSchedID = GetScheduleIndex(state, cAlphaArgs(4)); - if ((state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode == ScheduledWaterTable) && (state.dataWaterData->GroundwaterWell(Item).WaterTableDepthSchedID == 0)) { + if ((state.dataWaterData->GroundwaterWell(Item).GroundwaterTableMode == DataWater::GroundWaterTable::ScheduledWaterTable) && (state.dataWaterData->GroundwaterWell(Item).WaterTableDepthSchedID == 0)) { ShowSevereError("Invalid " + cAlphaFieldNames(4) + '=' + cAlphaArgs(4)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; @@ -583,7 +578,7 @@ namespace WaterManager { if (state.dataWaterData->NumWaterStorageTanks > 0) { for (Item = 1; Item <= state.dataWaterData->NumWaterStorageTanks; ++Item) { // check that all storage tanks with ground well controls actually had wells pointing to them - if ((state.dataWaterData->WaterStorage(Item).ControlSupplyType == WellFloatValve) || (state.dataWaterData->WaterStorage(Item).ControlSupplyType == WellFloatMainsBackup)) { + if ((state.dataWaterData->WaterStorage(Item).ControlSupplyType == DataWater::ControlSupplyType::WellFloatValve) || (state.dataWaterData->WaterStorage(Item).ControlSupplyType == DataWater::ControlSupplyType::WellFloatMainsBackup)) { if (state.dataWaterData->WaterStorage(Item).GroundWellID == 0) { ShowSevereError(cCurrentModuleObject + "= \"" + state.dataWaterData->WaterStorage(Item).Name + "\" does not have a WaterUse:Well (groundwater well) that names it."); @@ -592,7 +587,7 @@ namespace WaterManager { } // setup tanks whose level is controlled by supply from another tank - if ((state.dataWaterData->WaterStorage(Item).ControlSupplyType == OtherTankFloatValve) || (state.dataWaterData->WaterStorage(Item).ControlSupplyType == TankMainsBackup)) { + if ((state.dataWaterData->WaterStorage(Item).ControlSupplyType == DataWater::ControlSupplyType::OtherTankFloatValve) || (state.dataWaterData->WaterStorage(Item).ControlSupplyType == DataWater::ControlSupplyType::TankMainsBackup)) { state.dataWaterData->WaterStorage(Item).SupplyTankID = UtilityRoutines::FindItemInList(state.dataWaterData->WaterStorage(Item).SupplyTankName, state.dataWaterData->WaterStorage); if (state.dataWaterData->WaterStorage(Item).SupplyTankID == 0) { ShowSevereError("Other tank called " + state.dataWaterData->WaterStorage(Item).SupplyTankName + " not found for " + cCurrentModuleObject + @@ -614,16 +609,16 @@ namespace WaterManager { if (state.dataWaterData->WaterStorage(Item).OverflowTankID == 0) { // if blank, then okay it is discarded. but if not blank then error if (is_blank(state.dataWaterData->WaterStorage(Item).OverflowTankName)) { - state.dataWaterData->WaterStorage(Item).OverflowMode = OverflowDiscarded; + state.dataWaterData->WaterStorage(Item).OverflowMode = DataWater::Overflow::Discarded; } else { ShowSevereError("Overflow tank name of " + state.dataWaterData->WaterStorage(Item).OverflowTankName + " not found for " + cCurrentModuleObject + " Named " + state.dataWaterData->WaterStorage(Item).Name); ErrorsFound = true; } } else { - state.dataWaterData->WaterStorage(Item).OverflowMode = OverflowToTank; + state.dataWaterData->WaterStorage(Item).OverflowMode = DataWater::Overflow::ToTank; } - if (state.dataWaterData->WaterStorage(Item).OverflowMode == OverflowToTank) { + if (state.dataWaterData->WaterStorage(Item).OverflowMode == DataWater::Overflow::ToTank) { InternalSetupTankSupplyComponent(state, state.dataWaterData->WaterStorage(Item).Name, cCurrentModuleObject, state.dataWaterData->WaterStorage(Item).OverflowTankName, @@ -780,7 +775,7 @@ namespace WaterManager { "System", "Average", state.dataWaterData->WaterStorage(Item).Name); - if (state.dataWaterData->WaterStorage(Item).OverflowMode == OverflowDiscarded) { + if (state.dataWaterData->WaterStorage(Item).OverflowMode == DataWater::Overflow::Discarded) { SetupOutputVariable(state, "Water System Storage Tank Overflow Water Volume", OutputProcessor::Unit::m3, state.dataWaterData->WaterStorage(Item).VolOverflow, @@ -907,32 +902,9 @@ namespace WaterManager { // PURPOSE OF THIS SUBROUTINE: // update the current rate of precipitation - // METHODOLOGY EMPLOYED: - // - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Using/Aliasing using DataHVACGlobals::TimeStepSys; using ScheduleManager::GetCurrentScheduleValue; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 schedRate; Real64 ScaleFactor; @@ -960,34 +932,10 @@ namespace WaterManager { // PURPOSE OF THIS SUBROUTINE: // update the current rate of irrigation - // METHODOLOGY EMPLOYED: - // na - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Using/Aliasing using DataHVACGlobals::TimeStepSys; using ScheduleManager::GetCurrentScheduleValue; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 schedRate; - // REAL(r64) :: ScaleFactor state.dataWaterData->Irrigation.ScheduledAmount = 0.0; @@ -1001,43 +949,6 @@ namespace WaterManager { } } - void SizeWaterManager() - { - - // SUBROUTINE INFORMATION: - // AUTHOR B. Griffith - // DATE WRITTEN August 2006 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS SUBROUTINE: - // - - // METHODOLOGY EMPLOYED: - // - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS - // na - - // DERIVED TYPE DEFINITIONS - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - } - void CalcWaterStorageTank(EnergyPlusData &state, int const TankNum) // Index of storage tank { @@ -1051,28 +962,10 @@ namespace WaterManager { // Collect the calculations used to update the modeled values // for the storage tanks at each system timestep - // METHODOLOGY EMPLOYED: - // - - // REFERENCES: - // na - // Using/Aliasing using DataHVACGlobals::TimeStepSys; using ScheduleManager::GetCurrentScheduleValue; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // see DataWater.cc - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: static Real64 OrigVdotDemandRequest(0.0); static Real64 TotVdotDemandAvail(0.0); @@ -1081,7 +974,6 @@ namespace WaterManager { static Real64 OrigVdotSupplyAvail(0.0); static Real64 TotVdotSupplyAvail(0.0); static Real64 TotVolSupplyAvail(0.0); - // REAL(r64) :: TotVolSupplyAllow = 0.0d0 static Real64 overflowVdot(0.0); static Real64 overflowVol(0.0); static Real64 overflowTwater(0.0); @@ -1178,26 +1070,26 @@ namespace WaterManager { FillVolRequest = state.dataWaterData->WaterStorage(TankNum).ValveOffCapacity - VolumePredict; // set mains draws for float on (all the way to Float off) - if (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == MainsFloatValve) { + if (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::MainsFloatValve) { state.dataWaterData->WaterStorage(TankNum).MainsDrawVdot = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); NetVolAdd = FillVolRequest; } // set demand request in supplying tank if needed - if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == OtherTankFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == TankMainsBackup)) { + if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::OtherTankFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::TankMainsBackup)) { state.dataWaterData->WaterStorage(state.dataWaterData->WaterStorage(TankNum).SupplyTankID).VdotRequestDemand(state.dataWaterData->WaterStorage(TankNum).SupplyTankDemandARRID) = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); } // set demand request in groundwater well if needed - if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatMainsBackup)) { + if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::WellFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::WellFloatMainsBackup)) { state.dataWaterData->GroundwaterWell(state.dataWaterData->WaterStorage(TankNum).GroundWellID).VdotRequest = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); } } // set mains flow if mains backup active if ((VolumePredict) < state.dataWaterData->WaterStorage(TankNum).BackupMainsCapacity) { // turn on supply - if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatMainsBackup) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == TankMainsBackup)) { + if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::WellFloatMainsBackup) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::TankMainsBackup)) { FillVolRequest = state.dataWaterData->WaterStorage(TankNum).ValveOffCapacity - VolumePredict; state.dataWaterData->WaterStorage(TankNum).MainsDrawVdot = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); NetVolAdd = FillVolRequest; @@ -1224,7 +1116,7 @@ namespace WaterManager { } // set supply avail data from overflows in Receiving tank - if (state.dataWaterData->WaterStorage(TankNum).OverflowMode == OverflowToTank) { + if (state.dataWaterData->WaterStorage(TankNum).OverflowMode == DataWater::Overflow::ToTank) { state.dataWaterData->WaterStorage(state.dataWaterData->WaterStorage(TankNum).OverflowTankID).VdotAvailSupply(state.dataWaterData->WaterStorage(TankNum).OverflowTankSupplyARRID) = state.dataWaterData->WaterStorage(TankNum).VdotOverflow; state.dataWaterData->WaterStorage(state.dataWaterData->WaterStorage(TankNum).OverflowTankID).TwaterSupply(state.dataWaterData->WaterStorage(TankNum).OverflowTankSupplyARRID) = @@ -1290,7 +1182,6 @@ namespace WaterManager { int oldNumSupply; Array1D_string oldSupplyCompNames; Array1D_string oldSupplyCompTypes; - // LOGICAL , SAVE :: MyOneTimeFlag = .TRUE. TankIndex = UtilityRoutines::FindItemInList(TankName, state.dataWaterData->WaterStorage); if (TankIndex == 0) { @@ -1466,31 +1357,10 @@ namespace WaterManager { // Collect the calculations used to update the modeled values // for the rain collector at each system timestep - // METHODOLOGY EMPLOYED: - // - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - // Using/Aliasing using DataEnvironment::OutWetBulbTempAt; using DataHVACGlobals::TimeStepSys; using ScheduleManager::GetCurrentScheduleValue; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // see DataWater.cc - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 LossFactor(0.0); Real64 VdotAvail; @@ -1553,25 +1423,9 @@ namespace WaterManager { // starting simple and ignoring well storage and complex rate restrictions. // just uses nominal pump rate and power (assuming well designed well). - // REFERENCES: - // na - - // Using/Aliasing using DataEnvironment::GroundTemp_Deep; using DataHVACGlobals::TimeStepSys; - // Locals - // SUBROUTINE ARGUMENT DEFINITIONS: - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // see DataWater.cc - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: Real64 VdotDelivered; Real64 PumpPower; @@ -1687,7 +1541,7 @@ namespace WaterManager { // This was an issue because the coil supply was being stomped by this assignment to zero, so no tank action was happening state.dataWaterData->WaterStorage(TankNum).VdotAvailSupply = 0.0; } - if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == WellFloatMainsBackup)) { + if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::WellFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::WellFloatMainsBackup)) { if (allocated(state.dataWaterData->GroundwaterWell)) state.dataWaterData->GroundwaterWell(state.dataWaterData->WaterStorage(TankNum).GroundWellID).VdotRequest = 0.0; } } // tank loop @@ -1699,7 +1553,6 @@ namespace WaterManager { } for (WellNum = 1; WellNum <= state.dataWaterData->NumGroundWaterWells; ++WellNum) { - // re init calculated vars state.dataWaterData->GroundwaterWell(WellNum).VdotRequest = 0.0; state.dataWaterData->GroundwaterWell(WellNum).VdotDelivered = 0.0; state.dataWaterData->GroundwaterWell(WellNum).VolDelivered = 0.0; @@ -1708,45 +1561,6 @@ namespace WaterManager { } } - void ReportWaterManager() - { - - // SUBROUTINE INFORMATION: - // AUTHOR B. Griffith - // DATE WRITTEN August 2006 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS SUBROUTINE: - // - - // METHODOLOGY EMPLOYED: - // - - // REFERENCES: - // na - - // USE STATEMENTS: - // na - - // SUBROUTINE ARGUMENT DEFINITIONS: - // na - - // SUBROUTINE PARAMETER DEFINITIONS: - // na - - // INTERFACE BLOCK SPECIFICATIONS: - // na - - // DERIVED TYPE DEFINITIONS: - // na - - // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - // na - - // - } - } // namespace WaterManager } // namespace EnergyPlus diff --git a/src/EnergyPlus/WaterManager.hh b/src/EnergyPlus/WaterManager.hh index 63fe151f86e..875c81e1383 100644 --- a/src/EnergyPlus/WaterManager.hh +++ b/src/EnergyPlus/WaterManager.hh @@ -72,8 +72,6 @@ namespace WaterManager { void UpdateIrrigation(EnergyPlusData &state); - void SizeWaterManager(); - void CalcWaterStorageTank(EnergyPlusData &state, int const TankNum); // Index of storage tank void SetupTankSupplyComponent(EnergyPlusData &state, std::string const &CompName, @@ -113,8 +111,6 @@ namespace WaterManager { void UpdateWaterManager(EnergyPlusData &state); - void ReportWaterManager(); - } // namespace WaterManager struct WaterManagerData : BaseGlobalStruct { From 4f960e6d10fe00f781b439d361efe1ed5388a608 Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Wed, 28 Oct 2020 09:26:07 -0600 Subject: [PATCH 5/6] move remaining const ints in DataWater to enums --- src/EnergyPlus/CMakeLists.txt | 1 - src/EnergyPlus/DataWater.cc | 79 -------------------------------- src/EnergyPlus/DataWater.hh | 52 ++++++++++++--------- src/EnergyPlus/EcoRoofManager.cc | 19 ++------ src/EnergyPlus/WaterManager.cc | 79 ++++++++++++-------------------- 5 files changed, 63 insertions(+), 167 deletions(-) delete mode 100644 src/EnergyPlus/DataWater.cc diff --git a/src/EnergyPlus/CMakeLists.txt b/src/EnergyPlus/CMakeLists.txt index 8a487ce58d0..b451af0d488 100644 --- a/src/EnergyPlus/CMakeLists.txt +++ b/src/EnergyPlus/CMakeLists.txt @@ -226,7 +226,6 @@ SET( SRC DataVectorTypes.hh DataViewFactorInformation.cc DataViewFactorInformation.hh - DataWater.cc DataWater.hh DataWindowEquivalentLayer.cc DataWindowEquivalentLayer.hh diff --git a/src/EnergyPlus/DataWater.cc b/src/EnergyPlus/DataWater.cc deleted file mode 100644 index 11b32054cdc..00000000000 --- a/src/EnergyPlus/DataWater.cc +++ /dev/null @@ -1,79 +0,0 @@ -// EnergyPlus, Copyright (c) 1996-2020, The Board of Trustees of the University of Illinois, -// The Regents of the University of California, through Lawrence Berkeley National Laboratory -// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge -// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other -// contributors. All rights reserved. -// -// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the -// U.S. Government consequently retains certain rights. As such, the U.S. Government has been -// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, -// worldwide license in the Software to reproduce, distribute copies to the public, prepare -// derivative works, and perform publicly and display publicly, and to permit others to do so. -// -// Redistribution and use in source and binary forms, with or without modification, are permitted -// provided that the following conditions are met: -// -// (1) Redistributions of source code must retain the above copyright notice, this list of -// conditions and the following disclaimer. -// -// (2) Redistributions in binary form must reproduce the above copyright notice, this list of -// conditions and the following disclaimer in the documentation and/or other materials -// provided with the distribution. -// -// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, -// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be -// used to endorse or promote products derived from this software without specific prior -// written permission. -// -// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form -// without changes from the version obtained under this License, or (ii) Licensee makes a -// reference solely to the software portion of its product, Licensee must refer to the -// software as "EnergyPlus version X" software, where "X" is the version number Licensee -// obtained under this License and may not use a different name for the software. Except as -// specifically required in this Section (4), Licensee shall not use in a company name, a -// product name, in advertising, publicity, or other promotional activities any name, trade -// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly -// similar designation, without the U.S. Department of Energy's prior written consent. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR -// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -// EnergyPlus Headers -#include - -namespace EnergyPlus { - -namespace DataWater { - - // Module containing the routines dealing with the DataWater - - // MODULE INFORMATION: - // AUTHOR B. Griffith - // DATE WRITTEN August 2006 - // MODIFIED D. Sailor -- to add ecoroof irrigation - // RE-ENGINEERED na - - int const ScheduledTankTemp(101); // tank water temperature is user input via schedule - int const TankZoneThermalCoupled(102); // tank water temperature is modeled using simple UA - - int const RainSchedDesign(201); // mode of Rainfall determination is Scheduled Design - int const IrrSchedDesign(202); // mode of Irrigation determination is Scheduled Design (DJS -PSU) - int const IrrSmartSched(203); // mode of irrigation DJS - PSU - - int const ConstantRainLossFactor(301); - int const ScheduledRainLossFactor(302); - - int const AmbientTempSchedule(1); // ambient temperature around tank (or HPWH inlet air) is scheduled - int const AmbientTempZone(2); // tank is located in a zone or HPWH inlet air is zone air only - int const AmbientTempExterior(3); // tank is located outdoors or HPWH inlet air is outdoor air only - -} // namespace DataWater - -} // namespace EnergyPlus diff --git a/src/EnergyPlus/DataWater.hh b/src/EnergyPlus/DataWater.hh index 2db164ea297..3254af87fd4 100644 --- a/src/EnergyPlus/DataWater.hh +++ b/src/EnergyPlus/DataWater.hh @@ -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, @@ -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] @@ -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), @@ -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; @@ -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) { } @@ -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; @@ -248,7 +258,7 @@ 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) { } }; @@ -256,14 +266,14 @@ namespace DataWater { 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) { } }; diff --git a/src/EnergyPlus/EcoRoofManager.cc b/src/EnergyPlus/EcoRoofManager.cc index dcd9d09c4df..f9916af024c 100644 --- a/src/EnergyPlus/EcoRoofManager.cc +++ b/src/EnergyPlus/EcoRoofManager.cc @@ -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) @@ -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) { @@ -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; diff --git a/src/EnergyPlus/WaterManager.cc b/src/EnergyPlus/WaterManager.cc index d2b9c8ec993..66d8e60c3c6 100644 --- a/src/EnergyPlus/WaterManager.cc +++ b/src/EnergyPlus/WaterManager.cc @@ -82,12 +82,6 @@ namespace WaterManager { using namespace DataWater; - // SUBROUTINE SPECIFICATIONS FOR MODULE WaterManager: - // pointers for water storage tanks and their supply arrays - // pointers for water storage tanks and their demand arrays - - // Functions - void ManageWater(EnergyPlusData &state) { @@ -106,9 +100,9 @@ namespace WaterManager { // State variables are continually recalculated each system iteration // except when appropriate to update them. IF this module is moved up // to a different timestep (with less iteration), then numerical solution - // may need to be added. Iteration is being used to solve interdependecies + // may need to be added. Iteration is being used to solve interdependencies // of storage, supply, and demand modeling of water system. - // Most data are declared in data-only module DataWater.cc + // Most data are declared in data-only module DataWater.hh // Calling order, // storage tanks // supply @@ -150,16 +144,6 @@ namespace WaterManager { void ManageWaterInits(EnergyPlusData &state) { - - // SUBROUTINE INFORMATION: - // AUTHOR - // DATE WRITTEN - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS SUBROUTINE: - // - if (!(state.dataWaterData->AnyWaterSystemsInModel)) return; UpdateWaterManager(state); @@ -331,15 +315,15 @@ namespace WaterManager { state.dataWaterData->WaterStorage(Item).SupplyTankName = cAlphaArgs(5); // set up later if (UtilityRoutines::SameString(cAlphaArgs(6), "ScheduledTemperature")) { - state.dataWaterData->WaterStorage(Item).ThermalMode = ScheduledTankTemp; + state.dataWaterData->WaterStorage(Item).ThermalMode = DataWater::TankThermalMode::ScheduledTankTemp; } else if (UtilityRoutines::SameString(cAlphaArgs(6), "ThermalModel")) { - state.dataWaterData->WaterStorage(Item).ThermalMode = TankZoneThermalCoupled; + state.dataWaterData->WaterStorage(Item).ThermalMode = DataWater::TankThermalMode::TankZoneThermalCoupled; } else { ShowSevereError("Invalid " + cAlphaFieldNames(6) + '=' + cAlphaArgs(6)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); } - if (state.dataWaterData->WaterStorage(Item).ThermalMode == ScheduledTankTemp) { + if (state.dataWaterData->WaterStorage(Item).ThermalMode == DataWater::TankThermalMode::ScheduledTankTemp) { state.dataWaterData->WaterStorage(Item).TempSchedID = GetScheduleIndex(state, cAlphaArgs(7)); if (state.dataWaterData->WaterStorage(Item).TempSchedID == 0) { ShowSevereError("Invalid " + cAlphaFieldNames(7) + '=' + cAlphaArgs(7)); @@ -362,26 +346,26 @@ namespace WaterManager { } } - if (state.dataWaterData->WaterStorage(Item).ThermalMode == TankZoneThermalCoupled) { + if (state.dataWaterData->WaterStorage(Item).ThermalMode == DataWater::TankThermalMode::TankZoneThermalCoupled) { if (UtilityRoutines::SameString(cAlphaArgs(8), "Schedule")) { - state.dataWaterData->WaterStorage(Item).AmbientTempIndicator = AmbientTempSchedule; + state.dataWaterData->WaterStorage(Item).AmbientTempIndicator = DataWater::AmbientTempType::Schedule; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "Zone")) { - state.dataWaterData->WaterStorage(Item).AmbientTempIndicator = AmbientTempZone; + state.dataWaterData->WaterStorage(Item).AmbientTempIndicator = DataWater::AmbientTempType::Zone; } else if (UtilityRoutines::SameString(cAlphaArgs(8), "Outdoors")) { - state.dataWaterData->WaterStorage(Item).AmbientTempIndicator = AmbientTempExterior; + state.dataWaterData->WaterStorage(Item).AmbientTempIndicator = DataWater::AmbientTempType::Exterior; } else { ShowSevereError("Invalid " + cAlphaFieldNames(8) + '=' + cAlphaArgs(8)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; } state.dataWaterData->WaterStorage(Item).AmbientTempSchedule = GetScheduleIndex(state, cAlphaArgs(9)); - if ((state.dataWaterData->WaterStorage(Item).AmbientTempSchedule == 0) && (state.dataWaterData->WaterStorage(Item).AmbientTempIndicator == AmbientTempSchedule)) { + if ((state.dataWaterData->WaterStorage(Item).AmbientTempSchedule == 0) && (state.dataWaterData->WaterStorage(Item).AmbientTempIndicator == DataWater::AmbientTempType::Schedule)) { ShowSevereError("Invalid " + cAlphaFieldNames(9) + '=' + cAlphaArgs(9)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; } state.dataWaterData->WaterStorage(Item).ZoneID = UtilityRoutines::FindItemInList(cAlphaArgs(10), Zone); - if ((state.dataWaterData->WaterStorage(Item).ZoneID == 0) && (state.dataWaterData->WaterStorage(Item).AmbientTempIndicator == AmbientTempZone)) { + if ((state.dataWaterData->WaterStorage(Item).ZoneID == 0) && (state.dataWaterData->WaterStorage(Item).AmbientTempIndicator == DataWater::AmbientTempType::Zone)) { ShowSevereError("Invalid " + cAlphaFieldNames(10) + '=' + cAlphaArgs(10)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); ErrorsFound = true; @@ -427,9 +411,9 @@ namespace WaterManager { } if (UtilityRoutines::SameString(cAlphaArgs(3), "Constant")) { - state.dataWaterData->RainCollector(Item).LossFactorMode = ConstantRainLossFactor; + state.dataWaterData->RainCollector(Item).LossFactorMode = DataWater::RainLossFactor::Constant; } else if (UtilityRoutines::SameString(cAlphaArgs(3), "Scheduled")) { - state.dataWaterData->RainCollector(Item).LossFactorMode = ScheduledRainLossFactor; + state.dataWaterData->RainCollector(Item).LossFactorMode = DataWater::RainLossFactor::Scheduled; } else { ShowSevereError("Invalid " + cAlphaFieldNames(3) + '=' + cAlphaArgs(3)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); @@ -448,7 +432,7 @@ namespace WaterManager { ErrorsFound = true; } - if (state.dataWaterData->RainCollector(Item).LossFactorMode == ScheduledRainLossFactor) { + if (state.dataWaterData->RainCollector(Item).LossFactorMode == DataWater::RainLossFactor::Scheduled) { state.dataWaterData->RainCollector(Item).LossFactorSchedID = GetScheduleIndex(state, cAlphaArgs(4)); if (state.dataWaterData->RainCollector(Item).LossFactorSchedID == 0) { ShowSevereError("Invalid " + cAlphaFieldNames(4) + '=' + cAlphaArgs(4)); @@ -641,17 +625,17 @@ namespace WaterManager { inputProcessor->getObjectItem(state, cCurrentModuleObject, 1, cAlphaArgs, NumAlphas, rNumericArgs, NumNumbers, IOStatus); if (UtilityRoutines::SameString(cAlphaArgs(1), "ScheduleAndDesignLevel")) { - state.dataWaterData->RainFall.ModeID = RainSchedDesign; + state.dataWaterData->RainFall.ModeID = DataWater::RainfallMode::RainSchedDesign; } else { ShowSevereError("Precipitation Model Type of " + cCurrentModuleObject + " is incorrect."); ShowContinueError("Only available option is ScheduleAndDesignLevel."); ErrorsFound = true; } state.dataWaterData->RainFall.RainSchedID = GetScheduleIndex(state, cAlphaArgs(2)); - if ((state.dataWaterData->RainFall.RainSchedID == 0) && (state.dataWaterData->RainFall.ModeID == RainSchedDesign)) { + if ((state.dataWaterData->RainFall.RainSchedID == 0) && (state.dataWaterData->RainFall.ModeID == DataWater::RainfallMode::RainSchedDesign)) { ShowSevereError("Schedule not found for " + cCurrentModuleObject + " object"); ErrorsFound = true; - } else if ((state.dataWaterData->RainFall.RainSchedID != 0) && (state.dataWaterData->RainFall.ModeID == RainSchedDesign)) { + } else if ((state.dataWaterData->RainFall.RainSchedID != 0) && (state.dataWaterData->RainFall.ModeID == DataWater::RainfallMode::RainSchedDesign)) { if (!CheckScheduleValueMinMax(state.dataWaterData->RainFall.RainSchedID, ">=", 0.0)) { ShowSevereError("Schedule=" + cAlphaArgs(2) + " for " + cCurrentModuleObject + " object has values < 0."); ErrorsFound = true; @@ -673,18 +657,18 @@ namespace WaterManager { state.dataWaterData->AnyIrrigationInModel = true; inputProcessor->getObjectItem(state, cCurrentModuleObject, 1, cAlphaArgs, NumAlphas, rNumericArgs, NumNumbers, IOStatus); if (UtilityRoutines::SameString(cAlphaArgs(1), "Schedule")) { - state.dataWaterData->Irrigation.ModeID = IrrSchedDesign; + state.dataWaterData->Irrigation.ModeID = DataWater::RainfallMode::IrrSchedDesign; } else if (UtilityRoutines::SameString(cAlphaArgs(1), "SmartSchedule")) { - state.dataWaterData->Irrigation.ModeID = IrrSmartSched; + state.dataWaterData->Irrigation.ModeID = DataWater::RainfallMode::IrrSmartSched; } else { ShowSevereError("Type of " + cCurrentModuleObject + " is incorrect. Options are Schedule or SmartSchedule"); ErrorsFound = true; } state.dataWaterData->Irrigation.IrrSchedID = GetScheduleIndex(state, cAlphaArgs(2)); - if ((state.dataWaterData->Irrigation.IrrSchedID == 0) && ((state.dataWaterData->Irrigation.ModeID == IrrSchedDesign) || state.dataWaterData->Irrigation.ModeID == IrrSmartSched)) { + if ((state.dataWaterData->Irrigation.IrrSchedID == 0) && ((state.dataWaterData->Irrigation.ModeID == DataWater::RainfallMode::IrrSchedDesign) || state.dataWaterData->Irrigation.ModeID == DataWater::RainfallMode::IrrSmartSched)) { ShowSevereError("Schedule not found for " + cCurrentModuleObject + " object"); ErrorsFound = true; - } else if ((state.dataWaterData->Irrigation.IrrSchedID == 0) && (state.dataWaterData->Irrigation.ModeID == IrrSchedDesign)) { + } else if ((state.dataWaterData->Irrigation.IrrSchedID == 0) && (state.dataWaterData->Irrigation.ModeID == DataWater::RainfallMode::IrrSchedDesign)) { if (!CheckScheduleValueMinMax(state.dataWaterData->Irrigation.IrrSchedID, ">=", 0.0)) { ShowSevereError("Schedule=" + cAlphaArgs(2) + " for " + cCurrentModuleObject + " object has values < 0."); ErrorsFound = true; @@ -694,7 +678,7 @@ namespace WaterManager { // If we later add a designannualirrigation and a nominalannualirrigation variable (for scaling) those // would be assigned here... as with the Rainfall... state.dataWaterData->Irrigation.IrrigationThreshold = 0.4; - if (state.dataWaterData->Irrigation.ModeID == IrrSmartSched && NumNumbers > 0) { + if (state.dataWaterData->Irrigation.ModeID == DataWater::RainfallMode::IrrSmartSched && NumNumbers > 0) { if (rNumericArgs(1) > 100.0 || rNumericArgs(1) < 0.0) { ShowSevereError("Irrigation threshold for " + cCurrentModuleObject + " object has values > 100 or < 0."); ErrorsFound = true; @@ -782,10 +766,6 @@ namespace WaterManager { "System", "Sum", state.dataWaterData->WaterStorage(Item).Name); - // ResourceTypeKey='Water', & - // EndUseKey='WaterSystems', & - // EndUseSubkey=state.dataWaterData->WaterStorage(item)%QualitySubCategoryName ,& - // GroupKey='System') } else { SetupOutputVariable(state, "Water System Storage Tank Overflow Water Volume", OutputProcessor::Unit::m3, @@ -908,7 +888,7 @@ namespace WaterManager { Real64 schedRate; Real64 ScaleFactor; - if (state.dataWaterData->RainFall.ModeID == RainSchedDesign) { + if (state.dataWaterData->RainFall.ModeID == DataWater::RainfallMode::RainSchedDesign) { schedRate = GetCurrentScheduleValue(state.dataWaterData->RainFall.RainSchedID); // m/hr if (state.dataWaterData->RainFall.NomAnnualRain > 0.0){ ScaleFactor = state.dataWaterData->RainFall.DesignAnnualRain / state.dataWaterData->RainFall.NomAnnualRain; @@ -939,11 +919,11 @@ namespace WaterManager { state.dataWaterData->Irrigation.ScheduledAmount = 0.0; - if (state.dataWaterData->Irrigation.ModeID == IrrSchedDesign) { + if (state.dataWaterData->Irrigation.ModeID == DataWater::RainfallMode::IrrSchedDesign) { schedRate = GetCurrentScheduleValue(state.dataWaterData->Irrigation.IrrSchedID); // m/hr state.dataWaterData->Irrigation.ScheduledAmount = schedRate * (TimeStepSys * DataGlobalConstants::SecInHour()) / DataGlobalConstants::SecInHour(); // convert to m/timestep - } else if (state.dataWaterData->Irrigation.ModeID == IrrSmartSched) { + } else if (state.dataWaterData->Irrigation.ModeID == DataWater::RainfallMode::IrrSmartSched) { schedRate = GetCurrentScheduleValue(state.dataWaterData->Irrigation.IrrSchedID); // m/hr state.dataWaterData->Irrigation.ScheduledAmount = schedRate * (TimeStepSys * DataGlobalConstants::SecInHour()) / DataGlobalConstants::SecInHour(); // convert to m/timestep } @@ -1107,10 +1087,10 @@ namespace WaterManager { { auto const SELECT_CASE_var(state.dataWaterData->WaterStorage(TankNum).ThermalMode); - if (SELECT_CASE_var == ScheduledTankTemp) { + if (SELECT_CASE_var == DataWater::TankThermalMode::ScheduledTankTemp) { state.dataWaterData->WaterStorage(TankNum).Twater = GetCurrentScheduleValue(state.dataWaterData->WaterStorage(TankNum).TempSchedID); state.dataWaterData->WaterStorage(TankNum).TouterSkin = state.dataWaterData->WaterStorage(TankNum).Twater; - } else if (SELECT_CASE_var == TankZoneThermalCoupled) { + } else if (SELECT_CASE_var == DataWater::TankThermalMode::TankZoneThermalCoupled) { ShowFatalError("WaterUse:Storage (Water Storage Tank) zone thermal model incomplete"); } } @@ -1290,7 +1270,6 @@ namespace WaterManager { int oldNumDemand; Array1D_string oldDemandCompNames; Array1D_string oldDemandCompTypes; - // LOGICAL , SAVE :: MyOneTimeFlag = .TRUE. TankIndex = UtilityRoutines::FindItemInList(TankName, state.dataWaterData->WaterStorage); if (TankIndex == 0) { @@ -1379,9 +1358,9 @@ namespace WaterManager { { auto const SELECT_CASE_var(state.dataWaterData->RainCollector(RainColNum).LossFactorMode); - if (SELECT_CASE_var == ConstantRainLossFactor) { + if (SELECT_CASE_var == DataWater::RainLossFactor::Constant) { LossFactor = state.dataWaterData->RainCollector(RainColNum).LossFactor; - } else if (SELECT_CASE_var == ScheduledRainLossFactor) { + } else if (SELECT_CASE_var == DataWater::RainLossFactor::Scheduled) { LossFactor = GetCurrentScheduleValue(state.dataWaterData->RainCollector(RainColNum).LossFactorSchedID); } else { assert(false); From 3a9faac6358aead4ec1ecf381cb7f8f1df335b6a Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Wed, 28 Oct 2020 10:31:05 -0600 Subject: [PATCH 6/6] fix duplicated local var and enum name --- src/EnergyPlus/DataWater.hh | 5 ++--- src/EnergyPlus/WaterManager.cc | 32 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/EnergyPlus/DataWater.hh b/src/EnergyPlus/DataWater.hh index 3254af87fd4..1dfc55d3605 100644 --- a/src/EnergyPlus/DataWater.hh +++ b/src/EnergyPlus/DataWater.hh @@ -121,7 +121,7 @@ namespace DataWater { int OverflowTankSupplyARRID; Real64 ValveOnCapacity; // tank capacity at lower control range [m3] Real64 ValveOffCapacity; // tank capacity at upper control range [m3] - ControlSupplyType ControlSupplyType; // mode for tank controlled resupply + ControlSupplyType ControlSupply; // mode for tank controlled resupply int GroundWellID; // index "pointer" to well if present std::string SupplyTankName; int SupplyTankID; @@ -172,8 +172,7 @@ namespace DataWater { // Default Constructor 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), + : MaxCapacity(0.0), OverflowMode(Overflow::Unassigned), OverflowTankID(0), OverflowTankSupplyARRID(0), ValveOnCapacity(0.0), ValveOffCapacity(0.0), ControlSupply(ControlSupplyType::Unassigned), GroundWellID(0), SupplyTankID(0), SupplyTankDemandARRID(0), BackupMainsCapacity(0.0), InitialVolume(0.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), diff --git a/src/EnergyPlus/WaterManager.cc b/src/EnergyPlus/WaterManager.cc index 66d8e60c3c6..fcb0540bbaf 100644 --- a/src/EnergyPlus/WaterManager.cc +++ b/src/EnergyPlus/WaterManager.cc @@ -275,13 +275,13 @@ namespace WaterManager { state.dataWaterData->WaterStorage(Item).OverflowTankName = cAlphaArgs(3); // setup later if (UtilityRoutines::SameString(cAlphaArgs(4), "None")) { - state.dataWaterData->WaterStorage(Item).ControlSupplyType = DataWater::ControlSupplyType::NoControlLevel; + state.dataWaterData->WaterStorage(Item).ControlSupply = DataWater::ControlSupplyType::NoControlLevel; } else if (UtilityRoutines::SameString(cAlphaArgs(4), "Mains")) { - state.dataWaterData->WaterStorage(Item).ControlSupplyType = DataWater::ControlSupplyType::MainsFloatValve; + state.dataWaterData->WaterStorage(Item).ControlSupply = DataWater::ControlSupplyType::MainsFloatValve; } else if (UtilityRoutines::SameString(cAlphaArgs(4), "GroundwaterWell")) { - state.dataWaterData->WaterStorage(Item).ControlSupplyType = DataWater::ControlSupplyType::WellFloatValve; + state.dataWaterData->WaterStorage(Item).ControlSupply = DataWater::ControlSupplyType::WellFloatValve; } else if (UtilityRoutines::SameString(cAlphaArgs(4), "OtherTank")) { - state.dataWaterData->WaterStorage(Item).ControlSupplyType = DataWater::ControlSupplyType::OtherTankFloatValve; + state.dataWaterData->WaterStorage(Item).ControlSupply = DataWater::ControlSupplyType::OtherTankFloatValve; } else { ShowSevereError("Invalid " + cAlphaFieldNames(4) + '=' + cAlphaArgs(4)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); @@ -289,7 +289,7 @@ namespace WaterManager { } state.dataWaterData->WaterStorage(Item).ValveOnCapacity = rNumericArgs(5); state.dataWaterData->WaterStorage(Item).ValveOffCapacity = rNumericArgs(6); - if (state.dataWaterData->WaterStorage(Item).ControlSupplyType != DataWater::ControlSupplyType::NoControlLevel) { + if (state.dataWaterData->WaterStorage(Item).ControlSupply != DataWater::ControlSupplyType::NoControlLevel) { if (state.dataWaterData->WaterStorage(Item).ValveOffCapacity < state.dataWaterData->WaterStorage(Item).ValveOnCapacity) { ShowSevereError("Invalid " + cNumericFieldNames(5) + " and/or " + cNumericFieldNames(6)); ShowContinueError("Entered in " + cCurrentModuleObject + '=' + cAlphaArgs(1)); @@ -304,11 +304,11 @@ namespace WaterManager { state.dataWaterData->WaterStorage(Item).BackupMainsCapacity = rNumericArgs(7); if (state.dataWaterData->WaterStorage(Item).BackupMainsCapacity > 0.0) { // add backup to well and other thank supply - if (state.dataWaterData->WaterStorage(Item).ControlSupplyType == DataWater::ControlSupplyType::WellFloatValve) { - state.dataWaterData->WaterStorage(Item).ControlSupplyType = DataWater::ControlSupplyType::WellFloatMainsBackup; + if (state.dataWaterData->WaterStorage(Item).ControlSupply == DataWater::ControlSupplyType::WellFloatValve) { + state.dataWaterData->WaterStorage(Item).ControlSupply = DataWater::ControlSupplyType::WellFloatMainsBackup; } - if (state.dataWaterData->WaterStorage(Item).ControlSupplyType == DataWater::ControlSupplyType::OtherTankFloatValve) { - state.dataWaterData->WaterStorage(Item).ControlSupplyType = DataWater::ControlSupplyType::TankMainsBackup; + if (state.dataWaterData->WaterStorage(Item).ControlSupply == DataWater::ControlSupplyType::OtherTankFloatValve) { + state.dataWaterData->WaterStorage(Item).ControlSupply = DataWater::ControlSupplyType::TankMainsBackup; } } @@ -562,7 +562,7 @@ namespace WaterManager { if (state.dataWaterData->NumWaterStorageTanks > 0) { for (Item = 1; Item <= state.dataWaterData->NumWaterStorageTanks; ++Item) { // check that all storage tanks with ground well controls actually had wells pointing to them - if ((state.dataWaterData->WaterStorage(Item).ControlSupplyType == DataWater::ControlSupplyType::WellFloatValve) || (state.dataWaterData->WaterStorage(Item).ControlSupplyType == DataWater::ControlSupplyType::WellFloatMainsBackup)) { + if ((state.dataWaterData->WaterStorage(Item).ControlSupply == DataWater::ControlSupplyType::WellFloatValve) || (state.dataWaterData->WaterStorage(Item).ControlSupply == DataWater::ControlSupplyType::WellFloatMainsBackup)) { if (state.dataWaterData->WaterStorage(Item).GroundWellID == 0) { ShowSevereError(cCurrentModuleObject + "= \"" + state.dataWaterData->WaterStorage(Item).Name + "\" does not have a WaterUse:Well (groundwater well) that names it."); @@ -571,7 +571,7 @@ namespace WaterManager { } // setup tanks whose level is controlled by supply from another tank - if ((state.dataWaterData->WaterStorage(Item).ControlSupplyType == DataWater::ControlSupplyType::OtherTankFloatValve) || (state.dataWaterData->WaterStorage(Item).ControlSupplyType == DataWater::ControlSupplyType::TankMainsBackup)) { + if ((state.dataWaterData->WaterStorage(Item).ControlSupply == DataWater::ControlSupplyType::OtherTankFloatValve) || (state.dataWaterData->WaterStorage(Item).ControlSupply == DataWater::ControlSupplyType::TankMainsBackup)) { state.dataWaterData->WaterStorage(Item).SupplyTankID = UtilityRoutines::FindItemInList(state.dataWaterData->WaterStorage(Item).SupplyTankName, state.dataWaterData->WaterStorage); if (state.dataWaterData->WaterStorage(Item).SupplyTankID == 0) { ShowSevereError("Other tank called " + state.dataWaterData->WaterStorage(Item).SupplyTankName + " not found for " + cCurrentModuleObject + @@ -1050,26 +1050,26 @@ namespace WaterManager { FillVolRequest = state.dataWaterData->WaterStorage(TankNum).ValveOffCapacity - VolumePredict; // set mains draws for float on (all the way to Float off) - if (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::MainsFloatValve) { + if (state.dataWaterData->WaterStorage(TankNum).ControlSupply == DataWater::ControlSupplyType::MainsFloatValve) { state.dataWaterData->WaterStorage(TankNum).MainsDrawVdot = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); NetVolAdd = FillVolRequest; } // set demand request in supplying tank if needed - if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::OtherTankFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::TankMainsBackup)) { + if ((state.dataWaterData->WaterStorage(TankNum).ControlSupply == DataWater::ControlSupplyType::OtherTankFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupply == DataWater::ControlSupplyType::TankMainsBackup)) { state.dataWaterData->WaterStorage(state.dataWaterData->WaterStorage(TankNum).SupplyTankID).VdotRequestDemand(state.dataWaterData->WaterStorage(TankNum).SupplyTankDemandARRID) = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); } // set demand request in groundwater well if needed - if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::WellFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::WellFloatMainsBackup)) { + if ((state.dataWaterData->WaterStorage(TankNum).ControlSupply == DataWater::ControlSupplyType::WellFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupply == DataWater::ControlSupplyType::WellFloatMainsBackup)) { state.dataWaterData->GroundwaterWell(state.dataWaterData->WaterStorage(TankNum).GroundWellID).VdotRequest = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); } } // set mains flow if mains backup active if ((VolumePredict) < state.dataWaterData->WaterStorage(TankNum).BackupMainsCapacity) { // turn on supply - if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::WellFloatMainsBackup) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::TankMainsBackup)) { + if ((state.dataWaterData->WaterStorage(TankNum).ControlSupply == DataWater::ControlSupplyType::WellFloatMainsBackup) || (state.dataWaterData->WaterStorage(TankNum).ControlSupply == DataWater::ControlSupplyType::TankMainsBackup)) { FillVolRequest = state.dataWaterData->WaterStorage(TankNum).ValveOffCapacity - VolumePredict; state.dataWaterData->WaterStorage(TankNum).MainsDrawVdot = FillVolRequest / (TimeStepSys * DataGlobalConstants::SecInHour()); NetVolAdd = FillVolRequest; @@ -1520,7 +1520,7 @@ namespace WaterManager { // This was an issue because the coil supply was being stomped by this assignment to zero, so no tank action was happening state.dataWaterData->WaterStorage(TankNum).VdotAvailSupply = 0.0; } - if ((state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::WellFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupplyType == DataWater::ControlSupplyType::WellFloatMainsBackup)) { + if ((state.dataWaterData->WaterStorage(TankNum).ControlSupply == DataWater::ControlSupplyType::WellFloatValve) || (state.dataWaterData->WaterStorage(TankNum).ControlSupply == DataWater::ControlSupplyType::WellFloatMainsBackup)) { if (allocated(state.dataWaterData->GroundwaterWell)) state.dataWaterData->GroundwaterWell(state.dataWaterData->WaterStorage(TankNum).GroundWellID).VdotRequest = 0.0; } } // tank loop