aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2021-12-04 17:05:29 +0100
committerNao Pross <np@0hm.ch>2021-12-04 17:05:29 +0100
commit9d0910c5140b28a84017b9bbb4def22d15425518 (patch)
tree26836d9005a93afabbb71edd6fddbc194e601a5f /tests
parentUpdate documentation (diff)
parentUpdate net.py to decode UDP data stream (diff)
downloadFading-9d0910c5140b28a84017b9bbb4def22d15425518.tar.gz
Fading-9d0910c5140b28a84017b9bbb4def22d15425518.zip
Merge branch 'master' of github.com:NaoPross/Fading
Diffstat (limited to 'tests')
-rw-r--r--tests/BER/Bit_error.grc156
-rwxr-xr-xtests/BER/Test_Bit_Errorrate.py161
-rw-r--r--tests/correlator/correlator.grc975
-rwxr-xr-xtests/correlator/correlator.py325
-rw-r--r--tests/correlator/epy_block_0.py124
-rw-r--r--tests/correlator/epy_block_1.py27
-rw-r--r--tests/sockets/Socket_test.grc (renamed from tests/zmq/zmqtest.grc)92
-rwxr-xr-xtests/sockets/Test_Bit_Errorrate.py (renamed from tests/zmq/zmqtest.py)33
-rw-r--r--tests/sockets/send.py21
-rw-r--r--tests/zmq/lena512color.tiffbin786572 -> 0 bytes
-rw-r--r--tests/zmq/server.py4
11 files changed, 897 insertions, 1021 deletions
diff --git a/tests/BER/Bit_error.grc b/tests/BER/Bit_error.grc
new file mode 100644
index 0000000..1a1a891
--- /dev/null
+++ b/tests/BER/Bit_error.grc
@@ -0,0 +1,156 @@
+options:
+ parameters:
+ author: 'Sara Halter '
+ category: '[GRC Hier Blocks]'
+ cmake_opt: ''
+ comment: ''
+ copyright: ''
+ description: ''
+ gen_cmake: 'On'
+ gen_linking: dynamic
+ generate_options: qt_gui
+ hier_block_src_path: '.:'
+ id: Test_Bit_Errorrate
+ max_nouts: '0'
+ output_language: python
+ placement: (0,0)
+ qt_qss_theme: ''
+ realtime_scheduling: ''
+ run: 'True'
+ run_command: '{python} -u {filename}'
+ run_options: prompt
+ sizing_mode: fixed
+ thread_safe_setters: ''
+ title: 'Bit Error Rate test '
+ window_size: ''
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [8, 8]
+ rotation: 0
+ state: enabled
+
+blocks:
+- name: samp_rate
+ id: variable
+ parameters:
+ comment: ''
+ value: '32000'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [184, 12]
+ rotation: 0
+ state: enabled
+- name: testvec
+ id: variable
+ parameters:
+ comment: ''
+ value: '[31, 53] + [0x12, 0xe3, 0x9b, 0xee, 0x84, 0x23, 0x41, 0xf3]'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [216, 396.0]
+ rotation: 0
+ state: enabled
+- name: vlen
+ id: variable
+ parameters:
+ comment: ''
+ value: '10'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [216, 196.0]
+ rotation: 0
+ state: true
+- name: wrong
+ id: variable
+ parameters:
+ comment: ''
+ value: list(np.random.randint(0, 255, dtype=np.uint8, size=10))
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [216, 460.0]
+ rotation: 0
+ state: true
+- name: blocks_throttle_0
+ id: blocks_throttle
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ ignoretag: 'True'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ samples_per_second: samp_rate
+ type: byte
+ vlen: vlen
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [448, 292.0]
+ rotation: 0
+ state: true
+- name: blocks_vector_source_x_0
+ id: blocks_vector_source_x
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ repeat: 'True'
+ tags: '[]'
+ type: byte
+ vector: testvec + list(np.random.randint(0, 255, dtype=np.uint8, size=10))
+ vlen: vlen
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [216, 276.0]
+ rotation: 0
+ state: enabled
+- name: fadingui_ber_0
+ id: fadingui_ber
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ vgl: testvec
+ vlen: vlen
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [672, 292.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: [328, 20.0]
+ rotation: 0
+ state: true
+
+connections:
+- [blocks_throttle_0, '0', fadingui_ber_0, '0']
+- [blocks_vector_source_x_0, '0', blocks_throttle_0, '0']
+
+metadata:
+ file_format: 1
diff --git a/tests/BER/Test_Bit_Errorrate.py b/tests/BER/Test_Bit_Errorrate.py
new file mode 100755
index 0000000..a861ae7
--- /dev/null
+++ b/tests/BER/Test_Bit_Errorrate.py
@@ -0,0 +1,161 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+#
+# SPDX-License-Identifier: GPL-3.0
+#
+# GNU Radio Python Flow Graph
+# Title: Bit Error Rate test
+# Author: Sara Halter
+# GNU Radio version: 3.8.2.0
+
+from distutils.version import StrictVersion
+
+if __name__ == '__main__':
+ import ctypes
+ import sys
+ if sys.platform.startswith('linux'):
+ try:
+ x11 = ctypes.cdll.LoadLibrary('libX11.so')
+ x11.XInitThreads()
+ except:
+ print("Warning: failed to XInitThreads()")
+
+from gnuradio import blocks
+from gnuradio import gr
+from gnuradio.filter import firdes
+import sys
+import signal
+from PyQt5 import Qt
+from argparse import ArgumentParser
+from gnuradio.eng_arg import eng_float, intx
+from gnuradio import eng_notation
+import fadingui
+import numpy as np
+
+from gnuradio import qtgui
+
+class Test_Bit_Errorrate(gr.top_block, Qt.QWidget):
+
+ def __init__(self):
+ gr.top_block.__init__(self, "Bit Error Rate test ")
+ Qt.QWidget.__init__(self)
+ self.setWindowTitle("Bit Error Rate test ")
+ qtgui.util.check_set_qss()
+ try:
+ self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
+ except:
+ pass
+ self.top_scroll_layout = Qt.QVBoxLayout()
+ self.setLayout(self.top_scroll_layout)
+ self.top_scroll = Qt.QScrollArea()
+ self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
+ self.top_scroll_layout.addWidget(self.top_scroll)
+ self.top_scroll.setWidgetResizable(True)
+ self.top_widget = Qt.QWidget()
+ self.top_scroll.setWidget(self.top_widget)
+ self.top_layout = Qt.QVBoxLayout(self.top_widget)
+ self.top_grid_layout = Qt.QGridLayout()
+ self.top_layout.addLayout(self.top_grid_layout)
+
+ self.settings = Qt.QSettings("GNU Radio", "Test_Bit_Errorrate")
+
+ try:
+ if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
+ self.restoreGeometry(self.settings.value("geometry").toByteArray())
+ else:
+ self.restoreGeometry(self.settings.value("geometry"))
+ except:
+ pass
+
+ ##################################################
+ # Variables
+ ##################################################
+ self.wrong = wrong = list(np.random.randint(0, 255, dtype=np.uint8, size=10))
+ self.vlen = vlen = 10
+ self.testvec = testvec = [31, 53] + [0x12, 0xe3, 0x9b, 0xee, 0x84, 0x23, 0x41, 0xf3]
+ self.samp_rate = samp_rate = 32000
+
+ ##################################################
+ # Blocks
+ ##################################################
+ self.fadingui_ber_0 = fadingui.ber(vgl=testvec, vlen=vlen)
+ self.blocks_vector_source_x_0 = blocks.vector_source_b(testvec + list(np.random.randint(0, 255, dtype=np.uint8, size=10)), True, vlen, [])
+ self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*vlen, samp_rate,True)
+
+
+
+ ##################################################
+ # Connections
+ ##################################################
+ self.connect((self.blocks_throttle_0, 0), (self.fadingui_ber_0, 0))
+ self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_throttle_0, 0))
+
+
+ def closeEvent(self, event):
+ self.settings = Qt.QSettings("GNU Radio", "Test_Bit_Errorrate")
+ self.settings.setValue("geometry", self.saveGeometry())
+ event.accept()
+
+ def get_wrong(self):
+ return self.wrong
+
+ def set_wrong(self, wrong):
+ self.wrong = wrong
+
+ def get_vlen(self):
+ return self.vlen
+
+ def set_vlen(self, vlen):
+ self.vlen = vlen
+
+ def get_testvec(self):
+ return self.testvec
+
+ def set_testvec(self, testvec):
+ self.testvec = testvec
+ self.blocks_vector_source_x_0.set_data(self.testvec + list(np.random.randint(0, 255, dtype=np.uint8, size=10)), [])
+
+ def get_samp_rate(self):
+ return self.samp_rate
+
+ def set_samp_rate(self, samp_rate):
+ self.samp_rate = samp_rate
+ self.blocks_throttle_0.set_sample_rate(self.samp_rate)
+
+
+
+
+
+def main(top_block_cls=Test_Bit_Errorrate, options=None):
+
+ if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
+ style = gr.prefs().get_string('qtgui', 'style', 'raster')
+ Qt.QApplication.setGraphicsSystem(style)
+ qapp = Qt.QApplication(sys.argv)
+
+ tb = top_block_cls()
+
+ tb.start()
+
+ tb.show()
+
+ def sig_handler(sig=None, frame=None):
+ Qt.QApplication.quit()
+
+ signal.signal(signal.SIGINT, sig_handler)
+ signal.signal(signal.SIGTERM, sig_handler)
+
+ timer = Qt.QTimer()
+ timer.start(500)
+ timer.timeout.connect(lambda: None)
+
+ def quitting():
+ tb.stop()
+ tb.wait()
+
+ qapp.aboutToQuit.connect(quitting)
+ qapp.exec_()
+
+if __name__ == '__main__':
+ main()
diff --git a/tests/correlator/correlator.grc b/tests/correlator/correlator.grc
index 9deec54..c34e5a9 100644
--- a/tests/correlator/correlator.grc
+++ b/tests/correlator/correlator.grc
@@ -1,7 +1,6 @@
options:
parameters:
author: Naoki Pross
- catch_exceptions: 'True'
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
@@ -23,6 +22,7 @@ options:
sizing_mode: fixed
thread_safe_setters: ''
title: Correlator Test
+ window_size: ''
states:
bus_sink: false
bus_source: false
@@ -36,34 +36,15 @@ blocks:
id: variable
parameters:
comment: ''
- value: '[(-1.4142135623730951-1.4142135623730951j), (1.4142135623730951-1.4142135623730951j),
+ value: .5 * np.array([(-1.4142135623730951-1.4142135623730951j), (1.4142135623730951-1.4142135623730951j),
(1.4142135623730951+1.4142135623730951j), (1.4142135623730951+1.4142135623730951j),
(-1.4142135623730951-1.4142135623730951j), (1.4142135623730951+1.4142135623730951j),
- (1.4142135623730951-1.4142135623730951j), (1.4142135623730951-1.4142135623730951j)]'
+ (1.4142135623730951-1.4142135623730951j), (1.4142135623730951-1.4142135623730951j)])
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [776, 1140.0]
- rotation: 0
- state: enabled
-- name: access_code_symbols_sps
- id: variable
- parameters:
- comment: ''
- value: '[(1.4142197+1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j),
- (1.4142197+1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j),
- (1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j),
- (1.4142197-1.4142197j), (-1.4142197-1.4142197j), (-1.4142197-1.4142197j), (-1.4142197-1.4142197j),
- (-1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j),
- (1.4142197-1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j),
- (1.4142197+1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j),
- (1.4142197+1.4142197j)]'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [224, 132.0]
+ coordinate: [792, 788.0]
rotation: 0
state: enabled
- name: const
@@ -72,7 +53,6 @@ blocks:
comment: ''
const_points: '[-1-1j, -1+1j, 1+1j, 1-1j]'
dims: '1'
- normalization: digital.constellation.AMPLITUDE_NORMALIZATION
precision: '8'
rot_sym: '4'
soft_dec_lut: None
@@ -82,7 +62,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [592, 484.0]
+ coordinate: [592, 360.0]
rotation: 0
state: enabled
- name: excess_bw
@@ -94,7 +74,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [496, 484.0]
+ coordinate: [496, 360.0]
rotation: 0
state: enabled
- name: nfilts
@@ -106,7 +86,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [224, 988.0]
+ coordinate: [224, 856.0]
rotation: 0
state: enabled
- name: revconj_access_code_symbols
@@ -121,7 +101,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [48, 564.0]
+ coordinate: [784, 1052.0]
rotation: 0
state: enabled
- name: rrc_taps
@@ -133,14 +113,14 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [304, 988.0]
+ coordinate: [304, 856.0]
rotation: 0
state: enabled
- name: samp_rate
id: variable
parameters:
comment: ''
- value: '32000'
+ value: int(1.5e6)
states:
bus_sink: false
bus_source: false
@@ -164,76 +144,24 @@ blocks:
id: variable
parameters:
comment: ''
- value: '[31, 53] + [0x12, 0xe3, 0x9b, 0xee, 0x84, 0x23, 0x41, 0xf3]'
+ value: '[0x1f, 0x35] + [0x12, 0xe3, 0x9b, 0xee, 0x84, 0x23, 0x41, 0xf3] '
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [48, 492.0]
+ coordinate: [48, 360.0]
rotation: 0
state: enabled
- name: timing_loop_bw
id: variable
parameters:
comment: ''
- value: 2 * 3.141592653589793 / 100
+ value: 2 * np.pi / 100
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [224, 1068.0]
- rotation: 0
- state: enabled
-- name: blocks_burst_tagger_0
- id: blocks_burst_tagger
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- false_key: nothing
- false_value: '0'
- maxoutbuf: '0'
- minoutbuf: '0'
- true_key: peak
- true_value: 'True'
- type: float
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [944, 1580.0]
- rotation: 0
- state: disabled
-- name: blocks_char_to_short_0
- id: blocks_char_to_short
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- maxoutbuf: '0'
- minoutbuf: '0'
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [752, 1624.0]
- rotation: 0
- state: disabled
-- name: blocks_complex_to_magphase_0
- id: blocks_complex_to_magphase
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- maxoutbuf: '0'
- minoutbuf: '0'
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [1048, 696.0]
+ coordinate: [224, 936.0]
rotation: 0
state: enabled
- name: blocks_complex_to_magphase_0_0
@@ -249,41 +177,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1048, 1104.0]
- rotation: 0
- state: enabled
-- name: blocks_complex_to_magphase_0_1
- id: blocks_complex_to_magphase
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- maxoutbuf: '0'
- minoutbuf: '0'
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [256, 1592.0]
- rotation: 0
- state: disabled
-- name: blocks_multiply_const_vxx_0
- id: blocks_multiply_const_vxx
- parameters:
- affinity: ''
- alias: ''
- comment: ''
- const: 180 / 3.141592653589793
- maxoutbuf: '0'
- minoutbuf: '0'
- type: float
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [1288, 724.0]
+ coordinate: [1056, 984.0]
rotation: 0
state: enabled
- name: blocks_multiply_const_vxx_0_0
@@ -301,41 +195,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1336, 1180.0]
- rotation: 0
- state: disabled
-- name: blocks_null_sink_0
- id: blocks_null_sink
- parameters:
- affinity: ''
- alias: ''
- bus_structure_sink: '[[0,],]'
- comment: ''
- num_inputs: '1'
- type: byte
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [1504, 1696.0]
- rotation: 0
- state: disabled
-- name: blocks_null_sink_2
- id: blocks_null_sink
- parameters:
- affinity: ''
- alias: ''
- bus_structure_sink: '[[0,],]'
- comment: ''
- num_inputs: '1'
- type: float
- vlen: '1'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [528, 1720.0]
+ coordinate: [1312, 1076.0]
rotation: 0
state: disabled
- name: blocks_null_sink_3
@@ -352,7 +212,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1336, 1232.0]
+ coordinate: [1360, 1016.0]
rotation: 0
state: true
- name: blocks_null_source_0
@@ -371,34 +231,36 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [96, 344.0]
+ coordinate: [96, 200.0]
rotation: 0
state: enabled
-- name: blocks_peak_detector2_fb_0
- id: blocks_peak_detector2_fb
+- name: blocks_repack_bits_bb_0
+ id: blocks_repack_bits_bb
parameters:
affinity: ''
alias: ''
- alpha: '0.001'
+ align_output: 'False'
comment: ''
- look_ahead: '1000'
+ endianness: gr.GR_MSB_FIRST
+ k: '2'
+ l: '8'
+ len_tag_key: '""'
maxoutbuf: '0'
minoutbuf: '0'
- threshold_factor_rise: '7'
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [528, 1620.0]
+ coordinate: [672, 1252.0]
rotation: 0
- state: disabled
+ state: true
- name: blocks_stream_mux_0
id: blocks_stream_mux
parameters:
affinity: ''
alias: ''
comment: ''
- lengths: '[10, len(testvec)]'
+ lengths: '[0, len(testvec)]'
maxoutbuf: '0'
minoutbuf: '0'
num_inputs: '2'
@@ -408,68 +270,66 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [288, 392.0]
+ coordinate: [288, 256.0]
rotation: 0
state: enabled
-- name: blocks_stream_mux_1
- id: blocks_stream_mux
+- name: blocks_tag_debug_0
+ id: blocks_tag_debug
parameters:
affinity: ''
alias: ''
comment: ''
- lengths: '[len(access_code_symbols_sps), sps * (len(testvec) + 15)]'
- maxoutbuf: '0'
- minoutbuf: '0'
- num_inputs: '2'
- type: complex
+ display: 'True'
+ filter: '""'
+ name: ''
+ num_inputs: '1'
+ type: byte
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [776, 280.0]
+ coordinate: [1208, 1164.0]
rotation: 0
state: disabled
-- name: blocks_throttle_0
- id: blocks_throttle
+- name: blocks_tagged_stream_align_0
+ id: blocks_tagged_stream_align
parameters:
affinity: ''
alias: ''
comment: ''
- ignoretag: 'True'
+ lengthtagname: frame_start
maxoutbuf: '0'
minoutbuf: '0'
- samples_per_second: samp_rate
- type: complex
+ type: byte
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1272, 404.0]
+ coordinate: [928, 1260.0]
rotation: 0
- state: enabled
-- name: blocks_vector_source_x_0
- id: blocks_vector_source_x
+ state: true
+- name: blocks_throttle_0
+ id: blocks_throttle
parameters:
affinity: ''
alias: ''
comment: ''
+ ignoretag: 'True'
maxoutbuf: '0'
minoutbuf: '0'
- repeat: 'False'
- tags: '[]'
- type: byte
- vector: testvec * 1600
+ samples_per_second: samp_rate
+ type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [48, 404.0]
+ coordinate: [1272, 268.0]
rotation: 0
state: enabled
-- name: blocks_vector_source_x_1
+- name: blocks_vector_source_x_0
id: blocks_vector_source_x
parameters:
affinity: ''
@@ -479,16 +339,16 @@ blocks:
minoutbuf: '0'
repeat: 'True'
tags: '[]'
- type: complex
- vector: access_code_symbols_sps
+ type: byte
+ vector: testvec * 500
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [224, 204.0]
+ coordinate: [48, 268.0]
rotation: 0
- state: disabled
+ state: enabled
- name: channels_channel_model_0
id: channels_channel_model
parameters:
@@ -497,17 +357,17 @@ blocks:
block_tags: 'False'
comment: ''
epsilon: '1.0'
- freq_offset: '0.000001'
+ freq_offset: '0.002'
maxoutbuf: '0'
minoutbuf: '0'
- noise_voltage: '0.2'
+ noise_voltage: '0.01'
seed: '243'
- taps: -1.4 + .4j
+ taps: np.exp(1j * 30 / 180 * np.pi)
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [992, 364.0]
+ coordinate: [1000, 228.0]
rotation: 0
state: enabled
- name: digital_cma_equalizer_cc_0
@@ -526,7 +386,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [528, 812.0]
+ coordinate: [520, 676.0]
rotation: 0
state: enabled
- name: digital_constellation_decoder_cb_0
@@ -542,9 +402,9 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1232, 1692.0]
+ coordinate: [224, 1260.0]
rotation: 0
- state: disabled
+ state: enabled
- name: digital_constellation_modulator_0
id: digital_constellation_modulator
parameters:
@@ -558,13 +418,12 @@ blocks:
maxoutbuf: '0'
minoutbuf: '0'
samples_per_symbol: sps
- truncate: 'False'
verbose: 'False'
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [496, 380.0]
+ coordinate: [504, 244.0]
rotation: 0
state: enabled
- name: digital_corr_est_cc_0
@@ -573,18 +432,52 @@ blocks:
affinity: ''
alias: ''
comment: ''
- mark_delay: '0'
+ mark_delay: len(access_code_symbols) // 2
maxoutbuf: '0'
minoutbuf: '0'
sps: '1'
symbols: access_code_symbols
- threshold: '.8'
- threshold_method: digital.THRESHOLD_DYNAMIC
+ threshold: '.9'
+ threshold_method: digital.THRESHOLD_ABSOLUTE
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [792, 668.0]
+ rotation: 0
+ state: enabled
+- name: digital_costas_loop_cc_0
+ id: digital_costas_loop_cc
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ order: '4'
+ use_snr: 'False'
+ w: 2 * 3.141592653589793 / 100
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [1104, 808.0]
+ rotation: 0
+ state: true
+- name: digital_map_bb_0
+ id: digital_map_bb
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ map: '[0, 1, 3, 2]'
+ maxoutbuf: '0'
+ minoutbuf: '0'
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [776, 1020.0]
+ coordinate: [496, 1260.0]
rotation: 0
state: enabled
- name: digital_pfb_clock_sync_xxx_0
@@ -607,174 +500,168 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [224, 836.0]
+ coordinate: [224, 700.0]
rotation: 0
state: enabled
-- name: fir_filter_xxx_1
- id: fir_filter_xxx
+- name: epy_block_0
+ id: epy_block
parameters:
+ _source_code: "import pmt\n\nimport numpy as np\nfrom gnuradio import gr\n\n\n\
+ class blk(gr.sync_block):\n \"\"\"\n Apply phase and frequency correction\
+ \ where there is a correlation peak tag.\n\n The correlation peak tags are\
+ \ NOT propagated, and instead replaced with a\n frame_start tag.\n \"\"\
+ \"\n def __init__(self):\n gr.sync_block.__init__(\n self,\n\
+ \ name='Phase and Frequency Correction',\n in_sig=[np.complex64],\n\
+ \ out_sig=[np.complex64]\n )\n\n # tags should not\
+ \ be propagated, we then output our own tags\n self.set_tag_propagation_policy(gr.TPP_DONT)\n\
+ \n # because we do block processing, we need to keep track of the last\
+ \ tag\n # of the previous block to correct the first values of the next\
+ \ block\n self.last = None\n self.lastfreq = 0\n\n def block_phase(self,\
+ \ start, end):\n \"\"\"\n Compute a vector for the phase and frequency\
+ \ correction for the samples\n between two tags (start and end).\n\n\
+ \ @param start Tag where the samples should start to be corrected\n \
+ \ @param end Tag where to stop correcting\n\n @return A vector\
+ \ of phase values for each sample. To correct the samples\n the\
+ \ data should be multiplied with np.exp(-1j * phase)\n \"\"\"\n \
+ \ # compute number of samples between tags\n nsamples = end.offset\
+ \ - start.offset\n\n # unpack pmt values into start and end phase\n \
+ \ sphase = pmt.to_python(start.value)\n ephase = pmt.to_python(end.value)\n\
+ \n # compute frequency offset between start and end\n phasediff\
+ \ = ephase - sphase\n\n if phasediff > np.pi:\n phasediff\
+ \ -= 2*np.pi\n\n elif phasediff < -np.pi:\n phasediff += 2*np.pi\n\
+ \n freq = phasediff / nsamples\n\n # save this one for the last\
+ \ block (see variable `end' in self.work)\n self.lastfreq = freq\n\n\
+ \ # debugging\n print(f\"Correction for chunk of {nsamples:2d}\
+ \ samples is \" \\\n f\"sphase={sphase: .4f} rad and freq={freq*1e3:\
+ \ .4f} milli rad / sample\")\n\n # compute chunk values\n return\
+ \ sphase * np.ones(nsamples) + freq * np.arange(0, nsamples)\n\n def work(self,\
+ \ input_items, output_items):\n counter = self.nitems_written(0)\n\n\
+ \ # nicer aliases\n inp = input_items[0]\n out = output_items[0]\n\
+ \n # read phase tags\n is_phase = lambda tag: pmt.to_python(tag.key)\
+ \ == \"phase_est\"\n tags = list(filter(is_phase, self.get_tags_in_window(0,\
+ \ 0, len(inp))))\n\n if not tags:\n print(f\"There were no\
+ \ tags in {len(inp)} samples!\")\n out[:] = inp\n return\
+ \ len(out)\n\n # debugging\n print(f\"Processing {len(tags)} tags\
+ \ = {tags[-1].offset - tags[0].offset} \" \\\n f\"samples out of\
+ \ {len(inp)} input samples\")\n\n # compute \"the middle\"\n enough_samples\
+ \ = lambda pair: ((pair[1].offset - pair[0].offset) > 0)\n pairs = list(filter(enough_samples,\
+ \ zip(tags, tags[1:])))\n chunks = [ self.block_phase(start, end) for\
+ \ (start, end) in pairs ]\n middle = np.concatenate(chunks) if chunks\
+ \ else []\n\n # compute values at the end, we do not have informations\
+ \ about the future\n # but we can use the frequency of the last tag to\
+ \ approximate\n nback = len(inp) - (tags[-1].offset - counter)\n \
+ \ print(f\"Processing {nback} samples at the back of the buffer\")\n \
+ \ end = np.ones(nback) * pmt.to_python(tags[-1].value) \\\n \
+ \ + self.lastfreq * np.arange(0, nback)\n\n # compute the \"start\"\
+ , using the last tag from the previous call\n nfront = tags[0].offset\
+ \ - counter\n print(f\"Processing {nfront} samples at the front of the\
+ \ buffer\")\n start = self.block_phase(self.last, tags[0])[-nfront:]\
+ \ \\\n if self.last and nfront else np.zeros(nfront)\n\n \
+ \ # compute correction\n correction = np.exp(-1j * np.concatenate([start,\
+ \ middle, end]))\n length = len(correction)\n\n # write outputs\n\
+ \ out[:length] = inp[:length] * correction\n\n # save last tag\
+ \ for next call\n self.last = tags[-1]\n\n # add tags\n \
+ \ for tag in tags:\n self.add_item_tag(0, tag.offset, pmt.intern(\"\
+ frame_start\"), pmt.PMT_T)\n\n # FIXME: should return `length' but then\
+ \ the last sample is not\n # included and self.last does something\
+ \ weird\n return len(out)\n"
affinity: ''
alias: ''
comment: ''
- decim: '1'
maxoutbuf: '0'
minoutbuf: '0'
- samp_delay: '0'
- taps: revconj_access_code_symbols
- type: ccc
states:
+ _io_cache: ('Phase and Frequency Correction', 'blk', [], [('0', 'complex', 1)],
+ [('0', 'complex', 1)], '\n Apply phase and frequency correction where there
+ is a correlation peak tag.\n\n The correlation peak tags are NOT propagated,
+ and instead replaced with a\n frame_start tag.\n ', [])
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [776, 828.0]
+ coordinate: [1088, 688.0]
rotation: 0
state: enabled
-- name: high_pass_filter_0
- id: high_pass_filter
+- 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\nnp.set_printoptions(formatter={'int':hex})\n\nclass\
+ \ blk(gr.sync_block):\n def __init__(self):\n gr.sync_block.__init__(\n\
+ \ self,\n name='Printer',\n in_sig=[np.byte],\n\
+ \ out_sig=[]\n )\n\n def work(self, input_items, output_items):\n\
+ \ inp = np.array(input_items[0], dtype=np.uint8)\n print(f\"Decoded\
+ \ {len(inp)} samples:\\n{inp}\")\n\n return len(inp)\n"
affinity: ''
alias: ''
- beta: '6.76'
comment: ''
- cutoff_freq: 5e3
- decim: '1'
- gain: '1'
- interp: '1'
maxoutbuf: '0'
minoutbuf: '0'
- samp_rate: samp_rate
- type: fir_filter_fff
- width: '.7'
- win: window.WIN_HAMMING
states:
+ _io_cache: ('Printer', 'blk', [], [('0', 'byte', 1)], [], '', [])
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [528, 1420.0]
+ coordinate: [1232, 1264.0]
rotation: 0
- state: disabled
-- name: low_pass_filter_0
- id: low_pass_filter
+ state: true
+- name: fir_filter_xxx_1
+ id: fir_filter_xxx
parameters:
affinity: ''
alias: ''
- beta: '6.76'
comment: ''
- cutoff_freq: 7e3
decim: '1'
- gain: '1'
- interp: '1'
maxoutbuf: '0'
minoutbuf: '0'
- samp_rate: samp_rate
- type: fir_filter_fff
- width: '.8'
- win: window.WIN_HAMMING
+ samp_delay: '0'
+ taps: revconj_access_code_symbols
+ type: ccc
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [528, 1252.0]
+ coordinate: [784, 988.0]
rotation: 0
state: disabled
-- name: qtgui_const_sink_x_0
- id: qtgui_const_sink_x
+- name: import_0
+ id: import
parameters:
- affinity: ''
alias: ''
- alpha1: '1.0'
- alpha10: '1.0'
- alpha2: '1.0'
- alpha3: '1.0'
- alpha4: '1.0'
- alpha5: '1.0'
- alpha6: '1.0'
- alpha7: '1.0'
- alpha8: '1.0'
- alpha9: '1.0'
- autoscale: 'False'
- axislabels: 'True'
- color1: '"blue"'
- color10: '"red"'
- color2: '"red"'
- color3: '"red"'
- color4: '"red"'
- color5: '"red"'
- color6: '"red"'
- color7: '"red"'
- color8: '"red"'
- color9: '"red"'
comment: ''
- grid: 'False'
- gui_hint: 0,1,2,1
- label1: ''
- label10: ''
- label2: ''
- label3: ''
- label4: ''
- label5: ''
- label6: ''
- label7: ''
- label8: ''
- label9: ''
- legend: 'True'
- marker1: '0'
- marker10: '0'
- marker2: '0'
- marker3: '0'
- marker4: '0'
- marker5: '0'
- marker6: '0'
- marker7: '0'
- marker8: '0'
- marker9: '0'
- name: '"Equalized Signal"'
- nconnections: '1'
- size: '1024'
- style1: '0'
- style10: '0'
- style2: '0'
- style3: '0'
- style4: '0'
- style5: '0'
- style6: '0'
- style7: '0'
- style8: '0'
- style9: '0'
- tr_chan: '0'
- tr_level: '0.0'
- tr_mode: qtgui.TRIG_MODE_FREE
- tr_slope: qtgui.TRIG_SLOPE_POS
- tr_tag: '""'
- type: complex
- update_time: '0.10'
- width1: '1'
- width10: '1'
- width2: '1'
- width3: '1'
- width4: '1'
- width5: '1'
- width6: '1'
- width7: '1'
- width8: '1'
- width9: '1'
- xmax: '2'
- xmin: '-2'
- ymax: '2'
- ymin: '-2'
+ imports: import numpy as np
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [776, 716.0]
+ coordinate: [184, 12.0]
rotation: 0
- state: enabled
-- name: qtgui_const_sink_x_1
+ state: true
+- name: note_0
+ id: note
+ parameters:
+ alias: ''
+ comment: 'THIS FLOWGRAPH MUST BE RUN
+
+ FROM THE TERMINAL BECAUSE
+
+ IT HAS A HUGE OUTPUT (PRINT)'
+ note: README
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [280, 12.0]
+ rotation: 0
+ state: true
+- name: qtgui_const_sink_x_0
id: qtgui_const_sink_x
parameters:
affinity: ''
alias: ''
- alpha1: '.5'
+ alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
@@ -784,7 +671,7 @@ blocks:
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
- autoscale: 'True'
+ autoscale: 'False'
axislabels: 'True'
color1: '"blue"'
color10: '"red"'
@@ -797,8 +684,8 @@ blocks:
color8: '"red"'
color9: '"red"'
comment: ''
- grid: 'True'
- gui_hint: 2,1,2,1
+ grid: 'False'
+ gui_hint: 0,1,2,1
label1: ''
label10: ''
label2: ''
@@ -810,7 +697,7 @@ blocks:
label8: ''
label9: ''
legend: 'True'
- marker1: '9'
+ marker1: '0'
marker10: '0'
marker2: '0'
marker3: '0'
@@ -820,10 +707,10 @@ blocks:
marker7: '0'
marker8: '0'
marker9: '0'
- name: '"Cross Correlation"'
+ name: '"Equalized Signal"'
nconnections: '1'
size: '1024'
- style1: '2'
+ style1: '0'
style10: '0'
style2: '0'
style3: '0'
@@ -858,10 +745,10 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1048, 612.0]
+ coordinate: [792, 572.0]
rotation: 0
state: enabled
-- name: qtgui_const_sink_x_2
+- name: qtgui_const_sink_x_0_0
id: qtgui_const_sink_x
parameters:
affinity: ''
@@ -890,10 +777,10 @@ blocks:
color9: '"red"'
comment: ''
grid: 'False'
- gui_hint: '2,1,2,1 '
- label1: ''
+ gui_hint: 2,1,2,1
+ label1: Custom Block
label10: ''
- label2: ''
+ label2: Costas Loop
label3: ''
label4: ''
label5: ''
@@ -912,8 +799,8 @@ blocks:
marker7: '0'
marker8: '0'
marker9: '0'
- name: '"Phase Correction"'
- nconnections: '1'
+ name: '"Phase Locked Signal"'
+ nconnections: '2'
size: '1024'
style1: '0'
style10: '0'
@@ -950,104 +837,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1248, 1588.0]
- rotation: 0
- state: disabled
-- name: qtgui_time_sink_x_0
- id: qtgui_time_sink_x
- parameters:
- affinity: ''
- alias: ''
- alpha1: '1.0'
- alpha10: '1.0'
- alpha2: '1.0'
- alpha3: '1.0'
- alpha4: '1.0'
- alpha5: '1.0'
- alpha6: '1.0'
- alpha7: '1.0'
- alpha8: '1.0'
- alpha9: '1.0'
- autoscale: 'True'
- axislabels: 'True'
- color1: blue
- color10: dark blue
- color2: red
- color3: green
- color4: black
- color5: cyan
- color6: magenta
- color7: yellow
- color8: dark red
- color9: dark green
- comment: ''
- ctrlpanel: 'False'
- entags: 'True'
- grid: 'False'
- gui_hint: 2,0,1,1
- label1: Signal 1
- label10: Signal 10
- label2: Signal 2
- label3: Signal 3
- label4: Signal 4
- label5: Signal 5
- label6: Signal 6
- label7: Signal 7
- label8: Signal 8
- label9: Signal 9
- legend: 'True'
- marker1: '-1'
- marker10: '-1'
- marker2: '-1'
- marker3: '-1'
- marker4: '-1'
- marker5: '-1'
- marker6: '-1'
- marker7: '-1'
- marker8: '-1'
- marker9: '-1'
- name: '""'
- nconnections: '1'
- size: '1024'
- srate: samp_rate
- stemplot: 'False'
- style1: '1'
- style10: '1'
- style2: '1'
- style3: '1'
- style4: '1'
- style5: '1'
- style6: '1'
- style7: '1'
- style8: '1'
- style9: '1'
- tr_chan: '0'
- tr_delay: '0'
- tr_level: '0.0'
- tr_mode: qtgui.TRIG_MODE_FREE
- tr_slope: qtgui.TRIG_SLOPE_POS
- tr_tag: '""'
- type: float
- update_time: '0.10'
- width1: '1'
- width10: '1'
- width2: '1'
- width3: '1'
- width4: '1'
- width5: '1'
- width6: '1'
- width7: '1'
- width8: '1'
- width9: '1'
- ylabel: XC Magnitude
- ymax: '20'
- ymin: '0'
- yunit: '""'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [1320, 604.0]
+ coordinate: [1416, 772.0]
rotation: 0
state: enabled
- name: qtgui_time_sink_x_0_0
@@ -1106,7 +896,7 @@ blocks:
name: '""'
nconnections: '1'
size: '1024'
- srate: samp_rate
+ srate: samp_rate / sps
stemplot: 'False'
style1: '1'
style10: '1'
@@ -1144,7 +934,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1336, 1084.0]
+ coordinate: [1472, 964.0]
rotation: 0
state: enabled
- name: qtgui_time_sink_x_0_0_0
@@ -1203,7 +993,7 @@ blocks:
name: '""'
nconnections: '1'
size: '1024'
- srate: samp_rate
+ srate: samp_rate / sps
stemplot: 'False'
style1: '1'
style10: '1'
@@ -1233,7 +1023,7 @@ blocks:
width7: '1'
width8: '1'
width9: '1'
- ylabel: XC Magnitude
+ ylabel: Equalized
ymax: '2'
ymin: '-2'
yunit: '""'
@@ -1241,106 +1031,9 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1048, 1020.0]
+ coordinate: [1096, 572.0]
rotation: 0
state: enabled
-- name: qtgui_time_sink_x_1
- id: qtgui_time_sink_x
- parameters:
- affinity: ''
- alias: ''
- alpha1: '1.0'
- alpha10: '1.0'
- alpha2: '1.0'
- alpha3: '1.0'
- alpha4: '1.0'
- alpha5: '1.0'
- alpha6: '1.0'
- alpha7: '1.0'
- alpha8: '1.0'
- alpha9: '1.0'
- autoscale: 'False'
- axislabels: 'True'
- color1: blue
- color10: dark blue
- color2: red
- color3: green
- color4: black
- color5: cyan
- color6: magenta
- color7: yellow
- color8: dark red
- color9: dark green
- comment: ''
- ctrlpanel: 'False'
- entags: 'True'
- grid: 'False'
- gui_hint: ''
- label1: Signal 1
- label10: Signal 10
- label2: Signal 2
- label3: Signal 3
- label4: Signal 4
- label5: Signal 5
- label6: Signal 6
- label7: Signal 7
- label8: Signal 8
- label9: Signal 9
- legend: 'True'
- marker1: '-1'
- marker10: '-1'
- marker2: '-1'
- marker3: '-1'
- marker4: '-1'
- marker5: '-1'
- marker6: '-1'
- marker7: '-1'
- marker8: '-1'
- marker9: '-1'
- name: '""'
- nconnections: '1'
- size: '1024'
- srate: samp_rate
- stemplot: 'False'
- style1: '1'
- style10: '1'
- style2: '1'
- style3: '1'
- style4: '1'
- style5: '1'
- style6: '1'
- style7: '1'
- style8: '1'
- style9: '1'
- tr_chan: '0'
- tr_delay: '0'
- tr_level: '0.0'
- tr_mode: qtgui.TRIG_MODE_FREE
- tr_slope: qtgui.TRIG_SLOPE_POS
- tr_tag: '""'
- type: float
- update_time: '0.10'
- width1: '1'
- width10: '1'
- width2: '1'
- width3: '1'
- width4: '1'
- width5: '1'
- width6: '1'
- width7: '1'
- width8: '1'
- width9: '1'
- ylabel: Amplitude
- ymax: '20'
- ymin: '-5'
- yunit: '""'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [784, 1452.0]
- rotation: 0
- state: disabled
- name: qtgui_time_sink_x_1_0
id: qtgui_time_sink_x
parameters:
@@ -1435,7 +1128,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [808, 452.0]
+ coordinate: [800, 172.0]
rotation: 0
state: enabled
- name: qtgui_time_sink_x_1_1
@@ -1532,106 +1225,9 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [776, 612.0]
- rotation: 0
- state: enabled
-- name: qtgui_time_sink_x_2
- id: qtgui_time_sink_x
- parameters:
- affinity: ''
- alias: ''
- alpha1: '1.0'
- alpha10: '1.0'
- alpha2: '1.0'
- alpha3: '1.0'
- alpha4: '1.0'
- alpha5: '1.0'
- alpha6: '1.0'
- alpha7: '1.0'
- alpha8: '1.0'
- alpha9: '1.0'
- autoscale: 'True'
- axislabels: 'True'
- color1: blue
- color10: dark blue
- color2: red
- color3: green
- color4: black
- color5: cyan
- color6: magenta
- color7: yellow
- color8: dark red
- color9: dark green
- comment: ''
- ctrlpanel: 'False'
- entags: 'True'
- grid: 'False'
- gui_hint: 3,0,1,1
- label1: Signal 1
- label10: Signal 10
- label2: Signal 2
- label3: Signal 3
- label4: Signal 4
- label5: Signal 5
- label6: Signal 6
- label7: Signal 7
- label8: Signal 8
- label9: Signal 9
- legend: 'True'
- marker1: '-1'
- marker10: '-1'
- marker2: '-1'
- marker3: '-1'
- marker4: '-1'
- marker5: '-1'
- marker6: '-1'
- marker7: '-1'
- marker8: '-1'
- marker9: '-1'
- name: '""'
- nconnections: '1'
- size: '1024'
- srate: samp_rate
- stemplot: 'False'
- style1: '1'
- style10: '1'
- style2: '1'
- style3: '1'
- style4: '1'
- style5: '1'
- style6: '1'
- style7: '1'
- style8: '1'
- style9: '1'
- tr_chan: '0'
- tr_delay: '0'
- tr_level: '0.0'
- tr_mode: qtgui.TRIG_MODE_FREE
- tr_slope: qtgui.TRIG_SLOPE_POS
- tr_tag: '""'
- type: float
- update_time: '0.10'
- width1: '1'
- width10: '1'
- width2: '1'
- width3: '1'
- width4: '1'
- width5: '1'
- width6: '1'
- width7: '1'
- width8: '1'
- width9: '1'
- ylabel: XC Phase
- ymax: '1'
- ymin: '-1'
- yunit: '""'
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [1480, 708.0]
+ coordinate: [792, 484.0]
rotation: 0
- state: enabled
+ state: disabled
- name: qtgui_time_sink_x_2_0
id: qtgui_time_sink_x
parameters:
@@ -1726,30 +1322,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1512, 1164.0]
- rotation: 0
- state: disabled
-- name: root_raised_cosine_filter_0
- id: root_raised_cosine_filter
- parameters:
- affinity: ''
- alias: ''
- alpha: excess_bw
- comment: ''
- decim: '1'
- gain: '2'
- interp: '1'
- maxoutbuf: '0'
- minoutbuf: '0'
- ntaps: 11*samp_rate
- samp_rate: samp_rate
- sym_rate: sps * samp_rate
- type: fir_filter_ccf
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [496, 180.0]
+ coordinate: [1472, 1060.0]
rotation: 0
state: disabled
- name: virtual_sink_0
@@ -1762,33 +1335,20 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1480, 404.0]
+ coordinate: [1488, 268.0]
rotation: 0
state: enabled
-- name: virtual_sink_1
- id: virtual_sink
- parameters:
- alias: ''
- comment: ''
- stream_id: symbols
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [776, 916.0]
- rotation: 0
- state: true
-- name: virtual_sink_2
+- name: virtual_sink_3
id: virtual_sink
parameters:
alias: ''
comment: ''
- stream_id: xcorrelation
+ stream_id: locked
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1080, 836.0]
+ coordinate: [1416, 684.0]
rotation: 0
state: true
- name: virtual_source_0
@@ -1801,78 +1361,55 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [32, 884.0]
+ coordinate: [16, 748.0]
rotation: 0
state: enabled
-- name: virtual_source_2
+- name: virtual_source_1
id: virtual_source
parameters:
alias: ''
comment: ''
- stream_id: symbols
+ stream_id: locked
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [32, 1716.0]
+ coordinate: [16, 1260.0]
rotation: 0
- state: disabled
-- name: virtual_source_3
- id: virtual_source
- parameters:
- alias: ''
- comment: ''
- stream_id: xcorrelation
- states:
- bus_sink: false
- bus_source: false
- bus_structure: null
- coordinate: [32, 1604.0]
- rotation: 0
- state: disabled
+ state: true
connections:
-- [blocks_char_to_short_0, '0', blocks_burst_tagger_0, '1']
-- [blocks_complex_to_magphase_0, '0', qtgui_time_sink_x_0, '0']
-- [blocks_complex_to_magphase_0, '1', blocks_multiply_const_vxx_0, '0']
- [blocks_complex_to_magphase_0_0, '0', qtgui_time_sink_x_0_0, '0']
- [blocks_complex_to_magphase_0_0, '1', blocks_multiply_const_vxx_0_0, '0']
- [blocks_complex_to_magphase_0_0, '1', blocks_null_sink_3, '0']
-- [blocks_complex_to_magphase_0_1, '0', blocks_burst_tagger_0, '0']
-- [blocks_complex_to_magphase_0_1, '0', blocks_peak_detector2_fb_0, '0']
-- [blocks_complex_to_magphase_0_1, '0', high_pass_filter_0, '0']
-- [blocks_complex_to_magphase_0_1, '0', low_pass_filter_0, '0']
-- [blocks_complex_to_magphase_0_1, '1', blocks_null_sink_2, '0']
-- [blocks_multiply_const_vxx_0, '0', qtgui_time_sink_x_2, '0']
- [blocks_multiply_const_vxx_0_0, '0', qtgui_time_sink_x_2_0, '0']
- [blocks_null_source_0, '0', blocks_stream_mux_0, '0']
-- [blocks_peak_detector2_fb_0, '0', blocks_char_to_short_0, '0']
+- [blocks_repack_bits_bb_0, '0', blocks_tagged_stream_align_0, '0']
- [blocks_stream_mux_0, '0', digital_constellation_modulator_0, '0']
-- [blocks_stream_mux_1, '0', channels_channel_model_0, '0']
+- [blocks_tagged_stream_align_0, '0', blocks_tag_debug_0, '0']
+- [blocks_tagged_stream_align_0, '0', epy_block_1, '0']
- [blocks_throttle_0, '0', virtual_sink_0, '0']
- [blocks_vector_source_x_0, '0', blocks_stream_mux_0, '1']
-- [blocks_vector_source_x_1, '0', root_raised_cosine_filter_0, '0']
- [channels_channel_model_0, '0', blocks_throttle_0, '0']
- [digital_cma_equalizer_cc_0, '0', digital_corr_est_cc_0, '0']
- [digital_cma_equalizer_cc_0, '0', fir_filter_xxx_1, '0']
- [digital_cma_equalizer_cc_0, '0', qtgui_const_sink_x_0, '0']
- [digital_cma_equalizer_cc_0, '0', qtgui_time_sink_x_1_1, '0']
-- [digital_cma_equalizer_cc_0, '0', virtual_sink_1, '0']
-- [digital_constellation_decoder_cb_0, '0', blocks_null_sink_0, '0']
-- [digital_constellation_modulator_0, '0', blocks_stream_mux_1, '1']
+- [digital_constellation_decoder_cb_0, '0', digital_map_bb_0, '0']
- [digital_constellation_modulator_0, '0', channels_channel_model_0, '0']
- [digital_constellation_modulator_0, '0', qtgui_time_sink_x_1_0, '0']
+- [digital_corr_est_cc_0, '0', digital_costas_loop_cc_0, '0']
+- [digital_corr_est_cc_0, '0', epy_block_0, '0']
- [digital_corr_est_cc_0, '0', qtgui_time_sink_x_0_0_0, '0']
- [digital_corr_est_cc_0, '1', blocks_complex_to_magphase_0_0, '0']
+- [digital_costas_loop_cc_0, '0', qtgui_const_sink_x_0_0, '1']
+- [digital_map_bb_0, '0', blocks_repack_bits_bb_0, '0']
- [digital_pfb_clock_sync_xxx_0, '0', digital_cma_equalizer_cc_0, '0']
-- [fir_filter_xxx_1, '0', blocks_complex_to_magphase_0, '0']
-- [fir_filter_xxx_1, '0', qtgui_const_sink_x_1, '0']
-- [fir_filter_xxx_1, '0', virtual_sink_2, '0']
-- [high_pass_filter_0, '0', qtgui_time_sink_x_1, '0']
-- [low_pass_filter_0, '0', qtgui_time_sink_x_1, '0']
-- [root_raised_cosine_filter_0, '0', blocks_stream_mux_1, '0']
+- [epy_block_0, '0', qtgui_const_sink_x_0_0, '0']
+- [epy_block_0, '0', virtual_sink_3, '0']
+- [fir_filter_xxx_1, '0', blocks_complex_to_magphase_0_0, '0']
- [virtual_source_0, '0', digital_pfb_clock_sync_xxx_0, '0']
-- [virtual_source_3, '0', blocks_complex_to_magphase_0_1, '0']
+- [virtual_source_1, '0', digital_constellation_decoder_cb_0, '0']
metadata:
file_format: 1
diff --git a/tests/correlator/correlator.py b/tests/correlator/correlator.py
index 376d061..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.9.2.0
+# GNU Radio version: 3.8.2.0
from distutils.version import StrictVersion
@@ -28,23 +28,22 @@ import sip
from gnuradio import blocks
from gnuradio import channels
from gnuradio import digital
-from gnuradio import filter
from gnuradio import gr
-from gnuradio.fft import window
import sys
import signal
from argparse import ArgumentParser
from gnuradio.eng_arg import eng_float, intx
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):
def __init__(self):
- gr.top_block.__init__(self, "Correlator Test", catch_exceptions=True)
+ gr.top_block.__init__(self, "Correlator Test")
Qt.QWidget.__init__(self)
self.setWindowTitle("Correlator Test")
qtgui.util.check_set_qss()
@@ -80,131 +79,22 @@ class correlator(gr.top_block, Qt.QWidget):
self.sps = sps = 4
self.nfilts = nfilts = 32
self.excess_bw = excess_bw = .35
- self.timing_loop_bw = timing_loop_bw = 2 * 3.141592653589793 / 100
- self.testvec = testvec = [31, 53] + [0x12, 0xe3, 0x9b, 0xee, 0x84, 0x23, 0x41, 0xf3]
- self.samp_rate = samp_rate = 32000
+ self.timing_loop_bw = timing_loop_bw = 2 * np.pi / 100
+ self.testvec = testvec = [0x1f, 0x35] + [0x12, 0xe3, 0x9b, 0xee, 0x84, 0x23, 0x41, 0xf3]
+ self.samp_rate = samp_rate = int(1.5e6)
self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), excess_bw, 45*nfilts)
self.revconj_access_code_symbols = revconj_access_code_symbols = [(1.4142135623730951+1.4142135623730951j), (1.4142135623730951+1.4142135623730951j), (1.4142135623730951-1.4142135623730951j), (-1.4142135623730951+1.4142135623730951j), (1.4142135623730951-1.4142135623730951j), (1.4142135623730951-1.4142135623730951j), (1.4142135623730951+1.4142135623730951j), (-1.4142135623730951+1.4142135623730951j)]
self.const = const = digital.constellation_qpsk().base()
- self.access_code_symbols_sps = access_code_symbols_sps = [(1.4142197+1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j), (-1.4142197-1.4142197j), (-1.4142197-1.4142197j), (-1.4142197-1.4142197j), (-1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197-1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j), (1.4142197+1.4142197j)]
- self.access_code_symbols = access_code_symbols = [(-1.4142135623730951-1.4142135623730951j), (1.4142135623730951-1.4142135623730951j), (1.4142135623730951+1.4142135623730951j), (1.4142135623730951+1.4142135623730951j), (-1.4142135623730951-1.4142135623730951j), (1.4142135623730951+1.4142135623730951j), (1.4142135623730951-1.4142135623730951j), (1.4142135623730951-1.4142135623730951j)]
+ self.access_code_symbols = access_code_symbols = .5 * np.array([(-1.4142135623730951-1.4142135623730951j), (1.4142135623730951-1.4142135623730951j), (1.4142135623730951+1.4142135623730951j), (1.4142135623730951+1.4142135623730951j), (-1.4142135623730951-1.4142135623730951j), (1.4142135623730951+1.4142135623730951j), (1.4142135623730951-1.4142135623730951j), (1.4142135623730951-1.4142135623730951j)])
##################################################
# Blocks
##################################################
- self.qtgui_time_sink_x_2 = qtgui.time_sink_f(
- 1024, #size
- samp_rate, #samp_rate
- "", #name
- 1, #number of inputs
- None # parent
- )
- self.qtgui_time_sink_x_2.set_update_time(0.10)
- self.qtgui_time_sink_x_2.set_y_axis(-1, 1)
-
- self.qtgui_time_sink_x_2.set_y_label('XC Phase', "")
-
- self.qtgui_time_sink_x_2.enable_tags(True)
- self.qtgui_time_sink_x_2.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
- self.qtgui_time_sink_x_2.enable_autoscale(True)
- self.qtgui_time_sink_x_2.enable_grid(False)
- self.qtgui_time_sink_x_2.enable_axis_labels(True)
- self.qtgui_time_sink_x_2.enable_control_panel(False)
- self.qtgui_time_sink_x_2.enable_stem_plot(False)
-
-
- labels = ['Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
- 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10']
- widths = [1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1]
- colors = ['blue', 'red', 'green', 'black', 'cyan',
- 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue']
- alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
- 1.0, 1.0, 1.0, 1.0, 1.0]
- styles = [1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1]
- markers = [-1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1]
-
-
- for i in range(1):
- if len(labels[i]) == 0:
- self.qtgui_time_sink_x_2.set_line_label(i, "Data {0}".format(i))
- else:
- self.qtgui_time_sink_x_2.set_line_label(i, labels[i])
- self.qtgui_time_sink_x_2.set_line_width(i, widths[i])
- self.qtgui_time_sink_x_2.set_line_color(i, colors[i])
- self.qtgui_time_sink_x_2.set_line_style(i, styles[i])
- self.qtgui_time_sink_x_2.set_line_marker(i, markers[i])
- self.qtgui_time_sink_x_2.set_line_alpha(i, alphas[i])
-
- self._qtgui_time_sink_x_2_win = sip.wrapinstance(self.qtgui_time_sink_x_2.pyqwidget(), Qt.QWidget)
- self.top_grid_layout.addWidget(self._qtgui_time_sink_x_2_win, 3, 0, 1, 1)
- for r in range(3, 4):
- self.top_grid_layout.setRowStretch(r, 1)
- for c in range(0, 1):
- self.top_grid_layout.setColumnStretch(c, 1)
- self.qtgui_time_sink_x_1_1 = qtgui.time_sink_c(
- 1024, #size
- samp_rate, #samp_rate
- "", #name
- 1, #number of inputs
- None # parent
- )
- self.qtgui_time_sink_x_1_1.set_update_time(0.10)
- self.qtgui_time_sink_x_1_1.set_y_axis(-2, 2)
-
- self.qtgui_time_sink_x_1_1.set_y_label('Equalized', "")
-
- self.qtgui_time_sink_x_1_1.enable_tags(True)
- self.qtgui_time_sink_x_1_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
- self.qtgui_time_sink_x_1_1.enable_autoscale(True)
- self.qtgui_time_sink_x_1_1.enable_grid(True)
- self.qtgui_time_sink_x_1_1.enable_axis_labels(True)
- self.qtgui_time_sink_x_1_1.enable_control_panel(False)
- self.qtgui_time_sink_x_1_1.enable_stem_plot(False)
-
-
- labels = ['Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
- 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10']
- widths = [1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1]
- colors = ['blue', 'red', 'green', 'black', 'cyan',
- 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue']
- alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
- 1.0, 1.0, 1.0, 1.0, 1.0]
- styles = [1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1]
- markers = [-1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1]
-
-
- for i in range(2):
- if len(labels[i]) == 0:
- if (i % 2 == 0):
- self.qtgui_time_sink_x_1_1.set_line_label(i, "Re{{Data {0}}}".format(i/2))
- else:
- self.qtgui_time_sink_x_1_1.set_line_label(i, "Im{{Data {0}}}".format(i/2))
- else:
- self.qtgui_time_sink_x_1_1.set_line_label(i, labels[i])
- self.qtgui_time_sink_x_1_1.set_line_width(i, widths[i])
- self.qtgui_time_sink_x_1_1.set_line_color(i, colors[i])
- self.qtgui_time_sink_x_1_1.set_line_style(i, styles[i])
- self.qtgui_time_sink_x_1_1.set_line_marker(i, markers[i])
- self.qtgui_time_sink_x_1_1.set_line_alpha(i, alphas[i])
-
- self._qtgui_time_sink_x_1_1_win = sip.wrapinstance(self.qtgui_time_sink_x_1_1.pyqwidget(), Qt.QWidget)
- self.top_grid_layout.addWidget(self._qtgui_time_sink_x_1_1_win, 1, 0, 1, 1)
- for r in range(1, 2):
- self.top_grid_layout.setRowStretch(r, 1)
- for c in range(0, 1):
- self.top_grid_layout.setColumnStretch(c, 1)
self.qtgui_time_sink_x_1_0 = qtgui.time_sink_c(
1024, #size
samp_rate, #samp_rate
"", #name
- 1, #number of inputs
- None # parent
+ 1 #number of inputs
)
self.qtgui_time_sink_x_1_0.set_update_time(0.10)
self.qtgui_time_sink_x_1_0.set_y_axis(-2, 2)
@@ -256,15 +146,14 @@ class correlator(gr.top_block, Qt.QWidget):
self.top_grid_layout.setColumnStretch(c, 1)
self.qtgui_time_sink_x_0_0_0 = qtgui.time_sink_c(
1024, #size
- samp_rate, #samp_rate
+ samp_rate / sps, #samp_rate
"", #name
- 1, #number of inputs
- None # parent
+ 1 #number of inputs
)
self.qtgui_time_sink_x_0_0_0.set_update_time(0.10)
self.qtgui_time_sink_x_0_0_0.set_y_axis(-2, 2)
- self.qtgui_time_sink_x_0_0_0.set_y_label('XC Magnitude', "")
+ self.qtgui_time_sink_x_0_0_0.set_y_label('Equalized', "")
self.qtgui_time_sink_x_0_0_0.enable_tags(True)
self.qtgui_time_sink_x_0_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
@@ -304,13 +193,12 @@ class correlator(gr.top_block, Qt.QWidget):
self.qtgui_time_sink_x_0_0_0.set_line_alpha(i, alphas[i])
self._qtgui_time_sink_x_0_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0_0.pyqwidget(), Qt.QWidget)
- self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_0_win)
+ self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_0_win)
self.qtgui_time_sink_x_0_0 = qtgui.time_sink_f(
1024, #size
- samp_rate, #samp_rate
+ samp_rate / sps, #samp_rate
"", #name
- 1, #number of inputs
- None # parent
+ 1 #number of inputs
)
self.qtgui_time_sink_x_0_0.set_update_time(0.10)
self.qtgui_time_sink_x_0_0.set_y_axis(0, 20)
@@ -352,100 +240,47 @@ class correlator(gr.top_block, Qt.QWidget):
self.qtgui_time_sink_x_0_0.set_line_alpha(i, alphas[i])
self._qtgui_time_sink_x_0_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0_0.pyqwidget(), Qt.QWidget)
- self.top_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
- self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
+ self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_0_win)
+ self.qtgui_const_sink_x_0_0 = qtgui.const_sink_c(
1024, #size
- samp_rate, #samp_rate
- "", #name
- 1, #number of inputs
- None # parent
+ "Phase Locked Signal", #name
+ 2 #number of inputs
)
- self.qtgui_time_sink_x_0.set_update_time(0.10)
- self.qtgui_time_sink_x_0.set_y_axis(0, 20)
-
- self.qtgui_time_sink_x_0.set_y_label('XC Magnitude', "")
-
- self.qtgui_time_sink_x_0.enable_tags(True)
- self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "")
- self.qtgui_time_sink_x_0.enable_autoscale(True)
- self.qtgui_time_sink_x_0.enable_grid(False)
- self.qtgui_time_sink_x_0.enable_axis_labels(True)
- self.qtgui_time_sink_x_0.enable_control_panel(False)
- self.qtgui_time_sink_x_0.enable_stem_plot(False)
-
-
- labels = ['Signal 1', 'Signal 2', 'Signal 3', 'Signal 4', 'Signal 5',
- 'Signal 6', 'Signal 7', 'Signal 8', 'Signal 9', 'Signal 10']
- widths = [1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1]
- colors = ['blue', 'red', 'green', 'black', 'cyan',
- 'magenta', 'yellow', 'dark red', 'dark green', 'dark blue']
- alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
- 1.0, 1.0, 1.0, 1.0, 1.0]
- styles = [1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1]
- markers = [-1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1]
+ self.qtgui_const_sink_x_0_0.set_update_time(0.10)
+ self.qtgui_const_sink_x_0_0.set_y_axis(-2, 2)
+ self.qtgui_const_sink_x_0_0.set_x_axis(-2, 2)
+ self.qtgui_const_sink_x_0_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
+ self.qtgui_const_sink_x_0_0.enable_autoscale(False)
+ self.qtgui_const_sink_x_0_0.enable_grid(False)
+ self.qtgui_const_sink_x_0_0.enable_axis_labels(True)
- for i in range(1):
- if len(labels[i]) == 0:
- self.qtgui_time_sink_x_0.set_line_label(i, "Data {0}".format(i))
- else:
- self.qtgui_time_sink_x_0.set_line_label(i, labels[i])
- self.qtgui_time_sink_x_0.set_line_width(i, widths[i])
- self.qtgui_time_sink_x_0.set_line_color(i, colors[i])
- self.qtgui_time_sink_x_0.set_line_style(i, styles[i])
- self.qtgui_time_sink_x_0.set_line_marker(i, markers[i])
- self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i])
-
- self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget)
- self.top_grid_layout.addWidget(self._qtgui_time_sink_x_0_win, 2, 0, 1, 1)
- for r in range(2, 3):
- self.top_grid_layout.setRowStretch(r, 1)
- for c in range(0, 1):
- self.top_grid_layout.setColumnStretch(c, 1)
- self.qtgui_const_sink_x_1 = qtgui.const_sink_c(
- 1024, #size
- "Cross Correlation", #name
- 1, #number of inputs
- None # parent
- )
- self.qtgui_const_sink_x_1.set_update_time(0.10)
- self.qtgui_const_sink_x_1.set_y_axis(-2, 2)
- self.qtgui_const_sink_x_1.set_x_axis(-2, 2)
- self.qtgui_const_sink_x_1.set_trigger_mode(qtgui.TRIG_MODE_FREE, qtgui.TRIG_SLOPE_POS, 0.0, 0, "")
- self.qtgui_const_sink_x_1.enable_autoscale(True)
- self.qtgui_const_sink_x_1.enable_grid(True)
- self.qtgui_const_sink_x_1.enable_axis_labels(True)
-
-
- labels = ['', '', '', '', '',
+ labels = ['Custom Block', 'Costas Loop', '', '', '',
'', '', '', '', '']
widths = [1, 1, 1, 1, 1,
1, 1, 1, 1, 1]
colors = ["blue", "red", "red", "red", "red",
"red", "red", "red", "red", "red"]
- styles = [2, 0, 0, 0, 0,
+ styles = [0, 0, 0, 0, 0,
0, 0, 0, 0, 0]
- markers = [9, 0, 0, 0, 0,
+ markers = [0, 0, 0, 0, 0,
0, 0, 0, 0, 0]
- alphas = [.5, 1.0, 1.0, 1.0, 1.0,
+ alphas = [1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0]
- for i in range(1):
+ for i in range(2):
if len(labels[i]) == 0:
- self.qtgui_const_sink_x_1.set_line_label(i, "Data {0}".format(i))
+ self.qtgui_const_sink_x_0_0.set_line_label(i, "Data {0}".format(i))
else:
- self.qtgui_const_sink_x_1.set_line_label(i, labels[i])
- self.qtgui_const_sink_x_1.set_line_width(i, widths[i])
- self.qtgui_const_sink_x_1.set_line_color(i, colors[i])
- self.qtgui_const_sink_x_1.set_line_style(i, styles[i])
- self.qtgui_const_sink_x_1.set_line_marker(i, markers[i])
- self.qtgui_const_sink_x_1.set_line_alpha(i, alphas[i])
-
- self._qtgui_const_sink_x_1_win = sip.wrapinstance(self.qtgui_const_sink_x_1.pyqwidget(), Qt.QWidget)
- self.top_grid_layout.addWidget(self._qtgui_const_sink_x_1_win, 2, 1, 2, 1)
+ self.qtgui_const_sink_x_0_0.set_line_label(i, labels[i])
+ self.qtgui_const_sink_x_0_0.set_line_width(i, widths[i])
+ self.qtgui_const_sink_x_0_0.set_line_color(i, colors[i])
+ self.qtgui_const_sink_x_0_0.set_line_style(i, styles[i])
+ self.qtgui_const_sink_x_0_0.set_line_marker(i, markers[i])
+ self.qtgui_const_sink_x_0_0.set_line_alpha(i, alphas[i])
+
+ self._qtgui_const_sink_x_0_0_win = sip.wrapinstance(self.qtgui_const_sink_x_0_0.pyqwidget(), Qt.QWidget)
+ self.top_grid_layout.addWidget(self._qtgui_const_sink_x_0_0_win, 2, 1, 2, 1)
for r in range(2, 4):
self.top_grid_layout.setRowStretch(r, 1)
for c in range(1, 2):
@@ -453,8 +288,7 @@ class correlator(gr.top_block, Qt.QWidget):
self.qtgui_const_sink_x_0 = qtgui.const_sink_c(
1024, #size
"Equalized Signal", #name
- 1, #number of inputs
- None # parent
+ 1 #number of inputs
)
self.qtgui_const_sink_x_0.set_update_time(0.10)
self.qtgui_const_sink_x_0.set_y_axis(-2, 2)
@@ -495,10 +329,12 @@ class correlator(gr.top_block, Qt.QWidget):
self.top_grid_layout.setRowStretch(r, 1)
for c in range(1, 2):
self.top_grid_layout.setColumnStretch(c, 1)
- self.fir_filter_xxx_1 = filter.fir_filter_ccc(1, revconj_access_code_symbols)
- self.fir_filter_xxx_1.declare_sample_delay(0)
+ self.epy_block_1 = epy_block_1.blk()
+ self.epy_block_0 = epy_block_0.blk()
self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, timing_loop_bw, rrc_taps, nfilts, 16, 1.5, 1)
- self.digital_corr_est_cc_0 = digital.corr_est_cc(access_code_symbols, 1, 0, .8, digital.THRESHOLD_DYNAMIC)
+ self.digital_map_bb_0 = digital.map_bb([0, 1, 3, 2])
+ self.digital_costas_loop_cc_0 = digital.costas_loop_cc(2 * 3.141592653589793 / 100, 4, False)
+ self.digital_corr_est_cc_0 = digital.corr_est_cc(access_code_symbols, 1, len(access_code_symbols) // 2, .9, digital.THRESHOLD_ABSOLUTE)
self.digital_constellation_modulator_0 = digital.generic_mod(
constellation=const,
differential=False,
@@ -506,59 +342,58 @@ class correlator(gr.top_block, Qt.QWidget):
pre_diff_code=True,
excess_bw=excess_bw,
verbose=False,
- log=False,
- truncate=False)
+ log=False)
+ self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(const)
self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(15, 1, .002, 1)
self.channels_channel_model_0 = channels.channel_model(
- noise_voltage=0.2,
- frequency_offset=0.000001,
+ noise_voltage=0.01,
+ frequency_offset=0.002,
epsilon=1.0,
- taps=[-1.4 + .4j],
+ taps=[np.exp(1j * 30 / 180 * np.pi)],
noise_seed=243,
block_tags=False)
- self.blocks_vector_source_x_0 = blocks.vector_source_b(testvec * 1600, False, 1, [])
+ self.blocks_vector_source_x_0 = blocks.vector_source_b(testvec * 500, True, 1, [])
self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
- self.blocks_stream_mux_0 = blocks.stream_mux(gr.sizeof_char*1, [10, len(testvec)])
+ self.blocks_tagged_stream_align_0 = blocks.tagged_stream_align(gr.sizeof_char*1, 'frame_start')
+ self.blocks_stream_mux_0 = blocks.stream_mux(gr.sizeof_char*1, [0, len(testvec)])
+ self.blocks_repack_bits_bb_0 = blocks.repack_bits_bb(2, 8, "", False, gr.GR_MSB_FIRST)
self.blocks_null_source_0 = blocks.null_source(gr.sizeof_char*1)
self.blocks_null_sink_3 = blocks.null_sink(gr.sizeof_float*1)
- self.blocks_multiply_const_vxx_0 = blocks.multiply_const_ff(180 / 3.141592653589793)
self.blocks_complex_to_magphase_0_0 = blocks.complex_to_magphase(1)
- self.blocks_complex_to_magphase_0 = blocks.complex_to_magphase(1)
##################################################
# Connections
##################################################
- self.connect((self.blocks_complex_to_magphase_0, 1), (self.blocks_multiply_const_vxx_0, 0))
- self.connect((self.blocks_complex_to_magphase_0, 0), (self.qtgui_time_sink_x_0, 0))
self.connect((self.blocks_complex_to_magphase_0_0, 1), (self.blocks_null_sink_3, 0))
self.connect((self.blocks_complex_to_magphase_0_0, 0), (self.qtgui_time_sink_x_0_0, 0))
- self.connect((self.blocks_multiply_const_vxx_0, 0), (self.qtgui_time_sink_x_2, 0))
self.connect((self.blocks_null_source_0, 0), (self.blocks_stream_mux_0, 0))
+ self.connect((self.blocks_repack_bits_bb_0, 0), (self.blocks_tagged_stream_align_0, 0))
self.connect((self.blocks_stream_mux_0, 0), (self.digital_constellation_modulator_0, 0))
+ self.connect((self.blocks_tagged_stream_align_0, 0), (self.epy_block_1, 0))
self.connect((self.blocks_throttle_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0))
self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_stream_mux_0, 1))
self.connect((self.channels_channel_model_0, 0), (self.blocks_throttle_0, 0))
self.connect((self.digital_cma_equalizer_cc_0, 0), (self.digital_corr_est_cc_0, 0))
- self.connect((self.digital_cma_equalizer_cc_0, 0), (self.fir_filter_xxx_1, 0))
self.connect((self.digital_cma_equalizer_cc_0, 0), (self.qtgui_const_sink_x_0, 0))
- self.connect((self.digital_cma_equalizer_cc_0, 0), (self.qtgui_time_sink_x_1_1, 0))
+ self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_map_bb_0, 0))
self.connect((self.digital_constellation_modulator_0, 0), (self.channels_channel_model_0, 0))
self.connect((self.digital_constellation_modulator_0, 0), (self.qtgui_time_sink_x_1_0, 0))
self.connect((self.digital_corr_est_cc_0, 1), (self.blocks_complex_to_magphase_0_0, 0))
+ self.connect((self.digital_corr_est_cc_0, 0), (self.digital_costas_loop_cc_0, 0))
+ self.connect((self.digital_corr_est_cc_0, 0), (self.epy_block_0, 0))
self.connect((self.digital_corr_est_cc_0, 0), (self.qtgui_time_sink_x_0_0_0, 0))
+ self.connect((self.digital_costas_loop_cc_0, 0), (self.qtgui_const_sink_x_0_0, 1))
+ self.connect((self.digital_map_bb_0, 0), (self.blocks_repack_bits_bb_0, 0))
self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_cma_equalizer_cc_0, 0))
- self.connect((self.fir_filter_xxx_1, 0), (self.blocks_complex_to_magphase_0, 0))
- self.connect((self.fir_filter_xxx_1, 0), (self.qtgui_const_sink_x_1, 0))
+ 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())
- self.stop()
- self.wait()
-
event.accept()
def get_sps(self):
@@ -567,6 +402,8 @@ class correlator(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.qtgui_time_sink_x_0_0.set_samp_rate(self.samp_rate / self.sps)
+ self.qtgui_time_sink_x_0_0_0.set_samp_rate(self.samp_rate / self.sps)
def get_nfilts(self):
return self.nfilts
@@ -594,7 +431,7 @@ class correlator(gr.top_block, Qt.QWidget):
def set_testvec(self, testvec):
self.testvec = testvec
- self.blocks_vector_source_x_0.set_data(self.testvec * 1600, [])
+ self.blocks_vector_source_x_0.set_data(self.testvec * 500, [])
def get_samp_rate(self):
return self.samp_rate
@@ -602,12 +439,9 @@ class correlator(gr.top_block, Qt.QWidget):
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
self.blocks_throttle_0.set_sample_rate(self.samp_rate)
- self.qtgui_time_sink_x_0.set_samp_rate(self.samp_rate)
- self.qtgui_time_sink_x_0_0.set_samp_rate(self.samp_rate)
- self.qtgui_time_sink_x_0_0_0.set_samp_rate(self.samp_rate)
+ self.qtgui_time_sink_x_0_0.set_samp_rate(self.samp_rate / self.sps)
+ self.qtgui_time_sink_x_0_0_0.set_samp_rate(self.samp_rate / self.sps)
self.qtgui_time_sink_x_1_0.set_samp_rate(self.samp_rate)
- self.qtgui_time_sink_x_1_1.set_samp_rate(self.samp_rate)
- self.qtgui_time_sink_x_2.set_samp_rate(self.samp_rate)
def get_rrc_taps(self):
return self.rrc_taps
@@ -621,7 +455,6 @@ class correlator(gr.top_block, Qt.QWidget):
def set_revconj_access_code_symbols(self, revconj_access_code_symbols):
self.revconj_access_code_symbols = revconj_access_code_symbols
- self.fir_filter_xxx_1.set_taps(self.revconj_access_code_symbols)
def get_const(self):
return self.const
@@ -629,17 +462,13 @@ class correlator(gr.top_block, Qt.QWidget):
def set_const(self, const):
self.const = const
- def get_access_code_symbols_sps(self):
- return self.access_code_symbols_sps
-
- def set_access_code_symbols_sps(self, access_code_symbols_sps):
- self.access_code_symbols_sps = access_code_symbols_sps
-
def get_access_code_symbols(self):
return self.access_code_symbols
def set_access_code_symbols(self, access_code_symbols):
self.access_code_symbols = access_code_symbols
+ self.digital_corr_est_cc_0.set_mark_delay(len(self.access_code_symbols) // 2)
+
@@ -658,9 +487,6 @@ def main(top_block_cls=correlator, options=None):
tb.show()
def sig_handler(sig=None, frame=None):
- tb.stop()
- tb.wait()
-
Qt.QApplication.quit()
signal.signal(signal.SIGINT, sig_handler)
@@ -670,6 +496,11 @@ def main(top_block_cls=correlator, options=None):
timer.start(500)
timer.timeout.connect(lambda: None)
+ def quitting():
+ tb.stop()
+ tb.wait()
+
+ qapp.aboutToQuit.connect(quitting)
qapp.exec_()
if __name__ == '__main__':
diff --git a/tests/correlator/epy_block_0.py b/tests/correlator/epy_block_0.py
new file mode 100644
index 0000000..dbdadd1
--- /dev/null
+++ b/tests/correlator/epy_block_0.py
@@ -0,0 +1,124 @@
+import pmt
+
+import numpy as np
+from gnuradio import gr
+
+
+class blk(gr.sync_block):
+ """
+ Apply phase and frequency correction where there is a correlation peak tag.
+
+ The correlation peak tags are NOT propagated, and instead replaced with a
+ frame_start tag.
+ """
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name='Phase and Frequency Correction',
+ in_sig=[np.complex64],
+ out_sig=[np.complex64]
+ )
+
+ # tags should not be propagated, we then output our own tags
+ self.set_tag_propagation_policy(gr.TPP_DONT)
+
+ # because we do block processing, we need to keep track of the last tag
+ # of the previous block to correct the first values of the next block
+ self.last = None
+ self.lastfreq = 0
+
+ def block_phase(self, start, end):
+ """
+ Compute a vector for the phase and frequency correction for the samples
+ between two tags (start and end).
+
+ @param start Tag where the samples should start to be corrected
+ @param end Tag where to stop correcting
+
+ @return A vector of phase values for each sample. To correct the samples
+ the data should be multiplied with np.exp(-1j * phase)
+ """
+ # compute number of samples between tags
+ nsamples = end.offset - start.offset
+
+ # unpack pmt values into start and end phase
+ sphase = pmt.to_python(start.value)
+ ephase = pmt.to_python(end.value)
+
+ # compute frequency offset between start and end
+ phasediff = ephase - sphase
+
+ if phasediff > np.pi:
+ phasediff -= 2*np.pi
+
+ elif phasediff < -np.pi:
+ phasediff += 2*np.pi
+
+ freq = phasediff / nsamples
+
+ # save this one for the last block (see variable `end' in self.work)
+ self.lastfreq = freq
+
+ # debugging
+ print(f"Correction for chunk of {nsamples:2d} samples is " \
+ f"sphase={sphase: .4f} rad and freq={freq*1e3: .4f} milli rad / sample")
+
+ # compute chunk values
+ return sphase * np.ones(nsamples) + freq * np.arange(0, nsamples)
+
+ def work(self, input_items, output_items):
+ counter = self.nitems_written(0)
+
+ # nicer aliases
+ inp = input_items[0]
+ out = output_items[0]
+
+ # read phase tags
+ is_phase = lambda tag: pmt.to_python(tag.key) == "phase_est"
+ tags = list(filter(is_phase, self.get_tags_in_window(0, 0, len(inp))))
+
+ if not tags:
+ print(f"There were no tags in {len(inp)} samples!")
+ out[:] = inp
+ return len(out)
+
+ # debugging
+ print(f"Processing {len(tags)} tags = {tags[-1].offset - tags[0].offset} " \
+ f"samples out of {len(inp)} input samples")
+
+ # compute "the middle"
+ enough_samples = lambda pair: ((pair[1].offset - pair[0].offset) > 0)
+ pairs = list(filter(enough_samples, zip(tags, tags[1:])))
+ chunks = [ self.block_phase(start, end) for (start, end) in pairs ]
+ middle = np.concatenate(chunks) if chunks else []
+
+ # compute values at the end, we do not have informations about the future
+ # but we can use the frequency of the last tag to approximate
+ nback = len(inp) - (tags[-1].offset - counter)
+ print(f"Processing {nback} samples at the back of the buffer")
+ end = np.ones(nback) * pmt.to_python(tags[-1].value) \
+ + self.lastfreq * np.arange(0, nback)
+
+ # compute the "start", using the last tag from the previous call
+ nfront = tags[0].offset - counter
+ print(f"Processing {nfront} samples at the front of the buffer")
+ start = self.block_phase(self.last, tags[0])[-nfront:] \
+ if self.last and nfront else np.zeros(nfront)
+
+ # compute correction
+ correction = np.exp(-1j * np.concatenate([start, middle, end]))
+ length = len(correction)
+
+ # write outputs
+ out[:length] = inp[:length] * correction
+
+ # save last tag for next call
+ self.last = tags[-1]
+
+ # add tags
+ for tag in tags:
+ self.add_item_tag(0, tag.offset, pmt.intern("frame_start"), pmt.PMT_T)
+
+ # FIXME: should return `length' but then the last sample is not
+ # included and self.last does something weird
+ return len(out)
diff --git a/tests/correlator/epy_block_1.py b/tests/correlator/epy_block_1.py
new file mode 100644
index 0000000..d30c2eb
--- /dev/null
+++ b/tests/correlator/epy_block_1.py
@@ -0,0 +1,27 @@
+"""
+Embedded Python Blocks:
+
+Each time this file is saved, GRC will instantiate the first class it finds
+to get ports and parameters of your block. The arguments to __init__ will
+be the parameters. All of them are required to have default values!
+"""
+
+import numpy as np
+from gnuradio import gr
+
+np.set_printoptions(formatter={'int':hex})
+
+class blk(gr.sync_block):
+ def __init__(self):
+ gr.sync_block.__init__(
+ self,
+ name='Printer',
+ in_sig=[np.byte],
+ out_sig=[]
+ )
+
+ def work(self, input_items, output_items):
+ inp = np.array(input_items[0], dtype=np.uint8)
+ print(f"Decoded {len(inp)} samples:\n{inp}")
+
+ return len(inp)
diff --git a/tests/zmq/zmqtest.grc b/tests/sockets/Socket_test.grc
index ad1729d..fbc3cdf 100644
--- a/tests/zmq/zmqtest.grc
+++ b/tests/sockets/Socket_test.grc
@@ -1,6 +1,6 @@
options:
parameters:
- author: Naoki Pross
+ author: 'Sara Halter '
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
@@ -10,18 +10,18 @@ options:
gen_linking: dynamic
generate_options: no_gui
hier_block_src_path: '.:'
- id: zmqtest
+ id: Test_Bit_Errorrate
max_nouts: '0'
output_language: python
placement: (0,0)
qt_qss_theme: ''
- realtime_scheduling: '1'
+ realtime_scheduling: ''
run: 'True'
run_command: '{python} -u {filename}'
- run_options: prompt
+ run_options: run
sizing_mode: fixed
thread_safe_setters: ''
- title: ZMQ test
+ title: 'Bit Error Rate test '
window_size: ''
states:
bus_sink: false
@@ -41,72 +41,100 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [184, 12]
+ coordinate: [216, 20.0]
rotation: 0
state: enabled
-- name: blocks_throttle_0
- id: blocks_throttle
+- name: analog_noise_source_x_0
+ id: analog_noise_source_x
parameters:
affinity: ''
alias: ''
+ amp: '1'
comment: ''
- ignoretag: 'True'
maxoutbuf: '0'
minoutbuf: '0'
- samples_per_second: samp_rate
- type: complex
- vlen: '1'
+ noise_type: analog.GR_GAUSSIAN
+ seed: '0'
+ type: float
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [440, 324.0]
+ coordinate: [32, 148.0]
rotation: 0
- state: true
-- name: zeromq_rep_sink_0
- id: zeromq_rep_sink
+ state: enabled
+- name: blocks_null_source_0
+ id: blocks_null_source
parameters:
- address: ''
affinity: ''
alias: ''
+ bus_structure_source: '[[0,],]'
comment: ''
- hwm: '-1'
- pass_tags: 'False'
- timeout: '100'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ num_outputs: '1'
type: complex
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [664, 308.0]
+ coordinate: [64, 264.0]
rotation: 0
- state: true
-- name: zeromq_req_source_0
- id: zeromq_req_source
+ state: disabled
+- name: blocks_throttle_1
+ id: blocks_throttle
parameters:
- address: ''
affinity: ''
alias: ''
comment: ''
- hwm: '-1'
+ ignoretag: 'True'
maxoutbuf: '0'
minoutbuf: '0'
- pass_tags: 'False'
- timeout: '100'
- type: complex
+ samples_per_second: samp_rate
+ type: float
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [216, 308.0]
+ coordinate: [280, 164.0]
+ rotation: 0
+ state: true
+- name: fadingui_netsink_0
+ id: fadingui_netsink
+ parameters:
+ address: udp://localhost:31415
+ affinity: ''
+ alias: ''
+ comment: ''
+ type: float
+ veclen: '1'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [504, 164.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: [328, 20.0]
rotation: 0
state: true
connections:
-- [blocks_throttle_0, '0', zeromq_rep_sink_0, '0']
-- [zeromq_req_source_0, '0', blocks_throttle_0, '0']
+- [analog_noise_source_x_0, '0', blocks_throttle_1, '0']
+- [blocks_null_source_0, '0', blocks_throttle_1, '0']
+- [blocks_throttle_1, '0', fadingui_netsink_0, '0']
metadata:
file_format: 1
diff --git a/tests/zmq/zmqtest.py b/tests/sockets/Test_Bit_Errorrate.py
index a046c13..6a989df 100755
--- a/tests/zmq/zmqtest.py
+++ b/tests/sockets/Test_Bit_Errorrate.py
@@ -5,10 +5,11 @@
# SPDX-License-Identifier: GPL-3.0
#
# GNU Radio Python Flow Graph
-# Title: ZMQ test
-# Author: Naoki Pross
+# Title: Bit Error Rate test
+# Author: Sara Halter
# GNU Radio version: 3.8.2.0
+from gnuradio import analog
from gnuradio import blocks
from gnuradio import gr
from gnuradio.filter import firdes
@@ -17,13 +18,14 @@ import signal
from argparse import ArgumentParser
from gnuradio.eng_arg import eng_float, intx
from gnuradio import eng_notation
-from gnuradio import zeromq
+import fadingui
+import numpy as np
-class zmqtest(gr.top_block):
+class Test_Bit_Errorrate(gr.top_block):
def __init__(self):
- gr.top_block.__init__(self, "ZMQ test")
+ gr.top_block.__init__(self, "Bit Error Rate test ")
##################################################
# Variables
@@ -33,17 +35,17 @@ class zmqtest(gr.top_block):
##################################################
# Blocks
##################################################
- self.zeromq_req_source_0 = zeromq.req_source(gr.sizeof_gr_complex, 1, '', 100, False, -1)
- self.zeromq_rep_sink_0 = zeromq.rep_sink(gr.sizeof_gr_complex, 1, '', 100, False, -1)
- self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
+ self.fadingui_netsink_0 = fadingui.netsink(address='udp://localhost:31415', dtype="float", vlen=1)
+ self.blocks_throttle_1 = blocks.throttle(gr.sizeof_float*1, samp_rate,True)
+ self.analog_noise_source_x_0 = analog.noise_source_f(analog.GR_GAUSSIAN, 1, 0)
##################################################
# Connections
##################################################
- self.connect((self.blocks_throttle_0, 0), (self.zeromq_rep_sink_0, 0))
- self.connect((self.zeromq_req_source_0, 0), (self.blocks_throttle_0, 0))
+ self.connect((self.analog_noise_source_x_0, 0), (self.blocks_throttle_1, 0))
+ self.connect((self.blocks_throttle_1, 0), (self.fadingui_netsink_0, 0))
def get_samp_rate(self):
@@ -51,15 +53,13 @@ class zmqtest(gr.top_block):
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
- self.blocks_throttle_0.set_sample_rate(self.samp_rate)
+ self.blocks_throttle_1.set_sample_rate(self.samp_rate)
-def main(top_block_cls=zmqtest, options=None):
- if gr.enable_realtime_scheduling() != gr.RT_OK:
- print("Error: failed to enable real-time scheduling.")
+def main(top_block_cls=Test_Bit_Errorrate, options=None):
tb = top_block_cls()
def sig_handler(sig=None, frame=None):
@@ -73,11 +73,6 @@ def main(top_block_cls=zmqtest, options=None):
tb.start()
- try:
- input('Press Enter to quit: ')
- except EOFError:
- pass
- tb.stop()
tb.wait()
diff --git a/tests/sockets/send.py b/tests/sockets/send.py
new file mode 100644
index 0000000..87faf5d
--- /dev/null
+++ b/tests/sockets/send.py
@@ -0,0 +1,21 @@
+import socket
+from urllib.parse import urlparse
+
+import numpy as np
+
+remote = "upd://localhost:31415"
+url = urlparse(remote)
+
+print(url.hostname)
+print(url.port)
+
+sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+sock.connect((url.hostname, url.port))
+
+# sent some text
+sock.send(bytes("hello", "ascii"))
+
+arr = np.arange(0, 10)
+print(arr)
+
+sock.send(arr.tobytes())
diff --git a/tests/zmq/lena512color.tiff b/tests/zmq/lena512color.tiff
deleted file mode 100644
index ffe5c83..0000000
--- a/tests/zmq/lena512color.tiff
+++ /dev/null
Binary files differ
diff --git a/tests/zmq/server.py b/tests/zmq/server.py
deleted file mode 100644
index be4bede..0000000
--- a/tests/zmq/server.py
+++ /dev/null
@@ -1,4 +0,0 @@
-import zmq
-import pmt
-
-import numpy as np