summaryrefslogtreecommitdiff
path: root/gr-digital/python/generic_mod_demod.py
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital/python/generic_mod_demod.py')
-rw-r--r--gr-digital/python/generic_mod_demod.py73
1 files changed, 33 insertions, 40 deletions
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."