diff --git a/lib/include/srslte/phy/channel/channel.h b/lib/include/srslte/phy/channel/channel.h index 8df7fafe6..2f53f735c 100644 --- a/lib/include/srslte/phy/channel/channel.h +++ b/lib/include/srslte/phy/channel/channel.h @@ -38,12 +38,14 @@ public: bool enable = false; // Fading options - std::string fading_model = ""; + bool fading_enable = false; + std::string fading_model = "none"; // Delay options - float delay_min_us = 0; - float delay_max_us = 0; - uint32_t delay_period_s = 0; + bool delay_enable = false; + float delay_min_us = 10; + float delay_max_us = 100; + uint32_t delay_period_s = 3600; } args_t; channel(const args_t& channel_args, uint32_t _nof_ports); diff --git a/lib/src/phy/channel/channel.cc b/lib/src/phy/channel/channel.cc index 09775d31c..ea6eaef6b 100644 --- a/lib/src/phy/channel/channel.cc +++ b/lib/src/phy/channel/channel.cc @@ -44,7 +44,8 @@ channel::channel(const channel::args_t& channel_args, uint32_t _nof_ports) nof_ports = _nof_ports; for (uint32_t i = 0; i < nof_ports; i++) { // Create fading channel - if (!channel_args.fading_model.empty() && channel_args.fading_model != "none" && ret == SRSLTE_SUCCESS) { + if (channel_args.fading_enable && !channel_args.fading_model.empty() && channel_args.fading_model != "none" && + ret == SRSLTE_SUCCESS) { fading[i] = (srslte_channel_fading_t*)calloc(sizeof(srslte_channel_fading_t), 1); ret = srslte_channel_fading_init(fading[i], srate_max, channel_args.fading_model.c_str(), 0x1234 * i); } else { @@ -52,7 +53,7 @@ channel::channel(const channel::args_t& channel_args, uint32_t _nof_ports) } // Create delay - if (channel_args.delay_period_s && ret == SRSLTE_SUCCESS) { + if (channel_args.delay_enable && ret == SRSLTE_SUCCESS) { delay[i] = (srslte_channel_delay_t*)calloc(sizeof(srslte_channel_delay_t), 1); ret = srslte_channel_delay_init( delay[i], channel_args.delay_min_us, channel_args.delay_max_us, channel_args.delay_period_s, srate_max); diff --git a/srsue/src/main.cc b/srsue/src/main.cc index d9ab908f4..0977f4574 100644 --- a/srsue/src/main.cc +++ b/srsue/src/main.cc @@ -149,10 +149,12 @@ void parse_args(all_args_t* args, int argc, char* argv[]) /* Channel emulator section */ ("channel.dl.enable", bpo::value(&args->phy.dl_channel_args.enable)->default_value(false), "Enable/Disable internal Downlink channel emulator") - ("channel.dl.fading_model", bpo::value(&args->phy.dl_channel_args.fading_model)->default_value("none"), "Fading model (none, EPA5, EVA70, ETU300, etc)") - ("channel.dl.delay_period", bpo::value(&args->phy.dl_channel_args.delay_period_s)->default_value(3600), "Delay period in seconds (integer)") - ("channel.dl.delay_maximum_us", bpo::value(&args->phy.dl_channel_args.delay_max_us)->default_value(100.0f), "Maximum delay in microseconds") - ("channel.dl.delay_minimum_us", bpo::value(&args->phy.dl_channel_args.delay_min_us)->default_value(0.0f), "Maximum delay in microseconds") + ("channel.dl.fading.enable", bpo::value(&args->phy.dl_channel_args.fading_enable)->default_value(false), "Enable/Disable Fading model") + ("channel.dl.fading.model", bpo::value(&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(&args->phy.dl_channel_args.delay_enable)->default_value(false), "Enable/Disable Delay simulator") + ("channel.dl.delay.period", bpo::value(&args->phy.dl_channel_args.delay_period_s)->default_value(3600), "Delay period in seconds (integer)") + ("channel.dl.delay.maximum_us", bpo::value(&args->phy.dl_channel_args.delay_max_us)->default_value(100.0f), "Maximum delay in microseconds") + ("channel.dl.delay.minimum_us", bpo::value(&args->phy.dl_channel_args.delay_min_us)->default_value(10.0f), "Minimum delay in microseconds") /* Expert section */ ("expert.phy.worker_cpu_mask", diff --git a/srsue/ue.conf.example b/srsue/ue.conf.example index fe3ad20a0..918793d24 100644 --- a/srsue/ue.conf.example +++ b/srsue/ue.conf.example @@ -184,19 +184,24 @@ enable = false # dl.enable: Enable/Disable internal Downlink channel emulator # # -- Fading emulator -# dl.fading_model: Fading model (none, EPA5, EVA70, ETU300, etc) +# dl.fading.enable: Enable/disable fading simulator +# dl.fading.model: Fading model + maximum doppler (E.g. none, epa5, eva70, etu300, etc) # -# -- Delay Emulator: d(t) = d_min + (d_max - d_min) * sin(2pi*t/period) / 2 -# dl.delay_period: Delay period in seconds (integer). -# dl.delay_maximum_us: Maximum delay in microseconds -# dl.delay_minumum_us: Minimum delay in microseconds +# -- Delay Emulator delay(t) = delay_min + (delay_max - delay_min) * sin(2pi*t/period) / 2 +# Maximum speed [m/s]: (delay_max - delay_min) * pi * 300 / period +# dl.delay.enable: Enable/disable delay simulator +# dl.delay.period: Delay period in seconds (integer). +# dl.delay.maximum_us: Maximum delay in microseconds +# dl.delay.minumum_us: Minimum delay in microseconds ##################################################################### [channel] -#dl.enable = false -#dl.fading_model = none -#dl.delay_period = 3600 -#dl.delay_maximum_us = 100 -#dl.delay_minimum_us = 10 +#dl.enable = false +#dl.fading.enable = false +#dl.fading.model = none +#dl.delay.enable = false +#dl.delay.period = 3600 +#dl.delay.maximum_us = 100 +#dl.delay.minimum_us = 10 ##################################################################### # Expert configuration options