No changes between revisions
/Designs/Laboratory_instruments/ACPmeter/SW/ACPmeter.py |
---|
0,0 → 1,107 |
#!/usr/bin/env python2 |
# -*- coding: utf-8 -*- |
################################################## |
# GNU Radio Python Flow Graph |
# Title: Acpmeter |
# Generated: Tue Dec 20 08:12:39 2016 |
################################################## |
if __name__ == '__main__': |
import ctypes |
import sys |
if sys.platform.startswith('linux'): |
try: |
x11 = ctypes.cdll.LoadLibrary('libX11.so') |
x11.XInitThreads() |
except: |
print "Warning: failed to XInitThreads()" |
from gnuradio import blocks |
from gnuradio import eng_notation |
from gnuradio import filter |
from gnuradio import gr |
from gnuradio import wxgui |
from gnuradio.eng_option import eng_option |
from gnuradio.filter import firdes |
from gnuradio.wxgui import scopesink2 |
from grc_gnuradio import blks2 as grc_blks2 |
from grc_gnuradio import wxgui as grc_wxgui |
from optparse import OptionParser |
import wx |
class ACPmeter(grc_wxgui.top_block_gui): |
def __init__(self): |
grc_wxgui.top_block_gui.__init__(self, title="Acpmeter") |
_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" |
self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) |
################################################## |
# Variables |
################################################## |
self.samp_rate = samp_rate = 96000 |
################################################## |
# Blocks |
################################################## |
self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( |
self.GetWin(), |
title="Scope Plot", |
sample_rate=9600, |
v_scale=0, |
v_offset=0, |
t_scale=0, |
ac_couple=False, |
xy_mode=False, |
num_inputs=1, |
trig_mode=wxgui.TRIG_MODE_AUTO, |
y_axis_label="Power [Watts]", |
) |
self.Add(self.wxgui_scopesink2_0.win) |
self.fir_filter_xxx_0 = filter.fir_filter_fff(10, (firdes.low_pass(1, samp_rate, 100, 100, firdes.WIN_BLACKMAN_HARRIS))) |
self.fir_filter_xxx_0.declare_sample_delay(0) |
self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) |
self.blocks_rms_xx_0 = blocks.rms_ff(0.1) |
self.blocks_multiply_xx_0 = blocks.multiply_vff(1) |
self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((1, )) |
self.blocks_complex_to_float_0 = blocks.complex_to_float(1) |
self.blocks_abs_xx_0 = blocks.abs_ff(1) |
self.blks2_tcp_source_0 = grc_blks2.tcp_source( |
itemsize=gr.sizeof_gr_complex*1, |
addr="127.0.0.1", |
port=3701, |
server=False, |
) |
################################################## |
# Connections |
################################################## |
self.connect((self.blks2_tcp_source_0, 0), (self.blocks_throttle_0, 0)) |
self.connect((self.blocks_abs_xx_0, 0), (self.blocks_rms_xx_0, 0)) |
self.connect((self.blocks_complex_to_float_0, 0), (self.blocks_multiply_const_vxx_0, 0)) |
self.connect((self.blocks_complex_to_float_0, 1), (self.blocks_multiply_xx_0, 1)) |
self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_multiply_xx_0, 0)) |
self.connect((self.blocks_multiply_xx_0, 0), (self.blocks_abs_xx_0, 0)) |
self.connect((self.blocks_rms_xx_0, 0), (self.fir_filter_xxx_0, 0)) |
self.connect((self.blocks_throttle_0, 0), (self.blocks_complex_to_float_0, 0)) |
self.connect((self.fir_filter_xxx_0, 0), (self.wxgui_scopesink2_0, 0)) |
def get_samp_rate(self): |
return self.samp_rate |
def set_samp_rate(self, samp_rate): |
self.samp_rate = samp_rate |
self.blocks_throttle_0.set_sample_rate(self.samp_rate) |
self.fir_filter_xxx_0.set_taps((firdes.low_pass(1, self.samp_rate, 100, 100, firdes.WIN_BLACKMAN_HARRIS))) |
def main(top_block_cls=ACPmeter, options=None): |
tb = top_block_cls() |
tb.Start(True) |
tb.Wait() |
if __name__ == '__main__': |
main() |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
/Designs/Laboratory_instruments/ACPmeter/SW/Pvalue.grc |
---|
0,0 → 1,660 |
<?xml version='1.0' encoding='utf-8'?> |
<?grc format='1' created='3.7.9'?> |
<flow_graph> |
<timestamp>Mon Dec 19 23:16:51 2016</timestamp> |
<block> |
<key>options</key> |
<param> |
<key>author</key> |
<value></value> |
</param> |
<param> |
<key>window_size</key> |
<value></value> |
</param> |
<param> |
<key>category</key> |
<value>Custom</value> |
</param> |
<param> |
<key>comment</key> |
<value></value> |
</param> |
<param> |
<key>description</key> |
<value></value> |
</param> |
<param> |
<key>_enabled</key> |
<value>True</value> |
</param> |
<param> |
<key>_coordinate</key> |
<value>(8, 8)</value> |
</param> |
<param> |
<key>_rotation</key> |
<value>0</value> |
</param> |
<param> |
<key>generate_options</key> |
<value>wx_gui</value> |
</param> |
<param> |
<key>hier_block_src_path</key> |
<value>.:</value> |
</param> |
<param> |
<key>id</key> |
<value>ACPmeter</value> |
</param> |
<param> |
<key>max_nouts</key> |
<value>0</value> |
</param> |
<param> |
<key>qt_qss_theme</key> |
<value></value> |
</param> |
<param> |
<key>realtime_scheduling</key> |
<value></value> |
</param> |
<param> |
<key>run_command</key> |
<value>{python} -u {filename}</value> |
</param> |
<param> |
<key>run_options</key> |
<value>prompt</value> |
</param> |
<param> |
<key>run</key> |
<value>True</value> |
</param> |
<param> |
<key>thread_safe_setters</key> |
<value></value> |
</param> |
<param> |
<key>title</key> |
<value></value> |
</param> |
</block> |
<block> |
<key>variable</key> |
<param> |
<key>comment</key> |
<value></value> |
</param> |
<param> |
<key>_enabled</key> |
<value>True</value> |
</param> |
<param> |
<key>_coordinate</key> |
<value>(8, 160)</value> |
</param> |
<param> |
<key>_rotation</key> |
<value>0</value> |
</param> |
<param> |
<key>id</key> |
<value>samp_rate</value> |
</param> |
<param> |
<key>value</key> |
<value>96000</value> |
</param> |
</block> |
<block> |
<key>blks2_tcp_source</key> |
<param> |
<key>addr</key> |
<value>127.0.0.1</value> |
</param> |
<param> |
<key>alias</key> |
<value></value> |
</param> |
<param> |
<key>comment</key> |
<value></value> |
</param> |
<param> |
<key>affinity</key> |
<value></value> |
</param> |
<param> |
<key>_enabled</key> |
<value>True</value> |
</param> |
<param> |
<key>_coordinate</key> |
<value>(24, 382)</value> |
</param> |
<param> |
<key>_rotation</key> |
<value>0</value> |
</param> |
<param> |
<key>id</key> |
<value>blks2_tcp_source_0</value> |
</param> |
<param> |
<key>maxoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>minoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>server</key> |
<value>False</value> |
</param> |
<param> |
<key>type</key> |
<value>complex</value> |
</param> |
<param> |
<key>port</key> |
<value>3701</value> |
</param> |
<param> |
<key>vlen</key> |
<value>1</value> |
</param> |
</block> |
<block> |
<key>blocks_abs_xx</key> |
<param> |
<key>alias</key> |
<value></value> |
</param> |
<param> |
<key>comment</key> |
<value></value> |
</param> |
<param> |
<key>affinity</key> |
<value></value> |
</param> |
<param> |
<key>_enabled</key> |
<value>True</value> |
</param> |
<param> |
<key>_coordinate</key> |
<value>(536, 673)</value> |
</param> |
<param> |
<key>_rotation</key> |
<value>0</value> |
</param> |
<param> |
<key>id</key> |
<value>blocks_abs_xx_0</value> |
</param> |
<param> |
<key>type</key> |
<value>float</value> |
</param> |
<param> |
<key>maxoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>minoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>vlen</key> |
<value>1</value> |
</param> |
</block> |
<block> |
<key>blocks_complex_to_float</key> |
<param> |
<key>alias</key> |
<value></value> |
</param> |
<param> |
<key>comment</key> |
<value></value> |
</param> |
<param> |
<key>affinity</key> |
<value></value> |
</param> |
<param> |
<key>_enabled</key> |
<value>True</value> |
</param> |
<param> |
<key>_coordinate</key> |
<value>(112, 561)</value> |
</param> |
<param> |
<key>_rotation</key> |
<value>0</value> |
</param> |
<param> |
<key>id</key> |
<value>blocks_complex_to_float_0</value> |
</param> |
<param> |
<key>maxoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>minoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>vlen</key> |
<value>1</value> |
</param> |
</block> |
<block> |
<key>blocks_multiply_const_vxx</key> |
<param> |
<key>alias</key> |
<value></value> |
</param> |
<param> |
<key>comment</key> |
<value></value> |
</param> |
<param> |
<key>const</key> |
<value>1</value> |
</param> |
<param> |
<key>affinity</key> |
<value></value> |
</param> |
<param> |
<key>_enabled</key> |
<value>True</value> |
</param> |
<param> |
<key>_coordinate</key> |
<value>(336, 556)</value> |
</param> |
<param> |
<key>_rotation</key> |
<value>0</value> |
</param> |
<param> |
<key>id</key> |
<value>blocks_multiply_const_vxx_0</value> |
</param> |
<param> |
<key>type</key> |
<value>float</value> |
</param> |
<param> |
<key>maxoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>minoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>vlen</key> |
<value>1</value> |
</param> |
</block> |
<block> |
<key>blocks_multiply_xx</key> |
<param> |
<key>alias</key> |
<value></value> |
</param> |
<param> |
<key>comment</key> |
<value></value> |
</param> |
<param> |
<key>affinity</key> |
<value></value> |
</param> |
<param> |
<key>_enabled</key> |
<value>True</value> |
</param> |
<param> |
<key>_coordinate</key> |
<value>(416, 889)</value> |
</param> |
<param> |
<key>_rotation</key> |
<value>0</value> |
</param> |
<param> |
<key>id</key> |
<value>blocks_multiply_xx_0</value> |
</param> |
<param> |
<key>type</key> |
<value>float</value> |
</param> |
<param> |
<key>maxoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>minoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>num_inputs</key> |
<value>2</value> |
</param> |
<param> |
<key>vlen</key> |
<value>1</value> |
</param> |
</block> |
<block> |
<key>blocks_rms_xx</key> |
<param> |
<key>alpha</key> |
<value>0.1</value> |
</param> |
<param> |
<key>alias</key> |
<value></value> |
</param> |
<param> |
<key>comment</key> |
<value></value> |
</param> |
<param> |
<key>affinity</key> |
<value></value> |
</param> |
<param> |
<key>_enabled</key> |
<value>True</value> |
</param> |
<param> |
<key>_coordinate</key> |
<value>(616, 580)</value> |
</param> |
<param> |
<key>_rotation</key> |
<value>0</value> |
</param> |
<param> |
<key>id</key> |
<value>blocks_rms_xx_0</value> |
</param> |
<param> |
<key>type</key> |
<value>float</value> |
</param> |
<param> |
<key>maxoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>minoutbuf</key> |
<value>0</value> |
</param> |
</block> |
<block> |
<key>blocks_throttle</key> |
<param> |
<key>alias</key> |
<value></value> |
</param> |
<param> |
<key>comment</key> |
<value></value> |
</param> |
<param> |
<key>affinity</key> |
<value></value> |
</param> |
<param> |
<key>_enabled</key> |
<value>True</value> |
</param> |
<param> |
<key>_coordinate</key> |
<value>(192, 460)</value> |
</param> |
<param> |
<key>_rotation</key> |
<value>0</value> |
</param> |
<param> |
<key>id</key> |
<value>blocks_throttle_0</value> |
</param> |
<param> |
<key>ignoretag</key> |
<value>True</value> |
</param> |
<param> |
<key>maxoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>minoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>samples_per_second</key> |
<value>samp_rate</value> |
</param> |
<param> |
<key>type</key> |
<value>complex</value> |
</param> |
<param> |
<key>vlen</key> |
<value>1</value> |
</param> |
</block> |
<block> |
<key>fir_filter_xxx</key> |
<param> |
<key>alias</key> |
<value></value> |
</param> |
<param> |
<key>comment</key> |
<value></value> |
</param> |
<param> |
<key>affinity</key> |
<value></value> |
</param> |
<param> |
<key>decim</key> |
<value>10</value> |
</param> |
<param> |
<key>_enabled</key> |
<value>True</value> |
</param> |
<param> |
<key>_coordinate</key> |
<value>(752, 661)</value> |
</param> |
<param> |
<key>_rotation</key> |
<value>0</value> |
</param> |
<param> |
<key>id</key> |
<value>fir_filter_xxx_0</value> |
</param> |
<param> |
<key>maxoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>minoutbuf</key> |
<value>0</value> |
</param> |
<param> |
<key>samp_delay</key> |
<value>0</value> |
</param> |
<param> |
<key>taps</key> |
<value>firdes.low_pass(1, samp_rate, 100, 100, firdes.WIN_BLACKMAN_HARRIS)</value> |
</param> |
<param> |
<key>type</key> |
<value>fff</value> |
</param> |
</block> |
<block> |
<key>wxgui_scopesink2</key> |
<param> |
<key>ac_couple</key> |
<value>False</value> |
</param> |
<param> |
<key>alias</key> |
<value></value> |
</param> |
<param> |
<key>comment</key> |
<value></value> |
</param> |
<param> |
<key>affinity</key> |
<value></value> |
</param> |
<param> |
<key>_enabled</key> |
<value>True</value> |
</param> |
<param> |
<key>_coordinate</key> |
<value>(1032, 551)</value> |
</param> |
<param> |
<key>_rotation</key> |
<value>0</value> |
</param> |
<param> |
<key>grid_pos</key> |
<value></value> |
</param> |
<param> |
<key>id</key> |
<value>wxgui_scopesink2_0</value> |
</param> |
<param> |
<key>notebook</key> |
<value></value> |
</param> |
<param> |
<key>num_inputs</key> |
<value>1</value> |
</param> |
<param> |
<key>samp_rate</key> |
<value>9600</value> |
</param> |
<param> |
<key>t_scale</key> |
<value>0</value> |
</param> |
<param> |
<key>title</key> |
<value>Scope Plot</value> |
</param> |
<param> |
<key>trig_mode</key> |
<value>wxgui.TRIG_MODE_AUTO</value> |
</param> |
<param> |
<key>type</key> |
<value>float</value> |
</param> |
<param> |
<key>v_offset</key> |
<value>0</value> |
</param> |
<param> |
<key>v_scale</key> |
<value>0</value> |
</param> |
<param> |
<key>win_size</key> |
<value></value> |
</param> |
<param> |
<key>xy_mode</key> |
<value>False</value> |
</param> |
<param> |
<key>y_axis_label</key> |
<value>Power [Watts]</value> |
</param> |
</block> |
<connection> |
<source_block_id>blks2_tcp_source_0</source_block_id> |
<sink_block_id>blocks_throttle_0</sink_block_id> |
<source_key>0</source_key> |
<sink_key>0</sink_key> |
</connection> |
<connection> |
<source_block_id>blocks_abs_xx_0</source_block_id> |
<sink_block_id>blocks_rms_xx_0</sink_block_id> |
<source_key>0</source_key> |
<sink_key>0</sink_key> |
</connection> |
<connection> |
<source_block_id>blocks_complex_to_float_0</source_block_id> |
<sink_block_id>blocks_multiply_xx_0</sink_block_id> |
<source_key>1</source_key> |
<sink_key>1</sink_key> |
</connection> |
<connection> |
<source_block_id>blocks_complex_to_float_0</source_block_id> |
<sink_block_id>blocks_multiply_const_vxx_0</sink_block_id> |
<source_key>0</source_key> |
<sink_key>0</sink_key> |
</connection> |
<connection> |
<source_block_id>blocks_multiply_const_vxx_0</source_block_id> |
<sink_block_id>blocks_multiply_xx_0</sink_block_id> |
<source_key>0</source_key> |
<sink_key>0</sink_key> |
</connection> |
<connection> |
<source_block_id>blocks_multiply_xx_0</source_block_id> |
<sink_block_id>blocks_abs_xx_0</sink_block_id> |
<source_key>0</source_key> |
<sink_key>0</sink_key> |
</connection> |
<connection> |
<source_block_id>blocks_rms_xx_0</source_block_id> |
<sink_block_id>fir_filter_xxx_0</sink_block_id> |
<source_key>0</source_key> |
<sink_key>0</sink_key> |
</connection> |
<connection> |
<source_block_id>blocks_throttle_0</source_block_id> |
<sink_block_id>blocks_complex_to_float_0</sink_block_id> |
<source_key>0</source_key> |
<sink_key>0</sink_key> |
</connection> |
<connection> |
<source_block_id>fir_filter_xxx_0</source_block_id> |
<sink_block_id>wxgui_scopesink2_0</sink_block_id> |
<source_key>0</source_key> |
<sink_key>0</sink_key> |
</connection> |
</flow_graph> |
/Designs/Laboratory_instruments/ACPmeter/SW/README.txt |
---|
0,0 → 1,13 |
Power measurement and display software. |
Installation |
------------- |
sudo apt install git buffer gnuradio |
Use |
---- |
Run ./start.sh |
/Designs/Laboratory_instruments/ACPmeter/SW/start.sh |
---|
0,0 → 1,15 |
#!/bin/sh |
ulimit -c unlimited |
cd ~/repos/signal-piping-tools |
if ! pidof sdr-widget > /dev/null; then |
{ ./sdr-widget -r 96000 | buffer & } | ./servestream -d -p 3701 |
fi |
if ! pidof -x ACPmeter.py > /dev/null; then |
python ./ACPmeter.py |
fi |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |