From 749ac8bc7cadf575c0b23afcc299a86bc9731186 Mon Sep 17 00:00:00 2001 From: anastas Date: Tue, 18 Nov 2008 06:03:54 +0000 Subject: [PATCH] added an example in grc that uses trellis structures git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10010 221aa14e-8319-0410-a670-987f0aec2ac5 --- grc/examples/trellis/Makefile.am | 30 + .../trellis/interference_cancellation.grc | 2012 +++++++++++++++++ grc/examples/trellis/readme.txt | 16 + 3 files changed, 2058 insertions(+) create mode 100644 grc/examples/trellis/Makefile.am create mode 100644 grc/examples/trellis/interference_cancellation.grc create mode 100644 grc/examples/trellis/readme.txt diff --git a/grc/examples/trellis/Makefile.am b/grc/examples/trellis/Makefile.am new file mode 100644 index 00000000..1fb6b774 --- /dev/null +++ b/grc/examples/trellis/Makefile.am @@ -0,0 +1,30 @@ +# +# Copyright 2008 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. +# + +include $(top_srcdir)/grc/Makefile.inc + +ourdatadir = $(grc_examples_prefix)/trellis + +DATA_FILES = interference_cancellation.grc + +ourdata_DATA = $(DATA_FILES) + +EXTRA_DIST = $(DATA_FILES) diff --git a/grc/examples/trellis/interference_cancellation.grc b/grc/examples/trellis/interference_cancellation.grc new file mode 100644 index 00000000..4065845f --- /dev/null +++ b/grc/examples/trellis/interference_cancellation.grc @@ -0,0 +1,2012 @@ + + + Tue Nov 18 00:48:20 2008 + + options + + id + int_cancellation + + + _enabled + True + + + title + Superposition Coding + + + author + AA + + + description + gnuradio flow graph + + + window_size + 2048, 2048 + + + generate_options + wx_gui + + + category + Custom + + + _coordinate + (10, 10) + + + _rotation + 0 + + + + variable_slider + + id + alpha + + + _enabled + True + + + label + P1/P + + + value + 0.6 + + + min + 0 + + + max + 1.0 + + + num_steps + 100 + + + slider_length + 200 + + + slider_type + horizontal + + + grid_pos + + + + _coordinate + (243, 11) + + + _rotation + 0 + + + + variable_slider + + id + snr_db + + + _enabled + True + + + label + P/sigma^2 (dB) + + + value + 16 + + + min + 0 + + + max + 20 + + + num_steps + 100 + + + slider_length + 200 + + + slider_type + horizontal + + + grid_pos + + + + _coordinate + (447, 14) + + + _rotation + 0 + + + + variable + + id + noisevar + + + _enabled + True + + + value + 10**(-snr_db/10) + + + _coordinate + (637, 13) + + + _rotation + 0 + + + + random_source_x + + id + random_source_x_0 + + + _enabled + True + + + type + short + + + min + 0 + + + max + 2 + + + num_samps + 1000 + + + repeat + True + + + _coordinate + (21, 170) + + + _rotation + 0 + + + + gr_chunks_to_symbols_xx + + id + gr_chunks_to_symbols_xx_0 + + + _enabled + True + + + in_type + short + + + out_type + complex + + + symbol_table + 1,1j,-1j,-1 + + + dimension + 1 + + + _coordinate + (665, 187) + + + _rotation + 0 + + + + gr_multiply_const_vxx + + id + gr_multiply_const_vxx_0 + + + _enabled + True + + + type + complex + + + const + alpha**0.5 + + + vlen + 1 + + + _coordinate + (988, 196) + + + _rotation + 0 + + + + random_source_x + + id + random_source_x_1 + + + _enabled + True + + + type + short + + + min + 0 + + + max + 2 + + + num_samps + 1000 + + + repeat + True + + + _coordinate + (25, 291) + + + _rotation + 0 + + + + gr_chunks_to_symbols_xx + + id + gr_chunks_to_symbols_xx_1 + + + _enabled + True + + + in_type + short + + + out_type + complex + + + symbol_table + 1,1j,-1j,-1 + + + dimension + 1 + + + _coordinate + (660, 311) + + + _rotation + 0 + + + + gr_multiply_const_vxx + + id + gr_multiply_const_vxx_1 + + + _enabled + True + + + type + complex + + + const + (1-alpha)**0.5 + + + vlen + 1 + + + _coordinate + (994, 319) + + + _rotation + 0 + + + + gr_add_vxx + + id + gr_add_vxx_0 + + + _enabled + True + + + type + complex + + + num_inputs + 2 + + + vlen + 1 + + + _coordinate + (1224, 244) + + + _rotation + 0 + + + + gr_add_vxx + + id + gr_add_vxx_1 + + + _enabled + True + + + type + complex + + + num_inputs + 2 + + + vlen + 1 + + + _coordinate + (1400, 262) + + + _rotation + 0 + + + + gr_noise_source_x + + id + gr_noise_source_x_0 + + + _enabled + True + + + type + complex + + + noise_type + gr.GR_GAUSSIAN + + + amp + noisevar + + + seed + 42 + + + _coordinate + (1146, 369) + + + _rotation + 0 + + + + wxgui_constellationsink2 + + id + wxgui_constellationsink2_0 + + + _enabled + True + + + title + Constellation Plot + + + samp_rate + R + + + frame_decim + 15 + + + marker + set_format_plus + + + grid_pos + + + + _coordinate + (1301, 74) + + + _rotation + 0 + + + + gr_sub_xx + + id + gr_sub_xx_0 + + + _enabled + True + + + type + short + + + num_inputs + 2 + + + _coordinate + (536, 529) + + + _rotation + 0 + + + + gr_multiply_vxx + + id + gr_multiply_vxx_0 + + + _enabled + True + + + type + short + + + num_inputs + 2 + + + vlen + 1 + + + _coordinate + (771, 525) + + + _rotation + 0 + + + + gr_short_to_float + + id + gr_short_to_float_0 + + + _enabled + True + + + _coordinate + (994, 545) + + + _rotation + 0 + + + + gr_sub_xx + + id + gr_sub_xx_3 + + + _enabled + True + + + type + short + + + num_inputs + 2 + + + _coordinate + (535, 792) + + + _rotation + 0 + + + + gr_multiply_vxx + + id + gr_multiply_vxx_1 + + + _enabled + True + + + type + short + + + num_inputs + 2 + + + vlen + 1 + + + _coordinate + (785, 779) + + + _rotation + 0 + + + + gr_short_to_float + + id + gr_short_to_float_2 + + + _enabled + True + + + _coordinate + (1005, 798) + + + _rotation + 0 + + + + gr_chunks_to_symbols_xx + + id + gr_chunks_to_symbols_xx_2 + + + _enabled + True + + + in_type + short + + + out_type + complex + + + symbol_table + 1,1j,-1j,-1 + + + dimension + 1 + + + _coordinate + (405, 998) + + + _rotation + 0 + + + + gr_multiply_const_vxx + + id + gr_multiply_const_vxx_2 + + + _enabled + True + + + type + complex + + + const + alpha**0.5 + + + vlen + 1 + + + _coordinate + (710, 1008) + + + _rotation + 0 + + + + gr_sub_xx + + id + gr_sub_xx_2 + + + _enabled + True + + + type + complex + + + num_inputs + 2 + + + _coordinate + (944, 978) + + + _rotation + 0 + + + + gr_sub_xx + + id + gr_sub_xx_1 + + + _enabled + True + + + type + short + + + num_inputs + 2 + + + _coordinate + (540, 1141) + + + _rotation + 0 + + + + gr_multiply_vxx + + id + gr_multiply_vxx_2 + + + _enabled + True + + + type + short + + + num_inputs + 2 + + + vlen + 1 + + + _coordinate + (796, 1136) + + + _rotation + 0 + + + + gr_short_to_float + + id + gr_short_to_float_1 + + + _enabled + True + + + _coordinate + (1009, 1156) + + + _rotation + 0 + + + + gr_chunks_to_symbols_xx + + id + gr_chunks_to_symbols_xx_2_0 + + + _enabled + True + + + in_type + short + + + out_type + complex + + + symbol_table + 1,1j,-1j,-1 + + + dimension + 1 + + + _coordinate + (420, 1368) + + + _rotation + 0 + + + + gr_multiply_const_vxx + + id + gr_multiply_const_vxx_2_0 + + + _enabled + True + + + type + complex + + + const + (1-alpha)**0.5 + + + vlen + 1 + + + _coordinate + (733, 1374) + + + _rotation + 0 + + + + gr_sub_xx + + id + gr_sub_xx_2_0 + + + _enabled + True + + + type + complex + + + num_inputs + 2 + + + _coordinate + (975, 1342) + + + _rotation + 0 + + + + gr_sub_xx + + id + gr_sub_xx_1_0 + + + _enabled + True + + + type + short + + + num_inputs + 2 + + + _coordinate + (559, 1536) + + + _rotation + 0 + + + + gr_multiply_vxx + + id + gr_multiply_vxx_2_0 + + + _enabled + True + + + type + short + + + num_inputs + 2 + + + vlen + 1 + + + _coordinate + (771, 1530) + + + _rotation + 0 + + + + gr_short_to_float + + id + gr_short_to_float_1_0 + + + _enabled + True + + + _coordinate + (1010, 1551) + + + _rotation + 0 + + + + wxgui_numbersink2 + + id + wxgui_numbersink2_2 + + + _enabled + True + + + type + float + + + title + BER 2 (raw) + + + units + BER + + + samp_rate + R + + + base_value + 0.0 + + + min_value + 0 + + + max_value + 1.0 + + + factor + 1.0 + + + decimal_places + 6 + + + ref_level + 0 + + + number_rate + 15 + + + avg_alpha + 0.001 + + + options + average + + + show_gauge + True + + + grid_pos + 0,1,1,1 + + + _coordinate + (1260, 659) + + + _rotation + 0 + + + + wxgui_numbersink2 + + id + wxgui_numbersink2_3 + + + _enabled + True + + + type + float + + + title + BER 2 (after cancelling user 1) + + + units + BER + + + samp_rate + R + + + base_value + 0.0 + + + min_value + 0 + + + max_value + 1.0 + + + factor + 1.0 + + + decimal_places + 6 + + + ref_level + 0 + + + number_rate + 15 + + + avg_alpha + 0.001 + + + options + average + + + show_gauge + True + + + grid_pos + 1,1,1,1 + + + _coordinate + (1262, 1020) + + + _rotation + 0 + + + + wxgui_numbersink2 + + id + wxgui_numbersink2_3_0 + + + _enabled + True + + + type + float + + + title + BER 1 (after cancelling user 2) + + + units + BER + + + samp_rate + R + + + base_value + 0.0 + + + min_value + 0 + + + max_value + 1.0 + + + factor + 1.0 + + + decimal_places + 6 + + + ref_level + 0 + + + number_rate + 15 + + + avg_alpha + 0.001 + + + options + average + + + show_gauge + True + + + grid_pos + 1,0,1,1 + + + _coordinate + (1269, 1417) + + + _rotation + 0 + + + + wxgui_numbersink2 + + id + wxgui_numbersink2_0 + + + _enabled + True + + + type + float + + + title + BER 1 (raw) + + + units + BER + + + samp_rate + R + + + base_value + 0.0 + + + min_value + 0 + + + max_value + 1 + + + factor + 1.0 + + + decimal_places + 6 + + + ref_level + 0 + + + number_rate + 15 + + + avg_alpha + 0.001 + + + options + average + + + show_gauge + True + + + grid_pos + 0,0,1,1 + + + _coordinate + (1267, 410) + + + _rotation + 0 + + + + variable + + id + R + + + _enabled + True + + + value + 10e3 + + + _coordinate + (748, 12) + + + _rotation + 0 + + + + trellis_encoder_xx + + id + trellis_encoder_xx_0 + + + _enabled + True + + + type + ss + + + fsm_args + prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm" + + + init_state + 0 + + + _coordinate + (334, 190) + + + _rotation + 0 + + + + trellis_encoder_xx + + id + trellis_encoder_xx_1 + + + _enabled + True + + + type + ss + + + fsm_args + prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm" + + + init_state + 0 + + + _coordinate + (336, 311) + + + _rotation + 0 + + + + trellis_viterbi_combined_xx + + id + trellis_viterbi_combined_xx_1 + + + _enabled + True + + + type + c + + + out_type + s + + + fsm_args + prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm" + + + block_size + 1000 + + + init_state + -1 + + + final_state + -1 + + + dim + 1 + + + table + alpha**0.5*1,alpha**0.5*1j,alpha**0.5*(-1j),alpha**0.5*(-1) + + + metric_type + trellis.TRELLIS_EUCLIDEAN + + + _coordinate + (79, 501) + + + _rotation + 0 + + + + trellis_viterbi_combined_xx + + id + trellis_viterbi_combined_xx_2 + + + _enabled + True + + + type + c + + + out_type + s + + + fsm_args + prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm" + + + block_size + 1000 + + + init_state + -1 + + + final_state + -1 + + + dim + 1 + + + table + (1-alpha)**0.5*1,(1-alpha)**0.5*1j,(1-alpha)**0.5*(-1j),(1-alpha)**0.5*(-1) + + + metric_type + trellis.TRELLIS_EUCLIDEAN + + + _coordinate + (82, 766) + + + _rotation + 0 + + + + trellis_encoder_xx + + id + trellis_encoder_xx_2 + + + _enabled + True + + + type + ss + + + fsm_args + prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm" + + + init_state + 0 + + + _coordinate + (89, 998) + + + _rotation + 0 + + + + trellis_viterbi_combined_xx + + id + trellis_viterbi_combined_xx_0 + + + _enabled + True + + + type + c + + + out_type + s + + + fsm_args + prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm" + + + block_size + 1000 + + + init_state + -1 + + + final_state + -1 + + + dim + 1 + + + table + (1-alpha)**0.5*1,(1-alpha)**0.5*1j,(1-alpha)**0.5*(-1j),(1-alpha)**0.5*(-1) + + + metric_type + trellis.TRELLIS_EUCLIDEAN + + + _coordinate + (83, 1111) + + + _rotation + 0 + + + + trellis_encoder_xx + + id + trellis_encoder_xx_2_0 + + + _enabled + True + + + type + ss + + + fsm_args + prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm" + + + init_state + 0 + + + _coordinate + (105, 1367) + + + _rotation + 0 + + + + trellis_viterbi_combined_xx + + id + trellis_viterbi_combined_xx_0_0 + + + _enabled + True + + + type + c + + + out_type + s + + + fsm_args + prefix+"gr-trellis/src/examples/fsm_files/awgn1o2_16.fsm" + + + block_size + 1000 + + + init_state + -1 + + + final_state + -1 + + + dim + 1 + + + table + alpha**0.5*1,alpha**0.5*1j,alpha**0.5*(-1j),alpha**0.5*(-1) + + + metric_type + trellis.TRELLIS_EUCLIDEAN + + + _coordinate + (75, 1495) + + + _rotation + 0 + + + + variable + + id + prefix + + + _enabled + True + + + value + "../../../" + + + _coordinate + (871, 14) + + + _rotation + 0 + + + + random_source_x_1 + trellis_encoder_xx_1 + 0 + 0 + + + trellis_encoder_xx_0 + gr_chunks_to_symbols_xx_0 + 0 + 0 + + + trellis_encoder_xx_1 + gr_chunks_to_symbols_xx_1 + 0 + 0 + + + gr_chunks_to_symbols_xx_0 + gr_multiply_const_vxx_0 + 0 + 0 + + + gr_multiply_const_vxx_0 + gr_add_vxx_0 + 0 + 0 + + + gr_add_vxx_0 + gr_add_vxx_1 + 0 + 0 + + + gr_noise_source_x_0 + gr_add_vxx_1 + 0 + 1 + + + gr_add_vxx_1 + wxgui_constellationsink2_0 + 0 + 0 + + + gr_chunks_to_symbols_xx_1 + gr_multiply_const_vxx_1 + 0 + 0 + + + gr_multiply_const_vxx_1 + gr_add_vxx_0 + 0 + 1 + + + gr_sub_xx_0 + gr_multiply_vxx_0 + 0 + 0 + + + gr_sub_xx_0 + gr_multiply_vxx_0 + 0 + 1 + + + gr_multiply_vxx_0 + gr_short_to_float_0 + 0 + 0 + + + gr_short_to_float_0 + wxgui_numbersink2_0 + 0 + 0 + + + gr_multiply_vxx_2 + gr_short_to_float_1 + 0 + 0 + + + random_source_x_0 + trellis_encoder_xx_0 + 0 + 0 + + + gr_add_vxx_1 + trellis_viterbi_combined_xx_1 + 0 + 0 + + + random_source_x_0 + gr_sub_xx_0 + 0 + 0 + + + trellis_viterbi_combined_xx_1 + gr_sub_xx_0 + 0 + 1 + + + trellis_viterbi_combined_xx_0 + gr_sub_xx_1 + 0 + 1 + + + random_source_x_1 + gr_sub_xx_1 + 0 + 0 + + + gr_sub_xx_1 + gr_multiply_vxx_2 + 0 + 0 + + + gr_sub_xx_1 + gr_multiply_vxx_2 + 0 + 1 + + + gr_sub_xx_2 + trellis_viterbi_combined_xx_0 + 0 + 0 + + + gr_add_vxx_1 + gr_sub_xx_2 + 0 + 0 + + + trellis_encoder_xx_2 + gr_chunks_to_symbols_xx_2 + 0 + 0 + + + gr_chunks_to_symbols_xx_2 + gr_multiply_const_vxx_2 + 0 + 0 + + + gr_multiply_const_vxx_2 + gr_sub_xx_2 + 0 + 1 + + + trellis_viterbi_combined_xx_1 + trellis_encoder_xx_2 + 0 + 0 + + + gr_multiply_vxx_1 + gr_short_to_float_2 + 0 + 0 + + + gr_short_to_float_2 + wxgui_numbersink2_2 + 0 + 0 + + + trellis_viterbi_combined_xx_2 + gr_sub_xx_3 + 0 + 1 + + + gr_sub_xx_3 + gr_multiply_vxx_1 + 0 + 0 + + + gr_sub_xx_3 + gr_multiply_vxx_1 + 0 + 1 + + + gr_add_vxx_1 + trellis_viterbi_combined_xx_2 + 0 + 0 + + + random_source_x_1 + gr_sub_xx_3 + 0 + 0 + + + gr_short_to_float_1 + wxgui_numbersink2_3 + 0 + 0 + + + trellis_encoder_xx_2_0 + gr_chunks_to_symbols_xx_2_0 + 0 + 0 + + + gr_chunks_to_symbols_xx_2_0 + gr_multiply_const_vxx_2_0 + 0 + 0 + + + trellis_viterbi_combined_xx_2 + trellis_encoder_xx_2_0 + 0 + 0 + + + gr_multiply_vxx_2_0 + gr_short_to_float_1_0 + 0 + 0 + + + trellis_viterbi_combined_xx_0_0 + gr_sub_xx_1_0 + 0 + 1 + + + gr_sub_xx_1_0 + gr_multiply_vxx_2_0 + 0 + 0 + + + gr_sub_xx_1_0 + gr_multiply_vxx_2_0 + 0 + 1 + + + gr_sub_xx_2_0 + trellis_viterbi_combined_xx_0_0 + 0 + 0 + + + gr_short_to_float_1_0 + wxgui_numbersink2_3_0 + 0 + 0 + + + gr_add_vxx_1 + gr_sub_xx_2_0 + 0 + 0 + + + random_source_x_0 + gr_sub_xx_1_0 + 0 + 0 + + + gr_multiply_const_vxx_2_0 + gr_sub_xx_2_0 + 0 + 1 + + diff --git a/grc/examples/trellis/readme.txt b/grc/examples/trellis/readme.txt new file mode 100644 index 00000000..d620fd62 --- /dev/null +++ b/grc/examples/trellis/readme.txt @@ -0,0 +1,16 @@ +This is an example of using gr-trellis in grc. + +Two users are transmitting simultaneously using convolutionally encoded QPSK, each with power P1=alpha*P and P2=(1-alpha)*P. +The combined signal is observed in noise and four different receivers are considered: +1) A viterbi decoder decoding user 1 assuming user 2 is noise +2) A viterbi decoder decoding user 2 assuming user 1 is noise +3) A viterbi decoder decoding user 1 first + and then reencoding this signal, subtracting it from the observation + and then running a Viterbi decoder decoding user 2 +4) A viterbi decoder decoding user 2 first + and then reencoding this signal, subtracting it from the observation + and then running a Viterbi decoder decoding user 1 + +You can change the signal to noise ratio P/sigma^2 and the allocation of power to the two users, alpha. + +Enjoy. -- 2.47.2