Agora  1.2.0
Agora project
dobeamweights.h
Go to the documentation of this file.
1 
5 #ifndef DOBEAMWEIGHTS_H_
6 #define DOBEAMWEIGHTS_H_
7 
8 #include <memory>
9 
10 #include "armadillo"
11 #include "common_typedef_sdk.h"
12 #include "config.h"
13 #include "doer.h"
14 #include "mat_logger.h"
15 #include "memory_manage.h"
16 #include "message.h"
17 #include "phy_stats.h"
18 #include "stats.h"
19 
20 class DoBeamWeights : public Doer {
21  public:
23  Config* in_config, int tid,
25  Table<complex_float>& calib_dl_buffer,
26  Table<complex_float>& calib_ul_buffer,
27  Table<complex_float>& calib_dl_msum_buffer,
28  Table<complex_float>& calib_ul_msum_buffer,
31  PhyStats* in_phy_stats, Stats* stats_manager);
32  ~DoBeamWeights() override;
33 
50  EventData Launch(size_t tag) override;
51 
52  private:
53  void ComputePartialCsiBeams(size_t tag);
54 
57  float ComputePrecoder(size_t frame_id, size_t cur_sc_id,
58  const arma::cx_fmat& mat_csi,
59  const arma::cx_fvec& calib_sc_vec, const float noise,
60  complex_float* ul_beam_mem, complex_float* dl_beam_mem);
61  void ComputeCalib(size_t frame_id, size_t sc_id, arma::cx_fvec& calib_sc_vec);
62  void ComputeFullCsiBeams(size_t tag);
63 
86  void Predict(size_t offset);
87 
90 
91  //Should be read only (Set by FFT and read by Zf)
94 
95  //Shared by all doZf objects
101 
102  complex_float* csi_gather_buffer_; // Intermediate buffer to gather CSI
103  // Intermediate buffer to gather reciprical calibration data vector
105  std::unique_ptr<arma::cx_fvec> calib_sc_vec_ptr_;
106 
108  arma::uvec ext_ref_id_;
109  size_t num_ext_ref_;
110 };
111 
112 #endif // DOBEAMWEIGHTS_H_
PhyStats
Definition: phy_stats.h:15
DoBeamWeights::ComputeCalib
void ComputeCalib(size_t frame_id, size_t sc_id, arma::cx_fvec &calib_sc_vec)
Definition: dobeamweights.cc:221
DoerType::kBeam
@ kBeam
Config::GetBeamScId
size_t GetBeamScId(size_t sc_id) const
Definition: config.h:481
Config::UeAntNum
size_t UeAntNum() const
Definition: config.h:41
FrameStats::IsRecCalEnabled
bool IsRecCalEnabled() const
Definition: framestats.cc:97
complex_float
Definition: test_transpose.cc:22
DoBeamWeights::ul_beam_matrices_
PtrGrid< kFrameWnd, kMaxDataSCs, complex_float > & ul_beam_matrices_
Definition: dobeamweights.h:98
DoBeamWeights::calib_sc_vec_ptr_
std::unique_ptr< arma::cx_fvec > calib_sc_vec_ptr_
Definition: dobeamweights.h:105
DoBeamWeights::calib_dl_msum_buffer_
Table< complex_float > & calib_dl_msum_buffer_
Definition: dobeamweights.h:96
kEnableMatLog
static constexpr bool kEnableMatLog
Definition: symbols.h:174
fmt::v8::printf
auto printf(const S &fmt, const T &... args) -> int
Definition: printf.h:631
DoBeamWeights::~DoBeamWeights
~DoBeamWeights() override
Definition: dobeamweights.cc:79
Config::NumChannels
size_t NumChannels() const
Definition: config.h:98
DoBeamWeights::ComputePrecoder
float ComputePrecoder(size_t frame_id, size_t cur_sc_id, const arma::cx_fmat &mat_csi, const arma::cx_fvec &calib_sc_vec, const float noise, complex_float *ul_beam_mem, complex_float *dl_beam_mem)
Definition: dobeamweights.cc:96
Stats
Definition: stats.h:63
DurationStat::task_duration_
std::array< size_t, kMaxStatBreakdown > task_duration_
Definition: stats.h:23
concurrent_queue_wrapper.h
Config::RecipCalFrameCnt
size_t RecipCalFrameCnt() const
Definition: config.h:171
PhyStats::GetNoise
float GetNoise(size_t frame_id)
Definition: phy_stats.cc:608
kFrameWnd
static constexpr size_t kFrameWnd
Definition: symbols.h:18
Agora_memory::PaddedAlignedAlloc
void * PaddedAlignedAlloc(Alignment_t alignment, size_t size)
Definition: memory_manage.cc:15
fmt::v8::detail::sign
constexpr Char sign(Sign s)
Definition: format.h:929
kUseUlZfForDownlink
static constexpr bool kUseUlZfForDownlink
Definition: dobeamweights.cc:17
memory_manage.h
Config::BsAntNum
size_t BsAntNum() const
Definition: config.h:35
kPrintBeamStats
static constexpr bool kPrintBeamStats
Definition: symbols.h:193
AGORA_LOG_ERROR
#define AGORA_LOG_ERROR(...)
Definition: logger.h:39
kTransposeBlockSize
static constexpr size_t kTransposeBlockSize
Definition: symbols.h:340
DoBeamWeights::pred_csi_buffer_
complex_float * pred_csi_buffer_
Definition: dobeamweights.h:89
PhyStats::UpdateCsiCond
void UpdateCsiCond(size_t frame_id, size_t sc_id, float cond)
Definition: phy_stats.cc:522
Config::RefRadio
size_t RefRadio(size_t id) const
Definition: config.h:101
Config::Frame
const FrameStats & Frame() const
Definition: config.h:340
AGORA_LOG_TRACE
#define AGORA_LOG_TRACE(...)
Definition: logger.h:92
DoBeamWeights::calib_dl_buffer_
Table< complex_float > & calib_dl_buffer_
Definition: dobeamweights.h:92
Config::ModifyRecCalIndex
size_t ModifyRecCalIndex(size_t previous_index, int mod_value=0) const
Definition: config.h:133
Doer
Definition: doer.h:17
Doer::tid_
int tid_
Definition: doer.h:65
Table< complex_float >
DoBeamWeights::ComputePartialCsiBeams
void ComputePartialCsiBeams(size_t tag)
Definition: dobeamweights.cc:451
index
index
Definition: parse_all_dl.m:11
Config::BeamformingAlgo
size_t BeamformingAlgo() const
Definition: config.h:108
kUsePartialTrans
static constexpr bool kUsePartialTrans
Definition: symbols.h:183
EventType::kBeam
@ kBeam
gen_tag_t
Definition: message.h:22
fmt::v8::detail::abs
constexpr std::chrono::duration< Rep, Period > abs(std::chrono::duration< Rep, Period > d)
Definition: chrono.h:1488
DoBeamWeights::num_ext_ref_
size_t num_ext_ref_
Definition: dobeamweights.h:109
Config::OfdmDataNum
size_t OfdmDataNum() const
Definition: config.h:47
kDebugPrintInTask
static constexpr bool kDebugPrintInTask
Definition: symbols.h:201
mat_logger.h
Declaration file for the MatLogger class which records runtime zero-forcing matrices into csv files....
PhyStats::UpdateDlCsi
void UpdateDlCsi(size_t frame_id, size_t sc_id, const arma::cx_fmat &mat_in)
Definition: phy_stats.cc:598
Config::ExternalRefNode
bool ExternalRefNode(size_t id) const
Definition: config.h:110
stats.h
Declaration file for the Stats class. Includes definations for DurationStat and FrameSummery types.
kUseInverseForZF
static constexpr bool kUseInverseForZF
Definition: dobeamweights.cc:16
EventData
Definition: message.h:142
DurationStat::task_count_
size_t task_count_
Definition: stats.h:24
PtrGrid< kFrameWnd, kMaxUEs, complex_float >
message.h
Self defined functions for message storage and passing.
DoBeamWeights::Predict
void Predict(size_t offset)
i
for i
Definition: generate_data.m:107
DoBeamWeights::duration_stat_
DurationStat * duration_stat_
Definition: dobeamweights.h:100
PhyStats::UpdateDlBeam
void UpdateDlBeam(size_t frame_id, size_t sc_id, const arma::cx_fmat &mat_in)
Definition: phy_stats.cc:603
comms-lib.h
Communications Library: a) Generate pilot/preamble sequences b) OFDM modulation.
Agora_memory::Alignment_t::kAlign64
@ kAlign64
DoBeamWeights::ComputeFullCsiBeams
void ComputeFullCsiBeams(size_t tag)
Definition: dobeamweights.cc:383
DoBeamWeights::ext_ref_id_
arma::uvec ext_ref_id_
Definition: dobeamweights.h:108
Config::RecipCalIndex
size_t RecipCalIndex(size_t frame_id) const
Definition: config.h:138
PartialTransposeGather
static void PartialTransposeGather(size_t cur_sc_id, float *src, float *&dst, size_t bs_ant_num)
Definition: dobeamweights.cc:306
DoBeamWeights::csi_gather_buffer_
complex_float * csi_gather_buffer_
Definition: dobeamweights.h:102
DurationStat
Definition: stats.h:22
Doer::cfg_
Config * cfg_
Definition: doer.h:64
FrameStats::NumDLSyms
size_t NumDLSyms() const
Definition: framestats.cc:83
DoBeamWeights::dl_beam_matrices_
PtrGrid< kFrameWnd, kMaxDataSCs, complex_float > & dl_beam_matrices_
Definition: dobeamweights.h:99
GetTime::WorkerRdtsc
static size_t WorkerRdtsc()
Definition: gettime.h:34
Config
Definition: config.h:26
DoBeamWeights::csi_buffers_
PtrGrid< kFrameWnd, kMaxUEs, complex_float > & csi_buffers_
Definition: dobeamweights.h:88
doer.h
Declaration file for the Doer class. The is the base class for all agora doers.
DoBeamWeights::DoBeamWeights
DoBeamWeights(Config *in_config, int tid, PtrGrid< kFrameWnd, kMaxUEs, complex_float > &csi_buffers, Table< complex_float > &calib_dl_buffer, Table< complex_float > &calib_ul_buffer, Table< complex_float > &calib_dl_msum_buffer, Table< complex_float > &calib_ul_msum_buffer, PtrGrid< kFrameWnd, kMaxDataSCs, complex_float > &ul_beam_matrices_, PtrGrid< kFrameWnd, kMaxDataSCs, complex_float > &dl_beam_matrices_, PhyStats *in_phy_stats, Stats *stats_manager)
Definition: dobeamweights.cc:19
zeros
N_SC, NUM_UE, NUM_UE zeros()
dobeamweights.h
Declaration file for the DoBeamWeights class. Zero forcing for one subcarrier.
DoBeamWeights::calib_gather_buffer_
complex_float * calib_gather_buffer_
Definition: dobeamweights.h:104
AGORA_LOG_WARN
#define AGORA_LOG_WARN(...)
Definition: logger.h:53
noise
noise
Definition: generate_data_dl.m:131
Config::BeamBlockSize
size_t BeamBlockSize() const
Definition: config.h:200
Config::NumCells
size_t NumCells() const
Definition: config.h:94
config.h
Declaration file for the configuration class which importants json configuration values into class va...
DoBeamWeights::calib_ul_buffer_
Table< complex_float > & calib_ul_buffer_
Definition: dobeamweights.h:93
gen_tag_t::sc_id_
uint16_t sc_id_
Definition: message.h:39
kMaxUEs
static constexpr size_t kMaxUEs
Definition: symbols.h:289
DoBeamWeights
Definition: dobeamweights.h:20
phy_stats.h
Declaration file for the PhyStats class.
kUseSIMDGather
static constexpr bool kUseSIMDGather
Definition: dobeamweights.cc:13
TransposeGather
static void TransposeGather(size_t cur_sc_id, float *src, float *&dst, size_t bs_ant_num, size_t ofdm_data_num)
Definition: dobeamweights.cc:373
PhyStats::UpdateUlCsi
void UpdateUlCsi(size_t frame_id, size_t sc_id, const arma::cx_fmat &mat_in)
Definition: phy_stats.cc:593
Config::FreqOrthogonalPilot
bool FreqOrthogonalPilot() const
Definition: config.h:208
gen_tag_t::frame_id_
uint32_t frame_id_
Definition: message.h:32
kMaxAntennas
static constexpr size_t kMaxAntennas
Definition: symbols.h:286
PhyStats::RecordCalibMat
void RecordCalibMat(size_t frame_id, size_t sc_id, const arma::cx_fvec &calib_buffer)
Definition: phy_stats.cc:391
DoBeamWeights::calib_ul_msum_buffer_
Table< complex_float > & calib_ul_msum_buffer_
Definition: dobeamweights.h:97
DoBeamWeights::phy_stats_
PhyStats * phy_stats_
Definition: dobeamweights.h:107
Stats::GetDurationStat
DurationStat * GetDurationStat(DoerType doer_type, size_t thread_id)
Definition: stats.h:162
DoBeamWeights::Launch
EventData Launch(size_t tag) override
Definition: dobeamweights.cc:86
Config::BfAntNum
size_t BfAntNum() const
Definition: config.h:39