58 double mjdstart = -1.;
62 double logstride = 3600./86400.;
64 vector <tlestruc> lines;
71 mjdend = atof(argv[4]);
73 logperiod = atof(argv[3]);
75 if (strchr(argv[2],
':') !=
nullptr)
78 mjdstart = stof(fname.substr(fname.find(
':')+1));
83 iretn =
load_lines(fname.substr(0, fname.find(
':')), lines);
88 mjdstart = atof(argv[2]);
94 std::cout <<
"Usage: fast_propagator nodename [mjdstart|0 [logperiod [mjdend]]]" << std::endl;
119 fname +=
"/state.ini";
120 if ((iretn=stat(fname.c_str(), &fstat)) == 0 && (fdes=fopen(fname.c_str(),
"r")) != NULL)
122 char*
ibuf = (
char *)calloc(1,fstat.st_size+1);
123 size_t nbytes = fread(ibuf, 1, fstat.st_size, fdes);
129 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;
130 std::cout <<
"Initial MJD: " << std::setprecision(10) << iloc.
utc << std::endl;
134 printf(
"Unable to open state.ini\n");
147 #define POLLBUFSIZE 20000 154 case Agent::AgentMessage::SOH:
155 case Agent::AgentMessage::BEAT:
158 if (!tbuf.empty() && tbuf ==
"physics")
173 else if (mjdstart == 0.)
192 else if (mjdstart == 0.)
208 if (mjdnow < iloc.
utc)
214 std::cout <<
"Initialize backwards " <<
agent->
cinfo->
node.
loc.
utc-mjdnow <<
"days" << std::endl;
223 double step = 8.64 * (mjdnow-iloc.
utc);
234 std::cout <<
"Initialize forwards " << (mjdnow-iloc.
utc) <<
" days, steps of " << step << std::endl;
271 double logdate = floor(mjdnow/logstride)*logstride;
273 while (mjdend < 0. || mjdend-mjdstart > 0)
275 mjdnow += logperiod/86400.;
285 if ((dtemp=floor(mjdnow/logstride)*logstride) > logdate)
298 for (uint32_t k=0; k<
events.size(); ++k)
std::vector< eventstruc > eventdict
Definition: fast_propagator.cpp:43
string json_list_of_soh(cosmosstruc *cinfo)
Definition: jsonlib.cpp:9252
#define DATA_LOG_TYPE_EVENT
Definition: datalib.h:109
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 > events
Definition: fast_propagator.cpp:44
ElapsedTime dt
Definition: agent_file3.cpp:183
double utc
UTC of Position.
Definition: convertdef.h:161
int i
Definition: rw_test.cpp:37
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
uint32_t pass
pass indicator: allows synchronization with other attitude and position values.
Definition: convertdef.h:170
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
void log_move(string oldpath, string newpath, bool compress)
Move log file - path version.
Definition: datalib.cpp:200
static vector< jsonentry * > logtable
Definition: agent_exec-2-0.cpp:114
double utc
Master time for location, in Modified Julian Day.
Definition: convertdef.h:879
double utc
Overall Node time.
Definition: jsondef.h:3592
string json_extract_namedmember(string json, string token)
Extract JSON value matching name.
Definition: jsonlib.cpp:4417
vector< vector< jsonequation > > emap
JSON Equation Map matrix.
Definition: jsondef.h:4211
cosmosstruc * json_init()
Initialize JSON pointer map.
Definition: jsonlib.cpp:454
int32_t set_sohstring(string list)
Set Limited SOH string.
Definition: agentclass.cpp:641
int32_t json_table_of_list(vector< jsonentry * > &table, string tokens, cosmosstruc *cinfo)
Output a vector of JSON entries.
Definition: jsonlib.cpp:3086
nodestruc node
Structure for summary information in node.
Definition: jsondef.h:4220
static string sohstring
Definition: agent_cpu-2-0.cpp:72
int32_t pos_clear(locstruc *loc)
Initialize posstruc.
Definition: convertlib.cpp:77
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
char name[40+1]
Node Name.
Definition: jsondef.h:3556
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
Full COSMOS Event structure.
Definition: jsondef.h:1093
vector< locstruc > gauss_jackson_propagate(gj_handle &gjh, physicsstruc &physics, locstruc &loc, double tomjd)
Definition: physicslib.cpp:2871
double logperiod
Definition: agent_physics.cpp:47
Storage for messages.
Definition: agentclass.h:272
const char * json_of_event(string &jstring, cosmosstruc *cinfo)
Create JSON for an event.
Definition: jsonlib.cpp:9854
gj_handle gjh
Definition: fast_propagator.cpp:41
int32_t loc_update(locstruc *loc)
Synchronize all frames in location structure.
Definition: convertlib.cpp:2294
int32_t load_lines(string fname, vector< tlestruc > &lines)
Load TLE from file. TODO!!! Rename Function to loadTle and create new class for dealing with TLEs...
Definition: convertlib.cpp:3612
void log_write(string node, string agent, double utc, string extra, string type, string record, string location)
Write log entry - full.
Definition: datalib.cpp:75
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
#define DATA_LOG_TYPE_SOH
Definition: datalib.h:108
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
vector< eventstruc > event
Single entry vector for event information.
Definition: jsondef.h:4250
#define AGENT_ERROR_JSON_CREATE
Definition: cosmos-errno.h:105
int32_t mode
Definition: jsondef.h:3436
vector< targetstruc > target
Vector of all targets known to node.
Definition: jsondef.h:4253
static string node
Definition: agent_monitor.cpp:126
std::string mainjstring
Definition: fast_propagator.cpp:45
Definition: convertdef.h:876
int lines2eci(double utc, vector< tlestruc >lines, cartpos &eci)
Return position from TLE set.
Definition: convertlib.cpp:3155
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
Agent * agent
Definition: fast_propagator.cpp:42