parser: don't average, let do this subsequent blocks

This commit is contained in:
Bastian Bloessl
2015-04-14 13:13:01 +02:00
parent d8f0159985
commit a185b39871
+4 -16
View File
@@ -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_out(pmt::mp("fer"));
d_last_fer = 0.0f;
d_last_seq_no = 0;
}
~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<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;
// calculate frame error rate
float fer = 1 - (1 / (static_cast<float>(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;
};