aboutsummaryrefslogtreecommitdiffstats
path: root/simulation/QAM_Fading
diff options
context:
space:
mode:
authorsara <sara.halter@gmx.ch>2021-11-27 16:02:16 +0100
committersara <sara.halter@gmx.ch>2021-11-27 16:02:16 +0100
commit338c6d7980947579d7419feeaa48ca8f9ae84086 (patch)
tree6598ba2996a4306162dcf5cb038e10b9fc8c0c04 /simulation/QAM_Fading
parentFix import issue in xor sync block (diff)
downloadFading-338c6d7980947579d7419feeaa48ca8f9ae84086.tar.gz
Fading-338c6d7980947579d7419feeaa48ca8f9ae84086.zip
Test FIR filter implemenatation / eigener FIR Block Gnur radio
Diffstat (limited to '')
-rw-r--r--simulation/QAM_Fading/qam_fading_V2_eigerner_block.grc77
-rwxr-xr-xsimulation/QAM_Fading/qam_fading_block.py13
2 files changed, 27 insertions, 63 deletions
diff --git a/simulation/QAM_Fading/qam_fading_V2_eigerner_block.grc b/simulation/QAM_Fading/qam_fading_V2_eigerner_block.grc
index f14bda0..1ba7d1c 100644
--- a/simulation/QAM_Fading/qam_fading_V2_eigerner_block.grc
+++ b/simulation/QAM_Fading/qam_fading_V2_eigerner_block.grc
@@ -768,58 +768,6 @@ blocks:
coordinate: [1016, 1204.0]
rotation: 0
state: true
-- name: epy_block_0
- 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 numpy.fft import fft,ifft,fftshift\nfrom 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, amplitudes=[], delays=[], los=True): # 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.amplitudes = amplitudes\n self.delays\
- \ = delays\n self.temp = [0]\n # if los:\n # self.amplitudes.append(1)\n\
- \ # self.delays.append(0)\n self.los= 1\n #self.fir\
- \ = \n\n def work(self, input_items, output_items):\n \"\"\"example:\
- \ multiply with constant\"\"\"\n inp = input_items[0]\n oup =\
- \ output_items[0]\n \n if len(self.amplitudes) != len(self.delays):\n\
- \ raise Exception(\"Amplitudes and Delay length dont match\")\n\n\
- \ # raise Exception(\"Delay length can't be one\")\n #if np.min(self.delays)<=1:\n\
- \ # raise Exception(\"Delay length can't be one\")\n max_len\
- \ = np.max(self.delays)\n sum_x = np.zeros(max_len)\n for(a,d)\
- \ in zip(self.amplitudes,self.delays):\n # if d-1 <= 0:\n \
- \ # x = np.concatenate([[a], np.zeros(max_len-1)])\n # else:\
- \ \n x = np.concatenate([np.zeros(d-1), [a], np.zeros(max_len-d)])\n\
- \ sum_x += x\n \n sum_x[0] = self.los\n print(sum_x)\n\
- \ \n #H_int = fft(sum_x)\n\n #h = ifft(H_int)\n\n \
- \ #h[0]=1\n\n y = np.convolve(inp, sum_x)\n \n y+=np.concatenate([self.temp,np.zeros(len(y)-len(self.temp))])\n\
- \ \n\n oup[:] = y[:len(inp)]\n self.temp = y[len(inp):]\
- \ \n \n\n return len(oup)"
- affinity: ''
- alias: ''
- amplitudes: '[0.2,0.2]'
- comment: ''
- delays: '[sps+1,sps+1]'
- los: 'True'
- maxoutbuf: '0'
- minoutbuf: '0'
- states:
- _io_cache: ('Embedded Python Block', 'blk', [('amplitudes', '[]'), ('delays',
- '[]'), ('los', 'True')], [('0', 'complex', 1)], [('0', 'complex', 1)], 'Embedded
- Python Block example - a simple multiply const', ['amplitudes', 'delays', 'los'])
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [968, 324.0]
- rotation: 0
- state: true
- name: epy_block_1
id: epy_block
parameters:
@@ -855,6 +803,23 @@ blocks:
coordinate: [984, 284.0]
rotation: 0
state: disabled
+- name: fadingui_multipath_fading_0
+ id: fadingui_multipath_fading
+ parameters:
+ affinity: ''
+ alias: ''
+ amplitudes: '[0.2,0.2]'
+ comment: ''
+ delays: '[sps+1,sps+1]'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [968, 324.0]
+ rotation: 0
+ state: true
- name: import_0
id: import
parameters:
@@ -1577,7 +1542,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', epy_block_0, '0']
+- [channels_channel_model_0, '0', fadingui_multipath_fading_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']
@@ -1599,9 +1564,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']
-- [epy_block_0, '0', digital_pfb_clock_sync_xxx_0, '0']
-- [epy_block_0, '0', qtgui_const_sink_x_0, '0']
-- [epy_block_0, '0', qtgui_freq_sink_x_0, '0']
+- [fadingui_multipath_fading_0, '0', digital_pfb_clock_sync_xxx_0, '0']
+- [fadingui_multipath_fading_0, '0', qtgui_const_sink_x_0, '0']
+- [fadingui_multipath_fading_0, '0', qtgui_freq_sink_x_0, '0']
metadata:
file_format: 1
diff --git a/simulation/QAM_Fading/qam_fading_block.py b/simulation/QAM_Fading/qam_fading_block.py
index b16ac7a..8186175 100755
--- a/simulation/QAM_Fading/qam_fading_block.py
+++ b/simulation/QAM_Fading/qam_fading_block.py
@@ -36,7 +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 epy_block_0
+import fadingui
import numpy as np
from gnuradio import qtgui
@@ -491,6 +491,7 @@ 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=[0.2,0.2], delays=[sps+1,sps+1])
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_2.addWidget(self._fading_1_win, 1, 0, 1, 1)
@@ -498,7 +499,6 @@ class qam_fading_block(gr.top_block, Qt.QWidget):
self.params_grid_layout_2.setRowStretch(r, 1)
for c in range(0, 1):
self.params_grid_layout_2.setColumnStretch(c, 1)
- self.epy_block_0 = epy_block_0.blk(amplitudes=[0.2,0.2], delays=[sps+1,sps+1], los=True)
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])
@@ -568,7 +568,7 @@ class qam_fading_block(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.epy_block_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.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))
@@ -590,9 +590,9 @@ class qam_fading_block(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.epy_block_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0))
- self.connect((self.epy_block_0, 0), (self.qtgui_const_sink_x_0, 0))
- self.connect((self.epy_block_0, 0), (self.qtgui_freq_sink_x_0, 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.qtgui_const_sink_x_0, 0))
+ self.connect((self.fadingui_multipath_fading_0, 0), (self.qtgui_freq_sink_x_0, 0))
def closeEvent(self, event):
@@ -606,7 +606,6 @@ class qam_fading_block(gr.top_block, Qt.QWidget):
def set_sps(self, sps):
self.sps = sps
self.set_rrc_taps(firdes.root_raised_cosine(self.nfilts, self.nfilts, 1.0/float(self.sps), self.excess_bw, 45*self.nfilts))
- self.epy_block_0.delays = [self.sps+1,self.sps+1]
def get_nfilts(self):
return self.nfilts