Skip to content

Commit

Permalink
Fixup exterior energy use, inclusions, forward declares, and make som…
Browse files Browse the repository at this point in the history
…e int const into enums
  • Loading branch information
Myoldmopar committed May 5, 2020
1 parent 4e11c58 commit 5854492
Show file tree
Hide file tree
Showing 16 changed files with 207 additions and 263 deletions.
4 changes: 3 additions & 1 deletion src/EnergyPlus/BaseboardElectric.hh
Expand Up @@ -57,6 +57,8 @@

namespace EnergyPlus {

struct EnergyPlusData;

namespace BaseboardElectric {

// Using/Aliasing
Expand Down Expand Up @@ -125,7 +127,7 @@ 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);

void GetBaseboardInput();

Expand Down
10 changes: 1 addition & 9 deletions src/EnergyPlus/BaseboardRadiator.hh
Expand Up @@ -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 {

Expand Down Expand Up @@ -185,12 +183,6 @@ namespace BaseboardRadiator {

} // namespace BaseboardRadiator

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//******************************************************************************************************
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//******************************************************************************************************
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

} // namespace EnergyPlus

#endif
232 changes: 91 additions & 141 deletions src/EnergyPlus/Data/EnergyPlusData.hh
Expand Up @@ -54,10 +54,11 @@
#include <unordered_map>
#include <string>

struct BaseGlobalStruct
{
virtual void clear_state() = 0;
};
namespace EnergyPlus {

struct BaseGlobalStruct {
virtual void clear_state() = 0;
};

//struct OutputReportTabular : BaseGlobalStruct
//{
Expand All @@ -67,146 +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
{
// MODULE PARAMETER DEFINITIONS:
int const ElecUse = 1; // Electricity
int const GasUse = 2; // Gas (Natural)
int const WaterUse = 3; // Water
int const CoalUse = 4; // Coal
int const FuelOil1Use = 5; // FuelOil#1
int const FuelOil2Use = 6; // FuelOil#2
int const PropaneUse = 7; // Propane
int const GasolineUse = 8; // Gasoline
int const DieselUse = 9; // Diesel
int const SteamUse = 10; // Steam
int const DistrictCoolUse = 11; // Purchased Cooling
int const DistrictHeatUse = 12; // Purchased Heating
int const OtherFuel1Use = 13; // OtherFuel1
int const OtherFuel2Use = 14; // OtherFuel2

int const ScheduleOnly = 1; // exterior lights only on schedule
int const AstroClockOverride = 2; // exterior lights controlled to turn off during day.

std::unordered_map<std::string, std::string> UniqueExteriorEquipNames;

bool GetExteriorEnergyInputFlag = true; // First time, input is "gotten"

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 {

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;

// 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
Array1D<ExteriorEquipmentUsage> ExteriorEquipment; // Structure for Exterior Equipment Reporting

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;

// 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
1 change: 0 additions & 1 deletion src/EnergyPlus/DataGlobals.hh
Expand Up @@ -54,7 +54,6 @@

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

namespace EnergyPlus {

Expand Down
5 changes: 3 additions & 2 deletions src/EnergyPlus/DataHeatBalance.hh
Expand Up @@ -64,6 +64,7 @@
#include <EnergyPlus/DataVectorTypes.hh>
#include <EnergyPlus/DataWindowEquivalentLayer.hh>
#include <EnergyPlus/EnergyPlus.hh>
#include <EnergyPlus/ExteriorEnergyUse.hh>
#include <EnergyPlus/PhaseChangeModeling/HysteresisModel.hh>

namespace EnergyPlus {
Expand Down Expand Up @@ -1470,15 +1471,15 @@ namespace DataHeatBalance {
Real64 LostEnergy; // Lost energy (converted to work) [J]
Real64 TotGainEnergy; // Total heat gain [J]
std::string EndUseSubcategory; // user defined name for the end use category
int OtherEquipFuelType; // Fuel Type Number of the Other Equipment (defined in ExteriorEnergyUse.cc)
ExteriorEnergyUse::ExteriorFuelUsage OtherEquipFuelType; // Fuel Type Number of the Other Equipment (defined in ExteriorEnergyUse.cc)

// Default Constructor
ZoneEquipData()
: ZonePtr(0), SchedPtr(0), DesignLevel(0.0), EMSZoneEquipOverrideOn(false), EMSEquipPower(0.0), FractionLatent(0.0), FractionRadiant(0.0),
FractionLost(0.0), FractionConvected(0.0), CO2DesignRate(0.0), CO2RateFactor(0.0), NomMinDesignLevel(0.0), NomMaxDesignLevel(0.0),
ManageDemand(false), DemandLimit(0.0), Power(0.0), RadGainRate(0.0), ConGainRate(0.0), LatGainRate(0.0), LostRate(0.0),
TotGainRate(0.0), CO2GainRate(0.0), Consumption(0.0), RadGainEnergy(0.0), ConGainEnergy(0.0), LatGainEnergy(0.0), LostEnergy(0.0),
TotGainEnergy(0.0), EndUseSubcategory(""), OtherEquipFuelType(0)
TotGainEnergy(0.0), EndUseSubcategory(""), OtherEquipFuelType(ExteriorEnergyUse::ExteriorFuelUsage::Unknown)
{
}
};
Expand Down

7 comments on commit 5854492

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

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

Build 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.

global_exteriorEnergy (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.

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

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

global_exteriorEnergy (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1388 of 1388 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.

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

Failures:\n

integration Test Summary

  • Passed: 698
  • Timeout: 1

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.

global_exteriorEnergy (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2753 of 2754 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 929
  • Failed: 1

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

global_exteriorEnergy (Myoldmopar) - x86_64-MacOS-10.13-clang: Tests Failed (0 of 0 tests passed, 0 test warnings)

Build Badge Test Badge

Please sign in to comment.