diff options
author | Nao Pross <np@0hm.ch> | 2021-10-18 18:13:00 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2021-10-18 18:13:00 +0200 |
commit | 977948d798a6b946780752aecd694a91e119e007 (patch) | |
tree | 9b893c477ce5b348c0499f849619dcf1e32c85d2 /simulation | |
parent | Merge remote-tracking branch 'origin/master' (diff) | |
download | Fading-977948d798a6b946780752aecd694a91e119e007.tar.gz Fading-977948d798a6b946780752aecd694a91e119e007.zip |
Add decoder to QPKS simulation
Diffstat (limited to '')
-rw-r--r-- | simulation/QPKS/qpks.grc | 240 | ||||
-rwxr-xr-x | simulation/QPKS/qpks.py | 70 |
2 files changed, 310 insertions, 0 deletions
diff --git a/simulation/QPKS/qpks.grc b/simulation/QPKS/qpks.grc index cf3454a..ffc7103 100644 --- a/simulation/QPKS/qpks.grc +++ b/simulation/QPKS/qpks.grc @@ -294,6 +294,59 @@ blocks: coordinate: [32, 332.0] rotation: 0 state: enabled +- name: blocks_char_to_float_0 + id: blocks_char_to_float + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + scale: '1' + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [2272, 276.0] + rotation: 0 + state: true +- name: blocks_char_to_float_0_0 + id: blocks_char_to_float + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + scale: '1' + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [408, 840.0] + rotation: 0 + state: true +- name: blocks_delay_0 + id: blocks_delay + parameters: + affinity: '' + alias: '' + comment: '' + delay: '50' + maxoutbuf: '0' + minoutbuf: '0' + num_ports: '1' + type: float + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [2264, 844.0] + rotation: 0 + state: true - name: blocks_throttle_0 id: blocks_throttle parameters: @@ -313,6 +366,38 @@ blocks: coordinate: [464, 356.0] rotation: 0 state: enabled +- name: blocks_unpack_k_bits_bb_0 + id: blocks_unpack_k_bits_bb + parameters: + affinity: '' + alias: '' + comment: '' + k: '2' + maxoutbuf: '0' + minoutbuf: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [2192, 436.0] + rotation: 0 + state: true +- name: blocks_unpack_k_bits_bb_0_0 + id: blocks_unpack_k_bits_bb + parameters: + affinity: '' + alias: '' + comment: '' + k: '2' + maxoutbuf: '0' + minoutbuf: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [232, 840.0] + rotation: 0 + state: true - name: channels_channel_model_0 id: channels_channel_model parameters: @@ -353,6 +438,22 @@ blocks: coordinate: [1336, 284.0] rotation: 0 state: true +- name: digital_constellation_decoder_cb_0 + id: digital_constellation_decoder_cb + parameters: + affinity: '' + alias: '' + comment: '' + constellation: qpsk_const + maxoutbuf: '0' + minoutbuf: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1976, 276.0] + rotation: 0 + state: true - name: digital_constellation_modulator_0 id: digital_constellation_modulator parameters: @@ -392,6 +493,38 @@ blocks: coordinate: [1640, 280.0] rotation: 0 state: true +- name: digital_diff_decoder_bb_0 + id: digital_diff_decoder_bb + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + modulus: '4' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1976, 348.0] + rotation: 180 + state: true +- name: digital_map_bb_0 + id: digital_map_bb + parameters: + affinity: '' + alias: '' + comment: '' + map: '[0, 1, 3, 2]' + maxoutbuf: '0' + minoutbuf: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1984, 436.0] + rotation: 0 + state: true - name: digital_pfb_clock_sync_xxx_0 id: digital_pfb_clock_sync_xxx parameters: @@ -931,17 +1064,124 @@ blocks: coordinate: [856.0, 472] rotation: 270 state: true +- name: qtgui_time_sink_x_0 + id: qtgui_time_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: 'True' + axislabels: 'True' + color1: blue + color10: dark blue + color2: red + color3: green + color4: black + color5: cyan + color6: magenta + color7: yellow + color8: dark red + color9: dark green + comment: '' + ctrlpanel: 'False' + entags: 'True' + grid: 'False' + gui_hint: 'plots@2: 0,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: '"Decoded"' + nconnections: '2' + size: '1024' + srate: samp_rate + stemplot: 'False' + 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: float + 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: [2504, 268.0] + rotation: 0 + state: true connections: +- [analog_random_source_x_0, '0', blocks_unpack_k_bits_bb_0_0, '0'] - [analog_random_source_x_0, '0', digital_constellation_modulator_0, '0'] +- [blocks_char_to_float_0, '0', qtgui_time_sink_x_0, '0'] +- [blocks_char_to_float_0_0, '0', blocks_delay_0, '0'] +- [blocks_delay_0, '0', qtgui_time_sink_x_0, '1'] - [blocks_throttle_0, '0', channels_channel_model_0, '0'] +- [blocks_unpack_k_bits_bb_0, '0', blocks_char_to_float_0, '0'] +- [blocks_unpack_k_bits_bb_0_0, '0', blocks_char_to_float_0_0, '0'] - [channels_channel_model_0, '0', digital_pfb_clock_sync_xxx_0, '0'] - [channels_channel_model_0, '0', qtgui_const_sink_x_0, '0'] - [channels_channel_model_0, '0', qtgui_freq_sink_x_0, '0'] - [digital_cma_equalizer_cc_0, '0', digital_costas_loop_cc_0, '0'] - [digital_cma_equalizer_cc_0, '0', qtgui_const_sink_x_1, '0'] +- [digital_constellation_decoder_cb_0, '0', digital_diff_decoder_bb_0, '0'] - [digital_constellation_modulator_0, '0', blocks_throttle_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_diff_decoder_bb_0, '0', digital_map_bb_0, '0'] +- [digital_map_bb_0, '0', blocks_unpack_k_bits_bb_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, '0'] diff --git a/simulation/QPKS/qpks.py b/simulation/QPKS/qpks.py index c8d5f82..e436356 100755 --- a/simulation/QPKS/qpks.py +++ b/simulation/QPKS/qpks.py @@ -166,6 +166,57 @@ class qpks(gr.top_block, Qt.QWidget): self.params_grid_layout_1.setRowStretch(r, 1) for c in range(0, 1): self.params_grid_layout_1.setColumnStretch(c, 1) + self.qtgui_time_sink_x_0 = qtgui.time_sink_f( + 1024, #size + samp_rate, #samp_rate + "Decoded", #name + 2 #number of inputs + ) + self.qtgui_time_sink_x_0.set_update_time(0.10) + self.qtgui_time_sink_x_0.set_y_axis(-1, 1) + + self.qtgui_time_sink_x_0.set_y_label('Amplitude', "") + + self.qtgui_time_sink_x_0.enable_tags(True) + self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") + self.qtgui_time_sink_x_0.enable_autoscale(True) + self.qtgui_time_sink_x_0.enable_grid(False) + self.qtgui_time_sink_x_0.enable_axis_labels(True) + self.qtgui_time_sink_x_0.enable_control_panel(False) + self.qtgui_time_sink_x_0.enable_stem_plot(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', 'red', 'green', 'black', 'cyan', + 'magenta', 'yellow', 'dark red', 'dark green', 'dark 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: + self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i)) + else: + self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) + self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) + self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) + self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) + self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) + self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) + + self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) + self.plots_grid_layout_2.addWidget(self._qtgui_time_sink_x_0_win, 0, 0, 1, 1) + for r in range(0, 1): + self.plots_grid_layout_2.setRowStretch(r, 1) + for c in range(0, 1): + self.plots_grid_layout_2.setColumnStretch(c, 1) self.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( 1024, #size firdes.WIN_BLACKMAN_hARRIS, #wintype @@ -387,6 +438,8 @@ class qpks(gr.top_block, Qt.QWidget): for c in range(0, 1): self.plots_grid_layout_0.setColumnStretch(c, 1) self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps * 1.001, timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, 2) + 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( constellation=qpsk_const, @@ -396,6 +449,7 @@ class qpks(gr.top_block, Qt.QWidget): excess_bw=excess_bw, verbose=False, 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, 2) self.channels_channel_model_0 = channels.channel_model( noise_voltage=noise_volt, @@ -404,7 +458,12 @@ class qpks(gr.top_block, Qt.QWidget): taps=chn_taps, noise_seed=0, block_tags=False) + self.blocks_unpack_k_bits_bb_0_0 = blocks.unpack_k_bits_bb(2) + self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) + self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, 50) + self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1) + self.blocks_char_to_float_0 = blocks.char_to_float(1, 1) self.analog_random_source_x_0 = blocks.vector_source_b(list(map(int, numpy.random.randint(0, 256, 1000))), True) @@ -412,15 +471,25 @@ class qpks(gr.top_block, Qt.QWidget): ################################################## # Connections ################################################## + self.connect((self.analog_random_source_x_0, 0), (self.blocks_unpack_k_bits_bb_0_0, 0)) self.connect((self.analog_random_source_x_0, 0), (self.digital_constellation_modulator_0, 0)) + self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0, 0)) + self.connect((self.blocks_char_to_float_0_0, 0), (self.blocks_delay_0, 0)) + self.connect((self.blocks_delay_0, 0), (self.qtgui_time_sink_x_0, 1)) self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0, 0)) + self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_char_to_float_0, 0)) + self.connect((self.blocks_unpack_k_bits_bb_0_0, 0), (self.blocks_char_to_float_0_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_const_sink_x_0, 0)) self.connect((self.channels_channel_model_0, 0), (self.qtgui_freq_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)) + 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_2, 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.blocks_unpack_k_bits_bb_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)) @@ -465,6 +534,7 @@ class qpks(gr.top_block, Qt.QWidget): self.samp_rate = samp_rate self.blocks_throttle_0.set_sample_rate(self.samp_rate) self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate) + self.qtgui_time_sink_x_0.set_samp_rate(self.samp_rate) def get_rrc_taps(self): return self.rrc_taps |