summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dpd/dpd.ini10
-rw-r--r--src/MemlessPoly.cpp53
-rw-r--r--src/MemlessPoly.h2
3 files changed, 37 insertions, 28 deletions
diff --git a/dpd/dpd.ini b/dpd/dpd.ini
index 5e809e5..af83a63 100644
--- a/dpd/dpd.ini
+++ b/dpd/dpd.ini
@@ -14,12 +14,16 @@ transport=tcp
source=localhost:9200
[modulator]
-digital_gain=0.8
+digital_gain=0.95
rate=8192000
[firfilter]
enabled=0
+[poly]
+enabled=1
+polycoeffile=polyCoefs
+
[output]
output=uhd
@@ -27,14 +31,14 @@ output=uhd
device=
master_clock_rate=32768000
type=b200
-txgain=75
+txgain=87
channel=13C
refclk_source=internal
pps_source=none
behaviour_refclk_lock_lost=ignore
max_gps_holdover_time=600
dpd_port=50055
-rxgain=0
+rxgain=15
[delaymanagement]
; Use synchronous=1 so that the USRP time is set. This works
diff --git a/src/MemlessPoly.cpp b/src/MemlessPoly.cpp
index 7e074eb..5fbf724 100644
--- a/src/MemlessPoly.cpp
+++ b/src/MemlessPoly.cpp
@@ -45,10 +45,10 @@ using namespace std;
// By default the signal is unchanged
-static const std::array<float, 8> default_coefficients({
+static const std::array<complexf, 8> default_coefficients({{
1, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0
- });
+ }});
MemlessPoly::MemlessPoly(const std::string& coefs_file) :
@@ -69,7 +69,7 @@ MemlessPoly::MemlessPoly(const std::string& coefs_file) :
void MemlessPoly::load_coefficients(const std::string &coefFile)
{
- std::vector<float> coefs;
+ std::vector<complexf> coefs;
if (coefFile == "default") {
std::copy(default_coefficients.begin(), default_coefficients.end(),
std::back_inserter(coefs));
@@ -98,7 +98,10 @@ void MemlessPoly::load_coefficients(const std::string &coefFile)
int n;
for (n = 0; n < n_coefs; n++) {
- coef_fstream >> coefs[n];
+ float a, b;
+ coef_fstream >> a;
+ coef_fstream >> b;
+ coefs[n] = complexf(a, b)
PDEBUG("MemlessPoly: coef: %f\n", coefs[n] );
if (coef_fstream.eof()) {
fprintf(stderr, "MemlessPoly: file %s should contains %d coefs, but EOF reached "\
@@ -118,27 +121,29 @@ void MemlessPoly::load_coefficients(const std::string &coefFile)
int MemlessPoly::internal_process(Buffer* const dataIn, Buffer* dataOut)
{
- const float* in = reinterpret_cast<const float*>(dataIn->getData());
- float* out = reinterpret_cast<float*>(dataOut->getData());
- size_t sizeIn = dataIn->getLength() / sizeof(float);
-
- {
- std::lock_guard<std::mutex> lock(m_coefs_mutex);
- for (size_t i = 0; i < sizeIn; i += 1) {
- float mag = std::abs(in[i]);
- //out[i] = in[i];
- out[i] = in[i] * (
- m_coefs[0] +
- m_coefs[1] * mag +
- m_coefs[2] * mag*mag +
- m_coefs[3] * mag*mag*mag +
- m_coefs[4] * mag*mag*mag*mag +
- m_coefs[5] * mag*mag*mag*mag*mag +
- m_coefs[6] * mag*mag*mag*mag*mag*mag +
- m_coefs[7] * mag*mag*mag*mag*mag*mag*mag
- );
- }
+ dataOut->setLength(dataIn->getLength());
+
+ const complexf* in = reinterpret_cast<const complexf*>(dataIn->getData());
+ complexf* out = reinterpret_cast<complexf*>(dataOut->getData());
+ size_t sizeOut = dataOut->getLength() / sizeof(complexf);
+
+ {
+ std::lock_guard<std::mutex> lock(m_coefs_mutex);
+ for (size_t i = 0; i < sizeOut; i += 1) {
+ float mag = std::abs(in[i]);
+ //out[i] = in[i];
+ out[i] = in[i] * (
+ m_coefs[0] +
+ m_coefs[1] * mag +
+ m_coefs[2] * mag*mag +
+ m_coefs[3] * mag*mag*mag +
+ m_coefs[4] * mag*mag*mag*mag +
+ m_coefs[5] * mag*mag*mag*mag*mag +
+ m_coefs[6] * mag*mag*mag*mag*mag*mag +
+ m_coefs[7] * mag*mag*mag*mag*mag*mag*mag
+ );
}
+ }
return dataOut->getLength();
}
diff --git a/src/MemlessPoly.h b/src/MemlessPoly.h
index 210b4b4..eb51d50 100644
--- a/src/MemlessPoly.h
+++ b/src/MemlessPoly.h
@@ -64,7 +64,7 @@ public:
const std::string& parameter) const;
//TODO to protected
- std::vector<float> m_coefs;
+ std::vector<complexf> m_coefs;
protected: