def test_002_sets(self): agc = analog.agc_ff(1e-3, 1, 1) agc.set_rate(1) agc.set_reference(1.1) agc.set_gain(1.1) agc.set_max_gain(100) self.assertAlmostEqual(agc.rate(), 1) self.assertAlmostEqual(agc.reference(), 1.1) self.assertAlmostEqual(agc.gain(), 1.1) self.assertAlmostEqual(agc.max_gain(), 100)
def test_002_sets(self): agc = analog.agc_ff(1e-3, 1, 1, 1000) agc.set_rate(1) agc.set_reference(1.1) agc.set_gain(1.1) agc.set_max_gain(100) self.assertAlmostEqual(agc.rate(), 1) self.assertAlmostEqual(agc.reference(), 1.1) self.assertAlmostEqual(agc.gain(), 1.1) self.assertAlmostEqual(agc.max_gain(), 100)
def test_002(self): ''' Test the floating point AGC loop (single rate input) ''' tb = self.tb expected_result = ( 7.2191943445432116e-07, 58.837181091308594, 89.700050354003906, 81.264183044433594, 45.506141662597656, 4.269894304798072e-07, -42.948936462402344, -65.50335693359375, -59.368724822998047, -33.261005401611328, -4.683740257860336e-07, 31.423542022705078, 47.950984954833984, 43.485683441162109, 24.378345489501953, 5.7254135299444897e-07, -23.062990188598633, -35.218441009521484, -31.964075088500977, -17.934831619262695, -5.0591745548445033e-07, 16.998210906982422, 25.982204437255859, 23.606258392333984, 13.260685920715332, 4.9936483037527069e-07, -12.59880542755127, -19.28221321105957, -17.54347038269043, -9.8700437545776367, -4.188150626305287e-07, 9.4074573516845703, 14.422011375427246, 13.145503044128418, 7.41046142578125, 3.8512698097292741e-07, -7.0924453735351562, -10.896408081054688, -9.9552040100097656, -5.6262712478637695, -3.1982864356905338e-07, 5.4131259918212891, 8.3389215469360352, 7.6409502029418945, 4.3320145606994629, 2.882407841298118e-07, -4.194943904876709, -6.4837145805358887, -5.9621825218200684, -3.3931560516357422) sampling_freq = 100 src1 = gr.sig_source_f(sampling_freq, gr.GR_SIN_WAVE, sampling_freq * 0.10, 100.0) dst1 = gr.vector_sink_f() head = gr.head(gr.sizeof_float, int(5 * sampling_freq * 0.10)) agc = analog.agc_ff(1e-3, 1, 1, 1000) tb.connect(src1, head) tb.connect(head, agc) tb.connect(agc, dst1) if test_output == True: tb.connect(agc, gr.file_sink(gr.sizeof_float, "test_agc_ff.dat")) tb.run() dst_data = dst1.data() self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 4)
def test_002(self): ''' Test the floating point AGC loop (single rate input) ''' tb = self.tb expected_result = ( 7.2191943445432116e-07, 58.837181091308594, 89.700050354003906, 81.264183044433594, 45.506141662597656, 4.269894304798072e-07, -42.948936462402344, -65.50335693359375, -59.368724822998047, -33.261005401611328, -4.683740257860336e-07, 31.423542022705078, 47.950984954833984, 43.485683441162109, 24.378345489501953, 5.7254135299444897e-07, -23.062990188598633, -35.218441009521484, -31.964075088500977, -17.934831619262695, -5.0591745548445033e-07, 16.998210906982422, 25.982204437255859, 23.606258392333984, 13.260685920715332, 4.9936483037527069e-07, -12.59880542755127, -19.28221321105957, -17.54347038269043, -9.8700437545776367, -4.188150626305287e-07, 9.4074573516845703, 14.422011375427246, 13.145503044128418, 7.41046142578125, 3.8512698097292741e-07, -7.0924453735351562, -10.896408081054688, -9.9552040100097656, -5.6262712478637695, -3.1982864356905338e-07, 5.4131259918212891, 8.3389215469360352, 7.6409502029418945, 4.3320145606994629, 2.882407841298118e-07, -4.194943904876709, -6.4837145805358887, -5.9621825218200684, -3.3931560516357422) sampling_freq = 100 src1 = analog.sig_source_f(sampling_freq, analog.GR_SIN_WAVE, sampling_freq * 0.10, 100.0) dst1 = blocks.vector_sink_f () head = blocks.head (gr.sizeof_float, int (5*sampling_freq * 0.10)) agc = analog.agc_ff(1e-3, 1, 1) tb.connect (src1, head) tb.connect (head, agc) tb.connect (agc, dst1) tb.run () dst_data = dst1.data () self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 4)