
	/* a program which tries to schedule observing on an automatic telescope 
	   following the procedure used by ATIS scopes, as described in Chapter 12
	   of "Robotic Observatories." */

#include <stdio.h>
#include <math.h>
#include "listgen.h"

#define UT_INC     600.0		/* number of seconds by which to advance */
                        		/*   clocks if no object selected now */

main(argc, argv)
int argc;
char *argv[];
{
	int i, j, k;
	int num_list, num_groups;
	double jd, ut, lst;
	double start_jd, start_ut, end_ut, start_lst;
	struct target *tar, *atis_select();

	start_jd = 1.0;
	start_ut = 6.0;
	end_ut = 18.0;
	start_lst = 6.0;

	/* initialize the JD, UT, and LST clocks */
	set_clocks(start_jd, start_ut, start_lst);

	num_list = read_input();
	target_ids(num_list);

	while (1) {
		now(&jd, &ut, &lst);
		if (ut >= end_ut)
			break;
		if ((tar = atis_select(num_list)) == (struct target *) NULL) {
			advance_clocks(UT_INC);
		}
		else {
			observe(tar);
		}
	}

}
