fix phy simulators build Pb: move snr_dB global to simulation code, add a channel mode section in configuration for snr_dB ,add a parameter flag in the config module to allow omitting prefix when modifying a parameter (for compatibility of -s option)

This commit is contained in:
frtabu
2019-08-07 18:42:35 +02:00
parent f3a757ce5a
commit d3217ac30b
14 changed files with 240 additions and 257 deletions
@@ -52,7 +52,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 ?
// 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 - snr_dB;
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;
+6 -6
View File
@@ -42,7 +42,7 @@
// Fixme: datamodel, external variables in .h files, ...
#include <common/ran_context.h>
extern double snr_dB;
extern RAN_CONTEXT_t RC;
//
@@ -91,7 +91,7 @@ typedef struct {
int tx_num_channels;
double sample_rate;
double tx_bw;
bool enable_channelmod;
int channelmod;
} rfsimulator_state_t;
@@ -112,7 +112,7 @@ void allocCirBuf(rfsimulator_state_t *bridge, int sock) {
ev.data.fd = sock;
AssertFatal(epoll_ctl(bridge->epollfd, EPOLL_CTL_ADD, sock, &ev) != -1, "");
if ( bridge->enable_channelmod==true) {
if ( bridge->channelmod > 0) {
// create channel simulation model for this mode reception
// snr_dB is pure global, coming from configuration paramter "-s"
// Fixme: referenceSignalPower should come from the right place
@@ -126,7 +126,7 @@ void allocCirBuf(rfsimulator_state_t *bridge, int sock) {
// Legacy changes directlty the variable channel_model->path_loss_dB place to place
// while calling new_channel_desc_scm() with path losses = 0
ptr->channel_model=new_channel_desc_scm(bridge->tx_num_channels,bridge->rx_num_channels,
AWGN,
bridge->channelmod,
bridge->sample_rate,
bridge->tx_bw,
0.0, // forgetting_factor
@@ -239,8 +239,8 @@ void rfsimulator_readconfig(rfsimulator_state_t *rfsimulator) {
break;
} else if (strcmp(rfsimu_params[p].strlistptr[i],"chanmod") == 0) {
init_channelmod(modelname);
rfsimulator->enable_channelmod=true;
init_channelmod();
rfsimulator->channelmod=modelid_fromname(modelname);
} else {
fprintf(stderr,"Unknown rfsimulator option: %s\n",rfsimu_params[p].strlistptr[i]);
exit(-1);