Commit 3b1b74cf authored by Laurent THOMAS's avatar Laurent THOMAS

starting

parent fdc818bc
...@@ -157,8 +157,16 @@ install_protobuf_from_source(){ ...@@ -157,8 +157,16 @@ install_protobuf_from_source(){
#cd protobuf-2.6.1/ #cd protobuf-2.6.1/
rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 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 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 tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $(id -u) --group $(id -g) --no-same-owner
cd protobuf-3.3.0/ || exit 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 ./configure
echo "Compiling protobuf" echo "Compiling protobuf"
make -j"$(nproc)" make -j"$(nproc)"
...@@ -198,15 +206,15 @@ install_usrp_uhd_driver_from_source(){ ...@@ -198,15 +206,15 @@ install_usrp_uhd_driver_from_source(){
rm -rf /tmp/uhd rm -rf /tmp/uhd
git clone https://github.com/EttusResearch/uhd.git git clone https://github.com/EttusResearch/uhd.git
cd uhd || exit cd uhd || exit
git checkout tags/v3.13.0.2 git checkout UHD-3.15.LTS
mkdir -p host/build mkdir -p host/build
cd host/build || exit cd host/build || exit
$CMAKE ../ $CMAKE ../ -GNinja
echo "Compiling UHD" echo "Compiling UHD"
make -j"$(nproc)" ninja
make test $SUDO ninja install
$SUDO make install
$SUDO ldconfig $SUDO ldconfig
$SUDO /usr/lib/uhd/utils/uhd_images_downloader.py
) >& "$uhd_install_log" ) >& "$uhd_install_log"
} }
......
...@@ -502,7 +502,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -502,7 +502,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
double DS_TDL, double DS_TDL,
double forgetting_factor, double forgetting_factor,
int32_t channel_offset, int32_t channel_offset,
double path_loss_dB) { double path_loss_dB,
float noise_power_dB) {
channel_desc_t *chan_desc = (channel_desc_t *)calloc(1,sizeof(channel_desc_t)); channel_desc_t *chan_desc = (channel_desc_t *)calloc(1,sizeof(channel_desc_t));
for(int i=0; i<max_chan;i++) { for(int i=0; i<max_chan;i++) {
if (defined_channels[i] == NULL) { if (defined_channels[i] == NULL) {
...@@ -530,6 +531,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -530,6 +531,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
chan_desc->path_loss_dB = path_loss_dB; chan_desc->path_loss_dB = path_loss_dB;
chan_desc->first_run = 1; chan_desc->first_run = 1;
chan_desc->ip = 0.0; chan_desc->ip = 0.0;
chan_desc->noise_power_dB = noise_power_dB;
LOG_I(OCM,"Channel Model (inside of new_channel_desc_scm)=%d\n\n", channel_model); LOG_I(OCM,"Channel Model (inside of new_channel_desc_scm)=%d\n\n", channel_model);
int tdl_paths=0; int tdl_paths=0;
...@@ -1861,7 +1864,7 @@ static int channelmod_print_help(char *buff, int debug, telnet_printfunc_t prnt ...@@ -1861,7 +1864,7 @@ static int channelmod_print_help(char *buff, int debug, telnet_printfunc_t prnt
prnt("channelmod show current: display the currently used models in the running executable\n"); prnt("channelmod show current: display the currently used models in the running executable\n");
prnt("channelmod modify <model index> <param name> <param value>: set the specified parameters in a current model to the given value\n"); prnt("channelmod modify <model index> <param name> <param value>: set the specified parameters in a current model to the given value\n");
prnt(" <model index> specifies the model, the show current model command can be used to list the current models indexes\n"); prnt(" <model index> specifies the model, the show current model command can be used to list the current models indexes\n");
prnt(" <param name> can be one of \"riceanf\", \"aoa\", \"randaoa\", \"ploss\", \"offset\", \"forgetf\"\n"); prnt(" <param name> can be one of \"riceanf\", \"aoa\", \"randaoa\", \"ploss\", \"noise_power_dB\", \"offset\", \"forgetf\"\n");
return CMDSTATUS_FOUND; return CMDSTATUS_FOUND;
} }
...@@ -1874,8 +1877,8 @@ static void display_channelmodel(channel_desc_t *cd,int debug, telnet_printfunc_ ...@@ -1874,8 +1877,8 @@ static void display_channelmodel(channel_desc_t *cd,int debug, telnet_printfunc_
prnt("nb_tx: %i nb_rx: %i taps: %i bandwidth: %lf sampling: %lf\n",cd->nb_tx, cd->nb_rx, cd->nb_taps, cd->channel_bandwidth, cd->sampling_rate); prnt("nb_tx: %i nb_rx: %i taps: %i bandwidth: %lf sampling: %lf\n",cd->nb_tx, cd->nb_rx, cd->nb_taps, cd->channel_bandwidth, cd->sampling_rate);
prnt("channel length: %i Max path delay: %lf ricean fact.: %lf angle of arrival: %lf (randomized:%s)\n", prnt("channel length: %i Max path delay: %lf ricean fact.: %lf angle of arrival: %lf (randomized:%s)\n",
cd->channel_length, cd->Td, cd->ricean_factor, cd->aoa, (cd->random_aoa?"Yes":"No")); cd->channel_length, cd->Td, cd->ricean_factor, cd->aoa, (cd->random_aoa?"Yes":"No"));
prnt("max Doppler: %lf path loss: %lf rchannel offset: %i forget factor; %lf\n", prnt("max Doppler: %lf path loss: %lf noise: %lf rchannel offset: %i forget factor; %lf\n",
cd->max_Doppler, cd->path_loss_dB, cd->channel_offset, cd->forgetting_factor); cd->max_Doppler, cd->path_loss_dB, cd->noise_power_dB, cd->channel_offset, cd->forgetting_factor);
prnt("Initial phase: %lf nb_path: %i \n", prnt("Initial phase: %lf nb_path: %i \n",
cd->ip, cd->nb_paths); cd->ip, cd->nb_paths);
for (int i=0; i<cd->nb_taps ; i++) { for (int i=0; i<cd->nb_taps ; i++) {
...@@ -1945,6 +1948,9 @@ static int channelmod_modify_cmd(char *buff, int debug, telnet_printfunc_t prnt) ...@@ -1945,6 +1948,9 @@ static int channelmod_modify_cmd(char *buff, int debug, telnet_printfunc_t prnt)
} else if ( strcmp(param,"ploss") == 0) { } else if ( strcmp(param,"ploss") == 0) {
double dbl = atof(value); double dbl = atof(value);
defined_channels[cd_id]->path_loss_dB=dbl; defined_channels[cd_id]->path_loss_dB=dbl;
} else if ( strcmp(param,"noise_power_dB") == 0) {
double dbl = atof(value);
defined_channels[cd_id]->noise_power_dB=dbl;
} else if ( strcmp(param,"offset") == 0) { } else if ( strcmp(param,"offset") == 0) {
int i = atoi(value); int i = atoi(value);
defined_channels[cd_id]->channel_offset=i; defined_channels[cd_id]->channel_offset=i;
......
...@@ -89,6 +89,7 @@ typedef struct { ...@@ -89,6 +89,7 @@ typedef struct {
double path_loss_dB; double path_loss_dB;
///additional delay of channel in samples. ///additional delay of channel in samples.
int32_t channel_offset; 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 ///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; double forgetting_factor;
///needs to be set to 1 for the first call, 0 otherwise. ///needs to be set to 1 for the first call, 0 otherwise.
...@@ -280,7 +281,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx, ...@@ -280,7 +281,8 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
double TDL_DS, double TDL_DS,
double forgetting_factor, double forgetting_factor,
int32_t channel_offset, int32_t channel_offset,
double path_loss_dB); double path_loss_dB,
float noise_power_dB);
/** /**
\brief free memory allocated for a model descriptor \brief free memory allocated for a model descriptor
\param ch points to the model, which cannot be used after calling this fuction \param ch points to the model, which cannot be used after calling this fuction
......
...@@ -72,7 +72,7 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si ...@@ -72,7 +72,7 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si
// Fixme: how to convert a noise in Watt into a 12 bits value out of the RF ADC ? // 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 // 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) // −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(); const double rxGain= 132.24 - channelDesc->noise_power_dB;
// sqrt(4*noise_figure_watt) is the thermal noise factor (volts) // sqrt(4*noise_figure_watt) is the thermal noise factor (volts)
// fixme: the last constant is pure trial results to make decent noise // 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; const double noise_per_sample = sqrt(4*noise_figure_watt) * pow(10,rxGain/20) *10;
......
...@@ -133,6 +133,7 @@ typedef struct { ...@@ -133,6 +133,7 @@ typedef struct {
double chan_pathloss; double chan_pathloss;
double chan_forgetfact; double chan_forgetfact;
int chan_offset; int chan_offset;
float noise_power_dB;
void *telnetcmd_qid; void *telnetcmd_qid;
poll_telnetcmdq_func_t poll_telnetcmdq; poll_telnetcmdq_func_t poll_telnetcmdq;
} rfsimulator_state_t; } rfsimulator_state_t;
...@@ -190,7 +191,8 @@ static void allocCirBuf(rfsimulator_state_t *bridge, int sock) { ...@@ -190,7 +191,8 @@ static void allocCirBuf(rfsimulator_state_t *bridge, int sock) {
30e-9, // TDL delay-spread parameter 30e-9, // TDL delay-spread parameter
bridge->chan_forgetfact, // forgetting_factor bridge->chan_forgetfact, // forgetting_factor
bridge->chan_offset, // maybe used for TA bridge->chan_offset, // maybe used for TA
bridge->chan_pathloss); // path_loss in dB bridge->chan_pathloss,
bridge->noise_power_dB); // path_loss in dB
set_channeldesc_owner(ptr->channel_model, RFSIMU_MODULEID); set_channeldesc_owner(ptr->channel_model, RFSIMU_MODULEID);
random_channel(ptr->channel_model,false); random_channel(ptr->channel_model,false);
} }
...@@ -341,7 +343,9 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt, ...@@ -341,7 +343,9 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt,
30e-9, // TDL delay-spread parameter 30e-9, // TDL delay-spread parameter
t->chan_forgetfact, // forgetting_factor t->chan_forgetfact, // forgetting_factor
t->chan_offset, // maybe used for TA 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_owner(newmodel, RFSIMU_MODULEID);
random_channel(newmodel,false); random_channel(newmodel,false);
channel_desc_t *oldmodel=b->channel_model; channel_desc_t *oldmodel=b->channel_model;
......
...@@ -361,6 +361,7 @@ void init_ocm(void) { ...@@ -361,6 +361,7 @@ void init_ocm(void) {
DS_TDL, DS_TDL,
0.0, 0.0,
0, 0,
0,
0); 0);
random_channel(sim.RU2UE[ru_id][UE_id][CC_id],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); 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) { ...@@ -374,6 +375,7 @@ void init_ocm(void) {
DS_TDL, DS_TDL,
0.0, 0.0,
0, 0,
0,
0); 0);
random_channel(sim.UE2RU[UE_id][ru_id][CC_id],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. // 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