-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global exterior energy #7965
Global exterior energy #7965
Changes from all commits
e5becc2
4d9e5d4
eb73e1b
4e11c58
5854492
aa8b6b1
a6a70dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,8 @@ | |
|
||
namespace EnergyPlus { | ||
|
||
struct EnergyPlusData; | ||
|
||
namespace BaseboardElectric { | ||
|
||
// Using/Aliasing | ||
|
@@ -125,13 +127,13 @@ namespace BaseboardElectric { | |
|
||
void clear_state(); | ||
|
||
void SimElectricBaseboard(EnergyPlusData &state, std::string const &EquipName, int const ActualZoneNum, int const ControlledZoneNum, Real64 &PowerMet, int &CompIndex); | ||
void SimElectricBaseboard(EnergyPlus::EnergyPlusData &state, std::string const &EquipName, int const ActualZoneNum, int const ControlledZoneNum, Real64 &PowerMet, int &CompIndex); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Accompanying that change, whenever we declare it as an argument type, it needs to be declared properly with |
||
|
||
void GetBaseboardInput(); | ||
|
||
void InitBaseboard(EnergyPlusData &state, int const BaseboardNum, int const ControlledZoneNum); | ||
void InitBaseboard(EnergyPlus::EnergyPlusData &state, int const BaseboardNum, int const ControlledZoneNum); | ||
|
||
void SizeElectricBaseboard(EnergyPlusData &state, int const BaseboardNum); | ||
void SizeElectricBaseboard(EnergyPlus::EnergyPlusData &state, int const BaseboardNum); | ||
|
||
void SimElectricConvective(int const BaseboardNum, Real64 const LoadMet); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,9 +57,7 @@ | |
|
||
namespace EnergyPlus { | ||
|
||
// Note: This file contains two modules: | ||
// Module BaseboardRadiator -- (ref: Object: ZoneHVAC:Baseboard:Convective:Water) | ||
// Module BaseboardElectric -- (ref: Object: ZoneHVAC:Baseboard:Convective:Electric) | ||
struct EnergyPlusData; | ||
|
||
namespace BaseboardRadiator { | ||
|
||
|
@@ -150,7 +148,7 @@ namespace BaseboardRadiator { | |
|
||
void clear_state(); | ||
|
||
void SimBaseboard(EnergyPlusData &state, std::string const &EquipName, | ||
void SimBaseboard(EnergyPlus::EnergyPlusData &state, std::string const &EquipName, | ||
int const ActualZoneNum, | ||
int const ControlledZoneNum, | ||
bool const FirstHVACIteration, | ||
|
@@ -159,9 +157,9 @@ namespace BaseboardRadiator { | |
|
||
void GetBaseboardInput(); | ||
|
||
void InitBaseboard(EnergyPlusData &state, int const BaseboardNum, int const ControlledZoneNumSub); | ||
void InitBaseboard(EnergyPlus::EnergyPlusData &state, int const BaseboardNum, int const ControlledZoneNumSub); | ||
|
||
void SizeBaseboard(EnergyPlusData &state, int const BaseboardNum); | ||
void SizeBaseboard(EnergyPlus::EnergyPlusData &state, int const BaseboardNum); | ||
|
||
void SimHWConvective(int &BaseboardNum, Real64 &LoadMet); | ||
|
||
|
@@ -185,12 +183,6 @@ namespace BaseboardRadiator { | |
|
||
} // namespace BaseboardRadiator | ||
|
||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
//****************************************************************************************************** | ||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
//****************************************************************************************************** | ||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feel free to clean up stuff like this as you refactor. |
||
|
||
} // namespace EnergyPlus | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,13 +50,15 @@ | |
|
||
// EnergyPlus Headers | ||
#include <EnergyPlus/EnergyPlus.hh> | ||
|
||
#include <EnergyPlus/ExteriorEnergyUse.hh> | ||
#include <unordered_map> | ||
#include <string> | ||
|
||
struct BaseGlobalStruct | ||
{ | ||
virtual void clear_state() = 0; | ||
}; | ||
namespace EnergyPlus { | ||
|
||
struct BaseGlobalStruct { | ||
virtual void clear_state() = 0; | ||
}; | ||
|
||
//struct OutputReportTabular : BaseGlobalStruct | ||
//{ | ||
|
@@ -66,119 +68,95 @@ struct BaseGlobalStruct | |
// } | ||
//}; | ||
|
||
struct DataGlobal : BaseGlobalStruct | ||
{ | ||
// Data | ||
bool AnnualSimulation = false; | ||
|
||
// MODULE VARIABLE DECLARATIONS: | ||
std::string DayOfSimChr = "0"; // Counter for days (during the simulation) (character -- for reporting) | ||
|
||
// MODULE PARAMETER DEFINITIONS | ||
static constexpr int EndZoneSizingCalc = 4; | ||
|
||
void clear_state() override { | ||
AnnualSimulation = false; | ||
DayOfSimChr = "0"; | ||
} | ||
}; | ||
|
||
struct ExteriorEnergyUseData : BaseGlobalStruct | ||
{ | ||
struct ExteriorLightUsage | ||
{ | ||
// Members | ||
std::string Name; // Descriptive name -- will show on reporting | ||
int SchedPtr; // Can be scheduled | ||
Real64 DesignLevel; // Consumption in Watts | ||
Real64 Power; // Power = DesignLevel * ScheduleValue | ||
Real64 CurrentUse; // Use for this time step | ||
int ControlMode; // Control mode Schedule Only or Astronomical Clock plus schedule | ||
bool ManageDemand; // Flag to indicate whether to use demand limiting | ||
Real64 DemandLimit; // Demand limit set by demand manager [W] | ||
bool PowerActuatorOn; // EMS flag | ||
Real64 PowerActuatorValue; // EMS value | ||
Real64 SumConsumption; // sum of electric consumption [J] for reporting | ||
Real64 SumTimeNotZeroCons; // sum of time of positive electric consumption [hr] | ||
|
||
// Default Constructor | ||
ExteriorLightUsage() | ||
: SchedPtr(0), DesignLevel(0.0), Power(0.0), CurrentUse(0.0), ControlMode(1), ManageDemand(false), DemandLimit(0.0), | ||
PowerActuatorOn(false), SumConsumption(0.0), SumTimeNotZeroCons(0.0) | ||
{ | ||
struct DataGlobal : BaseGlobalStruct { | ||
// Data | ||
bool AnnualSimulation = false; | ||
|
||
// MODULE VARIABLE DECLARATIONS: | ||
std::string DayOfSimChr = "0"; // Counter for days (during the simulation) (character -- for reporting) | ||
|
||
// MODULE PARAMETER DEFINITIONS | ||
static constexpr int EndZoneSizingCalc = 4; | ||
|
||
void clear_state() override { | ||
AnnualSimulation = false; | ||
DayOfSimChr = "0"; | ||
} | ||
}; | ||
|
||
struct ExteriorEnergyUseData : BaseGlobalStruct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These structs should remain very lean, only variables. No nested structures, no int const values, just the actual variables storing data. |
||
|
||
int NumExteriorLights = 0; // Number of Exterior Light Inputs | ||
int NumExteriorEqs = 0; // Number of Exterior Equipment Inputs | ||
Array1D<ExteriorEnergyUse::ExteriorLightUsage> ExteriorLights; // Structure for Exterior Light reporting | ||
Array1D<ExteriorEnergyUse::ExteriorEquipmentUsage> ExteriorEquipment; // Structure for Exterior Equipment Reporting | ||
std::unordered_map<std::string, std::string> UniqueExteriorEquipNames; | ||
bool GetExteriorEnergyInputFlag = true; // First time, input is "gotten" | ||
ExteriorEnergyUseData() : NumExteriorLights(0), NumExteriorEqs(0), GetExteriorEnergyInputFlag(true) {} | ||
|
||
void clear_state() { | ||
NumExteriorLights = 0; | ||
NumExteriorEqs = 0; | ||
ExteriorLights.deallocate(); | ||
ExteriorEquipment.deallocate(); | ||
UniqueExteriorEquipNames.clear(); | ||
GetExteriorEnergyInputFlag = true; | ||
} | ||
}; | ||
|
||
struct FansData : BaseGlobalStruct { | ||
// constants | ||
static constexpr int ExhaustFanCoupledToAvailManagers = 150; | ||
static constexpr int ExhaustFanDecoupledFromAvailManagers = 151; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't remove these, but I would suggest you doing it. I made an enum class from the constant integers in the exterior energy use namespace. The enum class should live back in the original header file. You'll need to go in and clean up the usage of those variables but it is generally easy. If you don't feel like tackling that during any of these refactors, it is OK, but don't bring them into this namespace. They are really just constants, not variables. |
||
|
||
// members | ||
int NumFans; | ||
int NumNightVentPerf; // number of FAN:NIGHT VENT PERFORMANCE objects found in the input | ||
bool GetFanInputFlag; // Flag set to make sure you get input once | ||
bool LocalTurnFansOn; // If True, overrides fan schedule and cycles ZoneHVAC component fans on | ||
bool LocalTurnFansOff; // If True, overrides fan schedule and LocalTurnFansOn and cycles ZoneHVAC component fans off | ||
|
||
FansData() : NumFans(0), NumNightVentPerf(0), GetFanInputFlag(true), LocalTurnFansOn(false), | ||
LocalTurnFansOff(false) {} | ||
|
||
void clear_state() override { | ||
NumFans = 0; | ||
NumNightVentPerf = 0; | ||
GetFanInputFlag = true; | ||
LocalTurnFansOn = false; | ||
LocalTurnFansOff = false; | ||
} | ||
}; | ||
|
||
struct PipesData : BaseGlobalStruct { | ||
int NumLocalPipes; | ||
bool GetPipeInputFlag; | ||
|
||
PipesData() : NumLocalPipes(0), GetPipeInputFlag(true) {} | ||
|
||
void clear_state() override { | ||
NumLocalPipes = 0; | ||
GetPipeInputFlag = true; | ||
} | ||
}; | ||
|
||
int NumExteriorLights = 0; // Number of Exterior Light Inputs | ||
int NumExteriorEqs = 0; // Number of Exterior Equipment Inputs | ||
|
||
// Object Data | ||
Array1D<ExteriorLightUsage> ExteriorLights; // Structure for Exterior Light reporting | ||
|
||
void clear_state() override { | ||
NumExteriorLights = 0; | ||
NumExteriorEqs = 0; | ||
ExteriorLights.deallocate(); | ||
} | ||
}; | ||
|
||
struct FansData : BaseGlobalStruct | ||
{ | ||
// constants | ||
static constexpr int ExhaustFanCoupledToAvailManagers = 150; | ||
static constexpr int ExhaustFanDecoupledFromAvailManagers = 151; | ||
|
||
// members | ||
int NumFans; | ||
int NumNightVentPerf; // number of FAN:NIGHT VENT PERFORMANCE objects found in the input | ||
bool GetFanInputFlag; // Flag set to make sure you get input once | ||
bool LocalTurnFansOn; // If True, overrides fan schedule and cycles ZoneHVAC component fans on | ||
bool LocalTurnFansOff; // If True, overrides fan schedule and LocalTurnFansOn and cycles ZoneHVAC component fans off | ||
|
||
FansData() : NumFans(0), NumNightVentPerf(0), GetFanInputFlag(true), LocalTurnFansOn(false), LocalTurnFansOff(false) | ||
{ | ||
} | ||
|
||
void clear_state() override | ||
{ | ||
NumFans = 0; | ||
NumNightVentPerf = 0; | ||
GetFanInputFlag = true; | ||
LocalTurnFansOn = false; | ||
LocalTurnFansOff = false; | ||
} | ||
}; | ||
|
||
struct PipesData : BaseGlobalStruct | ||
{ | ||
// MODULE VARIABLE DECLARATIONS | ||
int NumLocalPipes = 0; | ||
bool GetPipeInputFlag = true; | ||
|
||
void clear_state() override { | ||
NumLocalPipes = 0; | ||
GetPipeInputFlag = true; | ||
} | ||
}; | ||
|
||
struct EnergyPlusData : BaseGlobalStruct | ||
{ | ||
// module globals | ||
DataGlobal dataGlobals; | ||
ExteriorEnergyUseData exteriorEnergyUse; | ||
FansData fans; | ||
PipesData pipes; | ||
//OutputReportTabular outputReportTabular; | ||
|
||
// all clear states | ||
void clear_state() override | ||
{ | ||
dataGlobals.clear_state(); | ||
exteriorEnergyUse.clear_state(); | ||
fans.clear_state(); | ||
//outputReportTabular.clear_state(); | ||
pipes.clear_state(); | ||
struct EnergyPlusData : BaseGlobalStruct { | ||
// module globals | ||
DataGlobal dataGlobals; | ||
ExteriorEnergyUseData exteriorEnergyUse; | ||
FansData fans; | ||
PipesData pipes; | ||
//OutputReportTabular outputReportTabular; | ||
|
||
// all clear states | ||
void clear_state() override { | ||
dataGlobals.clear_state(); | ||
exteriorEnergyUse.clear_state(); | ||
fans.clear_state(); | ||
//outputReportTabular.clear_state(); | ||
pipes.clear_state(); | ||
}; | ||
}; | ||
}; | ||
|
||
} | ||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,6 @@ | |
|
||
// EnergyPlus Headers | ||
#include <EnergyPlus/EnergyPlus.hh> | ||
#include <EnergyPlus/Data/EnergyPlusData.hh> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was causing a circular inclusion. And it's not needed. If, for some reason, DataGlobals needs something from the Data.hh file, it can forward declare it. |
||
|
||
namespace EnergyPlus { | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the main struct will live inside the EnergyPlus namespace. Anywhere that we are using a forward declaration of this struct we need to put it inside the EnergyPlus namespace, not before it, and not inside another nested namespace. This goes with any other lower level structs you may use as well.