![]() |
ModelSpace
Documentation for ModelSpace models and classes.
|
/******************************************************************************
* Copyright (c) ATTX LLC 2024. All Rights Reserved.
*
* This software and associated documentation (the "Software") are the
* proprietary and confidential information of ATTX, LLC. 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, LLC.
******************************************************************************/
/*
Custom Planet header file
Author: Alex Reynolds
*/
/*
Metadata for MS GUI:
imdata = {"displayname" : "Custom Planet",
"exclude" : False,
"category" : "Assemblies"
}
aliases = {"initial_attitude" : "EXCLUDE",
"omega" : "Planet Ang. Vel.",
"eq_radius" : "Equatorial Radius",
"flattening" : "Ellipse Flattening",
"mu" : "Gravitational Parameter",
"J2" : "EXCLUDE",
"J3" : "EXCLUDE",
"mean_ang_vel" : "Mean Ang. Vel.",
"self_id", "Planet",
"inertial_frame" : "Planet Inertial Frame",
"rotating_frame" : "Planet Rotating Frame",
"eq_radius" : "Equatorial Radius",
"flattening" : "Ellipse Flattening",
"mu" : "Gravitational Parameter",
"J2" : "EXCLUDE",
"J3" : "EXCLUDE",
"mean_ang_vel" : "Mean Ang. Vel.",
}
*/
#ifndef MODELS_ASSEMBLIES_SIMPLE_PLANET_MODEL_H
#define MODELS_ASSEMBLIES_SIMPLE_PLANET_MODEL_H
#include "core/CartesianVector.hpp"
#include "simulation/Model.h"
#include "frames/Frame.h"
#include "simulation/SimScheduler.h"
#include "constants/planetdefaults.h"
namespace modelspace {
/**
* @brief Custom planet consisting of inertial and rotating frame which can be configured with custom rotation rate
*
* The simple planet model is a simple model of a planet with configurable
* parameters for initial attitude, angular rate, and the items defined
* in planet defaults for gravitational parameter, J2, J3, equatorial radius,
*
*
* Author: Alex Reynolds <alex.reynolds@attx.tech>
*/
MODEL(CustomPlanet)
public:
// Model params
// NAME TYPE DEFAULT VALUE
START_PARAMS
/** The angular velocity of the planet rotating frame relative to the inertial frame.
* Defaults to Earth's rotation rate */
SIGNAL(initial_attitude, clockwerk::Quaternion, clockwerk::Quaternion({1.0,0.0,0.0,0.0}))
/** The angular velocity of the planet rotating frame relative to the inertial frame.
* Defaults to Earth's rotation rate. Mirrored on the output value. */
SIGNAL(omega, CartesianVector3, CartesianVector3({0.0,0.0,cfspp::earth_wgs84.mean_ang_vel}))
/** Equatorial radius of the planet, in meters. Default is Earth R per WGS84, in meters.
* This value is set to reflect user input values.
* Mirrored on the output value. */
SIGNAL(eq_radius, double, cfspp::earth_wgs84.eq_radius)
/** Flattening for the planet. Default is WGS84 flattening.
* This value is set to reflect user input values.
* Mirrored on the output value. */
SIGNAL(flattening, double, cfspp::earth_wgs84.flattening)
/** Gravitational parameter for planet. Default is WGS84 value, in m^3/s^2.
* This value is set to reflect user input values.
* Mirrored on the output value. */
SIGNAL(mu, double, cfspp::earth_wgs84.mu)
/** J2 parameter for planet. Default is derived from WGS84 but inexact.
* This value is set to reflect user input values.
* Mirrored on the output value. */
SIGNAL(J2, double, cfspp::earth_wgs84.J2)
/** J3 parameter for planet. Default is derived from WGS84 but inexact.
* This value is set to reflect user input values.
* Mirrored on the output value. */
SIGNAL(J3, double, cfspp::earth_wgs84.J3)
/** Mean angular velocity of the planet. Assumes rotation about Z axis. Default is WGS84 Earth in rad/s.
* This value is set to reflect user input values.
* Mirrored on the output value. */
SIGNAL(mean_ang_vel, CartesianVector3, CartesianVector3({0.0,0.0,cfspp::earth_wgs84.mean_ang_vel}))
END_PARAMS
// Model inputs
// NAME TYPE DEFAULT VALUE
START_INPUTS
END_INPUTS
// Model outputs
// NAME TYPE DEFAULT VALUE
START_OUTPUTS
/** A pointer to the custom planet object itself for easy passing to other models.
* Is a void pointer and must be cast in downstream model. Nullptr is set to
* self in constructor. */
SIGNAL(self_id, GraphTreeObject*, nullptr)
/** Accessor to the inertial frame of the planet. Set to point to _planet_inertial in constructor. */
SIGNAL(inertial_frame, Frame*, nullptr)
/** Accessor to the rotating frame of the planet. Set to point to _planet_inertial in constructor. */
SIGNAL(rotating_frame, Frame*, nullptr)
/** Equatorial radius of the planet, in meters. Default is Earth R per WGS84, in meters.
* This value is set to reflect user input values. */
SIGNAL(eq_radius, double, cfspp::earth_wgs84.eq_radius)
/** Flattening for the planet. Default is WGS84 flattening.
* This value is set to reflect user input values. */
SIGNAL(flattening, double, cfspp::earth_wgs84.flattening)
/** Gravitational parameter for planet. Default is WGS84 value, in m^3/s^2.
* This value is set to reflect user input values. */
SIGNAL(mu, double, cfspp::earth_wgs84.mu)
/** J2 parameter for planet. Default is derived from WGS84 but inexact.
* This value is set to reflect user input values. */
SIGNAL(J2, double, cfspp::earth_wgs84.J2)
/** J3 parameter for planet. Default is derived from WGS84 but inexact.
* This value is set to reflect user input values. */
SIGNAL(J3, double, cfspp::earth_wgs84.J3)
/** Mean angular velocity of the planet. Assumes rotation about Z axis. Default is WGS84 Earth in rad/s.
* This value is set to reflect user input values. */
SIGNAL(mean_ang_vel, CartesianVector3, CartesianVector3({0.0,0.0,cfspp::earth_wgs84.mean_ang_vel}))
END_OUTPUTS
protected:
int16 start() override;
// The inertial frame of the planet
Frame _planet_inertial = Frame("planet_inertial_frame");
// The planet rotating frame
Frame _planet_rotating = Frame("planet_rotating_frame");
};
}
#endif