From a185b39871704e50ad9cddc39db80eae6c462f0a Mon Sep 17 00:00:00 2001 From: Bastian Bloessl Date: Tue, 14 Apr 2015 13:13:01 +0200 Subject: [PATCH] parser: don't average, let do this subsequent blocks --- lib/ofdm_parse_mac.cc | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/lib/ofdm_parse_mac.cc b/lib/ofdm_parse_mac.cc index 4da7b12..832e829 100644 --- a/lib/ofdm_parse_mac.cc +++ b/lib/ofdm_parse_mac.cc @@ -23,8 +23,6 @@ using namespace gr::ieee802_11; -#define FER_ALPHA 0.2f - class ofdm_parse_mac_impl : public ofdm_parse_mac { public: @@ -33,15 +31,13 @@ ofdm_parse_mac_impl(bool log, bool debug) : block("ofdm_parse_mac", 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) { - message_port_register_in(pmt::mp("in")); - set_msg_handler(pmt::mp("in"), boost::bind(&ofdm_parse_mac_impl::parse, this, _1)); + message_port_register_in(pmt::mp("in")); + set_msg_handler(pmt::mp("in"), boost::bind(&ofdm_parse_mac_impl::parse, this, _1)); - message_port_register_out(pmt::mp("fer")); - d_last_fer = 0.0f; - d_last_seq_no = 0; + message_port_register_out(pmt::mp("fer")); } ~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 << "lost frames: " << lost_frames << std::endl; - // calculate instantaneous error rate - float curr_fer = 0.0f; - if (lost_frames > 0) - curr_fer = 1 - (1 / (static_cast(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; + // calculate frame error rate + float fer = 1 - (1 / (static_cast(lost_frames) + 1)); + dout << "instantaneous fer: " << fer << std::endl; // keep track of values d_last_seq_no = seq_no; - d_last_fer = fer; // publish FER estimate pmt::pmt_t pdu = pmt::make_f32vector(1, fer * 100); @@ -370,7 +359,6 @@ void print_ascii(char* buf, int length) { private: bool d_log; bool d_debug; - float d_last_fer; int d_last_seq_no; };