ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
AsphericalGravityModel.h
1/******************************************************************************
2* Copyright (c) ATTX LLC 2024. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX, LLC. 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, LLC.
15******************************************************************************/
16/*
17Aspherical gravity model header file
18
19Author: Alex Reynolds
20*/
21
22#ifndef MODELS_ENVIRONMENT_ASPHERICAL_GRAVITY_MODEL_H
23#define MODELS_ENVIRONMENT_ASPHERICAL_GRAVITY_MODEL_H
24
25#include "core/macros.h"
26#include "simulation/Model.h"
27#include "six_dof_dynamics/Frame.hpp"
28#include "six_dof_dynamics/Node.hpp"
29#include "utils/frameutils.hpp"
30#include "utils/planetdefaults.h"
31
32namespace modelspace {
33
34 // Precalculated constants for internal gravity model use
35 const double PC_15_2 = 0.5*15.0; // Precalc of 15/2
36 const double PC_3_2 = 0.5*3.0; // Precalc of 3/2
37 const double PC_35_2 = 0.5*35; // Precalc of 35/2
38
39 /**
40 * @brief Aspherical gravity model with J2 and J3 effects
41 *
42 * This model calculates gravity for a planetary body, accounting for effects
43 * due to the J2 and J3 perturbations.
44 */
45 class AsphericalGravityModel : public Model {
46 public:
47 // TODO: Replace need for mass with direct acceleration calculation when
48 // body accel methods are implemented
49 // Model params
50 // NAME TYPE DEFAULT VALUE
52 /** This is the gravitational parameter of our parent planet. Defaults to
53 * Earth's gravitational parameter for ease of use */
54 SIGNAL(mu, double, clockwerk::earth_wgs84.mu)
55 /** This is the J2 parameter of our parent planet. Defaults to
56 * Earth's J2 parameter for ease of use */
57 SIGNAL(J2, double, clockwerk::earth_wgs84.J2)
58 /** This is the J3 parameter of our parent planet. Defaults to
59 * Earth's J3 parameter for ease of use */
60 SIGNAL(J3, double, clockwerk::earth_wgs84.J3)
61 /** This is the radius of our parent planet. Defaults to Earth's radius, in meters for ease of use */
62 SIGNAL(r_planet, double, clockwerk::earth_wgs84.semimajor_axis)
63 /** This is the mass of the body, which will be multiplied by our force
64 * to get the force calculation... TODO to replace this with accel methods */
65 SIGNAL(body_mass, double, 1.0)
67
68 // Model inputs
69 // NAME TYPE DEFAULT VALUE
71 /** The position of the object body in the reference frame f */
74
75 // Model outputs
76 // NAME TYPE DEFAULT VALUE
78 /** This is the total acceleration due to gravity calculated in the same reference frame as pos_body__f */
80 /** This is the acceleration due to point mass gravity calculated in the same reference frame as pos_body__f */
82 /** This is the acceleration due to J2 calculated in the same reference frame as pos_body__f */
84 /** This is the acceleration due to J3 calculated in the same reference frame as pos_body__f */
87
88 // Model-specific implementations of startup and derivative
89 AsphericalGravityModel();
90 AsphericalGravityModel(Model &pnt, const std::string &m_name="aspherical_gravity");
91 AsphericalGravityModel(SimulationExecutive &e, const std::string &m_name="aspherical_gravity");
92 AsphericalGravityModel(Model &pnt, int schedule_slot, const std::string &m_name="aspherical_gravity");
93 AsphericalGravityModel(SimulationExecutive &e, int schedule_slot, const std::string &m_name="aspherical_gravity");
94 ~AsphericalGravityModel() {}
95 protected:
96 int start();
97 int execute();
98
99 // Temporary vectors and variables to carry out our calculations
100 double r;
101 double precalc_j2;
102 double precalc_j3;
103 CartesianVector3D grav_force__planet;
104 };
105
106}
107
108#endif
Aspherical gravity model with J2 and J3 effects.
Definition AsphericalGravityModel.h:45
int start()
Function to perform task startup activities (step once after creation)
Definition AsphericalGravityModel.cpp:35
int execute()
Function to execute the task. All math and calculations should be here.
Definition AsphericalGravityModel.cpp:44
Base model class for derived implementation.
Definition Model.h:56
Implementation of the executive class for simulation.
Definition SimulationExecutive.h:63
#define SIGNAL(NAME, TYPE, INITIAL_VALUE)
Definition macros.h:87
#define START_PARAMS
Definition macros.h:96
#define CartesianVector3D
Definition macros.h:54
#define END_OUTPUTS
Definition macros.h:90
#define END_PARAMS
Definition macros.h:98
#define START_OUTPUTS
Definition macros.h:88
#define END_INPUTS
Definition macros.h:94
#define START_INPUTS
Definition macros.h:92
Class to propagate CR3BP dynamics in characteristic units.
Definition ConfigurationWriter.cpp:18
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > pos_body__f
Definition AsphericalGravityModel.h:72
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > grav_mu
Definition AsphericalGravityModel.h:81
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > grav_J3
Definition AsphericalGravityModel.h:85
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > grav_J2
Definition AsphericalGravityModel.h:83
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > grav_force__f
Definition AsphericalGravityModel.h:79
clockwerk::DataIO< double > J3
Definition AsphericalGravityModel.h:60
clockwerk::DataIO< double > mu
Definition AsphericalGravityModel.h:54
clockwerk::DataIO< double > r_planet
Definition AsphericalGravityModel.h:62
clockwerk::DataIO< double > J2
Definition AsphericalGravityModel.h:57
clockwerk::DataIO< double > body_mass
Definition AsphericalGravityModel.h:65