diff options
Diffstat (limited to 'gr-digital/python/digital/generic_mod_demod.py')
-rw-r--r-- | gr-digital/python/digital/generic_mod_demod.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/gr-digital/python/digital/generic_mod_demod.py b/gr-digital/python/digital/generic_mod_demod.py index 2a0d2c44ce..bd0c849245 100644 --- a/gr-digital/python/digital/generic_mod_demod.py +++ b/gr-digital/python/digital/generic_mod_demod.py @@ -41,6 +41,7 @@ _def_samples_per_symbol = 2 _def_excess_bw = 0.35 _def_verbose = False _def_log = False +_def_truncate = False # Frequency correction _def_freq_bw = 2*math.pi/100.0 @@ -93,6 +94,7 @@ class generic_mod(gr.hier_block2): excess_bw: Root-raised cosine filter excess bandwidth (float) verbose: Print information about modulator? (boolean) log: Log modulation data to files? (boolean) + truncate: Truncate the modulated output to account for the RRC filter response (boolean) """ def __init__(self, constellation, @@ -101,7 +103,8 @@ class generic_mod(gr.hier_block2): pre_diff_code=True, excess_bw=_def_excess_bw, verbose=_def_verbose, - log=_def_log): + log=_def_log, + truncate=_def_truncate): gr.hier_block2.__init__(self, "generic_mod", gr.io_signature(1, 1, gr.sizeof_char), # Input signature @@ -133,7 +136,8 @@ class generic_mod(gr.hier_block2): # pulse shaping filter nfilts = 32 - ntaps = nfilts * 11 * int(self._samples_per_symbol) # make nfilts filters of ntaps each + ntaps_per_filt = 11 + ntaps = nfilts * ntaps_per_filt * int(self._samples_per_symbol) # make nfilts filters of ntaps each self.rrc_taps = filter.firdes.root_raised_cosine( nfilts, # gain nfilts, # sampling rate based on 32 filters in resampler @@ -143,13 +147,23 @@ class generic_mod(gr.hier_block2): self.rrc_filter = filter.pfb_arb_resampler_ccf(self._samples_per_symbol, self.rrc_taps) + # Remove the filter transient at the beginning of the transmission + if truncate: + fsps = float(self._samples_per_symbol) + len_filt_delay = (ntaps_per_filt*fsps*fsps-fsps)/2.0 # Length of delay through rrc filter + self.skiphead = blocks.skiphead(gr.sizeof_gr_complex*1, len_filt_delay) + # Connect self._blocks = [self, self.bytes2chunks] if self.pre_diff_code: self._blocks.append(self.symbol_mapper) if differential: self._blocks.append(self.diffenc) - self._blocks += [self.chunks2symbols, self.rrc_filter, self] + self._blocks += [self.chunks2symbols, self.rrc_filter] + + if truncate: + self._blocks.append(self.skiphead) + self._blocks.append(self) self.connect(*self._blocks) if verbose: |