diff options
author | Piotr Krysik <ptrkrysik@gmail.com> | 2016-07-17 22:48:35 +0200 |
---|---|---|
committer | Piotr Krysik <ptrkrysik@gmail.com> | 2016-07-17 22:48:35 +0200 |
commit | 83afe7390fadd13cb8636ac4da1bafb9a73a5521 (patch) | |
tree | 5ac105f23da8880f433a343fd4721844c3d0cc1c /python/misc_utils | |
parent | a94adb186438498dcc6513cc68d8f2ee4155e6f5 (diff) |
Changed clock offset controller and company in order to remove from the gsm_input one of the resamplers.
Diffstat (limited to 'python/misc_utils')
-rw-r--r-- | python/misc_utils/clock_offset_corrector_tagged.py | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/python/misc_utils/clock_offset_corrector_tagged.py b/python/misc_utils/clock_offset_corrector_tagged.py index 4f2045c..a3e2b0a 100644 --- a/python/misc_utils/clock_offset_corrector_tagged.py +++ b/python/misc_utils/clock_offset_corrector_tagged.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph -# Title: Clock offset corrector tagged +# Title: Clock Offset Corrector Tagged # Author: Piotr Krysik # Description: Clock offset corrector with blocks that use tags to switch offsets -# Generated: Sun Jul 17 11:30:51 2016 +# Generated: Sun Jul 17 22:03:13 2016 ################################################## from gnuradio import gr @@ -15,9 +15,9 @@ import math class clock_offset_corrector_tagged(grgsm.hier_block): - def __init__(self, fc=936.6e6, ppm=0, samp_rate_in=1625000.0/6.0*4.0): + def __init__(self, fc=936.6e6, osr=4, ppm=0, samp_rate_in=1625000.0/6.0*4.0): gr.hier_block2.__init__( - self, "Clock offset corrector tagged", + self, "Clock Offset Corrector Tagged", gr.io_signature(1, 1, gr.sizeof_gr_complex*1), gr.io_signature(1, 1, gr.sizeof_gr_complex*1), ) @@ -27,20 +27,22 @@ class clock_offset_corrector_tagged(grgsm.hier_block): # Parameters ################################################## self.fc = fc + self.osr = osr self.ppm = ppm self.samp_rate_in = samp_rate_in ################################################## # Variables ################################################## - self.samp_rate_out = samp_rate_out = samp_rate_in + self.gsm_symb_rate = gsm_symb_rate = 1625000.0/6.0 + self.samp_rate_out = samp_rate_out = osr*gsm_symb_rate ################################################## # Blocks ################################################## self.gsm_msg_to_tag_0 = grgsm.msg_to_tag() - self.gsm_controlled_rotator_cc_0 = grgsm.controlled_rotator_cc(ppm/1.0e6*2*math.pi*fc/samp_rate_in,samp_rate_out) - self.gsm_controlled_fractional_resampler_cc_0 = grgsm.controlled_fractional_resampler_cc(0, 1.0) + self.gsm_controlled_rotator_cc_0 = grgsm.controlled_rotator_cc(ppm/1.0e6*2*math.pi*fc/samp_rate_out) + self.gsm_controlled_fractional_resampler_cc_0 = grgsm.controlled_fractional_resampler_cc(0, samp_rate_in/samp_rate_out) ################################################## # Connections @@ -56,26 +58,40 @@ class clock_offset_corrector_tagged(grgsm.hier_block): def set_fc(self, fc): self.fc = fc - self.gsm_controlled_rotator_cc_0.set_phase_inc(self.ppm/1.0e6*2*math.pi*self.fc/self.samp_rate_in) + self.gsm_controlled_rotator_cc_0.set_phase_inc(self.ppm/1.0e6*2*math.pi*self.fc/self.samp_rate_out) + + def get_osr(self): + return self.osr + + def set_osr(self, osr): + self.osr = osr + self.set_samp_rate_out(self.osr*self.gsm_symb_rate) def get_ppm(self): return self.ppm def set_ppm(self, ppm): self.ppm = ppm - self.gsm_controlled_rotator_cc_0.set_phase_inc(self.ppm/1.0e6*2*math.pi*self.fc/self.samp_rate_in) + self.gsm_controlled_rotator_cc_0.set_phase_inc(self.ppm/1.0e6*2*math.pi*self.fc/self.samp_rate_out) def get_samp_rate_in(self): return self.samp_rate_in def set_samp_rate_in(self, samp_rate_in): self.samp_rate_in = samp_rate_in - self.set_samp_rate_out(self.samp_rate_in) - self.gsm_controlled_rotator_cc_0.set_phase_inc(self.ppm/1.0e6*2*math.pi*self.fc/self.samp_rate_in) + self.gsm_controlled_fractional_resampler_cc_0.set_resamp_ratio(self.samp_rate_in/self.samp_rate_out) + + def get_gsm_symb_rate(self): + return self.gsm_symb_rate + + def set_gsm_symb_rate(self, gsm_symb_rate): + self.gsm_symb_rate = gsm_symb_rate + self.set_samp_rate_out(self.osr*self.gsm_symb_rate) def get_samp_rate_out(self): return self.samp_rate_out def set_samp_rate_out(self, samp_rate_out): self.samp_rate_out = samp_rate_out - self.gsm_controlled_rotator_cc_0.set_samp_rate(self.samp_rate_out) + self.gsm_controlled_fractional_resampler_cc_0.set_resamp_ratio(self.samp_rate_in/self.samp_rate_out) + self.gsm_controlled_rotator_cc_0.set_phase_inc(self.ppm/1.0e6*2*math.pi*self.fc/self.samp_rate_out) |