user2156697
user2156697

Reputation: 81

Python SGP4 1.1 Calculating Incorrect Orbit

I am using the python SGP4 1.1 module to calculate the position and velocity of a MEO satellite. I'm noticing when compared against STK and JSatTrak that the returned values for position and velocity are incorrect. The Satellite should have a ground repeat track of roughly 6 hours, but this program is showing a ground repeat of 4:47:51. Is there something that I am doing incorrectly?

from sgp4.earth_gravity import wgs72
from sgp4.io import twoline2rv
from math import atan2, cos, pi, sin, sqrt, tan
from datetime import datetime

def calculate(options):
    x = options[0]
    y = options[1]
    z = options[2]

    # Constants (WGS ellipsoid)
    a = 6378.137
    e = 8.1819190842622e-2
    # Calculation
    b = sqrt(pow(a,2) * (1-pow(e,2)))
    ep = sqrt((pow(a,2)-pow(b,2))/pow(b,2))
    p = sqrt(pow(x,2)+pow(y,2))
    th = atan2(a*z, b*p)
    lon = atan2(y, x)
    lat = atan2((z+ep*ep*b*pow(sin(th),3)), (p-e*e*a*pow(cos(th),3)))
    n = a/sqrt(1-e*e*pow(sin(lat),2))
    alt = str(p/cos(lat)-n)
    lat = str((lat*180)/pi)
    lon = str((lon*180)/pi)
    #print "%s %s %s" % (lat, lon, alt)
    return (lat, lon, alt)

line1 = '1     1U 001001   14001.00000000  .00000000  00000+0  00000+0 0 00022'           
line2 = '2     1   0.0891 294.8098 0002843  64.8653   0.5014  5.00115502    09'

satellite = twoline2rv(line1, line2, wgs72)
position1, velocity1 = satellite.propagate(2013, 3, 1, 0, 0, 1)
position2, velocity2 = satellite.propagate(2013, 3, 1, 4, 47, 52)
lat1,lon1,alt1 = calculate(position1)
lat2,lon2,alt2 = calculate(position2)

print lat1 + " " + lon1  + " " + alt1
print lat2 + " " + lon2  + " " + alt2
print "\n\n"
print position1
print position2   

Upvotes: 2

Views: 2962

Answers (3)

Meysam Mahooti
Meysam Mahooti

Reputation: 41

Simplified Deep Space Perturbations (SDP) models apply to objects with an orbital period greater than 225 minutes, which corresponds to an altitude of 5,877.5 km, assuming a circular orbit. As a result, you have to use SDP4 or SDP8 for MEO satellites. The MATLAB version of SDP4 is available at the following link: https://www.mathworks.com/matlabcentral/fileexchange/132693-sgp4-sdp4?s_tid=srchtitle

Upvotes: 1

JPaget
JPaget

Reputation: 1010

You need to allow for the rotation of the Earth in your calculations. Instead of longitude you have calculated geocentric right ascension. Start by reading the article on Hour Angle in Wikipedia.

Upvotes: 3

siritinga
siritinga

Reputation: 4231

It's been three weeks since you asked this question so I suppose it won't help you but anyway, for the archives...

I don't have the Python SGP4 routines and I cannot test them, but usually SGP4 routines will return position and speed in an inertial (non-rotating) reference frame called TEME (True Equator, Mean Equinox: https://en.wikipedia.org/wiki/Earth-centered_inertial#TEME). You are calculating the lat/long of Earth in this reference system, and it will give you wrong results. You should first transform the TEME system to a rotating system that rotates with Earth (like ECEF: https://en.wikipedia.org/wiki/ECEF ) and then you can calculate the lat/lon.

I hope there are libraries for this conversion, as it is not a trivial one.

Regards.

Upvotes: 4

Related Questions