Skip to content

Commit

Permalink
Avoid unnecessary calls to same supervisor managing multiple plants
Browse files Browse the repository at this point in the history
  • Loading branch information
rraustad committed Aug 4, 2023
1 parent 010b367 commit b2cbba5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/EnergyPlus/Plant/EquipAndOperations.hh
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ struct ChillerHeaterSupervisoryOperationData
std::string DedicatedHR_HWRetControl_Name;

bool oneTimeSetupComplete = false;
bool needsSimulation = false;
DataPlant::OpScheme Type = DataPlant::OpScheme::Invalid; // Op scheme type (from keyword)

TempSetpoint Setpoint;
Expand Down
16 changes: 14 additions & 2 deletions src/EnergyPlus/PlantCondLoopOperation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2870,6 +2870,10 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration)
}
}
}
// set sim flag so each supervisor is only simulated once in the plant loop below
for (DataPlant::ChillerHeaterSupervisoryOperationData &supervisor : state.dataPlantCondLoopOp->ChillerHeaterSupervisoryOperationSchemes) {
supervisor.needsSimulation = true;
}
// Update the OpScheme schedules
for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
FoundScheme = false;
Expand All @@ -2878,8 +2882,10 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration)
auto &this_op_scheme = this_loop.OpScheme(OpNum);

if (this_op_scheme.Type == OpScheme::ChillerHeaterSupervisory) {
if (this_op_scheme.ChillerHeaterSupervisoryOperation != nullptr) {
if (this_op_scheme.ChillerHeaterSupervisoryOperation != nullptr &&
this_op_scheme.ChillerHeaterSupervisoryOperation->needsSimulation) {
this_op_scheme.ChillerHeaterSupervisoryOperation->EvaluateChillerHeaterChangeoverOpScheme(state);
this_op_scheme.ChillerHeaterSupervisoryOperation->needsSimulation = false;
}
continue;
}
Expand Down Expand Up @@ -2933,13 +2939,19 @@ void InitLoadDistribution(EnergyPlusData &state, bool const FirstHVACIteration)
}
} else { // call supervisory scheme every iteration
if (!state.dataPlantCondLoopOp->ChillerHeaterSupervisoryOperationSchemes.empty()) {
// set sim flag so each supervisor is only simulated once in the plant loop below
for (DataPlant::ChillerHeaterSupervisoryOperationData &supervisor : state.dataPlantCondLoopOp->ChillerHeaterSupervisoryOperationSchemes) {
supervisor.EvaluateChillerHeaterChangeoverOpScheme(state);

This comment has been minimized.

Copy link
@EnergyArchmage

EnergyArchmage Aug 4, 2023

Contributor

should this block match the one above, set bool to true?

This comment has been minimized.

Copy link
@rraustad

rraustad Aug 4, 2023

Author Contributor

Oh, shoot. That was the change where I tried to call supervisors directly and backed off because there could be unused objects in the input file.

}
for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
auto &this_loop = state.dataPlnt->PlantLoop(LoopNum);
for (int OpNum = 1; OpNum <= this_loop.NumOpSchemes; ++OpNum) {
auto &this_op_scheme = this_loop.OpScheme(OpNum);
if (this_op_scheme.Type == OpScheme::ChillerHeaterSupervisory) {
if (this_op_scheme.ChillerHeaterSupervisoryOperation != nullptr) {
if (this_op_scheme.ChillerHeaterSupervisoryOperation != nullptr &&
this_op_scheme.ChillerHeaterSupervisoryOperation->needsSimulation) {
this_op_scheme.ChillerHeaterSupervisoryOperation->EvaluateChillerHeaterChangeoverOpScheme(state);
this_op_scheme.ChillerHeaterSupervisoryOperation->needsSimulation = false;
}
continue;
}
Expand Down

0 comments on commit b2cbba5

Please sign in to comment.