![]() |
WarpTwin
Documentation for WarpTwin models and classes.
|
/******************************************************************************
* Copyright (c) ATTX INC 2025. All Rights Reserved.
*
* This software and associated documentation (the "Software") are the
* proprietary and confidential information of ATTX INC. The Software is
* furnished under a license agreement between ATTX and the user organization
* and may be used or copied only in accordance with the terms of the agreement.
* Refer to 'license/attx_license.adoc' for standard license terms.
*
* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
* transmitted in any form or by any means, for any purpose, without the express
* written permission of ATTX INC.
******************************************************************************/
/*
Orbital elements model header file
Author: Alex Reynolds
*/
/*
Metadata for MS GUI:
imdata = {"displayname" : "Orbital Elements Sensor",
"exclude" : False,
"category" : "Sensors"
}
aliases = {"mu" : "GM",
"pos__inertial" : "Position",
"vel__inertial" : "Velocity",
"a" : "Semimajor Axis",
"e" : "Eccentricity",
"i" : "Inclination",
"RAAN" : "RAAN",
"w" : "Arg. of Periapsis",
"f" : "True Anomaly"
}
*/
#ifndef MODELS_STATES_ORBITAL_ELEMENTS_SENSOR_MODEL_H
#define MODELS_STATES_ORBITAL_ELEMENTS_SENSOR_MODEL_H
#include "simulation/Model.h"
#include "frames/Frame.h"
#include "frames/frameutils.h"
#include "constants/planetdefaults.h"
namespace warptwin {
/**
* @brief Model for sensing the instantaneous orbital elements of a vehicle given its position and velocity
*
* This model takes the xyz cartesian state of a
* spacecraft and outputs it as keplerian orbital elements
*/
MODEL(OrbitalElementsSensorModel)
public:
// Model params
// NAME TYPE DEFAULT VALUE
START_PARAMS
/** This is the gravitational parameter of our parent planet. Defaults to
* Earth's gravitational parameter for ease of use */
SIGNAL(mu, double, warpos::earth_wgs84.mu)
END_PARAMS
// Model inputs
// NAME TYPE DEFAULT VALUE
START_INPUTS
/** The position of the spacecraft in a generic inertial frame */
SIGNAL(pos__inertial, CartesianVector3, CartesianVector3({0.0,0.0,0.0}))
/** The velocity of the spacecraft in a generic inertial frame */
SIGNAL(vel__inertial, CartesianVector3, CartesianVector3({0.0,0.0,0.0}))
END_INPUTS
// Model outputs
// NAME TYPE DEFAULT VALUE
START_OUTPUTS
/** The semimajor axis of the spacecraft orbit, in meters */
SIGNAL(a, double, 0.0)
/** The orbit eccentricity */
SIGNAL(e, double, 0.0)
/** The orbit inclination, in radians */
SIGNAL(i, double, 0.0)
/** The orbit RAAN, in radians */
SIGNAL(RAAN, double, 0.0)
/** The orbit argument of periapsis */
SIGNAL(w, double, 0.0)
/** The true anomaly, in radians */
SIGNAL(f, double, 0.0)
END_OUTPUTS
protected:
int16 execute() override;
// Temporary vector to hold orbital elements output
CartesianVector6 _orbital_elements;
};
}
#endif