Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge recent changes from devel branch #50

Merged
merged 4 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/cssrlib/ephemeris.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
RTOL_KEPLER = 1e-13

MAXDTOE_t = {uGNSS.GPS: 7201.0, uGNSS.GAL: 14400.0, uGNSS.QZS: 7201.0,
uGNSS.BDS: 21601.0, uGNSS.IRN: 7201.0, uGNSS.GLO: 1800.0,
uGNSS.BDS: 7201.0, uGNSS.IRN: 7201.0, uGNSS.GLO: 1800.0,
uGNSS.SBS: 360.0}


Expand Down Expand Up @@ -309,7 +309,6 @@ def satpos(sat, t, nav, cs=None, orb=None):

# Health indicator from BRDC
#

if sys == uGNSS.GLO and len(nav.geph) > 0:

geph = findeph(nav.geph, t, sat)
Expand Down Expand Up @@ -363,11 +362,10 @@ def satpos(sat, t, nav, cs=None, orb=None):

if cs.lc[0].iodc[sat] == cs.lc[0].iodc_c[sat]:
dclk = cs.lc[0].dclk[sat]
elif cs.lc[0].iodc[sat] == cs.lc[0].iodc_c_p[sat]:
dclk = cs.lc[0].dclk_p[sat]
else:
if cs.lc[0].iodc[sat] == cs.lc[0].iodc_c_p[sat]:
dclk = cs.lc[0].dclk_p[sat]
else:
return rs, vs, dts, svh
return rs, vs, dts, svh

else:

Expand All @@ -379,12 +377,12 @@ def satpos(sat, t, nav, cs=None, orb=None):
if cs.iodssr_c[sCType.CLOCK] == cs.iodssr:
if sat not in cs.sat_n:
return rs, vs, dts, svh
else:
if cs.iodssr_c[sCType.CLOCK] == cs.iodssr_p:
if sat not in cs.sat_n_p:
return rs, vs, dts, svh
else:

elif cs.iodssr_c[sCType.CLOCK] == cs.iodssr_p:
if sat not in cs.sat_n_p:
return rs, vs, dts, svh
else:
return rs, vs, dts, svh

dclk = cs.lc[0].dclk[sat]

Expand All @@ -400,6 +398,8 @@ def satpos(sat, t, nav, cs=None, orb=None):
if np.isnan(dclk) or np.isnan(dorb@dorb):
return rs, vs, dts, svh

# Select broadcast navigation type depending on GNSS type
#
mode = cs.nav_mode[sys]

else:
Expand Down
2 changes: 1 addition & 1 deletion src/cssrlib/pppssr.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def zdres(self, obs, cs, bsx, rs, vs, dts, rr, rtype=1):
elif sys == uGNSS.GLO:
sig0 = (rSigRnx("RC1C"), rSigRnx("RC2C"))
elif sys == uGNSS.GAL:
sig0 = (rSigRnx("EC1C"), rSigRnx("EC7Q"))
sig0 = (rSigRnx("EC1C"), rSigRnx("EC5Q"))
elif sys == uGNSS.QZS:
sig0 = (rSigRnx("JC1C"), rSigRnx("JC2S"))

Expand Down
16 changes: 13 additions & 3 deletions src/cssrlib/rawnav.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def decode_gal_inav(self, week, time, sat, type_, msg):
# 64:field1, 24:crc, 8:field2, 6:tail
# for E1B: field1: reserved1(40) + SAR(22)+spare(2), field2=SSP
# for E5b: field1: reserved1. field2 = reserved2
msg = bytes(msg)

odd, page = bs.unpack_from('u1u1', msg, 0)
sid, iodnav = bs.unpack_from('u6u10', msg, 2)

Expand Down Expand Up @@ -238,7 +238,7 @@ def decode_gal_fnav(self, week, time, sat, type_, msg):
sys, prn = sat2prn(sat)
eph = Eph(sat)
# 244bit => type(6) + svid(6) + iodnav(10) + body () + crc(24)+tail(6)
msg = bytes(msg)

sid, svid, iodnav = bs.unpack_from('u6u6u10', msg, 0)

if sid > 4:
Expand Down Expand Up @@ -331,6 +331,7 @@ def decode_gps_lnav(self, week, time, sat, msg):

sid = bs.unpack_from('u3', msg, 53)[0]
buff[(sid-1)*40:(sid-1)*40+40] = msg[0:40]
buff = bytes(buff)

id1 = bs.unpack_from('u3', buff, 53)[0]
id2 = bs.unpack_from('u3', buff, 320+53)[0]
Expand Down Expand Up @@ -474,6 +475,7 @@ def decode_gps_cnav(self, week, time, sat, msg):
elif sid == 15: # Text
None

buff = bytes(buff)
id1 = bs.unpack_from('u6', buff, 14)[0]
id2 = bs.unpack_from('u6', buff, 304+14)[0]
id3 = bs.unpack_from('u6', buff, 304*2+14)[0]
Expand Down Expand Up @@ -865,6 +867,7 @@ def decode_bds_b2a(self, week, time_, sat, msg):
for k in range(len(msg)):
buff[mid*40+k] = msg[k]

buff = bytes(buff)
id1, sow1 = bs.unpack_from('u6u18', buff, 6)
id2, sow2 = bs.unpack_from('u6u18', buff, 320+6)
id3, sow3 = bs.unpack_from('u6u18', buff, 320*2+6)
Expand Down Expand Up @@ -938,6 +941,7 @@ def decode_bds_b2b(self, week, time_, sat, msg, ofst=12):
for k in range(len(msg)):
buff[mid*64+k] = msg[k]

buff = bytes(buff)
id1, sow1 = bs.unpack_from('u6u20', buff, ofst)
id2, sow2 = bs.unpack_from('u6u20', buff, 512+ofst)
id3, sow3 = bs.unpack_from('u6u20', buff, 512*2+ofst)
Expand Down Expand Up @@ -993,6 +997,7 @@ def decode_bds_d1(self, week, time, sat, msg):
buff = self.bds_d12[prn-1]
buff[(sid-1)*40:(sid-1)*40+40] = msg[0:40]

buff = bytes(buff)
id1 = bs.unpack_from('u3', buff, 15)[0]
id2 = bs.unpack_from('u3', buff, 320+15)[0]
id3 = bs.unpack_from('u3', buff, 320*2+15)[0]
Expand Down Expand Up @@ -1085,6 +1090,7 @@ def decode_bds_d2(self, week, time, sat, msg):

sow_ = np.zeros(10, dtype=int)

buff = bytes(buff)
for k in range(10):
if k == 1:
continue
Expand Down Expand Up @@ -1200,6 +1206,7 @@ def decode_irn_lnav(self, week, time, sat, msg):
if sid > 2:
return None

buff = bytes(buff)
id1 = bs.unpack_from('u2', buff, 27)[0]
id2 = bs.unpack_from('u2', buff, 320+27)[0]

Expand Down Expand Up @@ -1286,12 +1293,13 @@ def decode_glo_fdma(self, week, time, sat, msg, freq=0):

if sid == 1: # when tk is updated, clear buffer
tk = bs.unpack_from('u12', msg, 9)[0]
tk_ = bs.unpack_from('u12', buff, 9)[0]
tk_ = bs.unpack_from('u12', bytes(buff), 9)[0]
if tk != tk_:
for sid_ in range(4):
buff[sid_*12:sid_*12+12] = bytearray(12)

buff[(sid-1)*12:(sid-1)*12+12] = msg[0:12]
buff = bytes(buff)

id1 = bs.unpack_from('u4', buff, 1)[0]
id2 = bs.unpack_from('u4', buff, 96+1)[0]
Expand Down Expand Up @@ -1576,6 +1584,8 @@ def init_param(self, opt: rcvOpt, prefix=''):
self.fh_galinav = open(prefix+self.file_galinav, mode='w')
if opt.flg_galfnav:
self.flg_galfnav = True
self.file_galfnav = "galfnav.txt"
self.fh_galfnav = open(prefix+self.file_galfnav, mode='w')
if opt.flg_bdsb1c:
self.flg_bdsb1c = True
if opt.flg_bdsb2a:
Expand Down