Skip to content

Commit

Permalink
Added CE_Throughput_Test
Browse files Browse the repository at this point in the history
  • Loading branch information
ericps1 committed Feb 4, 2016
1 parent 76f5c49 commit d9599e5
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 3 deletions.
27 changes: 27 additions & 0 deletions cognitive_engines/CE_Throughput_Test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "CE_Throughput_Test.hpp"
#include "ECR.hpp"
#include <stdio.h>
#include <timer.h>
#include <sys/time.h>
#include "CE_Throughput_Test.hpp"

// constructor
CE_Throughput_Test::CE_Throughput_Test() {
first_execution = 1;
}

// destructor
CE_Throughput_Test::~CE_Throughput_Test() {}

// execute function
void CE_Throughput_Test::execute(ExtensibleCognitiveRadio *ECR) {

if (first_execution) {
// Print the estimated network throughput (assuming perfect reception).
// The 256/288 factor is to account for the header added by the TUN interface.
float phy_data_rate = ECR->get_tx_data_rate();
printf("Estimated network throughput: %e\n", (256.0/288.0)*phy_data_rate);
ECR->set_ce_timeout_ms(200.0);
first_execution = 0;
}
}
17 changes: 17 additions & 0 deletions cognitive_engines/CE_Throughput_Test.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef _CE_THROUGHPUT_TEST_
#define _CE_THROUGHPUT_TEST_

#include "CE.hpp"
#include <sys/time.h>

class CE_Throughput_Test : public Cognitive_Engine {

private:
int first_execution;
public:
CE_Throughput_Test();
~CE_Throughput_Test();
virtual void execute(ExtensibleCognitiveRadio *ECR);
};

#endif
6 changes: 4 additions & 2 deletions scenarios/FEC_Adaptation.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ node1 : {
// initial liquid OFDM settings
duplex = "FDD";
tx_gain_soft = -12.0;
tx_modulation = "qpsk" tx_crc = "crc32";
tx_modulation = "qpsk";
tx_crc = "crc32";
tx_fec0 = "h128";
tx_fec1 = "none";
};
Expand Down Expand Up @@ -79,7 +80,8 @@ node2 : {
// initial liquid OFDM settings
duplex = "FDD";
tx_gain_soft = -12.0;
tx_modulation = "qpsk" tx_crc = "crc32";
tx_modulation = "qpsk";
tx_crc = "crc32";
tx_fec0 = "h128";
tx_fec1 = "none";
};
Expand Down
3 changes: 2 additions & 1 deletion scenarios/Scenario_Template.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ node1 : {
// - The tx_taper_len and rx_taper_len specify how many samples of
// the cyclic prefix are windowed (to improve spectral properties).
tx_gain_soft = -12.0;
tx_modulation = "bpsk" tx_crc = "crc32";
tx_modulation = "bpsk";
tx_crc = "crc32";
tx_fec0 = "v27";
tx_fec1 = "none";
tx_cp_len = 16;
Expand Down

0 comments on commit d9599e5

Please sign in to comment.