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

Physics Simulation Structure. More...

#include <jsondef.h>

Collaboration diagram for physicsstruc:

Public Member Functions

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

Public Attributes

double dt = 0.
 Time step in seconds. More...
 
double dtj = 0.
 Time step in Julian days. More...
 
double utc = 0.
 Simulated starting time in MJD. More...
 
double mjdaccel = 0.
 Acceleration factor for simulated time. More...
 
double mjddiff = 0.
 Offset factor for simulated time (simtime = mjdaccel * realtime + mjddiff) More...
 
float hcap = 900.f
 
float mass = 1.f
 
float temp = 300.f
 
float heat = 300. * 900. * 1.
 
float radiation
 
float area = .001f
 
float battcap = 36000.f
 
float battlev = 0.f
 
float powgen = 0.f
 
float powuse = 0.f
 
int32_t mode = 0
 
Vector ftorque
 
Vector atorque
 
Vector rtorque
 
Vector gtorque
 
Vector htorque
 
Vector hmomentum
 
Vector ctorque
 
Vector fdrag
 
Vector adrag
 
Vector rdrag
 
Vector thrust
 
Vector moi = Vector(1.,1.,1.)
 
Vector com
 
vector< Vectorvertices
 
vector< trianglestructriangles
 

Detailed Description

Physics Simulation Structure.

Holds parameters used specifically for the physical simulation of the environment and hardware of a Node.

Member Function Documentation

json11::Json physicsstruc::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
3458  {
3459  return json11::Json::object {
3460  { "dt" , dt },
3461  { "dtj" , dtj },
3462  { "utc" , utc },
3463  { "mjdaccel" , mjdaccel },
3464  { "mjddiff" , mjddiff },
3465  { "hcap" , hcap },
3466  { "mass" , mass },
3467  { "temp" , temp },
3468  { "heat" , heat },
3469  { "area" , area },
3470  { "radiation" , radiation },
3471  { "battcap" , battcap },
3472  { "battlev" , battlev },
3473  { "powgen" , powgen },
3474  { "powuse" , powuse },
3475  { "mode" , mode },
3476 
3477  { "ftorque" , ftorque },
3478  { "atorque" , atorque },
3479  { "rtorque" , rtorque },
3480  { "gtorque" , gtorque },
3481  { "htorque" , htorque },
3482  { "hmomentum" , hmomentum },
3483  { "ctorque" , ctorque },
3484  { "fdrag" , fdrag },
3485  { "adrag" , adrag },
3486  { "rdrag" , rdrag },
3487  { "thrust" , thrust },
3488  { "moi" , moi },
3489  { "com" , com },
3490  { "vertices" , vertices },
3491  { "triangles" , triangles }
3492  };
3493  }
Vector moi
Definition: jsondef.h:3448
float area
Definition: jsondef.h:3429
Vector fdrag
Definition: jsondef.h:3444
std::map< std::string, Json > object
Definition: json11.hpp:88
Vector com
Definition: jsondef.h:3449
Vector gtorque
Definition: jsondef.h:3440
float radiation
Definition: jsondef.h:3428
Vector adrag
Definition: jsondef.h:3445
vector< Vector > vertices
Definition: jsondef.h:3451
Vector thrust
Definition: jsondef.h:3447
float battcap
Definition: jsondef.h:3430
float battlev
Definition: jsondef.h:3431
Vector ftorque
Definition: jsondef.h:3437
double mjddiff
Offset factor for simulated time (simtime = mjdaccel * realtime + mjddiff)
Definition: jsondef.h:3422
double mjdaccel
Acceleration factor for simulated time.
Definition: jsondef.h:3420
float temp
Definition: jsondef.h:3426
float hcap
Definition: jsondef.h:3424
Vector htorque
Definition: jsondef.h:3441
Vector rtorque
Definition: jsondef.h:3439
Vector rdrag
Definition: jsondef.h:3446
Vector ctorque
Definition: jsondef.h:3443
Vector atorque
Definition: jsondef.h:3438
Vector hmomentum
Definition: jsondef.h:3442
float powuse
Definition: jsondef.h:3433
float heat
Definition: jsondef.h:3427
float mass
Definition: jsondef.h:3425
double dt
Time step in seconds.
Definition: jsondef.h:3414
int32_t mode
Definition: jsondef.h:3436
double utc
Simulated starting time in MJD.
Definition: jsondef.h:3418
double dtj
Time step in Julian days.
Definition: jsondef.h:3416
vector< trianglestruc > triangles
Definition: jsondef.h:3452
float powgen
Definition: jsondef.h:3432
void physicsstruc::from_json ( const string &  js)
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
3501  {
3502  string error;
3503  json11::Json parsed = json11::Json::parse(js,error);
3504  if(error.empty()) {
3505  if(!parsed["dt"].is_null()) { dt = parsed["dt"].number_value(); }
3506  if(!parsed["dtj"].is_null()) { dtj = parsed["dtj"].number_value(); }
3507  if(!parsed["utc"].is_null()) { utc = parsed["utc"].number_value(); }
3508  if(!parsed["mjdaccel"].is_null()) { mjdaccel = parsed["mjdaccel"].number_value(); }
3509  if(!parsed["mjddiff"].is_null()) { mjddiff = parsed["mjddiff"].number_value(); }
3510  if(!parsed["hcap"].is_null()) { hcap = parsed["hcap"].number_value(); }
3511  if(!parsed["mass"].is_null()) { mass = parsed["mass"].number_value(); }
3512  if(!parsed["temp"].is_null()) { temp = parsed["temp"].number_value(); }
3513  if(!parsed["heat"].is_null()) { heat = parsed["heat"].number_value(); }
3514  if(!parsed["radiation"].is_null()) { radiation = parsed["radiation"].number_value(); }
3515  if(!parsed["area"].is_null()) { area = parsed["area"].number_value(); }
3516  if(!parsed["battcap"].is_null()) { battcap = parsed["battcap"].number_value(); }
3517  if(!parsed["battlev"].is_null()) { battlev = parsed["battlev"].number_value(); }
3518  if(!parsed["powgen"].is_null()) { powgen = parsed["powgen"].number_value(); }
3519  if(!parsed["powuse"].is_null()) { powuse = parsed["powuse"].number_value(); }
3520  if(!parsed["mode"].is_null()) { mode = parsed["mode"].int_value(); }
3521 
3522  if(!parsed["ftorque"].is_null()) { ftorque.from_json(parsed["ftorque"].dump()); }
3523  if(!parsed["atorque"].is_null()) { atorque.from_json(parsed["atorque"].dump()); }
3524  if(!parsed["rtorque"].is_null()) { rtorque.from_json(parsed["rtorque"].dump()); }
3525  if(!parsed["gtorque"].is_null()) { gtorque.from_json(parsed["gtorque"].dump()); }
3526  if(!parsed["htorque"].is_null()) { htorque.from_json(parsed["htorque"].dump()); }
3527  if(!parsed["hmomentum"].is_null()) { hmomentum.from_json(parsed["hmomentum"].dump()); }
3528  if(!parsed["ctorque"].is_null()) { ctorque.from_json(parsed["ctorque"].dump()); }
3529  if(!parsed["fdrag"].is_null()) { fdrag.from_json(parsed["fdrag"].dump()); }
3530  if(!parsed["adrag"].is_null()) { adrag.from_json(parsed["adrag"].dump()); }
3531  if(!parsed["rdrag"].is_null()) { rdrag.from_json(parsed["rdrag"].dump()); }
3532  if(!parsed["thrust"].is_null()) { thrust.from_json(parsed["thrust"].dump()); }
3533  if(!parsed["moi"].is_null()) { moi.from_json(parsed["moi"].dump()); }
3534  if(!parsed["com"].is_null()) { com.from_json(parsed["com"].dump()); }
3535  for(size_t i = 0; i < vertices.size(); ++i) {
3536  if(!parsed["vertices"][i].is_null()) { vertices[i].from_json(parsed["vertices"][i].dump()); }
3537  }
3538  for(size_t i = 0; i < triangles.size(); ++i) {
3539  if(!parsed["triangles"][i].is_null()) { triangles[i].from_json(parsed["triangles"][i].dump()); }
3540  }
3541  } else {
3542  cerr<<"ERROR = "<<error<<endl;
3543  }
3544  return;
3545  }
Vector moi
Definition: jsondef.h:3448
float area
Definition: jsondef.h:3429
Vector fdrag
Definition: jsondef.h:3444
Definition: json11.hpp:79
Vector com
Definition: jsondef.h:3449
Vector gtorque
Definition: jsondef.h:3440
float radiation
Definition: jsondef.h:3428
Vector adrag
Definition: jsondef.h:3445
vector< Vector > vertices
Definition: jsondef.h:3451
int i
Definition: rw_test.cpp:37
Vector thrust
Definition: jsondef.h:3447
float battcap
Definition: jsondef.h:3430
float battlev
Definition: jsondef.h:3431
Vector ftorque
Definition: jsondef.h:3437
double mjddiff
Offset factor for simulated time (simtime = mjdaccel * realtime + mjddiff)
Definition: jsondef.h:3422
double mjdaccel
Acceleration factor for simulated time.
Definition: jsondef.h:3420
float temp
Definition: jsondef.h:3426
float hcap
Definition: jsondef.h:3424
void from_json(const string &s)
Set class contents from JSON string.
Definition: vector.h:783
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
Vector htorque
Definition: jsondef.h:3441
static void dump(NullStruct, string &out)
Definition: json11.cpp:53
Vector rtorque
Definition: jsondef.h:3439
Vector rdrag
Definition: jsondef.h:3446
Vector ctorque
Definition: jsondef.h:3443
Vector atorque
Definition: jsondef.h:3438
Vector hmomentum
Definition: jsondef.h:3442
float powuse
Definition: jsondef.h:3433
float heat
Definition: jsondef.h:3427
float mass
Definition: jsondef.h:3425
double dt
Time step in seconds.
Definition: jsondef.h:3414
int32_t mode
Definition: jsondef.h:3436
double utc
Simulated starting time in MJD.
Definition: jsondef.h:3418
double dtj
Time step in Julian days.
Definition: jsondef.h:3416
int int_value() const
Definition: json11.cpp:281
vector< trianglestruc > triangles
Definition: jsondef.h:3452
float powgen
Definition: jsondef.h:3432
double number_value() const
Definition: json11.cpp:280

Member Data Documentation

double physicsstruc::dt = 0.

Time step in seconds.

double physicsstruc::dtj = 0.

Time step in Julian days.

double physicsstruc::utc = 0.

Simulated starting time in MJD.

double physicsstruc::mjdaccel = 0.

Acceleration factor for simulated time.

double physicsstruc::mjddiff = 0.

Offset factor for simulated time (simtime = mjdaccel * realtime + mjddiff)

float physicsstruc::hcap = 900.f
float physicsstruc::mass = 1.f
float physicsstruc::temp = 300.f
float physicsstruc::heat = 300. * 900. * 1.
float physicsstruc::radiation
float physicsstruc::area = .001f
float physicsstruc::battcap = 36000.f
float physicsstruc::battlev = 0.f
float physicsstruc::powgen = 0.f
float physicsstruc::powuse = 0.f
int32_t physicsstruc::mode = 0
Vector physicsstruc::ftorque
Vector physicsstruc::atorque
Vector physicsstruc::rtorque
Vector physicsstruc::gtorque
Vector physicsstruc::htorque
Vector physicsstruc::hmomentum
Vector physicsstruc::ctorque
Vector physicsstruc::fdrag
Vector physicsstruc::adrag
Vector physicsstruc::rdrag
Vector physicsstruc::thrust
Vector physicsstruc::moi = Vector(1.,1.,1.)
Vector physicsstruc::com
vector<Vector> physicsstruc::vertices
vector<trianglestruc> physicsstruc::triangles

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