Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
395249b7
Commit
395249b7
authored
Feb 27, 2023
by
Marwan Hammouda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Develop-Testing]: chnages for testing Frequency offset compensation on Emulator
parent
21140c0a
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
98 additions
and
17 deletions
+98
-17
executables/nr-softmodem-common.h
executables/nr-softmodem-common.h
+8
-0
executables/nr-softmodem.c
executables/nr-softmodem.c
+1
-0
executables/nr-uesoftmodem.c
executables/nr-uesoftmodem.c
+5
-0
executables/nr-uesoftmodem.h
executables/nr-uesoftmodem.h
+3
-1
openair1/PHY/MODULATION/slot_fep_nr.c
openair1/PHY/MODULATION/slot_fep_nr.c
+2
-1
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
+7
-0
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
+7
-6
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
+2
-1
radio/rfsimulator/simulator.c
radio/rfsimulator/simulator.c
+63
-8
No files found.
executables/nr-softmodem-common.h
View file @
395249b7
...
...
@@ -129,6 +129,9 @@
#define CONFIG_HLP_FD_ScalingFN "Set the D scaling factor (numerator) of the PID controller for the Doppler compensation at UE side"
#define CONFIG_HLP_FD_ScalingFD "Set the D scaling factor (denominator) of the PID controller for the Doppler compensation at UE side"
#define CONFIG_HLP_FP_Scaling "set scaling P"
#define CONFIG_HLP_FI_Scaling "set scaling I"
/*--------------------------------------------------------------------------------------------------------------------------------*/
/* command line parameters for LOG utility */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
...
...
@@ -192,4 +195,9 @@ extern uint16_t I_ScalingFD; //I scaling factor (denominator) of the PID control
extern
uint16_t
D_ScalingFN
;
//D scaling factor (numerator) of the PID controller for the Doppler compensation at UE side
extern
uint16_t
D_ScalingFD
;
//D scaling factor (denominator) of the PID controller for the Doppler compensation at UE side
extern
double
PScaling
;
extern
double
IScaling
;
extern
int
commonDoppler
;
#endif
executables/nr-softmodem.c
View file @
395249b7
...
...
@@ -578,6 +578,7 @@ int32_t fdopplerRate;
uint32_t
fdopplerVar
;
int
tdriftComp
=
1
;
int32_t
fdopplerPrePost
=
0
;
//pre/post compensation of the Doppler shift at the gNB side
int
commonDoppler
=
0
;
// common doppler to be compensated at UE, but set here to avoid linking error
int
main
(
int
argc
,
char
**
argv
)
{
int
ru_id
,
CC_id
=
0
;
...
...
executables/nr-uesoftmodem.c
View file @
395249b7
...
...
@@ -441,6 +441,11 @@ uint16_t I_ScalingFD = 2; //I scaling factor (denominator) of the PID controller
uint16_t
D_ScalingFN
=
0
;
//D scaling factor (numerator) of the PID controller for the Doppler compensation at UE side
uint16_t
D_ScalingFD
=
1
;
//D scaling factor (denominator) of the PID controller for the Doppler compensation at UE side
double
PScaling
=
0
.
33
;
double
IScaling
=
0
.
5
;
int
commonDoppler
=
421528
;
int
main
(
int
argc
,
char
**
argv
)
{
int
set_exe_prio
=
1
;
...
...
executables/nr-uesoftmodem.h
View file @
395249b7
...
...
@@ -77,7 +77,9 @@
{"DCIN" , CONFIG_HLP_FI_ScalingFN,0, .u16ptr=&I_ScalingFN, .defintval=1, TYPE_UINT16, 0}, \
{"DCID" , CONFIG_HLP_FI_ScalingFD,0, .u16ptr=&I_ScalingFD, .defintval=2, TYPE_UINT16, 0}, \
{"DCDN" , CONFIG_HLP_FD_ScalingFN,0, .u16ptr=&D_ScalingFN, .defintval=0, TYPE_UINT16, 0}, \
{"DCDD" , CONFIG_HLP_FD_ScalingFD,0, .u16ptr=&D_ScalingFD, .defintval=1, TYPE_UINT16, 0} \
{"DCDD" , CONFIG_HLP_FD_ScalingFD,0, .u16ptr=&D_ScalingFD, .defintval=1, TYPE_UINT16, 0}, \
{"DCP" , CONFIG_HLP_FP_Scaling,0, .dblptr=&PScaling, .defdblval=0.33, TYPE_DOUBLE, 0}, \
{"DCI" , CONFIG_HLP_FI_Scaling,0, .dblptr=&IScaling, .defdblval=0.5, TYPE_DOUBLE, 0}, \
}
// clang-format on
...
...
openair1/PHY/MODULATION/slot_fep_nr.c
View file @
395249b7
...
...
@@ -36,6 +36,7 @@
#endif*/
extern
int
fdopplerComp
;
extern
int
commonDoppler
;
int
nr_slot_fep
(
PHY_VARS_NR_UE
*
ue
,
UE_nr_rxtx_proc_t
*
proc
,
...
...
@@ -93,7 +94,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
{
unsigned
int
nsamps
=
frame_parms
->
ofdm_symbol_size
+
curr_nb_prefix
;
int16_t
*
rxdataDopp_ptr
=
(
int16_t
*
)
&
common_vars
->
rxdata
[
aa
][
SampIdxDopplerUERx
];
int
DopplerToComp
=
-
(
ue
->
DopplerEst
);
int
DopplerToComp
=
-
(
ue
->
DopplerEst
+
commonDoppler
);
nr_apply_Doppler
(
rxdataDopp_ptr
,
nsamps
,
DopplerToComp
,
&
SampIdxDopplerUERx
,
frame_parms
);
}
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
View file @
395249b7
...
...
@@ -45,6 +45,8 @@
#include "PHY/NR_REFSIG/sss_nr.h"
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
#include "PHY/MODULATION/nr_modulation.h"
extern
openair0_config_t
openair0_cfg
[];
//static nfapi_nr_config_request_t config_t;
//static nfapi_nr_config_request_t* config =&config_t;
...
...
@@ -196,6 +198,7 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
}
extern
int
commonDoppler
;
int
nr_initial_sync
(
UE_nr_rxtx_proc_t
*
proc
,
PHY_VARS_NR_UE
*
ue
,
int
n_frames
,
int
sa
)
...
...
@@ -209,6 +212,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
NR_DL_FRAME_PARMS
*
fp
=
&
ue
->
frame_parms
;
int
ret
=-
1
;
int
rx_power
=
0
;
//aarx,
uint32_t
SampIdxUERxInitSync
=
0
;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INITIAL_UE_SYNC
,
VCD_FUNCTION_IN
);
...
...
@@ -237,6 +242,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
// initial sync performed on two successive frames, if pbch passes on first frame, no need to process second frame
// only one frame is used for symulation tools
for
(
frame_id
=
0
;
frame_id
<
n_frames
;
frame_id
++
)
{
nr_apply_Doppler
(
&
ue
->
common_vars
.
rxdata
[
0
][
frame_id
*
fp
->
samples_per_frame
],
fp
->
samples_per_frame
,
-
commonDoppler
,
&
SampIdxUERxInitSync
,
fp
);
/* process pss search on received buffer */
sync_pos
=
pss_synchro_nr
(
ue
,
frame_id
,
NO_RATE_CHANGE
);
if
(
sync_pos
<
fp
->
nb_prefix_samples
)
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
View file @
395249b7
...
...
@@ -528,18 +528,19 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
if
(
DopplerErrLast
==
(
int64_t
)
1
<<
60
)
//Initialization of DopplerErrLast
DopplerErrLast
=
DopplerErr
;
Doppler_I_Ctrl
+=
DopplerErr
;
ue
->
DopplerEst
=
(
int32_t
)(
DopplerErr
*
P_ScalingFN
/
P_ScalingFD
+
Doppler_I_Ctrl
*
I_ScalingFN
/
I_ScalingFD
+
(
DopplerErr
-
DopplerErrLast
)
*
D_ScalingFN
/
D_ScalingFD
);
//PID controller
// ue->DopplerEst = (int32_t)(DopplerErr*P_ScalingFN/P_ScalingFD + Doppler_I_Ctrl*I_ScalingFN/I_ScalingFD +
// (DopplerErr-DopplerErrLast)*D_ScalingFN/D_ScalingFD); //PID controller
ue
->
DopplerEst
=
(
int32_t
)(
DopplerErr
*
PScaling
+
Doppler_I_Ctrl
*
IScaling
);
//PID controller
DopplerErrLast
=
DopplerErr
;
#ifdef DEBUG_PBCH
//
#ifdef DEBUG_PBCH
double
rx_gain
=
openair0_cfg
[
0
].
rx_gain
[
0
];
double
rx_gain_offset
=
openair0_cfg
[
0
].
rx_gain_offset
[
0
];
double
DopplerEstMax
=
M_PI
/
(
2
*
M_PI
*
(
DMRS_idx_current
-
DMRS_idx_last
)
*
TOfdm
);
LOG_I
(
PHY
,
"**** DopplerEst: %f, ue->DopplerEst: %d, chLevel: %i, chLevelLog: %u, outShift: %u, re: %i, im: %i, phase: %f, rxG: %f, rxGOff: %f
\n
"
,
DopplerEst
,
ue
->
DopplerEst
,
channelLevel
,
channelLevelLog
,
outputShift
,
Res_cpx
.
r
,
Res_cpx
.
i
,
Res_phase
,
rx_gain
,
rx_gain_offset
);
LOG_I
(
PHY
,
"DopplerEstMax: %f
\n
"
,
DopplerEstMax
);
#endif
DopplerEst
,
ue
->
DopplerEst
,
channelLevel
,
channelLevelLog
,
outputShift
,
Dot_Prod_Res
.
r
,
Dot_Prod_Res
.
i
,
Res_phase
,
rx_gain
,
rx_gain_offset
);
LOG_I
(
PHY
,
"DopplerEstMax: %f
, PScaling: %f, IScaling: %f
\n
"
,
DopplerEstMax
,
PScaling
,
IScaling
);
//
#endif
}
#ifdef DEBUG_PBCH
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c
View file @
395249b7
...
...
@@ -628,12 +628,13 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
SampIdxDopplerUETx
=
frame_parms
->
get_samples_slot_timestamp
(
slot
,
frame_parms
,
0
);
int
writeBlockSize
=
frame_parms
->
get_samples_per_slot
(
slot
,
frame_parms
);
extern
int
fdopplerComp
;
extern
int
commonDoppler
;
if
(
fdopplerComp
==
1
){
// First scale the offset computed on DL before being applied to UL
uint64_t
dl_carrier
,
ul_carrier
;
nr_get_carrier_frequencies
(
UE
,
&
dl_carrier
,
&
ul_carrier
);
double
freq_scale
=
(
double
)
ul_carrier
/
dl_carrier
;
int
DopplerToComp
=
-
(
UE
->
DopplerEst
*
freq_scale
);
int
DopplerToComp
=
-
(
(
UE
->
DopplerEst
+
commonDoppler
)
*
freq_scale
);
nr_apply_Doppler
(
&
txdata
[
0
][
tx_offset
],
writeBlockSize
,
DopplerToComp
,
&
SampIdxDopplerUETx
,
frame_parms
);
}
...
...
radio/rfsimulator/simulator.c
View file @
395249b7
...
...
@@ -845,16 +845,21 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
LOG_W
(
HW
,
"rfsimulator: only 4 antenna tested
\n
"
);
}
static
double
timeForDoppler
=
0
;
int
currDoppler
=
0
;
static
uint64_t
counter
=
0
;
static
int
initDoppler
=
0
;
static
uint64_t
SampIdxDoppler
=
0
;
//sample index in the calculation of the Doppler shift
//Paramters for Doppler shift. Assume the Doppler frequency changes every frame
uint32_t
NrSampFrame
=
fsamp
/
100
;
//Number of samples per frame (10ms)
static
int32_t
fdopplerStep
=
1
<<
20
;
static
uint32_t
CntDoppRate
=
1
;
//counter for the Doppler rate
static
int32_t
fdopplerCurr
=
1
<<
20
;
//current Doppler
if
(
fdopplerStep
==
1
<<
20
)
fdopplerStep
=
fdopplerRate
/
100
;
if
(
fdopplerCurr
==
1
<<
20
)
fdopplerCurr
=
fdoppler
;
//
uint32_t NrSampFrame = fsamp/100; //Number of samples per frame (10ms)
//
static int32_t fdopplerStep = 1<<20;
//
static uint32_t CntDoppRate = 1; //counter for the Doppler rate
//
static int32_t fdopplerCurr = 1<<20; //current Doppler
//
if ( fdopplerStep == 1<<20 )
//
fdopplerStep = fdopplerRate/100;
//
if ( fdopplerCurr == 1<<20 )
//
fdopplerCurr = fdoppler;
rfsimulator_state_t
*
t
=
device
->
priv
;
LOG_D
(
HW
,
"Enter rfsimulator_read, expect %d samples, will release at TS: %ld, nbAnt %d
\n
"
,
nsamps
,
t
->
nextRxTstamp
+
nsamps
,
nbAnt
);
...
...
@@ -947,6 +952,25 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
a
];
int
nbAnt_tx
=
ptr
->
th
.
nbAnt
;
//number of Tx antennas
if
((
t
->
typeStamp
!=
ENB_MAGICDL
)
&&
(
TO_UE_flag
==
1
))
{
timeForDoppler
=
1050
+
(
double
)
SampIdxDoppler
/
fsamp
;
const
float
R
=
6371000
;
const
float
h
=
600000
;
double
ue_posX
=
0
;
double
ue_posY
=
0
;
double
ue_posZ
=
R
;
static
float
wsat
=
0
.
0011
;
double
sat_posX
=
0
;
double
sat_posY
=
(
R
+
h
)
*
cos
(
wsat
*
timeForDoppler
);
double
sat_posZ
=
(
R
+
h
)
*
sin
(
wsat
*
timeForDoppler
);
float
norm_d
=
sqrt
(((
ue_posX
-
sat_posX
)
*
(
ue_posX
-
sat_posX
))
+
((
ue_posY
-
sat_posY
)
*
(
ue_posY
-
sat_posY
))
+
((
ue_posZ
-
sat_posZ
)
*
(
ue_posZ
-
sat_posZ
)));
float
cos_theta
=
(
sat_posY
-
ue_posY
)
/
norm_d
;
double
fc
=
20e9
;
double
c
=
299792458
;
int
currDopplerTmp
=
(
int
)((
wsat
*
R
/
c
)
*
fc
*
(
R
/
(
R
+
h
))
*
cos_theta
);
if
(
SampIdxDoppler
==
0
)
initDoppler
=
currDopplerTmp
;
currDoppler
=
currDopplerTmp
-
initDoppler
;
}
//LOG_I(HW, "nbAnt_tx %d\n",nbAnt_tx);
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
...
...
@@ -955,6 +979,18 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
}
// end for a_tx
if
((
t
->
typeStamp
!=
ENB_MAGICDL
)
&&
(
TO_UE_flag
==
1
))
{
int16_t
outRealTmp
=
out
[
i
].
r
;
int16_t
outImagTmp
=
out
[
i
].
i
;
out
[
i
].
r
=
(
short
)(
outRealTmp
*
cos
(
2
*
M_PI
*
(
double
)
SampIdxDoppler
*
currDoppler
/
fsamp
)
-
outImagTmp
*
sin
(
2
*
M_PI
*
(
double
)
SampIdxDoppler
*
currDoppler
/
fsamp
));
out
[
i
].
i
=
(
short
)(
outImagTmp
*
cos
(
2
*
M_PI
*
(
double
)
SampIdxDoppler
*
currDoppler
/
fsamp
)
+
outRealTmp
*
sin
(
2
*
M_PI
*
(
double
)
SampIdxDoppler
*
currDoppler
/
fsamp
));
SampIdxDoppler
++
;
}
/*
int16_t outRealTmp = out[i].r;
int16_t outImagTmp = out[i].i;
...
...
@@ -971,6 +1007,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
fdopplerCurr += 2*fdopplerStep;
}
}
*/
}
// end for i (number of samps)
}
// end of no channel modeling
...
...
@@ -978,6 +1015,24 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
}
}
if
((
t
->
typeStamp
!=
ENB_MAGICDL
)
&&
(
TO_UE_flag
==
1
))
{
char
filename
[
40
];
sprintf
(
filename
,
"DataSim.m"
);
FILE
*
fptr
;
fptr
=
fopen
(
filename
,
"a"
);
if
(
counter
%
1600
==
0
)
{
fprintf
(
fptr
,
"%d
\n
"
,
currDoppler
);
}
fclose
(
fptr
);
counter
++
;
}
*
ptimestamp
=
t
->
nextRxTstamp
;
// return the time of the first sample
t
->
nextRxTstamp
+=
nsamps
;
LOG_D
(
HW
,
"Rx to upper layer: %d from %ld to %ld, energy in first antenna %d
\n
"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment