/* Howell's version of rate.c */ /* February 27, 1994 */ /* 1999_12_29 RRH Modified for Linux tracking */ /* 2000_01_14 RRH Fixed seconds_on_object rolloever at 0 UT */ /* #include */ #include #include "/home/observer/wiro/track/wirotypes.h" #include "/home/observer/wiro/track/track.h" #include "/home/observer/wiro/track/wiro.h" #include struct wiro_memory *tinfo, *get_tinfo(); main( argc, argv ) int argc; char *argv[ ]; { struct timeval timeonobj; double seconds_on_object; double vra, vdec; char s1[ 98 ]; tinfo = get_tinfo(); /* attach shared memory */ /* if ( NULL == ( tinfo = (struct wiro_memory *) smem_get("WIRO_MEMORY",sizeof(*tinfo), SM_READ | SM_WRITE ) ) ) { */ /* printf("Unable to open shared memory \n"); exit(-1); } */ if ( argc == 2 ) { vdec= V_DEC ; vra = V_RA * 15.; if ( tinfo->motion_type == NON_SOLAR) { printf(" Special version for use only with solar system objects."); exit(1); /* printf(" (\"/s) ra: %10.4f dec %10.4f\n", vra, vdec ); */ } else { printf(" (\"/s) ra: %11.5lf dec %11.5lf\n", vra, vdec); exit(0); } } if ( argc != 4 ) { printf("Usage:\n" ); printf(" rhrate q reports drive rates\n"); printf(" rhrate a #1 #2 sets these rates, while \n"); printf(" rhrate i #1 #2 increments them.\n\n"); printf(" The ra rate (#1) is given in E seconds/15 per second.\n"); printf(" The dec rate (#2) is given in N arcseconds per second.\n"); printf(" The RA unit IS the same as \" per second, IF the object\n"); printf(" is on the equator. The sky rate will be less near the poles.\n"); printf(" This apparently unusual unit dates from the days when \n"); printf(" telescopes had hardware which directly set the drive rate \n"); printf(" of the RA axis, and did not have a way to consider the object's\n"); printf(" declination. It is commonly used in planetary work.\n"); exit ( -1 ); } sscanf( argv[2], "%lf", &vra); sscanf( argv[3], "%lf", &vdec); /* vra /= 15. * cos( PI * DES_DEC / 180.); Original version */ vra /= 15. ; /* Convert 1/15 s per s to s/s or hr/hr */ /* This is already in "/s which equals deg / hr */ if (tinfo -> motion_type == NON_SOLAR) { printf("\n This special version only works for solar system objects now."); exit(1); /* if ( strcmp( argv[1], "a" ) == 0 ) { */ /* V_RA = vra / 3600. ; */ /* V_DEC = vdec / 3600. ; */ /* } */ /* else if ( strcmp( argv[1], "i" ) == 0 ) { */ /* V_RA += vra / 3600.0 ; */ /* V_DEC += vdec / 3600.0 ; */ /* } */ } if ( tinfo -> motion_type == SOLAR ) { /* Note: ORIG_RA is given in hours, ORIG_DEC is given in degrees, */ /* and timesize(timeonobj) returns seconds. */ /* V_RA is given in hours of RA per hour or equivalently */ /* seconds of RA per second */ /* V_DEC is given in degrees of DEC per hour. */ /* To prevent a jump in position when the rates are changed, */ /* first update the original ra & dec to correspond to current position */ /* and update the start time on object to the current time. */ timesub(CURRENT,TONOBJ, &timeonobj); seconds_on_object = timesize(timeonobj); while (seconds_on_object < 0.0) seconds_on_object += 86400.; ORIG_RA += seconds_on_object * V_RA /3600.; ORIG_DEC += seconds_on_object * V_DEC/3600.; timecopy(CURRENT,&TONOBJ); if (strcmp( argv[1], "i") == 0 ) { V_DEC += vdec; V_RA += vra ; } if ( strcmp( argv[1], "a") == 0 ) { V_DEC = vdec ; V_RA = vra ; } } sprintf( s1, "rhrate %s %s %s", argv[ 1 ], argv[ 2 ], argv[ 3 ] ); /* logf( s1 ); */ }