aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsara <sara.halter@gmx.ch>2021-12-03 20:46:20 +0100
committersara <sara.halter@gmx.ch>2021-12-03 20:46:20 +0100
commitcafce753722ec8d396cadfdf991b5c6f5a18dc12 (patch)
treef51c4e5255ccca8989a13b870ebdaeddafa9c8bb /src
parentImprove frequency LPF (diff)
downloadFading-cafce753722ec8d396cadfdf991b5c6f5a18dc12.tar.gz
Fading-cafce753722ec8d396cadfdf991b5c6f5a18dc12.zip
BER Block Fertig gestellt
Diffstat (limited to 'src')
-rw-r--r--src/gr-fadingui/grc/fadingui_ber.block.yml16
-rw-r--r--src/gr-fadingui/python/ber.py29
-rwxr-xr-xsrc/gr-fadingui/python/qa_ber.py13
3 files changed, 34 insertions, 24 deletions
diff --git a/src/gr-fadingui/grc/fadingui_ber.block.yml b/src/gr-fadingui/grc/fadingui_ber.block.yml
index 3383df5..3070311 100644
--- a/src/gr-fadingui/grc/fadingui_ber.block.yml
+++ b/src/gr-fadingui/grc/fadingui_ber.block.yml
@@ -4,7 +4,7 @@ category: '[fadingui]'
templates:
imports: import fadingui
- make: fadingui.ber(vgl=${vgl})
+ make: fadingui.ber(vgl=${vgl}, vlen=${vlen})
# Make one 'parameters' list entry for every parameter you want settable from the GUI.
# Keys include:
@@ -12,12 +12,12 @@ templates:
# * label (label shown in the GUI)
# * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...)
parameters:
- - id: vgl
- label: Vergleichsparameter
- dtype: raw
-# - id: ...
-# label: ...
-# dtype: ...
+- id: vgl
+ label: Vergleichsparameter
+ dtype: raw
+- id: vlen
+ label: Vec Length
+ dtype: int
# Make one 'inputs' list entry per input and one 'outputs' list entry per output.
# Keys include:
@@ -30,7 +30,7 @@ inputs:
- label: in
domain: stream
dtype: byte
-
+ vlen: ${vlen}
# 'file_format' specifies the version of the GRC yml format used in the file
# and should usually not be changed.
diff --git a/src/gr-fadingui/python/ber.py b/src/gr-fadingui/python/ber.py
index 387b75f..e966f17 100644
--- a/src/gr-fadingui/python/ber.py
+++ b/src/gr-fadingui/python/ber.py
@@ -30,26 +30,29 @@ class ber(gr.sync_block):
"""
docstring for block ber
"""
- def __init__(self, vgl):
+ def __init__(self, vgl, vlen):
gr.sync_block.__init__(self,
name="ber",
- in_sig=[np.byte, ],
+ in_sig=[np.dtype(str(vlen) + "b")],
out_sig=None)
self.vgl=vgl
-
-
+ self.vlen=vlen
def work(self, input_items, output_items):
+
inp = input_items[0]
- # <+signal processing here+>
-
- v = self.vgl^inp
- v_array= np.array(v,dtype = np.uint8)
-
- ber = sum(np.unpackbits(v_array))
-
-
- log.debug(ber)
+ ber_tot = 0
+ log.debug(f"Length: {len(inp)}")
+ log.debug(f"Inp_vector:{inp}")
+
+ for i in inp:
+ log.debug(f"In Schlaufe{i}")
+ v = np.array(self.vgl, dtype=np.uint8)^np.array(i, dtype=np.uint8)
+ ber = sum(np.unpackbits(v))
+ log.debug(f"BER {ber} in Paket {i}")
+ ber_tot+=ber
+ log.debug(f"BER Total{ber_tot}")
+
return len(input_items[0])
diff --git a/src/gr-fadingui/python/qa_ber.py b/src/gr-fadingui/python/qa_ber.py
index 8b6d56e..cb6c198 100755
--- a/src/gr-fadingui/python/qa_ber.py
+++ b/src/gr-fadingui/python/qa_ber.py
@@ -22,6 +22,7 @@
from gnuradio import gr, gr_unittest
from gnuradio import blocks
from ber import ber
+import numpy as np
class qa_ber(gr_unittest.TestCase):
@@ -32,9 +33,15 @@ class qa_ber(gr_unittest.TestCase):
self.tb = None
def test_001_t(self):
- # set up fg
- self.tb.run()
- # check data
+ # pattern = np.array([0xaa], dtype=np.uint8)
+ # testdata = np.array([0xc0, 0xfa, 0xae] * 4, dtype=np.uint8)
+
+ # src = blocks.vector_source_b(testdata)
+ # op = ber(pattern)
+
+ # self.tb.connect(src, op)
+ # self.tb.run()
+ pass
if __name__ == '__main__':