SRSUE: Refactored work_dl for NR. Added NZP-CSI-RS measurement

master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent e68c822505
commit 653177ca7c

@ -57,6 +57,12 @@ private:
// Methods for DCI blind search
void decode_pdcch_ul();
void decode_pdcch_dl();
// Method for decode PDSCH
bool decode_pdsch_dl();
// Method for measurements
bool measure();
};
} // namespace nr

@ -57,6 +57,7 @@ private:
mutable std::mutex metrics_mutex;
/// CSI-RS measurements
std::mutex csi_measurements_mutex;
std::array<srsran_csi_measurements_t, SRSRAN_CSI_MAX_NOF_RESOURCES> csi_measurements = {};
/**
@ -90,7 +91,7 @@ public:
csi_measurements[0].K_csi_rs = 1;
csi_measurements[0].nof_ports = 1;
csi_measurements[1].K_csi_rs = 4;
csi_measurements[0].nof_ports = 1;
csi_measurements[1].nof_ports = 1;
}
/**
@ -422,6 +423,17 @@ public:
// Reset all metrics
reset_metrics_();
}
void new_nzp_csi_rs_channel_measurement(const srsran_csi_measurements_t& new_measure, uint32_t resource_set_id)
{
std::lock_guard<std::mutex> lock(csi_measurements_mutex);
if (srsran_csi_new_nzp_csi_rs_measurement(
cfg.csi.csi_resources, csi_measurements.data(), &new_measure, resource_set_id) < SRSRAN_SUCCESS) {
ERROR("Error processing new NZP-CSI-RS");
return;
}
}
};
} // namespace nr
} // namespace srsue

@ -192,32 +192,16 @@ void cc_worker::decode_pdcch_ul()
}
}
bool cc_worker::work_dl()
bool cc_worker::decode_pdsch_dl()
{
// Do NOT process any DL if it is not configured
if (not configured) {
return true;
}
// Check if it is a DL slot, if not skip
if (!srsran_tdd_nr_is_dl(&phy->cfg.tdd, 0, dl_slot_cfg.idx)) {
return true;
}
// Run FFT
srsran_ue_dl_nr_estimate_fft(&ue_dl, &dl_slot_cfg);
// Decode PDCCH DL first
decode_pdcch_dl();
// Decode PDCCH UL after
decode_pdcch_ul();
// Get DL grant for this TTI, if available
uint32_t pid = 0;
srsran_sch_cfg_nr_t pdsch_cfg = {};
srsran_pdsch_ack_resource_nr_t ack_resource = {};
if (phy->get_dl_pending_grant(dl_slot_cfg.idx, pdsch_cfg, ack_resource, pid)) {
if (not phy->get_dl_pending_grant(dl_slot_cfg.idx, pdsch_cfg, ack_resource, pid)) {
// Early return if no grant was available
return false;
}
// Notify MAC about PDSCH grant
mac_interface_phy_nr::tb_action_dl_t dl_action = {};
mac_interface_phy_nr::mac_nr_grant_dl_t mac_dl_grant = {};
@ -321,6 +305,64 @@ bool cc_worker::work_dl()
ch_m.sync_err = ue_dl.chest.sync_error;
phy->set_channel_metrics(ch_m);
}
return true;
}
bool cc_worker::measure()
{
// Iterate all NZP-CSI-RS and perform channel measurements
for (uint32_t resource_set_id = 0; resource_set_id < SRSRAN_PHCH_CFG_MAX_NOF_CSI_RS_SETS; resource_set_id++) {
// Select NZP-CSI-RS set
const srsran_csi_rs_nzp_set_t& nzp_set = phy->cfg.pdsch.nzp_csi_rs_sets[resource_set_id];
srsran_csi_measurements_t measurements = {};
int n = srsran_ue_dl_nr_csi_measure(&ue_dl, &dl_slot_cfg, &nzp_set, &measurements);
if (n < SRSRAN_SUCCESS) {
logger.error("Error measuring CSI-RS");
return false;
}
// Report new measurement to the PHY state
if (n > 0) {
phy->new_nzp_csi_rs_channel_measurement(measurements, resource_set_id);
}
}
return true;
}
bool cc_worker::work_dl()
{
// Do NOT process any DL if it is not configured
if (not configured) {
return true;
}
// Check if it is a DL slot, if not skip
if (!srsran_tdd_nr_is_dl(&phy->cfg.tdd, 0, dl_slot_cfg.idx)) {
return true;
}
// Run FFT
srsran_ue_dl_nr_estimate_fft(&ue_dl, &dl_slot_cfg);
// Decode PDCCH DL first
decode_pdcch_dl();
// Decode PDCCH UL after
decode_pdcch_ul();
// Decode PDSCH
if (not decode_pdsch_dl()) {
logger.error("Error decoding PDSCH, aborting work DL");
return false;
}
// Measure CSI-RS
if (not measure()) {
logger.error("Error measuring CSI-RS, aborting work DL");
return false;
}
return true;

Loading…
Cancel
Save