Rev Author Line No. Line
4895 kaklik 1 #!/usr/bin/env python2
2 # -*- coding: utf-8 -*-
3 ##################################################
4 # GNU Radio Python Flow Graph
5 # Title: Acpmeter
6 # Generated: Tue Dec 20 00:13:24 2016
7 ##################################################
8  
9 if __name__ == '__main__':
10 import ctypes
11 import sys
12 if sys.platform.startswith('linux'):
13 try:
14 x11 = ctypes.cdll.LoadLibrary('libX11.so')
15 x11.XInitThreads()
16 except:
17 print "Warning: failed to XInitThreads()"
18  
19 from gnuradio import blocks
20 from gnuradio import eng_notation
21 from gnuradio import gr
22 from gnuradio import wxgui
23 from gnuradio.eng_option import eng_option
24 from gnuradio.filter import firdes
25 from gnuradio.wxgui import scopesink2
26 from grc_gnuradio import blks2 as grc_blks2
27 from grc_gnuradio import wxgui as grc_wxgui
28 from optparse import OptionParser
29 import wx
30  
31  
32 class ACPmeter(grc_wxgui.top_block_gui):
33  
34 def __init__(self):
35 grc_wxgui.top_block_gui.__init__(self, title="Acpmeter")
36 _icon_path = "/usr/local/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
37 self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))
38  
39 ##################################################
40 # Variables
41 ##################################################
42 self.samp_rate = samp_rate = 96000
43  
44 ##################################################
45 # Blocks
46 ##################################################
47 self.wxgui_scopesink2_0 = scopesink2.scope_sink_f(
48 self.GetWin(),
49 title="Scope Plot",
50 sample_rate=samp_rate,
51 v_scale=0,
52 v_offset=0,
53 t_scale=0,
54 ac_couple=True,
55 xy_mode=False,
56 num_inputs=1,
57 trig_mode=wxgui.TRIG_MODE_AUTO,
58 y_axis_label="Power [Watts]",
59 )
60 self.Add(self.wxgui_scopesink2_0.win)
61 self.blocks_multiply_xx_0 = blocks.multiply_vff(1)
62 self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
63 self.blks2_tcp_source_0 = grc_blks2.tcp_source(
64 itemsize=gr.sizeof_gr_complex*1,
65 addr="127.0.0.1",
66 port=3701,
67 server=False,
68 )
69  
70 ##################################################
71 # Connections
72 ##################################################
73 self.connect((self.blks2_tcp_source_0, 0), (self.blocks_complex_to_float_0, 0))
74 self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0, 1))
75 self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_xx_0, 0))
76 self.connect((self.blocks_multiply_xx_0, 0), (self.wxgui_scopesink2_0, 0))
77  
78 def get_samp_rate(self):
79 return self.samp_rate
80  
81 def set_samp_rate(self, samp_rate):
82 self.samp_rate = samp_rate
83 self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate)
84  
85  
86 def main(top_block_cls=ACPmeter, options=None):
87  
88 tb = top_block_cls()
89 tb.Start(True)
90 tb.Wait()
91  
92  
93 if __name__ == '__main__':
94 main()