Skip to content

Update maximum sensible heat ratio calculation#11031

Merged
mitchute merged 13 commits intodevelopfrom
fix_negative_bpf
Sep 26, 2025
Merged

Update maximum sensible heat ratio calculation#11031
mitchute merged 13 commits intodevelopfrom
fix_negative_bpf

Conversation

@lymereJ
Copy link
Collaborator

@lymereJ lymereJ commented Apr 12, 2025

Pull request overview

Description of the purpose of this PR

When calculating a coil bypass factor, prevent coil outlet temperature to be lower than dew point temperature at the same humidity ratio and avoid negative bypass factor.

Pull Request Author

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions

Reviewer

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • 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
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

@lymereJ lymereJ added the Defect Includes code to repair a defect in EnergyPlus label Apr 12, 2025
@lymereJ lymereJ added this to the EnergyPlus 25.2 IO Freeze milestone Apr 12, 2025
@NatLabRockies NatLabRockies deleted a comment from github-actions bot Apr 15, 2025
@NatLabRockies NatLabRockies deleted a comment from github-actions bot Apr 15, 2025
@NatLabRockies NatLabRockies deleted a comment from github-actions bot Apr 15, 2025
@NatLabRockies NatLabRockies deleted a comment from github-actions bot Apr 15, 2025
@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit c73195e

Regression Summary
  • EIO: 134
  • EDD: 7
  • ESO Small Diffs: 86
  • Table Small Diffs: 95
  • ESO Big Diffs: 38
  • MTR Small Diffs: 98
  • Table Big Diffs: 35
  • ERR: 18
  • Table String Diffs: 8
  • JSON Big Diffs: 1
  • MTR Big Diffs: 3

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 835e4c3

Regression Summary
  • EIO: 136
  • EDD: 8
  • ESO Small Diffs: 64
  • Table Small Diffs: 53
  • ESO Big Diffs: 60
  • MTR Small Diffs: 82
  • Table Big Diffs: 77
  • ERR: 18
  • MTR Big Diffs: 19
  • Table String Diffs: 17
  • Audit: 3
  • JSON Big Diffs: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 8bb002a

Regression Summary
  • EIO: 136
  • EDD: 8
  • ESO Small Diffs: 64
  • Table Small Diffs: 53
  • ESO Big Diffs: 60
  • MTR Small Diffs: 82
  • Table Big Diffs: 77
  • ERR: 18
  • MTR Big Diffs: 19
  • Table String Diffs: 17
  • Audit: 3
  • JSON Big Diffs: 1

@lymereJ lymereJ changed the title Prevent coil outlet temperature to be lower than dew point temperature at the same humidity ratio Update maximum sensible heat ratio calculation Apr 17, 2025
Copy link
Collaborator Author

@lymereJ lymereJ left a comment

Choose a reason for hiding this comment

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

Walkthrough:

Comment on lines +455 to +460
Real64 ADiff = -A0 / AirMassFlow;
if (ADiff >= DataPrecisionGlobals::EXP_LowerLimit) {
CBF = std::exp(ADiff);
} else {
CBF = 0.0;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

When the bypass factor is 0, set the adjusted bypass factor to 0. Current code would calculate A0 = 0 and CBF = std::exp(ADiff) would be 1.

Comment on lines +12165 to +12169
Real64 enthalpyMaxADP = InletAirEnthalpy - DeltaH;
Real64 tempADPMax = PsyTsatFnHPb(state, enthalpyMaxADP, DataEnvironment::StdPressureSeaLevel, CallingRoutine);
Real64 humRatADP = PsyWFnTdbH(state, tempADPMax, enthalpyMaxADP, CallingRoutine);
Real64 enthalpyTempinHumRatADP = PsyHFnTdbW(RatedInletAirTemp, humRatADP);
Real64 shrADPMax = min(1.0, (enthalpyTempinHumRatADP - enthalpyMaxADP) / (InletAirEnthalpy - enthalpyMaxADP));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Calculate the SHR corresponding to the apparatus dewpoint temperature based on the enthalpy difference that corresponds to the ratio of rated capacity to mass flow rate. Use this value as the "maximum" SHR.

Comment on lines -12161 to -12162
DeltaH = TotCap / AirMassFlow;
InletAirEnthalpy = PsyHFnTdbW(RatedInletAirTemp, RatedInletAirHumRat);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Move these outside of the while so they are only calculated once.

Comment on lines +2551 to +2589
TEST_F(EnergyPlusFixture, DXCoil_ValidateADPFunctionAlone)
{
state->init_state(*state);
// Define coil parameters
Real64 constexpr RatedInletAirTemp(26.666699999999999);
Real64 constexpr RatedInletAirHumRat(0.011184700000000001);
state->dataDXCoils->DXCoil.allocate(1);
state->dataDXCoils->DXCoil(1).DXCoilType = "Coil:Cooling:DX:SingleSpeed";
state->dataDXCoils->DXCoil(1).Name = "Test Coil";
state->dataDXCoils->DXCoil(1).RatedTotCap(1) = 4480.6580719394560;
state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1) = 0.23519298920287324;
state->dataDXCoils->DXCoil(1).RatedSHR(1) = 0.75045855035287490;
std::string const CallingRoutine("DXCoil_ValidateADPFunctionAlone");

// Calculate new SHR
Real64 newSHR = ValidateADP(*state,
state->dataDXCoils->DXCoil(1).DXCoilType,
state->dataDXCoils->DXCoil(1).Name,
RatedInletAirTemp,
RatedInletAirHumRat,
state->dataDXCoils->DXCoil(1).RatedTotCap(1),
state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1),
state->dataDXCoils->DXCoil(1).RatedSHR(1),
CallingRoutine);

// Make sure that the outlet conditions are below the saturation
Real64 airMassFlowRate =
state->dataDXCoils->DXCoil(1).RatedAirVolFlowRate(1) *
Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::StdPressureSeaLevel, RatedInletAirTemp, RatedInletAirHumRat, CallingRoutine);
Real64 deltaH = state->dataDXCoils->DXCoil(1).RatedTotCap(1) / airMassFlowRate;
Real64 inletAirEnthalpy = Psychrometrics::PsyHFnTdbW(RatedInletAirTemp, RatedInletAirHumRat);
Real64 hTinHumRatOut = inletAirEnthalpy - (1.0 - newSHR) * deltaH;
Real64 outletAirHumRat = Psychrometrics::PsyWFnTdbH(*state, RatedInletAirTemp, hTinHumRatOut); // 0.0098703703931385892
Real64 outletAirEnthalpy = inletAirEnthalpy - deltaH; // 38853.039955973931
Real64 outletAirTemp = Psychrometrics::PsyTdbFnHW(outletAirEnthalpy, outletAirHumRat); // 13.846750113203081
Real64 dewPointTempOutHumRat = Psychrometrics::PsyTdpFnWPb(*state, outletAirHumRat, DataEnvironment::StdPressureSeaLevel);
ASSERT_TRUE(dewPointTempOutHumRat < outletAirTemp);
}

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 unit test that reproduces the defect file conditions.

EXPECT_ENUM_EQ(AutoSizingResultType::NoError, sizer.errorType);
EXPECT_TRUE(sizer.wasAutoSized);
EXPECT_NEAR(0.7763, sizedValue, 0.000001);
EXPECT_NEAR(0.776167, sizedValue, 0.000001);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changes in the SHR calculation has marginally impacted several unit test such as this one.

if (SlopeAtConds > 0) {
Error = (Slope - SlopeAtConds) / SlopeAtConds;
} else {
Error = 0; // SHR = 1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if SlopeAtConds == 0 then SHR = 1 hence we want to keep the initial guess, the dew point temperature at the coil outlet humidity ratio.

@lymereJ
Copy link
Collaborator Author

lymereJ commented Apr 17, 2025

The diffs do not include any additional psychometrics related warning or error that I could see. On the contrary, the proposed changes remove existing psychometrics related warnings in all the following files:

  • EMSCustomOutputVariable
  • EMSThermochromicWindow
  • Fenestration_RefBldgSmallHotelNew2004_Chicago
  • PythonPluginCustomOutputVariable
  • PythonPluginCustomTrendVariable
  • PythonPluginThermochromicWindow
  • RefBldgSmallHotelNew2004_Chicago
  • ThermochromicWindow
  • VRFMultispeedFan

The warnings were as follows:

** Warning ** For object = Coil:Cooling:DX:SingleSpeed, name = "PSZ-AC:2_COOLC DXCOIL"
**   ~~~   ** Calculated outlet air relative humidity greater than 1. The combination of
**   ~~~   ** rated air volume flow rate, total cooling capacity and sensible heat ratio yields coil exiting
**   ~~~   ** air conditions above the saturation curve. Possible fixes are to reduce the rated total cooling
**   ~~~   ** capacity, increase the rated air volume flow rate, or reduce the rated sensible heat ratio for this coil.
**   ~~~   ** If autosizing, it is recommended that all three of these values be autosized.
**   ~~~   ** ...Inputs used for calculating cooling coil bypass factor.
**   ~~~   ** ...Inlet Air Temperature     = 26.67 C
**   ~~~   ** ...Outlet Air Temperature    = 13.90 C
**   ~~~   ** ...Inlet Air Humidity Ratio  = 1.118470E-002 kgWater/kgDryAir
**   ~~~   ** ...Outlet Air Humidity Ratio = 9.904953E-003 kgWater/kgDryAir
**   ~~~   ** ...Total Cooling Capacity used in calculation = 9598.60 W
**   ~~~   ** ...Air Mass Flow Rate used in calculation     = 0.587717 kg/s
**   ~~~   ** ...Air Volume Flow Rate used in calculation   = 0.508077 m3/s
**   ~~~   **  During Warmup, Environment=LAS_VEGAS ANN HTG 99.6% CONDNS DB, at Simulation time=01/21 00:00 - 00:10
**   ~~~   ** CalcCBF: SHR adjusted to achieve valid outlet air properties and the simulation continues.
**   ~~~   ** CalcCBF: initial SHR = 0.80015
**   ~~~   ** CalcCBF: adjusted SHR = 0.79913

@lymereJ lymereJ marked this pull request as ready for review April 17, 2025 22:16
bStillValidating = false; // have to stop somewhere, this is the upper limit of SHR empirical model (see Autosizing/CoolingSHRSizing)
if (SHR > shrADPMax) {
SHR = shrADPMax;
bStillValidating = false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This all looks good. I think it would be a good idea to report a severe that describes why the user inputs, or I guess autosized inputs, cause the outlet condition to exceed the saturation curve. A warning the shows the supply air T, w and the DP at saturation(w) that shows the outlet T is left of the saturation curve. At least then the user will know what caused the design failure and a warning will be available to help correct the initial problem. This input issue might be happening more than we know.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure! I'll push some changes.

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 23694ff

Regression Summary
  • EIO: 136
  • EDD: 8
  • ESO Small Diffs: 64
  • Table Small Diffs: 53
  • ESO Big Diffs: 60
  • MTR Small Diffs: 82
  • Table Big Diffs: 77
  • ERR: 18
  • MTR Big Diffs: 19
  • Table String Diffs: 17
  • Audit: 3
  • JSON Big Diffs: 1

@nrel-bot-2
Copy link

@lymereJ @Myoldmopar it has been 33 days since this pull request was last updated.

@nrel-bot-2c
Copy link

@lymereJ @Myoldmopar it has been 34 days since this pull request was last updated.

@nrel-bot-2c
Copy link

@lymereJ @Myoldmopar it has been 38 days since this pull request was last updated.

@nrel-bot-2c
Copy link

@lymereJ @Myoldmopar it has been 28 days since this pull request was last updated.

@rraustad
Copy link
Collaborator

@lymereJ I have reviewed and this looks ready to merge. There are conflicts that must be resolved before that can happen.

@mitchute
Copy link
Collaborator

Last call for any final review comments here.

@github-actions
Copy link

⚠️ Regressions detected on ubuntu-24.04 for commit 381a005

Regression Summary
  • EIO: 137
  • EDD: 8
  • ESO Small Diffs: 64
  • Table Small Diffs: 53
  • ESO Big Diffs: 61
  • MTR Small Diffs: 83
  • Table Big Diffs: 80
  • Table String Diffs: 19
  • ERR: 19
  • MTR Big Diffs: 19
  • Audit: 3
  • JSON Big Diffs: 1

@github-actions
Copy link

⚠️ Regressions detected on macos-14 for commit 381a005

Regression Summary
  • EIO: 137
  • EDD: 8
  • ESO Small Diffs: 64
  • Table Small Diffs: 53
  • ESO Big Diffs: 61
  • MTR Small Diffs: 83
  • Table Big Diffs: 80
  • ERR: 19
  • MTR Big Diffs: 19
  • Table String Diffs: 17
  • Audit: 3
  • JSON Big Diffs: 1

@mitchute mitchute merged commit 08aab32 into develop Sep 26, 2025
11 checks passed
@mitchute mitchute deleted the fix_negative_bpf branch September 26, 2025 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Defect Includes code to repair a defect in EnergyPlus

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants