Skip to content

Commit 6521a3d

Browse files
committed
phy: propagate estimated cfo
1 parent fc28f48 commit 6521a3d

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

include/srsran/phy/upper/channel_estimation.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,10 @@ class channel_estimate
219219

220220
/// \brief Gets the general Channel State Information.
221221
///
222-
/// param[in] csi Channel State Information object where the CSI parameters are stored.
222+
/// \param[out] csi Channel State Information object where the CSI parameters are stored.
223223
void get_channel_state_information(channel_state_information& csi) const
224224
{
225-
// EPRE, RSRP and time alignment are reported as a linear average of the results for all Rx ports.
225+
// EPRE and RSRP are reported as a linear average of the results for all Rx ports.
226226
float epre_lin = 0.0F;
227227
float rsrp_lin = 0.0F;
228228
unsigned best_rx_port = 0;
@@ -246,9 +246,15 @@ class channel_estimate
246246
csi.set_epre(convert_power_to_dB(epre_lin));
247247
csi.set_rsrp(convert_power_to_dB(rsrp_lin));
248248

249-
// Use the time alignment of the channel path with better SNR.
249+
// Use the time alignment of the channel path with best SNR.
250250
csi.set_time_alignment(get_time_alignment(best_rx_port, 0));
251251

252+
// Use the CFO of the channel path with best SNR.
253+
optional<float> cfo_help = get_cfo_Hz(best_rx_port, 0);
254+
if (cfo_help.has_value()) {
255+
csi.set_cfo(cfo_help.value());
256+
}
257+
252258
// SINR is reported by averaging the signal and noise power contributions of all Rx ports.
253259
csi.set_sinr_dB(channel_state_information::sinr_type::channel_estimator,
254260
convert_power_to_dB(get_layer_average_snr(0)));

include/srsran/phy/upper/channel_processors/pusch/formatters.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ struct formatter<srsran::channel_state_information> {
236236
srsran::optional<float> rsrp_dB = csi.get_rsrp_dB();
237237
srsran::optional<float> sinr_dB = csi.get_sinr_dB();
238238
srsran::optional<srsran::phy_time_unit> time_aligment = csi.get_time_alignment();
239+
srsran::optional<float> cfo_Hz = csi.get_cfo_Hz();
239240

240241
// Print the measurements that are present.
241242
if (epre_dB.has_value()) {
@@ -258,6 +259,11 @@ struct formatter<srsran::channel_state_information> {
258259
} else {
259260
helper.format_if_verbose(ctx, "t_align=na");
260261
}
262+
if (cfo_Hz.has_value()) {
263+
helper.format_if_verbose(ctx, "cfo={:.2f}Hz", cfo_Hz.value());
264+
} else {
265+
helper.format_if_verbose(ctx, "cfo=na");
266+
}
261267
} else {
262268
// Short representation only prints the SINR selected for CSI reporting to higher layers.
263269
srsran::optional<float> sinr_dB = csi.get_sinr_dB();
@@ -340,4 +346,4 @@ struct formatter<srsran::pusch_processor_result_control> {
340346
}
341347
};
342348

343-
} // namespace fmt
349+
} // namespace fmt

include/srsran/phy/upper/channel_state_information.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,22 @@ class channel_state_information
158158
/// \return The measured RSRP if present, otherwise \c nullopt.
159159
optional<float> get_rsrp_dB() const { return rsrp_dB; }
160160

161+
/// \brief Sets the measured Carrier Frequency Offset (CFO) in hertz.
162+
///
163+
/// The CFO value is ignored if NaN.
164+
void set_cfo(float cfo_Hz_)
165+
{
166+
if (std::isnan(cfo_Hz_)) {
167+
return;
168+
}
169+
170+
cfo_Hz.emplace(cfo_Hz_);
171+
}
172+
173+
/// \brief Gets the measured Carrier Frequency Offset (CFO) in hertz.
174+
/// \return The measured CFO if present, \c nullopt otherwise.
175+
optional<float> get_cfo_Hz() const { return cfo_Hz; }
176+
161177
private:
162178
friend struct fmt::formatter<channel_state_information>;
163179
/// \brief SINR type that can be accessed by \ref get_sinr_dB.
@@ -179,6 +195,8 @@ class channel_state_information
179195
optional<float> epre_dB;
180196
/// Average RSRP in decibels.
181197
optional<float> rsrp_dB;
198+
/// CFO measurement in hertz.
199+
optional<float> cfo_Hz;
182200
};
183201

184202
} // namespace srsran

0 commit comments

Comments
 (0)