1
0
Fork 0

Minor changes

pull/2/head
Cees Bassa 2014-10-07 23:41:49 +02:00
parent afc5d9eacf
commit 3f2009a46e
4 changed files with 37 additions and 43 deletions

View File

@ -6,7 +6,7 @@
#include "sgdp4h.h"
#include <getopt.h>
#define LIM 80
#define LIM 128
#define NMAX 256
#define D2R M_PI/180.0
#define R2D 180.0/M_PI

View File

@ -376,7 +376,6 @@ void plot_xyz(void)
while (fgetline(fp,line,LIM)>0) {
// Get satellite position
sscanf(line,"%lf %lf %lf %lf",&mjd,&satpos.x,&satpos.y,&satpos.z);
printf("%lf %f %f %f\n",mjd,satpos.x,satpos.y,satpos.z);
// Get positions
sunpos_xyz(m.mjd,&sunpos,&sra,&sde);

View File

@ -47,51 +47,46 @@ int read_twoline(FILE *fp, long search_satno, orbit_t *orb)
int found;
double bm, bx;
// Set defaults
strcpy(orb->desig,"");
st1 = line1;
st2 = line2;
do {
if(fgets(line1, ST_SIZE-1, fp) == NULL) return -1;
if(fgets(line1, ST_SIZE-1, fp) == NULL)
return -1;
st1 = st_start(line1);
} while(st1[0] != '1');
if(search_satno > 0)
{
if(search_satno > 0) {
found = 0;
}
else
{
found = 1;
search_satno = atol(st1+2);
}
} else {
found = 1;
search_satno = atol(st1+2);
}
sprintf(search, "1 %05ld", search_satno);
do {
st1 = st_start(line1);
if(strncmp(st1, search, 7) == 0)
{
found = 1;
break;
}
if(strncmp(st1, search, 7) == 0) {
found = 1;
break;
}
} while(fgets(line1, ST_SIZE-1, fp) != NULL);
sprintf(search, "2 %05ld", search_satno);
sprintf(search, "2 %05ld", search_satno);
if(found)
{
fgets(line2, ST_SIZE-1, fp);
st2 = st_start(line2);
}
if(!found || strncmp(st2, search, 7) != 0)
{
return -1;
}
if(found) {
fgets(line2, ST_SIZE-1, fp);
st2 = st_start(line2);
}
if(!found || strncmp(st2, search, 7) != 0) {
return -1;
}
orb->ep_year = (int)i_read(st1, 19, 20);
if(orb->ep_year < 57) orb->ep_year += 2000;
else orb->ep_year += 1900;

View File

@ -170,20 +170,20 @@ typedef struct orbit_s
{
/* Add the epoch time if required. */
int ep_year;/* Year of epoch, e.g. 94 for 1994, 100 for 2000AD */
double ep_day; /* Day of epoch from 00:00 Jan 1st ( = 1.0 ) */
double rev; /* Mean motion, revolutions per day */
double bstar; /* Drag term .*/
double eqinc; /* Equatorial inclination, radians */
double ecc; /* Eccentricity */
double mnan; /* Mean anomaly at epoch from elements, radians */
double argp; /* Argument of perigee, radians */
double ascn; /* Right ascension (ascending node), radians */
double smjaxs; /* Semi-major axis, km */
int ep_year;/* Year of epoch, e.g. 94 for 1994, 100 for 2000AD */
double ep_day; /* Day of epoch from 00:00 Jan 1st ( = 1.0 ) */
double rev; /* Mean motion, revolutions per day */
double bstar; /* Drag term .*/
double eqinc; /* Equatorial inclination, radians */
double ecc; /* Eccentricity */
double mnan; /* Mean anomaly at epoch from elements, radians */
double argp; /* Argument of perigee, radians */
double ascn; /* Right ascension (ascending node), radians */
double smjaxs; /* Semi-major axis, km */
double ndot2,nddot6; /* Mean motion derivatives */
char desig[10]; /* International designation */
long norb; /* Orbit number, for elements */
int satno; /* Satellite number. */
char desig[10]; /* International designation */
long norb; /* Orbit number, for elements */
int satno; /* Satellite number. */
} orbit_t;