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 GetDemandManagerInput
! SUBROUTINE INFORMATION:
! AUTHOR Peter Graham Ellis
! DATE WRITTEN July 2005
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Gets the DEMAND MANAGER input from the input file.
! METHODOLOGY EMPLOYED:
! Standard EnergyPlus methodology.
! USE STATEMENTS:
USE DataGlobals, ONLY: MaxNameLength, MinutesPerTimeStep
USE DataInterfaces, ONLY: ShowSevereError, ShowWarningError, ShowFatalError, &
SetupOutputVariable, ShowContinueError
USE InputProcessor, ONLY: GetNumObjectsFound, GetObjectItem, VerifyName, FindItemInList, GetObjectDefMaxArgs
USE DataIPShortCuts ! Data for field names, blank numerics
USE ScheduleManager, ONLY: GetScheduleIndex
USE DataHeatBalance, ONLY: Lights, TotLights, ZoneElectric, TotElecEquip, LightsObjects, NumLightsStatements, &
ZoneElectricObjects, NumZoneElectricStatements
USE ExteriorEnergyUse, ONLY: ExteriorLights, NumExteriorLights
USE DataZoneControls, ONLY: TempControlledZone, NumTempControlledZones, TStatObjects, NumTStatStatements
USE General, ONLY: RoundSigDigits
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE PARAMETER DEFINITIONS:
CHARACTER(len=*), PARAMETER :: Blank = ' '
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: NumDemandMgrExtLights
INTEGER :: NumDemandMgrLights
INTEGER :: NumDemandMgrElecEquip
INTEGER :: NumDemandMgrThermostats
INTEGER :: MgrNum
INTEGER :: StartIndex
INTEGER :: EndIndex
INTEGER :: LoadNum
INTEGER :: LoadPtr
INTEGER :: NumAlphas ! Number of elements in the alpha array
INTEGER :: NumNums ! Number of elements in the numeric array
INTEGER :: MaxAlphas ! Max number of elements in the alpha array
INTEGER :: MaxNums ! Max number of elements in the numeric array
INTEGER :: NumParams ! Number of arguments total in an ObjectDef
INTEGER :: IOStat ! IO Status when calling get input subroutine
CHARACTER(len=MaxNameLength),DIMENSION(:),ALLOCATABLE :: AlphArray ! Character string data
REAL(r64), DIMENSION(:),ALLOCATABLE :: NumArray ! Numeric data
LOGICAL :: IsNotOK ! Flag to verify name
LOGICAL :: IsBlank ! Flag for blank name
LOGICAL :: ErrorsFound = .FALSE.
CHARACTER(len=MaxNameLength) :: CurrentModuleObject ! for ease in renaming.
INTEGER :: Item
INTEGER :: Item1
! FLOW:
MaxAlphas=0
MaxNums=0
CurrentModuleObject='DemandManager:ExteriorLights'
NumDemandMgrExtLights = GetNumObjectsFound(CurrentModuleObject)
IF (NumDemandMgrExtLights > 0) THEN
CALL GetObjectDefMaxArgs(CurrentModuleObject,NumParams,NumAlphas,NumNums)
MaxAlphas=MAX(MaxAlphas,NumAlphas)
MaxNums=MAX(MaxNums,NumNums)
ENDIF
CurrentModuleObject='DemandManager:Lights'
NumDemandMgrLights = GetNumObjectsFound(CurrentModuleObject)
IF (NumDemandMgrLights > 0) THEN
CALL GetObjectDefMaxArgs(CurrentModuleObject,NumParams,NumAlphas,NumNums)
MaxAlphas=MAX(MaxAlphas,NumAlphas)
MaxNums=MAX(MaxNums,NumNums)
ENDIF
CurrentModuleObject='DemandManager:ElectricEquipment'
NumDemandMgrElecEquip = GetNumObjectsFound(CurrentModuleObject)
IF (NumDemandMgrElecEquip > 0) THEN
CALL GetObjectDefMaxArgs(CurrentModuleObject,NumParams,NumAlphas,NumNums)
MaxAlphas=MAX(MaxAlphas,NumAlphas)
MaxNums=MAX(MaxNums,NumNums)
ENDIF
CurrentModuleObject='DemandManager:Thermostats'
NumDemandMgrThermostats = GetNumObjectsFound(CurrentModuleObject)
IF (NumDemandMgrThermostats > 0) THEN
CALL GetObjectDefMaxArgs(CurrentModuleObject,NumParams,NumAlphas,NumNums)
MaxAlphas=MAX(MaxAlphas,NumAlphas)
MaxNums=MAX(MaxNums,NumNums)
ENDIF
NumDemandMgr = NumDemandMgrExtLights + NumDemandMgrLights + NumDemandMgrElecEquip + NumDemandMgrThermostats
IF (NumDemandMgr > 0) THEN
ALLOCATE(AlphArray(MaxAlphas))
AlphArray=Blank
ALLOCATE(NumArray(MaxNums))
NumArray=0.0d0
ALLOCATE(DemandMgr(NumDemandMgr))
! Get input for DemandManager:ExteriorLights
StartIndex = 1
EndIndex = NumDemandMgrExtLights
CurrentModuleObject = 'DemandManager:ExteriorLights'
DO MgrNum = StartIndex, EndIndex
CALL GetObjectItem(CurrentModuleObject,MgrNum - StartIndex + 1,AlphArray,NumAlphas,NumArray,NumNums,IOSTAT, &
AlphaBlank=lAlphaFieldBlanks, AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
IsNotOK = .FALSE.
IsBlank = .FALSE.
CALL VerifyName(AlphArray(1),DemandMgr%Name,MgrNum - StartIndex,IsNotOK,IsBlank,TRIM(CurrentModuleObject)//' Name')
IF (IsNotOK) THEN
ErrorsFound = .TRUE.
IF (IsBlank) AlphArray(1) = 'xxxxx'
END IF
DemandMgr(MgrNum)%Name = AlphArray(1)
DemandMgr(MgrNum)%Type = ManagerTypeExtLights
IF (.NOT. lAlphaFieldBlanks(2) ) THEN
DemandMgr(MgrNum)%AvailSchedule = GetScheduleIndex(AlphArray(2))
IF (DemandMgr(MgrNum)%AvailSchedule .EQ. 0) THEN
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(2))//'="'//trim(AlphArray(2))//'" not found.')
ErrorsFound = .TRUE.
END IF
ELSE
DemandMgr(MgrNum)%AvailSchedule = ScheduleAlwaysOn
END IF
! Validate Limiting Control
SELECT CASE (AlphArray(3))
CASE ('OFF')
DemandMgr(MgrNum)%LimitControl = ManagerLimitOff
CASE ('FIXED')
DemandMgr(MgrNum)%LimitControl = ManagerLimitFixed
CASE ('VARIABLE')
DemandMgr(MgrNum)%LimitControl = ManagerLimitVariable
CASE DEFAULT
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid value'// &
trim(cAlphaFieldNames(3))//'="'//trim(AlphArray(3))//'".')
CALL ShowContinueError('...value must be one of Off, Fixed, or Variable.')
ErrorsFound = .TRUE.
END SELECT
DemandMgr(MgrNum)%LimitDuration = NumArray(1)
DemandMgr(MgrNum)%LowerLimit = NumArray(2)
! Validate Selection Control
SELECT CASE (AlphArray(4))
CASE ('ALL')
DemandMgr(MgrNum)%SelectionControl = ManagerSelectionAll
CASE ('ROTATEONE')
DemandMgr(MgrNum)%SelectionControl = ManagerSelectionOne
CASE ('ROTATEMANY')
DemandMgr(MgrNum)%SelectionControl = ManagerSelectionMany
CASE DEFAULT
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid value'// &
trim(cAlphaFieldNames(4))//'="'//trim(AlphArray(4))//'".')
CALL ShowContinueError('...value must be one of All, RotateOne, or RotateMany.')
ErrorsFound = .TRUE.
END SELECT
DemandMgr(MgrNum)%RotationDuration = NumArray(4)
DemandMgr(MgrNum)%NumOfLoads = NumAlphas - 4
IF (DemandMgr(MgrNum)%NumOfLoads > 0) THEN
ALLOCATE(DemandMgr(MgrNum)%Load(DemandMgr(MgrNum)%NumOfLoads))
DO LoadNum = 1, DemandMgr(MgrNum)%NumOfLoads
LoadPtr = FindItemInList(AlphArray(LoadNum + 4),ExteriorLights%Name,NumExteriorLights)
IF (LoadPtr > 0) THEN
DemandMgr(MgrNum)%Load(LoadNum) = LoadPtr
ELSE
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(LoadNum+4))//'="'//trim(AlphArray(LoadNum+4))//'" not found.')
ErrorsFound = .TRUE.
END IF
END DO ! LoadNum
END IF
END DO ! MgrNum
! Get input for DemandManager:Lights
StartIndex = EndIndex + 1
EndIndex = EndIndex + NumDemandMgrLights
CurrentModuleObject = 'DemandManager:Lights'
DO MgrNum = StartIndex, EndIndex
CALL GetObjectItem(CurrentModuleObject,MgrNum - StartIndex + 1,AlphArray,NumAlphas,NumArray,NumNums,IOSTAT, &
AlphaBlank=lAlphaFieldBlanks, AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
IsNotOK = .FALSE.
IsBlank = .FALSE.
CALL VerifyName(AlphArray(1),DemandMgr%Name,MgrNum - StartIndex,IsNotOK,IsBlank,TRIM(CurrentModuleObject)//' Name')
IF (IsNotOK) THEN
ErrorsFound = .TRUE.
IF (IsBlank) AlphArray(1) = 'xxxxx'
END IF
DemandMgr(MgrNum)%Name = AlphArray(1)
DemandMgr(MgrNum)%Type = ManagerTypeLights
IF (.not. lAlphaFieldBlanks(2)) THEN
DemandMgr(MgrNum)%AvailSchedule = GetScheduleIndex(AlphArray(2))
IF (DemandMgr(MgrNum)%AvailSchedule .EQ. 0) THEN
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(2))//'="'//trim(AlphArray(2))//'" not found.')
ErrorsFound = .TRUE.
END IF
ELSE
DemandMgr(MgrNum)%AvailSchedule = ScheduleAlwaysOn
END IF
! Validate Limiting Control
SELECT CASE (AlphArray(3))
CASE ('OFF')
DemandMgr(MgrNum)%LimitControl = ManagerLimitOff
CASE ('FIXED')
DemandMgr(MgrNum)%LimitControl = ManagerLimitFixed
CASE ('VARIABLE')
DemandMgr(MgrNum)%LimitControl = ManagerLimitVariable
CASE DEFAULT
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid value'// &
trim(cAlphaFieldNames(3))//'="'//trim(AlphArray(3))//'".')
CALL ShowContinueError('...value must be one of Off, Fixed, or Variable.')
ErrorsFound = .TRUE.
END SELECT
DemandMgr(MgrNum)%LimitDuration = NumArray(1)
DemandMgr(MgrNum)%LowerLimit = NumArray(2)
! Validate Selection Control
SELECT CASE (AlphArray(4))
CASE ('ALL')
DemandMgr(MgrNum)%SelectionControl = ManagerSelectionAll
CASE ('ROTATEONE')
DemandMgr(MgrNum)%SelectionControl = ManagerSelectionOne
CASE ('ROTATEMANY')
DemandMgr(MgrNum)%SelectionControl = ManagerSelectionMany
CASE DEFAULT
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid value'// &
trim(cAlphaFieldNames(4))//'="'//trim(AlphArray(4))//'".')
CALL ShowContinueError('...value must be one of All, RotateOne, or RotateMany.')
ErrorsFound = .TRUE.
END SELECT
DemandMgr(MgrNum)%RotationDuration = NumArray(4)
! Count actual pointers to controlled zones
DemandMgr(MgrNum)%NumOfLoads = 0
DO LoadNum=1,NumAlphas-4
LoadPtr = FindItemInList(AlphArray(LoadNum+4),LightsObjects%Name,NumLightsStatements)
IF (LoadPtr > 0) THEN
DemandMgr(MgrNum)%NumOfLoads=DemandMgr(MgrNum)%NumOfLoads + LightsObjects(LoadPtr)%NumOfZones
ELSE
LoadPtr = FindItemInList(AlphArray(LoadNum+4),Lights%Name,TotLights)
IF (LoadPtr > 0) THEN
DemandMgr(MgrNum)%NumOfLoads=DemandMgr(MgrNum)%NumOfLoads + 1
ELSE
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(LoadNum+4))//'="'//trim(AlphArray(LoadNum+4))//'" not found.')
ErrorsFound = .TRUE.
ENDIF
ENDIF
ENDDO
! DemandMgr(MgrNum)%NumOfLoads = NumAlphas - 4
IF (DemandMgr(MgrNum)%NumOfLoads > 0) THEN
ALLOCATE(DemandMgr(MgrNum)%Load(DemandMgr(MgrNum)%NumOfLoads))
LoadNum=0
DO Item = 1, NumAlphas-4
LoadPtr = FindItemInList(AlphArray(Item+4),LightsObjects%Name,NumLightsStatements)
IF (LoadPtr > 0) THEN
DO Item1=1,LightsObjects(LoadPtr)%NumOfZones
LoadNum=LoadNum+1
DemandMgr(MgrNum)%Load(LoadNum) = LightsObjects(LoadPtr)%StartPtr+Item1-1
ENDDO
ELSE
LoadPtr = FindItemInList(AlphArray(Item+4),Lights%Name,TotLights)
IF (LoadPtr > 0) THEN
LoadNum=LoadNum+1
DemandMgr(MgrNum)%Load(LoadNum) = LoadPtr
ENDIF
END IF
END DO ! LoadNum
END IF
END DO ! MgrNum
! Get input for DemandManager:ElectricEquipment
StartIndex = EndIndex + 1
EndIndex = EndIndex + NumDemandMgrElecEquip
CurrentModuleObject = 'DemandManager:ElectricEquipment'
DO MgrNum = StartIndex, EndIndex
CALL GetObjectItem(CurrentModuleObject, &
MgrNum - StartIndex + 1,AlphArray,NumAlphas,NumArray,NumNums,IOSTAT, &
AlphaBlank=lAlphaFieldBlanks, AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
IsNotOK = .FALSE.
IsBlank = .FALSE.
CALL VerifyName(AlphArray(1),DemandMgr%Name, &
MgrNum - StartIndex,IsNotOK,IsBlank,TRIM(CurrentModuleObject)//' Name')
IF (IsNotOK) THEN
ErrorsFound = .TRUE.
IF (IsBlank) AlphArray(1) = 'xxxxx'
END IF
DemandMgr(MgrNum)%Name = AlphArray(1)
DemandMgr(MgrNum)%Type = ManagerTypeElecEquip
IF (.not. lAlphaFieldBlanks(2)) THEN
DemandMgr(MgrNum)%AvailSchedule = GetScheduleIndex(AlphArray(2))
IF (DemandMgr(MgrNum)%AvailSchedule .EQ. 0) THEN
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(2))//'="'//trim(AlphArray(2))//'" not found.')
ErrorsFound = .TRUE.
END IF
ELSE
DemandMgr(MgrNum)%AvailSchedule = ScheduleAlwaysOn
END IF
! Validate Limiting Control
SELECT CASE (AlphArray(3))
CASE ('OFF')
DemandMgr(MgrNum)%LimitControl = ManagerLimitOff
CASE ('FIXED')
DemandMgr(MgrNum)%LimitControl = ManagerLimitFixed
CASE ('VARIABLE')
DemandMgr(MgrNum)%LimitControl = ManagerLimitVariable
CASE DEFAULT
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid value'// &
trim(cAlphaFieldNames(3))//'="'//trim(AlphArray(3))//'".')
CALL ShowContinueError('...value must be one of Off, Fixed, or Variable.')
ErrorsFound = .TRUE.
END SELECT
DemandMgr(MgrNum)%LimitDuration = NumArray(1)
DemandMgr(MgrNum)%LowerLimit = NumArray(2)
! Validate Selection Control
SELECT CASE (AlphArray(4))
CASE ('ALL')
DemandMgr(MgrNum)%SelectionControl = ManagerSelectionAll
CASE ('ROTATEONE')
DemandMgr(MgrNum)%SelectionControl = ManagerSelectionOne
CASE ('ROTATEMANY')
DemandMgr(MgrNum)%SelectionControl = ManagerSelectionMany
CASE DEFAULT
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid value'// &
trim(cAlphaFieldNames(4))//'="'//trim(AlphArray(4))//'".')
CALL ShowContinueError('...value must be one of All, RotateOne, or RotateMany.')
ErrorsFound = .TRUE.
END SELECT
DemandMgr(MgrNum)%RotationDuration = NumArray(4)
! Count actual pointers to controlled zones
DemandMgr(MgrNum)%NumOfLoads = 0
DO LoadNum=1,NumAlphas-4
LoadPtr = FindItemInList(AlphArray(LoadNum+4),ZoneElectricObjects%Name,NumZoneElectricStatements)
IF (LoadPtr > 0) THEN
DemandMgr(MgrNum)%NumOfLoads=DemandMgr(MgrNum)%NumOfLoads + ZoneElectricObjects(LoadPtr)%NumOfZones
ELSE
LoadPtr = FindItemInList(AlphArray(LoadNum+4),ZoneElectric%Name,TotElecEquip)
IF (LoadPtr > 0) THEN
DemandMgr(MgrNum)%NumOfLoads=DemandMgr(MgrNum)%NumOfLoads + 1
ELSE
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(LoadNum+4))//'="'//trim(AlphArray(LoadNum+4))//'" not found.')
ErrorsFound = .TRUE.
END IF
ENDIF
ENDDO
! DemandMgr(MgrNum)%NumOfLoads = NumAlphas - 4
IF (DemandMgr(MgrNum)%NumOfLoads > 0) THEN
ALLOCATE(DemandMgr(MgrNum)%Load(DemandMgr(MgrNum)%NumOfLoads))
LoadNum=0
DO Item = 1, NumAlphas-4
LoadPtr = FindItemInList(AlphArray(Item+4),ZoneElectricObjects%Name,NumZoneElectricStatements)
IF (LoadPtr > 0) THEN
DO Item1=1,ZoneElectricObjects(LoadPtr)%NumOfZones
LoadNum=LoadNum+1
DemandMgr(MgrNum)%Load(LoadNum) = ZoneElectricObjects(LoadPtr)%StartPtr+Item1-1
ENDDO
ELSE
LoadPtr = FindItemInList(AlphArray(Item+4),ZoneElectric%Name,TotElecEquip)
IF (LoadPtr > 0) THEN
LoadNum=LoadNum+1
DemandMgr(MgrNum)%Load(LoadNum) = LoadPtr
ENDIF
END IF
END DO ! LoadNum
END IF
END DO ! MgrNum
! Get input for DemandManager:Thermostats
StartIndex = EndIndex + 1
EndIndex = EndIndex + NumDemandMgrThermostats
CurrentModuleObject = 'DemandManager:Thermostats'
DO MgrNum = StartIndex, EndIndex
CALL GetObjectItem(CurrentModuleObject, &
MgrNum - StartIndex + 1,AlphArray,NumAlphas,NumArray,NumNums,IOSTAT, &
AlphaBlank=lAlphaFieldBlanks, AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
IsNotOK = .FALSE.
IsBlank = .FALSE.
CALL VerifyName(AlphArray(1),DemandMgr%Name, &
MgrNum - StartIndex,IsNotOK,IsBlank,TRIM(CurrentModuleObject)//' Name')
IF (IsNotOK) THEN
ErrorsFound = .TRUE.
IF (IsBlank) AlphArray(1) = 'xxxxx'
END IF
DemandMgr(MgrNum)%Name = AlphArray(1)
DemandMgr(MgrNum)%Type = ManagerTypeThermostats
IF (.not. lAlphaFieldBlanks(2)) THEN
DemandMgr(MgrNum)%AvailSchedule = GetScheduleIndex(AlphArray(2))
IF (DemandMgr(MgrNum)%AvailSchedule .EQ. 0) THEN
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(2))//'="'//trim(AlphArray(2))//'" not found.')
ErrorsFound = .TRUE.
END IF
ELSE
DemandMgr(MgrNum)%AvailSchedule = ScheduleAlwaysOn
END IF
! Validate Limiting Control
SELECT CASE (AlphArray(3))
CASE ('OFF')
DemandMgr(MgrNum)%LimitControl = ManagerLimitOff
CASE ('FIXED')
DemandMgr(MgrNum)%LimitControl = ManagerLimitFixed
CASE ('VARIABLE')
DemandMgr(MgrNum)%LimitControl = ManagerLimitVariable
CASE DEFAULT
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid value'// &
trim(cAlphaFieldNames(3))//'="'//trim(AlphArray(3))//'".')
CALL ShowContinueError('...value must be one of Off, Fixed, or Variable.')
ErrorsFound = .TRUE.
END SELECT
DemandMgr(MgrNum)%LimitDuration = NumArray(1)
DemandMgr(MgrNum)%LowerLimit = NumArray(2)
DemandMgr(MgrNum)%UpperLimit = NumArray(3)
IF (DemandMgr(MgrNum)%LowerLimit > DemandMgr(MgrNum)%UpperLimit) THEN
CALL ShowSevereError('Invalid input for '//TRIM(CurrentModuleObject)//' = '//TRIM(AlphArray(1)))
CALL ShowContinueError(TRIM(cNumericFieldNames(2))//' ['//TRIM(RoundSigDigits(NumArray(2),2))//'] > '// &
TRIM(cNumericFieldNames(3))//' ['//TRIM(RoundSigDigits(NumArray(3),2))//']')
CALL ShowContinueError(TRIM(cNumericFieldNames(2))//' cannot be greater than '//TRIM(cNumericFieldNames(3)) )
ErrorsFound = .TRUE.
END IF
! Validate Selection Control
SELECT CASE (AlphArray(4))
CASE ('ALL')
DemandMgr(MgrNum)%SelectionControl = ManagerSelectionAll
CASE ('ROTATEONE')
DemandMgr(MgrNum)%SelectionControl = ManagerSelectionOne
CASE ('ROTATEMANY')
DemandMgr(MgrNum)%SelectionControl = ManagerSelectionMany
CASE DEFAULT
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid value'// &
trim(cAlphaFieldNames(4))//'="'//trim(AlphArray(4))//'".')
CALL ShowContinueError('...value must be one of All, RotateOne, or RotateMany.')
ErrorsFound = .TRUE.
END SELECT
DemandMgr(MgrNum)%RotationDuration = NumArray(5)
! Count actual pointers to controlled zones
DemandMgr(MgrNum)%NumOfLoads = 0
DO LoadNum=1,NumAlphas-4
LoadPtr = FindItemInList(AlphArray(LoadNum+4),TStatObjects%Name,NumTStatStatements)
IF (LoadPtr > 0) THEN
DemandMgr(MgrNum)%NumOfLoads=DemandMgr(MgrNum)%NumOfLoads + TStatObjects(LoadPtr)%NumOfZones
ELSE
LoadPtr = FindItemInList(AlphArray(LoadNum+4),TempControlledZone%Name,NumTempControlledZones)
IF (LoadPtr > 0) THEN
DemandMgr(MgrNum)%NumOfLoads=DemandMgr(MgrNum)%NumOfLoads + 1
ELSE
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(LoadNum+4))//'="'//trim(AlphArray(LoadNum+4))//'" not found.')
ErrorsFound = .TRUE.
ENDIF
ENDIF
ENDDO
IF (DemandMgr(MgrNum)%NumOfLoads > 0) THEN
ALLOCATE(DemandMgr(MgrNum)%Load(DemandMgr(MgrNum)%NumOfLoads))
LoadNum=0
DO Item = 1, NumAlphas-4
LoadPtr = FindItemInList(AlphArray(Item+4),TStatObjects%Name,NumTStatStatements)
IF (LoadPtr > 0) THEN
DO Item1=1,TStatObjects(LoadPtr)%NumOfZones
LoadNum=LoadNum+1
DemandMgr(MgrNum)%Load(LoadNum) = TStatObjects(LoadPtr)%TempControlledZoneStartPtr+Item1-1
ENDDO
ELSE
LoadPtr = FindItemInList(AlphArray(Item+4),TempControlledZone%Name,NumTempControlledZones)
IF (LoadPtr > 0) THEN
LoadNum=LoadNum+1
DemandMgr(MgrNum)%Load(LoadNum) = LoadPtr
ENDIF
END IF
END DO ! LoadNum
END IF
END DO ! MgrNum
DEALLOCATE(AlphArray)
DEALLOCATE(NumArray)
END IF
IF (ErrorsFound) THEN
CALL ShowFatalError('Errors found in processing input for demand managers. Preceding condition causes termination.')
END IF
RETURN
END SUBROUTINE GetDemandManagerInput