diff options
author | ptrkrysik <ptrkrysik@gmail.com> | 2014-11-06 14:47:33 +0100 |
---|---|---|
committer | ptrkrysik <ptrkrysik@gmail.com> | 2014-11-06 14:47:33 +0100 |
commit | dac3b2a3097894a062f9ff2b65d6ff2d5319adc6 (patch) | |
tree | a6e42d1583620de9e86a076572d72f9d3177a9f7 /python | |
parent | 486d97946acabbf5589b3163446fbe44c6a7a402 (diff) |
Added new block which adapts stream of samples to GSM receiver's input requirements (integer multiply of 1625000/6 symbol rate, LP filtering)
Diffstat (limited to 'python')
-rw-r--r-- | python/CMakeLists.txt | 1 | ||||
-rw-r--r-- | python/__init__.py | 2 | ||||
-rw-r--r-- | python/receiver/gsm_input.py | 84 |
3 files changed, 87 insertions, 0 deletions
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 68a6aa4..1689ee5 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -31,6 +31,7 @@ endif() GR_PYTHON_INSTALL( FILES __init__.py + receiver/gsm_input.py receiver/fcch_burst_tagger.py receiver/sch_detector.py receiver/fcch_detector.py diff --git a/python/__init__.py b/python/__init__.py index 3b10c19..326f54c 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -51,6 +51,8 @@ from sch_detector import sch_detector from fcch_detector import fcch_detector from clock_offset_control import clock_offset_control from clock_offset_corrector import clock_offset_corrector +from gsm_input import gsm_input + # diff --git a/python/receiver/gsm_input.py b/python/receiver/gsm_input.py new file mode 100644 index 0000000..e1a51b0 --- /dev/null +++ b/python/receiver/gsm_input.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +################################################## +# Gnuradio Python Flow Graph +# Title: GSM input adaptor +# Author: Piotr Krysik +# Description: Adaptor of input stream for the GSM receiver. Contains frequency ofset corrector doing also resampling to integer multiplies of GSM sample rate and LP filter filtering GSM channel. +# Generated: Thu Nov 6 14:41:06 2014 +################################################## + +from gnuradio import filter +from gnuradio import gr +from gnuradio.filter import firdes +import gsm + +class gsm_input(gr.hier_block2): + + def __init__(self, ppm=0, osr=4, fc=940e6, samp_rate_in=1e6): + gr.hier_block2.__init__( + self, "GSM input adaptor", + gr.io_signature(1, 1, gr.sizeof_gr_complex*1), + gr.io_signature(1, 1, gr.sizeof_gr_complex*1), + ) + + ################################################## + # Parameters + ################################################## + self.ppm = ppm + self.osr = osr + self.fc = fc + self.samp_rate_in = samp_rate_in + + ################################################## + # Blocks + ################################################## + self.ppm_in = None;self.message_port_register_hier_out("ppm_in") + self.low_pass_filter_0_0 = filter.fir_filter_ccf(1, firdes.low_pass( + 1, 1625000.0/6.0*osr, 125e3, 5e3, firdes.WIN_HAMMING, 6.76)) + self.gsm_clock_offset_corrector_0 = gsm.clock_offset_corrector( + fc=fc, + ppm=0, + samp_rate_in=samp_rate_in, + samp_rate_out=1625000.0/6.0*4.0, + ) + + ################################################## + # Connections + ################################################## + self.connect((self.low_pass_filter_0_0, 0), (self, 0)) + self.connect((self.gsm_clock_offset_corrector_0, 0), (self.low_pass_filter_0_0, 0)) + self.connect((self, 0), (self.gsm_clock_offset_corrector_0, 0)) + + ################################################## + # Asynch Message Connections + ################################################## + self.msg_connect(self, "ppm_in", self.gsm_clock_offset_corrector_0, "ppm_in") + + + def get_ppm(self): + return self.ppm + + def set_ppm(self, ppm): + self.ppm = ppm + + def get_osr(self): + return self.osr + + def set_osr(self, osr): + self.osr = osr + self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, 1625000.0/6.0*self.osr, 125e3, 5e3, firdes.WIN_HAMMING, 6.76)) + + def get_fc(self): + return self.fc + + def set_fc(self, fc): + self.fc = fc + self.gsm_clock_offset_corrector_0.set_fc(self.fc) + + 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.gsm_clock_offset_corrector_0.set_samp_rate_in(self.samp_rate_in) + |