Skip to content

Commit

Permalink
resolve conflicts from #10131
Browse files Browse the repository at this point in the history
  • Loading branch information
dareumnam committed Sep 18, 2023
1 parent 82a878f commit b4a8cfd
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
30 changes: 19 additions & 11 deletions src/EnergyPlus/DataGlobalConstants.hh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ namespace Constant {
DistrictHeatingWater,
DistrictHeatingSteam,
Water,
None, // used for OtherEquipment object
EnergyTransfer,
ElectricityProduced,
ElectricityPurchased,
Expand Down Expand Up @@ -146,6 +147,7 @@ namespace Constant {
DistrictHeatingWater,
DistrictHeatingSteam,
Water,
None, // used for OtherEquipment object
Num
};

Expand Down Expand Up @@ -184,6 +186,7 @@ namespace Constant {
eFuel::DistrictHeatingWater,
eFuel::DistrictHeatingSteam,
eFuel::Water,
eFuel::None,
eFuel::Invalid,
eFuel::Invalid,
eFuel::Invalid,
Expand Down Expand Up @@ -231,17 +234,18 @@ namespace Constant {
eResource::DistrictCooling,
eResource::DistrictHeatingWater,
eResource::DistrictHeatingSteam,
eResource::Water};
eResource::Water,
eResource::None};

constexpr std::array<ePollutant, static_cast<int>(eResource::Num)> eResource2ePollutant = {
ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid,
ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid,
ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid,
ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid,
ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid,
ePollutant::Invalid, ePollutant::Invalid, ePollutant::SO2, ePollutant::NOx, ePollutant::N2O, ePollutant::PM,
ePollutant::PM2_5, ePollutant::PM10, ePollutant::CO, ePollutant::CO2, ePollutant::CH4, ePollutant::NH3,
ePollutant::NMVOC, ePollutant::Hg, ePollutant::Pb, ePollutant::NuclearHigh, ePollutant::NuclearLow};
ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid,
ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid,
ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid,
ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid,
ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid,
ePollutant::Invalid, ePollutant::Invalid, ePollutant::Invalid, ePollutant::SO2, ePollutant::NOx, ePollutant::N2O,
ePollutant::PM, ePollutant::PM2_5, ePollutant::PM10, ePollutant::CO, ePollutant::CO2, ePollutant::CH4,
ePollutant::NH3, ePollutant::NMVOC, ePollutant::Hg, ePollutant::Pb, ePollutant::NuclearHigh, ePollutant::NuclearLow};

constexpr std::array<eResource, static_cast<int>(ePollutant::Num)> ePollutant2eResource = {eResource::SO2,
eResource::NOx,
Expand Down Expand Up @@ -273,6 +277,7 @@ namespace Constant {
"DISTRICTHEATINGWATER",
"DISTRICTHEATINGSTEAM",
"WATER",
"NONE",
"ENERGYTRANSFER",
"ELECTRICITYPRODUCED",
"ELECTRICITYPURCHASED",
Expand Down Expand Up @@ -321,6 +326,7 @@ namespace Constant {
"DistrictHeatingWater",
"DistrictHeatingSteam",
"Water",
"None",
"EnergyTransfer",
"ElectricityProduced",
"ElectricityPurchased",
Expand Down Expand Up @@ -369,7 +375,8 @@ namespace Constant {
eResourceNamesUC[static_cast<int>(eFuel2eResource[static_cast<int>(eFuel::DistrictCooling)])],
eResourceNamesUC[static_cast<int>(eFuel2eResource[static_cast<int>(eFuel::DistrictHeatingWater)])],
eResourceNamesUC[static_cast<int>(eFuel2eResource[static_cast<int>(eFuel::DistrictHeatingSteam)])],
eResourceNamesUC[static_cast<int>(eFuel2eResource[static_cast<int>(eFuel::Water)])]};
eResourceNamesUC[static_cast<int>(eFuel2eResource[static_cast<int>(eFuel::Water)])],
eResourceNamesUC[static_cast<int>(eFuel2eResource[static_cast<int>(eFuel::None)])]};

static constexpr std::array<std::string_view, static_cast<int>(eFuel::Num)> eFuelNames = {
eResourceNames[static_cast<int>(eFuel2eResource[static_cast<int>(eFuel::Electricity)])],
Expand All @@ -385,7 +392,8 @@ namespace Constant {
eResourceNames[static_cast<int>(eFuel2eResource[static_cast<int>(eFuel::DistrictCooling)])],
eResourceNames[static_cast<int>(eFuel2eResource[static_cast<int>(eFuel::DistrictHeatingWater)])],
eResourceNames[static_cast<int>(eFuel2eResource[static_cast<int>(eFuel::DistrictHeatingSteam)])],
eResourceNames[static_cast<int>(eFuel2eResource[static_cast<int>(eFuel::Water)])]};
eResourceNames[static_cast<int>(eFuel2eResource[static_cast<int>(eFuel::Water)])],
eResourceNames[static_cast<int>(eFuel2eResource[static_cast<int>(eFuel::None)])]};

static constexpr std::array<std::string_view, static_cast<int>(ePollutant::Num)> ePollutantNamesUC = {
eResourceNamesUC[static_cast<int>(ePollutant2eResource[static_cast<int>(ePollutant::SO2)])],
Expand Down
1 change: 0 additions & 1 deletion src/EnergyPlus/DataHeatBalance.hh
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,6 @@ namespace DataHeatBalance {
std::string EndUseSubcategory; // user defined name for the end use category
std::string otherEquipFuelTypeString; // Fuel Type string for Other Equipment
Constant::eFuel OtherEquipFuelType = Constant::eFuel::Invalid; // Fuel Type Number of the Other Equipment
bool OtherEquipFuelTypeNone = false; // Flag for Fuel Type = "None"
};

struct ExtVentedCavityStruct
Expand Down
13 changes: 6 additions & 7 deletions src/EnergyPlus/InternalHeatGains.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2662,8 +2662,7 @@ namespace InternalHeatGains {

std::string FuelTypeString("");
if (IHGAlphas(2) == "NONE") {
thisZoneOthEq.OtherEquipFuelType = Constant::eFuel::Invalid;
thisZoneOthEq.OtherEquipFuelTypeNone = true;
thisZoneOthEq.OtherEquipFuelType = Constant::eFuel::None;
FuelTypeString = IHGAlphas(2);
} else {
thisZoneOthEq.OtherEquipFuelType = static_cast<Constant::eFuel>(getEnumValue(Constant::eFuelNamesUC, IHGAlphas(2)));
Expand All @@ -2681,7 +2680,7 @@ namespace InternalHeatGains {
ErrorsFound = true;
}
thisZoneOthEq.otherEquipFuelTypeString = FuelTypeString; // Save for output variable setup later
// Build list of fuel types used in each zone and space (excluding None and Water)
// Build list of fuel types used in each zone and space (excluding Water)
bool found = false;
for (Constant::eFuel fuelType : state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums) {
if (thisZoneOthEq.OtherEquipFuelType == fuelType) {
Expand Down Expand Up @@ -2821,7 +2820,7 @@ namespace InternalHeatGains {

// Throw an error if the design level is negative and we have a fuel type
if (thisZoneOthEq.DesignLevel < 0.0 && thisZoneOthEq.OtherEquipFuelType != Constant::eFuel::Invalid &&
!(thisZoneOthEq.OtherEquipFuelTypeNone)) {
thisZoneOthEq.OtherEquipFuelType != Constant::eFuel::None) {
ShowSevereError(state,
format("{}{}=\"{}\", {} is not allowed to be negative",
RoutineName,
Expand Down Expand Up @@ -6133,7 +6132,7 @@ namespace InternalHeatGains {
addZoneOutputs(state.dataHeatBal->ZoneOtherEq(othEqNum).ZonePtr) = true;
addSpaceOutputs(state.dataHeatBal->ZoneOtherEq(othEqNum).spaceIndex) = true;
if (state.dataHeatBal->ZoneOtherEq(othEqNum).OtherEquipFuelType != Constant::eFuel::Invalid &&
!(state.dataHeatBal->ZoneOtherEq(othEqNum).OtherEquipFuelTypeNone)) {
state.dataHeatBal->ZoneOtherEq(othEqNum).OtherEquipFuelType != Constant::eFuel::None) {
std::string fuelTypeString = state.dataHeatBal->ZoneOtherEq(othEqNum).otherEquipFuelTypeString;
SetupOutputVariable(state,
"Other Equipment " + fuelTypeString + " Rate",
Expand Down Expand Up @@ -6239,7 +6238,7 @@ namespace InternalHeatGains {
if (addZoneOutputs(zoneNum)) {
for (size_t i = 0; i < state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums.size(); ++i) {
Constant::eFuel fuelType = state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNums[i];
if (fuelType == Constant::eFuel::Invalid) continue;
if (fuelType == Constant::eFuel::Invalid || fuelType == Constant::eFuel::None) continue;

SetupOutputVariable(state,
"Zone Other Equipment " + state.dataHeatBal->Zone(zoneNum).otherEquipFuelTypeNames[i] + " Rate",
Expand Down Expand Up @@ -6337,7 +6336,7 @@ namespace InternalHeatGains {
if (addSpaceOutputs(spaceNum)) {
for (size_t i = 0; i < state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNums.size(); ++i) {
Constant::eFuel fuelType = state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNums[i];
if (fuelType == Constant::eFuel::Invalid) continue;
if (fuelType == Constant::eFuel::Invalid || fuelType == Constant::eFuel::None) continue;

SetupOutputVariable(state,
"Space Other Equipment " + state.dataHeatBal->space(spaceNum).otherEquipFuelTypeNames[i] + " Rate",
Expand Down
2 changes: 1 addition & 1 deletion tst/EnergyPlus/unit/InternalHeatGains.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_OtherEquipment_CheckFuelType)
for (unsigned long i = 1; i <= state->dataHeatBal->ZoneOtherEq.size(); ++i) {
const DataHeatBalance::ZoneEquipData &equip = state->dataHeatBal->ZoneOtherEq(i);
if (equip.Name == "OTHEREQ1") {
ASSERT_TRUE(compare_enums(equip.OtherEquipFuelType, Constant::eFuel::Invalid));
ASSERT_TRUE(compare_enums(equip.OtherEquipFuelType, Constant::eFuel::None));
} else if (equip.Name == "OTHEREQ2") {
ASSERT_TRUE(compare_enums(equip.OtherEquipFuelType, Constant::eFuel::Propane));
}
Expand Down

5 comments on commit b4a8cfd

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

SteamPart1Followup (dareumnam) - Win64-Windows-10-VisualStudio-16: OK (2735 of 2735 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.

SteamPart1Followup (dareumnam) - x86_64-MacOS-10.17-clang-14.0.0: OK (3518 of 3520 tests passed, 3 test warnings)

Messages:\n

  • 2 tests had: ESO small diffs.
  • 4 tests had: EIO diffs.
  • 1 test had: ESO big diffs.
  • 2 tests had: MTR small diffs.
  • 2 tests had: Table small diffs.
  • 1 test had: ERR diffs.
  • 1 test had: Table big diffs.

Failures:\n

regression Test Summary

  • Passed: 782
  • Failed: 2

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.

SteamPart1Followup (dareumnam) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3560 of 3561 tests passed, 4 test warnings)

Messages:\n

  • 2 tests had: ESO small diffs.
  • 3 tests had: EIO diffs.
  • 1 test had: ESO big diffs.
  • 2 tests had: MTR small diffs.
  • 3 tests had: Table small diffs.

Failures:\n

regression Test Summary

  • Passed: 803
  • Failed: 1

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

SteamPart1Followup (dareumnam) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1950 of 1950 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.

SteamPart1Followup (dareumnam) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (788 of 788 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.