aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdpd/main.py21
-rw-r--r--dpd/src/Agc.py6
-rw-r--r--dpd/src/TX_Agc.py17
-rw-r--r--dpd/src/const.py10
4 files changed, 28 insertions, 26 deletions
diff --git a/dpd/main.py b/dpd/main.py
index 923a7f8..8de0f86 100755
--- a/dpd/main.py
+++ b/dpd/main.py
@@ -145,10 +145,10 @@ elif dpddata[0] == "lut":
else:
logging.error("Unknown dpd data format {}".format(dpddata[0]))
-tx_agc = TX_Agc.TX_Agc(adapt)
+tx_agc = TX_Agc.TX_Agc(adapt, c)
# Automatic Gain Control
-agc = Agc.Agc(meas, adapt)
+agc = Agc.Agc(meas, adapt, c)
agc.run()
state = "measure"
@@ -165,7 +165,7 @@ while i < num_iter:
tx, rx, phase_diff, n_per_bin = extStat.extract(txframe_aligned, rxframe_aligned)
- if extStat.n_meas >= 15:
+ if extStat.n_meas >= 200:
state = "model"
else:
state = "measure"
@@ -181,11 +181,11 @@ while i < num_iter:
elif state == "adapt":
adapt.set_predistorter(dpddata)
state = "report"
- i += 1
# Report
elif state == "report":
try:
+ i += 1
path = adapt.dump()
off = SA.calc_offset(txframe_aligned)
@@ -196,12 +196,12 @@ while i < num_iter:
rx_gain = adapt.get_rxgain()
digital_gain = adapt.get_digital_gain()
tx_median = np.median(np.abs(txframe_aligned))
- rx_shoulders = MS.average_shoulders(rxframe_aligned)
- tx_shoulders = MS.average_shoulders(txframe_aligned)
+ rx_shoulder_tuple = MS.average_shoulders(rxframe_aligned)
+ tx_shoulder_tuple = MS.average_shoulders(txframe_aligned)
logging.info(list((name, eval(name)) for name in
- ['i', 'tx_mer', 'tx_shoulders', 'rx_mer',
- 'rx_shoulders', 'mse', 'tx_gain',
+ ['i', 'tx_mer', 'tx_shoulder_tuple', 'rx_mer',
+ 'rx_shoulder_tuple', 'mse', 'tx_gain',
'digital_gain', 'rx_gain', 'rx_median',
'tx_median']))
if dpddata[0] == "poly":
@@ -216,11 +216,6 @@ while i < num_iter:
lut = dpddata[2]
logging.info("It {}: LUT scalefactor {}, LUT {}".
format(i, scalefactor, lut))
-
- model.reset_coefs()
- dpd_data = model.get_dpd_data()
- adapt.set_predistorter(dpd_data)
- tx_gain = tx_gain - 1
if tx_gain < 89:
adapt.set_txgain(tx_gain)
else:
diff --git a/dpd/src/Agc.py b/dpd/src/Agc.py
index b83c91e..670fbbb 100644
--- a/dpd/src/Agc.py
+++ b/dpd/src/Agc.py
@@ -35,14 +35,14 @@ class Agc:
received signal fulfills our desired property, of having
all amplitudes properly quantized."""
- def __init__(self, measure, adapt, min_rxgain=25, peak_to_median=20):
+ def __init__(self, measure, adapt, c):
assert isinstance(measure, Measure.Measure)
assert isinstance(adapt, Adapt.Adapt)
self.measure = measure
self.adapt = adapt
- self.min_rxgain = min_rxgain
+ self.min_rxgain = c.RAGC_min_rxgain
self.rxgain = self.min_rxgain
- self.peak_to_median = peak_to_median
+ self.peak_to_median = 1./c.RAGC_rx_median_target
def run(self):
self.adapt.set_rxgain(self.rxgain)
diff --git a/dpd/src/TX_Agc.py b/dpd/src/TX_Agc.py
index affc42f..b9226b2 100644
--- a/dpd/src/TX_Agc.py
+++ b/dpd/src/TX_Agc.py
@@ -24,10 +24,7 @@ import src.Adapt as Adapt
class TX_Agc:
def __init__(self,
adapt,
- max_txgain=89,
- tx_median_target=0.16,
- tx_median_threshold_max=0.18,
- tx_median_threshold_min=0.14):
+ c):
"""
In order to avoid digital clipping, this class increases the
TX gain and reduces the digital gain. Digital clipping happens
@@ -47,16 +44,16 @@ class TX_Agc:
:param tx_median_target: The digital gain is reduced in a way that
the median TX value is expected to be lower than this value.
"""
+
+
assert isinstance(adapt, Adapt.Adapt)
self.adapt = adapt
- self.max_txgain = max_txgain
+ self.max_txgain = c.TAGC_max_txgain
self.txgain = self.max_txgain
- assert tx_median_threshold_max > tx_median_target,\
- "The tolerated tx_median has to be larger then the goal tx_median"
- self.tx_median_threshold_tolerate_max = tx_median_threshold_max
- self.tx_median_threshold_tolerate_min = tx_median_threshold_min
- self.tx_median_target = tx_median_target
+ self.tx_median_threshold_tolerate_max = c.TAGC_tx_median_max
+ self.tx_median_threshold_tolerate_min = c.TAGC_tx_median_min
+ self.tx_median_target = c.TAGC_tx_median_target
def adapt_if_necessary(self, tx):
tx_median = np.median(np.abs(tx))
diff --git a/dpd/src/const.py b/dpd/src/const.py
index c7f4b7c..63a095b 100644
--- a/dpd/src/const.py
+++ b/dpd/src/const.py
@@ -43,6 +43,16 @@ class const:
self.ES_n_bins = 64
self.ES_n_per_bin = 128
+ # Constants for TX_Agc
+ self.TAGC_max_txgain = 89
+ self.TAGC_tx_median_target = 0.1
+ self.TAGC_tx_median_max = self.TAGC_tx_median_target*1.4
+ self.TAGC_tx_median_min = self.TAGC_tx_median_target/1.4
+
+ # Constants for Agc
+ self.RAGC_min_rxgain = 25
+ self.RAGC_rx_median_target = self.TAGC_tx_median_target
+
# Constants for Model_PM
self.MPM_tx_min = 0.1