From 76e9e6393fe1d5a0ccc9e05deb431694921850ec Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Mon, 24 Oct 2016 10:25:42 -0700 Subject: gr-usrptest: Initial creation - new OOT-blocks: phase_calc_ccf hier-block, measurement_sink_f - new python submodules: flowgraphs, functions, rts_tests - new apps: usrp_phasealignment.py - cmdline example for manual testing OOT-Blocks: - phase_calc_ccf takes two complex input streams and conjugate multiplys them and extracts the phase from the result and converts it to degree scale - measurement_sink_f: takes a float input stream and calculates average and stddev for a specified number of samples. Start of a measurement is invoked by a call of start_run() on the block. After a couple of runs average and stddev can be extracted. Python modules: - flowgrahps contains reconfigurable flowgraphs for different GNU Radio RF test cases - functions contains functions which are used in different apps/RTS scripts - rts_tests contains test cases which are meant to be executed from the RTS system. Depends on TinyDB, labview_automation Apps: - usrp_phasealignment.py is an example how to use the underlying flowgraph to measure phase differences. Commandline arguments of uhd_app can be used and several additional arguments can/have to be specified. Runs a phase difference measurement --runs number of times and averages phase difference over --duration seconds. Between measurements USRP sinks are retuned to random frequencies in daughterboard range. Results are displayed using motherboard serial and daughterboard serial --- tools/gr-usrptest/TODO | 21 + tools/gr-usrptest/apps/CMakeLists.txt | 1 + tools/gr-usrptest/apps/usrp_phasealignment.py | 72 + tools/gr-usrptest/apps/usrp_selftest.py | 17 + .../examples/phase_diff_x310_ubx_example.grc | 3296 ++++++++++++++++++++ .../grc/usrptest_measurement_sink_f.xml | 38 + tools/gr-usrptest/grc/usrptest_phase_calc_ccf.xml | 20 + tools/gr-usrptest/include/usrptest/CMakeLists.txt | 2 +- .../include/usrptest/measurement_sink_f.h | 61 + tools/gr-usrptest/lib/CMakeLists.txt | 1 + tools/gr-usrptest/lib/measurement_sink_f_impl.cc | 124 + tools/gr-usrptest/lib/measurement_sink_f_impl.h | 62 + tools/gr-usrptest/lib/qa_usrptest.cc | 36 + tools/gr-usrptest/lib/qa_usrptest.h | 38 + tools/gr-usrptest/lib/test_usrptest.cc | 48 + tools/gr-usrptest/python/CMakeLists.txt | 10 +- tools/gr-usrptest/python/flowgraphs/CMakeLists.txt | 28 + tools/gr-usrptest/python/flowgraphs/__init__.py | 14 + .../python/flowgraphs/phasealignment_fg.py | 119 + tools/gr-usrptest/python/flowgraphs/selftest_fg.py | 122 + tools/gr-usrptest/python/functions.py | 133 + tools/gr-usrptest/python/phase_calc_ccf.py | 47 + tools/gr-usrptest/python/qa_measurement_sink_f.py | 41 + tools/gr-usrptest/python/rts_tests/CMakeLists.txt | 27 + tools/gr-usrptest/python/rts_tests/__init__.py | 14 + .../python/rts_tests/test_phasealignment.py | 121 + tools/gr-usrptest/swig/usrptest_swig.i | 3 + 27 files changed, 4513 insertions(+), 3 deletions(-) create mode 100644 tools/gr-usrptest/TODO create mode 100755 tools/gr-usrptest/apps/usrp_phasealignment.py create mode 100755 tools/gr-usrptest/apps/usrp_selftest.py create mode 100644 tools/gr-usrptest/examples/phase_diff_x310_ubx_example.grc create mode 100644 tools/gr-usrptest/grc/usrptest_measurement_sink_f.xml create mode 100644 tools/gr-usrptest/grc/usrptest_phase_calc_ccf.xml create mode 100644 tools/gr-usrptest/include/usrptest/measurement_sink_f.h create mode 100644 tools/gr-usrptest/lib/measurement_sink_f_impl.cc create mode 100644 tools/gr-usrptest/lib/measurement_sink_f_impl.h create mode 100644 tools/gr-usrptest/lib/qa_usrptest.cc create mode 100644 tools/gr-usrptest/lib/qa_usrptest.h create mode 100644 tools/gr-usrptest/lib/test_usrptest.cc create mode 100644 tools/gr-usrptest/python/flowgraphs/CMakeLists.txt create mode 100644 tools/gr-usrptest/python/flowgraphs/__init__.py create mode 100644 tools/gr-usrptest/python/flowgraphs/phasealignment_fg.py create mode 100644 tools/gr-usrptest/python/flowgraphs/selftest_fg.py create mode 100644 tools/gr-usrptest/python/functions.py create mode 100644 tools/gr-usrptest/python/phase_calc_ccf.py create mode 100755 tools/gr-usrptest/python/qa_measurement_sink_f.py create mode 100644 tools/gr-usrptest/python/rts_tests/CMakeLists.txt create mode 100644 tools/gr-usrptest/python/rts_tests/__init__.py create mode 100644 tools/gr-usrptest/python/rts_tests/test_phasealignment.py diff --git a/tools/gr-usrptest/TODO b/tools/gr-usrptest/TODO new file mode 100644 index 000000000..0a56a49c3 --- /dev/null +++ b/tools/gr-usrptest/TODO @@ -0,0 +1,21 @@ + +- Measure & Report phase alignment and phase stability of USRPs + - Wire diagram: + + ______________ ______________ + | | | | + | USRP 1 | | USRP 2 | + |______________| |______________| + ^ |______^ |_________^ | + |_______________________| + + - USRP 1: send tone from first to second daughterboard - delta_phi_1 + - USRP 1: send tone from second daughterboard to USPR 2 - delta_phi_2 + - USRP 2: send tone to first daughterboard (USRP1) - delta_phi_3 + + Arbitrary number of RX-USRPs and TX-USRPs possible. + + test_signal = sin(2*pi*f*t + phi) + reference = sin(2*pi*f*t) + + diff --git a/tools/gr-usrptest/apps/CMakeLists.txt b/tools/gr-usrptest/apps/CMakeLists.txt index c837d77f6..a40192924 100644 --- a/tools/gr-usrptest/apps/CMakeLists.txt +++ b/tools/gr-usrptest/apps/CMakeLists.txt @@ -21,5 +21,6 @@ include(GrPython) GR_PYTHON_INSTALL( PROGRAMS + usrp_phasealignment.py DESTINATION bin ) diff --git a/tools/gr-usrptest/apps/usrp_phasealignment.py b/tools/gr-usrptest/apps/usrp_phasealignment.py new file mode 100755 index 000000000..928788be4 --- /dev/null +++ b/tools/gr-usrptest/apps/usrp_phasealignment.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python + +from gnuradio.uhd.uhd_app import UHDApp +from usrptest.flowgraphs import phasealignment_fg +from usrptest.functions import run_test, setup_phase_alignment_parser, setup_tx_phase_alignment_parser, setup_manual_phase_alignment_parser +import time +import argparse + + +def plot_results(results): + import matplotlib.pyplot as plt + ax = plt.axes() + ax.set_ylim(-180, 180) + for result in results: + plt.errorbar( + range(len(result['avg'])), + result["avg"], + result["stddev"], + label="{} - {}".format(result["first"], result["second"]), + axes=ax) + ax.legend(loc='upper left', bbox_to_anchor=(0.0, 0.0)) + plt.show() + + +def print_results(results): + for result in results: + print('Results for: {first} - {second}'.format( + first=result['first'], second=result['second'])) + for i, (avg, + stddev) in enumerate(zip(result['avg'], result['stddev'])): + print('\t {}. run avg: {}, stddev: {}'.format(i + 1, avg, stddev)) + + +def main(): + parser = argparse.ArgumentParser(conflict_handler='resolve') + UHDApp.setup_argparser(parser=parser) + parser = setup_phase_alignment_parser(parser) + parser = setup_tx_phase_alignment_parser(parser) + parser = setup_manual_phase_alignment_parser(parser) + args = parser.parse_args() + test_app = UHDApp(args=args) + if args.auto and args.start_freq and args.stop_freq: + from random import uniform + bw = (args.stop_freq - args.start_freq) / args.freq_bands + for nband in range(args.freq_bands): + freq1 = args.start_freq + nband * bw + new_freq = uniform(freq1, freq1 + bw) + test_app.args.freq = new_freq + raw_input( + "New test frequency: {:f} MHz. Adjust your signal generator and press ENTER to start measurement.". + format(new_freq / 1e6)) + fg = phasealignment_fg.phasealignment_fg(test_app) + fg.start() + results = run_test(fg, args.runs) + fg.stop() + fg.wait() + if args.plot: + plot_results(results) + print_results(results) + else: + fg = phasealignment_fg.phasealignment_fg(test_app) + fg.start() + results = run_test(fg, args.runs) + fg.stop() + fg.wait() + if args.plot: + plot_results(results) + print_results(results) + + +if __name__ == '__main__': + main() diff --git a/tools/gr-usrptest/apps/usrp_selftest.py b/tools/gr-usrptest/apps/usrp_selftest.py new file mode 100755 index 000000000..3dcd4e6ca --- /dev/null +++ b/tools/gr-usrptest/apps/usrp_selftest.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +import argparse +from usrptest import parsers +from usrptest.flowgraphs import selftest_fg + + +def main(): + parser = argparse.ArgumentParser() + parser = parsers.add_core_args(parser) + parser = parsers.add_selftest_args(parser) + args = parser.parse_args() + my_flowgraph = selftest_fg.selftest_fg(args.frequency, args.samp_rate, args.dphase ,args.devices) + results = my_flowgraph.run() + print(results) +if __name__ == '__main__': + main() diff --git a/tools/gr-usrptest/examples/phase_diff_x310_ubx_example.grc b/tools/gr-usrptest/examples/phase_diff_x310_ubx_example.grc new file mode 100644 index 000000000..f6cbe3d83 --- /dev/null +++ b/tools/gr-usrptest/examples/phase_diff_x310_ubx_example.grc @@ -0,0 +1,3296 @@ + + + + Thu Oct 6 14:49:17 2016 + + options + + author + + + + window_size + + + + category + [GRC Hier Blocks] + + + comment + + + + description + + + + _enabled + True + + + _coordinate + (8, 8) + + + _rotation + 0 + + + generate_options + qt_gui + + + hier_block_src_path + .: + + + id + phase_difference_x3x0_example + + + max_nouts + 0 + + + qt_qss_theme + + + + realtime_scheduling + + + + run_command + {python} -u {filename} + + + run_options + prompt + + + run + True + + + thread_safe_setters + + + + title + + + + + variable + + comment + + + + _enabled + 0 + + + _coordinate + (8, 100) + + + _rotation + 0 + + + id + baseband + + + value + 3e9 + + + + variable_qtgui_range + + comment + + + + value + 10e6 + + + _enabled + True + + + _coordinate + (200, 112) + + + gui_hint + + + + _rotation + 0 + + + id + rx_base + + + label + + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + 10e6 + + + step + 50e6 + + + stop + 6e9 + + + rangeType + float + + + widget + counter_slider + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (8, 160) + + + _rotation + 0 + + + id + samp_rate + + + value + 10e6 + + + + variable_qtgui_range + + comment + + + + value + 10e6 + + + _enabled + True + + + _coordinate + (168, 240) + + + gui_hint + + + + _rotation + 0 + + + id + tx_base + + + label + + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + 10e6 + + + step + 50e6 + + + stop + 6e9 + + + rangeType + float + + + widget + counter_slider + + + + analog_sig_source_x + + amp + 1 + + + alias + + + + comment + + + + affinity + + + + _enabled + 1 + + + freq + 100e3 + + + _coordinate + (440, 112) + + + _rotation + 0 + + + id + analog_sig_source_x_1 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + offset + 0 + + + type + complex + + + samp_rate + samp_rate + + + waveform + analog.GR_COS_WAVE + + + + qtgui_time_sink_x + + autoscale + False + + + axislabels + True + + + alias + + + + comment + + + + ctrlpanel + False + + + affinity + + + + entags + True + + + _enabled + True + + + _coordinate + (768, 404) + + + gui_hint + + + + _rotation + 0 + + + grid + False + + + id + qtgui_time_sink_x_0 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + marker1 + -1 + + + style1 + 1 + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "blue" + + + label10 + + + + marker10 + -1 + + + style10 + 1 + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + marker2 + -1 + + + style2 + 1 + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "green" + + + label3 + + + + marker3 + -1 + + + style3 + 1 + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "black" + + + label4 + + + + marker4 + -1 + + + style4 + 1 + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "cyan" + + + label5 + + + + marker5 + -1 + + + style5 + 1 + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "magenta" + + + label6 + + + + marker6 + -1 + + + style6 + 1 + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "yellow" + + + label7 + + + + marker7 + -1 + + + style7 + 1 + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "dark red" + + + label8 + + + + marker8 + -1 + + + style8 + 1 + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "dark green" + + + label9 + + + + marker9 + -1 + + + style9 + 1 + + + width9 + 1 + + + name + "" + + + nconnections + 1 + + + size + 1024 + + + srate + samp_rate + + + 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 + + + ylabel + Amplitude + + + yunit + "" + + + ymax + 1 + + + ymin + -1 + + + + qtgui_time_sink_x + + autoscale + False + + + axislabels + True + + + alias + + + + comment + + + + ctrlpanel + False + + + affinity + + + + entags + True + + + _enabled + 0 + + + _coordinate + (664, 280) + + + gui_hint + + + + _rotation + 0 + + + grid + False + + + id + qtgui_time_sink_x_1 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + marker1 + -1 + + + style1 + 1 + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "blue" + + + label10 + + + + marker10 + -1 + + + style10 + 1 + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + marker2 + -1 + + + style2 + 1 + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "green" + + + label3 + + + + marker3 + -1 + + + style3 + 1 + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "black" + + + label4 + + + + marker4 + -1 + + + style4 + 1 + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "cyan" + + + label5 + + + + marker5 + -1 + + + style5 + 1 + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "magenta" + + + label6 + + + + marker6 + -1 + + + style6 + 1 + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "yellow" + + + label7 + + + + marker7 + -1 + + + style7 + 1 + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "dark red" + + + label8 + + + + marker8 + -1 + + + style8 + 1 + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "dark green" + + + label9 + + + + marker9 + -1 + + + style9 + 1 + + + width9 + 1 + + + name + "" + + + nconnections + 2 + + + size + 1024 + + + srate + samp_rate + + + 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 + complex + + + update_time + 0.10 + + + ylabel + Amplitude + + + yunit + "" + + + ymax + 1 + + + ymin + -1 + + + + uhd_usrp_sink + + alias + + + + ant0 + + + + bw0 + 0 + + + center_freq0 + tx_base + + + norm_gain0 + False + + + gain0 + 15 + + + ant10 + + + + bw10 + 0 + + + center_freq10 + 0 + + + norm_gain10 + False + + + gain10 + 0 + + + ant11 + + + + bw11 + 0 + + + center_freq11 + 0 + + + norm_gain11 + False + + + gain11 + 0 + + + ant12 + + + + bw12 + 0 + + + center_freq12 + 0 + + + norm_gain12 + False + + + gain12 + 0 + + + ant13 + + + + bw13 + 0 + + + center_freq13 + 0 + + + norm_gain13 + False + + + gain13 + 0 + + + ant14 + + + + bw14 + 0 + + + center_freq14 + 0 + + + norm_gain14 + False + + + gain14 + 0 + + + ant15 + + + + bw15 + 0 + + + center_freq15 + 0 + + + norm_gain15 + False + + + gain15 + 0 + + + ant16 + + + + bw16 + 0 + + + center_freq16 + 0 + + + norm_gain16 + False + + + gain16 + 0 + + + ant17 + + + + bw17 + 0 + + + center_freq17 + 0 + + + norm_gain17 + False + + + gain17 + 0 + + + ant18 + + + + bw18 + 0 + + + center_freq18 + 0 + + + norm_gain18 + False + + + gain18 + 0 + + + ant19 + + + + bw19 + 0 + + + center_freq19 + 0 + + + norm_gain19 + False + + + gain19 + 0 + + + ant1 + + + + bw1 + 0 + + + center_freq1 + tx_base + + + norm_gain1 + False + + + gain1 + 15 + + + ant20 + + + + bw20 + 0 + + + center_freq20 + 0 + + + norm_gain20 + False + + + gain20 + 0 + + + ant21 + + + + bw21 + 0 + + + center_freq21 + 0 + + + norm_gain21 + False + + + gain21 + 0 + + + ant22 + + + + bw22 + 0 + + + center_freq22 + 0 + + + norm_gain22 + False + + + gain22 + 0 + + + ant23 + + + + bw23 + 0 + + + center_freq23 + 0 + + + norm_gain23 + False + + + gain23 + 0 + + + ant24 + + + + bw24 + 0 + + + center_freq24 + 0 + + + norm_gain24 + False + + + gain24 + 0 + + + ant25 + + + + bw25 + 0 + + + center_freq25 + 0 + + + norm_gain25 + False + + + gain25 + 0 + + + ant26 + + + + bw26 + 0 + + + center_freq26 + 0 + + + norm_gain26 + False + + + gain26 + 0 + + + ant27 + + + + bw27 + 0 + + + center_freq27 + 0 + + + norm_gain27 + False + + + gain27 + 0 + + + ant28 + + + + bw28 + 0 + + + center_freq28 + 0 + + + norm_gain28 + False + + + gain28 + 0 + + + ant29 + + + + bw29 + 0 + + + center_freq29 + 0 + + + norm_gain29 + False + + + gain29 + 0 + + + ant2 + + + + bw2 + 0 + + + center_freq2 + 0 + + + norm_gain2 + False + + + gain2 + 0 + + + ant30 + + + + bw30 + 0 + + + center_freq30 + 0 + + + norm_gain30 + False + + + gain30 + 0 + + + ant31 + + + + bw31 + 0 + + + center_freq31 + 0 + + + norm_gain31 + False + + + gain31 + 0 + + + ant3 + + + + bw3 + 0 + + + center_freq3 + 0 + + + norm_gain3 + False + + + gain3 + 0 + + + ant4 + + + + bw4 + 0 + + + center_freq4 + 0 + + + norm_gain4 + False + + + gain4 + 0 + + + ant5 + + + + bw5 + 0 + + + center_freq5 + 0 + + + norm_gain5 + False + + + gain5 + 0 + + + ant6 + + + + bw6 + 0 + + + center_freq6 + 0 + + + norm_gain6 + False + + + gain6 + 0 + + + ant7 + + + + bw7 + 0 + + + center_freq7 + 0 + + + norm_gain7 + False + + + gain7 + 0 + + + ant8 + + + + bw8 + 0 + + + center_freq8 + 0 + + + norm_gain8 + False + + + gain8 + 0 + + + ant9 + + + + bw9 + 0 + + + center_freq9 + 0 + + + norm_gain9 + False + + + gain9 + 0 + + + clock_rate + 0.0 + + + comment + + + + affinity + + + + dev_addr + "addr=192.168.10.2" + + + dev_args + "" + + + _enabled + 1 + + + _coordinate + (816, 104) + + + _rotation + 0 + + + id + uhd_usrp_sink_1 + + + type + fc32 + + + clock_source0 + + + + sd_spec0 + "A:0 B:0" + + + time_source0 + + + + clock_source1 + + + + sd_spec1 + + + + time_source1 + + + + clock_source2 + + + + sd_spec2 + + + + time_source2 + + + + clock_source3 + + + + sd_spec3 + + + + time_source3 + + + + clock_source4 + + + + sd_spec4 + + + + time_source4 + + + + clock_source5 + + + + sd_spec5 + + + + time_source5 + + + + clock_source6 + + + + sd_spec6 + + + + time_source6 + + + + clock_source7 + + + + sd_spec7 + + + + time_source7 + + + + nchan + 2 + + + num_mboards + 1 + + + samp_rate + samp_rate + + + hide_cmd_port + False + + + hide_lo_controls + True + + + stream_args + + + + stream_chans + [] + + + sync + + + + len_tag_name + + + + otw + + + + + uhd_usrp_source + + alias + + + + ant0 + + + + bw0 + 0 + + + center_freq0 + rx_base + + + dc_offs_enb0 + "" + + + iq_imbal_enb0 + "" + + + norm_gain0 + False + + + gain0 + 15 + + + lo_export0 + False + + + lo_source0 + internal + + + ant10 + + + + bw10 + 0 + + + center_freq10 + 0 + + + dc_offs_enb10 + "" + + + iq_imbal_enb10 + "" + + + norm_gain10 + False + + + gain10 + 0 + + + lo_export10 + False + + + lo_source10 + internal + + + ant11 + + + + bw11 + 0 + + + center_freq11 + 0 + + + dc_offs_enb11 + "" + + + iq_imbal_enb11 + "" + + + norm_gain11 + False + + + gain11 + 0 + + + lo_export11 + False + + + lo_source11 + internal + + + ant12 + + + + bw12 + 0 + + + center_freq12 + 0 + + + dc_offs_enb12 + "" + + + iq_imbal_enb12 + "" + + + norm_gain12 + False + + + gain12 + 0 + + + lo_export12 + False + + + lo_source12 + internal + + + ant13 + + + + bw13 + 0 + + + center_freq13 + 0 + + + dc_offs_enb13 + "" + + + iq_imbal_enb13 + "" + + + norm_gain13 + False + + + gain13 + 0 + + + lo_export13 + False + + + lo_source13 + internal + + + ant14 + + + + bw14 + 0 + + + center_freq14 + 0 + + + dc_offs_enb14 + "" + + + iq_imbal_enb14 + "" + + + norm_gain14 + False + + + gain14 + 0 + + + lo_export14 + False + + + lo_source14 + internal + + + ant15 + + + + bw15 + 0 + + + center_freq15 + 0 + + + dc_offs_enb15 + "" + + + iq_imbal_enb15 + "" + + + norm_gain15 + False + + + gain15 + 0 + + + lo_export15 + False + + + lo_source15 + internal + + + ant16 + + + + bw16 + 0 + + + center_freq16 + 0 + + + dc_offs_enb16 + "" + + + iq_imbal_enb16 + "" + + + norm_gain16 + False + + + gain16 + 0 + + + lo_export16 + False + + + lo_source16 + internal + + + ant17 + + + + bw17 + 0 + + + center_freq17 + 0 + + + dc_offs_enb17 + "" + + + iq_imbal_enb17 + "" + + + norm_gain17 + False + + + gain17 + 0 + + + lo_export17 + False + + + lo_source17 + internal + + + ant18 + + + + bw18 + 0 + + + center_freq18 + 0 + + + dc_offs_enb18 + "" + + + iq_imbal_enb18 + "" + + + norm_gain18 + False + + + gain18 + 0 + + + lo_export18 + False + + + lo_source18 + internal + + + ant19 + + + + bw19 + 0 + + + center_freq19 + 0 + + + dc_offs_enb19 + "" + + + iq_imbal_enb19 + "" + + + norm_gain19 + False + + + gain19 + 0 + + + lo_export19 + False + + + lo_source19 + internal + + + ant1 + + + + bw1 + 0 + + + center_freq1 + rx_base + + + dc_offs_enb1 + "" + + + iq_imbal_enb1 + "" + + + norm_gain1 + False + + + gain1 + 15 + + + lo_export1 + False + + + lo_source1 + internal + + + ant20 + + + + bw20 + 0 + + + center_freq20 + 0 + + + dc_offs_enb20 + "" + + + iq_imbal_enb20 + "" + + + norm_gain20 + False + + + gain20 + 0 + + + lo_export20 + False + + + lo_source20 + internal + + + ant21 + + + + bw21 + 0 + + + center_freq21 + 0 + + + dc_offs_enb21 + "" + + + iq_imbal_enb21 + "" + + + norm_gain21 + False + + + gain21 + 0 + + + lo_export21 + False + + + lo_source21 + internal + + + ant22 + + + + bw22 + 0 + + + center_freq22 + 0 + + + dc_offs_enb22 + "" + + + iq_imbal_enb22 + "" + + + norm_gain22 + False + + + gain22 + 0 + + + lo_export22 + False + + + lo_source22 + internal + + + ant23 + + + + bw23 + 0 + + + center_freq23 + 0 + + + dc_offs_enb23 + "" + + + iq_imbal_enb23 + "" + + + norm_gain23 + False + + + gain23 + 0 + + + lo_export23 + False + + + lo_source23 + internal + + + ant24 + + + + bw24 + 0 + + + center_freq24 + 0 + + + dc_offs_enb24 + "" + + + iq_imbal_enb24 + "" + + + norm_gain24 + False + + + gain24 + 0 + + + lo_export24 + False + + + lo_source24 + internal + + + ant25 + + + + bw25 + 0 + + + center_freq25 + 0 + + + dc_offs_enb25 + "" + + + iq_imbal_enb25 + "" + + + norm_gain25 + False + + + gain25 + 0 + + + lo_export25 + False + + + lo_source25 + internal + + + ant26 + + + + bw26 + 0 + + + center_freq26 + 0 + + + dc_offs_enb26 + "" + + + iq_imbal_enb26 + "" + + + norm_gain26 + False + + + gain26 + 0 + + + lo_export26 + False + + + lo_source26 + internal + + + ant27 + + + + bw27 + 0 + + + center_freq27 + 0 + + + dc_offs_enb27 + "" + + + iq_imbal_enb27 + "" + + + norm_gain27 + False + + + gain27 + 0 + + + lo_export27 + False + + + lo_source27 + internal + + + ant28 + + + + bw28 + 0 + + + center_freq28 + 0 + + + dc_offs_enb28 + "" + + + iq_imbal_enb28 + "" + + + norm_gain28 + False + + + gain28 + 0 + + + lo_export28 + False + + + lo_source28 + internal + + + ant29 + + + + bw29 + 0 + + + center_freq29 + 0 + + + dc_offs_enb29 + "" + + + iq_imbal_enb29 + "" + + + norm_gain29 + False + + + gain29 + 0 + + + lo_export29 + False + + + lo_source29 + internal + + + ant2 + + + + bw2 + 0 + + + center_freq2 + 0 + + + dc_offs_enb2 + "" + + + iq_imbal_enb2 + "" + + + norm_gain2 + False + + + gain2 + 0 + + + lo_export2 + False + + + lo_source2 + internal + + + ant30 + + + + bw30 + 0 + + + center_freq30 + 0 + + + dc_offs_enb30 + "" + + + iq_imbal_enb30 + "" + + + norm_gain30 + False + + + gain30 + 0 + + + lo_export30 + False + + + lo_source30 + internal + + + ant31 + + + + bw31 + 0 + + + center_freq31 + 0 + + + dc_offs_enb31 + "" + + + iq_imbal_enb31 + "" + + + norm_gain31 + False + + + gain31 + 0 + + + lo_export31 + False + + + lo_source31 + internal + + + ant3 + + + + bw3 + 0 + + + center_freq3 + 0 + + + dc_offs_enb3 + "" + + + iq_imbal_enb3 + "" + + + norm_gain3 + False + + + gain3 + 0 + + + lo_export3 + False + + + lo_source3 + internal + + + ant4 + + + + bw4 + 0 + + + center_freq4 + 0 + + + dc_offs_enb4 + "" + + + iq_imbal_enb4 + "" + + + norm_gain4 + False + + + gain4 + 0 + + + lo_export4 + False + + + lo_source4 + internal + + + ant5 + + + + bw5 + 0 + + + center_freq5 + 0 + + + dc_offs_enb5 + "" + + + iq_imbal_enb5 + "" + + + norm_gain5 + False + + + gain5 + 0 + + + lo_export5 + False + + + lo_source5 + internal + + + ant6 + + + + bw6 + 0 + + + center_freq6 + 0 + + + dc_offs_enb6 + "" + + + iq_imbal_enb6 + "" + + + norm_gain6 + False + + + gain6 + 0 + + + lo_export6 + False + + + lo_source6 + internal + + + ant7 + + + + bw7 + 0 + + + center_freq7 + 0 + + + dc_offs_enb7 + "" + + + iq_imbal_enb7 + "" + + + norm_gain7 + False + + + gain7 + 0 + + + lo_export7 + False + + + lo_source7 + internal + + + ant8 + + + + bw8 + 0 + + + center_freq8 + 0 + + + dc_offs_enb8 + "" + + + iq_imbal_enb8 + "" + + + norm_gain8 + False + + + gain8 + 0 + + + lo_export8 + False + + + lo_source8 + internal + + + ant9 + + + + bw9 + 0 + + + center_freq9 + 0 + + + dc_offs_enb9 + "" + + + iq_imbal_enb9 + "" + + + norm_gain9 + False + + + gain9 + 0 + + + lo_export9 + False + + + lo_source9 + internal + + + clock_rate + 0.0 + + + comment + + + + affinity + + + + dev_addr + "addr=192.168.10.2" + + + dev_args + "" + + + _enabled + True + + + _coordinate + (320, 376) + + + _rotation + 0 + + + id + uhd_usrp_source_0 + + + maxoutbuf + 0 + + + clock_source0 + + + + sd_spec0 + "A:0 B:0" + + + time_source0 + + + + clock_source1 + + + + sd_spec1 + + + + time_source1 + + + + clock_source2 + + + + sd_spec2 + + + + time_source2 + + + + clock_source3 + + + + sd_spec3 + + + + time_source3 + + + + clock_source4 + + + + sd_spec4 + + + + time_source4 + + + + clock_source5 + + + + sd_spec5 + + + + time_source5 + + + + clock_source6 + + + + sd_spec6 + + + + time_source6 + + + + clock_source7 + + + + sd_spec7 + + + + time_source7 + + + + minoutbuf + 0 + + + nchan + 2 + + + num_mboards + 1 + + + type + fc32 + + + samp_rate + samp_rate + + + hide_cmd_port + False + + + hide_lo_controls + True + + + stream_args + + + + stream_chans + [] + + + sync + + + + otw + + + + + usrptest_phase_calc_ccf + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (568, 408) + + + _rotation + 0 + + + id + usrptest_phase_calc_ccf_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + + analog_sig_source_x_1 + uhd_usrp_sink_1 + 0 + 0 + + + analog_sig_source_x_1 + uhd_usrp_sink_1 + 0 + 1 + + + uhd_usrp_source_0 + qtgui_time_sink_x_1 + 0 + 0 + + + uhd_usrp_source_0 + usrptest_phase_calc_ccf_0 + 0 + 0 + + + uhd_usrp_source_0 + qtgui_time_sink_x_1 + 1 + 1 + + + uhd_usrp_source_0 + usrptest_phase_calc_ccf_0 + 1 + 1 + + + usrptest_phase_calc_ccf_0 + qtgui_time_sink_x_0 + 0 + 0 + + diff --git a/tools/gr-usrptest/grc/usrptest_measurement_sink_f.xml b/tools/gr-usrptest/grc/usrptest_measurement_sink_f.xml new file mode 100644 index 000000000..c681e457f --- /dev/null +++ b/tools/gr-usrptest/grc/usrptest_measurement_sink_f.xml @@ -0,0 +1,38 @@ + + + measurement_sink_f + usrptest_measurement_sink_f + [usrptest] + import usrptest + usrptest.measurement_sink_f($num_samples, $) + + + ... + ... + ... + + + + + in + + + + + + out + + + diff --git a/tools/gr-usrptest/grc/usrptest_phase_calc_ccf.xml b/tools/gr-usrptest/grc/usrptest_phase_calc_ccf.xml new file mode 100644 index 000000000..4c98f56eb --- /dev/null +++ b/tools/gr-usrptest/grc/usrptest_phase_calc_ccf.xml @@ -0,0 +1,20 @@ + + + Calculate phase diff + usrptest_phase_calc_ccf + [usrptest] + import usrptest + usrptest.phase_calc_ccf() + + in1 + complex + + + in2 + complex + + + out + float + + diff --git a/tools/gr-usrptest/include/usrptest/CMakeLists.txt b/tools/gr-usrptest/include/usrptest/CMakeLists.txt index 2d5ed3975..761a8bee4 100644 --- a/tools/gr-usrptest/include/usrptest/CMakeLists.txt +++ b/tools/gr-usrptest/include/usrptest/CMakeLists.txt @@ -22,5 +22,5 @@ ######################################################################## install(FILES api.h - DESTINATION include/usrptest + measurement_sink_f.h DESTINATION include/usrptest ) diff --git a/tools/gr-usrptest/include/usrptest/measurement_sink_f.h b/tools/gr-usrptest/include/usrptest/measurement_sink_f.h new file mode 100644 index 000000000..aaf1fb9d1 --- /dev/null +++ b/tools/gr-usrptest/include/usrptest/measurement_sink_f.h @@ -0,0 +1,61 @@ +/* -*- c++ -*- */ +/* + * Copyright 2016 Ettus Research LLC. + * + * 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. + */ + + +#ifndef INCLUDED_USRPTEST_MEASUREMENT_SINK_F_H +#define INCLUDED_USRPTEST_MEASUREMENT_SINK_F_H + +#include +#include + +namespace gr { + namespace usrptest { + + /*! + * \brief <+description of block+> + * \ingroup usrptest + * + */ + class USRPTEST_API measurement_sink_f : virtual public gr::sync_block + { + public: + typedef boost::shared_ptr sptr; + + /*! + * \brief Return a shared_ptr to a new instance of usrptest::measurement_sink_f. + * + * To avoid accidental use of raw pointers, usrptest::measurement_sink_f's + * constructor is in a private implementation + * class. usrptest::measurement_sink_f::make is the public interface for + * creating new instances. + */ + static sptr make(int num_samples,int runs); + virtual std::vector get_avg() const = 0; + virtual std::vector get_stddev() const = 0; + virtual int get_run() const = 0; + virtual void start_run() = 0; + + }; + + } // namespace usrptest +} // namespace gr + +#endif /* INCLUDED_USRPTEST_MEASUREMENT_SINK_F_H */ + diff --git a/tools/gr-usrptest/lib/CMakeLists.txt b/tools/gr-usrptest/lib/CMakeLists.txt index dd44b7f26..2d8f0fe16 100644 --- a/tools/gr-usrptest/lib/CMakeLists.txt +++ b/tools/gr-usrptest/lib/CMakeLists.txt @@ -26,6 +26,7 @@ include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIRS}) list(APPEND usrptest_sources + measurement_sink_f_impl.cc ) set(usrptest_sources "${usrptest_sources}" PARENT_SCOPE) diff --git a/tools/gr-usrptest/lib/measurement_sink_f_impl.cc b/tools/gr-usrptest/lib/measurement_sink_f_impl.cc new file mode 100644 index 000000000..58faccb9a --- /dev/null +++ b/tools/gr-usrptest/lib/measurement_sink_f_impl.cc @@ -0,0 +1,124 @@ +/* -*- c++ -*- */ +/* + * Copyright 2016 Ettus Research LLC. + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include "measurement_sink_f_impl.h" + +namespace gr { + namespace usrptest { + + measurement_sink_f::sptr + measurement_sink_f::make(int num_samples, int runs) + { + return gnuradio::get_initial_sptr + (new measurement_sink_f_impl(num_samples, runs)); + + } + + /* + * The private constructor + */ + measurement_sink_f_impl::measurement_sink_f_impl(int num_samples, int runs) + : gr::sync_block("measurement_sink_f", + gr::io_signature::make(1, 1, sizeof(float)), + gr::io_signature::make(0, 0, 0)), + d_runs(runs), + d_nsamples(num_samples) + { + d_curr_run = 0; // number of completed measurement runs + d_curr_avg = 0.0f; // accumulated average + d_curr_M2 = 0.0f; // accumulated M2 + d_run = false; // true if a measurement is currently recorded + d_curr_sample = 0; // current sample count + } + + /* + * Our virtual destructor. + */ + measurement_sink_f_impl::~measurement_sink_f_impl() + { + } + + int + measurement_sink_f_impl::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) + { + const float *in = (const float *) input_items[0]; + if ((d_curr_run < d_runs)&&d_run){ //check if we need to record data + const int max_items = std::min(noutput_items, d_nsamples-d_curr_sample); // calculate number of samples we have to take into account + for (int item=0; item < max_items;++item){ + ++d_curr_sample; + inc_both(in[item]); + } + if (d_curr_sample == d_nsamples) { + d_avg.push_back(d_curr_avg); + d_stddev.push_back(std::sqrt(d_curr_M2/(float)(d_curr_sample - 1))); + ++d_curr_run; + d_run = false; + d_curr_sample = 0; + d_curr_avg = 0.0f; + d_curr_M2 = 0.0f; + } + } + return noutput_items; + } + + + void + measurement_sink_f_impl::inc_both(const float new_val) + { + float delta = new_val - d_curr_avg; + d_curr_avg = d_curr_avg + delta/(float)(d_curr_sample); + d_curr_M2 = d_curr_M2 + delta*(new_val - d_curr_avg); + } + + + void + measurement_sink_f_impl::start_run() + { + d_run = true; + } + + std::vector + measurement_sink_f_impl::get_avg() const + { + return d_avg; + } + + std::vector + measurement_sink_f_impl::get_stddev() const + { + return d_stddev; + } + + int + measurement_sink_f_impl::get_run() const + { + return d_curr_run; + } + + } /* namespace usrptest */ +} /* namespace gr */ + diff --git a/tools/gr-usrptest/lib/measurement_sink_f_impl.h b/tools/gr-usrptest/lib/measurement_sink_f_impl.h new file mode 100644 index 000000000..4d63adfa2 --- /dev/null +++ b/tools/gr-usrptest/lib/measurement_sink_f_impl.h @@ -0,0 +1,62 @@ +/* -*- c++ -*- */ +/* + * Copyright 2016 Ettus Research LLC. + * + * 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. + */ + +#ifndef INCLUDED_USRPTEST_MEASUREMENT_SINK_F_IMPL_H +#define INCLUDED_USRPTEST_MEASUREMENT_SINK_F_IMPL_H + +#include + +namespace gr { + namespace usrptest { + + class measurement_sink_f_impl : public measurement_sink_f + { + private: + std::vector< float > d_avg; + std::vector< float > d_stddev; + bool d_run; + int d_runs; + int d_nsamples; + int d_curr_sample; + int d_curr_run; + float d_curr_avg; + float d_curr_M2; + void inc_both(const float new_val); + + + public: + measurement_sink_f_impl(int num_samples, int runs); + ~measurement_sink_f_impl(); + std::vector get_avg() const; + std::vector get_stddev() const; + int get_run() const; + void start_run(); + + // Where all the action really happens + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } // namespace usrptest +} // namespace gr + +#endif /* INCLUDED_USRPTEST_MEASUREMENT_SINK_F_IMPL_H */ + diff --git a/tools/gr-usrptest/lib/qa_usrptest.cc b/tools/gr-usrptest/lib/qa_usrptest.cc new file mode 100644 index 000000000..c8e6495ae --- /dev/null +++ b/tools/gr-usrptest/lib/qa_usrptest.cc @@ -0,0 +1,36 @@ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +/* + * This class gathers together all the test cases for the gr-filter + * directory into a single test suite. As you create new test cases, + * add them here. + */ + +#include "qa_usrptest.h" + +CppUnit::TestSuite * +qa_usrptest::suite() +{ + CppUnit::TestSuite *s = new CppUnit::TestSuite("usrptest"); + + return s; +} diff --git a/tools/gr-usrptest/lib/qa_usrptest.h b/tools/gr-usrptest/lib/qa_usrptest.h new file mode 100644 index 000000000..94ce3f33b --- /dev/null +++ b/tools/gr-usrptest/lib/qa_usrptest.h @@ -0,0 +1,38 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef _QA_USRPTEST_H_ +#define _QA_USRPTEST_H_ + +#include +#include + +//! collect all the tests for the gr-filter directory + +class __GR_ATTR_EXPORT qa_usrptest +{ + public: + //! return suite of tests for all of gr-filter directory + static CppUnit::TestSuite *suite(); +}; + +#endif /* _QA_USRPTEST_H_ */ diff --git a/tools/gr-usrptest/lib/test_usrptest.cc b/tools/gr-usrptest/lib/test_usrptest.cc new file mode 100644 index 000000000..808638cdf --- /dev/null +++ b/tools/gr-usrptest/lib/test_usrptest.cc @@ -0,0 +1,48 @@ +/* -*- c++ -*- */ +/* + * Copyright 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio 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. + * + * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include +#include "qa_usrptest.h" +#include +#include + +int +main (int argc, char **argv) +{ + CppUnit::TextTestRunner runner; + std::ofstream xmlfile(get_unittest_path("usrptest.xml").c_str()); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); + + runner.addTest(qa_usrptest::suite()); + runner.setOutputter(xmlout); + + bool was_successful = runner.run("", false); + + return was_successful ? 0 : 1; +} diff --git a/tools/gr-usrptest/python/CMakeLists.txt b/tools/gr-usrptest/python/CMakeLists.txt index 4afda600e..ba3d12394 100644 --- a/tools/gr-usrptest/python/CMakeLists.txt +++ b/tools/gr-usrptest/python/CMakeLists.txt @@ -31,15 +31,21 @@ endif() GR_PYTHON_INSTALL( FILES __init__.py - parsers.py - selftest_fg.py + functions.py phase_calc_ccf.py DESTINATION ${GR_PYTHON_DIR}/usrptest ) +add_subdirectory(flowgraphs) +add_subdirectory(labview_control) +add_subdirectory(rts_tests) + ######################################################################## # Handle the unit tests ######################################################################## include(GrTest) +GR_ADD_TEST(qa_phasealignment ${PYTHON_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/qa_phasealignment.py) set(GR_TEST_TARGET_DEPS gnuradio-usrptest) set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig) +GR_ADD_TEST(qa_measurement_sink_f ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_measurement_sink_f.py) diff --git a/tools/gr-usrptest/python/flowgraphs/CMakeLists.txt b/tools/gr-usrptest/python/flowgraphs/CMakeLists.txt new file mode 100644 index 000000000..7ea94b505 --- /dev/null +++ b/tools/gr-usrptest/python/flowgraphs/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio 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. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Install python sources +######################################################################## +GR_PYTHON_INSTALL( + FILES + __init__.py + selftest_fg.py + phasealignment_fg.py DESTINATION ${GR_PYTHON_DIR}/usrptest/flowgraphs +) diff --git a/tools/gr-usrptest/python/flowgraphs/__init__.py b/tools/gr-usrptest/python/flowgraphs/__init__.py new file mode 100644 index 000000000..048e5638a --- /dev/null +++ b/tools/gr-usrptest/python/flowgraphs/__init__.py @@ -0,0 +1,14 @@ +""" +usrptest.flowgraphs +====================================== + +Contents +-------- + +Subpackages +----------- +:: + +The existance of the file turns the folder into a Python module. + +""" diff --git a/tools/gr-usrptest/python/flowgraphs/phasealignment_fg.py b/tools/gr-usrptest/python/flowgraphs/phasealignment_fg.py new file mode 100644 index 000000000..f120e2421 --- /dev/null +++ b/tools/gr-usrptest/python/flowgraphs/phasealignment_fg.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python2 + +from gnuradio import gr +from gnuradio import uhd +from gnuradio import analog +from usrptest import phase_calc_ccf, measurement_sink_f +from usrptest.functions import log_level +from random import uniform +from ast import literal_eval +import copy +import logging +import sys + + +class phasealignment_fg(gr.top_block): + def __init__(self, uhd_app): + gr.top_block.__init__(self, "Calculate dphi for all USRPs (Rx only)") + ############################## + # Block dicts + ############################## + self.log = logging.getLogger(__name__) + [self.log.removeHandler(h) for h in self.log.handlers] + self.log.addHandler(logging.StreamHandler(sys.stdout)) + self.log.setLevel(log_level(uhd_app.args.log_level)) + self.rx_streams = list() + self.phase_diff_calc = list() + self.measurement_sink = list() + self.uhd_app = copy.copy(uhd_app) + self.tx_app = copy.copy(uhd_app) + self.samp_rate = uhd_app.args.samp_rate + # Create all devices specified in --receiver + # Create all remaining blocks and connect devices to the first port and + # sink + self.uhd_app.args.num_chan = len(self.uhd_app.args.channels) + self.log.info('setting up usrp....') + ############################## + # Setup RX + ############################## + self.log.debug("RX-Setup with args: {}".format(self.uhd_app.args)) + self.uhd_app.setup_usrp(uhd.usrp_source, self.uhd_app.args) + if self.uhd_app.args.measurement_setup is not None: + self.measurement_channels = self.uhd_app.args.measurement_setup.strip( + ).split(',') + # make sure every channels is listed in measurement_channels at least once + if len(set( + self.measurement_channels)) != self.uhd_apps.args.num_chan: + self.uhd_app.vprint( + "[{prefix}] Number of measurement channels has to be the number of used channels." + ) + self.uhd_app.exit(1) + self.measurement_channels = [self.uhd_app.args.channels.index(m) for m in self.measurement_channels] + else: + self.measurement_channels = range(self.uhd_app.args.num_chan) + + self.measurement_channels_names = list() + for chan in self.measurement_channels: + usrp_info = self.uhd_app.usrp.get_usrp_info(chan) + self.measurement_channels_names.append("_".join( + [usrp_info['mboard_serial'], usrp_info['rx_serial']])) + + #Connect channels to first port of d_phi_calc_block and to measurement_sink + for num, chan in enumerate(self.measurement_channels[:-1]): + self.phase_diff_calc.append(phase_calc_ccf()) + self.measurement_sink.append( + measurement_sink_f( + int(self.uhd_app.args.samp_rate * + self.uhd_app.args.duration), self.uhd_app.args.runs)) + self.connect((self.uhd_app.usrp, chan), + (self.phase_diff_calc[num], 0)) + self.connect((self.phase_diff_calc[num], 0), + (self.measurement_sink[num], 0)) + # Connect devices to second port of d_phi_block + for num, chan in enumerate(self.measurement_channels[1:]): + self.connect((self.uhd_app.usrp, chan), + (self.phase_diff_calc[num], 1)) + ############################## + # Setup TX + ############################## + if self.uhd_app.args.tx_channels is not None: + self.tx_app.args.antenna = self.tx_app.args.tx_antenna + self.tx_app.args.channels = [ + int(chan.strip()) + for chan in self.tx_app.args.tx_channels.split(',') + ] + self.tx_app.usrp = None + self.log.debug("TX-Setup with args: {}".format(self.tx_app.args)) + self.tx_app.setup_usrp(uhd.usrp_sink, self.tx_app.args) + self.siggen = analog.sig_source_c(self.samp_rate, + analog.GR_COS_WAVE, + self.tx_app.args.tx_offset, 1.0) + for chan in range(len(self.tx_app.channels)): + self.connect((self.siggen, 0), (self.tx_app.usrp, chan)) + + + def get_samp_rate(self): + return self.samp_rate + + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + + def retune_frequency(self, band_num=1, bands=1): + ref_chan = self.uhd_app.channels[0] + freq_range = literal_eval( + self.uhd_app.usrp.get_freq_range(ref_chan).__str__( + )) # returns tuple with (start_freq, end_freq, step) + + if bands > 1: + bw = (freq_range[1] - freq_range[0])/bands + freq_range = list(freq_range) + freq_range[0] = freq_range[0] + ((band_num-1) % bands)*bw + freq_range[1] = freq_range[0] + bw + + retune_freq = uniform(freq_range[0], freq_range[1]) + self.log.info('tune all channels to: {:f} MHz'.format(retune_freq / + 1e6)) + self.uhd_app.set_freq(retune_freq) + self.log.info('tune all channels to: {:f} MHz'.format( + self.uhd_app.args.freq / 1e6)) + self.uhd_app.set_freq(self.uhd_app.args.freq) diff --git a/tools/gr-usrptest/python/flowgraphs/selftest_fg.py b/tools/gr-usrptest/python/flowgraphs/selftest_fg.py new file mode 100644 index 000000000..cdfc35e74 --- /dev/null +++ b/tools/gr-usrptest/python/flowgraphs/selftest_fg.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python + +from gnuradio import blocks +from gnuradio import gr +from gnuradio import uhd +from usrptest import phase_calc_ccf +from gnuradio.uhd.uhd_app import UHDApp +import numpy as np + +class selftest_fg(gr.top_block): + + def __init__(self, freq, samp_rate, dphase, devices=list()): + gr.top_block.__init__(self, "Generate Signal extract phase") + + ################################################## + # Variables + ################################################## + self.samp_rate = samp_rate + self.freq = 10e3 + self.devices = devices + self.dphase = dphase + self.tx_gain = 50 + self.rx_gain = 50 + self.center_freq = freq + self.omega = 2*np.pi*self.freq + self.steps = np.arange( + self.samp_rate)*float(self.omega)/float(self.samp_rate) + self.reference = self.complex_sine(self.steps) + self.test_signal = self.complex_sine(self.steps+0.5*np.pi) + self.device_test = False + + ################################################## + # Block dicts + ################################################## + self.rx_devices = dict() + self.tx_devices = dict() + self.sink_dict = dict() + self.phase_dict = dict() + self.reference_source = blocks.vector_source_c(self.reference) + + if len(self.devices): + ################################################## + # Devices + ################################################## + self.device_test = True + #To reuse existing setup_usrp() command + for device in self.devices: + # Create and configure all devices + self.rx_devices[device] = uhd.usrp_source( + device, uhd.stream_args( + cpu_format="fc32", channel=range(1))) + self.tx_devices[device] = uhd.usrp_sink( + device, uhd.stream_args( + cpu_format="fc32", channel=range(1))) + self.rx_devices[device].set_samp_rate(self.samp_rate) + self.rx_devices[device].set_center_freq(self.center_freq, 0) + self.rx_devices[device].set_gain(self.rx_gain, 0) + self.tx_devices[device].set_samp_rate(self.samp_rate) + self.tx_devices[device].set_center_freq(self.center_freq, 0) + self.tx_devices[device].set_gain(self.tx_gain, 0) + self.sink_dict[device] = blocks.vector_sink_f() + self.phase_dict[device] = phase_calc_ccf( + self.samp_rate, self.freq) + for device in self.tx_devices.values(): + self.connect((self.reference_source, 0), (device, 0)) + + for device_key in self.rx_devices.keys(): + self.connect( + (self.rx_devices[device_key], 0), (self.phase_dict[device_key], 0)) + self.connect((self.reference_source, 0), + (self.phase_dict[device_key], 1)) + self.connect( + (self.phase_dict[device_key], 0), (self.sink_dict[device_key], 0)) + # Debug options + # self.sink_list.append(blocks.vector_sink_c()) + #self.connect((device, 0), (self.sink_list[-1], 0)) + # self.sink_list.append(blocks.vector_sink_c()) + #self.connect((self.reference_source, 0), (self.sink_list[-1], 0)) + else: + ################################################## + # Blocks + ################################################## + self.result = blocks.vector_sink_f(1) + self.test_source = blocks.vector_source_c(self.test_signal) + self.block_phase_calc = phase_calc_ccf( + self.samp_rate, self.freq) + + ################################################## + # Connections + ################################################## + self.connect((self.reference_source, 0), (self.block_phase_calc, 1)) + self.connect((self.test_source, 0), (self.block_phase_calc, 0)) + self.connect((self.block_phase_calc, 0), (self.result, 0)) + def complex_sine(self, steps): + return np.exp(1j*steps) + + def get_samp_rate(self): + return self.samp_rate + + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + + def run(self): + self.start() + self.wait() + if self.device_test: + data = dict() + for device_key in self.sink_dict.keys(): + curr_data = self.sink_dict[device_key].data() + curr_data = curr_data[int(0.2*self.samp_rate):-int(0.2*self.samp_rate)] + phase_avg = np.average(curr_data) + if (np.max(curr_data) < phase_avg+self.dphase*0.5) and (np.min(curr_data) > phase_avg-self.dphase*0.5): + data[device_key] = phase_avg + else: + print("Error phase not settled") + + #Debug + # plt.ylim(-1, 1) + # plt.xlim(self.samp_rate/2.), (self.samp_rate/2.)+1000) + #for key in data: + # plt.plot(data[key]) + return data diff --git a/tools/gr-usrptest/python/functions.py b/tools/gr-usrptest/python/functions.py new file mode 100644 index 000000000..e3f7958b1 --- /dev/null +++ b/tools/gr-usrptest/python/functions.py @@ -0,0 +1,133 @@ +#!/usr/bin/env python2 +import numpy as np +import time +import copy +import logging + + +def setup_phase_alignment_parser(parser): + test_group = parser.add_argument_group( + 'Phase alignment specific arguments') + test_group.add_argument( + '--runs', + default=10, + type=int, + help='Number of times to retune and measure d_phi') + test_group.add_argument( + '--duration', + default=5.0, + type=float, + help='Duration of a measurement run') + test_group.add_argument( + '--measurement-setup', + type=str, + help='Comma-seperated list of channel ids. Phase difference will be calculated between consecutive channels. default=(0,1,2,..,M-1) M: num_chan' + ) + test_group.add_argument( + '--log-level', + type=str, + choices=["critical", "error", "warning", "info", "debug"], + default="info") + test_group.add_argument( + '--freq-bands', + type=int, + help="Number of frequency bands in daughterboard range to randomly retune to", + default=1) + return parser + + +def setup_tx_phase_alignment_parser(parser): + tx_group = parser.add_argument_group( + 'TX Phase alignment specific arguments.') + tx_group.add_argument( + '--tx-channels', type=str, help='which channels to use') + tx_group.add_argument( + '--tx-antenna', + type=str, + help='comma-separated list of channel antennas for tx') + tx_group.add_argument( + '--tx-offset', + type=float, + help='frequency offset in Hz which should be added to center frequency for transmission' + ) + return parser + + +def setup_rts_phase_alignment_parser(parser): + rts_group = parser.add_argument_group('RTS Phase alignment specific arguments') + rts_group.add_argument( + '-pd', '--phasedev', + type=float, + default=1.0, + help='maximum phase standard deviation of dphi in a run which is considered settled (in deg)') + rts_group.add_argument( + '-dp', + '--dphi', + type=float, + default=2.0, + help='maximum allowed d_phase deviation between runs (in deg)') + return parser + +def setup_manual_phase_alignment_parser(parser): + manual_group = parser.add_argument_group( + 'Manual Phase alignment specific arguments') + manual_group.add_argument( + '--plot', + dest='plot', + action='store_true', + help='Set this argument to enable plotting results with matplotlib' + ) + manual_group.add_argument( + '--auto', + action='store_true', + help='Set this argument to enable automatic selection of test frequencies' + ) + manual_group.add_argument( + '--start-freq', + type=float, + default=0.0, + help='Start frequency for automatic selection' + ), + manual_group.add_argument( + '--stop-freq', + type=float, + default=0.0, + help='Stop frequency for automatic selection') + + parser.set_defaults(plot=False,auto=False) + return parser + + +def process_measurement_sinks(top_block): + data = list() + curr_data = dict() + for num, chan in enumerate(top_block.measurement_channels[:-1]): + curr_data['avg'] = list(top_block.measurement_sink[num].get_avg()) + curr_data['stddev'] = list(top_block.measurement_sink[num].get_stddev( + )) + curr_data['first'] = top_block.measurement_channels_names[num] + curr_data['second'] = top_block.measurement_channels_names[num + 1] + data.append(copy.copy(curr_data)) + return data + + +def run_test(top_block, ntimes): + results = dict() + num_sinks = len(top_block.measurement_sink) + for i in xrange(ntimes): + #tune frequency to random position and back to specified frequency + top_block.retune_frequency(bands=top_block.uhd_app.args.freq_bands,band_num=i+1) + time.sleep(2) + #trigger start in all measurement_sinks + for sink in top_block.measurement_sink: + sink.start_run() + #wait until every measurement_sink is ready with the current run + while (sum([ms.get_run() for ms in top_block.measurement_sink]) < ( + (i + 1) * num_sinks)): + time.sleep(1) + results = process_measurement_sinks(top_block) + return results + + +def log_level(string): + return getattr(logging, string.upper()) diff --git a/tools/gr-usrptest/python/phase_calc_ccf.py b/tools/gr-usrptest/python/phase_calc_ccf.py new file mode 100644 index 000000000..fe3cf55a8 --- /dev/null +++ b/tools/gr-usrptest/python/phase_calc_ccf.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright 2016 Ettus Research LLC. +# +# 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 +from gnuradio import blocks +import numpy as np + + +class phase_calc_ccf(gr.hier_block2): + """ + docstring for block phase_calc_ccf + """ + + def __init__(self): + gr.hier_block2.__init__( + self, + "phase_calc_ccf", + gr.io_signature(2, 2, gr.sizeof_gr_complex), # Input signature + gr.io_signature(1, 1, gr.sizeof_float)) # Output signature + self.block = dict() + self.block['mult_conj'] = blocks.multiply_conjugate_cc() + self.block['arg'] = blocks.complex_to_arg() + self.block['mult_const'] = blocks.multiply_const_ff(180.0 / np.pi) + + self.connect((self, 0), (self.block['mult_conj'], 0)) + self.connect((self, 1), (self.block['mult_conj'], 1)) + self.connect((self.block['mult_conj'], 0), (self.block['arg'], 0)) + self.connect((self.block['arg'], 0), (self.block['mult_const'], 0)) + self.connect((self.block['mult_const'], 0), (self, 0)) diff --git a/tools/gr-usrptest/python/qa_measurement_sink_f.py b/tools/gr-usrptest/python/qa_measurement_sink_f.py new file mode 100755 index 000000000..ceb9913ae --- /dev/null +++ b/tools/gr-usrptest/python/qa_measurement_sink_f.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright 2016 Ettus Research LLC. +# +# 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 +import usrptest_swig as usrptest + +class qa_measurement_sink_f (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_measurement_sink_f, "qa_measurement_sink_f.xml") diff --git a/tools/gr-usrptest/python/rts_tests/CMakeLists.txt b/tools/gr-usrptest/python/rts_tests/CMakeLists.txt new file mode 100644 index 000000000..fbe49995a --- /dev/null +++ b/tools/gr-usrptest/python/rts_tests/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio 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. +# +# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +######################################################################## +# Install python sources +######################################################################## +GR_PYTHON_INSTALL( + FILES + __init__.py + test_phasealignment.py DESTINATION ${GR_PYTHON_DIR}/usrptest/rts_tests +) diff --git a/tools/gr-usrptest/python/rts_tests/__init__.py b/tools/gr-usrptest/python/rts_tests/__init__.py new file mode 100644 index 000000000..048e5638a --- /dev/null +++ b/tools/gr-usrptest/python/rts_tests/__init__.py @@ -0,0 +1,14 @@ +""" +usrptest.flowgraphs +====================================== + +Contents +-------- + +Subpackages +----------- +:: + +The existance of the file turns the folder into a Python module. + +""" diff --git a/tools/gr-usrptest/python/rts_tests/test_phasealignment.py b/tools/gr-usrptest/python/rts_tests/test_phasealignment.py new file mode 100644 index 000000000..10642f298 --- /dev/null +++ b/tools/gr-usrptest/python/rts_tests/test_phasealignment.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright 2016 Ettus Research LLC. +# +# 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 unittest +from tinydb import TinyDB, Query +from usrptest.flowgraphs import phasealignment_fg +from usrptest.functions import setup_phase_alignment_parser, run_test +from gnuradio.uhd.uhd_app import UHDApp +import numpy as np +import argparse +import time + +class gr_usrp_test(unittest.TestCase): + def __init__(self, methodName='runTest', args=None): + super(gr_usrp_test,self).__init__(methodName) + self.args = args + +class qa_phasealignment(gr_usrp_test): + def setUp(self): + self.uhd_app = UHDApp(args=self.args) + self.tb = phasealignment_fg.phasealignment_fg(self.uhd_app) + self.db = TinyDB('phase_db.json') + + def tearDown(self): + self.uhd_app = None + self.tb = None + + def test_001(self): + self.tb.start() + time.sleep(2) + results = run_test(self.tb,self.args.runs) # dict key:dev, value: dict{dphase:[],stddev:[]} + time.sleep(1) + self.first_device = self.tb.measurement_channels_names[:-1] + self.second_device = self.tb.measurement_channels_names[1:] + #self.tb.stop() + #self.tb.wait() + self.time_stamp = time.strftime('%Y%m%d%H%M') + self.passed = True + for fdev, sdev in zip(self.first_device,self.second_device): + print('Comparing values for phase difference between {} and {}'.format(fdev, sdev)) + dphase_list = results[fdev]['avg'] + dev_list = results[fdev]['stddev'] + dphase = np.average(dphase_list) + dev = np.average(dev_list) + ref_meas = get_reference_meas(self.db, fdev, sdev, self.args.freq) + for dphase_i in dphase_list: + passed = True + if abs(dphase_i - dphase) > self.args.dphi and passed: + print('\t dPhase of a measurement_run differs from average dhpase. dphase_run: {}, dphase_avg: {}'.format(dphase_i, dphase)) + passed = False + if dev > self.args.phasedev: + print('\t dPhase deviates during measurement. stddev: {}'.format(dev)) + passed = False + if ref_meas: + if abs(ref_meas['dphase'] - dphase) > self.args.dphi: + print('\t dPhase differs from reference measurement. Now: {}, reference: {}'.format(dphase, ref_meas['dphase'])) + if not passed: + self.passed = False + else: + self.db.insert({'dev1':fdev, 'dev2':sdev, 'timestamp':self.time_stamp, 'dphase':dphase, 'dphase_dev': dev, 'freq': self.args.freq}) + self.tb.stop() + self.assertTrue(self.passed) + +def get_previous_meas(db, dev1, dev2, freq): + meas = Query() + results = db.search((meas.dev1 == dev1) & (meas.dev2 == dev2) & (meas.freq == freq)) + prev_result = dict() + if results: + prev_result = results[0] + for result in results: + if result['timestamp'] > prev_result['timestamp']: + prev_result = result + return prev_result + +def get_reference_meas(db, dev1, dev2, freq): + meas = Query() + results = db.search((meas.dev1 == dev1) & (meas.dev2 == dev2) & (meas.freq == freq)) + ref_result = dict() + if results: + ref_result = results[0] + for result in results: + if result['timestamp'] < ref_result['timestamp']: + ref_result = result + return ref_result + + + +if __name__ == '__main__': + parser = argparse.ArgumentParser(conflict_handler='resolve') + parser = setup_phase_alignment_parser(parser) + UHDApp.setup_argparser(parser=parser) + args = parser.parse_args() + def make_suite(testcase_class): + testloader = unittest.TestLoader() + testnames = testloader.getTestCaseNames(testcase_class) + suite = unittest.TestSuite() + for name in testnames: + suite.addTest(testcase_class(name, args=args)) + return suite + + # Add tests. + alltests = unittest.TestSuite() + alltests.addTest(make_suite(qa_phasealignment)) + result = unittest.TextTestRunner(verbosity=2).run(alltests) # Run tests. diff --git a/tools/gr-usrptest/swig/usrptest_swig.i b/tools/gr-usrptest/swig/usrptest_swig.i index c6988262e..273b7c866 100644 --- a/tools/gr-usrptest/swig/usrptest_swig.i +++ b/tools/gr-usrptest/swig/usrptest_swig.i @@ -8,6 +8,9 @@ %include "usrptest_swig_doc.i" %{ +#include "usrptest/measurement_sink_f.h" %} +%include "usrptest/measurement_sink_f.h" +GR_SWIG_BLOCK_MAGIC2(usrptest, measurement_sink_f); -- cgit v1.2.3