Skip to content

Commit

Permalink
Merge pull request #8166 from NREL/global_water_use
Browse files Browse the repository at this point in the history
Global water use
  • Loading branch information
Myoldmopar authored Jul 20, 2020
2 parents 52c0be4 + dd781e3 commit 490d6ec
Show file tree
Hide file tree
Showing 15 changed files with 211 additions and 205 deletions.
3 changes: 3 additions & 0 deletions src/EnergyPlus/Data/EnergyPlusData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
#include <EnergyPlus/OutputFiles.hh>
#include <EnergyPlus/Pipes.hh>
#include <EnergyPlus/PlantChillers.hh>
#include <EnergyPlus/WaterUse.hh>
#include <EnergyPlus/WindowAC.hh>
#include <EnergyPlus/WindowComplexManager.hh>
#include <EnergyPlus/WindowEquivalentLayer.hh>
Expand Down Expand Up @@ -132,6 +133,7 @@ namespace EnergyPlus {
// after we've plumbed enough of the functions to allow
OutputFiles outputFiles;

WaterUseData dataWaterUse;
WindowACData dataWindowAC;
WindowComplexManagerData dataWindowComplexManager;
WindowEquivalentLayerData dataWindowEquivalentLayer;
Expand Down Expand Up @@ -180,6 +182,7 @@ namespace EnergyPlus {
//outputReportTabular.clear_state();
pipes.clear_state();
dataPlantChillers.clear_state();
dataWaterUse.clear_state();
dataWindowAC.clear_state();
dataWindowComplexManager.clear_state();
dataWindowEquivalentLayer.clear_state();
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/InternalHeatGains.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5524,7 +5524,7 @@ namespace InternalHeatGains {

CalcWaterThermalTankZoneGains(state);
PipeHeatTransfer::PipeHTData::CalcZonePipesHeatGain();
CalcWaterUseZoneGains();
CalcWaterUseZoneGains(state.dataWaterUse);
FigureFuelCellZoneGains();
FigureMicroCHPZoneGains();
initializeElectricPowerServiceZoneGains();
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/NonZoneEquipmentManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ namespace NonZoneEquipmentManager {
CountNonZoneEquip = false;
}

SimulateWaterUse(state.dataBranchInputManager, FirstHVACIteration); // simulate non-plant loop water use.
SimulateWaterUse(state.dataBranchInputManager, state.dataWaterUse, FirstHVACIteration); // simulate non-plant loop water use.

if (!ZoneSizingCalc) {
for (WaterHeaterNum = 1; WaterHeaterNum <= NumOfWaterHeater; ++WaterHeaterNum) {
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/Plant/PlantManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ namespace EnergyPlus {
} else if (UtilityRoutines::SameString(this_comp_type, "WaterUse:Connections")) {
this_comp.TypeOf_Num = TypeOf_WaterUseConnection;
this_comp.CurOpSchemeType = DemandOpSchemeType;
this_comp.compPtr = WaterUse::WaterConnectionsType::factory(CompNames(CompNum));
this_comp.compPtr = WaterUse::WaterConnectionsType::factory(state.dataWaterUse, CompNames(CompNum));
} else if (UtilityRoutines::SameString(this_comp_type, "Coil:Cooling:Water")) {
this_comp.TypeOf_Num = TypeOf_CoilWaterCooling;
this_comp.CurOpSchemeType = DemandOpSchemeType;
Expand Down
2 changes: 0 additions & 2 deletions src/EnergyPlus/StateManagement.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@
#include <EnergyPlus/WaterManager.hh>
#include <EnergyPlus/WaterThermalTanks.hh>
#include <EnergyPlus/WaterToAirHeatPumpSimple.hh>
#include <EnergyPlus/WaterUse.hh>
#include <EnergyPlus/WeatherManager.hh>

void EnergyPlus::clearThisState(EnergyPlusData &state)
Expand Down Expand Up @@ -388,7 +387,6 @@ void EnergyPlus::clearAllStates(OutputFiles &outputFiles)
WaterThermalTanks::clear_state();
WaterToAirHeatPumpSimple::clear_state();
EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::clear_state();
WaterUse::clear_state();
WeatherManager::clear_state();
ResultsFramework::clear_state();
}
339 changes: 160 additions & 179 deletions src/EnergyPlus/WaterUse.cc

Large diffs are not rendered by default.

57 changes: 37 additions & 20 deletions src/EnergyPlus/WaterUse.hh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <ObjexxFCL/Array1D.hh>

// EnergyPlus Headers
#include <EnergyPlus/Data/BaseData.hh>
#include <EnergyPlus/DataGlobals.hh>
#include <EnergyPlus/EnergyPlus.hh>
#include <EnergyPlus/PlantComponent.hh>
Expand All @@ -61,6 +62,7 @@ namespace EnergyPlus {
// Forward declarations
struct EnergyPlusData;
struct BranchInputManagerData;
struct WaterUseData;

namespace WaterUse {

Expand All @@ -78,10 +80,6 @@ namespace WaterUse {
PlantAndEquip
};

extern bool getWaterUseInputFlag;

extern Array1D_bool CheckEquipName;

struct WaterEquipmentType
{
std::string Name; // Name of DHW
Expand Down Expand Up @@ -144,11 +142,11 @@ namespace WaterUse {
DrainTemp = 0.0;
}

void CalcEquipmentFlowRates();
void CalcEquipmentFlowRates(WaterUseData &dataWaterUse);

void CalcEquipmentDrainTemp();

void setupOutputVars();
void setupOutputVars(WaterUseData &dataWaterUse);
};

struct WaterConnectionsType : PlantComponent
Expand Down Expand Up @@ -229,40 +227,59 @@ namespace WaterUse {
{
}

static PlantComponent *factory(std::string const &objectName);
static PlantComponent *factory(WaterUseData &dataWaterUse, std::string const &objectName);

void simulate(EnergyPlusData &EP_UNUSED(state), const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag) override;

void InitConnections(BranchInputManagerData &state);
void InitConnections(BranchInputManagerData &dataBranchInputManager, WaterUseData &dataWaterUse);

void CalcConnectionsFlowRates(bool FirstHVACIteration);
void CalcConnectionsFlowRates(WaterUseData &dataWaterUse, bool FirstHVACIteration);

void CalcConnectionsDrainTemp();
void CalcConnectionsDrainTemp(WaterUseData &dataWaterUse);

void CalcConnectionsHeatRecovery();

void UpdateWaterConnections();

void ReportWaterUse();
void ReportWaterUse(WaterUseData &dataWaterUse);

void setupOutputVars();
void setupOutputVars(WaterUseData &EP_UNUSED(dataWaterUse));
};

void clear_state();
void SimulateWaterUse(BranchInputManagerData &dataBranchInputManager, WaterUseData &dataWaterUse, bool FirstHVACIteration);

void SimulateWaterUse(BranchInputManagerData &dataBranchInputManager, bool FirstHVACIteration);
void GetWaterUseInput(WaterUseData &dataWaterUse);

void GetWaterUseInput();
void ReportStandAloneWaterUse(WaterUseData &dataWaterUse);

void ReportStandAloneWaterUse();
void CalcWaterUseZoneGains(WaterUseData &dataWaterUse);

void CalcWaterUseZoneGains();
} // namespace WaterUse

extern Array1D<WaterEquipmentType> WaterEquipment;
struct WaterUseData : BaseGlobalStruct {

extern Array1D<WaterConnectionsType> WaterConnections;
int numWaterEquipment;
int numWaterConnections;
bool getWaterUseInputFlag;
Array1D_bool CheckEquipName;
Array1D<WaterUse::WaterEquipmentType> WaterEquipment;
Array1D<WaterUse::WaterConnectionsType> WaterConnections;

} // namespace WaterUse
void clear_state() override
{
numWaterEquipment = 0;
numWaterConnections = 0;
getWaterUseInputFlag = true;
CheckEquipName.deallocate();
WaterEquipment.deallocate();
WaterConnections.deallocate();
}

// Default Constructor
WaterUseData() : numWaterEquipment(0), numWaterConnections(0), getWaterUseInputFlag(true)
{
}
};

} // namespace EnergyPlus

Expand Down
1 change: 1 addition & 0 deletions src/EnergyPlus/WindTurbine.hh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <ObjexxFCL/Array1D.hh>

// EnergyPlus Headers
#include <EnergyPlus/Data/BaseData.hh>
#include <EnergyPlus/DataGlobals.hh>
#include <EnergyPlus/EnergyPlus.hh>

Expand Down
1 change: 1 addition & 0 deletions src/EnergyPlus/WindowAC.hh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <ObjexxFCL/Array1D.hh>

// EnergyPlus Headers
#include <EnergyPlus/Data/BaseData.hh>
#include <EnergyPlus/DataGlobals.hh>
#include <EnergyPlus/EnergyPlus.hh>

Expand Down
1 change: 1 addition & 0 deletions src/EnergyPlus/WindowComplexManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include <ObjexxFCL/Array2D.hh>

// EnergyPlus Headers
#include <EnergyPlus/Data/BaseData.hh>
#include <EnergyPlus/DataBSDFWindow.hh>
#include <EnergyPlus/DataVectorTypes.hh>
#include <EnergyPlus/EnergyPlus.hh>
Expand Down
1 change: 1 addition & 0 deletions src/EnergyPlus/WindowEquivalentLayer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include <ObjexxFCL/Optional.hh>

// EnergyPlus Headers
#include <EnergyPlus/Data/BaseData.hh>
#include <EnergyPlus/DataWindowEquivalentLayer.hh>
#include <EnergyPlus/EnergyPlus.hh>

Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/WindowManagerExteriorData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
#include <vector>

// EnergyPlus Headers
#include <EnergyPlus/EnergyPlus.hh>
#include <EnergyPlus/Data/BaseData.hh>
#include <EnergyPlus/Material.hh>
#include <EnergyPlus/Vectors.hh>

Expand Down
1 change: 1 addition & 0 deletions src/EnergyPlus/ZoneAirLoopEquipmentManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <string>

// EnergyPlus Headers
#include <EnergyPlus/Data/BaseData.hh>
#include <EnergyPlus/EnergyPlus.hh>

namespace EnergyPlus {
Expand Down
1 change: 1 addition & 0 deletions src/EnergyPlus/ZoneContaminantPredictorCorrector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#define ZoneContaminantPredictorCorrector_hh_INCLUDED

// EnergyPlus Headers
#include <EnergyPlus/Data/BaseData.hh>
#include <EnergyPlus/DataContaminantBalance.hh>
#include <EnergyPlus/EnergyPlus.hh>

Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/ZoneTempPredictorCorrector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@

namespace EnergyPlus {
// Forward declarations
struct EnergyPlusData;
class OutputFiles;

// Forward declarations
Expand Down

8 comments on commit 490d6ec

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-MacOS-10.13-clang: OK (2179 of 2179 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-cppcheck: OK (0 of 0 tests passed, 0 test warnings)

Build Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (2199 of 2199 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-custom_check: OK (13 of 13 tests passed, 0 test warnings)

Build Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1468 of 1468 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (714 of 714 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2155 of 2155 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

develop (Myoldmopar) - x86_64-MacOS-10.15-clang-11.0.0: OK (2179 of 2179 tests passed, 0 test warnings)

Build Badge Test Badge

Please # to comment.