aboutsummaryrefslogtreecommitdiffstats
path: root/simulation/QAM_Fading/qam_fading.py
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2021-11-18 19:07:24 +0100
committerNao Pross <np@0hm.ch>2021-11-18 19:07:24 +0100
commitaa82e80921551465c0a77a8a0316404eb2ffab88 (patch)
treefd61cfe95dd737c36db09b90e00bc1b459fe649a /simulation/QAM_Fading/qam_fading.py
parentPartially implement xor correlator (untested) (diff)
parentMerge remote-tracking branch 'origin/master' (diff)
downloadFading-aa82e80921551465c0a77a8a0316404eb2ffab88.tar.gz
Fading-aa82e80921551465c0a77a8a0316404eb2ffab88.zip
Merge branch 'master' of github.com:NaoPross/Fading
Diffstat (limited to 'simulation/QAM_Fading/qam_fading.py')
-rwxr-xr-xsimulation/QAM_Fading/qam_fading.py95
1 files changed, 75 insertions, 20 deletions
diff --git a/simulation/QAM_Fading/qam_fading.py b/simulation/QAM_Fading/qam_fading.py
index 01685a1..f8c72b1 100755
--- a/simulation/QAM_Fading/qam_fading.py
+++ b/simulation/QAM_Fading/qam_fading.py
@@ -87,13 +87,17 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.phase_bw = phase_bw = 2 * 3.141592653589793 / 100
self.noise_volt = noise_volt = 0.0001
self.freq_offset = freq_offset = 0
+ self.fading_3 = fading_3 = 0
+ self.fading_2 = fading_2 = 0
self.fading_1 = fading_1 = 2
self.eq_ntaps = eq_ntaps = 15
self.eq_mod = eq_mod = 1
self.eq_gain = eq_gain = .01
self.const = const = digital.constellation_16qam().base()
self.chn_taps = chn_taps = [1.0 + 0.0j, ]
- self.amp = amp = 0.2
+ self.amp_3 = amp_3 = 0
+ self.amp_2 = amp_2 = 0
+ self.amp_1 = amp_1 = 0.2
self.LOS_NLOS = LOS_NLOS = 1
##################################################
@@ -168,10 +172,17 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.params_grid_layout_0.setRowStretch(r, 1)
for c in range(0, 1):
self.params_grid_layout_0.setColumnStretch(c, 1)
+ self._fading_2_range = Range(0, 30, 1, 0, 200)
+ self._fading_2_win = RangeWidget(self._fading_2_range, self.set_fading_2, 'Fading 2', "counter_slider", int)
+ self.params_grid_layout_2.addWidget(self._fading_2_win, 2, 0, 1, 1)
+ for r in range(2, 3):
+ self.params_grid_layout_2.setRowStretch(r, 1)
+ for c in range(0, 1):
+ self.params_grid_layout_2.setColumnStretch(c, 1)
self._fading_1_range = Range(1, 30, 1, 2, 200)
self._fading_1_win = RangeWidget(self._fading_1_range, self.set_fading_1, 'Fading', "counter_slider", int)
- self.params_grid_layout_2.addWidget(self._fading_1_win, 0, 0, 1, 1)
- for r in range(0, 1):
+ self.params_grid_layout_2.addWidget(self._fading_1_win, 1, 0, 1, 1)
+ for r in range(1, 2):
self.params_grid_layout_2.setRowStretch(r, 1)
for c in range(0, 1):
self.params_grid_layout_2.setColumnStretch(c, 1)
@@ -182,19 +193,26 @@ 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._amp_range = Range(0, 5, 0.1, 0.2, 200)
- self._amp_win = RangeWidget(self._amp_range, self.set_amp, 'Ampliude', "counter_slider", float)
- self.params_grid_layout_2.addWidget(self._amp_win, 1, 0, 1, 1)
+ self._amp_2_range = Range(0, 5, 0.1, 0, 200)
+ self._amp_2_win = RangeWidget(self._amp_2_range, self.set_amp_2, 'Ampliude 2', "counter_slider", float)
+ self.params_grid_layout_2.addWidget(self._amp_2_win, 2, 1, 1, 1)
+ for r in range(2, 3):
+ self.params_grid_layout_2.setRowStretch(r, 1)
+ for c in range(1, 2):
+ self.params_grid_layout_2.setColumnStretch(c, 1)
+ self._amp_1_range = Range(0, 5, 0.1, 0.2, 200)
+ self._amp_1_win = RangeWidget(self._amp_1_range, self.set_amp_1, 'Ampliude', "counter_slider", float)
+ self.params_grid_layout_2.addWidget(self._amp_1_win, 1, 1, 1, 1)
for r in range(1, 2):
self.params_grid_layout_2.setRowStretch(r, 1)
- for c in range(0, 1):
+ for c in range(1, 2):
self.params_grid_layout_2.setColumnStretch(c, 1)
self._LOS_NLOS_range = Range(0, 1, 1, 1, 200)
self._LOS_NLOS_win = RangeWidget(self._LOS_NLOS_range, self.set_LOS_NLOS, 'LOS_NLOS', "counter_slider", int)
- self.params_grid_layout_2.addWidget(self._LOS_NLOS_win, 0, 1, 1, 1)
+ self.params_grid_layout_2.addWidget(self._LOS_NLOS_win, 0, 0, 1, 1)
for r in range(0, 1):
self.params_grid_layout_2.setRowStretch(r, 1)
- for c in range(1, 2):
+ for c in range(0, 1):
self.params_grid_layout_2.setColumnStretch(c, 1)
self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
1024, #size
@@ -512,8 +530,15 @@ 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.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(1, [LOS_NLOS]+([0]*fading_1)+[amp])
+ self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(1, [LOS_NLOS]+(([0]*fading_1)+[amp_1])+(([0]*fading_2)+[amp_2]))
self.interp_fir_filter_xxx_0.declare_sample_delay(0)
+ self._fading_3_range = Range(0, 30, 1, 0, 200)
+ self._fading_3_win = RangeWidget(self._fading_3_range, self.set_fading_3, 'Fading 3', "counter_slider", int)
+ self.params_grid_layout_2.addWidget(self._fading_3_win, 3, 0, 1, 1)
+ for r in range(3, 4):
+ self.params_grid_layout_2.setRowStretch(r, 1)
+ for c in range(0, 1):
+ self.params_grid_layout_2.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])
@@ -545,13 +570,18 @@ class qam_fading(gr.top_block, Qt.QWidget):
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)
self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
- self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, '/home/sara/Documents/Fading/simulation/QAM_Fading/qam_fading_V2_output.grc', False)
- self.blocks_file_sink_0.set_unbuffered(False)
self.blocks_delay_0 = blocks.delay(gr.sizeof_float*1, 50)
self.blocks_char_to_float_0_1 = blocks.char_to_float(1, 1)
self.blocks_char_to_float_0_0 = blocks.char_to_float(1, 1)
self.blocks_char_to_float_0 = blocks.char_to_float(1, 1)
self.analog_random_source_x_0 = blocks.vector_source_b(list(map(int, numpy.random.randint(0, 256, 1000))), True)
+ self._amp_3_range = Range(0, 5, 0.1, 0, 200)
+ self._amp_3_win = RangeWidget(self._amp_3_range, self.set_amp_3, 'Ampliude 3', "counter_slider", float)
+ self.params_grid_layout_2.addWidget(self._amp_3_win, 3, 1, 1, 1)
+ for r in range(3, 4):
+ self.params_grid_layout_2.setRowStretch(r, 1)
+ for c in range(1, 2):
+ self.params_grid_layout_2.setColumnStretch(c, 1)
@@ -560,7 +590,6 @@ class qam_fading(gr.top_block, Qt.QWidget):
##################################################
self.connect((self.analog_random_source_x_0, 0), (self.blocks_unpack_k_bits_bb_0_0, 0))
self.connect((self.analog_random_source_x_0, 0), (self.digital_constellation_modulator_0, 0))
- self.connect((self.blocks_char_to_float_0, 0), (self.blocks_file_sink_0, 0))
self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_freq_sink_x_2_1, 0))
self.connect((self.blocks_char_to_float_0, 0), (self.qtgui_time_sink_x_0, 0))
self.connect((self.blocks_char_to_float_0_0, 0), (self.blocks_delay_0, 0))
@@ -680,12 +709,25 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.freq_offset = freq_offset
self.channels_channel_model_0.set_frequency_offset(self.freq_offset)
+ def get_fading_3(self):
+ return self.fading_3
+
+ def set_fading_3(self, fading_3):
+ self.fading_3 = fading_3
+
+ def get_fading_2(self):
+ return self.fading_2
+
+ def set_fading_2(self, fading_2):
+ self.fading_2 = fading_2
+ self.interp_fir_filter_xxx_0.set_taps([self.LOS_NLOS]+(([0]*self.fading_1)+[self.amp_1])+(([0]*self.fading_2)+[self.amp_2]))
+
def get_fading_1(self):
return self.fading_1
def set_fading_1(self, fading_1):
self.fading_1 = fading_1
- self.interp_fir_filter_xxx_0.set_taps([self.LOS_NLOS]+([0]*self.fading_1)+[self.amp])
+ self.interp_fir_filter_xxx_0.set_taps([self.LOS_NLOS]+(([0]*self.fading_1)+[self.amp_1])+(([0]*self.fading_2)+[self.amp_2]))
def get_eq_ntaps(self):
return self.eq_ntaps
@@ -722,19 +764,32 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.chn_taps = chn_taps
self.channels_channel_model_0.set_taps(self.chn_taps)
- def get_amp(self):
- return self.amp
+ def get_amp_3(self):
+ return self.amp_3
+
+ def set_amp_3(self, amp_3):
+ self.amp_3 = amp_3
+
+ def get_amp_2(self):
+ return self.amp_2
+
+ def set_amp_2(self, amp_2):
+ self.amp_2 = amp_2
+ self.interp_fir_filter_xxx_0.set_taps([self.LOS_NLOS]+(([0]*self.fading_1)+[self.amp_1])+(([0]*self.fading_2)+[self.amp_2]))
+
+ def get_amp_1(self):
+ return self.amp_1
- def set_amp(self, amp):
- self.amp = amp
- self.interp_fir_filter_xxx_0.set_taps([self.LOS_NLOS]+([0]*self.fading_1)+[self.amp])
+ def set_amp_1(self, amp_1):
+ self.amp_1 = amp_1
+ self.interp_fir_filter_xxx_0.set_taps([self.LOS_NLOS]+(([0]*self.fading_1)+[self.amp_1])+(([0]*self.fading_2)+[self.amp_2]))
def get_LOS_NLOS(self):
return self.LOS_NLOS
def set_LOS_NLOS(self, LOS_NLOS):
self.LOS_NLOS = LOS_NLOS
- self.interp_fir_filter_xxx_0.set_taps([self.LOS_NLOS]+([0]*self.fading_1)+[self.amp])
+ self.interp_fir_filter_xxx_0.set_taps([self.LOS_NLOS]+(([0]*self.fading_1)+[self.amp_1])+(([0]*self.fading_2)+[self.amp_2]))