/*  
 *  - - - - - - - - - - - -
 *   g a l _ s g p 4 t . h  
 *  - - - - - - - - - - - -
 *  
 *  This routine is part of the General Astrodynamics Library  
 *
 *  Description:
 *
 *     This header file defines the SGP4 data structure
 *  
 *  Status: 
 *  
 *     Header file  
 *  
 *  References:
 *  
 *     Revisting Spacetrack Report #3
 *     Vallado, David, Crawford, Paul, Hujsak, Richard, Kelso, T.S.
 *     AIAA 2006-6753
 *  
 *  This revision:  
 * 
 *     2008 March 30 
 *  
 *  Copyright (C) 2008 Paul C. L. Willmott. See notes at end. 
 *  
 *-----------------------------------------------------------------------  
 */  

#ifndef _GAL_SGP4T_H_  
#define _GAL_SGP4T_H_ 1  
  
#undef  __BEGIN_DECLS  
#undef  __END_DECLS  
#ifdef  __cplusplus  
#define __BEGIN_DECLS extern "C" {  
#define __END_DECLS }  
#else  
#define __BEGIN_DECLS /* empty */  
#define __END_DECLS   /* empty */  
#endif
  
__BEGIN_DECLS  
  
typedef struct {

/*
 * Internal Control Variables
 */
 
  int    error          ;
  char   init           ;
  char   method         ;

/*
 * TLE Parameters
 */
 
  int    satnum         ;  /* NORAD Catalog Number                        */
  char   classification ;  /* Security Classification                     */
  char   intldesg[10]   ;  /* International Designator (COSPAR/WDC-A-R&S) */
  int    epochyr        ;  /* Epoch Year                                  */
  double epochdays      ;  /* Epoch Day of Year (plus Fraction)           */
  double epoch          ;  /* Epoch Date ( days since 1950-01-01 0h )     */ 
  double ndot           ;  /* Mean motion derivative                      */
  double nddot          ;  /* Mean motion second derivative               */
  double bstar          ;  /* Bstar / Drag Term                           */
  int    ephtype        ;  /* Ephermeris Type                             */
  int    setnum         ;  /* Element set number                          */
  double inclo          ;  /* Inclination (rad)                           */
  double nodeo          ;  /* Right Ascension of Ascending Node (rad)     */
  double ecco           ;  /* Eccentricity                                */
  double argpo          ;  /* Argument of Perigee (rad)                   */
  double mo             ;  /* Mean Anamaly (rad)                          */
  double no             ;  /* Mean Motion ( rad/min )                     */
  int    revnum         ;  /* Epoch Revolution Number                     */

  double a              ; 
  double altp           ; 
  double alta           ; 
  double jdepoch1       ;  /* Julian date of Epoch Part 1                 */
  double jdepoch2       ;  /* Julian date of Epoch Part 2                 */
  double rcse           ; 
  int    epochtynumrev  ;

/*
 * Gravity Model Parameters
 */
 
  double tumin          ;  /* Minutes in one time unit                    */
  double mu             ;  /* Earth gravitational parameter               */
  double radiusearthkm  ;  /* Radius of the earth in km                   */
  double xke            ;  /* Reciprocal of tumin                         */
  double j2             ;  /* Un-normalized second zonal harmonic value   */
  double j3             ;  /* Un-normalized third  zonal harmonic value   */
  double j4             ;  /* Un-normalized fourth zonal harmonic value   */
  double j3oj2          ;  /* j3 divided by j2                            */
  double vkmpersec      ;  
  
/* 
 * Near Earth 
 */
 
  int    isimp          ;
  double aycof          ; 
  double con41          ; 
  double cc1            ;  
  double cc4            ; 
  double cc5            ; 
  double d2             ; 
  double d3             ; 
  double d4             ;
  double delmo          ; 
  double eta            ; 
  double argpdot        ; 
  double omgcof         ; 
  double sinmao         ; 
  double t              ; 
  double t2cof          ; 
  double t3cof          ;
  double t4cof          ; 
  double t5cof          ; 
  double x1mth2         ; 
  double x7thm1         ; 
  double mdot           ; 
  double nodedot        ; 
  double xlcof          ; 
  double xmcof          ;
  double nodecf         ;

/* 
 * Deep Space 
 */
 
  int    irez           ;
  double d2201          ; 
  double d2211          ; 
  double d3210          ; 
  double d3222          ; 
  double d4410          ; 
  double d4422          ; 
  double d5220          ; 
  double d5232          ;
  double d5421          ; 
  double d5433          ; 
  double dedt           ; 
  double del1           ; 
  double del2           ; 
  double del3           ; 
  double didt           ; 
  double dmdt           ;
  double dnodt          ; 
  double domdt          ; 
  double e3             ; 
  double ee2            ; 
  double peo            ; 
  double pgho           ; 
  double pho            ; 
  double pinco          ;
  double plo            ; 
  double se2            ; 
  double se3            ; 
  double sgh2           ; 
  double sgh3           ; 
  double sgh4           ; 
  double sh2            ; 
  double sh3            ;
  double si2            ; 
  double si3            ; 
  double sl2            ; 
  double sl3            ; 
  double sl4            ; 
  double gsto           ; 
  double xfact          ; 
  double xgh2           ;
  double xgh3           ; 
  double xgh4           ; 
  double xh2            ; 
  double xh3            ; 
  double xi2            ; 
  double xi3            ; 
  double xl2            ; 
  double xl3            ;
  double xl4            ; 
  double xlamo          ; 
  double zmol           ; 
  double zmos           ; 
  double atime          ; 
  double xli            ; 
  double xni            ;
  
/*
 * The following parameters are for the use of the gal_sgp4rs routine
 */
 
  double time           ; /* UTC JD of last computation */
  double pv[2][3]       ; /* pv-vector ( m, m/s )       */
  double pos            ; /* modulus of p vector        */
  double vel            ; /* modulus of v ector         */
   
} gal_sgp4_t ;
 
__END_DECLS  
  
#endif /* !_GAL_SGP4T_H_ */ 

/*
 *  gal - General Astrodynamics Library  
 *  Copyright (C) 2008 Paul C. L. Willmott  
 *  
 *  This program is free software; you can redistribute it and/or modify  
 *  it under the terms of the GNU General Public License as published by  
 *  the Free Software Foundation; either version 2 of the License, or  
 *  (at your option) any later version.  
 *  
 *  This program is distributed in the hope that it will be useful,  
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of  
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
 *  GNU General Public License for more details.  
 *  
 *  You should have received a copy of the GNU General Public License along  
 *  with this program; if not, write to the Free Software Foundation, Inc.,  
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.  
 *    
 *  Contact:  
 *    
 *  Paul Willmott  
 *  vp9mu@amsat.org  
 */  
  
