Beispiel #1
0
 def test_002_rx(self):
     nrx, ntx, q = 1, 1, phy.phyglobal.ctrlQ()
     s = "hello"
     q.insert_tail(gr.message_from_string(s) )
     tx = phy.tx(ntx)
     rx = phy.rx(nrx)
     tx.transmit(s)
     x = self.tocomplex(tx.outputQ().delete_head().to_string() )
     
     src = gr.vector_source_c (x)
     self.tb.connect(src, rx)
     self.tb.run()
     self.assertEqual (rx.outputQ().count(), 1)
     m = rx.outputQ().delete_head().to_string()
     self.assertEqual (m, s)
Beispiel #2
0
 def test_001_tx(self):
     ntx, q = 2, phy.phyglobal.ctrlQ()
     s = "hello"
     t = phy.tx(ntx)
     
     G = 100
     Gdb = 20
     t.set_gain_db(Gdb)
     self.assertAlmostEqual(G, t.gain() )
     t.set_gain(G)
     self.assertAlmostEqual(Gdb, t.gain_db() )
     
     t.transmit(s)
     self.assertNotEqual(t.outputQ().count(), q.count() )
     m = t.outputQ().delete_head()
     self.assertAlmostEqual (m.arg1(), ntx)
     s = m.to_string()
     x = self.tocomplex(s)
     self.assertAlmostEqual (len(x), m.arg1()*m.arg2() )