rfsimulator: remove static variable last_TS from function rxAddInput()
This static variable creates issues when there are multiple instances of the LEO channel model in use.
This commit is contained in:
@@ -27,9 +27,8 @@
|
|||||||
#include "openair2/LAYER2/NR_MAC_gNB/mac_config.h"
|
#include "openair2/LAYER2/NR_MAC_gNB/mac_config.h"
|
||||||
#include "rfsimulator.h"
|
#include "rfsimulator.h"
|
||||||
|
|
||||||
void update_channel_model(channel_desc_t *channelDesc, uint64_t TS)
|
void update_channel_model(channel_desc_t *channelDesc, int nbSamples, uint64_t TS)
|
||||||
{
|
{
|
||||||
static uint64_t last_TS = 0;
|
|
||||||
if ((channelDesc->sat_height > 0)
|
if ((channelDesc->sat_height > 0)
|
||||||
&& (channelDesc->enable_dynamic_delay
|
&& (channelDesc->enable_dynamic_delay
|
||||||
|| channelDesc->enable_dynamic_Doppler)) { // model for transparent satellite on circular orbit
|
|| channelDesc->enable_dynamic_Doppler)) { // model for transparent satellite on circular orbit
|
||||||
@@ -137,8 +136,7 @@ void update_channel_model(channel_desc_t *channelDesc, uint64_t TS)
|
|||||||
if (channelDesc->enable_dynamic_Doppler)
|
if (channelDesc->enable_dynamic_Doppler)
|
||||||
channelDesc->Doppler_phase_inc = 2 * M_PI * f_Doppler_shift_ue_sat / channelDesc->sampling_rate;
|
channelDesc->Doppler_phase_inc = 2 * M_PI * f_Doppler_shift_ue_sat / channelDesc->sampling_rate;
|
||||||
|
|
||||||
if (TS - last_TS >= channelDesc->sampling_rate) {
|
if (TS / (unsigned int)channelDesc->sampling_rate != (TS + nbSamples) / (unsigned int)channelDesc->sampling_rate) {
|
||||||
last_TS = TS;
|
|
||||||
LOG_I(HW,
|
LOG_I(HW,
|
||||||
"Satellite orbit: time %f s, Position = (%f, %f, %f), Velocity = (%f, %f, %f)\n",
|
"Satellite orbit: time %f s, Position = (%f, %f, %f), Velocity = (%f, %f, %f)\n",
|
||||||
t,
|
t,
|
||||||
@@ -204,8 +202,7 @@ void update_channel_model(channel_desc_t *channelDesc, uint64_t TS)
|
|||||||
if (channelDesc->enable_dynamic_Doppler)
|
if (channelDesc->enable_dynamic_Doppler)
|
||||||
channelDesc->Doppler_phase_inc = 2 * M_PI * f_Doppler_shift_sat_ue / channelDesc->sampling_rate;
|
channelDesc->Doppler_phase_inc = 2 * M_PI * f_Doppler_shift_sat_ue / channelDesc->sampling_rate;
|
||||||
|
|
||||||
if (TS - last_TS >= channelDesc->sampling_rate) {
|
if (TS / (unsigned int)channelDesc->sampling_rate != (TS + nbSamples) / (unsigned int)channelDesc->sampling_rate) {
|
||||||
last_TS = TS;
|
|
||||||
LOG_I(HW,
|
LOG_I(HW,
|
||||||
"Satellite orbit: time %f s, Position = (%f, %f, %f), Velocity = (%f, %f, %f)\n",
|
"Satellite orbit: time %f s, Position = (%f, %f, %f), Velocity = (%f, %f, %f)\n",
|
||||||
t,
|
t,
|
||||||
|
|||||||
@@ -30,5 +30,5 @@ void rxAddInput(c16_t **input_sig,
|
|||||||
channel_desc_t *channelDesc,
|
channel_desc_t *channelDesc,
|
||||||
int nbSamples,
|
int nbSamples,
|
||||||
uint64_t TS);
|
uint64_t TS);
|
||||||
void update_channel_model(channel_desc_t *channelDesc, uint64_t TS);
|
void update_channel_model(channel_desc_t *channelDesc, int nbSamples, uint64_t TS);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1426,7 +1426,7 @@ static int rfsimulator_read_beams(openair0_device_t *device,
|
|||||||
buffer_t *ptr = &t->buf[sock];
|
buffer_t *ptr = &t->buf[sock];
|
||||||
|
|
||||||
if (ptr->conn_sock != -1 && ptr->channel_model != NULL) {
|
if (ptr->conn_sock != -1 && ptr->channel_model != NULL) {
|
||||||
update_channel_model(ptr->channel_model, t->nextRxTstamp);
|
update_channel_model(ptr->channel_model, nsamps, t->nextRxTstamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user