Skip to content

A simulation environment to predict spacecraft attitude and trajectories

License

Notifications You must be signed in to change notification settings

srenevey/satops

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SatOps

SatOps is a library that propagates the trajectory and attitude of a spacecraft subject to various orbital perturbations. Currently supported are atmospheric drag (exponentional model or EarthGRAM 2016), geopotential perturbations, third-body effects, solar radiation pressure, and magnetic perturbations. An example is provided in examples/cubesat.cpp.

Note: the propagator is still a work in progress and has not been validated yet. The output might be inaccurate / incorrect.

Prerequisites

The C++ propagator uses the EGM2008 geopotential model, the EarthGRAM2016 atmospheric model, the IGRF-13 magnetic model, as well as several kernels used with the Naif SPICE toolbox for the planetary ephemerides. These models should be downloaded before compiling the library.

Geopotential model

The EGM2008 model can be downloaded here. Download the model Spherical Harmonic Coefficients for Earth's Gravitational Potential - "Tide Free" system and then extract it. Place the file EGM2008_to2190_TideFree into assets.

SatOps
└── assets
    |   EGM2008_to2190_TideFree
|   docs
|   examples
|   extern
|   include
|   LICENSE
|   README.md
|   src
|   tests

Atmospheric model

The library currently supports an exponentially decaying atmosphere (provided) or NASA's Earth Global Reference Atmospheric Model 2016 (EarthGRAM2016). The model can be requested from the NASA Software Catalog. Unzip the archive and place it in the extern folder

SatOps
└── assets
    |   EGM2008_to2190_TideFree 	
|   docs
|   examples
└── extern
    |   earthGRAM2016
|   include
|   LICENSE
|   README.md
|   src
|   tests

Copy NameRef_Linux.txt from data/IOfiles into earthGRAM2016 and rename it to NameRef.txt. Open the file and modifiy as follows:

atmpath = <ABSOLUTE_PATH_TO_PROJECT_ROOT>/extern/earthGRAM2016/data/IOfiles/
NCEPpath = <ABSOLUTE_PATH_TO_PROJECT_ROOT>/extern/earthGRAM2016/data/NCEPdata/FixedBin/
trapath = null
prtpath = null
nprpath =  null
conpath =  null
rrapath = <ABSOLUTE_PATH_TO_PROJECT_ROOT>/extern/earthGRAM2016/data/RRAdata/
...
iurra = 0
...
ibltest = 0

where <ABSOLUTE_PATH_TO_PROJECT_ROOT> must be modified accordingly. By default, EarthGRAM2016 prompts the user to enter the path to NameRef.txt which is not ideal for a seamless integration. The file earthgram.patch modifies some of the source files to suppress any prompt and output. To apply the patch, copy the file earthgram.patch from assets into extern/earthGRAM2016/src and then in a terminal, navigate to extern/earthGRAM2016/src and type

patch -p1 < earthgram.patch

The next step is to compile EarthGRAM2016 into a library. Assuming that CMake is installed, create a CMakeLists file in earthGRAM2016/src and add the following lines:

cmake_minimum_required(VERSION 3.14)
project(earthGRAM2016)

set(CMAKE_CXX_STANDARD 20)

add_library(earthGRAM2016 STATIC
    Atmod1.cpp
    Atmod1.h
    AuxProf.cpp
    AuxProf.h
    HWM.cpp
    HWM.h
    Init.cpp
    Init.h
    InitP.cpp
    InitP.h
    JB2008.cpp
    JB2008.h
    Map.cpp
    Map.h
    MET.cpp
    MET.h
    MSIS.cpp
    MSIS.h
    NCEP.cpp
    NCEP.h
    Pert.cpp
    Pert.h
    RRA.cpp
    RRA.h)

set_property(TARGET earthGRAM2016 PROPERTY POSITION_INDEPENDENT_CODE ON)

Open a terminal and navigate to earthGRAM2016/src. Then, type

mkdir build
cd build
cmake ..
cmake --build .

The library earthGRAM2016.a will be crated in the build directory.

Planetary ephemerides

The propagator uses JPL's ephemerides to retrieve the celestial bodies positions. This process is facilitated by the SPICE toolbox developed by NASA's Naif. The kernels used by the SPICE toolbox can be accessed from the JPL's Naif website by going to Data > Generic Kernels > Generic Kernels and navigating in the subfolders. The required kernels are (right click > "Save Link As..." to download the file directly):

These kernels should be placed in a kernels folder inside the assets directory.

SatOps
└── assets
    |   EGM2008_to2190_TideFree 
    └── kernels
        |   de430.bsp
        |   earth_latest_high_prec.bpc
        |   gm_de431.tpc
        |   naif0012.tls
        |   pck00010.tpc
|   docs
|   examples
└── extern
    |   earthGRAM2016
|   include
|   LICENSE
|   README.md
|   src
|   tests

These kernels will be loaded by SPICE through a meta-kernel. The following content should be put in a file named kernels.tm and placed in the assets folder. Modify <ABSOLUTE_PATH_TO_PROJECT_ROOT> to reflect your project's root directory path:

KPL/MK
   \begindata
   PATH_VALUES     = ( '<ABSOLUTE_PATH_TO_PROJECT_ROOT>' )
   
   PATH_SYMBOLS    = ( 'ROOT' )

   KERNELS_TO_LOAD = (  '$ROOT/assets/kernels/de430.bsp',
                        '$ROOT/assets/kernels/earth_latest_high_prec.bpc',
                        '$ROOT/assets/kernels/gm_de431.tpc',
                        '$ROOT/assets/kernels/naif0012.tls',
                        '$ROOT/assets/kernels/pck00010.tpc')
 
   \begintext

Geomagnetic Model

The 13th generation International Geomagnetic Reference Field (IGRF-13) is used to model the Earth magnetic field. The spherical harmonic coefficients are provided in the file located in assets.

Compilation

The SatOps library is based on boost and CSPICE. These libraries should be downloaded and installed before compiling the library.

Create a build directory to keep the project directory clean:

mkdir build
cd build
cmake ..

To compile the library, the examples, and the documentation (requires doxygen):

cmake --build . 

To compile the library only:

cmake --build . --target SatOps

To compile a specific example:

cmake --build . --target cubesat

To compile the documentation:

cmake --build . --target doc

To compile the tests (googletest must be installed in extern prior to building the tests):

mkdir build
cd build
cmake .. -DBUILD_TESTS=ON
cmake --build .

Releases

No releases published

Packages

No packages published

Languages