57 double mjdstart = -1.;
65 mjdstart = atof(argv[2]);
70 std::cout <<
"Usage: propogator nodename [mjd|0]" << std::endl;
93 fname +=
"/state.ini";
94 if ((iretn=stat(fname.c_str(), &fstat)) == 0 && (fdes=fopen(fname.c_str(),
"r")) != NULL)
96 char*
ibuf = (
char *)calloc(1,fstat.st_size+1);
97 size_t nbytes = fread(ibuf, 1, fstat.st_size, fdes);
112 std::cout <<
"Initial State Vector Vel: [" << iloc.
pos.
eci.
v.
col[0] <<
", " << iloc.
pos.
eci.
v.
col[1] <<
", " << iloc.
pos.
eci.
v.
col[2] <<
"] km" << std::endl;
113 std::cout <<
"Initial MJD: " << std::setprecision(10) << iloc.
utc << std::endl;
117 printf(
"Unable to open state.ini\n");
121 #define POLLBUFSIZE 20000 127 case Agent::AgentMessage::SOH:
128 case Agent::AgentMessage::BEAT:
131 if (!tbuf.empty() && tbuf ==
"physics")
146 else if (mjdstart == 0.)
165 else if (mjdstart == 0.)
180 double sohtimer = mjdnow;
182 if (mjdnow < iloc.
utc)
188 std::cout <<
"Initialize backwards " <<
agent->
cinfo->
node.
loc.
utc-mjdnow <<
"days" << std::endl;
198 double step = 8.64 * (mjdnow-iloc.
utc);
209 std::cout <<
"Initialize forwards " << (mjdnow-iloc.
utc) <<
" days, steps of " << step << std::endl;
211 std::cout <<
"Initialize Hardware Simulation " << std::endl;
214 std::cout <<
"Initialize Gauss Jackson Propagator " << std::endl;
217 std::cout <<
"Start Hardware Simulation " << std::endl;
220 std::cout <<
"Start Orbital Propagator " << std::endl;
223 std::cout <<
"Start Hardware Simulation 2" << std::endl;
231 std::cout <<
"Start Hardware Simulation 3" << std::endl;
234 std::cout <<
"Initialize Gauss Jackson Propagator" << std::endl;
242 std::cout <<
"Start Agent" << std::endl;
245 sohtimer += 1./86400.;
254 double dsleep = 1000000. * 86400.*(sohtimer - mjdnow);
258 COSMOS_USLEEP(dsleep);
std::vector< eventstruc > events
Definition: propagator.cpp:44
string json_list_of_soh(cosmosstruc *cinfo)
Definition: jsonlib.cpp:9252
gj_handle gjh
Definition: propagator.cpp:42
AgentMessage
Type of Agent Message. Types > 127 are binary.
Definition: agentclass.h:216
size_t calc_events(vector< eventstruc > &dictionary, cosmosstruc *cinfo, vector< eventstruc > &events)
Calculate current Events.
Definition: jsonlib.cpp:11356
std::vector< eventstruc > eventdict
Definition: propagator.cpp:43
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
const char * json_of_table(string &jstring, vector< jsonentry * > table, cosmosstruc *cinfo)
Create JSON stream from entries.
Definition: jsonlib.cpp:8733
void simulate_hardware(cosmosstruc *cinfo, vector< locstruc > &locvec)
Simulate Hardware data - multiple.
Definition: physicslib.cpp:937
int32_t update_target(cosmosstruc *cinfo)
Update Track list.
Definition: jsonlib.cpp:11262
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
Agent * agent
Definition: propagator.cpp:41
double utc
Master time for location, in Modified Julian Day.
Definition: convertdef.h:879
string json_extract_namedmember(string json, string token)
Extract JSON value matching name.
Definition: jsonlib.cpp:4417
int32_t set_sohstring(string list)
Set Limited SOH string.
Definition: agentclass.cpp:641
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
static string sohstring
Definition: agent_cpu-2-0.cpp:72
int32_t pos_clear(locstruc *loc)
Initialize posstruc.
Definition: convertlib.cpp:77
int32_t post(messstruc mess)
Post a Cosmos::Agent::messstruc.
Definition: agentclass.cpp:2074
attstruc att
attstruc for this time.
Definition: convertdef.h:883
double utcoffset
MJD Offset between system UT and simulated UT.
Definition: jsondef.h:3590
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
size_t load_dictionary(vector< eventstruc > &dict, cosmosstruc *cinfo, const char *file)
Load Event Dictionary.
Definition: jsonlib.cpp:11313
int32_t shutdown()
Shutdown agent gracefully.
Definition: agentclass.cpp:366
vector< locstruc > gauss_jackson_propagate(gj_handle &gjh, physicsstruc &physics, locstruc &loc, double tomjd)
Definition: physicslib.cpp:2871
std::string mainjstring
Definition: propagator.cpp:45
Storage for messages.
Definition: agentclass.h:272
int32_t loc_update(locstruc *loc)
Synchronize all frames in location structure.
Definition: convertlib.cpp:2294
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
string jdata
Definition: agentclass.h:277
void hardware_init_eci(cosmosstruc *cinfo, locstruc &loc)
Initialize Hardware.
Definition: physicslib.cpp:877
string json_convert_string(string object)
Convert JSON to string.
Definition: jsonlib.cpp:4557
double col[3]
Definition: vector.h:55
cosmosstruc * cinfo
Definition: agentclass.h:346
cartpos eci
Definition: convertdef.h:737
#define AGENTMAXBUFFER
Maximum AGENT transfer buffer size.
Definition: jsondef.h:438
#define AGENT_ERROR_JSON_CREATE
Definition: cosmos-errno.h:105
vector< jsonentry * > sohtable
State of Health element vector.
Definition: agentclass.h:156
int32_t mode
Definition: jsondef.h:3436
static string node
Definition: agent_monitor.cpp:126
Definition: convertdef.h:876
physicsstruc phys
Definition: jsondef.h:3597
int32_t readring(messstruc &message, AgentMessage type=Agent::AgentMessage::ALL, float waitsec=1., Where where=Where::TAIL, string proc="", string node="")
Check Ring for message.
Definition: agentclass.cpp:2395
rvector v
Velocity.
Definition: convertdef.h:165