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
1e7fb04a
Commit
1e7fb04a
authored
Sep 26, 2023
by
Deokseong "David" Kim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Script update to run multiple types of USRP to send multiple strings
parent
feec7ef4
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
502 additions
and
342 deletions
+502
-342
ci-scripts/run_sl_test.py
ci-scripts/run_sl_test.py
+270
-175
ci-scripts/sl_check_log.py
ci-scripts/sl_check_log.py
+13
-17
ci-scripts/sl_cmds.txt
ci-scripts/sl_cmds.txt
+96
-33
ci-scripts/sl_rx_agent.py
ci-scripts/sl_rx_agent.py
+47
-39
executables/softmodem-common.h
executables/softmodem-common.h
+4
-1
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
+1
-2
openair1/PHY/NR_UE_TRANSPORT/nr_slsch_ue.c
openair1/PHY/NR_UE_TRANSPORT/nr_slsch_ue.c
+18
-35
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+37
-32
openair1/SIMULATION/NR_PHY/psschsim.c
openair1/SIMULATION/NR_PHY/psschsim.c
+16
-8
No files found.
ci-scripts/run_sl_test.py
View file @
1e7fb04a
This diff is collapsed.
Click to expand it.
ci-scripts/sl_check_log.py
View file @
1e7fb04a
...
...
@@ -8,8 +8,6 @@ class LogChecker():
def
__init__
(
self
,
OPTS
,
LOGGER
):
self
.
OPTS
=
OPTS
self
.
LOGGER
=
LOGGER
self
.
rxlog_file_path
=
os
.
path
.
join
(
OPTS
.
log_dir
,
'rx.log'
)
self
.
txlog_file_path
=
os
.
path
.
join
(
OPTS
.
log_dir
,
'tx.log'
)
def
get_lines
(
self
,
filename
:
str
)
->
Generator
[
str
,
None
,
None
]:
"""
...
...
@@ -29,7 +27,7 @@ class LogChecker():
for
line
in
self
.
get_lines
(
filename
):
yield
line
def
analyze_nearby_logs
(
self
,
exp_nid1
:
int
,
exp_nid2
:
int
,
sci2
:
bool
)
->
bool
:
def
analyze_nearby_logs
(
self
,
exp_nid1
:
int
,
exp_nid2
:
int
,
sci2
:
bool
,
log_file
:
str
)
->
bool
:
"""
Checking matched sync logs of Nearby UE.
"""
...
...
@@ -38,7 +36,6 @@ class LogChecker():
ssb_rsrp
=
0
nb_decoded
=
0
total_rx
=
0
log_file
=
self
.
rxlog_file_path
result
=
None
user_msg
=
None
...
...
@@ -55,7 +52,7 @@ class LogChecker():
est_nid2
=
int
(
fields
[
10
])
if
'RSRP'
in
line
:
ssb_rsrp
=
int
(
fields
[
12
])
found
.
add
(
'
found
'
)
found
.
add
(
'
syncref
'
)
time_end_s
=
float
(
fields
[
0
])
#153092.995494 [NR_PHY] In nr_ue_sl_pssch_rsrp_measurements: [UE 0] adj_ue_index 0 PSSCH-RSRP: -63 dBm/RE (6685627)
...
...
@@ -77,7 +74,7 @@ class LogChecker():
if
'the polar decoder output is:'
in
line
:
line
=
line
.
strip
()
user_msg
=
line
found
.
add
(
'
found
'
)
found
.
add
(
'
sci2
'
)
else
:
if
'Received your text! It says:'
in
line
:
line
=
line
.
strip
()
...
...
@@ -85,20 +82,21 @@ class LogChecker():
found
.
add
(
'found'
)
self
.
LOGGER
.
debug
(
'found: %r'
,
found
)
if
len
(
found
)
!=
1
:
self
.
LOGGER
.
error
(
f'Failed -- No SyncRef UE
found
.'
)
return
if
'syncref'
not
in
found
:
self
.
LOGGER
.
error
(
f'Failed -- No SyncRef UE.'
)
return
(
result
,
user_msg
)
if
exp_nid1
!=
est_nid1
or
exp_nid2
!=
est_nid2
:
self
.
LOGGER
.
error
(
f'Failed -- found SyncRef UE Nid1
{
est_nid1
}
, Ni2
{
est_nid2
}
, expecting Nid1
{
exp_nid1
}
, Nid2
{
exp_nid2
}
'
)
return
return
(
result
,
user_msg
)
if
time_start_s
==
-
1
:
self
.
LOGGER
.
error
(
f'Failed -- No start time found! Fix log and re-run!'
)
return
return
(
result
,
user_msg
)
delta_time_s
=
time_end_s
-
time_start_s
result
=
f'SyncRef UE found. PSSCH-RSRP:
{
pssch_rsrp
}
dBm/RE. SSS-RSRP:
{
ssb_rsrp
}
dBm/RE passed
{
nb_decoded
}
total
{
total_rx
}
It took
{
delta_time_s
}
seconds'
self
.
LOGGER
.
info
(
result
)
self
.
LOGGER
.
info
(
user_msg
)
if
user_msg
!=
None
:
self
.
LOGGER
.
info
(
user_msg
)
return
(
result
,
user_msg
)
def
get_analysis_messages_syncref
(
self
,
filename
:
str
)
->
Generator
[
str
,
None
,
None
]:
...
...
@@ -113,23 +111,21 @@ class LogChecker():
if
len
(
fields
)
==
4
or
len
(
fields
)
==
6
:
yield
line
def
analyze_syncref_logs
(
self
,
counting_delta
:
float
)
->
int
:
def
analyze_syncref_logs
(
self
,
sync_duration
:
float
,
log_file
:
str
)
->
int
:
"""
Checking logs of SyncRef UE.
"""
time_start_s
,
time_end_s
=
-
1
,
-
1
log_file
=
self
.
txlog_file_path
sum_ssb
=
0
if
self
.
OPTS
.
compress
:
log_file
=
f'
{
log_file
}
.bz2'
for
line
in
self
.
get_analysis_messages_syncref
(
log_file
):
#796811.532881 [NR_PHY] nrUE configured
#796821.854505 [NR_PHY] PSBCH SL generation started
if
time_start_s
==
-
1
and
'
nrUE configur
ed'
in
line
:
if
time_start_s
==
-
1
and
'
PSBCH SL generation start
ed'
in
line
:
fields
=
line
.
split
(
maxsplit
=
2
)
time_start_s
=
float
(
fields
[
0
])
time_end_s
=
time_start_s
+
counting_delta
time_end_s
=
time_start_s
+
sync_duration
if
'PSBCH SL generation started'
in
line
:
fields
=
line
.
split
(
maxsplit
=
2
)
time_st
=
float
(
''
.
join
([
ch
for
ch
in
fields
[
0
]
if
ch
.
isnumeric
()
or
ch
==
'.'
]))
...
...
ci-scripts/sl_cmds.txt
View file @
1e7fb04a
# The lines containing 'usrp' and starts with 'syncref' or 'nearby' will be valid until it does not contain backspace.
#########################
#### USRP B210 ####
#########################
################################################################
#### USRP B210 --- USRP B210 ####
################################################################
### TX SyncRef UE ###
syncref_usrp_b210_net0_cmd = \
sudo -E LD_LIBRARY_PATH=$HOME/openairinterface5g/cmake_targets/ran_build/build:$LD_LIBRARY_PATH \
$HOME/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
--sl-mode 2 --sync-ref --rbsl 52 --numerology 1 --band 38 --SLC 2600000000 --ue-txgain 0 \
--usrp-args "type=b200,serial=3150384,clock_source=external" \
--log_config.global_log_options time,nocolor \
> ~/syncref.log 2>&1
### RX Nearby UE ###
nearby_usrp_b210_cmd = cd $HOME/openairinterface5g/ci-scripts; \
nearby_usrp_b210_net0_hostIP = 10.1.1.61
nearby_usrp_b210_net0_cmd = cd $HOME/openairinterface5g/ci-scripts; \
python3 sl_rx_agent.py --cmd \
'sudo -E LD_LIBRARY_PATH=$HOME/openairinterface5g/cmake_targets/ran_build/build:$LD_LIBRARY_PATH \
$HOME/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
--sl-mode 2 --rbsl 52 --numerology 1 --band 38 --SLC 2600000000 --ue-rxgain 90 \
--usrp-args "type=b200,serial=3150361,clock_source=external" \
--log_config.global_log_options time,nocolor \
> ~/rx.log 2>&1'
> ~/nearby.log 2>&1'
################################################################
#### USRP N310 --- USRP N310 ####
################################################################
### TX SyncRef UE ###
syncref_usrp_
b210
_cmd = \
syncref_usrp_
n310_net1
_cmd = \
sudo -E LD_LIBRARY_PATH=$HOME/openairinterface5g/cmake_targets/ran_build/build:$LD_LIBRARY_PATH \
$HOME/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
--sl-mode 2 --sync-ref --rbsl 52 --numerology 1 --band
38 --SLC 2
600000000 --ue-txgain 0 \
--usrp-args "type=
b200,serial=3150384,clock_source=external
" \
--sl-mode 2 --sync-ref --rbsl 52 --numerology 1 --band
78 --SLC 3
600000000 --ue-txgain 0 \
--usrp-args "type=
n3xx,addr=192.168.10.2,subdev=A:0,master_clock_rate=122.88e6
" \
--log_config.global_log_options time,nocolor \
> ~/tx.log 2>&1
#########################
#### USRP N310 ####
#########################
> ~/syncref.log 2>&1
### RX Nearby UE ###
nearby_usrp_n310_cmd = cd $HOME/openairinterface5g/ci-scripts; \
nearby_usrp_n310_net1_hostIP = 10.1.1.80
nearby_usrp_n310_net1_cmd = cd $HOME/openairinterface5g/ci-scripts; \
python3 sl_rx_agent.py --cmd \
'sudo -E LD_LIBRARY_PATH=$HOME/openairinterface5g/cmake_targets/ran_build/build:$LD_LIBRARY_PATH \
$HOME/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
--sl-mode 2 --rbsl 52 --numerology 1 --band
38 --SLC 2600000000 --ue-rxgain 20
\
--usrp-args "type=n3xx,addr=192.168.
2
0.2,subdev=A:0,master_clock_rate=122.88e6" \
--sl-mode 2 --rbsl 52 --numerology 1 --band
78 --SLC 3600000000 --ue-rxgain 75
\
--usrp-args "type=n3xx,addr=192.168.
1
0.2,subdev=A:0,master_clock_rate=122.88e6" \
--log_config.global_log_options time,nocolor \
> ~/rx.log 2>&1'
> ~/nearby.log 2>&1'
################################################################
#### Multi-hop: USRP N310 --- USRP N310 --- USRP B210 ####
################################################################
### TX SyncRef UE ###
syncref_usrp_n310_cmd = \
syncref_usrp_n310_
net2_
cmd = \
sudo -E LD_LIBRARY_PATH=$HOME/openairinterface5g/cmake_targets/ran_build/build:$LD_LIBRARY_PATH \
$HOME/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
--sl-mode 2 --sync-ref --rbsl 52 --numerology 1 --band
38 --SLC 2
600000000 --ue-txgain 0 \
--sl-mode 2 --sync-ref --rbsl 52 --numerology 1 --band
78 --SLC 3
600000000 --ue-txgain 0 \
--usrp-args "type=n3xx,addr=192.168.10.2,subdev=A:0,master_clock_rate=122.88e6" \
--log_config.global_log_options time,nocolor \
> ~/
tx
.log 2>&1
--log_config.global_log_options time,nocolor
--node-number 1
\
> ~/
syncref1
.log 2>&1
### Relay UE ###
nearby_usrp_n310_net2_hostIP = 10.1.1.80
nearby_usrp_n310_net2_cmd = cd $HOME/openairinterface5g/ci-scripts; \
python3 sl_rx_agent.py --cmd \
'sudo -E LD_LIBRARY_PATH=$HOME/openairinterface5g/cmake_targets/ran_build/build:$LD_LIBRARY_PATH \
$HOME/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
--sl-mode 2 --rbsl 52 --numerology 1 --band 78 --SLC 3600000000 --ue-txgain 0 --ue-rxgain 75 \
--usrp-args "type=n3xx,addr=192.168.10.2,subdev=A:0,master_clock_rate=122.88e6" \
--log_config.global_log_options time,nocolor --node-number 2 \
> ~/nearby2.log 2>&1'
#########################
#### RFSIMULATOR ####
#########################
### RX Nearby UE ###
nearby_usrp_b210_net2_hostIP = 10.1.1.63
nearby_usrp_b210_net2_cmd = cd $HOME/openairinterface5g/ci-scripts; \
python3 sl_rx_agent.py --cmd \
'sudo -E LD_LIBRARY_PATH=$HOME/openairinterface5g/cmake_targets/ran_build/build:$LD_LIBRARY_PATH \
$HOME/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
--sl-mode 2 --rbsl 52 --numerology 1 --band 78 --SLC 3600000000 --ue-rxgain 100 \
--usrp-args "type=b200,serial=3150384,clock_source=external" \
--log_config.global_log_options time,nocolor --node-number 3 \
> ~/nearby3.log 2>&1'
################################################################
#### RFSIMULATOR : SyncRef UE --- Nearby UE ####
################################################################
### TX SyncRef UE ###
syncref_rfsim_net1_cmd = \
sudo -E RFSIMULATOR=server \
$HOME/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
--sync-ref --rfsim --sl-mode 2 --rbsl 106 --SLC 3300000000 --ue-txgain 0 \
--rfsimulator.serverport 4048 --log_config.global_log_options time,nocolor \
> ~/syncref.log 2>&1
### RX Nearby UE ###
nearby_rfsim_cmd = \
nearby_rfsim_
net1_
cmd = \
sudo -E RFSIMULATOR=127.0.0.1 \
$HOME/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
--rfsim --sl-mode 2 --rbsl 106 --SLC 3300000000 --ue-rxgain 20 --rfsimulator.serverport 4048 \
--log_config.global_log_options time,nocolor \
> ~/rx.log 2>&1
--rfsim --sl-mode 2 --rbsl 106 --SLC 3300000000 --ue-rxgain 90 \
--rfsimulator.serverport 4048 --log_config.global_log_options time,nocolor \
> ~/nearby.log 2>&1
################################################################
#### RFSIMULATOR : SyncRef UE --- Relay UE --- Nearby UE ####
################################################################
### TX SyncRef UE ###
syncref_rfsim_cmd = \
syncref_rfsim_net2_cmd = \
sudo -E RFSIMULATOR=127.0.0.1 \
$HOME/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
--sync-ref --rfsim --sl-mode 2 --rbsl 52 --SLC 2600000000 --ue-txgain 0 --node-number 1 \
--rfsimulator.serverport 4048 --log_config.global_log_options time,nocolor \
> ~/syncref1.log 2>&1
### Relay UE ###
nearby_rfsim_net2_cmd = \
sudo -E RFSIMULATOR=server \
$HOME/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
--sync-ref --rfsim --sl-mode 2 --rbsl 106 --SLC 3300000000 --ue-txgain 0 --rfsimulator.serverport 4048 \
--log_config.global_log_options time,nocolor \
> ~/tx.log 2>&1
--rfsim --sl-mode 2 --rbsl 52 --SLC 2600000000 --ue-txgain 0 --ue-rxgain 90 --node-number 2 \
--rfsimulator.serverport 4048 --log_config.global_log_options time,nocolor \
> ~/nearby2.log 2>&1
### RX Nearby UE ###
nearby_rfsim_net2_cmd = \
sudo -E RFSIMULATOR=127.0.0.1 \
$HOME/openairinterface5g/cmake_targets/ran_build/build/nr-uesoftmodem \
--rfsim --sl-mode 2 --rbsl 52 --SLC 2600000000 --ue-rxgain 90 --node-number 3 \
--rfsimulator.serverport 4048 --log_config.global_log_options time,nocolor \
> ~/nearby3.log 2>&1
ci-scripts/sl_rx_agent.py
View file @
1e7fb04a
...
...
@@ -46,28 +46,32 @@ parser = argparse.ArgumentParser(description="""
Automated tests for 5G NR Sidelink Rx simulations
"""
)
parser
.
add_argument
(
'--
duration'
,
'-d'
,
metavar
=
'SECONDS'
,
type
=
int
,
default
=
20
,
help
=
"""
How long to run the test before stopping to examine the logs
parser
.
add_argument
(
'--
compress'
,
'-c'
,
action
=
'store_true'
,
help
=
"""
Compress the log files in the --log-dir
"""
)
parser
.
add_argument
(
'--cmd'
,
type
=
str
,
default
=
DEFAULT_USRP_CMD
,
help
=
"""
Commands
"""
)
parser
.
add_argument
(
'--
nid1'
,
type
=
int
,
default
=
10
,
help
=
"""
Nid1 value
parser
.
add_argument
(
'--
debug'
,
action
=
'store_true'
,
help
=
"""
Enable debug logging (for this script only)
"""
)
parser
.
add_argument
(
'--
nid2'
,
type
=
int
,
default
=
1
,
help
=
"""
Nid2 value
parser
.
add_argument
(
'--
duration'
,
'-d'
,
metavar
=
'SECONDS'
,
type
=
int
,
default
=
20
,
help
=
"""
How long to run the test before stopping to examine the logs
"""
)
parser
.
add_argument
(
'--log-dir'
,
default
=
HOME_DIR
,
help
=
"""
Where to store log files
"""
)
parser
.
add_argument
(
'--compress'
,
'-c'
,
action
=
'store_true'
,
help
=
"""
Compress the log files in the --log-dir
parser
.
add_argument
(
'--nid1'
,
type
=
int
,
default
=
10
,
help
=
"""
Nid1 value
"""
)
parser
.
add_argument
(
'--nid2'
,
type
=
int
,
default
=
1
,
help
=
"""
Nid2 value
"""
)
parser
.
add_argument
(
'--no-run'
,
'-n'
,
action
=
'store_true'
,
help
=
"""
...
...
@@ -75,10 +79,6 @@ Don't run the test, only examine the logs in the --log-dir
directory from a previous run of the test
"""
)
parser
.
add_argument
(
'--debug'
,
action
=
'store_true'
,
help
=
"""
Enable debug logging (for this script only)
"""
)
parser
.
add_argument
(
'--sci2'
,
action
=
'store_true'
,
help
=
"""
Enable SCI2 log parsing (this will grep the logs for the SCI2 payload)
"""
)
...
...
@@ -90,8 +90,6 @@ logging.basicConfig(level=logging.DEBUG if OPTS.debug else logging.INFO,
format
=
'>>> %(name)s: %(levelname)s: %(message)s'
)
LOGGER
=
logging
.
getLogger
(
os
.
path
.
basename
(
sys
.
argv
[
0
]))
log_file_path
=
os
.
path
.
join
(
OPTS
.
log_dir
,
'rx.log'
)
# ----------------------------------------------------------------------------
def
compress
(
from_name
:
str
,
to_name
:
Optional
[
str
]
=
None
,
remove_original
:
bool
=
False
)
->
None
:
...
...
@@ -159,69 +157,79 @@ class TestNearby():
"""
Represents TestNearby
"""
def
__init__
(
self
):
self
.
cmd
=
None
def
__init__
(
self
,
cmd
:
str
):
self
.
cmd
=
cmd
self
.
delay
=
0
# seconds
self
.
id
=
self
.
_get_id
(
cmd
)
self
.
role
=
"nearby"
self
.
log_file_path
=
os
.
path
.
join
(
OPTS
.
log_dir
,
f'
{
self
.
role
}{
self
.
id
}
.log'
)
def
run
(
self
,
cmd
:
str
)
->
bool
:
self
.
cmd
=
cmd
job
=
"nearby"
def
__str__
(
self
)
->
str
:
return
f'
{
self
.
role
}{
self
.
id
}
'
def
_get_id
(
self
)
->
str
:
node_id
=
''
if
'node-number'
in
self
.
cmd
:
node_id
=
self
.
cmd
.
split
(
'node-number'
)[
-
1
].
split
()[
0
]
return
node_id
def
run
(
self
)
->
bool
:
time
.
sleep
(
self
.
delay
)
proc
=
self
.
launch_nearby
(
job
)
proc
=
self
.
launch_nearby
()
LOGGER
.
info
(
f"nearby_proc =
{
proc
}
"
)
LOGGER
.
info
(
f"Process running...
{
job
}
"
)
LOGGER
.
info
(
f"Process running...
{
self
}
"
)
time
.
sleep
(
OPTS
.
duration
)
passed
=
self
.
kill_process
(
"nearby"
,
proc
)
passed
=
self
.
kill_process
(
proc
)
if
OPTS
.
compress
:
self
.
compress_log_file
(
proc
)
return
passed
def
launch_nearby
(
self
,
job
)
->
Popen
:
LOGGER
.
info
(
'Launching Nearby UE: %s'
,
log_file_path
)
cmd
=
self
.
cmd
proc
=
Popen
(
cmd
,
shell
=
True
)
def
launch_nearby
(
self
)
->
Popen
:
LOGGER
.
info
(
'Launching Nearby UE'
)
proc
=
Popen
(
self
.
cmd
,
shell
=
True
)
time
.
sleep
(
1
)
return
proc
def
kill_process
(
self
,
job
:
str
,
proc
:
Popen
)
->
bool
:
def
kill_process
(
self
,
proc
:
Popen
)
->
bool
:
passed
=
True
if
proc
:
status
=
proc
.
poll
()
if
status
is
None
:
LOGGER
.
info
(
'process is still running, which is good'
)
else
:
#
passed = False
passed
=
False
LOGGER
.
info
(
'process ended early: %r'
,
status
)
LOGGER
.
info
(
f'kill main simulation processes...
{
job
}
'
)
cmd
=
[
'sudo'
,
'killall'
]
cmd
.
append
(
'-KILL'
)
if
proc
:
LOGGER
.
info
(
f'
{
self
}
process ended early:
{
status
}
'
)
if
proc
and
passed
:
LOGGER
.
info
(
f'kill main simulation processes...
{
self
}
'
)
cmd
=
[
'sudo'
,
'killall'
]
cmd
.
append
(
'-KILL'
)
cmd
.
append
(
'nr-uesoftmodem'
)
if
"nearby"
==
job
:
if
"nearby"
==
self
.
role
:
subprocess
.
run
(
cmd
)
LOGGER
.
info
(
f'Waiting for PID proc.pid for
{
job
}
'
)
LOGGER
.
info
(
f'Waiting for PID proc.pid for
{
self
}
'
)
proc
.
kill
()
proc
.
wait
()
LOGGER
.
info
(
f'kill main simulation processes...done for
{
job
}
'
)
LOGGER
.
info
(
f'kill main simulation processes...done for
{
self
}
'
)
return
passed
def
compress_log_file
(
self
,
proc
:
Popen
):
jobs
=
CompressJobs
()
jobs
.
compress
(
log_file_path
)
jobs
.
compress
(
self
.
log_file_path
)
jobs
.
wait
()
# ----------------------------------------------------------------------------
def
main
(
argv
)
->
int
:
test_agent
=
TestNearby
()
test_agent
=
TestNearby
(
OPTS
.
cmd
)
log_agent
=
LogChecker
(
OPTS
,
LOGGER
)
passed
=
True
if
not
OPTS
.
no_run
:
passed
=
test_agent
.
run
(
OPTS
.
cmd
)
passed
=
test_agent
.
run
()
# Examine the logs to determine if the test passed
result
,
user_msg
=
log_agent
.
analyze_nearby_logs
(
exp_nid1
=
OPTS
.
nid1
,
exp_nid2
=
OPTS
.
nid2
,
sci2
=
OPTS
.
sci2
)
result
,
user_msg
=
log_agent
.
analyze_nearby_logs
(
OPTS
.
nid1
,
OPTS
.
nid2
,
OPTS
.
sci2
,
test_agent
.
log_file_path
)
if
not
result
or
not
user_msg
:
passed
=
False
...
...
executables/softmodem-common.h
View file @
1e7fb04a
...
...
@@ -138,6 +138,7 @@ extern "C"
#define NFAPI softmodem_params.nfapi
#define NSA softmodem_params.nsa
#define NODE_NUMBER softmodem_params.node_number
#define SL_DEST_ID softmodem_params.dest_id
#define NON_STOP softmodem_params.non_stop
#define EMULATE_L1 softmodem_params.emulate_l1
#define CONTINUOUS_TX softmodem_params.continuous_tx
...
...
@@ -182,6 +183,7 @@ extern int usrp_tx_thread;
{"chest-time", CONFIG_HLP_CHESTTIME, 0, iptr:&CHEST_TIME, defintval:0, TYPE_INT, 0}, \
{"nsa", CONFIG_HLP_NSA, PARAMFLAG_BOOL, iptr:&NSA, defintval:0, TYPE_INT, 0}, \
{"node-number", NULL, 0, u16ptr:&NODE_NUMBER, defuintval:0, TYPE_UINT16, 0}, \
{"dest", NULL, 0, u16ptr:&SL_DEST_ID, defuintval:0, TYPE_UINT16, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
{"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \
{"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \
...
...
@@ -191,7 +193,7 @@ extern int usrp_tx_thread;
{"sync-ref", CONFIG_HLP_SYNC_REF, PARAMFLAG_BOOL, iptr:&SYNC_REF, defintval:0, TYPE_INT, 0}, \
{"nid1", CONFIG_HLP_NID1, 0, iptr:&NID1, defintval:10, TYPE_INT, 0}, \
{"nid2", CONFIG_HLP_NID2, 0, iptr:&NID2, defintval:1, TYPE_INT, 0}, \
{"message", CONFIG_HLP_MSG, 0, strptr:&SL_USER_MSG, defstrval:
"EpiScience",
TYPE_STRING, 0}, \
{"message", CONFIG_HLP_MSG, 0, strptr:&SL_USER_MSG, defstrval:
NULL,
TYPE_STRING, 0}, \
}
#define CONFIG_HLP_NSA "Enable NSA mode \n"
...
...
@@ -287,6 +289,7 @@ typedef struct {
uint8_t
nfapi
;
int
nsa
;
uint16_t
node_number
;
uint16_t
dest_id
;
int
non_stop
;
int
emulate_l1
;
int
continuous_tx
;
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
View file @
1e7fb04a
...
...
@@ -330,8 +330,7 @@ int nr_sl_initial_sync(UE_nr_rxtx_proc_t *proc,
if
(
ret
==
0
)
{
nr_gold_psbch
(
ue
);
ret
=
nr_psbch_detection
(
proc
,
ue
,
0
,
&
phy_pdcch_config
);
if
((
proc
->
nr_slot_rx
!=
ue
->
slss
->
sl_timeoffsetssb_r16
)
&&
(
get_softmodem_params
()
->
node_number
))
{
if
((
ret
==
0
)
&&
(
proc
->
nr_slot_rx
!=
ue
->
slss
->
sl_timeoffsetssb_r16
)
&&
(
get_softmodem_params
()
->
node_number
))
{
LOG_I
(
PHY
,
"Filtering out the direct connection between SyncRef UE and Nearby UE when Relay UE exists.
\n
"
);
return
-
1
;
}
...
...
openair1/PHY/NR_UE_TRANSPORT/nr_slsch_ue.c
View file @
1e7fb04a
...
...
@@ -206,16 +206,7 @@ void nr_pssch_data_control_multiplexing(uint8_t *in_slssh,
uint32_t
get_B_multiplexed_value
(
NR_DL_FRAME_PARMS
*
fp
,
NR_DL_UE_HARQ_t
*
harq
)
{
uint8_t
number_of_symbols
=
harq
->
nb_symbols
;
uint16_t
nb_rb
=
harq
->
nb_rb
;
uint8_t
Nl
=
harq
->
Nl
;
uint8_t
mod_order
=
harq
->
Qm
;
uint16_t
dmrs_pos
=
harq
->
dlDmrsSymbPos
;
uint16_t
length_dmrs
=
get_num_dmrs
(
dmrs_pos
);
uint8_t
nb_dmrs_re_per_rb
=
6
*
harq
->
n_dmrs_cdm_groups
;
unsigned
int
G_slsch_bits
=
harq
->
G
;
uint32_t
B_mul
=
G_slsch_bits
+
harq
->
B_sci2
*
Nl
;
return
B_mul
;
...
...
@@ -280,7 +271,7 @@ void nr_ue_set_slsch_rx(PHY_VARS_NR_UE *ue, unsigned char harq_pid)
unsigned
int
TBS
=
nr_compute_tbs_sl
(
mod_order
,
code_rate
,
nb_rb
,
nb_re_sci1
,
nb_re_sci2
,
nb_symb_sch
,
nb_re_dmrs
*
length_dmrs
,
0
,
0
,
Nl
);
harq
->
TBS
=
TBS
>>
3
;
harq
->
G
=
nr_get_G_sl
(
nb_rb
,
nb_re_sci1
,
nb_re_sci2
,
harq
->
nb_symbols
,
nb_re_dmrs
,
length_dmrs
,
harq
->
Qm
,
harq
->
Nl
);
LOG_
I
(
NR_PHY
,
"mcs %u polar_encoder_output_len %u, code_rate %d, TBS %d
\n
"
,
Imcs
,
harq
->
B_sci2
,
code_rate
,
TBS
);
LOG_
D
(
NR_PHY
,
"mcs %u polar_encoder_output_len %u, code_rate %d, TBS %d
\n
"
,
Imcs
,
harq
->
B_sci2
,
code_rate
,
TBS
);
harq
->
status
=
ACTIVE
;
nfapi_nr_pssch_pdu_t
*
rel16_sl_rx
=
&
harq
->
pssch_pdu
;
...
...
@@ -309,7 +300,6 @@ void nr_ue_set_slsch(NR_DL_FRAME_PARMS *fp,
uint8_t
slot
)
{
NR_UL_UE_HARQ_t
*
harq
=
slsch
->
harq_processes
[
harq_pid
];
uint8_t
nb_codewords
=
1
;
uint8_t
N_PRB_oh
=
0
;
uint16_t
nb_symb_sch
=
12
;
uint16_t
nb_symb_cch
=
3
;
// Assumption there are three SLCCH symbols
int
nb_rb
=
get_PRB
(
fp
->
N_RB_SL
);
...
...
@@ -330,7 +320,6 @@ void nr_ue_set_slsch(NR_DL_FRAME_PARMS *fp,
uint8_t
length_dmrs
=
get_num_dmrs
(
dmrsSymbPos
);
uint16_t
code_rate
=
nr_get_code_rate_ul
(
Imcs
,
0
);
uint8_t
mod_order
=
nr_get_Qm_ul
(
Imcs
,
0
);
uint16_t
nb_symb_psfch
=
0
;
harq
->
pssch_pdu
.
mcs_index
=
Imcs
;
harq
->
pssch_pdu
.
nrOfLayers
=
Nl
;
harq
->
pssch_pdu
.
rb_size
=
nb_rb
;
...
...
@@ -354,7 +343,6 @@ void nr_ue_set_slsch(NR_DL_FRAME_PARMS *fp,
nb_re_dmrs
=
4
*
harq
->
pssch_pdu
.
num_dmrs_cdm_grps_no_data
;
}
uint16_t
N_RE_prime
=
NR_NB_SC_PER_RB
*
(
nb_symb_sch
-
nb_symb_psfch
)
-
nb_re_dmrs
-
N_PRB_oh
;
uint16_t
nb_re_sci1
=
nb_symb_cch
*
NB_RB_SCI1
*
NR_NB_SC_PER_RB
;
uint16_t
polar_encoder_output_len
=
polar_encoder_output_length
(
code_rate
,
harq
->
num_of_mod_symbols
);
uint8_t
SCI2_mod_order
=
2
;
...
...
@@ -369,31 +357,34 @@ void nr_ue_set_slsch(NR_DL_FRAME_PARMS *fp,
unsigned
char
*
test_input
=
harq
->
a
;
uint64_t
*
sci_input
=
harq
->
a_sci2
;
bool
payload_type_string
=
false
;
char
*
sl_user_msg
=
get_softmodem_params
()
->
sl_user_msg
;
uint32_t
sl_user_msg_len
=
(
sl_user_msg
!=
NULL
)
?
strlen
(
sl_user_msg
)
:
0
;
bool
payload_type_string
=
(
sl_user_msg_len
>
0
)
?
true
:
false
;
if
(
qsize_of_relay_data
()
==
0
)
{
if
(
payload_type_string
)
{
for
(
int
i
=
0
;
i
<
32
;
i
++
)
{
test_input
[
i
]
=
get_softmodem_params
()
->
sl_user_msg
[
i
];
}
memcpy
(
test_input
,
sl_user_msg
,
sl_user_msg_len
);
LOG_D
(
NR_PHY
,
"SLSCH_TX will send %s
\n
"
,
test_input
);
}
else
{
srand
(
time
(
NULL
));
for
(
int
i
=
0
;
i
<
TBS
/
8
;
i
++
)
test_input
[
i
]
=
(
unsigned
char
)
(
i
+
3
)
;
//rand();
test_input
[
0
]
=
(
unsigned
char
)
(
slot
);
test_input
[
1
]
=
(
unsigned
char
)
(
frame
&
0xFF
);
// 8 bits LSB
test_input
[
2
]
=
(
unsigned
char
)
((
frame
>>
8
)
&
0x3
);
//
test_input
[
3
]
=
(
unsigned
char
)
((
frame
&
0x111
)
<<
5
)
+
(
unsigned
char
)
(
slot
)
+
rand
()
%
256
;
for
(
int
i
=
0
;
i
<
min
(
32
,
TBS
/
8
)
;
i
++
)
test_input
[
i
]
=
'0'
+
(
unsigned
char
)
(
i
+
3
)
%
10
;
//rand();
//
test_input[0] = (unsigned char) (slot);
//
test_input[1] = (unsigned char) (frame & 0xFF); // 8 bits LSB
//
test_input[2] = (unsigned char) ((frame >> 8) & 0x3); //
//
test_input[3] = (unsigned char) ((frame & 0x111) << 5) + (unsigned char) (slot) + rand() % 256;
LOG_D
(
NR_PHY
,
"SLSCH_TX will send %u
\n
"
,
test_input
[
3
]);
}
uint64_t
u
=
0
;
uint64_t
dest
=
0
;
dest
=
(
0x2
+
((
slot
%
2
)
==
0
?
1
:
0
))
*
get_softmodem_params
()
->
node_number
;
u
^=
(
dest
<<
32
);
uint64_t
dest_id
=
(
0x2
+
((
slot
%
2
)
==
0
?
1
:
0
))
*
get_softmodem_params
()
->
node_number
;
dest_id
=
(
0x2
+
((
slot
%
2
)
==
0
?
1
:
0
))
*
get_softmodem_params
()
->
node_number
;
if
(
get_softmodem_params
()
->
dest_id
>
0
)
dest_id
=
get_softmodem_params
()
->
dest_id
;
u
^=
(
dest_id
<<
32
);
*
sci_input
=
u
;
}
else
{
get_relay_data_from_buffer
(
test_input
,
sci_input
,
TBS
/
8
);
uint64_t
dest
=
(
*
sci_input
>>
32
)
&
0xFFFF
;
LOG_W
(
NR_PHY
,
"SLSCH_TX will forward with original slot index %u for dest %
d
\n
"
,
test_input
[
0
],
dest
);
LOG_W
(
NR_PHY
,
"SLSCH_TX will forward with original slot index %u for dest %
lu
\n
"
,
test_input
[
0
],
dest
);
}
}
...
...
@@ -404,7 +395,6 @@ void nr_ue_slsch_tx_procedures(PHY_VARS_NR_UE *txUE,
LOG_D
(
NR_PHY
,
"nr_ue_slsch_tx_procedures hard_id %d %d.%d
\n
"
,
harq_pid
,
frame
,
slot
);
uint8_t
nb_dmrs_re_per_rb
;
NR_DL_FRAME_PARMS
*
frame_parms
=
&
txUE
->
frame_parms
;
int32_t
**
txdataF
=
txUE
->
common_vars
.
txdataF
;
...
...
@@ -416,11 +406,6 @@ void nr_ue_slsch_tx_procedures(PHY_VARS_NR_UE *txUE,
uint16_t
nb_rb
=
pssch_pdu
->
rb_size
;
uint8_t
Nl
=
pssch_pdu
->
nrOfLayers
;
uint8_t
mod_order
=
pssch_pdu
->
qam_mod_order
;
uint8_t
cdm_grps_no_data
=
pssch_pdu
->
num_dmrs_cdm_grps_no_data
;
uint16_t
dmrs_pos
=
pssch_pdu
->
sl_dmrs_symb_pos
;
uint16_t
length_dmrs
=
get_num_dmrs
(
dmrs_pos
);
nb_dmrs_re_per_rb
=
6
*
cdm_grps_no_data
;
/////////////////////////SLSCH data and SCI2 encoding/////////////////////////
unsigned
int
G_slsch_bits
=
harq_process_ul_ue
->
G
;
...
...
@@ -808,12 +793,10 @@ uint32_t nr_ue_slsch_rx_procedures(PHY_VARS_NR_UE *rxUE,
int
nb_re_SCI2
=
slsch_ue_rx
->
harq_processes
[
0
]
->
B_sci2
/
SCI2_mod_order
;
uint8_t
nb_re_dmrs
=
6
*
slsch_ue_rx_harq
->
n_dmrs_cdm_groups
;
uint32_t
dmrs_data_re
=
12
-
nb_re_dmrs
;
uint16_t
length_dmrs
=
get_num_dmrs
(
dmrs_pos
);
unsigned
int
G
=
slsch_ue_rx_harq
->
G
;
uint16_t
num_data_symbs
=
(
G
<<
1
)
/
mod_order
;
uint32_t
M_SCI2_bits
=
slsch_ue_rx
->
harq_processes
[
0
]
->
B_sci2
*
Nl
;
uint16_t
num_sci2_symbs
=
(
M_SCI2_bits
<<
1
)
/
SCI2_mod_order
;
uint16_t
num_sci2_samples
=
num_sci2_symbs
>>
1
;
int
avgs
=
0
;
int
avg
[
16
];
...
...
openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
View file @
1e7fb04a
...
...
@@ -1468,7 +1468,6 @@ int phy_procedures_nrUE_SL_RX(PHY_VARS_NR_UE *ue,
int32_t
**
rxdataF
=
ue
->
common_vars
.
common_vars_rx_data_per_thread
[
0
].
rxdataF
;
uint64_t
rx_offset
=
(
slot_rx
&
3
)
*
(
ue
->
frame_parms
.
symbols_per_slot
*
ue
->
frame_parms
.
ofdm_symbol_size
);
bool
payload_type_string
=
false
;
static
bool
detect_new_dest
;
uint16_t
node_id
=
get_softmodem_params
()
->
node_number
;
uint32_t
B_mul
=
get_B_multiplexed_value
(
&
ue
->
frame_parms
,
slsch
->
harq_processes
[
0
]);
...
...
@@ -1485,10 +1484,12 @@ int phy_procedures_nrUE_SL_RX(PHY_VARS_NR_UE *ue,
}
uint32_t
ret
=
nr_ue_slsch_rx_procedures
(
ue
,
harq_pid
,
frame_rx
,
slot_rx
,
rxdataF
,
B_mul
,
Nidx
,
proc
);
bool
payload_type_string
=
true
;
bool
polar_decoded
=
(
ret
<
LDPC_MAX_LIMIT
)
?
true
:
false
;
uint16_t
dest
=
(
*
harq
->
b_sci2
>>
32
)
&
0xFFFF
;
bool
dest_matched
=
(
dest
==
node_id
);
LOG_I
(
PHY
,
"dest %u vs %u node_id for hex %lx
\n
"
,
dest
,
node_id
,
*
harq
->
b_sci2
);
if
(
polar_decoded
)
LOG_D
(
PHY
,
"dest %u vs %u node_id for hex %lx
\n
"
,
dest
,
node_id
,
*
harq
->
b_sci2
);
if
((
ret
!=
-
1
)
&&
dest_matched
)
{
if
(
payload_type_string
)
validate_rx_payload_str
(
harq
,
slot_rx
,
polar_decoded
);
...
...
@@ -1513,13 +1514,13 @@ int phy_procedures_nrUE_SL_RX(PHY_VARS_NR_UE *ue,
return
(
0
);
}
#define DEBUG_NR_PSSCHSIM
void
/* The above code is likely defining a function called "validate_rx_payload" in the C programming
language. */
/* The above code is likely a function or method called "validate_rx_payload" written in the C
programming language. However, without the actual code implementation, it is not possible to
determine what the function does. */
validate_rx_payload
(
NR_DL_UE_HARQ_t
*
harq
,
int
frame_rx
,
int
slot_rx
,
bool
polar_decoded
)
{
#define DEBUG_NR_PSSCHSIM
unsigned
int
errors_bit
=
0
;
unsigned
int
n_false_positive
=
0
;
#ifdef DEBUG_NR_PSSCHSIM
...
...
@@ -1546,7 +1547,7 @@ validate_rx_payload(NR_DL_UE_HARQ_t *harq, int frame_rx, int slot_rx, bool polar
if
(
i
==
8
*
2
)
frame_tx
+=
(
harq
->
b
[
2
]
<<
8
);
if
(
i
==
8
*
3
)
randm_tx
=
harq
->
b
[
3
];
if
(
i
>=
8
*
comparison_beg_byte
)
LOG_I
(
PHY
,
"TxByte : %4u vs %4u
: RxByte
\n
"
,
test_input
[
i
/
8
],
harq
->
b
[
i
/
8
]);
LOG_I
(
NR_PHY
,
"TxByte : %4c vs %4c
: RxByte
\n
"
,
test_input
[
i
/
8
],
harq
->
b
[
i
/
8
]);
}
LOG_D
(
NR_PHY
,
"tx bit: %u, rx bit: %u
\n
"
,
test_input_bit
[
i
],
estimated_output_bit
[
i
]);
...
...
@@ -1558,43 +1559,49 @@ validate_rx_payload(NR_DL_UE_HARQ_t *harq, int frame_rx, int slot_rx, bool polar
}
}
LOG_I
(
PHY
,
"TxRandm: %4u
\n
"
,
randm_tx
);
LOG_I
(
PHY
,
"TxFrame: %4u vs %4u : RxFrame
\n
"
,
frame_tx
,
(
uint32_t
)
frame_rx
);
LOG_I
(
PHY
,
"TxSlot : %4u vs %4u : RxSlot
\n
"
,
slot_tx
,
(
uint8_t
)
slot_rx
);
LOG_I
(
NR_PHY
,
"TxRandm: %4u
\n
"
,
randm_tx
);
LOG_I
(
NR_PHY
,
"TxFrame: %4u vs %4u : RxFrame
\n
"
,
frame_tx
,
(
uint32_t
)
frame_rx
);
LOG_I
(
NR_PHY
,
"TxSlot : %4u vs %4u : RxSlot
\n
"
,
slot_tx
,
(
uint8_t
)
slot_rx
);
}
#endif
if
(
errors_bit
>
0
||
polar_decoded
==
false
)
{
n_false_positive
++
;
++
sum_failed
;
LOG_I
(
PHY
,
"errors_bit %u, polar_decoded %d
\n
"
,
errors_bit
,
polar_decoded
);
LOG_I
(
PHY
,
"PSSCH test NG with %d / %d = %4.2f
\n
"
,
sum_passed
,
(
sum_passed
+
sum_failed
),
(
float
)
sum_passed
/
(
float
)
(
sum_passed
+
sum_failed
));
LOG_I
(
NR_PHY
,
"errors_bit %u, polar_decoded %d
\n
"
,
errors_bit
,
polar_decoded
);
LOG_I
(
NR_
PHY
,
"PSSCH test NG with %d / %d = %4.2f
\n
"
,
sum_passed
,
(
sum_passed
+
sum_failed
),
(
float
)
sum_passed
/
(
float
)
(
sum_passed
+
sum_failed
));
}
else
{
++
sum_passed
;
LOG_I
(
PHY
,
"PSSCH test OK with %d / %d = %4.2f
\n
"
,
sum_passed
,
(
sum_passed
+
sum_failed
),
(
float
)
sum_passed
/
(
float
)
(
sum_passed
+
sum_failed
));
LOG_I
(
NR_
PHY
,
"PSSCH test OK with %d / %d = %4.2f
\n
"
,
sum_passed
,
(
sum_passed
+
sum_failed
),
(
float
)
sum_passed
/
(
float
)
(
sum_passed
+
sum_failed
));
// if (slot_rx ==4)
// exit(0);
}
}
void
validate_rx_payload_str
(
NR_DL_UE_HARQ_t
*
harq
,
int
slot
,
bool
polar_decoded
)
{
#define MAX_MSG_SIZE 128
unsigned
int
errors_bit
=
0
;
unsigned
char
estimated_output_bit
[
HNA_SIZE
];
unsigned
char
test_input_bit
[
HNA_SIZE
];
char
estimated_output_bit
[
HNA_SIZE
];
char
test_input_bit
[
HNA_SIZE
];
unsigned
int
n_false_positive
=
0
;
unsigned
char
test_input
[]
=
"EpiScience"
;
char
default_input
[
MAX_MSG_SIZE
]
=
""
;
char
*
sl_user_msg
=
get_softmodem_params
()
->
sl_user_msg
;
char
*
test_input
=
(
sl_user_msg
!=
NULL
)
?
sl_user_msg
:
default_input
;
uint32_t
default_msg_len
=
(
sl_user_msg
!=
NULL
)
?
strlen
(
sl_user_msg
)
:
MAX_MSG_SIZE
;
uint32_t
test_msg_len
=
min
(
max
(
10
,
strlen
((
char
*
)
harq
->
b
)),
min
(
default_msg_len
,
harq
->
TBS
));
static
uint16_t
sum_passed
=
0
;
static
uint16_t
sum_failed
=
0
;
uint8_t
comparison_end_byte
=
10
;
uint8_t
comparison_end_byte
=
test_msg_len
;
if
(
polar_decoded
==
true
)
{
for
(
int
i
=
0
;
i
<
min
(
32
,
harq
->
TBS
)
*
8
;
i
++
)
{
//max tx string size is 32 bytes
for
(
int
i
=
0
;
i
<
test_msg_len
*
8
;
i
++
)
{
//max tx string size is 32 bytes
estimated_output_bit
[
i
]
=
(
harq
->
b
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
test_input_bit
[
i
]
=
(
test_input
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
// Further correct for multiple segments
if
(
i
%
8
==
0
){
LOG_D
(
PHY
,
"TxByte : %c vs %c : RxByte
\n
"
,
test_input
[
i
/
8
],
harq
->
b
[
i
/
8
]);
LOG_D
(
NR_PHY
,
"TxByte : %c vs %c : RxByte
\n
"
,
test_input
[
i
/
8
],
harq
->
b
[
i
/
8
]);
}
#ifdef DEBUG_NR_PSSCHSIM
LOG_
I
(
NR_PHY
,
"tx bit: %u, rx bit: %u
\n
"
,
test_input_bit
[
i
],
estimated_output_bit
[
i
]);
LOG_
D
(
NR_PHY
,
"tx bit: %u, rx bit: %u
\n
"
,
test_input_bit
[
i
],
estimated_output_bit
[
i
]);
#endif
if
(
i
>=
8
*
comparison_end_byte
)
break
;
...
...
@@ -1602,30 +1609,28 @@ void validate_rx_payload_str(NR_DL_UE_HARQ_t *harq, int slot, bool polar_decoded
errors_bit
++
;
}
}
}
if
(
errors_bit
>
0
||
polar_decoded
==
false
)
{
static
unsigned
char
result
[
128
];
for
(
int
i
=
0
;
i
<
min
(
128
,
harq
->
TBS
);
i
++
)
{
static
char
result
[
MAX_MSG_SIZE
];
for
(
int
i
=
0
;
i
<
test_msg_len
;
i
++
)
{
result
[
i
]
=
harq
->
b
[
i
];
LOG_D
(
PHY
,
"result[%d]=%c
\n
"
,
i
,
result
[
i
]);
LOG_D
(
NR_
PHY
,
"result[%d]=%c
\n
"
,
i
,
result
[
i
]);
}
unsigned
char
*
usr_msg_ptr
=
&
result
[
0
];
char
*
usr_msg_ptr
=
&
result
[
0
];
char
tmp_flag
[
128
];
memset
(
tmp_flag
,
'+'
,
strlen
(
"Received your text! It says: "
)
+
test_msg_len
);
LOG_I
(
NR_PHY
,
"%s
\n
"
,
tmp_flag
);
LOG_I
(
NR_PHY
,
"Received your text! It says: %s
\n
"
,
usr_msg_ptr
);
LOG_I
(
PHY
,
"Decoded_payload for slot %d: %s
\n
"
,
slot
,
result
);
LOG_D
(
NR_PHY
,
"Decoded_payload for slot %d: %s
\n
"
,
slot
,
result
);
LOG_I
(
NR_PHY
,
"%s
\n
"
,
tmp_flag
);
}
if
(
errors_bit
>
0
||
polar_decoded
==
false
)
{
n_false_positive
++
;
++
sum_failed
;
LOG_I
(
PHY
,
"errors_bit %u, polar_decoded %d
\n
"
,
errors_bit
,
polar_decoded
);
LOG_I
(
PHY
,
"PSSCH test NG with %d / %d = %4.2f
\n
"
,
sum_passed
,
(
sum_passed
+
sum_failed
),
(
float
)
sum_passed
/
(
float
)
(
sum_passed
+
sum_failed
));
}
else
{
static
unsigned
char
result
[
128
];
for
(
int
i
=
0
;
i
<
min
(
128
,
harq
->
TBS
);
i
++
)
{
result
[
i
]
=
harq
->
b
[
i
];
LOG_D
(
PHY
,
"result[%d]=%c
\n
"
,
i
,
result
[
i
]);
}
++
sum_passed
;
unsigned
char
*
usr_msg_ptr
=
&
result
[
0
];
LOG_I
(
NR_PHY
,
"Received your text! It says: %s
\n
"
,
usr_msg_ptr
);
LOG_I
(
PHY
,
"Decoded_payload for slot %d: %s
\n
"
,
slot
,
result
);
LOG_I
(
PHY
,
"PSSCH test OK with %d / %d = %4.2f
\n
"
,
sum_passed
,
(
sum_passed
+
sum_failed
),
(
float
)
sum_passed
/
(
float
)
(
sum_passed
+
sum_failed
));
}
}
...
...
openair1/SIMULATION/NR_PHY/psschsim.c
View file @
1e7fb04a
...
...
@@ -111,6 +111,7 @@ int loglvl = OAILOG_WARNING;
int
seed
=
0
;
int
mcs
=
0
;
uint16_t
node_id
=
0
;
char
user_msg
[
128
]
=
""
;
static
void
get_sim_cl_opts
(
int
argc
,
char
**
argv
)
{
...
...
@@ -173,6 +174,10 @@ static void get_sim_cl_opts(int argc, char **argv)
slot
=
atoi
(
optarg
);
break
;
case
'M'
:
mcs
=
atoi
(
optarg
);
break
;
case
'm'
:
mu
=
atoi
(
optarg
);
break
;
...
...
@@ -195,7 +200,7 @@ static void get_sim_cl_opts(int argc, char **argv)
break
;
case
't'
:
m
cs
=
atoi
(
optarg
);
m
emcpy
(
user_msg
,
optarg
,
strlen
(
optarg
)
+
1
);
break
;
case
'y'
:
...
...
@@ -216,7 +221,7 @@ static void get_sim_cl_opts(int argc, char **argv)
default:
case
'h'
:
printf
(
"%s -h(elp) -g channel_model -n n_frames -s snr0 -S snr1 -p(extended_prefix) -y TXant -z RXant -M
-N cell_id -R -F input_filename -m -l -r
\n
"
,
argv
[
0
]);
printf
(
"%s -h(elp) -g channel_model -n n_frames -s snr0 -S snr1 -p(extended_prefix) -y TXant -z RXant -M
MCS -N cell_id -R -F input_filename -m -l -r -t user_message_to_send
\n
"
,
argv
[
0
]);
//printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", argv[0]);
printf
(
"-h This message
\n
"
);
printf
(
"-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)
\n
"
);
...
...
@@ -229,9 +234,10 @@ static void get_sim_cl_opts(int argc, char **argv)
printf
(
"-W number of layer
\n
"
);
printf
(
"-r N_RB_SL
\n
"
);
printf
(
"-F Input filename (.txt format) for RX conformance testing
\n
"
);
printf
(
"-
m
MCS
\n
"
);
printf
(
"-
M
MCS
\n
"
);
printf
(
"-l number of symbol
\n
"
);
printf
(
"-r number of RB
\n
"
);
printf
(
"-t User message to send
\n
"
);
exit
(
-
1
);
break
;
}
...
...
@@ -359,7 +365,6 @@ int main(int argc, char **argv)
exit_fun
(
"[NR_PSSCHSIM] Error, configuration module init failed
\n
"
);
}
get_sim_cl_opts
(
argc
,
argv
);
char
user_msg
[
128
]
=
"EpiScience"
;
get_softmodem_params
()
->
sl_user_msg
=
user_msg
;
randominit
(
0
);
// logging initialization
...
...
@@ -450,7 +455,7 @@ int main(int argc, char **argv)
unsigned
int
n_errors
=
0
;
unsigned
int
n_false_positive
=
0
;
unsigned
int
errors_bit_delta
=
0
;
unsigned
int
num_bytes_to_check
=
8
0
;
unsigned
int
num_bytes_to_check
=
1
0
;
//double modulated_input[HNA_SIZE];
unsigned
char
test_input_bit
[
HNA_SIZE
];
//short channel_output_uncoded[HNA_SIZE];
...
...
@@ -512,11 +517,14 @@ int main(int argc, char **argv)
txUE
->
slsch
[
0
][
0
]
->
Nidx
,
&
proc
);
uint32_t
rx_msg_len
=
strlen
((
char
*
)
harq_process_rxUE
->
b
);
bool
payload_type_string
=
rx_msg_len
?
true
:
false
;
num_bytes_to_check
=
payload_type_string
?
min
(
rx_msg_len
,
harq_process_rxUE
->
TBS
)
:
min
(
num_bytes_to_check
,
harq_process_rxUE
->
TBS
);
bool
polar_decoded
=
(
ret
<
LDPC_MAX_LIMIT
)
?
true
:
false
;
if
(
ret
!=
-
1
)
{
errors_bit_delta
=
0
;
bool
payload_type_string
=
false
;
for
(
int
i
=
0
;
i
<
num_bytes_to_check
;
i
++
)
{
for
(
int
i
=
0
;
i
<
num_bytes_to_check
*
8
;
i
++
)
{
estimated_output_bit
[
i
]
=
(
harq_process_rxUE
->
b
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
test_input_bit
[
i
]
=
(
txUE
->
slsch
[
0
][
0
]
->
harq_processes
[
harq_pid
]
->
a
[
i
/
8
]
&
(
1
<<
(
i
&
7
)))
>>
(
i
&
7
);
// Further correct for multiple segments
#ifdef DEBUG_NR_PSSCHSIM
...
...
@@ -546,7 +554,7 @@ int main(int argc, char **argv)
printf
(
"*****************************************
\n
"
);
printf
(
"SNR %f, BLER %f BER %f
\n
"
,
SNR
,
(
float
)
n_errors
/
(
float
)
n_trials
,
(
float
)
errors_bit
/
(
float
)
(
n_trials
*
num_bytes_to_check
));
(
float
)
errors_bit
/
(
float
)
(
n_trials
*
num_bytes_to_check
*
8
));
printf
(
"*****************************************
\n
"
);
printf
(
"
\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