def test_sine(self, param): """this function run the defined test, for easier understanding""" tb = self.tb data_signal_search = namedtuple('data_signal_search', 'src out tags') amplitude = 1 offset = 0 Average = False src_sine = analog.sig_source_c(param.samp_rate, analog.GR_COS_WAVE, param.freq, amplitude, offset) src_noise = analog.noise_source_c(analog.GR_GAUSSIAN, param.noise, offset) adder = blocks.add_vcc(1) throttle = blocks.throttle(gr.sizeof_gr_complex * 1, param.samp_rate, True) head = blocks.head(gr.sizeof_gr_complex, int(param.items)) head2 = blocks.head(gr.sizeof_gr_complex, int(1)) dst_source = blocks.vector_sink_c() dst_out = blocks.vector_sink_c() null = blocks.null_sink(gr.sizeof_gr_complex * 1) ecss_signal_search_fft_v = ecss.signal_search_fft_v( True, param.fft_size, param.decimation, Average, firdes.WIN_BLACKMAN_hARRIS, param.f_central, param.bw, param.average, param.threshold, param.samp_rate) blocks_stream_to_vector = blocks.stream_to_vector( gr.sizeof_gr_complex * 1, param.fft_size * param.decimation) blocks_vector_to_stream = blocks.vector_to_stream( gr.sizeof_gr_complex * 1, param.fft_size * param.decimation) agc = ecss.agc(10, 1, 1, 65536, param.samp_rate) # ecss_signal_search_fft_v = ecss.signal_search_fft_v(param.fft_size, param.decimation, Average, firdes.WIN_BLACKMAN_hARRIS, param.f_central, param.bw, param.average, param.threshold, param.samp_rate) # blocks_stream_to_vector = blocks.stream_to_vector(gr.sizeof_gr_complex*1, param.fft_size * param.decimation) # blocks_vector_to_stream = blocks.vector_to_stream(gr.sizeof_gr_complex*1, param.fft_size * param.decimation) tb.connect(src_sine, (adder, 0)) tb.connect(src_noise, (adder, 1)) tb.connect(adder, throttle) tb.connect(throttle, head) tb.connect(head, agc) tb.connect(agc, dst_source) tb.connect(agc, blocks_stream_to_vector) tb.connect(blocks_stream_to_vector, ecss_signal_search_fft_v) tb.connect(ecss_signal_search_fft_v, blocks_vector_to_stream) tb.connect(blocks_vector_to_stream, dst_out) # throttle.set_max_noutput_items (param.samp_rate) # throttle.set_min_noutput_items (param.samp_rate) self.tb.run() data_signal_search.src = dst_source.data() data_signal_search.out = dst_out.data() data_signal_search.tags = dst_out.tags() return data_signal_search
def test_sine(self, param): """this function run the defined test, for easier understanding""" tb = self.tb data_agc = namedtuple('data_agc', 'src out') src_sine = analog.sig_source_c(param.samp_rate, analog.GR_SIN_WAVE, param.freq_sine, 1) src_square = analog.sig_source_f( param.samp_rate, analog.GR_SQR_WAVE, param.freq_square, ((param.input_amplitude_max - param.input_amplitude_min) / math.sqrt(2)), (param.input_amplitude_min / math.sqrt(2))) src_noise = analog.noise_source_c(analog.GR_GAUSSIAN, param.noise, 0) adder = blocks.add_vcc(1) multiply_const = blocks.multiply_const_ff(-1) multiply_complex = blocks.multiply_cc() dst_agc = blocks.vector_sink_c() dst_source = blocks.vector_sink_c() float_to_complex = blocks.float_to_complex() head = blocks.head(gr.sizeof_gr_complex, int(param.N)) agc = ecss.agc(param.settling_time, param.reference, 1.0, 65536.0, param.samp_rate) tb.connect(src_square, (float_to_complex, 0)) tb.connect(src_square, multiply_const) tb.connect(multiply_const, (float_to_complex, 1)) tb.connect(src_sine, (adder, 0)) tb.connect(src_noise, (adder, 1)) tb.connect(adder, (multiply_complex, 0)) tb.connect(float_to_complex, (multiply_complex, 1)) tb.connect(multiply_complex, head) tb.connect(head, agc) tb.connect(agc, dst_agc) tb.connect(head, dst_source) self.tb.run() data_agc.src = dst_source.data() data_agc.out = dst_agc.data() return data_agc