You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

*** DRAFT ***


How to Add an Orbit State Type to GMAT

Wendy C. Shoan
Goddard Space Flight Center


GMAT provides the capability to model spacecraft orbits.  As of R2013a, there are six orbit state representations allowed in GMAT: Cartesian, Keplerian, Modified Keplerian, SphericalAZFPA, SphericalRADEC, and Equinoctial.  

This document will first give a brief overview of how GMAT handles these state types.  Then it will explain how to add a new orbit state type to GMAT.  Due to current design, new state types cannot be added by plugins and so GMAT base code must be modified.  The implementation of a new orbit state type will involve, at a high level:

  • Modifying the Spacecraft class to handle the new type
  • Adding conversions methods in StateConversionUtil
  • Adding new parameters to GMAT for the fields associated with your new state type
  • Modifying the Orbit tab of the Spacecraft panel 

State Type Overview

The user can set a spacecraft's orbital state in any of the above-mentioned representations via the script or the Orbit tab of the Spacecraft panel.  Internal computations are done in Cartesian.  The StateConversionUtil static class provides conversion methods between the available representations, usually going through the Cartesian state.  Uses can plot or report state data in any of the allowed representations.

Adding a State Type 

Step 1: Modify Spacecraft.hpp

There are minimal changes needed for the header file when adding a new state type.  The new elements must be added to the end of the MultipleReps enum, and the state type must be added to the end of the STATE_REPS enum.  For example, if we were adding the Delaunay type:


Step 2: Modify Spacecraft.cpp

You will need to add your new elements to the MULT_REP_STRINGS array to match the data you added to the header, e.g. 

You will need to modify other Spacecraft methods as follows:

  • in the constructor, you will need to add your new type to the representations vector
  • in GetParameterID, you will need to add your new elements
  • in SetStringParameter, in the code for DISPLAY_STATE_TYPE_ID, you will need to add your new state type in the check for valid input type
  • in UpdateElementLabels, set the labels for your elements
  • in SetElement, add checks for elements that could be part of other representations (e.g. AOP, RAAN, or MA for Delaunay)
  • in LookUpLabel, add your element labels
  • in BuildElementLabelMap, add your element labels
  • in SetPossibleInputTypes, you will need to make sure your new type is included or removed where applicable
  • in ValidateOrbitStateValue, add validation where necessary

Step 3: Modify StateConversionUtil

You will need to add your new type to the StateType enum, and to the STATE_TYPE_TEXT and REQUIRES_CB_ORIGIN.  Your entry for this last one is set to true if your new state type requires that the origin be a CelestialBody; false otherwise.  You may need to add a constant (e.g. a tolerance value) as well.

You will need to provide conversion methods to/from your new type and Cartesian, e.g. CartesianToDelaunay and DelaunayToCartesian.  For example:

You may need more arguments for your conversions, or you may need a larger Rvector for your state type.  These methods should also include all validation necessary - checking for singularities, disallowed orbits, etc.  You will need to modify ValidateValue to check for range of data, values of coupled data, etc.  You will then need to modify the main Convert methods to call your new methods, as needed.  

Step 4: Add the new parameters

Step 5: Update the Orbit Panel



*** DRAFT ***

  • No labels