aboutsummaryrefslogtreecommitdiffstats
path: root/simulation
diff options
context:
space:
mode:
Diffstat (limited to 'simulation')
-rwxr-xr-xsimulation/QAM/qam.py15
-rw-r--r--simulation/QAM/qam_nogui.grc6
-rwxr-xr-xsimulation/QAM_Fading/qam_fading.py47
-rw-r--r--simulation/QAM_Fading/qam_fading_V2.grc116
4 files changed, 134 insertions, 50 deletions
diff --git a/simulation/QAM/qam.py b/simulation/QAM/qam.py
index 6c069b2..bf6b82d 100755
--- a/simulation/QAM/qam.py
+++ b/simulation/QAM/qam.py
@@ -75,21 +75,22 @@ class qam(gr.top_block, Qt.QWidget):
##################################################
# Variables
##################################################
- self.sps = sps = 2
+ self.sps = sps = 4
self.nfilts = nfilts = 32
self.excess_bw = excess_bw = 350e-3
self.timing_loop_bw = timing_loop_bw = 2 * 3.141592653589793 / 100
self.time_offset = time_offset = 1.0
self.samp_rate = samp_rate = 32000
self.rrc_taps = rrc_taps = firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(sps), excess_bw, 45*nfilts)
+ self.qam_const = qam_const = digital.constellation_rect([(-3-3j), (-1-3j), (1-3j), (3-3j), (-3-1j), (-1-1j), (1-1j), (3-1j), (-3+1j), (-1+1j), (1+1j), (3+1j), (-3+3j), (-1+3j), (1+3j), (3+3j)], [0, 4, 12, 8, 1, 5, 13, 9, 3, 7, 15, 11, 2, 6, 14, 10],
+ 4, 1, 1, 1, 1).base()
self.phase_bw = phase_bw = 2 * 3.141592653589793 / 100
self.noise_volt = noise_volt = 0.0001
self.freq_offset = freq_offset = 0
self.eq_ntaps = eq_ntaps = 15
self.eq_mod = eq_mod = 1
self.eq_gain = eq_gain = .01
- self.const = const = digital.constellation_rect([(-3-3j), 0, 0, (3-3j), (-3-1j), 0, 0, (3-1j), (-3+1j), (-1+1j), (1+1j), (3+1j), (-3+3j), 0, 0, (3+3j)], [0, 4, 12, 8, 1, 5, 13, 9, 3, 7, 15, 11, 2, 6, 14, 10],
- 4, 1, 1, 1, 1).base()
+ self.const = const = digital.constellation_16qam().base()
self.chn_taps = chn_taps = [1.0 + 0.0j, ]
##################################################
@@ -440,7 +441,7 @@ class qam(gr.top_block, Qt.QWidget):
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 = digital.map_bb([0, 1, 3, 2])
self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(4)
- self.digital_costas_loop_cc_0 = digital.costas_loop_cc(phase_bw, 2, False)
+ self.digital_costas_loop_cc_0 = digital.costas_loop_cc(phase_bw, 4, False)
self.digital_constellation_modulator_0 = digital.generic_mod(
constellation=const,
differential=True,
@@ -550,6 +551,12 @@ class qam(gr.top_block, Qt.QWidget):
self.rrc_taps = rrc_taps
self.digital_pfb_clock_sync_xxx_0.update_taps(self.rrc_taps)
+ def get_qam_const(self):
+ return self.qam_const
+
+ def set_qam_const(self, qam_const):
+ self.qam_const = qam_const
+
def get_phase_bw(self):
return self.phase_bw
diff --git a/simulation/QAM/qam_nogui.grc b/simulation/QAM/qam_nogui.grc
index 1264e80..cfbed6d 100644
--- a/simulation/QAM/qam_nogui.grc
+++ b/simulation/QAM/qam_nogui.grc
@@ -449,7 +449,7 @@ blocks:
modulus: eq_mod
mu: eq_gain
num_taps: eq_ntaps
- sps: sps
+ sps: '1'
states:
bus_sink: false
bus_source: false
@@ -556,8 +556,8 @@ blocks:
max_dev: '1.5'
maxoutbuf: '0'
minoutbuf: '0'
- osps: sps
- sps: sps * 1.001
+ osps: '1'
+ sps: 'sps '
taps: rrc_taps
type: ccf
states:
diff --git a/simulation/QAM_Fading/qam_fading.py b/simulation/QAM_Fading/qam_fading.py
index 063c91b..fff224a 100755
--- a/simulation/QAM_Fading/qam_fading.py
+++ b/simulation/QAM_Fading/qam_fading.py
@@ -93,6 +93,8 @@ class qam_fading(gr.top_block, Qt.QWidget):
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.LOS_NLOS = LOS_NLOS = 1
##################################################
# Blocks
@@ -108,6 +110,11 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.params_grid_layout_1 = Qt.QGridLayout()
self.params_layout_1.addLayout(self.params_grid_layout_1)
self.params.addTab(self.params_widget_1, 'Receiver')
+ self.params_widget_2 = Qt.QWidget()
+ self.params_layout_2 = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.params_widget_2)
+ self.params_grid_layout_2 = Qt.QGridLayout()
+ self.params_layout_2.addLayout(self.params_grid_layout_2)
+ self.params.addTab(self.params_widget_2, 'Fading')
self.top_grid_layout.addWidget(self.params)
self._timing_loop_bw_range = Range(0, 200e-3, 10e-3, 2 * 3.141592653589793 / 100, 200)
self._timing_loop_bw_win = RangeWidget(self._timing_loop_bw_range, self.set_timing_loop_bw, 'Time Bandwidth', "counter_slider", float)
@@ -163,11 +170,11 @@ class qam_fading(gr.top_block, Qt.QWidget):
self.params_grid_layout_0.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_0.addWidget(self._fading_1_win, 2, 0, 1, 1)
- for r in range(2, 3):
- self.params_grid_layout_0.setRowStretch(r, 1)
+ 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.setRowStretch(r, 1)
for c in range(0, 1):
- self.params_grid_layout_0.setColumnStretch(c, 1)
+ self.params_grid_layout_2.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)
@@ -175,6 +182,20 @@ 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)
+ 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)
+ 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)
+ for r in range(0, 1):
+ self.params_grid_layout_2.setRowStretch(r, 1)
+ for c in range(1, 2):
+ self.params_grid_layout_2.setColumnStretch(c, 1)
self.qtgui_time_sink_x_0 = qtgui.time_sink_f(
1024, #size
samp_rate, #samp_rate
@@ -491,7 +512,7 @@ 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, [1]+([0]*fading_1)+[0.2])
+ self.interp_fir_filter_xxx_0 = filter.interp_fir_filter_ccc(1, [LOS_NLOS]+([0]*fading_1)+[amp])
self.interp_fir_filter_xxx_0.declare_sample_delay(0)
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)
@@ -661,7 +682,7 @@ class qam_fading(gr.top_block, Qt.QWidget):
def set_fading_1(self, fading_1):
self.fading_1 = fading_1
- self.interp_fir_filter_xxx_0.set_taps([1]+([0]*self.fading_1)+[0.2])
+ self.interp_fir_filter_xxx_0.set_taps([self.LOS_NLOS]+([0]*self.fading_1)+[self.amp])
def get_eq_ntaps(self):
return self.eq_ntaps
@@ -698,6 +719,20 @@ 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 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 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])
+
diff --git a/simulation/QAM_Fading/qam_fading_V2.grc b/simulation/QAM_Fading/qam_fading_V2.grc
index d45e030..adc1925 100644
--- a/simulation/QAM_Fading/qam_fading_V2.grc
+++ b/simulation/QAM_Fading/qam_fading_V2.grc
@@ -32,6 +32,48 @@ options:
state: enabled
blocks:
+- name: LOS_NLOS
+ id: variable_qtgui_range
+ parameters:
+ comment: ''
+ gui_hint: 'params@2: 0,1,1,1'
+ label: LOS_NLOS
+ min_len: '200'
+ orient: Qt.Horizontal
+ rangeType: int
+ start: '0'
+ step: '1'
+ stop: '1'
+ value: '1'
+ widget: counter_slider
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [1200, 484.0]
+ rotation: 0
+ state: true
+- name: amp
+ id: variable_qtgui_range
+ parameters:
+ comment: ''
+ gui_hint: 'params@2: 1,0,1,1'
+ label: Ampliude
+ min_len: '200'
+ orient: Qt.Horizontal
+ rangeType: float
+ start: '0'
+ step: '0.1'
+ stop: '5'
+ value: '0.2'
+ widget: counter_slider
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [1136, 612.0]
+ rotation: 0
+ state: true
- name: chn_taps
id: variable
parameters:
@@ -80,7 +122,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1648, 476.0]
+ coordinate: [1864, 480.0]
rotation: 0
state: true
- name: eq_mod
@@ -92,7 +134,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1648, 400.0]
+ coordinate: [1864, 400.0]
rotation: 0
state: true
- name: eq_ntaps
@@ -104,7 +146,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1728, 400.0]
+ coordinate: [1944, 400.0]
rotation: 0
state: true
- name: excess_bw
@@ -123,7 +165,7 @@ blocks:
id: variable_qtgui_range
parameters:
comment: ''
- gui_hint: 'params@0: 2,0,1,1'
+ gui_hint: 'params@2: 0,0,1,1'
label: Fading
min_len: '200'
orient: Qt.Horizontal
@@ -137,7 +179,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [992, 476.0]
+ coordinate: [1080, 484.0]
rotation: 0
state: true
- name: freq_offset
@@ -170,7 +212,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1312, 132.0]
+ coordinate: [1528, 128.0]
rotation: 0
state: true
- name: noise_volt
@@ -212,7 +254,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1952, 444.0]
+ coordinate: [2168, 448.0]
rotation: 0
state: true
- name: rrc_taps
@@ -224,7 +266,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1392, 132.0]
+ coordinate: [1608, 128.0]
rotation: 0
state: true
- name: samp_rate
@@ -290,7 +332,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1312, 196.0]
+ coordinate: [1528, 192.0]
rotation: 0
state: true
- name: analog_random_source_x_0
@@ -327,7 +369,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2592, 296.0]
+ coordinate: [2808, 296.0]
rotation: 0
state: true
- name: blocks_char_to_float_0_0
@@ -361,7 +403,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2544, 692.0]
+ coordinate: [2760, 696.0]
rotation: 0
state: true
- name: blocks_delay_0
@@ -380,7 +422,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2624, 1352.0]
+ coordinate: [2848, 1356.0]
rotation: 0
state: true
- name: blocks_throttle_0
@@ -415,7 +457,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2512, 456.0]
+ coordinate: [2728, 456.0]
rotation: 0
state: true
- name: blocks_unpack_k_bits_bb_0_0
@@ -447,7 +489,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2448, 868.0]
+ coordinate: [2664, 872.0]
rotation: 0
state: true
- name: channels_channel_model_0
@@ -487,7 +529,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1648, 304.0]
+ coordinate: [1864, 304.0]
rotation: 0
state: true
- name: digital_cma_equalizer_cc_0_0
@@ -506,7 +548,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1536, 788.0]
+ coordinate: [1784, 956.0]
rotation: 0
state: true
- name: digital_constellation_decoder_cb_0
@@ -522,7 +564,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2288, 296.0]
+ coordinate: [2504, 296.0]
rotation: 0
state: true
- name: digital_constellation_decoder_cb_0_0
@@ -538,7 +580,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2224, 684.0]
+ coordinate: [2440, 680.0]
rotation: 0
state: true
- name: digital_constellation_modulator_0
@@ -577,7 +619,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1952, 296.0]
+ coordinate: [2168, 288.0]
rotation: 0
state: true
- name: digital_costas_loop_cc_0_0
@@ -595,7 +637,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1872, 824.0]
+ coordinate: [2096, 952.0]
rotation: 0
state: true
- name: digital_diff_decoder_bb_0
@@ -611,7 +653,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2288, 360.0]
+ coordinate: [2504, 360.0]
rotation: 180
state: true
- name: digital_diff_decoder_bb_0_0
@@ -627,7 +669,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2264, 764.0]
+ coordinate: [2472, 760.0]
rotation: 180
state: true
- name: digital_map_bb_0
@@ -643,7 +685,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2304, 456.0]
+ coordinate: [2520, 456.0]
rotation: 0
state: true
- name: digital_map_bb_0_0
@@ -659,7 +701,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2272, 868.0]
+ coordinate: [2488, 872.0]
rotation: 0
state: true
- name: digital_pfb_clock_sync_xxx_0
@@ -682,7 +724,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1312, 324.0]
+ coordinate: [1528, 328.0]
rotation: 0
state: true
- name: digital_pfb_clock_sync_xxx_0_0
@@ -705,7 +747,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1096, 812.0]
+ coordinate: [1248, 980.0]
rotation: 0
state: true
- name: import_0
@@ -731,13 +773,13 @@ blocks:
maxoutbuf: '0'
minoutbuf: '0'
samp_delay: '0'
- taps: '[1]+([0]*fading_1)+[0.2]'
+ taps: '[LOS_NLOS]+([0]*fading_1)+[amp]'
type: ccc
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [968, 348.0]
+ coordinate: [1128, 348.0]
rotation: 0
state: true
- name: params
@@ -758,7 +800,7 @@ blocks:
label17: Tab 17
label18: Tab 18
label19: Tab 19
- label2: Tab 2
+ label2: Fading
label3: Tab 3
label4: Tab 4
label5: Tab 5
@@ -766,7 +808,7 @@ blocks:
label7: Tab 7
label8: Tab 8
label9: Tab 9
- num_tabs: '2'
+ num_tabs: '3'
states:
bus_sink: false
bus_source: false
@@ -897,7 +939,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [884.0, -112]
+ coordinate: [1348.0, -80]
rotation: 90
state: enabled
- name: qtgui_const_sink_x_0_0
@@ -989,7 +1031,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1572.0, 80]
+ coordinate: [1776.0, 80]
rotation: 90
state: enabled
- name: qtgui_const_sink_x_1
@@ -1081,7 +1123,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1812.0, 56]
+ coordinate: [2016.0, 48]
rotation: 90
state: true
- name: qtgui_const_sink_x_2
@@ -1173,7 +1215,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2188.0, 0]
+ coordinate: [2400.0, 0]
rotation: 90
state: true
- name: qtgui_freq_sink_x_0
@@ -1253,7 +1295,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [1200.0, 624]
+ coordinate: [1424.0, 584]
rotation: 270
state: true
- name: qtgui_freq_sink_x_2_1
@@ -1333,7 +1375,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2848, 488.0]
+ coordinate: [3064, 480.0]
rotation: 0
state: true
- name: qtgui_time_sink_x_0
@@ -1430,7 +1472,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [2816, 288.0]
+ coordinate: [3032, 288.0]
rotation: 0
state: true