COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
agent_add_soh.cpp File Reference
#include "support/configCosmos.h"
#include "support/elapsedtime.h"
#include "support/timeutils.h"
#include "agent/agentclass.h"
#include <iostream>
#include <string>
Include dependency graph for agent_add_soh.cpp:

Macros

#define MAXBUFFERSIZE   256
 

Functions

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

Variables

string agentname = "add_soh"
 
string nodename = "telem"
 
int waitsec = 1
 
int loopmsec = 1
 
char buf4 [512]
 
beatstruc beat_agent_002
 
Agentagent
 

Macro Definition Documentation

#define MAXBUFFERSIZE   256

Function Documentation

int myagent ( )
97 {
98  cout << "agent " << agentname << " ...online " << endl;
99 
100  rvector omega;
101  omega = {1.,2.,3.};
102 
104  pos_eci.s = {4,5,6};
105  pos_eci.v = {0.1,0,0};
106 
107  // Start executing the agent
108  while(agent->running())
109  {
110  pos_eci.utc = currentmjd(0);
112  }
113 
114  return (0);
115 
116 }
3 element generic row vector
Definition: vector.h:53
double utc
UTC of Position.
Definition: convertdef.h:161
Cartesian full position structure.
Definition: convertdef.h:158
Agent * agent
Definition: agent_add_soh.cpp:61
nodestruc node
Structure for summary information in node.
Definition: jsondef.h:4220
uint16_t running()
Check if we&#39;re supposed to be running.
Definition: agentclass.cpp:391
rvector s
Location.
Definition: convertdef.h:163
string agentname
Definition: agent_add_soh.cpp:53
locstruc loc
Location structure.
Definition: jsondef.h:3596
int32_t pos_eci(locstruc *loc)
Set ECI position.
Definition: convertlib.cpp:258
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65
posstruc pos
posstruc for this time.
Definition: convertdef.h:881
cosmosstruc * cinfo
Definition: agentclass.h:346
cartpos eci
Definition: convertdef.h:737
rvector v
Velocity.
Definition: convertdef.h:165
int main ( int  argc,
char *  argv[] 
)
66 {
67  int32_t iretn = 0;
68  cout << "Starting agent " << endl;
69 
70  // Establish the command channel and heartbeat
71  agent = new Agent(nodename, agentname);
72  if ((iretn = agent->wait()) < 0)
73  {
74  fprintf(agent->get_debug_fd(), "%16.10f %s Failed to start Agent %s on Node %s Dated %s : %s\n",currentmjd(), mjd2iso8601(currentmjd()).c_str(), agent->getAgent().c_str(), agent->getNode().c_str(), utc2iso8601(data_ctime(argv[0])).c_str(), cosmos_error_string(iretn).c_str());
75  exit(iretn);
76  }
77  else
78  {
79  fprintf(agent->get_debug_fd(), "%16.10f %s Started Agent %s on Node %s Dated %s\n",currentmjd(), mjd2iso8601(currentmjd()).c_str(), agent->getAgent().c_str(), agent->getNode().c_str(), utc2iso8601(data_ctime(argv[0])).c_str());
80  }
81 
82 
83  // Set SOH String
84  char sohstring[2000] = "{\"node_loc_utc\","
85  "\"node_loc_pos_eci\","
86  "\"node_loc_att_icrf\"}"
87  ;
88  agent->set_sohstring(sohstring);
89 
90  // Start our own thread
91  myagent();
92 
93  return iretn;
94 }
FILE * get_debug_fd(double mjd=0.)
Definition: agentclass.cpp:2645
string getNode()
Listen for heartbeat.
Definition: agentclass.cpp:2607
Agent * agent
Definition: agent_add_soh.cpp:61
int iretn
Definition: rw_test.cpp:37
int32_t wait(State state=State::RUN, double waitsec=10.)
Definition: agentclass.cpp:398
int32_t set_sohstring(string list)
Set Limited SOH string.
Definition: agentclass.cpp:641
string cosmos_error_string(int32_t cosmos_errno)
Definition: cosmos-errno.cpp:45
static string sohstring
Definition: agent_cpu-2-0.cpp:72
string getAgent()
Definition: agentclass.cpp:2609
string agentname
Definition: agent_add_soh.cpp:53
Definition: agentclass.h:139
double data_ctime(string path)
Definition: datalib.cpp:1910
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65
string nodename
Definition: agent_add_soh.cpp:54
string utc2iso8601(double utc)
ISO 8601 version of time.
Definition: timelib.cpp:1286
int myagent()
Definition: agent_add_soh.cpp:96
string mjd2iso8601(double mjd)
Definition: timelib.cpp:1316

Variable Documentation

string agentname = "add_soh"
string nodename = "telem"
int waitsec = 1
int loopmsec = 1
char buf4[512]
beatstruc beat_agent_002
Agent* agent