def track(x, s, chan): n = len(x) fs = s.fs nco.mix(x, -s.carrier_f / fs, s.carrier_p) s.carrier_p = s.carrier_p - n * s.carrier_f / fs s.carrier_p = np.mod(s.carrier_p, 1) rf_carrier = 1602.0 + 0.5625 * chan scale_factor = rf_carrier / 0.511 cf = (s.code_f + s.carrier_f / scale_factor) / fs p_early = ca.correlate(x, 0, s.code_p - 0.5, cf, ca.ca_code()) p_prompt = ca.correlate(x, 0, s.code_p, cf, ca.ca_code()) p_late = ca.correlate(x, 0, s.code_p + 0.5, cf, ca.ca_code()) if s.mode == 'FLL_WIDE': fll_k = 2.0 a = p_prompt b = s.prompt1 e = discriminator.fll_atan(a, b) s.carrier_f = s.carrier_f + fll_k * e s.prompt1 = p_prompt elif s.mode == 'FLL_NARROW': fll_k = 0.5 a = p_prompt b = s.prompt1 e = discriminator.fll_atan(a, b) s.carrier_f = s.carrier_f + fll_k * e s.prompt1 = p_prompt elif s.mode == 'PLL': pll_k1 = 0.1 pll_k2 = 5 e = discriminator.pll_costas(p_prompt) e1 = s.carrier_e1 s.carrier_f = s.carrier_f + pll_k1 * e + pll_k2 * (e - e1) s.carrier_e1 = e # code loop dll_k1 = 0.00002 dll_k2 = 0.2 s.early = np.absolute(p_early) s.prompt = np.absolute(p_prompt) s.late = np.absolute(p_late) if (s.late + s.early) == 0: e = 0 else: e = (s.late - s.early) / (s.late + s.early) s.eml = e e1 = s.code_e1 s.code_f = s.code_f + dll_k1 * e + dll_k2 * (e - e1) s.code_e1 = e s.code_p = s.code_p + n * cf s.code_p = np.mod(s.code_p, ca.code_length) return p_prompt, s
def track(x,s): n = len(x) fs = s.fs nco.mix(x,-s.carrier_f/fs, s.carrier_p) s.carrier_p = s.carrier_p - n*s.carrier_f/fs s.carrier_p = np.mod(s.carrier_p,1) cf = (s.code_f+s.carrier_f/3135.0)/fs p_early = ca.correlate(x, 0, s.code_p-0.5, cf, ca.ca_code()) p_prompt = ca.correlate(x, 0, s.code_p, cf, ca.ca_code()) p_late = ca.correlate(x, 0, s.code_p+0.5, cf, ca.ca_code()) if s.mode=='FLL_WIDE': fll_k = 2.0 a = p_prompt b = s.prompt1 e = discriminator.fll_atan(a,b) s.carrier_f = s.carrier_f + fll_k*e s.prompt1 = p_prompt elif s.mode=='FLL_NARROW': fll_k = 0.5 a = p_prompt b = s.prompt1 e = discriminator.fll_atan(a,b) s.carrier_f = s.carrier_f + fll_k*e s.prompt1 = p_prompt elif s.mode=='PLL': pll_k1 = 0.1 pll_k2 = 5 e = discriminator.pll_costas(p_prompt) e1 = s.carrier_e1 s.carrier_f = s.carrier_f + pll_k1*e + pll_k2*(e-e1) s.carrier_e1 = e # code loop dll_k1 = 0.00002 dll_k2 = 0.2 s.early = np.absolute(p_early) s.prompt = np.absolute(p_prompt) s.late = np.absolute(p_late) if (s.late+s.early)==0: e = 0 else: e = (s.late-s.early)/(s.late+s.early) s.eml = e e1 = s.code_e1 s.code_f = s.code_f + dll_k1*e + dll_k2*(e-e1) s.code_e1 = e s.code_p = s.code_p + n*cf s.code_p = np.mod(s.code_p,ca.code_length) return p_prompt,s