Skip to content

Conversation

@lymereJ
Copy link
Collaborator

@lymereJ lymereJ commented Sep 27, 2023

Pull request overview

#7702 provided a fix for the original defect file from #7464 by increasing the upper bound used to solve for the range to determine the outlet water temperature of the tower. Tests have shown that increasing further the upper bound would solve the issue for the new defect file, however, it might still not be a solution that is general enough . The proposed changes include a variable upper bound in order to avoid this type of error before calling regula falsi.

A warning (and recurring as well) was added to identify instances where no outlet temperature control is attempted due potential bad intervals passed to regula falsi.

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

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

…ases where the tower does no outlet temperature control but run the fan at full speed.
@lymereJ lymereJ added the Defect Includes code to repair a defect in EnergyPlus label Sep 27, 2023
@lymereJ
Copy link
Collaborator Author

lymereJ commented Sep 27, 2023

Results for the defect file:

image

With the proposed changes:

image

The figure shows that the cooling tower is now meeting the setpoint.

@lymereJ
Copy link
Collaborator Author

lymereJ commented Sep 27, 2023

The proposed changes have a large impact on the heat rejection energy use because the tower is now running appropriately.

Current:
image

Proposed changes:
image

In the current case, the tower is running more because the following code snippet sets the airflow ratio, attempts to calculate the outlet and if the outlet is greater than the setpoint it assumes that the unit is running at full capacity, however, if the combination of lower and upper bound passed to regula falsi lead to a returned value of -2 the outlet water temperature is not actually controlled (i.e. not calculated) so the tower energy use is overestimated.

this->airFlowRateRatio = 1.0;
OutletWaterTempOFF = state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp;
this->OutletWaterTemp = OutletWaterTempOFF;
FreeConvectionCapFrac = this->FreeConvectionCapacityFraction;
OutletWaterTempON = this->calculateVariableTowerOutletTemp(state, WaterFlowRateRatioCapped, this->airFlowRateRatio, TwbCapped);
if (OutletWaterTempON > TempSetPoint) {
this->FanCyclingRatio = 1.0;
this->airFlowRateRatio = 1.0;
this->FanPower = this->HighSpeedFanPower * this->NumCellOn / this->NumCell;
this->OutletWaterTemp = OutletWaterTempON;
// if possible increase the number of cells and do the calculations again with the new water mass flow rate per cell
if (this->NumCellOn < this->NumCell && (this->WaterMassFlowRate / (this->NumCellOn + 1)) > WaterMassFlowRatePerCellMin) {
++this->NumCellOn;
WaterMassFlowRatePerCell = this->WaterMassFlowRate / this->NumCellOn;
IncrNumCellFlag = true;
}
}
}
// find the correct air ratio only if full flow is too much
if (OutletWaterTempON < TempSetPoint) {

@lymereJ lymereJ marked this pull request as draft September 27, 2023 23:43
@lymereJ
Copy link
Collaborator Author

lymereJ commented Sep 27, 2023

The defect file uses the YorkCalc model results using the CoolToolsCrossFlow model are the same before and after the fix but are more in part with the new results for the YorkCalc model:

image

@lymereJ lymereJ requested review from Nigusse and mjwitte September 28, 2023 00:01
@rraustad
Copy link
Contributor

rraustad commented Sep 28, 2023

So if the SP is 30C, why is the tower outlet temp now showing 32.2C?

Schedule:Day:Interval,
    New HP-Loop-Temp-Schedule 2 All Days,  !- Name
    Temperature 44,          !- Schedule Type Limits Name
    No,                      !- Interpolate to Timestep
    24:00,                   !- Time 1 {hh:mm}
    30;                      !- Value Until Time 1

I don't see anything in the tower inputs that would explain that. But a new loop on range temp may be influencing the results? But then I do see a min range (1.11) and approach (1.11) temperature that would explain that (30 + 2.22 = 32.22)? Too hard to know how these inputs affect results without spending a lot of time with this model.
And on that note, how do these inputs relate to what is happening now with a dynamic range temperature?

CoolingTowerPerformance:YorkCalc,
    YorkCalc Default Tower Model,  !- Name
    -34.4,                   !- Minimum Inlet Air Wet-Bulb Temperature {C}
    26.6667,                 !- Maximum Inlet Air Wet-Bulb Temperature {C}
    1.1111,                  !- Minimum Range Temperature {deltaC}
    22.2222,                 !- Maximum Range Temperature {deltaC}
    1.1111,                  !- Minimum Approach Temperature {deltaC}
    40.0,                    !- Maximum Approach Temperature {deltaC}

@rraustad
Copy link
Contributor

What energy results from a single-speed and two-speed tower? Those results could be compared to these.

@lymereJ
Copy link
Collaborator Author

lymereJ commented Sep 28, 2023

So if the SP is 30C, why is the tower outlet temp now showing 32.2C?

Schedule:Day:Interval,
    New HP-Loop-Temp-Schedule 2 All Days,  !- Name
    Temperature 44,          !- Schedule Type Limits Name
    No,                      !- Interpolate to Timestep
    24:00,                   !- Time 1 {hh:mm}
    30;                      !- Value Until Time 1

I don't see anything in the tower inputs that would explain that. But a new loop on range temp may be influencing the results? But then I do see a min range (1.11) and approach (1.11) temperature that would explain that (30 + 2.22 = 30.22)? Too hard to know how these inputs affect results without spending a lot of time with this model. And on that note, how do these inputs relate to what is happening now with a dynamic range temperature?

CoolingTowerPerformance:YorkCalc,
    YorkCalc Default Tower Model,  !- Name
    -34.4,                   !- Minimum Inlet Air Wet-Bulb Temperature {C}
    26.6667,                 !- Maximum Inlet Air Wet-Bulb Temperature {C}
    1.1111,                  !- Minimum Range Temperature {deltaC}
    22.2222,                 !- Maximum Range Temperature {deltaC}
    1.1111,                  !- Minimum Approach Temperature {deltaC}
    40.0,                    !- Maximum Approach Temperature {deltaC}

That schedule is not in the defect file. The defect file uses 32.22.

  Schedule:Day:Interval,
    Min Max Temp w Deadband Max-90.0C Day,  !- Name
    Min Max Temp w Deadband Max-90.0C Limits,  !- Schedule Type Limits Name
    No,                      !- Interpolate to Timestep
    24:00,                   !- Time 1
    32.22;                   !- Value Until Time 1

@lymereJ
Copy link
Collaborator Author

lymereJ commented Sep 28, 2023

What energy results from a single-speed and two-speed tower? Those results could be compared to these.

I have results for the variable speed Merkel model but I'll generate these as well.

@rraustad
Copy link
Contributor

OK, I am looking at in-moreoutput-2xTower.idf from #7464. Now I see there is defect_file.zip which I assume you are using. Good, that answers the SP issue.

@lymereJ
Copy link
Collaborator Author

lymereJ commented Sep 28, 2023

What energy results from a single-speed and two-speed tower? Those results could be compared to these.

I have results for the variable speed Merkel model but I'll generate these as well.

Here are the results for the other models:

Single speed:
image

Two speed (Merkel):
image

Variable speed (Merkel):
image

So the current case (YorkCalc model) would perform worse than the single speed tower. The results for the variable speed merkel model are in par with the YorkCalc and CoolToolsCrossFlow.

@rraustad
Copy link
Contributor

rraustad commented Sep 28, 2023

So with cooling energy roughly the same at 280 GJ, the difference in Heat Rejection is due to a reduction in fan/pump power. This trend (heat rejection energy falling as tower speeds increase) should provide a good basis to validate all tower models. Now the results of this branch make more sense.

@lymereJ lymereJ marked this pull request as ready for review September 28, 2023 18:29
@lymereJ lymereJ added the DoNotMerge Code that requires additional attention and investigation label Sep 29, 2023
@lymereJ lymereJ marked this pull request as draft September 29, 2023 00:26
@lymereJ lymereJ removed the DoNotMerge Code that requires additional attention and investigation label Oct 2, 2023
@nrel-bot-3
Copy link

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

4 similar comments
@nrel-bot-2
Copy link

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

@nrel-bot-2
Copy link

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

@nrel-bot
Copy link

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

@nrel-bot
Copy link

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

@Myoldmopar Myoldmopar added this to the EnergyPlus 24.2 milestone Mar 14, 2024
@nrel-bot
Copy link

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

1 similar comment
@nrel-bot-2b
Copy link

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

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 of the changes.

Comment on lines +2352 to +2365
SetupOutputVariable(state,
"Cooling Tower Approach",
Constant::Units::C,
this->coolingTowerApproach,
OutputProcessor::TimeStepType::System,
OutputProcessor::StoreType::Average,
this->Name);
SetupOutputVariable(state,
"Cooling Tower Range",
Constant::Units::C,
this->coolingTowerRange,
OutputProcessor::TimeStepType::System,
OutputProcessor::StoreType::Average,
this->Name);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Add range and approach as outputs for all cooling tower objects.

Copy link
Member

Choose a reason for hiding this comment

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

Looks good.


Real64 OutletWaterTempLocal = this->WaterTemp - Tr;
// calculate outlet temperature
Real64 outletWaterTempLocal = this->WaterTemp - min(Tr, this->MaxRangeTemp);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Make sure that the range doesn't exceeds the model's maximum range.

Comment on lines +5863 to +5885
} else if (SolFla == -2) {
// bad starting value means that solution corresponds to a range that is beyond
// the bounds of the model; The maximum range is used here
outletWaterTempLocal = this->WaterTemp - this->MaxRangeTemp;
++this->VSErrorCountTRCalc;
if (this->VSErrorCountTRCalc < 2) {
ShowWarningError(
state,
format("The range for the cooling tower {} likely exceeds the bounds of the model. The maximum range of the model is used {}.",
this->Name,
this->MaxRangeTemp));
ShowContinueError(state,
format(" ... Occurrence info = {}, {} {}",
state.dataEnvrn->EnvironmentName,
state.dataEnvrn->CurMnDy,
General::CreateSysTimeIntervalString(state)));
} else {
ShowRecurringWarningErrorAtEnd(
state,
format("The range for the cooling tower {} likely exceeds the bounds of the model. The maximum range of the model is used {}",
this->Name,
this->MaxRangeTemp),
this->ErrIndexTRCalc);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Previously, if a "bad starting value" error was returned by Regula Falsi (SolFla == -2, i.e., both the output for the function for the lower and upper bounds are of the same sign), the outlet temperature was only recalculated if the inlet temperature minus the range were greater than the setpoint. As described in the issue, this occurs for the YorkCalc model. Looking at that model closer shows that this typically occurs when the range returned by the model is significantly greater than the maximum range. In the first figure below, the solution is a range of about 63 deg. C which is way beyond the limit of the model (22.2222).

Inlet water temperature: 38.75 deg. C; Wet-bulb temperature: 15.4 deg. C; Flow ratio: 2
image

Varying wet-bulb temperature
image

Varying air flow ratio
image

Varying water flow ratio
image

Increasing further the upper bound used with Regula Falsi works but doesn't make sense since the solutions are outside the limits of the model. The proposed changes apply the maximum range every time SolFla == 2. As shown in the simulation results above, this approach leads to the correct control of the outlet of the tower and reasonable fan power unlike the status quo.

Currently, when the outlet is not recalculated, no warning is issued, The proposed changes include a (recurring) warning every time this happens.

VSTower.calculateVariableSpeedTower(*state);
EXPECT_DOUBLE_EQ(30.0, VSTower.OutletWaterTemp);
EXPECT_NEAR(0.5213, VSTower.FanCyclingRatio, 0.0001);
EXPECT_NEAR(0.5424, VSTower.FanCyclingRatio, 0.0001);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This change to an existing test was necessary because prior to the proposed changes the range used in CoolingTower::calculateVariableTowerOutletTemp was not capped to the maximum range for a selected model which lead to this test using a range greater than the maximum, see screenshot below.

justification_mod_test

Copy link
Member

Choose a reason for hiding this comment

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

Interesting. And makes sense.

EXPECT_EQ(vSpdMerkel_tower.HeatRejectCapNomCapSizingRatio, 1.25);
}

TEST_F(EnergyPlusFixture, CondenserLoopTowers_CalculateVariableTowerOutletTemp)
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 for defect.

@lymereJ
Copy link
Collaborator Author

lymereJ commented May 6, 2024

The RDD/AUD diffs are due to the new outputs. Most ERR files are due to the new warning. The two EIO diffs are very small convergence value changes. The ESO files diffs appears very small.

@lymereJ lymereJ marked this pull request as ready for review May 6, 2024 18:59
@Myoldmopar
Copy link
Member

CI results do look OK based on the intended changes. I'm building and testing locally and looking over the changes now.

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.

No major red flags here, I think this is good to go in.

Comment on lines +2352 to +2365
SetupOutputVariable(state,
"Cooling Tower Approach",
Constant::Units::C,
this->coolingTowerApproach,
OutputProcessor::TimeStepType::System,
OutputProcessor::StoreType::Average,
this->Name);
SetupOutputVariable(state,
"Cooling Tower Range",
Constant::Units::C,
this->coolingTowerRange,
OutputProcessor::TimeStepType::System,
OutputProcessor::StoreType::Average,
this->Name);
Copy link
Member

Choose a reason for hiding this comment

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

Looks good.

VSTower.calculateVariableSpeedTower(*state);
EXPECT_DOUBLE_EQ(30.0, VSTower.OutletWaterTemp);
EXPECT_NEAR(0.5213, VSTower.FanCyclingRatio, 0.0001);
EXPECT_NEAR(0.5424, VSTower.FanCyclingRatio, 0.0001);
Copy link
Member

Choose a reason for hiding this comment

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

Interesting. And makes sense.

@Myoldmopar
Copy link
Member

@rraustad these changes seem fine, let me know soon if you want anything else done here, otherwise I'll merge.

@rraustad
Copy link
Contributor

rraustad commented May 8, 2024

I'm good.

@Myoldmopar
Copy link
Member

I'm good.

Thanks @rraustad , I'm going to merge this then. Thanks @lymereJ

@Myoldmopar Myoldmopar merged commit 4d39dff into develop May 8, 2024
@Myoldmopar Myoldmopar deleted the clgtwr_ext_rng branch May 8, 2024 17:29
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.

CoolingTower:VariableSpeed control problems

9 participants