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 |
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 InitLoadDistribution(FirstHVACIteration)
! SUBROUTINE INFORMATION:
! AUTHOR: Dan Fisher
! DATE WRITTEN: July 2010
! REVISED:
!
! PURPOSE OF THIS SUBROUTINE:
! This subroutine scans equipment lists and matches a particular
! plant component with a component on the list. Pointers to the
! operation scheme and equipment list are saved on the plant data
! structure to facilitate a new load management routine that calls
! ManageLoadDistribution for every component.
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
USE ScheduleManager, ONLY: GetScheduleIndex, GetCurrentScheduleValue
USE InputProcessor, ONLY: SameString, FindItem
USE DataGlobals, ONLY: BeginEnvrnFlag, emsCallFromUserDefinedComponentModel
USE EMSManager, ONLY: ManageEMS
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
LOGICAL, INTENT(IN) :: FirstHVACIteration
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
TYPE (OpSchemePtrData), ALLOCATABLE, DIMENSION(:) :: TempCompOpscheme
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: LoopPtr
INTEGER :: LoopSidePtr
INTEGER :: BranchPtr
INTEGER :: CompPtr
INTEGER :: LoopNum
INTEGER :: DummyLoopNum
INTEGER :: LoopSideNum
INTEGER :: BranchNum
INTEGER :: CompNum
INTEGER :: Index
INTEGER :: EquipNum
INTEGER :: OpNum
INTEGER :: OpSchemePtr
INTEGER :: SchemeNum
INTEGER :: thisSchemeNum
INTEGER :: SchemeType
INTEGER :: ListNum
LOGICAL, SAVE :: MyOneTimeFlag = .true.
LOGICAL :: FoundScheme
LOGICAL :: FoundSchemeMatch
! LOGICAL, SAVE :: FirstHVACInitsDone = .FALSE.
! LOGICAL, SAVE :: MyEnvrnFlag = .TRUE.
INTEGER :: ThisTypeOfNum
INTEGER :: CompOpNum
INTEGER :: OldNumOpSchemes
INTEGER :: OldNumEquipLists
INTEGER :: NewNumEquipLists
INTEGER :: NewNumOpSchemes
INTEGER :: NumSearchResults
LOGICAL :: GetInputOK !successful Get Input
LOGICAL,SAVE :: GetPlantOpInput =.TRUE. !successful Get Input
LOGICAL :: errFlag1
LOGICAL :: errFlag2
REAL(r64) :: HighestRange
errFlag2 = .FALSE.
!Get Input
IF (GetPlantOpInput)THEN
CALL GetPlantOperationInput(GetInputOK)
IF(GetInputOK)THEN
CALL GetOperationSchemeInput
GetPlantOpInput = .FALSE.
ELSE
RETURN
ENDIF
END IF
!ONE TIME INITS
IF (MyOneTimeFlag) THEN
!Set up 'component' to 'op scheme' pointers in Plant data structure
!We're looking for matches between a component on a PlantLoop()%Opscheme()%List()
!and the same component in the PlantLoop()%LoopSide()%Branch()%Comp() data structure
! first loop over main operation scheme data and finish filling out indexes to plant topology for the components in the lists
DO LoopNum = 1, TotNumLoops
DO OpNum =1, PlantLoop(LoopNum)%NumOpschemes
DO ListNum = 1,PlantLoop(LoopNum)%Opscheme(OpNum)%NumEquipLists
DO EquipNum = 1,PlantLoop(LoopNum)%Opscheme(OpNum)%EquipList(ListNum)%NumComps
ThisTypeOfNum = FindItem(TRIM(PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%Comp(EquipNum)%TypeOf), &
SimPlantEquipTypes, &
NumSimPlantEquipTypes)
errFlag1 = .FALSE.
CALL ScanPlantLoopsForObject(TRIM(PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%Comp(EquipNum)%Name), &
ThisTypeOfNum, &
DummyLoopNum, &
LoopSideNum, &
BranchNum, &
CompNum, &
CountMatchPlantLoops = NumSearchResults, &
SingleLoopSearch = LoopNum, &
errflag = errFlag1)
IF ( errFlag1 ) THEN
CALL ShowSevereError('InitLoadDistribution: Equipment specified for operation scheme not found on correct loop')
CALL ShowContinueError('Operation Scheme name = '//TRIM(PlantLoop(LoopNum)%Opscheme(OpNum)%Name) )
CALL ShowContinueError('Loop name = '//TRIM(PlantLoop(LoopNum)%Name) )
CALL ShowContinueError('Component name = ' &
//TRIM(PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%Comp(EquipNum)%Name) )
CALL ShowFatalError('InitLoadDistribution: Simulation terminated because of error in operation scheme.')
END IF
PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%Comp(EquipNum)%LoopNumPtr = DummyLoopNum
PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%Comp(EquipNum)%LoopSideNumPtr = LoopSideNum
PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%Comp(EquipNum)%BranchNumPtr = BranchNum
PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%Comp(EquipNum)%CompNumPtr = CompNum
IF(ValidLoopEquipTypes(ThisTypeOfNum)==LoopType_Plant .AND. PlantLoop(LoopNum)%TypeOfLoop == LoopType_Condenser)THEN
CALL ShowSevereError('InitLoadDistribution: CondenserLoop="'//trim(PlantLoop(LoopNum)%Name)// &
'", Operation Scheme="'// &
trim(PlantLoop(LoopNum)%OperationScheme)//'",')
CALL ShowContinueError('Scheme type='//trim(PlantLoop(LoopNum)%OpScheme(OpNum)%TypeOf)//', Name="'// &
trim(PlantLoop(LoopNum)%OpScheme(OpNum)%Name)//'" includes equipment that is not valid on a Condenser Loop')
CALL ShowContinueError('Component '//trim(ccSimPlantEquipTypes(ThisTypeOfNum))// &
' not allowed as supply equipment on this type of loop.')
CALL ShowContinueError('Component name = ' &
//TRIM(PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%Comp(EquipNum)%Name) )
errFlag2 = .TRUE.
ENDIF
IF(ValidLoopEquipTypes(ThisTypeOfNum)==LoopType_Condenser .AND. PlantLoop(LoopNum)%TypeOfLoop == LoopType_Plant)THEN
CALL ShowSevereError('InitLoadDistribution: PlantLoop="'//trim(PlantLoop(LoopNum)%Name)//'", Operation Scheme="'// &
trim(PlantLoop(LoopNum)%OperationScheme)//'",')
CALL ShowContinueError('Scheme type='//trim(PlantLoop(LoopNum)%OpScheme(OpNum)%TypeOf)//', Name="'// &
trim(PlantLoop(LoopNum)%OpScheme(OpNum)%Name)//'" includes equipment that is not valid on a Plant Loop')
CALL ShowContinueError('Component '//trim(ccSimPlantEquipTypes(ThisTypeOfNum))// &
' not allowed as supply equipment on this type of loop.')
CALL ShowContinueError('Component name = ' &
//TRIM(PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%Comp(EquipNum)%Name) )
errFlag2 = .TRUE.
ENDIF
ENDDO !Equipment on List
ENDDO !List
ENDDO !operation scheme
ENDDO !loop
!second loop, fill op schemes info at each component.
DO LoopNum = 1, TotNumLoops
DO OpNum =1, PlantLoop(LoopNum)%NumOpschemes
DO ListNum = 1,PlantLoop(LoopNum)%Opscheme(OpNum)%NumEquipLists
DO EquipNum = 1,PlantLoop(LoopNum)%Opscheme(OpNum)%EquipList(ListNum)%NumComps
! dereference indices (stored in previous loop)
DummyLoopNum = PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%Comp(EquipNum)%LoopNumPtr
LoopSideNum = PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%Comp(EquipNum)%LoopSideNumPtr
BranchNum = PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%Comp(EquipNum)%BranchNumPtr
CompNum = PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%Comp(EquipNum)%CompNumPtr
IF (PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%NumOpSchemes == 0) THEN
! first op scheme for this component, allocate OpScheme and its EquipList to size 1
ALLOCATE(PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%OpScheme(1))
ALLOCATE(PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%OpScheme(1)%EquipList(1))
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%NumOpSchemes = 1
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%OpScheme(1)%NumEquipLists = 1
! store pointers
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%OpScheme(1)%OpSchemePtr = OpNum
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%OpScheme(1)%EquipList(1)%ListPtr = &
ListNum
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%OpScheme(1)%EquipList(1)%CompPtr = &
EquipNum
ELSEIF (PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%NumOpSchemes > 0) THEN
! already an op scheme
OldNumOpSchemes = PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%NumOpSchemes
! create and store complete copy of old opScheme structure
ALLOCATE(TempCompOpscheme(OldNumOpSchemes))
DO thisSchemeNum = 1,OldNumOpSchemes
OldNumEquipLists = &
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%OpScheme(thisSchemeNum)%NumEquipLists
ALLOCATE(TempCompOpscheme(thisSchemeNum)%EquipList(OldNumEquipLists))
ENDDO
TempCompOpscheme = PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%OpScheme
!could be new list on existing scheme or new scheme with new list. Check and see
FoundSchemeMatch = .FALSE.
DO thisSchemeNum = 1,OldNumOpSchemes
!compare the opscheme index, 'opnum', in the PlantLoop()%OpScheme()data structure
!with the opschemeptr in the PlantLoop()%LoopSide()%Branch()%Comp() data structure.
IF(OpNum /= &
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(thisSchemeNum)%OpSchemePtr) &
CYCLE
FoundSchemeMatch = .TRUE.
EXIT
ENDDO
IF(FoundSchemeMatch)THEN
!op scheme already exists, but need to add a list to the existing opscheme
NewNumEquipLists = PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(thisSchemeNum)%NumEquipLists + 1
DEALLOCATE(PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(thisSchemeNum)%EquipList)
ALLOCATE(PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(thisSchemeNum)%EquipList(NewNumEquipLists))
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(thisSchemeNum)%EquipList(1:NewNumEquipLists-1) &
= TempCompOpscheme(thisSchemeNum)%EquipList !structure array assignment
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(thisSchemeNum)%NumEquipLists = NewNumEquipLists
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(thisSchemeNum)%EquipList(NewNumEquipLists)%ListPtr &
= ListNum
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(thisSchemeNum)%EquipList(NewNumEquipLists)%CompPtr &
= EquipNum
ELSE !(.NOT.FoundSchemeMatch)THEN
! add new op scheme and a new list
NewNumOpSchemes = OldNumOpSchemes + 1
DEALLOCATE(PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%OpScheme)
ALLOCATE(PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%OpScheme(NewNumOpSchemes))
DO SchemeNum = 1,OldNumOpSchemes
NewNumEquipLists = TempCompOpscheme(SchemeNum)%NumEquipLists
ALLOCATE(PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(SchemeNum)%EquipList(NewNumEquipLists))
ENDDO
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%OpScheme(1:OldNumOpSchemes) = &
TempCompOpscheme ! structure array assignment
ALLOCATE(PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(NewNumOpSchemes)%EquipList(1))
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%NumOpSchemes = NewNumOpSchemes
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(NewNumOpSchemes)%NumEquipLists = 1
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(NewNumOpSchemes)%OpSchemePtr = OpNum
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(NewNumOpSchemes)%EquipList(1)%ListPtr = ListNum
PlantLoop(DummyLoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)% &
OpScheme(NewNumOpSchemes)%EquipList(1)%CompPtr = EquipNum
ENDIF
IF (ALLOCATED(TempCompOpscheme)) DEALLOCATE(TempCompOpscheme)
ENDIF
ENDDO !Equipment on List
ENDDO !List
ENDDO !operation scheme
ENDDO !loop
!check the pointers to see if a single component is attached to more than one type of control scheme
DO LoopNum = 1, TotNumLoops
DO LoopSideNum = DemandSide,SupplySide
DO BranchNum = 1, PlantLoop(LoopNum)%LoopSide(LoopSideNum)%TotalBranches
DO CompNum = 1, PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%TotalComponents
IF(ALLOCATED(PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%OpScheme))THEN
DO index = 1,PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%NumOpSchemes
OpSchemePtr = PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%OpScheme(index)%OpschemePtr
IF (OpSchemePtr ==0) THEN
CALL ShowSevereError('InitLoadDistribution: no operation scheme index found for component on PlantLoop='&
//TRIM(PlantLoop(LoopNum)%Name) )
CALL ShowContinueError('Component name = ' &
//TRIM(PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%Name) )
errFlag2 = .TRUE.
ENDIF
IF(index ==1)THEN
SchemeType = PlantLoop(LoopNum)%Opscheme(OpSchemePtr)%OpSchemeType
ELSE
IF(SchemeType /= PlantLoop(LoopNum)%Opscheme(OpSchemePtr)%OpSchemeType)THEN
!CALL FATAL ERROR 'component may not be specified on two types of operation schemes
!DSU? BG do not understand. Cannot different op schemes be in effect at different times?
! I thought this would be allowed??
ENDIF
ENDIF
ENDDO
ENDIF
ENDDO
ENDDO
ENDDO
ENDDO
! fill out information on which equipment list is the "last" meaning it has the highest upper limit for load range
DO LoopNum = 1, TotNumLoops
DO OpNum =1, PlantLoop(LoopNum)%NumOpschemes
! skip non-load based op schemes
IF ((PlantLoop(LoopNum)%Opscheme(OpNum)%OpSchemeType /= HeatingRBOpSchemeType) .AND. &
(PlantLoop(LoopNum)%Opscheme(OpNum)%OpSchemeType /= CoolingRBOpSchemeType) ) CYCLE
HighestRange = 0.d0
DO ListNum = 1,PlantLoop(LoopNum)%Opscheme(OpNum)%NumEquipLists
HighestRange = MAX(HighestRange, PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%RangeUpperLimit)
ENDDO !List
DO ListNum = 1,PlantLoop(LoopNum)%Opscheme(OpNum)%NumEquipLists
IF (HighestRange == PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%RangeUpperLimit) THEN
PlantLoop(LoopNum)%OpScheme(OpNum)%EquipListNumForLastStage = ListNum
ENDIF
ENDDO
ENDDO !operation scheme
ENDDO !loop
MyOneTimeFlag = .FALSE.
ENDIF
If (AnyEMSPlantOpSchemesInModel) THEN
! Execute any Initialization EMS program calling managers for User-Defined operation.
DO LoopNum = 1, TotNumLoops
DO OpNum =1, PlantLoop(LoopNum)%NumOpschemes
IF (PlantLoop(LoopNum)%Opscheme(OpNum)%OpSchemeType == EMSOpSchemeType) THEN
IF (BeginEnvrnFlag .and. PlantLoop(LoopNum)%Opscheme(OpNum)%MyEnvrnFlag) THEN
IF (PlantLoop(LoopNum)%OpScheme(OpNum)%ErlInitProgramMngr > 0) THEN
CALL ManageEMS(emsCallFromUserDefinedComponentModel, &
ProgramManagerToRun = PlantLoop(LoopNum)%OpScheme(OpNum)%ErlInitProgramMngr)
ENDIF
PlantLoop(LoopNum)%Opscheme(OpNum)%MyEnvrnFlag = .FALSE.
ENDIF
IF (.NOT. BeginEnvrnFlag) PlantLoop(LoopNum)%Opscheme(OpNum)%MyEnvrnFlag = .TRUE.
ENDIF
ENDDO !operation scheme
ENDDO !loop
ENDIF
!FIRST HVAC INITS
IF (FirstHVACIteration )THEN
DO LoopNum = 1, TotNumLoops
DO LoopSideNum = DemandSide,SupplySide
DO BranchNum = 1, PlantLoop(LoopNum)%LoopSide(LoopSideNum)%TotalBranches
DO CompNum = 1, PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%TotalComponents
! initalize components 'ON-AVAILABLE-NO LOAD-NO EMS CTRL'
PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%ON = .TRUE.
PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%Available = .TRUE.
PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%MyLoad =0.d0
PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%EMSLoadOverrideOn = .FALSE.
! Zero out the old curopschemeptr so that we don't get 'carry-over' when we update schedules
IF(PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%CurOpSchemeType.NE.DemandOpSchemeType .and. &
PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%CurOpSchemeType.NE.PumpOpSchemeType .and. &
PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%CurOpSchemeType.NE.WSEconOpSchemeType .and. &
PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%CurOpSchemeType.NE.NoControlOpSchemeType)THEN
PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%CurOpSchemeType = NoControlOpSchemeType
END IF
PlantLoop(LoopNum)%LoopSide(LoopSideNum)%Branch(BranchNum)%Comp(CompNum)%CurCompLevelOpNum = 0
ENDDO
ENDDO
ENDDO
ENDDO
!Update the opscheme schedules
DO LoopNum = 1, TotNumLoops
foundscheme = .false.
DO OpNum = 1, PlantLoop(LoopNum)%NumOpSchemes
IF(GetCurrentScheduleValue(PlantLoop(LoopNum)%OpScheme(OpNum)%SchedPtr) > 0.0d0) THEN
PlantLoop(LoopNum)%OpScheme(OpNum)%Available = .TRUE.
foundscheme = .true.
DO ListNum = 1, PlantLoop(LoopNum)%OpScheme(OpNum)%NumEquipLists
!The component loop loads the pointers from the Opscheme data structure
!If the component happens to be active in more than schedule, the *LAST*
!schedule found will be activated
DO CompNum = 1, PlantLoop(LoopNum)%OpScheme(OpNum)%EquipList(ListNum)%NumComps
LoopPtr = PlantLoop(LoopNum)%Opscheme(OpNum)%EquipList(ListNum)%Comp(CompNum)%LoopNumPtr
LoopSidePtr = PlantLoop(LoopNum)%Opscheme(OpNum)%EquipList(ListNum)%Comp(CompNum)%LoopSideNumPtr
BranchPtr = PlantLoop(LoopNum)%Opscheme(OpNum)%EquipList(ListNum)%Comp(CompNum)%BranchNumPtr
CompPtr = PlantLoop(LoopNum)%Opscheme(OpNum)%EquipList(ListNum)%Comp(CompNum)%CompNumPtr
IF (PlantLoop(LoopPtr)%LoopSide(LoopSidePtr)%Branch(BranchPtr)%Comp(CompPtr)%CurOpSchemeType &
.NE. PumpOpSchemeType ) THEN
PlantLoop(LoopPtr)%LoopSide(LoopSidePtr)%Branch(BranchPtr)%Comp(CompPtr)%CurOpSchemeType = &
PlantLoop(LoopNum)%OpScheme(OpNum)%OpSchemeType
ELSE
CALL ShowSevereError('Invalid [pump] component found on equipment list. Pumps are not allowed on equipment lists.')
CALL ShowContinueError('Problem component name = ' &
//TRIM(PlantLoop(LoopNum)%Opscheme(OpNum)%EquipList(ListNum)%Comp(CompNum)%Name) )
CALL ShowContinueError('Remove pump component and place other plant equipment on the list to correct.')
errFlag2 = .TRUE.
END IF
DO CompOpNum = 1, PlantLoop(LoopPtr)%LoopSide(LoopSidePtr)%Branch(BranchPtr)%Comp(CompPtr)%NumOpSchemes
IF(PlantLoop(LoopPtr)%LoopSide(LoopSidePtr)%Branch(BranchPtr)%Comp(CompPtr)%Opscheme(CompOpNum)%OpschemePtr &
== OpNum)THEN
PlantLoop(LoopPtr)%LoopSide(LoopSidePtr)%Branch(BranchPtr)%Comp(CompPtr)%CurCompLevelOpNum = CompOpNum
ENDIF
ENDDO
ENDDO
ENDDO
ELSE
PlantLoop(LoopNum)%OpScheme(OpNum)%Available = .FALSE.
ENDIF
ENDDO
! IF(.NOT. foundscheme)THEN
! !'call warning 'no current control scheme specified. Loop Equipment will be shut down'
! ENDIF
ENDDO
END IF
IF ( errFlag2 ) THEN
CALL ShowFatalError('InitLoadDistribution: Fatal error caused by previous severe error(s).')
ENDIF
RETURN
END SUBROUTINE InitLoadDistribution