USRP Hardware Driver and USRP Manual  Version: 4.4.0.HEAD-0-g5fac246b
UHD and USRP Manual
uhd::usrp::cal::pwr_cal Class Referenceabstract

#include <uhd/cal/pwr_cal.hpp>

Inheritance diagram for uhd::usrp::cal::pwr_cal:
uhd::usrp::cal::container

Public Types

using sptr = std::shared_ptr< pwr_cal >
 

Public Member Functions

virtual void add_power_table (const std::map< double, double > &gain_power_map, const double min_power, const double max_power, const double freq, const boost::optional< int > temperature=boost::none)=0
 
virtual void clear ()=0
 
virtual void set_temperature (const int temperature)=0
 
virtual int get_temperature () const =0
 Return the current default temperature. More...
 
virtual void set_ref_gain (const double gain)=0
 
virtual double get_ref_gain () const =0
 
virtual uhd::meta_range_t get_power_limits (const double freq, const boost::optional< int > temperature=boost::none) const =0
 
virtual double get_power (const double gain, const double freq, const boost::optional< int > temperature=boost::none) const =0
 
virtual double get_gain (const double power_dbm, const double freq, const boost::optional< int > temperature=boost::none) const =0
 
- Public Member Functions inherited from uhd::usrp::cal::container
virtual ~container ()=default
 
virtual std::string get_name () const =0
 Return the name of this calibration table. More...
 
virtual std::string get_serial () const =0
 Return the device serial of this calibration table. More...
 
virtual uint64_t get_timestamp () const =0
 Timestamp of acquisition time. More...
 
virtual std::vector< uint8_t > serialize ()=0
 Return a serialized version of this container. More...
 
virtual void deserialize (const std::vector< uint8_t > &data)=0
 Populate this class from the serialized data. More...
 

Static Public Member Functions

static sptr make (const std::string &name, const std::string &serial, const uint64_t timestamp)
 Factory for new cal data sets. More...
 
static sptr make ()
 Default factory. More...
 
- Static Public Member Functions inherited from uhd::usrp::cal::container
template<typename container_type >
static std::shared_ptr< container_type > make (const std::vector< uint8_t > &data)
 Generic factory for cal data from serialized data. More...
 

Detailed Description

Class that stores power levels (in dBm) at various gains, frequencies, and temperatures.

This container class is suitable for all cases where devices want to store a gain-to-power mapping from a single, overall gain value.

The underlying data structure stores the power level for every gain/frequency point that is part of this data set. It can also do a reverse look-up of gain values for a given power value.

The interpolation algorithms assume a monotonic gain/power profile, i.e., f(gain) = power is monotonically increasing. If the power is not monotonically increasing, the interpolation algorithms still work, but get_gain() might produce a greater than necessary interpolation error. For that case, this class provides get_gain_coerced(), which helps with both coercion of the interpolated gain into a gain value that can be used at the call site, as well as minimizing the effect on the application using this container.

All interpolation algorithms first interpolate temperature by finding the nearest available temperature data. For example, if the data set includes calibration data for 40C and 50C, and the actual temperature is measured at 48C, then the data set for 50C is used, and the data set for 40C is not considered at all. Within a data set, frequency and gain are interpolated in two dimensions (the same is true for frequency and power for get_gain() and get_gain_coerced()) using a bilinear interpolation.

Member Typedef Documentation

◆ sptr

using uhd::usrp::cal::pwr_cal::sptr = std::shared_ptr<pwr_cal>

Member Function Documentation

◆ add_power_table()

virtual void uhd::usrp::cal::pwr_cal::add_power_table ( const std::map< double, double > &  gain_power_map,
const double  min_power,
const double  max_power,
const double  freq,
const boost::optional< int >  temperature = boost::none 
)
pure virtual

Add or update a power level data point

Note: Power measurements can only be written atomically. It is not possible to add individual gain/power points using this method.

Parameters
gain_power_mapA mapping gain -> power (dB -> dBm) for all measured gain points for this frequency.
min_powerThe minimum available power for this frequency.
max_powerThe maximum available power for this frequency.
freqThe frequency at which this power level was measured
temperatureThe temperature at which this power level was measured, in Celsius. This parameter is optional, the return value for get_temperature() is used if no temperature is provided here.

◆ clear()

virtual void uhd::usrp::cal::pwr_cal::clear ( )
pure virtual

Clear all stored values

Note: All of the getters will throw a uhd::assertion_error if called after clearing the data.

◆ get_gain()

virtual double uhd::usrp::cal::pwr_cal::get_gain ( const double  power_dbm,
const double  freq,
const boost::optional< int >  temperature = boost::none 
) const
pure virtual

Look up a gain value from a power value.

This is the reverse function to get_power(). Like get_power(), it will interpolate in two dimensions (linearly) if the requested power value is not part of the measurement data.

Note: power_dbm is coerced into the available power range using get_power_limits().

Parameters
power_dbmThe power (in dBm) at which we are getting the gain value for
freqThe frequency at which we are finding the gain
temperatureThe temperature at which we are finding the gain. If none is given, uses the current default temperature (see set_temperature()).

◆ get_power()

virtual double uhd::usrp::cal::pwr_cal::get_power ( const double  gain,
const double  freq,
const boost::optional< int >  temperature = boost::none 
) const
pure virtual

Returns the power at a gain value.

This will interpolate from the given data set to obtain a power value if gain and frequency are not exactly within the given data set.

Parameters
gainThe gain at which we are checking the power
freqThe frequency at which we are checking the power
temperatureThe temperature at which we are checking the power. If none is given, uses the current default temperature (see set_temperature()).

◆ get_power_limits()

virtual uhd::meta_range_t uhd::usrp::cal::pwr_cal::get_power_limits ( const double  freq,
const boost::optional< int >  temperature = boost::none 
) const
pure virtual

Return the min and max power available for this frequency

◆ get_ref_gain()

virtual double uhd::usrp::cal::pwr_cal::get_ref_gain ( ) const
pure virtual

Return the current reference gain point.

Currently unused.

◆ get_temperature()

virtual int uhd::usrp::cal::pwr_cal::get_temperature ( ) const
pure virtual

Return the current default temperature.

◆ make() [1/2]

static sptr uhd::usrp::cal::pwr_cal::make ( )
static

Default factory.

◆ make() [2/2]

static sptr uhd::usrp::cal::pwr_cal::make ( const std::string &  name,
const std::string &  serial,
const uint64_t  timestamp 
)
static

Factory for new cal data sets.

◆ set_ref_gain()

virtual void uhd::usrp::cal::pwr_cal::set_ref_gain ( const double  gain)
pure virtual

Set the reference gain point, i.e., the gain value where by definition the difference between linearized power and measured power is zero.

Currently unused.

◆ set_temperature()

virtual void uhd::usrp::cal::pwr_cal::set_temperature ( const int  temperature)
pure virtual

Set the current default temperature

Some of the API calls have a optional temperature argument. However, in practice, it is often useful to set an ambient temperature once, or only when it has changed, and then use a default temperature instead of providing the temperature on every call. This sets the default temperature.


The documentation for this class was generated from the following file: