From 75edb689e503769dcb1ab228e4a59ea2e0cf8d9e Mon Sep 17 00:00:00 2001 From: sara Date: Tue, 14 Dec 2021 18:57:29 +0100 Subject: BER block angepasst --- flowgraphs/qpsk_hw.grc | 12 ++++++------ flowgraphs/qpsk_hw.py | 4 ++-- flowgraphs/qpsk_sim.grc | 4 ++-- flowgraphs/qpsk_sim.py | 12 ------------ 4 files changed, 10 insertions(+), 22 deletions(-) (limited to 'flowgraphs') diff --git a/flowgraphs/qpsk_hw.grc b/flowgraphs/qpsk_hw.grc index 2ebc340..a0d6872 100644 --- a/flowgraphs/qpsk_hw.grc +++ b/flowgraphs/qpsk_hw.grc @@ -131,7 +131,7 @@ blocks: id: variable parameters: comment: '' - value: 1e6 + value: 5e5 states: bus_sink: false bus_source: false @@ -361,7 +361,7 @@ blocks: minoutbuf: '0' sps: '1' symbols: access_code_symbols - threshold: '0.85' + threshold: '0.7' threshold_method: digital.THRESHOLD_ABSOLUTE states: bus_sink: false @@ -386,7 +386,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [520, 1100.0] + coordinate: [520, 1084.0] rotation: 0 state: enabled - name: digital_pfb_clock_sync_xxx_0 @@ -424,7 +424,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [1184, 1300.0] + coordinate: [1184, 1292.0] rotation: 0 state: true - name: fadingui_datasource_0 @@ -1000,7 +1000,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [312, 692.0] + coordinate: [336, 684.0] rotation: 0 state: true - name: uhd_usrp_source_0 @@ -1450,7 +1450,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [56, 764.0] + coordinate: [80, 756.0] rotation: 0 state: true diff --git a/flowgraphs/qpsk_hw.py b/flowgraphs/qpsk_hw.py index eb6bf70..9db06a3 100755 --- a/flowgraphs/qpsk_hw.py +++ b/flowgraphs/qpsk_hw.py @@ -81,7 +81,7 @@ class qpsk_hw(gr.top_block, Qt.QWidget): self.sps = sps = 4 self.nfilts = nfilts = 32 self.excess_bw = excess_bw = 0.35 - self.samp_rate = samp_rate = 1e6 + self.samp_rate = samp_rate = 5e5 self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), excess_bw, 45*nfilts) self.qpsk_const = qpsk_const = digital.constellation_qpsk().base() self.frame_len = frame_len = len(testvec) +4 @@ -210,7 +210,7 @@ class qpsk_hw(gr.top_block, Qt.QWidget): self.fadingui_ber_0 = fadingui.ber(vgl=testvec + list(np.zeros(4)), vlen=frame_len) 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_lms_dd_equalizer_cc_0 = digital.lms_dd_equalizer_cc(15, 3e-3, 1, qpsk_const) - self.digital_corr_est_cc_0 = digital.corr_est_cc(access_code_symbols, 1, len(access_code_symbols) // 2, 0.85, digital.THRESHOLD_ABSOLUTE) + self.digital_corr_est_cc_0 = digital.corr_est_cc(access_code_symbols, 1, len(access_code_symbols) // 2, 0.7, digital.THRESHOLD_ABSOLUTE) self.digital_constellation_modulator_0 = digital.generic_mod( constellation=qpsk_const, differential=False, diff --git a/flowgraphs/qpsk_sim.grc b/flowgraphs/qpsk_sim.grc index 7be9ec8..a8dd485 100644 --- a/flowgraphs/qpsk_sim.grc +++ b/flowgraphs/qpsk_sim.grc @@ -366,7 +366,7 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [600, 572.0] + coordinate: [568, 548.0] rotation: 0 state: disabled - name: digital_cma_equalizer_cc_0 @@ -816,7 +816,7 @@ blocks: bus_structure: null coordinate: [1248, 1060.0] rotation: 0 - state: disabled + state: enabled - name: virtual_sink_0 id: virtual_sink parameters: diff --git a/flowgraphs/qpsk_sim.py b/flowgraphs/qpsk_sim.py index b633bba..1e00180 100755 --- a/flowgraphs/qpsk_sim.py +++ b/flowgraphs/qpsk_sim.py @@ -47,11 +47,6 @@ class qpsk_sim(gr.top_block): # Blocks ################################################## self.fadingui_phasecorrection_0 = fadingui.phasecorrection(frame_len) - self.fadingui_netsink_4 = fadingui.netsink(address='udp://localhost:31417', dtype="complex", vlen=1) - self.fadingui_netsink_3 = fadingui.netsink(address='udp://localhost:31419', dtype="complex", vlen=1) - 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.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, 2 * np.pi / 100, rrc_taps, 32, 16, 1.5, 1) @@ -79,7 +74,6 @@ class qpsk_sim(gr.top_block): self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_char*1, frame_len) self.blocks_stream_mux_0 = blocks.stream_mux(gr.sizeof_char*1, [len(testvec), 4]) self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(2, 8, "", False, gr.GR_LSB_FIRST) - self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.analog_random_source_x_0 = blocks.vector_source_b(list(map(int, numpy.random.randint(0, 255, 400))), True) @@ -88,7 +82,6 @@ class qpsk_sim(gr.top_block): # Connections ################################################## self.connect((self.analog_random_source_x_0, 0), (self.blocks_stream_mux_0, 1)) - self.connect((self.blocks_complex_to_mag_0, 0), (self.fadingui_netsink_0_0, 0)) self.connect((self.blocks_repack_bits_bb_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_stream_mux_0, 0), (self.digital_constellation_modulator_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fadingui_ber_0, 0)) @@ -97,17 +90,12 @@ class qpsk_sim(gr.top_block): 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.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)) self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_throttle_0, 0)) - self.connect((self.digital_corr_est_cc_0, 1), (self.blocks_complex_to_mag_0, 0)) 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)) def get_testvec(self): -- cgit v1.2.1 From 06f4ef810c7089c8b994f438b90b293762133bdd Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Tue, 14 Dec 2021 19:40:03 +0100 Subject: Implement network_value to show BER --- flowgraphs/qpsk_sim.grc | 8 ++++---- flowgraphs/qpsk_sim.py | 20 +++++++++++++++++--- 2 files changed, 21 insertions(+), 7 deletions(-) (limited to 'flowgraphs') diff --git a/flowgraphs/qpsk_sim.grc b/flowgraphs/qpsk_sim.grc index a8dd485..75bf3e1 100644 --- a/flowgraphs/qpsk_sim.grc +++ b/flowgraphs/qpsk_sim.grc @@ -366,9 +366,9 @@ blocks: bus_sink: false bus_source: false bus_structure: null - coordinate: [568, 548.0] + coordinate: [592, 572.0] rotation: 0 - state: disabled + state: enabled - name: digital_cma_equalizer_cc_0 id: digital_cma_equalizer_cc parameters: @@ -518,7 +518,7 @@ blocks: bus_structure: null coordinate: [648, 740.0] rotation: 0 - state: enabled + state: disabled - name: fadingui_netsink_0 id: fadingui_netsink parameters: @@ -816,7 +816,7 @@ blocks: bus_structure: null coordinate: [1248, 1060.0] rotation: 0 - state: enabled + state: disabled - name: virtual_sink_0 id: virtual_sink parameters: diff --git a/flowgraphs/qpsk_sim.py b/flowgraphs/qpsk_sim.py index 1e00180..63d8a6e 100755 --- a/flowgraphs/qpsk_sim.py +++ b/flowgraphs/qpsk_sim.py @@ -47,7 +47,11 @@ class qpsk_sim(gr.top_block): # Blocks ################################################## self.fadingui_phasecorrection_0 = fadingui.phasecorrection(frame_len) - self.fadingui_multipath_fading_0 = fadingui.multipath_fading(amplitudes=[0.12], delays=[1.8], los =True) + self.fadingui_netsink_4 = fadingui.netsink(address='udp://localhost:31417', dtype="complex", vlen=1) + self.fadingui_netsink_3 = fadingui.netsink(address='udp://localhost:31419', dtype="complex", vlen=1) + 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_ber_0 = fadingui.ber(vgl=testvec + list(np.zeros(4)), 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) @@ -61,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, ((4*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, @@ -74,6 +79,7 @@ class qpsk_sim(gr.top_block): self.blocks_stream_to_vector_0 = blocks.stream_to_vector(gr.sizeof_char*1, frame_len) self.blocks_stream_mux_0 = blocks.stream_mux(gr.sizeof_char*1, [len(testvec), 4]) self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(2, 8, "", False, gr.GR_LSB_FIRST) + self.blocks_complex_to_mag_0 = blocks.complex_to_mag(1) self.analog_random_source_x_0 = blocks.vector_source_b(list(map(int, numpy.random.randint(0, 255, 400))), True) @@ -82,20 +88,26 @@ class qpsk_sim(gr.top_block): # Connections ################################################## self.connect((self.analog_random_source_x_0, 0), (self.blocks_stream_mux_0, 1)) + self.connect((self.blocks_complex_to_mag_0, 0), (self.fadingui_netsink_0_0, 0)) self.connect((self.blocks_repack_bits_bb_0, 0), (self.blocks_stream_to_vector_0, 0)) self.connect((self.blocks_stream_mux_0, 0), (self.digital_constellation_modulator_0, 0)) self.connect((self.blocks_stream_to_vector_0, 0), (self.fadingui_ber_0, 0)) 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)) self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_throttle_0, 0)) + self.connect((self.digital_corr_est_cc_0, 1), (self.blocks_complex_to_mag_0, 0)) 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.fadingui_multipath_fading_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) + self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.fadingui_netsink_4, 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)) def get_testvec(self): @@ -133,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(((4*self.carrier_freq)/(3*10e8))/self.samp_rate) def get_rrc_taps(self): return self.rrc_taps @@ -158,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(((4*self.carrier_freq)/(3*10e8))/self.samp_rate) def get_access_code_symbols(self): return self.access_code_symbols -- cgit v1.2.1