-
Notifications
You must be signed in to change notification settings - Fork 192
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
Fix AirLoopHVACUnitarySystem FT issues with UnitarySystemPerformanceMultispeed #5278
Conversation
@@ -566,7 +567,7 @@ namespace energyplus { | |||
} else { | |||
extensible.setString(UnitarySystemPerformance_MultispeedExtensibleFields::HeatingSpeedSupplyAirFlowRatio, "Autosize"); | |||
} | |||
} else if (i < 2) { |
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.
Not sure the purpose of the "< 2"...?
} else { | ||
_unitarySystemPerformance.setInt(UnitarySystemPerformance_MultispeedFields::NumberofSpeedsforHeating, 1); | ||
} | ||
|
||
if (multispeedDXCooling) { | ||
coolingStages = multispeedDXCooling->stages(); | ||
maxStages = coolingStages.size(); |
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.
This was overwriting maxStages
set by heating speeds.
using namespace openstudio::model; | ||
using namespace openstudio; | ||
|
||
TEST_F(EnergyPlusFixture, ForwardTranslator_UnitarySystemPerformanceMultispeed_Ctor) { |
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.
New test for direct translation of UnitarySystemPerformanceMultispeed
.
} | ||
} | ||
|
||
TEST_F(EnergyPlusFixture, ForwardTranslator_UnitarySystemPerformanceMultispeed_AirLoopHVACUnitarySystem) { |
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.
New test for translation of UnitarySystemPerformanceMultispeed
using AirLoopHVACUnitarySystem
.
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.
A comment or another name would be helpful here. Make it clearer that this is the one that the FT creates if the user didn't specifically instantiate a UnitarySystemPerformanceMultiSpeed object
auto egs = idf_perf.extensibleGroups(); | ||
|
||
IdfExtensibleGroup eg1 = egs[0]; | ||
ASSERT_TRUE(eg1.getDouble(UnitarySystemPerformance_MultispeedExtensibleFields::HeatingSpeedSupplyAirFlowRatio)); | ||
EXPECT_EQ(0.1, eg1.getDouble(UnitarySystemPerformance_MultispeedExtensibleFields::HeatingSpeedSupplyAirFlowRatio).get()); | ||
ASSERT_TRUE(eg1.getDouble(UnitarySystemPerformance_MultispeedExtensibleFields::CoolingSpeedSupplyAirFlowRatio)); | ||
EXPECT_EQ(0.2, eg1.getDouble(UnitarySystemPerformance_MultispeedExtensibleFields::CoolingSpeedSupplyAirFlowRatio).get()); | ||
|
||
IdfExtensibleGroup eg2 = egs[1]; | ||
ASSERT_TRUE(eg2.getDouble(UnitarySystemPerformance_MultispeedExtensibleFields::HeatingSpeedSupplyAirFlowRatio)); | ||
EXPECT_EQ(0.3, eg2.getDouble(UnitarySystemPerformance_MultispeedExtensibleFields::HeatingSpeedSupplyAirFlowRatio).get()); |
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.
I'm really liking this test, seems to be thorough!
Nitpick/FYI: I would scope the eg variable in {}
. Otherwise it's easy to check the wrong eg by copy pasting:
Here's how I'd do it:
{
const auto& eg = egs[0]; // Notice this is a const ref, no need for a copy here (don't care, it's a test, but still, good habits)
ASSERT_TRUE(eg.getDouble(UnitarySystemPerformance_MultispeedExtensibleFields::HeatingSpeedSupplyAirFlowRatio));
[...]
}
{
const auto& eg = egs[1];
ASSERT_TRUE(eg.getDouble(UnitarySystemPerformance_MultispeedExtensibleFields::HeatingSpeedSupplyAirFlowRatio));
[...]
}
} | ||
} | ||
|
||
TEST_F(EnergyPlusFixture, ForwardTranslator_UnitarySystemPerformanceMultispeed_AirLoopHVACUnitarySystem) { |
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.
A comment or another name would be helpful here. Make it clearer that this is the one that the FT creates if the user didn't specifically instantiate a UnitarySystemPerformanceMultiSpeed object
{ // h < c | ||
Model m; | ||
|
||
CoilHeatingDXMultiSpeed htgcoil(m); | ||
CoilHeatingDXMultiSpeedStageData htgstage1(m); | ||
EXPECT_TRUE(htgstage1.setRatedAirFlowRate(1)); | ||
EXPECT_TRUE(htgcoil.addStage(htgstage1)); | ||
|
||
CoilCoolingDXMultiSpeed clgcoil(m); | ||
CoilCoolingDXMultiSpeedStageData clgstage1(m); | ||
EXPECT_TRUE(clgstage1.setRatedAirFlowRate(2)); | ||
EXPECT_TRUE(clgcoil.addStage(clgstage1)); | ||
CoilCoolingDXMultiSpeedStageData clgstage2(m); | ||
EXPECT_TRUE(clgstage2.setRatedAirFlowRate(3)); | ||
EXPECT_TRUE(clgcoil.addStage(clgstage2)); |
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.
It would probably be good to have at least one test that has like 4 stages for one, and 2 for the other. So that we test the former i < 2
condition a bit better.
27c21f9
to
4a3deb3
Compare
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.
@joseph-robertson I made some nitpick changes and tested the last one with 2 heating and 4 cooling stages. Take a quick look. Otherwise this is looks good. Thanks again for the thorough testing!
const int maxHeatingStages = 2; | ||
const int maxCoolingStages = 4; | ||
const int maxStages = std::max(maxHeatingStages, maxCoolingStages); | ||
|
||
CoilHeatingDXMultiSpeed htgcoil(m); | ||
for (int i = 1; i <= maxHeatingStages; ++i) { | ||
CoilHeatingDXMultiSpeedStageData htgstage(m); | ||
EXPECT_TRUE(htgstage.setRatedAirFlowRate(i)); | ||
EXPECT_TRUE(htgcoil.addStage(htgstage)); | ||
} | ||
|
||
CoilCoolingDXMultiSpeed clgcoil(m); | ||
for (int i = 1; i <= maxCoolingStages; ++i) { | ||
CoilCoolingDXMultiSpeedStageData clgstage(m); | ||
EXPECT_TRUE(clgstage.setRatedAirFlowRate(i + maxHeatingStages)); | ||
EXPECT_TRUE(clgcoil.addStage(clgstage)); | ||
} |
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.
Make this test case use 2 speed for heating and 4 for cooling.
const auto egs = idf_perf.extensibleGroups(); | ||
|
||
{ | ||
const IdfExtensibleGroup& eg = egs[0]; | ||
ASSERT_TRUE(eg.getDouble(UnitarySystemPerformance_MultispeedExtensibleFields::HeatingSpeedSupplyAirFlowRatio)); | ||
EXPECT_EQ(0.1, eg.getDouble(UnitarySystemPerformance_MultispeedExtensibleFields::HeatingSpeedSupplyAirFlowRatio).get()); | ||
ASSERT_TRUE(eg.getDouble(UnitarySystemPerformance_MultispeedExtensibleFields::CoolingSpeedSupplyAirFlowRatio)); | ||
EXPECT_EQ(0.2, eg.getDouble(UnitarySystemPerformance_MultispeedExtensibleFields::CoolingSpeedSupplyAirFlowRatio).get()); | ||
} | ||
{ | ||
const IdfExtensibleGroup& eg = egs[1]; |
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.
scoping
CI Results for 4a3deb3:
|
Pull request overview
Pull Request Author
src/model/test
)src/energyplus/Test
)src/osversion/VersionTranslator.cpp
)Labels:
IDDChange
APIChange
Pull Request - Ready for CI
so that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.