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
11693330
Commit
11693330
authored
Jan 30, 2023
by
Marwan Hammouda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[develop] Added: timing offset estimation based on PBCH
- command-line option to activate/deactivate compensation added
parent
95f1a66c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
38 additions
and
34 deletions
+38
-34
executables/nr-softmodem-common.h
executables/nr-softmodem-common.h
+2
-0
executables/nr-softmodem.c
executables/nr-softmodem.c
+1
-0
executables/nr-uesoftmodem.c
executables/nr-uesoftmodem.c
+1
-0
executables/nr-uesoftmodem.h
executables/nr-uesoftmodem.h
+2
-1
openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
+28
-6
openair1/PHY/defs_nr_UE.h
openair1/PHY/defs_nr_UE.h
+3
-0
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+1
-1
radio/rfsimulator/simulator.c
radio/rfsimulator/simulator.c
+0
-26
No files found.
executables/nr-softmodem-common.h
View file @
11693330
...
@@ -120,6 +120,7 @@
...
@@ -120,6 +120,7 @@
#define CONFIG_HLP_TDRIFT "Set the timing offset/drift per frame in the RF simulator (expressed in number of samples per frame)\n"
#define CONFIG_HLP_TDRIFT "Set the timing offset/drift per frame in the RF simulator (expressed in number of samples per frame)\n"
#define CONFIG_HLP_FDopplerRate "Set the Doppler rate in Hz/s\n"
#define CONFIG_HLP_FDopplerRate "Set the Doppler rate in Hz/s\n"
#define CONFIG_HLP_FDopplerVar "Set Doppler variance, [fdoppler +/- fdopplerVar]\n"
#define CONFIG_HLP_FDopplerVar "Set Doppler variance, [fdoppler +/- fdopplerVar]\n"
#define CONFIG_HLP_TDriftComp "Execute continous timing drift compensation\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 */
...
@@ -174,5 +175,6 @@ extern int fdopplerComp; // flag to activate/deactivate continous freque
...
@@ -174,5 +175,6 @@ extern int fdopplerComp; // flag to activate/deactivate continous freque
extern
int
RFsim_DriftPerFrame
;
//the timing offset/drift per frame in the RF simulator (expressed in number of samples per frame)
extern
int
RFsim_DriftPerFrame
;
//the timing offset/drift per frame in the RF simulator (expressed in number of samples per frame)
extern
int32_t
fdopplerRate
;
//Doppler rate in Hz/s
extern
int32_t
fdopplerRate
;
//Doppler rate in Hz/s
extern
uint32_t
fdopplerVar
;
//Doppler variance, [fdoppler +/- fdopplerVar]
extern
uint32_t
fdopplerVar
;
//Doppler variance, [fdoppler +/- fdopplerVar]
extern
int
tdriftComp
;
// flag to activate/deactivate continous timing drift compensation
#endif
#endif
executables/nr-softmodem.c
View file @
11693330
...
@@ -576,6 +576,7 @@ int fdopplerComp = 1;
...
@@ -576,6 +576,7 @@ int fdopplerComp = 1;
int
RFsim_DriftPerFrame
=
0
;
int
RFsim_DriftPerFrame
=
0
;
int32_t
fdopplerRate
;
int32_t
fdopplerRate
;
uint32_t
fdopplerVar
;
uint32_t
fdopplerVar
;
int
tdriftComp
=
1
;
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
int
ru_id
,
CC_id
=
0
;
int
ru_id
,
CC_id
=
0
;
...
...
executables/nr-uesoftmodem.c
View file @
11693330
...
@@ -432,6 +432,7 @@ int32_t fdoppler = 0; //center Doppler frequency shift
...
@@ -432,6 +432,7 @@ int32_t fdoppler = 0; //center Doppler frequency shift
int32_t
fdopplerRate
;
//Doppler rate in Hz/s
int32_t
fdopplerRate
;
//Doppler rate in Hz/s
uint32_t
fdopplerVar
;
//Doppler variance, [fdoppler +/- fdopplerVar]
uint32_t
fdopplerVar
;
//Doppler variance, [fdoppler +/- fdopplerVar]
int
fdopplerComp
=
1
;
// flag to activate continous frequency offset compensation (=0 deacticated, =1 activated (default case))
int
fdopplerComp
=
1
;
// flag to activate continous frequency offset compensation (=0 deacticated, =1 activated (default case))
int
tdriftComp
=
1
;
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
...
...
executables/nr-uesoftmodem.h
View file @
11693330
...
@@ -68,9 +68,10 @@
...
@@ -68,9 +68,10 @@
{"ue_k2" , CONFIG_HLP_UEK2, 0, .u16ptr=&NTN_UE_k2, .defintval=0, TYPE_UINT16, 0}, \
{"ue_k2" , CONFIG_HLP_UEK2, 0, .u16ptr=&NTN_UE_k2, .defintval=0, TYPE_UINT16, 0}, \
{"FD" , CONFIG_HLP_FDoppler, 0, .iptr=&fdoppler, .defintval=0, TYPE_INT, 0}, \
{"FD" , CONFIG_HLP_FDoppler, 0, .iptr=&fdoppler, .defintval=0, TYPE_INT, 0}, \
{"FC" , CONFIG_HLP_FDopplerComp, 0, .iptr=&fdopplerComp, .defintval=1, TYPE_INT, 0}, \
{"FC" , CONFIG_HLP_FDopplerComp, 0, .iptr=&fdopplerComp, .defintval=1, TYPE_INT, 0}, \
{"TD" ,
CONFIG_HLP_TDRIFT, 0, .iptr=&RFsim_DriftPerFrame, .defintval=0, TYPE_INT, 0}, \
{"TD" , CONFIG_HLP_TDRIFT, 0, .iptr=&RFsim_DriftPerFrame, .defintval=0, TYPE_INT, 0}, \
{"DSR" , CONFIG_HLP_FDopplerRate,0, .iptr=&fdopplerRate, .defintval=0, TYPE_INT32, 0}, \
{"DSR" , CONFIG_HLP_FDopplerRate,0, .iptr=&fdopplerRate, .defintval=0, TYPE_INT32, 0}, \
{"DSV" , CONFIG_HLP_FDopplerVar, 0, .uptr=&fdopplerVar, .defintval=0, TYPE_UINT32, 0}, \
{"DSV" , CONFIG_HLP_FDopplerVar, 0, .uptr=&fdopplerVar, .defintval=0, TYPE_UINT32, 0}, \
{"TC" , CONFIG_HLP_TDriftComp, 0, .iptr=&tdriftComp, .defintval=1, TYPE_INT, 0}, \
}
}
// clang-format on
// clang-format on
...
...
openair1/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
View file @
11693330
...
@@ -50,6 +50,11 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
...
@@ -50,6 +50,11 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
const
int
sync_pos
=
0
;
const
int
sync_pos
=
0
;
uint8_t
sync_offset
=
0
;
uint8_t
sync_offset
=
0
;
static
int64_t
TO_I_Ctrl
=
0
;
//Integral controller for TO
int
I_ScalingF
=
10
;
//Scaling factor for the I controller, can be adjusted
static
int
frameLast
=
0
;
//frame number of last call of nr_adjust_synch_ue()
static
int
FirstFlag
=
1
;
//indicate the first call of nr_adjust_synch_ue()
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH
,
VCD_FUNCTION_IN
);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ADJUST_SYNCH
,
VCD_FUNCTION_IN
);
short
ncoef
=
32767
-
coef
;
short
ncoef
=
32767
-
coef
;
...
@@ -83,16 +88,33 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
...
@@ -83,16 +88,33 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
//ue->max_pos_fil = max_pos << 15;
//ue->max_pos_fil = max_pos << 15;
int
diff
=
(
ue
->
max_pos_fil
>>
15
)
-
sync_pos
;
int
diff
=
(
ue
->
max_pos_fil
>>
15
)
-
sync_pos
;
int
FrameDiff
=
(
frame
-
frameLast
+
1024
)
%
1024
;
if
(
frame_parms
->
freq_range
==
nr_FR2
)
if
(
FirstFlag
)
sync_offset
=
2
;
FirstFlag
=
0
;
else
else
sync_offset
=
0
;
diff
/=
FrameDiff
;
//scaled by the frame number
frameLast
=
frame
;
//save the last frame number
TO_I_Ctrl
+=
diff
;
//integral of all offsets
ue
->
rx_offset
=
diff
;
ue
->
rx_offset_TO
=
diff
+
TO_I_Ctrl
/
I_ScalingF
;
//PI controller
ue
->
rx_offset_slot
=
1
;
ue
->
rx_offset_comp
=
0
;
printf
(
"** Frame: %u, ue->rx_offset: %d, ue->rx_offset_TO: %d
\n
"
,
frame
,
ue
->
rx_offset
,
ue
->
rx_offset_TO
);
if
(
abs
(
diff
)
<
(
SYNCH_HYST
+
sync_offset
)
)
extern
tdriftComp
;
{
TO_I_Ctrl
+=
diff
;
//integral of all offsets
ue
->
rx_offset
=
0
;
ue
->
rx_offset
=
0
;
else
ue
->
rx_offset_TO
=
0
;
//PI controller
ue
->
rx_offset
=
diff
;
ue
->
rx_offset_slot
=
1
;
ue
->
rx_offset_comp
=
0
;
}
if
(
tdriftComp
==
0
)
const
int
sample_shift
=
-
(
ue
->
rx_offset
>>
1
);
const
int
sample_shift
=
-
(
ue
->
rx_offset
>>
1
);
// reset IIR filter for next offset calculation
// reset IIR filter for next offset calculation
...
...
openair1/PHY/defs_nr_UE.h
View file @
11693330
...
@@ -525,6 +525,9 @@ typedef struct {
...
@@ -525,6 +525,9 @@ typedef struct {
int64_t
max_pos_fil
;
/// Timing offset IIR filter
int64_t
max_pos_fil
;
/// Timing offset IIR filter
bool
apply_timing_offset
;
/// Do time sync for current frame
bool
apply_timing_offset
;
/// Do time sync for current frame
int
time_sync_cell
;
int
time_sync_cell
;
int
rx_offset_TO
;
/// Timing offset used for compensating the time drift due to high speed
int
rx_offset_slot
;
/// Indicating time (in slots) after rx_offset calculation
int
rx_offset_comp
;
/// Already compensated rx_offset
/// Timing Advance updates variables
/// Timing Advance updates variables
/// Timing advance update computed from the TA command signalled from gNB
/// Timing advance update computed from the TA command signalled from gNB
...
...
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
View file @
11693330
...
@@ -916,7 +916,7 @@ void pbch_pdcch_processing(PHY_VARS_NR_UE *ue,
...
@@ -916,7 +916,7 @@ void pbch_pdcch_processing(PHY_VARS_NR_UE *ue,
dl_ch_estimates_time
,
dl_ch_estimates_time
,
frame_rx
,
frame_rx
,
nr_slot_rx
,
nr_slot_rx
,
0
,
1
,
16384
);
16384
);
}
}
ue
->
apply_timing_offset
=
true
;
ue
->
apply_timing_offset
=
true
;
...
...
radio/rfsimulator/simulator.c
View file @
11693330
...
@@ -947,11 +947,6 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
...
@@ -947,11 +947,6 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
a
];
sample_t
*
out
=
(
sample_t
*
)
samplesVoid
[
a
];
int
nbAnt_tx
=
ptr
->
th
.
nbAnt
;
//number of Tx antennas
int
nbAnt_tx
=
ptr
->
th
.
nbAnt
;
//number of Tx antennas
char
filename
[
40
];
sprintf
(
filename
,
"gNB_data.m"
);
char
filename1
[
40
];
sprintf
(
filename1
,
"gNB_Time.m"
);
//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
...
@@ -966,27 +961,6 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
...
@@ -966,27 +961,6 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
out
[
i
].
r
=
(
short
)(
outRealTmp
*
cos
(
2
*
M_PI
*
(
double
)
SampIdxDoppler
*
fdopplerCurr
/
fsamp
)
-
outImagTmp
*
sin
(
2
*
M_PI
*
(
double
)
SampIdxDoppler
*
fdopplerCurr
/
fsamp
));
out
[
i
].
r
=
(
short
)(
outRealTmp
*
cos
(
2
*
M_PI
*
(
double
)
SampIdxDoppler
*
fdopplerCurr
/
fsamp
)
-
outImagTmp
*
sin
(
2
*
M_PI
*
(
double
)
SampIdxDoppler
*
fdopplerCurr
/
fsamp
));
out
[
i
].
i
=
(
short
)(
outImagTmp
*
cos
(
2
*
M_PI
*
(
double
)
SampIdxDoppler
*
fdopplerCurr
/
fsamp
)
+
outRealTmp
*
sin
(
2
*
M_PI
*
(
double
)
SampIdxDoppler
*
fdopplerCurr
/
fsamp
));
out
[
i
].
i
=
(
short
)(
outImagTmp
*
cos
(
2
*
M_PI
*
(
double
)
SampIdxDoppler
*
fdopplerCurr
/
fsamp
)
+
outRealTmp
*
sin
(
2
*
M_PI
*
(
double
)
SampIdxDoppler
*
fdopplerCurr
/
fsamp
));
if
(
t
->
typeStamp
==
ENB_MAGICDL
)
{
FILE
*
fptr
;
FILE
*
fptr1
;
double
tTmp
=
SampIdxDoppler
/
fsamp
;
if
((
i
%
1000
==
0
)
&&
(
tTmp
<=
10
))
{
printf
(
"*************** gNB Recording!, i: %d, fdopplerCurr: %d, tTmp: %f
\n
"
,
i
,
fdopplerCurr
,
tTmp
);
fptr
=
fopen
(
filename
,
"a"
);
fptr1
=
fopen
(
filename1
,
"a"
);
fprintf
(
fptr
,
"%i
\n
"
,
fdopplerCurr
);
fprintf
(
fptr1
,
"%f
\n
"
,
tTmp
);
fclose
(
fptr
);
fclose
(
fptr1
);
}
}
SampIdxDoppler
++
;
SampIdxDoppler
++
;
CntDoppRate
++
;
CntDoppRate
++
;
if
(
CntDoppRate
>
NrSampFrame
)
{
if
(
CntDoppRate
>
NrSampFrame
)
{
...
...
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