ODU-CGA-CubeSat / orbit-propagator

MIT License
1 stars 1 forks source link

Orbit Propagator

C library for performing orbit propagation, based on Vinti6 algorithm.

Cloning the repo

Clone the Orbit Propagator repo. Don't forget to use --recurse-submodules flag, or else you won't pull down some of the code needed to run unit tests.

git clone --recurse-submodules git@github.com:ODU-CGA-CubeSat/orbit-propagator.git
cd orbit-propagator

Note: If you accidentally cloned without using --recurse-submodules, you can run git submodule update --init --recursive to pull down submodules needed to run unit tests.

Build with CMake

This builds the main executable written in C

mkdir build
cd build
cmake ..
make

State Vector Example

The main executable, orbit-propagator, as well as the simulation, vinti_sim.m, take as input/output an ECI state vector which gives position and velocity in cartesian coordinates.

x  =      2328.9659400000   km
y  =     -5995.2160000000   km
z  =      1719.9789400000   km
xd =         2.9111011300   km/s
yd =         -.9816405300   km/s
zd =        -7.0904992200   km/s

Usage

Running main executable

Create an inputStateVect.txt in the build/ directory using ECI coordinates and units of km, km/s, example below

4063.75
0
5134.54
0
7.826
0

In the build/ directory, run main executable

./orbit-propagator

This outputs a new state vector to outputStateVect.txt (ECI cartesian and mean elements)

Running unit tests

In the build/ directory, run

ctest -V

Running Octave Simulation

After running the build commands, you may run the the Octave orbit simulation, vinti_sim.m.

Create an input text file in the orbit-propagator project directory using ECI coordinates in km, km/s.

Example below using initial condition for mission generated by STK:

STK_initialCond.txt

-5877.6
428.24
3051.4
-2.991
-5.0497
-5.0231

In Octave, navigate to orbit-propagator and from "Command Window" (in Octave) call:

[x_ECI, orbital_lifetime_hrs] = vinti_sim(max_simulation_time_hrs, 'inputFileName', 'dragCondition', SatMass)

Where,

Inputs:

Outputs:

Example usage:

[stateVector,orbital_lifetime_hrs] = vinti_sim(2,"STK_initialCond.txt","tumbling",4)