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
canghaiwuhen
OpenXG-RAN
Commits
49a14c4f
Commit
49a14c4f
authored
Aug 13, 2020
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes for TDL channel models in nr_ulsim
parent
ae4f3320
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
140 additions
and
114 deletions
+140
-114
openair1/SIMULATION/NR_PHY/ulsim.c
openair1/SIMULATION/NR_PHY/ulsim.c
+117
-101
openair1/SIMULATION/TOOLS/channel_sim.c
openair1/SIMULATION/TOOLS/channel_sim.c
+2
-2
openair1/SIMULATION/TOOLS/multipath_channel.c
openair1/SIMULATION/TOOLS/multipath_channel.c
+9
-2
openair1/SIMULATION/TOOLS/random_channel.c
openair1/SIMULATION/TOOLS/random_channel.c
+7
-7
openair1/SIMULATION/TOOLS/sim.h
openair1/SIMULATION/TOOLS/sim.h
+5
-2
No files found.
openair1/SIMULATION/NR_PHY/ulsim.c
View file @
49a14c4f
...
...
@@ -127,7 +127,7 @@ int main(int argc, char **argv)
double
*
r_re
[
4
]
=
{
r_re0
,
r_re1
,
r_re2
,
r_re3
};
double
*
r_im
[
4
]
=
{
r_im0
,
r_im1
,
r_im2
,
r_im3
};
//uint8_t write_output_file = 0;
int
trial
,
n_trials
=
1
,
n_
errors
=
0
,
n_
false_positive
=
0
,
delay
=
0
;
int
trial
,
n_trials
=
1
,
n_false_positive
=
0
,
delay
=
0
;
double
maxDoppler
=
0
.
0
;
uint8_t
n_tx
=
1
,
n_rx
=
1
;
//uint8_t transmission_mode = 1;
...
...
@@ -170,7 +170,7 @@ int main(int argc, char **argv)
UE_nr_rxtx_proc_t
UE_proc
;
FILE
*
scg_fd
=
NULL
;
double
TDL_DS
=
30e-9
;
double
DS_TDL
=
.
03
;
int
ibwps
=
24
;
int
ibwp_rboffset
=
41
;
...
...
@@ -253,17 +253,17 @@ int main(int argc, char **argv)
case
'H'
:
channel_model
=
TDL_C
;
TDL_DS
=
30e-9
;
DS_TDL
=
.
030
;
// 30 ns
break
;
case
'I'
:
channel_model
=
TDL_C
;
TDL_DS
=
300e-9
;
DS_TDL
=
.
3
;
// 300ns
break
;
case
'J'
:
channel_model
=
TDL_D
;
TDL_DS
=
30e-9
;
DS_TDL
=
.
03
;
break
;
default:
...
...
@@ -435,19 +435,20 @@ int main(int argc, char **argv)
double
sampling_frequency
;
double
bandwidth
;
if
(
N_RB_UL
>=
217
)
sampling_frequency
=
122.88
e6
;
else
if
(
N_RB_UL
>=
106
)
sampling_frequency
=
61.44
e6
;
if
(
N_RB_UL
>=
217
)
sampling_frequency
=
122
.
88
;
else
if
(
N_RB_UL
>=
106
)
sampling_frequency
=
61
.
44
;
else
{
printf
(
"Need at least 106 PRBs
\b
"
);
exit
(
-
1
);
}
if
(
N_RB_UL
==
273
)
bandwidth
=
100
e6
;
else
if
(
N_RB_UL
==
217
)
bandwidth
=
80
e6
;
else
if
(
N_RB_UL
==
106
)
bandwidth
=
40
e6
;
if
(
N_RB_UL
==
273
)
bandwidth
=
100
;
else
if
(
N_RB_UL
==
217
)
bandwidth
=
80
;
else
if
(
N_RB_UL
==
106
)
bandwidth
=
40
;
else
{
printf
(
"Add N_RB_UL %d
\n
"
,
N_RB_UL
);
exit
(
-
1
);
}
if
(
openair0_cfg
[
0
].
threequarter_fs
==
1
)
sampling_frequency
*=
.
75
;
UE2gNB
=
new_channel_desc_scm
(
n_tx
,
n_rx
,
channel_model
,
sampling_frequency
,
bandwidth
,
TDL_DS
,
DS_TDL
,
0
,
0
,
0
);
UE2gNB
->
max_Doppler
=
maxDoppler
;
...
...
@@ -588,7 +589,7 @@ int main(int argc, char **argv)
unsigned
char
*
estimated_output_bit
;
unsigned
char
*
test_input_bit
;
uint32_t
errors_decoding
=
0
;
uint32_t
errors_scrambling
=
0
;
test_input_bit
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
estimated_output_bit
=
(
unsigned
char
*
)
malloc16
(
sizeof
(
unsigned
char
)
*
16
*
68
*
384
);
...
...
@@ -633,19 +634,23 @@ int main(int argc, char **argv)
//for (int i=0;i<16;i++) printf("%f\n",gaussdouble(0.0,1.0));
snrRun
=
0
;
int
n_errs
;
for
(
SNR
=
snr0
;
SNR
<
snr1
;
SNR
+=
snr_step
)
{
varArray_t
*
table_rx
=
initVarArray
(
1000
,
sizeof
(
double
));
int
error_flag
=
0
;
n_false_positive
=
0
;
effRate
=
0
;
n_errors
=
0
;
int
n_errors
[
4
]
=
{
0
,
0
,
0
,
0
};;
int
round_trials
[
4
]
=
{
0
,
0
,
0
,
0
};
uint32_t
errors_scrambling
[
4
]
=
{
0
,
0
,
0
,
0
};
for
(
trial
=
0
;
trial
<
n_trials
;
trial
++
)
{
uint8_t
round
=
0
;
crc_status
=
1
;
errors_scrambling
=
0
;
errors_decoding
=
0
;
while
(
round
<
max_rounds
&&
crc_status
)
{
round_trials
[
round
]
++
;
ulsch_ue
[
0
]
->
harq_processes
[
harq_pid
]
->
round
=
round
;
gNB
->
ulsch
[
0
][
0
]
->
harq_processes
[
harq_pid
]
->
round
=
round
;
rv_index
=
nr_rv_round_map
[
round
];
...
...
@@ -837,13 +842,12 @@ int main(int argc, char **argv)
if
(
UE2gNB
->
max_Doppler
==
0
)
{
multipath_channel
(
UE2gNB
,
s_re
,
s_im
,
r_re
,
r_im
,
slot_length
,
0
);
slot_length
,
0
,(
n_trials
==
1
)
?
1
:
0
);
}
else
{
multipath_tv_channel
(
UE2gNB
,
s_re
,
s_im
,
r_re
,
r_im
,
2
*
slot_length
,
0
);
}
for
(
i
=
0
;
i
<
slot_length
;
i
++
)
{
if
(
n_trials
==
1
&&
i
<
256
)
printf
(
"i %d : (%f,%f)*%f = (%f,%f)
\n
"
,
i
,
r_re
[
0
][
i
],
r_im
[
0
][
i
],
tx_gain
,
r_re
[
0
][
i
]
*
tx_gain
,
r_im
[
0
][
i
]
*
tx_gain
);
for
(
ap
=
0
;
ap
<
frame_parms
->
nb_antennas_rx
;
ap
++
)
{
((
int16_t
*
)
&
gNB
->
common_vars
.
rxdata
[
ap
][
slot_offset
])[(
2
*
i
)
+
(
delay
*
2
)]
=
(
int16_t
)((
tx_gain
*
r_re
[
ap
][
i
])
+
(
sqrt
(
sigma
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
)));
// convert to fixed point
((
int16_t
*
)
&
gNB
->
common_vars
.
rxdata
[
ap
][
slot_offset
])[(
2
*
i
)
+
1
+
(
delay
*
2
)]
=
(
int16_t
)((
tx_gain
*
r_im
[
ap
][
i
])
+
(
sqrt
(
sigma
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
)));
...
...
@@ -905,18 +909,12 @@ int main(int argc, char **argv)
if
(
gNB
->
ulsch
[
0
][
0
]
->
last_iteration_cnt
>=
gNB
->
ulsch
[
0
][
0
]
->
max_ldpc_iterations
+
1
)
{
error_flag
=
1
;
n_errors
++
;
n_errors
[
round
]
++
;
crc_status
=
1
;
}
else
{
crc_status
=
0
;
}
if
(
n_trials
==
1
)
printf
(
"end of round %d rv_index %d
\n
"
,
round
,
rv_index
);
round
++
;
}
// round
//----------------------------------------------------------
//----------------- count and print errors -----------------
//----------------------------------------------------------
for
(
i
=
0
;
i
<
available_bits
;
i
++
)
{
...
...
@@ -925,12 +923,20 @@ int main(int argc, char **argv)
{
/*if(errors_scrambling == 0)
printf("\x1B[34m" "[frame %d][trial %d]\t1st bit in error in unscrambling = %d\n" "\x1B[0m", frame, trial, i);*/
errors_scrambling
++
;
errors_scrambling
[
round
]
++
;
}
}
round
++
;
if
(
errors_scrambling
>
0
)
{
if
(
n_trials
==
1
)
}
// round
//----------------------------------------------------------
//----------------- count and print errors -----------------
//----------------------------------------------------------
if
(
n_trials
==
1
&&
errors_scrambling
[
0
]
>
0
)
{
printf
(
"
\x1B
[31m""[frame %d][trial %d]
\t
number of errors in unscrambling = %u
\n
"
"
\x1B
[0m"
,
frame
,
trial
,
errors_scrambling
);
}
...
...
@@ -968,9 +974,18 @@ int main(int argc, char **argv)
effRate
/=
n_trials
;
printf
(
"*****************************************
\n
"
);
printf
(
"SNR %f: n_errors (negative CRC) = %d/%d, false_positive %d/%d, errors_scrambling %u/%u
\n
"
,
SNR
,
n_errors
,
n_trials
,
n_false_positive
,
n_trials
,
errors_scrambling
,
available_bits
*
n_trials
);
printf
(
"SNR %f: n_errors (%d/%d,%d/%d,%d/%d,%d/%d) (negative CRC), false_positive %d/%d, errors_scrambling (%u/%u,%u/%u,%u/%u,%u/%u
\n
"
,
SNR
,
n_errors
[
0
],
round_trials
[
0
],
n_errors
[
1
],
round_trials
[
1
],
n_errors
[
2
],
round_trials
[
2
],
n_errors
[
3
],
round_trials
[
3
],
n_false_positive
,
n_trials
,
errors_scrambling
[
0
],
available_bits
*
n_trials
,
errors_scrambling
[
1
],
available_bits
*
n_trials
,
errors_scrambling
[
2
],
available_bits
*
n_trials
,
errors_scrambling
[
3
],
available_bits
*
n_trials
);
printf
(
"
\n
"
);
printf
(
"SNR %f: Channel BLER %e, Channel BER %e Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %d bits/slot
\n
"
,
SNR
,(
double
)
n_errors
/
n_trials
,(
double
)
errors_scrambling
/
available_bits
/
n_trials
,
roundStats
[
snrRun
],
effRate
,
effRate
/
TBS
*
100
,
TBS
);
printf
(
"SNR %f: Channel BLER (%e,%e,%e,%e), Channel BER (%e,%e,%e,%e) Avg round %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %d bits/slot
\n
"
,
SNR
,
(
double
)
n_errors
[
0
]
/
round_trials
[
0
],
(
double
)
n_errors
[
1
]
/
round_trials
[
0
],
(
double
)
n_errors
[
2
]
/
round_trials
[
0
],
(
double
)
n_errors
[
3
]
/
round_trials
[
0
],
(
double
)
errors_scrambling
[
0
]
/
available_bits
/
round_trials
[
0
],
(
double
)
errors_scrambling
[
1
]
/
available_bits
/
round_trials
[
0
],
(
double
)
errors_scrambling
[
2
]
/
available_bits
/
round_trials
[
0
],
(
double
)
errors_scrambling
[
3
]
/
available_bits
/
round_trials
[
0
],
roundStats
[
snrRun
],
effRate
,
effRate
/
TBS
*
100
,
TBS
);
printf
(
"*****************************************
\n
"
);
printf
(
"
\n
"
);
...
...
@@ -991,7 +1006,7 @@ int main(int argc, char **argv)
if
(
n_trials
==
1
)
break
;
if
((
float
)
n_errors
/
(
float
)
n_trials
<=
target_error_rate
)
{
if
((
float
)
n_errors
[
0
]
/
(
float
)
n_trials
<=
target_error_rate
)
{
printf
(
"*************
\n
"
);
printf
(
"PUSCH test OK
\n
"
);
printf
(
"*************
\n
"
);
...
...
@@ -999,6 +1014,7 @@ int main(int argc, char **argv)
}
snrRun
++
;
n_errs
=
n_errors
[
0
];
}
// SNR loop
printf
(
"
\n
"
);
...
...
@@ -1014,5 +1030,5 @@ int main(int argc, char **argv)
if
(
scg_fd
)
fclose
(
scg_fd
);
return
(
n_err
or
s
);
return
(
n_errs
);
}
openair1/SIMULATION/TOOLS/channel_sim.c
View file @
49a14c4f
...
...
@@ -180,7 +180,7 @@ void do_DL_sig(sim_t *sim,
//RU2UE[eNB_id][UE_id]->path_loss_dB = 0;
multipath_channel
(
sim
->
RU2UE
[
ru_id
][
UE_id
][
CC_id
],
s_re
,
s_im
,
r_re0
,
r_im0
,
length
,
hold_channel
);
length
,
hold_channel
,
0
);
#ifdef DEBUG_SIM
rx_pwr
=
signal_energy_fp2
(
sim
->
RU2UE
[
ru_id
][
UE_id
][
CC_id
]
->
ch
[
0
],
sim
->
RU2UE
[
ru_id
][
UE_id
][
CC_id
]
->
channel_length
)
*
sim
->
RU2UE
[
ru_id
][
UE_id
][
CC_id
]
->
channel_length
;
...
...
@@ -394,7 +394,7 @@ void do_UL_sig(sim_t *sim,
multipath_channel
(
sim
->
UE2RU
[
UE_id
][
ru_id
][
CC_id
],
s_re
,
s_im
,
r_re0
,
r_im0
,
frame_parms
->
samples_per_tti
,
hold_channel
);
frame_parms
->
samples_per_tti
,
hold_channel
,
0
);
rx_pwr
=
signal_energy_fp2
(
sim
->
UE2RU
[
UE_id
][
ru_id
][
CC_id
]
->
ch
[
0
],
...
...
openair1/SIMULATION/TOOLS/multipath_channel.c
View file @
49a14c4f
...
...
@@ -44,7 +44,8 @@ void multipath_channel(channel_desc_t *desc,
double
rx_sig_re
[
2
][
30720
*
2
],
double
rx_sig_im
[
2
][
30720
*
2
],
uint32_t
length
,
uint8_t
keep_channel
)
uint8_t
keep_channel
,
int
log_channel
)
{
int
i
,
ii
,
j
,
l
;
...
...
@@ -150,7 +151,8 @@ void multipath_channel(channel_desc_t *desc,
double
*
rx_sig_re
[
2
],
double
*
rx_sig_im
[
2
],
uint32_t
length
,
uint8_t
keep_channel
)
uint8_t
keep_channel
,
int
log_channel
)
{
int
i
,
ii
,
j
,
l
;
...
...
@@ -196,6 +198,11 @@ void multipath_channel(channel_desc_t *desc,
rx_tmp
.
x
+=
(
tx
.
x
*
desc
->
ch
[
ii
+
(
j
*
desc
->
nb_rx
)][
l
].
x
)
-
(
tx
.
y
*
desc
->
ch
[
ii
+
(
j
*
desc
->
nb_rx
)][
l
].
y
);
rx_tmp
.
y
+=
(
tx
.
y
*
desc
->
ch
[
ii
+
(
j
*
desc
->
nb_rx
)][
l
].
x
)
+
(
tx
.
x
*
desc
->
ch
[
ii
+
(
j
*
desc
->
nb_rx
)][
l
].
y
);
if
(
i
==
0
&&
log_channel
==
1
)
{
printf
(
"channel[%d][%d][%d] = %f dB (%e,%e)
\n
"
,
ii
,
j
,
l
,
10
*
log10
(
pow
(
desc
->
ch
[
ii
+
(
j
*
desc
->
nb_rx
)][
l
].
x
,
2
.
0
)
+
pow
(
desc
->
ch
[
ii
+
(
j
*
desc
->
nb_rx
)][
l
].
y
,
2
.
0
)),
desc
->
ch
[
ii
+
(
j
*
desc
->
nb_rx
)][
l
].
x
,
desc
->
ch
[
ii
+
(
j
*
desc
->
nb_rx
)][
l
].
y
);
}
}
//l
}
// j
...
...
openair1/SIMULATION/TOOLS/random_channel.c
View file @
49a14c4f
...
...
@@ -695,9 +695,10 @@ channel_desc_t *new_channel_desc_scm(uint8_t nb_tx,
sum_amps
+=
chan_desc
->
amps
[
i
];
}
for
(
i
=
0
;
i
<
chan_desc
->
nb_taps
;
i
++
)
for
(
i
=
0
;
i
<
chan_desc
->
nb_taps
;
i
++
)
{
chan_desc
->
amps
[
i
]
/=
sum_amps
;
tdl_delays
[
i
]
*=
DS_TDL
;
}
chan_desc
->
delays
=
tdl_delays
;
chan_desc
->
ricean_factor
=
tdl_ricean_factor
;
chan_desc
->
aoa
=
0
;
...
...
@@ -1733,15 +1734,14 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
desc
->
ch
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][
k
].
x
+=
s
*
desc
->
a
[
l
][
aarx
+
(
aatx
*
desc
->
nb_rx
)].
x
;
desc
->
ch
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][
k
].
y
+=
s
*
desc
->
a
[
l
][
aarx
+
(
aatx
*
desc
->
nb_rx
)].
y
;
// printf("l %d : desc->ch.x %f\n",l,desc->a[l][aarx+(aatx*desc->nb_rx)].x
);
// printf("l %d : desc->ch.x %f, s %e, delay %f\n",l,desc->a[l][aarx+(aatx*desc->nb_rx)].x,s,desc->delays[l]
);
}
//nb_taps
#ifdef DEBUG_CH
k
=
0
;
printf
(
"(%d,%d,%d)->(%f,%f)
\n
"
,
k
,
aarx
,
aatx
,
desc
->
ch
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][
k
].
x
,
desc
->
ch
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][
k
].
y
);
printf
(
"(%d,%d,%d)->(%e,%e)
\n
"
,
k
,
aarx
,
aatx
,
desc
->
ch
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][
k
].
x
,
desc
->
ch
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][
k
].
y
);
#endif
}
}
//channel_length
}
}
//aatx
}
//aarx
...
...
openair1/SIMULATION/TOOLS/sim.h
View file @
49a14c4f
...
...
@@ -277,7 +277,8 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag);
double rx_sig_re[2],
double rx_sig_im[2],
uint32_t length,
uint8_t keep_channel)
uint8_t keep_channel,
int log_channel)
\brief This function generates and applys a random frequency selective random channel model.
@param desc Pointer to channel descriptor
...
...
@@ -287,6 +288,7 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag);
@param rx_sig_im output signal (imaginary component)
@param length Length of input signal
@param keep_channel Set to 1 to keep channel constant for null-B/F
@param log_channel=1 make channel coefficients come out for first sample of input
*/
void
multipath_channel
(
channel_desc_t
*
desc
,
...
...
@@ -295,7 +297,8 @@ void multipath_channel(channel_desc_t *desc,
double
*
rx_sig_re
[
2
],
double
*
rx_sig_im
[
2
],
uint32_t
length
,
uint8_t
keep_channel
);
uint8_t
keep_channel
,
int
log_channel
);
/*
\fn double compute_pbch_sinr(channel_desc_t *desc,
channel_desc_t *desc_i1,
...
...
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