1
0
Fork 0

Minor changes

pull/2/head
Cees Bassa 2014-10-30 18:00:46 +01:00
parent 38c4e241a3
commit d5038e8c36
3 changed files with 54 additions and 5 deletions

View File

@ -75,10 +75,10 @@ void compute_position(double mjd,xyz_t satpos,struct site s,int satno,char *desi
int main(int argc,char *argv[])
{
int arg=0,satno;
int arg=0,satno=99999;
struct site s;
double mjd=0;
char nfd[32],tlefile[LIM],*fname,line[LIM];
char nfd[32],tlefile[LIM],*fname,line[LIM],desig[10]="14999A";
int i,imode;
FILE *file;
orbit_t orb;
@ -95,7 +95,7 @@ int main(int argc,char *argv[])
}
// Decode options
while ((arg=getopt(argc,argv,"t:c:i:s:f:p:"))!=-1) {
while ((arg=getopt(argc,argv,"t:c:i:s:f:p:d:"))!=-1) {
switch (arg) {
case 't':
@ -129,6 +129,10 @@ int main(int argc,char *argv[])
satno=atoi(optarg);
break;
case 'd':
strcpy(desig,optarg);
break;
default:
return 0;
}
@ -184,7 +188,7 @@ int main(int argc,char *argv[])
file=fopen(fname,"r");
while (fgetline(file,line,LIM)>0) {
status=sscanf(line,"%lf %lf %lf %lf",&mjd,&satpos.x,&satpos.y,&satpos.z);
compute_position(mjd,satpos,s,99999,"14999A");
compute_position(mjd,satpos,s,satno,desig);
}
fclose(file);
}

View File

@ -40,6 +40,15 @@ xyz_t cross(xyz_t a,xyz_t b)
return c;
}
// Return x modulo y [0,y)
double modulo(double x,double y)
{
x=fmod(x,y);
if (x<0.0) x+=y;
return x;
}
// Compute Date from Julian Day
void mjd2date(double mjd,int *year,int *month,double *day)
{
@ -215,6 +224,9 @@ orbit_t rv2el(int satno,double mjd,xyz_t r0,xyz_t v0)
orb[i+1].ecc=0.0;
if (orb[i+1].eqinc<0.0)
orb[i+1].eqinc=0.0;
orb[i+1].mnan=modulo(orb[i+1].mnan,2.0*M_PI);
orb[i+1].ascn=modulo(orb[i+1].ascn,2.0*M_PI);
orb[i+1].argp=modulo(orb[i+1].argp,2.0*M_PI);
}
return orb[i];

View File

@ -713,6 +713,34 @@ void plot_moon(void)
cpgtext(x0,y0,text);
}
}
for (dmjd=-6.0;dmjd<0.0;dmjd+=1.0) {
// Get positions
lunpos_xyz(m.mjd+dmjd,&s,&lra,&lde);
// GMST
h=gmst(m.mjd);
// Lunar antipode
l0=modulo(lra-h-180,360.0);
b0=-lde;
if (l0>180.0)
l0-=360.0;
// Convert
z0=cos(l0*D2R)*cos(b0*D2R)*XKMPER;
x0=sin(l0*D2R)*cos(b0*D2R)*XKMPER;
y0=sin(b0*D2R)*XKMPER;
rotate(1,m.l0,&x0,&y0,&z0);
rotate(0,m.b0,&x0,&y0,&z0);
// Plot antipode
if (z0>0.0) {
sprintf(text," %.0f",dmjd);
cpgpt1(x0,y0,2);
cpgtext(x0,y0,text);
}
}
cpgsci(isci);
@ -902,6 +930,11 @@ void plot_notam(char *filename)
file=fopen(filename,"r");
while (fgetline(file,line,LIM)>0) {
sscanf(line,"%f %f",&b,&l);
if (strlen(line)<2) {
flag=0;
continue;
}
z=cos(l*D2R)*cos(b*D2R)*XKMPER;
x=sin(l*D2R)*cos(b*D2R)*XKMPER;
y=sin(b*D2R)*XKMPER;
@ -1010,7 +1043,7 @@ void plot_map(void)
// Plot track
if (m.xyzflag==1)
plot_xyz();
else
// else
plot_track();
}