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.
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 RevisePlantCallingOrder
! SUBROUTINE INFORMATION:
! AUTHOR Brent Griffith
! DATE WRITTEN april 2011
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! setup the order that plant loops are to be called
! METHODOLOGY EMPLOYED:
! simple rule-based allocation of which order to call the half loops
!
! Examine for interconnected components and rearrange to impose the following rules
!
!
! REFERENCES:
! na
! USE STATEMENTS:
USE PlantUtilities, ONLY : ShiftPlantLoopSideCallingOrder
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
! na
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: HalfLoopNum
INTEGER :: LoopNum
INTEGER :: LoopSideNum
INTEGER :: OtherLoopNum
INTEGER :: OtherLoopSideNum
INTEGER :: OtherLoopCallingIndex = 0
INTEGER :: OtherLoopDemandSideCallingIndex = 0
INTEGER :: NewOtherDemandSideCallingIndex = 0
INTEGER :: newCallingIndex = 0
LOGICAL :: thisLoopPutsDemandOnAnother
INTEGER :: ConnctNum
DO HalfLoopNum = 1, TotNumHalfLoops
LoopNum = PlantCallingOrderInfo(HalfLoopNum)%LoopIndex
LoopSideNum = PlantCallingOrderInfo(HalfLoopNum)%LoopSide
IF (ALLOCATED(PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Connected)) THEN
DO ConnctNum = 1, Size(PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Connected)
OtherLoopNum = PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Connected(ConnctNum)%LoopNum
OtherLoopSideNum = PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Connected(ConnctNum)%LoopSideNum
OtherLoopCallingIndex = FindLoopSideInCallingOrder(OtherLoopNum, OtherLoopSideNum)
thisLoopPutsDemandOnAnother = PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Connected(ConnctNum)%LoopDemandsOnRemote
If (thisLoopPutsDemandOnAnother) THEN ! make sure this loop side is called before the other loop side
IF (OtherLoopCallingIndex < HalfLoopNum) THEN !rearrange
newCallingIndex = MIN(HalfLoopNum + 1, TotNumHalfLoops)
CALL ShiftPlantLoopSideCallingOrder(OtherLoopCallingIndex, newCallingIndex)
ENDIF
ELSE ! make sure the other is called before this one
IF (OtherLoopCallingIndex > HalfLoopNum) THEN !rearrange
newCallingIndex = MAX(HalfLoopNum, 1)
IF (OtherLoopSideNum == SupplySide) THEN !if this is a supplyside, don't push it before its own demand side
OtherLoopDemandSideCallingIndex = FindLoopSideInCallingOrder(OtherLoopNum, DemandSide)
IF (OtherLoopDemandSideCallingIndex < HalfLoopNum) THEN ! good to go
NewCallingIndex = MIN(OtherLoopDemandSideCallingIndex + 1, TotNumHalfLoops) !put it right after its demand side
CALL ShiftPlantLoopSideCallingOrder(OtherLoopCallingIndex, newCallingIndex)
ELSE ! move both sides of other loop before this, keeping demand side in front
NewOtherDemandSideCallingIndex = MAX(HalfLoopNum, 1)
CALL ShiftPlantLoopSideCallingOrder(OtherLoopDemandSideCallingIndex, NewOtherDemandSideCallingIndex)
! get fresh pointer after it has changed in previous call
OtherLoopCallingIndex = FindLoopSideInCallingOrder(OtherLoopNum, OtherLoopSideNum)
newCallingIndex = NewOtherDemandSideCallingIndex + 1
CALL ShiftPlantLoopSideCallingOrder(OtherLoopCallingIndex, newCallingIndex)
ENDIF
ELSE
CALL ShiftPlantLoopSideCallingOrder(OtherLoopCallingIndex, newCallingIndex)
ENDIF
ENDIF
ENDIF
ENDDO
ENDIF
ENDDO
RETURN
END SUBROUTINE RevisePlantCallingOrder