MCPcopy Index your code
hub / github.com/SpaceNetLab/StarryNet / calculate_delay

Method calculate_delay

starrynet/sn_observer.py:216–315  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

214 cnt = 1
215
216 def calculate_delay(self):
217 path = self.configuration_file_path + "/" + self.file_path
218 sat_cbf = [
219 ] # first dimension: time. second dimension: node. third dimension: xyz
220 sat_lla = [
221 ] # first dimension: time. second dimension: node. third dimension: lla
222 fac_cbf = [] # first dimension: node. second dimension: xyz
223
224 if os.path.exists(path + '/delay') == True:
225 osstr = "rm -f " + path + "/delay/*"
226 os.system(osstr)
227 else:
228 os.system("mkdir " + path)
229 os.system("mkdir " + path + "/delay")
230 if os.path.exists(path + '/position') == True:
231 osstr = "rm -f " + path + "/position/*"
232 os.system(osstr)
233 else:
234 os.system("mkdir " + path + "/position")
235
236 ts = load.timescale()
237 since = datetime(1949, 12, 31, 0, 0, 0)
238 start = datetime(2020, 1, 1, 0, 0, 0)
239 epoch = (start - since).days
240 inclination = self.inclination * 2 * np.pi / 360
241 GM = 3.9860044e14
242 R = 6371393
243 altitude = self.satellite_altitude * 1000
244 mean_motion = np.sqrt(GM / (R + altitude)**3) * 60
245 num_of_orbit = self.orbit_number
246 sat_per_orbit = self.sat_number
247 num_of_sat = num_of_orbit * sat_per_orbit
248 F = 18
249 bound_dis = self.calculate_bound(
250 self.antenna_inclination, self.satellite_altitude) * 29.5 / 17.31
251
252 duration = self.duration # second
253 result = [[] for i in range(duration)] # LLA result
254 lla_per_sec = [[] for i in range(duration)] # LLA result
255
256 for i in range(num_of_orbit): # range(num_of_orbit)
257 raan = i / num_of_orbit * 2 * np.pi
258 for j in range(sat_per_orbit): # range(sat_per_orbit)
259 mean_anomaly = (j * 360 / sat_per_orbit + i * 360 * F /
260 num_of_sat) % 360 * 2 * np.pi / 360
261 satrec = Satrec()
262 satrec.sgp4init(
263 WGS84, # gravity model
264 'i', # 'a' = old AFSPC mode, 'i' = improved mode
265 i * sat_per_orbit + j, # satnum: Satellite number
266 epoch, # epoch: days since 1949 December 31 00:00 UT
267 2.8098e-05, # bstar: drag coefficient (/earth radii)
268 6.969196665e-13, # ndot: ballistic coefficient (revs/day)
269 0.0, # nddot: second derivative of mean motion (revs/day^3)
270 0.001, # ecco: eccentricity
271 0.0, # argpo: argument of perigee (radians)
272 inclination, # inclo: inclination (radians)
273 mean_anomaly, # mo: mean anomaly (radians)

Callers 1

__init__Method · 0.80

Calls 4

calculate_boundMethod · 0.95
to_cbfMethod · 0.95
access_P_L_shortestMethod · 0.95
matrix_to_changeMethod · 0.95

Tested by

no test coverage detected