예제 #1
0
 def add_print_list():
     """
     Adds to the print list (method of the Logger class)
     """
     print "\n******************************************************************\n"
     print "\nPrinting the energy\n"
     Logger.add_to_print_list("energy_decision", "energy")
     print "\n******************************************************************\n"
예제 #2
0
def build_us_block(options):
    """
    Builds the US top block.
    The RX path performs the ED sensing
    The TX path transmits a BER
    @param options
    """

    # TOP BLOCK
    tb = OpERAFlow(name='US')

    # RX PATH
    if not options.tx_only:
        uhd_source = UHDSource(device_addr=options.args)
        uhd_source.samp_rate = 195512

        the_source = uhd_source
        the_sink = blocks.probe_signal_f()

        rx_path = EnergySSArch(fft_size=512,
                               mavg_size=5,
                               algorithm=EnergyDecision(th=0.000005)
                               )


        device_source = RadioDevice()
        device_source.add_arch(source=the_source, arch=rx_path, sink=the_sink, uhd_device=None, name="source")

        ###tb.add_arch( abstract_arch = rx_path, radio_device = device_source, name_of_arch = 'rx')
        tb.ad_radio(device_source, 'rx')

    # TX PATH
    tx_path = PacketGMSKTx(name='a')
    Logger.add_to_print_list("a_bit_rate", 'bps')

    uhd_sink = UHDSink(device_addr = options.args)
    uhd_sink.samp_rate = options.samp_rate

    the_source = None
    the_sink = uhd_sink
    uhd_device = uhd_sink
    radio_sink = RadioDevice()
    #::TODO:: conferir se arch é mesmo  tx_path, e fazer essa verificacao do tx_path e rx_path para todos os outros arquivos
    radio_sink.add_arch(source=the_source, arch=tx_path, sink=the_sink, uhd_device=uhd_device, name="sink")

    ###tb.add_arch( tx_path, radio_sink, 'tx', connection_type = OpERAFlow.CONN_SINK)
    tb.add_radio(radio_sink, 'tx')

    return tb