Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | GlheNum |
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 CalcAggregateLoad(GlheNum)
! SUBROUTINE INFORMATION:
! AUTHOR: Arun Murugappan
! DATE WRITTEN: August, 2000
! MODIFIED: na
! RE-ENGINEERED: na
! PURPOSE OF THIS SUBROUTINE:
! Manages the heat transfer history.
! METHODOLOGY EMPLOYED:
! The heat pulse histories need to be recorded over an extended period (months).
! To aid computational efficiency past pulses are continuously agregated into
! equivalent heat pulses of longer duration, as each pulse becomes less recent.
! Past sub-hourly loads are re-aggregated into equivalent hourly and monthly loads.
! REFERENCES:
! Eskilson, P. 'Thermal Analysis of Heat Extraction Boreholes' Ph.D. Thesis:
! Dept. of Mathematical Physics, University of Lund, Sweden, June 1987.
! Yavuzturk, C., J.D. Spitler. 1999. 'A Short Time Step Response Factor Model
! for Vertical Ground Loop Heat Exchangers. ASHRAE Transactions. 105(2): 475-485.
! USE STATEMENTS:
! na
INTEGER, INTENT(IN):: GlheNum
!LOCAL VARIABLES
REAL(r64) :: SumQnMonth ! intermediate variable to store the Montly heat rejection/
REAL(r64) :: SumQnHr
INTEGER :: MonthNum
INTEGER :: J ! Loop counter
INTEGER,SAVE, ALLOCATABLE,DIMENSION(:):: PrevHour ! Saved Var to store the previous hour
! LOGICAL,SAVE :: Allocated = .FALSE.
LOGICAL, SAVE :: MyEnvrnFlag = .TRUE.
IF(MyEnvrnFlag .AND. BeginEnvrnFlag)THEN
! IF(.not.Allocated)THEN
! ALLOCATE(PrevHour(NumVerticalGlhes))
IF(.NOT. ALLOCATED(PrevHour)) ALLOCATE(PrevHour(NumVerticalGlhes))
! Allocated = .TRUE.
MyEnvrnFlag = .FALSE.
PrevHour = 1
END IF
IF (CurrentSimTime .LE. 0.0d0) RETURN
IF(.NOT. BeginEnvrnFlag) MyEnvrnFlag = .TRUE.
!FOR EVERY HOUR UPDATE THE HOURLY QN QnHr(J)
!THIS IS DONE BY AGGREGATING THE SUBHOURLY QN FROM THE PREVIOUS HOUR TO UNTIL THE CURRNET HOUR
!AND STORING IT IN VerticalGlhe(GlheNum)%QnHr(J)
!SUBHOURLY Qn IS NOT AGGREGATED . IT IS THE BASIC LOAD
IF(PrevHour(GlheNum) /= LocHourOfDay )THEN
SumQnHr=0.0d0
DO J = 1, (N - VerticalGlhe(GlheNum)%LastHourN(1)) ! Check during debugging if we need a +1
SumQnHr = SumQnHr + VerticalGlhe(GlheNum)%QnSubHr(J)*ABS((PrevTimeSteps(J)-PrevTimeSteps(J+1)))
END DO
SumQnHr = SumQnHr/ABS(PrevTimeSteps(1)-PrevTimeSteps(J))
VerticalGlhe(GlheNum)%QnHr = EOSHIFT(VerticalGlhe(GlheNum)%QnHr,-1,SumQnHr)
VerticalGlhe(GlheNum)%LastHourN = EOSHIFT(VerticalGlhe(GlheNum)%LastHourN,-1,N)
END IF
!CHECK IF A MONTH PASSES...
IF(MOD(((LocDayOfSim-1)*HrsPerDay+(LocHourOfDay)),HrsPerMonth).EQ.0 .AND. PrevHour(GlheNum) /= LocHourOfDay)THEN
MonthNum = (LocDayOfSim*HrsPerDay+LocHourOfDay)/HrsPerMonth
SumQnMonth=0.0d0
DO J = 1, Int(HrsPerMonth)
SumQnMonth = SumQnMonth+VerticalGlhe(GlheNum)%QnHr(J)
END DO
SumQnMonth = SumQnMonth/HrsPerMonth
VerticalGlhe(GlheNum)%QnMonthlyAgg(MonthNum) = SumQnMonth
END IF
IF(PrevHour(GlheNum) /= LocHourOfDay)THEN
PrevHour(GlheNum) = LocHourOfDay
END IF
END SUBROUTINE CalcAggregateLoad