ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
GravityGradientModel.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/*
17Gravity gradient torque model header file
18
19Author: Sam Matez
20*/
21
22#ifndef MODELS_ENVIRONMENT_GRAVITY_GRADIENT_MODEL_H
23#define MODELS_ENVIRONMENT_GRAVITY_GRADIENT_MODEL_H
24
25#include "six_dof_dynamics/Body.hpp"
26#include "core/macros.h"
27#include "architecture/Tasks.h"
28#include "utils/frameutils.hpp"
29#include "simulation/Model.h"
30#include "utils/planetdefaults.h"
31
32namespace modelspace {
33
34 /**
35 * @brief Gravity Gradient Model
36 *
37 * This model calculates the gravity gradient torque force
38 * resulting from differences in axial inertia on a spacecraft.
39 * The equations used for this calculation come from "Analytical
40 * Mechanics of Space Systems (Fourth Edition), by Hanspeter
41 * Schaub and John L. Junkins", page 226 (eq. 4.158). The gravity
42 * gradient torque calculation is done in the body frame (Body
43 * frame position and inertia).
44 *
45 * Author: Sam Matez
46 * Email: sam.matez@attx.tech
47 *
48 */
49 class GravityGradientModel : public Model {
50 public:
51 // Model params
52 // NAME TYPE DEFAULT VALUE
54 /** This is the gravitational parameter of our parent planet. Defaults to
55 * Earth's gravitational parameter for ease of use */
56 SIGNAL(mu, double, clockwerk::earth_wgs84.mu)
58
59 // Model inputs
60 // NAME TYPE DEFAULT VALUE
62 /** The position of the body with respect to PCI frame, expressed in PCI coordinates */
64 /** The attitude of the body with respect ot the PCI frame, in quaternions */
65 SIGNAL(quat_body_pci, QuaternionD, QuaternionD({1.0, 0.0, 0.0, 0.0}))
66 /** The inertia tensor expressed in the body frame */
67 SIGNAL(inertiatensor_body_body, Matrix3D, Matrix3D({{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}))
69
70 // Model outputs
71 // NAME TYPE DEFAULT VALUE
73 /** The tourque vector acting on the body due to gravity gradient effects wrt to the body frame */
76
77 // Model-specific implementations of startup and derivative
78 GravityGradientModel();
79 GravityGradientModel(Model &pnt, const std::string &m_name="gravity_gradient_torque");
80 GravityGradientModel(SimulationExecutive &e, const std::string &m_name="gravity_gradient_torque");
81 GravityGradientModel(Model &pnt, int schedule_slot, const std::string &m_name="gravity_gradient_torque");
82 GravityGradientModel(SimulationExecutive &e, int schedule_slot, const std::string &m_name="gravity_gradient_torque");
83 ~GravityGradientModel() {}
84
85 protected:
86 // Execute in protected
87 int execute();
88
89 // Temporary vectors and variables to carry out our calculations
90 CartesianVector3D _pos_body_pci__body;
91 double _r;
92 double _multiplier;
93 CartesianVector3D _ggTorque;
94
95 };
96
97}
98
99#endif
Gravity Gradient Model.
Definition GravityGradientModel.h:49
int execute()
Function to execute the task. All math and calculations should be here.
Definition GravityGradientModel.cpp:40
Base model class for derived implementation.
Definition Model.h:56
Implementation of the executive class for simulation.
Definition SimulationExecutive.h:63
#define Matrix3D
Definition macros.h:33
#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 QuaternionD
Definition macros.h:78
#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::Quaternion< double > > quat_body_pci
Definition GravityGradientModel.h:65
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > pos_body_pci
Definition GravityGradientModel.h:63
clockwerk::DataIO< clockwerk::Matrix< double, 3, 3 > > inertiatensor_body_body
Definition GravityGradientModel.h:67
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > ggTorque_body_body
Definition GravityGradientModel.h:74
clockwerk::DataIO< double > mu
Definition GravityGradientModel.h:56