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
zzha zzha
OpenXG-RAN
Commits
b6f0546f
Commit
b6f0546f
authored
Sep 16, 2021
by
rmagueta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix nr_pucchsim
parent
11506316
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
openair1/SIMULATION/NR_PHY/pucchsim.c
openair1/SIMULATION/NR_PHY/pucchsim.c
+17
-15
No files found.
openair1/SIMULATION/NR_PHY/pucchsim.c
View file @
b6f0546f
...
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
...
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
//unsigned char frame_type = 0;
//unsigned char frame_type = 0;
int
loglvl
=
OAILOG_WARNING
;
int
loglvl
=
OAILOG_WARNING
;
int
sr_flag
=
0
;
int
sr_flag
=
0
;
int
pucch_DTX_thres
=
0
;
int
pucch_DTX_thres
=
10
0
;
cpuf
=
get_cpu_freq_GHz
();
cpuf
=
get_cpu_freq_GHz
();
if
(
load_configmodule
(
argc
,
argv
,
CONFIG_ENABLECMDLINEONLY
)
==
0
)
{
if
(
load_configmodule
(
argc
,
argv
,
CONFIG_ENABLECMDLINEONLY
)
==
0
)
{
...
@@ -544,18 +544,17 @@ int main(int argc, char **argv)
...
@@ -544,18 +544,17 @@ int main(int argc, char **argv)
// SNR Computation
// SNR Computation
// standard says: SNR = S / N, where S is the total signal energy, N is the noise energy in the transmission bandwidth (i.e. N_RB_DL resource blocks)
// standard says: SNR = S / N, where S is the total signal energy, N is the noise energy in the transmission bandwidth (i.e. N_RB_DL resource blocks)
// txlev = S. Note: signal_energy_nodc normalizes by the length of the vector, so multiply output by ofdm_symbol_size
// txlev = S.
double
txlev
=
do_DTX
==
0
?
signal_energy_nodc
(
&
txdataF
[
0
][
startingSymbolIndex
*
frame_parms
->
ofdm_symbol_size
],
int
txlev
=
signal_energy
(
&
txdataF
[
0
][
startingSymbolIndex
*
frame_parms
->
ofdm_symbol_size
],
frame_parms
->
ofdm_symbol_size
);
frame_parms
->
ofdm_symbol_size
)
*
(
double
)
frame_parms
->
ofdm_symbol_size
:
1e5
;
int
N_RB
=
(
format
==
0
||
format
==
1
)
?
1
:
nrofPRB
;
// sigma2 is variance per dimension, so N/(N_RB*12)
// sigma2 is variance per dimension, so N/(N_RB*12)
// so, sigma2 = N/(N_RB_DL*12) => (S/SNR)/(N_RB*12)
// so, sigma2 = N/(N_RB_DL*12) => (S/SNR)/(N_RB*12)
int
N_RB
=
(
format
==
0
||
format
==
1
)
?
1
:
nrofPRB
;
sigma2_dB
=
10
*
log10
(
txlev
/
(
12
.
0
*
N_RB
))
-
SNR
;
sigma2_dB
=
10
*
log10
(
txlev
/
(
12
.
0
*
N_RB
))
-
SNR
;
sigma2
=
pow
(
10
.
0
,
sigma2_dB
/
10
.
0
);
sigma2
=
pow
(
10
.
0
,
sigma2_dB
/
10
.
0
);
if
(
n_trials
==
1
)
printf
(
"txlev %f (%f dB), offset %d, sigma2 %f ( %f dB)
\n
"
,
txlev
,
10
*
log10
(
txlev
),
startingSymbolIndex
*
frame_parms
->
ofdm_symbol_size
,
sigma2
,
sigma2_dB
);
random_channel
(
UE2gNB
,
0
);
if
(
n_trials
==
1
)
printf
(
"txlev %d (%f dB), offset %d, sigma2 %f ( %f dB)
\n
"
,
txlev
,
10
*
log10
(
txlev
),
startingSymbolIndex
*
frame_parms
->
ofdm_symbol_size
,
sigma2
,
sigma2_dB
);
freq_channel
(
UE2gNB
,
N_RB_DL
,
1
+
(
N_RB_DL
*
12
),
scs
/
1000
);
int
i0
;
int
i0
;
double
txr
,
txi
,
rxr
,
rxi
,
nr
,
ni
;
double
txr
,
txi
,
rxr
,
rxi
,
nr
,
ni
;
for
(
int
symb
=
0
;
symb
<
gNB
->
frame_parms
.
symbols_per_slot
;
symb
++
)
{
for
(
int
symb
=
0
;
symb
<
gNB
->
frame_parms
.
symbols_per_slot
;
symb
++
)
{
...
@@ -566,12 +565,15 @@ int main(int argc, char **argv)
...
@@ -566,12 +565,15 @@ int main(int argc, char **argv)
for
(
int
aarx
=
0
;
aarx
<
n_rx
;
aarx
++
)
{
for
(
int
aarx
=
0
;
aarx
<
n_rx
;
aarx
++
)
{
nr
=
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
);
nr
=
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
);
ni
=
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
);
ni
=
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
);
((
int16_t
*
)
rxdataF
[
aarx
])[
i
<<
1
]
=
(
int16_t
)(
100
.
0
*
(
nr
)
/
sqrt
((
double
)
txlev
));
((
int16_t
*
)
rxdataF
[
aarx
])[
i
<<
1
]
=
(
int16_t
)(
100
.
0
*
((
double
)(((
int16_t
*
)
txdataF
[
0
])[(
i
<<
1
)])
+
nr
)
/
sqrt
((
double
)
txlev
));
((
int16_t
*
)
rxdataF
[
aarx
])[
1
+
(
i
<<
1
)]
=
(
int16_t
)(
100
.
0
*
(
ni
)
/
sqrt
((
double
)
txlev
));
((
int16_t
*
)
rxdataF
[
aarx
])[
1
+
(
i
<<
1
)]
=
(
int16_t
)(
100
.
0
*
((
double
)(((
int16_t
*
)
txdataF
[
0
])[(
i
<<
1
)
+
1
])
+
ni
)
/
sqrt
((
double
)
txlev
));
}
}
}
}
}
}
}
}
random_channel
(
UE2gNB
,
0
);
freq_channel
(
UE2gNB
,
N_RB_DL
,
2
*
N_RB_DL
+
1
,
scs
/
1000
);
for
(
int
symb
=
0
;
symb
<
nrofSymbols
;
symb
++
)
{
for
(
int
symb
=
0
;
symb
<
nrofSymbols
;
symb
++
)
{
i0
=
(
startingSymbolIndex
+
symb
)
*
gNB
->
frame_parms
.
ofdm_symbol_size
;
i0
=
(
startingSymbolIndex
+
symb
)
*
gNB
->
frame_parms
.
ofdm_symbol_size
;
for
(
int
re
=
0
;
re
<
N_RB_DL
*
12
;
re
++
)
{
for
(
int
re
=
0
;
re
<
N_RB_DL
*
12
;
re
++
)
{
...
@@ -583,8 +585,8 @@ int main(int argc, char **argv)
...
@@ -583,8 +585,8 @@ int main(int argc, char **argv)
rxi
=
txr
*
UE2gNB
->
chF
[
aarx
][
re
].
i
+
txi
*
UE2gNB
->
chF
[
aarx
][
re
].
r
;
rxi
=
txr
*
UE2gNB
->
chF
[
aarx
][
re
].
i
+
txi
*
UE2gNB
->
chF
[
aarx
][
re
].
r
;
nr
=
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
);
nr
=
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
);
ni
=
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
);
ni
=
sqrt
(
sigma2
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
);
((
int16_t
*
)
rxdataF
[
aarx
])[
i
<<
1
]
=
(
int16_t
)(
100
.
0
*
(
rxr
+
nr
)
/
sqrt
((
double
)
txlev
));
((
int16_t
*
)
rxdataF
[
aarx
])[
i
<<
1
]
=
(
int16_t
)(
100
.
0
*
((
double
)(((
int16_t
*
)
txdataF
[
0
])[(
i
<<
1
)])
+
rxr
+
nr
)
/
sqrt
((
double
)
txlev
));
((
int16_t
*
)
rxdataF
[
aarx
])[
1
+
(
i
<<
1
)]
=
(
int16_t
)(
100
.
0
*
(
rxi
+
ni
)
/
sqrt
((
double
)
txlev
));
((
int16_t
*
)
rxdataF
[
aarx
])[
1
+
(
i
<<
1
)]
=
(
int16_t
)(
100
.
0
*
((
double
)(((
int16_t
*
)
txdataF
[
0
])[(
i
<<
1
)
+
1
])
+
rxi
+
ni
)
/
sqrt
((
double
)
txlev
));
if
(
n_trials
==
1
&&
abs
(
txr
)
>
0
)
printf
(
"symb %d, re %d , aarx %d : txr %f, txi %f, chr %f, chi %f, nr %f, ni %f, rxr %f, rxi %f => %d,%d
\n
"
,
if
(
n_trials
==
1
&&
abs
(
txr
)
>
0
)
printf
(
"symb %d, re %d , aarx %d : txr %f, txi %f, chr %f, chi %f, nr %f, ni %f, rxr %f, rxi %f => %d,%d
\n
"
,
symb
,
re
,
aarx
,
txr
,
txi
,
symb
,
re
,
aarx
,
txr
,
txi
,
...
@@ -594,12 +596,12 @@ int main(int argc, char **argv)
...
@@ -594,12 +596,12 @@ int main(int argc, char **argv)
}
}
}
}
}
}
int
rxlev
=
0
;
int
rxlev
=
0
;
for
(
int
aarx
=
0
;
aarx
<
n_rx
;
aarx
++
)
rxlev
+=
signal_energy
(
&
rxdataF
[
aarx
][
startingSymbolIndex
*
frame_parms
->
ofdm_symbol_size
],
for
(
int
aarx
=
0
;
aarx
<
n_rx
;
aarx
++
)
rxlev
+=
signal_energy
(
&
rxdataF
[
aarx
][
startingSymbolIndex
*
frame_parms
->
ofdm_symbol_size
],
frame_parms
->
ofdm_symbol_size
);
frame_parms
->
ofdm_symbol_size
);
// noise measurement
// noise measurement
for
(
int
s
=
0
;
s
<
frame_parms
->
symbols_per_slot
;
s
++
){
for
(
int
s
=
0
;
s
<
frame_parms
->
symbols_per_slot
;
s
++
){
if
(
s
>=
startingSymbolIndex
&&
s
<
(
startingSymbolIndex
+
nrofSymbols
))
if
(
s
>=
startingSymbolIndex
&&
s
<
(
startingSymbolIndex
+
nrofSymbols
))
for
(
int
rb
=
0
;
rb
<
N_RB
;
rb
++
)
{
for
(
int
rb
=
0
;
rb
<
N_RB
;
rb
++
)
{
...
...
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