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
0f6043d8
Commit
0f6043d8
authored
Aug 03, 2023
by
Melissa
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mel-testing-fo' into 'episys/master-sl'
Mel testing fo See merge request aburger/openairinterface5g!237
parents
9982bc60
ad4e3e87
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
76 additions
and
103 deletions
+76
-103
executables/nr-ue.c
executables/nr-ue.c
+14
-20
openair1/PHY/MODULATION/slot_fep_nr.c
openair1/PHY/MODULATION/slot_fep_nr.c
+7
-40
openair1/PHY/NR_REFSIG/ss_pbch_nr.h
openair1/PHY/NR_REFSIG/ss_pbch_nr.h
+1
-1
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
+18
-18
openair1/PHY/NR_UE_TRANSPORT/nr_psbch.c
openair1/PHY/NR_UE_TRANSPORT/nr_psbch.c
+1
-1
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+4
-6
openair1/SIMULATION/NR_PHY/psbchsim.c
openair1/SIMULATION/NR_PHY/psbchsim.c
+16
-17
sdr/rfsimulator/simulator.c
sdr/rfsimulator/simulator.c
+15
-0
No files found.
executables/nr-ue.c
View file @
0f6043d8
...
...
@@ -833,20 +833,19 @@ int computeSamplesShift(PHY_VARS_NR_UE *UE) {
return
samples_shift
;
}
static
inline
int
get_firstSymSamp
(
uint16_t
slot
,
NR_DL_FRAME_PARMS
*
fp
,
bool
sync
)
{
uint16_t
nb_prefix_samples0
=
sync
?
fp
->
nb_prefix_samples0
:
fp
->
nb_prefix_samples
;
static
inline
int
get_firstSymSamp
(
uint16_t
slot
,
NR_DL_FRAME_PARMS
*
fp
)
{
if
(
fp
->
numerology_index
==
0
)
return
fp
->
nb_prefix_samples0
+
fp
->
ofdm_symbol_size
;
int
num_samples
=
(
slot
%
(
fp
->
slots_per_subframe
/
2
))
?
fp
->
nb_prefix_samples
:
nb_prefix_samples0
;
int
num_samples
=
(
slot
%
(
fp
->
slots_per_subframe
/
2
))
?
fp
->
nb_prefix_samples
:
fp
->
nb_prefix_samples0
;
num_samples
+=
fp
->
ofdm_symbol_size
;
return
num_samples
;
}
static
inline
int
get_readBlockSize
(
uint16_t
slot
,
NR_DL_FRAME_PARMS
*
fp
,
bool
sync
)
{
int
rem_samples
=
fp
->
get_samples_per_slot
(
slot
,
fp
)
-
get_firstSymSamp
(
slot
,
fp
,
sync
);
static
inline
int
get_readBlockSize
(
uint16_t
slot
,
NR_DL_FRAME_PARMS
*
fp
)
{
int
rem_samples
=
fp
->
get_samples_per_slot
(
slot
,
fp
)
-
get_firstSymSamp
(
slot
,
fp
);
int
next_slot_first_symbol
=
0
;
if
(
slot
<
(
fp
->
slots_per_frame
-
1
))
next_slot_first_symbol
=
get_firstSymSamp
(
slot
+
1
,
fp
,
sync
);
next_slot_first_symbol
=
get_firstSymSamp
(
slot
+
1
,
fp
);
return
rem_samples
+
next_slot_first_symbol
;
}
...
...
@@ -973,13 +972,11 @@ void *UE_thread_SL(void *arg) {
syncInFrame
(
UE
,
&
timestamp
);
UE
->
rx_offset_sl
=
0
;
UE
->
time_sync_cell
=
0
;
uint16_t
nb_prefix_samples0
=
UE
->
is_synchronized_sl
?
UE
->
frame_parms
.
nb_prefix_samples0
:
UE
->
frame_parms
.
nb_prefix_samples
;
AssertFatal
(
UE
->
frame_parms
.
ofdm_symbol_size
+
nb_prefix_samples0
==
AssertFatal
(
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
==
UE
->
rfdevice
.
trx_read_func
(
&
UE
->
rfdevice
,
&
timestamp
,
(
void
**
)
UE
->
common_vars
.
rxdata
,
UE
->
frame_parms
.
ofdm_symbol_size
+
nb_prefix_samples0
,
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
,
UE
->
frame_parms
.
nb_antennas_rx
),
"Could not read in first symbol"
);
// we have the decoded frame index in the return of the synch process
// and we shifted above to the first slot of next frame
...
...
@@ -1014,7 +1011,7 @@ void *UE_thread_SL(void *arg) {
curMsg
->
proc
.
frame_tx
=
((
absolute_slot
+
DURATION_RX_TO_TX
)
/
nb_slot_frame
)
%
MAX_FRAME_NUMBER
;
curMsg
->
proc
.
decoded_frame_rx
=-
1
;
int
firstSymSamp
=
get_firstSymSamp
(
slot_nr
,
&
UE
->
frame_parms
,
UE
->
is_synchronized_sl
);
int
firstSymSamp
=
get_firstSymSamp
(
slot_nr
,
&
UE
->
frame_parms
);
uint64_t
write_time_stamp
=
UE
->
frame_parms
.
get_samples_slot_timestamp
(
slot_nr
,
&
UE
->
frame_parms
,
0
);
uint64_t
read_time_stamp
=
UE
->
frame_parms
.
get_samples_slot_timestamp
(
slot_nr
,
&
UE
->
frame_parms
,
0
);
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
...
...
@@ -1024,11 +1021,11 @@ void *UE_thread_SL(void *arg) {
int
readBlockSize
,
writeBlockSize
;
if
(
slot_nr
<
(
nb_slot_frame
-
1
))
{
readBlockSize
=
get_readBlockSize
(
slot_nr
,
&
UE
->
frame_parms
,
UE
->
is_synchronized_sl
);
readBlockSize
=
get_readBlockSize
(
slot_nr
,
&
UE
->
frame_parms
);
writeBlockSize
=
UE
->
frame_parms
.
get_samples_per_slot
(
slot_nr
,
&
UE
->
frame_parms
);
}
else
{
UE
->
rx_offset_diff
=
computeSamplesShift
(
UE
);
readBlockSize
=
get_readBlockSize
(
slot_nr
,
&
UE
->
frame_parms
,
UE
->
is_synchronized_sl
)
-
UE
->
rx_offset_diff
;
readBlockSize
=
get_readBlockSize
(
slot_nr
,
&
UE
->
frame_parms
)
-
UE
->
rx_offset_diff
;
writeBlockSize
=
UE
->
frame_parms
.
get_samples_per_slot
(
slot_nr
,
&
UE
->
frame_parms
)
-
UE
->
rx_offset_diff
;
}
...
...
@@ -1041,10 +1038,7 @@ void *UE_thread_SL(void *arg) {
if
(
slot_nr
==
(
nb_slot_frame
-
1
))
{
// read in first symbol of next frame and adjust for timing drift
uint16_t
nb_prefix_samples0
=
UE
->
is_synchronized_sl
?
UE
->
frame_parms
.
nb_prefix_samples0
:
UE
->
frame_parms
.
nb_prefix_samples
;
int
first_symbols
=
UE
->
frame_parms
.
ofdm_symbol_size
+
nb_prefix_samples0
;
int
first_symbols
=
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
;
if
(
first_symbols
>
0
)
{
openair0_timestamp
ignore_timestamp
;
AssertFatal
(
first_symbols
==
...
...
@@ -1248,7 +1242,7 @@ void *UE_thread(void *arg) {
}*/
#endif
int
firstSymSamp
=
get_firstSymSamp
(
slot_nr
,
&
UE
->
frame_parms
,
UE
->
is_synchronized_sl
);
int
firstSymSamp
=
get_firstSymSamp
(
slot_nr
,
&
UE
->
frame_parms
);
for
(
int
i
=
0
;
i
<
UE
->
frame_parms
.
nb_antennas_rx
;
i
++
)
rxp
[
i
]
=
(
void
*
)
&
UE
->
common_vars
.
rxdata
[
i
][
firstSymSamp
+
UE
->
frame_parms
.
get_samples_slot_timestamp
(
slot_nr
,
&
UE
->
frame_parms
,
0
)];
...
...
@@ -1260,11 +1254,11 @@ void *UE_thread(void *arg) {
int
readBlockSize
,
writeBlockSize
;
if
(
slot_nr
<
(
nb_slot_frame
-
1
))
{
readBlockSize
=
get_readBlockSize
(
slot_nr
,
&
UE
->
frame_parms
,
UE
->
is_synchronized_sl
);
readBlockSize
=
get_readBlockSize
(
slot_nr
,
&
UE
->
frame_parms
);
writeBlockSize
=
UE
->
frame_parms
.
get_samples_per_slot
((
slot_nr
+
DURATION_RX_TO_TX
-
NR_RX_NB_TH
)
%
nb_slot_frame
,
&
UE
->
frame_parms
);
}
else
{
UE
->
rx_offset_diff
=
computeSamplesShift
(
UE
);
readBlockSize
=
get_readBlockSize
(
slot_nr
,
&
UE
->
frame_parms
,
UE
->
is_synchronized_sl
)
-
readBlockSize
=
get_readBlockSize
(
slot_nr
,
&
UE
->
frame_parms
)
-
UE
->
rx_offset_diff
;
writeBlockSize
=
UE
->
frame_parms
.
get_samples_per_slot
((
slot_nr
+
DURATION_RX_TO_TX
-
NR_RX_NB_TH
)
%
nb_slot_frame
,
&
UE
->
frame_parms
)
-
UE
->
rx_offset_diff
;
}
...
...
openair1/PHY/MODULATION/slot_fep_nr.c
View file @
0f6043d8
...
...
@@ -47,37 +47,18 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
AssertFatal
(
symbol
<
frame_parms
->
symbols_per_slot
,
"slot_fep: symbol must be between 0 and %d
\n
"
,
frame_parms
->
symbols_per_slot
-
1
);
AssertFatal
(
Ns
<
frame_parms
->
slots_per_frame
,
"slot_fep: Ns must be between 0 and %d
\n
"
,
frame_parms
->
slots_per_frame
-
1
);
unsigned
int
nb_prefix_samples
;
unsigned
int
nb_prefix_samples0
;
bool
is_synced
=
ue
->
is_synchronized
;
if
(
get_softmodem_params
()
->
sl_mode
==
2
)
{
is_synced
=
ue
->
is_synchronized_sl
;
}
if
(
is_synced
)
{
nb_prefix_samples
=
frame_parms
->
nb_prefix_samples
;
nb_prefix_samples0
=
frame_parms
->
nb_prefix_samples0
;
}
else
{
nb_prefix_samples
=
frame_parms
->
nb_prefix_samples
;
nb_prefix_samples0
=
frame_parms
->
nb_prefix_samples
;
}
dft_size_idx_t
dftsize
=
get_dft
(
frame_parms
->
ofdm_symbol_size
);
// This is for misalignment issues
int32_t
tmp_dft_in
[
8192
]
__attribute__
((
aligned
(
32
)));
unsigned
int
rx_offset
=
frame_parms
->
get_samples_slot_timestamp
(
Ns
,
frame_parms
,
0
);
unsigned
int
abs_symbol
=
Ns
*
frame_parms
->
symbols_per_slot
+
symbol
;
for
(
int
idx_symb
=
Ns
*
frame_parms
->
symbols_per_slot
;
idx_symb
<=
abs_symbol
;
idx_symb
++
)
rx_offset
+=
(
idx_symb
%
(
0x7
<<
frame_parms
->
numerology_index
))
?
nb_prefix_samples
:
nb_prefix_samples0
;
rx_offset
+=
frame_parms
->
ofdm_symbol_size
*
symbol
;
// use OFDM symbol from within 1/8th of the CP to avoid ISI
rx_offset
-=
(
nb_prefix_samples
/
frame_parms
->
ofdm_offset_divisor
);
rx_offset
+=
frame_parms
->
nb_prefix_samples0
;
rx_offset
+=
(
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
)
*
symbol
;
//#ifdef DEBUG_FEP
// if (ue->frame <100)
LOG_D
(
PHY
,
"slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u energy %d
\n
"
,
Ns
,
symbol
,
nb_prefix_samples
,
nb_prefix_samples0
,
rx_offset
,
dB_fixed
(
signal_energy
(
&
common_vars
->
rxdata
[
0
][
rx_offset
],
frame_parms
->
ofdm_symbol_size
)));
Ns
,
symbol
,
frame_parms
->
nb_prefix_samples
,
frame_parms
->
nb_prefix_samples0
,
rx_offset
,
dB_fixed
(
signal_energy
(
&
common_vars
->
rxdata
[
0
][
rx_offset
],
frame_parms
->
ofdm_symbol_size
)));
//#endif
for
(
unsigned
char
aa
=
0
;
aa
<
frame_parms
->
nb_antennas_rx
;
aa
++
)
{
...
...
@@ -165,20 +146,8 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
AssertFatal
(
symbol
<
frame_parms
->
symbols_per_slot
,
"slot_fep: symbol must be between 0 and %d
\n
"
,
frame_parms
->
symbols_per_slot
-
1
);
AssertFatal
(
Ns
<
frame_parms
->
slots_per_frame
,
"slot_fep: Ns must be between 0 and %d
\n
"
,
frame_parms
->
slots_per_frame
-
1
);
unsigned
int
nb_prefix_samples
;
unsigned
int
nb_prefix_samples0
;
bool
is_synced
=
ue
->
is_synchronized
;
if
(
get_softmodem_params
()
->
sl_mode
==
2
)
{
is_synced
=
ue
->
is_synchronized_sl
;
}
if
(
is_synced
)
{
nb_prefix_samples
=
frame_parms
->
nb_prefix_samples
;
nb_prefix_samples0
=
frame_parms
->
nb_prefix_samples0
;
}
else
{
nb_prefix_samples
=
frame_parms
->
nb_prefix_samples
;
nb_prefix_samples0
=
frame_parms
->
nb_prefix_samples
;
}
unsigned
int
nb_prefix_samples
=
frame_parms
->
nb_prefix_samples
;
unsigned
int
nb_prefix_samples0
=
frame_parms
->
nb_prefix_samples0
;
unsigned
int
frame_length_samples
=
frame_parms
->
samples_per_frame
;
dft_size_idx_t
dftsize
=
get_dft
(
frame_parms
->
ofdm_symbol_size
);
...
...
@@ -187,10 +156,8 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
unsigned
int
slot_offset
=
frame_parms
->
get_samples_slot_timestamp
(
Ns
,
frame_parms
,
0
);
unsigned
int
rx_offset
=
sample_offset
+
slot_offset
;
unsigned
int
abs_symbol
=
Ns
*
frame_parms
->
symbols_per_slot
+
symbol
;
for
(
int
idx_symb
=
Ns
*
frame_parms
->
symbols_per_slot
;
idx_symb
<=
abs_symbol
;
idx_symb
++
)
rx_offset
+=
(
abs_symbol
%
(
0x7
<<
frame_parms
->
numerology_index
))
?
nb_prefix_samples
:
nb_prefix_samples0
;
rx_offset
+=
frame_parms
->
ofdm_symbol_size
*
symbol
;
rx_offset
+=
nb_prefix_samples0
;
rx_offset
+=
(
frame_parms
->
ofdm_symbol_size
+
nb_prefix_samples
)
*
symbol
;
#ifdef DEBUG_FEP
LOG_I
(
NR_PHY
,
"slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, slot_offset %u, sample_offset %d,rx_offset %u, frame_length_samples %u
\n
"
,
...
...
openair1/PHY/NR_REFSIG/ss_pbch_nr.h
View file @
0f6043d8
...
...
@@ -70,7 +70,7 @@
#define SSS_SYMBOL_NB ((2) + OFFSET_SS_PBCH)
#define PBCH_LAST_SYMBOL_NB ((3) + OFFSET_SS_PBCH)
#define OFFSET_SS_PSBCH
-1
#define OFFSET_SS_PSBCH
0
#define PSS0_SL_SYMBOL_NB ((1) + OFFSET_SS_PSBCH)
#define PSS1_SL_SYMBOL_NB ((2) + OFFSET_SS_PSBCH)
#define SSS0_SL_SYMBOL_NB ((3) + OFFSET_SS_PSBCH)
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
View file @
0f6043d8
...
...
@@ -278,25 +278,25 @@ int nr_sl_initial_sync(UE_nr_rxtx_proc_t *proc,
int32_t
sync_pos
=
0
,
sync_pos_frame
;
for
(
int
is
=
0
;
is
<
n_frames
;
is
++
)
{
sync_pos
=
pss_synchro_nr
(
ue
,
is
,
NO_RATE_CHANGE
);
if
(
sync_pos
>=
fp
->
nb_prefix_samples
)
{
// In 5G SL, the first SSB symbol is the PSBCH, so we need adjust the SSB
// offset accordingly (psbch_plus_prefix_size). Additionally, there are 2
// PSS symbols. So in the case where we correlate on the second PSS,
// we need to adjust the SSB offset accordingly (subtracting first PSS prefix)
.
// However, if we correlated on the second PSS, we do not need to includ
e
// the size of the first PSS0, becasue the correlation occurs on each individual PSS
.
// The sync position (sync_pos) is the start of the found PSS + nb_prefix_samples.
// PSBCH PREFIX | PSBCH 0 | PSS 0 PREFIX | PSS 0 | PSS 1 PREFIX | PSS 1
|
// 144 | 2048 | 144 | 2048 | 144 | 2048 |
// 144 | 2048 | 144 | - | 144 | X | SSB Start = X - (144 + 144
+ 2048 + 144)
// 144 | 2048 | 144 | X | 144 | 2048 | SSB Start = X - (144 + 2048 + 144)
uint32_t
psbch_plus_prefix_size
=
fp
->
ofdm_symbol_size
+
fp
->
nb_prefix_samples
;
uint32_t
num_pss_prefix_samples_size
=
(
ue
->
common_vars
.
N2_id
+
1
)
*
fp
->
nb_prefix_samples
;
LOG_I
(
NR_PHY
,
"This is
num_pss_prefix_samples
_size %d, psbch_plus_prefix_size %d, sync_pos %d, N2_id %d
\n
"
,
num_pss_prefix_samples
_size
,
psbch_plus_prefix_size
,
sync_pos
,
ue
->
common_vars
.
N2_id
);
ue
->
ssb_offset
=
sync_pos
-
num_pss_prefix_samples_size
-
psbch_plus_prefix_size
;
// In 5G SL, the first SSB symbol is the PSBCH, so we need adjust the SSB
// offset accordingly (psbch_plus_prefix_size). Additionally, there are 2
// PSS symbols.
// However, if we correlated on the second PSS, we do not need to include an offset
// the size of the first PSS0, becasue the correlation occurs on each individual PSS
.
// The sync_pos will ALWAYS point at the start of the first PSS (PSS0) becasu
e
// it is just the peak position in the correlation related to the ref symbols
.
// PSBCH PREFIX | PSBCH 0 | PSS 0 PREFIX | PSS 0 | PSS 1 PREFIX | PSS 1 |
// 176 | 2048 | 144 | 2048 | 144 | 2048
|
// 176 | 2048 | 144 | - | - | X | SSB Start = X - (176 + 2048 + 144)
// 176 | 2048 | 144 | X | 144 | 2048 | SSB Start = X - (176
+ 2048 + 144)
uint32_t
psbch_plus_prefix_size
=
fp
->
ofdm_symbol_size
+
fp
->
nb_prefix_samples0
;
uint32_t
pss_plus_prefix_size
=
fp
->
nb_prefix_samples
;
if
(
sync_pos
>=
psbch_plus_prefix_size
+
pss_plus_prefix_size
)
{
LOG_I
(
NR_PHY
,
"This is
pss_plus_prefix
_size %d, psbch_plus_prefix_size %d, sync_pos %d, N2_id %d
\n
"
,
pss_plus_prefix
_size
,
psbch_plus_prefix_size
,
sync_pos
,
ue
->
common_vars
.
N2_id
);
ue
->
ssb_offset
=
sync_pos
-
(
pss_plus_prefix_size
+
psbch_plus_prefix_size
)
;
}
else
{
ue
->
ssb_offset
=
sync_pos
+
(
fp
->
samples_per_subframe
*
10
)
-
fp
->
nb_prefix_samples
;
ue
->
ssb_offset
=
sync_pos
+
fp
->
samples_per_frame
-
(
pss_plus_prefix_size
+
psbch_plus_prefix_size
)
;
}
LOG_I
(
NR_PHY
,
"[UE%d] Initial sync : n_frames %d Estimated PSS position %d, Nid2 %d ssb_offset %d
\n
"
,
ue
->
Mod_id
,
n_frames
,
sync_pos
,
ue
->
common_vars
.
N2_id
,
ue
->
ssb_offset
);
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_psbch.c
View file @
0f6043d8
...
...
@@ -300,7 +300,7 @@ void nr_sl_common_signal_procedures(PHY_VARS_NR_UE *ue, int frame, int slot)
NR_DL_FRAME_PARMS
*
fp
=
&
ue
->
frame_parms
;
int
**
txdataF
=
ue
->
common_vars
.
txdataF
;
uint8_t
ssb_index
=
0
;
//TODO: Need update to get 0 or 1 from parameter in case of mu = 1.
int
txdataF_offset
=
slot
*
fp
->
samples_per_slot_wCP
;
const
int
txdataF_offset
=
slot
*
ue
->
frame_parms
.
get_samples_per_slot
(
slot
,
&
ue
->
frame_parms
)
;
uint16_t
ssb_start_symbol
=
0
;
LOG_D
(
NR_PHY
,
"common_signal_procedures: frame %d, slot %d ssb index %d, ssb_start_symbol %d, txdataF_offset %d
\n
"
,
...
...
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
View file @
0f6043d8
...
...
@@ -313,7 +313,7 @@ void phy_procedures_nrUE_SL_TX(PHY_VARS_NR_UE *ue,
if
(
get_softmodem_params
()
->
sl_mode
==
2
)
{
ue
->
tx_power_dBm
[
slot_tx
]
=
-
127
;
int
num_samples_per_slot
=
ue
->
frame_parms
.
slots_per_frame
*
ue
->
frame_parms
.
samples_per_slot_wCP
;
int
num_samples_per_slot
=
ue
->
frame_parms
.
slots_per_frame
*
ue
->
frame_parms
.
get_samples_per_slot
(
slot_tx
,
&
ue
->
frame_parms
)
;
for
(
int
i
=
0
;
i
<
ue
->
frame_parms
.
nb_antennas_tx
;
++
i
)
{
AssertFatal
(
i
<
sizeof
(
ue
->
common_vars
.
txdataF
),
"Array index %d is over the Array size %lu
\n
"
,
i
,
sizeof
(
ue
->
common_vars
.
txdataF
));
memset
(
ue
->
common_vars
.
txdataF
[
i
],
0
,
sizeof
(
int32_t
)
*
num_samples_per_slot
);
...
...
@@ -322,9 +322,8 @@ void phy_procedures_nrUE_SL_TX(PHY_VARS_NR_UE *ue,
if
(
ue
->
sync_ref
&&
phy_ssb_slot_allocation_sl
(
ue
,
frame_tx
,
slot_tx
))
{
nr_sl_common_signal_procedures
(
ue
,
frame_tx
,
slot_tx
);
const
int
txdataF_offset
=
slot_tx
*
ue
->
frame_parms
.
samples_per_slot_wCP
;
const
int
txdataF_offset
=
slot_tx
*
ue
->
frame_parms
.
get_samples_per_slot
(
slot_tx
,
&
ue
->
frame_parms
)
;
LOG_D
(
NR_PHY
,
"%s() %d. slot %d txdataF_offset %d
\n
"
,
__FUNCTION__
,
__LINE__
,
slot_tx
,
txdataF_offset
);
uint16_t
nb_prefix_samples0
=
ue
->
is_synchronized_sl
?
ue
->
frame_parms
.
nb_prefix_samples0
:
ue
->
frame_parms
.
nb_prefix_samples
;
int
slot_timestamp
=
ue
->
frame_parms
.
get_samples_slot_timestamp
(
slot_tx
,
&
ue
->
frame_parms
,
0
);
for
(
int
aa
=
0
;
aa
<
ue
->
frame_parms
.
nb_antennas_tx
;
aa
++
)
{
apply_nr_rotation
(
&
ue
->
frame_parms
,
...
...
@@ -341,9 +340,8 @@ void phy_procedures_nrUE_SL_TX(PHY_VARS_NR_UE *ue,
slot_tx
,
1
,
13
,
link_type_sl
);
// Conducts rotation on symbols located 1 (PSS) to 13 (guard)
PHY_ofdm_mod
(
&
ue
->
common_vars
.
txdataF
[
aa
][
ue
->
frame_parms
.
ofdm_symbol_size
+
txdataF_offset
],
// Starting at PSS (in freq)
(
int
*
)
&
ue
->
common_vars
.
txdata
[
aa
][
ue
->
frame_parms
.
ofdm_symbol_size
+
nb_prefix_samples0
+
ue
->
frame_parms
.
nb_prefix_samples
+
slot_timestamp
],
// Starting output offset at CP0 + PSBCH0 + CP1
ue
->
frame_parms
.
nb_prefix_samples0
+
slot_timestamp
],
// Starting output offset at CP0 + PSBCH0
ue
->
frame_parms
.
ofdm_symbol_size
,
13
,
// Takes IDFT of remaining 13 symbols (PSS to guard)... Notice the offset of the input and output above
ue
->
frame_parms
.
nb_prefix_samples
,
...
...
openair1/SIMULATION/NR_PHY/psbchsim.c
View file @
0f6043d8
...
...
@@ -463,6 +463,7 @@ int main(int argc, char **argv)
int
frame
=
0
;
int
ssb_start_symbol_abs
=
(
UE
->
slss
->
sl_timeoffsetssb_r16
+
UE
->
slss
->
sl_timeinterval_r16
*
i
)
*
UE
->
frame_parms
.
symbols_per_slot
;
int
slot
=
ssb_start_symbol_abs
/
14
;
const
int
txdataF_offset
=
slot
*
UE
->
frame_parms
.
get_samples_per_slot
(
slot
,
&
UE
->
frame_parms
);
nr_sl_common_signal_procedures
(
UE
,
frame
,
slot
);
const
int
sc_offset
=
UE
->
frame_parms
.
freq_range
==
nr_FR1
?
ssb_subcarrier_offset
<<
mu
:
ssb_subcarrier_offset
;
...
...
@@ -473,43 +474,41 @@ int main(int argc, char **argv)
msgDataTx
.
ssb
[
i
].
ssb_pdu
.
ssb_pdu_rel15
.
ssbOffsetPointA
=
prb_offset
;
int
slot_timestamp
=
UE
->
frame_parms
.
get_samples_slot_timestamp
(
slot
,
&
UE
->
frame_parms
,
0
);
UE
->
frame_parms
.
nb_prefix_samples0
=
UE
->
is_synchronized_sl
?
UE
->
frame_parms
.
nb_prefix_samples0
:
UE
->
frame_parms
.
nb_prefix_samples
;
int
max_symbol_size
=
slot_timestamp
+
UE
->
frame_parms
.
nb_prefix_samples0
+
UE
->
frame_parms
.
ofdm_symbol_size
;
AssertFatal
(
max_symbol_size
<
frame_length_complex_samples
,
"Invalid index %d
\n
"
,
max_symbol_size
);
for
(
int
aa
=
0
;
aa
<
UE
->
frame_parms
.
nb_antennas_tx
;
aa
++
)
{
apply_nr_rotation
(
&
UE
->
frame_parms
,
(
int16_t
*
)
UE
->
common_vars
.
txdataF
[
aa
],
(
int16_t
*
)
&
UE
->
common_vars
.
txdataF
[
aa
][
txdataF_offset
],
slot
,
0
,
1
,
link_type_sl
);
// Conducts rotation on 0th symbol
PHY_ofdm_mod
(
UE
->
common_vars
.
txdataF
[
aa
],
PHY_ofdm_mod
(
&
UE
->
common_vars
.
txdataF
[
aa
][
txdataF_offset
],
(
int
*
)
&
txdata
[
aa
][
slot_timestamp
],
UE
->
frame_parms
.
ofdm_symbol_size
,
1
,
// Takes IDFT of 1st symbol (first PSBCH)
UE
->
frame_parms
.
nb_prefix_samples0
,
CYCLIC_PREFIX
);
apply_nr_rotation
(
&
UE
->
frame_parms
,
(
int16_t
*
)
UE
->
common_vars
.
txdataF
[
aa
],
(
int16_t
*
)
&
UE
->
common_vars
.
txdataF
[
aa
][
txdataF_offset
],
slot
,
1
,
13
,
link_type_sl
);
// Conducts rotation on symbols located 1 (PSS) to 13 (guard)
PHY_ofdm_mod
(
&
UE
->
common_vars
.
txdataF
[
aa
][
UE
->
frame_parms
.
ofdm_symbol_size
],
// Starting at PSS (in freq)
(
int
*
)
&
txdata
[
aa
][
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples0
+
UE
->
frame_parms
.
nb_prefix_samples
],
// Starting output offset at CP0 + PSBCH0 + CP1
PHY_ofdm_mod
(
&
UE
->
common_vars
.
txdataF
[
aa
][
UE
->
frame_parms
.
ofdm_symbol_size
+
txdataF_offset
],
// Starting at PSS (in freq)
(
int
*
)
&
txdata
[
aa
][
slot_timestamp
+
UE
->
frame_parms
.
ofdm_symbol_size
+
UE
->
frame_parms
.
nb_prefix_samples
0
],
// Starting output offset at CP0 + PSBCH0 + CP1
UE
->
frame_parms
.
ofdm_symbol_size
,
13
,
// Takes IDFT of remaining 13 symbols (PSS to guard)... Notice the offset of the input and output above
UE
->
frame_parms
.
nb_prefix_samples
,
CYCLIC_PREFIX
);
}
char
buffer
[
1024
];
printf
(
"txdataF[0] = %s
\n
"
,
hexdump
(
&
UE
->
common_vars
.
txdataF
[
0
][
txdataF_offset
],
sizeof
(
UE
->
common_vars
.
txdataF
[
0
]),
buffer
,
sizeof
(
buffer
)));
if
(
UE
->
frame_parms
.
nb_antennas_tx
>
1
)
printf
(
"txdataF[1] = %s
\n
"
,
hexdump
(
&
UE
->
common_vars
.
txdataF
[
1
][
txdataF_offset
],
sizeof
(
UE
->
common_vars
.
txdataF
[
1
]),
buffer
,
sizeof
(
buffer
)));
printf
(
"txdata[0] = %s
\n
"
,
hexdump
(
txdata
[
0
],
sizeof
(
txdata
[
0
]),
buffer
,
sizeof
(
buffer
)));
if
(
UE
->
frame_parms
.
nb_antennas_tx
>
1
)
printf
(
"txdata[0] = %s
\n
"
,
hexdump
(
txdata
[
1
],
sizeof
(
txdata
[
1
]),
buffer
,
sizeof
(
buffer
)));
}
}
char
buffer
[
1024
];
printf
(
"txdataF[0] = %s
\n
"
,
hexdump
(
UE
->
common_vars
.
txdataF
[
0
],
sizeof
(
UE
->
common_vars
.
txdataF
[
0
]),
buffer
,
sizeof
(
buffer
)));
if
(
UE
->
frame_parms
.
nb_antennas_tx
>
1
)
printf
(
"txdataF[1] = %s
\n
"
,
hexdump
(
UE
->
common_vars
.
txdataF
[
1
],
sizeof
(
UE
->
common_vars
.
txdataF
[
1
]),
buffer
,
sizeof
(
buffer
)));
printf
(
"txdata[0] = %s
\n
"
,
hexdump
(
txdata
[
0
],
sizeof
(
txdata
[
0
]),
buffer
,
sizeof
(
buffer
)));
if
(
UE
->
frame_parms
.
nb_antennas_tx
>
1
)
printf
(
"txdata[0] = %s
\n
"
,
hexdump
(
txdata
[
1
],
sizeof
(
txdata
[
1
]),
buffer
,
sizeof
(
buffer
)));
AssertFatal
((((
frame_length_complex_samples
-
1
)
<<
1
)
+
1
)
<
2
*
frame_length_complex_samples
,
"Invalid index %d >= %d
\n
"
,
(((
frame_length_complex_samples
-
1
)
<<
1
)
+
1
),
2
*
frame_length_complex_samples
);
int
n_errors
=
0
;
...
...
sdr/rfsimulator/simulator.c
View file @
0f6043d8
...
...
@@ -84,6 +84,7 @@
{"modelname", "<channel model name>\n", simOpt, strptr:&modelname, defstrval:"AWGN", TYPE_STRING, 0 },\
{"ploss", "<channel path loss in dB>\n", simOpt, dblptr:&(rfsimulator->chan_pathloss), defdblval:0, TYPE_DOUBLE, 0 },\
{"forgetfact", "<channel forget factor ((0 to 1)>\n", simOpt, dblptr:&(rfsimulator->chan_forgetfact), defdblval:0, TYPE_DOUBLE, 0 },\
{"CFO", "<Carrier frequency offset (Hz)>\n" , simOpt, dblptr:&(rfsimulator->cfo) , defdblval:0, TYPE_DOUBLE, 0 },\
{"offset", "<channel offset in samps>\n", simOpt, iptr:&(rfsimulator->chan_offset), defintval:0, TYPE_INT, 0 }\
};
...
...
@@ -135,6 +136,7 @@ typedef struct {
float
noise_power_dB
;
void
*
telnetcmd_qid
;
poll_telnetcmdq_func_t
poll_telnetcmdq
;
double
cfo
;
}
rfsimulator_state_t
;
...
...
@@ -693,6 +695,10 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
if
(
t
->
poll_telnetcmdq
)
t
->
poll_telnetcmdq
(
t
->
telnetcmd_qid
,
t
);
double
cfo
=
t
->
cfo
;
//LOG_I(HW,"rfsimCFO is %f\n", cfo);
double
phase_inc
=
2
*
M_PI
*
cfo
/
122.88e6
;
struct
complexd
rx_tmp
=
{
0
};
for
(
int
a
=
0
;
a
<
nbAnt
;
a
++
)
{
//loop over number of Rx antennas
if
(
ptr
->
channel_model
!=
NULL
)
{
// apply a channel model
...
...
@@ -721,6 +727,15 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
}
// end for a_tx
}
// end for i (number of samps)
}
// end of no channel modeling
double
phase
=
0
;
sample_t
*
outCFO
=
(
sample_t
*
)
samplesVoid
[
a
];
for
(
int
i
=
0
;
i
<
nsamps
;
i
++
){
rx_tmp
.
r
=
outCFO
[
i
].
r
*
cos
(
phase
)
-
outCFO
[
i
].
i
*
sin
(
phase
);
rx_tmp
.
i
=
outCFO
[
i
].
r
*
sin
(
phase
)
+
outCFO
[
i
].
i
*
cos
(
phase
);
outCFO
[
i
].
r
=
lround
(
rx_tmp
.
r
);
outCFO
[
i
].
i
=
lround
(
rx_tmp
.
i
);
phase
+=
phase_inc
;
}
}
// end for a (number of rx antennas)
}
}
...
...
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