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 @@
#ifndef __SIMULATION_TOOLS_DEFS_H__
#define __SIMULATION_TOOLS_DEFS_H__
#include "PHY/defs_common.h"
#include "common/utils/telnetsrv/telnetsrv.h"
#include <pthread.h>
/** @defgroup _numerical_ Useful Numerical Functions
*@{
......@@ -57,6 +58,51 @@ typedef enum {
CORR_LEVEL_HIGH
} 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 {
///Number of tx antennas
uint8_t nb_tx;
......@@ -126,6 +172,12 @@ typedef struct {
char *model_name;
/// flags to properly trigger memory free
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;
typedef struct {
......@@ -258,6 +310,23 @@ typedef enum {
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
#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 */
#define CHANNELMOD_MODELLIST_PARANAME "modellist"
......@@ -274,6 +343,7 @@ typedef enum {
/* parameters for one model */
#define CHANNELMOD_MODEL_NAME_PNAME "model_name"
#define CHANNELMOD_MODEL_TYPE_PNAME "type"
#define CHANNELMOD_MODEL_PLM_PNAME "pathloss_model"
#define CHANNELMOD_MODEL_PL_PNAME "ploss_dB"
#define CHANNELMOD_MODEL_NP_PNAME "noise_power_dB"
#define CHANNELMOD_MODEL_FF_PNAME "forgetfact"
......@@ -284,6 +354,7 @@ typedef enum {
#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_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_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 }, \
......@@ -320,6 +391,7 @@ typedef struct {
channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
uint8_t nb_rx,
SCM_t channel_model,
pathloss_model_t pathloss_model,
double sampling_rate,
uint64_t center_freq,
double channel_bandwidth,
......@@ -333,6 +405,7 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
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
......@@ -553,7 +626,7 @@ 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) ;
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_RB2channel_bandwidth(uint16_t N_RB);
......
......@@ -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);
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_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);
......@@ -160,6 +161,7 @@ typedef struct {
simuRole role;
char *ip;
uint16_t port;
uint64_t fc; //center frequency
int saveIQfile;
buffer_t buf[MAX_FD_RFSIMU];
int rx_num_channels;
......@@ -167,6 +169,7 @@ typedef struct {
double sample_rate;
double tx_bw;
int channelmod;
int pathlossmod;
double chan_pathloss;
double chan_forgetfact;
int chan_offset;
......@@ -354,7 +357,7 @@ static void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) {
break;
} else if (strcmp(rfsimu_params[p].strlistptr[i],"chanmod") == 0) {
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;
} else {
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,
channel_desc_t *newmodel = new_channel_desc_scm(t->tx_num_channels,
t->rx_num_channels,
channelmod,
t->pathlossmod,
t->sample_rate,
0,
t->tx_bw,
......@@ -567,6 +571,9 @@ static int rfsimu_setdistance_cmd(char *buff, int debug, telnet_printfunc_t prnt
const int nbTx = cd->nb_tx;
prnt(" %s: Modifying model %s...\n", __func__, modelname);
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);
......@@ -1077,6 +1084,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
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->fc=openair0_cfg->tx_freq[0];
rfsimulator->tx_bw=openair0_cfg->tx_bw;
rfsimulator_readconfig(rfsimulator);
LOG_W(HW, "sample_rate %f\n", rfsimulator->sample_rate);
......
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