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
0124e537
Commit
0124e537
authored
Jun 06, 2020
by
Florian Kaltenberger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding possibility to read rx signal from file
parent
06ee95f4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
3 deletions
+28
-3
openair1/SIMULATION/NR_PHY/prachsim.c
openair1/SIMULATION/NR_PHY/prachsim.c
+28
-3
No files found.
openair1/SIMULATION/NR_PHY/prachsim.c
View file @
0124e537
...
...
@@ -99,7 +99,9 @@ int main(int argc, char **argv){
// double prach_sinr;
// uint32_t nsymb;
// uint16_t preamble_max, preamble_energy_max;
FILE
*
input_fd
=
NULL
;
char
*
input_file
=
NULL
;
int
n_bytes
=
0
;
NR_DL_FRAME_PARMS
*
frame_parms
;
NR_PRACH_RESOURCES_t
prach_resources
;
...
...
@@ -292,6 +294,14 @@ int main(int argc, char **argv){
break
;
case
'F'
:
input_fd
=
fopen
(
optarg
,
"r"
);
input_file
=
optarg
;
if
(
input_fd
==
NULL
)
{
printf
(
"Problem with filename %s
\n
"
,
optarg
);
exit
(
-
1
);
}
break
;
default:
...
...
@@ -647,7 +657,7 @@ int main(int argc, char **argv){
for
(
trial
=
0
;
trial
<
n_frames
;
trial
++
)
{
if
(
input_fd
==
NULL
)
{
sigma2_dB
=
10
*
log10
((
double
)
tx_lev
)
-
SNR
-
10
*
log10
(
N_RB_UL
*
12
/
N_ZC
);
if
(
n_frames
==
1
)
...
...
@@ -673,6 +683,15 @@ int main(int argc, char **argv){
((
short
*
)
&
ru
->
common
.
rxdata
[
aa
][
rx_prach_start
])[
2
*
i
+
1
]
=
(
short
)
(.
167
*
(
r_im
[
aa
][
i
]
+
(
iqim
*
r_re
[
aa
][
i
])
+
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
)));
}
}
}
else
{
n_bytes
=
fread
(
&
ru
->
common
.
rxdata
[
0
][
rx_prach_start
+
frame_parms
->
samples_per_subframe
/
2
],
sizeof
(
int32_t
),
frame_parms
->
samples_per_subframe
/
2
,
input_fd
);
printf
(
"fread %d bytes from file %s
\n
"
,
n_bytes
,
input_file
);
if
(
n_bytes
!=
frame_parms
->
samples_per_subframe
/
2
)
{
printf
(
"expected %d bytes
\n
"
,
frame_parms
->
samples_per_subframe
/
2
);
exit
(
-
1
);
}
}
rx_nr_prach_ru
(
ru
,
prach_format
,
numRA
,
prachStartSymbol
,
frame
,
slot
);
...
...
@@ -695,7 +714,7 @@ int main(int argc, char **argv){
LOG_M
(
"prach0.m"
,
"prach0"
,
&
txdata
[
0
][
prach_start
],
frame_parms
->
samples_per_subframe
,
1
,
1
);
LOG_M
(
"prachF0.m"
,
"prachF0"
,
&
gNB
->
prach_vars
.
prachF
[
0
],
N_ZC
,
1
,
1
);
LOG_M
(
"rxsig0.m"
,
"rxs0"
,
&
gNB
->
common_vars
.
rxdata
[
0
][
rx_prach_start
],
frame_parms
->
samples_per_subframe
,
1
,
1
);
//
LOG_M("ru_rxsig0.m","rxs0", &ru->common.rxdata[0][rx_prach_start], frame_parms->samples_per_subframe, 1, 1);
LOG_M
(
"ru_rxsig0.m"
,
"rxs0"
,
&
ru
->
common
.
rxdata
[
0
][
rx_prach_start
],
frame_parms
->
samples_per_subframe
,
1
,
1
);
LOG_M
(
"rxsigF0.m"
,
"rxsF0"
,
gNB
->
prach_vars
.
rxsigF
[
0
],
N_ZC
,
1
,
1
);
LOG_M
(
"prach_preamble.m"
,
"prachp"
,
&
gNB
->
X_u
[
0
],
N_ZC
,
1
,
1
);
LOG_M
(
"ue_prach_preamble.m"
,
"prachp"
,
&
UE
->
X_u
[
0
],
N_ZC
,
1
,
1
);
...
...
@@ -703,6 +722,8 @@ int main(int argc, char **argv){
}
}
printf
(
"SNR %f dB, UE Speed %f km/h: errors %d/%d (delay %f)
\n
"
,
SNR
,
ue_speed
,
prach_errors
,
n_frames
,
delay_avg
/
(
double
)(
n_frames
-
prach_errors
));
if
(
input_fd
)
break
;
if
(
prach_errors
)
break
;
}
// UE Speed loop
...
...
@@ -710,6 +731,8 @@ int main(int argc, char **argv){
printf
(
"PRACH test OK
\n
"
);
break
;
}
if
(
input_fd
)
break
;
}
//SNR loop
for
(
i
=
0
;
i
<
2
;
i
++
)
{
...
...
@@ -724,5 +747,7 @@ int main(int argc, char **argv){
free
(
r_re
);
free
(
r_im
);
if
(
input_fd
)
fclose
(
input_fd
);
return
(
0
);
}
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