Agora
1.2.0
Agora project
|
Go to the documentation of this file.
5 #ifndef RADIO_DATA_PLANE_H_
6 #define RADIO_DATA_PLANE_H_
11 #include "SoapySDR/Device.hpp"
28 virtual
void Setup() = 0;
31 long long act_time_ns = 0,
size_t samples = 0) = 0;
33 virtual
void Close() = 0;
36 size_t rx_size,
Radio::RxFlags& out_flags,
37 long long& rx_time_ns) = 0;
38 virtual
int Rx(
std::vector<
std::vector<
std::complex<int16_t>>*>& rx_buffs,
39 size_t rx_size,
Radio::RxFlags& out_flags,
40 long long& rx_time_ns) = 0;
41 virtual
int Rx(
std::vector<
void*>& rx_locations,
size_t rx_size,
42 Radio::RxFlags& out_flags,
long long& rx_time_ns) = 0;
44 virtual
void Flush() = 0;
49 virtual
void Setup(const SoapySDR::Kwargs& args);
63 #endif // RADIO_DATA_PLANE_H_
Config * cfg_
Definition: radio_lib.h:84
static void AdjustCalibrationGains(std::vector< Radio * > &rx_devs, Radio *tx_dev, size_t channel, double fft_bin, bool plot=false)
Definition: radio_calibrate_analog.cc:123
Defination file for the Radio class.
const Config * Configuration() const
Definition: radio_data_plane.h:50
DataPlaneType
Definition: radio_data_plane.h:18
Radio * radio_
Definition: radio_data_plane.h:54
size_t Id() const
Definition: radio.h:27
bool CalibrateSampleOffsetDownlink(size_t max_attempts)
Definition: radio_calibrate_digital.cc:395
static std::vector< int > GetRadioOffsets(size_t num_channels, size_t num_radios, size_t offset_check_channel, const std::vector< int > &offsets)
Definition: radio_calibrate_digital.cc:271
static size_t CheckTone(size_t channel, std::vector< Radio * > &rx_devs, std::vector< float > tone_levels, double fft_bin)
Definition: radio_calibrate_analog.cc:18
Mode mode_
Definition: radio_data_plane.h:58
bool plot(const std::vector< Numeric > &x, const std::vector< Numeric > &y, const std::map< std::string, std::string > &keywords)
Definition: matplotlibcpp.h:442
void ResetTxGains()
Definition: radio_soapysdr.cc:722
double Rate() const
Definition: config.h:58
static constexpr size_t kRefChannel
Definition: radio_calibrate_digital.cc:21
static constexpr bool kVerboseCalibration
Definition: radio_calibrate_digital.cc:20
size_t NumChannels() const
Definition: config.h:98
std::vector< std::complex< float > > SnoopSamples(size_t channel, size_t read_size)
Definition: radio_soapysdr.cc:756
static void ConvertShortToFloat(const short *in_buf, float *out_buf, size_t n_elems)
Produces outputs -1->+0.999.
Definition: datatype_conversion.h:41
static size_t FindPilotSeq(const std::vector< std::complex< float >> &iq, const std::vector< std::complex< float >> &pilot, size_t seq_len)
Definition: comms-lib.cc:32
void InitCalRx(size_t channel, double center_freq)
Definition: radio_soapysdr.cc:713
void CalibrateSampleOffset()
Definition: radio_calibrate_digital.cc:341
size_t calib_meas_num_
Definition: radio_lib.h:94
void SetTxCalGain(size_t channel)
Definition: radio_soapysdr.cc:742
@ kLinuxSocket
Definition: radio_data_plane.h:18
static constexpr bool kPrintCalibrationMats
Definition: radio_calibrate_digital.cc:19
size_t CpLen() const
Definition: config.h:46
void save(const std::string &filename, const int dpi=0)
Definition: matplotlibcpp.h:2625
static constexpr double kToneTargetLevel
Definition: radio_calibrate_analog.cc:16
Table< arma::cx_float > init_calib_ul_
Definition: radio_lib.h:89
static constexpr float kMaxSampleRxTimeSec
Definition: radio_calibrate_digital.cc:22
@ kSoapyStream
Definition: radio_data_plane.h:18
virtual void Activate(Radio::ActivationTypes type=Radio::ActivationTypes::kActivate, long long act_time_ns=0, size_t samples=0)=0
Definition: radio_data_plane.cc:57
size_t OfdmRxZeroPrefixCalUl() const
Definition: config.h:219
bool InitialCalib()
Definition: radio_calibrate_digital.cc:438
Declaration file for the RadioDataPlaneSocket Class.
size_t BsAntNum() const
Definition: config.h:35
@ kModeUninit
Definition: radio_data_plane.h:21
void Go()
Definition: radio_lib.cc:293
ActivationTypes
Definition: radio.h:23
static void AdjustRxGains(size_t channel, std::vector< Radio * > &rx_devs, std::vector< float > tone_levels, const std::string &gain_stage, double min_setting, double max_setting)
Definition: radio_calibrate_analog.cc:88
SoapySDR::Device * SoapyDevice() const
Definition: radio_soapysdr.h:77
void legend()
Definition: matplotlibcpp.h:1944
#define AGORA_LOG_ERROR(...)
Definition: logger.h:39
SPDLOG_INLINE spdlog::log_clock::time_point now() SPDLOG_NOEXCEPT
Definition: os-inl.h:71
size_t RefRadio(size_t id) const
Definition: config.h:101
virtual void Deactivate()=0
Definition: radio_data_plane.cc:91
void figure_size(size_t w, size_t h)
Definition: matplotlibcpp.h:1922
bool CalibrateSampleOffsetUplink(size_t max_attempts)
Definition: radio_calibrate_digital.cc:349
double RadioRfFreq() const
Definition: config.h:61
SoapySDR::Stream * remote_stream_
Definition: radio_data_plane.h:55
#define AGORA_LOG_TRACE(...)
Definition: logger.h:92
bool FindTimeOffset(const std::vector< std::vector< std::complex< int16_t >>> &rx_mat, std::vector< int > &offset)
Definition: radio_calibrate_digital.cc:210
const std::string & SerialNumber() const
Definition: radio.h:28
static void CheckSnr(size_t offset, const std::vector< std::vector< std::complex< int16_t >>> &check_buff, const Config *cfg)
Definition: radio_calibrate_digital.cc:297
data_stop
Definition: inspect_agora_results.m:18
@ kActivateWaitTrigger
Definition: radio.h:23
size_t OfdmRxZeroPrefixCalDl() const
Definition: config.h:225
const std::vector< std::complex< float > > & PilotCf32() const
Definition: config.h:341
Definition: matplotlibcpp.h:43
Declaration file for the RadioConfig class.
snr
Definition: inspect_agora_results.m:118
constexpr std::chrono::duration< Rep, Period > abs(std::chrono::duration< Rep, Period > d)
Definition: chrono.h:1488
void SetFreqRf(size_t channel, double freq)
Definition: radio_soapysdr.cc:796
@ kModeActive
Definition: radio_data_plane.h:21
size_t OfdmDataNum() const
Definition: config.h:47
bool ExternalRefNode(size_t id) const
Definition: config.h:110
void InitRefTx(size_t channel, double freq)
Definition: radio_soapysdr.cc:708
std::vector< std::unique_ptr< Radio > > radios_
Definition: radio_lib.h:86
Aligned types for SIMD compatibility.
Defination file for the RadioSoapySdr class.
static constexpr bool kIQImbalancePlot
Definition: radio_calibrate_analog.cc:15
data_start
Definition: inspect_agora_results.m:17
for i
Definition: generate_data.m:107
size_t OfdmCaNum() const
Definition: config.h:45
void xlim(Numeric left, Numeric right)
Definition: matplotlibcpp.h:2048
@ kModeDeactive
Definition: radio_data_plane.h:21
@ center
Definition: core.h:2021
Plot Rx waveform for u
Definition: inspect_single_frame.m:108
Communications Library: a) Generate pilot/preamble sequences b) OFDM modulation.
Rx data rx_mat
Definition: generate_data.m:115
static std::vector< float > HannWindowFunction(size_t fft_size)
Definition: comms-lib.cc:266
static std::vector< std::complex< float > > Cint16ToCfloat32(const std::vector< std::complex< int16_t >> &in)
Definition: utils.cc:264
#define SETTLE_TIME_MS
Definition: symbols.h:21
void SetIQBalance(int direction, size_t channel, std::complex< double > i_qcorr)
Definition: radio_soapysdr.cc:782
end start
Definition: inspect_agora_results.m:95
static std::unique_ptr< RadioDataPlane > Create(DataPlaneType type)
Definition: radio_data_plane.cc:16
Table< arma::cx_float > init_calib_dl_
Definition: radio_lib.h:90
static constexpr size_t kMaxArraySampleOffset
Definition: radio_calibrate_digital.cc:17
static float ComputeOfdmSnr(const std::vector< std::complex< float >> &data_t, size_t data_start_index, size_t data_stop_index)
Definition: comms-lib.cc:608
static MKL_LONG FFT(std::vector< std::complex< float >> &in_out, int fft_size)
Definition: comms-lib.cc:460
static std::vector< float > MagnitudeFft(std::vector< std::complex< float >> const &samps, std::vector< float > const &win, size_t fft_size)
Definition: comms-lib.cc:237
void AdjustDelays(const std::vector< int > &ch0_offsets)
Definition: radio_calibrate_digital.cc:251
size_t OfdmDataStart() const
Definition: config.h:48
const Mode & CheckMode() const
Definition: radio_data_plane.h:51
static void SetIqBalance(Radio *dev, int direction, size_t channel, int gcorr, int iqcorr)
Definition: radio_calibrate_analog.cc:181
static void DciqMinimize(Radio *target_dev, Radio *ref_dev, int direction, size_t channel, double rx_center_tone, double tx_center_tone)
Definition: radio_calibrate_analog.cc:192
static void PlotTones(size_t channel, std::vector< Radio * > &rx_devs, std::vector< float > tone_levels, double fft_bin)
Definition: radio_calibrate_analog.cc:43
const Config * cfg_
Definition: radio_data_plane.h:60
#define AGORA_LOG_SYMBOL(...)
Definition: logger.h:82
const T & first(const T &value, const Tail &...)
Definition: compile.h:178
Definition: radio_data_plane.h:16
#define AGORA_LOG_INFO(...)
Definition: logger.h:62
size_t RefAnt(size_t id) const
Definition: config.h:100
Definition: json.hpp:5213
auto TxArrayToRef(const std::vector< std::complex< int16_t >> &tx_vec)
Definition: radio_calibrate_digital.cc:24
@ kModeShutdown
Definition: radio_data_plane.h:21
virtual void Close()=0
Definition: radio_data_plane.cc:113
static void RtAssert(bool condition, const char *throw_str)
Definition: utils.h:104
N_SC, NUM_UE, NUM_UE zeros()
Mode
Definition: radio_data_plane.h:21
static constexpr size_t kDownlinkMaxDiffOffset
Definition: radio_calibrate_digital.cc:394
#define AGORA_LOG_WARN(...)
Definition: logger.h:53
virtual void Init(Radio *radio, const Config *cfg, bool hw_framer)=0
Definition: radio_data_plane.cc:36
virtual int Rx(std::vector< std::vector< std::complex< int16_t >>> &rx_data, size_t rx_size, Radio::RxFlags &out_flags, long long &rx_time_ns)=0
noise
Definition: generate_data_dl.m:131
auto TxRefToArray(const std::vector< std::complex< int16_t >> &tx_vec)
Definition: radio_calibrate_digital.cc:118
std::string to_string() const
Definition: eth_common.h:64
virtual ~RadioDataPlane()
Definition: radio_data_plane.cc:34
static float MeasureTone(std::vector< std::complex< float >> const &samps, std::vector< float > const &win, double win_gain, double fft_bin, size_t fft_size, const size_t delta=10)
Definition: comms-lib.cc:317
Declaration file for the configuration class which importants json configuration values into class va...
Declaration file for the RadioDataPlaneSoapy Class.
case QPSK rx_data
Definition: generate_data.m:160
static double WindowFunctionPower(std::vector< float > const &win)
Definition: comms-lib.cc:285
void ylim(Numeric left, Numeric right)
Definition: matplotlibcpp.h:2029
static constexpr bool kReciprocalCalibPlot
Definition: radio_calibrate_digital.cc:18
bool hw_framer_
Definition: radio_data_plane.h:61
virtual void Setup()=0
Definition: radio_data_plane.cc:153
void title(const std::string &titlestr, const std::map< std::string, std::string > &keywords={})
Definition: matplotlibcpp.h:2296
size_t NumRadios() const
Definition: config.h:95
Definition: radio_soapysdr.h:16
size_t OfdmDataStop() const
Definition: config.h:50
std::vector< std::complex< int16_t > > & PilotCi16()
Definition: config.h:377
static void MeasureCorrection(RadioSoapySdr *ref, size_t channel, size_t num_samples, size_t rx_center_tone, size_t tx_center_tone, const std::vector< float > &window, double window_gain)
Definition: radio_calibrate_analog.cc:105
Declaration file for the RadioDataPlane Class.
type
Definition: core.h:1131
const bool & HwFramer() const
Definition: radio_data_plane.h:52
size_t BfAntNum() const
Definition: config.h:39
void DciqCalibrationProc(size_t channel)
Definition: radio_calibrate_analog.cc:330