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 #10665 - HeatPump:AirToWater:FuelFired:Heating was not using Outside air temperatures to evaluate curves #10682

Merged
merged 4 commits into from
Sep 12, 2024

Conversation

jmarrec
Copy link
Contributor

@jmarrec jmarrec commented Aug 21, 2024

Pull request overview

Using PlantLoopHeatPump_Fuel-Fired.idf , before versus after, plotting the CAPCURVEFUNCTEMP2

image

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

```
[ RUN      ] EnergyPlusFixture.GAHP_AirSource_CurveEval
/home/julien/Software/Others/EnergyPlus2/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc:5650: Failure
Expected equality of these values:
  oaTemp
    Which is: 3
  oaTempforCurve
    Which is: 43.0859
/home/julien/Software/Others/EnergyPlus2/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc:5658: Failure
Expected equality of these values:
  oaTemp
    Which is: 3
  oaTempforCurve
    Which is: 43.0859
/home/julien/Software/Others/EnergyPlus2/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc:5664: Failure
Expected equality of these values:
  oaTemp
    Which is: 3
  oaTempforCurve
    Which is: 3.33333
/home/julien/Software/Others/EnergyPlus2/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc:5693: Failure
Expected equality of these values:
  oaTemp
    Which is: 3
  oaTempforCurve
    Which is: 43.0859
/home/julien/Software/Others/EnergyPlus2/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc:5701: Failure
Expected equality of these values:
  oaTemp
    Which is: 3
  oaTempforCurve
    Which is: 43.0859
/home/julien/Software/Others/EnergyPlus2/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc:5736: Failure
Expected equality of these values:
  oaWetbulb
    Which is: -4.36026
  oaTempforCurve
    Which is: 15.7288
/home/julien/Software/Others/EnergyPlus2/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc:5744: Failure
Expected equality of these values:
  oaWetbulb
    Which is: -4.36026
  oaTempforCurve
    Which is: 15.7288
/home/julien/Software/Others/EnergyPlus2/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc:5750: Failure
Expected equality of these values:
  oaWetbulb
    Which is: -4.36026
  oaTempforCurve
    Which is: 3.33333
/home/julien/Software/Others/EnergyPlus2/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc:5778: Failure
Expected equality of these values:
  oaWetbulb
    Which is: -4.36026
  oaTempforCurve
    Which is: 17.0828
/home/julien/Software/Others/EnergyPlus2/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc:5786: Failure
Expected equality of these values:
  oaWetbulb
    Which is: -4.36026
  oaTempforCurve
    Which is: 17.0828
[  FAILED  ] EnergyPlusFixture.GAHP_AirSource_CurveEval (900 ms)
```
@jmarrec jmarrec added Defect Includes code to repair a defect in EnergyPlus NotIDDChange Code does not impact IDD (can be merged after IO freeze) labels Aug 21, 2024
@jmarrec jmarrec requested a review from Myoldmopar August 21, 2024 17:17
@jmarrec jmarrec self-assigned this Aug 21, 2024
@jmarrec
Copy link
Contributor Author

jmarrec commented Aug 21, 2024

Now, I change the evaluation variables

image

image

Comment on lines +5403 to +5465
"HeatPump:AirToWater:FuelFired:Heating,",
" FuelFired GAHP Heating, !- Name",
" Node 3, !- Water Inlet Node Name",
" Node 7, !- Water Outlet Node Name",
" FuelFired GAHP Heating OA Node, !- Air Source Node Name",
" FuelFired GAHP Cooling, !- Companion Cooling Heat Pump Name",
" NaturalGas, !- Fuel Type",
" GAHP, !- End-Use Subcategory",
" 3000, !- Nominal Heating Capacity {W}",
" 1.5, !- Nominal COP {W/W}",
" 0.005, !- Design Flow Rate {m3/s}",
" 60, !- Design Supply Temperature {C}",
" 11.1, !- Design Temperature Lift {deltaC}",
" 1, !- Sizing Factor",
" NotModulated, !- Flow Mode",
" DryBulb, !- Outdoor Air Temperature Curve Input Variable",
" EnteringCondenser, !- Water Temperature Curve Input Variable",
" CapCurveFuncTemp, !- Normalized Capacity Function of Temperature Curve Name",
" EIRCurveFuncTemp, !- Fuel Energy Input Ratio Function of Temperature Curve Name",
" EIRCurveFuncPLR, !- Fuel Energy Input Ratio Function of PLR Curve Name",
" 0.1, !- Minimum Part Load Ratio",
" 1, !- Maximum Part Load Ratio",
" OnDemand, !- Defrost Control Type",
" 0, !- Defrost Operation Time Fraction",
" EIRDefrostFoTCurve, !- Fuel Energy Input Ratio Defrost Adjustment Curve Name",
" 0, !- Resistive Defrost Heater Capacity {W}",
" 5, !- Maximum Outdoor Dry-bulb Temperature for Defrost Operation {C}",
" CRFCurve, !- Cycling Ratio Factor Curve Name",
" 500, !- Nominal Auxiliary Electric Power {W}",
" auxElecEIRCurveFuncTempCurve, !- Auxiliary Electric Energy Input Ratio Function of Temperature Curve Name",
" auxElecEIRFoPLRCurve, !- Auxiliary Electric Energy Input Ratio Function of PLR Curve Name",
" 20; !- Standby Electric Power {W}",

"OutdoorAir:Node,",
" FuelFired GAHP Heating OA Node; !- Name",

"HeatPump:AirToWater:FuelFired:Cooling,",
" FuelFired GAHP Cooling, !- Name",
" FuelFired GAHP Cooling Water Inlet Node, !- Water Inlet Node Name",
" FuelFired GAHP Cooling Water Outlet Node, !- Water Outlet Node Name",
" FuelFired GAHP Cooling OA Node, !- Air Source Node Name",
" FuelFired GAHP Heating, !- Companion Heating Heat Pump Name",
" NaturalGas, !- Fuel Type",
" GAHP, !- End-Use Subcategory",
" 4000, !- Nominal Cooling Capacity {W}",
" 2, !- Nominal COP {W/W}",
" 0.006, !- Design Flow Rate {m3/s}",
" 7, !- Design Supply Temperature {C}",
" 11.1, !- Design Temperature Lift {deltaC}",
" 1, !- Sizing Factor",
" NotModulated, !- Flow Mode",
" DryBulb, !- Outdoor Air Temperature Curve Input Variable",
" EnteringEvaporator, !- Water Temperature Curve Input Variable",
" CapCurveFuncTemp, !- Normalized Capacity Function of Temperature Curve Name",
" EIRCurveFuncTemp, !- Fuel Energy Input Ratio Function of Temperature Curve Name",
" EIRCurveFuncPLR, !- Fuel Energy Input Ratio Function of PLR Curve Name",
" 0.1, !- Minimum Part Load Ratio",
" 1, !- Maximum Part Load Ratio",
" CRFCurve, !- Cycling Ratio Factor Curve Name",
" 500, !- Nominal Auxiliary Electric Power {W}",
" auxElecEIRCurveFuncTempCurve, !- Auxiliary Electric Energy Input Ratio Function of Temperature Curve Name",
" auxElecEIRFoPLRCurve, !- Auxiliary Electric Energy Input Ratio Function of PLR Curve Name",
" 20; !- Standby Electric Power {W}",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prepare a unit test with a HeatPump:AirToWater:FuelFired:Heating and HeatPump:AirToWater:FuelFired:Cooling object, having all curves defined.

Comment on lines +5623 to +5624
// This is not the case, even though the E+ I/O Documentation says it should
constexpr bool isLoadSideHeatTransferNegativeForCooling = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Side note...

Comment on lines +5626 to +5666
thisHeatingPLHP->onInitLoopEquip(*state, myHeatingLoadLocation);
{
EXPECT_ENUM_EQ(EIRFuelFiredHeatPump::OATempCurveVar::DryBulb, thisHeatingPLHP->oaTempCurveInputVar);
EXPECT_ENUM_EQ(EIRFuelFiredHeatPump::WaterTempCurveVar::EnteringCondenser, thisHeatingPLHP->waterTempCurveInputVar);

bool firstHVAC = true;
Real64 curLoad = 800;
bool runFlag = true;
Real64 const calculatedLoadInletTemp = specifiedLoadSetpoint - curLoad / (expectedLoadMassFlowRate * expectedCp);

state->dataLoopNodes->Node(thisHeatingPLHP->loadSideNodes.inlet).Temp = calculatedLoadInletTemp;
state->dataLoopNodes->Node(thisHeatingPLHP->loadSideNodes.outlet).TempSetPoint = specifiedLoadSetpoint;
state->dataLoopNodes->Node(thisHeatingPLHP->sourceSideNodes.inlet).Temp = oaTemp;

thisHeatingPLHP->simulate(*state, myHeatingLoadLocation, firstHVAC, curLoad, runFlag);
// expect it to meet setpoint and have some pre-evaluated conditions
// EXPECT_NEAR(specifiedLoadSetpoint, thisHeatingPLHP->loadSideOutletTemp, 0.001);
EXPECT_NEAR(curLoad, thisHeatingPLHP->loadSideHeatTransfer, 0.001);
{
ASSERT_GT(thisHeatingPLHP->capFuncTempCurveIndex, 0);
auto const *thisCurve = state->dataCurveManager->PerfCurve(thisHeatingPLHP->capFuncTempCurveIndex);
Real64 const waterTempforCurve = thisCurve->inputs[0];
Real64 const oaTempforCurve = thisCurve->inputs[1];
EXPECT_EQ(calculatedLoadInletTemp, waterTempforCurve);
EXPECT_EQ(oaTemp, oaTempforCurve);
}
{
ASSERT_GT(thisHeatingPLHP->powerRatioFuncTempCurveIndex, 0);
auto const *thisCurve = state->dataCurveManager->PerfCurve(thisHeatingPLHP->powerRatioFuncTempCurveIndex);
Real64 const waterTempforCurve = thisCurve->inputs[0];
Real64 const oaTempforCurve = thisCurve->inputs[1];
EXPECT_EQ(calculatedLoadInletTemp, waterTempforCurve);
EXPECT_EQ(oaTemp, oaTempforCurve);
}
{
ASSERT_GT(thisHeatingPLHP->defrostEIRCurveIndex, 0);
auto const *thisCurve = state->dataCurveManager->PerfCurve(thisHeatingPLHP->defrostEIRCurveIndex);
Real64 const oaTempforCurve = thisCurve->inputs[0];
EXPECT_EQ(oaTemp, oaTempforCurve);
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I'm going to do 4 calls to simulate:

  • For object in "Heating", "Cooling"
    • Simulate with Drybulb and Entering Condenser/Evaporator temperature
    • Simulate with Welbulb and Leaving Condenser/Evaporator temperature

For each of these, I check that the curves were evaluated with the proper conditions

@@ -2549,6 +2549,7 @@ void EIRFuelFiredHeatPump::doPhysics(EnergyPlusData &state, Real64 currentLoad)
// will not shut down the branch
auto &thisInletNode = state.dataLoopNodes->Node(this->loadSideNodes.inlet);
auto &thisOutletNode = state.dataLoopNodes->Node(this->loadSideNodes.outlet);
auto &thisSourceSideInletNode = state.dataLoopNodes->Node(this->sourceSideNodes.inlet); // OA Intake node
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Take a ref

@@ -2720,10 +2721,10 @@ void EIRFuelFiredHeatPump::doPhysics(EnergyPlusData &state, Real64 currentLoad)
// Determine which air variable to use for GAHP:
// Source (air) side variable to use
// auto &thisloadsideinletnode = state.dataLoopNodes->Node(this->loadSideNodes.inlet);
Real64 oaTempforCurve = thisInletNode.Temp; // state.dataLoopNodes->Node(this->loadSideNodes.inlet).Temp;
Real64 oaTempforCurve = this->sourceSideInletTemp; // state.dataLoopNodes->Node(this->loadSideNodes.inlet).Temp;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix one, for OA Drybulb

Comment on lines +2726 to +2727
oaTempforCurve = Psychrometrics::PsyTwbFnTdbWPb(
state, thisSourceSideInletNode.Temp, thisSourceSideInletNode.HumRat, thisSourceSideInletNode.Press, "PLFFHPEIR::doPhysics()");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix 2, If Wetbulb, evaluate it

Copy link
Contributor

@mjwitte mjwitte left a comment

Choose a reason for hiding this comment

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

Code changes look correct. Tested with modified example file, and can see the correct input temps for the curves.

Unit test GAHP_HeatingSimulate_AirSource_with_Defrost is failing.

Comment on lines +5470 to +5473
"Curve:Biquadratic,",
" CapCurveFuncTemp, !- Name",
" 1, !- Coefficient1 Constant",
" 0, !- Coefficient2 x",
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice if these curves actually computed a value instead of a constant 1.0. The constant fT curves in the example file explain why there are no diffs. That would be nice to change, but not sure where to get a reasonable set of curves.

@mjwitte
Copy link
Contributor

mjwitte commented Sep 9, 2024

Also, this applies to both the cooling and heating side of this heat pump.

@Myoldmopar
Copy link
Member

Unit test GAHP_HeatingSimulate_AirSource_with_Defrost is failing.

Thanks for looking this over and noticing the failing unit test. I'm assuming the unit test was simply using the wrong numbers and things are now more correct. I can make an attempt at fixing up the unit test to get this in unless @jmarrec wants to get it running.

@Myoldmopar Myoldmopar added this to the EnergyPlus 24.2 milestone Sep 11, 2024
@mjwitte
Copy link
Contributor

mjwitte commented Sep 11, 2024

@Myoldmopar @jmarrec The failing unit test needs updated results to align with this fix. Here's one of the parts that fails:

state->dataLoopNodes->Node(thisHeatingPLHP->loadSideNodes.outlet).TempSetPoint = specifiedLoadSetpoint;
state->dataLoopNodes->Node(thisHeatingPLHP->loadSideNodes.inlet).Temp = calculatedLoadInletTemp;
state->dataLoopNodes->Node(thisHeatingPLHP->sourceSideNodes.inlet).Temp = 30;
thisHeatingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag);
EXPECT_NEAR(19200.0, thisHeatingPLHP->fuelRate, 0.001);
EXPECT_NEAR(17280000.0, thisHeatingPLHP->fuelEnergy, 0.001);

If I set Node(thisHeatingPLHP->sourceSideNodes.inlet).Temp = calculatedLoadInletTemp; (to mimic the bug) then the test passes. I will push up a fix soon with updated numbers.

@mjwitte
Copy link
Contributor

mjwitte commented Sep 12, 2024

@Myoldmopar CI is green and happy here. In the merge queue.

@jmarrec
Copy link
Contributor Author

jmarrec commented Sep 12, 2024

Sorry I wasn't responsive, been swamped. Thanks a lot @mjwitte for updating the test!

@Myoldmopar
Copy link
Member

Yes indeed, thanks for fixing the test @mjwitte ! I'll pull develop and double check things.

@Myoldmopar
Copy link
Member

Yep still good here, thanks @jmarrec and @mjwitte, merging.

@Myoldmopar Myoldmopar merged commit b723d7b into develop Sep 12, 2024
10 checks passed
@Myoldmopar Myoldmopar deleted the 10665_GAHP_CurveEval branch September 12, 2024 16:22
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 NotIDDChange Code does not impact IDD (can be merged after IO freeze)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HeatPump:AirToWater:FuelFired:Heating curves not using two independent temperature variables
6 participants