GPS从入门到放弃(七) --- GPS卫星位置解算

GPS从入门到放弃(七) — GPS卫星位置解算

上一篇讲了开普勒轨道参数,根据这些参数就可以确定卫星的位置,这一篇我们来实际计算一下。

WGS-84基本参数

首先给出几个WGS-84坐标系中的基本参数:

  • a = 6378137 [ m ] a = 6378137[m] a=6378137[m] # 基准椭球体长半径
  • f = 1 / 298.257223563 f = 1/298.257223563 f=1/298.257223563 # 基准椭球体扁率
  • Ω ˙ e = 7.2921151467 × 1 0 − 5 [ r a d / s ] \dot{\Omega}_e = 7.2921151467\times10^{-5}[rad/s] Ω˙e=7.2921151467×105[rad/s] # 地球自转角速度
  • μ = 3.986005 × 1 0 14 [ m 3 / s 2 ] \mu = 3.986005\times10^{14}[m^3/s^2] μ=3.986005×1014[m3/s2] # 地球引力常数GM
  • c = 2.99792458 × 1 0 8 [ m / s ] c = 2.99792458\times10^8[m/s] c=2.99792458×108[m/s] # 真空中的光速

Python代码如下:

# WGS-84基本参数
a = 6378137 # 基准椭球体长半径(m)
f = 1/298.257223563 # 基准椭球体扁率
Omega_e_Dot = 7.2921151467e-5 # 地球自转角速度(rad/s)
mu = 3.986005e14 # 地球引力常数GM(m^3/s^2)
c = 2.99792458e8 # 真空中的光速(m/s)
星历参数
  • t o e t_{oe} toe # 星历参考时间
  • A \sqrt{A} A # 卫星轨道半长轴A的平方根
  • e e e # 卫星轨道偏心率
  • i 0 i_0 i0 # t o e t_{oe} toe时的轨道倾角
  • Ω 0 \Omega_0 Ω0 # 周内时为0时的轨道升交点赤经
  • ω \omega ω # 近地点角距
  • M 0 M_0 M0 # t o e t_{oe} toe时的平近点角
  • Δ n \Delta_n Δn # 卫星平均角速度校正值
  • i ˙ \dot{i} i˙ # 轨道倾角的变化率
  • Ω ˙ \dot{\Omega} Ω˙ # 轨道升交点赤经的变化率
  • C u c C_{uc} Cuc # 升交点角距余弦调和校正振幅
  • C u s C_{us} Cus # 升交点角距正弦调和校正振幅
  • C r c C_{rc} Crc # 轨道半径余弦调和校正振幅
  • C r s C_{rs} Crs # 轨道半径正弦调和校正振幅
  • C i c C_{ic} Cic # 轨道倾角余弦调和校正振幅
  • C i s C_{is} Cis # 轨道倾角正弦调和校正振幅

从网站 ftp://cddis.nasa.gov/gnss/data 下载2019年国庆(10月1日)当天的星历数据,可以得到星历参数的值,Python代码如下:

# 星历参数
t_oe = 2.016000000000E+05
A_sqrt = 5.153681812286E+03
e = 1.475233526435E-02
i_0 = 9.590228562257E-01
Omega_0 = -1.091936976129E-01
omega = 6.837269280624E-01
M_0 = 1.699075304872E+00
Delta_n = 4.599120143243E-09
i_Dot = -3.957307694893E-10
Omega_Dot = -8.244629136182E-09
Cuc = -5.902722477913E-06
Cus = 9.264796972275E-06
Crc = 2.046875000000E+02
Crs = -1.155625000000E+02
Cic = -3.259629011154E-07
Cis = 5.774199962616E-08

下面开始计算。

计算卫星轨道半长轴
A = A_sqrt**2 # 卫星轨道半长轴
print("A={}".format(A))

可得 A=26560436.222287513(米)

计算规化时间

假设我们要计算这个星历发射时刻 t = 1.993680000000 E + 05 t = 1.993680000000E+05 t=1.993680000000E+05 的卫星位置,设规化时间为 t k t_k tk,即为 t t t 时刻与参考时间 t o e t_{oe} toe 之间的差异:
t k = t − t o e t_k = t - t_{oe} tk=ttoe
要注意 t t

  • 75
    点赞
  • 324
    收藏
    觉得还不错? 一键收藏
  • 40
    评论
以下是一个简单的 Python 代码示例,用于 GPS 卫星位置解算: ```python import math def gps_position_solver(prn_list, pseudoranges, ephemerides): # Constants GM = 3.986005e14 # Earth's gravitational constant OMEGA_E_DOT = 7.2921151467e-5 # Earth's rotation rate C = 2.99792458e8 # Speed of light F_L1 = 1.57542e9 # L1 frequency F_L2 = 1.2276e9 # L2 frequency # Variables x, y, z, t = 0, 0, 0, 0 # Select one satellite prn = prn_list[0] pr = pseudoranges[0] eph = ephemerides[prn] # Calculate the satellite's position at transmission time toe = eph.toe # Time of ephemeris toc = eph.toc # Time of clock dt = t - pr / C # Signal transmission time tk = dt - toc # Time from ephemeris reference epoch a = eph.sqrt_a ** 2 # Semi-major axis n0 = math.sqrt(GM / a ** 3) # Computed mean motion n = n0 + eph.dn # Corrected mean motion M = eph.m0 + n * tk # Mean anomaly E = M # Eccentric anomaly for i in range(10): E_old = E E = M + eph.e * math.sin(E) if abs(E - E_old) < 1e-12: break v = math.atan2(math.sqrt(1 - eph.e ** 2) * math.sin(E), math.cos(E) - eph.e) phi = v + eph.omega u = phi + eph.cuc * math.cos(2 * phi) + eph.cus * math.sin(2 * phi) r = a * (1 - eph.e * math.cos(E)) + eph.crc * math.cos(2 * phi) + eph.crs * math.sin(2 * phi) i = eph.i0 + eph.idot * tk + eph.cic * math.cos(2 * phi) + eph.cis * math.sin(2 * phi) Omega = eph.Omega0 + (eph.OmegaDot - OMEGA_E_DOT) * tk - OMEGA_E_DOT * toe x = r * math.cos(u) y = r * math.sin(u) z = 0 x_new = x * math.cos(Omega) - y * math.cos(i) * math.sin(Omega) y_new = x * math.sin(Omega) + y * math.cos(i) * math.cos(Omega) z_new = y * math.sin(i) # Calculate the receiver's position dt = t - pr / C # Signal reception time pr = pseudoranges[0] rx = [0, 0, 0] # Receiver's position rx_old = [1e6, 1e6, 1e6] # Old receiver's position while abs(rx[0] - rx_old[0]) > 1e-4 or abs(rx[1] - rx_old[1]) > 1e-4 or abs(rx[2] - rx_old[2]) > 1e-4: rx_old = rx dx = x_new - rx[0] dy = y_new - rx[1] dz = z_new - rx[2] r = math.sqrt(dx ** 2 + dy ** 2 + dz ** 2) dt = dt - r / C rx[0] = x_new - dx * (1 - pr / r) rx[1] = y_new - dy * (1 - pr / r) rx[2] = z_new - dz * (1 - pr / r) return rx ``` 此代码需要以下输入: - `prn_list`:卫星 PRN 号的列表 - `pseudoranges`:伪距的列表 - `ephemerides`:卫星星历的字典,其中每个键是卫星 PRN 号,每个值是卫星星历的对象 此代码的输出是接收器的位置。请注意,这是一个简单的示例,可能需要进行更多的错误检查和修复。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 40
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值