From b4a8cfd1e014d00c3eaec37fd8047be55da17328 Mon Sep 17 00:00:00 2001 From: Dareum Nam Date: Mon, 18 Sep 2023 10:03:12 -0600 Subject: [PATCH] resolve conflicts from #10131 --- src/EnergyPlus/DataGlobalConstants.hh | 30 ++++++++++++------- src/EnergyPlus/DataHeatBalance.hh | 1 - src/EnergyPlus/InternalHeatGains.cc | 13 ++++---- tst/EnergyPlus/unit/InternalHeatGains.unit.cc | 2 +- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/EnergyPlus/DataGlobalConstants.hh b/src/EnergyPlus/DataGlobalConstants.hh index 9054985d420..fb135398b7d 100644 --- a/src/EnergyPlus/DataGlobalConstants.hh +++ b/src/EnergyPlus/DataGlobalConstants.hh @@ -93,6 +93,7 @@ namespace Constant { DistrictHeatingWater, DistrictHeatingSteam, Water, + None, // used for OtherEquipment object EnergyTransfer, ElectricityProduced, ElectricityPurchased, @@ -146,6 +147,7 @@ namespace Constant { DistrictHeatingWater, DistrictHeatingSteam, Water, + None, // used for OtherEquipment object Num }; @@ -184,6 +186,7 @@ namespace Constant { eFuel::DistrictHeatingWater, eFuel::DistrictHeatingSteam, eFuel::Water, + eFuel::None, eFuel::Invalid, eFuel::Invalid, eFuel::Invalid, @@ -231,17 +234,18 @@ namespace Constant { eResource::DistrictCooling, eResource::DistrictHeatingWater, eResource::DistrictHeatingSteam, - eResource::Water}; + eResource::Water, + eResource::None}; constexpr std::array(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(ePollutant::Num)> ePollutant2eResource = {eResource::SO2, eResource::NOx, @@ -273,6 +277,7 @@ namespace Constant { "DISTRICTHEATINGWATER", "DISTRICTHEATINGSTEAM", "WATER", + "NONE", "ENERGYTRANSFER", "ELECTRICITYPRODUCED", "ELECTRICITYPURCHASED", @@ -321,6 +326,7 @@ namespace Constant { "DistrictHeatingWater", "DistrictHeatingSteam", "Water", + "None", "EnergyTransfer", "ElectricityProduced", "ElectricityPurchased", @@ -369,7 +375,8 @@ namespace Constant { eResourceNamesUC[static_cast(eFuel2eResource[static_cast(eFuel::DistrictCooling)])], eResourceNamesUC[static_cast(eFuel2eResource[static_cast(eFuel::DistrictHeatingWater)])], eResourceNamesUC[static_cast(eFuel2eResource[static_cast(eFuel::DistrictHeatingSteam)])], - eResourceNamesUC[static_cast(eFuel2eResource[static_cast(eFuel::Water)])]}; + eResourceNamesUC[static_cast(eFuel2eResource[static_cast(eFuel::Water)])], + eResourceNamesUC[static_cast(eFuel2eResource[static_cast(eFuel::None)])]}; static constexpr std::array(eFuel::Num)> eFuelNames = { eResourceNames[static_cast(eFuel2eResource[static_cast(eFuel::Electricity)])], @@ -385,7 +392,8 @@ namespace Constant { eResourceNames[static_cast(eFuel2eResource[static_cast(eFuel::DistrictCooling)])], eResourceNames[static_cast(eFuel2eResource[static_cast(eFuel::DistrictHeatingWater)])], eResourceNames[static_cast(eFuel2eResource[static_cast(eFuel::DistrictHeatingSteam)])], - eResourceNames[static_cast(eFuel2eResource[static_cast(eFuel::Water)])]}; + eResourceNames[static_cast(eFuel2eResource[static_cast(eFuel::Water)])], + eResourceNames[static_cast(eFuel2eResource[static_cast(eFuel::None)])]}; static constexpr std::array(ePollutant::Num)> ePollutantNamesUC = { eResourceNamesUC[static_cast(ePollutant2eResource[static_cast(ePollutant::SO2)])], diff --git a/src/EnergyPlus/DataHeatBalance.hh b/src/EnergyPlus/DataHeatBalance.hh index cd4e04723b7..65da26de11d 100644 --- a/src/EnergyPlus/DataHeatBalance.hh +++ b/src/EnergyPlus/DataHeatBalance.hh @@ -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 diff --git a/src/EnergyPlus/InternalHeatGains.cc b/src/EnergyPlus/InternalHeatGains.cc index 9a5189c18ff..e0df054086c 100644 --- a/src/EnergyPlus/InternalHeatGains.cc +++ b/src/EnergyPlus/InternalHeatGains.cc @@ -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(getEnumValue(Constant::eFuelNamesUC, IHGAlphas(2))); @@ -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) { @@ -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, @@ -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", @@ -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", @@ -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", diff --git a/tst/EnergyPlus/unit/InternalHeatGains.unit.cc b/tst/EnergyPlus/unit/InternalHeatGains.unit.cc index 628ab11ece6..67dd46487fc 100644 --- a/tst/EnergyPlus/unit/InternalHeatGains.unit.cc +++ b/tst/EnergyPlus/unit/InternalHeatGains.unit.cc @@ -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)); }