INTEGER FUNCTION GetLoopSidePumpIndex(LoopNum, LoopSideNum, BranchNum, CompNum)
! FUNCTION INFORMATION:
! AUTHOR Edwin Lee
! DATE WRITTEN April 2010
! MODIFIED na
! RE-ENGINEERED na
!
! PURPOSE OF THIS FUNCTION:
! This subroutine scans the plant loopside pumps data structure, and returns the index or zero
!
! METHODOLOGY EMPLOYED:
! Standard EnergyPlus methodology.
!
! REFERENCES:
! na
!
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: LoopNum
INTEGER, INTENT(IN) :: LoopSideNum
INTEGER, INTENT(IN) :: BranchNum
INTEGER, INTENT(IN) :: CompNum
! FUNCTION PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
INTEGER :: PumpCtr
! Assume it isn't found
GetLoopSidePumpIndex = 0
! If there aren't any pumps on this loop side then just exit
IF (.NOT. ALLOCATED(PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Pumps) ) THEN
RETURN
END IF
! We can also make use of the TypeOfs to exit early
IF (PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%GeneralEquipType /= &
GenEquipTypes_Pump) &
RETURN
! Loop across all the loops on this loop/loopside, and check the branch/comp location
DO PumpCtr = 1, PlantLoop(LoopNum)%LoopSide(LoopSideNum)%TotalPumps
IF ( (PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Pumps(PumpCtr)%BranchNum == BranchNum) &
.AND. (PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Pumps(PumpCtr)%CompNum == CompNum) ) THEN
GetLoopSidePumpIndex = PumpCtr
EXIT
END IF
END DO
RETURN
END FUNCTION GetLoopSidePumpIndex