aboutsummaryrefslogtreecommitdiffstats
path: root/simulation/QAM
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xsimulation/QAM/qam.py19
-rwxr-xr-xsimulation/QAM_Fading/qam_fading.py24
-rw-r--r--simulation/QAM_Fading/qam_fading_V2.grc45
3 files changed, 38 insertions, 50 deletions
diff --git a/simulation/QAM/qam.py b/simulation/QAM/qam.py
index d64a687..6c069b2 100755
--- a/simulation/QAM/qam.py
+++ b/simulation/QAM/qam.py
@@ -75,22 +75,21 @@ class qam(gr.top_block, Qt.QWidget):
##################################################
# Variables
##################################################
- self.sps = sps = 4
+ self.sps = sps = 2
self.nfilts = nfilts = 32
self.excess_bw = excess_bw = 350e-3
self.timing_loop_bw = timing_loop_bw = 2 * 3.141592653589793 / 100
self.time_offset = time_offset = 1.0
self.samp_rate = samp_rate = 32000
self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), excess_bw, 45*nfilts)
- self.qam_const = qam_const = digital.constellation_rect([(-3-3j), (-1-3j), (1-3j), (3-3j), (-3-1j), (-1-1j), (1-1j), (3-1j), (-3+1j), (-1+1j), (1+1j), (3+1j), (-3+3j), (-1+3j), (1+3j), (3+3j)], [0, 4, 12, 8, 1, 5, 13, 9, 3, 7, 15, 11, 2, 6, 14, 10],
- 4, 1, 1, 1, 1).base()
self.phase_bw = phase_bw = 2 * 3.141592653589793 / 100
self.noise_volt = noise_volt = 0.0001
self.freq_offset = freq_offset = 0
self.eq_ntaps = eq_ntaps = 15
self.eq_mod = eq_mod = 1
self.eq_gain = eq_gain = .01
- self.const = const = digital.constellation_16qam().base()
+ self.const = const = digital.constellation_rect([(-3-3j), 0, 0, (3-3j), (-3-1j), 0, 0, (3-1j), (-3+1j), (-1+1j), (1+1j), (3+1j), (-3+3j), 0, 0, (3+3j)], [0, 4, 12, 8, 1, 5, 13, 9, 3, 7, 15, 11, 2, 6, 14, 10],
+ 4, 1, 1, 1, 1).base()
self.chn_taps = chn_taps = [1.0 + 0.0j, ]
##################################################
@@ -438,10 +437,10 @@ class qam(gr.top_block, Qt.QWidget):
self.plots_grid_layout_0.setRowStretch(r, 1)
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, sps)
+ self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps , timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, 1)
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_costas_loop_cc_0 = digital.costas_loop_cc(phase_bw, 2, False)
self.digital_constellation_modulator_0 = digital.generic_mod(
constellation=const,
differential=True,
@@ -451,7 +450,7 @@ class qam(gr.top_block, Qt.QWidget):
verbose=False,
log=False)
self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(const)
- self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, sps)
+ self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, 1)
self.channels_channel_model_0 = channels.channel_model(
noise_voltage=noise_volt,
frequency_offset=freq_offset,
@@ -551,12 +550,6 @@ class qam(gr.top_block, Qt.QWidget):
self.rrc_taps = rrc_taps
self.digital_pfb_clock_sync_xxx_0.update_taps(self.rrc_taps)
- def get_qam_const(self):
- return self.qam_const
-
- def set_qam_const(self, qam_const):
- self.qam_const = qam_const
-
def get_phase_bw(self):
return self.phase_bw
diff --git a/simulation/QAM_Fading/qam_fading.py b/simulation/QAM_Fading/qam_fading.py
index d6ace52..063c91b 100755
--- a/simulation/QAM_Fading/qam_fading.py
+++ b/simulation/QAM_Fading/qam_fading.py
@@ -37,6 +37,7 @@ from argparse import ArgumentParser
from gnuradio.eng_arg import eng_float, intx
from gnuradio import eng_notation
from gnuradio.qtgui import Range, RangeWidget
+import numpy as np
from gnuradio import qtgui
@@ -160,7 +161,7 @@ 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._fading_1_range = Range(1, 10, 1, 2, 200)
+ self._fading_1_range = Range(1, 30, 1, 2, 200)
self._fading_1_win = RangeWidget(self._fading_1_range, self.set_fading_1, 'Fading', "counter_slider", int)
self.params_grid_layout_0.addWidget(self._fading_1_win, 2, 0, 1, 1)
for r in range(2, 3):
@@ -490,7 +491,8 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.plots_grid_layout_0.setRowStretch(r, 1)
for c in range(0, 1):
self.plots_grid_layout_0.setColumnStretch(c, 1)
- self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, [1]+([0]*fading_1)+[0.2], 0, samp_rate)
+ self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(1, [1]+([0]*fading_1)+[0.2])
+ self.interp_fir_filter_xxx_0.declare_sample_delay(0)
self.digital_pfb_clock_sync_xxx_0_0 = digital.pfb_clock_sync_ccf(sps , timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, 1)
self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, 1)
self.digital_map_bb_0_0 = digital.map_bb([0, 1, 3, 2])
@@ -546,7 +548,7 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.connect((self.blocks_unpack_k_bits_bb_0_0, 0), (self.blocks_char_to_float_0_0, 0))
self.connect((self.blocks_unpack_k_bits_bb_0_1, 0), (self.blocks_char_to_float_0_1, 0))
self.connect((self.channels_channel_model_0, 0), (self.digital_pfb_clock_sync_xxx_0_0, 0))
- self.connect((self.channels_channel_model_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0))
+ self.connect((self.channels_channel_model_0, 0), (self.interp_fir_filter_xxx_0, 0))
self.connect((self.channels_channel_model_0, 0), (self.qtgui_const_sink_x_0, 1))
self.connect((self.channels_channel_model_0, 0), (self.qtgui_freq_sink_x_0, 1))
self.connect((self.digital_cma_equalizer_cc_0, 0), (self.digital_costas_loop_cc_0, 0))
@@ -568,9 +570,9 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_const_sink_x_0_0, 0))
self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0), (self.digital_cma_equalizer_cc_0_0, 0))
self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0), (self.qtgui_const_sink_x_0_0, 1))
- self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0))
- self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_const_sink_x_0, 0))
- self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0))
+ self.connect((self.interp_fir_filter_xxx_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0))
+ self.connect((self.interp_fir_filter_xxx_0, 0), (self.qtgui_const_sink_x_0, 0))
+ self.connect((self.interp_fir_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0))
def closeEvent(self, event):
@@ -659,7 +661,7 @@ class qam_fading(gr.top_block, Qt.QWidget):
def set_fading_1(self, fading_1):
self.fading_1 = fading_1
- self.freq_xlating_fir_filter_xxx_0.set_taps([1]+([0]*self.fading_1)+[0.2])
+ self.interp_fir_filter_xxx_0.set_taps([1]+([0]*self.fading_1)+[0.2])
def get_eq_ntaps(self):
return self.eq_ntaps
@@ -696,12 +698,6 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.chn_taps = chn_taps
self.channels_channel_model_0.set_taps(self.chn_taps)
-def snipfcn_snippet_0(self):
- import numpy as np
-
-
-def snippets_main_after_init(tb):
- snipfcn_snippet_0(tb)
@@ -716,7 +712,7 @@ def main(top_block_cls=qam_fading, options=None):
qapp = Qt.QApplication(sys.argv)
tb = top_block_cls()
- snippets_main_after_init(tb)
+
tb.start()
tb.show()
diff --git a/simulation/QAM_Fading/qam_fading_V2.grc b/simulation/QAM_Fading/qam_fading_V2.grc
index ab70648..d45e030 100644
--- a/simulation/QAM_Fading/qam_fading_V2.grc
+++ b/simulation/QAM_Fading/qam_fading_V2.grc
@@ -130,14 +130,14 @@ blocks:
rangeType: int
start: '1'
step: '1'
- stop: '10'
+ stop: '30'
value: '2'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [976, 308.0]
+ coordinate: [992, 476.0]
rotation: 0
state: true
- name: freq_offset
@@ -506,7 +506,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1544, 824.0]
+ coordinate: [1536, 788.0]
rotation: 0
state: true
- name: digital_constellation_decoder_cb_0
@@ -708,37 +708,36 @@ blocks:
coordinate: [1096, 812.0]
rotation: 0
state: true
-- name: freq_xlating_fir_filter_xxx_0
- id: freq_xlating_fir_filter_xxx
+- name: import_0
+ id: import
parameters:
- affinity: ''
alias: ''
- center_freq: '0'
comment: ''
- decim: '1'
- maxoutbuf: '0'
- minoutbuf: '0'
- samp_rate: samp_rate
- taps: '[1]+([0]*fading_1)+[0.2]'
- type: ccc
+ imports: import numpy as np
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [976, 204.0]
+ coordinate: [600, 20.0]
rotation: 0
state: true
-- name: import_0
- id: import
+- name: interp_fir_filter_xxx_0
+ id: interp_fir_filter_xxx
parameters:
+ affinity: ''
alias: ''
comment: ''
- imports: import numpy as np
+ interp: '1'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ samp_delay: '0'
+ taps: '[1]+([0]*fading_1)+[0.2]'
+ type: ccc
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [600, 20.0]
+ coordinate: [968, 348.0]
rotation: 0
state: true
- name: params
@@ -898,7 +897,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [812.0, -96]
+ coordinate: [884.0, -112]
rotation: 90
state: enabled
- name: qtgui_const_sink_x_0_0
@@ -1449,7 +1448,7 @@ connections:
- [blocks_unpack_k_bits_bb_0_0, '0', blocks_char_to_float_0_0, '0']
- [blocks_unpack_k_bits_bb_0_1, '0', blocks_char_to_float_0_1, '0']
- [channels_channel_model_0, '0', digital_pfb_clock_sync_xxx_0_0, '0']
-- [channels_channel_model_0, '0', freq_xlating_fir_filter_xxx_0, '0']
+- [channels_channel_model_0, '0', interp_fir_filter_xxx_0, '0']
- [channels_channel_model_0, '0', qtgui_const_sink_x_0, '1']
- [channels_channel_model_0, '0', qtgui_freq_sink_x_0, '1']
- [digital_cma_equalizer_cc_0, '0', digital_costas_loop_cc_0, '0']
@@ -1471,9 +1470,9 @@ connections:
- [digital_pfb_clock_sync_xxx_0, '0', qtgui_const_sink_x_0_0, '0']
- [digital_pfb_clock_sync_xxx_0_0, '0', digital_cma_equalizer_cc_0_0, '0']
- [digital_pfb_clock_sync_xxx_0_0, '0', qtgui_const_sink_x_0_0, '1']
-- [freq_xlating_fir_filter_xxx_0, '0', digital_pfb_clock_sync_xxx_0, '0']
-- [freq_xlating_fir_filter_xxx_0, '0', qtgui_const_sink_x_0, '0']
-- [freq_xlating_fir_filter_xxx_0, '0', qtgui_freq_sink_x_0, '0']
+- [interp_fir_filter_xxx_0, '0', digital_pfb_clock_sync_xxx_0, '0']
+- [interp_fir_filter_xxx_0, '0', qtgui_const_sink_x_0, '0']
+- [interp_fir_filter_xxx_0, '0', qtgui_freq_sink_x_0, '0']
metadata:
file_format: 1