Browse Source

added pilot quality block

master
Clemens Richter 9 years ago
parent
commit
4596dbe3f1
  1. 3
      grc/CMakeLists.txt
  2. 72
      grc/multirds_pilot_quality.xml
  3. 3
      python/CMakeLists.txt
  4. 1
      python/__init__.py
  5. 54
      python/pilot_quality.py
  6. 4
      python/rds_parser_table_qt.py
  7. 1346
      python/rds_parser_table_qt.py.bak
  8. 1986
      python/rds_parser_table_qt.sync-conflict-20170315-102705.py

3
grc/CMakeLists.txt

@ -32,5 +32,6 @@ install(FILES
multirds_rds_decoder_redsea.xml
multirds_qtgui_range.xml
multirds_variable_setter.xml
multirds_tmc_parser.xml DESTINATION share/gnuradio/grc/blocks
multirds_tmc_parser.xml
multirds_pilot_quality.xml DESTINATION share/gnuradio/grc/blocks
)

72
grc/multirds_pilot_quality.xml

@ -0,0 +1,72 @@
<?xml version="1.0"?>
<block>
<name>pilot_quality</name>
<key>multirds_pilot_quality</key>
<category>[multirds]</category>
<import>import multirds</import>
<make>multirds.pilot_quality($debug, $samp_rate, $fft_len, $carrier_freq,$gap_width, $msg_adr)</make>
<!-- Make one 'param' node for every Parameter you want settable from the GUI.
Sub-nodes:
* name
* key (makes the value accessible as $keyname, e.g. in the make node)
* type -->
<param>
<name>Debug</name>
<key>debug</key>
<value>False</value>
<type>bool</type>
<option>
<name>Enable</name>
<key>True</key>
</option>
<option>
<name>Disable</name>
<key>False</key>
</option>
</param>
<param>
<name>carrier_freq</name>
<key>carrier_freq</key>
<value>19e3</value>
<type>float</type>
</param>
<param>
<name>gap_width</name>
<key>gap_width</key>
<value>4e3</value>
<type>float</type>
</param>
<param>
<name>samp_rate</name>
<key>samp_rate</key>
<value>240000</value>
<type>int</type>
</param>
<param>
<name>fft_len</name>
<key>fft_len</key>
<value>2048</value>
<type>int</type>
</param>
<param>
<name>msg_adr</name>
<key>msg_adr</key>
<value>3</value>
<type>int</type>
</param>
<!-- Make one 'sink' node per input. Sub-nodes:
* name (an identifier for the GUI)
* type
* vlen
* optional (set to 1 for optional inputs) -->
<sink>
<name>in</name>
<type>float</type>
<vlen>$fft_len</vlen>
</sink>
<source>
<name>out</name>
<type>message</type>
<optional>1</optional>
</source>
</block>

3
python/CMakeLists.txt

@ -44,7 +44,8 @@ GR_PYTHON_INSTALL(
qtgui_range.py
variable_setter.py
tmc_classes.py
tmc_parser.py DESTINATION ${GR_PYTHON_DIR}/multirds
tmc_parser.py
pilot_quality.py DESTINATION ${GR_PYTHON_DIR}/multirds
)
########################################################################

1
python/__init__.py

@ -44,4 +44,5 @@ from decoder_compare import decoder_compare
from qtgui_range import qtgui_range
from variable_setter import variable_setter
from tmc_parser import tmc_parser
from pilot_quality import pilot_quality
#

54
python/pilot_quality.py

@ -0,0 +1,54 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 <+YOU OR YOUR COMPANY+>.
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this software; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
import numpy as np
from gnuradio import gr
import pmt,code
class pilot_quality(gr.sync_block):
"""
docstring for block pilot_quality
"""
def __init__(self, debug,samp_rate,fft_len,carrier_freq,gap_width,msg_adr):
gr.sync_block.__init__(self,
name="pilot_quality",
in_sig=[(np.float32,fft_len)],
out_sig=None)
#self.carrier_width=1
self.debug=debug
self.message_port_register_out(pmt.intern('out'))
self.carrier_index=int(carrier_freq*fft_len/float(samp_rate))
self.lowbound_index=int((carrier_freq-gap_width)*fft_len/float(samp_rate))
self.highbound_index=int((carrier_freq+gap_width)*fft_len/float(samp_rate))
def work(self, input_items, output_items):
in0 = input_items[0]
# <+signal processing here+>
for i,in_vec in enumerate(in0):
surrounding=np.mean(in_vec[self.lowbound_index:self.highbound_index])
carrier=np.mean(in_vec[self.carrier_index-1:self.carrier_index+1])
#code.interact(local=locals())
strength=abs(carrier-surrounding)
if self.debug:
print("strength: %f,carrier: %f, around:%f"%(strength,carrier,surrounding))
return len(input_items[0])

4
python/rds_parser_table_qt.py

@ -260,6 +260,10 @@ class rds_parser_table_qt(gr.sync_block):#START
dots="."*self.RDS_data[PI]["blockcounts"]["any"]
self.RDS_data[PI]["wrong_block_ratio"]=wrong_block_ratio
self.signals.DataUpdateEvent.emit({'PI':PI,'wrong_block_ratio':wrong_block_ratio,'dots':dots})
elif pmt.to_long(pmt.car(msg))==3L: #carrier quality message
data=pmt.to_python(pmt.cdr(msg))
if self.debug:
print(data)
else: #elif pmt.to_long(pmt.car(msg))==0L
array=pmt.to_python(msg)[1]

1346
python/rds_parser_table_qt.py.bak

File diff suppressed because it is too large Load Diff

1986
python/rds_parser_table_qt.sync-conflict-20170315-102705.py

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save