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
25449148
Commit
25449148
authored
Oct 17, 2022
by
francescomani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
addressing review and correcting indentation
parent
3a8db593
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
481 additions
and
517 deletions
+481
-517
openair1/SIMULATION/NR_PHY/dlsim.c
openair1/SIMULATION/NR_PHY/dlsim.c
+30
-66
openair1/SIMULATION/NR_PHY/ulsim.c
openair1/SIMULATION/NR_PHY/ulsim.c
+451
-451
No files found.
openair1/SIMULATION/NR_PHY/dlsim.c
View file @
25449148
...
@@ -382,7 +382,6 @@ int main(int argc, char **argv)
...
@@ -382,7 +382,6 @@ int main(int argc, char **argv)
float
effRate
;
float
effRate
;
//float psnr;
//float psnr;
float
eff_tp_check
=
0
.
7
;
float
eff_tp_check
=
0
.
7
;
uint8_t
snrRun
;
uint32_t
TBS
=
0
;
uint32_t
TBS
=
0
;
int
**
txdata
;
int
**
txdata
;
double
**
s_re
,
**
s_im
,
**
r_re
,
**
r_im
;
double
**
s_re
,
**
s_im
,
**
r_re
,
**
r_im
;
...
@@ -464,7 +463,7 @@ int main(int argc, char **argv)
...
@@ -464,7 +463,7 @@ int main(int argc, char **argv)
FILE
*
scg_fd
=
NULL
;
FILE
*
scg_fd
=
NULL
;
while
((
c
=
getopt
(
argc
,
argv
,
"f:hA:pf:g:i:n:s:S:t:v:x:y:z:M:N:F:GR:d:PI:L:Ea:b:e:m:w:T:U:q:X:Y"
))
!=
-
1
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"f:hA:pf:g:i:n:s:S:t:v:x:y:z:M:N:F:GR:d:PI:L:Ea:b:e:m:w:T:U:q:X:Y"
))
!=
-
1
)
{
switch
(
c
)
{
switch
(
c
)
{
case
'f'
:
case
'f'
:
scg_fd
=
fopen
(
optarg
,
"r"
);
scg_fd
=
fopen
(
optarg
,
"r"
);
...
@@ -571,13 +570,9 @@ int main(int argc, char **argv)
...
@@ -571,13 +570,9 @@ int main(int argc, char **argv)
break
;
break
;
case
'v'
:
case
'v'
:
num_rounds
=
atoi
(
optarg
);
num_rounds
=
atoi
(
optarg
);
if
(
num_rounds
<
1
)
{
printf
(
"Unsupported number of rounds %d
\n
"
,
num_rounds
);
exit
(
-
1
);
}
AssertFatal
(
num_rounds
>
0
&&
num_rounds
<
16
,
"Unsupported number of rounds %d, should be in [1,16]
\n
"
,
num_rounds
);
break
;
break
;
case
'y'
:
case
'y'
:
...
@@ -736,21 +731,6 @@ int main(int argc, char **argv)
...
@@ -736,21 +731,6 @@ int main(int argc, char **argv)
}
}
}
}
uint32_t
errors_scrambling
[
num_rounds
][
100
];
int
n_errors
[
num_rounds
][
100
];
int
round_trials
[
num_rounds
][
100
];
double
roundStats
[
100
];
double
blerStats
[
num_rounds
][
100
];
double
berStats
[
num_rounds
][
100
];
double
snrStats
[
100
];
memset
(
errors_scrambling
,
0
,
sizeof
(
uint32_t
)
*
num_rounds
*
100
);
memset
(
n_errors
,
0
,
sizeof
(
int
)
*
num_rounds
*
100
);
memset
(
round_trials
,
0
,
sizeof
(
int
)
*
num_rounds
*
100
);
memset
(
blerStats
,
0
,
sizeof
(
double
)
*
num_rounds
*
100
);
memset
(
berStats
,
0
,
sizeof
(
double
)
*
num_rounds
*
100
);
memset
(
snrStats
,
0
,
sizeof
(
double
)
*
100
);
memset
(
roundStats
,
0
,
sizeof
(
double
)
*
100
);
logInit
();
logInit
();
set_glog
(
loglvl
);
set_glog
(
loglvl
);
T_stdout
=
1
;
T_stdout
=
1
;
...
@@ -1053,7 +1033,6 @@ int main(int argc, char **argv)
...
@@ -1053,7 +1033,6 @@ int main(int argc, char **argv)
nr_ue_phy_config_request
(
&
UE_mac
->
phy_config
);
nr_ue_phy_config_request
(
&
UE_mac
->
phy_config
);
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
//NR_COMMON_channels_t *cc = RC.nrmac[0]->common_channels;
snrRun
=
0
;
int
n_errs
=
0
;
int
n_errs
=
0
;
initNamedTpool
(
gNBthreads
,
&
gNB
->
threadPool
,
true
,
"gNB-tpool"
);
initNamedTpool
(
gNBthreads
,
&
gNB
->
threadPool
,
true
,
"gNB-tpool"
);
...
@@ -1084,6 +1063,13 @@ int main(int argc, char **argv)
...
@@ -1084,6 +1063,13 @@ int main(int argc, char **argv)
clear_pdsch_stats
(
gNB
);
clear_pdsch_stats
(
gNB
);
uint32_t
errors_scrambling
[
16
]
=
{
0
};
int
n_errors
[
16
]
=
{
0
};
int
round_trials
[
16
]
=
{
0
};
double
roundStats
=
{
0
};
double
blerStats
[
16
]
=
{
0
};
double
berStats
[
16
]
=
{
0
};
effRate
=
0
;
effRate
=
0
;
//n_errors2 = 0;
//n_errors2 = 0;
//n_alamouti = 0;
//n_alamouti = 0;
...
@@ -1117,7 +1103,7 @@ int main(int argc, char **argv)
...
@@ -1117,7 +1103,7 @@ int main(int argc, char **argv)
UE_harq_process
->
first_rx
=
1
;
UE_harq_process
->
first_rx
=
1
;
while
((
round
<
num_rounds
)
&&
(
UE_harq_process
->
ack
==
0
))
{
while
((
round
<
num_rounds
)
&&
(
UE_harq_process
->
ack
==
0
))
{
round_trials
[
round
]
[
snrRun
]
++
;
round_trials
[
round
]
++
;
clear_nr_nfapi_information
(
RC
.
nrmac
[
0
],
0
,
frame
,
slot
);
clear_nr_nfapi_information
(
RC
.
nrmac
[
0
],
0
,
frame
,
slot
);
UE_info
->
UE_sched_ctrl
.
harq_processes
[
harq_pid
].
ndi
=
!
(
trial
&
1
);
UE_info
->
UE_sched_ctrl
.
harq_processes
[
harq_pid
].
ndi
=
!
(
trial
&
1
);
...
@@ -1288,9 +1274,8 @@ int main(int argc, char **argv)
...
@@ -1288,9 +1274,8 @@ int main(int argc, char **argv)
//---------------------- count errors ----------------------
//---------------------- count errors ----------------------
//----------------------------------------------------------
//----------------------------------------------------------
if
(
UE
->
dlsch
[
0
][
0
]
->
last_iteration_cnt
>=
if
(
UE
->
dlsch
[
0
][
0
]
->
last_iteration_cnt
>=
UE
->
dlsch
[
0
][
0
]
->
max_ldpc_iterations
+
1
)
UE
->
dlsch
[
0
][
0
]
->
max_ldpc_iterations
+
1
)
n_errors
[
round
]
++
;
n_errors
[
round
][
snrRun
]
++
;
NR_UE_PDSCH
**
pdsch_vars
=
UE
->
pdsch_vars
;
NR_UE_PDSCH
**
pdsch_vars
=
UE
->
pdsch_vars
;
int16_t
*
UE_llr
=
pdsch_vars
[
0
]
->
llr
[
0
];
int16_t
*
UE_llr
=
pdsch_vars
[
0
]
->
llr
[
0
];
...
@@ -1312,10 +1297,10 @@ int main(int argc, char **argv)
...
@@ -1312,10 +1297,10 @@ int main(int argc, char **argv)
if
(((
gNB_dlsch
->
harq_process
.
f
[
i
]
==
0
)
&&
(
UE_llr
[
i
]
<=
0
))
||
if
(((
gNB_dlsch
->
harq_process
.
f
[
i
]
==
0
)
&&
(
UE_llr
[
i
]
<=
0
))
||
((
gNB_dlsch
->
harq_process
.
f
[
i
]
==
1
)
&&
(
UE_llr
[
i
]
>=
0
)))
((
gNB_dlsch
->
harq_process
.
f
[
i
]
==
1
)
&&
(
UE_llr
[
i
]
>=
0
)))
{
{
if
(
errors_scrambling
[
round
][
snrRun
]
==
0
)
{
if
(
errors_scrambling
[
round
]
==
0
)
{
LOG_D
(
PHY
,
"First bit in error in unscrambling = %d
\n
"
,
i
);
LOG_D
(
PHY
,
"First bit in error in unscrambling = %d
\n
"
,
i
);
}
}
errors_scrambling
[
round
]
[
snrRun
]
++
;
errors_scrambling
[
round
]
++
;
}
}
}
}
...
@@ -1343,40 +1328,34 @@ int main(int argc, char **argv)
...
@@ -1343,40 +1328,34 @@ int main(int argc, char **argv)
if
(
n_trials
==
1
)
if
(
n_trials
==
1
)
printf
(
"errors_bit = %u (trial %d)
\n
"
,
errors_bit
,
trial
);
printf
(
"errors_bit = %u (trial %d)
\n
"
,
errors_bit
,
trial
);
}
}
roundStats
[
snrRun
]
+=
((
float
)
round
);
roundStats
+=
((
float
)
round
);
if
(
UE_harq_process
->
ack
==
1
)
effRate
+=
((
float
)
TBS
)
/
round
;
if
(
UE_harq_process
->
ack
==
1
)
effRate
+=
((
float
)
TBS
)
/
round
;
}
// noise trials
}
// noise trials
roundStats
[
snrRun
]
/=
((
float
)
n_trials
);
roundStats
/=
((
float
)
n_trials
);
for
(
int
r
=
0
;
r
<
num_rounds
;
r
++
)
{
for
(
int
r
=
0
;
r
<
num_rounds
;
r
++
)
{
blerStats
[
r
]
[
snrRun
]
=
(
double
)
n_errors
[
r
][
snrRun
]
/
round_trials
[
r
][
snrRun
];
blerStats
[
r
]
=
(
double
)
n_errors
[
r
]
/
round_trials
[
r
];
berStats
[
r
]
[
snrRun
]
=
(
double
)
errors_scrambling
[
r
][
snrRun
]
/
available_bits
/
round_trials
[
r
][
snrRun
];
berStats
[
r
]
=
(
double
)
errors_scrambling
[
r
]
/
available_bits
/
round_trials
[
r
];
}
}
effRate
/=
n_trials
;
effRate
/=
n_trials
;
printf
(
"*****************************************
\n
"
);
printf
(
"*****************************************
\n
"
);
printf
(
"SNR %f: n_errors (%d/%d"
,
SNR
,
n_errors
[
0
]
[
snrRun
],
round_trials
[
0
][
snrRun
]);
printf
(
"SNR %f: n_errors (%d/%d"
,
SNR
,
n_errors
[
0
]
,
round_trials
[
0
]);
for
(
int
r
=
1
;
r
<
num_rounds
;
r
++
)
for
(
int
r
=
1
;
r
<
num_rounds
;
r
++
)
printf
(
",%d/%d"
,
n_errors
[
r
][
snrRun
],
round_trials
[
r
][
snrRun
]);
printf
(
",%d/%d"
,
n_errors
[
r
],
round_trials
[
r
]);
printf
(
") (negative CRC), false_positive %d/%d, errors_scrambling (%u/%u"
,
printf
(
") (negative CRC), false_positive %d/%d, errors_scrambling (%u/%u"
,
n_false_positive
,
n_trials
,
errors_scrambling
[
0
],
available_bits
*
round_trials
[
0
]);
n_false_positive
,
n_trials
,
errors_scrambling
[
0
][
snrRun
],
available_bits
*
round_trials
[
0
][
snrRun
]);
for
(
int
r
=
1
;
r
<
num_rounds
;
r
++
)
for
(
int
r
=
1
;
r
<
num_rounds
;
r
++
)
printf
(
",%u/%u"
,
errors_scrambling
[
r
]
[
snrRun
],
available_bits
*
round_trials
[
r
][
snrRun
]);
printf
(
",%u/%u"
,
errors_scrambling
[
r
]
,
available_bits
*
round_trials
[
r
]);
printf
(
")
\n\n
"
);
printf
(
")
\n\n
"
);
dump_pdsch_stats
(
stdout
,
gNB
);
dump_pdsch_stats
(
stdout
,
gNB
);
printf
(
"SNR %f: Channel BLER (%e"
,
SNR
,
blerStats
[
0
]
[
snrRun
]
);
printf
(
"SNR %f: Channel BLER (%e"
,
SNR
,
blerStats
[
0
]);
for
(
int
r
=
1
;
r
<
num_rounds
;
r
++
)
for
(
int
r
=
1
;
r
<
num_rounds
;
r
++
)
printf
(
",%e"
,
blerStats
[
r
]
[
snrRun
]
);
printf
(
",%e"
,
blerStats
[
r
]);
printf
(
"), Channel BER (%e"
,
berStats
[
0
]
[
snrRun
]
);
printf
(
"), Channel BER (%e"
,
berStats
[
0
]);
for
(
int
r
=
1
;
r
<
num_rounds
;
r
++
)
for
(
int
r
=
1
;
r
<
num_rounds
;
r
++
)
printf
(
",%e"
,
berStats
[
r
][
snrRun
]);
printf
(
",%e"
,
berStats
[
r
]);
printf
(
") Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot
\n
"
,
printf
(
") Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot
\n
"
,
roundStats
,
effRate
,
effRate
/
TBS
*
100
,
TBS
);
roundStats
[
snrRun
],
effRate
,
effRate
/
TBS
*
100
,
TBS
);
printf
(
"*****************************************
\n
"
);
printf
(
"*****************************************
\n
"
);
printf
(
"
\n
"
);
printf
(
"
\n
"
);
...
@@ -1450,24 +1429,9 @@ int main(int argc, char **argv)
...
@@ -1450,24 +1429,9 @@ int main(int argc, char **argv)
break
;
break
;
}
}
snrStats
[
snrRun
]
=
SNR
;
n_errs
=
n_errors
[
0
];
snrRun
++
;
n_errs
=
n_errors
[
0
][
snrRun
];
}
// NSR
}
// NSR
LOG_M
(
"dlsimStats.m"
,
"SNR"
,
snrStats
,
snrRun
,
1
,
7
);
LOG_MM
(
"dlsimStats.m"
,
"BLER"
,
blerStats
,
snrRun
,
1
,
7
);
LOG_MM
(
"dlsimStats.m"
,
"BER"
,
berStats
,
snrRun
,
1
,
7
);
LOG_MM
(
"dlsimStats.m"
,
"rounds"
,
roundStats
,
snrRun
,
1
,
7
);
/*if (n_trials>1) {
printf("HARQ stats:\nSNR\tRounds\n");
psnr = snr0;
for (uint8_t i=0; i<snrRun; i++) {
printf("%.1f\t%.2f\n",psnr,roundStats[i]);
psnr+=0.2;
}
}*/
free_channel_desc_scm
(
gNB2UE
);
free_channel_desc_scm
(
gNB2UE
);
for
(
i
=
0
;
i
<
n_tx
;
i
++
)
{
for
(
i
=
0
;
i
<
n_tx
;
i
++
)
{
...
...
openair1/SIMULATION/NR_PHY/ulsim.c
View file @
25449148
This diff is collapsed.
Click to expand it.
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