78 double triger_time = 0;
79 double iteration_rate = 1;
80 double trigger_offset_ms = 10;
81 uint32_t precision = static_cast <uint32_t>(1/iteration_rate);
82 double sleep_time = 0.7*iteration_rate;
84 double elapsed_seconds = 0;
130 cout <<
"Usage: propogator_simple nodename [mjd|0]" << endl;
159 cout <<
"Loading state.ini info from " <<
node_name <<
" node (node must exist in cosmos/nodes) " << endl;
164 fname +=
"/state.ini";
168 if ((iretn=stat(fname.c_str(), &fstat)) == 0 && (fdes=fopen(fname.c_str(),
"r")) !=
nullptr)
170 char*
ibuf = static_cast <
char *>(calloc(1,static_cast <size_t>(fstat.st_size)+1));
172 fread(ibuf, 1, static_cast <size_t>(fstat.st_size), fdes);
182 cout <<
"Sucessfully found state.ini" << endl;
184 cout <<
"UTC from state.ini : ";
190 cout <<
"-----------------------------------------------" << endl;
195 printf(
"Unable to open state.ini\n");
199 ep.
toc(
"load state.ini");
228 std::string soh =
"{\"node_loc_utc\"," 229 "\"node_loc_pos_eci\"," 230 "\"node_loc_att_icrf\"}" ;
238 elapsed_seconds = (utc_now - mjd_start_sim)*86400;
240 set_time = floor(elapsed_seconds*precision)/precision + iteration_rate;
241 triger_time = set_time - trigger_offset_ms/1000.;
243 if (elapsed_seconds > triger_time){
264 sprintf(
buffer,
"%s,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f",
296 COSMOS_SLEEP(sleep_time);
rvector bearth
Earth magnetic vector in ITRS for this time and location.
Definition: convertdef.h:754
double y
Y value.
Definition: vector.h:114
string mjdToGregorianFormat(double mjd)
Definition: timelib.cpp:1417
Definition: eci2kep_test.cpp:33
qatt geoc
Definition: convertdef.h:828
Gauss-Jackson integration handle.
Definition: physicsdef.h:98
Definition: print_utils.h:60
ElapsedTime dt
Definition: agent_file3.cpp:183
double utc
UTC of Position.
Definition: convertdef.h:161
int32_t json_parse(string jstring, cosmosstruc *cinfo)
Parse JSON using Name Space.
Definition: jsonlib.cpp:4799
char ibuf[1000]
Definition: razor_imu.cpp:43
string seconds2DDHHMMSS(double elapsed_seconds)
Convert Elapsed Time in Seconds to Human Readable Format (used for GPS simulator) ...
Definition: timelib.cpp:1514
cvector d
Orientation.
Definition: vector.h:405
const char * json_of_table(string &jstring, vector< jsonentry * > table, cosmosstruc *cinfo)
Create JSON stream from entries.
Definition: jsonlib.cpp:8733
uint32_t pass
pass indicator: allows synchronization with other attitude and position values.
Definition: convertdef.h:170
int iretn
Definition: rw_test.cpp:37
void gauss_jackson_init_eci(gj_handle &gjh, uint32_t order, int32_t mode, double dt, double utc, cartpos ipos, qatt iatt, physicsstruc &physics, locstruc &loc)
Initialize Gauss-Jackson orbit using ECI state vector.
Definition: physicslib.cpp:2479
cartpos geoc
Definition: convertdef.h:739
double utc
Master time for location, in Modified Julian Day.
Definition: convertdef.h:879
double x
X value.
Definition: vector.h:112
int32_t set_sohstring(string list)
Set Limited SOH string.
Definition: agentclass.cpp:641
void vector(string prefix, rvector v, double scale, string suffix, int precision, int fieldwidth)
Definition: print_utils.cpp:85
nodestruc node
Structure for summary information in node.
Definition: jsondef.h:4220
uint16_t running()
Check if we're supposed to be running.
Definition: agentclass.cpp:391
int32_t pos_clear(locstruc *loc)
Initialize posstruc.
Definition: convertlib.cpp:77
rvector s
Location.
Definition: convertdef.h:163
int32_t post(messstruc mess)
Post a Cosmos::Agent::messstruc.
Definition: agentclass.cpp:2074
bool print
Definition: elapsedtime.h:97
attstruc att
attstruc for this time.
Definition: convertdef.h:883
void tic()
ElapsedTime::tic, equivalent to matlab to start a stopwatch timer.
Definition: elapsedtime.cpp:166
static char buffer[255]
Definition: propagator_simple.cpp:60
void endline()
Definition: print_utils.cpp:606
static char fname[100]
Definition: geomag.cpp:89
Definition: agentclass.h:139
qatt icrf
Definition: convertdef.h:830
locstruc loc
Location structure.
Definition: jsondef.h:3596
int32_t pos_eci(locstruc *loc)
Set ECI position.
Definition: convertlib.cpp:258
vector< locstruc > gauss_jackson_propagate(gj_handle &gjh, physicsstruc &physics, locstruc &loc, double tomjd)
Definition: physicslib.cpp:2871
gj_handle gjh
Definition: agent_node.cpp:80
void printMjdAndDateTime(double mjd)
Definition: propagator_simple.cpp:67
double w
Rotation.
Definition: vector.h:407
static Agent * agent
Definition: propagator_simple.cpp:62
Definition: elapsedtime.h:62
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65
string get_nodedir(string node, bool create_flag)
Get Current Node Directory.
Definition: datalib.cpp:1572
posstruc pos
posstruc for this time.
Definition: convertdef.h:881
static string node_name
Definition: propagator_simple.cpp:50
double z
Z value.
Definition: vector.h:116
int32_t last_error()
Definition: agentclass.cpp:414
quaternion s
0th derivative: Quaternion
Definition: convertdef.h:479
double col[3]
Definition: vector.h:55
static string agent_name
Definition: propagator_simple.cpp:51
cosmosstruc * cinfo
Definition: agentclass.h:346
cartpos eci
Definition: convertdef.h:737
string mjdToGregorianDDMmmYYYY(double mjd)
Definition: timelib.cpp:1479
double toc()
ElapsedTime::toc, equivalent to matlab to stop a stopwatch timer.
Definition: elapsedtime.cpp:174
#define AGENT_ERROR_JSON_CREATE
Definition: cosmos-errno.h:105
vector< jsonentry * > sohtable
State of Health element vector.
Definition: agentclass.h:156
static string mainjstring
Definition: propagator_simple.cpp:65
Definition: convertdef.h:876
physicsstruc phys
Definition: jsondef.h:3597
rvector v
Velocity.
Definition: convertdef.h:165