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 | ||
---|---|---|---|---|---|---|
integer | :: | ScheduleIndex | ||||
integer, | optional | :: | ThisHour | |||
integer, | optional | :: | ThisTimeStep | |||
integer, | optional | :: | ThisDayOfYear |
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.
REAL(r64) FUNCTION LookUpScheduleValue(ScheduleIndex, ThisHour, ThisTimeStep, ThisDayOfYear)
! FUNCTION INFORMATION:
! AUTHOR Linda K. Lawrie
! DATE WRITTEN January 2003
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS FUNCTION:
! This function provides a method to look up schedule values for any hour, timestep, day
! of the year (rather than just the "current time").
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
USE DataEnvironment, ONLY: DayOfYear_Schedule
USE General, ONLY: JulianDay
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! FUNCTION ARGUMENT DEFINITIONS:
INTEGER ScheduleIndex
INTEGER, OPTIONAL :: ThisHour
INTEGER, OPTIONAL :: ThisTimeStep
INTEGER, OPTIONAL :: ThisDayOfYear
! FUNCTION PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! FUNCTION LOCAL VARIABLE DECLARATIONS:
INTEGER WeekSchedulePointer
INTEGER DaySchedulePointer
INTEGER WhichHour
INTEGER WhichTimeStep
IF (.not. ScheduleInputProcessed) THEN
CALL ProcessScheduleInput
ScheduleInputProcessed=.true.
ENDIF
IF (ScheduleIndex == -1) THEN
LookUpScheduleValue=1.0d0
RETURN
ELSEIF (ScheduleIndex == 0) THEN
LookUpScheduleValue=0.0d0
RETURN
ENDIF
IF (.not. PRESENT(ThisHour)) THEN
LookUpScheduleValue=GetCurrentScheduleValue(ScheduleIndex)
! ELSEIF (ThisHour == 0) THEN ! odd answers when thishour=0 (initialization of shadowing)
! LookUpScheduleValue=GetCurrentScheduleValue(ScheduleIndex)
ELSEIF (.not. PRESENT(ThisDayOfYear)) THEN ! ThisHour present, check other optional parameters
! so, current date, but maybe TimeStep added
! Determine which Week Schedule is used
! Cant use stored day of year because of leap year inconsistency
WeekSchedulePointer=Schedule(ScheduleIndex)%WeekSchedulePointer(DayOfYear_Schedule)
! Now, which day?
IF (DayofWeek <= 7 .and. HolidayIndex > 0) THEN
DaySchedulePointer=WeekSchedule(WeekSchedulePointer)%DaySchedulePointer(7+HolidayIndex)
ELSE
DaySchedulePointer=WeekSchedule(WeekSchedulePointer)%DaySchedulePointer(DayofWeek)
ENDIF
! Hourly Value
WhichHour=HourOfDay+DSTIndicator
IF (WhichHour <= 24) THEN
LookUpScheduleValue=DaySchedule(DaySchedulePointer)%TSValue(WhichHour,TimeStep)
ELSE
LookUpScheduleValue=DaySchedule(DaySchedulePointer)%TSValue(WhichHour-24,TimeStep)
ENDIF
WhichHour=ThisHour
DO WHILE (WhichHour < 1)
WhichHour=WhichHour+24
END DO
IF (WhichHour > 24) THEN
DO WHILE (WhichHour > 24)
WeekSchedulePointer=Schedule(ScheduleIndex)%WeekSchedulePointer(JulianDay(MonthTomorrow,DayOfMonthTomorrow,1))
IF (DayofWeekTomorrow <=7 .and. HolidayIndexTomorrow > 0) THEN
DaySchedulePointer=WeekSchedule(WeekSchedulePointer)%DaySchedulePointer(7+HolidayIndexTomorrow)
ELSE
DaySchedulePointer=WeekSchedule(WeekSchedulePointer)%DaySchedulePointer(DayofWeekTomorrow)
ENDIF
WhichHour=WhichHour-24
END DO
ELSE
! Determine which Week Schedule is used
! Cant use stored day of year because of leap year inconsistency
WeekSchedulePointer=Schedule(ScheduleIndex)%WeekSchedulePointer(DayOfYear_Schedule)
! Now, which day?
IF (DayofWeek <= 7 .and. HolidayIndex > 0) THEN
DaySchedulePointer=WeekSchedule(WeekSchedulePointer)%DaySchedulePointer(7+HolidayIndex)
ELSE
DaySchedulePointer=WeekSchedule(WeekSchedulePointer)%DaySchedulePointer(DayofWeek)
ENDIF
ENDIF
WhichHour=WhichHour+DSTIndicator
IF (PRESENT(ThisTimeStep)) THEN
IF (ThisTimeStep == 0) THEN
WhichTimeStep=NumOfTimeStepInHour
ELSE
WhichTimeStep=ThisTimeStep
ENDIF
IF (WhichHour <= 24) THEN
LookUpScheduleValue=DaySchedule(DaySchedulePointer)%TSValue(WhichHour,WhichTimeStep)
ELSEIF (ThisTimeStep <= NumOfTimeStepInHour) THEN
LookUpScheduleValue=DaySchedule(DaySchedulePointer)%TSValue(WhichHour-24,WhichTimeStep)
ELSE
LookUpScheduleValue=DaySchedule(DaySchedulePointer)%TSValue(WhichHour-24,NumOfTimeStepInHour)
ENDIF
ELSE
IF (WhichHour <= 24) THEN
LookUpScheduleValue=DaySchedule(DaySchedulePointer)%TSValue(WhichHour,NumOfTimeStepInHour)
ELSE
LookUpScheduleValue=DaySchedule(DaySchedulePointer)%TSValue(WhichHour-24,NumOfTimeStepInHour)
ENDIF
ENDIF
ELSE ! date present, not ready for that yet.
CALL ShowFatalError('DayofYear Requested in LookUpScheduleValue, not implemented yet')
ENDIF
RETURN
END FUNCTION LookUpScheduleValue