COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
mtrstruc Struct Reference

Magnetic Torque Rod structure: z axis is aligned with rod. More...

#include <jsondef.h>

Collaboration diagram for mtrstruc:

Public Member Functions

json11::Json to_json () const
 Convert class contents to JSON object. More...
 
void from_json (const string &s)
 Set class contents from JSON string. More...
 

Public Attributes

quaternion align
 Rotates vectors from MTR frame to Body frame. More...
 
float npoly [7] = {0.f}
 Terms of 6th order polynomial converting negative moment to current. More...
 
float ppoly [7] = {0.f}
 Terms of 6th order polynomial converting positive moment to current. More...
 
float mxmom = 0.f
 Maxiumum field strength. More...
 
float tc = 0.f
 Field Change Time Constant. More...
 
float rmom = 0.f
 Requested Magnetic Moment. More...
 
float mom = 0.f
 Actual Magnetic Moment. More...
 

Detailed Description

Magnetic Torque Rod structure: z axis is aligned with rod.

Member Function Documentation

json11::Json mtrstruc::to_json ( ) const
inline

Convert class contents to JSON object.

Returns a json11 JSON object of the class

Returns
A json11 JSON object containing every member variable within the class
2007  {
2008  vector<float> v_npoly = vector<float>(npoly, npoly+sizeof(npoly)/sizeof(npoly[0]));
2009  vector<float> v_ppoly = vector<float>(ppoly, npoly+sizeof(ppoly)/sizeof(ppoly[0]));
2010  return json11::Json::object {
2011  { "align" , align },
2012  { "npoly" , v_npoly },
2013  { "ppoly" , v_ppoly },
2014  { "mxmom" , mxmom },
2015  { "tc" , tc },
2016  { "rmom" , rmom },
2017  { "mom" , mom }
2018  };
2019  }
std::map< std::string, Json > object
Definition: json11.hpp:88
float tc
Field Change Time Constant.
Definition: jsondef.h:1997
float rmom
Requested Magnetic Moment.
Definition: jsondef.h:1999
quaternion align
Rotates vectors from MTR frame to Body frame.
Definition: jsondef.h:1989
float ppoly[7]
Terms of 6th order polynomial converting positive moment to current.
Definition: jsondef.h:1993
float mxmom
Maxiumum field strength.
Definition: jsondef.h:1995
float npoly[7]
Terms of 6th order polynomial converting negative moment to current.
Definition: jsondef.h:1991
float mom
Actual Magnetic Moment.
Definition: jsondef.h:2001
void mtrstruc::from_json ( const string &  s)
inline

Set class contents from JSON string.

Parses the provided JSON-formatted string and sets the class data. String should be formatted like the string returned from to_json()

Parameters
sJSON-formatted string to set class contents to
Returns
n/a
2027  {
2028  string error;
2029  json11::Json parsed = json11::Json::parse(s,error);
2030  if(error.empty()) {
2031  if(!parsed["align"].is_null()) { align.from_json(parsed["align"].dump()); }
2032  if(!parsed["npoly"].is_null()) {
2033  auto p_npoly = parsed["npoly"].array_items();
2034  for(size_t i = 0; i != p_npoly.size(); ++i) {
2035  if(!p_npoly[i].is_null()) { npoly[i] = p_npoly[i].number_value(); }
2036  }
2037  }
2038  if(!parsed["ppoly"].is_null()) {
2039  auto p_ppoly = parsed["ppoly"].array_items();
2040  for(size_t i = 0; i != p_ppoly.size(); ++i) {
2041  if(!p_ppoly[i].is_null()) { ppoly[i] = p_ppoly[i].number_value(); }
2042  }
2043  }
2044  if(!parsed["mxmom"].is_null()) { mxmom = parsed["mxmom"].number_value(); }
2045  if(!parsed["tc"].is_null()) { tc = parsed["tc"].number_value(); }
2046  if(!parsed["rmom"].is_null()) { rmom = parsed["rmom"].number_value(); }
2047  if(!parsed["mom"].is_null()) { mom = parsed["mom"].number_value(); }
2048  } else {
2049  cerr<<"ERROR: <"<<error<<">"<<endl;
2050  }
2051  return;
2052  }
float tc
Field Change Time Constant.
Definition: jsondef.h:1997
Definition: json11.hpp:79
int i
Definition: rw_test.cpp:37
float rmom
Requested Magnetic Moment.
Definition: jsondef.h:1999
quaternion align
Rotates vectors from MTR frame to Body frame.
Definition: jsondef.h:1989
float ppoly[7]
Terms of 6th order polynomial converting positive moment to current.
Definition: jsondef.h:1993
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
static void dump(NullStruct, string &out)
Definition: json11.cpp:53
float mxmom
Maxiumum field strength.
Definition: jsondef.h:1995
const array & array_items() const
Definition: json11.cpp:284
void from_json(const string &s)
Set class contents from JSON string.
Definition: vector.h:431
float npoly[7]
Terms of 6th order polynomial converting negative moment to current.
Definition: jsondef.h:1991
float mom
Actual Magnetic Moment.
Definition: jsondef.h:2001
double number_value() const
Definition: json11.cpp:280

Member Data Documentation

quaternion mtrstruc::align

Rotates vectors from MTR frame to Body frame.

float mtrstruc::npoly[7] = {0.f}

Terms of 6th order polynomial converting negative moment to current.

float mtrstruc::ppoly[7] = {0.f}

Terms of 6th order polynomial converting positive moment to current.

float mtrstruc::mxmom = 0.f

Maxiumum field strength.

float mtrstruc::tc = 0.f

Field Change Time Constant.

float mtrstruc::rmom = 0.f

Requested Magnetic Moment.

float mtrstruc::mom = 0.f

Actual Magnetic Moment.


The documentation for this struct was generated from the following file: