Skip to content

Commit

Permalink
10065 Final Changes and Unit Tests
Browse files Browse the repository at this point in the history
This commit includes unit tests, a couple of fixes to the code that the unit tests uncovered, and some code simplification.  This is PR candidate.
  • Loading branch information
RKStrand committed Jul 30, 2024
1 parent a71222b commit 3141020
Show file tree
Hide file tree
Showing 4 changed files with 430 additions and 22 deletions.
10 changes: 7 additions & 3 deletions design/FY2024/chiller_heater_part_load_fix.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DEFECT: Fix for Chiller Heater Always Assuming Evaporator is at Full Load
**Rick Strand, University of Illinois at Urbana-Champaign**

- Original Date: July 22, 2024
- Revision Date
- Revision Date: July 30, 2024


## Justification for New Feature ##
Expand All @@ -13,7 +13,7 @@ The current heater mode portion of the chiller heater model in PlantCentralGSHP.

## E-mail and Conference Call Conclusions ##

This is the first time this will be discussed via email or in a Technicalities Call.
July 24, 2024: Discussed this on the technicalities call. Decision was made to not implement an iteration strategy but to simply make an approximation of the PLR from the condenser load and then multiple full load evaporator load, compressor power, and false loading by that PLR. Not ideal, but given all of the suspected problems in this model, it was decided to not invest too heavily in this now and turn this into a potential development topic in the future.

## Overview ##

Expand All @@ -23,7 +23,7 @@ The simlation flow in the heater portion of the model is summarized as follows.

The problem here is that the evaporator load and the compressor power are still at full load and are never adjusted when the condenser load gets reduced because the heating load does not require full load. This is the source of the error--evaporator load and compressor power never change in heating mode regardless of the actual part load ratio based on the condenser load. PLR simply stays at near 100%. This is not correct and leads to over-estimation of both the evaporator load and the compressor power consumption.

## Approach ##
## Original Approach ##

Note: before the actual fix takes place, it was decided to make a code improvement pass through the current chiller heater model. This has already taken place and has been merged into develop. The point was to make the code re-usable within the chiller heater model but it also realized some improvements in the cooling mode subroutine as well. The changes took several different code sections and turned them into smaller subroutines. The heating mode code is now much easier to follow, reducing the size of the routine by a factor of more than 3 (based on printouts of the routine before and after restructuring). The real benefit will be seen when the problem is fixed as the algorithm should stay fairly compact and easy to follow (hopefully).

Expand Down Expand Up @@ -68,6 +68,10 @@ Step 8: Call adjustChillerHeaterFlowTemp to adjust flow rate and temperature if

At this point, a new QCondenser has been calculated so the iteration cycle is done. No additional code is needed after the iteration cycle as it should just be able to pick up where it left off as it currently does.

## Modified Approach ##

During the technicalities call, it was suggested that rather than iterating, we should just approximate the PLR from the condenser load and then multiply evaporator load and compressor power by this PLR. The false load was also factored in this way though in this case it was probably zero at full load anyway. Other problems in the algorithm were also fixed along the way. No guarantees that this model is now 100% bug free but it should be improved.

## Testing/Validation/Data Sources ##

Testing will be done using the existing user input file that shows the problem. Comparisons will be made between develop and the new version to establish that the results have changed after the fix has been implemented and that the new output makes sense.
Expand Down
33 changes: 15 additions & 18 deletions src/EnergyPlus/PlantCentralGSHP.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2692,7 +2692,7 @@ void WrapperSpecs::checkEvapOutletTemp(EnergyPlusData &state,
Real64 const lowTempLimitEout,
Real64 const evapInletTemp,
Real64 &qEvaporator,
Real64 &evapMassFlowRate,
Real64 const evapMassFlowRate,
Real64 const Cp)
{
// Check evaporator temperature low limit and adjust capacity if needed
Expand All @@ -2709,10 +2709,9 @@ void WrapperSpecs::checkEvapOutletTemp(EnergyPlusData &state,

// Check if the outlet temperature exceeds the node minimum temperature and adjust capacity if needed
if (evapOutletTemp < this->ChillerHeater(numChillerHeater).EvapOutletNode.TempMin) {
if ((this->ChillerHeater(numChillerHeater).EvapInletNode.Temp - this->ChillerHeater(numChillerHeater).EvapOutletNode.TempMin) >
DataPlant::DeltaTempTol) {
if ((evapInletTemp - this->ChillerHeater(numChillerHeater).EvapOutletNode.TempMin) > DataPlant::DeltaTempTol) {
evapOutletTemp = this->ChillerHeater(numChillerHeater).EvapOutletNode.TempMin;
Real64 evapDeltaTemp = this->ChillerHeater(numChillerHeater).EvapOutletNode.TempMin - evapOutletTemp;
Real64 evapDeltaTemp = evapInletTemp - evapOutletTemp;
qEvaporator = evapMassFlowRate * Cp * evapDeltaTemp;
} else {
qEvaporator = 0.0;
Expand All @@ -2730,29 +2729,27 @@ void WrapperSpecs::calcPLRAndCyclingRatio(EnergyPlusData &state,
Real64 &frac)
{
// Calculate PLR (actualPartLoadRatio) based on evaporator load and available capacity, factoring in max PLR
if (availChillerCap > 0.0) {
actualPartLoadRatio = max(0.0, min((qEvaporator / availChillerCap), maxPartLoadRatio));
if (availChillerCap <= 0.0) {
actualPartLoadRatio = 0;
frac = 1.0;
} else {
actualPartLoadRatio = 0.0;
actualPartLoadRatio = max(0.0, min((qEvaporator / availChillerCap), maxPartLoadRatio));
// If chiller cycles below minimum part load ratio, frac = amount of time chiller is ON during this time step
if (minPartLoadRatio > 0.0) {
frac = min(1.0, (actualPartLoadRatio / minPartLoadRatio));
} else {
frac = 1.0;
}
actualPartLoadRatio = max(actualPartLoadRatio, minPartLoadRatio);
}

// Chiller cycles below minimum part load ratio, frac = amount of time chiller is ON during this time step
if (actualPartLoadRatio < minPartLoadRatio) frac = min(1.0, (actualPartLoadRatio / minPartLoadRatio));
if (frac <= 0.0) frac = 1.0; // CR 9303 COP reporting issue, it should be greater than zero in this routine
state.dataPlantCentralGSHP->ChillerCyclingRatio = frac;

// Chiller is false loading below PLR = minimum unloading ratio, find PLR used for energy calculation
if (availChillerCap > 0.0) {
actualPartLoadRatio = max(actualPartLoadRatio, minPartLoadRatio);
} else {
actualPartLoadRatio = 0.0;
}

// Evaporator part load ratio
state.dataPlantCentralGSHP->ChillerPartLoadRatio = actualPartLoadRatio;

// Calculate the load due to false loading on chiller over and above water side load
state.dataPlantCentralGSHP->ChillerFalseLoadRate = (availChillerCap * actualPartLoadRatio * frac) - qEvaporator;
state.dataPlantCentralGSHP->ChillerFalseLoadRate = (availChillerCap * minPartLoadRatio) - qEvaporator;
if (state.dataPlantCentralGSHP->ChillerFalseLoadRate < HVAC::SmallLoad) {
state.dataPlantCentralGSHP->ChillerFalseLoadRate = 0.0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/PlantCentralGSHP.hh
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ namespace PlantCentralGSHP {
Real64 const lowTempLimitEout,
Real64 evapInletTemp,
Real64 &qEvaporator,
Real64 &evapMassFlowRate,
Real64 const evapMassFlowRate,
Real64 const Cp);

void calcPLRAndCyclingRatio(EnergyPlusData &state,
Expand Down
Loading

5 comments on commit 3141020

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

10065ChillerHeaterFix (RKStrand) - Win64-Windows-10-VisualStudio-16: OK (2867 of 2867 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

10065ChillerHeaterFix (RKStrand) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3698 of 3700 tests passed, 0 test warnings)

Messages:\n

  • 2 tests had: EIO diffs.
  • 2 tests had: ESO big diffs.
  • 2 tests had: MTR big diffs.
  • 2 tests had: Table big diffs.
  • 2 tests had: Table string diffs.

Failures:\n

regression Test Summary

  • Passed: 809
  • Failed: 2

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

10065ChillerHeaterFix (RKStrand) - x86_64-MacOS-10.18-clang-15.0.0: OK (3657 of 3659 tests passed, 0 test warnings)

Messages:\n

  • 2 tests had: EIO diffs.
  • 2 tests had: ESO big diffs.
  • 2 tests had: MTR big diffs.
  • 2 tests had: Table big diffs.
  • 2 tests had: Table string diffs.

Failures:\n

regression Test Summary

  • Passed: 789
  • Failed: 2

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

10065ChillerHeaterFix (RKStrand) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (2075 of 2075 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

10065ChillerHeaterFix (RKStrand) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (795 of 795 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.