Implement MSDD on benchmark_rx.py

Hello All,

Now I’m trying to modify benchmark_tx.py and benchmark_rx.py in order to
implement multiple symbol differential detection (MSDD) proposed in [1].
As pointed out in the literature, the packet error rate of MSDD with
three observation symbols is superior to that of conventional two-symbol
differential detection (CDD) via computer simulations.

The experimenatl results, however, shows that the PER performance of the
MSDD is always inferior to that of the CDD. Although I’m trying to fix
this bug, I cannot find any mistakes in my program and also it works
well in the case of computer simulations.

So, I guess that the problem is caused by the processing speed of USRP2
(or maybe GNU Radio). Does anyone try to modify the benchmark_rx.py
and/or know the solution of this problem?

It is worth noting that this serious errors may happen in the latter
half of the transmission. Moreover, I feel that it’s somewhat periodic.

Thank you in advance.


Specifically, the modified version of the benchmark_rx.py and its
corresponding sources are attached in the following:

In order to realize the MSDD, the module, msdd.bpsk_3(), replaces both
gr.diff_phasor() and gr.constellation_decoder_cb(). The module,
Through.in_out(), is used for adjusting the number of “input_items”.

Spec

Daughterboard e$B!!e(BXCVR2450
PC CPU Intel CORE2 Duo [email protected]
memory 2GB

benchmark_tx.py setting
python /usr/share/gnuradio/example/digital/benchmark_rx.py -f 2.4G -m
dbpsk -s 500 -M 5.0

benchmark_rx.py setting
python /usr/share/gnuradio/example/digital/benchmark_rx.py -f 2.4G -m
dbpsk


*******Changed dbpsk.py adout l.270~


Do differential decoding based on phase change of symbols

#self.diffdec = gr.diff_phasor_cc()
self.diffdec = through.in_out()

find closest constellation point

#rot = 1
#rotated_const = map(lambda pt: pt * rot, psk.constellation[arity])
#self.slicer = gr.constellation_decoder_cb(rotated_const,
range(arity))

#MSDD Implementation (Calculating Metrics)
self.slicer = msdd.bpsk_3()


****module1 through_in_out.cpp


#include
#include <gr_io_signature.h>
#include “through_in_out.h”
using namespace std;

through_in_out_sptr through_make_in_out()
{
return through_in_out_sptr(new through_in_out);
}

through_in_out::through_in_out() : gr_block(“through_in_out”,
gr_make_io_signature(1,1,sizeof(gr_complex)),
gr_make_io_signature(1,1,sizeof(gr_complex)))
{
set_history(2);}

through_in_out::~through_in_out(){}

int through_in_out::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];

for(int i = 0; i < noutput_items + 2; i++){
out[i] = in[i];
}
consume_each(noutput_items);

return noutput_items;
}


*module2 msdd_bpsk_3.cpp


#include
#include <gr_io_signature.h>
#include “msdd_bpsk_3.h”
#include
using namespace std;

msdd_bpsk_3_sptr msdd_make_bpsk_3()
{
return msdd_bpsk_3_sptr(new msdd_bpsk_3);
}

msdd_bpsk_3::msdd_bpsk_3()
: gr_sync_block(“msdd_bpsk_3”,
gr_make_io_signature(1,1,sizeof(gr_complex)),
gr_make_io_signature(1,1,sizeof(unsigned char)))
{}

msdd_bpsk_3::~msdd_bpsk_3(){}

int msdd_bpsk_3::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
gr_complex const *in = (const gr_complex *) input_items[0];
unsigned char *out = (unsigned char *) output_items[0];

unsigned int max_index = 0;
int i,j;
double max_euclid_dist = 0, euclid_dist[4];
double phase[3],diff_phase[3],Pi=2*asin(1);

double estimate_phase[8];
unsigned char estimate_info[8];

estimate_phase[0]=estimate_phase[1]=estimate_phase[3]=estimate_phase[4]=0;

estimate_phase[2]=estimate_phase[5]=estimate_phase[6]=estimate_phase[7]=Pi;
estimate_info[0]=estimate_info[1]=estimate_info[3]=estimate_info[4]=0;
estimate_info[2]=estimate_info[5]=estimate_info[6]=estimate_info[7]=1;

in += 2;

for(i = 0; i < noutput_items/2 + 1 ; i++){

phase[0] = arg(in[2*i]);
phase[1] = arg(in[2*i-1]);
phase[2] = arg(in[2*i-2]);

diff_phase[0] = phase[1] - phase[2];
diff_phase[1] = phase[0] - phase[1];
diff_phase[2] = phase[0] - phase[2];

max_index = 0;
max_euclid_dist=0;

for (j = 0; j < 4; j++){
  euclid_dist[j] = cos((diff_phase[0]) - estimate_phase[2*j])
  • cos((diff_phase[1]) - estimate_phase[2*j+1])

  • cos((diff_phase[2]) - (estimate_phase[2j] +
    estimate_phase[2
    j+1]));

    if (euclid_dist[j] > max_euclid_dist){
    max_euclid_dist = euclid_dist[j];
    max_index = j;
    }
    }
    out[2i] = estimate_info[2max_index];
    out[2i+1] = estimate_info[2max_index+1];
    }

return noutput_items;
}