def print_iirv_points(st, table): for i in range(0, len(table)): print("GIIRV MANY\r\r\n") tt = table[i][0].timetuple() string = "1111800001%3.3d%3.3d%2.2d%2.2d%2.2d%3.3d" % (i+1, tt.tm_yday, tt.tm_hour, tt.tm_min, tt.tm_sec, int(table[i][0].microsecond/1000.0)) csum = checksum(string) print("%s%3.3d\r\r\n" % (string, csum)) gmst_radians = astronomy.gmst(table[i][0]) #print("gmst_radians=%s, degrees=%s" % (gmst_radians, gmst_radians * 180.0/3.1415927)) (x, y, z) = (table[i][1][0], table[i][1][1], table[i][1][2]) r = math.sqrt(x*x + y*y) theta = math.atan2(y, x) x = r*math.cos(-1.0*gmst_radians+theta) y = r*math.sin(-1.0*gmst_radians+theta) string = "% 013.0f% 013.0f% 013.0f" % (x*1000.0, y*1000.0, z*1000.0) csum = checksum(string) print("%s%3.3d\r\r\n" % (string, csum)) (x, y, z) = (table[i][2][0], table[i][2][1], table[i][2][2]) r = math.sqrt(x*x + y*y) theta = math.atan2(y, x) x = r*math.cos(-1.0*gmst_radians+theta) y = r*math.sin(-1.0*gmst_radians+theta) string = "% 013.0f% 013.0f% 013.0f" % (x*1000000.0, y*1000000.0, z*1000000.0) csum = checksum(string) print("%s%3.3d\r\r\n" % (string, csum)) mass = 4544100 cross = 99999 drag = 200 solar = 1500000 string = "%08.0f%05.0f%04.0f% 08.0f" % (mass, cross, drag, solar) csum = checksum(string) print("%s%3.3d\r\r\n" % (string, csum)) print("ITERM GAQD\r\r\n")
def print_ephemeris_point(st, point, inertial=True): #print point if (inertial): coords = "ECI" else: coords = "ECEF" print("===== %s =====" % coords) if (not inertial): gmst_radians = astronomy.gmst(point[0]) print("Date/Time: %s Satellite Number: %s" % \ (point[0], st.get_satellite_number())) (x, y, z) = (point[1][0], point[1][1], point[1][2]) if (not inertial): r = math.sqrt(x * x + y * y) theta = math.atan2(y, x) x = r * math.cos(-1.0 * gmst_radians + theta) y = r * math.sin(-1.0 * gmst_radians + theta) print("Position (km, x/y/z %s): %s/%s/%s" % (coords, x, y, z)) (x, y, z) = (point[2][0], point[2][1], point[2][2]) if (not inertial): r = math.sqrt(x * x + y * y) theta = math.atan2(y, x) x = r * math.cos(-1.0 * gmst_radians + theta) y = r * math.sin(-1.0 * gmst_radians + theta) print("Velocity (km/s, x/y/z %s): %s/%s/%s" % (coords, x, y, z))
def print_iirv_point(st, point): print("GIIRV MANY\r\r\n") tt = point[0].timetuple() string = "1211800001000%3.3d%2.2d%2.2d%2.2d%3.3d" % (tt.tm_yday, tt.tm_hour, tt.tm_min, tt.tm_sec, int(point[0].microsecond/1000.0)) csum = checksum(string) print("%s%3.3d\r\r\n" % (string, csum)) gmst_radians = astronomy.gmst(point[0]) #print("gmst_radians=%s, degrees=%s" % (gmst_radians, gmst_radians * 180.0/3.1415927)) (x, y, z) = (point[1][0], point[1][1], point[1][2]) r = math.sqrt(x*x + y*y) theta = math.atan2(y, x) x = r*math.cos(-1.0*gmst_radians+theta) y = r*math.sin(-1.0*gmst_radians+theta) string = "% 013.0f% 013.0f% 013.0f" % (x*1000.0, y*1000.0, z*1000.0) csum = checksum(string) print("%s%3.3d\r\r\n" % (string, csum)) (x, y, z) = (point[2][0], point[2][1], point[2][2]) r = math.sqrt(x*x + y*y) theta = math.atan2(y, x) x = r*math.cos(-1.0*gmst_radians+theta) y = r*math.sin(-1.0*gmst_radians+theta) string = "% 013.0f% 013.0f% 013.0f" % (x*1000000.0, y*1000000.0, z*1000000.0) csum = checksum(string) print("%s%3.3d\r\r\n" % (string, csum)) mass = 4475570 cross = 99999 drag = 207 solar = 0 string = "%08.0f%05.0f%04.0f% 08.0f" % (mass, cross, drag, solar) csum = checksum(string) print("%s%3.3d\r\r\n" % (string, csum)) print("ITERM GAQD\r\r\n")
def print_ephemeris_table(st, table, inertial=True): if (inertial): coords = "ECI" else: coords = "ECEF" print "===== %s =====" % coords print "Time, X,Y,Z in km, VX,VY,VZ in km/s (%s Coordinates)" % coords for i in range(0, len(table)): ( x, y, z) = (table[i][1][0], table[i][1][1], table[i][1][2]) (vx, vy, vz) = (table[i][2][0], table[i][2][1], table[i][2][2]) if (not inertial): gmst_radians = astronomy.gmst(table[i][0]) r = math.sqrt(x*x + y*y) x = r*math.cos(-1.0*gmst_radians) y = r*math.sin(-1.0*gmst_radians) vr = math.sqrt(vx*vx + vy*vy) vx = r*math.cos(-1.0*gmst_radians) vy = r*math.sin(-1.0*gmst_radians) print "%s, %16.8f,%16.8f,%16.8f, %13.9f,%13.9f,%13.9f" % \ (table[i][0], x, y, z, vx, vy, vz)