Commit 68b07d54 authored by Thomas Schlichter's avatar Thomas Schlichter

rfsimulator: correctly set center frequency

parent 2ec8fefb
......@@ -2281,7 +2281,7 @@ void init_channelmod(void) {
} /* init_channelmod */
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, uint64_t center_freq, double channel_bandwidth) {
paramdef_t achannel_params[] = CHANNELMOD_MODEL_PARAMS_DESC;
paramlist_def_t channel_list;
memset(&channel_list,0,sizeof(paramlist_def_t));
......@@ -2314,7 +2314,7 @@ int load_channellist(uint8_t nb_tx, uint8_t nb_rx, double sampling_rate, double
nb_rx,
modid,
sampling_rate,
0,
center_freq,
channel_bandwidth,
*(channel_list.paramarray[i][pindex_DT].dblptr),
0.0,
......
......@@ -543,7 +543,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, uint64_t center_freq, double channel_bandwidth) ;
double N_RB2sampling_rate(uint16_t N_RB);
double N_RB2channel_bandwidth(uint16_t N_RB);
......
......@@ -167,6 +167,7 @@ typedef struct {
int rx_num_channels;
int tx_num_channels;
double sample_rate;
double rx_freq;
double tx_bw;
int channelmod;
double chan_pathloss;
......@@ -342,7 +343,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->rx_freq, rfsimulator->tx_bw);
rfsimulator->channelmod=true;
} else {
fprintf(stderr, "unknown rfsimulator option: %s\n", rfsimu_params[p].strlistptr[i]);
......@@ -400,7 +401,7 @@ static int rfsimu_setchanmod_cmd(char *buff, int debug, telnet_printfunc_t prnt,
t->rx_num_channels,
channelmod,
t->sample_rate,
0,
t->rx_freq,
t->tx_bw,
30e-9, // TDL delay-spread parameter
0.0,
......@@ -963,6 +964,8 @@ static int rfsimulator_stop(openair0_device *device) {
return 0;
}
static int rfsimulator_set_freq(openair0_device *device, openair0_config_t *openair0_cfg) {
rfsimulator_state_t* s = device->priv;
s->rx_freq = openair0_cfg->rx_freq[0];
return 0;
}
static int rfsimulator_set_gains(openair0_device *device, openair0_config_t *openair0_cfg) {
......@@ -980,6 +983,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->rx_freq=openair0_cfg->rx_freq[0];
rfsimulator->tx_bw=openair0_cfg->tx_bw;
rfsimulator_readconfig(rfsimulator);
if (rfsimulator->prop_delay_ms > 0.0)
......
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