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) | :: | LoopSide | |||
real(kind=r64), | intent(in) | :: | TankOutletTemp | |||
real(kind=r64), | intent(out) | :: | MixedOutletTemp |
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.
Type | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|
real | :: | PipeTemp = TempPriOutTankOut |
Type | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|
real | :: | PipeTemp = TempSecOutTankOut |
Type | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|
real | :: | PipeTemp = (TempPriOutTankOut + TempSecOutTankOut) / 2.d0 |
SUBROUTINE ManageSingleCommonPipe(LoopNum,LoopSide,TankOutletTemp, MixedOutletTemp)
! SUBROUTINE INFORMATION:
! AUTHOR Sankaranarayanan K P
! DATE WRITTEN November 2006
! MODIFIED B. Griffith, Jan 2010 clean up setup to allow mixing common pipe modes
! B. Griffith, Mar 2010 add LoopNum arg and simplify
! RE-ENGINEERED D. Fisher, Sept. 2010
! B. Griffitth, Oct 2011, major rewrite for plant upgrade
! PURPOSE OF THIS SUBROUTINE:
! To determine the conditions in common pipe viz., the flow flow temperature and direction of flow.
! METHODOLOGY EMPLOYED:
! Determine the flow on both sides of the common pipe. Decide if flow is coming into common pipe
! or going out of common pipe. After that determine which interface calls the subroutine, i.e. if
! called from "Demand to Supply" interface or "Supply to Demand" interface. Update the node temperatures
! accordingly.
! REFERENCES:
! na
! USE STATEMENTS:
USE DataGlobals, ONLY : BeginEnvrnFlag
USE DataLoopNode, ONLY: Node
USE DataPlant
USE DataBranchAirLoopPlant, ONLY: MassFlowTolerance
!SUBROUTINE ARGUMENT DEFINITIONS
INTEGER, INTENT(IN) :: LoopNum !plant loop number
INTEGER, INTENT(IN) :: LoopSide !plant loop side number
REAL(r64), INTENT(IN) :: TankOutletTemp !inlet temperature to the common pipe passed in from the capacitance calculation
REAL(r64), INTENT(OUT) :: MixedOutletTemp !inlet temperature to the common pipe passed in from the capacitance calculation
! SUBROUTINE LOCAL VARIABLE DECLARATIONS
REAL(r64) :: MdotPri = 0.d0 ! flow rate on primary side kg/s
REAL(r64) :: MdotSec = 0.d0 ! flow rate on secondary side kg/s
REAL(r64) :: MdotPriRCLeg = 0.d0 ! flow rate of primary recirculation thru common pipe kg/s
REAL(r64) :: MdotSecRCLeg = 0.d0 ! flow rate of secondary recirculation thru common pipe kg/s
REAL(r64) :: TempSecInlet = 0.d0 ! temperature at secondary inlet deg C
REAL(r64) :: TempPriInlet = 0.d0 ! temperature at primary inlet deg C
REAL(r64) :: TempPriOutTankOut = 0.d0
REAL(r64) :: TempSecOutTankOut = 0.d0
INTEGER :: NodeNumPriOut = 0
INTEGER :: NodeNumSecOut = 0
INTEGER :: NodeNumPriIn = 0
INTEGER :: NodeNumSecIn = 0
INTEGER :: CPFlowDir !flow direction in single common pipe
LOGICAL,SAVE,ALLOCATABLE, DIMENSION(:) :: MyEnvrnFlag
LOGICAL,SAVE :: OneTimeData = .TRUE.
REAL(r64) :: CommonPipeTemp
!One time call to set up report variables and set common pipe 'type' flag
IF (OneTimeData) THEN
IF ( .NOT. CommonPipeSetupFinished ) CALL SetupCommonPipes
ALLOCATE(MyEnvrnFlag(TotNumLoops))
MyEnvrnFlag = .TRUE.
OneTimeData = .FALSE.
END IF
!fill local node indexes
NodeNumPriIn = PlantLoop(LoopNum)%LoopSide(SupplySide)%NodeNumIn
NodeNumPriOut = PlantLoop(LoopNum)%LoopSide(SupplySide)%NodeNumOut
NodeNumSecIn = PlantLoop(LoopNum)%LoopSide(DemandSide)%NodeNumIn
NodeNumSecOut = PlantLoop(LoopNum)%LoopSide(DemandSide)%NodeNumOut
IF (MyEnvrnFlag(LoopNum) .and. BeginEnvrnFlag) THEN
PlantCommonPipe(LoopNum)%Flow = 0.d0
PlantCommonPipe(LoopNum)%Temp = 0.d0
PlantCommonPipe(LoopNum)%FlowDir = NoRecircFlow
MyEnvrnFlag(LoopNum) = .FALSE.
ENDIF
IF (.NOT. BeginEnvrnFlag) THEN
MyEnvrnFlag(LoopNum)=.TRUE.
END IF
! every time inits
MdotSec = Node(NodeNumSecOut)%MassFlowRate
MdotPri = Node(NodeNumPriOut)%MassFlowRate
IF (LoopSide == SupplySide) THEN
TempSecOutTankOut = TankOutletTemp
TempPriOutTankOut = PlantLoop(LoopNum)%LoopSide(DemandSide)%LoopSideInlet_TankTemp
ELSE
TempPriOutTankOut = TankOutletTemp
TempSecOutTankOut = PlantLoop(LoopNum)%LoopSide(SupplySide)%LoopSideInlet_TankTemp
ENDIF
! first do mass balances and find common pipe flow rate and direction
IF (MdotPri > MdotSec) THEN
MdotPriRCLeg = MdotPri - MdotSec
IF (MdotPriRCLeg < MassFlowTolerance) THEN
MdotPriRCLeg = 0.d0
CPFlowDir = NoRecircFlow
ELSE
CPFlowDir = PrimaryRecirc
ENDIF
MdotSecRCLeg = 0.d0
CommonPipeTemp = TempPriOutTankOut
ELSEIF (MdotPri < MdotSec) THEN
MdotSecRCLeg = MdotSec - MdotPri
IF (MdotSecRCLeg < MassFlowTolerance) THEN
MdotSecRCLeg = 0.d0
CPFlowDir = NoRecircFlow
ELSE
CPFlowDir = SecondaryRecirc
ENDIF
MdotPriRCLeg = 0.d0
CommonPipeTemp = TempSecOutTankOut
ELSE ! equal
MdotPriRCLeg = 0.d0
MdotSecRCLeg = 0.d0
CPFlowDir = NoRecircFlow
CommonPipeTemp = (TempPriOutTankOut + TempSecOutTankOut) / 2.d0
ENDIF
! now calculate inlet temps
IF (MdotSec > 0.d0) THEN
TempSecInlet = (MdotPri*TempPriOutTankOut + MdotSecRCLeg*TempSecOutTankOut - MdotPriRCLeg * TempPriOutTankOut) &
/ (MdotSec)
ELSE
TempSecInlet = TempPriOutTankOut
ENDIF
IF (MdotPri > 0.d0) THEN
TempPriInlet = (MdotSec*TempSecOutTankOut + MdotPriRCLeg*TempPriOutTankOut - MdotSecRCLeg*TempSecOutTankOut) &
/ (MdotPri)
ELSE
TempPriInlet = TempSecOutTankOut
ENDIF
!Update the Common Pipe Data structure for reporting purposes.
PlantCommonPipe(LoopNum)%Flow = MAX(MdotPriRCLeg, MdotSecRCLeg)
PlantCommonPipe(LoopNum)%Temp = CommonPipeTemp
PlantCommonPipe(LoopNum)%FlowDir = CPFlowDir
Node(NodeNumSecIn)%Temp = TempSecInlet
Node(NodeNumPriIn)%Temp = TempPriInlet
IF (LoopSide == SupplySide) THEN
MixedOutletTemp = TempPriInlet
ELSE
MixedOutletTemp = TempSecInlet
ENDIF
RETURN
END SUBROUTINE ManageSingleCommonPipe