Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2 KPM for xApp reporting couldn't show accurate CQI values #1021

Open
xynolphia opened this issue Jan 22, 2025 · 0 comments
Open

E2 KPM for xApp reporting couldn't show accurate CQI values #1021

xynolphia opened this issue Jan 22, 2025 · 0 comments
Assignees

Comments

@xynolphia
Copy link

xynolphia commented Jan 22, 2025

I realised that the CQI reading I receive at the xApp ( Multi User) shows me the reading of the last metrics value but not for CQI. Normal CQI values should be from 0 to 15, but I am seeing up to thousands. And after checking out the files in E2SM_KPM, I found this file "e2sm_kpm_du_meas_provider_impl.cpp" where it has many metrics and pointers to get the metrics, so I tried to change the cqi part to

supported_metrics.emplace(
      "CARR.WBCQIDist", e2sm_kpm_supported_metric_t{NO_LABEL, E2_NODE_LEVEL | UE_LEVEL, true, &e2sm_kpm_du_meas_provider_impl::get_cqi});

as for the the function for get_cqi below, I would like to change it to make it receive CQI of multi UE and I wonder if anyone has done this before, because I tried to modify it to the second part and it could not work.

bool e2sm_kpm_du_meas_provider_impl::get_cqi(const asn1::e2sm::label_info_list_l          label_info_list,
                                             const std::vector<asn1::e2sm::ue_id_c>&      ues,
                                             const std::optional<asn1::e2sm::cgi_c>       cell_global_id,
                                             std::vector<asn1::e2sm::meas_record_item_c>& items)
{
  bool meas_collected = false;
  if (last_ue_metrics.empty()) {
    return handle_no_meas_data_available(ues, items, asn1::e2sm::meas_record_item_c::types::options::integer);
  }
  scheduler_ue_metrics ue_metrics = last_ue_metrics[0];

  meas_record_item_c meas_record_item;
  meas_record_item.set_integer() = ue_metrics.cqi_stats.get_nof_observations() > 0
                                       ? static_cast<uint64_t>(std::roundf(ue_metrics.cqi_stats.get_mean()))
                                       : 0;
  items.push_back(meas_record_item);
  meas_collected = true;

  return meas_collected;

Part 2 (New)

bool e2sm_kpm_du_meas_provider_impl::get_cqi(const asn1::e2sm::label_info_list_l          label_info_list,
                                             const std::vector<asn1::e2sm::ue_id_c>&      ues,
                                             const std::optional<asn1::e2sm::cgi_c>       cell_global_id,
                                             std::vector<asn1::e2sm::meas_record_item_c>& items)
{
  bool meas_collected = false;
  if (last_ue_metrics.empty()) {
    return handle_no_meas_data_available(ues, items, asn1::e2sm::meas_record_item_c::types::options::integer);
  }


    if (ues.empty()) {
        // E2-level CQI: Aggregate CQI over all UEs
        meas_record_item_c meas_record_item;
        float total_cqi = 0;
        uint32_t ue_count = 0;

        for (auto& ue_metrics : last_ue_metrics) {
            // Add CQI from each UE, assuming `cqi_stats.get_mean()` returns the CQI value
            if (ue_metrics.cqi_stats.get_nof_observations() > 0) {
                total_cqi += ue_metrics.cqi_stats.get_mean();
                ue_count++;
            }
        }

        if (ue_count > 0) {
            float avg_cqi = total_cqi / ue_count;
            meas_record_item.set_integer() = static_cast<uint64_t>(std::roundf(avg_cqi));
            meas_collected = true;
        } else {
            // If no CQI data available, set default CQI (e.g., 0 or -1)
            meas_record_item.set_integer() = 0; // Or use -1 to indicate no data
        }

        items.push_back(meas_record_item);
    } else {
        // Handle case for specific UEs 
        for ( auto& ue : ues) {
            // Find matching metrics for each UE and calculate CQI
            auto it = std::find_if(last_ue_metrics.begin(), last_ue_metrics.end(),
                                   [&ue](const scheduler_ue_metrics& metrics) {
                                       return metrics.ue_id == ue;
                                   });

            asn1::e2sm::meas_record_item_c meas_record_item;
            if (it != last_ue_metrics.end()) {
                const scheduler_ue_metrics& ue_metrics = *it;

                meas_record_item.set_integer() = ue_metrics.cqi_stats.get_nof_observations() > 0
                                                     ? static_cast<uint64_t>(std::roundf(ue_metrics.cqi_stats.get_mean()))
                                                     : 0;
                meas_collected = true;
            } else {
                meas_record_item.set_integer() = 0; // No data for this UE
            }

            items.push_back(meas_record_item);
        }
    }

    return meas_collected;
}
@yagoda yagoda self-assigned this Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants