aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--flowgraphs/qpsk_hw.grc96
-rwxr-xr-xflowgraphs/qpsk_hw.py75
-rwxr-xr-xhardware/QPSK/qpks.py4
-rw-r--r--hardware/QPSK/qpsk.grc4
-rwxr-xr-xsimulation/QAM_Fading/qam_fading.py56
-rw-r--r--src/gr-fadingui/python/ber.py14
-rw-r--r--src/gr-fadingui/python/phasecorrection.py5
7 files changed, 109 insertions, 145 deletions
diff --git a/flowgraphs/qpsk_hw.grc b/flowgraphs/qpsk_hw.grc
index c47a5df..2ebc340 100644
--- a/flowgraphs/qpsk_hw.grc
+++ b/flowgraphs/qpsk_hw.grc
@@ -36,10 +36,10 @@ blocks:
id: variable
parameters:
comment: ''
- value: '[(-0.7071067811865475-0.7071067811865475j), (0.7071067811865475-0.7071067811865475j),
+ value: 2 * np.array([(-0.7071067811865475-0.7071067811865475j), (0.7071067811865475-0.7071067811865475j),
(0.7071067811865475+0.7071067811865475j), (0.7071067811865475+0.7071067811865475j),
(-0.7071067811865475-0.7071067811865475j), (0.7071067811865475+0.7071067811865475j),
- (0.7071067811865475-0.7071067811865475j), (0.7071067811865475-0.7071067811865475j)]'
+ (0.7071067811865475-0.7071067811865475j), (0.7071067811865475-0.7071067811865475j)])
states:
bus_sink: false
bus_source: false
@@ -124,7 +124,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [432, 1156.0]
+ coordinate: [256, 932.0]
rotation: 0
state: true
- name: samp_rate
@@ -274,25 +274,6 @@ blocks:
coordinate: [496, 1308.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: samp_rate
- type: complex
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [720, 428.0]
- rotation: 0
- state: true
- name: blocks_vector_source_x_0
id: blocks_vector_source_x
parameters:
@@ -331,7 +312,7 @@ blocks:
bus_structure: null
coordinate: [528, 980.0]
rotation: 0
- state: true
+ state: disabled
- name: digital_constellation_decoder_cb_0
id: digital_constellation_decoder_cb
parameters:
@@ -380,7 +361,7 @@ blocks:
minoutbuf: '0'
sps: '1'
symbols: access_code_symbols
- threshold: '0.9'
+ threshold: '0.85'
threshold_method: digital.THRESHOLD_ABSOLUTE
states:
bus_sink: false
@@ -389,6 +370,25 @@ blocks:
coordinate: [768, 972.0]
rotation: 0
state: true
+- name: digital_lms_dd_equalizer_cc_0
+ id: digital_lms_dd_equalizer_cc
+ parameters:
+ affinity: ''
+ alias: ''
+ cnst: qpsk_const
+ comment: ''
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ mu: 3e-3
+ num_taps: '15'
+ sps: '1'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [520, 1100.0]
+ rotation: 0
+ state: enabled
- name: digital_pfb_clock_sync_xxx_0
id: digital_pfb_clock_sync_xxx
parameters:
@@ -523,7 +523,7 @@ blocks:
bus_structure: null
coordinate: [1008, 988.0]
rotation: 0
- state: true
+ state: enabled
- name: import_0
id: import
parameters:
@@ -537,7 +537,7 @@ blocks:
coordinate: [224, 12.0]
rotation: 0
state: enabled
-- name: qtgui_const_sink_x_0
+- name: qtgui_const_sink_x_0_0
id: qtgui_const_sink_x
parameters:
affinity: ''
@@ -557,7 +557,7 @@ blocks:
color1: '"blue"'
color10: '"red"'
color2: '"red"'
- color3: '"red"'
+ color3: '"dark green"'
color4: '"red"'
color5: '"red"'
color6: '"red"'
@@ -589,7 +589,7 @@ blocks:
marker8: '0'
marker9: '0'
name: '""'
- nconnections: '1'
+ nconnections: '3'
size: '1024'
style1: '0'
style10: '0'
@@ -626,7 +626,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1240, 828.0]
+ coordinate: [1128, 784.0]
rotation: 0
state: true
- name: qtgui_time_sink_x_0
@@ -795,7 +795,7 @@ blocks:
bw7: '0'
bw8: '0'
bw9: '0'
- center_freq0: '0'
+ center_freq0: 2.4e9
center_freq1: '0'
center_freq10: '0'
center_freq11: '0'
@@ -828,7 +828,7 @@ blocks:
center_freq8: '0'
center_freq9: '0'
clock_rate: 0e0
- clock_source0: ''
+ clock_source0: external
clock_source1: ''
clock_source2: ''
clock_source3: ''
@@ -837,9 +837,9 @@ blocks:
clock_source6: ''
clock_source7: ''
comment: ''
- dev_addr: '""'
+ dev_addr: '"serial=309AF59 "'
dev_args: '""'
- gain0: '0'
+ gain0: '0.4'
gain1: '0'
gain10: '0'
gain11: '0'
@@ -939,7 +939,7 @@ blocks:
maxoutbuf: '0'
minoutbuf: '0'
nchan: '1'
- norm_gain0: 'False'
+ norm_gain0: 'True'
norm_gain1: 'False'
norm_gain10: 'False'
norm_gain11: 'False'
@@ -1000,7 +1000,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [320, 700.0]
+ coordinate: [312, 692.0]
rotation: 0
state: true
- name: uhd_usrp_source_0
@@ -1072,7 +1072,7 @@ blocks:
bw7: '0'
bw8: '0'
bw9: '0'
- center_freq0: '0'
+ center_freq0: 2.4e9
center_freq1: '0'
center_freq10: '0'
center_freq11: '0'
@@ -1105,7 +1105,7 @@ blocks:
center_freq8: '0'
center_freq9: '0'
clock_rate: 0e0
- clock_source0: ''
+ clock_source0: external
clock_source1: ''
clock_source2: ''
clock_source3: ''
@@ -1146,9 +1146,9 @@ blocks:
dc_offs_enb7: '""'
dc_offs_enb8: '""'
dc_offs_enb9: '""'
- dev_addr: '""'
+ dev_addr: '"serial=309AF6A "'
dev_args: '""'
- gain0: '0'
+ gain0: '1'
gain1: '0'
gain10: '0'
gain11: '0'
@@ -1279,7 +1279,7 @@ blocks:
maxoutbuf: '0'
minoutbuf: '0'
nchan: '1'
- norm_gain0: 'False'
+ norm_gain0: 'True'
norm_gain1: 'False'
norm_gain10: 'False'
norm_gain11: 'False'
@@ -1372,7 +1372,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [696, 692.0]
+ coordinate: [696, 676.0]
rotation: 0
state: true
- name: virtual_sink_0
@@ -1385,7 +1385,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [928, 428.0]
+ coordinate: [768, 428.0]
rotation: 0
state: true
- name: virtual_sink_1
@@ -1450,7 +1450,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [56, 756.0]
+ coordinate: [56, 764.0]
rotation: 0
state: true
@@ -1461,20 +1461,24 @@ connections:
- [blocks_stream_mux_0, '0', digital_constellation_modulator_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', virtual_sink_0, '0']
- [blocks_vector_source_x_0, '0', blocks_stream_mux_0, '0']
- [digital_cma_equalizer_cc_0, '0', digital_corr_est_cc_0, '0']
- [digital_cma_equalizer_cc_0, '0', fadingui_netsink_1, '0']
+- [digital_cma_equalizer_cc_0, '0', qtgui_const_sink_x_0_0, '1']
- [digital_constellation_decoder_cb_0, '0', blocks_tagged_stream_align_0, '0']
-- [digital_constellation_modulator_0, '0', blocks_throttle_0, '0']
- [digital_constellation_modulator_0, '0', fadingui_netsink_0, '0']
+- [digital_constellation_modulator_0, '0', virtual_sink_0, '0']
- [digital_corr_est_cc_0, '0', fadingui_phasecorrection_0, '0']
- [digital_corr_est_cc_0, '1', blocks_complex_to_mag_0, '0']
+- [digital_lms_dd_equalizer_cc_0, '0', digital_corr_est_cc_0, '0']
+- [digital_lms_dd_equalizer_cc_0, '0', qtgui_const_sink_x_0_0, '1']
- [digital_pfb_clock_sync_xxx_0, '0', digital_cma_equalizer_cc_0, '0']
+- [digital_pfb_clock_sync_xxx_0, '0', digital_lms_dd_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, '0']
- [fadingui_datasource_0, '0', digital_constellation_modulator_0, '0']
- [fadingui_phasecorrection_0, '0', fadingui_netsink_3, '0']
-- [fadingui_phasecorrection_0, '0', qtgui_const_sink_x_0, '0']
+- [fadingui_phasecorrection_0, '0', qtgui_const_sink_x_0_0, '2']
- [fadingui_phasecorrection_0, '0', virtual_sink_2, '0']
- [uhd_usrp_source_0, '0', virtual_sink_1, '0']
- [virtual_source_0, '0', digital_constellation_decoder_cb_0, '0']
diff --git a/flowgraphs/qpsk_hw.py b/flowgraphs/qpsk_hw.py
index 6f64876..eb6bf70 100755
--- a/flowgraphs/qpsk_hw.py
+++ b/flowgraphs/qpsk_hw.py
@@ -85,26 +85,27 @@ class qpsk_hw(gr.top_block, Qt.QWidget):
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
- self.access_code_symbols = access_code_symbols = [(-0.7071067811865475-0.7071067811865475j), (0.7071067811865475-0.7071067811865475j), (0.7071067811865475+0.7071067811865475j), (0.7071067811865475+0.7071067811865475j), (-0.7071067811865475-0.7071067811865475j), (0.7071067811865475+0.7071067811865475j), (0.7071067811865475-0.7071067811865475j), (0.7071067811865475-0.7071067811865475j)]
+ self.access_code_symbols = access_code_symbols = 2 * np.array([(-0.7071067811865475-0.7071067811865475j), (0.7071067811865475-0.7071067811865475j), (0.7071067811865475+0.7071067811865475j), (0.7071067811865475+0.7071067811865475j), (-0.7071067811865475-0.7071067811865475j), (0.7071067811865475+0.7071067811865475j), (0.7071067811865475-0.7071067811865475j), (0.7071067811865475-0.7071067811865475j)])
##################################################
# Blocks
##################################################
self.uhd_usrp_source_0 = uhd.usrp_source(
- ",".join(("", "")),
+ ",".join(("serial=309AF6A ", "")),
uhd.stream_args(
cpu_format="fc32",
args='',
channels=list(range(0,1)),
),
)
- self.uhd_usrp_source_0.set_center_freq(0, 0)
- self.uhd_usrp_source_0.set_gain(0, 0)
+ self.uhd_usrp_source_0.set_clock_source('external', 0)
+ self.uhd_usrp_source_0.set_center_freq(2.4e9, 0)
+ self.uhd_usrp_source_0.set_normalized_gain(1, 0)
self.uhd_usrp_source_0.set_antenna('RX2', 0)
self.uhd_usrp_source_0.set_samp_rate(samp_rate)
self.uhd_usrp_source_0.set_time_unknown_pps(uhd.time_spec())
self.uhd_usrp_sink_0 = uhd.usrp_sink(
- ",".join(("", "")),
+ ",".join(("serial=309AF59 ", "")),
uhd.stream_args(
cpu_format="fc32",
args='',
@@ -112,8 +113,9 @@ class qpsk_hw(gr.top_block, Qt.QWidget):
),
'',
)
- self.uhd_usrp_sink_0.set_center_freq(0, 0)
- self.uhd_usrp_sink_0.set_gain(0, 0)
+ 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.4, 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())
@@ -164,25 +166,25 @@ class qpsk_hw(gr.top_block, Qt.QWidget):
self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win)
- self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
+ self.qtgui_const_sink_x_0_0 = qtgui.const_sink_c(
1024, #size
"", #name
- 1 #number of inputs
+ 3 #number of inputs
)
- self.qtgui_const_sink_x_0.set_update_time(0.10)
- self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
- self.qtgui_const_sink_x_0.set_x_axis(-2, 2)
- self.qtgui_const_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
- self.qtgui_const_sink_x_0.enable_autoscale(False)
- self.qtgui_const_sink_x_0.enable_grid(False)
- self.qtgui_const_sink_x_0.enable_axis_labels(True)
+ self.qtgui_const_sink_x_0_0.set_update_time(0.10)
+ self.qtgui_const_sink_x_0_0.set_y_axis(-2, 2)
+ self.qtgui_const_sink_x_0_0.set_x_axis(-2, 2)
+ self.qtgui_const_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
+ self.qtgui_const_sink_x_0_0.enable_autoscale(False)
+ self.qtgui_const_sink_x_0_0.enable_grid(False)
+ self.qtgui_const_sink_x_0_0.enable_axis_labels(True)
labels = ['', '', '', '', '',
'', '', '', '', '']
widths = [1, 1, 1, 1, 1,
1, 1, 1, 1, 1]
- colors = ["blue", "red", "red", "red", "red",
+ colors = ["blue", "red", "dark green", "red", "red",
"red", "red", "red", "red", "red"]
styles = [0, 0, 0, 0, 0,
0, 0, 0, 0, 0]
@@ -191,23 +193,24 @@ class qpsk_hw(gr.top_block, Qt.QWidget):
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):
+ for i in range(3):
if len(labels[i]) == 0:
- self.qtgui_const_sink_x_0.set_line_label(i, "Data {0}".format(i))
+ self.qtgui_const_sink_x_0_0.set_line_label(i, "Data {0}".format(i))
else:
- self.qtgui_const_sink_x_0.set_line_label(i, labels[i])
- self.qtgui_const_sink_x_0.set_line_width(i, widths[i])
- self.qtgui_const_sink_x_0.set_line_color(i, colors[i])
- self.qtgui_const_sink_x_0.set_line_style(i, styles[i])
- self.qtgui_const_sink_x_0.set_line_marker(i, markers[i])
- self.qtgui_const_sink_x_0.set_line_alpha(i, alphas[i])
-
- self._qtgui_const_sink_x_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0.pyqwidget(), Qt.QWidget)
- self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_win)
+ self.qtgui_const_sink_x_0_0.set_line_label(i, labels[i])
+ self.qtgui_const_sink_x_0_0.set_line_width(i, widths[i])
+ self.qtgui_const_sink_x_0_0.set_line_color(i, colors[i])
+ self.qtgui_const_sink_x_0_0.set_line_style(i, styles[i])
+ self.qtgui_const_sink_x_0_0.set_line_marker(i, markers[i])
+ self.qtgui_const_sink_x_0_0.set_line_alpha(i, alphas[i])
+
+ self._qtgui_const_sink_x_0_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0_0.pyqwidget(), Qt.QWidget)
+ self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_0_win)
self.fadingui_phasecorrection_0 = fadingui.phasecorrection(frame_len)
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_corr_est_cc_0 = digital.corr_est_cc(access_code_symbols, 1, len(access_code_symbols) // 2, 0.9, digital.THRESHOLD_ABSOLUTE)
+ 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_constellation_modulator_0 = digital.generic_mod(
constellation=qpsk_const,
differential=False,
@@ -217,9 +220,7 @@ class qpsk_hw(gr.top_block, Qt.QWidget):
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(15, 1, 2e-3, 1)
self.blocks_vector_source_x_0 = blocks.vector_source_b(testvec, True, 1, [])
- self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
self.blocks_tagged_stream_align_0 = blocks.tagged_stream_align(gr.sizeof_char*1, 'frame_start')
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])
@@ -238,16 +239,17 @@ class qpsk_hw(gr.top_block, Qt.QWidget):
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.uhd_usrp_sink_0, 0))
self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_stream_mux_0, 0))
- self.connect((self.digital_cma_equalizer_cc_0, 0), (self.digital_corr_est_cc_0, 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_constellation_modulator_0, 0), (self.uhd_usrp_sink_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_lms_dd_equalizer_cc_0, 0), (self.digital_corr_est_cc_0, 0))
+ self.connect((self.digital_lms_dd_equalizer_cc_0, 0), (self.qtgui_const_sink_x_0_0, 1))
+ self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_lms_dd_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.fadingui_phasecorrection_0, 0), (self.digital_constellation_decoder_cb_0, 0))
- self.connect((self.fadingui_phasecorrection_0, 0), (self.qtgui_const_sink_x_0, 0))
+ self.connect((self.fadingui_phasecorrection_0, 0), (self.qtgui_const_sink_x_0_0, 2))
self.connect((self.uhd_usrp_source_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0))
@@ -291,7 +293,6 @@ class qpsk_hw(gr.top_block, Qt.QWidget):
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
- self.blocks_throttle_0.set_sample_rate(self.samp_rate)
self.qtgui_time_sink_x_0.set_samp_rate(self.samp_rate / self.sps)
self.uhd_usrp_sink_0.set_samp_rate(self.samp_rate)
self.uhd_usrp_source_0.set_samp_rate(self.samp_rate)
diff --git a/hardware/QPSK/qpks.py b/hardware/QPSK/qpks.py
index f89ac12..dee7994 100755
--- a/hardware/QPSK/qpks.py
+++ b/hardware/QPSK/qpks.py
@@ -80,7 +80,7 @@ class qpks(gr.top_block, Qt.QWidget):
self.nfilts = nfilts = 32
self.excess_bw = excess_bw = .35
self.timing_loop_bw = timing_loop_bw = 2 * 3.141592653589793 / 100
- self.samp_rate = samp_rate = .4e6
+ self.samp_rate = samp_rate = 1e6
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_rect([0.707+0.707j, -0.707+0.707j, -0.707-0.707j, 0.707-0.707j], [0, 1, 3, 2],
4, 2, 2, 1, 1).base()
@@ -837,7 +837,7 @@ class qpks(gr.top_block, Qt.QWidget):
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_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 = blocks.file_source(gr.sizeof_char*1, '/home/sara/Documents/Fading/hardware/QPSK/lena512color.tiff', True, 0, 0)
self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL)
diff --git a/hardware/QPSK/qpsk.grc b/hardware/QPSK/qpsk.grc
index fd17712..279385d 100644
--- a/hardware/QPSK/qpsk.grc
+++ b/hardware/QPSK/qpsk.grc
@@ -158,7 +158,7 @@ blocks:
id: variable
parameters:
comment: ''
- value: .4e6
+ value: 1e6
states:
bus_sink: false
bus_source: false
@@ -215,7 +215,7 @@ blocks:
alias: ''
begin_tag: pmt.PMT_NIL
comment: ''
- file: /home/god/Documents/Fading/hardware/QPSK/lena512color.tiff
+ file: /home/sara/Documents/Fading/hardware/QPSK/lena512color.tiff
length: '0'
maxoutbuf: '0'
minoutbuf: '0'
diff --git a/simulation/QAM_Fading/qam_fading.py b/simulation/QAM_Fading/qam_fading.py
index c6116f4..56a3847 100755
--- a/simulation/QAM_Fading/qam_fading.py
+++ b/simulation/QAM_Fading/qam_fading.py
@@ -29,7 +29,6 @@ from gnuradio import blocks
import numpy
from gnuradio import channels
from gnuradio import digital
-from gnuradio import filter
from gnuradio import gr
import sys
import signal
@@ -88,7 +87,7 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.phase_bw = phase_bw = 2 * 3.141592653589793 / 100
self.noise_volt = noise_volt = 0.0001
self.freq_offset = freq_offset = 0
- self.fc = fc = 1
+ self.fc = fc = 2.4
self.eq_ntaps = eq_ntaps = 15
self.eq_mod = eq_mod = 1
self.eq_gain = eq_gain = .01
@@ -163,8 +162,8 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.params_grid_layout_0.setRowStretch(r, 1)
for c in range(0, 1):
self.params_grid_layout_0.setColumnStretch(c, 1)
- self._fc_range = Range(0, 1000000000, 1, 1, 200)
- self._fc_win = RangeWidget(self._fc_range, self.set_fc, 'fc', "counter_slider", int)
+ self._fc_range = Range(0, 10, 1, 2.4, 200)
+ self._fc_win = RangeWidget(self._fc_range, self.set_fc, 'fc', "counter_slider", float)
self.params_grid_layout_0.addWidget(self._fc_win, 1, 2, 1, 1)
for r in range(1, 2):
self.params_grid_layout_0.setRowStretch(r, 1)
@@ -272,46 +271,6 @@ class qam_fading(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_const_sink_x_3 = qtgui.const_sink_c(
- 1024, #size
- "", #name
- 1 #number of inputs
- )
- self.qtgui_const_sink_x_3.set_update_time(0.10)
- self.qtgui_const_sink_x_3.set_y_axis(-2, 2)
- self.qtgui_const_sink_x_3.set_x_axis(-2, 2)
- self.qtgui_const_sink_x_3.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
- self.qtgui_const_sink_x_3.enable_autoscale(False)
- self.qtgui_const_sink_x_3.enable_grid(False)
- self.qtgui_const_sink_x_3.enable_axis_labels(True)
-
-
- labels = ['', '', '', '', '',
- '', '', '', '', '']
- widths = [1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1]
- colors = ["blue", "red", "red", "red", "red",
- "red", "red", "red", "red", "red"]
- styles = [0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0]
- markers = [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_const_sink_x_3.set_line_label(i, "Data {0}".format(i))
- else:
- self.qtgui_const_sink_x_3.set_line_label(i, labels[i])
- self.qtgui_const_sink_x_3.set_line_width(i, widths[i])
- self.qtgui_const_sink_x_3.set_line_color(i, colors[i])
- self.qtgui_const_sink_x_3.set_line_style(i, styles[i])
- self.qtgui_const_sink_x_3.set_line_marker(i, markers[i])
- self.qtgui_const_sink_x_3.set_line_alpha(i, alphas[i])
-
- self._qtgui_const_sink_x_3_win = sip.wrapinstance(self.qtgui_const_sink_x_3.pyqwidget(), Qt.QWidget)
- self.top_grid_layout.addWidget(self._qtgui_const_sink_x_3_win)
self.qtgui_const_sink_x_2 = qtgui.const_sink_c(
1024, #size
"Locked", #name
@@ -508,7 +467,7 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(const)
self.digital_cma_equalizer_cc_0_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, 2)
self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, 2)
- self.channels_selective_fading_model_0 = channels.selective_fading_model( 8, ((4*fc)/(3*10e8))/samp_rate, False, 4, 0, (0,2e-5/samp_rate), (1,0.12), 8 )
+ self.channels_selective_fading_model_0 = channels.selective_fading_model( 8, ((2*fc*1e9)/(3*10e8))/samp_rate, False, 4, 0, (0,1.8), (1,0.12), 8 )
self.channels_channel_model_0 = channels.channel_model(
noise_voltage=noise_volt,
frequency_offset=freq_offset,
@@ -555,7 +514,6 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_diff_decoder_bb_0, 0))
self.connect((self.digital_constellation_decoder_cb_0_0, 0), (self.digital_diff_decoder_bb_0_0, 0))
self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_throttle_0, 0))
- self.connect((self.digital_constellation_modulator_0, 0), (self.qtgui_const_sink_x_3, 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, 0), (self.digital_constellation_decoder_cb_0_0, 0))
@@ -623,8 +581,7 @@ class qam_fading(gr.top_block, Qt.QWidget):
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.blocks_throttle_0.set_sample_rate(self.samp_rate)
- self.blocks_throttle_0_0.set_sample_rate(self.samp_rate)
- self.channels_selective_fading_model_0.set_fDTs(((4*self.fc)/(3*10e8))/self.samp_rate)
+ self.channels_selective_fading_model_0.set_fDTs(((2*self.fc*1e9)/(3*10e8))/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)
@@ -635,7 +592,6 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.rrc_taps = rrc_taps
self.digital_pfb_clock_sync_xxx_0.update_taps(self.rrc_taps)
self.digital_pfb_clock_sync_xxx_0_0.update_taps(self.rrc_taps)
- self.fir_filter_xxx_0.set_taps(self.rrc_taps)
def get_phase_bw(self):
return self.phase_bw
@@ -664,7 +620,7 @@ class qam_fading(gr.top_block, Qt.QWidget):
def set_fc(self, fc):
self.fc = fc
- self.channels_selective_fading_model_0.set_fDTs(((4*self.fc)/(3*10e8))/self.samp_rate)
+ self.channels_selective_fading_model_0.set_fDTs(((2*self.fc*1e9)/(3*10e8))/self.samp_rate)
def get_eq_ntaps(self):
return self.eq_ntaps
diff --git a/src/gr-fadingui/python/ber.py b/src/gr-fadingui/python/ber.py
index e966f17..5b71f35 100644
--- a/src/gr-fadingui/python/ber.py
+++ b/src/gr-fadingui/python/ber.py
@@ -26,6 +26,8 @@ from gnuradio import gr
from fadingui.logger import get_logger
log = get_logger("ber")
+np.set_printoptions(formatter={'int': hex})
+
class ber(gr.sync_block):
"""
docstring for block ber
@@ -41,18 +43,16 @@ class ber(gr.sync_block):
def work(self, input_items, output_items):
inp = input_items[0]
- ber_tot = 0
log.debug(f"Length: {len(inp)}")
log.debug(f"Inp_vector:{inp}")
for i in inp:
- log.debug(f"In Schlaufe{i}")
- v = np.array(self.vgl, dtype=np.uint8)^np.array(i, dtype=np.uint8)
+ i = np.array(i, dtype=np.uint8)
+ v = np.array(self.vgl, dtype=np.uint8) ^ i
ber = sum(np.unpackbits(v))
- log.debug(f"BER {ber} in Paket {i}")
- ber_tot+=ber
- log.debug(f"BER Total{ber_tot}")
-
+
+ trueber = ber - 32
+ log.debug(f"BER {trueber if trueber > 0 else 0} in Paket {i}")
return len(input_items[0])
diff --git a/src/gr-fadingui/python/phasecorrection.py b/src/gr-fadingui/python/phasecorrection.py
index cd3fa37..9acf563 100644
--- a/src/gr-fadingui/python/phasecorrection.py
+++ b/src/gr-fadingui/python/phasecorrection.py
@@ -68,12 +68,15 @@ class phasecorrection(gr.sync_block):
phasediff = (ephase - sphase) % (2 * np.pi)
freq = phasediff / nsamples
+ if freq < 1e-3:
+ freq = 0
+
# save this one for the last block (see variable `end' in self.work)
self.lastfreq = freq
# debugging
log.debug(f"Correction for chunk of {nsamples:2d} samples is " \
- f"sphase={sphase: .4f} rad and freq={freq*1e3: .4f}e-3 rad / sample")
+ f"sphase={sphase: .4f} rad, ephase={ephase: .4f} rad and freq={freq*1e3: .4f}e-3 rad / sample")
self.lastnsamples = nsamples
# compute chunk values