def test_006(self): ''' Test the complex AGC loop (attack and decay rate inputs) ''' tb = self.tb sampling_freq = 100 N = int(5 * sampling_freq) src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE, sampling_freq * 0.10, 100) dst1 = blocks.vector_sink_c() head = blocks.head(gr.sizeof_gr_complex, N) ref = 1 agc = analog.agc3_cc(1e-2, 1e-3, ref) tb.connect(src1, head) tb.connect(head, agc) tb.connect(agc, dst1) tb.run() dst_data = dst1.data() M = 100 result = map(lambda x: abs(x), dst_data[N - M:]) self.assertFloatTuplesAlmostEqual(result, M * [ ref, ], 4)
def test_006_sets(self): agc = analog.agc3_cc(1e-3, 1e-1, 1) agc.set_attack_rate(1) agc.set_decay_rate(2) agc.set_reference(1.1) agc.set_gain(1.1) self.assertAlmostEqual(agc.attack_rate(), 1) self.assertAlmostEqual(agc.decay_rate(), 2) self.assertAlmostEqual(agc.reference(), 1.1) self.assertAlmostEqual(agc.gain(), 1.1)
def test_006(self): ''' Test the complex AGC loop (attack and decay rate inputs) ''' tb = self.tb sampling_freq = 100 N = int(5*sampling_freq) src1 = analog.sig_source_c(sampling_freq, analog.GR_SIN_WAVE, sampling_freq * 0.10, 100) dst1 = blocks.vector_sink_c() head = blocks.head(gr.sizeof_gr_complex, N) ref = 1 agc = analog.agc3_cc(1e-2, 1e-3, ref) tb.connect(src1, head) tb.connect(head, agc) tb.connect(agc, dst1) tb.run() dst_data = dst1.data() M = 100 result = map(lambda x: abs(x), dst_data[N-M:]) self.assertFloatTuplesAlmostEqual(result, M*[ref,], 4)