def device_definition(options): """ Definition of the devices used in the program. @param options """ tb = OpERAFlow(name="US") bits_per_symbol = 2 modulator = grc_blks2.packet_mod_b( digital.ofdm_mod( options=grc_blks2.options( modulation="bpsk", fft_length=512, occupied_tones=200, cp_length=128, pad_for_usrp=True, log=None, verbose=None, ) ), payload_length=0, ) uhd_source = UHDSourceDummy(modulator=modulator, f=change_status_fun) uhd_source.pre_connect(tb) # Gambi the_source = AWGNChannel(bits_per_symbol=bits_per_symbol, component=uhd_source) algorithm = None if options.sensing == "ed": sensing = EnergySSArch(fft_size=1024, mavg_size=1) algorithm = EnergyDecision(options.th) sink = EnergyDetector(1024, algorithm) elif options.sensing == "wfd": sensing = WaveformSSArch(fft_size=1024) algorithm = WaveformDecision(options.th) sink = WaveformDetector(1024, algorithm) elif options.sensing == "cfd": sensing = CycloSSArch(64, 16, 4) from sensing import CycloDecision algorithm = CycloDecision(64, 16, 4, options.th) sink = CycloDetector(64, 16, 4, algorithm) else: raise AttributeError radio = RadioDevice(name="radio") radio.add_arch(source=the_source, arch=sensing, sink=sink, uhd_device=uhd_source, name="sensing") tb.add_radio(radio, "radio") return tb, radio, algorithm
def device_definition(options): """ Definition of the devices used in the program. @param options """ tb = OpERAFlow(name='US') bits_per_symbol = 2 modulator = grc_blks2.packet_mod_b(digital.ofdm_mod( options=grc_blks2.options( modulation="bpsk", fft_length=512, occupied_tones=200, cp_length=128, pad_for_usrp=True, log=None, verbose=None, ), ), payload_length=0, ) uhd_source = UHDSourceDummy(modulator=modulator) uhd_source.pre_connect(tb) # Gambi the_source = AWGNChannel(component=uhd_source, bits_per_symbol = bits_per_symbol) arch1 = EnergySSArch(fft_size=1024, mavg_size=1) algo1 = EnergyDecision(options.th['ed']) if options.sensing == "wfd": arch2 = WaveformSSArch(fft_size=1024) algo2 = WaveformDecision(options.th['wfd']) elif options.sensing == 'cfd': arch2 = CycloSSArch(64, 16, 4) from sensing import CycloDecision algo2 = CycloDecision(64, 16, 4, options.th['cfd']) else: raise AttributeError hier = HierarchicalSSArch(1024, algo1=algo1, algo2=algo2) radio = RadioDevice(name="radio") radio.add_arch(source=the_source, arch=arch1, sink=(hier, 0), uhd_device=uhd_source, name='ed') radio.add_arch(source=the_source, arch=arch2, sink=(hier, 1), uhd_device=uhd_source, name='sensing') tb.add_radio(radio, "radio") return tb, radio, algo1, algo1
modulator = grc_blks2.packet_mod_b(digital.ofdm_mod( options=grc_blks2.options( modulation="bpsk", fft_length=512, occupied_tones=200, cp_length=128, pad_for_usrp=True, log=None, verbose=None, ), ), payload_length=0, ) src = UHDSourceDummy(modulator=modulator) the_source = AWGNChannel(component=src) from sensing import CycloSSArch from sensing import CycloDecision cyclo_fam = CycloSSArch(Np, P, L) algorithm = CycloDecision(1024, 2, 512, 1) cyclo_sink = CycloDetector(Np, P, L, algorithm) the_source._component.set_active_freqs([1, ]) the_source._component.set_center_freq(0) tb = gr.top_block() src.pre_connect(tb)