From be900003711c01ef03df99026c5afc79e8ab037b Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Wed, 3 Nov 2021 16:51:53 +0100 Subject: Replace QPKS bit visualizations with eye diagrams --- hardware/QPSK/qpks.py | 199 ++++++++++++++++++++++++++-------------------- hardware/QPSK/qpsk.grc | 209 +++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 314 insertions(+), 94 deletions(-) (limited to 'hardware/QPSK') diff --git a/hardware/QPSK/qpks.py b/hardware/QPSK/qpks.py index aa9b943..f89ac12 100755 --- a/hardware/QPSK/qpks.py +++ b/hardware/QPSK/qpks.py @@ -166,7 +166,7 @@ class qpks(gr.top_block, Qt.QWidget): ) self.uhd_usrp_sink_0.set_clock_source('external', 0) self.uhd_usrp_sink_0.set_center_freq(2.4e9, 0) - self.uhd_usrp_sink_0.set_normalized_gain(0.3, 0) + self.uhd_usrp_sink_0.set_normalized_gain(0.35, 0) self.uhd_usrp_sink_0.set_antenna('TX/RX', 0) self.uhd_usrp_sink_0.set_samp_rate(samp_rate) self.uhd_usrp_sink_0.set_time_unknown_pps(uhd.time_spec()) @@ -278,88 +278,6 @@ class qpks(gr.top_block, Qt.QWidget): self.plots_grid_layout_2.setRowStretch(r, 1) for c in range(0, 1): self.plots_grid_layout_2.setColumnStretch(c, 1) - self.qtgui_time_raster_sink_x_0 = qtgui.time_raster_sink_b( - samp_rate, - 256, - 256, - [], - [], - "", - 1 - ) - - self.qtgui_time_raster_sink_x_0.set_update_time(0.10) - self.qtgui_time_raster_sink_x_0.set_intensity_range(-1, 1) - self.qtgui_time_raster_sink_x_0.enable_grid(False) - self.qtgui_time_raster_sink_x_0.enable_axis_labels(True) - - labels = ['', '', '', '', '', - '', '', '', '', ''] - colors = [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(1): - if len(labels[i]) == 0: - self.qtgui_time_raster_sink_x_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_time_raster_sink_x_0.set_line_label(i, labels[i]) - self.qtgui_time_raster_sink_x_0.set_color_map(i, colors[i]) - self.qtgui_time_raster_sink_x_0.set_line_alpha(i, alphas[i]) - - self._qtgui_time_raster_sink_x_0_win = sip.wrapinstance(self.qtgui_time_raster_sink_x_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_3.addWidget(self._qtgui_time_raster_sink_x_0_win, 1, 0, 1, 1) - for r in range(1, 2): - self.plots_grid_layout_3.setRowStretch(r, 1) - for c in range(0, 1): - self.plots_grid_layout_3.setColumnStretch(c, 1) - self.qtgui_histogram_sink_x_0 = qtgui.histogram_sink_f( - 1024*4, - 20, - -1, - 1, - "Sent", - 1 - ) - - self.qtgui_histogram_sink_x_0.set_update_time(0.10) - self.qtgui_histogram_sink_x_0.enable_autoscale(True) - self.qtgui_histogram_sink_x_0.enable_accumulate(False) - self.qtgui_histogram_sink_x_0.enable_grid(False) - self.qtgui_histogram_sink_x_0.enable_axis_labels(True) - - - labels = ['', '', '', '', '', - '', '', '', '', ''] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "dark blue"] - styles = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - markers= [-1, -1, -1, -1, -1, - -1, -1, -1, -1, -1] - 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(1): - if len(labels[i]) == 0: - self.qtgui_histogram_sink_x_0.set_line_label(i, "Data {0}".format(i)) - else: - self.qtgui_histogram_sink_x_0.set_line_label(i, labels[i]) - self.qtgui_histogram_sink_x_0.set_line_width(i, widths[i]) - self.qtgui_histogram_sink_x_0.set_line_color(i, colors[i]) - self.qtgui_histogram_sink_x_0.set_line_style(i, styles[i]) - self.qtgui_histogram_sink_x_0.set_line_marker(i, markers[i]) - self.qtgui_histogram_sink_x_0.set_line_alpha(i, alphas[i]) - - self._qtgui_histogram_sink_x_0_win = sip.wrapinstance(self.qtgui_histogram_sink_x_0.pyqwidget(), Qt.QWidget) - self.plots_grid_layout_3.addWidget(self._qtgui_histogram_sink_x_0_win, 0, 0, 1, 1) - for r in range(0, 1): - self.plots_grid_layout_3.setRowStretch(r, 1) - for c in range(0, 1): - self.plots_grid_layout_3.setColumnStretch(c, 1) self.qtgui_freq_sink_x_1_0_1_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype @@ -580,6 +498,110 @@ class qpks(gr.top_block, Qt.QWidget): self.plots_grid_layout_1.setRowStretch(r, 1) for c in range(0, 1): self.plots_grid_layout_1.setColumnStretch(c, 1) + self.qtgui_eye_sink_x_1 = qtgui.eye_sink_c( + 1024, #size + samp_rate, #samp_rate + "", #name + 1 #number of inputs + ) + self.qtgui_eye_sink_x_1.set_update_time(0.10) + self.qtgui_eye_sink_x_1.set_samp_per_symbol(sps) + self.qtgui_eye_sink_x_1.set_y_axis(-1, 1) + + self.qtgui_eye_sink_x_1.set_y_label('Amplitude', "") + + self.qtgui_eye_sink_x_1.enable_tags(True) + self.qtgui_eye_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") + self.qtgui_eye_sink_x_1.enable_autoscale(False) + self.qtgui_eye_sink_x_1.enable_grid(False) + self.qtgui_eye_sink_x_1.enable_axis_labels(True) + self.qtgui_eye_sink_x_1.enable_control_panel(False) + + + labels = ['Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', + 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'] + widths = [1, 1, 1, 1, 1, + 1, 1, 1, 1, 1] + colors = ['blue', 'blue', 'blue', 'blue', 'blue', + 'blue', 'blue', 'blue', 'blue', 'blue'] + alphas = [1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0] + styles = [1, 1, 1, 1, 1, + 1, 1, 1, 1, 1] + markers = [-1, -1, -1, -1, -1, + -1, -1, -1, -1, -1] + + + for i in range(2): + if len(labels[i]) == 0: + if (i % 2 == 0): + self.qtgui_eye_sink_x_1.set_line_label(i, "Eye [Re{{Data {0}}}]".format(round(i/2))) + else: + self.qtgui_eye_sink_x_1.set_line_label(i, "Eye [Im{{Data {0}}}]".format(round((i-1)/2))) + else: + self.qtgui_eye_sink_x_1.set_line_label(i, labels[i]) + self.qtgui_eye_sink_x_1.set_line_width(i, widths[i]) + self.qtgui_eye_sink_x_1.set_line_color(i, colors[i]) + self.qtgui_eye_sink_x_1.set_line_style(i, styles[i]) + self.qtgui_eye_sink_x_1.set_line_marker(i, markers[i]) + self.qtgui_eye_sink_x_1.set_line_alpha(i, alphas[i]) + + self._qtgui_eye_sink_x_1_win = sip.wrapinstance(self.qtgui_eye_sink_x_1.pyqwidget(), Qt.QWidget) + self.plots_grid_layout_3.addWidget(self._qtgui_eye_sink_x_1_win, 1, 0, 1, 1) + for r in range(1, 2): + self.plots_grid_layout_3.setRowStretch(r, 1) + for c in range(0, 1): + self.plots_grid_layout_3.setColumnStretch(c, 1) + self.qtgui_eye_sink_x_0 = qtgui.eye_sink_c( + 1024, #size + samp_rate, #samp_rate + "", #name + 1 #number of inputs + ) + self.qtgui_eye_sink_x_0.set_update_time(0.10) + self.qtgui_eye_sink_x_0.set_samp_per_symbol(sps) + self.qtgui_eye_sink_x_0.set_y_axis(-1, 1) + + self.qtgui_eye_sink_x_0.set_y_label('Amplitude', "") + + self.qtgui_eye_sink_x_0.enable_tags(True) + self.qtgui_eye_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") + self.qtgui_eye_sink_x_0.enable_autoscale(False) + self.qtgui_eye_sink_x_0.enable_grid(False) + self.qtgui_eye_sink_x_0.enable_axis_labels(True) + self.qtgui_eye_sink_x_0.enable_control_panel(False) + + + labels = ['Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5', + 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10'] + widths = [1, 1, 1, 1, 1, + 1, 1, 1, 1, 1] + colors = ['blue', 'blue', 'blue', 'blue', 'blue', + 'blue', 'blue', 'blue', 'blue', 'blue'] + alphas = [1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0] + styles = [1, 1, 1, 1, 1, + 1, 1, 1, 1, 1] + markers = [-1, -1, -1, -1, -1, + -1, -1, -1, -1, -1] + + + for i in range(2): + if len(labels[i]) == 0: + if (i % 2 == 0): + self.qtgui_eye_sink_x_0.set_line_label(i, "Eye [Re{{Data {0}}}]".format(round(i/2))) + else: + self.qtgui_eye_sink_x_0.set_line_label(i, "Eye [Im{{Data {0}}}]".format(round((i-1)/2))) + else: + self.qtgui_eye_sink_x_0.set_line_label(i, labels[i]) + self.qtgui_eye_sink_x_0.set_line_width(i, widths[i]) + self.qtgui_eye_sink_x_0.set_line_color(i, colors[i]) + self.qtgui_eye_sink_x_0.set_line_style(i, styles[i]) + self.qtgui_eye_sink_x_0.set_line_marker(i, markers[i]) + self.qtgui_eye_sink_x_0.set_line_alpha(i, alphas[i]) + + self._qtgui_eye_sink_x_0_win = sip.wrapinstance(self.qtgui_eye_sink_x_0.pyqwidget(), Qt.QWidget) + self.top_grid_layout.addWidget(self._qtgui_eye_sink_x_0_win) self.qtgui_const_sink_x_2 = qtgui.const_sink_c( 1024, #size "Locked", #name @@ -814,7 +836,7 @@ class qpks(gr.top_block, Qt.QWidget): log=False) self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(qpsk_const) self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, int(sps / 2)) - self.blocks_uchar_to_float_0 = blocks.uchar_to_float() + self.blocks_null_sink_0 = blocks.null_sink(gr.sizeof_char*1) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_char*1, '/home/god/Documents/Fading/hardware/QPSK/lena512color.tiff', True, 0, 0) self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) @@ -823,9 +845,7 @@ class qpks(gr.top_block, Qt.QWidget): ################################################## # Connections ################################################## - self.connect((self.blocks_file_source_0, 0), (self.blocks_uchar_to_float_0, 0)) self.connect((self.blocks_file_source_0, 0), (self.digital_constellation_modulator_0, 0)) - self.connect((self.blocks_uchar_to_float_0, 0), (self.qtgui_histogram_sink_x_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_1_0, 0)) self.connect((self.digital_cma_equalizer_cc_0, 0), (self.qtgui_freq_sink_x_1_0_1, 0)) @@ -836,10 +856,11 @@ class qpks(gr.top_block, Qt.QWidget): self.connect((self.digital_constellation_modulator_0, 0), (self.uhd_usrp_sink_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_2, 0)) + self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_eye_sink_x_1, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_freq_sink_x_1_0_1_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_time_sink_x_2_0_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.digital_map_bb_0, 0)) - self.connect((self.digital_map_bb_0, 0), (self.qtgui_time_raster_sink_x_0, 0)) + self.connect((self.digital_map_bb_0, 0), (self.blocks_null_sink_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, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_freq_sink_x_1_0, 0)) @@ -859,6 +880,8 @@ class qpks(gr.top_block, Qt.QWidget): def set_sps(self, sps): self.sps = sps self.set_rrc_taps(firdes.root_raised_cosine(self.nfilts, self.nfilts, 1.0/float(self.sps), self.excess_bw, 45*self.nfilts)) + self.qtgui_eye_sink_x_0.set_samp_per_symbol(self.sps) + self.qtgui_eye_sink_x_1.set_samp_per_symbol(self.sps) def get_nfilts(self): return self.nfilts @@ -886,6 +909,8 @@ class qpks(gr.top_block, Qt.QWidget): def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate + self.qtgui_eye_sink_x_0.set_samp_rate(self.samp_rate) + self.qtgui_eye_sink_x_1.set_samp_rate(self.samp_rate) self.qtgui_freq_sink_x_1.set_frequency_range(0, self.samp_rate) self.qtgui_freq_sink_x_1_0.set_frequency_range(0, self.samp_rate) self.qtgui_freq_sink_x_1_0_0.set_frequency_range(0, self.samp_rate) diff --git a/hardware/QPSK/qpsk.grc b/hardware/QPSK/qpsk.grc index 69c2915..fd17712 100644 --- a/hardware/QPSK/qpsk.grc +++ b/hardware/QPSK/qpsk.grc @@ -205,7 +205,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [1776, 692.0] + coordinate: [1832, 692.0] rotation: 0 state: disabled - name: blocks_file_source_0 @@ -246,7 +246,7 @@ blocks: bus_structure: null coordinate: [1832, 800.0] rotation: 0 - state: disabled + state: enabled - name: blocks_uchar_to_float_0 id: blocks_uchar_to_float parameters: @@ -261,7 +261,7 @@ blocks: bus_structure: null coordinate: [792.0, 192] rotation: 90 - state: true + state: disabled - name: blocks_vector_source_x_0 id: blocks_vector_source_x parameters: @@ -936,9 +936,203 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [1372.0, 720] + coordinate: [1380.0, 720] rotation: 90 state: true +- name: qtgui_eye_sink_x_0 + id: qtgui_eye_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: blue + color10: blue + color2: blue + color3: blue + color4: blue + color5: blue + color6: blue + color7: blue + color8: blue + color9: blue + comment: '' + ctrlpanel: 'False' + entags: 'True' + grid: 'False' + gui_hint: '' + label1: Signal 1 + label10: Signal 10 + label2: Signal 2 + label3: Signal 3 + label4: Signal 4 + label5: Signal 5 + label6: Signal 6 + label7: Signal 7 + label8: Signal 8 + label9: Signal 9 + legend: 'True' + marker1: '-1' + marker10: '-1' + marker2: '-1' + marker3: '-1' + marker4: '-1' + marker5: '-1' + marker6: '-1' + marker7: '-1' + marker8: '-1' + marker9: '-1' + name: '""' + nconnections: '1' + samp_per_symbol: sps + size: '1024' + srate: samp_rate + style1: '1' + style10: '1' + style2: '1' + style3: '1' + style4: '1' + style5: '1' + style6: '1' + style7: '1' + style8: '1' + style9: '1' + tr_chan: '0' + tr_delay: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '""' + type: complex + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + ylabel: Amplitude + ymax: '1' + ymin: '-1' + yunit: '""' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1360, 84.0] + rotation: 0 + state: true +- name: qtgui_eye_sink_x_1 + id: qtgui_eye_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + axislabels: 'True' + color1: blue + color10: blue + color2: blue + color3: blue + color4: blue + color5: blue + color6: blue + color7: blue + color8: blue + color9: blue + comment: '' + ctrlpanel: 'False' + entags: 'True' + grid: 'False' + gui_hint: 'plots@3: 1,0,1,1' + label1: Signal 1 + label10: Signal 10 + label2: Signal 2 + label3: Signal 3 + label4: Signal 4 + label5: Signal 5 + label6: Signal 6 + label7: Signal 7 + label8: Signal 8 + label9: Signal 9 + legend: 'True' + marker1: '-1' + marker10: '-1' + marker2: '-1' + marker3: '-1' + marker4: '-1' + marker5: '-1' + marker6: '-1' + marker7: '-1' + marker8: '-1' + marker9: '-1' + name: '""' + nconnections: '1' + samp_per_symbol: sps + size: '1024' + srate: samp_rate + style1: '1' + style10: '1' + style2: '1' + style3: '1' + style4: '1' + style5: '1' + style6: '1' + style7: '1' + style8: '1' + style9: '1' + tr_chan: '0' + tr_delay: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_slope: qtgui.TRIG_SLOPE_POS + tr_tag: '""' + type: complex + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + ylabel: Amplitude + ymax: '1' + ymin: '-1' + yunit: '""' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1840, 1028.0] + rotation: 0 + state: true - name: qtgui_freq_sink_x_1 id: qtgui_freq_sink_x parameters: @@ -1425,7 +1619,7 @@ blocks: bus_structure: null coordinate: [912, 60.0] rotation: 0 - state: true + state: disabled - name: qtgui_time_raster_sink_x_0 id: qtgui_time_raster_sink_x parameters: @@ -1482,7 +1676,7 @@ blocks: bus_structure: null coordinate: [1832, 852.0] rotation: 0 - state: true + state: disabled - name: qtgui_time_sink_x_2 id: qtgui_time_sink_x parameters: @@ -1790,7 +1984,7 @@ blocks: comment: '' dev_addr: '"serial=309AF59 "' dev_args: '""' - gain0: '0.3' + gain0: '0.35' gain1: '0' gain10: '0' gain11: '0' @@ -2343,6 +2537,7 @@ connections: - [digital_constellation_modulator_0, '0', uhd_usrp_sink_0, '0'] - [digital_costas_loop_cc_0, '0', digital_constellation_decoder_cb_0, '0'] - [digital_costas_loop_cc_0, '0', qtgui_const_sink_x_2, '0'] +- [digital_costas_loop_cc_0, '0', qtgui_eye_sink_x_1, '0'] - [digital_costas_loop_cc_0, '0', qtgui_freq_sink_x_1_0_1_0, '0'] - [digital_costas_loop_cc_0, '0', qtgui_time_sink_x_2_0_0, '0'] - [digital_diff_decoder_bb_0, '0', digital_map_bb_0, '0'] -- cgit v1.2.1