8 changed files with 135 additions and 3334 deletions
@ -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> |
||||
@ -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]) |
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue