diff options
author | Lars Amsel <lars.amsel@ni.com> | 2022-03-11 16:15:41 +0100 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-03-23 16:12:03 -0500 |
commit | 2e8f7484a4497c1b3f1f2caff32d9269ca492ffb (patch) | |
tree | 7e69b4d90f99792c52224648ec1047e04410a58c /host/lib | |
parent | c0015db3ea80117e8c66966e55f337e4fe8d29c2 (diff) | |
download | uhd-2e8f7484a4497c1b3f1f2caff32d9269ca492ffb.tar.gz uhd-2e8f7484a4497c1b3f1f2caff32d9269ca492ffb.tar.bz2 uhd-2e8f7484a4497c1b3f1f2caff32d9269ca492ffb.zip |
Fix handling of discontinuities in power calibration data
The power that corresponds to a certain gain values depends on the
frequency band we are in. At the edges of these bands discontinuities
can occur (the gain necessary to achieve the same power value changes
non-continuously). The power calibration does a linear interpolation
between two neighbor points in the calibration data set to find at
best fitting value. We therefore have to make sure that this interpolation
does not cross discontinuities.
This is a minimal invasive approach. It adds values at discontinuities
for the lower and the upper band. The power calibration format uses
the frequency for a power to gain mapping as a map key. Therefore two
gain to power mappings cannot be stored for the same frequency as it
would be needed for the discontinuity. Instead the mapping for the
lower band is stored at the discontinuity frequency itself. The mapping
for the upper band is stored at the frequency + 1Hz. The calibration
will therefore still fail to yield proper results within this
sub-Hertz range. The frequency lookup in the power calibration manager
now uses round instead of truncation to find the best mapping frequency
in the calibration table.
With this, searching for neighbor data points now ensures that the data
points used belong to the same band (except for the range of
(f_discontinuity, f_discontinuity + 1Hz) ).
This commit does not solve the issue for calibration data generated
with usrp_power_cal.py because the Python interface has no means to
detect band edges for the USRP it is calibrating.
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/rc/cal/x4xx_pwr_zbx_rx_0_rx1.cal | bin | 4504 -> 6112 bytes | |||
-rw-r--r-- | host/lib/rc/cal/x4xx_pwr_zbx_rx_0_tx+rx0.cal | bin | 4504 -> 6112 bytes | |||
-rw-r--r-- | host/lib/rc/cal/x4xx_pwr_zbx_rx_1_rx1.cal | bin | 4504 -> 6112 bytes | |||
-rw-r--r-- | host/lib/rc/cal/x4xx_pwr_zbx_rx_1_tx+rx0.cal | bin | 4504 -> 6112 bytes | |||
-rw-r--r-- | host/lib/rc/cal/x4xx_pwr_zbx_tx_0_tx+rx0.cal | bin | 3832 -> 5344 bytes | |||
-rw-r--r-- | host/lib/rc/cal/x4xx_pwr_zbx_tx_1_tx+rx0.cal | bin | 3832 -> 5344 bytes | |||
-rw-r--r-- | host/lib/usrp/common/pwr_cal_mgr.cpp | 6 |
7 files changed, 3 insertions, 3 deletions
diff --git a/host/lib/rc/cal/x4xx_pwr_zbx_rx_0_rx1.cal b/host/lib/rc/cal/x4xx_pwr_zbx_rx_0_rx1.cal Binary files differindex cc25f6ded..b71088c48 100644 --- a/host/lib/rc/cal/x4xx_pwr_zbx_rx_0_rx1.cal +++ b/host/lib/rc/cal/x4xx_pwr_zbx_rx_0_rx1.cal diff --git a/host/lib/rc/cal/x4xx_pwr_zbx_rx_0_tx+rx0.cal b/host/lib/rc/cal/x4xx_pwr_zbx_rx_0_tx+rx0.cal Binary files differindex 6da01d48b..d4a3d5f14 100644 --- a/host/lib/rc/cal/x4xx_pwr_zbx_rx_0_tx+rx0.cal +++ b/host/lib/rc/cal/x4xx_pwr_zbx_rx_0_tx+rx0.cal diff --git a/host/lib/rc/cal/x4xx_pwr_zbx_rx_1_rx1.cal b/host/lib/rc/cal/x4xx_pwr_zbx_rx_1_rx1.cal Binary files differindex d56c740c2..569bcdbd8 100644 --- a/host/lib/rc/cal/x4xx_pwr_zbx_rx_1_rx1.cal +++ b/host/lib/rc/cal/x4xx_pwr_zbx_rx_1_rx1.cal diff --git a/host/lib/rc/cal/x4xx_pwr_zbx_rx_1_tx+rx0.cal b/host/lib/rc/cal/x4xx_pwr_zbx_rx_1_tx+rx0.cal Binary files differindex 99f4eec4d..3740896a0 100644 --- a/host/lib/rc/cal/x4xx_pwr_zbx_rx_1_tx+rx0.cal +++ b/host/lib/rc/cal/x4xx_pwr_zbx_rx_1_tx+rx0.cal diff --git a/host/lib/rc/cal/x4xx_pwr_zbx_tx_0_tx+rx0.cal b/host/lib/rc/cal/x4xx_pwr_zbx_tx_0_tx+rx0.cal Binary files differindex 349557bae..abc864c76 100644 --- a/host/lib/rc/cal/x4xx_pwr_zbx_tx_0_tx+rx0.cal +++ b/host/lib/rc/cal/x4xx_pwr_zbx_tx_0_tx+rx0.cal diff --git a/host/lib/rc/cal/x4xx_pwr_zbx_tx_1_tx+rx0.cal b/host/lib/rc/cal/x4xx_pwr_zbx_tx_1_tx+rx0.cal Binary files differindex 4ecf1ba00..5cc7ca25a 100644 --- a/host/lib/rc/cal/x4xx_pwr_zbx_tx_1_tx+rx0.cal +++ b/host/lib/rc/cal/x4xx_pwr_zbx_tx_1_tx+rx0.cal diff --git a/host/lib/usrp/common/pwr_cal_mgr.cpp b/host/lib/usrp/common/pwr_cal_mgr.cpp index d2838cbe9..7fb569e83 100644 --- a/host/lib/usrp/common/pwr_cal_mgr.cpp +++ b/host/lib/usrp/common/pwr_cal_mgr.cpp @@ -99,7 +99,7 @@ public: _load_cal_data(key); UHD_ASSERT_THROW(_cal_data.count(key)); _desired_power = power_dbm; - const uint64_t freq = static_cast<uint64_t>(_get_freq()); + const uint64_t freq = static_cast<uint64_t>(std::round(_get_freq())); auto& cal_data = _cal_data.at(key); if (!cal_data) { const std::string err_msg = std::string("Attempting to set power for key ") @@ -141,7 +141,7 @@ public: throw uhd::runtime_error(err_msg); } - const uint64_t freq = static_cast<uint64_t>(_get_freq()); + const uint64_t freq = static_cast<uint64_t>(std::round(_get_freq())); const double hw_gain = _gain_group->get_value(_hw_gain_name); const double hw_power = cal_data->get_power(hw_gain, freq); // We directly scale the power with the residual gain @@ -167,7 +167,7 @@ public: UHD_LOG_ERROR(_log_id, err_msg); throw uhd::runtime_error(err_msg); } - const uint64_t freq = static_cast<uint64_t>(_get_freq()); + const uint64_t freq = static_cast<uint64_t>(std::round(_get_freq())); return cal_data->get_power_limits(freq); } |