# # ///////////////////////////////////////////////////////////////////////////// class qam_demod(generic_demod): def __init__(self, constellation_points=_def_constellation_points, differential=_def_differential, mod_code=_def_mod_code, *args, **kwargs): """ Hierarchical block for RRC-filtered QAM modulation. The input is a byte stream (unsigned char) and the output is the complex modulated signal at baseband. See generic_demod block for list of parameters. """ constellation = qam_constellation(constellation_points, differential, mod_code) # We take care of the gray coding in the constellation generation so it doesn't # need to be done in the block. super(qam_demod, self).__init__(constellation, differential=differential, *args, **kwargs) # # Add these to the mod/demod registry # modulation_utils.add_type_1_mod('qam', qam_mod) modulation_utils.add_type_1_demod('qam', qam_demod) modulation_utils.add_type_1_constellation('qam', qam_constellation)
# ///////////////////////////////////////////////////////////////////////////// # PSK demodulator # # ///////////////////////////////////////////////////////////////////////////// class psk_demod(generic_demod): def __init__(self, constellation_points=_def_constellation_points, mod_code=_def_mod_code, *args, **kwargs): """ Hierarchical block for RRC-filtered PSK modulation. The input is a byte stream (unsigned char) and the output is the complex modulated signal at baseband. See generic_demod block for list of parameters. """ constellation = psk_constellation(constellation_points, mod_code) super(psk_demod, self).__init__(constellation, *args, **kwargs) # # Add these to the mod/demod registry # modulation_utils.add_type_1_mod('psk', psk_mod) modulation_utils.add_type_1_demod('psk', psk_demod) modulation_utils.add_type_1_constellation('psk', psk_constellation)
mod_code=_def_mod_code, *args, **kwargs): """ Hierarchical block for RRC-filtered QAM modulation. The input is a byte stream (unsigned char) and the output is the complex modulated signal at baseband. See generic_demod block for list of parameters. """ constellation = qam_constellation(constellation_points, differential, mod_code) # We take care of the gray coding in the constellation generation so it doesn't # need to be done in the block. super(qam_demod, self).__init__(constellation, differential=differential, *args, **kwargs) # adding member variable to simplify logging self._mod_code = mod_code # # Add these to the mod/demod registry # modulation_utils.add_type_1_mod('qam', qam_mod) modulation_utils.add_type_1_demod('qam', qam_demod) modulation_utils.add_type_1_constellation('qam', qam_constellation)
# DBPSK demodulator # # ///////////////////////////////////////////////////////////////////////////// class dbpsk_demod(bpsk_demod): """ Hierarchical block for RRC-filtered DBPSK modulation. The input is a byte stream (unsigned char) and the output is the complex modulated signal at baseband. Args: mod_code: Argument is not used. It exists purely to simplify generation of the block in grc. """ # See generic_demod for additional arguments __doc__ += shared_demod_args def __init__(self, mod_code=None, *args, **kwargs): super(dbpsk_demod, self).__init__(*args, **kwargs) # # Add these to the mod/demod registry # modulation_utils.add_type_1_mod('bpsk', bpsk_mod) modulation_utils.add_type_1_demod('bpsk', bpsk_demod) modulation_utils.add_type_1_constellation('bpsk', bpsk_constellation) modulation_utils.add_type_1_mod('dbpsk', dbpsk_mod) modulation_utils.add_type_1_demod('dbpsk', dbpsk_demod) modulation_utils.add_type_1_constellation('dbpsk', dbpsk_constellation)
*args, **kwargs): """ Hierarchical block for RRC-filtered DQPSK modulation. The input is a byte stream (unsigned char) and the output is the complex modulated signal at baseband. See generic_demod block for list of parameters. """ constellation_points = _def_constellation_points constellation = digital_swig.constellation_dqpsk() if constellation_points != 4: raise ValueError( 'Number of constellation points must be 4 for DQPSK.') super(dqpsk_demod, self).__init__(constellation=constellation, differential=True, *args, **kwargs) # # Add these to the mod/demod registry # modulation_utils.add_type_1_mod('qpsk', qpsk_mod) modulation_utils.add_type_1_demod('qpsk', qpsk_demod) modulation_utils.add_type_1_constellation('qpsk', qpsk_constellation) modulation_utils.add_type_1_mod('dqpsk', dqpsk_mod) modulation_utils.add_type_1_demod('dqpsk', dqpsk_demod) modulation_utils.add_type_1_constellation('dqpsk', dqpsk_constellation)
# ///////////////////////////////////////////////////////////////////////////// class dqpsk_demod(qpsk_demod): """ Hierarchical block for RRC-filtered DQPSK modulation. The input is a byte stream (unsigned char) and the output is the complex modulated signal at baseband. Args: mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE). """ # See generic_mod for additional arguments __doc__ += shared_demod_args def __init__(self, mod_code=_def_mod_code, *args, **kwargs): super(dqpsk_demod, self).__init__(mod_code, *args, **kwargs) # # Add these to the mod/demod registry # modulation_utils.add_type_1_mod("qpsk", qpsk_mod) modulation_utils.add_type_1_demod("qpsk", qpsk_demod) modulation_utils.add_type_1_constellation("qpsk", qpsk_constellation) modulation_utils.add_type_1_mod("dqpsk", dqpsk_mod) modulation_utils.add_type_1_demod("dqpsk", dqpsk_demod) modulation_utils.add_type_1_constellation("dqpsk", dqpsk_constellation)
class qam_demod(generic_demod): def __init__( self, constellation_points=_def_constellation_points, differential=_def_differential, mod_code=_def_mod_code, *args, **kwargs ): """ Hierarchical block for RRC-filtered QAM modulation. The input is a byte stream (unsigned char) and the output is the complex modulated signal at baseband. See generic_demod block for list of parameters. """ constellation = qam_constellation(constellation_points, differential, mod_code) # We take care of the gray coding in the constellation generation so it doesn't # need to be done in the block. super(qam_demod, self).__init__(constellation, differential=differential, *args, **kwargs) # # Add these to the mod/demod registry # modulation_utils.add_type_1_mod("qam", qam_mod) modulation_utils.add_type_1_demod("qam", qam_demod) modulation_utils.add_type_1_constellation("qam", qam_constellation)
def __init__(self, constellation_points=_def_constellation_points, differential=True, *args, **kwargs): """ Hierarchical block for RRC-filtered DQPSK modulation. The input is a byte stream (unsigned char) and the output is the complex modulated signal at baseband. See generic_demod block for list of parameters. """ constellation_points = _def_constellation_points constellation = digital_swig.constellation_dqpsk() if constellation_points != 4: raise ValueError('Number of constellation points must be 4 for DQPSK.') super(dqpsk_demod, self).__init__(constellation=constellation, differential=True, *args, **kwargs) # # Add these to the mod/demod registry # modulation_utils.add_type_1_mod('qpsk', qpsk_mod) modulation_utils.add_type_1_demod('qpsk', qpsk_demod) modulation_utils.add_type_1_constellation('qpsk', qpsk_constellation) modulation_utils.add_type_1_mod('dqpsk', dqpsk_mod) modulation_utils.add_type_1_demod('dqpsk', dqpsk_demod) modulation_utils.add_type_1_constellation('dqpsk', dqpsk_constellation)