diff --git a/examples/NFM_simulation.grc b/examples/NFM_simulation.grc new file mode 100644 index 0000000..055f749 --- /dev/null +++ b/examples/NFM_simulation.grc @@ -0,0 +1,524 @@ +options: + parameters: + author: Barry Duggan + catch_exceptions: 'True' + category: '[GRC Hier Blocks]' + cmake_opt: '' + comment: '' + copyright: '' + description: NBFM transmitter + gen_cmake: 'On' + gen_linking: dynamic + generate_options: qt_gui + hier_block_src_path: '.:' + id: NFM_xmt + max_nouts: '0' + output_language: python + placement: (0,0) + qt_qss_theme: '' + realtime_scheduling: '' + run: 'True' + run_command: '{python} -u {filename}' + run_options: prompt + sizing_mode: fixed + thread_safe_setters: '' + title: NFM_xmt + window_size: '' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [16, 32.0] + rotation: 0 + state: enabled + +blocks: +- name: df + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: '' + label: '' + min_len: '200' + orient: QtCore.Qt.Horizontal + rangeType: float + start: '0' + step: '0.001' + stop: '0.02' + value: '0' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [168, 296.0] + rotation: 0 + state: true +- name: freq + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: '' + label: '' + min_len: '200' + orient: QtCore.Qt.Horizontal + rangeType: float + start: '0' + step: '1' + stop: samp_rate/2 + value: '440' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [672, 64.0] + rotation: 0 + state: true +- name: if_rate + id: variable + parameters: + comment: '' + value: int(usrp_rate/3) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [376, 32.0] + rotation: 0 + state: true +- name: noise + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: '' + label: '' + min_len: '200' + orient: QtCore.Qt.Horizontal + rangeType: float + start: '0' + step: '0.01' + stop: '2' + value: '0.3' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 296.0] + rotation: 0 + state: true +- name: samp_rate + id: variable + parameters: + comment: '' + value: '48000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [200, 32.0] + rotation: 0 + state: enabled +- name: usrp_rate + id: variable + parameters: + comment: '' + value: '576000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [288, 32.0] + rotation: 0 + state: true +- name: analog_nbfm_rx_0 + id: analog_nbfm_rx + parameters: + affinity: '' + alias: '' + audio_rate: '48000' + comment: '' + max_dev: 5e3 + maxoutbuf: '0' + minoutbuf: '0' + quad_rate: if_rate + tau: 75e-6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [696, 392.0] + rotation: 0 + state: enabled +- name: analog_nbfm_tx_0 + id: analog_nbfm_tx + parameters: + affinity: '' + alias: '' + audio_rate: samp_rate + comment: '' + fh: '-1.0' + max_dev: 5e3 + maxoutbuf: '0' + minoutbuf: '0' + quad_rate: if_rate + tau: 75e-6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [280, 160.0] + rotation: 0 + state: true +- name: analog_sig_source_x_1 + id: analog_sig_source_x + parameters: + affinity: '' + alias: '' + amp: '0.9' + comment: '' + freq: freq + maxoutbuf: '0' + minoutbuf: '0' + offset: '0' + phase: '0' + samp_rate: samp_rate + type: float + waveform: analog.GR_COS_WAVE + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [32, 152.0] + rotation: 0 + state: true +- name: blocks_repeat_0_0 + id: blocks_repeat + parameters: + affinity: '' + alias: '' + comment: '' + interp: (int)(usrp_rate/if_rate) + maxoutbuf: '0' + minoutbuf: '0' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [752, 192.0] + rotation: 0 + state: true +- name: blocks_throttle_0 + id: blocks_throttle + parameters: + affinity: '' + alias: '' + comment: '' + ignoretag: 'True' + maxoutbuf: '0' + minoutbuf: '0' + samples_per_second: usrp_rate + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [160, 416.0] + rotation: 0 + state: true +- name: channels_channel_model_0 + id: channels_channel_model + parameters: + affinity: '' + alias: '' + block_tags: 'False' + comment: '' + epsilon: '1.0' + freq_offset: df + maxoutbuf: '0' + minoutbuf: '0' + noise_voltage: noise + seed: '0' + taps: 1.0 + 1.0j + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [320, 376.0] + rotation: 0 + state: true +- name: low_pass_filter_0 + id: low_pass_filter + parameters: + affinity: '' + alias: '' + beta: '6.76' + comment: '' + cutoff_freq: '5000' + decim: '1' + gain: '1' + interp: '1' + maxoutbuf: '0' + minoutbuf: '0' + samp_rate: if_rate + type: fir_filter_ccf + width: '2000' + win: window.WIN_HAMMING + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [552, 140.0] + rotation: 0 + state: true +- name: low_pass_filter_1 + id: low_pass_filter + parameters: + affinity: '' + alias: '' + beta: '6.76' + comment: '' + cutoff_freq: samp_rate/6 + decim: int(usrp_rate/if_rate) + gain: '1' + interp: '1' + maxoutbuf: '0' + minoutbuf: '0' + samp_rate: usrp_rate + type: fir_filter_ccf + width: samp_rate/64 + win: window.WIN_HAMMING + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [520, 364.0] + rotation: 0 + state: true +- name: qtgui_freq_sink_x_0 + id: qtgui_freq_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' + average: '1.0' + axislabels: 'True' + bw: if_rate + 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' + fc: '0' + fftsize: '1024' + freqhalf: 'True' + grid: 'False' + gui_hint: '' + label: Relative Gain + label1: '' + label10: '''''' + label2: '''''' + label3: '''''' + label4: '''''' + label5: '''''' + label6: '''''' + label7: '''''' + label8: '''''' + label9: '''''' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '""' + nconnections: '3' + norm_window: 'False' + showports: 'False' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_tag: '""' + type: complex + units: dB + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + wintype: window.WIN_BLACKMAN_hARRIS + ymax: '10' + ymin: '-140' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [896, 272.0] + rotation: 0 + 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: 'False' + 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: '' + 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: '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: [888, 384.0] + rotation: 0 + state: true +- name: virtual_sink_0 + id: virtual_sink + parameters: + alias: '' + comment: '' + stream_id: tag1 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [904, 192.0] + rotation: 0 + state: true +- name: virtual_source_0 + id: virtual_source + parameters: + alias: '' + comment: '' + stream_id: tag1 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 416.0] + rotation: 0 + state: true + +connections: +- [analog_nbfm_rx_0, '0', qtgui_time_sink_x_0, '1'] +- [analog_nbfm_tx_0, '0', low_pass_filter_0, '0'] +- [analog_nbfm_tx_0, '0', qtgui_freq_sink_x_0, '1'] +- [analog_sig_source_x_1, '0', analog_nbfm_tx_0, '0'] +- [analog_sig_source_x_1, '0', qtgui_time_sink_x_0, '0'] +- [blocks_repeat_0_0, '0', virtual_sink_0, '0'] +- [blocks_throttle_0, '0', channels_channel_model_0, '0'] +- [channels_channel_model_0, '0', low_pass_filter_1, '0'] +- [low_pass_filter_0, '0', blocks_repeat_0_0, '0'] +- [low_pass_filter_0, '0', qtgui_freq_sink_x_0, '0'] +- [low_pass_filter_1, '0', analog_nbfm_rx_0, '0'] +- [low_pass_filter_1, '0', qtgui_freq_sink_x_0, '2'] +- [virtual_source_0, '0', blocks_throttle_0, '0'] + +metadata: + file_format: 1 + grc_version: 3.10.5.1 diff --git a/examples/m17_loopback_noisychannel.grc b/examples/m17_loopback_noisychannel.grc new file mode 100644 index 0000000..2a2311a --- /dev/null +++ b/examples/m17_loopback_noisychannel.grc @@ -0,0 +1,630 @@ +options: + parameters: + author: sp5wwp + catch_exceptions: 'True' + category: '[GRC Hier Blocks]' + cmake_opt: '' + comment: '' + copyright: '' + description: '' + gen_cmake: 'On' + gen_linking: dynamic + generate_options: qt_gui + hier_block_src_path: '.:' + id: m17_block + max_nouts: '0' + output_language: python + placement: (0,0) + qt_qss_theme: '' + realtime_scheduling: '' + run: 'True' + run_command: '{python} -u {filename}' + run_options: prompt + sizing_mode: fixed + thread_safe_setters: '' + title: Not titled yet + window_size: (1000,1000) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [40, 8.0] + rotation: 0 + state: enabled + +blocks: +- name: N + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: '' + label: '' + min_len: '200' + orient: QtCore.Qt.Horizontal + rangeType: float + start: '-20' + step: '1' + stop: '20' + value: '8' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [432, 8.0] + rotation: 0 + state: true +- name: can + id: variable + parameters: + comment: '' + value: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [280, 8.0] + rotation: 0 + state: true +- name: df + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: '' + label: '' + min_len: '200' + orient: QtCore.Qt.Horizontal + rangeType: float + start: '0' + step: '.001' + stop: '.2' + value: '0' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [536, 8.0] + rotation: 0 + state: true +- name: noise + id: variable_qtgui_range + parameters: + comment: '' + gui_hint: '' + label: '' + min_len: '200' + orient: QtCore.Qt.Horizontal + rangeType: float + start: '0' + step: '.01' + stop: '5' + value: '0' + widget: counter_slider + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [640, 8.0] + rotation: 0 + state: true +- name: samp_rate + id: variable + parameters: + comment: '' + value: '48000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [344, 8.0] + rotation: 0 + state: true +- name: threshold + id: variable_qtgui_entry + parameters: + comment: '' + gui_hint: '' + label: '' + type: real + value: '0.85' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [744, 8.0] + rotation: 0 + state: true +- name: analog_agc_xx_0 + id: analog_agc_xx + parameters: + affinity: '' + alias: '' + comment: '' + gain: '1.0' + max_gain: '65536' + maxoutbuf: '0' + minoutbuf: '0' + rate: 1e-2 + reference: '2' + type: float + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [896, 320.0] + rotation: 0 + state: true +- name: analog_frequency_modulator_fc_0 + id: analog_frequency_modulator_fc + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + sensitivity: '8.18123e-2' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [752, 176.0] + rotation: 0 + state: enabled +- name: analog_quadrature_demod_cf_0 + id: analog_quadrature_demod_cf + parameters: + affinity: '' + alias: '' + comment: '' + gain: samp_rate/(2*math.pi*800.0) + maxoutbuf: '0' + minoutbuf: '0' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [520, 344.0] + rotation: 0 + state: enabled +- name: blocks_delay_0 + id: blocks_delay + parameters: + affinity: '' + alias: '' + comment: '' + delay: N + maxoutbuf: '0' + minoutbuf: '0' + num_ports: '1' + type: float + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [912, 232.0] + rotation: 0 + state: true +- name: blocks_throttle_0 + id: blocks_throttle + parameters: + affinity: '' + alias: '' + comment: '' + ignoretag: 'True' + maxoutbuf: '0' + minoutbuf: '0' + samples_per_second: '4800' + type: float + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [376, 176.0] + rotation: 0 + state: enabled +- name: blocks_vector_source_x_0 + id: blocks_vector_source_x + parameters: + affinity: '' + alias: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + repeat: 'True' + tags: '[]' + type: byte + vector: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [16, 160.0] + rotation: 0 + state: enabled +- name: channels_channel_model_0 + id: channels_channel_model + parameters: + affinity: '' + alias: '' + block_tags: 'False' + comment: '' + epsilon: '1.0' + freq_offset: df + maxoutbuf: '0' + minoutbuf: '0' + noise_voltage: noise + seed: '0' + taps: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [320, 304.0] + rotation: 0 + state: bypassed +- name: iio_pluto_sink_0 + id: iio_pluto_sink + parameters: + affinity: '' + alias: '' + attenuation1: '10.0' + bandwidth: '20000000' + buffer_size: '32768' + comment: '' + cyclic: 'False' + filter: '' + filter_source: '''Auto''' + fpass: '0' + frequency: '435000000' + fstop: '0' + len_tag_key: '' + samplerate: samp_rate*16 + type: fc32 + uri: '' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1016, 60.0] + rotation: 0 + state: disabled +- name: iio_pluto_source_0 + id: iio_pluto_source + parameters: + affinity: '' + alias: '' + bandwidth: '20000000' + bbdc: 'True' + buffer_size: '32768' + comment: '' + filter: '' + filter_source: '''Auto''' + fpass: '0' + frequency: 2400000000-40000 + fstop: '0' + gain1: '''slow_attack''' + len_tag_key: packet_len + manual_gain1: '64' + maxoutbuf: '0' + minoutbuf: '0' + quadrature: 'True' + rfdc: 'True' + samplerate: samp_rate*16 + type: fc32 + uri: '' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 340.0] + rotation: 0 + state: disabled +- name: import_0 + id: import + parameters: + alias: '' + comment: '' + imports: import math + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [192, 8.0] + rotation: 0 + state: true +- name: m17_m17_coder_0 + id: m17_m17_coder + parameters: + affinity: '' + alias: '' + comment: '' + debug: 'False' + dst_id: ALL + maxoutbuf: '0' + meta: helloworld + minoutbuf: '0' + src_id: AB1CDE + type: (can<<7)|(2<<1)|1 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [208, 144.0] + rotation: 0 + state: enabled +- name: m17_m17_decoder_0 + id: m17_m17_decoder + parameters: + affinity: '' + alias: '' + comment: '' + debug_ctrl: 'True' + debug_data: 'False' + maxoutbuf: '0' + minoutbuf: '0' + threshold: threshold + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1096, 328.0] + rotation: 0 + state: enabled +- name: qtgui_number_sink_0 + id: qtgui_number_sink + parameters: + affinity: '' + alias: '' + autoscale: 'False' + avg: '0' + color1: ("black", "black") + color10: ("black", "black") + color2: ("black", "black") + color3: ("black", "black") + color4: ("black", "black") + color5: ("black", "black") + color6: ("black", "black") + color7: ("black", "black") + color8: ("black", "black") + color9: ("black", "black") + comment: '' + factor1: '1' + factor10: '1' + factor2: '1' + factor3: '1' + factor4: '1' + factor5: '1' + factor6: '1' + factor7: '1' + factor8: '1' + factor9: '1' + graph_type: qtgui.NUM_GRAPH_HORIZ + gui_hint: '' + label1: '' + label10: '' + label2: '' + label3: '' + label4: '' + label5: '' + label6: '' + label7: '' + label8: '' + label9: '' + max: '1' + min: '-1' + name: '""' + nconnections: '1' + type: byte + unit1: '' + unit10: '' + unit2: '' + unit3: '' + unit4: '' + unit5: '' + unit6: '' + unit7: '' + unit8: '' + unit9: '' + update_time: '0.10' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1264, 320.0] + rotation: 0 + state: true +- name: qtgui_time_sink_x_0_0_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: 'False' + 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: '' + 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: '2' + size: '100' + srate: samp_rate/10 + 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: '5' + ymin: '-5' + yunit: '""' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1096, 240.0] + rotation: 0 + state: enabled +- name: root_raised_cosine_filter_0 + id: root_raised_cosine_filter + parameters: + affinity: '' + alias: '' + alpha: '0.5' + comment: '' + decim: '1' + gain: '10' + interp: '10' + maxoutbuf: '0' + minoutbuf: '0' + ntaps: '81' + samp_rate: '10' + sym_rate: '1.0' + type: interp_fir_filter_fff + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [536, 136.0] + rotation: 0 + state: enabled +- name: root_raised_cosine_filter_0_0 + id: root_raised_cosine_filter + parameters: + affinity: '' + alias: '' + alpha: '0.5' + comment: '' + decim: '10' + gain: '10' + interp: '1' + maxoutbuf: '0' + minoutbuf: '0' + ntaps: '81' + samp_rate: '10' + sym_rate: '1.0' + type: fir_filter_fff + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [696, 304.0] + rotation: 0 + state: enabled +- name: virtual_sink_0 + id: virtual_sink + parameters: + alias: '' + comment: '' + stream_id: '' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [928, 176.0] + rotation: 0 + state: enabled +- name: virtual_source_0 + id: virtual_source + parameters: + alias: '' + comment: '' + stream_id: '' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [176, 344.0] + rotation: 0 + state: enabled + +connections: +- [analog_agc_xx_0, '0', m17_m17_decoder_0, '0'] +- [analog_agc_xx_0, '0', qtgui_time_sink_x_0_0_0, '1'] +- [analog_frequency_modulator_fc_0, '0', iio_pluto_sink_0, '0'] +- [analog_frequency_modulator_fc_0, '0', virtual_sink_0, '0'] +- [analog_quadrature_demod_cf_0, '0', root_raised_cosine_filter_0_0, '0'] +- [blocks_delay_0, '0', qtgui_time_sink_x_0_0_0, '0'] +- [blocks_throttle_0, '0', blocks_delay_0, '0'] +- [blocks_throttle_0, '0', root_raised_cosine_filter_0, '0'] +- [blocks_vector_source_x_0, '0', m17_m17_coder_0, '0'] +- [channels_channel_model_0, '0', analog_quadrature_demod_cf_0, '0'] +- [iio_pluto_source_0, '0', analog_quadrature_demod_cf_0, '0'] +- [m17_m17_coder_0, '0', blocks_throttle_0, '0'] +- [m17_m17_decoder_0, '0', qtgui_number_sink_0, '0'] +- [root_raised_cosine_filter_0, '0', analog_frequency_modulator_fc_0, '0'] +- [root_raised_cosine_filter_0_0, '0', analog_agc_xx_0, '0'] +- [virtual_source_0, '0', channels_channel_model_0, '0'] + +metadata: + file_format: 1 + grc_version: 3.10.5.1 diff --git a/grc/m17_m17_decoder.block.yml b/grc/m17_m17_decoder.block.yml index 201b8a2..05c2946 100644 --- a/grc/m17_m17_decoder.block.yml +++ b/grc/m17_m17_decoder.block.yml @@ -13,13 +13,18 @@ parameters: dtype: bool default: 'False' options: ['True', 'False'] +- id: threshold + label: Threshold + dtype: float + default: 0.9 templates: imports: from gnuradio import m17 - make: m17.m17_decoder(${debug_data},${debug_ctrl}) + make: m17.m17_decoder(${debug_data},${debug_ctrl},${threshold}) callbacks: - set_debug_data(${debug_data}) - set_debug_ctrl(${debug_ctrl}) + - set_threshold(${threshold}) # Make one 'inputs' list entry per input and one 'outputs' list entry per output. # Keys include: diff --git a/include/gnuradio/m17/m17_decoder.h b/include/gnuradio/m17/m17_decoder.h index 93d02ae..922657a 100644 --- a/include/gnuradio/m17/m17_decoder.h +++ b/include/gnuradio/m17/m17_decoder.h @@ -32,9 +32,10 @@ public: * class. m17::m17_decoder::make is the public interface for * creating new instances. */ - static sptr make(bool debug_data,bool debug_ctrl); + static sptr make(bool debug_data,bool debug_ctrl,float threshold); virtual void set_debug_data(bool debug)=0; virtual void set_debug_ctrl(bool debug)=0; + virtual void set_threshold(float threshold)=0; }; } // namespace m17 diff --git a/lib/m17_decoder_impl.cc b/lib/m17_decoder_impl.cc index 4524f31..efc031a 100644 --- a/lib/m17_decoder_impl.cc +++ b/lib/m17_decoder_impl.cc @@ -40,7 +40,7 @@ //#define SHOW_VITERBI_ERRS // -#define XCORR_THRESHOLD 0.90 // arbitrary threshold between 0 and 1: might be tunable from GNU Radio Block for flexibility +//#define XCORR_THRESHOLD 0.90 // arbitrary threshold between 0 and 1: might be tunable from GNU Radio Block for flexibility #define CODE_MEAN -0.75 // mean(str_sync) #define CODE_STD 8.78 // std(str_sync)*sqrt(length(str_sync)) // see ../M17_Implementations/SP5WWP/inc/m17.h for const int8_t str_sync[8]={-3, -3, -3, -3, +3, +3, -3, +3}; @@ -108,23 +108,25 @@ void decode_callsign(uint8_t *outp, const uint8_t *inp) } m17_decoder::sptr - m17_decoder::make(bool debug_data,bool debug_ctrl) + m17_decoder::make(bool debug_data,bool debug_ctrl,float threshold) { return gnuradio::get_initial_sptr - (new m17_decoder_impl(debug_data,debug_ctrl)); + (new m17_decoder_impl(debug_data,debug_ctrl,threshold)); } /* * The private constructor */ - m17_decoder_impl::m17_decoder_impl(bool debug_data,bool debug_ctrl) + m17_decoder_impl::m17_decoder_impl(bool debug_data,bool debug_ctrl,float threshold) : gr::block("m17_decoder", gr::io_signature::make(1, 1, sizeof(float)), gr::io_signature::make(1, 1, sizeof(char))), - _debug_data(debug_data), _debug_ctrl(debug_ctrl) + _debug_data(debug_data), _debug_ctrl(debug_ctrl), _threshold(threshold) {set_debug_data(debug_data); - set_debug_ctrl(debug_ctrl);} + set_debug_ctrl(debug_ctrl); + set_threshold(threshold); + } /* * Our virtual destructor. @@ -133,6 +135,11 @@ void decode_callsign(uint8_t *outp, const uint8_t *inp) { } +void m17_decoder_impl::set_threshold(float threshold) +{_threshold=threshold; + printf("Threshold: %f\n",_threshold); +} + void m17_decoder_impl::set_debug_data(bool debug) {_debug_data=debug; if (_debug_data==true) printf("Data debug: true\n"); else printf("Data debug: false\n"); @@ -210,13 +217,13 @@ uint8_t pushed; //counter for pushed symbols xcorr/=(sqrt(normx)*CODE_STD); // 8.78=std(str_sync)*sqrt(length(str_sync)) // printf("%f\n", xcorr); - if(xcorr>XCORR_THRESHOLD) //Frame syncword detected + if(xcorr>_threshold) // XCORR_THRESHOLD) //Frame syncword detected { syncd=1; pushed=0; fl=0; } - else if(xcorr<-XCORR_THRESHOLD) //LSF syncword + else if(xcorr<-_threshold) // XCORR_THRESHOLD) //LSF syncword { syncd=1; pushed=0; diff --git a/lib/m17_decoder_impl.h b/lib/m17_decoder_impl.h index 5063225..d8b6548 100644 --- a/lib/m17_decoder_impl.h +++ b/lib/m17_decoder_impl.h @@ -18,12 +18,14 @@ class m17_decoder_impl : public m17_decoder private: bool _debug_data=false; bool _debug_ctrl=false; + float _threshold=0.9; public: - m17_decoder_impl(bool debug_data,bool debug_ctrl); + m17_decoder_impl(bool debug_data,bool debug_ctrl,float threshold); ~m17_decoder_impl(); void set_debug_data(bool debug); void set_debug_ctrl(bool debug); + void set_threshold(float threshold); // Where all the action really happens void forecast(int noutput_items, gr_vector_int& ninput_items_required); diff --git a/python/m17/bindings/m17_decoder_python.cc b/python/m17/bindings/m17_decoder_python.cc index ab60e60..fdfa778 100644 --- a/python/m17/bindings/m17_decoder_python.cc +++ b/python/m17/bindings/m17_decoder_python.cc @@ -16,7 +16,7 @@ /* BINDTOOL_GEN_AUTOMATIC(0) */ /* BINDTOOL_USE_PYGCCXML(0) */ /* BINDTOOL_HEADER_FILE(m17_decoder.h) */ -/* BINDTOOL_HEADER_FILE_HASH(6d1584568dd4bd471f76c6e03b799efb) */ +/* BINDTOOL_HEADER_FILE_HASH(74e8e77389b1889023dbed48ecb9523e) */ /***********************************************************************************/ #include @@ -37,7 +37,7 @@ void bind_m17_decoder(py::module &m) { std::shared_ptr>(m, "m17_decoder", D(m17_decoder)) .def(py::init(&m17_decoder::make), py::arg("debug_data"), - py::arg("debug_ctrl"), D(m17_decoder, make)) + py::arg("debug_ctrl"), py::arg("threshold"), D(m17_decoder, make)) .def("set_debug_data", &m17_decoder::set_debug_data, py::arg("debug"), D(m17_decoder, set_debug_data)) @@ -45,5 +45,8 @@ void bind_m17_decoder(py::module &m) { .def("set_debug_ctrl", &m17_decoder::set_debug_ctrl, py::arg("debug"), D(m17_decoder, set_debug_ctrl)) + .def("set_threshold", &m17_decoder::set_threshold, py::arg("threshold"), + D(m17_decoder, set_threshold)) + ; }