Я работаю над проектом GRC и в настоящее время занимаюсь созданием пользовательского блока Vector Source.Я хочу, чтобы этот векторный источник сбрасывал генерацию тегов каждый раз, когда он получает «1» от зонда.Последовательность, сгенерированная Vector Source, представляет собой 128-битный псевдо-кодекс.image1 в приложении показывает пользовательский блок Hier, который генерирует «Vector_Genator_C.py».Я подумываю об изменении Vector_Genator_C.py для включения сигнала зонда в оператор if и игры с.stop, .wait и.stop, но я, честно говоря, не знаю, как это сделать.Ввод зонда показан на изображении 2, сгенерированная последовательность на изображении 3 и желаемый результат в файле image4.
Vector_Genator_C.py:
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Vector_Genator_C
# Author: zaki
# Description: zzz
# Generated: Tue Dec 11 10:49:22 2018
##################################################
from gnuradio import blocks
from gnuradio import gr
from gnuradio.filter import firdes
import threading
import time
class Vector_Genator_C(gr.hier_block2):
def __init__(self, parameter_0=0):
gr.hier_block2.__init__(
self, "Vector_Genator_C",
gr.io_signature(1, 1, gr.sizeof_char*1),
gr.io_signature(1, 1, gr.sizeof_gr_complex*1),
)
##################################################
# Parameters
##################################################
self.parameter_0 = parameter_0
##################################################
# Variables
##################################################
self.samp_rate = samp_rate = 75e3
self.probe_control = probe_control = 0
##################################################
# Blocks
##################################################
def _probe_control_probe():
while True:
val = self.bloc_probe_control.level()
try:
self.set_probe_control(val)
except AttributeError:
pass
time.sleep(1.0 / (2e6))
_probe_control_thread = threading.Thread(target=_probe_control_probe)
_probe_control_thread.daemon = True
_probe_control_thread.start()
self.blocks_vector_source_x_0 = blocks.vector_source_c(parameter_0, True, 1, [])
self.bloc_probe_control = blocks.probe_signal_b()
##################################################
# Connections
##################################################
self.connect((self.blocks_vector_source_x_0, 0), (self, 0))
self.connect((self, 0), (self.bloc_probe_control, 0))
def get_parameter_0(self):
return self.parameter_0
def set_parameter_0(self, parameter_0):
self.parameter_0 = parameter_0
self.blocks_vector_source_x_0.set_data(self.parameter_0, [])
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
def get_probe_control(self):
return self.probe_control
def set_probe_control(self, probe_control):
self.probe_control = probe_control
Большое спасибо заранее !!Zak