Commit b530ea49 authored by hardy's avatar hardy

Merge remote-tracking branch 'origin/sim-channels' into integration_2021_wk12

parents dfeb91cb 230af8db
#/* configuration for channel modelisation */
#/* To be included in main config file when */
#/* channel modelisation is used (rfsimulator with chanmod options enabled) */
channelmod = {
max_chan=10;
modellist="modellist_rfsimu_1";
modellist_rfsimu_1 = (
{
model_name = "rfsimu_channel_enB0"
type = "AWGN";
ploss_dB = 0;
noise_power_dB = -10;
forgetfact = 0;
offset = 0;
ds_tdl = 0;
},
{
model_name = "rfsimu_channel_ue1"
type = "AWGN";
ploss_dB = 0;
noise_power_dB = 0;
forgetfact = 0;
offset = 0;
ds_tdl = 0;
}
);
modellist_rfsimu_2 = (
{
model_name = "rfsimu_channel_ue0"
type = "AWGN";
ploss_dB = 0;
noise_power_dB = 0;
forgetfact = 0;
offset = 0;
ds_tdl = 0;
},
{
model_name = "rfsimu_channel_ue1"
type = "AWGN";
ploss_dB = 0;
noise_power_dB = 0;
forgetfact = 0;
offset = 0;
ds_tdl = 0;
},
{
model_name = "rfsimu_channel_ue2"
type = "AWGN";
ploss_dB = 0;
noise_power_dB = 0;
forgetfact = 0;
offset = 0;
ds_tdl = 0;
}
);
};
......@@ -260,7 +260,6 @@ NETWORK_CONTROLLER :
FLEXRAN_CACHE = "/mnt/oai_agent_cache";
FLEXRAN_AWAIT_RECONF = "no";
};
log_config :
{
global_log_level ="info";
......@@ -279,3 +278,4 @@ NETWORK_CONTROLLER :
rrc_log_verbosity ="medium";
};
@include "channelmod_rfsimu.conf"
......@@ -2808,6 +2808,7 @@ include_directories("${OPENAIR_DIR}/common/utils/T")
if (${T_TRACER})
set(T_SOURCE
${OPENAIR_DIR}/common/utils/T/T_IDs.h
${OPENAIR_DIR}/common/utils/T/T.c
${OPENAIR_DIR}/common/utils/T/local_tracer.c)
set(T_LIB "rt")
......
......@@ -157,8 +157,16 @@ install_protobuf_from_source(){
#cd protobuf-2.6.1/
rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0
wget --tries=3 --retry-connrefused https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz
tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner "$USER" --group "$(groups | cut -d" " -f1)" --no-same-owner
cd protobuf-3.3.0/ || exit
tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner
cd protobuf-3.3.0/
else
export LD_LIBRARY_PATH=/usr/local/lib #protoc needs to know where toclook for shared libs
rm -rf /tmp/protobuf
git clone --depth=1 --branch=v3.3.0 https://github.com/protocolbuffers/protobuf.git /tmp/protobuf
cd /tmp/protobuf
git submodule update --init --recursive
./autogen.sh
fi
./configure
echo "Compiling protobuf"
make -j"$(nproc)"
......@@ -198,15 +206,15 @@ install_usrp_uhd_driver_from_source(){
rm -rf /tmp/uhd
git clone https://github.com/EttusResearch/uhd.git
cd uhd || exit
git checkout tags/v3.13.0.2
git checkout UHD-3.15.LTS
mkdir -p host/build
cd host/build || exit
$CMAKE ../
$CMAKE ../ -GNinja
echo "Compiling UHD"
make -j"$(nproc)"
make test
$SUDO make install
ninja
$SUDO ninja install
$SUDO ldconfig
$SUDO /usr/lib/uhd/utils/uhd_images_downloader.py
) >& "$uhd_install_log"
}
......
......@@ -255,7 +255,7 @@ int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix)
if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) || /* long option beginning with "--" */
((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgoptions[n].optname) == 0) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ||
((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) {
((strlen(oneargv) > 2) && (strcmp(oneargv + 2, cfgoptions[n].optname) == 0 ) && (cfgoptions[n].paramflags & PARAMFLAG_CMDLINE_NOPREFIXENABLED )) ) {
char *valptr=NULL;
int ret;
config_get_if()->argv_info[i] |= CONFIG_CMDLINEOPT_PROCESSED;
......
......@@ -82,10 +82,12 @@ typedef struct configmodule_interface {
#ifdef CONFIG_LOADCONFIG_MAIN
configmodule_interface_t *cfgptr=NULL;
static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]> \n \
debugflags can also be defined in the config_libconfig section of the config file\n \
static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]><:incp[path]>\n \
debugflags can also be defined in the config section of the config file\n \
debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \
4->print command line processing debug messages\n ";
4->print command line processing debug messages\n \
incp parameter can be used to define the include path used for config files (@include directive)\n \
defaults is set to the path of the main config file.\n";
#define CONFIG_SECTIONNAME "config"
#define CONFIGPARAM_DEBUGFLAGS_IDX 0
......
......@@ -33,8 +33,9 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <libgen.h>
#include <arpa/inet.h>
#include "config_libconfig.h"
#include "config_libconfig_private.h"
......@@ -347,17 +348,35 @@ int config_libconfig_init(char *cfgP[], int numP) {
config_get_if()->numptrs=0;
memset(config_get_if()->ptrs,0,sizeof(void *) * CONFIG_MAX_ALLOCATEDPTRS);
memset(config_get_if()->ptrsAllocated, 0, sizeof(config_get_if()->ptrsAllocated));
/* search for include path parameter and set config file include path accordingly */
for (int i=0; i<numP; i++) {
if (strncmp(cfgP[i],"incp",4) == 0) {
config_set_include_dir (&(libconfig_privdata.cfg),cfgP[i]+4);
break;
}
}
/* dirname may modify the input path and returned ptr may points to part of input path */
char *tmppath = strdup(libconfig_privdata.configfile);
if ( config_get_include_dir (&(libconfig_privdata.cfg)) == NULL) {
config_set_include_dir (&(libconfig_privdata.cfg),dirname( tmppath ));
}
const char *incp = config_get_include_dir (&(libconfig_privdata.cfg)) ;
printf("[LIBCONFIG] Path for include directive set to: %s\n", (incp!=NULL)?incp:"libconfig defaults");
/* set convertion option to allow integer to float conversion*/
config_set_auto_convert (&(libconfig_privdata.cfg), CONFIG_TRUE);
/* Read the file. If there is an error, report it and exit. */
if(! config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile)) {
fprintf(stderr,"[LIBCONFIG] %s %d file %s - %d - %s\n",__FILE__, __LINE__,
if( config_read_file(&(libconfig_privdata.cfg), libconfig_privdata.configfile) == CONFIG_FALSE) {
fprintf(stderr,"[LIBCONFIG] %s %d file %s - line %d: %s\n",__FILE__, __LINE__,
libconfig_privdata.configfile, config_error_line(&(libconfig_privdata.cfg)),
config_error_text(&(libconfig_privdata.cfg)));
config_destroy(&(libconfig_privdata.cfg));
printf( "\n");
free(tmppath);
return -1;
}
free(tmppath);
return 0;
}
......
......@@ -243,7 +243,7 @@ int write_file_matlab(const char *fname,
fprintf(fp,"%d \n",((unsigned char *)&data)[0]);
break;
default:
AssertFatal(false, "unknown dump format: %d\n", format);
AssertFatal(false, "unknown dump format: %u\n", format);
}
if ((format != 10 && format !=11 && format !=12 && format != 13 && format != 15) || multiVec) {
......
......@@ -339,9 +339,9 @@ extern "C" {
int itti_create_queue(const task_info_t *taskInfo) {
pthread_mutex_lock (&lock_nb_queues);
int newQueue=nb_queues++;
task_list_t **new_tasks = (task_list_t **)realloc(tasks, nb_queues * sizeof(*tasks));
AssertFatal(new_tasks != NULL, "could not realloc() tasks list");
tasks = new_tasks;
task_list_t **tmp=(task_list_t **) realloc(tasks, nb_queues * sizeof(*tasks));
AssertFatal(tmp!=NULL,"");
tasks=tmp;
tasks[newQueue]= new task_list_t;
pthread_mutex_unlock (&lock_nb_queues);
LOG_I(TMR,"Starting itti queue: %s as task %d\n", taskInfo->name, newQueue);
......
......@@ -495,7 +495,7 @@ int process_command(char *buf) {
memset(cmdb,0,sizeof(cmdb));
bufbck=strdup(buf);
rt=CMDSTATUS_NOTFOUND;
j = sscanf(buf,"%19s %19s %19[^\t\n]",modulename,cmd,cmdb);
j = sscanf(buf,"%19s %19s %[^\t\n]",modulename,cmd,cmdb);
if (telnetparams.telnetdbg > 0)
printf("process_command: %i words, module=%s cmd=%s, parameters= %s\n",j,modulename,cmd,cmdb);
......
......@@ -86,7 +86,7 @@ char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr) {
void get_common_options(uint32_t execmask) {
uint32_t online_log_messages=0;
uint32_t glog_level=0 ;
uint32_t start_telnetsrv = 0;
uint32_t start_telnetsrv = 0, start_telnetclt = 0;
uint32_t noS1 = 0, nokrnmod = 0, nonbiot = 0;
uint32_t rfsim = 0, basicsim = 0, do_forms = 0;
char *logmem_filename = NULL;
......@@ -95,21 +95,26 @@ void get_common_options(uint32_t execmask) {
checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
check_execmask(execmask);
config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,
sizeof(cmdline_logparams)/sizeof(paramdef_t));
config_get( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL);
if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) {
int numparams=sizeof(cmdline_logparams)/sizeof(paramdef_t);
config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,numparams);
config_get( cmdline_logparams,numparams,NULL);
if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_FLOG_OPT))) {
set_glog_onlinelog(online_log_messages);
}
if(config_isparamset(cmdline_logparams,CMDLINE_GLOGLEVEL_IDX)) {
if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_LOGL_OPT))) {
set_glog(glog_level);
}
if (start_telnetsrv) {
load_module_shlib("telnetsrv",NULL,0,NULL);
}
if (start_telnetclt) {
set_softmodem_optmask(SOFTMODEM_TELNETCLT_BIT);
}
if (logmem_filename != NULL && strlen(logmem_filename) > 0) {
log_mem_filename = &logmem_filename[0];
......
......@@ -153,23 +153,22 @@ extern "C"
#define CONFIG_HLP_LOGV "Set the global log verbosity \n"
#define CONFIG_HLP_TELN "Start embedded telnet server \n"
#define CONFIG_HLP_MSC "Enable the MSC tracing utility \n"
/*----------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for LOG utility */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*----------------------------------------------------------------------------------------------------------------------------*/
#define CONFIG_FLOG_OPT "R"
#define CONFIG_LOGL_OPT "g"
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for LOG utility */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-------------------------------------------------------------------------------------------------------------------------------------------------*/
#define START_MSC softmodem_params.start_msc
#define CMDLINE_LOGPARAMS_DESC { \
{"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
{"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
{"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \
{"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \
{CONFIG_FLOG_OPT , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
{CONFIG_LOGL_OPT , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
{"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \
{"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:NULL, TYPE_STRING, 0}, \
{"telnetclt", NULL, 0, uptr:&start_telnetclt, defstrval:NULL, TYPE_UINT, 0}, \
}
#define CMDLINE_ONLINELOG_IDX 0
#define CMDLINE_GLOGLEVEL_IDX 1
#define CMDLINE_GLOGVERBO_IDX 2
#define CMDLINE_STARTTELN_IDX 3
/* check function for global log level */
#define CMDLINE_LOGPARAMS_CHECK_DESC { \
......@@ -178,6 +177,7 @@ extern "C"
{ .s5= {NULL} } , \
{ .s5= {NULL} } , \
{ .s5= {NULL} } , \
{ .s5= {NULL} } , \
}
/***************************************************************************************************************************************/
......@@ -190,6 +190,7 @@ extern "C"
#define SOFTMODEM_SIML1_BIT (1<<12)
#define SOFTMODEM_DOFORMS_BIT (1<<15)
#define SOFTMODEM_RECPLAY_BIT (1<<16)
#define SOFTMODEM_TELNETCLT_BIT (1<<17)
#define SOFTMODEM_ENB_BIT (1<<20)
#define SOFTMODEM_GNB_BIT (1<<21)
#define SOFTMODEM_4GUE_BIT (1<<22)
......@@ -206,6 +207,7 @@ extern "C"
#define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT)
#define IS_SOFTMODEM_DOFORMS ( get_softmodem_optmask() & SOFTMODEM_DOFORMS_BIT)
#define IS_SOFTMODEM_IQPLAYER ( get_softmodem_optmask() & SOFTMODEM_RECPLAY_BIT)
#define IS_SOFTMODEM_TELNETCLT_BIT ( get_softmodem_optmask() & SOFTMODEM_TELNETCLT_BIT)
#define IS_SOFTMODEM_ENB_BIT ( get_softmodem_optmask() & SOFTMODEM_ENB_BIT)
#define IS_SOFTMODEM_GNB_BIT ( get_softmodem_optmask() & SOFTMODEM_GNB_BIT)
#define IS_SOFTMODEM_4GUE_BIT ( get_softmodem_optmask() & SOFTMODEM_4GUE_BIT)
......
......@@ -39,7 +39,7 @@
#include "nrLDPC_bnProc.h"
#define NR_LDPC_ENABLE_PARITY_CHECK
#define NR_LDPC_PROFILER_DETAIL
//#define NR_LDPC_PROFILER_DETAIL
#ifdef NR_LDPC_DEBUG_MODE
#include "nrLDPC_tools/nrLDPC_debug.h"
......
......@@ -242,7 +242,7 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in
for (int pix=0; pix<graph->w; pix++) {
scopeSample_t *end=values+(pix+1)*samplesPerPixel;
end-=2;
AssertFatal(end <= values+datasize,"diff : %ld", end-values+datasize);
AssertFatal(end <= values+datasize,"diff : %lu", end-values+datasize);
double val=0;
for (scopeSample_t *s=values+(pix)*samplesPerPixel;
......@@ -278,7 +278,7 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in
graph->initDone=true;
}
fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, sqrt(avg));
fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, 0/*sqrt(avg)*/);
graph->iteration++;
}
......
......@@ -1179,7 +1179,7 @@ int main(int argc, char **argv) {
DS_TDL,
forgetting_factor,
rx_sample_offset,
0);
0, 0);
reset_meas(&eNB2UE[0]->random_channel);
reset_meas(&eNB2UE[0]->interp_time);
......@@ -1193,7 +1193,7 @@ int main(int argc, char **argv) {
DS_TDL,
forgetting_factor,
rx_sample_offset,
0);
0, 0);
reset_meas(&eNB2UE[n]->random_channel);
reset_meas(&eNB2UE[n]->interp_time);
}
......
......@@ -988,7 +988,7 @@ int main(int argc, char **argv)
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
forgetting_factor,
rx_sample_offset,
0);
0, 0);
if(num_rounds>1) {
for(n=1; n<8; n++)
......@@ -999,7 +999,7 @@ int main(int argc, char **argv)
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
forgetting_factor,
rx_sample_offset,
0);
0, 0);
}
if (eNB2UE[0]==NULL) {
......
......@@ -834,7 +834,7 @@ int main(int argc, char **argv) {
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
forgetting_factor,
rx_sample_offset,
0);
0, 0);
if(num_rounds>1) {
for(n=1; n<4; n++)
......@@ -845,7 +845,7 @@ int main(int argc, char **argv) {
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
forgetting_factor,
rx_sample_offset,
0);
0, 0);
}
if (eNB2UE[0]==NULL) {
......
......@@ -1290,7 +1290,7 @@ int main(int argc, char **argv) {
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
forgetting_factor,
rx_sample_offset,
0);
0, 0);
reset_meas(&eNB2UE[0]->random_channel);
reset_meas(&eNB2UE[0]->interp_time);
......@@ -1303,7 +1303,7 @@ int main(int argc, char **argv) {
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
forgetting_factor,
rx_sample_offset,
0);
0, 0);
reset_meas(&eNB2UE[n]->random_channel);
reset_meas(&eNB2UE[n]->interp_time);
}
......
......@@ -386,7 +386,7 @@ int main(int argc, char **argv) {
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
0,
0,
0);
0, 0);
if (interf1>-20)
eNB2UE1 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
......@@ -396,7 +396,7 @@ int main(int argc, char **argv) {
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
0,
4,
0);
0, 0);
if (interf2>-20)
eNB2UE2 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
......@@ -406,7 +406,7 @@ int main(int argc, char **argv) {
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
0,
8,
0);
0, 0);
if (eNB2UE==NULL) {
msg("Problem generating channel model. Exiting.\n");
......
......@@ -708,7 +708,7 @@ int main(int argc, char **argv) {
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
0,
0,
0);
0, 0);
L1_rxtx_proc_t *proc_rxtx = (subframe == 0)? &eNB->proc.L1_proc: &eNB->proc.L1_proc_tx;
eNB->ulsch[0] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,N_RB_DL,0);
UE->ulsch[0] = new_ue_ulsch(N_RB_DL,0);
......
......@@ -343,7 +343,7 @@ int main(int argc, char **argv) {
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
0.0,
delay,
0);
0, 0);
if (UE2eNB==NULL) {
msg("Problem generating channel model. Exiting.\n");
......
......@@ -323,7 +323,7 @@ int main(int argc, char **argv) {
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
0.0,
0,
0);
0, 0);
if (UE2eNB==NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -335,7 +335,7 @@ int main(int argc, char **argv) {
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
0,
0,
0);
0, 0);
if (eNB2UE==NULL) {
msg("Problem generating channel model. Exiting.\n");
......
......@@ -724,7 +724,7 @@ int main(int argc, char **argv) {
BW,
0,
0,
0);
0, 0);
if (interf1>-20)
eNB2UE1 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
......@@ -733,7 +733,7 @@ int main(int argc, char **argv) {
BW,
0,
0,
0);
0, 0);
if (interf2>-20)
eNB2UE2 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
......@@ -742,7 +742,7 @@ int main(int argc, char **argv) {
BW,
0,
0,
0);
0, 0);
if (eNB2UE==NULL) {
msg("Problem generating channel model. Exiting.\n");
......
......@@ -734,7 +734,7 @@ int main(int argc, char **argv) {
30e-9,
forgetting_factor,
delay,
0);
0, 0);
// set Doppler
UE2eNB->max_Doppler = maxDoppler;
......
......@@ -339,7 +339,7 @@ int main(int argc, char **argv)
61.44e6, //N_RB2sampling_rate(N_RB_DL),
40e6, //N_RB2channel_bandwidth(N_RB_DL),
DS_TDL,
0, 0, 0);
0, 0, 0, 0);
if (gNB2UE == NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -766,7 +766,7 @@ int main(int argc, char **argv)
30e-9,
0,
0,
0);
0, 0);
if (gNB2UE==NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -479,7 +479,7 @@ int main(int argc, char **argv)
300e-9,
0,
0,
0);
0, 0);
if (gNB2UE==NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -658,7 +658,7 @@ int main(int argc, char **argv){
DS_TDL,
0.0,
delay,
0);
0, 0);
if (UE2gNB==NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -418,7 +418,7 @@ int main(int argc, char **argv)
printf("FFO = %lf; IFO = %d\n",eps-IFO,IFO);
}
UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, DS_TDL,0, 0, 0);
UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model, fs, bw, DS_TDL,0, 0, 0, 0);
if (UE2gNB==NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -364,7 +364,7 @@ int main(int argc, char **argv)
61.44e6, //N_RB2sampling_rate(N_RB_DL),
40e6, //N_RB2channel_bandwidth(N_RB_DL),
DS_TDL,
0,0,0);
0,0,0, 0);
if (gNB2UE == NULL) {
printf("Problem generating channel model. Exiting.\n");
......
......@@ -593,7 +593,7 @@ int main(int argc, char **argv)
sampling_frequency,
bandwidth,
DS_TDL,
0, 0, 0);
0, 0, 0, 0);
if (UE2gNB == NULL) {
printf("Problem generating channel model. Exiting.\n");
......
# 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)
\ No newline at end of file
# 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
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.
## Documentation
* [runtime usage](rtusage.md)
* [developer usage](devusage.md)
* [module architecture](arch.md)
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
### 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)
\ No newline at end of file
## 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](../../../../targets/ARCH/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)
\ No newline at end of file
This diff is collapsed.
......@@ -89,6 +89,7 @@ typedef struct {
double path_loss_dB;
///additional delay of channel in samples.
int32_t channel_offset;
float noise_power_dB;
///This parameter (0...1) allows for simple 1st order temporal variation. 0 means a new channel every call, 1 means keep channel constant all the time
double forgetting_factor;
///needs to be set to 1 for the first call, 0 otherwise.
......@@ -106,8 +107,10 @@ typedef struct {
unsigned int chan_idx;
/// id of the channel modeling algorithm
int modelid;
/// identifies channel descriptor owner (the module which created this descriptor)
/// identifies channel descriptor owner (the module which created this descriptor
channelmod_moduleid_t module_id;
/// name of this descriptor,used for model created from config file at init time
char *model_name;
/// flags to properly trigger memory free
unsigned int free_flags;
} channel_desc_t;
......@@ -241,12 +244,37 @@ typedef enum {
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
#define CHANNELMOD_SECTION "channelmod"
/* global channel modelization parameters */
#define CHANNELMOD_MODELLIST_PARANAME "modellist"
#define CHANNELMOD_HELP_MODELLIST "<list name> channel list name in config file describing the model type and its parameters\n"
#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, CONFIG_HLP_MAX_CHAN", 0, uptr:&max_chan, defintval:10, TYPE_UINT, 0},\
{"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:(char **)&modellist_name, defstrval:"DefaultChannelList", TYPE_STRING, 60 },\
}
/* parameters for one model */
#define CHANNELMOD_MODEL_NAME_PNAME "model_name"
#define CHANNELMOD_MODEL_TYPE_PNAME "type"
#define CHANNELMOD_MODEL_PL_PNAME "ploss_dB"
#define CHANNELMOD_MODEL_NP_PNAME "noise_power_dB"
#define CHANNELMOD_MODEL_FF_PNAME "forgetfact"
#define CHANNELMOD_MODEL_CO_PNAME "offset"
#define CHANNELMOD_MODEL_DT_PNAME "ds_tdl"
#define CHANNELMOD_MODEL_PARAMS_DESC { \
{CHANNELMOD_MODEL_NAME_PNAME, "name of the model\n", 0, strptr:NULL , defstrval:"", TYPE_STRING, 0 },\
{CHANNELMOD_MODEL_TYPE_PNAME, "name of the model type\n", 0, strptr:NULL , defstrval:"AWGN", TYPE_STRING, 0 },\
{CHANNELMOD_MODEL_PL_PNAME, "channel path loss in dB\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\
{CHANNELMOD_MODEL_NP_PNAME, "channel noise in dB\n", 0, dblptr:NULL, defdblval:-50, TYPE_DOUBLE, 0 },\
{CHANNELMOD_MODEL_FF_PNAME, "channel forget factor ((0 to 1)\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 },\
{CHANNELMOD_MODEL_CO_PNAME, "channel offset in samps\n", 0, iptr:NULL, defintval:0, TYPE_INT, 0 },\
{CHANNELMOD_MODEL_DT_PNAME, "delay spread for TDL models\n", 0, dblptr:NULL, defdblval:0, TYPE_DOUBLE, 0 }\
}
#include "platform_constants.h"
typedef struct {
......@@ -275,12 +303,17 @@ typedef struct {
channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
uint8_t nb_rx,
SCM_t channel_model,
double sampling_rate,
double sampling_rate,
double channel_bandwidth,
double TDL_DS,
double TDL_DS,
double forgetting_factor,
int32_t channel_offset,
double path_loss_dB);
double path_loss_dB,
float noise_power_dB);
channel_desc_t *find_channel_desc_fromname( char *modelname );
/**
\brief free memory allocated for a model descriptor
\param ch points to the model, which cannot be used after calling this fuction
......@@ -293,6 +326,12 @@ void free_channel_desc_scm(channel_desc_t *ch);
\param module_id identifies the channel model. should be define as a macro in simu.h
*/
void set_channeldesc_owner(channel_desc_t *cdesc, channelmod_moduleid_t module_id);
/**
\brief This function set a model name to a model descriptor, can be later used to identify a allocated channel model
\param cdesc points to the model descriptor
\param module_name is the C string to use as model name for the channel pointed by cdesc
*/
void set_channeldesc_name(channel_desc_t *cdesc,char *modelname);
/** \fn void random_channel(channel_desc_t *desc)
\brief This routine generates a random channel response (time domain) according to a tapped delay line model.
\param desc Pointer to the channel descriptor
......@@ -452,11 +491,11 @@ void multipath_tv_channel(channel_desc_t *desc,
/**@} */
/**@} */
int modelid_fromname(char *modelname);
int modelid_fromstrtype(char *modeltype);
double channelmod_get_snr_dB(void);
double channelmod_get_sinr_dB(void);
void init_channelmod(void) ;
int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) ;
double N_RB2sampling_rate(uint16_t N_RB);
double N_RB2channel_bandwidth(uint16_t N_RB);
......
......@@ -65,17 +65,8 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si
// Fixme: not sure when it is "volts" so dB is 20*log10(...) or "power", so dB is 10*log10(...)
const double pathLossLinear = pow(10,channelDesc->path_loss_dB/20.0);
// Energy in one sample to calibrate input noise
//Fixme: modified the N0W computation, not understand the origin value
const double KT=1.38e-23*290; //Boltzman*temperature
// sampling rate is linked to acquisition band (the input pass band filter)
const double noise_figure_watt = KT*channelDesc->sampling_rate;
// Fixme: how to convert a noise in Watt into a 12 bits value out of the RF ADC ?
// the parameter "-s" is declared as SNR, but the input power is not well defined
// −132.24 dBm is a LTE subcarrier noise, that was used in origin code (15KHz BW thermal noise)
const double rxGain= 132.24 - channelmod_get_snr_dB();
// sqrt(4*noise_figure_watt) is the thermal noise factor (volts)
// fixme: the last constant is pure trial results to make decent noise
const double noise_per_sample = sqrt(4*noise_figure_watt) * pow(10,rxGain/20) *10;
// the normalized OAI value seems to be 256 as average amplitude (numerical amplification = 1)
const double noise_per_sample = pow(10,channelDesc->noise_power_dB/10.0) * 256;
// Fixme: we don't fill the offset length samples at begining ?
// anyway, in today code, channel_offset=0
const int dd = abs(channelDesc->channel_offset);
......
This diff is collapsed.
......@@ -361,6 +361,7 @@ void init_ocm(void) {
DS_TDL,
0.0,
0,
0,
0);
random_channel(sim.RU2UE[ru_id][UE_id][CC_id],0);
LOG_D(OCM,"[SIM] Initializing channel (%s) from UE %d to ru %d\n", "AWGN", UE_id, ru_id);
......@@ -374,6 +375,7 @@ void init_ocm(void) {
DS_TDL,
0.0,
0,
0,
0);
random_channel(sim.UE2RU[UE_id][ru_id][CC_id],0);
// to make channel reciprocal uncomment following line instead of previous. However this only works for SISO at the moment. For MIMO the channel would need to be transposed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment