Commit 9179a7f0 authored by Sreeshma Shiv's avatar Sreeshma Shiv

Adding pathloss models as described in 3GPP TR 38.901 v16.1.0

parent 9a57514b
This diff is collapsed.
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#ifndef __SIMULATION_TOOLS_DEFS_H__ #ifndef __SIMULATION_TOOLS_DEFS_H__
#define __SIMULATION_TOOLS_DEFS_H__ #define __SIMULATION_TOOLS_DEFS_H__
#include "PHY/defs_common.h" #include "PHY/defs_common.h"
#include "common/utils/telnetsrv/telnetsrv.h"
#include <pthread.h> #include <pthread.h>
/** @defgroup _numerical_ Useful Numerical Functions /** @defgroup _numerical_ Useful Numerical Functions
*@{ *@{
...@@ -57,6 +58,51 @@ typedef enum { ...@@ -57,6 +58,51 @@ typedef enum {
CORR_LEVEL_HIGH CORR_LEVEL_HIGH
} corr_level_t; } corr_level_t;
typedef struct pathloss_model_variable_t_s{
//antenna height for BS in meters
double h_bs;
//antenna height for UT (User Terminal) in meters
double h_ut;
//H = avg. building height in meters
double H ;
//W = avg. street width in meters
double W ;
//2D distance between Tx and Rx in meters
double d_2d;
}pathloss_model_variable_t;
typedef enum {
//No Pathloss model selected user can set Pathloss.
None,
//Rural Macro Line of Sight
RMa_LOS,
//Rural Macro Non-Line of Sight
RMa_NLOS,
//Urban Macro Line of Sight
UMa_LOS,
//Urban Macro Non-Line of Sight
UMa_NLOS,
//Urabn Micro Street Canyon Line of Sight
UMi_SC_LOS,
//Urabn Micro Street Canyon Non-Line of Sight
UMi_SC_NLOS,
//Indoor Hotspot Office Line of Sight
InH_Office_LOS,
//Indoor Hotspot Office Non-Line of Sight
InH_Office_NLOS,
//Indoor Factory Line of Sight
InF_LOS,
//Indoor Factory with Dense clutter and Low base station height (both Tx and Rx are below the average height of the clutter)
InF_NLOS_DL,
//Indoor Factory with Dense clutter and High base station height (Tx or Rx elevated above the clutter)
InF_NLOS_DH,
//Indoor Factory with Sparse clutter and Low base station height (both Tx and Rx are below the average height of the clutter)
InF_NLOS_SL,
//Indoor Factory with Sparse clutter and High base station height (Tx or Rx elevated above the clutter)
InF_NLOS_SH
} pathloss_model_t;
typedef struct { typedef struct {
///Number of tx antennas ///Number of tx antennas
uint8_t nb_tx; uint8_t nb_tx;
...@@ -123,9 +169,15 @@ typedef struct { ...@@ -123,9 +169,15 @@ typedef struct {
/// 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; channelmod_moduleid_t module_id;
/// name of this descriptor,used for model created from config file at init time /// name of this descriptor,used for model created from config file at init time
char *model_name; char *model_name;
/// flags to properly trigger memory free /// flags to properly trigger memory free
unsigned int free_flags; unsigned int free_flags;
/// Pathloss Models as defined by TR 38.901 version 16.1.0 Release 16
pathloss_model_t pathloss_model;
/// Variables required for pathloss models
pathloss_model_variable_t pathloss_model_var;
///Pathloss Model Flag doesn't let the user change the pathloss directly when Pathloss Model is set
int PM_Flag;
} channel_desc_t; } channel_desc_t;
typedef struct { typedef struct {
...@@ -258,6 +310,23 @@ typedef enum { ...@@ -258,6 +310,23 @@ typedef enum {
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n" #define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
#define CHANNELMOD_SECTION "channelmod" #define CHANNELMOD_SECTION "channelmod"
#define PLMOD_MAP_INIT \
{"None",None},\
{"RMa_LOS",RMa_LOS},\
{"RMa_NLOS",RMa_NLOS},\
{"UMa_LOS",UMa_LOS},\
{"UMa_NLOS",UMa_NLOS},\
{"UMi_SC_LOS",UMi_SC_LOS},\
{"UMi_SC_NLOS",UMi_SC_NLOS},\
{"InH_Office_LOS",InH_Office_LOS},\
{"InH_Office_NLOS",InH_Office_NLOS},\
{"InF_LOS",InF_LOS},\
{"InF_NLOS_DL",InF_NLOS_DL},\
{"InF_NLOS_DH",InF_NLOS_DH},\
{"InF_NLOS_SL",InF_NLOS_SL},\
{"InF_NLOS_SH",InF_NLOS_SH},\
{NULL, -1}
/* global channel modelization parameters */ /* global channel modelization parameters */
#define CHANNELMOD_MODELLIST_PARANAME "modellist" #define CHANNELMOD_MODELLIST_PARANAME "modellist"
...@@ -271,9 +340,10 @@ typedef enum { ...@@ -271,9 +340,10 @@ typedef enum {
} }
// clang-format on // clang-format on
/* parameters for one model */ /* parameters for one model */
#define CHANNELMOD_MODEL_NAME_PNAME "model_name" #define CHANNELMOD_MODEL_NAME_PNAME "model_name"
#define CHANNELMOD_MODEL_TYPE_PNAME "type" #define CHANNELMOD_MODEL_TYPE_PNAME "type"
#define CHANNELMOD_MODEL_PLM_PNAME "pathloss_model"
#define CHANNELMOD_MODEL_PL_PNAME "ploss_dB" #define CHANNELMOD_MODEL_PL_PNAME "ploss_dB"
#define CHANNELMOD_MODEL_NP_PNAME "noise_power_dB" #define CHANNELMOD_MODEL_NP_PNAME "noise_power_dB"
#define CHANNELMOD_MODEL_FF_PNAME "forgetfact" #define CHANNELMOD_MODEL_FF_PNAME "forgetfact"
...@@ -284,6 +354,7 @@ typedef enum { ...@@ -284,6 +354,7 @@ typedef enum {
#define CHANNELMOD_MODEL_PARAMS_DESC { \ #define CHANNELMOD_MODEL_PARAMS_DESC { \
{CHANNELMOD_MODEL_NAME_PNAME, "name of the model\n", 0, .strptr=NULL , .defstrval="", TYPE_STRING, 0 }, \ {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_TYPE_PNAME, "name of the model type\n", 0, .strptr=NULL , .defstrval="AWGN", TYPE_STRING, 0 }, \
{CHANNELMOD_MODEL_PLM_PNAME, "name of the pathloss Model\n", 0, .strptr=NULL , .defstrval="None", TYPE_STRING, 0 }, \
{CHANNELMOD_MODEL_PL_PNAME, "channel path loss in dB\n", 0, .dblptr=NULL, .defdblval=0, TYPE_DOUBLE, 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_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_FF_PNAME, "channel forget factor ((0 to 1)\n", 0, .dblptr=NULL, .defdblval=0, TYPE_DOUBLE, 0 }, \
...@@ -320,6 +391,7 @@ typedef struct { ...@@ -320,6 +391,7 @@ typedef struct {
channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
uint8_t nb_rx, uint8_t nb_rx,
SCM_t channel_model, SCM_t channel_model,
pathloss_model_t pathloss_model,
double sampling_rate, double sampling_rate,
uint64_t center_freq, uint64_t center_freq,
double channel_bandwidth, double channel_bandwidth,
...@@ -333,6 +405,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -333,6 +405,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
channel_desc_t *find_channel_desc_fromname( char *modelname ); channel_desc_t *find_channel_desc_fromname( char *modelname );
int calculate_pathloss_cmd(channel_desc_t *chan_desc);
/** /**
\brief free memory allocated for a model descriptor \brief free memory allocated for a model descriptor
...@@ -553,14 +626,14 @@ int modelid_fromstrtype(char *modeltype); ...@@ -553,14 +626,14 @@ int modelid_fromstrtype(char *modeltype);
double channelmod_get_snr_dB(void); double channelmod_get_snr_dB(void);
double channelmod_get_sinr_dB(void); double channelmod_get_sinr_dB(void);
void init_channelmod(void) ; void init_channelmod(void) ;
int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth) ; int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double channel_bandwidth, uint64_t fc) ;
double N_RB2sampling_rate(uint16_t N_RB); double N_RB2sampling_rate(uint16_t N_RB);
double N_RB2channel_bandwidth(uint16_t N_RB); double N_RB2channel_bandwidth(uint16_t N_RB);
/* Linear phase noise model */ /* Linear phase noise model */
/*! /*!
\brief This function produce phase noise and add to input signal \brief This function produce phase noise and add to input signal
\param ts Sampling time \param ts Sampling time
\param *Re *Im Real and Imag part of the signal \param *Re *Im Real and Imag part of the signal
*/ */
//look-up table for the sine (cosine) function //look-up table for the sine (cosine) function
......
...@@ -120,6 +120,7 @@ typedef enum { SIMU_ROLE_SERVER = 1, SIMU_ROLE_CLIENT } simuRole; ...@@ -120,6 +120,7 @@ typedef enum { SIMU_ROLE_SERVER = 1, SIMU_ROLE_CLIENT } simuRole;
static void getset_currentchannels_type(char *buf, int debug, webdatadef_t *tdata, telnet_printfunc_t prnt); static void getset_currentchannels_type(char *buf, int debug, webdatadef_t *tdata, telnet_printfunc_t prnt);
extern int get_currentchannels_type(char *buf, int debug, webdatadef_t *tdata, telnet_printfunc_t prnt); // in random_channel.c extern int get_currentchannels_type(char *buf, int debug, webdatadef_t *tdata, telnet_printfunc_t prnt); // in random_channel.c
extern void display_channelmodel(channel_desc_t *cd,int debug, telnet_printfunc_t prnt); // in randon_channel.c
static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg); static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg);
static int rfsimu_setdistance_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg); static int rfsimu_setdistance_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg);
static int rfsimu_getdistance_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg); static int rfsimu_getdistance_cmd(char *buff, int debug, telnet_printfunc_t prnt, void *arg);
...@@ -160,6 +161,7 @@ typedef struct { ...@@ -160,6 +161,7 @@ typedef struct {
simuRole role; simuRole role;
char *ip; char *ip;
uint16_t port; uint16_t port;
uint64_t fc; //center frequency
int saveIQfile; int saveIQfile;
buffer_t buf[MAX_FD_RFSIMU]; buffer_t buf[MAX_FD_RFSIMU];
int rx_num_channels; int rx_num_channels;
...@@ -167,6 +169,7 @@ typedef struct { ...@@ -167,6 +169,7 @@ typedef struct {
double sample_rate; double sample_rate;
double tx_bw; double tx_bw;
int channelmod; int channelmod;
int pathlossmod;
double chan_pathloss; double chan_pathloss;
double chan_forgetfact; double chan_forgetfact;
int chan_offset; int chan_offset;
...@@ -354,7 +357,7 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) { ...@@ -354,7 +357,7 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) {
break; break;
} else if (strcmp(rfsimu_params[p].strlistptr[i],"chanmod") == 0) { } else if (strcmp(rfsimu_params[p].strlistptr[i],"chanmod") == 0) {
init_channelmod(); init_channelmod();
load_channellist(rfsimulator->tx_num_channels, rfsimulator->rx_num_channels, rfsimulator->sample_rate, rfsimulator->tx_bw); load_channellist(rfsimulator->tx_num_channels, rfsimulator->rx_num_channels, rfsimulator->sample_rate, rfsimulator->tx_bw, rfsimulator->fc);
rfsimulator->channelmod=true; rfsimulator->channelmod=true;
} else { } else {
fprintf(stderr, "unknown rfsimulator option: %s\n", rfsimu_params[p].strlistptr[i]); fprintf(stderr, "unknown rfsimulator option: %s\n", rfsimu_params[p].strlistptr[i]);
...@@ -411,6 +414,7 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, ...@@ -411,6 +414,7 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt,
channel_desc_t *newmodel = new_channel_desc_scm(t->tx_num_channels, channel_desc_t *newmodel = new_channel_desc_scm(t->tx_num_channels,
t->rx_num_channels, t->rx_num_channels,
channelmod, channelmod,
t->pathlossmod,
t->sample_rate, t->sample_rate,
0, 0,
t->tx_bw, t->tx_bw,
...@@ -567,6 +571,9 @@ static int rfsimu_setdistance_cmd(char *buff, int debug, telnet_printfunc_t prnt ...@@ -567,6 +571,9 @@ static int rfsimu_setdistance_cmd(char *buff, int debug, telnet_printfunc_t prnt
const int nbTx = cd->nb_tx; const int nbTx = cd->nb_tx;
prnt(" %s: Modifying model %s...\n", __func__, modelname); prnt(" %s: Modifying model %s...\n", __func__, modelname);
rfsimu_offset_change_cirBuf(b->circularBuf, t->nextRxTstamp, CirSize, old_offset, new_offset, nbTx); rfsimu_offset_change_cirBuf(b->circularBuf, t->nextRxTstamp, CirSize, old_offset, new_offset, nbTx);
cd->pathloss_model_var.d_2d = new_distance;
calculate_pathloss_cmd(cd);
display_channelmodel(cd,debug,prnt);
} }
free(modelname); free(modelname);
...@@ -1077,7 +1084,8 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) { ...@@ -1077,7 +1084,8 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels; rfsimulator->tx_num_channels=openair0_cfg->tx_num_channels;
rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels; rfsimulator->rx_num_channels=openair0_cfg->rx_num_channels;
rfsimulator->sample_rate=openair0_cfg->sample_rate; rfsimulator->sample_rate=openair0_cfg->sample_rate;
rfsimulator->tx_bw=openair0_cfg->tx_bw; rfsimulator->fc=openair0_cfg->tx_freq[0];
rfsimulator->tx_bw=openair0_cfg->tx_bw;
rfsimulator_readconfig(rfsimulator); rfsimulator_readconfig(rfsimulator);
LOG_W(HW, "sample_rate %f\n", rfsimulator->sample_rate); LOG_W(HW, "sample_rate %f\n", rfsimulator->sample_rate);
pthread_mutex_init(&Sockmutex, NULL); pthread_mutex_init(&Sockmutex, NULL);
......
uicc0 = {
imsi = "001010000000001";
key = "fec86ba6eb707ed08905757b1bb44b8f";
opc= "C42449363BBAD02B66D16BC975D77CC1";
dnn= "oai";
nssai_sst=1;
nssai_sd=0xffffff;
}
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_ue0"
type = "AWGN";
ploss_dB = 0;
noise_power_dB = -10;
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;
}
);
};
log_config :
{
global_log_level ="info";
hw_log_level ="info";
phy_log_level ="critical";
mac_log_level ="critical";
rlc_log_level ="critical";
pdcp_log_level ="critical";
rrc_log_level ="critical";
ngap_log_level ="critical";
f1ap_log_level ="critical";
};
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