diff --git a/src/EnergyPlus/PlantUtilities.cc b/src/EnergyPlus/PlantUtilities.cc index e982796d9d4..0c34d54d8b3 100644 --- a/src/EnergyPlus/PlantUtilities.cc +++ b/src/EnergyPlus/PlantUtilities.cc @@ -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 @@ -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 @@ -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; @@ -913,27 +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); + 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; } diff --git a/src/EnergyPlus/PlantUtilities.hh b/src/EnergyPlus/PlantUtilities.hh index 309cea0b34d..25064ba540f 100644 --- a/src/EnergyPlus/PlantUtilities.hh +++ b/src/EnergyPlus/PlantUtilities.hh @@ -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