Exemplo n.º 1
0
    def process(self,event):
        self.fData = open(self.data_t.GetValue(),'rb')
        self.fData.seek(0,2)
        end = self.fData.tell()
        total_sfn = (end-8)/(8064)
        self.sfn.SetValue(str(total_sfn))
        self.fData.seek(0,0)
        x = np.fromfile ( self.fData , dtype = np.int32 , count = 2 )
        self.cell_id = x[0];
        self.prb_count = x[1];
        self.id_cell_t.SetValue(str(x[0]))
        self.bandwidth_t.SetValue(str(x[1]))

        len_sf = self.prb_count*12*14;
        sfn_start = int(self.sfn_start.GetValue())
        N = int(self.sfn_total.GetValue())

        self.dl_subframe_demapper = lte_sat.dl_subframe_demapper(int(self.RNTI.GetValue()))
        self.dl_subframe_demapper.set_cell_id(int(self.cell_id))
        self.dl_subframe_demapper.set_rb_count(int(self.prb_count))

        """ Reconstruct the original complex array """
        self.fData = open(self.data_t.GetValue(),'rb')
        self.fData.seek(sfn_start*len_sf*2*4+8)
        print self.fData.tell()
        y = np.fromfile ( self.fData , dtype = np.complex64 , count = len_sf*N)

        wfc = np.zeros ( [ N*len_sf ] , dtype = np.complex )
        for i in range(len(y)):
            wfc[i] = y[i]

        self.dl_subframe_demapper.demux(wfc, (sfn_start%10))
        self.fData.close();
Exemplo n.º 2
0
    def process(self, event):
        self.fData = open(self.data_t.GetValue(), 'rb')
        self.fData.seek(0, 2)
        end = self.fData.tell()
        total_sfn = (end - 8) / (8064)
        self.sfn.SetValue(str(total_sfn))
        self.fData.seek(0, 0)
        x = np.fromfile(self.fData, dtype=np.int32, count=2)
        self.cell_id = x[0]
        self.prb_count = x[1]
        self.id_cell_t.SetValue(str(x[0]))
        self.bandwidth_t.SetValue(str(x[1]))

        len_sf = self.prb_count * 12 * 14
        sfn_start = int(self.sfn_start.GetValue())
        N = int(self.sfn_total.GetValue())

        self.dl_subframe_demapper = lte_sat.dl_subframe_demapper(
            int(self.RNTI.GetValue()))
        self.dl_subframe_demapper.set_cell_id(int(self.cell_id))
        self.dl_subframe_demapper.set_rb_count(int(self.prb_count))
        """ Reconstruct the original complex array """
        self.fData = open(self.data_t.GetValue(), 'rb')
        self.fData.seek(sfn_start * len_sf * 2 * 4 + 8)
        print self.fData.tell()
        y = np.fromfile(self.fData, dtype=np.complex64, count=len_sf * N)

        wfc = np.zeros([N * len_sf], dtype=np.complex)
        for i in range(len(y)):
            wfc[i] = y[i]

        self.dl_subframe_demapper.demux(wfc, (sfn_start % 10))
        self.fData.close()
Exemplo n.º 3
0
    def __init__(self, **param):
        gr.top_block.__init__(self, "Dl Recv")

        ##################################################
        # Variables
        ##################################################
        try:
            if param['Bandwidth'] == '1.4':
                self.prbl = prbl = 6
                self.fftl = fftl = 128
                self.multiply_const = multiply_const = 128.0
            else:
                self.prbl = prbl = 15
                self.fftl = fftl = 256
                self.multiply_const = multiply_const = 256.0

            if param['samp_rate_T'] == '2M':
                self.samp_rate = samp_rate = 2000000
            else:
                self.samp_rate = samp_rate = 4000000

            self.threshold = threshold = float(param['Threshold'])
            self.gain = gain = int(param['gain_r_T'])
            self.RNTI_A = RNTI_A = int(param['RNTI_A'])
            self.sacle_0 = sacle_0 = 1024
            self.sacle = sacle = 1024
        except:
            print '变量初始化失败'

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0 = uhd.usrp_source(
            device_addr="addr=192.168.10.2",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(2.0e7, 0)
        self.uhd_usrp_source_0.set_gain(gain, 0)
        self.lte_sat_layer2_ue_0 = lte_sat.layer2_ue(RNTI_A)
        self.lte_sat_dl_subframe_demapper_0 = lte_sat.dl_subframe_demapper(
            RNTI_A)
        self.lte_sat_dl_baseband_sync_0 = lte_sat.dl_baseband_sync(threshold)
        self.blocks_tagged_stream_to_pdu_0_0 = blocks.tagged_stream_to_pdu(
            blocks.byte_t, "packet_len")
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(
            blocks.byte_t, "packet_len")
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_char * 1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc(
            (multiply_const, ))
        self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1024)
        self.audio_sink_0_0 = audio.sink(48000, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_null_source_0, 0),
                     (self.blocks_tagged_stream_to_pdu_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 0),
                     (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.lte_sat_dl_subframe_demapper_0, 0),
                     (self.lte_sat_layer2_ue_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0),
                     (self.blocks_char_to_float_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0),
                     (self.lte_sat_dl_baseband_sync_0, 0))
        self.connect((self.blocks_char_to_float_0_0, 0),
                     (self.audio_sink_0_0, 0))
        self.connect((self.lte_sat_dl_baseband_sync_0, 0),
                     (self.lte_sat_dl_subframe_demapper_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.lte_sat_dl_baseband_sync_0, "sys_info",
                         self.lte_sat_dl_subframe_demapper_0, "sys_info")
        self.msg_connect(self.lte_sat_layer2_ue_0, "sdus",
                         self.blocks_pdu_to_tagged_stream_0, "pdus")
        self.msg_connect(self.blocks_tagged_stream_to_pdu_0_0, "pdus",
                         self.lte_sat_layer2_ue_0, "pdus")
        self.msg_connect(self.lte_sat_dl_subframe_demapper_0, "usg",
                         self.lte_sat_layer2_ue_0, "usg")
Exemplo n.º 4
0
    def __init__(self,**param):
        gr.top_block.__init__(self, "Dl Recv")

        ##################################################
        # Variables
        ##################################################
        try:
            if param['Bandwidth'] == '1.4':
                self.prbl = prbl = 6
                self.fftl = fftl = 128
                self.multiply_const = multiply_const = 128.0
            else:
                self.prbl = prbl = 15
                self.fftl = fftl = 256
                self.multiply_const = multiply_const = 256.0

            if param['samp_rate_T'] == '2M':
                self.samp_rate = samp_rate = 2000000
            else:
                self.samp_rate = samp_rate = 4000000 

            self.threshold = threshold = float(param['Threshold'])
            self.gain = gain = int(param['gain_r_T'])
            self.RNTI_A = RNTI_A = int(param['RNTI_A'])
            self.sacle_0 = sacle_0 = 1024
            self.sacle = sacle = 1024
        except: print '变量初始化失败'

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0 = uhd.usrp_source(
            device_addr="addr=192.168.10.2",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(2.0e7, 0)
        self.uhd_usrp_source_0.set_gain(gain, 0)
        self.lte_sat_layer2_ue_0 = lte_sat.layer2_ue(RNTI_A)
        self.lte_sat_dl_subframe_demapper_0 = lte_sat.dl_subframe_demapper(RNTI_A)
        self.lte_sat_dl_baseband_sync_0 = lte_sat.dl_baseband_sync(threshold)
        self.blocks_tagged_stream_to_pdu_0_0 = blocks.tagged_stream_to_pdu(blocks.byte_t, "packet_len")
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, "packet_len")
        self.blocks_null_source_0 = blocks.null_source(gr.sizeof_char*1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((multiply_const, ))
        self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1024)
        self.audio_sink_0_0 = audio.sink(48000, "", True)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_null_source_0, 0), (self.blocks_tagged_stream_to_pdu_0_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.lte_sat_dl_subframe_demapper_0, 0), (self.lte_sat_layer2_ue_0, 0))
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_char_to_float_0_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.lte_sat_dl_baseband_sync_0, 0))
        self.connect((self.blocks_char_to_float_0_0, 0), (self.audio_sink_0_0, 0))
        self.connect((self.lte_sat_dl_baseband_sync_0, 0), (self.lte_sat_dl_subframe_demapper_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.lte_sat_dl_baseband_sync_0, "sys_info", self.lte_sat_dl_subframe_demapper_0, "sys_info")
        self.msg_connect(self.lte_sat_layer2_ue_0, "sdus", self.blocks_pdu_to_tagged_stream_0, "pdus")
        self.msg_connect(self.blocks_tagged_stream_to_pdu_0_0, "pdus", self.lte_sat_layer2_ue_0, "pdus")
        self.msg_connect(self.lte_sat_dl_subframe_demapper_0, "usg", self.lte_sat_layer2_ue_0, "usg")
Exemplo n.º 5
0
    def __init__(self,**param):
        gr.top_block.__init__(self, "Ue Ping")

        ##################################################
        # Variables
        ##################################################
        try:
            if param['Bandwidth'] == '1.4':
                self.prbl = prbl = 6
                self.fftl = fftl = 128
                self.multiply_const = multiply_const = 128.0
            else:
                self.prbl = prbl = 15
                self.fftl = fftl = 256
                self.multiply_const = multiply_const = 256.0

            if param['samp_rate_T'] == '2M':
                self.samp_rate = samp_rate = 2000000
            else:
                self.samp_rate = samp_rate = 4000000 

            self.threshold = threshold = float(param['Threshold'])
            self.gain_r = gain_r = int(param['gain_r_T'])
            self.gain_s = gain_s = int(param['gain_s_T'])
            self.RNTI_A = RNTI_A = int(param['RNTI_A'])
            self.sacle_0 = sacle_0 = 1024
            self.sacle = sacle = 1024
        except: print '变量初始化失败'

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0 = uhd.usrp_source(
            device_addr="addr=192.168.10.2",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(4e6)
        self.uhd_usrp_source_0.set_center_freq(900e6, 0)
        self.uhd_usrp_source_0.set_gain(gain_r, 0)
        self.uhd_usrp_source_0.set_bandwidth(1.5e6, 0)
        self.uhd_usrp_sink_0 = uhd.usrp_sink(
            device_addr="addr=192.168.10.2",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_sink_0.set_samp_rate(4e6)
        self.uhd_usrp_sink_0.set_center_freq(1e9, 0)
        self.uhd_usrp_sink_0.set_gain(gain_s, 0)
        self.uhd_usrp_sink_0.set_bandwidth(1.5e6, 0)
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=25,
                decimation=24,
                taps=None,
                fractional_bw=None,
        )
        self.lte_sat_ul_subframe_mapper_0 = lte_sat.ul_subframe_mapper()
        self.lte_sat_ul_baseband_generator_0 = lte_sat.ul_baseband_generator()
        self.lte_sat_layer2_ue_0 = lte_sat.layer2_ue(RNTI_A,False)
        self.lte_sat_dl_subframe_demapper_0 = lte_sat.dl_subframe_demapper(RNTI_A)
        self.lte_sat_dl_baseband_sync_0 = lte_sat.dl_baseband_sync(threshold)
        self.blocks_tuntap_pdu_1 = blocks.tuntap_pdu("tun1", 10000)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((1.0, ))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.rational_resampler_xxx_0, 0), (self.uhd_usrp_sink_0, 0))
        self.connect((self.lte_sat_ul_baseband_generator_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.lte_sat_ul_subframe_mapper_0, 0), (self.lte_sat_ul_baseband_generator_0, 0))
        self.connect((self.lte_sat_dl_baseband_sync_0, 0), (self.lte_sat_dl_subframe_demapper_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_const_vxx_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.lte_sat_dl_baseband_sync_0, 0))
        self.connect((self.lte_sat_dl_subframe_demapper_0, 0), (self.lte_sat_layer2_ue_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.blocks_tuntap_pdu_1, "pdus", self.lte_sat_layer2_ue_0, "pdus")
        self.msg_connect(self.lte_sat_layer2_ue_0, "sdus", self.blocks_tuntap_pdu_1, "pdus")
        self.msg_connect(self.lte_sat_layer2_ue_0, "sched_from_l2", self.lte_sat_ul_subframe_mapper_0, "sched_from_l2")
        self.msg_connect(self.lte_sat_dl_baseband_sync_0, "sys_info", self.lte_sat_dl_subframe_demapper_0, "sys_info")
        self.msg_connect(self.lte_sat_dl_subframe_demapper_0, "usg", self.lte_sat_layer2_ue_0, "usg")
        self.msg_connect(self.lte_sat_dl_baseband_sync_0, "sys_info", self.lte_sat_ul_subframe_mapper_0, "sys_info")
        self.msg_connect(self.lte_sat_dl_baseband_sync_0, "sys_info", self.lte_sat_ul_baseband_generator_0, "sys_info")
Exemplo n.º 6
0
    def __init__(self,**param):
        gr.top_block.__init__(self, "Dl Ber Test Recv")

        ##################################################
        # Variables
        ##################################################
        try:
            if param['Bandwidth'] == '1.4':
                self.prbl = prbl = 6
                self.fftl = fftl = 128
                self.multiply_const = multiply_const = 128.0
            else:
                self.prbl = prbl = 15
                self.fftl = fftl = 256
                self.multiply_const = multiply_const = 256.0

            if param['samp_rate_T'] == '2M':
                self.samp_rate = samp_rate = 2000000
            else:
                self.samp_rate = samp_rate = 4000000 

            if param['data_rules_T'] == '规则递增':
                self.data_type = data_type = 0
            else:
                self.data_type = data_type = 1

            self.threshold = threshold = float(param['Threshold'])
            self.gain = gain = int(param['gain_r_T'])
            self.RNTI_A = RNTI_A = int(param['RNTI_A'])
        except: print '变量初始化失败'

        ##################################################
        # Blocks
        ##################################################
        self.uhd_usrp_source_0 = uhd.usrp_source(
            device_addr="addr=192.168.10.2",
            stream_args=uhd.stream_args(
                cpu_format="fc32",
                channels=range(1),
            ),
        )
        self.uhd_usrp_source_0.set_samp_rate(samp_rate)
        self.uhd_usrp_source_0.set_center_freq(9.0e8, 0)
        self.uhd_usrp_source_0.set_gain(gain, 0)
        self.lte_sat_dl_subframe_demapper_0 = lte_sat.dl_subframe_demapper(RNTI_A)
        self.lte_sat_dl_baseband_sync_0 = lte_sat.dl_baseband_sync(threshold)
        self.lte_sat_DL_mac_receive_0 = lte_sat.DL_mac_receive(data_type)
        self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, "packet_len")
        self.blocks_null_sink_0_0 = blocks.null_sink(gr.sizeof_char*1)
        self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((multiply_const, ))

        ##################################################
        # Connections
        ##################################################
        self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_null_sink_0_0, 0))
        self.connect((self.lte_sat_dl_subframe_demapper_0, 0), (self.lte_sat_DL_mac_receive_0, 0))
        self.connect((self.blocks_multiply_const_vxx_0, 0), (self.lte_sat_dl_baseband_sync_0, 0))
        self.connect((self.lte_sat_dl_baseband_sync_0, 0), (self.lte_sat_dl_subframe_demapper_0, 0))
        self.connect((self.uhd_usrp_source_0, 0), (self.blocks_multiply_const_vxx_0, 0))

        ##################################################
        # Asynch Message Connections
        ##################################################
        self.msg_connect(self.lte_sat_dl_subframe_demapper_0, "usg", self.blocks_pdu_to_tagged_stream_0, "pdus")
        self.msg_connect(self.lte_sat_dl_baseband_sync_0, "sys_info", self.lte_sat_dl_subframe_demapper_0, "sys_info")