Added more pilot symbols for precision frequency estimation

This adds 4 pilot symbols each after 128 and 256 data symbols. These are
used for precision frequency estimation and feed-forward correction,
resulting in less decoder errors at the end of the packet.

Due to this change, this system can no longer transmit packets shorter
than 64 bytes!
This commit is contained in:
Thomas Kolb 2019-09-13 23:10:23 +02:00
parent 69a497ccf8
commit 85ce667d7b
18 changed files with 903 additions and 20 deletions

View file

@ -24,5 +24,7 @@ install(FILES
hamnet70_pid_controller.xml hamnet70_pid_controller.xml
hamnet70_insert_delayed_tag.xml hamnet70_insert_delayed_tag.xml
hamnet70_scrambler.xml hamnet70_scrambler.xml
hamnet70_async_scrambler.xml DESTINATION share/gnuradio/grc/blocks hamnet70_async_scrambler.xml
hamnet70_insert_pilot_symbols.xml
hamnet70_correct_frequency_from_pilot_syms.xml DESTINATION share/gnuradio/grc/blocks
) )

View file

@ -0,0 +1,38 @@
<?xml version="1.0"?>
<block>
<name>Correct Frequency from Pilot Symbols</name>
<key>hamnet70_correct_frequency_from_pilot_syms</key>
<category>[hamnet70]</category>
<import>import hamnet70</import>
<make>hamnet70.correct_frequency_from_pilot_syms($pilot_sequence, $offsets, $phase_ref_offset, $start_tag)</make>
<param>
<name>Pilot Sequence</name>
<key>pilot_sequence</key>
<type>complex_vector</type>
</param>
<param>
<name>Insertion Positions</name>
<key>offsets</key>
<type>int_vector</type>
</param>
<param>
<name>Phase Reference Index</name>
<key>phase_ref_offset</key>
<type>int</type>
<!--value>0</value-->
</param>
<param>
<name>Start Tag Key</name>
<key>start_tag</key>
<type>string</type>
<!--value>corr_est</value-->
</param>
<sink>
<name>in</name>
<type>complex</type>
</sink>
<source>
<name>out</name>
<type>complex</type>
</source>
</block>

View file

@ -0,0 +1,32 @@
<?xml version="1.0"?>
<block>
<name>Insert Pilot Symbols</name>
<key>hamnet70_insert_pilot_symbols</key>
<category>[hamnet70]</category>
<import>import hamnet70</import>
<make>hamnet70.insert_pilot_symbols($pilot_sequence, $offsets, $length_tag)</make>
<param>
<name>Pilot Sequence</name>
<key>pilot_sequence</key>
<type>complex_vector</type>
</param>
<param>
<name>Insertion Positions</name>
<key>offsets</key>
<type>int_vector</type>
</param>
<param>
<name>Length Tag Key</name>
<key>length_tag</key>
<type>string</type>
<!--value>packet_len</value-->
</param>
<sink>
<name>in</name>
<type>complex</type>
</sink>
<source>
<name>out</name>
<type>complex</type>
</source>
</block>

View file

@ -29,5 +29,7 @@ install(FILES
pid_controller.h pid_controller.h
insert_delayed_tag.h insert_delayed_tag.h
scrambler.h scrambler.h
async_scrambler.h DESTINATION include/hamnet70 async_scrambler.h
insert_pilot_symbols.h
correct_frequency_from_pilot_syms.h DESTINATION include/hamnet70
) )

View file

@ -0,0 +1,56 @@
/* -*- c++ -*- */
/*
* Copyright 2019 Thomas Kolb.
*
* 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.
*/
#ifndef INCLUDED_HAMNET70_CORRECT_FREQUENCY_FROM_PILOT_SYMS_H
#define INCLUDED_HAMNET70_CORRECT_FREQUENCY_FROM_PILOT_SYMS_H
#include <hamnet70/api.h>
#include <gnuradio/block.h>
namespace gr {
namespace hamnet70 {
/*!
* \brief <+description of block+>
* \ingroup hamnet70
*
*/
class HAMNET70_API correct_frequency_from_pilot_syms : virtual public gr::block
{
public:
typedef boost::shared_ptr<correct_frequency_from_pilot_syms> sptr;
/*!
* \brief Return a shared_ptr to a new instance of hamnet70::correct_frequency_from_pilot_syms.
*
* To avoid accidental use of raw pointers, hamnet70::correct_frequency_from_pilot_syms's
* constructor is in a private implementation
* class. hamnet70::correct_frequency_from_pilot_syms::make is the public interface for
* creating new instances.
*/
static sptr make(const std::vector<gr_complex> &pilot_sequence, const std::vector<size_t> &offsets, size_t phase_ref_offset = 0, const std::string &start_tag = "corr_est");
};
} // namespace hamnet70
} // namespace gr
#endif /* INCLUDED_HAMNET70_CORRECT_FREQUENCY_FROM_PILOT_SYMS_H */

View file

@ -0,0 +1,56 @@
/* -*- c++ -*- */
/*
* Copyright 2019 Thomas Kolb.
*
* 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.
*/
#ifndef INCLUDED_HAMNET70_INSERT_PILOT_SYMBOLS_H
#define INCLUDED_HAMNET70_INSERT_PILOT_SYMBOLS_H
#include <hamnet70/api.h>
#include <gnuradio/tagged_stream_block.h>
namespace gr {
namespace hamnet70 {
/*!
* \brief <+description of block+>
* \ingroup hamnet70
*
*/
class HAMNET70_API insert_pilot_symbols : virtual public gr::tagged_stream_block
{
public:
typedef boost::shared_ptr<insert_pilot_symbols> sptr;
/*!
* \brief Return a shared_ptr to a new instance of hamnet70::insert_pilot_symbols.
*
* To avoid accidental use of raw pointers, hamnet70::insert_pilot_symbols's
* constructor is in a private implementation
* class. hamnet70::insert_pilot_symbols::make is the public interface for
* creating new instances.
*/
static sptr make(const std::vector<gr_complex> &pilot_sequence, const std::vector<size_t> &offsets, const std::string &length_tag);
};
} // namespace hamnet70
} // namespace gr
#endif /* INCLUDED_HAMNET70_INSERT_PILOT_SYMBOLS_H */

View file

@ -33,6 +33,8 @@ list(APPEND hamnet70_sources
insert_delayed_tag_impl.cc insert_delayed_tag_impl.cc
scrambler_impl.cc scrambler_impl.cc
async_scrambler_impl.cc async_scrambler_impl.cc
insert_pilot_symbols_impl.cc
correct_frequency_from_pilot_syms_impl.cc
) )
set(hamnet70_sources "${hamnet70_sources}" PARENT_SCOPE) set(hamnet70_sources "${hamnet70_sources}" PARENT_SCOPE)

View file

@ -0,0 +1,210 @@
/* -*- c++ -*- */
/*
* Copyright 2019 Thomas Kolb.
*
* 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <algorithm>
#include <gnuradio/io_signature.h>
#include <gnuradio/expj.h>
#include <gnuradio/math.h>
#include "correct_frequency_from_pilot_syms_impl.h"
namespace gr {
namespace hamnet70 {
correct_frequency_from_pilot_syms::sptr
correct_frequency_from_pilot_syms::make(const std::vector<gr_complex> &pilot_sequence, const std::vector<size_t> &offsets, size_t phase_ref_offset, const std::string &start_tag)
{
return gnuradio::get_initial_sptr
(new correct_frequency_from_pilot_syms_impl(pilot_sequence, offsets, phase_ref_offset, start_tag));
}
/*
* The private constructor
*/
correct_frequency_from_pilot_syms_impl::correct_frequency_from_pilot_syms_impl(const std::vector<gr_complex> &pilot_sequence, const std::vector<size_t> &offsets, size_t phase_ref_offset, const std::string &start_tag)
: gr::block("correct_frequency_from_pilot_syms",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(gr_complex))),
d_pilot_sequence(pilot_sequence),
d_offsets(offsets),
d_phase_ref_offset(phase_ref_offset),
d_start_tag(pmt::intern(start_tag)),
d_items_required(*std::max_element(offsets.begin(), offsets.end()) + pilot_sequence.size()),
d_tag_found(false),
d_phase_inc_per_symbol(0.0f),
d_current_phase(0.0f)
{
set_tag_propagation_policy(TPP_CUSTOM);
}
/*
* Our virtual destructor.
*/
correct_frequency_from_pilot_syms_impl::~correct_frequency_from_pilot_syms_impl()
{
}
void
correct_frequency_from_pilot_syms_impl::forecast (int noutput_items, gr_vector_int &ninput_items_required)
{
ninput_items_required[0] = noutput_items + d_pilot_sequence.size() * d_offsets.size();
}
int
correct_frequency_from_pilot_syms_impl::general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const gr_complex *in = (const gr_complex *) input_items[0];
gr_complex *out = (gr_complex *) output_items[0];
int consumed = 0, produced = 0;
std::vector<tag_t> tags;
get_tags_in_window(tags, 0, 0, ninput_items[0], d_start_tag);
size_t tagidx = 0;
for(int i = 0; i < ninput_items[0]; i++) {
if((tagidx < tags.size()) && (tags[tagidx].offset == nitems_read(0) + i)) {
d_packet.clear();
d_tags_in_packet.clear();
d_tag_found = true;
tagidx++;
}
if(!d_tag_found) {
// tag propagation
std::vector<tag_t> prop_tags;
get_tags_in_window(prop_tags, 0, consumed, consumed+1);
for(tag_t &tag: prop_tags) {
tag.offset = nitems_written(0) + produced;
add_item_tag(0, tag);
}
// calculate sample
d_current_phase += d_phase_inc_per_symbol;
out[produced++] = in[consumed++] * gr_expj(d_current_phase);
} else if(d_tag_found && d_packet.size() < d_items_required) {
// get and store tags for later insertion in the output stream
std::vector<tag_t> prop_tags;
get_tags_in_window(prop_tags, 0, consumed, consumed+1);
for(tag_t &tag: prop_tags) {
tag.offset = d_packet.size();
d_tags_in_packet.push_back(tag);
}
d_packet.push_back(in[consumed++]);
} else if(d_packet.size() == d_items_required) {
// frequency estimation
float phase_sum = 0.0f;
size_t last_off = d_phase_ref_offset;
float last_phase = 0.0f;
for(size_t off: d_offsets) {
gr_complex sum(0, 0);
size_t n = 0;
for(const gr_complex &ref_sym: d_pilot_sequence) {
sum += d_packet[off+n] * conj(ref_sym);
n++;
}
sum /= n;
float phase = gr::fast_atan2f(sum); // FIXME? unwrap
phase_sum += (phase - last_phase) / (off - last_off);
last_phase = phase;
last_off = off;
}
d_phase_inc_per_symbol = -phase_sum / d_offsets.size();
d_current_phase = (-(int)d_phase_ref_offset - 1) * d_phase_inc_per_symbol;
//std::cout << "initial phase: " << d_current_phase << std::endl;
//std::cout << "phase increment: " << d_phase_inc_per_symbol << std::endl;
size_t drop_start = 1;
size_t drop_end = 0;
size_t next_off_idx = 0;
//std::cout << "packet = [";
std::vector<tag_t>::iterator tag_iter = d_tags_in_packet.begin();
for(size_t i = 0; i < d_packet.size(); i++) {
d_current_phase += d_phase_inc_per_symbol;
if(i == drop_end) {
if(next_off_idx >= d_offsets.size()) {
drop_end = drop_start = d_packet.size(); // index cannot be reached
} else {
drop_start = d_offsets[next_off_idx];
drop_end = d_offsets[next_off_idx] + d_pilot_sequence.size();
next_off_idx++;
}
}
if(i >= drop_start) {
continue;
}
// restore tags
while(tag_iter != d_tags_in_packet.end() &&
tag_iter->offset <= i) {
tag_iter->offset = nitems_written(0) + produced;
add_item_tag(0, *tag_iter);
tag_iter++;
}
gr_complex &item = d_packet[i];
out[produced++] = item * gr_expj(d_current_phase);
gr_complex &c = out[produced-1];
//std::cout << c.real() << "+" << c.imag() << "j, ";
}
//std::cout << "]" << std::endl;
d_tag_found = false;
}
}
// Tell runtime system how many input items we consumed on
// each input stream.
consume_each (consumed);
// Tell runtime system how many output items we produced.
return produced;
}
} /* namespace hamnet70 */
} /* namespace gr */

View file

@ -0,0 +1,65 @@
/* -*- c++ -*- */
/*
* Copyright 2019 Thomas Kolb.
*
* 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.
*/
#ifndef INCLUDED_HAMNET70_CORRECT_FREQUENCY_FROM_PILOT_SYMS_IMPL_H
#define INCLUDED_HAMNET70_CORRECT_FREQUENCY_FROM_PILOT_SYMS_IMPL_H
#include <hamnet70/correct_frequency_from_pilot_syms.h>
#include <map>
namespace gr {
namespace hamnet70 {
class correct_frequency_from_pilot_syms_impl : public correct_frequency_from_pilot_syms
{
private:
std::vector<size_t> d_offsets;
std::vector<gr_complex> d_pilot_sequence;
size_t d_phase_ref_offset;
pmt::pmt_t d_start_tag;
std::vector<tag_t> d_tags_in_packet;
std::vector<gr_complex> d_packet;
size_t d_items_required;
bool d_tag_found;
float d_phase_inc_per_symbol;
float d_current_phase;
public:
correct_frequency_from_pilot_syms_impl(const std::vector<gr_complex> &pilot_sequence, const std::vector<size_t> &offsets, size_t phase_ref_offset, const std::string &start_tag);
~correct_frequency_from_pilot_syms_impl();
// Where all the action really happens
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
int general_work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
} // namespace hamnet70
} // namespace gr
#endif /* INCLUDED_HAMNET70_CORRECT_FREQUENCY_FROM_PILOT_SYMS_IMPL_H */

View file

@ -0,0 +1,107 @@
/* -*- c++ -*- */
/*
* Copyright 2019 Thomas Kolb.
*
* 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gnuradio/io_signature.h>
#include "insert_pilot_symbols_impl.h"
namespace gr {
namespace hamnet70 {
insert_pilot_symbols::sptr
insert_pilot_symbols::make(const std::vector<gr_complex> &pilot_sequence, const std::vector<size_t> &offsets, const std::string &length_tag)
{
return gnuradio::get_initial_sptr
(new insert_pilot_symbols_impl(pilot_sequence, offsets, length_tag));
}
/*
* The private constructor
*/
insert_pilot_symbols_impl::insert_pilot_symbols_impl(const std::vector<gr_complex> &pilot_sequence, const std::vector<size_t> &offsets, const std::string &length_tag)
: gr::tagged_stream_block("insert_pilot_symbols",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(gr_complex)), length_tag),
d_pilot_sequence(pilot_sequence),
d_offsets(offsets)
{}
/*
* Our virtual destructor.
*/
insert_pilot_symbols_impl::~insert_pilot_symbols_impl()
{
}
int
insert_pilot_symbols_impl::calculate_output_stream_length(const gr_vector_int &ninput_items)
{
int noutput_items = ninput_items[0] + d_pilot_sequence.size() * d_offsets.size();
return noutput_items ;
}
int
insert_pilot_symbols_impl::work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const gr_complex *in = (const gr_complex *) input_items[0];
gr_complex *out = (gr_complex *) output_items[0];
size_t in_pos = 0;
size_t out_pos = 0;
size_t offset_idx = 0;
size_t cur_offset = d_offsets[0];
while(in_pos < ninput_items[0] && out_pos < noutput_items) {
if(in_pos == cur_offset) {
// insert preamble before cur_offset
for(const gr_complex &v : d_pilot_sequence) {
out[out_pos++] = v;
}
offset_idx++;
if(offset_idx >= d_offsets.size()) {
// end of list reached => set to 0, which will never be valid
// again for this packet
cur_offset = 0;
} else {
cur_offset = d_offsets[offset_idx];
}
}
// copy input packet symbol
out[out_pos] = in[in_pos];
out_pos++;
in_pos++;
}
// Tell runtime system how many output items we produced.
return out_pos;
}
} /* namespace hamnet70 */
} /* namespace gr */

View file

@ -0,0 +1,53 @@
/* -*- c++ -*- */
/*
* Copyright 2019 Thomas Kolb.
*
* 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.
*/
#ifndef INCLUDED_HAMNET70_INSERT_PILOT_SYMBOLS_IMPL_H
#define INCLUDED_HAMNET70_INSERT_PILOT_SYMBOLS_IMPL_H
#include <hamnet70/insert_pilot_symbols.h>
namespace gr {
namespace hamnet70 {
class insert_pilot_symbols_impl : public insert_pilot_symbols
{
private:
std::vector<size_t> d_offsets;
std::vector<gr_complex> d_pilot_sequence;
protected:
int calculate_output_stream_length(const gr_vector_int &ninput_items);
public:
insert_pilot_symbols_impl(const std::vector<gr_complex> &pilot_sequence, const std::vector<size_t> &offsets, const std::string &length_tag);
~insert_pilot_symbols_impl();
// Where all the action really happens
int work(int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
} // namespace hamnet70
} // namespace gr
#endif /* INCLUDED_HAMNET70_INSERT_PILOT_SYMBOLS_IMPL_H */

View file

@ -49,3 +49,5 @@ set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig)
#GR_ADD_TEST(qa_insert_delayed_tag ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_insert_delayed_tag.py) #GR_ADD_TEST(qa_insert_delayed_tag ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_insert_delayed_tag.py)
#GR_ADD_TEST(qa_scrambler ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_scrambler.py) #GR_ADD_TEST(qa_scrambler ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_scrambler.py)
#GR_ADD_TEST(qa_async_scrambler ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_async_scrambler.py) #GR_ADD_TEST(qa_async_scrambler ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_async_scrambler.py)
#GR_ADD_TEST(qa_insert_pilot_symbols ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_insert_pilot_symbols.py)
#GR_ADD_TEST(qa_correct_frequency_from_pilot_syms ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_correct_frequency_from_pilot_syms.py)

View file

@ -0,0 +1,41 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 Thomas Kolb.
#
# 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.
#
from gnuradio import gr, gr_unittest
from gnuradio import blocks
import hamnet70_swig as hamnet70
class qa_correct_frequency_from_pilot_syms (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
def tearDown (self):
self.tb = None
def test_001_t (self):
# set up fg
self.tb.run ()
# check data
if __name__ == '__main__':
gr_unittest.run(qa_correct_frequency_from_pilot_syms, "qa_correct_frequency_from_pilot_syms.xml")

View file

@ -0,0 +1,41 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 Thomas Kolb.
#
# 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.
#
from gnuradio import gr, gr_unittest
from gnuradio import blocks
import hamnet70_swig as hamnet70
class qa_insert_pilot_symbols (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
def tearDown (self):
self.tb = None
def test_001_t (self):
# set up fg
self.tb.run ()
# check data
if __name__ == '__main__':
gr_unittest.run(qa_insert_pilot_symbols, "qa_insert_pilot_symbols.xml")

View file

@ -15,6 +15,8 @@
#include "hamnet70/insert_delayed_tag.h" #include "hamnet70/insert_delayed_tag.h"
#include "hamnet70/scrambler.h" #include "hamnet70/scrambler.h"
#include "hamnet70/async_scrambler.h" #include "hamnet70/async_scrambler.h"
#include "hamnet70/insert_pilot_symbols.h"
#include "hamnet70/correct_frequency_from_pilot_syms.h"
%} %}
@ -33,3 +35,7 @@ GR_SWIG_BLOCK_MAGIC2(hamnet70, insert_delayed_tag);
GR_SWIG_BLOCK_MAGIC2(hamnet70, scrambler); GR_SWIG_BLOCK_MAGIC2(hamnet70, scrambler);
%include "hamnet70/async_scrambler.h" %include "hamnet70/async_scrambler.h"
GR_SWIG_BLOCK_MAGIC2(hamnet70, async_scrambler); GR_SWIG_BLOCK_MAGIC2(hamnet70, async_scrambler);
%include "hamnet70/insert_pilot_symbols.h"
GR_SWIG_BLOCK_MAGIC2(hamnet70, insert_pilot_symbols);
%include "hamnet70/correct_frequency_from_pilot_syms.h"
GR_SWIG_BLOCK_MAGIC2(hamnet70, correct_frequency_from_pilot_syms);

View file

@ -585,7 +585,7 @@
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
<value>(1269, 387)</value> <value>(1525, 387)</value>
</param> </param>
<param> <param>
<key>_rotation</key> <key>_rotation</key>
@ -1543,7 +1543,7 @@
</param> </param>
<param> <param>
<key>threshold</key> <key>threshold</key>
<value>0.997</value> <value>0.999</value>
</param> </param>
</block> </block>
<block> <block>
@ -1896,6 +1896,61 @@
<value>0xFF</value> <value>0xFF</value>
</param> </param>
</block> </block>
<block>
<key>hamnet70_correct_frequency_from_pilot_syms</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>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(1254, 387)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>hamnet70_correct_frequency_from_pilot_syms_0</value>
</param>
<param>
<key>offsets</key>
<value>[len(preamble)+128, len(preamble)+256+4]</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>phase_ref_offset</key>
<value>len(preamble)/2</value>
</param>
<param>
<key>pilot_sequence</key>
<value>[1+1j, -1-1j, 1-1j, -1+1j]</value>
</param>
<param>
<key>start_tag</key>
<value>corr_est</value>
</param>
</block>
<block> <block>
<key>hamnet70_correct_phase_from_tag</key> <key>hamnet70_correct_phase_from_tag</key>
<param> <param>
@ -2182,7 +2237,7 @@
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
<value>(1525, 467)</value> <value>(1725, 467)</value>
</param> </param>
<param> <param>
<key>_rotation</key> <key>_rotation</key>
@ -2249,7 +2304,7 @@
</param> </param>
<param> <param>
<key>optional</key> <key>optional</key>
<value>False</value> <value>True</value>
</param> </param>
<param> <param>
<key>vlen</key> <key>vlen</key>
@ -2444,7 +2499,7 @@
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
<value>(1525, 411)</value> <value>(1725, 411)</value>
</param> </param>
<param> <param>
<key>_rotation</key> <key>_rotation</key>
@ -2685,11 +2740,17 @@
<sink_key>in</sink_key> <sink_key>in</sink_key>
</connection> </connection>
<connection> <connection>
<source_block_id>hamnet70_correct_phase_from_tag_0</source_block_id> <source_block_id>hamnet70_correct_frequency_from_pilot_syms_0</source_block_id>
<sink_block_id>analog_agc_xx_0</sink_block_id> <sink_block_id>analog_agc_xx_0</sink_block_id>
<source_key>0</source_key> <source_key>0</source_key>
<sink_key>0</sink_key> <sink_key>0</sink_key>
</connection> </connection>
<connection>
<source_block_id>hamnet70_correct_phase_from_tag_0</source_block_id>
<sink_block_id>hamnet70_correct_frequency_from_pilot_syms_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection> <connection>
<source_block_id>hamnet70_freq_est_lr_0</source_block_id> <source_block_id>hamnet70_freq_est_lr_0</source_block_id>
<sink_block_id>hamnet70_pid_controller_0</sink_block_id> <sink_block_id>hamnet70_pid_controller_0</sink_block_id>

View file

@ -1132,11 +1132,11 @@
</param> </param>
<param> <param>
<key>_enabled</key> <key>_enabled</key>
<value>2</value> <value>1</value>
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
<value>(1980, 443)</value> <value>(1980, 435)</value>
</param> </param>
<param> <param>
<key>_rotation</key> <key>_rotation</key>
@ -1150,6 +1150,10 @@
<key>offsets</key> <key>offsets</key>
<value>[len(preamble)+128, len(preamble)+256]</value> <value>[len(preamble)+128, len(preamble)+256]</value>
</param> </param>
<param>
<key>length_tag</key>
<value>packet_len</value>
</param>
<param> <param>
<key>maxoutbuf</key> <key>maxoutbuf</key>
<value>0</value> <value>0</value>

View file

@ -105,7 +105,7 @@
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
<value>(957, 394)</value> <value>(974, 51)</value>
</param> </param>
<param> <param>
<key>gui_hint</key> <key>gui_hint</key>
@ -168,7 +168,7 @@
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
<value>(837, 394)</value> <value>(854, 51)</value>
</param> </param>
<param> <param>
<key>gui_hint</key> <key>gui_hint</key>
@ -258,7 +258,7 @@
</param> </param>
<param> <param>
<key>_enabled</key> <key>_enabled</key>
<value>True</value> <value>1</value>
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
@ -1355,6 +1355,105 @@
<value>firdes.WIN_BLACKMAN_hARRIS</value> <value>firdes.WIN_BLACKMAN_hARRIS</value>
</param> </param>
</block> </block>
<block>
<key>qtgui_sink_x</key>
<param>
<key>bw</key>
<value>samp_rate/2</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>fc</key>
<value>0</value>
</param>
<param>
<key>freqchangevar</key>
<value>None</value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>0</value>
</param>
<param>
<key>fftsize</key>
<value>8192</value>
</param>
<param>
<key>_coordinate</key>
<value>(694, 554)</value>
</param>
<param>
<key>gui_hint</key>
<value></value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>qtgui_sink_x_1</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>name</key>
<value>"Synced Symbols"</value>
</param>
<param>
<key>plotconst</key>
<value>True</value>
</param>
<param>
<key>plotfreq</key>
<value>True</value>
</param>
<param>
<key>plottime</key>
<value>True</value>
</param>
<param>
<key>plotwaterfall</key>
<value>True</value>
</param>
<param>
<key>showports</key>
<value>True</value>
</param>
<param>
<key>showrf</key>
<value>False</value>
</param>
<param>
<key>type</key>
<value>complex</value>
</param>
<param>
<key>rate</key>
<value>1</value>
</param>
<param>
<key>wintype</key>
<value>firdes.WIN_BLACKMAN_hARRIS</value>
</param>
</block>
<block> <block>
<key>qtgui_time_sink_x</key> <key>qtgui_time_sink_x</key>
<param> <param>
@ -1391,7 +1490,7 @@
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
<value>(710, 562)</value> <value>(870, 487)</value>
</param> </param>
<param> <param>
<key>gui_hint</key> <key>gui_hint</key>
@ -1655,7 +1754,7 @@
</param> </param>
<param> <param>
<key>name</key> <key>name</key>
<value>""</value> <value>"Synced"</value>
</param> </param>
<param> <param>
<key>nconnections</key> <key>nconnections</key>
@ -1663,11 +1762,11 @@
</param> </param>
<param> <param>
<key>size</key> <key>size</key>
<value>1024</value> <value>8192</value>
</param> </param>
<param> <param>
<key>srate</key> <key>srate</key>
<value>samp_rate</value> <value>samp_rate/2</value>
</param> </param>
<param> <param>
<key>stemplot</key> <key>stemplot</key>
@ -1695,7 +1794,7 @@
</param> </param>
<param> <param>
<key>tr_tag</key> <key>tr_tag</key>
<value>"corr_est"</value> <value>"corr_start"</value>
</param> </param>
<param> <param>
<key>type</key> <key>type</key>
@ -1703,7 +1802,7 @@
</param> </param>
<param> <param>
<key>update_time</key> <key>update_time</key>
<value>0.10</value> <value>1</value>
</param> </param>
<param> <param>
<key>ylabel</key> <key>ylabel</key>
@ -1754,7 +1853,7 @@
</param> </param>
<param> <param>
<key>_enabled</key> <key>_enabled</key>
<value>True</value> <value>1</value>
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
@ -2155,6 +2254,12 @@
<source_key>pdu_out</source_key> <source_key>pdu_out</source_key>
<sink_key>print_pdu</sink_key> <sink_key>print_pdu</sink_key>
</connection> </connection>
<connection>
<source_block_id>hamnet70_demod_sc16qam_0</source_block_id>
<sink_block_id>qtgui_sink_x_1</sink_block_id>
<source_key>1</source_key>
<sink_key>0</sink_key>
</connection>
<connection> <connection>
<source_block_id>hamnet70_demod_sc16qam_0</source_block_id> <source_block_id>hamnet70_demod_sc16qam_0</source_block_id>
<sink_block_id>qtgui_time_sink_x_0</sink_block_id> <sink_block_id>qtgui_time_sink_x_0</sink_block_id>