WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
SphericalHarmonicsGravityModel.h
Go to the documentation of this file.
1/******************************************************************************
2* Copyright (c) ATTX INC 2025. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX INC. The Software is
6* furnished under a license agreement between ATTX and the user organization
7* and may be used or copied only in accordance with the terms of the agreement.
8* Refer to 'license/attx_license.adoc' for standard license terms.
9*
10* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13* transmitted in any form or by any means, for any purpose, without the express
14* written permission of ATTX INC.
15******************************************************************************/
16/*
17Solar Radiation Pressure model header file
18
19Author: Sam Matez
20*/
21/*
22Metadata for MS GUI:
23imdata = {"displayname" : "Spherical Harmonic Gravity",
24 "exclude" : False,
25 "category" : "Dynamics"
26}
27aliases = {"mu" : "GM",
28 "filename" : "Gravity File",
29 "r_planet" : "Planet Equatorial Radius",
30 "body_mass" : "Spacecraft Mass",
31 "n" : "Degree",
32 "m" : "Order",
33 "pos_body_planet__pcpf" : "Position",
34 "grav_force__f" : "Gravity Force"
35}
36*/
37
38#ifndef MODELS_SPHERICAL_HARMONICS_GRAVITY_MODEL_H
39#define MODELS_SPHERICAL_HARMONICS_GRAVITY_MODEL_H
40
41#include <string>
42
43#include "simulation/Model.h"
45#include "locations.h"
47
48namespace warptwin {
49
61 MODEL(SphericalHarmonicsGravityModel)
62 public:
63 // Model params
64 // NAME TYPE DEFAULT VALUE
69 SIGNAL(filename, std::string, warptwinDir() + "data/WGS84/WGS84.txt")
72 SIGNAL(mu, double, warpos::earth_wgs84.mu)
74 SIGNAL(r_planet, double, warpos::earth_wgs84.eq_radius)
76 SIGNAL(n, int, 0)
79 SIGNAL(m, int, 0)
82 SIGNAL(body_mass, double, 1.0)
84
85 // Model inputs
86 // NAME TYPE DEFAULT VALUE
89 SIGNAL(pos_body_planet__pcpf, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
91
92 // Model Outputs
93 // NAME TYPE DEFAULT VALUE
96 SIGNAL(grav_accel__f, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
98 SIGNAL(grav_force__f, CartesianVector3, CartesianVector3({0.0, 0.0, 0.0}))
100
101 protected:
102 int16 start() override;
103 int16 execute() override;
104
105 // Pre-calculated parameters
106 double _K;
107
108 // Variables to hold gravity coefficients
111
112 // Local variable to hold force in the spherical frame
114
115 // Local variables for lla coordinates
116 double _lat;
117 double _lon;
118 double _alt;
119
120 // Local variable for magnitude of position vector
121 double _r_pos;
122
123 // Local variable to hold colatitude
125
126 // Local variables for rotation back to pcpf
127 double _sth;
128 double _cth;
129 double _sph;
130 double _cph;
132
133 };
134
135}
136
137#endif
#define SIGNAL(NAME, TYPE, INITIAL_VALUE)
Definition appmacros.h:27
#define START_PARAMS
Definition appmacros.h:42
#define END_OUTPUTS
Definition appmacros.h:33
#define END_PARAMS
Definition appmacros.h:47
#define START_OUTPUTS
Definition appmacros.h:28
#define END_INPUTS
Definition appmacros.h:40
#define START_INPUTS
Definition appmacros.h:35
#define CartesianVector3
Definition mathmacros.h:43
Class to propagate CR3BP dynamics in characteristic units.
Definition statistics.hpp:22
int16 start() override
Class to execute logging.
const int NMAX_SPHERICAL_HARMONICS
Definition sphericalharmonicsutils.h:38
double _alt
Definition SphericalHarmonicsGravityModel.h:118
SIGNAL(_mu, double, warpos::earth_wgs84.mu)
double _cph
Definition SphericalHarmonicsGravityModel.h:130
double _r_pos
Definition SphericalHarmonicsGravityModel.h:121
double _lat
Definition SphericalHarmonicsGravityModel.h:116
double _sph
Definition SphericalHarmonicsGravityModel.h:129
CartesianVector3 _accel_grav__spherical
Definition SphericalHarmonicsGravityModel.h:113
double _c[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1]
Definition SphericalHarmonicsGravityModel.h:109
double _cth
Definition SphericalHarmonicsGravityModel.h:128
double _sth
Definition SphericalHarmonicsGravityModel.h:127
double _lon
Definition SphericalHarmonicsGravityModel.h:117
@ MODEL
Simplified dynamics model representing motion in the circular restricted 3 body problem.
Definition ImNode.h:31
int16 execute() override
Function to check monitor input conditions and set trigger flag accordingly. Should be implemented in...
double _s[NMAX_SPHERICAL_HARMONICS+1][NMAX_SPHERICAL_HARMONICS+1]
Definition SphericalHarmonicsGravityModel.h:110
CartesianVector3 _fe
Definition SphericalHarmonicsGravityModel.h:131
double _K
Definition SphericalHarmonicsGravityModel.h:106
double _colatitude
Definition SphericalHarmonicsGravityModel.h:124