def set_channel_num(self, channel_num): self.channel_num = channel_num self.blocks_file_sink_0.open("" + self.out_directory + "/fc_" + str(self.channel_num) + ".cfile") self.blocks_rotator_cc_0.set_phase_inc( -2 * math.pi * (arfcn.get_freq_from_arfcn(self.channel_num, 'e') - self.fc + self.f_offset) / self.samp_rate)
def __init__(self, channel_num=22, decim=50, directory="./", f_offset=0, fc=947.4e6, out_directory="./", samp_rate=25e6): gr.top_block.__init__(self, "Get Channel") ################################################## # Parameters ################################################## self.channel_num = channel_num self.decim = decim self.directory = directory self.f_offset = f_offset self.fc = fc self.out_directory = out_directory self.samp_rate = samp_rate ################################################## # Variables ################################################## self.SDCCH = SDCCH = 6 self.RACH = RACH = 3 self.PCH = PCH = 5 self.CHANNEL_UNKNOWN = CHANNEL_UNKNOWN = 0 self.CCCH = CCCH = 2 self.BCCH = BCCH = 1 self.AGCH = AGCH = 4 ################################################## # Blocks ################################################## self.pfb_decimator_ccf_0 = pfb.decimator_ccf( decim, (), 0, 100, True, True) self.pfb_decimator_ccf_0.declare_sample_delay(0) self.blocks_rotator_cc_0 = blocks.rotator_cc(-2*math.pi*(arfcn.get_freq_from_arfcn(channel_num,'e')-fc+f_offset)/samp_rate) self.blocks_interleaved_short_to_complex_1 = blocks.interleaved_short_to_complex(False, False) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_short*1, "/home/piotr/Odbiornik_gsm/Hopping/test_data/nagranie_hopping_4", False) self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_gr_complex*1, ""+out_directory+"/fc_"+ str(channel_num) +".cfile", False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.blocks_interleaved_short_to_complex_1, 0)) self.connect((self.blocks_interleaved_short_to_complex_1, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.pfb_decimator_ccf_0, 0)) self.connect((self.pfb_decimator_ccf_0, 0), (self.blocks_file_sink_0, 0))
def set_f_offset(self, f_offset): self.f_offset = f_offset self.blocks_rotator_cc_0.set_phase_inc(-2*math.pi*(arfcn.get_freq_from_arfcn(self.channel_num,'e')-self.fc+self.f_offset)/self.samp_rate)
def set_channel_num(self, channel_num): self.channel_num = channel_num self.blocks_file_sink_0.open(""+self.out_directory+"/fc_"+ str(self.channel_num) +".cfile") self.blocks_rotator_cc_0.set_phase_inc(-2*math.pi*(arfcn.get_freq_from_arfcn(self.channel_num,'e')-self.fc+self.f_offset)/self.samp_rate)
def __init__(self, channel_num=22, decim=50, directory="./", f_offset=0, fc=947.4e6, out_directory="./", samp_rate=25e6): gr.top_block.__init__(self, "Get Channel") ################################################## # Parameters ################################################## self.channel_num = channel_num self.decim = decim self.directory = directory self.f_offset = f_offset self.fc = fc self.out_directory = out_directory self.samp_rate = samp_rate ################################################## # Variables ################################################## self.SDCCH = SDCCH = 6 self.RACH = RACH = 3 self.PCH = PCH = 5 self.CHANNEL_UNKNOWN = CHANNEL_UNKNOWN = 0 self.CCCH = CCCH = 2 self.BCCH = BCCH = 1 self.AGCH = AGCH = 4 ################################################## # Blocks ################################################## self.pfb_decimator_ccf_0 = pfb.decimator_ccf(decim, (), 0, 100, True, True) self.pfb_decimator_ccf_0.declare_sample_delay(0) self.blocks_rotator_cc_0 = blocks.rotator_cc( -2 * math.pi * (arfcn.get_freq_from_arfcn(channel_num, 'e') - fc + f_offset) / samp_rate) self.blocks_interleaved_short_to_complex_1 = blocks.interleaved_short_to_complex( False, False) self.blocks_file_source_0 = blocks.file_source( gr.sizeof_short * 1, "/home/piotr/Odbiornik_gsm/Hopping/test_data/nagranie_hopping_4", False) self.blocks_file_sink_0 = blocks.file_sink( gr.sizeof_gr_complex * 1, "" + out_directory + "/fc_" + str(channel_num) + ".cfile", False) self.blocks_file_sink_0.set_unbuffered(False) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.blocks_interleaved_short_to_complex_1, 0)) self.connect((self.blocks_interleaved_short_to_complex_1, 0), (self.blocks_rotator_cc_0, 0)) self.connect((self.blocks_rotator_cc_0, 0), (self.pfb_decimator_ccf_0, 0)) self.connect((self.pfb_decimator_ccf_0, 0), (self.blocks_file_sink_0, 0))
def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.blocks_rotator_cc_0.set_phase_inc( -2 * math.pi * (arfcn.get_freq_from_arfcn(self.channel_num, 'e') - self.fc + self.f_offset) / self.samp_rate)