;+
; PROJECT
;          SolarB EIS
;
; NAME
;          EIS_TL_DURATION
;
; PURPOSE
;          Function to calculate the duration of an eis_study (ms)
;
; CATEGORY
;          EIS timeline planning
;
; WRITTEN
;          John Rainnie, RAL, 18-Jun-2008
;
; HISTORY
;          v0.1 JAR 19-Jun-2008
;               Get raster duration from raster database. This has no raster
;               repeats.
;
;-
;______________________________________________________________________________
FUNCTION eis_tl_duration , tl

t     = LONG64(0)
sc    = tl.science_component
st_id = sc.study_id

FOR i = 0, sc.nRasters-1 DO BEGIN

    ; Get studyRaster
    sra        = sc.studyRasters[i]

    ; Get duration from raster database - single repeat
    status     = eis_open_db(/RASTER)
    ra_dur     = dbval(sra.ra_id, 'RA_DURATION')
    dbclose

    ; Get total duration (duration * repeats)
    ra_dur     = ra_dur * sra.ra_repeats
    t          = t + ra_dur

ENDFOR

t = t + LONG64(21.e3)                   ; slit-slot movement
t = t + LONG64(1.5e3 * sc.nRasters)     ; per raster - movement to MIP

RETURN , LONG64(t)

END
