From e93f1472d1b96f43217f2476ef76b79c97847133 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Tue, 14 Dec 2021 19:48:22 +0100 Subject: Add (disabled) power squelch --- flowgraphs/qpsk_sim.grc | 106 ++++++++++++++++++++++++++++++++++++++++-------- flowgraphs/qpsk_sim.py | 12 +++--- 2 files changed, 95 insertions(+), 23 deletions(-) diff --git a/flowgraphs/qpsk_sim.grc b/flowgraphs/qpsk_sim.grc index 7be9ec8..db8f2be 100644 --- a/flowgraphs/qpsk_sim.grc +++ b/flowgraphs/qpsk_sim.grc @@ -76,8 +76,8 @@ blocks: parameters: alias: '' comment: '' - payload_len: '4096' - preamble: '[0xbe, 0xef]' + payload_len: '16' + preamble: '[0x1f, 0x35]' states: bus_sink: false bus_source: false @@ -96,7 +96,19 @@ blocks: bus_structure: null coordinate: [184, 252.0] rotation: 0 - state: true + state: enabled +- name: frame_len + id: variable + parameters: + comment: '' + value: 2 + 4 + 16 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [208, 604.0] + rotation: 0 + state: disabled - name: nfilts id: variable parameters: @@ -174,7 +186,7 @@ blocks: bus_structure: null coordinate: [48, 252.0] rotation: 0 - state: true + state: enabled - name: analog_random_source_x_0 id: analog_random_source_x parameters: @@ -194,7 +206,24 @@ blocks: bus_structure: null coordinate: [48, 420.0] rotation: 0 - state: true + state: enabled +- name: analog_simple_squelch_cc_0 + id: analog_simple_squelch_cc + parameters: + affinity: '' + alias: '' + alpha: '' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + threshold: '' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [1000, 692.0] + rotation: 0 + state: disabled - name: blocks_complex_to_mag_0 id: blocks_complex_to_mag parameters: @@ -211,6 +240,25 @@ blocks: coordinate: [1064, 1080.0] rotation: 0 state: enabled +- name: blocks_null_source_0 + id: blocks_null_source + parameters: + affinity: '' + alias: '' + bus_structure_source: '[[0,],]' + comment: '' + maxoutbuf: '0' + minoutbuf: '0' + num_outputs: '1' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [744, 344.0] + rotation: 0 + state: disabled - name: blocks_repack_bits_bb_0 id: blocks_repack_bits_bb parameters: @@ -247,9 +295,28 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [272, 416.0] + coordinate: [240, 416.0] rotation: 0 - state: true + state: enabled +- name: blocks_stream_mux_1 + id: blocks_stream_mux + parameters: + affinity: '' + alias: '' + comment: '' + lengths: '[]' + maxoutbuf: '0' + minoutbuf: '0' + num_inputs: '2' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [928, 344.0] + rotation: 0 + state: disabled - name: blocks_stream_to_vector_0 id: blocks_stream_to_vector parameters: @@ -324,7 +391,7 @@ blocks: bus_structure: null coordinate: [48, 324.0] rotation: 0 - state: true + state: enabled - name: channels_channel_model_0 id: channels_channel_model parameters: @@ -356,7 +423,7 @@ blocks: alias: '' comment: '' delays: (0,1.8) - fDTs: ((4*carrier_freq)/(3*10e8))/samp_rate + fDTs: ((2*carrier_freq)/(3*10e8))/samp_rate mags: (1,0.12) maxoutbuf: '0' minoutbuf: '0' @@ -368,7 +435,7 @@ blocks: bus_structure: null coordinate: [600, 572.0] rotation: 0 - state: disabled + state: enabled - name: digital_cma_equalizer_cc_0 id: digital_cma_equalizer_cc parameters: @@ -475,7 +542,7 @@ blocks: affinity: '' alias: '' comment: '' - vgl: testvec + list(np.zeros(4)) + vgl: list(np.zeros(frame_len)) vlen: frame_len states: bus_sink: false @@ -490,8 +557,8 @@ blocks: affinity: '' alias: '' comment: '' - fname: '' - frame_obj: '' + fname: ./lena512color.png + frame_obj: frame maxoutbuf: '0' minoutbuf: '0' states: @@ -518,7 +585,7 @@ blocks: bus_structure: null coordinate: [648, 740.0] rotation: 0 - state: enabled + state: disabled - name: fadingui_netsink_0 id: fadingui_netsink parameters: @@ -717,7 +784,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [1240, 828.0] + coordinate: [552, 852.0] rotation: 0 state: disabled - name: qtgui_time_sink_x_0 @@ -827,9 +894,9 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [928, 428.0] + coordinate: [1104, 428.0] rotation: 0 - state: true + state: enabled - name: virtual_sink_1 id: virtual_sink parameters: @@ -900,10 +967,13 @@ connections: - [analog_random_source_x_0, '0', blocks_stream_mux_0, '1'] - [blocks_complex_to_mag_0, '0', fadingui_netsink_0_0, '0'] - [blocks_complex_to_mag_0, '0', qtgui_time_sink_x_0, '0'] +- [blocks_null_source_0, '0', blocks_stream_mux_1, '0'] - [blocks_repack_bits_bb_0, '0', blocks_stream_to_vector_0, '0'] - [blocks_stream_mux_0, '0', digital_constellation_modulator_0, '0'] +- [blocks_stream_mux_1, '0', virtual_sink_0, '0'] - [blocks_stream_to_vector_0, '0', fadingui_ber_0, '0'] - [blocks_tagged_stream_align_0, '0', blocks_repack_bits_bb_0, '0'] +- [blocks_throttle_0, '0', blocks_stream_mux_1, '1'] - [blocks_throttle_0, '0', virtual_sink_0, '0'] - [blocks_vector_source_x_0, '0', blocks_stream_mux_0, '0'] - [channels_channel_model_0, '0', channels_selective_fading_model_0, '0'] @@ -918,11 +988,11 @@ connections: - [digital_corr_est_cc_0, '1', blocks_complex_to_mag_0, '0'] - [digital_pfb_clock_sync_xxx_0, '0', digital_cma_equalizer_cc_0, '0'] - [digital_pfb_clock_sync_xxx_0, '0', fadingui_netsink_4, '0'] +- [digital_pfb_clock_sync_xxx_0, '0', qtgui_const_sink_x_0, '0'] - [fadingui_datasource_0, '0', digital_constellation_modulator_0, '0'] - [fadingui_multipath_fading_0, '0', fadingui_netsink_0, '0'] - [fadingui_multipath_fading_0, '0', virtual_sink_1, '0'] - [fadingui_phasecorrection_0, '0', fadingui_netsink_3, '0'] -- [fadingui_phasecorrection_0, '0', qtgui_const_sink_x_0, '0'] - [fadingui_phasecorrection_0, '0', virtual_sink_2, '0'] - [virtual_source_0, '0', digital_constellation_decoder_cb_0, '0'] - [virtual_source_1, '0', digital_pfb_clock_sync_xxx_0, '0'] diff --git a/flowgraphs/qpsk_sim.py b/flowgraphs/qpsk_sim.py index b633bba..cb9315b 100755 --- a/flowgraphs/qpsk_sim.py +++ b/flowgraphs/qpsk_sim.py @@ -52,8 +52,7 @@ class qpsk_sim(gr.top_block): self.fadingui_netsink_1 = fadingui.netsink(address='udp://localhost:31418', dtype="complex", vlen=1) self.fadingui_netsink_0_0 = fadingui.netsink(address='udp://localhost:31415', dtype="float", vlen=1) self.fadingui_netsink_0 = fadingui.netsink(address='udp://localhost:31416', dtype="complex", vlen=1) - self.fadingui_multipath_fading_0 = fadingui.multipath_fading(amplitudes=[0.12], delays=[1.8], los =True) - self.fadingui_ber_0 = fadingui.ber(vgl=testvec + list(np.zeros(4)), vlen=frame_len,address='udp://localhost:31420') + self.fadingui_ber_0 = fadingui.ber(vgl=list(np.zeros(frame_len)), vlen=frame_len,address='udp://localhost:31420') self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, 2 * np.pi / 100, rrc_taps, 32, 16, 1.5, 1) self.digital_corr_est_cc_0 = digital.corr_est_cc(access_code_symbols, 1, len(access_code_symbols) // 2, 0.9, digital.THRESHOLD_ABSOLUTE) self.digital_constellation_modulator_0 = digital.generic_mod( @@ -66,6 +65,7 @@ class qpsk_sim(gr.top_block): log=False) self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(qpsk_const) self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(15, 1, 2e-3, 1) + self.channels_selective_fading_model_0 = channels.selective_fading_model( 8, ((2*carrier_freq)/(3*10e8))/samp_rate, False, 4.0, 21, (0,1.8), (1,0.12), 8 ) self.channels_channel_model_0 = channels.channel_model( noise_voltage=100e-3, frequency_offset=2e-3, @@ -95,7 +95,9 @@ class qpsk_sim(gr.top_block): self.connect((self.blocks_tagged_stream_align_0, 0), (self.blocks_repack_bits_bb_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0, 0)) self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_stream_mux_0, 0)) - self.connect((self.channels_channel_model_0, 0), (self.fadingui_multipath_fading_0, 0)) + self.connect((self.channels_channel_model_0, 0), (self.channels_selective_fading_model_0, 0)) + self.connect((self.channels_selective_fading_model_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) + self.connect((self.channels_selective_fading_model_0, 0), (self.fadingui_netsink_0, 0)) self.connect((self.digital_cma_equalizer_cc_0, 0), (self.digital_corr_est_cc_0, 0)) self.connect((self.digital_cma_equalizer_cc_0, 0), (self.fadingui_netsink_1, 0)) self.connect((self.digital_constellation_decoder_cb_0, 0), (self.blocks_tagged_stream_align_0, 0)) @@ -104,8 +106,6 @@ class qpsk_sim(gr.top_block): self.connect((self.digital_corr_est_cc_0, 0), (self.fadingui_phasecorrection_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.fadingui_netsink_4, 0)) - self.connect((self.fadingui_multipath_fading_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) - self.connect((self.fadingui_multipath_fading_0, 0), (self.fadingui_netsink_0, 0)) self.connect((self.fadingui_phasecorrection_0, 0), (self.digital_constellation_decoder_cb_0, 0)) self.connect((self.fadingui_phasecorrection_0, 0), (self.fadingui_netsink_3, 0)) @@ -145,6 +145,7 @@ class qpsk_sim(gr.top_block): def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.blocks_throttle_0.set_sample_rate(self.samp_rate) + self.channels_selective_fading_model_0.set_fDTs(((2*self.carrier_freq)/(3*10e8))/self.samp_rate) def get_rrc_taps(self): return self.rrc_taps @@ -170,6 +171,7 @@ class qpsk_sim(gr.top_block): def set_carrier_freq(self, carrier_freq): self.carrier_freq = carrier_freq + self.channels_selective_fading_model_0.set_fDTs(((2*self.carrier_freq)/(3*10e8))/self.samp_rate) def get_access_code_symbols(self): return self.access_code_symbols -- cgit v1.2.1