Agora
1.2.0
Agora project
|
Go to the documentation of this file.
32 size_t user_thread_num,
size_t worker_thread_num,
33 size_t in_core_offset = 30,
34 std::string in_chan_type = std::string(
"RAYLEIGH"),
35 double in_chan_snr = 20);
60 void DoTx(
size_t frame_id,
size_t symbol_id,
size_t max_ant,
61 size_t ant_per_socket,
const arma::cx_float* source_data,
63 std::vector<std::unique_ptr<UDPComm>>& udp_senders);
65 std::vector<std::pair<std::thread, std::unique_ptr<ChSimRxStorage>>>
68 size_t desired_threads,
size_t total_interfaces,
69 std::vector<std::unique_ptr<UDPComm>>& comm,
ChSimRxBuffer* rx_buffer,
70 std::vector<std::pair<std::thread, std::unique_ptr<ChSimRxStorage>>>&
74 std::vector<std::unique_ptr<UDPComm>>
bs_comm_;
76 std::vector<std::unique_ptr<UDPComm>>
ue_comm_;
95 std::array<std::unique_ptr<moodycamel::ProducerToken>,
kMaxThreads>
120 #endif // CHANNEL_SIM_H_
size_t NumPilotSyms() const
Definition: framestats.cc:91
Declaration file for the ChSimWorkerStorage class.
byte
Definition: core.h:388
Declaration file for the UDPComm class. This class is used to send messages and receive messages from...
void DoTxUser(ChSimWorkerStorage *local, size_t tag)
Definition: channel_sim.cc:560
Definition: concurrentqueue.h:630
size_t bs_thread_num_
Definition: channel_sim.h:104
uint32_t frame_id_
Definition: message.h:168
size_t UeAntNum() const
Definition: config.h:41
moodycamel::ConcurrentQueue< EventData > task_queue_bs_
Definition: channel_sim.h:88
void PinToCoreWithOffset(ThreadType thread_type, size_t core_offset, size_t thread_id, bool allow_reuse, bool verbose)
Definition: utils.cc:157
size_t SampsPerSymbol() const
Definition: config.h:234
size_t NumChannels() const
Definition: config.h:98
size_t NumBeaconSyms() const
Definition: framestats.cc:87
Declaration file for the channel simulator class.
TimeFrameCounters ue_tx_
Definition: channel_sim.h:115
size_t SocketOffset() const
Definition: chsim_worker_storage.h:190
Implementation file for the channel class.
void ScheduleTask(EventData do_task, moodycamel::ConcurrentQueue< EventData > *in_queue, moodycamel::ProducerToken const &ptok)
Definition: channel_sim.cc:136
size_t try_dequeue_bulk(It itemFirst, size_t max)
Definition: concurrentqueue.h:1210
uint16_t symbol_id_
Definition: message.h:33
size_t core_offset_
Definition: channel_sim.h:109
static constexpr size_t kFrameWnd
Definition: symbols.h:18
moodycamel::ConcurrentQueue< EventData > message_queue_
Definition: channel_sim.h:94
size_t DataSize() const
Definition: channel_sim.cc:35
short data_[]
Definition: message.h:173
static double GetTimeUs()
Definition: gettime.h:14
std::vector< std::unique_ptr< UDPComm > > bs_comm_
Definition: channel_sim.h:74
static bool GotExitSignal()
Definition: signal_handler.cc:23
std::vector< std::thread > task_threads_
Definition: channel_sim.h:98
size_t BsAntNum() const
Definition: config.h:35
uint32_t ant_id_
Definition: message.h:171
size_t payload_length_
Definition: channel_sim.h:102
~ChannelSim()
Definition: channel_sim.cc:126
void DoTx(size_t frame_id, size_t symbol_id, size_t max_ant, size_t ant_per_socket, const arma::cx_float *source_data, SimdAlignByteVector *udp_pkt_buf, std::vector< std::unique_ptr< UDPComm >> &udp_senders)
Warning: Threads are sharing these sender sockets.
Definition: channel_sim.cc:433
const Config *const cfg_
Definition: channel_sim.h:78
size_t StorageSize() const
Definition: channel_sim.cc:36
std::vector< std::unique_ptr< UDPComm > > ue_comm_
Definition: channel_sim.h:76
void RemoveData(size_t remove)
Definition: channel_sim.cc:47
std::array< size_t, kMaxTags > tags_
Definition: message.h:146
void DoTxBs(ChSimWorkerStorage *local, size_t tag)
Definition: channel_sim.cc:471
#define AGORA_LOG_ERROR(...)
Definition: logger.h:39
size_t data_size_
Definition: channel_sim.cc:60
const FrameStats & Frame() const
Definition: config.h:340
moodycamel::ConcurrentQueue< EventData > & ResponseQueue()
Definition: chsim_worker_storage.h:197
static constexpr bool kPrintDebugTxUser
Definition: channel_sim.cc:19
static void * RxLoop(ChSimRxStorage *rx_storage)
Definition: channel_sim.cc:363
int UeServerPort() const
Definition: config.h:306
#define AGORA_LOG_TRACE(...)
Definition: logger.h:92
size_t PacketLength() const
Definition: chsim_worker_storage.h:189
static std::vector< std::unique_ptr< UDPComm > > CreateCommSockets(const std::string &local_address, int local_port, const std::string &remote_address, int remote_port, size_t interface_count)
Definition: channel_sim.cc:651
ChannelSim(const Config *const config, size_t bs_thread_num, size_t user_thread_num, size_t worker_thread_num, size_t in_core_offset=30, std::string in_chan_type=std::string("RAYLEIGH"), double in_chan_snr=20)
Definition: channel_sim.cc:64
bool CompleteSymbol(size_t frame_id)
Definition: time_frame_counters.h:23
TimeFrameCounters ue_rx_
Definition: channel_sim.h:114
std::string channel_type_
Definition: channel_sim.h:111
static constexpr bool kDebugPrintInTask
Definition: symbols.h:201
static void SimdConvertShortToFloat(const short *in_buf, float *out_buf, size_t n_elems)
Definition: datatype_conversion.h:126
std::unique_ptr< Channel > channel_
Definition: channel_sim.h:79
Definition: message.h:142
double GetTaskTotalTimeMs(size_t frame_id, size_t symbol_id) const
Definition: time_frame_counters.h:59
std::vector< std::pair< std::thread, std::unique_ptr< ChSimRxStorage > > > CreateRxThreads()
Definition: channel_sim.cc:709
int BsRruPort() const
Definition: config.h:305
size_t CoreId() const
Definition: chsim_worker_storage.h:188
TimeFrameCounters bs_tx_
Definition: channel_sim.h:117
uint16_t ant_id_
Definition: message.h:38
std::byte * Rx()
Definition: channel_sim.cc:37
Self defined functions for message storage and passing.
Definition: time_frame_counters.h:15
int BsServerPort() const
Definition: config.h:304
static gen_tag_t FrmSymAnt(size_t frame_id, size_t symbol_id, size_t ant_id)
Definition: message.h:106
void Reset(size_t frame_id)
Definition: time_frame_counters.h:22
static constexpr double kChannelTimeWarning
Definition: channel_sim.cc:22
Definition: chsim_worker_storage.h:115
for i
Definition: generate_data.m:107
size_t Id() const
Definition: chsim_worker_storage.h:187
static constexpr size_t kOffsetOfData
Definition: message.h:166
bool enqueue(T const &item)
Definition: concurrentqueue.h:974
Definition: chsim_worker_storage.h:171
Plot Rx waveform for u
Definition: inspect_single_frame.m:108
void TransferRxData(size_t frame, size_t symbol, size_t ant, const short *input, size_t data_size)
Definition: chsim_worker_storage.h:193
void Run()
Definition: channel_sim.cc:148
UDPComm * Socket(size_t id)
Definition: chsim_worker_storage.h:192
std::string BsServerAddr() const
Definition: config.h:299
Definition: chsim_worker_storage.h:19
size_t user_thread_num_
Definition: channel_sim.h:105
Definition: message.h:164
ssize_t Recv(std::byte *buf, size_t len) const
Try to receive up to len bytes in buf by default this will not block.
Definition: udp_comm.cc:372
SocketRxBuffer(size_t num_bytes)
Definition: channel_sim.cc:32
uint32_t symbol_id_
Definition: message.h:169
void * BsRxLoop(size_t tid)
std::unique_ptr< ChSimRxBuffer > rx_buffer_ue_
Definition: channel_sim.h:85
moodycamel::ConcurrentQueue< EventData > task_queue_user_
Definition: channel_sim.h:91
size_t dl_data_plus_beacon_symbols_
Definition: channel_sim.h:101
double GetTaskEndTimeUs(size_t frame_id, size_t symbol_id) const
Definition: time_frame_counters.h:81
bool CompleteTask(size_t frame_id, size_t symbol_id)
Definition: time_frame_counters.h:35
double channel_snr_
Definition: channel_sim.h:112
const std::byte * At(size_t location) const
Definition: channel_sim.cc:38
size_t ul_data_plus_pilot_symbols_
Definition: channel_sim.h:100
std::vector< std::byte, boost::alignment::aligned_allocator< std::byte, kSimdAlignment > > SimdAlignByteVector
Definition: simd_types.h:18
size_t NumDLSyms() const
Definition: framestats.cc:83
void AddData(size_t data)
Definition: channel_sim.cc:41
SymbolType GetSymbolType(size_t symbol_id) const
Return the symbol type of this symbol in this frame.
Definition: config.cc:1557
size_t user_socket_num_
Definition: channel_sim.h:107
size_t NumULSyms() const
Definition: framestats.cc:85
size_t worker_thread_num_
Definition: channel_sim.h:108
#define AGORA_LOG_SYMBOL(...)
Definition: logger.h:82
static constexpr size_t kMaxThreads
Definition: symbols.h:309
static constexpr bool kEnableChannelTiming
Definition: channel_sim.cc:21
static constexpr size_t kUdpMTU
Definition: channel_sim.cc:24
size_t NumUeChannels() const
Definition: config.h:99
#define AGORA_LOG_INFO(...)
Definition: logger.h:62
Definition: json.hpp:5213
Definition: channel_sim.cc:30
#define AGORA_LOG_FRAME(...)
Definition: logger.h:72
static void RtAssert(bool condition, const char *throw_str)
Definition: utils.h:104
static constexpr bool kDebugPrintPerSymbolDone
Definition: symbols.h:198
#define AGORA_LOG_WARN(...)
Definition: logger.h:53
TimeFrameCounters bs_rx_
Definition: channel_sim.h:116
void * TaskThread(size_t tid)
Definition: channel_sim.cc:340
SPDLOG_INLINE int remove(const filename_t &filename) SPDLOG_NOEXCEPT
Definition: os-inl.h:163
static constexpr bool kPrintDebugTxBs
Definition: channel_sim.cc:20
void Init(size_t max_symbol_count, size_t max_task_count=0)
Definition: time_frame_counters.h:19
~SocketRxBuffer()=default
std::string to_string() const
Definition: eth_common.h:64
static void SimdConvertFloatToShort(const float *in_buf, short *out_buf, size_t n_elems, size_t n_prefix=0, float scale_down_factor=1.0f)
Definition: datatype_conversion.h:266
int UeRruPort() const
Definition: config.h:307
Declaration file for the configuration class which importants json configuration values into class va...
static constexpr size_t kDequeueBulkSize
Definition: channel_sim.cc:25
static constexpr bool kPrintChannelOutput
Definition: channel_sim.cc:17
bool try_dequeue(U &item)
Definition: concurrentqueue.h:1104
static std::atomic< bool > running
Definition: channel_sim.cc:16
Definition: concurrentqueue.h:695
Declaration file for the TimeFrameCounters class.
bool try_enqueue(T const &item)
Definition: concurrentqueue.h:1039
size_t PacketLength() const
Definition: config.h:238
Simualtor for many-antenna MU-MIMO channel to work with Agora BS and UE applications....
Definition: channel_sim.h:29
std::unique_ptr< ChSimRxBuffer > rx_buffer_bs_
Definition: channel_sim.h:82
uint32_t frame_id_
Definition: message.h:32
static void PrintMat(const arma::cx_fmat &c, const std::string &ss)
Definition: utils.cc:452
size_t AddRxThreads(size_t desired_threads, size_t total_interfaces, std::vector< std::unique_ptr< UDPComm >> &comm, ChSimRxBuffer *rx_buffer, std::vector< std::pair< std::thread, std::unique_ptr< ChSimRxStorage >>> &rx_threads_out)
Definition: channel_sim.cc:673
size_t bs_socket_num_
Definition: channel_sim.h:106
std::array< std::unique_ptr< moodycamel::ProducerToken >, kMaxThreads > task_ptok_
Definition: channel_sim.h:96
std::string UeRruAddr() const
Definition: config.h:301
static constexpr bool kDebugPrintPerFrameDone
Definition: symbols.h:196
static constexpr size_t kSockBufSize
Definition: channel_sim.cc:26
std::string UeServerAddr() const
Definition: config.h:298
std::string BsRruAddr() const
Definition: config.h:302
size_t NumTotalSyms() const
Definition: framestats.cc:93
void * UeRxLoop(size_t tid)
size_t SocketNumber() const
Definition: chsim_worker_storage.h:191
SimdAlignByteVector data_
Definition: channel_sim.cc:61
static constexpr size_t kDefaultQueueSize
Definition: channel_sim.cc:18