From 338c6d7980947579d7419feeaa48ca8f9ae84086 Mon Sep 17 00:00:00 2001 From: sara Date: Sat, 27 Nov 2021 16:02:16 +0100 Subject: Test FIR filter implemenatation / eigener FIR Block Gnur radio --- .../QAM_Fading/qam_fading_V2_eigerner_block.grc | 77 ++++++---------------- 1 file changed, 21 insertions(+), 56 deletions(-) (limited to 'simulation/QAM_Fading/qam_fading_V2_eigerner_block.grc') 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 -- cgit v1.2.1