ModelSpace
All Classes Namespaces Functions Variables Enumerations Pages
PlanetRelativeStatesModel.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/*
17Planet relative states model header file
18
19Author: Gabriel Heredia Acevedo
20*/
21
22#ifndef MODELS_STATES_PLANET_RELATIVE_STATES_MODEL_H
23#define MODELS_STATES_PLANET_RELATIVE_STATES_MODEL_H
24
25#include "core/macros.h"
26#include "simulation/Model.h"
27#include "utils/planetdefaults.h"
28
29namespace modelspace {
30
31 class Executive;
32
33 // Define this enum since this can only have one of these two values
34 enum radius_type_e {
35 EQUATORIAL,
36 POLAR
37 };
38
39 /**
40 * @brief Planet relative states model
41 *
42 * This model is a one-stop-shop for useful states of a vehicle relative to a
43 * celestial body. It uses the FrameStateSensor and planetrelutils from
44 * clockwerk internally then returns results every step. It is primarily a
45 * configuration wrapper model -- that is, it does the large majority of its
46 * work in startup, and adds little to no functionality at runtime, and instead
47 * runs the innter frame state sensor and planetrelutils, which do the heavy
48 * lifting.
49 *
50 * @author Gabe Heredia Acevedo <gabe@attx.tech>
51 */
52 class PlanetRelativeStatesModel : public Model {
53 public:
54 // Model params
55 // NAME TYPE DEFAULT VALUE
57 /** This is the equatorial radius of the planet. Default is Earth in meters */
58 SIGNAL(equatorial_radius, double, clockwerk::earth_wgs84.semimajor_axis)
59 /** The celestial body’s flattening parameter */
60 SIGNAL(flattening, double, 1.0/clockwerk::earth_wgs84.flattening)
61 /** This is the elevation mask value, in radians, for the ground station. Default is zero degrees*/
62 SIGNAL(centric_by, int, radius_type_e::EQUATORIAL)
64
65 // Model inputs
66 // NAME TYPE DEFAULT VALUE
68 //TODO: Inputs might not be needed
69 /** The cartesian position coordinates we will use to perform our calculations relative to the reference frame, typically Planet Centered Relative frame. */
71 /** The cartesian velocity coordinates we will use to perform our calculations relative to the reference frame, typically Planet Centered Relative frame. */
73 /** The quaternion which represents the nodal attitude relative to the reference frame, typically Planet Centered Relative frame. */
74 SIGNAL(quat_obj_pcr, QuaternionD, QuaternionD({1.0, 0.0, 0.0, 0.0}))
75 /** The attitude rate which represents the nodal attitude rate relative to the reference frame, typically Planet Centered Relative frame. */
78
79 // Model outputs
80 // NAME TYPE DEFAULT VALUE
82 /** The nodal position relative to the reference frame, expressed in the NED detic frame.*/
84 /** The nodal velocity relative to the reference frame, expressed in the NED detic frame.*/
86 /** The nodal attitude quaternion relative to the reference frame, expressed in the NED detic frame.*/
87 SIGNAL(quat_obj_pcr_ned_d, QuaternionD, QuaternionD({1.0, 0.0, 0.0, 0.0}))
88 /** The nodal attitude rate relative to the reference frame, expressed in the NED detic frame.*/
90 /** The nodal position relative to the reference frame, expressed in the ENU detic frame.*/
92 /** The nodal velocity relative to the reference frame, expressed in the ENU detic frame.*/
94 /** The nodal attitude quaternion relative to the reference frame, expressed in the ENU detic frame.*/
95 SIGNAL(quat_obj_pcr_enu_d, QuaternionD, QuaternionD({1.0, 0.0, 0.0, 0.0}))
96 /** The nodal attitude rate relative to the reference frame, expressed in the ENU detic frame.*/
98
99 /** The nodal position relative to the reference frame, expressed in the NED centric frame.*/
101 /** The nodal velocity relative to the reference frame, expressed in the NED centric frame.*/
103 /** The nodal attitude quaternion relative to the reference frame, expressed in the NED centric frame.*/
104 SIGNAL(quat_obj_pcr_ned_c, QuaternionD, QuaternionD({1.0, 0.0, 0.0, 0.0}))
105 /** The nodal attitude rate relative to the reference frame, expressed in the NED centric frame.*/
107 /** The nodal position relative to the reference frame, expressed in the ENU centric frame.*/
109 /** The nodal velocity relative to the reference frame, expressed in the ENU centric frame.*/
111 /** The nodal attitude quaternion relative to the reference frame, expressed in the ENU centric frame.*/
112 SIGNAL(quat_obj_pcr_enu_c, QuaternionD, QuaternionD({1.0, 0.0, 0.0, 0.0}))
113 /** The nodal attitude rate relative to the reference frame, expressed in the ENU centric frame.*/
115
116 /** The nodal detic latitude relative to the reference frame. Takes into account the ellipsoidal form of the celestial body.*/
117 SIGNAL(latitude_detic, double, 0.0)
118 /** The nodal centric latitude relative to the reference frame. Assumes the celestial body is spherical.*/
119 SIGNAL(latitude_centric, double, 0.0)
120 /** The nodal detic altitude relative to the reference frame. Takes into account the ellipsoidal form of the celestial body.*/
121 SIGNAL(altitude_detic, double, 0.0)
122 /** The nodal centric altitude relative to the reference frame. Assumes the celestial body is spherical.*/
123 SIGNAL(altitude_centric, double, 0.0)
124 /** The nodal longitude relative to the reference frame.*/
125 SIGNAL(longitude, double, 0.0)
127
128 // Model-specific implementations of startup and derivative
129 PlanetRelativeStatesModel();
130 PlanetRelativeStatesModel(Model &pnt, const std::string &m_name="planet_rel");
131 PlanetRelativeStatesModel(SimulationExecutive &e, const std::string &m_name="planet_rel");
132 PlanetRelativeStatesModel(Model &pnt, int schedule_slot, const std::string &m_name="planet_rel");
133 PlanetRelativeStatesModel(SimulationExecutive &e, int schedule_slot, const std::string &m_name="planet_rel");
134 ~PlanetRelativeStatesModel() {}
135
136 protected:
137 int start();
138 int execute();
139
140 int _updateStates();
141
142 /// @brief The radius set by the enum centric_by
143 double radius;
144 double polar_radius;
145 };
146}
147
148#endif
Base model class for derived implementation.
Definition Model.h:56
Planet relative states model.
Definition PlanetRelativeStatesModel.h:52
int execute()
Function to execute the task. All math and calculations should be here.
Definition PlanetRelativeStatesModel.cpp:65
double radius
The radius set by the enum centric_by.
Definition PlanetRelativeStatesModel.h:143
int start()
Function to perform task startup activities (step once after creation)
Definition PlanetRelativeStatesModel.cpp:42
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 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::CartesianVector< double, 3 > > angular_velocity_wrt_PCR
Definition PlanetRelativeStatesModel.h:76
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > vel__pcr
Definition PlanetRelativeStatesModel.h:72
clockwerk::DataIO< clockwerk::Quaternion< double > > quat_obj_pcr
Definition PlanetRelativeStatesModel.h:74
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > pos__pcr
Definition PlanetRelativeStatesModel.h:70
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > angular_velocity_wrt_PCR_enu_c
Definition PlanetRelativeStatesModel.h:114
clockwerk::DataIO< clockwerk::Quaternion< double > > quat_obj_pcr_enu_d
Definition PlanetRelativeStatesModel.h:95
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > angular_velocity_wrt_PCR_ned_c
Definition PlanetRelativeStatesModel.h:106
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > vel_coord_enu_d
Definition PlanetRelativeStatesModel.h:93
clockwerk::DataIO< double > latitude_detic
Definition PlanetRelativeStatesModel.h:117
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > pos_coord_ned_c
Definition PlanetRelativeStatesModel.h:100
clockwerk::DataIO< double > longitude
Definition PlanetRelativeStatesModel.h:125
clockwerk::DataIO< double > latitude_centric
Definition PlanetRelativeStatesModel.h:119
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > pos_coord_enu_d
Definition PlanetRelativeStatesModel.h:91
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > vel_coord_ned_d
Definition PlanetRelativeStatesModel.h:85
clockwerk::DataIO< double > altitude_centric
Definition PlanetRelativeStatesModel.h:123
clockwerk::DataIO< clockwerk::Quaternion< double > > quat_obj_pcr_ned_c
Definition PlanetRelativeStatesModel.h:104
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > pos_coord_enu_c
Definition PlanetRelativeStatesModel.h:108
clockwerk::DataIO< double > altitude_detic
Definition PlanetRelativeStatesModel.h:121
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > pos_coord_ned_d
Definition PlanetRelativeStatesModel.h:83
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > vel_coord_ned_c
Definition PlanetRelativeStatesModel.h:102
clockwerk::DataIO< clockwerk::Quaternion< double > > quat_obj_pcr_ned_d
Definition PlanetRelativeStatesModel.h:87
clockwerk::DataIO< clockwerk::Quaternion< double > > quat_obj_pcr_enu_c
Definition PlanetRelativeStatesModel.h:112
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > vel_coord_enu_c
Definition PlanetRelativeStatesModel.h:110
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > angular_velocity_wrt_PCR_ned_d
Definition PlanetRelativeStatesModel.h:89
clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > > angular_velocity_wrt_PCR_enu_d
Definition PlanetRelativeStatesModel.h:97
clockwerk::DataIO< double > equatorial_radius
Definition PlanetRelativeStatesModel.h:58
clockwerk::DataIO< double > flattening
Definition PlanetRelativeStatesModel.h:60
clockwerk::DataIO< int > centric_by
Definition PlanetRelativeStatesModel.h:62