diff options
Diffstat (limited to 'simulation/QAM_Fading/qam_fading.py')
-rwxr-xr-x | simulation/QAM_Fading/qam_fading.py | 81 |
1 files changed, 40 insertions, 41 deletions
diff --git a/simulation/QAM_Fading/qam_fading.py b/simulation/QAM_Fading/qam_fading.py index 7a7ab84..c24bd4d 100755 --- a/simulation/QAM_Fading/qam_fading.py +++ b/simulation/QAM_Fading/qam_fading.py @@ -29,6 +29,7 @@ from gnuradio import blocks import numpy from gnuradio import channels from gnuradio import digital +from gnuradio import filter from gnuradio import gr import sys import signal @@ -113,13 +114,6 @@ class qam_fading(gr.top_block, Qt.QWidget): self.params_grid_layout_0.setRowStretch(r, 1) for c in range(1, 2): self.params_grid_layout_0.setColumnStretch(c, 1) - self._time_offset_range = Range(0.999, 1.001, 0.0001, 1.0, 200) - self._time_offset_win = RangeWidget(self._time_offset_range, self.set_time_offset, 'Timing Offset', "counter_slider", float) - self.params_grid_layout_0.addWidget(self._time_offset_win, 0, 1, 1, 1) - for r in range(0, 1): - self.params_grid_layout_0.setRowStretch(r, 1) - for c in range(1, 2): - self.params_grid_layout_0.setColumnStretch(c, 1) self.plots = Qt.QTabWidget() self.plots_widget_0 = Qt.QWidget() self.plots_layout_0 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.plots_widget_0) @@ -144,20 +138,6 @@ class qam_fading(gr.top_block, Qt.QWidget): self.params_grid_layout_1.setRowStretch(r, 1) for c in range(0, 1): self.params_grid_layout_1.setColumnStretch(c, 1) - self._noise_volt_range = Range(0, 1, 0.01, 0.0001, 200) - self._noise_volt_win = RangeWidget(self._noise_volt_range, self.set_noise_volt, 'Noise Voltage', "counter_slider", float) - self.params_grid_layout_0.addWidget(self._noise_volt_win, 0, 0, 1, 1) - for r in range(0, 1): - self.params_grid_layout_0.setRowStretch(r, 1) - for c in range(0, 1): - self.params_grid_layout_0.setColumnStretch(c, 1) - self._freq_offset_range = Range(-100e-3, 100e-3, 1e-3, 0, 200) - self._freq_offset_win = RangeWidget(self._freq_offset_range, self.set_freq_offset, 'Frequency Offset', "counter_slider", float) - self.params_grid_layout_0.addWidget(self._freq_offset_win, 1, 0, 1, 1) - for r in range(1, 2): - self.params_grid_layout_0.setRowStretch(r, 1) - for c in range(0, 1): - self.params_grid_layout_0.setColumnStretch(c, 1) self._eq_gain_range = Range(0, .1, .001, .01, 200) self._eq_gain_win = RangeWidget(self._eq_gain_range, self.set_eq_gain, 'Equalizer Rate', "counter_slider", float) self.params_grid_layout_1.addWidget(self._eq_gain_win, 0, 0, 1, 1) @@ -165,6 +145,13 @@ class qam_fading(gr.top_block, Qt.QWidget): self.params_grid_layout_1.setRowStretch(r, 1) for c in range(0, 1): self.params_grid_layout_1.setColumnStretch(c, 1) + self._time_offset_range = Range(0.999, 1.001, 0.0001, 1.0, 200) + self._time_offset_win = RangeWidget(self._time_offset_range, self.set_time_offset, 'Timing Offset', "counter_slider", float) + self.params_grid_layout_0.addWidget(self._time_offset_win, 0, 1, 1, 1) + for r in range(0, 1): + self.params_grid_layout_0.setRowStretch(r, 1) + for c in range(1, 2): + self.params_grid_layout_0.setColumnStretch(c, 1) self.qtgui_time_sink_x_0 = qtgui.time_sink_f( 1024, #size samp_rate, #samp_rate @@ -477,8 +464,23 @@ class qam_fading(gr.top_block, Qt.QWidget): self.plots_grid_layout_0.setRowStretch(r, 1) for c in range(0, 1): self.plots_grid_layout_0.setColumnStretch(c, 1) - self.digital_pfb_clock_sync_xxx_0_0 = digital.pfb_clock_sync_ccf(sps * 1.001, timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, 2) - self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps * 1.001, timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, 2) + self._noise_volt_range = Range(0, 1, 0.01, 0.0001, 200) + self._noise_volt_win = RangeWidget(self._noise_volt_range, self.set_noise_volt, 'Noise Voltage', "counter_slider", float) + self.params_grid_layout_0.addWidget(self._noise_volt_win, 0, 0, 1, 1) + for r in range(0, 1): + self.params_grid_layout_0.setRowStretch(r, 1) + for c in range(0, 1): + self.params_grid_layout_0.setColumnStretch(c, 1) + self.freq_xlating_fir_filter_xxx_0 = filter.freq_xlating_fir_filter_ccc(1, [1]+[0 for n in range(0, 2*sps-1)]+[0.2], 0, samp_rate) + self._freq_offset_range = Range(-100e-3, 100e-3, 1e-3, 0, 200) + self._freq_offset_win = RangeWidget(self._freq_offset_range, self.set_freq_offset, 'Frequency Offset', "counter_slider", float) + self.params_grid_layout_0.addWidget(self._freq_offset_win, 1, 0, 1, 1) + for r in range(1, 2): + self.params_grid_layout_0.setRowStretch(r, 1) + for c in range(0, 1): + self.params_grid_layout_0.setColumnStretch(c, 1) + self.digital_pfb_clock_sync_xxx_0_0 = digital.pfb_clock_sync_ccf(sps , timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, 1) + self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, 1) self.digital_map_bb_0_0 = digital.map_bb([0, 1, 3, 2]) self.digital_map_bb_0 = digital.map_bb([0, 1, 3, 2]) self.digital_diff_decoder_bb_0_0 = digital.diff_decoder_bb(4) @@ -497,14 +499,6 @@ class qam_fading(gr.top_block, Qt.QWidget): self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(const) self.digital_cma_equalizer_cc_0_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, 2) self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, 2) - self.channels_fading_model_0 = channels.fading_model( 8, 10.0/samp_rate, False, 4.0, 0 ) - self.channels_channel_model_0 = channels.channel_model( - noise_voltage=noise_volt, - frequency_offset=freq_offset, - epsilon=time_offset, - taps=chn_taps, - noise_seed=0, - block_tags=False) self.blocks_unpack_k_bits_bb_0_1 = blocks.unpack_k_bits_bb(2) self.blocks_unpack_k_bits_bb_0_0 = blocks.unpack_k_bits_bb(2) self.blocks_unpack_k_bits_bb_0 = blocks.unpack_k_bits_bb(2) @@ -528,17 +522,13 @@ class qam_fading(gr.top_block, Qt.QWidget): self.connect((self.blocks_char_to_float_0_1, 0), (self.qtgui_freq_sink_x_2_1, 1)) self.connect((self.blocks_char_to_float_0_1, 0), (self.qtgui_time_sink_x_0, 2)) self.connect((self.blocks_delay_0, 0), (self.qtgui_time_sink_x_0, 1)) - self.connect((self.blocks_throttle_0, 0), (self.channels_channel_model_0, 0)) + self.connect((self.blocks_throttle_0, 0), (self.digital_pfb_clock_sync_xxx_0_0, 0)) + self.connect((self.blocks_throttle_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) + self.connect((self.blocks_throttle_0, 0), (self.qtgui_const_sink_x_0, 1)) + self.connect((self.blocks_throttle_0, 0), (self.qtgui_freq_sink_x_0, 1)) self.connect((self.blocks_unpack_k_bits_bb_0, 0), (self.blocks_char_to_float_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0_0, 0), (self.blocks_char_to_float_0_0, 0)) self.connect((self.blocks_unpack_k_bits_bb_0_1, 0), (self.blocks_char_to_float_0_1, 0)) - self.connect((self.channels_channel_model_0, 0), (self.channels_fading_model_0, 0)) - self.connect((self.channels_channel_model_0, 0), (self.digital_pfb_clock_sync_xxx_0_0, 0)) - self.connect((self.channels_channel_model_0, 0), (self.qtgui_const_sink_x_0, 1)) - self.connect((self.channels_channel_model_0, 0), (self.qtgui_freq_sink_x_0, 1)) - self.connect((self.channels_fading_model_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) - self.connect((self.channels_fading_model_0, 0), (self.qtgui_const_sink_x_0, 0)) - self.connect((self.channels_fading_model_0, 0), (self.qtgui_freq_sink_x_0, 0)) self.connect((self.digital_cma_equalizer_cc_0, 0), (self.digital_costas_loop_cc_0, 0)) self.connect((self.digital_cma_equalizer_cc_0, 0), (self.qtgui_const_sink_x_1, 0)) self.connect((self.digital_cma_equalizer_cc_0_0, 0), (self.digital_costas_loop_cc_0_0, 0)) @@ -558,6 +548,9 @@ class qam_fading(gr.top_block, Qt.QWidget): self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.qtgui_const_sink_x_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0), (self.digital_cma_equalizer_cc_0_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0_0, 0), (self.qtgui_const_sink_x_0_0, 1)) + self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.digital_pfb_clock_sync_xxx_0, 0)) + self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_const_sink_x_0, 0)) + self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.qtgui_freq_sink_x_0, 0)) def closeEvent(self, event): @@ -571,6 +564,7 @@ class qam_fading(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.freq_xlating_fir_filter_xxx_0.set_taps([1]+[0 for n in range(0, 2*self.sps-1)]+[0.2]) def get_nfilts(self): return self.nfilts @@ -607,7 +601,6 @@ class qam_fading(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.channels_fading_model_0.set_fDTs(10.0/self.samp_rate) self.qtgui_freq_sink_x_0.set_frequency_range(0, self.samp_rate) self.qtgui_freq_sink_x_2_1.set_frequency_range(0, self.samp_rate) self.qtgui_time_sink_x_0.set_samp_rate(self.samp_rate) @@ -677,6 +670,12 @@ class qam_fading(gr.top_block, Qt.QWidget): self.chn_taps = chn_taps self.channels_channel_model_0.set_taps(self.chn_taps) +def snipfcn_snippet_0(self): + import numpy as np + + +def snippets_main_after_init(tb): + snipfcn_snippet_0(tb) @@ -691,7 +690,7 @@ def main(top_block_cls=qam_fading, options=None): qapp = Qt.QApplication(sys.argv) tb = top_block_cls() - + snippets_main_after_init(tb) tb.start() tb.show() |