Skip to content

Commit

Permalink
Merge pull request #10794 from NREL/Remove-dead-code
Browse files Browse the repository at this point in the history
Remove dead code
  • Loading branch information
Myoldmopar authored Nov 12, 2024
2 parents e2a57d4 + 9b32f9e commit 389b30b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 34 deletions.
30 changes: 8 additions & 22 deletions src/EnergyPlus/PlantUtilities.cc
Original file line number Diff line number Diff line change
Expand Up @@ -860,8 +860,6 @@ void PullCompInterconnectTrigger(EnergyPlusData &state,
// SUBROUTINE INFORMATION:
// AUTHOR Edwin Lee
// DATE WRITTEN September 2010
// MODIFIED na
// RE-ENGINEERED na

// PURPOSE OF THIS SUBROUTINE:
// Provides a generic means for components to trigger interconnected loop sides sim flags
Expand All @@ -881,13 +879,6 @@ void PullCompInterconnectTrigger(EnergyPlusData &state,
// associated component. Therefore whenever we come in with a non-zero index, we will just
// verify that the stored loop/side/branch/comp matches

// Using/Aliasing
using DataPlant::CriteriaDelta_HeatTransferRate;
using DataPlant::CriteriaDelta_MassFlowRate;
using DataPlant::CriteriaDelta_Temperature;

CriteriaData CurCriteria; // for convenience

if (UniqueCriteriaCheckIndex <= 0) { // If we don't yet have an index, we need to initialize

// We need to start by allocating, or REallocating the array
Expand All @@ -897,9 +888,10 @@ void PullCompInterconnectTrigger(EnergyPlusData &state,
// Store the unique name and location
state.dataPlantUtilities->CriteriaChecks(CurrentNumChecksStored).CallingCompLoopNum = plantLoc.loopNum;
state.dataPlantUtilities->CriteriaChecks(CurrentNumChecksStored).CallingCompLoopSideNum = plantLoc.loopSideNum;
state.dataPlantUtilities->CriteriaChecks(CurrentNumChecksStored).CallingCompBranchNum = plantLoc.branchNum;
state.dataPlantUtilities->CriteriaChecks(CurrentNumChecksStored).CallingCompCompNum = plantLoc.compNum;

if (plantLoc.loopNum == 0 || plantLoc.loopSideNum == DataPlant::LoopSideLocation::Invalid) {
assert(false); // check that component has been set up correctly
}
// Since this was the first pass, it is safe to assume something has changed!
// Therefore we'll set the sim flag to true
state.dataPlnt->PlantLoop(ConnectedPlantLoc.loopNum).LoopSide(ConnectedPlantLoc.loopSideNum).SimLoopSideNeeded = true;
Expand All @@ -913,33 +905,27 @@ void PullCompInterconnectTrigger(EnergyPlusData &state,
// sim flag status based on the criteria type

// First store the current check in a single variable instead of array for readability
CurCriteria = state.dataPlantUtilities->CriteriaChecks(UniqueCriteriaCheckIndex);

// Check to make sure we didn't reuse the index in multiple components
if (CurCriteria.CallingCompLoopNum != plantLoc.loopNum || CurCriteria.CallingCompLoopSideNum != plantLoc.loopSideNum ||
CurCriteria.CallingCompBranchNum != plantLoc.branchNum || CurCriteria.CallingCompCompNum != plantLoc.compNum) {
// Diagnostic fatal: component does not properly utilize unique indexing
}
CriteriaData CurCriteria = state.dataPlantUtilities->CriteriaChecks(UniqueCriteriaCheckIndex);

// Initialize, then check if we are out of range
switch (CriteriaType) {
case DataPlant::CriteriaType::MassFlowRate: {
if (std::abs(CurCriteria.ThisCriteriaCheckValue - CriteriaValue) > CriteriaDelta_MassFlowRate) {
if (std::abs(CurCriteria.ThisCriteriaCheckValue - CriteriaValue) > DataPlant::CriteriaDelta_MassFlowRate) {
state.dataPlnt->PlantLoop(ConnectedPlantLoc.loopNum).LoopSide(ConnectedPlantLoc.loopSideNum).SimLoopSideNeeded = true;
}
} break;
case DataPlant::CriteriaType::Temperature: {
if (std::abs(CurCriteria.ThisCriteriaCheckValue - CriteriaValue) > CriteriaDelta_Temperature) {
if (std::abs(CurCriteria.ThisCriteriaCheckValue - CriteriaValue) > DataPlant::CriteriaDelta_Temperature) {
state.dataPlnt->PlantLoop(ConnectedPlantLoc.loopNum).LoopSide(ConnectedPlantLoc.loopSideNum).SimLoopSideNeeded = true;
}
} break;
case DataPlant::CriteriaType::HeatTransferRate: {
if (std::abs(CurCriteria.ThisCriteriaCheckValue - CriteriaValue) > CriteriaDelta_HeatTransferRate) {
if (std::abs(CurCriteria.ThisCriteriaCheckValue - CriteriaValue) > DataPlant::CriteriaDelta_HeatTransferRate) {
state.dataPlnt->PlantLoop(ConnectedPlantLoc.loopNum).LoopSide(ConnectedPlantLoc.loopSideNum).SimLoopSideNeeded = true;
}
} break;
default:
// Diagnostic fatal: improper criteria type
assert(false);
break;
}

Expand Down
15 changes: 3 additions & 12 deletions src/EnergyPlus/PlantUtilities.hh
Original file line number Diff line number Diff line change
Expand Up @@ -210,18 +210,9 @@ namespace PlantUtilities {
struct CriteriaData
{
// Members
int CallingCompLoopNum; // for debug error handling
DataPlant::LoopSideLocation CallingCompLoopSideNum; // for debug error handling
int CallingCompBranchNum; // for debug error handling
int CallingCompCompNum; // for debug error handling
Real64 ThisCriteriaCheckValue; // the previous value, to check the current against

// Default Constructor
CriteriaData()
: CallingCompLoopNum(0), CallingCompLoopSideNum(DataPlant::LoopSideLocation::Invalid), CallingCompBranchNum(0), CallingCompCompNum(0),
ThisCriteriaCheckValue(0.0)
{
}
int CallingCompLoopNum = 0; // for debug error handling
DataPlant::LoopSideLocation CallingCompLoopSideNum = DataPlant::LoopSideLocation::Invalid; // for debug error handling
Real64 ThisCriteriaCheckValue = 0.0; // the previous value, to check the current against
};

} // namespace PlantUtilities
Expand Down

3 comments on commit 389b30b

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (2917 of 2917 tests passed, 0 test warnings)

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.

develop (Myoldmopar) - 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

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

develop (Myoldmopar) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-RelWithDebInfo: OK (2099 of 2099 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.