ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
modelspace Namespace Reference

Class to propagate CR3BP dynamics in characteristic units. More...

Classes

class  Accelerometer
 Accelerometer Model. More...
 
class  ArgParser
 Class to parse arguments from the command line in any language. More...
 
class  AsphericalGravityModel
 Aspherical gravity model with J2 and J3 effects. More...
 
class  AutoDoc
 Class to document from code. More...
 
class  BiasNoiseModel
 Bias and noise model. More...
 
class  ConfigurationWriter
 Write out script from UX to execute using set toolchain. Base class for override. More...
 
struct  Connection
 Hold all information related to a connection point in the ImGUI UX. More...
 
class  CR3BPDynamics
 
class  CR3BPDynamicsModel
 Circular Restricted Three Body Problem Dynamics Model. More...
 
class  CsvLogger
 Class for logging to CSV. More...
 
struct  Dispersion
 Struct to store all data associated with dispersion. More...
 
class  DispersionEngine
 Class to generate input dispersions for the simulation. More...
 
class  EffectiveSolarAreaModel
 Effective Solar Area model. More...
 
class  FlatPlateDragModel
 Flat plate drag model. More...
 
class  FrameStateSensorModel
 Frame state sensor model. More...
 
class  GravityGradientModel
 Gravity Gradient Model. More...
 
class  GroundStationModel
 Simple ground station model. More...
 
class  GroundStationSensor
 Ground Station Sensor Model. More...
 
class  Gyro
 Gyro Model. More...
 
class  Hdf5Logger
 Class for logging to HDF5. More...
 
struct  ImNode
 Hold all data related to a visual node in the ImGUI UX. More...
 
class  ImpulseModel
 Impulse Model. More...
 
class  IMU
 IMU Model. More...
 
class  LogEvent
 Class to execute logging. More...
 
class  LogManager
 Class to manage logs. More...
 
class  LvcStateSensorModel
 LVC State Sensor Model. More...
 
class  LvlhFrameManagerModel
 LVLV Frame Manager Model. More...
 
class  Model
 Base model class for derived implementation. More...
 
class  ModelSpacePyConfigWriter
 Write out ModelSpace Python file from node information. More...
 
class  NodeBuilder
 Generate a list of mapped nodes and connections from json. More...
 
struct  NormalDispersion
 Struct to store all data associated with normal dispersion. More...
 
class  NormalRandom
 Class to generate random numbers according to normal distribution. More...
 
class  OrbitalElementsSensorModel
 Orbital elements sensor model. More...
 
class  OrbitalElementsStateInit
 Model to produce position/velocity vector from orbital elements. More...
 
class  PlanetInfo
 Planet Information Model. More...
 
class  PlanetRelativeStatesModel
 Planet relative states model. More...
 
class  PointMassGravityModel
 Point mass gravity model. More...
 
class  ProximityMonitor
 The time trigger monitor is a simple implementation of the monitor that triggers continuously after a set time. The time is set upon construction, but may be changed during run via function. More...
 
class  RangeAzElSensorModel
 Range, azimuth, and elevation sensor model. More...
 
class  RateMonitor
 Monitor to trigger at a particular rate. More...
 
class  SimpleCameraSensor
 Simple Camera Model. More...
 
class  SimplePlanet
 Simple Planet Model. More...
 
class  SimpleSpacecraft
 Simple Spacecraft Model. More...
 
class  SimpleThrusterModel
 Simple thruster model. More...
 
class  SimScheduler
 Simple implementation of the scheduler class. More...
 
class  SimTerminationEvent
 Class to trigger termination in scheduler. More...
 
class  SimTimeManager
 Class to manage time for the simulation object. More...
 
class  SimulationExecutive
 Implementation of the executive class for simulation. More...
 
class  SixDOFDynamicsModel
 Model to implement 6-DOF dynamics. More...
 
class  SolarPanelPowerModel
 Solar panel power model. More...
 
class  SolarRadiationPressureModel
 Solar Radiation Pressure Model. More...
 
class  SphericalHarmonicsGravityModel
 Spherical Harmonics Model. More...
 
class  SpiceManager
 The Spice Manager is a single class instance to manage spice frames and return SPICE states. More...
 
class  SpicePlanet
 The model to maintain planet state using SPICE. More...
 
class  StarTracker
 Star Tracker Model. More...
 
class  SynodicFrameManagerModel
 Synodic Frame Manager Model. More...
 
class  TimedImpulsiveBurnModel
 Timed Impulsive Burn Model. More...
 
class  TimeTriggerMonitor
 The time trigger monitor is a simple implementation of the monitor that triggers continuously after a set time. The time is set upon construction, but may be changed during run via function. More...
 
struct  UniformDispersion
 Struct to store all data associated with uniform dispersion. More...
 
class  UniformRandom
 Class to generate random numbers according to uniform distribution. More...
 
class  VisualsModel
 Class to write out frame information via socket using a standard interface as follows: More...
 

Enumerations

enum  connection_type_e { PARAM = -1 , INPUT = -2 , ALL_INPUT = -3 , OUTPUT = 1 }
 Hold acceptable values for connection type.
 
enum  node_types_e {
  STANDARD = 0 , MODEL = 1 , SIM_EXEC = 2 , TEXT_NODE = 3 ,
  FRAME = 4 , LOGGER = 5 , VIZKIT = 6
}
 Node type definition to allow config writer to identify custom nodes.
 
enum  cmds_e { OFF , ON }
 
enum  simulation_steps_e {
  NOT_SCHEDULED =-2 , STARTUP_ONLY =-1 , ALL =0 , START_STEP =1 ,
  DERIVATIVE =2 , END_STEP =3
}
 
enum  integrator_type_e { FORWARD_EULER = 1 , RK4 = 4 }
 
enum  radius_type_e { EQUATORIAL , POLAR }
 

Functions

double muStar (double m1, double m2)
 Function to return the characteristic mass for CR3BP.
 
double lStar (double r)
 Function to return the characteristic length for CR3BP.
 
double tStar (double r, double mu)
 Function to return the characteristic time for the CR3BP.
 
clockwerk::CartesianVector< double, 3 > convertPosDim2Nd (clockwerk::CartesianVector< double, 3 > pos_d, double l_star)
 Function to convert position from dimensional to characteristic units.
 
clockwerk::CartesianVector< double, 3 > convertVelDim2Nd (clockwerk::CartesianVector< double, 3 > vel_d, double l_star, double t_star)
 Function to convert velocity from dimensional to characteristic units.
 
clockwerk::CartesianVector< double, 3 > convertPosNd2Dim (clockwerk::CartesianVector< double, 3 > pos_nd, double l_star)
 Function to convert position from characteristic to dimensional units.
 
clockwerk::CartesianVector< double, 3 > convertVelNd2Dim (clockwerk::CartesianVector< double, 3 > vel_nd, double l_star, double t_star)
 Function to convert velocity from characteristic to dimensional units.
 
void simpleEncrypt (char *unencrypted, char *encrypted, char size, const std::string &key)
 Function to perform a simple encryption of a buffer of data.
 
void simpleDecrypt (char *encrypted, char *unencrypted, char size, const std::string &key)
 Function to decrypt a buffer of data – companion to simpleEncrypt.
 
void writeFileBinarySize (char *buffer, char buffer_size, const std::string &filename)
 Function to write a buffer of bytes to a file, along with their size.
 
void readFileBinarySize (char buffer[MAX_SIZE_CHAR], char *size_actual, const std::string &filename)
 Function to read a buffer of bytes from a file.
 
int checkVerifyLicense (const std::string &license_file, const std::string &license_server)
 Function to check and verify that user has license for the simulation.
 
void parseLicenseString (std::string str, std::string &licensee, int &year, int &month, int &day)
 Function to parse license string for relevant data.
 
bool contains (const std::string &parent_str, const std::string &substr)
 Function to return whether substr is in parent_str.
 
std::string trim (const std::string &str, const std::string &whitespace=" \t")
 Function to trim leading and trailing whitespace from string.
 
void loadKernel (std::string kernel)
 A function to load in a sinle spice kernel.
 
std::string toUpper (const std::string &input)
 Function to convert a string to all upper case.
 
std::string toLower (const std::string &input)
 Function to convert a string to all lower case.
 
bool caseInsensitiveEqual (const std::string &in_a, const std::string &in_b)
 Function to compare two strings independent of case.
 
int frameRelativeInit (clockwerk::Frame< double > &target, clockwerk::Frame< double > &reference, const clockwerk::CartesianVector< double, 3 > &pos_tgt_ref__ref, const clockwerk::CartesianVector< double, 3 > &vel_tgt_ref__ref)
 Function to initialize frame target relative to freame reference inertially.
 
int orbitInit (clockwerk::Frame< double > &target, clockwerk::Frame< double > &planet, double mu, double a, double e, double i, double RAAN, double w, double f)
 Function to initialize a body's position and velocity from an orbit.
 
std::string writeTrajectory (const std::vector< double > &lat, const std::vector< double > &lon, const std::vector< double > &alt, bool project_to_ground=true, const std::string &color="7f00ffff")
 Function to write a trajectory into a KML file

 
void writeKmlFile (const std::string &file, const std::vector< std::vector< double > > &lat, const std::vector< std::vector< double > > &lon, const std::vector< std::vector< double > > &alt, const std::vector< std::string > &colors, bool project_to_ground=true)
 Function to write a full KML file from trajectory data.
 
int readGravityCoefficientsFile (const std::string &filename, double cbar[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1], double sbar[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1], long int &n, long int &m)
 Reads gravitational coefficients from a file and stores them in provided matrices.
 
void neumannNormalization (double cbar[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1], double sbar[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1], double c[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1], double s[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1])
 Applies Neumann normalization to spherical harmonic coefficients.
 
int sphericalHarmonics (long N, long M, double r, double phi, double theta, double Re, double K, double C[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1], double S[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1], clockwerk::CartesianVector< double, 3 > &grad_v)
 Computes the gradient of the gravitational potential using spherical harmonics.
 
int legendre (long N, long M, double x, double P[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1], double sd_p[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1])
 Calculates the associated Legendre functions and their derivatives.
 
double fact (long n)
 Computes the factorial of a non-negative integer.
 
double oddfact (long n)
 Computes the double factorial of an odd integer.
 
template<typename T >
int mean (T *array, unsigned int size, T &result)
 
template<typename T >
int variance (T *array, unsigned int size, T &result)
 
template<typename T >
int stdev (T *array, unsigned int size, T &result)
 
template<typename T >
int max (T *array, unsigned int size, T &result)
 
template<typename T >
int min (T *array, unsigned int size, T &result)
 

Variables

const std::vector< std::pair< connection_type_e, std::string > > CONN_TYPES
 Hold all connection type enum values to loop through.
 
const int MAX_ITER = 5
 
const int MAX_SIZE_CHAR = 0xFF
 
const std::string KEY = "kodasandymoosebuddy"
 
const int NO_ERROR = 0
 
const int ERROR_LICENSE = 300
 
const double ON_STATE = 1e-15
 
const std::string ARG_INDICATOR = "--"
 
const int HASH_MULTIPLIER = 37
 
const int HASH_ADDER = 3
 
const std::string DEFAULT_SIMULATION_TIME = "2023 September 26, 12:00:00 MDT"
 This is the default simulation time.
 
const double GPS_TO_J2000_ET_OFFSET = 630763200.0
 This is the offset between the GPS and J2000 epochs for calculation of GPS time.
 
const std::string OBJNAME = "MSO"
 
const std::string JSONSTART = "{"
 
const std::string JSONEND = "}"
 
const std::string OBJSTART = "["
 
const std::string OBJEND = "]"
 
const std::string FRAMESTART = "{"
 
const std::string FRAMEEND = "}"
 
const std::string QUOTEMARK = "\'"
 
const double PC_15_2 = 0.5*15.0
 
const double PC_3_2 = 0.5*3.0
 
const double PC_35_2 = 0.5*35
 
const std::string TITLE = "= "
 
const std::string AUTHOR_EMAIL_START = " <"
 
const std::string AUTHOR_EMAIL_END = "> "
 
const std::string HEADER_ONE = "== "
 
const std::string HEADER_TWO = "=== "
 
const std::string CODE_LITERAL = "```"
 
const std::string TABLE_HEADER_START = "[\%header,cols="
 
const std::string TABLE_HEADER_END = "*]\n"
 
const std::string TABLE_MARKER = "|===\n"
 
const std::string TABLE_LINE_START = "|"
 
const std::string IMAGE_START = "image::"
 
const std::string ALIAS_START = "["
 
const std::string ALIAS_END = "]"
 
const std::string LINK_START = "link:++"
 
const std::string LINK_END = "++"
 
const std::string DOC_REF_START = "xref:"
 
const int NMAX_SPHERICAL_HARMONICS = 18
 
const int MAX_SPICE_NAME_LENGTH = 33
 
const unsigned int NUM_CR3BP_STATES = 6
 

Detailed Description

Class to propagate CR3BP dynamics in characteristic units.

File: Conversions.h

This file contains analysis utilities to convert units in the circular restricted three body problem (cr3bp).

All conversions are per Dr. Pernicka of Missouri S&T and the following online utilities: https://orbital-mechanics.space/the-n-body-problem/circular-restricted-three-body-problem.html

Author: Alex Reynolds alex..nosp@m.reyn.nosp@m.olds@.nosp@m.attx.nosp@m..tech

This class is used to propagate circular restricted 3 body problem dynamics in characteristic units. It sets internal parameters on the basis of the setters for mu and l, which are used in the propagation.

Function Documentation

◆ caseInsensitiveEqual()

bool modelspace::caseInsensitiveEqual ( const std::string &  in_a,
const std::string &  in_b 
)

Function to compare two strings independent of case.

Parameters
in_aThe first string to compare
in_bThe second string to compare
Returns
True if strings equal in case-independent fashion. False otherwise

◆ checkVerifyLicense()

int modelspace::checkVerifyLicense ( const std::string &  license_file,
const std::string &  license_server 
)

Function to check and verify that user has license for the simulation.

Parameters
license_fileThe license file containing the user's data, if it exists
license_serverThe license server which may be used to locate another file
Returns
Error code corresponding to success/failure

◆ contains()

bool modelspace::contains ( const std::string &  parent_str,
const std::string &  substr 
)

Function to return whether substr is in parent_str.

Parameters
parent_strThe string to search
substrThe string to search for
Returns
True if substr is in parent_str. False otherwise

◆ convertPosDim2Nd()

clockwerk::CartesianVector< double, 3 > modelspace::convertPosDim2Nd ( clockwerk::CartesianVector< double, 3 >  pos_d,
double  l_star 
)

Function to convert position from dimensional to characteristic units.

Parameters
pos_dThe position of the body in dimensional units
l_starThe characteristic length of the system
Returns
Position in characteristic units

◆ convertPosNd2Dim()

clockwerk::CartesianVector< double, 3 > modelspace::convertPosNd2Dim ( clockwerk::CartesianVector< double, 3 >  pos_nd,
double  l_star 
)

Function to convert position from characteristic to dimensional units.

Parameters
pos_ndThe position of the body in non-dimensional units
l_starThe characteristic length of the system
Returns
Position in dimensional units

◆ convertVelDim2Nd()

clockwerk::CartesianVector< double, 3 > modelspace::convertVelDim2Nd ( clockwerk::CartesianVector< double, 3 >  vel_d,
double  l_star,
double  t_star 
)

Function to convert velocity from dimensional to characteristic units.

Parameters
vel_dThe velocity of the body in dimensional units
l_starThe characteristic length of the system
t_starThe characteristic time of the system
Returns
Velocity in characteristic units

◆ convertVelNd2Dim()

clockwerk::CartesianVector< double, 3 > modelspace::convertVelNd2Dim ( clockwerk::CartesianVector< double, 3 >  vel_nd,
double  l_star,
double  t_star 
)

Function to convert velocity from characteristic to dimensional units.

Parameters
vel_ndThe velocity of the body in non-dimensional units
l_starThe characteristic length of the system
t_starThe characteristic time of the system
Returns
Velocity in dimensional units

◆ fact()

double modelspace::fact ( long  n)

Computes the factorial of a non-negative integer.

This helper function calculates the factorial of a given integer n (n!). It is used to normalize spherical harmonics coefficients.

Parameters
[in]nNon-negative integer for which to calculate the factorial.
Returns
Factorial of the input integer.
Note
This function was adapted from open-source code in the NASA 42 simulation.

◆ frameRelativeInit()

int modelspace::frameRelativeInit ( clockwerk::Frame< double > &  target,
clockwerk::Frame< double > &  reference,
const clockwerk::CartesianVector< double, 3 > &  pos_tgt_ref__ref,
const clockwerk::CartesianVector< double, 3 > &  vel_tgt_ref__ref 
)

Function to initialize frame target relative to freame reference inertially.

Parameters
targetThe target frame whose state we want to set
referenceThe frame we are setting state relative to
pos_tgt_ref__refThe position of target relative to reference, in ref frame coordinates
vel_tgt_ref__refThe inertial velocity of target origin relative to reference origin, in ref frame coords
Returns
Error code corresponding to success/failure

◆ legendre()

int modelspace::legendre ( long  N,
long  M,
double  x,
double  P[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1],
double  sd_p[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1] 
)

Calculates the associated Legendre functions and their derivatives.

Computes the associated Legendre functions up to degree N and order M with Neumann normalization. This includes calculating scaled derivatives (sdP), which handle singularities by multiplying the derivative by sqrt(1 - x^2).

Parameters
[in]NMaximum degree of the Legendre functions.
[in]MMaximum order of the Legendre functions.
[in]xArgument for Legendre functions, typically cos(theta).
[out]PMatrix of associated Legendre functions up to degree N and order M.
[out]sd_pMatrix of scaled derivatives of Legendre functions.
Returns
Error code corresponding to success/failure
Note
This function was adapted from open-source code in the NASA 42 simulation.
Warning
The derivatives sdP[n][1] are singular at x = ±1.

◆ loadKernel()

void modelspace::loadKernel ( std::string  kernel)

A function to load in a sinle spice kernel.

Parameters
Asingle spice kernel to load

◆ lStar()

double modelspace::lStar ( double  r)

Function to return the characteristic length for CR3BP.

Parameters
rThe circular orbit radius of the secondary body about the first
Returns
The characteristic length

◆ muStar()

double modelspace::muStar ( double  m1,
double  m2 
)

Function to return the characteristic mass for CR3BP.

Parameters
m1The mass of the primary body
m2The mass of the secondary body
Returns
The characteristic mass

◆ neumannNormalization()

void modelspace::neumannNormalization ( double  cbar[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1],
double  sbar[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1],
double  c[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1],
double  s[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1] 
)

Applies Neumann normalization to spherical harmonic coefficients.

This function transforms spherical harmonic coefficients from their original format (typically EGM96 style normalization) to Neumann normalization. The input matrices cbar and sbar contain the cosine and sine coefficients, which are normalized and stored in the output matrices c and s for use in gravitational calculations.

The Neumann normalization ensures that the coefficients are scaled to a standard that provides orthonormality and consistency across spherical harmonics terms.

Parameters
[in]cbarMatrix of original cosine coefficients.
[in]sbarMatrix of original sine coefficients.
[out]cMatrix to store Neumann-normalized cosine coefficients.
[out]sMatrix to store Neumann-normalized sine coefficients.
Note
This function was adapted from open-source code in the NASA 42 simulation.
Warning
This function assumes the matrices are dimensioned to support up to degree and order NMAX_SPHERICAL_HARMONICS. Applying the normalization to coefficients beyond this range may result in undefined behavior.

◆ oddfact()

double modelspace::oddfact ( long  n)

Computes the double factorial of an odd integer.

Calculates the product of all odd numbers up to and including the specified integer n. This is used in the Legendre function for terms involving odd factorials.

Parameters
[in]nNon-negative odd integer for which to calculate the double factorial.
Returns
Double factorial of the input integer.
Note
This function was adapted from open-source code in the NASA 42 simulation.

◆ orbitInit()

int modelspace::orbitInit ( clockwerk::Frame< double > &  target,
clockwerk::Frame< double > &  planet,
double  mu,
double  a,
double  e,
double  i,
double  RAAN,
double  w,
double  f 
)

Function to initialize a body's position and velocity from an orbit.

Parameters
targetThe target frame to initialize
planetThe planet frame our orbit is relative to
muGravitational parameter of the planet
aOrbit semimajor axis, in meters
eOrbit eccentricity
iOrbit inclination, radians
RAANOrbit Right Ascention of the Ascending Node, radians
wOrbit argument of periapsis, radians
fOrbit true anomaly, radians
Returns
Error code corresponding to success/failure

◆ parseLicenseString()

void modelspace::parseLicenseString ( std::string  str,
std::string &  licensee,
int &  year,
int &  month,
int &  day 
)

Function to parse license string for relevant data.

Parameters
strThe license string to parse (loaded from file)
licenseeThe licensing organization
yearThe year when the locally stored license expires
monthThe month when the locally stored license expires
dayThe day when the locally stored license expires

◆ readFileBinarySize()

void modelspace::readFileBinarySize ( char  buffer[MAX_SIZE_CHAR],
char *  size_actual,
const std::string &  filename 
)

Function to read a buffer of bytes from a file.

Parameters
bufferThe buffer of data to read from – max size is the max value of a char
buffer_sizeThe size of the buffer to be written
filenameThe name of the file to write to

◆ readGravityCoefficientsFile()

int modelspace::readGravityCoefficientsFile ( const std::string &  filename,
double  cbar[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1],
double  sbar[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1],
long int &  n,
long int &  m 
)

Reads gravitational coefficients from a file and stores them in provided matrices.

This function opens a specified file containing spherical harmonic gravitational coefficients and populates the provided matrices cbar and sbar with these values up to degree and order NMAX_SPHERICAL_HARMONICS. The function checks for the file's existence before attempting to read from it. This code is derived from the open-source NASA 42 simulation.

Parameters
[in]filenamePath to the file containing the gravitational coefficients.
[out]cbarMatrix to store cosine harmonic coefficients.
[out]sbarMatrix to store sine harmonic coefficients.
[out]nMax degree loaded from egm96 file.
[out]mMax order loaded from egm96 file.
Returns
Status code indicating success or failure.
Return values
NO_ERRORIf the file is successfully read and coefficients are loaded.
ERROR_FILE_NOT_FOUNDIf the specified file does not exist.
Note
This function was adapted from open-source code in the NASA 42 simulation.
Warning
The function assumes that the file format matches the expected format with columns for degree, order, and the respective coefficients. Incorrect file formatting may lead to unexpected results.

◆ simpleDecrypt()

void modelspace::simpleDecrypt ( char *  encrypted,
char *  unencrypted,
char  size,
const std::string &  key 
)

Function to decrypt a buffer of data – companion to simpleEncrypt.

Parameters
unencryptedThe encrypted buffer to decrypt
encryptedThe unencrypted buffer result
sizeThe size of the buffer
keyThe encryption key to use for the buffer

◆ simpleEncrypt()

void modelspace::simpleEncrypt ( char *  unencrypted,
char *  encrypted,
char  size,
const std::string &  key 
)

Function to perform a simple encryption of a buffer of data.

Parameters
unencryptedThe unencrypted buffer to encrypt
encryptedThe encrypted buffer result
sizeThe size of the buffer
keyThe encryption key to use for the buffer

◆ sphericalHarmonics()

int modelspace::sphericalHarmonics ( long  N,
long  M,
double  r,
double  phi,
double  theta,
double  Re,
double  K,
double  C[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1],
double  S[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1],
clockwerk::CartesianVector< double, 3 > &  grad_v 
)

Computes the gradient of the gravitational potential using spherical harmonics.

This function calculates the radial, latitudinal, and longitudinal components of the gravitational potential gradient up to degree N and order M using normalized Legendre coefficients. The result is stored in gradV. The maximum size is 18x18

Parameters
[in]NMaximum degree of spherical harmonics.
[in]MMaximum order of spherical harmonics.
[in]rRadial distance from planet's center.
[in]phiLongitude (angle from prime meridian in radians).
[in]thetaColatitude (angle from the north pole in radians).
[in]ReReference radius, typically planet's radius in meters.
[in]KScaling constant, typically planet's gravitational parameter divided by Re.
[in]CNormalized Legendre coefficients (cosine terms).
[in]SNormalized Legendre coefficients (sine terms).
[out]grad_vGradient of the gravitational potential [radial, latitudinal, longitudinal].
Returns
Error code corresponding to success/failure
Note
This function was adapted from open-source code in the NASA 42 simulation.

◆ toLower()

std::string modelspace::toLower ( const std::string &  input)

Function to convert a string to all lower case.

Parameters
inputString to be converted
Returns
String converted to all lower case

◆ toUpper()

std::string modelspace::toUpper ( const std::string &  input)

Function to convert a string to all upper case.

Parameters
inputString to be converted
Returns
String converted to all upper case

◆ trim()

std::string modelspace::trim ( const std::string &  str,
const std::string &  whitespace = " \t" 
)

Function to trim leading and trailing whitespace from string.

Parameters
strThe string to trim
whitespaceThe whitespace we're looking to trim off. Defaults to " \t"
Returns
The trimmed string

◆ tStar()

double modelspace::tStar ( double  r,
double  mu 
)

Function to return the characteristic time for the CR3BP.

Parameters
rThe circular orbit radius of the secondary body about the first
muThe mass of the primary body
Returns
The characteristic time

◆ writeFileBinarySize()

void modelspace::writeFileBinarySize ( char *  buffer,
char  buffer_size,
const std::string &  filename 
)

Function to write a buffer of bytes to a file, along with their size.

Parameters
bufferThe buffer of data to write to file
buffer_sizeThe size of the buffer to be written
filenameThe name of the file to write to

◆ writeKmlFile()

void modelspace::writeKmlFile ( const std::string &  file,
const std::vector< std::vector< double > > &  lat,
const std::vector< std::vector< double > > &  lon,
const std::vector< std::vector< double > > &  alt,
const std::vector< std::string > &  colors,
bool  project_to_ground = true 
)

Function to write a full KML file from trajectory data.

Parameters
fileThe file to write kml data to
latA vector of doubles corresponding to latitude
lonA vector of doubles corresponding to longitude
altA vector of doubles corresponding to altitude
colorsA vector of
project_to_groundA bolean indicating whether the trajectory should be projected to the ground

◆ writeTrajectory()

std::string modelspace::writeTrajectory ( const std::vector< double > &  lat,
const std::vector< double > &  lon,
const std::vector< double > &  alt,
bool  project_to_ground = true,
const std::string &  color = "7f00ffff" 
)

Function to write a trajectory into a KML file

Parameters
latA vector of doubles corresponding to latitude
lonA vector of doubles corresponding to longitude
altA vector of doubles corresponding to altitude
project_to_groundA bolean indicating whether the trajectory should be projected to the ground
Returns
A string to be written with all trajectory data

Variable Documentation

◆ CONN_TYPES

const std::vector<std::pair<connection_type_e, std::string> > modelspace::CONN_TYPES
Initial value:
= {
{connection_type_e::PARAM, "Param"},
{connection_type_e::INPUT, "Input"}
}

Hold all connection type enum values to loop through.