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 GetDemandManagerListInput
! SUBROUTINE INFORMATION:
! AUTHOR Peter Graham Ellis
! DATE WRITTEN July 2005
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Gets the DEMAND MANAGER LIST 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 OutputProcessor, ONLY: EnergyMeters
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE PARAMETER DEFINITIONS:
CHARACTER(len=*), PARAMETER :: Blank = ' '
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: ListNum
INTEGER :: MgrNum
INTEGER :: NumAlphas ! Number of elements in the alpha array
INTEGER :: NumNums ! Number of elements in the numeric array
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
CHARACTER(len=5) :: Units ! String for meter units
INTEGER, EXTERNAL :: GetMeterIndex
LOGICAL :: ErrorsFound = .FALSE.
CHARACTER(len=MaxNameLength) :: CurrentModuleObject ! for ease in renaming.
! FLOW:
CurrentModuleObject = 'DemandManagerAssignmentList'
CALL GetObjectDefMaxArgs(CurrentModuleObject,ListNum,NumAlphas,NumNums)
NumDemandManagerList = GetNumObjectsFound(CurrentModuleObject)
IF (NumDemandManagerList > 0) THEN
ALLOCATE(AlphArray(NumAlphas))
AlphArray=Blank
ALLOCATE(NumArray(NumNums))
NumArray=0.0d0
ALLOCATE(DemandManagerList(NumDemandManagerList))
DO ListNum = 1, NumDemandManagerList
CALL GetObjectItem(CurrentModuleObject,ListNum,AlphArray,NumAlphas,NumArray,NumNums,IOSTAT, &
AlphaBlank=lAlphaFieldBlanks, AlphaFieldnames=cAlphaFieldNames,NumericFieldNames=cNumericFieldNames)
IsNotOK = .FALSE.
IsBlank = .FALSE.
CALL VerifyName(AlphArray(1),DemandManagerList%Name,ListNum-1,IsNotOK,IsBlank,TRIM(CurrentModuleObject)//' Name')
IF (IsNotOK) THEN
ErrorsFound = .TRUE.
IF (IsBlank) AlphArray(1) = 'xxxxx'
END IF
DemandManagerList(ListNum)%Name = AlphArray(1)
DemandManagerList(ListNum)%Meter = GetMeterIndex(AlphArray(2))
IF (DemandManagerList(ListNum)%Meter .EQ. 0) THEN
CALL ShowSevereError('Invalid '//TRIM(cAlphaFieldNames(2))//'='//TRIM(AlphArray(2)))
CALL ShowContinueError('Entered in '//TRIM(CurrentModuleObject)//'='//TRIM(AlphArray(1)))
ErrorsFound = .TRUE.
ELSE
SELECT CASE (EnergyMeters(DemandManagerList(ListNum)%Meter)%ResourceType)
CASE ('Electricity', 'ElectricityNet')
Units = '[W]' ! For setup of report variables
CASE DEFAULT
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid value '// &
trim(cAlphaFieldNames(2))//'="'//trim(AlphArray(2))//'".')
CALL ShowContinueError('Only Electricity and ElectricityNet meters are currently allowed.')
ErrorsFound = .TRUE.
END SELECT
END IF
! Further checking for conflicting DEMAND MANAGER LISTs
IF ( .NOT. lAlphaFieldBlanks(3) ) THEN
DemandManagerList(ListNum)%LimitSchedule = GetScheduleIndex(AlphArray(3))
IF (DemandManagerList(ListNum)%LimitSchedule .EQ. 0) THEN
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(3))//'="'//trim(AlphArray(3))//'" not found.')
ErrorsFound = .TRUE.
END IF
END IF
DemandManagerList(ListNum)%SafetyFraction = NumArray(1)
IF ( .NOT. lAlphaFieldBlanks(4) ) THEN
DemandManagerList(ListNum)%BillingSchedule = GetScheduleIndex(AlphArray(4))
IF (DemandManagerList(ListNum)%BillingSchedule .EQ. 0) THEN
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(4))//'="'//trim(AlphArray(4))//'" not found.')
ErrorsFound = .TRUE.
END IF
END IF
IF ( .NOT. lAlphaFieldBlanks(5) ) THEN
DemandManagerList(ListNum)%PeakSchedule = GetScheduleIndex(AlphArray(5))
IF (DemandManagerList(ListNum)%PeakSchedule .EQ. 0) THEN
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(5))//'="'//trim(AlphArray(5))//'" not found.')
ErrorsFound = .TRUE.
END IF
END IF
DemandManagerList(ListNum)%AveragingWindow = MAX(INT(NumArray(2) / MinutesPerTimeStep), 1)
! Round to nearest timestep
! Can make this fancier to include windows that do not fit the timesteps
ALLOCATE(DemandManagerList(ListNum)%History(DemandManagerList(ListNum)%AveragingWindow))
DemandManagerList(ListNum)%History = 0.0d0
! Validate Demand Manager Priority
SELECT CASE (AlphArray(6))
CASE ('SEQUENTIAL')
DemandManagerList(ListNum)%ManagerPriority = ManagerPrioritySequential
CASE ('OPTIMAL')
DemandManagerList(ListNum)%ManagerPriority = ManagerPriorityOptimal
CASE ('ALL')
DemandManagerList(ListNum)%ManagerPriority = ManagerPriorityAll
CASE DEFAULT
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid value '// &
trim(cAlphaFieldNames(6))//'="'//trim(AlphArray(6))//'" not found.')
ErrorsFound = .TRUE.
END SELECT
! Get DEMAND MANAGER Type and Name pairs
DemandManagerList(ListNum)%NumOfManager = INT((NumAlphas - 6) / 2.0d0)
IF (DemandManagerList(ListNum)%NumOfManager > 0) THEN
ALLOCATE(DemandManagerList(ListNum)%Manager(DemandManagerList(ListNum)%NumOfManager))
DO MgrNum = 1, DemandManagerList(ListNum)%NumOfManager
! Validate DEMAND MANAGER Type
SELECT CASE (AlphArray(MgrNum*2 + 5))
CASE ('DEMANDMANAGER:LIGHTS', &
'DEMANDMANAGER:EXTERIORLIGHTS', &
'DEMANDMANAGER:ELECTRICEQUIPMENT', &
'DEMANDMANAGER:THERMOSTATS')
DemandManagerList(ListNum)%Manager(MgrNum) = FindItemInList(AlphArray(MgrNum*2 + 6),DemandMgr%Name,NumDemandMgr)
IF (DemandManagerList(ListNum)%Manager(MgrNum) .EQ. 0) THEN
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid '// &
trim(cAlphaFieldNames(MgrNum*2 + 6))//'="'//trim(AlphArray(MgrNum*2 + 6))//'" not found.')
ErrorsFound = .TRUE.
END IF
CASE DEFAULT
CALL ShowSevereError(trim(CurrentModuleObject)//'="'//trim(cAlphaArgs(1))//'" invalid value '// &
trim(cAlphaFieldNames(MgrNum*2 + 5))//'="'//trim(AlphArray(MgrNum*2 + 5))//'".')
ErrorsFound = .TRUE.
END SELECT
! Check that each is not already referenced using %DemandManagerList field
END DO ! MgrNum
END IF
! Setup report variables
CALL SetupOutputVariable('Demand Manager Meter Demand Power [W]', &
DemandManagerList(ListNum)%MeterDemand,'Zone','Average', &
DemandManagerList(ListNum)%Name)
CALL SetupOutputVariable('Demand Manager Average Demand Power [W]', &
DemandManagerList(ListNum)%AverageDemand,'Zone','Average', &
DemandManagerList(ListNum)%Name)
CALL SetupOutputVariable('Demand Manager Peak Demand Power [W]', &
DemandManagerList(ListNum)%PeakDemand,'Zone','Average', &
DemandManagerList(ListNum)%Name)
CALL SetupOutputVariable('Demand Manager Scheduled Limit Power [W]', &
DemandManagerList(ListNum)%ScheduledLimit,'Zone','Average', &
DemandManagerList(ListNum)%Name)
CALL SetupOutputVariable('Demand Manager Demand Limit Power [W]', &
DemandManagerList(ListNum)%DemandLimit,'Zone','Average', &
DemandManagerList(ListNum)%Name)
CALL SetupOutputVariable('Demand Manager Over Limit Power [W]', &
DemandManagerList(ListNum)%OverLimit,'Zone','Average', &
DemandManagerList(ListNum)%Name)
CALL SetupOutputVariable('Demand Manager Over Limit Time [hr]', &
DemandManagerList(ListNum)%OverLimitDuration,'Zone','Sum', &
DemandManagerList(ListNum)%Name)
IF (ErrorsFound) THEN
CALL ShowFatalError('Errors found in processing input for '//TRIM(CurrentModuleObject) )
END IF
END DO ! ListNum
DEALLOCATE(AlphArray)
DEALLOCATE(NumArray)
! Iteration diagnostic reporting for all DEMAND MANAGER LISTs
CALL SetupOutputVariable('Demand Manager Exterior Energy Iteration Count []', &
DemandManagerExtIterations,'Zone','Sum','ManageDemand')
CALL SetupOutputVariable('Demand Manager Heat Balance Iteration Count []', &
DemandManagerHBIterations,'Zone','Sum','ManageDemand')
CALL SetupOutputVariable('Demand Manager HVAC Iteration Count []', &
DemandManagerHVACIterations,'Zone','Sum','ManageDemand')
END IF
RETURN
END SUBROUTINE GetDemandManagerListInput