Hi guys!
I am happy to announce that I finished the first version of the SGP4/SDP4 implementation 100% written in Julia. The source code is part of SatelliteToolbox.jl. Notice that I did not tag yet, so you need to use master
.
As for the correctness of the algorithm, all the test TLEs available in [1] has been added into the test set, and everything passes. Thus, I am not expecting any major problems. But I will be very happy if you can help me to test in other scenarios and report weird behaviors
Notice that I have not yet implemented the verifications for things like the satellite crashed or numerical errors arising in veeeery long integrations (this is easy and will be done soon).
Furthermore, I decided to make a “readable” code instead of the most performant possible. Because this will be used to teach students about orbit propagators. So, for example, the FORTRAN code:
SING=SIN(OMEGAO)
COSG=COS(OMEGAO)
TSI=1./(AODP-S4)
ETA=AODP*EO*TSI
ETASQ=ETA*ETA
EETA=EO*ETA
PSISQ=ABS(1.-ETASQ)
COEF=QOMS24*TSI**4
COEF1=COEF/PSISQ**3.5
C2=COEF1*XNODP*(AODP*(1.+1.5*ETASQ+EETA*(4.+ETASQ))+.75*
1 CK2*TSI/PSISQ*X3THM1*(8.+3.*ETASQ*(8.+ETASQ)))
C1=BSTAR*C2
was translated into
aux0 = abs(1-η^2)
aux1 = aux0^(-7/2)
aux2 = ξ^4*all_0*β_0^2*aux1
C2 = QOMS2T*Îľ^4*nll_0*aux1*
( all_0*( 1 + (3/2)η^2 + 4e_0*η + e_0*η^3) +
3/2*(k_2*ξ)/aux0*(-1/2 + (3/2)θ²)*(8 + 24η^2 + 3η^4) )
C1 = bstar*C2
(give or take some lines of code…)
I know that FORTRAN version should be faster, but the Julia one is more easily related to the equations we have in the books.
Finally, I want the code to be very documented about the theory. So that, in the far far far away future, when someone needs to rewrite in another language, he/she will not have the problems I had… Hence, if you are an export in Astrodynamics and want to add comments about the equations in the code (specially the deep space bits…), be my guest
[1]: Vallado, D. A., Crawford, P., Hujsak, R., Kelso, T. S (2006). Revisiting Spacetrack Report #3: Rev1. AIAA.