Skip to content
This repository was archived by the owner on Apr 13, 2021. It is now read-only.

Commit b371610

Browse files
author
Adel Mamin
committed
Fix GLO changes to match profile switching logic changes
1 parent 93b8446 commit b371610

File tree

3 files changed

+61
-45
lines changed

3 files changed

+61
-45
lines changed

peregrine/defaults.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@
215215
'pll_bw': (20, 18, 16, 14, 12, 10, 8, 7, 6.5, 6, 5.5, 5),
216216
'coherent_ms': (20,) }
217217

218+
glol1_track_params = {
219+
'fll_bw': (2, 1, 0),
220+
'pll_bw': (40, 20, 18, 16, 14, 12, 10, 8, 7, 6.5, 6, 5.5, 5),
221+
'coherent_ms': (1,) }
222+
218223
l1ca_loop_filter_params_template = {
219224
'code_params': (1., 0.7, 1.), # NBW, zeta, k
220225
'carr_params': (20., 0.7, 1.), # NBW, zeta, k
@@ -231,6 +236,14 @@
231236
'carr_to_code': 1200. # carr_to_code
232237
}
233238

239+
glol1_loop_filter_params_template = {
240+
'code_params': (1., 0.7, 1.), # NBW, zeta, k
241+
'carr_params': (20., 0.7, 1.), # NBW, zeta, k
242+
'loop_freq': 1000., # 1000/coherent_ms
243+
'carr_freq_b1': 1., # FLL NBW
244+
'carr_to_code': 3135.0293542074364 # carr_to_code
245+
}
246+
234247
# Tracking stages. See track.c for more details.
235248
# 1;20 ms stages
236249
l1ca_stage_params_slow = \
@@ -372,7 +385,25 @@
372385
USE_COMPENSATED_BIT = 10
373386
PREPARE_BIT_COMPENSATION = 11
374387

375-
fsm_states = \
388+
glo_fsm_states = \
389+
{ '1ms':
390+
{ 'no_bit_sync':
391+
{ 'short_n_long':
392+
{ 0: (511, 1, {'pre': (APPLY_CORR_1,),
393+
'post': (RUN_LD, GET_CORR_1, ALIAS_DETECT_1ST)}),
394+
1: (511, 0, {'pre': (APPLY_CORR_2,),
395+
'post': (RUN_LD, GET_CORR_2, ALIAS_DETECT_2ND)}) },
396+
397+
'ideal':
398+
{ 0: (511, 1, {'pre': (APPLY_CORR_1,),
399+
'post': (RUN_LD, GET_CORR_1, ALIAS_DETECT_1ST)}),
400+
1: (511, 0, {'pre': (APPLY_CORR_1,),
401+
'post': (RUN_LD, GET_CORR_1, ALIAS_DETECT_2ND)}) }
402+
}
403+
}
404+
}
405+
406+
gps_fsm_states = \
376407
{ '1ms':
377408
{ 'no_bit_sync':
378409
{ 'short_n_long':
@@ -1257,6 +1288,8 @@
12571288
'lp': 50, # 1000ms worth of I/Q samples to reach pessimistic lock
12581289
'lo': 240} # 4800ms worth of I/Q samples to lower optimistic lock
12591290

1291+
glol1_lock_detect_params = l1ca_lock_detect_params_opt
1292+
12601293
# The time interval, over which the alias detection is done.
12611294
# The alias detect algorithm averages the phase angle over this time [ms]
12621295
alias_detect_interval_ms = 500

peregrine/tracking.py

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def _tracking_channel_factory(parameters):
128128
if parameters['acq'].signal == glo_constants.GLO_L1:
129129
return TrackingChannelGLOL1(parameters)
130130

131-
def get_fsm_states(ms, short_n_long, bit_sync):
131+
def get_fsm_states(fsm_states, ms, short_n_long, bit_sync):
132132
if ms == 1:
133133
ms = '1ms'
134134
elif ms == 2:
@@ -158,7 +158,7 @@ def get_fsm_states(ms, short_n_long, bit_sync):
158158
else:
159159
bit_sync_status = 'no_bit_sync'
160160

161-
return defaults.fsm_states[ms][bit_sync_status][mode]
161+
return fsm_states[ms][bit_sync_status][mode]
162162

163163

164164
def get_lock_detector(cur_bw, lock_detect_set):
@@ -244,7 +244,8 @@ def __init__(self, params):
244244

245245
self.track_settled = False
246246
self.fsm_index = 0
247-
self.fsm_states = get_fsm_states(ms=self.coherent_ms,
247+
self.fsm_states = get_fsm_states(self.fsm_states_all,
248+
ms=self.coherent_ms,
248249
short_n_long=self.short_n_long,
249250
bit_sync=self.bit_sync)
250251

@@ -408,7 +409,8 @@ def _set_track_profile(self):
408409
cutoff_freq=10,
409410
loop_freq=1e3 / self.coherent_ms)
410411

411-
self.fsm_states = get_fsm_states(ms=self.coherent_ms,
412+
self.fsm_states = get_fsm_states(self.fsm_states_all,
413+
ms=self.coherent_ms,
412414
short_n_long=self.short_n_long,
413415
bit_sync=self.bit_sync)
414416
self.fsm_index = 0
@@ -960,6 +962,7 @@ def __init__(self, params):
960962
params['chipping_rate'] = gps_constants.l1ca_chip_rate
961963
params['sample_index'] = params['samples']['sample_index']
962964
params['carrier_freq'] = gps_constants.l1
965+
params['fsm_states_all'] = defaults.gps_fsm_states
963966

964967
self.bit_sync = False
965968

@@ -1075,6 +1078,7 @@ def __init__(self, params):
10751078
params['chipping_rate'] = gps_constants.l2c_chip_rate
10761079
params['sample_index'] = 0
10771080
params['carrier_freq'] = gps_constants.l2
1081+
params['fsm_states_all'] = defaults.gps_fsm_states
10781082

10791083
self.bit_sync = True
10801084

@@ -1135,22 +1139,29 @@ def __init__(self, params):
11351139
GLO L1 tracking initialization parameters
11361140
11371141
"""
1142+
11381143
# Convert acquisition SNR to C/N0
11391144
cn0_0 = 10 * np.log10(params['acq'].snr)
11401145
cn0_0 += 10 * np.log10(defaults.GLOL1_CHANNEL_BANDWIDTH_HZ)
1146+
11411147
params['cn0_0'] = cn0_0
1142-
params['coherent_ms'] = 1
1143-
params['coherent_iter'] = 1
1144-
params['loop_filter_params'] = defaults.l1ca_stage1_loop_filter_params
1145-
params['lock_detect_params'] = defaults.l1ca_lock_detect_params_opt
11461148
params['IF'] = params['samples'][glo_constants.GLO_L1]['IF']
11471149
params['prn_code'] = GLOCode
11481150
params['code_freq_init'] = params['acq'].doppler * \
11491151
glo_constants.glo_chip_rate / glo_constants.glo_l1
1152+
1153+
params['track_params'] = defaults.glol1_track_params
1154+
params['loop_filter_params_template'] = \
1155+
defaults.glol1_loop_filter_params_template
1156+
1157+
params['lock_detect_params'] = defaults.glol1_lock_detect_params
11501158
params['chipping_rate'] = glo_constants.glo_chip_rate
1151-
params['sample_index'] = 0
1152-
params['alias_detector'] = \
1153-
alias_detector.AliasDetectorGLO(params['coherent_ms'])
1159+
params['sample_index'] = params['samples']['sample_index']
1160+
params['carrier_freq'] = glo_constants.glo_l1
1161+
1162+
params['fsm_states_all'] = defaults.glo_fsm_states
1163+
1164+
self.bit_sync = False
11541165

11551166
TrackingChannel.__init__(self, params)
11561167

@@ -1196,42 +1207,14 @@ def _run_preprocess(self):
11961207

11971208
self.coherent_iter = self.coherent_ms
11981209

1199-
def _short_n_long_preprocess(self):
1200-
if self.stage1:
1201-
self.E = self.P = self.L = 0.j
1202-
else:
1203-
# When simulating short and long cycles, short step resets EPL
1204-
# registers, and long one adds up to them
1205-
if self.short_step:
1206-
self.E = self.P = self.L = 0.j
1207-
self.coherent_iter = 1
1208-
else:
1209-
self.coherent_iter = self.coherent_ms - 1
1210-
1211-
self.code_chips_to_integrate = glo_constants.glo_code_len
1212-
1213-
return self.coherent_iter, self.code_chips_to_integrate
1214-
1215-
def _short_n_long_postprocess(self):
1216-
more_integration_needed = False
1217-
if not self.stage1:
1218-
if self.short_step:
1219-
# In case of short step - go to next integration period
1220-
self.short_step = False
1221-
more_integration_needed = True
1222-
else:
1223-
# Next step is short cycle
1224-
self.short_step = True
1225-
return more_integration_needed
1226-
1227-
def _run_postprocess(self):
1210+
def _run_nav_data_decoding(self):
12281211
"""
12291212
Run GLO L1 coherent integration postprocessing.
12301213
Runs navigation bit sync decoding operation and
12311214
GLO L1 to GLO L2 handover.
12321215
"""
12331216

1234-
# Handover to L2C if possible
1217+
# Handover to L2 if possible
12351218
if self.glol2_handover and not self.glol2_handover_acq and \
12361219
glo_constants.GLO_L2 in self.samples and \
12371220
'samples' in self.samples[glo_constants.GLO_L2]: # and sync:

tests/test_tracking.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def test_tracking_gps():
187187
run_track_test(samples, 0.6, init_doppler, init_code_phase, prn, file_format,
188188
freq_profile)
189189
run_track_test(samples, 0.3, init_doppler, init_code_phase, prn, file_format,
190-
freq_profile)
190+
freq_profile)
191191
run_track_test(samples, 0.3, init_doppler, init_code_phase, prn, file_format,
192192
freq_profile, short_long_cycles=True)
193193

@@ -253,9 +253,9 @@ def test_tracking_glo():
253253
run_track_test(samples, 0.6, init_doppler, init_code_phase, prn, file_format,
254254
freq_profile)
255255
run_track_test(samples, 0.3, init_doppler, init_code_phase, prn, file_format,
256-
freq_profile, pipelining=0.5)
256+
freq_profile)
257257
run_track_test(samples, 0.3, init_doppler, init_code_phase, prn, file_format,
258-
freq_profile, short_long_cycles=0.5)
258+
freq_profile, short_long_cycles=True)
259259

260260
os.remove(samples)
261261

0 commit comments

Comments
 (0)