COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
agent_node.cpp File Reference
#include "support/configCosmos.h"
#include <stdio.h>
#include "agent/agentclass.h"
#include "support/jsonlib.h"
#include "physics/physicslib.h"
#include <iostream>
Include dependency graph for agent_node.cpp:

Classes

struct  cachestruc
 

Macros

#define MAXEPHEM   3
 

Functions

double loadmjd (double mjd)
 Load a days worth of telemetry from disk. More...
 
void loadephemeris ()
 Load Event templates. More...
 
void loanode ()
 
int32_t request_loadmjd (string &request, string &response, Agent *)
 Load a given day's data. More...
 
int32_t request_counts (string &, string &response, Agent *)
 Gives the number of event and telemetry records. More...
 
int32_t request_indexes (string &, string &response, Agent *)
 Returns the current record of both event and telemetry data. More...
 
int32_t request_days (string &request, string &response, Agent *)
 Tells first and last day in archive. More...
 
int32_t request_rewind (string &request, string &response, Agent *)
 Goes to the first record for either events or telemetry for the loaded day. More...
 
int32_t request_next (string &request, string &response, Agent *)
 Gets next event, telemetry or data dictionary record entry. More...
 
int32_t request_getmjd (string &, string &response, Agent *)
 Returns the day that is loaded. More...
 
int32_t request_getnode (string &request, string &response, Agent *)
 Returns the current node.ini. More...
 
int main (int argc, char *argv[])
 

Variables

char ibuf [AGENTMAXBUFFER]
 
NetworkType ntype = NetworkType::UDP
 
int waitsec = 5
 
std::string reqjstring
 
std::string myjstring
 
cachestruc cache [3+3+1]
 
int cindex
 
uint32_t dindex
 
int32_t Mcount
 
int32_t mindex
 
nodestrucnode
 
std::vector< eventstruceventdict
 
std::vector< eventstruccommanddict
 
Agentagent
 
nodestruc statnode
 
gj_handle gjh
 
int32_t myport
 
double lastday
 
double firstday
 
double currentday
 
double newlastday
 

Macro Definition Documentation

#define MAXEPHEM   3

Function Documentation

double loadmjd ( double  mjd)

Load a days worth of telemetry from disk.

Attempt to load the indicated MJD from disk. If not found, start working forwards and backwards 1 day at a time, up to 500 days.

Parameters
mjdDesired Modified Julian Day.
Returns
MJD of day actually loaded, otherwise 0.

See if we already have this day in the cache

If the day is not in the cache, choose the oldest cache entry

342 {
343  int i;
344  double utime;
345 
346  if (mjd == 0.)
347  {
348  return (mjd);
349  }
350 
352  for (i=0; i<3+MAXEPHEM+1; ++i)
353  {
354  if (mjd == cache[i].mjd)
355  {
356  cindex = i;
357  cache[i].tindex = cache[i].eindex = 0;
358  return (mjd);
359  }
360  }
361 
363  //and replace it from the archive.
364  if ((int)mjd == lastday)
365  {
366  // Load to 4th cache entry
367  cindex = 3;
368  }
369  else
370  {
371  utime = cache[cindex].utime;
372  for (i=0; i<3; ++i)
373  {
374  if (cache[i].utime < utime)
375  {
376  cindex = i;
377  utime = cache[i].utime;
378  }
379  }
380  }
381 
382  if (!data_load_archive(mjd, cache[cindex].telem, cache[cindex].event, agent->cinfo))
383  {
384  cache[cindex].mjd = (int)mjd;
387  return (mjd);
388  }
389  else
390  return (0.);
391 }
uint32_t eindex
Definition: agent_node.cpp:61
int i
Definition: rw_test.cpp:37
#define MAXEPHEM
Definition: agent_node.cpp:44
int32_t data_load_archive(string node, string agent, double utcbegin, double utcend, string type, vector< string > &result)
Load data from archive.
Definition: datalib.cpp:1616
nodestruc node
Structure for summary information in node.
Definition: jsondef.h:4220
double utcoffset
MJD Offset between system UT and simulated UT.
Definition: jsondef.h:3590
uint32_t tindex
Definition: agent_node.cpp:59
double mjd
Definition: udp_send.cpp:41
int cindex
Definition: agent_node.cpp:66
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65
double utime
Definition: agent_node.cpp:58
cosmosstruc * cinfo
Definition: agentclass.h:346
Agent * agent
Definition: agent_node.cpp:78
double mjd
Definition: agent_node.cpp:57
cachestruc cache[3+3+1]
Definition: agent_node.cpp:65
double lastday
Definition: agent_node.cpp:84
void loadephemeris ( )

Load Event templates.

Copy Event templates from file events.dict into a vector of eventstruc. These will then be used to generate Events by matching against the current data.Load Ephemeris

Calculate ephemeris every 20 seconds, starting with last archived value, and going through next full day.

282 {
283  int j;
284  uint32_t k;
285  double stime, ctime, etime;
286  std::vector<eventstruc> events;
287 
288  // Return immediately if we haven't loaded any data
289  if (cache[3].utime > 0.)
290  {
291  stime = cache[3].utime;
292  }
293  else
294  {
295  return;
296  }
297 
298  // Cache[j] holds most recent day
299  json_parse((char *)(cache[3].telem[cache[3].telem.size()-1].c_str()), agent->cinfo);
301 
302  for (j=4; j<MAXEPHEM+4; ++j)
303  {
304  cache[j].telem.clear();
305  cache[j].event.clear();
306  }
307 
308  // Load Ephemeris with most recent data, calculated from last point of most recent day
309  ctime = agent->cinfo->node.loc.utc;
310  stime = (int)ctime;
311  etime = stime + MAXEPHEM + 1;
315  do
316  {
317  cache[3+(int)(ctime-stime)].telem.push_back(json_of_list(myjstring,(char *)"{\"node_utc\",\"node_loc_pos_eci\",\"node_loc_att_icrf\",\"node_powgen\",\"node_powuse\",\"node_battlev\"", agent->cinfo));
318  calc_events(eventdict, agent->cinfo, events);
319  for (k=0; k<events.size(); ++k)
320  {
321  memcpy(&agent->cinfo->event[0],&events[k],sizeof(eventstruc));
322  strcpy(agent->cinfo->event[0].condition, agent->cinfo->emap[events[k].handle.hash][events[k].handle.index].text);
323  cache[3+(int)(ctime-stime)].event.push_back(json_of_event(myjstring, agent->cinfo));
324  }
325  cache[3+(int)(ctime-stime)].mjd = (int)ctime;
326  cache[3+(int)(ctime-stime)].utime = ctime;
327  ctime += 20./86400.;
331  } while (ctime < etime);
332 
333 }
size_t calc_events(vector< eventstruc > &dictionary, cosmosstruc *cinfo, vector< eventstruc > &events)
Calculate current Events.
Definition: jsonlib.cpp:11356
std::vector< eventstruc > eventdict
Definition: agent_node.cpp:75
int32_t json_parse(string jstring, cosmosstruc *cinfo)
Parse JSON using Name Space.
Definition: jsonlib.cpp:4799
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
#define MAXEPHEM
Definition: agent_node.cpp:44
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
double utc
Master time for location, in Modified Julian Day.
Definition: convertdef.h:879
vector< vector< jsonequation > > emap
JSON Equation Map matrix.
Definition: jsondef.h:4211
static vector< eventstruc > events
Definition: propagator_simple.cpp:64
nodestruc node
Structure for summary information in node.
Definition: jsondef.h:4220
std::string myjstring
Definition: agent_node.cpp:53
attstruc att
attstruc for this time.
Definition: convertdef.h:883
qatt icrf
Definition: convertdef.h:830
locstruc loc
Location structure.
Definition: jsondef.h:3596
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
std::vector< std::string > event
Definition: agent_node.cpp:62
const char * json_of_event(string &jstring, cosmosstruc *cinfo)
Create JSON for an event.
Definition: jsonlib.cpp:9854
gj_handle gjh
Definition: agent_node.cpp:80
int32_t loc_update(locstruc *loc)
Synchronize all frames in location structure.
Definition: convertlib.cpp:2294
posstruc pos
posstruc for this time.
Definition: convertdef.h:881
double utime
Definition: agent_node.cpp:58
const char * json_of_list(string &jstring, string list, cosmosstruc *cinfo)
Create JSON stream from list.
Definition: jsonlib.cpp:8714
cosmosstruc * cinfo
Definition: agentclass.h:346
cartpos eci
Definition: convertdef.h:737
Agent * agent
Definition: agent_node.cpp:78
vector< eventstruc > event
Single entry vector for event information.
Definition: jsondef.h:4250
double mjd
Definition: agent_node.cpp:57
std::vector< std::string > telem
Definition: agent_node.cpp:60
physicsstruc phys
Definition: jsondef.h:3597
cachestruc cache[3+3+1]
Definition: agent_node.cpp:65
void loanode ( )
int32_t request_loadmjd ( string &  request,
string &  response,
Agent  
)

Load a given day's data.

397 {
398  double value;
399 
400  sscanf(request.c_str(),"%*s %lf",&value);
401 
402  value = loadmjd(value);
403 
404  response = std::to_string(cache[cindex].mjd);
405  return 0;
406 }
string to_string(char *value)
Definition: stringlib.cpp:220
double mjd
Definition: udp_send.cpp:41
int cindex
Definition: agent_node.cpp:66
double loadmjd(double mjd)
Load a days worth of telemetry from disk.
Definition: agent_node.cpp:341
cachestruc cache[3+3+1]
Definition: agent_node.cpp:65
int32_t request_counts ( string &  request,
string &  response,
Agent  
)

Gives the number of event and telemetry records.

412 {
413  response = std::to_string(cache[cindex].telem.size()) + " " + std::to_string(cache[cindex].event.size()) + " " + std::to_string(commanddict.size()) + " " + std::to_string(agent->cinfo->node.target_cnt);
414  return 0;
415 }
uint16_t target_cnt
Definition: jsondef.h:3575
string to_string(char *value)
Definition: stringlib.cpp:220
nodestruc node
Structure for summary information in node.
Definition: jsondef.h:4220
std::vector< eventstruc > commanddict
Definition: agent_node.cpp:76
int cindex
Definition: agent_node.cpp:66
cosmosstruc * cinfo
Definition: agentclass.h:346
Agent * agent
Definition: agent_node.cpp:78
cachestruc cache[3+3+1]
Definition: agent_node.cpp:65
int32_t request_indexes ( string &  request,
string &  response,
Agent  
)

Returns the current record of both event and telemetry data.

461 {
462  response = std::to_string(cache[cindex].tindex) + " " + std::to_string(cache[cindex].eindex) + " " + std::to_string(dindex) + " " + std::to_string(mindex);
463  return 0;
464 }
string to_string(char *value)
Definition: stringlib.cpp:220
int32_t mindex
Definition: agent_node.cpp:71
int cindex
Definition: agent_node.cpp:66
uint32_t dindex
Definition: agent_node.cpp:68
cachestruc cache[3+3+1]
Definition: agent_node.cpp:65
int32_t request_days ( string &  request,
string &  response,
Agent  
)

Tells first and last day in archive.

421 {
422  response = std::to_string((int)firstday) + " " + std::to_string((int)lastday);
423  return 0;
424 }
string to_string(char *value)
Definition: stringlib.cpp:220
double firstday
Definition: agent_node.cpp:84
double lastday
Definition: agent_node.cpp:84
int32_t request_rewind ( string &  request,
string &  response,
Agent  
)

Goes to the first record for either events or telemetry for the loaded day.

430 {
431  char arg[50];
432 
433  sscanf(request.c_str(),"%*s %s",arg);
434 
435  switch (arg[0])
436  {
437  case 'e':
438  cache[cindex].eindex = 0;
439  break;
440  case 't':
441  cache[cindex].tindex = 0;
442  break;
443  case 'd':
444  dindex = 0;
445  break;
446  default:
447  cache[cindex].eindex = 0;
448  cache[cindex].tindex = 0;
449  dindex = 0;
450  break;
451  }
452 
453  response.clear();
454  return 0;
455 }
uint32_t eindex
Definition: agent_node.cpp:61
uint32_t tindex
Definition: agent_node.cpp:59
int cindex
Definition: agent_node.cpp:66
uint32_t dindex
Definition: agent_node.cpp:68
cachestruc cache[3+3+1]
Definition: agent_node.cpp:65
int32_t request_next ( string &  request,
string &  response,
Agent  
)

Gets next event, telemetry or data dictionary record entry.

479 {
480  char arg[50];
481 
482  sscanf(request.c_str(),"%*s %s",arg);
483 
484  switch (arg[0])
485  {
486  case 'e':
487  if (cache[cindex].eindex < cache[cindex].event.size())
488  {
489  response = (cache[cindex].event[cache[cindex].eindex].c_str());
490  if (cache[cindex].eindex < cache[cindex].event.size()-1)
491  cache[cindex].eindex++;
492  return 0;
493  }
494  break;
495  case 't':
496  switch (arg[1])
497  {
498  case 'e':
499  if (cache[cindex].tindex < cache[cindex].telem.size())
500  {
501  response = (cache[cindex].telem[cache[cindex].tindex].c_str());
502  if (cache[cindex].tindex < cache[cindex].telem.size()-1)
503  cache[cindex].tindex++;
504  return 0;
505  }
506  break;
507  case 'r':
508  if (mindex >= 0)
509  {
510  response = (json_of_target(reqjstring, agent->cinfo, mindex));
511  if (mindex < agent->cinfo->node.target_cnt-1)
512  ++mindex;
513  return 0;
514  }
515  break;
516  }
517  break;
518  case 'd':
519  if (dindex <= commanddict.size())
520  {
522  response = (json_of_event(myjstring, agent->cinfo));
523  if (dindex < commanddict.size()-1)
524  ++dindex;
525  return 0;
526  }
527  break;
528  }
529  response = ("");
530  return (AGENT_ERROR_REQUEST);
531 }
#define AGENT_ERROR_REQUEST
Definition: cosmos-errno.h:113
uint32_t eindex
Definition: agent_node.cpp:61
std::string reqjstring
Definition: agent_node.cpp:52
int32_t mindex
Definition: agent_node.cpp:71
std::string myjstring
Definition: agent_node.cpp:53
uint32_t tindex
Definition: agent_node.cpp:59
std::vector< eventstruc > commanddict
Definition: agent_node.cpp:76
std::vector< std::string > event
Definition: agent_node.cpp:62
const char * json_of_event(string &jstring, cosmosstruc *cinfo)
Create JSON for an event.
Definition: jsonlib.cpp:9854
int cindex
Definition: agent_node.cpp:66
cosmosstruc * cinfo
Definition: agentclass.h:346
Agent * agent
Definition: agent_node.cpp:78
vector< eventstruc > event
Single entry vector for event information.
Definition: jsondef.h:4250
const char * json_of_target(string &jstring, cosmosstruc *cinfo, uint16_t num)
Create JSON Track string.
Definition: jsonlib.cpp:8755
std::vector< std::string > telem
Definition: agent_node.cpp:60
uint32_t dindex
Definition: agent_node.cpp:68
cachestruc cache[3+3+1]
Definition: agent_node.cpp:65
int32_t request_getmjd ( string &  request,
string &  response,
Agent  
)

Returns the day that is loaded.

470 {
471  response = std::to_string(cache[cindex].mjd);
472  return 0;
473 }
string to_string(char *value)
Definition: stringlib.cpp:220
double mjd
Definition: udp_send.cpp:41
int cindex
Definition: agent_node.cpp:66
cachestruc cache[3+3+1]
Definition: agent_node.cpp:65
int32_t request_getnode ( string &  request,
string &  response,
Agent  
)

Returns the current node.ini.

537 {
538  response = (json_of_node(reqjstring, agent->cinfo));
539  return 0;
540 }
std::string reqjstring
Definition: agent_node.cpp:52
const char * json_of_node(string &jstring, cosmosstruc *cinfo)
Create JSON Node string.
Definition: jsonlib.cpp:8826
cosmosstruc * cinfo
Definition: agentclass.h:346
Agent * agent
Definition: agent_node.cpp:78
int main ( int  argc,
char *  argv[] 
)
103 {
104  int32_t iretn, sleept;
105  double nextmjd;
106 
107 
108  // Check the Node Name was supplied
109  if (argc!=2)
110  {
111  printf("Usage: agent_node node\n");
112  exit(1);
113  }
114 
115  // Initialize the Agent
116  if (!(agent = new Agent(argv[1], "node")))
117  exit (JSON_ERROR_NOJMAP);
118 
119  // Set period of broadcasting SOH
120  agent->cinfo->agent[0].aprd = 1.;
121 
122  // Add additional requests
123  if ((iretn=agent->add_request("loadmjd",request_loadmjd)))
124  exit (iretn);
125  if ((iretn=agent->add_request("counts",request_counts)))
126  exit (iretn);
127  if ((iretn=agent->add_request("indexes",request_indexes)))
128  exit (iretn);
129  if ((iretn=agent->add_request("days",request_days)))
130  exit (iretn);
131  if ((iretn=agent->add_request("rewind",request_rewind)))
132  exit (iretn);
133  if ((iretn=agent->add_request("next",request_next)))
134  exit (iretn);
135  if ((iretn=agent->add_request("getmjd",request_getmjd)))
136  exit (iretn);
137  if ((iretn=agent->add_request("getnode",request_getnode)))
138  exit (iretn);
139 
140 
141  // Check Node directory
142  if (get_nodedir(agent->cinfo->node.name).empty())
143  {
144  printf("Couldn't find Node directory %s\n",argv[1]);
145  exit (1);
146  }
147 
148  // Find most recent day in archive
150 
151  // Find oldest day in archive
153 
154  printf("Found days %f to %f\n",firstday, lastday);
155 
156  // Initialize data cache and load most recent day
157  for (int i=0; i<3+MAXEPHEM+1; ++i)
158  {
159  cache[i].mjd = 0.;
160  cache[i].telem.resize(0);
161  cache[i].event.resize(0);
162  }
164  {
165  agent->cinfo->node.loc.utc = currentmjd(0.);
166  cache[3].telem.push_back(json_of_list(myjstring,(char *)"{\"node_utc\",\"node_loc_pos_geod\",\"node_loc_att_topo\",\"node_powgen\",\"node_powuse\",\"node_battlev\"", agent->cinfo));
167  }
168 
169  printf("Loaded day %f\n",lastday);
170 
171  // Load Event and Command dictionaries
172  // loadevents();
173  load_dictionary(eventdict, agent->cinfo, (char *)"events.dict");
174  load_dictionary(commanddict, agent->cinfo, (char *)"commands.dict");
175 
176  printf("Loaded events\n");
177 
178  // Initialize ephemeris for this day
179  loadephemeris();
180 
181  printf("Loaded Ephemeris\n");
182 
183  // Start performing the body of the agent
184  json_parse((char *)(cache[3].telem[cache[3].telem.size()-1].c_str()), agent->cinfo);
185 // loc_update(&agent->cinfo->node.loc);
186 
187  switch (agent->cinfo->node.type)
188  {
189  case NODE_TYPE_SATELLITE:
190  // Initialize hardware
192  // Initialize orbit
196  agent->set_sohstring((char *)"{\"node_utc\",\"node_name\",\"node_type\",\"node_loc_pos_eci\",\"node_loc_att_icrf\"}");
197  printf("Initialized satellite starting at %.15g [%.8g %.8g %.8g]\n", agent->cinfo->node.loc.pos.eci.utc, agent->cinfo->node.loc.pos.eci.s.col[0], agent->cinfo->node.loc.pos.eci.s.col[1], agent->cinfo->node.loc.pos.eci.s.col[2]);
198  break;
200  case NODE_TYPE_MOC:
201  case NODE_TYPE_UAV:
202  case NODE_TYPE_VEHICLE:
203  default:
205  agent->set_sohstring((char *)"{\"node_utc\",\"node_name\",\"node_type\",\"node_loc_pos_geod\",\"node_loc_att_topo\"}");
206  printf("Initialized ground node starting at %.15g [%.8g %.8g %.8g]\n", agent->cinfo->node.loc.pos.geod.utc, agent->cinfo->node.loc.pos.geod.s.lon, agent->cinfo->node.loc.pos.geod.s.lat, agent->cinfo->node.loc.pos.geod.s.h);
207  break;
208  }
209 
210  nextmjd = currentmjd(0.);
211  while(agent->running())
212  {
213  nextmjd += agent->cinfo->agent[0].aprd/86400.;
215  {
216 
217  }
218  switch (agent->cinfo->node.type)
219  {
220  case NODE_TYPE_SATELLITE:
223  break;
224  default:
229  agent->cinfo->node.loc.att.topo.s = q_eye();
230  for (uint32_t i=0; i<agent->cinfo->node.target_cnt; ++i)
231  {
232  if (agent->cinfo->target[i].elfrom > 0.)
233  {
235  }
236  }
239  break;
240  }
241 // agent->post(Agent::AgentMessage::SOH, json_of_list(myjstring, agent->cinfo->agent[0].sohstring,cinfo));
242  agent->post(Agent::AgentMessage::SOH, json_of_table(myjstring, agent->sohtable, agent->cinfo));
243  sleept = (int)((nextmjd-currentmjd(0.))*86400000000.);
244  if (sleept < 0) sleept = 0;
245  COSMOS_USLEEP(sleept);
246  }
247 
248  return 0;
249 }
int32_t request_loadmjd(string &request, string &response, Agent *)
Load a given day&#39;s data.
Definition: agent_node.cpp:396
int32_t request_indexes(string &request, string &response, Agent *)
Returns the current record of both event and telemetry data.
Definition: agent_node.cpp:460
int32_t request_days(string &request, string &response, Agent *)
Tells first and last day in archive.
Definition: agent_node.cpp:420
uint16_t target_cnt
Definition: jsondef.h:3575
int32_t request_counts(string &request, string &response, Agent *)
Gives the number of event and telemetry records.
Definition: agent_node.cpp:411
double findfirstday(string name)
Find first day in archive.
Definition: datalib.cpp:1754
double utc
Definition: convertdef.h:261
std::vector< eventstruc > eventdict
Definition: agent_node.cpp:75
#define JSON_ERROR_NOJMAP
Definition: cosmos-errno.h:93
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
void loadephemeris()
Load Event templates.
Definition: agent_node.cpp:281
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
#define MAXEPHEM
Definition: agent_node.cpp:44
int32_t request_getnode(string &request, string &response, Agent *)
Returns the current node.ini.
Definition: agent_node.cpp:536
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
double utc
Master time for location, in Modified Julian Day.
Definition: convertdef.h:879
int32_t set_sohstring(string list)
Set Limited SOH string.
Definition: agentclass.cpp:641
Definition: cosmos-defs.h:91
quaternion q_fmult(rvector r1, quaternion q2)
rvector quaternion multiply
Definition: vector.cpp:1079
nodestruc node
Structure for summary information in node.
Definition: jsondef.h:4220
double findlastday(string name)
Find last day in archive.
Definition: datalib.cpp:1679
uint16_t running()
Check if we&#39;re supposed to be running.
Definition: agentclass.cpp:391
Definition: cosmos-defs.h:90
rvector s
Location.
Definition: convertdef.h:163
int32_t post(messstruc mess)
Post a Cosmos::Agent::messstruc.
Definition: agentclass.cpp:2074
double firstday
Definition: agent_node.cpp:84
std::string myjstring
Definition: agent_node.cpp:53
attstruc att
attstruc for this time.
Definition: convertdef.h:883
double utcoffset
MJD Offset between system UT and simulated UT.
Definition: jsondef.h:3590
double newlastday
Definition: agent_node.cpp:84
int32_t add_request(string token, external_request_function function, string synopsis="", string description="")
Add internal request to Agent request list with description and synopsis.
Definition: agentclass.cpp:312
char name[40+1]
Node Name.
Definition: jsondef.h:3556
Definition: agentclass.h:139
quaternion q_change_around_z(double angle)
Rotation quaternion for Z axis.
Definition: vector.cpp:1461
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 request_getmjd(string &request, string &response, Agent *)
Returns the day that is loaded.
Definition: agent_node.cpp:469
double h
Height in meters.
Definition: vector.h:229
vector< locstruc > gauss_jackson_propagate(gj_handle &gjh, physicsstruc &physics, locstruc &loc, double tomjd)
Definition: physicslib.cpp:2871
std::vector< eventstruc > commanddict
Definition: agent_node.cpp:76
std::vector< std::string > event
Definition: agent_node.cpp:62
gj_handle gjh
Definition: agent_node.cpp:80
double lon
Longitude in radians.
Definition: vector.h:227
int32_t pos_geod(locstruc *loc)
Set Geodetic position.
Definition: convertlib.cpp:576
Definition: cosmos-defs.h:94
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65
Definition: cosmos-defs.h:92
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
uint32_t pass
pass indicator: allows synchronization with other attitude and position values.
Definition: convertdef.h:485
gvector s
Position vector.
Definition: convertdef.h:263
double lat
Latitude in radians.
Definition: vector.h:225
qatt topo
Definition: convertdef.h:826
const char * json_of_list(string &jstring, string list, cosmosstruc *cinfo)
Create JSON stream from list.
Definition: jsonlib.cpp:8714
void hardware_init_eci(cosmosstruc *cinfo, locstruc &loc)
Initialize Hardware.
Definition: physicslib.cpp:877
vector< agentstruc > agent
Single entry vector for agent information.
Definition: jsondef.h:4247
quaternion s
0th derivative: Quaternion
Definition: convertdef.h:479
double col[3]
Definition: vector.h:55
cosmosstruc * cinfo
Definition: agentclass.h:346
cartpos eci
Definition: convertdef.h:737
int32_t request_next(string &request, string &response, Agent *)
Gets next event, telemetry or data dictionary record entry.
Definition: agent_node.cpp:478
quaternion q_eye()
Identity quaternion.
Definition: vector.cpp:1310
Agent * agent
Definition: agent_node.cpp:78
geoidpos geod
Definition: convertdef.h:741
vector< jsonentry * > sohtable
State of Health element vector.
Definition: agentclass.h:156
double loadmjd(double mjd)
Load a days worth of telemetry from disk.
Definition: agent_node.cpp:341
uint32_t pass
pass indicator: allows synchronization with other attitude and position values.
Definition: convertdef.h:269
double mjd
Definition: agent_node.cpp:57
Definition: cosmos-defs.h:93
vector< targetstruc > target
Vector of all targets known to node.
Definition: jsondef.h:4253
std::vector< std::string > telem
Definition: agent_node.cpp:60
quaternion q_change_around_x(double angle)
Rotation quaternion for X axis.
Definition: vector.cpp:1410
uint16_t type
Node Type as listed in NODE_TYPE.
Definition: jsondef.h:3562
int32_t att_topo(locstruc *loc)
Definition: convertlib.cpp:2252
physicsstruc phys
Definition: jsondef.h:3597
int32_t request_rewind(string &request, string &response, Agent *)
Goes to the first record for either events or telemetry for the loaded day.
Definition: agent_node.cpp:429
cachestruc cache[3+3+1]
Definition: agent_node.cpp:65
double lastday
Definition: agent_node.cpp:84

Variable Documentation

char ibuf[AGENTMAXBUFFER]
int waitsec = 5
std::string reqjstring
std::string myjstring
cachestruc cache[3+3+1]
int cindex
uint32_t dindex
int32_t Mcount
int32_t mindex
nodestruc* node
std::vector<eventstruc> eventdict
std::vector<eventstruc> commanddict
Agent* agent
nodestruc statnode
gj_handle gjh
int32_t myport
double lastday
double firstday
double currentday
double newlastday