Airforce Space Command (AFSPC) distributes a copy of the binaries they use to compute the Standard Astrodynamic Algorithms (SAA) in Dynamic Link Library (DLL) form. To exactly replicate AFSPCs simulation results, one must use these DLLs to propogate orbits.
dshsaa
is a python3 driver which allows the user to interface with the SAA DLLs using simple python3 code.
If you need to coordinate with AFSPC and want to get exactly the same results AFSPC gets, use dshsaa
and the SAA DLLs to propogate your orbits.
If you only wish to implement the SGP4 satellite tracking algorithms, use the python-sgp4
package developed by Brandon Rhodes which is located here. The deviation between Brandon's implementation and AFPSC's implementation is relatively small.
David Harding built this driver to go with his blog at blog.hardinglabs.com.
- Test on Windows
- Test on MacOS (Catalina drops 32bit support, may not work)
- Add a test environment validation script that verifies
- dll path is known and populated
- python version is accurate
- ctypes version is acceptable
- dependencies are available
Installation on Linux is fully tested on Ubuntu 16.04 and 18.04. Installation on Windows and MacOS is still in development.
You must be a US citizen to lawfully download the SAA DLLs.
Go to space-track.org, make an account, then go to the sgp4 download page and download the appropriate package for your operating system. For me, this is SGP4_small_V7.9_LINUX64.tar.gz
. You should also download the windows package, SGP4_small_V7.9_WIN64.zip
, because the Windows package provides driver examples not present in the Linux version.
Check your Python3 version and make sure you are running at 3.7.5 or greater.
$ python3 -V
Python 3.7.5
Check your ctypes version and make sure you are running 1.1.0 or greater.
python3 -c "import ctypes; print(ctypes.__version__)"
1.1.0
Clone the dshsaa
repository to your working environment.
$ cd ~
$ git clone https://github.com/hardingprofessional/dshsaa.git
You should now have a folder called dshsaa
on your current path.
Untar your copy of SGP4_small_V7.9_LINUX64.tar.gz
. Navigate to SGP4_small_V7.9_LINUX64.tar.gz/Lib
and copy all of the contents to ~/dshsaa/dshsaa/libdll/
.
If you don't have pip installed, install it.
$ sudo apt update
$ sudo apt install python3-pip
$ sudo apt install python3-venv
Establish a virtual environment.
$ cd ~/dshsaa
$ python3 -m venv virtenv
You should now have a folder at ~/dshsaa/virtenv. Next, activate the virtual environment and install dependencies.
$ source virtenv/bin/activate
$ pip3 install --upgrade pip
$ pip3 install -r requirements.txt
Sourcing
virtenv/bin/activate
fundamentally alters the python environment in the shell, and those changes will persist until the user executes the shell functiondeactivate
. Your$PS1
shell prompt should indicate this by prepending(virtenv)
to itself.
Add the libdll to LD_LIBRARY_PATH
. This must be done any time the dshsaa
module is used.
$ cd ~/dshsaa
$ source source_env
Run the full test battery
$ ./runtest
The end of the output should look similar to this:
...
test_TleUpdateSatFrFieldsSP (raw.test_tledll.TestTleDll) ... ok
testl_TleFieldsToSatKey (raw.test_tledll.TestTleDll) ... ok
testl_TleFieldsToSatKeyML (raw.test_tledll.TestTleDll) ... skipped 'Segmentation fault, matlab'
----------------------------------------------------------------------
Ran 155 tests in 0.014s
OK (skipped=14)
Build the documentation with sphinx.
$ cd ~/dshsaa/sphinx
$ ./rebuild
Open the documentation by pointing your browser at ~/dshsaa/sphinx/_build/html/index.html
.
Any time you run the module, you should do so from ~/dshsaa
and you must source source_env
.
Any time you build the docs, you must do so from ~/dshsaa/sphinx
using the ./rebuild
script.
I am investigating ways to fix this.
Run dshsaa/example.py
to make sure it works. Use this code as a reference until the sphinx documentation is improved.