Merge remote-tracking branch 'origin/sim-channels' into integration_2020_wk15
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#/* 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"
|
||||
|
||||
@@ -2817,6 +2817,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")
|
||||
|
||||
@@ -159,8 +159,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)"
|
||||
@@ -200,15 +208,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) {
|
||||
|
||||
@@ -38,7 +38,7 @@ void display_backtrace(void) {
|
||||
size_t i;
|
||||
char *test=getenv("NO_BACKTRACE");
|
||||
|
||||
if (test!=0) *((int *)0)=0;
|
||||
if (test!=0) abort();
|
||||
|
||||
size = backtrace(array, 10);
|
||||
strings = backtrace_symbols(array, size);
|
||||
|
||||
@@ -461,12 +461,12 @@ int process_command(char *buf) {
|
||||
int i,j,k;
|
||||
char modulename[TELNET_CMD_MAXSIZE];
|
||||
char cmd[TELNET_CMD_MAXSIZE];
|
||||
char cmdb[TELNET_MAX_MSGLENGTH];
|
||||
char *cmdb=NULL;
|
||||
char *bufbck;
|
||||
int rt;
|
||||
memset(modulename,0,sizeof(modulename));
|
||||
memset(cmd,0,sizeof(cmd));
|
||||
memset(cmdb,0,sizeof(cmdb));
|
||||
|
||||
|
||||
if (strncasecmp(buf,"ex",2) == 0)
|
||||
return CMDSTATUS_EXIT;
|
||||
@@ -490,12 +490,10 @@ int process_command(char *buf) {
|
||||
return CMDSTATUS_FOUND;
|
||||
}
|
||||
|
||||
memset(modulename,0,sizeof(modulename));
|
||||
memset(cmd,0,sizeof(cmd));
|
||||
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 %m[^\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);
|
||||
@@ -562,7 +560,7 @@ int process_command(char *buf) {
|
||||
rt= CMDSTATUS_FOUND;
|
||||
} /* loop */
|
||||
} /* for i */
|
||||
|
||||
free(cmdb);
|
||||
free(bufbck);
|
||||
return rt;
|
||||
}
|
||||
|
||||
@@ -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_DOSCOPE_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_DOSCOPE ( get_softmodem_optmask() & SOFTMODEM_DOSCOPE_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)
|
||||
|
||||
@@ -2198,7 +2198,7 @@ void configure_nr_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_add
|
||||
pnf.phys[0].udp.tx_port = vnf_p7_port;
|
||||
strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr);
|
||||
strcpy(pnf.phys[0].local_addr, pnf_ip_addr);
|
||||
printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n",
|
||||
printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%u rx:%u]\n",
|
||||
__FUNCTION__,config->vnf_ip_addr, config->vnf_p5_port,
|
||||
pnf.phys[0].local_addr,
|
||||
pnf.phys[0].udp.tx_addr, pnf.phys[0].udp.tx_port,
|
||||
@@ -2249,7 +2249,7 @@ void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr,
|
||||
pnf.phys[0].udp.tx_port = vnf_p7_port;
|
||||
strcpy(pnf.phys[0].udp.tx_addr, vnf_ip_addr);
|
||||
strcpy(pnf.phys[0].local_addr, pnf_ip_addr);
|
||||
printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%d rx:%d]\n",
|
||||
printf("%s() VNF:%s:%d PNF_PHY[addr:%s UDP:tx_addr:%s:%u rx:%u]\n",
|
||||
__FUNCTION__,
|
||||
config->vnf_ip_addr, config->vnf_p5_port,
|
||||
pnf.phys[0].local_addr,
|
||||
|
||||
@@ -1,76 +1,76 @@
|
||||
/*
|
||||
* Copyright 2017 Cisco Systems, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <pthread.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#define MAX_MSG_LENGTH 2096
|
||||
#define TRACE_HEADER_LENGTH 44
|
||||
|
||||
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...);
|
||||
|
||||
// initialize the trace function to 0
|
||||
void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg;
|
||||
|
||||
nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO;
|
||||
//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN;
|
||||
|
||||
void nfapi_set_trace_level(nfapi_trace_level_t new_level)
|
||||
{
|
||||
nfapi_trace_level_g = new_level;
|
||||
}
|
||||
|
||||
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...)
|
||||
{
|
||||
char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH];
|
||||
uint32_t num_chars;
|
||||
va_list p_args;
|
||||
struct timeval tv;
|
||||
pthread_t tid = pthread_self();
|
||||
|
||||
(void)gettimeofday(&tv, NULL);
|
||||
|
||||
num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid);
|
||||
|
||||
if (num_chars > TRACE_HEADER_LENGTH)
|
||||
{
|
||||
printf("trace_dbg: Error, num_chars is too large: %d", num_chars);
|
||||
return;
|
||||
}
|
||||
|
||||
va_start(p_args, format);
|
||||
if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args)))
|
||||
{
|
||||
if (level <= NFAPI_TRACE_WARN)
|
||||
{
|
||||
printf("%s", trace_buff);
|
||||
}
|
||||
printf("%s", trace_buff);
|
||||
}
|
||||
va_end(p_args);
|
||||
}
|
||||
/*
|
||||
* Copyright 2017 Cisco Systems, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <pthread.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#define MAX_MSG_LENGTH 2096
|
||||
#define TRACE_HEADER_LENGTH 44
|
||||
|
||||
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...);
|
||||
|
||||
// initialize the trace function to 0
|
||||
void (*nfapi_trace_g)(nfapi_trace_level_t level, const char* format, ...) = &nfapi_trace_dbg;
|
||||
|
||||
nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_INFO;
|
||||
//nfapi_trace_level_t nfapi_trace_level_g = NFAPI_TRACE_WARN;
|
||||
|
||||
void nfapi_set_trace_level(nfapi_trace_level_t new_level)
|
||||
{
|
||||
nfapi_trace_level_g = new_level;
|
||||
}
|
||||
|
||||
void nfapi_trace_dbg(nfapi_trace_level_t level, const char *format, ...)
|
||||
{
|
||||
char trace_buff[MAX_MSG_LENGTH + TRACE_HEADER_LENGTH];
|
||||
uint32_t num_chars;
|
||||
va_list p_args;
|
||||
struct timeval tv;
|
||||
pthread_t tid = pthread_self();
|
||||
|
||||
(void)gettimeofday(&tv, NULL);
|
||||
|
||||
num_chars = (uint32_t)snprintf(trace_buff, TRACE_HEADER_LENGTH, "%04u.%06u: 0x%02x: %10u: ", ((uint32_t)tv.tv_sec) & 0x1FFF, (uint32_t)tv.tv_usec, (uint32_t)level, (uint32_t)tid);
|
||||
|
||||
if (num_chars > TRACE_HEADER_LENGTH)
|
||||
{
|
||||
printf("trace_dbg: Error, num_chars is too large: %u", num_chars);
|
||||
return;
|
||||
}
|
||||
|
||||
va_start(p_args, format);
|
||||
if ((num_chars = (uint32_t)vsnprintf(&trace_buff[num_chars], MAX_MSG_LENGTH, format, p_args)))
|
||||
{
|
||||
if (level <= NFAPI_TRACE_WARN)
|
||||
{
|
||||
printf("%s", trace_buff);
|
||||
}
|
||||
printf("%s", trace_buff);
|
||||
}
|
||||
va_end(p_args);
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ void *fapi_thread_start(void *ptr) {
|
||||
|
||||
if(instance->tick == 1000) {
|
||||
if(instance->tx_byte_count > 0) {
|
||||
printf("[FAPI] Tx rate %d bytes/sec\n", instance->tx_byte_count);
|
||||
printf("[FAPI] Tx rate %u bytes/sec\n", instance->tx_byte_count);
|
||||
instance->tx_byte_count = 0;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ void *fapi_thread_start(void *ptr) {
|
||||
millisec = now_ts.tv_nsec / 1e6;
|
||||
|
||||
if(last_millisec != -1 && ((last_millisec + 1 ) % 1000) != millisec) {
|
||||
printf("*** missing millisec %d %d\n", last_millisec, millisec);
|
||||
printf("*** missing millisec %u %u\n", last_millisec, millisec);
|
||||
catchup = millisec - last_millisec - 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -56,7 +56,7 @@ void lte_gold(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_table[20][2][14]
|
||||
(((1+(Nid_cell<<1))*(1 + (((frame_parms->Ncp==0)?4:3)*l) + (7*(1+ns))))<<10); //cinit
|
||||
//x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit
|
||||
//n = 0
|
||||
x1 = 1+ (1<<31);
|
||||
x1 = 1+ (1U<<31);
|
||||
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
|
||||
|
||||
// skip first 50 double words (1600 bits)
|
||||
@@ -103,7 +103,7 @@ void lte_gold_ue_spec(uint32_t lte_gold_uespec_table[2][20][2][21],uint16_t Nid_
|
||||
//x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit
|
||||
//n = 0
|
||||
// printf("cinit (ns %d, l %d) => %d\n",ns,l,x2);
|
||||
x1 = 1+ (1<<31);
|
||||
x1 = 1+ (1U<<31);
|
||||
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
|
||||
|
||||
// skip first 50 double words (1600 bits)
|
||||
@@ -143,7 +143,7 @@ void lte_gold_ue_spec_port5(uint32_t lte_gold_uespec_port5_table[20][38],uint16_
|
||||
//x2 = frame_parms->Ncp + (Nid_cell<<1) + (1+(Nid_cell<<1))*(1 + (3*l) + (7*(1+ns))); //cinit
|
||||
//n = 0
|
||||
//printf("cinit (ns %d, l %d) => %d\n",ns,l,x2);
|
||||
x1 = 1+ (1<<31);
|
||||
x1 = 1+ (1U<<31);
|
||||
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
|
||||
|
||||
//skip first 50 double words (1600 bits)
|
||||
|
||||
@@ -59,7 +59,7 @@ void lte_gold_mbsfn(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold_mbsfn_tabl
|
||||
//n = 0
|
||||
// printf("cinit (sfn %d, l %d) => %d\n",sfn,l,x2);
|
||||
// Initializing the Sequence
|
||||
x1 = 1+ (1<<31);
|
||||
x1 = 1+ (1U<<31);
|
||||
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
|
||||
// skip first 50 double words (1600 bits)
|
||||
// printf("n=0 : x1 %x, x2 %x\n",x1,x2);
|
||||
@@ -90,7 +90,7 @@ void lte_gold_mbsfn_khz_1dot25(LTE_DL_FRAME_PARMS *frame_parms,uint32_t lte_gold
|
||||
|
||||
for (sfn=0; sfn<10; sfn++) {
|
||||
x2 = (Nid_mbsfn) + (((1+(Nid_mbsfn<<1))*(1 + (7*(1+sfn))))<<9); //cinit
|
||||
x1 = 1+ (1<<31);
|
||||
x1 = 1+ (1U<<31);
|
||||
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
|
||||
|
||||
for (n=1; n<50; n++) {
|
||||
|
||||
@@ -121,7 +121,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
for (n=0; n<(1+(G>>5)); n++) {
|
||||
#ifdef DEBUG_SCRAMBLING
|
||||
|
||||
for (int k=0; k<32; k++) printf("scrambling %d : %d xor %d = %d\n",k+(n<<5),e[k],(s>>k)&1,e[k]^((s>>k)&1));
|
||||
for (int k=0; k<32; k++) printf("scrambling %d : %x xor %x = %d\n",k+(n<<5),e[k],(s>>k)&1,e[k]^((s>>k)&1));
|
||||
|
||||
#endif
|
||||
e[0] = (e[0]) ^ (s&1);
|
||||
|
||||
@@ -41,7 +41,7 @@ extern inline uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t res
|
||||
{
|
||||
// Init value for x1: x1(0) = 1, x1(n) = 0, n=1,2,...,30
|
||||
// x1(31) = [x1(3) + x1(0)]mod2 = 1
|
||||
*x1 = 1 + (1<<31);
|
||||
*x1 = 1 + (1U<<31);
|
||||
// Init value for x2: cinit = sum_{i=0}^30 x2*2^i
|
||||
// x2(31) = [x2(3) + x2(2) + x2(1) + x2(0)]mod2
|
||||
// = (*x2>>3) ^ (*x2>>2) + (*x2>>1) + *x2
|
||||
|
||||
@@ -374,7 +374,7 @@ static inline unsigned int lte_gold_unscram(unsigned int *x1, unsigned int *x2,
|
||||
int n;
|
||||
|
||||
if (reset) {
|
||||
*x1 = 1+ (1<<31);
|
||||
*x1 = 1+ (1U<<31);
|
||||
*x2=*x2 ^ ((*x2 ^ (*x2>>1) ^ (*x2>>2) ^ (*x2>>3))<<31);
|
||||
|
||||
// skip first 50 double words (1600 bits)
|
||||
|
||||
@@ -170,6 +170,7 @@ int32_t generate_srs(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
Msc_RS = msrsb * 6;
|
||||
k0 = ( ( (int16_t)(frame_parms->N_RB_UL>>1) - (int16_t)(msrs0>>1) ) * 12 ) + kTC;
|
||||
AssertFatal(msrsb,"divide by 0");
|
||||
nb = (4*n_RRC/msrsb)%Nb;
|
||||
|
||||
for (b=0; b<=Bsrs; b++) {
|
||||
|
||||
@@ -150,7 +150,7 @@ void pseudo_random_sequence_optimised(unsigned int size, uint32_t *c, uint32_t c
|
||||
unsigned int n,x1,x2;
|
||||
|
||||
/* init of m-sequences */
|
||||
x1 = 1+ (1<<31);
|
||||
x1 = 1+ (1U<<31);
|
||||
x2 = cinit;
|
||||
x2=x2 ^ ((x2 ^ (x2>>1) ^ (x2>>2) ^ (x2>>3))<<31);
|
||||
|
||||
|
||||
@@ -179,8 +179,7 @@ void phy_scope_eNB(FD_lte_phy_scope_enb *form,
|
||||
chest_f_abs = (float *) calloc(nsymb_ce*nb_antennas_rx*nb_antennas_tx,sizeof(float));
|
||||
llr = (float *) calloc(coded_bits_per_codeword,sizeof(float)); // init to zero
|
||||
bit = malloc(coded_bits_per_codeword*sizeof(float));
|
||||
|
||||
rxsig_t = (int16_t**) phy_vars_enb->RU_list[0]->common.rxdata;
|
||||
rxsig_t = (int16_t **) phy_vars_enb->RU_list[0]->common.rxdata;
|
||||
chest_t = (int16_t **) phy_vars_enb->srs_vars[UE_id].srs_ch_estimates;
|
||||
chest_f = (int16_t **) phy_vars_enb->pusch_vars[UE_id]->drs_ch_estimates;
|
||||
pusch_llr = (int16_t *) phy_vars_enb->pusch_vars[UE_id]->llr;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -240,7 +240,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 : %u", end-values+datasize);
|
||||
double val=0;
|
||||
|
||||
for (scopeSample_t *s=values+(pix)*samplesPerPixel;
|
||||
@@ -276,7 +276,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++;
|
||||
}
|
||||
|
||||
|
||||
@@ -1182,7 +1182,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);
|
||||
|
||||
@@ -1196,7 +1196,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");
|
||||
|
||||
@@ -737,7 +737,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");
|
||||
|
||||
@@ -771,7 +771,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");
|
||||
|
||||
@@ -663,7 +663,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");
|
||||
|
||||
@@ -596,7 +596,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");
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# 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)
|
||||
@@ -0,0 +1,13 @@
|
||||
# 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)
|
||||
@@ -0,0 +1,7 @@
|
||||
### 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)
|
||||
@@ -0,0 +1,69 @@
|
||||
## 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)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
|
||||
|
||||
@@ -648,18 +648,6 @@ error:
|
||||
* ************************************
|
||||
*/
|
||||
|
||||
int sort_ue_config(const void *a, const void *b) {
|
||||
const Protocol__FlexUeConfig *fa = a;
|
||||
const Protocol__FlexUeConfig *fb = b;
|
||||
|
||||
if (fa->rnti < fb->rnti)
|
||||
return -1;
|
||||
else if (fa->rnti < fb->rnti)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int flexran_agent_ue_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
|
||||
xid_t xid;
|
||||
Protocol__FlexHeader *header = NULL;
|
||||
|
||||
@@ -1017,7 +1017,7 @@ int get_format0(uint8_t index,
|
||||
uint8_t unpaired,
|
||||
frequency_range_t frequency_range){
|
||||
|
||||
uint16_t format;
|
||||
uint16_t format=0;
|
||||
if (unpaired) {
|
||||
if (frequency_range==FR1)
|
||||
format = table_6_3_3_2_3_prachConfig_Index[index][0];
|
||||
|
||||
@@ -323,7 +323,6 @@ void schedule_control_sib1(module_id_t module_id,
|
||||
gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon));
|
||||
gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space));
|
||||
gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset));
|
||||
gNB_mac->sched_ctrlCommon->active_bwp = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->active_bwp));
|
||||
fill_default_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space);
|
||||
fill_default_coresetZero(gNB_mac->sched_ctrlCommon->coreset,servingcellconfigcommon);
|
||||
fill_default_initialDownlinkBWP(gNB_mac->sched_ctrlCommon->active_bwp,servingcellconfigcommon);
|
||||
|
||||
@@ -656,7 +656,7 @@ int checkTargetSSBInTCIStates_pdcchConfig(int ssb_index_t, int Mod_idP, int UE_i
|
||||
//returns the measured RSRP value (upper limit)
|
||||
int get_measured_rsrp(uint8_t index) {
|
||||
//if index is invalid returning minimum rsrp -140
|
||||
if((index >= 0 && index <= 15) || index >= 114)
|
||||
if(index <= 15 || index >= 114)
|
||||
return MIN_RSRP_VALUE;
|
||||
|
||||
return L1_SSB_CSI_RSRP_measReport_mapping_38133_10_1_6_1_1[index];
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -69,7 +69,9 @@ extern RAN_CONTEXT_t RC;
|
||||
|
||||
#define RFSIMU_SECTION "rfsimulator"
|
||||
#define RFSIMU_OPTIONS_PARAMNAME "options"
|
||||
# define RFSIM_CONFIG_HELP_OPTIONS " list of comma separated options to enable rf simulator functionalities. Available options: \n"\
|
||||
|
||||
|
||||
#define RFSIM_CONFIG_HELP_OPTIONS " list of comma separated options to enable rf simulator functionalities. Available options: \n"\
|
||||
" chanmod: enable channel modelisation\n"\
|
||||
" saviq: enable saving written iqs to a file\n"
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
@@ -78,21 +80,21 @@ extern RAN_CONTEXT_t RC;
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define simOpt PARAMFLAG_NOFREE|PARAMFLAG_CMDLINE_NOPREFIXENABLED
|
||||
#define RFSIMULATOR_PARAMS_DESC { \
|
||||
{"serveraddr", "<ip address to connect to>\n", simOpt , strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\
|
||||
{"serverport", "<port to connect to>\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\
|
||||
{RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\
|
||||
{"IQfile", "<file path to use when saving IQs>\n",simOpt, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\
|
||||
{"modelname", "<channel model name>\n", simOpt, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\
|
||||
{"ploss", "<channel path loss in dB>\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\
|
||||
{"forgetfact", "<channel forget factor ((0 to 1)>\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\
|
||||
{"offset", "<channel offset in samps>\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\
|
||||
{"serveraddr", "<ip address to connect to>\n", simOpt, strptr:&(rfsimulator->ip), defstrval:"127.0.0.1", TYPE_STRING, 0 },\
|
||||
{"serverport", "<port to connect to>\n", simOpt, u16ptr:&(rfsimulator->port), defuintval:PORT, TYPE_UINT16, 0 },\
|
||||
{RFSIMU_OPTIONS_PARAMNAME, RFSIM_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0 },\
|
||||
{"IQfile", "<file path to use when saving IQs>\n",simOpt, strptr:&(saveF), defstrval:"/tmp/rfsimulator.iqs",TYPE_STRING, 0 },\
|
||||
{"modelname", "<channel model name>\n", simOpt, strptr:&(modelname), defstrval:"AWGN", TYPE_STRING, 0 },\
|
||||
{"ploss", "<channel path loss in dB>\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\
|
||||
{"forgetfact", "<channel forget factor ((0 to 1)>\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\
|
||||
{"offset", "<channel offset in samps>\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\
|
||||
};
|
||||
|
||||
|
||||
|
||||
static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg);
|
||||
static telnetshell_cmddef_t rfsimu_cmdarray[] = {
|
||||
{"setmodel","<model name>",(cmdfunc_t)rfsimu_setchanmod_cmd,TELNETSRV_CMDFLAG_PUSHINTPOOLQ},
|
||||
{"setmodel","<model name> <model type>",(cmdfunc_t)rfsimu_setchanmod_cmd,TELNETSRV_CMDFLAG_PUSHINTPOOLQ},
|
||||
{"","",NULL},
|
||||
};
|
||||
|
||||
@@ -133,6 +135,7 @@ typedef struct {
|
||||
double chan_pathloss;
|
||||
double chan_forgetfact;
|
||||
int chan_offset;
|
||||
float noise_power_dB;
|
||||
void *telnetcmd_qid;
|
||||
poll_telnetcmdq_func_t poll_telnetcmdq;
|
||||
} rfsimulator_state_t;
|
||||
@@ -182,15 +185,9 @@ static void allocCirBuf(rfsimulator_state_t *bridge, int sock) {
|
||||
tableNor(rand);
|
||||
init_done=true;
|
||||
}
|
||||
|
||||
ptr->channel_model=new_channel_desc_scm(bridge->tx_num_channels,bridge->rx_num_channels,
|
||||
bridge->channelmod,
|
||||
bridge->sample_rate,
|
||||
bridge->tx_bw,
|
||||
30e-9, // TDL delay-spread parameter
|
||||
bridge->chan_forgetfact, // forgetting_factor
|
||||
bridge->chan_offset, // maybe used for TA
|
||||
bridge->chan_pathloss); // path_loss in dB
|
||||
char *modelname = (bridge->typeStamp == ENB_MAGICDL) ? "rfsimu_channel_ue0":"rfsimu_channel_enB0";
|
||||
ptr->channel_model=find_channel_desc_fromname(modelname); // path_loss in dB
|
||||
AssertFatal((ptr->channel_model!= NULL),"Channel model %s not found, check config file\n",modelname);
|
||||
set_channeldesc_owner(ptr->channel_model, RFSIMU_MODULEID);
|
||||
random_channel(ptr->channel_model,false);
|
||||
}
|
||||
@@ -299,7 +296,8 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) {
|
||||
break;
|
||||
} else if (strcmp(rfsimu_params[p].strlistptr[i],"chanmod") == 0) {
|
||||
init_channelmod();
|
||||
rfsimulator->channelmod=modelid_fromname(modelname);
|
||||
load_channellist(rfsimulator->tx_num_channels, rfsimulator->rx_num_channels, rfsimulator->sample_rate, rfsimulator->tx_bw);
|
||||
rfsimulator->channelmod=true;
|
||||
} else {
|
||||
fprintf(stderr,"Unknown rfsimulator option: %s\n",rfsimu_params[p].strlistptr[i]);
|
||||
exit(-1);
|
||||
@@ -320,20 +318,27 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) {
|
||||
|
||||
static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg) {
|
||||
char *modelname=NULL;
|
||||
int s = sscanf(buff,"%ms\n",&modelname);
|
||||
char *modeltype=NULL;
|
||||
if (debug)
|
||||
prnt("rfsimu_setchanmod_cmd buffer \"%s\"\n",buff);
|
||||
int s = sscanf(buff,"%m[^ ] %ms\n",&modelname, &modeltype);
|
||||
|
||||
if (s == 1) {
|
||||
int channelmod=modelid_fromname(modelname);
|
||||
if (s == 2) {
|
||||
int channelmod=modelid_fromstrtype(modeltype);
|
||||
|
||||
if (channelmod<0)
|
||||
prnt("ERROR: model %s unknown\n",modelname);
|
||||
prnt("ERROR: model type %s unknown\n",modeltype);
|
||||
else {
|
||||
rfsimulator_state_t *t = (rfsimulator_state_t *)arg;
|
||||
|
||||
int found=0;
|
||||
for (int i=0; i<FD_SETSIZE; i++) {
|
||||
buffer_t *b=&t->buf[i];
|
||||
if ( b->channel_model==NULL)
|
||||
continue;
|
||||
if (b->channel_model->model_name==NULL)
|
||||
continue;
|
||||
if (b->conn_sock >= 0 && (strcmp(b->channel_model->model_name,modelname)==0)) {
|
||||
|
||||
if (b->conn_sock >= 0 ) {
|
||||
channel_desc_t *newmodel=new_channel_desc_scm(t->tx_num_channels,t->rx_num_channels,
|
||||
channelmod,
|
||||
t->sample_rate,
|
||||
@@ -341,21 +346,29 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt,
|
||||
30e-9, // TDL delay-spread parameter
|
||||
t->chan_forgetfact, // forgetting_factor
|
||||
t->chan_offset, // maybe used for TA
|
||||
t->chan_pathloss); // path_loss in dB
|
||||
t->chan_pathloss,
|
||||
t->noise_power_dB
|
||||
); // path_loss in dB
|
||||
set_channeldesc_owner(newmodel, RFSIMU_MODULEID);
|
||||
set_channeldesc_name(newmodel,modelname);
|
||||
random_channel(newmodel,false);
|
||||
channel_desc_t *oldmodel=b->channel_model;
|
||||
b->channel_model=newmodel;
|
||||
free_channel_desc_scm(oldmodel);
|
||||
prnt("New model %s applied to channel connected to sock %d\n",modelname,i);
|
||||
prnt("New model type %s applied to channel %s connected to sock %d\n",modeltype,modelname,i);
|
||||
found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* for */
|
||||
if (found==0)
|
||||
prnt("Channel %s not found or not currently used\n",modelname);
|
||||
}
|
||||
} else {
|
||||
prnt("ERROR: no model specified\n");
|
||||
prnt("ERROR: 2 parameters required: model name and model type (%i found)\n",s);
|
||||
}
|
||||
|
||||
free(modelname);
|
||||
free(modeltype);
|
||||
return CMDSTATUS_FOUND;
|
||||
}
|
||||
|
||||
@@ -774,6 +787,11 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
// to change the log level, use this on command line
|
||||
// --log_config.hw_log_level debug
|
||||
rfsimulator_state_t *rfsimulator = (rfsimulator_state_t *)calloc(sizeof(rfsimulator_state_t),1);
|
||||
// initialize channel simulation
|
||||
rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels;
|
||||
rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels;
|
||||
rfsimulator->sample_rate=openair0_cfg->sample_rate;
|
||||
rfsimulator->tx_bw=openair0_cfg->tx_bw;
|
||||
rfsimulator_readconfig(rfsimulator);
|
||||
pthread_mutex_init(&Sockmutex, NULL);
|
||||
LOG_I(HW,"rfsimulator: running as %s\n", rfsimulator-> typeStamp == ENB_MAGICDL ? "server waiting opposite rfsimulators to connect" : "client: will connect to a rfsimulator server side");
|
||||
@@ -798,11 +816,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
|
||||
rfsimulator->buf[i].conn_sock=-1;
|
||||
|
||||
AssertFatal((rfsimulator->epollfd = epoll_create1(0)) != -1,"");
|
||||
// initialize channel simulation
|
||||
rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels;
|
||||
rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels;
|
||||
rfsimulator->sample_rate=openair0_cfg->sample_rate;
|
||||
rfsimulator->tx_bw=openair0_cfg->tx_bw;
|
||||
|
||||
//randominit(0);
|
||||
set_taus_seed(0);
|
||||
/* look for telnet server, if it is loaded, add the channel modeling commands to it */
|
||||
|
||||
@@ -201,7 +201,6 @@ int main(int argc, char *argv[]) {
|
||||
void *buff=malloc(bufSize);
|
||||
uint64_t timestamp=0;
|
||||
const int blockSize=1920;
|
||||
|
||||
// If fileSize is not multiple of blockSize*4 then discard remaining samples
|
||||
fileSize = (fileSize/(blockSize<<2))*(blockSize<<2);
|
||||
|
||||
|
||||
@@ -869,7 +869,6 @@ static void *ru_thread_asynch_rxtx( void *param ) {
|
||||
LOG_I(PHY, "devices ok (ru_thread_asynch_rxtx)\n");
|
||||
|
||||
while (!oai_exit) {
|
||||
if (oai_exit) break;
|
||||
|
||||
if (ru->state != RU_RUN) {
|
||||
subframe=0;
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user