K-LINE Telescope History File Topic; Loop Timing The K-line oscillation data are taken periodically, with a timing that is set by the loop in the CCDOSCIL program. This file describes the timing and changes in timing over the operation of the K-line. Basic Principles -------------------- Each observing program specifies a set of parameters that are used by the observing code to control the timing of the data. The parameters are listed in an ascii file named DEFAULT.CCD. Separate files for the observing programs BJL01, BJL03, and KAB01 are kept. The appropriate file is copied into DEFAULT.CCD at the time of observation. The critical parameters for the loop timing are: NOVER Oscillation overhead per exposure, ticks NDISP Oscillation overhead for image display, ticks NTRAN Oscillation overhead for file transfer, ticks NCLR Oscillation overhead for cache clear, ticks DTIME Oscillation time interval between image sums, seconds The oscillation loop records one image at a cadence of DTIME seconds. During DTIME, the camera exposes and reads out the CCD and sums each exposure into the final image. The exposure time EXPTIME plus the overhead for readout and summation NOVER total to the interval between exposures DELTIM (FITS header keyword EXPNTRVL). There are NUMEXP such exposures per DTIME, with 0 < NUMEXP < 17. Each DTIME concludes with the transfer of the image to storage, which takes NTRAN, the display of the image to the screen, which takes NDISP, and in some cases the clearing of the CCD controller caches, which takes NCLR. Improvement in the code now permits NCLR to be 0. The closk in the K-LINE control computer TARO (an LSI-11) counts in units of ticks; there are 60 ticks per second (TKPRSC). This granularity, plus the fact that NUMEXP must be an integer, means that the DTIME interval is never fully used. The unused time is called free time (TFREE). A part of the free time is used during the exposure sequence to get more uniform timing; that part is extra time (XTIME). Precise Timing ------------------------ The earliest versions of the oscilllation code worked in a simple way as outlined above. But as the exposure time and the number of exposures vary, the effective time of the image moves around internal to DTIME. This deviation from stable timing can limit the accuracy of oscillation frequencies measured from the data. In April 1991 Robert Ronan altered the code to insure that the effective time of the image remains centered within DTIME. The simple way to insure the centering is to add NOVER onto the beginning of the exposure sequence, and divide the extra time equally between the beginning and the end of the exposure sequence. Exact Calculations --------------------- The version of CCDOSCIL dated 16-Oct-91 is the longest running version and has the most accurate loop timing. This section discusses its behavior. The image cadence in ticks is found: imint = int(dtime * tkprsc) The time available in each cadence interval for exposures is then: navail = imint - ndisp - ntran The number of exposures that can be fit into the avilable time is: numexp = navail/(exptim + nover) The extra time, that is, the unused part of NAVAIL in seconds is: xtime= ((float(navail)/float(numexp))-(exptim+nover))/2.0 xtime = xtime + float(nover) / 2. xtime = xtime / tkprsc This includes the equal division of the extra time between beginning and end of the exposure sequence. This also includes a better solution to the time centering problem. Rather than adding NOVER to the beginning, the final NOVER is divided in half, and half moved to the beginning. The actual exposure spacing is: deltim = float(navail)/tkprsc/floati(numexp) The granularity of the Taro clock requires that timing be trapped in a window. The length of the window, beginning from a reference time is defined by: blow = xtime - 0.033 bhigh = xtime + 0.033 A number of clocks are carried along. They are initialized by: etime = 0.0 tnext0 = 0.0 tnext = 0.0 + xtime The time ETIME is the middle time of each exposure as measured from the beginning of each cycle. ETIME is displayed for each image but not saved. The beginning of a cycle is defined by TNEXT0. The loop waits to begin (for the first image in an observing run) with an even minute U.T. as the reference time. The actual time to initate the first exposure is XTIME after the reference: 1155 ta = secnds(0.0) t1 = amod(ta, 60.) if ((t1 .lt. blow ) .or. (t1.gt. bhigh)) go to 1155 t0 = ta The time T1 is the time in seconds past the last even minute. The window determines the initiation of the loop. The time T0 is the recorded reference time. The time written into the FITS file header is the time at the beginning of the first exposure. The code is: 1170 call time(time1) call idate(month, nday, nyear) do 1190 i=1,numexp j = doexp(ccddev, exptim, 1) The exposures are moved or summed into the cache as appropriate. The running clocks are updated with each exposure: etime = etime + tnext - tnext0 + (exptim/(tkprsc*2.0)) tnext = tnext + deltim tfree = tnext - secnds(t0) The code then waits to start the next exposure: 1180 tl = secnds(t0) - tnext if(tl.lt.-0.016667) go to 1180 1190 continue After the image is transferred and displayed, the image intensity is used to determine a new value of EXPTIM. If needed, NUMEXP is also updated. Then the running clocks are updated: xtime=((float(navail)/float(numexp))-(exptim+nover))/2.0 xtime = xtime + nover xtime = xtime / tkprsc tnext0 = tnext0 + dtime tnextst = tnext0 + xtime tnext = tnext0 + xtime (OOPS - this differs from the first time through. Here, NOVER is added at the beginning. So the first image may be different from all the others.) The free time displayed is TNEXT0 - (time now). The loop waits until the next start time TNEXT0: 1230 t2 = secnds(t0) if((t2-tnextst) .lt. -0.0250) go to 1230 Effective time of image ------------------------ The actual effective time of the image can be calculated from the timing equations. We have to define a value that is not separately kept by the observing code: delta = ((float(navail)/float(numexp))-(exptim+nover))/2.0 The offset XTIME is then (for all but the first image): xtime = delta + nover Compared to the beginning of the cadence interval TNEXT0, the centers of the exposures occur at: T(i) = XTIME + (EXPTIM/2) + DELTIM * (i-1), with i=1,NUMEXP. Summing and dividing by NUMEXP gives: T(eff) = XTIME + (EXPTIM/2) + DELTIM * (NUMEXP-1)/2. The definition of DELTIM is: DELTIM = NAVAIL/NUMEXP = EXPTIM + NOVER + 2 * DELTA The final result is: T(eff) = DELTA + NOVER + EXPTIM/2 + NAVAIL/2 - EXPTIM/2 - NOVER/2 - DELTA = NAVAIL/2 + NOVER/2 independent of EXPTIM or NUMEXP. If the code used the convention of the first image for XTIME, then this would be exactly NAVAIL/2. The default values for NAVAIL and NOVER do not change generally. The following table gives the known history of the parameters. DATE NOVER NDISP NTRAN NCLR (ticks) --------------------------------------------------------------------- 14-SEP-89 - |-- 1140 ------| 31-OCT-89 150 840 150 150 24-JUN-92 175 640 150 0 01-OCT-94 135 610 150 0 -------------------------------------------------------------------- Some other imformation is available: DATE CONSTRAINT -------------------------------------------------------------------- 03-DEC-88 Cadence = 60 sec Exptim = 51 ticks Numexp = 7 Free time / exposure = 2.7 sec Free time / cadence = 2.1 sec Define BLOCK = NDISP + NTRAN + NCLR. Then, 60 - 7*(EXPTIM + Free time) <= BLOCK + 7 * NOVER, or 35.15 <= BLOCK + 7 * NOVER. This is consistent with the 31-OCT-89 values; BLOCK + 7 * NOVER = 36.5 sec. 29-MAR-89 Cadence = 60 sec Exptim = 56 ticks Numexp = 10 Free time / exposure = 1.0 sec Free time / cadence = 2.0 sec Overhead values were changed on this date, before this constraint. 60 - 10 * (EXPTIM + Free time) <= BLOCK + 10 * NOVER, or 40.67 <= BLOCK + 10 * NOVER. This is consistent with the 31-OCT-89 values; BLOCK + 10 * NOVER = 44. sec. 14-SEP-89 Cadence = 60 sec Exptim = 42 ticks Numexp = 12 DELTIM = 3.417 sec Free time / exposure = 0.85 sec Free time / cadence = 0.60 sec We can get 2 limits on NOVER from this data. NAVAIL = NUMEXP * DELTIM = 41. sec NOVER <= NAVAIL/NUMEXP - EXPTIM = 163 ticks NOVER >= DELTIM - EXPTIM - Free time = 112 ticks These suggest that NOVER = 150 is consistent. -------------------------------------------------------------------- The FITS headers for each image file contain the values of NUMEXP and EXPNTRVL = DELTIM. The current value of NAVAIL is just NAVAIL = DELTIM * NUMEXP. The recorded values are to the nearest tick, and have a scatter of about +/- 1 tick from roundoff error. The variation of NOVER over time is small, so the timing is well known. Old code versions ---------------------------------------------------- Before the Ronan improvements in April 1991, the code loop did not hold the effective times of the images constant. The first exposure began at the beginning interval TNEXT0. The exposures were distributed at uniform intervals during NAVAIL. There were jumps in the effective time of the image as the code changed NUMEXP in response to changes in EXPTIM. The offset time XTIME was not present. We can compute the effective times of old images by setting XTIME to zero. Then the effective time becomes: T(eff) = EXPTIM/2 + DELTIM * (NUMEXP-1)/2 = EXPTIM/2 + NAVAIL/2 - NAVAIL/(2*NUMEXP) = EXPTIM/2 + {NAVAIL * [ 1/2 - 1/(2*NUMEXP) ]}. At long EXPTIM, NUMEXP = 1 and T(eff) varies linearly with EXPTIM. When the exposure time gets short enough to make NUMEXP > 1, the term in brackets jumps from zero to NAVAIL * (1/2 - 1/4), then * (1/2 - 1/6), * (1/2 - 1/8), etc. The asymptotic limit as EXPTIM -> 0 and NUMEXP >> 1 is T(eff) -> NAVAIL/2. ----------------------------------------------------------------------