@@ -135,7 +135,6 @@ def preprocess(self, rinex_paths, satellites):
135135
136136 data = pd .DataFrame ()
137137 self .iono_params = {}
138- #TODO: Convert this to a dictionary
139138 for rinex_path in rinex_paths :
140139 new_data , rinex_header = self ._get_ephemeris_dataframe (rinex_path ,
141140 constellations )
@@ -242,7 +241,6 @@ def _get_ephemeris_dataframe(self, rinex_path, constellations=None):
242241 data ['t_oc' ] = 1e-9 * data ['t_oc' ] - consts .WEEKSEC * np .floor (1e-9 * data ['t_oc' ] / consts .WEEKSEC )
243242 data ['time' ] = data ['time' ].dt .tz_localize ('UTC' )
244243 # Rename Keplerian orbital parameters to match a GLP standard
245- # TODO: Change these to a standard nomenclature
246244 data .rename (columns = {'M0' : 'M_0' , 'Eccentricity' : 'e' , 'Toe' : 't_oe' , 'DeltaN' : 'deltaN' , 'Cuc' : 'C_uc' , 'Cus' : 'C_us' ,
247245 'Cic' : 'C_ic' , 'Crc' : 'C_rc' , 'Cis' : 'C_is' , 'Crs' : 'C_rs' , 'Io' : 'i_0' , 'Omega0' : 'Omega_0' }, inplace = True )
248246 data .rename (columns = {'X' : 'sv_x_m' , 'dX' : 'sv_dx_mps' , 'dX2' : 'sv_dx2_mps2' ,
@@ -362,211 +360,6 @@ def load_leapseconds(self, rinex_header):
362360 leap_seconds = np .nan
363361 return leap_seconds
364362
365- # def rinex_to_sv_states(gps_millis, rinex_nav):
366- # # keplerian_rinex =
367- # # num_int_rinex =
368- # # keplerian_sv_states =
369- # # num_int_sv_states =
370- # # sv_states = keplerian_sv_states.concat(num_int_sv_states)
371- # # sv_states.sort('gps_millis', inplace=True)
372- # # rotate the states
373- # # return sv_states
374- # pass
375- #
376- # def orbit_params_to_sv_states(gps_millis, ephem_orbit_params):
377- # """Compute position and velocities for all satellites in ephemeris file
378- # given time of clock.
379- #
380- # `ephem` contains broadcast ephemeris parameters (similar in form to GPS
381- # broadcast parameters).
382- #
383- # Must contain the following rows (description in [1]_):
384- # * :code:`gnss_id`
385- # * :code:`sv_id`
386- # * :code:`gps_week`
387- # * :code:`t_oe`
388- # * :code:`e`
389- # * :code:`omega`
390- # * :code:`Omega_0`
391- # * :code:`OmegaDot`
392- # * :code:`sqrtA`
393- # * :code:`deltaN`
394- # * :code:`IDOT`
395- # * :code:`i_0`
396- # * :code:`C_is`
397- # * :code:`C_ic`
398- # * :code:`C_rs`
399- # * :code:`C_rc`
400- # * :code:`C_uc`
401- # * :code:`C_us`
402- #
403- # Parameters
404- # ----------
405- # gps_millis : int
406- # Time at which measurements are needed, measured in milliseconds
407- # since start of GPS epoch [ms].
408- # ephem : gnss_lib_py.parsers.navdata.NavData
409- # NavData instance containing ephemeris parameters of satellites
410- # for which states are required.
411- #
412- # Returns
413- # -------
414- # sv_posvel : gnss_lib_py.parsers.navdata.NavData
415- # NavData containing satellite positions, velocities, corresponding
416- # time with GNSS ID and SV number.
417- #
418- # Notes
419- # -----
420- # Based on code written by J. Makela.
421- # AE 456, Global Navigation Sat Systems, University of Illinois
422- # Urbana-Champaign. Fall 2017
423- #
424- # More details on the algorithm used to compute satellite positions
425- # from broadcast navigation message can be found in [1]_.
426- #
427- # Satellite velocity calculations based on algorithms introduced in [2]_.
428- #
429- # References
430- # ----------
431- # .. [1] Misra, P. and Enge, P,
432- # "Global Positioning System: Signals, Measurements, and Performance."
433- # 2nd Edition, Ganga-Jamuna Press, 2006.
434- # .. [2] B. F. Thompson, S. W. Lewis, S. A. Brown, and T. M. Scott,
435- # “Computing GPS satellite velocity and acceleration from the broadcast
436- # navigation message,” NAVIGATION, vol. 66, no. 4, pp. 769–779, Dec. 2019,
437- # doi: 10.1002/navi.342.
438- #
439- # """
440- #
441- # # Convert time from GPS millis to TOW
442- # gps_week, gps_tow = gps_millis_to_tow(gps_millis)
443- # # Extract parameters
444- #
445- # c_is = ephem_orbit_params['C_is']
446- # c_ic = ephem_orbit_params['C_ic']
447- # c_rs = ephem_orbit_params['C_rs']
448- # c_rc = ephem_orbit_params['C_rc']
449- # c_uc = ephem_orbit_params['C_uc']
450- # c_us = ephem_orbit_params['C_us']
451- # delta_n = ephem_orbit_params['deltaN']
452- #
453- # ecc = ephem_orbit_params['e'] # eccentricity
454- # omega = ephem_orbit_params['omega'] # argument of perigee
455- # omega_0 = ephem_orbit_params['Omega_0']
456- # sqrt_sma = ephem_orbit_params['sqrtA'] # sqrt of semi-major axis
457- # sma = sqrt_sma**2 # semi-major axis
458- #
459- # sqrt_mu_a = np.sqrt(consts.MU_EARTH) * sqrt_sma**-3 # mean angular motion
460- # gpsweek_diff = (np.mod(gps_week,1024) - np.mod(ephem_orbit_params['gps_week'],1024))*604800.
461- # sv_posvel = NavData()
462- # sv_posvel['gnss_id'] = ephem_orbit_params['gnss_id']
463- # sv_posvel['sv_id'] = ephem_orbit_params['sv_id']
464- # sv_posvel['gps_millis'] = gps_millis
465- #
466- # delta_t = gps_tow - ephem_orbit_params['t_oe'] + gpsweek_diff
467- #
468- # # Calculate the mean anomaly with corrections
469- # ecc_anom = _compute_eccentric_anomaly(gps_week, gps_tow,
470- # ephem_orbit_params)
471- #
472- # cos_e = np.cos(ecc_anom)
473- # sin_e = np.sin(ecc_anom)
474- # e_cos_e = (1 - ecc*cos_e)
475- #
476- # # Calculate the true anomaly from the eccentric anomaly
477- # sin_nu = np.sqrt(1 - ecc**2) * (sin_e/e_cos_e)
478- # cos_nu = (cos_e-ecc) / e_cos_e
479- # nu_rad = np.arctan2(sin_nu, cos_nu)
480- #
481- # # Calcualte the argument of latitude iteratively
482- # phi_0 = nu_rad + omega
483- # phi = phi_0
484- # for incl in range(5):
485- # cos_to_phi = np.cos(2.*phi)
486- # sin_to_phi = np.sin(2.*phi)
487- # phi_corr = c_uc * cos_to_phi + c_us * sin_to_phi
488- # phi = phi_0 + phi_corr
489- #
490- # # Calculate the longitude of ascending node with correction
491- # omega_corr = ephem_orbit_params['OmegaDot'] * delta_t
492- #
493- # # Also correct for the rotation since the beginning of the GPS week for which the Omega0 is
494- # # defined. Correct for GPS week rollovers.
495- #
496- # # Also correct for the rotation since the beginning of the GPS week for
497- # # which the Omega0 is defined. Correct for GPS week rollovers.
498- # omega = omega_0 - (consts.OMEGA_E_DOT*(gps_tow + gpsweek_diff)) + omega_corr
499- #
500- # # Calculate orbital radius with correction
501- # r_corr = c_rc * cos_to_phi + c_rs * sin_to_phi
502- # orb_radius = sma*e_cos_e + r_corr
503- #
504- # ############################################
505- # ###### Lines added for velocity (1) ######
506- # ############################################
507- # delta_e = (sqrt_mu_a + delta_n) / e_cos_e
508- # dphi = np.sqrt(1 - ecc**2)*delta_e / e_cos_e
509- # # Changed from the paper
510- # delta_r = (sma * ecc * delta_e * sin_e) + 2*(c_rs*cos_to_phi - c_rc*sin_to_phi)*dphi
511- #
512- # # Calculate the inclination with correction
513- # i_corr = c_ic*cos_to_phi + c_is*sin_to_phi + ephem_orbit_params['IDOT']*delta_t
514- # incl = ephem_orbit_params['i_0'] + i_corr
515- #
516- # ############################################
517- # ###### Lines added for velocity (2) ######
518- # ############################################
519- # delta_i = 2*(c_is*cos_to_phi - c_ic*sin_to_phi)*dphi + ephem_orbit_params['IDOT']
520- #
521- # # Find the position in the orbital plane
522- # x_plane = orb_radius*np.cos(phi)
523- # y_plane = orb_radius*np.sin(phi)
524- #
525- # ############################################
526- # ###### Lines added for velocity (3) ######
527- # ############################################
528- # delta_u = (1 + 2*(c_us * cos_to_phi - c_uc*sin_to_phi))*dphi
529- # dxp = delta_r*np.cos(phi) - orb_radius*np.sin(phi)*delta_u
530- # dyp = delta_r*np.sin(phi) + orb_radius*np.cos(phi)*delta_u
531- # # Find satellite position in ECEF coordinates
532- # cos_omega = np.cos(omega)
533- # sin_omega = np.sin(omega)
534- # cos_i = np.cos(incl)
535- # sin_i = np.sin(incl)
536- #
537- # sv_posvel['x_sv_m'] = x_plane*cos_omega - y_plane*cos_i*sin_omega
538- # sv_posvel['y_sv_m'] = x_plane*sin_omega + y_plane*cos_i*cos_omega
539- # sv_posvel['z_sv_m'] = y_plane*sin_i
540- #
541- # ############################################
542- # ###### Lines added for velocity (4) ######
543- # ############################################
544- # omega_dot = ephem_orbit_params['OmegaDot'] - consts.OMEGA_E_DOT
545- # sv_posvel['vx_sv_mps'] = (dxp * cos_omega
546- # - dyp * cos_i*sin_omega
547- # + y_plane * sin_omega*sin_i*delta_i
548- # - (x_plane * sin_omega + y_plane*cos_i*cos_omega)*omega_dot)
549- #
550- # sv_posvel['vy_sv_mps'] = (dxp * sin_omega
551- # + dyp * cos_i * cos_omega
552- # - y_plane * sin_i * cos_omega * delta_i
553- # + (x_plane * cos_omega - (y_plane*cos_i*sin_omega)) * omega_dot)
554- #
555- # sv_posvel['vz_sv_mps'] = dyp*sin_i + y_plane*cos_i*delta_i
556- #
557- # # Estimate SV clock corrections, including polynomial and relativistic
558- # # clock corrections
559- # clock_corr, _, _ = _estimate_sv_clock_corr(gps_millis,
560- # ephem_orbit_params)
561- #
562- # sv_posvel['b_sv_m'] = clock_corr
563- #
564- # return sv_posvel
565- #
566- #
567- # def numerical_integration_for_sv_states(self, gps_millis):
568- # pass
569-
570363
571364def _compute_eccentric_anomaly (gps_week , gps_tow , ephem , tol = 1e-5 , max_iter = 10 ):
572365 """Compute the eccentric anomaly from ephemeris parameters.
0 commit comments