Added AWGN channel to SRSUE and SRSENB

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent c107b04f5a
commit 8e891b7038

@ -39,6 +39,10 @@ public:
// General
bool enable = false;
// AWGN options
bool awgn_enable = false;
float awgn_n0_dBfs = -30.0f;
// Fading options
bool fading_enable = false;
std::string fading_model = "none";
@ -71,6 +75,7 @@ public:
private:
srslte_channel_fading_t* fading[SRSLTE_MAX_CHANNELS] = {};
srslte_channel_delay_t* delay[SRSLTE_MAX_CHANNELS] = {};
srslte_channel_awgn_t* awgn = nullptr;
srslte_channel_hst_t* hst = nullptr; // HST has no buffers / no multiple instance is required
srslte_channel_rlf_t* rlf = nullptr; // RLF has no buffers / no multiple instance is required
cf_t* buffer_in = nullptr;

@ -74,6 +74,13 @@ channel::channel(const channel::args_t& channel_args, uint32_t _nof_channels)
}
}
// Create AWGN channnel
if (channel_args.awgn_enable && ret == SRSLTE_SUCCESS) {
awgn = (srslte_channel_awgn_t*)calloc(sizeof(srslte_channel_awgn_t), 1);
ret = srslte_channel_awgn_init(awgn, 1234);
srslte_channel_awgn_set_n0(awgn, args.awgn_n0_dBfs);
}
// Create high speed train
if (channel_args.hst_enable && ret == SRSLTE_SUCCESS) {
hst = (srslte_channel_hst_t*)calloc(sizeof(srslte_channel_hst_t), 1);
@ -101,6 +108,11 @@ channel::~channel()
free(buffer_out);
}
if (awgn) {
srslte_channel_awgn_free(awgn);
free(awgn);
}
if (hst) {
srslte_channel_hst_free(hst);
free(hst);
@ -143,6 +155,11 @@ void channel::run(cf_t* in[SRSLTE_MAX_CHANNELS],
// Copy input buffer
memcpy(buffer_in, in[i], sizeof(cf_t) * len);
if (awgn) {
srslte_channel_awgn_run_c(awgn, buffer_in, buffer_out, len);
memcpy(buffer_in, buffer_out, sizeof(cf_t) * len);
}
if (fading[i]) {
srslte_channel_fading_execute(fading[i], buffer_in, buffer_out, len, t.full_secs + t.frac_secs);
memcpy(buffer_in, buffer_out, sizeof(cf_t) * len);

@ -175,6 +175,10 @@ pusch_max_mcs = 16
# Channel emulator options:
# enable: Enable/Disable internal Downlink/Uplink channel emulator
#
# -- AWGN Generator
# awgn.enable: Enable/disable AWGN generator
# awgn.n0: Noise power in dBfs
#
# -- Fading emulator
# fading.enable: Enable/disable fading simulator
# fading.model: Fading model + maximum doppler (E.g. none, epa5, eva70, etu300, etc)
@ -201,6 +205,10 @@ pusch_max_mcs = 16
[channel.dl]
#enable = false
[channel.dl.awgn]
#enable = false
#n0 = -30
[channel.dl.fading]
#enable = false
#model = none
@ -226,6 +234,10 @@ pusch_max_mcs = 16
[channel.ul]
#enable = false
[channel.ul.awgn]
#enable = false
#n0 = -30
[channel.ul.fading]
#enable = false
#model = none

@ -134,6 +134,8 @@ void parse_args(all_args_t* args, int argc, char* argv[])
/* Downlink Channel emulator section */
("channel.dl.enable", bpo::value<bool>(&args->phy.dl_channel_args.enable)->default_value(false), "Enable/Disable internal Downlink channel emulator")
("channel.dl.awgn.enable", bpo::value<bool>(&args->phy.dl_channel_args.awgn_enable)->default_value(false), "Enable/Disable AWGN simulator")
("channel.dl.awgn.n0", bpo::value<float>(&args->phy.dl_channel_args.awgn_n0_dBfs)->default_value(-30.0f), "Noise level in decibels full scale (dBfs)")
("channel.dl.fading.enable", bpo::value<bool>(&args->phy.dl_channel_args.fading_enable)->default_value(false), "Enable/Disable Fading model")
("channel.dl.fading.model", bpo::value<std::string>(&args->phy.dl_channel_args.fading_model)->default_value("none"), "Fading model + maximum doppler (E.g. none, epa5, eva70, etu300, etc)")
("channel.dl.delay.enable", bpo::value<bool>(&args->phy.dl_channel_args.delay_enable)->default_value(false), "Enable/Disable Delay simulator")
@ -151,6 +153,8 @@ void parse_args(all_args_t* args, int argc, char* argv[])
/* Uplink Channel emulator section */
("channel.ul.enable", bpo::value<bool>(&args->phy.ul_channel_args.enable)->default_value(false), "Enable/Disable internal Uplink channel emulator")
("channel.ul.awgn.enable", bpo::value<bool>(&args->phy.ul_channel_args.awgn_enable)->default_value(false), "Enable/Disable AWGN simulator")
("channel.ul.awgn.n0", bpo::value<float>(&args->phy.ul_channel_args.awgn_n0_dBfs)->default_value(-30.0f), "Noise level in decibels full scale (dBfs)")
("channel.ul.fading.enable", bpo::value<bool>(&args->phy.ul_channel_args.fading_enable)->default_value(false), "Enable/Disable Fading model")
("channel.ul.fading.model", bpo::value<std::string>(&args->phy.ul_channel_args.fading_model)->default_value("none"), "Fading model + maximum doppler (E.g. none, epa5, eva70, etu300, etc)")
("channel.ul.delay.enable", bpo::value<bool>(&args->phy.ul_channel_args.delay_enable)->default_value(false), "Enable/Disable Delay simulator")

@ -72,7 +72,7 @@ bool phy_common::init(const phy_cell_cfg_list_t& cell_list_,
pthread_cond_init(&mtch_cvar, nullptr);
// Instantiate DL channel emulator
if (params.ul_channel_args.enable) {
if (params.dl_channel_args.enable) {
dl_channel = srslte::channel_ptr(new srslte::channel(params.dl_channel_args, 1));
dl_channel->set_srate((uint32_t)srslte_sampling_freq_hz(cell_list[0].cell.nof_prb));
}

@ -172,6 +172,8 @@ static int parse_args(all_args_t* args, int argc, char* argv[])
/* Downlink Channel emulator section */
("channel.dl.enable", bpo::value<bool>(&args->phy.dl_channel_args.enable)->default_value(false), "Enable/Disable internal Downlink channel emulator")
("channel.dl.awgn.enable", bpo::value<bool>(&args->phy.dl_channel_args.awgn_enable)->default_value(false), "Enable/Disable AWGN simulator")
("channel.dl.awgn.n0", bpo::value<float>(&args->phy.dl_channel_args.awgn_n0_dBfs)->default_value(-30.0f), "Noise level in decibels full scale (dBfs)")
("channel.dl.fading.enable", bpo::value<bool>(&args->phy.dl_channel_args.fading_enable)->default_value(false), "Enable/Disable Fading model")
("channel.dl.fading.model", bpo::value<std::string>(&args->phy.dl_channel_args.fading_model)->default_value("none"), "Fading model + maximum doppler (E.g. none, epa5, eva70, etu300, etc)")
("channel.dl.delay.enable", bpo::value<bool>(&args->phy.dl_channel_args.delay_enable)->default_value(false), "Enable/Disable Delay simulator")
@ -189,6 +191,8 @@ static int parse_args(all_args_t* args, int argc, char* argv[])
/* Uplink Channel emulator section */
("channel.ul.enable", bpo::value<bool>(&args->phy.ul_channel_args.enable)->default_value(false), "Enable/Disable internal Uplink channel emulator")
("channel.ul.awgn.enable", bpo::value<bool>(&args->phy.ul_channel_args.awgn_enable)->default_value(false), "Enable/Disable AWGN simulator")
("channel.ul.awgn.n0", bpo::value<float>(&args->phy.ul_channel_args.awgn_n0_dBfs)->default_value(-30.0f), "Noise level in decibels full scale (dBfs)")
("channel.ul.fading.enable", bpo::value<bool>(&args->phy.ul_channel_args.fading_enable)->default_value(false), "Enable/Disable Fading model")
("channel.ul.fading.model", bpo::value<std::string>(&args->phy.ul_channel_args.fading_model)->default_value("none"), "Fading model + maximum doppler (E.g. none, epa5, eva70, etu300, etc)")
("channel.ul.delay.enable", bpo::value<bool>(&args->phy.ul_channel_args.delay_enable)->default_value(false), "Enable/Disable Delay simulator")

@ -186,6 +186,10 @@ enable = false
# Channel emulator options:
# enable: Enable/Disable internal Downlink/Uplink channel emulator
#
# -- AWGN Generator
# awgn.enable: Enable/disable AWGN generator
# awgn.n0: Noise power in dBfs
#
# -- Fading emulator
# fading.enable: Enable/disable fading simulator
# fading.model: Fading model + maximum doppler (E.g. none, epa5, eva70, etu300, etc)
@ -212,6 +216,10 @@ enable = false
[channel.dl]
#enable = false
[channel.dl.awgn]
#enable = false
#n0 = -30
[channel.dl.fading]
#enable = false
#model = none
@ -237,6 +245,10 @@ enable = false
[channel.ul]
#enable = false
[channel.ul.awgn]
#enable = false
#n0 = -30
[channel.ul.fading]
#enable = false
#model = none

Loading…
Cancel
Save