SUBROUTINE POSVEL * * Module number: * * Module name: * * Keyphrase: * ---------- * calculate the position and velocity vectors of the space craft * * Description: * ------------ * Calculate the state vector (of J2000 equinox) and velocity of the space * craft from a model fitted to the original ephemeris. * * FORTRAN name: POSVEL.FOR * * Keywords of accessed files and tables: * -------------------------------------- * Name I/O Description / Comments * * input parameters * * 'infiles' I input file template name * 'intable' I input state vector table name * * output parameters * * 'x' O state vector * 'v' O velocity vector * * Subroutines Called: * ------------------- * CDBS: * VGTFIT, VSTATE * SDAS: * UCLGSD, UCLGST, UCLPVD, UMSPUT * Others: * None * * History: * -------- * Version Date Author Description * 1 06-02-89 J.-C. HSU design and coding *------------------------------------------------------------------------------- * *== local: * --start and end time in seconds from 1980.0 INTEGER TSTART, TEND, * --error status : STATUS, * --loop indices : I, * --status : STAT(20), STATOK * --input epoch DOUBLE PRECISION MJD, : MJ1980, * --state vector and velocity vector : X(3), DXDT(3), * --fitting coefficients : A(3), P(4,7), * --epoch of input time and start/end time * --in seconds from 1980.0 : T, T0, T1 * --input table CHARACTER*128 ITABLE * --error message context CHARACTER*130 CONTXT, MESS * --modified Julian Day of 1980 Jan 1, 0h PARAMETER (MJ1980 = 44239.D0) *=========================begin hsp.inc========================================= * --status return code INTEGER OK, ERRNUM(20) * --message destination and priority INTEGER DEST, PRIO DATA OK /0/ DATA ERRNUM /701, 702, 703, 704, 705, 706, 707, 708, 709, 710, : 711, 712, 713, 714, 715, 716, 717, 718, 719, 720/ DATA DEST, PRIO /1, 0/ *=========================end hsp.inc=========================================== *------------------------------------------------------------------------------ * * read parameter file * CALL UCLGSD ('mjd', MJD, STAT(1)) CALL UCLGST ('intable', ITABLE, STAT(2)) * DO 10 I = 1, 2 IF (STAT(I) .NE. OK) THEN STATUS = ERRNUM(1) CONTXT = 'can not get input parameter(s)' GO TO 999 END IF 10 CONTINUE * * convert input to seconds from 1980.0 * T = (MJD - MJ1980) * 86400.D0 * * get the fitting coefficients * CALL VGTFIT (ITABLE, TSTART, TEND, A, P, STATUS) * IF (STATUS .NE. OK) THEN CONTXT = 'cannot read fitting coefficients from input table' GO TO 999 END IF * T0 = DBLE (TSTART) T1 = DBLE (TEND) * * check if the input time is out of the fitting range * IF (T .LT. T0 .OR. T .GT. T1) THEN CONTXT = 'Warning: epoch out of ephemeris fitting range' CALL UMSPUT (CONTXT, DEST, PRIO, STATOK) END IF * * calculate the state vector and velocity * CALL VSTATE (T, T0, A, P, X, DXDT) * * write result to parameters * CALL UCLPVD ('x', X, 1, 3, STAT(1)) CALL UCLPVD ('v', DXDT, 1, 3, STAT(2)) * DO 20 I = 1, 2 IF (STAT(I) .NE. OK) THEN STATUS = ERRNUM(1) CONTXT = 'can not put output parameter(s)' GO TO 999 END IF 20 CONTINUE * STATUS = OK GO TO 1000 * * write error message * 999 MESS = 'POSVEL: ' // CONTXT CALL UMSPUT (MESS, DEST, PRIO, STATOK) * 1000 RETURN END