Commit 8339b4f5 authored by Bo Zhao's avatar Bo Zhao Committed by Thomas Schlichter

Adding CL option -P to simulate the propagation delay in the RF simulator

parent 25c41e92
...@@ -107,6 +107,7 @@ ...@@ -107,6 +107,7 @@
#define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n" #define CONFIG_HLP_SNR "Set average SNR in dB (for --siml1 option)\n"
#define CONFIG_HLP_NOS1 "Disable s1 interface\n" #define CONFIG_HLP_NOS1 "Disable s1 interface\n"
#define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n" #define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n"
#define CONFIG_HLP_PROPD "Set propagation delay in the RF simulator (expressed in number of samples)\n"
/*--------------------------------------------------------------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for LOG utility */ /* command line parameters for LOG utility */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
...@@ -151,4 +152,6 @@ extern int emulate_rf; ...@@ -151,4 +152,6 @@ extern int emulate_rf;
extern int numerology; extern int numerology;
extern int usrp_tx_thread; extern int usrp_tx_thread;
extern uint64_t RFsim_PropDelay; //propagation delay in the RF simulator (expressed in number of samples)
#endif #endif
...@@ -594,6 +594,8 @@ void init_pdcp(void) { ...@@ -594,6 +594,8 @@ void init_pdcp(void) {
} }
} }
uint64_t RFsim_PropDelay = 0;
int main( int argc, char **argv ) { int main( int argc, char **argv ) {
int ru_id, CC_id = 0; int ru_id, CC_id = 0;
start_background_system(); start_background_system();
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
{"ldpc-offload-enable", CONFIG_HLP_LDPC_OFFLOAD, 0, iptr:&ldpc_offload_flag, defstrval:0, TYPE_INT, 0}, \ {"ldpc-offload-enable", CONFIG_HLP_LDPC_OFFLOAD, 0, iptr:&ldpc_offload_flag, defstrval:0, TYPE_INT, 0}, \
{"uecap_file", CONFIG_HLP_UECAP_FILE, 0, strptr:&uecap_file, defstrval:"./uecap.xml", TYPE_STRING, 0}, \ {"uecap_file", CONFIG_HLP_UECAP_FILE, 0, strptr:&uecap_file, defstrval:"./uecap.xml", TYPE_STRING, 0}, \
{"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \ {"s" , CONFIG_HLP_SNR, 0, dblptr:&snr_dB, defdblval:25, TYPE_DOUBLE, 0}, \
{"P" , CONFIG_HLP_PROPD, 0, u64ptr:&RFsim_PropDelay, defintval:0, TYPE_UINT64, 0}, \
} }
#include "threads_t.h" #include "threads_t.h"
......
...@@ -387,6 +387,7 @@ void *rrc_enb_process_msg(void *notUsed) { ...@@ -387,6 +387,7 @@ void *rrc_enb_process_msg(void *notUsed) {
return NULL; return NULL;
} }
uint64_t RFsim_PropDelay = 0;
int main( int argc, char **argv ) { int main( int argc, char **argv ) {
int set_exe_prio = 1; int set_exe_prio = 1;
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
{"chest-freq", CONFIG_HLP_CHESTFREQ, 0, iptr:&(UE->chest_freq), defintval:0, TYPE_INT, 0}, \ {"chest-freq", CONFIG_HLP_CHESTFREQ, 0, iptr:&(UE->chest_freq), defintval:0, TYPE_INT, 0}, \
{"chest-time", CONFIG_HLP_CHESTTIME, 0, iptr:&(UE->chest_time), defintval:0, TYPE_INT, 0}, \ {"chest-time", CONFIG_HLP_CHESTTIME, 0, iptr:&(UE->chest_time), defintval:0, TYPE_INT, 0}, \
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&(UE->no_timing_correction), defintval:0, TYPE_INT, 0}, \ {"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&(UE->no_timing_correction), defintval:0, TYPE_INT, 0}, \
{"P" , CONFIG_HLP_PROPD, 0, u64ptr:&RFsim_PropDelay, defintval:0, TYPE_UINT64,0}, \
} }
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
#include <sdr/rfsimulator/rfsimulator.h> #include <sdr/rfsimulator/rfsimulator.h>
#define PORT 4043 //default TCP port for this simulator #define PORT 4043 //default TCP port for this simulator
#define CirSize 6144000 // 100ms is enough #define CirSize 61440000 //curently the circular buffer can hold 100 frames
#define sampleToByte(a,b) ((a)*(b)*sizeof(sample_t)) #define sampleToByte(a,b) ((a)*(b)*sizeof(sample_t))
#define byteToSample(a,b) ((a)/(sizeof(sample_t)*(b))) #define byteToSample(a,b) ((a)/(sizeof(sample_t)*(b)))
...@@ -425,6 +425,7 @@ sin_addr: ...@@ -425,6 +425,7 @@ sin_addr:
return 0; return 0;
} }
extern uint64_t RFsim_PropDelay;
static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp timestamp, void **samplesVoid, int nsamps, int nbAnt, int flags, bool alreadyLocked) { static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp timestamp, void **samplesVoid, int nsamps, int nbAnt, int flags, bool alreadyLocked) {
if (!alreadyLocked) if (!alreadyLocked)
pthread_mutex_lock(&Sockmutex); pthread_mutex_lock(&Sockmutex);
...@@ -700,7 +701,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest ...@@ -700,7 +701,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
a, a,
ptr->channel_model, ptr->channel_model,
nsamps, nsamps,
t->nextRxTstamp, t->nextRxTstamp-RFsim_PropDelay,
CirSize); CirSize);
} }
else { // no channel modeling else { // no channel modeling
...@@ -716,8 +717,8 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest ...@@ -716,8 +717,8 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
//LOG_I(HW, "nbAnt_tx %d\n",nbAnt_tx); //LOG_I(HW, "nbAnt_tx %d\n",nbAnt_tx);
for (int i=0; i < nsamps; i++) {//loop over nsamps for (int i=0; i < nsamps; i++) {//loop over nsamps
for (int a_tx=0; a_tx<nbAnt_tx; a_tx++) { //sum up signals from nbAnt_tx antennas for (int a_tx=0; a_tx<nbAnt_tx; a_tx++) { //sum up signals from nbAnt_tx antennas
out[i].r += (short)(ptr->circularBuf[((t->nextRxTstamp+i)*nbAnt_tx+a_tx)%CirSize].r*H_awgn_mimo[a][a_tx]); out[i].r += (short)(ptr->circularBuf[((t->nextRxTstamp-RFsim_PropDelay+i)*nbAnt_tx+a_tx)%CirSize].r*H_awgn_mimo[a][a_tx]);
out[i].i += (short)(ptr->circularBuf[((t->nextRxTstamp+i)*nbAnt_tx+a_tx)%CirSize].i*H_awgn_mimo[a][a_tx]); out[i].i += (short)(ptr->circularBuf[((t->nextRxTstamp-RFsim_PropDelay+i)*nbAnt_tx+a_tx)%CirSize].i*H_awgn_mimo[a][a_tx]);
} // end for a_tx } // end for a_tx
} // end for i (number of samps) } // end for i (number of samps)
} // end of no channel modeling } // end of no channel modeling
......
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