aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/gr-fadingui/grc/CMakeLists.txt3
-rw-r--r--src/gr-fadingui/grc/fadingui_multipath_fading.block.yml41
-rw-r--r--src/gr-fadingui/python/CMakeLists.txt4
-rw-r--r--src/gr-fadingui/python/__init__.py1
-rw-r--r--src/gr-fadingui/python/multipath_fading.py91
-rwxr-xr-xsrc/gr-fadingui/python/qa_multipath_fading.py41
-rw-r--r--src/gr-fadingui/python/xor_frame_sync.py2
7 files changed, 180 insertions, 3 deletions
diff --git a/src/gr-fadingui/grc/CMakeLists.txt b/src/gr-fadingui/grc/CMakeLists.txt
index 92b6add..2394de4 100644
--- a/src/gr-fadingui/grc/CMakeLists.txt
+++ b/src/gr-fadingui/grc/CMakeLists.txt
@@ -22,5 +22,6 @@ install(FILES
fadingui_dearpygui_sink.block.yml
fadingui_xor_frame_sync.block.yml
fadingui_deframer.block.yml
- fadingui_frame_obj.block.yml DESTINATION share/gnuradio/grc/blocks
+ fadingui_frame_obj.block.yml
+ fadingui_multipath_fading.block.yml DESTINATION share/gnuradio/grc/blocks
)
diff --git a/src/gr-fadingui/grc/fadingui_multipath_fading.block.yml b/src/gr-fadingui/grc/fadingui_multipath_fading.block.yml
new file mode 100644
index 0000000..e116467
--- /dev/null
+++ b/src/gr-fadingui/grc/fadingui_multipath_fading.block.yml
@@ -0,0 +1,41 @@
+id: fadingui_multipath_fading
+label: Multipath Fading
+category: '[fadingui]'
+
+templates:
+ imports: import fadingui
+ make: fadingui.multipath_fading(amplitudes=${amplitudes}, delays=${delays})
+
+# Make one 'parameters' list entry for every parameter you want settable from the GUI.
+# Keys include:
+# * id (makes the value accessible as \$keyname, e.g. in the make entry)
+# * label (label shown in the GUI)
+# * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...)
+parameters:
+- id: amplitudes
+ label: Amplitudes
+ dtype: raw
+- id: delays
+ label: Delays
+ dtype: raw
+
+# Make one 'inputs' list entry per input and one 'outputs' list entry per output.
+# Keys include:
+# * label (an identifier for the GUI)
+# * domain (optional - stream or message. Default is stream)
+# * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...)
+# * vlen (optional - data stream vector length. Default is 1)
+# * optional (optional - set to 1 for optional inputs. Default is 0)
+inputs:
+- label: in
+ domain: stream
+ dtype: complex
+
+outputs:
+- label: out
+ domain: stream
+ dtype: complex
+
+# 'file_format' specifies the version of the GRC yml format used in the file
+# and should usually not be changed.
+file_format: 1
diff --git a/src/gr-fadingui/python/CMakeLists.txt b/src/gr-fadingui/python/CMakeLists.txt
index 6ee73d3..95bb852 100644
--- a/src/gr-fadingui/python/CMakeLists.txt
+++ b/src/gr-fadingui/python/CMakeLists.txt
@@ -37,7 +37,8 @@ GR_PYTHON_INSTALL(
dearpygui_sink.py
xor_frame_sync.py
deframer.py
- frame_obj.py DESTINATION ${GR_PYTHON_DIR}/fadingui
+ frame_obj.py
+ multipath_fading.py DESTINATION ${GR_PYTHON_DIR}/fadingui
)
########################################################################
@@ -48,3 +49,4 @@ include(GrTest)
set(GR_TEST_TARGET_DEPS gnuradio-fadingui)
set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig)
GR_ADD_TEST(qa_xor_frame_sync ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_xor_frame_sync.py)
+GR_ADD_TEST(qa_multipath_fading ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_multipath_fading.py)
diff --git a/src/gr-fadingui/python/__init__.py b/src/gr-fadingui/python/__init__.py
index 5fdfea4..5a7b546 100644
--- a/src/gr-fadingui/python/__init__.py
+++ b/src/gr-fadingui/python/__init__.py
@@ -37,5 +37,6 @@ from .dearpygui_sink import dearpygui_sink
from .xor_frame_sync import xor_frame_sync
from .deframer import deframer
from .frame_obj import frame_obj
+from .multipath_fading import multipath_fading
#
diff --git a/src/gr-fadingui/python/multipath_fading.py b/src/gr-fadingui/python/multipath_fading.py
new file mode 100644
index 0000000..01f2dbe
--- /dev/null
+++ b/src/gr-fadingui/python/multipath_fading.py
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright 2021 Sara Cinzia Halter.
+#
+# This is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this software; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+
+import numpy as np
+from numpy.fft import fft,ifft,fftshift
+from gnuradio import gr
+
+from fadingui.logger import get_logger
+log = get_logger("multipath_fading")
+
+class multipath_fading(gr.sync_block):
+ """
+ docstring for block multipath_fading
+ """
+ def __init__(self, amplitudes=[], delays=[], los=True): # only default arguments here
+ """arguments to this function show up as parameters in GRC"""
+ gr.sync_block.__init__(
+ self,
+ name='Embedded Python Block', # will show up in GRC
+ in_sig=[np.complex64],
+ out_sig=[np.complex64]
+ )
+ # if an attribute with the same name as a parameter is found,
+ # a callback is registered (properties work, too).
+ self.amplitudes = amplitudes
+ self.delays = delays
+ self.temp = [0]
+ # if los:
+ # self.amplitudes.append(1)
+ # self.delays.append(0)
+ self.los= 1
+ #self.fir =
+
+ def work(self, input_items, output_items):
+ """example: multiply with constant"""
+ inp = input_items[0]
+ oup = output_items[0]
+
+ if len(self.amplitudes) != len(self.delays):
+ raise Exception("Amplitudes and Delay length dont match")
+
+ # raise Exception("Delay length can't be one")
+ #if np.min(self.delays)<=1:
+ # raise Exception("Delay length can't be one")
+ max_len = np.max(self.delays)
+ sum_x = np.zeros(max_len)
+ for(a,d) in zip(self.amplitudes,self.delays):
+ # if d-1 <= 0:
+ # x = np.concatenate([[a], np.zeros(max_len-1)])
+ # else:
+ x = np.concatenate([np.zeros(d-1), [a], np.zeros(max_len-d)])
+ sum_x += x
+
+ sum_x[0] = self.los
+ log.debug(sum_x)
+
+ #H_int = fft(sum_x)
+
+ #h = ifft(H_int)
+
+ #h[0]=1
+
+ y = np.convolve(inp, sum_x)
+
+ y+=np.concatenate([self.temp,np.zeros(len(y)-len(self.temp))])
+
+
+ oup[:] = y[:len(inp)]
+ self.temp = y[len(inp):]
+
+
+ return len(oup) \ No newline at end of file
diff --git a/src/gr-fadingui/python/qa_multipath_fading.py b/src/gr-fadingui/python/qa_multipath_fading.py
new file mode 100755
index 0000000..6a27cc6
--- /dev/null
+++ b/src/gr-fadingui/python/qa_multipath_fading.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright 2021 Sara Cinzia Halter.
+#
+# This is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this software; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+from gnuradio import blocks
+from multipath_fading import multipath_fading
+
+class qa_multipath_fading(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_001_t(self):
+ # set up fg
+ self.tb.run()
+ # check data
+
+
+if __name__ == '__main__':
+ gr_unittest.run(qa_multipath_fading)
diff --git a/src/gr-fadingui/python/xor_frame_sync.py b/src/gr-fadingui/python/xor_frame_sync.py
index 05c150a..bb5cfb1 100644
--- a/src/gr-fadingui/python/xor_frame_sync.py
+++ b/src/gr-fadingui/python/xor_frame_sync.py
@@ -9,7 +9,7 @@ from numpy_ringbuffer import RingBuffer
from gnuradio import gr
-from logger import get_logger
+from fadingui.logger import get_logger
log = get_logger("xor_frame_sync")