Skip to content

Commit

Permalink
ChillerReformulatedEIR remove flowlock
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwitte committed Oct 15, 2024
1 parent 08a5f61 commit 0b330e4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 39 deletions.
55 changes: 18 additions & 37 deletions src/EnergyPlus/ChillerReformulatedEIR.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2102,14 +2102,11 @@ void ReformulatedEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoa
// if the component control is SERIESACTIVE we set the component flow to inlet flow so that
// flow resolver will not shut down the branch
if (MyLoad >= 0 || !RunFlag) {
if (this->EquipFlowCtrl == DataBranchAirLoopPlant::ControlType::SeriesActive ||
state.dataPlnt->PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock == DataPlant::FlowLock::Locked) {
this->EvapMassFlowRate = state.dataLoopNodes->Node(this->EvapInletNodeNum).MassFlowRate;
}
this->EvapMassFlowRate = 0.0;
PlantUtilities::SetComponentFlowRate(state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc);
if (this->CondenserType == DataPlant::CondenserType::WaterCooled) {
if (DataPlant::CompData::getPlantComponent(state, this->CDPlantLoc).FlowCtrl == DataBranchAirLoopPlant::ControlType::SeriesActive) {
this->CondMassFlowRate = state.dataLoopNodes->Node(this->CondInletNodeNum).MassFlowRate;
}
this->CondMassFlowRate = 0.0;
PlantUtilities::SetComponentFlowRate(state, this->CondMassFlowRate, this->CondInletNodeNum, this->CondOutletNodeNum, this->CDPlantLoc);
}

return;
Expand Down Expand Up @@ -2251,9 +2248,7 @@ void ReformulatedEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoa
// Set evaporator heat transfer rate
this->QEvaporator = AvailChillerCap * PartLoadRat;
this->ChillerPartLoadRatio = PartLoadRat;
// If FlowLock is False (0), the chiller sets the plant loop mdot
// If FlowLock is True (1), the new resolved plant loop mdot is used
if (state.dataPlnt->PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock == DataPlant::FlowLock::Unlocked) {
{ // Old flowlock false section
this->PossibleSubcooling = !(state.dataPlnt->PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).CurOpSchemeType ==
DataPlant::OpScheme::CompSetPtBased);

Expand Down Expand Up @@ -2356,16 +2351,13 @@ void ReformulatedEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoa
this->ChillerPartLoadRatio = PartLoadRat;
}

} else { // If FlowLock is True
this->EvapMassFlowRate = state.dataLoopNodes->Node(this->EvapInletNodeNum).MassFlowRate;
PlantUtilities::SetComponentFlowRate(state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc);
// Old flowlock true section
// Some other component set the flow to 0. No reason to continue with calculations.
if (this->EvapMassFlowRate == 0.0) {
MyLoad = 0.0;
return;
}

Real64 EvapDeltaTemp;
if (this->PossibleSubcooling) {
this->QEvaporator = std::abs(MyLoad);
EvapDeltaTemp = this->QEvaporator / this->EvapMassFlowRate / Cp;
Expand Down Expand Up @@ -2464,8 +2456,7 @@ void ReformulatedEIRChillerSpecs::calculate(EnergyPlusData &state, Real64 &MyLoa
if (this->ChillerFalseLoadRate < HVAC::SmallLoad) {
this->ChillerFalseLoadRate = 0.0;
}

} // This is the end of the FlowLock Block
} // end of old flowlock sections

// set the module level variable used for reporting FRAC
this->ChillerCyclingRatio = FRAC;
Expand Down Expand Up @@ -2595,14 +2586,7 @@ void ReformulatedEIRChillerSpecs::checkMinMaxCurveBoundaries(EnergyPlusData &sta
// To compare the evaporator/condenser outlet temperatures to curve object min/max values

// Do not print out warnings if chiller not operating or FirstIteration/WarmupFlag/FlowLock
int PlantLoopNum = this->CWPlantLoc.loopNum;
DataPlant::LoopSideLocation LoopSideNum = this->CWPlantLoc.loopSideNum;
int BranchNum = this->CWPlantLoc.branchNum;
int CompNum = this->CWPlantLoc.compNum;

if (FirstIteration || state.dataGlobal->WarmupFlag ||
state.dataPlnt->PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock == DataPlant::FlowLock::Unlocked)
return;
if (FirstIteration || !PlantUtilities::okToIssueWarning(state, this->CWPlantLoc)) return;

// Minimum evaporator leaving temperature allowed by CAPFT curve [C]
Real64 CAPFTXTmin = this->ChillerCAPFTXTempMin;
Expand Down Expand Up @@ -2822,6 +2806,10 @@ void ReformulatedEIRChillerSpecs::checkMinMaxCurveBoundaries(EnergyPlusData &sta

Real64 EvapOutletTempSetPoint(0.0); // Evaporator outlet temperature setpoint [C]

int PlantLoopNum = this->CWPlantLoc.loopNum;
DataPlant::LoopSideLocation LoopSideNum = this->CWPlantLoc.loopSideNum;
int BranchNum = this->CWPlantLoc.branchNum;
int CompNum = this->CWPlantLoc.compNum;
switch (state.dataPlnt->PlantLoop(PlantLoopNum).LoopDemandCalcScheme) {
case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
if ((this->FlowMode == DataPlant::FlowMode::LeavingSetpointModulated) ||
Expand Down Expand Up @@ -2853,8 +2841,7 @@ void ReformulatedEIRChillerSpecs::checkMinMaxCurveBoundaries(EnergyPlusData &sta
this->ChillerCapFT = Curve::CurveValue(state, this->ChillerCapFTIndex, EvapOutletTempSetPoint, this->CondOutletTemp);

if (this->ChillerCapFT < 0) {
if (this->ChillerCapFTError < 1 && state.dataPlnt->PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock != DataPlant::FlowLock::Unlocked &&
!state.dataGlobal->WarmupFlag) {
if (this->ChillerCapFTError < 1) {
++this->ChillerCapFTError;
ShowWarningError(state, format("CHILLER:ELECTRIC:REFORMULATEDEIR \"{}\":", this->Name));
ShowContinueError(state, format(" Chiller Capacity as a Function of Temperature curve output is negative ({:.3R}).", this->ChillerCapFT));
Expand All @@ -2863,8 +2850,7 @@ void ReformulatedEIRChillerSpecs::checkMinMaxCurveBoundaries(EnergyPlusData &sta
EvapOutletTempSetPoint,
this->CondOutletTemp));
ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation.");
} else if (state.dataPlnt->PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock != DataPlant::FlowLock::Unlocked &&
!state.dataGlobal->WarmupFlag) {
} else {
++this->ChillerCapFTError;
ShowRecurringWarningErrorAtEnd(state,
"CHILLER:ELECTRIC:REFORMULATEDEIR \"" + this->Name +
Expand All @@ -2878,8 +2864,7 @@ void ReformulatedEIRChillerSpecs::checkMinMaxCurveBoundaries(EnergyPlusData &sta
this->ChillerEIRFT = Curve::CurveValue(state, this->ChillerEIRFTIndex, this->EvapOutletTemp, this->CondOutletTemp);

if (this->ChillerEIRFT < 0.0) {
if (this->ChillerEIRFTError < 1 && state.dataPlnt->PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock != DataPlant::FlowLock::Unlocked &&
!state.dataGlobal->WarmupFlag) {
if (this->ChillerEIRFTError < 1) {
++this->ChillerEIRFTError;
ShowWarningError(state, format("CHILLER:ELECTRIC:REFORMULATEDEIR \"{}\":", this->Name));
ShowContinueError(
Expand All @@ -2889,8 +2874,7 @@ void ReformulatedEIRChillerSpecs::checkMinMaxCurveBoundaries(EnergyPlusData &sta
this->EvapOutletTemp,
this->CondOutletTemp));
ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation.");
} else if (state.dataPlnt->PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock != DataPlant::FlowLock::Unlocked &&
!state.dataGlobal->WarmupFlag) {
} else {
++this->ChillerEIRFTError;
ShowRecurringWarningErrorAtEnd(state,
"CHILLER:ELECTRIC:REFORMULATEDEIR \"" + this->Name +
Expand Down Expand Up @@ -2926,9 +2910,7 @@ void ReformulatedEIRChillerSpecs::checkMinMaxCurveBoundaries(EnergyPlusData &sta
}

if (this->ChillerEIRFPLR < 0.0) {
if (this->ChillerEIRFPLRError < 1 &&
state.dataPlnt->PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock != DataPlant::FlowLock::Unlocked &&
!state.dataGlobal->WarmupFlag) {
if (this->ChillerEIRFPLRError < 1) {
++this->ChillerEIRFPLRError;
ShowWarningError(state, format("CHILLER:ELECTRIC:REFORMULATEDEIR \"{}\":", this->Name));
ShowContinueError(
Expand All @@ -2939,8 +2921,7 @@ void ReformulatedEIRChillerSpecs::checkMinMaxCurveBoundaries(EnergyPlusData &sta
this->ChillerPartLoadRatio,
this->CondOutletTemp));
ShowContinueErrorTimeStamp(state, " Resetting curve output to zero and continuing simulation.");
} else if (state.dataPlnt->PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).FlowLock != DataPlant::FlowLock::Unlocked &&
!state.dataGlobal->WarmupFlag) {
} else {
++this->ChillerEIRFPLRError;
ShowRecurringWarningErrorAtEnd(state,
"CHILLER:ELECTRIC:REFORMULATEDEIR \"" + this->Name +
Expand Down
4 changes: 2 additions & 2 deletions tst/EnergyPlus/unit/ChillerReformulatedEIR.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ TEST_F(EnergyPlusFixture, ChillerElectricReformulatedEIR_WaterCooledChillerVaria
" DummyEIRfT, !- Electric Input to Cooling Output Ratio Function of Temperature Curve Name",
" LeavingCondenserWaterTemperature, !- Electric Input to Cooling Output Ratio Function of Part Load Ratio Curve Type",
" DummyEIRfPLR, !- Electric Input to Cooling Output Ratio Function of Part Load Ratio Curve Name",
" 0.10, !- Minimum Part Load Ratio",
" 0.01, !- Minimum Part Load Ratio",
" 1.00, !- Maximum Part Load Ratio",
" 1.00, !- Optimum Part Load Ratio",
" 0.25, !- Minimum Unloading Ratio",
" 0.01, !- Minimum Unloading Ratio",
" CHW Inlet Node, !- Chilled Water Inlet Node Name",
" CHW Outlet Node, !- Chilled Water Outlet Node Name",
" Condenser Inlet Node, !- Condenser Inlet Node Name",
Expand Down

4 comments on commit 0b330e4

@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.

flowlock1 (mjwitte) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (2916 of 2916 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

flowlock1 (mjwitte) - Win64-Windows-10-VisualStudio-16: OK (2894 of 2894 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.

flowlock1 (mjwitte) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-RelWithDebInfo: OK (2098 of 2098 tests passed, 0 test warnings)

Build Badge Test Badge Coverage 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.

flowlock1 (mjwitte) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-RelWithDebInfo: OK (801 of 801 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.