Skip to content
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

Merged
merged 11 commits into from
Oct 29, 2024

Conversation

joseph-robertson
Copy link
Collaborator

Pull request overview

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

@joseph-robertson joseph-robertson added severity - Normal Bug component - IDF Translation Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. labels Oct 24, 2024
@joseph-robertson joseph-robertson self-assigned this Oct 24, 2024
@joseph-robertson joseph-robertson marked this pull request as ready for review October 29, 2024 14:50
@@ -566,7 +567,7 @@ namespace energyplus {
} else {
extensible.setString(UnitarySystemPerformance_MultispeedExtensibleFields::HeatingSpeedSupplyAirFlowRatio, "Autosize");
}
} else if (i < 2) {
Copy link
Collaborator Author

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();
Copy link
Collaborator Author

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) {
Copy link
Collaborator Author

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) {
Copy link
Collaborator Author

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.

Copy link
Collaborator

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

Comment on lines 159 to 169
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());
Copy link
Collaborator

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) {
Copy link
Collaborator

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

Comment on lines 372 to 386
{ // 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));
Copy link
Collaborator

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.

@jmarrec jmarrec force-pushed the unitary-sys-perf-multispeed-fix branch from 27c21f9 to 4a3deb3 Compare October 29, 2024 21:23
Copy link
Collaborator

@jmarrec jmarrec left a 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!

Comment on lines +388 to +404
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));
}
Copy link
Collaborator

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.

Comment on lines +159 to +169
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];
Copy link
Collaborator

Choose a reason for hiding this comment

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

scoping

@ci-commercialbuildings
Copy link
Collaborator

ci-commercialbuildings commented Oct 29, 2024

@joseph-robertson joseph-robertson merged commit c8b9868 into develop Oct 29, 2024
3 of 6 checks passed
@joseph-robertson joseph-robertson deleted the unitary-sys-perf-multispeed-fix branch October 29, 2024 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - IDF Translation Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. severity - Normal Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Forward Translator Issues for UnitarySystemPerformance:Multispeed
3 participants