-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2BodyProblem.py
More file actions
69 lines (49 loc) · 2.17 KB
/
Copy path2BodyProblem.py
File metadata and controls
69 lines (49 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import numpy as np
from scipy.integrate import ode
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from data.planetary_data import earth
from OrbitPropagator import OrbitPropagator as op
from central_body import CentralBody
from satellite import Satellite
from plot_test import PlotTest as pt
from data.orbital_elements_data import iss
import utils
plt.style.use('dark_background')
def init_central_body():
cb = CentralBody("Earth", earth['mass'], earth['radius'], axis_tilt=23.5)
return cb
cb = init_central_body()
def get_orbital_elements(sat_name="iss"):
a = cb.radius + (iss['perigee height'] + iss['apogee height'])/2
eles = [a, iss['e'], iss['i'], iss['raan'], iss['arg_perigee'], iss['ma@epoch'], iss['Epoch']]
period = (24.0*3600.0)/iss['revs/day']
return eles, period
if __name__ == "__main__":
pt.plot_polar()
cb = init_central_body()
sphere_coords = cb.plot_attributes()
# create satellite object and propagate it using orbital elements
sat1 = Satellite(sat_id=1, name="ISS", center_body=cb, sat_type="Station")
sat1r0, sat1v0 = sat1.propagate_with_tle("data/iss.tle")
sat1r0 = sat1r0.tolist()
sat1v0 = sat1v0.tolist()
propagtor1 = op(sat1r0, sat1v0, sat1.period, dt=100.0, central_body=cb)
propagtor1.propagate()
sat2 = Satellite(sat_id=2, name="Starlink-31", center_body=cb, sat_type="Communication")
sat2r0, sat2v0 = sat2.propagate_with_tle("data/starlink-31.tle")
sat2r0 = sat2r0.tolist()
sat2v0 = sat2v0.tolist()
propagtor2 = op(sat2r0, sat2v0, sat2.period, dt=100.0, central_body=cb)
propagtor2.propagate()
sat3 = Satellite(sat_id=3, name="NOAA", center_body=cb, sat_type="Weather")
sat3r0, sat3v0 = sat3.propagate_with_tle("data/noaa.tle")
sat3r0 = sat3r0.tolist()
sat3v0 = sat3v0.tolist()
propagtor3 = op(sat3r0, sat3v0, sat3.period, dt=100.0, central_body=cb)
propagtor3.propagate()
sat1_plot = [propagtor1.rs, 'k', sat1.name]
sat2_plot = [propagtor2.rs, 'g', sat2.name]
sat3_plot = [propagtor3.rs, 'm', sat3.name]
satellites_rs = [sat1_plot, sat2_plot, sat3_plot]
utils.plot_orbits(sphere_coords, satellites_rs)