Exemplo n.º 1
0
    def __init__(self, *args, **kwargs): 
        """
	Hierarchical block for cc1k FSK modulation.

	The input is a byte stream (unsigned char) and the
	output is the complex modulated signal at baseband.

	@param spb: samples per baud >= 2
	@type spb: integer
	"""
	try:
		self.spb = kwargs.pop('spb') 
	except KeyError:
		pass

	gr.hier_block2.__init__(self, "ieee802_15_4_mod",
				gr.io_signature(1, 1, 1),  # Input 
				gr.io_signature(1, 1, gr.sizeof_gr_complex))  # Output 

        if not isinstance(self.spb, int) or self.spb < 2: 
            raise TypeError, "spb must be an integer >= 2"

        self.symbolsToChips = ucla.symbols_to_chips_bi()
        self.chipsToSymbols = gr.packed_to_unpacked_ii(2, gr.GR_MSB_FIRST)
        self.symbolsToConstellation = gr.chunks_to_symbols_ic((-1-1j, -1+1j, 1-1j, 1+1j))

        self.pskmod = ucla.qpsk_modulator_cc()
        self.delay = ucla.delay_cc(self.spb)
        
        # Connect
        self.connect(self, self.symbolsToChips, self.chipsToSymbols, self.symbolsToConstellation, self.pskmod, self.delay, self)
Exemplo n.º 2
0
    def __init__(self, fg, spb = 2):
        """
	Hierarchical block for cc1k FSK modulation.

	The input is a byte stream (unsigned char) and the
	output is the complex modulated signal at baseband.

	@param fg: flow graph
	@type fg: flow graph
	@param spb: samples per baud >= 2
	@type spb: integer
	"""
        if not isinstance(spb, int) or spb < 2:
            raise TypeError, "sbp must be an integer >= 2"
        self.spb = spb

        self.symbolsToChips = ucla.symbols_to_chips_bi()
        self.chipsToSymbols = gr.packed_to_unpacked_ii(2, gr.GR_MSB_FIRST)
        self.symbolsToConstellation = gr.chunks_to_symbols_ic((-1-1j, -1+1j, 1-1j, 1+1j))

        self.pskmod = ucla.qpsk_modulator_cc()
        self.delay = ucla.delay_cc(self.spb)


	# Connect
	fg.connect(self.symbolsToChips, self.chipsToSymbols,
                   self.symbolsToConstellation, self.pskmod, self.delay)

	# Initialize base class
	gr.hier_block.__init__(self, fg, self.symbolsToChips, self.delay)
    def __init__(self, *args, **kwargs):
        """
	Hierarchical block for cc1k FSK modulation.

	The input is a byte stream (unsigned char) and the
	output is the complex modulated signal at baseband.

	@param spb: samples per baud >= 2
	@type spb: integer
	"""
        try:
            self.spb = kwargs.pop('spb')
        except KeyError:
            pass

	gr.hier_block2.__init__(self, "ieee802_15_4_mod",
                                gr.io_signature(1, 1, 1),  # Input
                                gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output

        if not isinstance(self.spb, int) or self.spb < 2:
            raise TypeError, "sbp must be an integer >= 2"

        self.symbolsToChips = ucla.symbols_to_chips_bi()
        self.chipsToSymbols = gr.packed_to_unpacked_ii(2, gr.GR_MSB_FIRST)
        self.symbolsToConstellation = gr.chunks_to_symbols_ic((-1-1j, -1+1j, 1-1j, 1+1j))

        self.pskmod = ucla.qpsk_modulator_cc()
        self.delay = ucla.delay_cc(self.spb)


	# Connect
	self.connect(self, self.symbolsToChips, self.chipsToSymbols,
                   self.symbolsToConstellation, self.pskmod, self.delay, self)
def build_graph(outfile):

  # Initialize our top block
  fg = gr.top_block()

  # Input
  input = [0x00, 0xa7]

  # Unsigned char source to use the input
  src = gr.vector_source_b(input)

  symbolsToChips = ucla.symbols_to_chips_bi()
  chipsToSymbols = gr.packed_to_unpacked_ii(2, gr.GR_MSB_FIRST)
  symbolsToConstellation = gr.chunks_to_symbols_ic((-1-1j, -1+1j, 1-1j, 1+1j))
  pskmod = ucla.qpsk_modulator_cc()
  delay = ucla.delay_cc(2)

  # File sink
  fsink = gr.file_sink(gr.sizeof_gr_complex, outfile)

  fg.connect(src, symbolsToChips, chipsToSymbols, symbolsToConstellation, pskmod, delay, fsink)

  return fg
Exemplo n.º 5
0
 def __init__(self, sps, excess_bw, amplitude, vector_source): 
     try:
         self.sps = 2
     except KeyError:
         pass
     
     gr.hier_block2.__init__(self, "OQPSK Modulator",
                             gr.io_signature(0, 0, 0),                     # Input 
                             gr.io_signature(1, 1, gr.sizeof_gr_complex))  # Output 
     
     if not isinstance(self.sps, int) or self.sps < 2: 
         raise TypeError, "sample per symbol  sps ou spb must be an integer >= 2"
     
     self.vector_source = vector_source
     
     self.symbolsToChips = ucla.symbols_to_chips_bi()
     
     self.chipsToSymbols = gr.packed_to_unpacked_ii(2, gr.GR_MSB_FIRST)
     
     #self.symbolsToConstellation = gr.chunks_to_symbols_ic((-1-1j, -1+1j, 1-1j, 1+1j))
     self.symbolsToConstellation = gr.chunks_to_symbols_bc((-1-1j, -1+1j, 1-1j, 1+1j))
     
     #self._scrambler = gr.scrambler_bb(0x8A, 0x7F, 31) # CCSDS 7-bit scrambler
     
     self.pskmod = ucla.qpsk_modulator_cc()
     
     self.delay = ucla.delay_cc(self.sps)
     
     self.amp = gr.multiply_const_cc(amplitude) 
     
     #self.connect(self.vector_source , self.symbolsToChips, self.chipsToSymbols, self.symbolsToConstellation, self.pskmod, self.delay, self.amp, self)
     
     #self.connect(self.vector_source , self._scrambler, self.symbolsToConstellation, self.pskmod, self.delay, self.amp, self)
     self.connect(self.vector_source, self.symbolsToConstellation, self.pskmod, self.delay, self.amp, self)
 
     #self.connect(self, self.symbolsToChips, self.chipsToSymbols, self.symbolsToConstellation, self.pskmod, self)