Merge remote-tracking branch 'origin/739-rf-channel-sim-improvements' into integration_2024_w09

This commit is contained in:
Jaroslava Fiedlerova
2024-03-04 17:39:13 +01:00
20 changed files with 242 additions and 742 deletions
-1
View File
@@ -14,7 +14,6 @@ int8_t threequarter_fs;
uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
int opp_enabled;
static double snr_dB=20;
THREAD_STRUCT thread_struct;
uint32_t target_ul_mcs = 9;
uint32_t target_dl_mcs = 9;
-6
View File
@@ -551,9 +551,6 @@ typedef struct PHY_VARS_eNB_NB_IoT_s {
int max_eNB_id, max_sync_pos;
///
int N_TA_offset; ///timing offset used in TDD
/// \brief sinr for all subcarriers of the current link (used only for abstraction).
/// first index: ? [0..N_RB_DL*12[
double *sinr_dB;
/// N0 (used for abstraction)
double N0;
///
@@ -885,9 +882,6 @@ typedef struct {
int mac_enabled;
/// Flag to initialize averaging of PHY measurements
int init_averaging;
/// \brief sinr for all subcarriers of the current link (used only for abstraction).
/// - first index: ? [0..12*N_RB_DL[
double *sinr_dB;
/// \brief sinr for all subcarriers of first symbol for the CQI Calculation.
/// - first index: ? [0..12*N_RB_DL[
double *sinr_CQI_dB;
-4
View File
@@ -738,10 +738,6 @@ typedef struct {
/// Flag to initialize averaging of PHY measurements
int init_averaging;
/// \brief sinr for all subcarriers of the current link (used only for abstraction).
/// - first index: ? [0..12*N_RB_DL[
double *sinr_dB;
/// \brief sinr for all subcarriers of first symbol for the CQI Calculation.
/// - first index: ? [0..12*N_RB_DL[
double *sinr_CQI_dB;
-4
View File
@@ -616,10 +616,6 @@ typedef struct PHY_VARS_eNB_s {
uint32_t max_peak_val;
int max_eNB_id, max_sync_pos;
/// \brief sinr for all subcarriers of the current link (used only for abstraction).
/// first index: ? [0..N_RB_DL*12[
double *sinr_dB;
/// N0 (used for abstraction)
double N0;
-4
View File
@@ -512,10 +512,6 @@ typedef struct PHY_VARS_NR_UE_s {
/// Flag to initialize averaging of PHY measurements
int init_averaging;
/// \brief sinr for all subcarriers of the current link (used only for abstraction).
/// - first index: ? [0..12*N_RB_DL[
double *sinr_dB;
/// sinr_effective used for CQI calulcation
double sinr_eff;
-9
View File
@@ -1,9 +0,0 @@
# Channel simulation source files
1. [random_channel.c](../random_channel.c)
1. [sim.h](../sim.h)
[channel simulation main page](channel_simulation.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
@@ -1,13 +1,206 @@
[[_TOC_]]
# OAI channel simulation feature
oai includes a channel simulation feature that any component can use to alter time domain samples of a RF channel by applying pre-defined models as defined, for example, in 3GPP TR 36.873 or TR 38.901
OpenAirInterface RFSimulator incorporates a channel simulation feature. This feature allows any component to modify the time domain samples of a RF channel. It achieves this by applying predefined models, such as those defined in 3GPP TR 36.873 or TR 38.901.
Definition, configuration and run-time modification of a channel model are implemented in common code included in UEs, gNb, eNB and used when running with the rfsimulator or the L1 simulator. Phy simulators are also using channel simulation but configuration is done via dedicated command line options. The rfsimulator is the only option to get access to all the configurations and run-time modifications features of oai channel simulation.
The definition, configuration, and real-time modification of a channel model are implemented in a common code. This code is included in UE, gNB and eNB. It is utilized when operating with the RFSimulator or the L1 simulator. PHY simulators also employ channel simulation, but their configuration is accomplished via dedicated command-line options.
## Documentation
The RFSimulator is the exclusive option that provides access to all the configuration and real-time modification features of OAI's channel simulation. This makes it a comprehensive tool for managing and manipulating channel simulations in OAI.
* [runtime usage](rtusage.md)
* [developer usage](devusage.md)
* [module architecture](arch.md)
# Implementation
OAI channel simulation is using the [config module](../../../../common/config/DOC/config.md) to get its parameters at init time. The [telnet server](../../../../common/utils/telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify some channel model parameters.
The relevant source files are:
1. [`radio/rfsimulator/simulator.c`](../../../../radio/rfsimulator/simulator.c)
2. [`radio/rfsimulator/apply_channelmod.c`](../../../../radio/rfsimulator/apply_channelmod.c)
3. [`random_channel.c`](../random_channel.c)
4. [`sim.h`](../sim.h)
All channel parameters are set depending on the model name via a call to:
```bash
channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
uint8_t nb_rx,
SCM_t channel_model,
double sampling_rate,
uint64_t center_freq,
double channel_bandwidth,
double DS_TDL,
double maxDoppler,
const corr_level_t corr_level,
double forgetting_factor,
int32_t channel_offset,
double path_loss_dB,
float noise_power_dB);
```
# Channel Model configuration file
To define and use a channel model for uplink, the gNB configuration file needs to include a channel configuration file. To do this, add `@include "channelmod_rfsimu.conf"` at the end of the gNB configuration file, and place the channel configuration file in the same directory. The same shall be done for downlink by including the channel model configuration file at the end of UE configuration file (e.g. [`ci-scripts/conf_files/nrue.uicc.conf`](../../../../ci-scripts/conf_files/nrue.uicc.conf)).
All channel simulation parameters are defined in the `channelmod` section. Most parameters are specific to a channel model and are only used by the rfsimulator. An example of the configuration file can be found here:
* [`ci-scripts/conf_files/channelmod_rfsimu.conf`](../../../../ci-scripts/conf_files/channelmod_rfsimu.conf)
e.g.:
```bash
channelmod = {
max_chan = 10;
modellist = "modellist_rfsimu_1";
modellist_rfsimu_1 = (
{
model_name = "rfsimu_channel_enB0"
type = "AWGN";
ploss_dB = 20;
noise_power_dB = -4;
forgetfact = 0;
offset = 0;
ds_tdl = 0;
},
{
model_name = "rfsimu_channel_ue0"
type = "AWGN";
ploss_dB = 20;
noise_power_dB = -2;
forgetfact = 0;
offset = 0;
ds_tdl = 0;
}
);
};
```
where `rfsimu_channel_ue0` will be activated on server side (i.e. eNB/gNB) for uplink and `rfsimu_channel_enB0` will be activated on client side (i.e. UE) for downlink.
# Run OAI with a channel model
When the `chanmod` option is enabled, the RF channel simulator with a channel modeling function is called. Add the following options to the command line to enable the channel model:
```bash
--rfsimulator.options chanmod
```
Example run of OAI RFSIM on the same machine with activation of the channel model via command line:
gNB:
```bash
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --sa --rfsimulator.options chanmod --telnetsrv
```
UE:
```bash
sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa --rfsimulator.serveraddr 127.0.0.1 --uicc0.imsi 001010000000001 -O ../../../ci-scripts/conf_files/nrue.uicc.conf --rfsimulator.options chanmod
```
where `@include "channelmod_rfsimu.conf"` has been added at the end of `ci-scripts/conf_files/channelmod_rfsimu.conf` which has been copied to `targets/PROJECTS/GENERIC-LTE-EPC/CONF/`.
## Set channel simulation parameters via CL:
Channel simulation parameters can also be specified on the command line by using the `--channelmod` option:
### Global parameters
| CL option |type |default | description |
|:--- |:---- |:---- |:----|
|`modellist` |char string |`DefaultChannelList`|select and load the `modellist` from the config file.|
|`max_chan` |integer |10 |set the maximum number of channel models that can be defined in the system. Must be greater than the number of model definitions in the model list loaded at init time.|
Example usage:
```bash
--channelmod.modellist modellist_rfsimu_2
```
### Model lists
Several model lists can be defined in the OAI channel simulation configuration file. One, defined by the `modellist` parameter is loaded at init time. In the configuration file each model list item describes a channel model using a group of parameters:
|Parameter name |Type |Default |Description |
|:--- |:---: |---: |:---- |
| `model_name` |char string | mandatory |name of the model, as used in the code to retrieve a model definition.|
| `type` |char string | `AWGN` |name of the channel modelization algorithm applied on RF signal. The list of available models is defined in [`sim.h`](../sim.h]|
| `ploss_dB` |real (float) | 0|total path loss of the channel including shadow fading, in dB |
| `noise_power_dB`|real (double)| -50|Noise power in dB, used to compute the SNR. Its value is proportional to the noise added.|
| `forgetfact` |real (double)| 0|Forgetting factor, allows for simple 1st order temporal variation. 0 means a new channel every call, 1 means keep channel constant all the time|
| `offset` |integer | 0|channel offset for accessing the input signal, in samples|
| `ds_tdl` |real double | 0|delay spread for TDL models|
`ploss_dB` and `noise_power_dB` are applied to each IQ sample in order to scale the received signal.
Example usage, set the offset for the selected model of the selected `modellist`:
```bash
--channelmod.<modellist>.[<model ID>].offset
```
e.g. with the softmodem:
```bash
sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --rfsim --sa --rfsimulator.options chanmod --telnetsrv --channelmod.modellist modellist_rfsimu_2 --channelmod.modellist_rfsimu_2.[1].offset 120
```
## Real time control and monitoring with telnet server
Add the `--telnetsrv` option to the command line. Then in a new shell, connect to the telnet server, e.g.:
```bash
$ telnet 127.0.0.1 9090
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'
```
to enter the command and control of the simulator press any key: `softmodem_enb` will be displayed for the eNB/gNB and `softmodem_5Gue` will be displayed for the UE. Select a different port in order to use both servers on the same machine.
The telnet server includes two modules to change the RF channel simulation in real-time:
1. `channelmod` to dynamically modify the channel model configuration parameters
2. `rfsimu` to set a different channel model
They both have their own help:
```bash
softmodem_enb> help
.....................................
module 4 = channelmod:
channelmod help
channelmod show <predef,current>
channelmod modify <channelid> <param> <value>
channelmod show params <channelid> <param> <value>
module 5 = rfsimu:
rfsimu setmodel <model name> <model type>
rfsimu setdistance <model name> <distance>
rfsimu getdistance <model name>
rfsimu vtime
softmodem_enb> channelmod help
channelmod commands can be used to display or modify channel models parameters
channelmod show predef: display predefined model algorithms available in oai
channelmod show current: display the currently used models in the running executable
channelmod modify <model index> <param name> <param value>: set the specified parameters in a current model to the given value
<model index> specifies the model, the show current model command can be used to list the current models indexes
<param name> can be one of "riceanf", "aoa", "randaoa", "ploss", "noise_power_dB", "offset", "forgetf"
softmodem_enb>
```
### channelmod module
Example usage:
| Command |Description |
|:--- |:---- |
|`channelmod show current` |Monitor the current status |
|`channelmod show predef` |See the available channel modelss|
|`channelmod modify <channelid> <param> <value>`|Set parameters specific to the channel model, e.g. pathloss, Ricean factor|
Where `<param>` in the `channelmod modify` command can be:
|Parameter |Type |Range |Description |
|:--- |:---: |:---: |:---- |
|`riceanf` |double|0 to 1 |Ricean factor, of first tap w.r.t. other taps (where 0 means AWGN and 1 means Rayleigh channel)|
|`aoa` |double|0 to 2*Pi|Angle of arrival of wavefront (in radians). For Ricean channel only. This assumes that both RX and TX have linear antenna arrays with lambda/2 antenna spacing. Also it is assumed that the arrays are parallel to each other and that they are far enough apart so that we can safely assume plane wave propagation. |
|`randaoa` |bool |0 or 1 |randomized angle of arrival according to a uniform random distribution|
|`ploss` |double|- |same as ploss_dB in [Model lists](#model-lists)|
|`noise_power_dB`|int |- |same as noise_power_dB in [Model lists](#model-lists)|
|`forgetf` |double|0 to 1 |same as forgetfact in [Model lists](#model-lists)|
Example usage:
```bash
channelmod modify 0 ploss 12
channelmod modify 0 noise_power_dB 3
```
### rfsimu module
This module can be used to set a different channel model, e.g. `rfsimu setmodel AWGN`.
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
@@ -1,7 +0,0 @@
### channel simulation developer usage
[Configuring the channel simulation](rtusage.md)
[channel simulation main page](channel_simulation.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
-69
View File
@@ -1,69 +0,0 @@
## configuring the channel simulation
Oai channel simulation is using the [config module](../../../config/config.md) to get its parameters at init time. The [telnet server](../../telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify some channel model parameters
All channel simulation parameters are defined in the `channelmod` section. Most parameters are specific to a channel model and are only used by the rfsimulator.
### global parameters
| name | type | default | description |
|:---:|:---:|:---:|:----|
| `max_chan` | integer | `25` | Maximum number of channel model that can be defined in the system. Must be greater than the number of model definitions in the model list loaded at init time. |
| `modellist` | character string | `DefaultChannelList` | Name of the channel models list to load at init time. |
### Model lists
Several model lists can be defined in the oai configuration file. One, defined by the `modellist` parameter is loaded at init time. In the configuration file each model list item describes a channel model using a group of parameters:
| parameter name | type | default | description |
|:---:|:---:|:---:|:----|
| `model name` | character string | mandatory |name of the model, as used in the code to retrieve a model definition|
| `type` | | `AWGN` | name of the channel modelization algorithm applied on rf signal. The list of available model types can be listed via the [telnet server](../../telnetsrv/DOC/telnetsrv.md) or by entering an invalid type name |
| `ploss_dB` | real (float) | | path loss of the channel, in dB |
| `noise_power_dB` | real (double) | | noise of the channel in dB |
| `forgetfact` | real (double) | | |
| `offset` | integer | | |
| `ds_tdl` | real double | | |
Channel simulation parameters can also be specified on the command line:
```bash
./lte-softmodem -O ../../../ci-scripts/conf_files/enb.band7.tm1.50prb.usrpb210.conf --noS1 --rfsim --rfsimulator.options chanmod --rfsimulator.serveraddr enb --telnetsrv --channelmod.modellist modellist_rfsimu_2 --channelmod.modellist_rfsimu_2.[1].offset 120
```
### Using the telnet server to modify channel simulator parameters
The telnet server includes a `channelmod` command which can be used to dynamically modify some channel model parameters. This command is only available when channel simulation is enabled (via `rfsimulator.options chanmod` option when running the rfsimulator. `channelmod` command has its own help:
```
$ telnet 127.0.0.1 9090
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
softmodem_enb> help
.....................................
module 6 = channelmod:
channelmod help
channelmod show <predef,current>
channelmod modify <channelid> <param> <value>
module 7 = rfsimu:
rfsimu setmodel <model name> <model type>
softmodem_enb> channelmod help
channelmod commands can be used to display or modify channel models parameters
channelmod show predef: display predefined model algorithms available in oai
channelmod show current: display the currently used models in the running executable
channelmod modify <model index> <param name> <param value>: set the specified parameters in a current model to the given value
<model index> specifies the model, the show current model command can be used to list the current models indexes
<param name> can be one of "riceanf", "aoa", "randaoa", "ploss", "noise_power_dB", "offset", "forgetf"
softmodem_enb>
```
The [rfsimulator documentation](../../../../radio/rfsimulator/README.md ) has also some specific information when using the channel simulation via this tool.
[channel simulation main page](channel_simulation.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
@@ -72,8 +72,6 @@ static telnetshell_cmddef_t channelmod_cmdarray[] = {
static telnetshell_vardef_t channelmod_vardef[] = {{"", 0, 0, NULL}};
static double snr_dB=25;
static double sinr_dB=0;
static unsigned int max_chan;
static channel_desc_t **defined_channels;
static char *modellist_name;
@@ -2261,14 +2259,6 @@ int modelid_fromstrtype(char *modeltype) {
return modelid;
}
double channelmod_get_snr_dB(void) {
return snr_dB;
}
double channelmod_get_sinr_dB(void) {
return sinr_dB;
}
void init_channelmod(void) {
paramdef_t channelmod_params[] = CHANNELMOD_PARAMS_DESC;
int numparams = sizeofArray(channelmod_params);
-9
View File
@@ -264,8 +264,6 @@ typedef enum {
#define CHANNELMOD_HELP_MODELLIST "<list name> channel list name in config file describing the model type and its parameters\n"
// clang-format off
#define CHANNELMOD_PARAMS_DESC { \
{"s" , CONFIG_HLP_SNR, PARAMFLAG_CMDLINE_NOPREFIXENABLED, .dblptr=&snr_dB, .defdblval=25, TYPE_DOUBLE, 0}, \
{"sinr_dB", NULL, 0, .dblptr=&sinr_dB, .defdblval=0 , TYPE_DOUBLE, 0}, \
{"max_chan", "Max number of runtime models", 0, .uptr=&max_chan, .defintval=10, TYPE_UINT, 0}, \
{CHANNELMOD_MODELLIST_PARANAME, CHANNELMOD_HELP_MODELLIST, 0, .strptr=&modellist_name, .defstrval="DefaultChannelList", TYPE_STRING, 0}, \
}
@@ -302,18 +300,11 @@ typedef struct {
double r_re_UL[NUMBER_OF_eNB_MAX][2][30720];
double r_im_UL[NUMBER_OF_eNB_MAX][2][30720];
int RU_output_mask[NUMBER_OF_UE_MAX];
int UE_output_mask[NUMBER_OF_RU_MAX];
pthread_mutex_t RU_output_mutex[NUMBER_OF_UE_MAX];
pthread_mutex_t UE_output_mutex[NUMBER_OF_RU_MAX];
pthread_mutex_t subframe_mutex;
int subframe_ru_mask;
int subframe_UE_mask;
openair0_timestamp current_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs];
openair0_timestamp current_UE_rx_timestamp[MAX_MOBILES_PER_ENB][MAX_NUM_CCs];
openair0_timestamp last_ru_rx_timestamp[NUMBER_OF_RU_MAX][MAX_NUM_CCs];
openair0_timestamp last_UE_rx_timestamp[MAX_MOBILES_PER_ENB][MAX_NUM_CCs];
double ru_amp[NUMBER_OF_RU_MAX];
pthread_t rfsim_thread;
} sim_t;