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

#5145 - HeatExchangerAirToAirSensibleAndLatent normalization divisor error #5193

Merged
merged 3 commits into from
May 14, 2024

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented May 13, 2024

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

@jmarrec jmarrec added component - Model Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. labels May 13, 2024
@jmarrec jmarrec self-assigned this May 13, 2024
Comment on lines +169 to +175
bool TableLookup_Impl::setNormalizationDivisor(double normalizationDivisor) {
if (std::abs(normalizationDivisor) < std::numeric_limits<double>::min()) {
LOG(Warn, "Unable to set " << briefDescription() << "'s Normalization divisor to zero.");
return false;
}

bool result = setDouble(OS_Table_LookupFields::NormalizationDivisor, normalizationDivisor);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TableLookup will reject 0.0 now, and return false + a warn

Comment on lines +1031 to +1037
const auto val100 = sensibleEffectivenessat100HeatingAirFlow();
if (std::abs(val100) < std::numeric_limits<double>::min()) {
LOG_AND_THROW("Unable to set " << briefDescription()
<< "'s Sensible Effectiveness at 75 Heating Air Flow because the value at 100 is zero and would lead to a "
"Normalization divisor equal to zero.");
}
auto tableLookup = makeTable(sensibleEffectivenessat75HeatingAirFlow, val100, model(), fmt::format("{}_SensHeatEff", nameString()));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

HX: we actually throw if we get to such a condition.

Comment on lines +405 to +423
// Ensure we protect users against dumb issues that lead to a normalization divisor of zero
{
// Ensure no curves assigned for now
hx.resetSensibleEffectivenessofHeatingAirFlowCurve();
hx.resetLatentEffectivenessofHeatingAirFlowCurve();
hx.resetSensibleEffectivenessofCoolingAirFlowCurve();
hx.resetLatentEffectivenessofCoolingAirFlowCurve();

// IMHO this doesn't make sense (IDD should be `\minimum> 0.0`), but the E+ IDD and OS IDD have always allowed it, so leaving it untouched
EXPECT_TRUE(hx.setSensibleEffectivenessat100HeatingAirFlow(0.0));
EXPECT_TRUE(hx.setLatentEffectivenessat100HeatingAirFlow(0.0));
EXPECT_TRUE(hx.setSensibleEffectivenessat100CoolingAirFlow(0.0));
EXPECT_TRUE(hx.setLatentEffectivenessat100CoolingAirFlow(0.0));

EXPECT_ANY_THROW(hx.setSensibleEffectivenessat75HeatingAirFlow(0.5));
EXPECT_ANY_THROW(hx.setLatentEffectivenessat75HeatingAirFlow(0.5));
EXPECT_ANY_THROW(hx.setSensibleEffectivenessat75CoolingAirFlow(0.5));
EXPECT_ANY_THROW(hx.setLatentEffectivenessat75CoolingAirFlow(0.5));
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Test that it throws with HX

Comment on lines +54 to +56
// #5145 - We reject 0 as a normalization divisor
EXPECT_FALSE(tableLookup.setNormalizationDivisor(0.0));
EXPECT_EQ(0.5, tableLookup.normalizationDivisor());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Test that TableLookup just returns false and leaves it untouched

@jmarrec jmarrec changed the title #5145 normalization divisor #5145 - HeatExchangerAirToAirSensibleAndLatent normalization divisor error May 13, 2024
@jmarrec jmarrec merged commit 544bca6 into develop May 14, 2024
3 of 6 checks passed
@jmarrec jmarrec deleted the 5145_normalization_divisor branch May 14, 2024 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - Model Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HeatExchangerAirToAirSensibleAndLatent normalization divisor error
2 participants