Nodes of different colours represent the following:
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module or program unit using it. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | LoopNum | |||
integer, | intent(in) | :: | LoopSideNum | |||
integer, | intent(in) | :: | BranchNum | |||
real(kind=r64), | intent(inout) | :: | BranchPressureDrop | |||
logical | :: | PumpFound |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE DistributePressureOnBranch(LoopNum,LoopSideNum,BranchNum,BranchPressureDrop,PumpFound)
! SUBROUTINE INFORMATION:
! AUTHOR Edwin Lee
! DATE WRITTEN August 2009
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Apply proper pressure to nodes along branch
! METHODOLOGY EMPLOYED:
! Move backward through components, passing pressure upstream
! Account for branch pressure drop at branch inlet node
! Update PlantLoop(:)%LoopSide(:)%Branch(:)%PressureDrop Variable
! REFERENCES:
! na
! USE STATEMENTS:
USE DataPlant, ONLY : PlantLoop, GenEquipTypes_Pump, DemandSide, SupplySide
USE DataLoopNode, ONLY : Node
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: LoopNum
INTEGER, INTENT(IN) :: LoopSideNum
INTEGER, INTENT(IN) :: BranchNum
REAL(r64), INTENT(INOUT) :: BranchPressureDrop
LOGICAL :: PumpFound
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: CompNum
INTEGER :: NumCompsOnBranch
REAL(r64) :: TempBranchPressureDrop
!Initialize
TempBranchPressureDrop = 0.0d0
BranchPressureDrop = 0.0d0
PumpFound = .FALSE.
NumCompsOnBranch = SIZE(PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp)
!Retrieve temporary branch pressure drop
IF (PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%HasPressureComponents) THEN
TempBranchPressureDrop = PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%PressureDrop
END IF
!If the last component on the branch is the pump, then check if a pressure drop is detected and set the flag and leave
IF (PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(NumCompsOnBranch)%GeneralEquipType==GenEquipTypes_Pump)THEN
PumpFound = .TRUE.
IF (TempBranchPressureDrop .NE. 0.0d0) THEN
CALL ShowSevereError('Error in plant pressure simulation for plant loop: '//PlantLoop(LoopNum)%Name)
IF (LoopNum == DemandSide) THEN
CALL ShowContinueError('Occurs for demand side, branch: '//PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Name)
ELSE IF (LoopNum == SupplySide) THEN
CALL ShowContinueError('Occurs for supply side, branch: '//PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Name)
END IF
CALL ShowContinueError('Branch contains only a single pump component, yet also a pressure drop component.')
CALL ShowContinueError('Either add a second component to this branch after the pump, or move pressure drop data.')
CALL ShowFatalError('Preceding pressure drop error causes program termination')
END IF
RETURN
END IF
!Assign official branch pressure drop
IF (PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%HasPressureComponents) THEN
BranchPressureDrop = TempBranchPressureDrop
END IF
!Otherwise update the inlet node of the last component on the branch with this corrected pressure
!This essentially sets all the pressure drop on the branch to be accounted for on the last component
Node(PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(NumCompsOnBranch)%NodeNumIn)%Press &
= Node(PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(NumCompsOnBranch)%NodeNumOut)%Press + BranchPressureDrop
!Then Smear any internal nodes with this new node pressure by working backward through
! all but the last component, and passing node pressure upstream
IF (NumCompsOnBranch > 1) THEN
DO CompNum = NumCompsOnBranch-1, 1, -1
!If this component is a pump, stop passing pressure upstream, and set flag to true for calling routine
IF (PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%GeneralEquipType==GenEquipTypes_Pump) THEN
PumpFound = .TRUE.
EXIT
END IF
!Otherwise just pass pressure upstream and move on
Node(PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%NodeNumIn)%Press = &
Node(PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%NodeNumOut)%Press
END DO
END IF
END SUBROUTINE DistributePressureOnBranch