aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsimulation/QAM_Fading/qam_fading.py20
-rw-r--r--simulation/QAM_Fading/qam_fading_V2_eigerner_block.grc41
-rwxr-xr-xsimulation/QAM_Fading/qam_fading_block.py33
-rw-r--r--simulation/QAM_Fading/qam_fading_frequency_selectiv.grc108
-rwxr-xr-xtests/correlator/correlator.py10
5 files changed, 145 insertions, 67 deletions
diff --git a/simulation/QAM_Fading/qam_fading.py b/simulation/QAM_Fading/qam_fading.py
index 30f2262..29991e1 100755
--- a/simulation/QAM_Fading/qam_fading.py
+++ b/simulation/QAM_Fading/qam_fading.py
@@ -36,6 +36,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
@@ -80,6 +81,7 @@ class qam_fading(gr.top_block, Qt.QWidget):
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.test = test = 1
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.phase_bw = phase_bw = 2 * 3.141592653589793 / 100
@@ -88,7 +90,8 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.eq_ntaps = eq_ntaps = 15
self.eq_mod = eq_mod = 1
self.eq_gain = eq_gain = .01
- self.const = const = digital.constellation_qpsk().base()
+ self.const = const = digital.constellation_calcdist([-1-1j, -1+1j, 1+1j, 1-1j], [0, 1, 3, 2],
+ 4, 1).base()
self.chn_taps = chn_taps = [1.0 + 0.0j, ]
##################################################
@@ -165,6 +168,13 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.params_grid_layout_1.setRowStretch(r, 1)
for c in range(0, 1):
self.params_grid_layout_1.setColumnStretch(c, 1)
+ self._test_range = Range(1, 30, 1, 1, 200)
+ self._test_win = RangeWidget(self._test_range, self.set_test, 'test', "counter_slider", int)
+ self.params_grid_layout_0.addWidget(self._test_win, 1, 2, 1, 1)
+ for r in range(1, 2):
+ self.params_grid_layout_0.setRowStretch(r, 1)
+ for c in range(2, 3):
+ self.params_grid_layout_0.setColumnStretch(c, 1)
self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
1024, #size
samp_rate, #samp_rate
@@ -456,7 +466,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, 0, True, 4, 0, (0,0.3e-6), (1,0.39), 3 )
+ self.channels_selective_fading_model_0 = channels.selective_fading_model( 8, 0, False, 4, 0, [(np.pi)], [(1)], 8 )
self.channels_channel_model_0 = channels.channel_model(
noise_voltage=noise_volt,
frequency_offset=freq_offset,
@@ -558,6 +568,12 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.time_offset = time_offset
self.channels_channel_model_0.set_timing_offset(self.time_offset)
+ def get_test(self):
+ return self.test
+
+ def set_test(self, test):
+ self.test = test
+
def get_samp_rate(self):
return self.samp_rate
diff --git a/simulation/QAM_Fading/qam_fading_V2_eigerner_block.grc b/simulation/QAM_Fading/qam_fading_V2_eigerner_block.grc
index 42a922b..3010c58 100644
--- a/simulation/QAM_Fading/qam_fading_V2_eigerner_block.grc
+++ b/simulation/QAM_Fading/qam_fading_V2_eigerner_block.grc
@@ -96,7 +96,7 @@ blocks:
rot_sym: '4'
soft_dec_lut: None
sym_map: '[0, 1, 3, 2]'
- type: 16qam
+ type: calcdist
states:
bus_sink: false
bus_source: false
@@ -768,49 +768,14 @@ blocks:
coordinate: [1016, 1204.0]
rotation: 0
state: true
-- name: epy_block_1
- id: epy_block
- parameters:
- _source_code: "\"\"\"\nEmbedded Python Blocks:\n\nEach time this file is saved,\
- \ GRC will instantiate the first class it finds\nto get ports and parameters\
- \ of your block. The arguments to __init__ will\nbe the parameters. All of\
- \ them are required to have default values!\n\"\"\"\n\nimport numpy as np\n\
- from gnuradio import gr\n\n\nclass blk(gr.sync_block): # other base classes\
- \ are basic_block, decim_block, interp_block\n \"\"\"Embedded Python Block\
- \ example - a simple multiply const\"\"\"\n\n def __init__(self, example_param=1.0):\
- \ # only default arguments here\n \"\"\"arguments to this function show\
- \ up as parameters in GRC\"\"\"\n gr.sync_block.__init__(\n \
- \ self,\n name='Embedded Python Block', # will show up in GRC\n\
- \ in_sig=[np.complex64],\n out_sig=[np.complex64]\n \
- \ )\n # if an attribute with the same name as a parameter is found,\n\
- \ # a callback is registered (properties work, too).\n self.example_param\
- \ = example_param\n\n def work(self, input_items, output_items):\n \
- \ \"\"\"example: multiply with constant\"\"\"\n output_items[0][:] =\
- \ input_items[0] * self.example_param\n return len(output_items[0])\n"
- affinity: ''
- alias: ''
- comment: ''
- example_param: ''
- maxoutbuf: '0'
- minoutbuf: '0'
- states:
- _io_cache: ('Embedded Python Block', 'blk', [('example_param', '1.0')], [('0',
- 'complex', 1)], [('0', 'complex', 1)], 'Embedded Python Block example - a simple
- multiply const', ['example_param'])
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [984, 284.0]
- rotation: 0
- state: disabled
- name: fadingui_multipath_fading_0
id: fadingui_multipath_fading
parameters:
affinity: ''
alias: ''
- amplitudes: '[amp_1]'
+ amplitudes: '[0.2]'
comment: ''
- delays: '[fading_1]'
+ delays: '[4]'
los: 'True'
maxoutbuf: '0'
minoutbuf: '0'
diff --git a/simulation/QAM_Fading/qam_fading_block.py b/simulation/QAM_Fading/qam_fading_block.py
index 416799c..3e625ea 100755
--- a/simulation/QAM_Fading/qam_fading_block.py
+++ b/simulation/QAM_Fading/qam_fading_block.py
@@ -91,7 +91,8 @@ class qam_fading_block(gr.top_block, Qt.QWidget):
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_calcdist([-1-1j, -1+1j, 1+1j, 1-1j], [0, 1, 3, 2],
+ 4, 1).base()
self.chn_taps = chn_taps = [1.0 + 0.0j, ]
self.amp_1 = amp_1 = 0.2
self.LOS_NLOS = LOS_NLOS = 1
@@ -168,13 +169,6 @@ class qam_fading_block(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, 30, 0.0001, sps, 200)
- self._fading_1_win = RangeWidget(self._fading_1_range, self.set_fading_1, 'Fading', "counter_slider", float)
- self.params_grid_layout_2.addWidget(self._fading_1_win, 1, 0, 1, 1)
- for r in range(1, 2):
- self.params_grid_layout_2.setRowStretch(r, 1)
- for c in range(0, 1):
- self.params_grid_layout_2.setColumnStretch(c, 1)
self._eq_gain_range = Range(0, .1, .001, .01, 200)
self._eq_gain_win = RangeWidget(self._eq_gain_range, self.set_eq_gain, 'Equalizer Rate', "counter_slider", float)
self.params_grid_layout_1.addWidget(self._eq_gain_win, 0, 0, 1, 1)
@@ -182,13 +176,6 @@ class qam_fading_block(gr.top_block, Qt.QWidget):
self.params_grid_layout_1.setRowStretch(r, 1)
for c in range(0, 1):
self.params_grid_layout_1.setColumnStretch(c, 1)
- self._amp_1_range = Range(0, 5, 0.1, 0.2, 200)
- self._amp_1_win = RangeWidget(self._amp_1_range, self.set_amp_1, 'Ampliude', "counter_slider", float)
- self.params_grid_layout_2.addWidget(self._amp_1_win, 1, 1, 1, 1)
- for r in range(1, 2):
- self.params_grid_layout_2.setRowStretch(r, 1)
- for c in range(1, 2):
- self.params_grid_layout_2.setColumnStretch(c, 1)
self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
1024, #size
samp_rate, #samp_rate
@@ -505,7 +492,14 @@ class qam_fading_block(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.fadingui_multipath_fading_0 = fadingui.multipath_fading(amplitudes=[amp_1], delays=[fading_1], los =True)
+ self.fadingui_multipath_fading_0 = fadingui.multipath_fading(amplitudes=[0.2], delays=[4], los =True)
+ self._fading_1_range = Range(1, 30, 0.0001, sps, 200)
+ self._fading_1_win = RangeWidget(self._fading_1_range, self.set_fading_1, 'Fading', "counter_slider", float)
+ self.params_grid_layout_2.addWidget(self._fading_1_win, 1, 0, 1, 1)
+ for r in range(1, 2):
+ self.params_grid_layout_2.setRowStretch(r, 1)
+ for c in range(0, 1):
+ self.params_grid_layout_2.setColumnStretch(c, 1)
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])
@@ -542,6 +536,13 @@ class qam_fading_block(gr.top_block, Qt.QWidget):
self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1)
self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
self.analog_random_source_x_0 = blocks.vector_source_b(list(map(int, numpy.random.randint(0, 256, 1000))), True)
+ self._amp_1_range = Range(0, 5, 0.1, 0.2, 200)
+ self._amp_1_win = RangeWidget(self._amp_1_range, self.set_amp_1, 'Ampliude', "counter_slider", float)
+ self.params_grid_layout_2.addWidget(self._amp_1_win, 1, 1, 1, 1)
+ for r in range(1, 2):
+ self.params_grid_layout_2.setRowStretch(r, 1)
+ for c in range(1, 2):
+ self.params_grid_layout_2.setColumnStretch(c, 1)
self._LOS_NLOS_range = Range(0, 1, 1, 1, 200)
self._LOS_NLOS_win = RangeWidget(self._LOS_NLOS_range, self.set_LOS_NLOS, 'LOS_NLOS', "counter_slider", int)
self.params_grid_layout_2.addWidget(self._LOS_NLOS_win, 0, 0, 1, 1)
diff --git a/simulation/QAM_Fading/qam_fading_frequency_selectiv.grc b/simulation/QAM_Fading/qam_fading_frequency_selectiv.grc
index ce87db8..6d2c7da 100644
--- a/simulation/QAM_Fading/qam_fading_frequency_selectiv.grc
+++ b/simulation/QAM_Fading/qam_fading_frequency_selectiv.grc
@@ -54,7 +54,7 @@ blocks:
rot_sym: '4'
soft_dec_lut: None
sym_map: '[0, 1, 3, 2]'
- type: qpsk
+ type: calcdist
states:
bus_sink: false
bus_source: false
@@ -230,6 +230,27 @@ blocks:
coordinate: [224, 268.0]
rotation: 0
state: true
+- name: test
+ id: variable_qtgui_range
+ parameters:
+ comment: ''
+ gui_hint: 'params@0: 1,2,1,1'
+ label: test
+ min_len: '200'
+ orient: Qt.Horizontal
+ rangeType: int
+ start: '1'
+ step: '1'
+ stop: '30'
+ value: '1'
+ widget: counter_slider
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [768, 44.0]
+ rotation: 0
+ state: true
- name: time_offset
id: variable_qtgui_range
parameters:
@@ -450,29 +471,77 @@ blocks:
coordinate: [648, 316.0]
rotation: 0
state: enabled
+- name: channels_selective_fading_model2_0
+ id: channels_selective_fading_model2
+ parameters:
+ K: '5.1'
+ LOS: 'False'
+ N: '20'
+ affinity: ''
+ alias: ''
+ comment: ''
+ delay_maxdev: (0.5,0.7,0.9)
+ delay_std: (1e-4,1e-4,1e-4)
+ delays: (1.0,1.9,2.7)
+ fDTs: '0'
+ mags: (1,0.95,0.8)
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ ntaps: '8'
+ seed: '0'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [904, 292.0]
+ rotation: 0
+ state: disabled
- name: channels_selective_fading_model_0
id: channels_selective_fading_model
parameters:
K: '4'
- LOS: 'True'
+ LOS: 'False'
N: '8'
affinity: ''
alias: ''
comment: ''
- delays: (0,0.3e-6)
+ delays: (np.pi)
fDTs: '0'
- mags: (1,0.39)
+ mags: (1)
maxoutbuf: '0'
minoutbuf: '0'
- ntaps: '3'
+ ntaps: '8'
seed: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [976, 308.0]
+ coordinate: [968, 476.0]
rotation: 0
- state: true
+ state: enabled
+- name: channels_selective_fading_model_2
+ id: channels_selective_fading_model
+ parameters:
+ K: '4.0'
+ LOS: 'False'
+ N: '30'
+ affinity: ''
+ alias: ''
+ comment: ''
+ delays: (0.0,0.1,1.3)
+ fDTs: '0'
+ mags: (1,0.99,0.97)
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ ntaps: '8'
+ seed: '0'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [928, 140.0]
+ rotation: 0
+ state: disabled
- name: digital_cma_equalizer_cc_0
id: digital_cma_equalizer_cc
parameters:
@@ -710,6 +779,19 @@ blocks:
coordinate: [1088, 868.0]
rotation: 0
state: true
+- name: import_0
+ id: import
+ parameters:
+ alias: ''
+ comment: ''
+ imports: import numpy as np
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [536, 156.0]
+ rotation: 0
+ state: true
- name: params
id: qtgui_tab_widget
parameters:
@@ -867,7 +949,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1036.0, -64]
+ coordinate: [1084.0, -104]
rotation: 90
state: enabled
- name: qtgui_const_sink_x_0_0
@@ -1223,7 +1305,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1080.0, 656]
+ coordinate: [1080.0, 680]
rotation: 270
state: true
- name: qtgui_freq_sink_x_2_1
@@ -1417,13 +1499,21 @@ connections:
- [blocks_unpack_k_bits_bb_0, '0', blocks_char_to_float_0, '0']
- [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', channels_selective_fading_model2_0, '0']
- [channels_channel_model_0, '0', channels_selective_fading_model_0, '0']
+- [channels_channel_model_0, '0', channels_selective_fading_model_2, '0']
- [channels_channel_model_0, '0', digital_pfb_clock_sync_xxx_0_0, '0']
- [channels_channel_model_0, '0', qtgui_const_sink_x_0, '1']
- [channels_channel_model_0, '0', qtgui_freq_sink_x_0, '1']
+- [channels_selective_fading_model2_0, '0', digital_pfb_clock_sync_xxx_0, '0']
+- [channels_selective_fading_model2_0, '0', qtgui_const_sink_x_0, '0']
+- [channels_selective_fading_model2_0, '0', qtgui_freq_sink_x_0, '0']
- [channels_selective_fading_model_0, '0', digital_pfb_clock_sync_xxx_0, '0']
- [channels_selective_fading_model_0, '0', qtgui_const_sink_x_0, '0']
- [channels_selective_fading_model_0, '0', qtgui_freq_sink_x_0, '0']
+- [channels_selective_fading_model_2, '0', digital_pfb_clock_sync_xxx_0, '0']
+- [channels_selective_fading_model_2, '0', qtgui_const_sink_x_0, '0']
+- [channels_selective_fading_model_2, '0', qtgui_freq_sink_x_0, '0']
- [digital_cma_equalizer_cc_0, '0', digital_costas_loop_cc_0, '0']
- [digital_cma_equalizer_cc_0, '0', qtgui_const_sink_x_1, '0']
- [digital_cma_equalizer_cc_0_0, '0', digital_costas_loop_cc_0_0, '0']
diff --git a/tests/correlator/correlator.py b/tests/correlator/correlator.py
index fddf8ea..d9dedb2 100755
--- a/tests/correlator/correlator.py
+++ b/tests/correlator/correlator.py
@@ -7,7 +7,7 @@
# GNU Radio Python Flow Graph
# Title: Correlator Test
# Author: Naoki Pross
-# GNU Radio version: 3.8.1.0
+# GNU Radio version: 3.8.2.0
from distutils.version import StrictVersion
@@ -37,6 +37,7 @@ from gnuradio import eng_notation
import epy_block_0
import epy_block_1
import numpy as np
+
from gnuradio import qtgui
class correlator(gr.top_block, Qt.QWidget):
@@ -389,6 +390,7 @@ class correlator(gr.top_block, Qt.QWidget):
self.connect((self.epy_block_0, 0), (self.digital_constellation_decoder_cb_0, 0))
self.connect((self.epy_block_0, 0), (self.qtgui_const_sink_x_0_0, 0))
+
def closeEvent(self, event):
self.settings = Qt.QSettings("GNU Radio", "correlator")
self.settings.setValue("geometry", self.saveGeometry())
@@ -469,6 +471,8 @@ class correlator(gr.top_block, Qt.QWidget):
+
+
def main(top_block_cls=correlator, options=None):
if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
@@ -477,7 +481,9 @@ def main(top_block_cls=correlator, options=None):
qapp = Qt.QApplication(sys.argv)
tb = top_block_cls()
+
tb.start()
+
tb.show()
def sig_handler(sig=None, frame=None):
@@ -493,9 +499,9 @@ def main(top_block_cls=correlator, options=None):
def quitting():
tb.stop()
tb.wait()
+
qapp.aboutToQuit.connect(quitting)
qapp.exec_()
-
if __name__ == '__main__':
main()