8000 Revised modules using new RINEXv3 signal class by AndreHauschild · Pull Request #4 · hirokawa/cssrlib · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Revised modules using new RINEXv3 signal class #4

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

Merged
merged 113 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
b41cc6e
Extract receiver and antenna type from RINEX OBS header
Mar 2, 2023
e72126b
Fix return values in peph2pos for invalid position/clock offsets
Mar 2, 2023
181d237
Draft implementation of receiver PCO/PCV extraction from ANTEX
Mar 2, 2023
c9e9a28
Added comments
Mar 2, 2023
5a50d7b
Draft implementation using SP3 and Bias-SINEX
Mar 2, 2023
601be03
Reduce debugging output
Mar 2, 2023
279c633
Eliminate dependency on SSR data
Mar 3, 2023
c655e99
Change plot labels and time axis
Mar 7, 2023
403fda5
Add missing display of skyplot
Mar 7, 2023
ced3509
Convert receiver and antenna name to uppercase
Mar 7, 2023
3c9c6c9
Fix unit of biases
Mar 7, 2023
a12011a
Extended signal list
AndreHauschild Mar 13, 2023
70108e5
Add time conversion to string
Mar 23, 2023
fd568cf
Major revision of ANTEX test
Mar 23, 2023
d012fef
Add meteo function to make model parameters accessible
Mar 23, 2023
549967c
Merge branch 'hirokawa:main' into main
AndreHauschild Apr 3, 2023
b89d957
Merge branch 'hirokawa:main' into rnxv3codes
AndreHauschild Apr 3, 2023
d038c59
New class for RINEX observation codes
Apr 3, 2023
f3ad4d0
Add char2gns conversion
Apr 3, 2023
fd7d91e
Fix time2str conversion
Apr 3, 2023
aa42a58
Temporary local implementation of rSIG until new SigRnx class is used
Apr 3, 2023
08f9382
Use rRnxSig in Bias-SINEX decoder
Apr 3, 2023
59a8403
Use rSigRnx in Bias-SINEX decoder test
Apr 3, 2023
e9006f6
Changed format of comments
Apr 13, 2023
31ebf76
Use new signal class for Bias-SINEX test
Apr 13, 2023
6fa4e1c
Fix typo
AndreHauschild Apr 13, 2023
5804b3e
Add conversion to signal and frequency
AndreHauschild Apr 13, 2023
e7fdc21
Fix problem with string conversion
AndreHauschild Apr 14, 2023
1a2d2f6
Remove unused data structures
AndreHauschild Apr 14, 2023
380cac4
First attempt of RINEX module (untested)
AndreHauschild Apr 14, 2023
2110036
Build RINEX data structures dynamically
Apr 17, 2023
c230e4d
Replace empty observation string with zero
Apr 18, 2023
0dc07cb
Fix parser for RINEX NAV
Apr 18, 2023
c2da589
Add conversion for IRNSS and SBAS satellites
Apr 19, 2023
fc16e90
Add hash function in rSigRnx
Apr 19, 2023
8589af2
Rename gns to sys, add sys2char
Apr 19, 2023
239d826
Major modificaton of ANTEX decoder
Apr 19, 2023
1c9eec8
Remove obsolete frequency definitions
Apr 20, 2023
f32039b
Fix variable name for frequency
Apr 20, 2023
c7a9e26
Revision of constructor
Apr 20, 2023
88de84b
Fix conversion from string
Apr 20, 2023
87fc18f
Add __repr__, toTyp and toAtt
Apr 20, 2023
55a73d5
Use new rSigRnx constructor
Apr 20, 2023
8d7c015
Use new rSigRnx constructors and methods
Apr 20, 2023
a3331b9
Add additional tests to constructor
Apr 20, 2023
803c2ab
Add test scripts
Apr 20, 2023
b176cd7
Fix signal extraction
Apr 20, 2023
f6bf312
Use new constructor
Apr 20, 2023
33e2458
Combine two test scripts
Apr 20, 2023
d46cb9c
Add comments
Apr 21, 2023
d127b22
Move antenna models to p_eph module
Apr 21, 2023
8663234
Add more tests
Apr 21, 2023
14f7691
Decode ANTENNA: DELTA H/E/N from header
Apr 21, 2023
2110efe
Extract "TIME OF FIRST OBS" and "TIME OF LAST OBS" from header
Apr 21, 2023
f2908cf
Add check for valid tracking attribute
Apr 24, 2023
5c595e6
Removed unused variable dazi from pcv_t
Apr 25, 2023
dbde30c
Add enu2xyz() conversion
Apr 25, 2023
0f44356
Revised transmitting and receiving antenna model
Apr 25, 2023
01a909a
Add new test script
Apr 25, 2023
b4df781
Revert to commit prior to dictionary structure
AndreHauschild May 11, 2023
92046a4
Restore empty lists in constructor of Obs()
AndreHauschild May 11, 2023
1eb6ba3
Use 0.0 instead of None for invalid observations
AndreHauschild May 11, 2023
683de91
Store signal table in Obs() structure
AndreHauschild May 11, 2023
f0dbe7d
Partial adaption to new data structures
AndreHauschild May 11, 2023
a015872
Use np.int32 for satellite list
May 12, 2023
cca47c1
First running version (not yet working)
May 12, 2023
0d6a9c5
Eliminate dependency on nav.gnss_t
May 12, 2023
12f0bde
Eliminate whitespace
May 12, 2023
7b9c49e
Add sys2str()
May 15, 2023
e83cf77
Remove obsolete data structures
May 16, 2023
37af23d
Preliminary version
May 16, 2023
593db28
Replace loglevel with monlevel
May 16, 2023
1f321ff
Add installation instructions for development version
AndreHauschild May 16, 2023
540d786
Add link to cssrlib-data repository
AndreHauschild May 16, 2023
ff56183
Merge branch 'new_sig' into main
AndreHauschild May 16, 2023
db60746
Merge pull request #2 from AndreHauschild/main
AndreHauschild May 16, 2023
bc5f2ad
Added simplified Hopfield model
May 17, 2023
89715ca
Add comments
May 23, 2023
9552310
Adapted to new RINEX and ANTEX module
May 24, 2023
dafd735
Adapted to new RINEX module
May 24, 2023
c76786b
Eliminate nav.gnss_t
May 24, 2023
20b4745
Eliminate nav.gnss_t
May 24, 2023
722ddb9
Correct signals for pseudorange antenna offsets
May 24, 2023
6445649
Use independent antenna corrections for pseudorange and carrier-phase
May 24, 2023
3c164da
Major update
May 26, 2023
b7bf327
Include phase wind-up
May 30, 2023
404fb04
Catch missing observations in iono delay initialization
May 30, 2023
af7eb09
Fix typo
May 31, 2023
2cf0a28
Changed index functions
May 31, 2023
b5fb0fe
Initialize pmode
May 31, 2023
d4ef788
Changed state prediction
May 31, 2023
4ec392c
Use IB from rtk module
Jun 1, 2023
4a5da55
User varerr from rtk
Jun 1, 2023
1397738
Use yaw attitude model in phase wind-up computation
Jun 1, 2023
dd32ba3
Restore original tropospheric model
Jun 1, 2023
0e86ff1
Remove obsolete MAXSAT
Jun 2, 2023
de7fb38
Remove obsolete nav.ratio
Jun 2, 2023
b66f561
Remove obsolete nav.neb
Jun 2, 2023
6ba4192
Remove obsolete nav.nfix
Jun 2, 2023
4fc1d53
Revised observation noise and process noise settings
Jun 2, 2023
783fe18
Changed prn <--> sat conversion
Jun 2, 2023
5b247ef
Add comments
Jun 2, 2023
a092649
Re-ordered rtkinit function
Jun 2, 2023
f481708
Remove obsolete logging file
Jun 6, 2023
774c0a0
Replace np.int with np.int32 for windows compatibility
Jun 7, 2023
587f806
Reduce debugging output
Jun 7, 2023
e59ceeb
Skip epochs without observations
Jun 7, 2023
fd37804
Make slant iono state uncorrelated in time
Jun 7, 2023
df0d0d0
Merge branch 'new_sig' into pr-3
Jun 12, 2023
712c219
Removed obsolete model import
Jun 12, 2023
65da0de
Fix comment
Jun 12, 2023
4c29cec
Fix comment
Jun 12, 2023
cc9bc10
Merge pull request #4 from AndreHauschild/pr-3
AndreHauschild Jun 12, 2023
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
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
CSSRlib - Toolkit for PPP-RTK/RTK in Python using Compact SSR
*************************

# What is CSSRlib?
# What is CSSRlib?

CSSRLIB is a open toolkit in Python for high accuracy GNSS positioning. It supports SSR (State-Space Representation) based potitioning such as PPP (Precise Point Positioning) or PPP-RTK (Realtime Kinematic), but also supporting RTK. The goal of the CSSRlib toolkit is to provide an easy-to-understand open implementation to learn PPP/PPP-RTK positioning provided by satellite-based open PPP/PPP-RTK services such as QZSS CLAS, Galileo HAS, BeiDou 3 PPP. It also supports ground based open service by IGS. The code is based on RTKlib.

Expand All @@ -17,10 +17,9 @@ Prerequisites
Additional python packages are required as prerequisites and can be installed via the following commands

```
pip install bitstruct
pip install cbitstruct
pip install galois
pip install cartopy
pip install bitstruct, cbitstruct
pip install galois, cartopy
pip install notebook, numpy, matplotlib
```

If the installation of `cartopy` fails, try installing `libgeos++-dev` first.
Expand All @@ -31,19 +30,21 @@ sudo apt-get install libgeos++-dev

Install
=======
You can install CSSRlib using pip.

You can install the official version of CSSRlib using pip

```
pip install cssrlib
```

additional python packages are required as prerequisites and can be installed via the following commands:
If you want to install the development version from this repository, first clone or download the sources and then run

```
pip install notebook, numpy, matplotlib
pip install bitstruct,cbitstruct,galois,cartopy
pip install .
```

in the root directory, where the ``setup.cfg`` file is located.

Testing
=======

Expand All @@ -59,7 +60,7 @@ Run RTK sample.
python test_rtk.py
```

Other samples are also available in a separate repository `cssrlib-data` including :
Other samples are also available in a separate repository [`cssrlib-data`](https://github.com/hirokawa/cssrlib-data) including :

- Galileo-HAS decoder
- BDS-PPP decoder
Expand Down
2 changes: 1 addition & 1 deletion src/cssrlib/ephemeris.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def satposs(obs, nav, cs=None):
for i in range(n):
sat = obs.sat[i]
sys, _ = sat2prn(sat)
if sys not in nav.gnss_t:
if sys not in obs.sig.keys():
continue
pr = obs.P[i, 0]
t = timeadd(obs.t, -pr/rCST.CLIGHT)
Expand Down
F438
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,18 @@ class rCST():

class uGNSS(IntEnum):
""" class for GNS systems """

NONE = -1

GPS = 0
SBS = 1
GAL = 2
GAL = 1
QZS = 2
BDS = 3
QZS = 5
GLO = 6
IRN = 7
GLO = 4
SBS = 5
IRN = 6

GNSSMAX = 8
GNSSMAX = 7

GPSMAX = 32
GALMAX = 36
Expand All @@ -87,7 +88,15 @@ class uGNSS(IntEnum):
SBSMAX = 24
IRNMAX = 10

MAXSAT = GPSMAX+GLOMAX+GALMAX+BDSMAX+QZSMAX+SBSMAX+IRNMAX
GPSMIN = 0
GALMIN = GPSMIN+GPSMAX
QZSMIN = GALMIN+GALMAX
BDSMIN = QZSMIN+QZSMAX
GLOMIN = BDSMIN+BDSMAX
SBSMIN = GLOMIN+GLOMAX
IRNMIN = SBSMIN+SBSMAX

MAXSAT = GPSMAX+GALMAX+QZSMAX+BDSMAX+GLOMAX+SBSMAX+IRNMAX


class uTYP(IntEnum):
Expand All @@ -100,8 +109,10 @@ class uTYP(IntEnum):
D = 3
S = 4


class uSIG(IntEnum):
""" class for signal band and attribute """

NONE = -1

# GPS L1 1575.42 MHz
Expand Down Expand Up @@ -502,14 +513,13 @@ class Obs():
""" class to define the observation """

def __init__(self):
self.nm = 0
self.t = gtime_t()
self.P = []
self.L = []
self.S = []
self.lli = []
self.data = []
self.sat = []
self.sig = {}


class Eph():
Expand Down Expand Up @@ -561,24 +571,23 @@ def __init__(self):
[0.1167E+06, -0.2294E+06, -0.1311E+06, 0.1049E+07]])
self.elmin = np.deg2rad(15.0)
self.tidecorr = False
self.nf = 2
######## START OBSOLETE ################################################
self.nf = 2 # TODO: make this obsolte if possible
######## END OBSOLETE ################################################
self.ne = 0
self.nc = 0
self.excl_sat = []
self.freq = [1.57542e9, 1.22760e9, # L1,L2
1.17645e9, 1.20714e9] # L5/E5a/B2a,E5b/B2b
self.excl_sat = [] # Excluded satellites
self.rb = [0, 0, 0] # base station position in ECEF [m]
self.smode = 0 # position mode 0:NONE,1:std,2:DGPS,4:fix,5:float
self.gnss_t = [uGNSS.GPS, uGNSS.GAL, uGNSS.QZS]
self.loglevel = 1
self.pmode = 1 # 0: static, 1: kinematic

self.monlevel = 1
self.cnr_min = 35
self.maxout = 5 # maximum outage [epoch]

self.sat_ant = None
self.rcv_ant = None
self.rcv_ant_b = None
self.sig_tab = None
self.sig_tab_b = None

# SSR correction placeholder
self.dorb = np.zeros(uGNSS.MAXSAT)
Expand All @@ -588,9 +597,13 @@ def __init__(self):

# satellite observation status
self.fix = np.zeros((uGNSS.MAXSAT, self.nf), dtype=int)
# Measurement outage indicator
self.outc = np.zeros((uGNSS.MAXSAT, self.nf), dtype=int)
# Carrier-phase processed indicator
self.vsat = np.zeros((uGNSS.MAXSAT, self.nf), dtype=int)
# ??? set but not used
self.lock = np.zeros((uGNSS.MAXSAT, self.nf), dtype=int)
# ??? not used
self.slip = np.zeros((uGNSS.MAXSAT, self.nf), dtype=int)

self.tt = 0
Expand Down Expand Up @@ -711,50 +724,51 @@ def time2str(t):
return "{:04d}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}"\
.format(e[0], e[1], e[2], e[3], e[4], int(e[5]))


def prn2sat(sys, prn):
""" convert sys+prn to sat """
if sys == uGNSS.GPS:
sat = prn
elif sys == uGNSS.GLO:
sat = prn+uGNSS.GPSMAX
elif sys == uGNSS.GAL:
sat = prn+uGNSS.GPSMAX+uGNSS.GLOMAX
elif sys == uGNSS.BDS:
sat = prn+uGNSS.GPSMAX+uGNSS.GLOMAX+uGNSS.GALMAX
sat = prn+uGNSS.GALMIN
elif sys == uGNSS.QZS:
sat = prn-192+uGNSS.GPSMAX+uGNSS.GLOMAX+uGNSS.GALMAX+uGNSS.BDSMAX
sat = prn-192+uGNSS.QZSMIN
elif sys == uGNSS.GLO:
sat = prn+uGNSS.GLOMIN
elif sys == uGNSS.BDS:
sat = prn+uGNSS.BDSMIN
elif sys == uGNSS.SBS:
sat = prn-100+uGNSS.GPSMAX+uGNSS.GLOMAX+uGNSS.GALMAX+uGNSS.BDSMAX+uGNSS.QZSMAX
sat = prn-100+uGNSS.SBSMIN
elif sys == uGNSS.IRN:
sat = prn+uGNSS.GPSMAX+uGNSS.GLOMAX+uGNSS.GALMAX + \
uGNSS.BDSMAX+uGNSS.QZSMAX+uGNSS.SBSMAX
sat = prn+uGNSS.IRNMIN
else:
sat = 0
return sat


def sat2prn(sat):
""" convert sat to sys+prn """
if sat > uGNSS.GPSMAX+uGNSS.GLOMAX+uGNSS.GALMAX+uGNSS.BDSMAX+uGNSS.QZSMAX+uGNSS.SBSMAX:
prn = sat-(uGNSS.GPSMAX+uGNSS.GLOMAX+uGNSS.GALMAX +
uGNSS.BDSMAX+uGNSS.QZSMAX+uGNSS.SBSMAX)
if sat > uGNSS.MAXSAT:
prn = 0
sys = uGNSS.NONE
elif sat > uGNSS.IRNMIN:
prn = sat-uGNSS.IRNMIN
sys = uGNSS.IRN
elif sat > uGNSS.GPSMAX+uGNSS.GLOMAX+uGNSS.GALMAX+uGNSS.BDSMAX+uGNSS.QZSMAX:
prn = sat-(uGNSS.GPSMAX+uGNSS.GLOMAX+uGNSS.GALMAX +
uGNSS.BDSMAX+uGNSS.QZSMAX)+100
elif sat > uGNSS.SBSMIN:
prn = sat+100-uGNSS.SBSMIN
sys = uGNSS.SBS
elif sat > uGNSS.GPSMAX+uGNSS.GLOMAX+uGNSS.GALMAX+uGNSS.BDSMAX:
prn = sat-(uGNSS.GPSMAX+uGNSS.GLOMAX+uGNSS.GALMAX+uGNSS.BDSMAX)+192
sys = uGNSS.QZS
elif sat > uGNSS.GPSMAX+uGNSS.GLOMAX+uGNSS.GALMAX:
prn = sat-(uGNSS.GPSMAX+uGNSS.GLOMAX+uGNSS.GALMAX)
elif sat > uGNSS.BDSMIN:
prn = sat-uGNSS.BDSMIN
sys = uGNSS.BDS
elif sat > uGNSS.GPSMAX+uGNSS.GLOMAX:
prn = sat-(uGNSS.GPSMAX+uGNSS.GLOMAX)
sys = uGNSS.GAL
elif sat > uGNSS.GPSMAX:
prn = sat-uGNSS.GPSMAX
elif sat > uGNSS.GLOMIN:
prn = sat-uGNSS.GLOMIN
sys = uGNSS.GLO
elif sat > uGNSS.QZSMIN:
prn = sat+192+uGNSS.QZSMIN
sys = uGNSS.QZS
elif sat > uGNSS.GALMIN:
prn = sat-uGNSS.GALMIN
sys = uGNSS.GAL
else:
prn = sat
sys = uGNSS.GPS
Expand Down Expand Up @@ -789,6 +803,7 @@ def id2sat(id_):
sat = prn2sat(sys, prn)
return sat


def char2sys(c):
""" convert character to GNSS """
gnss_tbl = {'G': uGNSS.GPS, 'R': uGNSS.GLO, 'E': uGNSS.GAL, 'C': uGNSS.BDS,
Expand All @@ -801,7 +816,7 @@ def char2sys(c):


def sys2char(sys):
""" convert character to GNSS """
""" convert GNSS to character """
gnss_tbl = {uGNSS.GPS: 'G', uGNSS.GLO: 'R', uGNSS.GAL: 'E', uGNSS.BDS: 'C',
uGNSS.QZS: 'J', uGNSS.SBS: 'S', uGNSS.IRN: 'I'}

Expand All @@ -811,6 +826,18 @@ def sys2char(sys):
return gnss_tbl[sys]


def sys2str(sys):
""" convert GNSS to string """
gnss_tbl = {uGNSS.GPS: 'GPS', uGNSS.GLO: 'GLONASS',
uGNSS.GAL: 'GALILEO', uGNSS.BDS: 'BEIDOU',
uGNSS.QZS: 'QZSS', uGNSS.SBS: 'SBAS', uGNSS.IRN: 'IRNSS'}

if sys not in gnss_tbl:
return "???"
else:
return gnss_tbl[sys]


def vnorm(r):
""" calculate norm of a vector """
return r/np.linalg.norm(r)
Expand Down Expand Up @@ -903,6 +930,8 @@ def xyz2enu(pos):
def enu2xyz(pos):
""" return ENU to ECEF conversion matrix from LLH """
return np.array(np.matrix(xyz2enu(pos)).I)


def ecef2pos(r):
""" ECEF to LLH position conversion """
e2 = rCST.FE_WGS84*(2-rCST.FE_WGS84)
Expand Down Expand Up @@ -1066,3 +1095,37 @@ def tropmodel(t, pos, el=np.pi/2, humi=0.7):
trop_hs = 0.0022768*pres/(1.0-0.00266*np.cos(2*pos[0])-0.00028e-3*hgt)
trop_wet = 0.002277*(1255.0/temp+0.05)*e
return trop_hs, trop_wet, z


def meteoHpf():
"""
Hopfield atmosphere model
"""
pres = 1010.0
temp = 291.1
e = 10.4
return pres, temp, e


def tropmapfHpf(el):
"""
Tropospheric mapping functions for Hopfield model
"""

mapfh = 1.0/(np.sin(np.sqrt(el**2+(np.pi/72.0)**2)))
mapfw = 1.0/(np.sin(np.sqrt(el**2+(np.pi/120.0)**2)))

return mapfh, mapfw


def tropmodelHpf():
"""
Hopfield tropospheric delay model
"""
# standard atmosphere for Hopfield model
pres, temp, e = meteoHpf()
# Hopfield
trop_dry = (77.6e-6 * (-613.3768/temp+148.98)*pres)/5.0
trop_wet = (77.6e-6 * 11000.0 * 4810.0 * e/temp**2)/5.0

return trop_dry, trop_wet
16 changes: 10 additions & 6 deletions src/cssrlib/peph.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from cssrlib.rinex import rnxdec
import numpy as np
from math import pow, sin, cos
import gzip


NMAX = 10
MAXDTE = 900.0
Expand Down Expand Up @@ -460,25 +460,27 @@ def readpcv(self, fname):
def searchpcv(pcvs, name, time):
""" get satellite or receiver antenna pcv """

if isinstance(name, int):
if isinstance(name, str):

for pcv in pcvs:
if pcv.sat != name:
if pcv.type != name:
continue
if pcv.ts.time != 0 and timediff(pcv.ts, time) > 0.0:
continue
if pcv.te.time != 0 and timediff(pcv.te, time) < 0.0:
continue
return pcv

else:

for pcv in pcvs:
if pcv.type != name:
if pcv.sat != name:
continue
if pcv.ts.time != 0 and timediff(pcv.ts, time) > 0.0:
continue
if pcv.te.time != 0 and timediff(pcv.te, time) < 0.0:
continue
return pcv
return None

return None

Expand Down Expand Up @@ -644,10 +646,12 @@ def antModelTx(nav, e, sigs, sat, time, rs):
# Select satellite antenna
#
ant = searchpcv(nav.sat_ant, sat, time)
if ant is None:
return None

# Zenit angle and zenit angle grid
#
za = np.rad2deg(np.arccos(np.dot(ez,-e)))
za = np.rad2deg(np.arccos(np.dot(ez, -e)))
za_t = np.arange(ant.zen[0], ant.zen[1]+ant.zen[2], ant.zen[2])

# Interpolate PCV and map PCO on line-of-sight vector
Expand Down
Loading
0