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

Address HSPF2 calculation problems for multispeed DX system #10618

Merged
merged 135 commits into from
Sep 10, 2024

Conversation

Nigusse
Copy link
Contributor

@Nigusse Nigusse commented Jul 22, 2024

Pull request overview

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • 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
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies

Reviewer

This will not be exhaustively relevant to every PR.

  • 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

@Nigusse Nigusse added the Defect Includes code to repair a defect in EnergyPlus label Jul 22, 2024
Copy link
Contributor Author

@Nigusse Nigusse left a comment

Choose a reason for hiding this comment

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

Code change walkthrough:

  • the code change now match the 2023 AHRI Standard

// Equation 11.199 AHRI-2023
q_full = q_H3_full + (q_H1_full - q_H3_full) * t_ratio;
// Equation 11.200 AHRI-2023
p_full = p_H3_full + (p_H1_full - p_H3_full) * t_ratio;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current code for Case III looks incorrect based on the review of the AHRI 2023 (2020) Standard for Performance Rating of Unitary Air-conditioning & Air-source Heat Pump Equipment. This code change matches the AHRI standard and corrects the logic flaws.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @Nigusse

@@ -4656,7 +4656,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoilsAutoSizingOutput)
! <DX Heating Coil Standard Rating Information>, Component Type, Component Name, High Temperature Heating (net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF {Btu/W-h}, Region Number
DX Heating Coil Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 34415.4, 20666.4, 6.56, 4
! <DX Heating Coil AHRI 2023 Standard Rating Information>, Component Type, Component Name, High Temperature Heating (net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF2 {Btu/W-h}, Region Number
DX Heating Coil AHRI 2023 Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 34697.2, 20948.1, 5.34, 4
DX Heating Coil AHRI 2023 Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 34697.2, 20948.1, 5.35, 4
Copy link
Contributor Author

@Nigusse Nigusse Jul 22, 2024

Choose a reason for hiding this comment

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

Modified a failed unit test.

Copy link
Contributor Author

@Nigusse Nigusse left a comment

Choose a reason for hiding this comment

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

Code change walkthrough for additional issues identified while working on the original defect.

Real64 q_H1_full = Q_H1_Full(spnum + 1);
Real64 q_H2_full = Q_H2_Full(spnum + 1);
Real64 q_H3_full = Q_H3_Full(spnum + 1);
Real64 q_H4_full = Q_H4_Full(spnum + 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The full heating capacity must be evaluated at the next available speed, not at the current speed. It should be different from the low speed.

Copy link
Member

Choose a reason for hiding this comment

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

It makes sense, and I believe you, but it would be great to get a second opinion on it. Anyone have thoughts on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know the standard but what will these values be used for? i.e., these would be used in some equation, so show the equation to support this change. For example, q_H1_full looks to be the capacity at speed 1 so why would we use speed 2 capacity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These capacities (H1, 2, 3, 4) are used to estimate the full capacity at a specified outdoor a condition through interpolation. The full capacity is then used to bracket the building load to get a speed level of the machine that matches the building load.

Real64 p_H1_full = P_H1_Full(spnum + 1);
Real64 p_H2_full = P_H2_Full(spnum + 1);
Real64 p_H3_full = P_H3_Full(spnum + 1);
Real64 p_H4_full = P_H4_Full(spnum + 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The full electric power input must be evaluated at the next available speed, not at the current speed. It should be different from the low speed.

// Equation 11.177 AHRI-2023
//?? (replaced 62 with 35) in Ratio expression // (t=>35-47/62-47)
Real64 q_35_low = // q_H1_low + (q_H0_low - q_H1_low) * ((t - (8.33)) / (1.66 - (8.33)));
q_H1_low + (q_H0_low - q_H1_low) * ((1.67 - (8.33)) / (16.67 - (8.33)));

// Equation 11.191 AHRI-2023
Real64 N_Hq = min(1.0, (q_H2_int - q_35_low) / (q_H2_full - q_35_low));
Real64 N_Hq = (q_H2_full != q_35_low) ? min(1.0, (q_H2_int - q_35_low) / (q_H2_full - q_35_low)) : 0.0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified to allow evaluation of the HSPF2 with flat heating capacity modifier curves function of temperature.

Copy link
Contributor

Choose a reason for hiding this comment

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

This fixes #10651

FWIW, and this looks like undefined behavior, but I was finding that in a release build with no floating point exceptions enabled, when you had the same Cap FT / Fflow curves, N_Hq was 0 but N_HE was 1.

// Equation 11.178 AHRI - 2023
//?? (replaced 62 with 35) in Ratio expression (t=>35 F-47/35-47)
Real64 p_35_low = // p_H1_low + (p_H0_low - p_H1_low) * ((t - (8.33)) / (1.66 - (8.33)));
p_H1_low + (p_H0_low - p_H1_low) * ((1.67 - (8.33)) / (16.67 - (8.33)));

// Equation 11.194 AHRI-2023
Real64 N_HE = min(1.0, (p_H2_int - p_35_low) / (p_H2_full - p_35_low));
Real64 N_HE = (p_H2_int != p_35_low) ? min(1.0, (p_H2_int - p_35_low) / (p_H2_full - p_35_low)) : 0.0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was modified to allow the evaluation of the HSPF2 with flat heating capacity modifier curves function of temperature.

// equation 11.181
q_low = Q_H2_Int(spnum);
// equation 11.184
p_low = P_H2_Int(spnum);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was modified the equations used to calculate delivered heat and energy input at the Low Speed to match the 2023 AHRI Standard 210/240.

// equation 11.199
q_hs = Q_H3_Full(spnum + 1) + ((Q_H1_Full(spnum + 1) - Q_H3_Full(spnum + 1)) * ratio);
// equation 11.200
p_hs = P_H3_Full(spnum + 1) + ((P_H1_Full(spnum + 1) - P_H3_Full(spnum + 1)) * ratio);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified the equations used to calculate delivered heat and energy input at the High Speed to match the 2023 AHRI Standard 210/240.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, so here I see the equations. I still don't know if Q_H1_Full should be the "full" capacity at the speed being evaluated or the full capacity at the next highest speed. What in the standard prompted this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding is that the next higher speed level should be used to get the full speed capacity that bounds the current building load.

Copy link
Contributor

Choose a reason for hiding this comment

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

But if PLR at speed x is < 1 then the full capacity at that same speed would bound the current building load. So where in the standard does it say to use the next highest speed level?

Copy link
Contributor Author

@Nigusse Nigusse Aug 20, 2024

Choose a reason for hiding this comment

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

In the standard, different sections may apply to this code: one for a two-speed (two-capacity) machine and another one for a variable-speed machine. They are not an exact match for a discrete-speed machine with more than the two-speed. The HSPF2 calculation is based on the variable speed section of the standard, and it requires some interpretation to fit the discrete multispeed DX heating coil model we have in EnergyPlus. It requires some judgment on how to account for the difference between the EnergyPlus model and the variable speed machine procedure in the AHRI standard. Simply, it needs interpretation of the procedure for implementation in EnergyPlus.

In a variable-speed machine, you have just one full speed, like the two-speed DX cooling coil model in EnergyPlus. In the multispeed DX heating coil, your full speed is a moving target, and depending on your load, it is the next available higher-speed capacity. Let's say a given load is bound between two-speed levels; the full load should point to the higher speed level, not the lower speed. This is my interpretation of how it should be. The current full capacity assignment was to the current speed, so I changed it to the next higher-speed capacity.

@@ -4656,7 +4656,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoilsAutoSizingOutput)
! <DX Heating Coil Standard Rating Information>, Component Type, Component Name, High Temperature Heating (net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF {Btu/W-h}, Region Number
DX Heating Coil Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 34415.4, 20666.4, 6.56, 4
! <DX Heating Coil AHRI 2023 Standard Rating Information>, Component Type, Component Name, High Temperature Heating (net) Rating Capacity {W}, Low Temperature Heating (net) Rating Capacity {W}, HSPF2 {Btu/W-h}, Region Number
DX Heating Coil AHRI 2023 Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 34697.2, 20948.1, 5.34, 4
DX Heating Coil AHRI 2023 Standard Rating Information, Coil:Heating:DX:MultiSpeed, ASHP HTG COIL, 34697.2, 20948.1, 5.76, 4
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified the HSPF2 values unit test to match latest results. Now the difference between HSPF and HSPF2 reduced to 12.2% from 18.6%.


EXPECT_TRUE(compare_eio_stream(htg_coil_eio_output, true));
}

} // namespace EnergyPlus
Copy link
Contributor Author

@Nigusse Nigusse Jul 24, 2024

Choose a reason for hiding this comment

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

Added three unit tests. These unit tests evaluate HSPF values for various compressor operation control minimum outdoor air temperature and fan power inputs. The unit tests demonstrate that the HSPF2 values are now closer to the HSPF values.

@Nigusse
Copy link
Contributor Author

Nigusse commented Jul 25, 2024

See below comparison of the HSPF2 values of develop and this branch:

Develop: percent difference between HSPF and HSPF2 is about 19.0%.
Develop

Branch: percent difference between HSPF and HSPF2 is about 8.9%.
Branch

@Nigusse
Copy link
Contributor Author

Nigusse commented Jul 25, 2024

See below comparison of the HSPF2 calculation intermediate outputs for develop and this branch:

Develop:
Develop

Branch:
Branch

The delivered heating rate is 4979.8W, the same for development and this branch. However, the total electric power input (compressor electric power + electric resistance heater power) decreased to 2389.0W from 2690.4W, resulting in an increased HSPF2 value. Note that the electric resistance heater power input has decreased more than the compressor electric power input increase.

@Nigusse
Copy link
Contributor Author

Nigusse commented Jul 25, 2024

Attached is a test file used to generate sample results demonstrating the fix.

Issue9909_in.idf.txt

@Nigusse Nigusse added this to the EnergyPlus 24.2 milestone Jul 25, 2024
@Nigusse Nigusse changed the title Address HSPF2 calculation problem when building load is greater than the full speed capacity for multispeed system Address HSPF2 calculation problems for multispeed DX system Jul 25, 2024
@Nigusse
Copy link
Contributor Author

Nigusse commented Jul 25, 2024

The regression test results show that 18 example files have diffs in the HSPF2 values. All these 18 example files have Multispeed DX Heating Coils. We found only six unique HSPF2 values since the inputs are similar in multiple example files. Below is a summary of the results based on the six files. The absolute diffs range 0.07 – 0.4 Btu/W-h, and the percent diffs range 1.0% - 8.1%. All the 18 example files with Multispeed DX heating coils in the branch showed increased HSPF2 values. However, they are less than the HSPF values. These results are consistent with the expectations.

image

@Nigusse
Copy link
Contributor Author

Nigusse commented Jul 25, 2024

This branch is ready for review.

Copy link
Member

@Myoldmopar Myoldmopar left a comment

Choose a reason for hiding this comment

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

This is fine to me, and I know you've done your due diligence in these changes. I'd like another review opinion on the changes to speed lookups and such, but if not, it's OK.

Real64 q_H1_full = Q_H1_Full(spnum + 1);
Real64 q_H2_full = Q_H2_Full(spnum + 1);
Real64 q_H3_full = Q_H3_Full(spnum + 1);
Real64 q_H4_full = Q_H4_Full(spnum + 1);
Copy link
Member

Choose a reason for hiding this comment

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

It makes sense, and I believe you, but it would be great to get a second opinion on it. Anyone have thoughts on this?

// Equation 11.199 AHRI-2023
q_full = q_H3_full + (q_H1_full - q_H3_full) * t_ratio;
// Equation 11.200 AHRI-2023
p_full = p_H3_full + (p_H1_full - p_H3_full) * t_ratio;
}
Copy link
Member

Choose a reason for hiding this comment

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

Thanks @Nigusse

@mjwitte mjwitte self-assigned this Jul 31, 2024
@Myoldmopar
Copy link
Member

@Nigusse I was going to merge this in, but during local testing I found 3 tests failing. I spent about 30 minutes trying to diagnose the issue, looking at other changes made recently that might interact, but couldn't solve it quick enough. While doing that I also found like 20+ variables in SizeDXCoil that were simply unused. (Assigned but never accessed) So I removed them just because.

If these 3 tests still fail, and you are able to look at them, that would be great. If not, I'll have to do some further testing to figure out what I need to do to the unit tests to get them to work.

Extra info:

  • This is the obvious culprit, but I couldn't tell quick enough what was needed on the HSPF tests.
  • If I need to debug further, I'm likely going to roll back to the unmerged version of this branch to get it to pass, then more carefully bring in commits from develop to see exactly what is triggering the failures.

Anyway, I'm going to move on to other PRs for now.

@Nigusse
Copy link
Contributor Author

Nigusse commented Aug 16, 2024

@Myoldmopar I will update the branch. If the failed unit tests are the new unit tests added, then I know what the problem is. I will look at it later today.

@Nigusse
Copy link
Contributor Author

Nigusse commented Aug 16, 2024

@Myoldmopar The failed unit test must have impacted by changes somewhere else. Now, the heating capacity is sized to zero. Maybe these unit tests need to be modified.

This commit includes the fix to the problem for both condensers operating even when the operation scheme said that one of them should not be operating.  It fixes this for all of the cooling tower models that were not set up to look at this.  Results now should that the towers are operating when they are supposed to.
@Nigusse
Copy link
Contributor Author

Nigusse commented Aug 30, 2024

@Myoldmopar Resolved the conflict and the 18 example files diffs are expected per the original fix.

@@ -7549,22 +7487,19 @@ void SizeDXCoil(EnergyPlusData &state, int const DXCoilNum)
PrintFlag = true;
state.dataSize->DataTotCapCurveIndex = thisDXCoil.CCapFTemp(Mode);
if (thisDXCoil.DXCoilType_Num == HVAC::CoilDX_CoolingTwoStageWHumControl) {
SizingMethod = HVAC::CoolingCapacitySizing;
Copy link
Contributor

Choose a reason for hiding this comment

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

@Nigusse @rraustad Are these changes to DXCoils.cc supposed to be in this PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like cleaning up unused information. I guess this can be done here as long as diffs show only for HSPF calculations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. I did not make this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Nigusse @rraustad Are these changes to DXCoils.cc supposed to be in this PR?

I think, @Myoldmopar might have made sizing related cleanup.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, ok, I see that commit.

Copy link

github-actions bot commented Sep 7, 2024

⚠️ Regressions detected on macos-14 for commit f5b88e4

Regression Summary
  • EIO: 16
  • Table Big Diffs: 18

@mjwitte mjwitte removed their assignment Sep 9, 2024
@Myoldmopar
Copy link
Member

No conflicts here 🎉 , but I'll still pull develop in locally to check nothing broke with the big refactor that just merged.

@Myoldmopar
Copy link
Member

(
And if you ever see a failure like that

image

You should be able to just click the Details tab and choose to re run the Jobs on the right side:

image
)

Anyway, pulled and it's all happy, merging this in. Thanks for your patience @Nigusse

@Myoldmopar Myoldmopar merged commit 7e6ca23 into develop Sep 10, 2024
9 of 10 checks passed
@Myoldmopar Myoldmopar deleted the Issue9909_multispeed_DX_Htg_Coil_HSPF2 branch September 10, 2024 13:01
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