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 | ||
---|---|---|---|---|---|---|
logical, | intent(in) | :: | FirstHVACIteration | |||
logical, | intent(inout) | :: | SimAirLoops | |||
logical, | intent(inout) | :: | SimZoneEquipment | |||
logical, | intent(inout) | :: | SimNonZoneEquipment | |||
logical, | intent(inout) | :: | SimPlantLoops | |||
logical, | intent(inout) | :: | SimElecCircuits |
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 ManagePlantLoops(FirstHVACIteration,SimAirLoops,SimZoneEquipment,SimNonZoneEquipment, &
SimPlantLoops, SimElecCircuits)
! SUBROUTINE INFORMATION:
! AUTHOR Sankaranarayanan K P
! DATE WRITTEN Apr 2005
! MODIFIED
! RE-ENGINEERED B. Griffith, Feb. 2010
! PURPOSE OF THIS SUBROUTINE:
! This subroutine manages the plant loop simulation
! METHODOLOGY EMPLOYED:
! Set up the while iteration block for the plant loop simulation.
! Calls half loop sides to be simulated in predetermined order.
! Reset the flags as necessary
! REFERENCES:
! na
! USE STATEMENTS: NA
USE DataGlobals, ONLY: AnyEnergyManagementSystemInModel
USE PlantUtilities, ONLY: LogPlantConvergencePoints
USE DataConvergParams, ONLY : MinPlantSubIterations, MaxPlantSubIterations
! SUBROUTINE ARGUMENT DEFINITIONS
LOGICAL, INTENT(IN):: FirstHVACIteration
LOGICAL, INTENT(INOUT):: SimAirLoops ! True when the air loops need to be (re)simulated
LOGICAL, INTENT(INOUT):: SimZoneEquipment ! True when zone equipment components need to be (re)simulated
LOGICAL, INTENT(INOUT):: SimNonZoneEquipment ! True when non-zone equipment components need to be (re)simulated
LOGICAL, INTENT(INOUT):: SimPlantLoops ! True when some part of Plant needs to be (re)simulated
LOGICAL, INTENT(INOUT):: SimElecCircuits ! True when electic circuits need to be (re)simulated
! SUBROUTINE PARAMETER DEFINITIONS
! SUBROUTINE VARIABLE DEFINITIONS
INTEGER :: IterPlant
INTEGER :: LoopNum
INTEGER :: LoopSide
INTEGER :: LoopSideNum
INTEGER :: OtherSide
LOGICAL :: SimHalfLoopFlag
INTEGER :: HalfLoopNum
INTEGER :: CurntMinPlantSubIterations
IF ( ANY(PlantLoop%CommonPipeType == CommonPipe_Single) .OR. &
ANY(PlantLoop%CommonPipeType == CommonPipe_TwoWay) ) THEN
CurntMinPlantSubIterations = MAX(7, MinPlantSubIterations)
ELSE
CurntMinPlantSubIterations = MinPlantSubIterations
ENDIF
IF (TotNumLoops <= 0) THEN ! quick return if no plant in model
SimPlantLoops = .FALSE.
RETURN
END IF
IterPlant = 0
CALL InitializeLoops(FirstHVACIteration)
DO WHILE ((SimPlantLoops) .AND. (IterPlant <= MaxPlantSubIterations) )
! go through half loops in predetermined calling order
DO HalfLoopNum = 1, TotNumHalfLoops
LoopNum = PlantCallingOrderInfo(HalfLoopNum)%LoopIndex
LoopSide = PlantCallingOrderInfo(HalfLoopNum)%LoopSide
OtherSide = 3 - LoopSide !will give us 1 if loopside is 2, or 2 if loopside is 1
SimHalfLoopFlag = PlantLoop(LoopNum)%LoopSide(LoopSide)%SimLoopSideNeeded !set half loop sim flag
IF (SimHalfLoopFlag .OR. IterPlant <= CurntMinPlantSubIterations) THEN
CALL PlantHalfLoopSolver(FirstHVACIteration, LoopSide, LoopNum, PlantLoop(LoopNum)%LoopSide(OtherSide)%SimLoopSideNeeded)
! Always set this side to false, so that it won't keep being turned on just because of first hvac
PlantLoop(LoopNum)%LoopSide(LoopSide)%SimLoopSideNeeded = .FALSE.
! If we did the demand side, turn on the supply side (only if we need to do it last)
IF (LoopSide == DemandSide) THEN
IF (PlantLoop(LoopNum)%HasPressureComponents) THEN
PlantLoop(LoopNum)%LoopSide(OtherSide)%SimLoopSideNeeded = .FALSE.
END IF
END IF
! Update the report variable
PlantReport(LoopNum)%LastLoopSideSimulated = LoopSide
PlantManageHalfLoopCalls = PlantManageHalfLoopCalls + 1
ENDIF
ENDDO ! half loop based calling order...
! decide new status for SimPlantLoops flag
SimPlantLoops = .FALSE.
LoopLevel: DO LoopNum = 1, TotNumLoops
LoopSideLevel: DO LoopSideNum = 1, 2
IF (PlantLoop(LoopNum)%LoopSide(LoopSideNum)%SimLoopSideNeeded)THEN
SimPlantLoops = .TRUE.
EXIT LoopLevel
ENDIF
ENDDO LoopSideLevel
ENDDO LoopLevel
IterPlant = IterPlant + 1 ! Increment the iteration counter
IF (IterPlant < CurntMinPlantSubIterations) SimPlantLoops = .TRUE.
PLANTManageSubIterations = PLANTManageSubIterations + 1 ! these are summed across all half loops for reporting
END DO !while
! add check for non-plant system sim flag updates
! could set SimAirLoops, SimElecCircuits, SimZoneEquipment flags for now
DO LoopNum = 1, TotNumLoops
DO LoopSide = DemandSide,SupplySide
IF (PlantLoop(LoopNum)%LoopSide(LoopSide)%SimAirLoopsNeeded) SimAirLoops = .TRUE.
IF (PlantLoop(LoopNum)%LoopSide(LoopSide)%SimZoneEquipNeeded) SimZoneEquipment = .TRUE.
! IF (PlantLoop(LoopNum)%LoopSide(LoopSide)%SimNonZoneEquipNeeded) SimNonZoneEquipment = .TRUE.
IF (PlantLoop(LoopNum)%LoopSide(LoopSide)%SimElectLoadCentrNeeded) SimElecCircuits = .TRUE.
ENDDO
ENDDO
!Also log the convergence history of all loopsides once complete
CALL LogPlantConvergencePoints(FirstHVACIteration)
RETURN
END SUBROUTINE ManagePlantLoops