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
Michael Black
OpenXG-RAN
Commits
3d00d78a
Commit
3d00d78a
authored
Dec 02, 2021
by
rmagueta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Power noise estimation based on SRS
parent
340508ff
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
12 deletions
+42
-12
openair1/PHY/INIT/nr_init.c
openair1/PHY/INIT/nr_init.c
+1
-1
openair1/PHY/INIT/nr_init_ue.c
openair1/PHY/INIT/nr_init_ue.c
+1
-1
openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
+38
-8
openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h
openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h
+1
-1
openair1/PHY/defs_nr_common.h
openair1/PHY/defs_nr_common.h
+1
-1
No files found.
openair1/PHY/INIT/nr_init.c
View file @
3d00d78a
...
...
@@ -198,7 +198,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
for
(
int
id
=
0
;
id
<
NUMBER_OF_NR_SRS_MAX
;
id
++
)
{
gNB
->
nr_srs_info
[
id
]
=
(
nr_srs_info_t
*
)
malloc16_clear
(
sizeof
(
nr_srs_info_t
));
gNB
->
nr_srs_info
[
id
]
->
srs_generated_signal
=
(
int32_t
*
)
malloc16_clear
(
fp
->
samples_per_frame
*
sizeof
(
int32_t
));
gNB
->
nr_srs_info
[
id
]
->
noise_power
=
(
double
*
)
malloc16_clear
(
sizeof
(
double
));
gNB
->
nr_srs_info
[
id
]
->
noise_power
=
(
uint32_t
*
)
malloc16_clear
(
sizeof
(
uint32_t
));
gNB
->
nr_srs_info
[
id
]
->
srs_received_signal
=
(
int32_t
**
)
malloc16
(
Prx
*
sizeof
(
int32_t
*
));
gNB
->
nr_srs_info
[
id
]
->
srs_ls_estimated_channel
=
(
int32_t
**
)
malloc16
(
Prx
*
sizeof
(
int32_t
*
));
gNB
->
nr_srs_info
[
id
]
->
srs_estimated_channel
=
(
int32_t
**
)
malloc16
(
Prx
*
sizeof
(
int32_t
*
));
...
...
openair1/PHY/INIT/nr_init_ue.c
View file @
3d00d78a
...
...
@@ -325,7 +325,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
srs_vars
[
gNB_id
]
->
active
=
false
;
ue
->
nr_srs_info
=
(
nr_srs_info_t
*
)
malloc16_clear
(
sizeof
(
nr_srs_info_t
));
ue
->
nr_srs_info
->
srs_generated_signal
=
(
int32_t
*
)
malloc16_clear
(
(
2
*
(
fp
->
samples_per_frame
)
+
2048
)
*
sizeof
(
int32_t
)
);
ue
->
nr_srs_info
->
noise_power
=
(
double
*
)
malloc16_clear
(
sizeof
(
double
));
ue
->
nr_srs_info
->
noise_power
=
(
uint32_t
*
)
malloc16_clear
(
sizeof
(
uint32_t
));
ue
->
nr_srs_info
->
srs_received_signal
=
(
int32_t
**
)
malloc16
(
fp
->
nb_antennas_rx
*
sizeof
(
int32_t
*
)
);
ue
->
nr_srs_info
->
srs_ls_estimated_channel
=
(
int32_t
**
)
malloc16
(
fp
->
nb_antennas_rx
*
sizeof
(
int32_t
*
)
);
ue
->
nr_srs_info
->
srs_estimated_channel
=
(
int32_t
**
)
malloc16
(
fp
->
nb_antennas_rx
*
sizeof
(
int32_t
*
)
);
...
...
openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
View file @
3d00d78a
...
...
@@ -1093,6 +1093,16 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
}
//Antenna loop
}
uint32_t
calc_power
(
uint16_t
*
x
,
uint32_t
size
)
{
uint64_t
sum_x
=
0
;
uint64_t
sum_x2
=
0
;
for
(
int
k
=
0
;
k
<
size
;
k
++
)
{
sum_x
=
sum_x
+
x
[
k
];
sum_x2
=
sum_x2
+
x
[
k
]
*
x
[
k
];
}
return
sum_x2
/
size
-
(
sum_x
/
size
)
*
(
sum_x
/
size
);
}
int
nr_srs_channel_estimation
(
PHY_VARS_gNB
*
gNB
,
int
frame
,
int
slot
,
...
...
@@ -1101,7 +1111,7 @@ int nr_srs_channel_estimation(PHY_VARS_gNB *gNB,
int32_t
*
srs_generated_signal
,
int32_t
**
srs_received_signal
,
int32_t
**
srs_estimated_channel
,
double
*
noise_power
)
{
uint32_t
*
noise_power
)
{
if
(
nr_srs_info
->
n_symbs
==
0
)
{
LOG_E
(
NR_PHY
,
"(%d.%d) nr_srs_info was not generated yet!
\n
"
,
frame
,
slot
);
...
...
@@ -1112,6 +1122,10 @@ int nr_srs_channel_estimation(PHY_VARS_gNB *gNB,
int32_t
**
srs_ls_estimated_channel
=
nr_srs_info
->
srs_ls_estimated_channel
;
uint64_t
subcarrier_offset
=
frame_parms
->
first_carrier_offset
+
srs_pdu
->
bwp_start
*
12
;
uint16_t
noise_real
[
frame_parms
->
nb_antennas_rx
*
nr_srs_info
->
n_symbs
];
uint16_t
noise_imag
[
frame_parms
->
nb_antennas_rx
*
nr_srs_info
->
n_symbs
];
int16_t
prev_ls_estimated
[
2
];
int16_t
ls_estimated
[
2
];
for
(
int
ant
=
0
;
ant
<
frame_parms
->
nb_antennas_rx
;
ant
++
)
{
...
...
@@ -1133,9 +1147,15 @@ int nr_srs_channel_estimation(PHY_VARS_gNB *gNB,
// So we only need a nr_srs_info->srs_generated_signal_bits shift to ensure that the result fits into 16 bits.
ls_estimated
[
0
]
=
(
int16_t
)(((
int32_t
)
generated_real
*
received_real
+
(
int32_t
)
generated_imag
*
received_imag
)
>>
nr_srs_info
->
srs_generated_signal_bits
);
ls_estimated
[
1
]
=
(
int16_t
)(((
int32_t
)
generated_real
*
received_imag
-
(
int32_t
)
generated_imag
*
received_real
)
>>
nr_srs_info
->
srs_generated_signal_bits
);
srs_ls_estimated_channel
[
ant
][
nr_srs_info
->
subcarrier_idx
[
sc_idx
]
+
subcarrier_offset
]
=
ls_estimated
[
0
]
+
(((
int32_t
)
ls_estimated
[
1
]
<<
16
)
&
0xFFFF0000
);
if
(
sc_idx
>
0
)
{
ls_estimated
[
0
]
=
(
ls_estimated
[
0
]
+
prev_ls_estimated
[
0
])
>>
1
;
ls_estimated
[
1
]
=
(
ls_estimated
[
1
]
+
prev_ls_estimated
[
1
])
>>
1
;
}
prev_ls_estimated
[
0
]
=
(
int16_t
)(((
int32_t
)
generated_real
*
received_real
+
(
int32_t
)
generated_imag
*
received_imag
)
>>
nr_srs_info
->
srs_generated_signal_bits
);
prev_ls_estimated
[
1
]
=
(
int16_t
)(((
int32_t
)
generated_real
*
received_imag
-
(
int32_t
)
generated_imag
*
received_real
)
>>
nr_srs_info
->
srs_generated_signal_bits
);
// Channel interpolation
if
(
srs_pdu
->
comb_size
==
0
)
{
if
(
sc_idx
==
0
)
{
...
...
@@ -1156,6 +1176,9 @@ int nr_srs_channel_estimation(PHY_VARS_gNB *gNB,
multadd_real_vector_complex_scalar
(
filt8_dcl0_h
,
ls_estimated
,
srs_estimated_channel16
,
8
);
}
noise_real
[
ant
*
nr_srs_info
->
n_symbs
+
sc_idx
]
=
abs
(
prev_ls_estimated
[
0
]
-
(
int16_t
)(
srs_estimated_channel
[
ant
][
nr_srs_info
->
subcarrier_idx
[
sc_idx
]
+
subcarrier_offset
]
&
0xFFFF
));
noise_imag
[
ant
*
nr_srs_info
->
n_symbs
+
sc_idx
]
=
abs
(
prev_ls_estimated
[
1
]
-
(
int16_t
)((
srs_estimated_channel
[
ant
][
nr_srs_info
->
subcarrier_idx
[
sc_idx
]
+
subcarrier_offset
]
>>
16
)
&
0xFFFF
));
#ifdef SRS_DEBUG
if
(
sc_idx
==
0
)
{
LOG_I
(
NR_PHY
,
"______________________________ Rx antenna %i _______________________________
\n
"
,
ant
);
...
...
@@ -1168,29 +1191,36 @@ int nr_srs_channel_estimation(PHY_VARS_gNB *gNB,
nr_srs_info
->
subcarrier_idx
[
sc_idx
],
generated_real
,
generated_imag
,
received_real
,
received_imag
,
ls_estimated
[
0
],
ls_estimated
[
1
]);
prev_ls_estimated
[
0
],
prev_
ls_estimated
[
1
]);
#endif
}
}
*
noise_power
=
calc_power
(
noise_real
,
frame_parms
->
nb_antennas_rx
*
nr_srs_info
->
n_symbs
)
+
calc_power
(
noise_imag
,
frame_parms
->
nb_antennas_rx
*
nr_srs_info
->
n_symbs
);
#ifdef SRS_DEBUG
uint8_t
shift
=
srs_pdu
->
comb_size
==
0
?
1
:
2
;
for
(
int
ant
=
0
;
ant
<
frame_parms
->
nb_antennas_rx
;
ant
++
)
{
for
(
int
sc
=
0
;
sc
<=
nr_srs_info
->
subcarrier_idx
[
nr_srs_info
->
n_symbs
-
1
];
sc
++
)
{
if
(
sc
==
0
)
{
LOG_I
(
NR_PHY
,
"__________________
Rx antenna %i
___________________
\n
"
,
ant
);
LOG_I
(
NR_PHY
,
"__________________
____________ Rx antenna %i ____________
___________________
\n
"
,
ant
);
}
if
(
sc
%
12
==
0
)
{
LOG_I
(
NR_PHY
,
"::::::::::::::::::::::::
%i
::::::::::::::::::::::::
\n
"
,
sc
/
12
);
LOG_I
(
NR_PHY
,
"
\t
__lsRe__________lsIm__|____intRe_______intIm_
\n
"
);
LOG_I
(
NR_PHY
,
"::::::::::::::::::::::::
:::::::::::: %i ::::::::::::
::::::::::::::::::::::::
\n
"
,
sc
/
12
);
LOG_I
(
NR_PHY
,
"
\t
__lsRe__________lsIm__|____intRe_______intIm_
_|____noiRe_______noiIm_
\n
"
);
}
LOG_I
(
NR_PHY
,
"(%4i) %6i
\t
%6i | %6i
\t
%6i
\n
"
,
LOG_I
(
NR_PHY
,
"(%4i) %6i
\t
%6i | %6i
\t
%6i
| %6i
\t
%6i
\n
"
,
sc
,
(
int16_t
)(
srs_ls_estimated_channel
[
ant
][
sc
+
subcarrier_offset
]
&
0xFFFF
),
(
int16_t
)((
srs_ls_estimated_channel
[
ant
][
sc
+
subcarrier_offset
]
>>
16
)
&
0xFFFF
),
(
int16_t
)(
srs_estimated_channel
[
ant
][
sc
+
subcarrier_offset
]
&
0xFFFF
),
(
int16_t
)((
srs_estimated_channel
[
ant
][
sc
+
subcarrier_offset
]
>>
16
)
&
0xFFFF
));
(
int16_t
)((
srs_estimated_channel
[
ant
][
sc
+
subcarrier_offset
]
>>
16
)
&
0xFFFF
),
noise_real
[
ant
*
nr_srs_info
->
n_symbs
+
(
sc
>>
shift
)],
noise_imag
[
ant
*
nr_srs_info
->
n_symbs
+
(
sc
>>
shift
)]);
}
}
LOG_I
(
NR_PHY
,
"noise_power = %u
\n
"
,
*
noise_power
);
#endif
return
0
;
...
...
openair1/PHY/NR_ESTIMATION/nr_ul_estimation.h
View file @
3d00d78a
...
...
@@ -71,5 +71,5 @@ int nr_srs_channel_estimation(PHY_VARS_gNB *gNB,
int32_t
*
srs_generated_signal
,
int32_t
**
srs_received_signal
,
int32_t
**
srs_estimated_channel
,
double
*
noise_power
);
uint32_t
*
noise_power
);
#endif
openair1/PHY/defs_nr_common.h
View file @
3d00d78a
...
...
@@ -248,7 +248,7 @@ typedef struct {
int32_t
**
srs_received_signal
;
int32_t
**
srs_ls_estimated_channel
;
int32_t
**
srs_estimated_channel
;
double
*
noise_power
;
uint32_t
*
noise_power
;
}
nr_srs_info_t
;
typedef
struct
NR_DL_FRAME_PARMS
NR_DL_FRAME_PARMS
;
...
...
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