Skip to content

Commit

Permalink
Merge pull request #10772 from NREL/fix10769hardsizeBaseboard
Browse files Browse the repository at this point in the history
Fix Convective Baseboard with Hard Sizes
  • Loading branch information
Myoldmopar authored Sep 30, 2024
2 parents 8c106b8 + 88832d0 commit 76fb9f8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 32 deletions.
29 changes: 15 additions & 14 deletions src/EnergyPlus/BaseboardRadiator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ namespace BaseboardRadiator {
thisBaseboard.ZonePtr = DataZoneEquipment::GetZoneEquipControlledZoneNum(
state, DataZoneEquipment::ZoneEquipType::BaseboardConvectiveWater, thisBaseboard.EquipID);

thisBaseboard.resetSizingFlagBasedOnInput(state); // set MySizeFlag to false if no autosizing is being done
thisBaseboard.checkForZoneSizing(state); // check if any autosizing is being done
}

if (ErrorsFound) {
Expand Down Expand Up @@ -625,8 +625,6 @@ namespace BaseboardRadiator {
state.dataSize->DataScalableCapSizingON = false;

if (state.dataSize->CurZoneEqNum > 0) {
auto &zoneEqSizing = state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum);
auto const &finalZoneSizing = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum);
bool FlowAutoSize = false; // Indicator to autosizing water volume flow

if (this->WaterVolFlowRateMax == DataSizing::AutoSize) {
Expand All @@ -638,6 +636,8 @@ namespace BaseboardRadiator {
state, cCMO_BBRadiator_Water, this->EquipID, "User-Specified Maximum Water Flow Rate [m3/s]", this->WaterVolFlowRateMax);
}
} else {
auto &zoneEqSizing = state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum);
auto const &finalZoneSizing = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum);
std::string_view const CompType = cCMO_BBRadiator_Water;
std::string_view const CompName = this->EquipID;
state.dataSize->DataFracOfAutosizedHeatingCapacity = 1.0;
Expand Down Expand Up @@ -748,6 +748,8 @@ namespace BaseboardRadiator {
state, cCMO_BBRadiator_Water, this->EquipID, "User-Specified U-Factor Times Area Value [W/K]", this->UA);
}
} else {
auto &zoneEqSizing = state.dataSize->ZoneEqSizing(state.dataSize->CurZoneEqNum);
auto const &finalZoneSizing = state.dataSize->FinalZoneSizing(state.dataSize->CurZoneEqNum);
this->WaterInletTemp = state.dataSize->PlantSizData(PltSizHeatNum).ExitTemp;
this->AirInletTemp = finalZoneSizing.ZoneTempAtHeatPeak;
this->AirInletHumRat = finalZoneSizing.ZoneHumRatAtHeatPeak;
Expand Down Expand Up @@ -938,19 +940,18 @@ namespace BaseboardRadiator {
}
}

void BaseboardParams::resetSizingFlagBasedOnInput(EnergyPlusData &state)
void BaseboardParams::checkForZoneSizing(EnergyPlusData &state)
{
// this->MySizeFlag defaults to true. Set to false if no sizing is requested.
// Condition 1: Is UA hardwired (not autosized)?
// Condition 2: Is max flow rate hardwired (not autosized)?
// Condition 3: Is EITHER capacity used and hardwired (not autosized) OR capacity per floor area used?
// If YES to all three, then this unit does not need to be autosized and the sizing flag needs to be set to false.
if ((this->UA != DataSizing::AutoSize) && (this->WaterVolFlowRateMax != DataSizing::AutoSize) &&
(((this->HeatingCapMethod == DataSizing::HeatingDesignCapacity) && (this->ScaledHeatingCapacity != DataSizing::AutoSize)) ||
(this->HeatingCapMethod == DataSizing::CapacityPerFloorArea))) {
this->MySizeFlag = false;
// If any sizing is requested, check that zone sizing has been done
// Condition 1: Is UA autosized)?
// Condition 2: Is max flow rate autosized?
// Condition 3: Is HeatingDesignCapacity used and autosized)
// Condition 4: Is FractionOfAutosizedHeatingCapacity used and heating capacity is autosized
if ((this->UA == DataSizing::AutoSize) || (this->WaterVolFlowRateMax == DataSizing::AutoSize) ||
((this->HeatingCapMethod == DataSizing::HeatingDesignCapacity) && (this->ScaledHeatingCapacity == DataSizing::AutoSize)) ||
((this->HeatingCapMethod == DataSizing::FractionOfAutosizedHeatingCapacity) && (this->ScaledHeatingCapacity == DataSizing::AutoSize))) {
CheckZoneSizing(state, cCMO_BBRadiator_Water, this->EquipID);
}
if (this->MySizeFlag) CheckZoneSizing(state, cCMO_BBRadiator_Water, this->EquipID);
}

void SimHWConvective(EnergyPlusData &state, int &BaseboardNum, Real64 &LoadMet)
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/BaseboardRadiator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace BaseboardRadiator {

void SizeBaseboard(EnergyPlusData &state, int baseboardNum);

void resetSizingFlagBasedOnInput(EnergyPlusData &state);
void checkForZoneSizing(EnergyPlusData &state);
};

void SimBaseboard(
Expand Down
43 changes: 26 additions & 17 deletions tst/EnergyPlus/unit/BaseboardRadiator.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "Fixtures/EnergyPlusFixture.hh"
#include <EnergyPlus/BaseboardRadiator.hh>
#include <EnergyPlus/Data/EnergyPlusData.hh>
#include <EnergyPlus/DataErrorTracking.hh>
#include <EnergyPlus/DataHVACGlobals.hh>
#include <EnergyPlus/DataHeatBalance.hh>
#include <EnergyPlus/DataSizing.hh>
Expand Down Expand Up @@ -480,58 +481,66 @@ TEST_F(EnergyPlusFixture, BaseboardConvWater_SizingTest)
EXPECT_EQ(state->dataBaseboardRadiator->baseboards(BaseboardNum).UA, 3000.0);
}

TEST_F(EnergyPlusFixture, BaseboardConvWater_resetSizingFlagBasedOnInputTest)
TEST_F(EnergyPlusFixture, BaseboardConvWater_checkForZoneSizingTest)
{
state->dataBaseboardRadiator->baseboards.allocate(1);
auto &thisBB = state->dataBaseboardRadiator->baseboards(1);
state->dataSize->ZoneSizingRunDone = true;
state->dataSize->ZoneSizingRunDone = false;

std::string const error_string =
delimited_string({" ** Severe ** For autosizing of ZoneHVAC:Baseboard:Convective:Water , a zone sizing run must be done.\n"
" ** ~~~ ** No \"Sizing:Zone\" objects were entered.\n"
" ** ~~~ ** The \"SimulationControl\" object did not have the field \"Do Zone Sizing Calculation\" set to Yes.\n"
" ** Fatal ** Program terminates due to previously shown condition(s).\n"
" ...Summary of Errors that led to program termination:\n"
" ..... Reference severe error count=1\n"
" ..... Last severe error=For autosizing of ZoneHVAC:Baseboard:Convective:Water , a zone sizing run must be done."});

// Test 1A: UA autosized so MySizeFlag should stay true
thisBB.MySizeFlag = true; // reset to default/initialized value
thisBB.UA = DataSizing::AutoSize;
thisBB.WaterVolFlowRateMax = 0.001;
thisBB.HeatingCapMethod = DataSizing::FractionOfAutosizedHeatingCapacity;
thisBB.ScaledHeatingCapacity = 1.0;
thisBB.resetSizingFlagBasedOnInput(*state);
EXPECT_TRUE(thisBB.MySizeFlag);
ASSERT_THROW(thisBB.checkForZoneSizing(*state), std::runtime_error);
EXPECT_TRUE(compare_err_stream(error_string, true));

// Test 1B: WaterVolFlowRateMax autosized so MySizeFlag should stay true
thisBB.MySizeFlag = true; // reset to default/initialized value
state->dataErrTracking->TotalSevereErrors = 0;
thisBB.UA = 0.5;
thisBB.WaterVolFlowRateMax = DataSizing::AutoSize;
thisBB.HeatingCapMethod = DataSizing::FractionOfAutosizedHeatingCapacity;
thisBB.ScaledHeatingCapacity = 1.0;
thisBB.resetSizingFlagBasedOnInput(*state);
EXPECT_TRUE(thisBB.MySizeFlag);
ASSERT_THROW(thisBB.checkForZoneSizing(*state), std::runtime_error);
EXPECT_TRUE(compare_err_stream(error_string, true));

// Test 1C: Heating Capacity autosized for method HeatingDesignCapacity so MySizeFlag should stay true
thisBB.MySizeFlag = true; // reset to default/initialized value
state->dataErrTracking->TotalSevereErrors = 0;
thisBB.UA = 0.5;
thisBB.WaterVolFlowRateMax = 0.001;
thisBB.HeatingCapMethod = DataSizing::HeatingDesignCapacity;
thisBB.ScaledHeatingCapacity = DataSizing::AutoSize;
thisBB.resetSizingFlagBasedOnInput(*state);
EXPECT_TRUE(thisBB.MySizeFlag);
ASSERT_THROW(thisBB.checkForZoneSizing(*state), std::runtime_error);
EXPECT_TRUE(compare_err_stream(error_string, true));

// Test 2A: Heating Capacity not autosized for method HeatingDesignCapacity and UA and WaterVolFlowRateMax not autosized
// so MySizeFlag should be changed to false
thisBB.MySizeFlag = true; // reset to default/initialized value
state->dataErrTracking->TotalSevereErrors = 0;
thisBB.UA = 0.5;
thisBB.WaterVolFlowRateMax = 0.001;
thisBB.HeatingCapMethod = DataSizing::HeatingDesignCapacity;
thisBB.ScaledHeatingCapacity = 1000.0;
thisBB.resetSizingFlagBasedOnInput(*state);
EXPECT_FALSE(thisBB.MySizeFlag);
thisBB.checkForZoneSizing(*state);
EXPECT_TRUE(compare_err_stream("", true));

// Test 2B: CapacityPerFloorArea method and UA and WaterVolFlowRateMax not autosized
// so MySizeFlag should be changed to false
thisBB.MySizeFlag = true; // reset to default/initialized value
state->dataErrTracking->TotalSevereErrors = 0;
thisBB.UA = 0.5;
thisBB.WaterVolFlowRateMax = 0.001;
thisBB.HeatingCapMethod = DataSizing::CapacityPerFloorArea;
thisBB.ScaledHeatingCapacity = DataSizing::AutoSize; // this value does not mater since it is not really valid for this method
thisBB.resetSizingFlagBasedOnInput(*state);
EXPECT_FALSE(thisBB.MySizeFlag);
thisBB.checkForZoneSizing(*state);
EXPECT_TRUE(compare_err_stream("", true));
}

} // namespace EnergyPlus

3 comments on commit 76fb9f8

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (2914 of 2914 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.

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-RelWithDebInfo: OK (2098 of 2098 tests passed, 0 test warnings)

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-RelWithDebInfo: OK (799 of 799 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.