parser: don't average, let do this subsequent blocks
This commit is contained in:
+4
-16
@@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
using namespace gr::ieee802_11;
|
using namespace gr::ieee802_11;
|
||||||
|
|
||||||
#define FER_ALPHA 0.2f
|
|
||||||
|
|
||||||
class ofdm_parse_mac_impl : public ofdm_parse_mac {
|
class ofdm_parse_mac_impl : public ofdm_parse_mac {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -33,15 +31,13 @@ ofdm_parse_mac_impl(bool log, bool debug) :
|
|||||||
block("ofdm_parse_mac",
|
block("ofdm_parse_mac",
|
||||||
gr::io_signature::make(0, 0, 0),
|
gr::io_signature::make(0, 0, 0),
|
||||||
gr::io_signature::make(0, 0, 0)),
|
gr::io_signature::make(0, 0, 0)),
|
||||||
d_log(log),
|
d_log(log), d_last_seq_no(0),
|
||||||
d_debug(debug) {
|
d_debug(debug) {
|
||||||
|
|
||||||
message_port_register_in(pmt::mp("in"));
|
message_port_register_in(pmt::mp("in"));
|
||||||
set_msg_handler(pmt::mp("in"), boost::bind(&ofdm_parse_mac_impl::parse, this, _1));
|
set_msg_handler(pmt::mp("in"), boost::bind(&ofdm_parse_mac_impl::parse, this, _1));
|
||||||
|
|
||||||
message_port_register_out(pmt::mp("fer"));
|
message_port_register_out(pmt::mp("fer"));
|
||||||
d_last_fer = 0.0f;
|
|
||||||
d_last_seq_no = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~ofdm_parse_mac_impl() {
|
~ofdm_parse_mac_impl() {
|
||||||
@@ -270,19 +266,12 @@ void parse_data(char *buf, int length) {
|
|||||||
dout << "d_last_seq_no: " << d_last_seq_no << std::endl;
|
dout << "d_last_seq_no: " << d_last_seq_no << std::endl;
|
||||||
dout << "lost frames: " << lost_frames << std::endl;
|
dout << "lost frames: " << lost_frames << std::endl;
|
||||||
|
|
||||||
// calculate instantaneous error rate
|
// calculate frame error rate
|
||||||
float curr_fer = 0.0f;
|
float fer = 1 - (1 / (static_cast<float>(lost_frames) + 1));
|
||||||
if (lost_frames > 0)
|
dout << "instantaneous fer: " << fer << std::endl;
|
||||||
curr_fer = 1 - (1 / (static_cast<float>(lost_frames) + 1));
|
|
||||||
dout << "instantaneous fer: " << curr_fer << std::endl;
|
|
||||||
|
|
||||||
// update FER estimate
|
|
||||||
float fer = (1.0f - FER_ALPHA) * d_last_fer + FER_ALPHA * curr_fer;
|
|
||||||
dout << "rolling fer: " << fer << std::endl;
|
|
||||||
|
|
||||||
// keep track of values
|
// keep track of values
|
||||||
d_last_seq_no = seq_no;
|
d_last_seq_no = seq_no;
|
||||||
d_last_fer = fer;
|
|
||||||
|
|
||||||
// publish FER estimate
|
// publish FER estimate
|
||||||
pmt::pmt_t pdu = pmt::make_f32vector(1, fer * 100);
|
pmt::pmt_t pdu = pmt::make_f32vector(1, fer * 100);
|
||||||
@@ -370,7 +359,6 @@ void print_ascii(char* buf, int length) {
|
|||||||
private:
|
private:
|
||||||
bool d_log;
|
bool d_log;
|
||||||
bool d_debug;
|
bool d_debug;
|
||||||
float d_last_fer;
|
|
||||||
int d_last_seq_no;
|
int d_last_seq_no;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user