自定义块问题GNU RADIO

时间:2017-10-25 17:39:27

标签: python usrp gnuradio-companion

我在GNU Radio中的流程图遇到了一些问题。我构建了一个自定义块作为延迟块,因为本机块对我的应用程序不起作用。在我的自定义块之前有一个UHD源。它的采样率为4M。但是,当我开始模拟时,它会产生溢出(“O”)。我觉得这很奇怪,因为当我在文件中保存UHD源的输出然后在“离线”模式下再次播放模拟时,没有溢出错误。换句话说,当我在“在线”模式下工作时,我遇到了问题。只有当我使用UHD Source而不是之前由UHD Source保存的文件时。

enter image description here

Delay_amostra_sync块码:

import numpy

来自gnuradio import gr

class Delay_amostra_sync(gr.sync_block):     “””     用于块Delay_amostra_sync的docstring     “””     def init (self,var):         gr.sync_block。的初始化(个体,             NAME = “Delay_amostra_sync”             in_sig = [numpy.complex64]             OUT_SIG = [numpy.complex64])         self.var = var         self.cont = 0
        self.buffer = numpy.array([])
        self.c = 1

def work(self, input_items, output_items):
    in0 = input_items[0]
    out = output_items[0]

    self.dados = numpy.array(input_items[0], copy=True)

    self.buffer = numpy.append(self.buffer, self.dados)      

    if self.cont >= self.var:                         
        out[:] = self.buffer[range(0,len(out))]
        self.buffer = numpy.delete(self.buffer, range(0,len(out)), 0)            
    self.cont = self.cont + 1

返回len(output_items [0])

0 个答案:

没有答案