COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
jpl_test.cpp File Reference
#include "convertlib.h"
Include dependency graph for jpl_test.cpp:

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)
33 {
34 cartpos epos[6], mpos[6];
35 double mjd;
36 int count;
37 rvector pos, mediff;
38 
39 get_resdir();
40 count = 0;
41 for (mjd=58135.4; mjd<58135.5; mjd+=1./86400.)
42 {
43 if (count == 0)
44  {
45  jplpos(JPL_SUN_BARY,JPL_EARTH,utc2tt(mjd),&epos[0]);
46  jplpos(JPL_SUN_BARY,JPL_MOON,utc2tt(mjd),&mpos[0]);
47  mediff = rv_sub(mpos[0].s,epos[0].s);
48  }
49 else
50  {
51  jplpos(JPL_SUN_BARY,JPL_EARTH,utc2tt(mjd),&epos[1]);
52  jplpos(JPL_SUN_BARY,JPL_MOON,utc2tt(mjd),&mpos[1]);
53  pos = rv_sub(rv_sub(mpos[1].s,epos[1].s),mediff);
54  printf("%.15g %.15g %.15g %.15g\n",mjd,pos.col[0],pos.col[1],pos.col[2]);
55  }
56 count++;
57 }
58 /*
59 jplpos(JPL_SUN_BARY,JPL_VENUS,JD2MJD(2451545.5),&pos,"/home/cosmos/data");
60 printf("%f %f %f %f %f %f %f\n",2451545.5,pos.s.x/1000.,pos.s.y/1000.,pos.s.z/1000.,pos.v.x/1000.,pos.v.y/1000.,pos.v.z/1000.);
61 jplpos(JPL_SUN_BARY,JPL_MOON,utc2tt(JD2MJD(2455620.5)),&pos,"/home/cosmos/data");
62 printf("%f %f %f %f %f %f %f\n",2455620.5,pos.s.x/1000.,pos.s.y/1000.,pos.s.z/1000.,pos.v.x/1000.,pos.v.y/1000.,pos.v.z/1000.);
63 jplpos(JPL_SUN_BARY,JPL_MOON,utc2tt(JD2MJD(2455621.5)),&pos,"/home/cosmos/data");
64 printf("%f %f %f %f %f %f %f\n",2455621.5,pos.s.x/1000.,pos.s.y/1000.,pos.s.z/1000.,pos.v.x/1000.,pos.v.y/1000.,pos.v.z/1000.);
65 jplpos(JPL_SUN_BARY,JPL_MOON,utc2tt(JD2MJD(2455622.5)),&pos,"/home/cosmos/data");
66 printf("%f %f %f %f %f %f %f\n",2455622.5,pos.s.x/1000.,pos.s.y/1000.,pos.s.z/1000.,pos.v.x/1000.,pos.v.y/1000.,pos.v.z/1000.);
67 jplpos(JPL_SUN_BARY,JPL_MOON,utc2tt(JD2MJD(2455623.5)),&pos,"/home/cosmos/data");
68 printf("%f %f %f %f %f %f %f\n",2455623.5,pos.s.x/1000.,pos.s.y/1000.,pos.s.z/1000.,pos.v.x/1000.,pos.v.y/1000.,pos.v.z/1000.);
69 jplpos(JPL_SUN_BARY,JPL_MOON,utc2tt(JD2MJD(2455624.5)),&pos,"/home/cosmos/data");
70 printf("%f %f %f %f %f %f %f\n",2455624.5,pos.s.x/1000.,pos.s.y/1000.,pos.s.z/1000.,pos.v.x/1000.,pos.v.y/1000.,pos.v.z/1000.);
71 jplpos(JPL_SUN_BARY,JPL_MOON,utc2tt(JD2MJD(2455625.5)),&pos,"/home/cosmos/data");
72 printf("%f %f %f %f %f %f %f\n",2455625.5,pos.s.x/1000.,pos.s.y/1000.,pos.s.z/1000.,pos.v.x/1000.,pos.v.y/1000.,pos.v.z/1000.);
73 */
74 
75 }
3 element generic row vector
Definition: vector.h:53
int count
Definition: rw_test.cpp:36
#define JPL_SUN_BARY
Definition: convertdef.h:121
Cartesian full position structure.
Definition: convertdef.h:158
#define JPL_MOON
Definition: convertdef.h:119
double mjd
Definition: udp_send.cpp:41
#define JPL_EARTH
Definition: convertdef.h:112
double col[3]
Definition: vector.h:55
int32_t jplpos(long from, long to, double utc, cartpos *pos)
Position from JPL Ephemeris.
Definition: ephemlib.cpp:128
rvector rv_sub(rvector a, rvector b)
Subtract two vectors.
Definition: vector.cpp:315
double utc2tt(double mjd)
Convert UTC to TT.
Definition: timelib.cpp:884