summaryrefslogtreecommitdiff
path: root/gr-digital
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital')
-rwxr-xr-xgr-digital/examples/benchmark_tx.py2
-rw-r--r--gr-digital/examples/transmit_path.py2
-rw-r--r--gr-digital/python/bpsk.py6
-rw-r--r--gr-digital/python/generic_mod_demod.py73
-rw-r--r--gr-digital/python/modulation_utils2.py1
-rw-r--r--gr-digital/python/qpsk.py16
6 files changed, 48 insertions, 52 deletions
diff --git a/gr-digital/examples/benchmark_tx.py b/gr-digital/examples/benchmark_tx.py
index 01902c0e3..e5d24915a 100755
--- a/gr-digital/examples/benchmark_tx.py
+++ b/gr-digital/examples/benchmark_tx.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2010 Free Software Foundation, Inc.
+# Copyright 2010,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
diff --git a/gr-digital/examples/transmit_path.py b/gr-digital/examples/transmit_path.py
index 91869ad9a..8ffb1e108 100644
--- a/gr-digital/examples/transmit_path.py
+++ b/gr-digital/examples/transmit_path.py
@@ -50,7 +50,7 @@ class transmit_path(gr.hier_block2):
# Get mod_kwargs
mod_kwargs = self._modulator_class.extract_kwargs_from_options(options)
-
+
# transmitter
modulator = self._modulator_class(**mod_kwargs)
self.packet_transmitter = \
diff --git a/gr-digital/python/bpsk.py b/gr-digital/python/bpsk.py
index 51de3ce08..806a5d695 100644
--- a/gr-digital/python/bpsk.py
+++ b/gr-digital/python/bpsk.py
@@ -67,7 +67,8 @@ class bpsk_mod(generic_mod):
constellation = digital_swig.constellation_bpsk()
if constellation_points != 2:
raise ValueError('Number of constellation points must be 2 for BPSK.')
- super(bpsk_mod, self).__init__(constellation, *args, **kwargs)
+ super(bpsk_mod, self).__init__(constellation=constellation,
+ *args, **kwargs)
# /////////////////////////////////////////////////////////////////////////////
# BPSK demodulator
@@ -92,7 +93,8 @@ class bpsk_demod(generic_demod):
constellation = digital_swig.constellation_bpsk()
if constellation_points != 2:
raise ValueError('Number of constellation points must be 2 for BPSK.')
- super(bpsk_demod, self).__init__(constellation, *args, **kwargs)
+ super(bpsk_demod, self).__init__(constellation=constellation,
+ *args, **kwargs)
#
# Add these to the mod/demod registry
diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py
index f252af13b..b5c727058 100644
--- a/gr-digital/python/generic_mod_demod.py
+++ b/gr-digital/python/generic_mod_demod.py
@@ -29,6 +29,7 @@ from gnuradio import gr
from modulation_utils2 import extract_kwargs_from_options_for_class
from utils import mod_codes
import digital_swig
+import math
# default values (used in __init__ and add_options)
_def_samples_per_symbol = 2
@@ -37,13 +38,12 @@ _def_verbose = False
_def_log = False
# Frequency correction
-_def_freq_alpha = 0.010
+_def_freq_bw = 2*math.pi/100.0
# Symbol timing recovery
-_def_timing_alpha = 0.100
-_def_timing_beta = 0.010
+_def_timing_bw = 2*math.pi/100.0
_def_timing_max_dev = 1.5
# Fine frequency / Phase correction
-_def_phase_alpha = 0.1
+_def_phase_bw = 2*math.pi/100.0
# Number of points in constellation
_def_constellation_points = 16
# Whether differential coding is used.
@@ -77,6 +77,7 @@ class generic_mod(gr.hier_block2):
differential=_def_differential,
samples_per_symbol=_def_samples_per_symbol,
excess_bw=_def_excess_bw,
+ gray_coded=True,
verbose=_def_verbose,
log=_def_log):
"""
@@ -88,9 +89,11 @@ class generic_mod(gr.hier_block2):
@param constellation: determines the modulation type
@type constellation: gnuradio.digital.gr_constellation
@param samples_per_symbol: samples per baud >= 2
- @type samples_per_symbol: integer
+ @type samples_per_symbol: float
@param excess_bw: Root-raised cosine filter excess bandwidth
@type excess_bw: float
+ @param gray_coded: turn gray coding on/off
+ @type gray_coded: bool
@param verbose: Print information about modulator?
@type verbose: bool
@param log: Log modulation data to files?
@@ -206,10 +209,9 @@ class generic_demod(gr.hier_block2):
samples_per_symbol=_def_samples_per_symbol,
differential=_def_differential,
excess_bw=_def_excess_bw,
- freq_alpha=_def_freq_alpha,
- timing_alpha=_def_timing_alpha,
- timing_max_dev=_def_timing_max_dev,
- phase_alpha=_def_phase_alpha,
+ freq_bw=_def_freq_bw,
+ timing_bw=_def_timing_bw,
+ phase_bw=_def_phase_bw,
verbose=_def_verbose,
log=_def_log):
"""
@@ -224,14 +226,12 @@ class generic_demod(gr.hier_block2):
@type samples_per_symbol: float
@param excess_bw: Root-raised cosine filter excess bandwidth
@type excess_bw: float
- @param freq_alpha: loop filter gain for frequency recovery
- @type freq_alpha: float
- @param timing_alpha: loop alpha gain for timing recovery
- @type timing_alpha: float
- @param timing_max_dev: timing loop maximum rate deviations
- @type timing_max_dev: float
- @param phase_alpha: loop filter gain in phase loop
- @type phase_alphas: float
+ @param freq_bw: loop filter lock-in bandwidth
+ @type freq_bw: float
+ @param timing_bw: timing recoery loop lock-in bandwidth
+ @type timing_bw: float
+ @param phase_bw: phase recovery loop bandwidth
+ @type phase_bw: float
@param verbose: Print information about modulator?
@type verbose: bool
@param debug: Print modualtion data to files?
@@ -245,12 +245,10 @@ class generic_demod(gr.hier_block2):
self._constellation = constellation.base()
self._samples_per_symbol = samples_per_symbol
self._excess_bw = excess_bw
- self._phase_alpha = phase_alpha
- self._freq_alpha = freq_alpha
- self._freq_beta = 0.10*self._freq_alpha
- self._timing_alpha = timing_alpha
- self._timing_beta = _def_timing_beta
- self._timing_max_dev=timing_max_dev
+ self._phase_bw = phase_bw
+ self._freq_bw = freq_bw
+ self._timing_bw = timing_bw
+ self._timing_max_dev= _def_timing_max_dev,
self._differential = differential
if self._samples_per_symbol < 2:
@@ -258,26 +256,24 @@ class generic_demod(gr.hier_block2):
arity = pow(2,self.bits_per_symbol())
+ nfilts = 32
+ ntaps = 11 * int(self._samples_per_symbol*nfilts)
+
# Automatic gain control
self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100)
# Frequency correction
- self.bandwidth = 6.28 / 100.0
self.freq_recov = digital_swig.fll_band_edge_cc(self._samples_per_symbol, self._excess_bw,
- 11*int(self._samples_per_symbol),
- self.bandwidth)
+ ntaps, self._freq_bw)
# symbol timing recovery with RRC data filter
- nfilts = 32
- ntaps = 11 * int(self._samples_per_symbol*nfilts)
- taps = gr.firdes.root_raised_cosine(nfilts, nfilts,
- 1.0/float(self._samples_per_symbol),
- self._excess_bw, ntaps)
+ taps = gr.firdes.root_raised_cosine(nfilts, nfilts*self._samples_per_symbol,
+ 1.0, self._excess_bw, ntaps)
self.time_recov = gr.pfb_clock_sync_ccf(self._samples_per_symbol,
- self._timing_alpha,
- taps, nfilts, nfilts/2, self._timing_max_dev)
- self.time_recov.set_beta(self._timing_beta)
+ self._timing_bw, taps,
+ nfilts, nfilts/2, self._timing_max_dev)
+ self._phase_alpha = 0.1
self._phase_beta = 0.25 * self._phase_alpha * self._phase_alpha
fmin = -0.25
fmax = 0.25
@@ -323,12 +319,9 @@ class generic_demod(gr.hier_block2):
print "\nDemodulator:"
print "bits per symbol: %d" % self.bits_per_symbol()
print "RRC roll-off factor: %.2f" % self._excess_bw
- print "FLL gain: %.2e" % self._freq_alpha
- print "Timing alpha gain: %.2e" % self._timing_alpha
- print "Timing beta gain: %.2e" % self._timing_beta
- print "Timing max dev: %.2f" % self._timing_max_dev
- print "Phase track alpha: %.2e" % self._phase_alpha
- print "Phase track beta: %.2e" % self._phase_beta
+ print "FLL bandwidth: %.2e" % self._freq_bw
+ print "Timing bandwidth: %.2e" % self._timing_bw
+ print "Phase bandwidth: %.2e" % self._phase_bw
def _setup_logging(self):
print "Modulation logging turned on."
diff --git a/gr-digital/python/modulation_utils2.py b/gr-digital/python/modulation_utils2.py
index f30055f4a..cb3a9812d 100644
--- a/gr-digital/python/modulation_utils2.py
+++ b/gr-digital/python/modulation_utils2.py
@@ -80,6 +80,7 @@ def extract_kwargs_from_options(function, excluded_args, options):
@param options: result of command argument parsing
@type options: optparse.Values
"""
+
# Try this in C++ ;)
args, varargs, varkw, defaults = inspect.getargspec(function)
d = {}
diff --git a/gr-digital/python/qpsk.py b/gr-digital/python/qpsk.py
index 91e8b196f..031aa03a5 100644
--- a/gr-digital/python/qpsk.py
+++ b/gr-digital/python/qpsk.py
@@ -23,7 +23,6 @@
QPSK modulation.
Demodulation is not included since the generic_mod_demod
-doesn't work for non-differential encodings.
"""
from gnuradio import gr
@@ -33,8 +32,7 @@ import modulation_utils2
# Default number of points in constellation.
_def_constellation_points = 4
-# Whether differential coding is used.
-_def_differential = False
+# Whether gray coding is used.
_def_gray_coded = True
# /////////////////////////////////////////////////////////////////////////////
@@ -70,9 +68,11 @@ class qpsk_mod(generic_mod):
constellation = digital_swig.constellation_qpsk()
if constellation_points != 4:
raise ValueError("QPSK can only have 4 constellation points.")
- if differential or not gray_coded:
- raise ValueError("This QPSK mod/demod works only for gray-coded, non-differential.")
- super(qpsk_mod, self).__init__(constellation, differential, gray_coded, *args, **kwargs)
+ if not gray_coded:
+ raise ValueError("This QPSK mod/demod works only for gray-coded constellations.")
+ super(qpsk_mod, self).__init__(constellation=constellation,
+ gray_coded=gray_coded,
+ *args, **kwargs)
# /////////////////////////////////////////////////////////////////////////////
@@ -98,8 +98,8 @@ class qpsk_demod(generic_demod):
constellation = digital_swig.constellation_qpsk()
if constellation_points != 4:
raise ValueError('Number of constellation points must be 4 for QPSK.')
- super(qpsk_demod, self).__init__(constellation, *args, **kwargs)
-
+ super(qpsk_demod, self).__init__(constellation=constellation,
+ *args, **kwargs)
#
# Add these to the mod/demod registry