Changed cell gain command from cell index to cell id

master
Xavier Arteaga 4 years ago committed by Xavier Arteaga
parent 0740154bff
commit 58be68f856

@ -30,10 +30,10 @@ class enb_command_interface
public: public:
/** /**
* Sets the relative gain of a cell from it's index (following rr.conf) order. * Sets the relative gain of a cell from it's index (following rr.conf) order.
* @param cell_idx Provides a cell index * @param cell_id Provides a cell identifier
* @param gain Relative gain * @param gain Relative gain
*/ */
virtual void cmd_cell_gain(uint32_t cell_idx, float gain) = 0; virtual void cmd_cell_gain(uint32_t cell_id, float gain) = 0;
}; };
} // namespace srsenb } // namespace srsenb

@ -131,7 +131,7 @@ public:
bool get_metrics(enb_metrics_t* m) override; bool get_metrics(enb_metrics_t* m) override;
// eNodeB command interface // eNodeB command interface
void cmd_cell_gain(uint32_t cell_idx, float gain) override; void cmd_cell_gain(uint32_t cell_id, float gain) override;
private: private:
const static int ENB_POOL_SIZE = 1024 * 10; const static int ENB_POOL_SIZE = 1024 * 10;

@ -68,7 +68,7 @@ public:
void get_metrics(phy_metrics_t metrics[ENB_METRICS_MAX_USERS]) override; void get_metrics(phy_metrics_t metrics[ENB_METRICS_MAX_USERS]) override;
void cmd_cell_gain(uint32_t cell_idx, float gain_db) override; void cmd_cell_gain(uint32_t cell_id, float gain_db) override;
void radio_overflow() override{}; void radio_overflow() override{};
void radio_failure() override{}; void radio_failure() override{};

@ -137,11 +137,18 @@ public:
return c; return c;
}; };
void set_cell_gain(uint32_t cc_idx, float gain_db) void set_cell_gain(uint32_t cell_id, float gain_db)
{ {
if (cc_idx < cell_list.size()) { auto it =
cell_list.at(cc_idx).gain_db = gain_db; std::find_if(cell_list.begin(), cell_list.end(), [cell_id](phy_cell_cfg_t& x) { return x.cell_id == cell_id; });
// Check if the cell was found;
if (it == cell_list.end()) {
srslte::console("cell ID %d not found\n", cell_id);
return;
} }
it->gain_db = gain_db;
} }
float get_cell_gain(uint32_t cc_idx) float get_cell_gain(uint32_t cc_idx)

@ -209,9 +209,9 @@ bool enb::get_metrics(enb_metrics_t* m)
return true; return true;
} }
void enb::cmd_cell_gain(uint32_t cell_idx, float gain) void enb::cmd_cell_gain(uint32_t cell_id, float gain)
{ {
phy->cmd_cell_gain(cell_idx, gain); phy->cmd_cell_gain(cell_id, gain);
} }
srslte::LOG_LEVEL_ENUM enb::level(std::string l) srslte::LOG_LEVEL_ENUM enb::level(std::string l)

@ -427,16 +427,16 @@ static void* input_loop(metrics_stdout* metrics, srsenb::enb_command_interface*
raise(SIGTERM); raise(SIGTERM);
} else if (cmd[0] == "cell_gain") { } else if (cmd[0] == "cell_gain") {
if (cmd.size() != 3) { if (cmd.size() != 3) {
cout << "Usage: " << cmd[0] << " [cell index] [gain in dB]" << endl; cout << "Usage: " << cmd[0] << " [cell identifier] [gain in dB]" << endl;
continue; continue;
} }
// Parse command arguments // Parse command arguments
uint32_t cell_idx = srslte::string_cast<uint32_t>(cmd[1]); uint32_t cell_id = srslte::string_cast<uint32_t>(cmd[1]);
float gain_db = srslte::string_cast<float>(cmd[2]); float gain_db = srslte::string_cast<float>(cmd[2]);
// Set cell gain // Set cell gain
control->cmd_cell_gain(cell_idx, gain_db); control->cmd_cell_gain(cell_id, gain_db);
} else { } else {
cout << "Available commands: " << endl; cout << "Available commands: " << endl;
cout << " t: starts console trace" << endl; cout << " t: starts console trace" << endl;

@ -220,9 +220,9 @@ void phy::get_metrics(phy_metrics_t metrics[ENB_METRICS_MAX_USERS])
} }
} }
void phy::cmd_cell_gain(uint32_t cc_idx, float gain_db) void phy::cmd_cell_gain(uint32_t cell_id, float gain_db)
{ {
workers_common.set_cell_gain(cc_idx, gain_db); workers_common.set_cell_gain(cell_id, gain_db);
} }
/***** RRC->PHY interface **********/ /***** RRC->PHY interface **********/

Loading…
Cancel
Save