From ec407f3bf29eca3271b428859b258b43222265c9 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 22 Nov 2021 19:59:14 +0100 Subject: Implement frame synchronization There is an issue somewhere between the mod and demod, since frame synchronization works on a direct path. --- tests/fadingui/QAM/qam_nogui.grc | 52 +++++++++++++++++++++++++----------- tests/fadingui/QAM/qam_nogui.py | 57 ++++------------------------------------ 2 files changed, 42 insertions(+), 67 deletions(-) (limited to 'tests') diff --git a/tests/fadingui/QAM/qam_nogui.grc b/tests/fadingui/QAM/qam_nogui.grc index c3d886e..78dc691 100644 --- a/tests/fadingui/QAM/qam_nogui.grc +++ b/tests/fadingui/QAM/qam_nogui.grc @@ -66,7 +66,7 @@ blocks: id: variable parameters: comment: '' - value: 10e-3 + value: '.002' states: bus_sink: false bus_source: false @@ -164,7 +164,7 @@ blocks: id: variable parameters: comment: '' - value: '.002' + value: '.01' states: bus_sink: false bus_source: false @@ -246,7 +246,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [2824, 312.0] + coordinate: [3056, 280.0] rotation: 0 state: true - name: blocks_throttle_0 @@ -268,6 +268,25 @@ blocks: coordinate: [720, 356.0] rotation: 0 state: enabled +- name: blocks_throttle_1 + id: blocks_throttle + parameters: + affinity: '' + alias: '' + comment: '' + ignoretag: 'True' + maxoutbuf: '0' + minoutbuf: '0' + samples_per_second: samp_rate + type: byte + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1448, 772.0] + rotation: 0 + state: disabled - name: channels_channel_model_0 id: channels_channel_model parameters: @@ -307,7 +326,7 @@ blocks: bus_structure: null coordinate: [1504, 284.0] rotation: 0 - state: true + state: enabled - name: digital_constellation_decoder_cb_0 id: digital_constellation_decoder_cb parameters: @@ -323,7 +342,7 @@ blocks: bus_structure: null coordinate: [2152, 276.0] rotation: 0 - state: true + state: enabled - name: digital_constellation_modulator_0 id: digital_constellation_modulator parameters: @@ -362,7 +381,7 @@ blocks: bus_structure: null coordinate: [1792, 280.0] rotation: 0 - state: true + state: enabled - name: digital_diff_decoder_bb_0 id: digital_diff_decoder_bb parameters: @@ -376,9 +395,9 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [2192, 348.0] - rotation: 180 - state: true + coordinate: [2408, 276.0] + rotation: 0 + state: enabled - name: digital_map_bb_0 id: digital_map_bb parameters: @@ -392,9 +411,9 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [2144, 452.0] + coordinate: [2304, 372.0] rotation: 0 - state: true + state: disabled - name: digital_pfb_clock_sync_xxx_0 id: digital_pfb_clock_sync_xxx parameters: @@ -417,7 +436,7 @@ blocks: bus_structure: null coordinate: [1184, 308.0] rotation: 0 - state: true + state: enabled - name: fadingui_datasource_0 id: fadingui_datasource parameters: @@ -463,7 +482,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [2592, 452.0] + coordinate: [2728, 276.0] rotation: 0 state: true - name: fadingui_xor_frame_sync_0 @@ -471,7 +490,7 @@ blocks: parameters: affinity: '' alias: '' - buffer_size: frame.length * 4 + buffer_size: frame.length * 5 comment: '' maxoutbuf: '0' minoutbuf: '0' @@ -480,7 +499,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [2312, 444.0] + coordinate: [2512, 364.0] rotation: 0 state: true - name: qtgui_const_sink_x_0 @@ -578,6 +597,7 @@ blocks: connections: - [blocks_throttle_0, '0', channels_channel_model_0, '0'] +- [blocks_throttle_1, '0', fadingui_xor_frame_sync_0, '0'] - [channels_channel_model_0, '0', digital_pfb_clock_sync_xxx_0, '0'] - [digital_cma_equalizer_cc_0, '0', digital_costas_loop_cc_0, '0'] - [digital_cma_equalizer_cc_0, '0', qtgui_const_sink_x_0, '1'] @@ -587,9 +607,11 @@ connections: - [digital_costas_loop_cc_0, '0', fadingui_dearpygui_sink_0, '0'] - [digital_costas_loop_cc_0, '0', qtgui_const_sink_x_0, '2'] - [digital_diff_decoder_bb_0, '0', digital_map_bb_0, '0'] +- [digital_diff_decoder_bb_0, '0', fadingui_xor_frame_sync_0, '0'] - [digital_map_bb_0, '0', fadingui_xor_frame_sync_0, '0'] - [digital_pfb_clock_sync_xxx_0, '0', digital_cma_equalizer_cc_0, '0'] - [digital_pfb_clock_sync_xxx_0, '0', qtgui_const_sink_x_0, '0'] +- [fadingui_datasource_0, '0', blocks_throttle_1, '0'] - [fadingui_datasource_0, '0', digital_constellation_modulator_0, '0'] - [fadingui_deframer_0, '0', blocks_null_sink_0, '0'] - [fadingui_xor_frame_sync_0, '0', fadingui_deframer_0, '0'] diff --git a/tests/fadingui/QAM/qam_nogui.py b/tests/fadingui/QAM/qam_nogui.py index 6cde63d..4116db5 100755 --- a/tests/fadingui/QAM/qam_nogui.py +++ b/tests/fadingui/QAM/qam_nogui.py @@ -21,9 +21,6 @@ if __name__ == '__main__': except: print("Warning: failed to XInitThreads()") -from PyQt5 import Qt -from gnuradio import qtgui -import sip from gnuradio import blocks from gnuradio import channels from gnuradio.filter import firdes @@ -31,6 +28,7 @@ from gnuradio import digital from gnuradio import gr import sys import signal +from PyQt5 import Qt from argparse import ArgumentParser from gnuradio.eng_arg import eng_float, intx from gnuradio import eng_notation @@ -81,64 +79,23 @@ class qam_nogui(gr.top_block, Qt.QWidget): self.time_offset = time_offset = 1 self.samp_rate = samp_rate = 32000 self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), excess_bw, 45*nfilts) - self.phase_bw = phase_bw = .002 + self.phase_bw = phase_bw = .01 self.noise_volt = noise_volt = 0 self.freq_offset = freq_offset = 0 self.frame = frame = fadingui.frame_obj(preamble=[190, 239], payload_len=32768) self.eq_ntaps = eq_ntaps = 15 self.eq_mod = eq_mod = 1 - self.eq_gain = eq_gain = 10e-3 + self.eq_gain = eq_gain = .002 self.const = const = digital.constellation_16qam().base() self.chn_taps = chn_taps = [1.0 + 0.0j, ] ################################################## # Blocks ################################################## - self.qtgui_const_sink_x_0 = qtgui.const_sink_c( - 1024, #size - "", #name - 3 #number of inputs - ) - self.qtgui_const_sink_x_0.set_update_time(0.10) - self.qtgui_const_sink_x_0.set_y_axis(-2, 2) - self.qtgui_const_sink_x_0.set_x_axis(-2, 2) - self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "") - self.qtgui_const_sink_x_0.enable_autoscale(False) - self.qtgui_const_sink_x_0.enable_grid(False) - self.qtgui_const_sink_x_0.enable_axis_labels(True) - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "red", "red", "red", - "red", "red", "red", "red", "red"] - styles = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - markers = [0, 0, 0, 0, 0, - 0, 0, 0, 0, 0] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in range(3): - if len(labels[i]) == 0: - self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_const_sink_x_0.set_line_label(i, labels[i]) - self.qtgui_const_sink_x_0.set_line_width(i, widths[i]) - self.qtgui_const_sink_x_0.set_line_color(i, colors[i]) - self.qtgui_const_sink_x_0.set_line_style(i, styles[i]) - self.qtgui_const_sink_x_0.set_line_marker(i, markers[i]) - self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i]) - - self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget) - self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win) - self.fadingui_xor_frame_sync_0 = fadingui.xor_frame_sync(sync_pattern=frame.preamble, buffer_size=frame.length * 4) + self.fadingui_xor_frame_sync_0 = fadingui.xor_frame_sync(sync_pattern=frame.preamble, buffer_size=frame.length * 5) self.fadingui_deframer_0 = fadingui.deframer(frame_obj=frame) self.fadingui_datasource_0 = fadingui.datasource(frame_obj=frame, filename='/home/god/Documents/Fading/tests/fadingui/QAM/lena512color.tiff') self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, 1) - self.digital_map_bb_0 = digital.map_bb([0, 1, 3, 2]) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(4) self.digital_costas_loop_cc_0 = digital.costas_loop_cc(phase_bw, 4, False) self.digital_constellation_modulator_0 = digital.generic_mod( @@ -169,15 +126,11 @@ class qam_nogui(gr.top_block, Qt.QWidget): self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.digital_cma_equalizer_cc_0, 0), (self.digital_costas_loop_cc_0, 0)) - self.connect((self.digital_cma_equalizer_cc_0, 0), (self.qtgui_const_sink_x_0, 1)) self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_constellation_decoder_cb_0, 0)) - self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_const_sink_x_0, 2)) - self.connect((self.digital_diff_decoder_bb_0, 0), (self.digital_map_bb_0, 0)) - self.connect((self.digital_map_bb_0, 0), (self.fadingui_xor_frame_sync_0, 0)) + self.connect((self.digital_diff_decoder_bb_0, 0), (self.fadingui_xor_frame_sync_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_cma_equalizer_cc_0, 0)) - self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.fadingui_datasource_0, 0), (self.digital_constellation_modulator_0, 0)) self.connect((self.fadingui_deframer_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.fadingui_xor_frame_sync_0, 0), (self.fadingui_deframer_0, 0)) -- cgit v1.2.1