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

MRO #17

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open

MRO #17

wants to merge 32 commits into from

Conversation

tanzim10
Copy link
Contributor

@tanzim10 tanzim10 commented Oct 28, 2024

Description:

This PR implements a robust simulation for optimizing UE mobility by predicting the best cell attachments using Bayesian Digital Twin models. It includes a pipeline of functions for data preprocessing, training, and prediction to enhance network connectivity stability. Some unittest cases for the functions are also added.

Functions:

  • _preprocess_ue_topology_data: Combines UE and topology data, adding derived features like log distance and received power, preparing for Bayesian Digital Twin training.

  • _preprocess_ue_training_data: Prepares training data, processing each cell's data and populating it with relevant features (log distance, relative bearing, cell power).

  • _preprocess_prediction_data: Prepares prediction data in the same format as training data, generating features required for Bayesian Digital Twin predictions.

  • training: Trains Bayesian Digital Twin models for each cell using UE data, enabling accurate prediction of cell power based on UE features.

  • predictions: Uses the Bayesian Digital Twin models to predict received power at various UE locations, then selects the best cell for each UE using the perform_attachment function.

  • mro_plot_scatter: Visualizes cell towers and UE locations, color-coded by cell attachment or RLF (gray) based on SINR values.

Copy link

linux-foundation-easycla bot commented Nov 22, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Comment on lines 24 to 29
def __init__(
self,
ue_data: pd.DataFrame,
topology: pd.DataFrame,
prediction_data: pd.DataFrame,
tx_power_dbm: int = 23,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add docstrings explaining format and/or content of each parameter

# Scatter plot of the Cell towers and UE Locations


def mro_plot_scatter(df, topology):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to notebook

Comment on lines 20 to 23
A class to perform Mobility Robustness Optimization (MRO) using Bayesian Digital Twins. This class integrates
user equipment (UE) data with cell topology to predict the received power at various UE locations and
determines the optimal cell attachment based on these predictions. The class uses Bayesian modeling to
accurately forecast signal strength, accounting for factors such as distance, frequency, and antenna characteristics.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A class to perform Mobility Robustness Optimization (MRO) using Bayesian Digital Twins. This class integrates
user equipment (UE) data with cell topology to predict the received power at various UE locations and
determines the optimal cell attachment based on these predictions. The class uses Bayesian modeling to
accurately forecast signal strength, accounting for factors such as distance, frequency, and antenna characteristics.
A class that contains a prototypical proof-of-concept of an `Mobility Robustness Optimization (MRO)` RIC xApp.


def update(self, new_data: pd.DataFrame):
"""
Updates or trains Bayesian Digital Twins for each cell with new data.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Updates or trains Bayesian Digital Twins for each cell with new data.
(Re-)train Bayesian Digital Twins for each cell.


if self.bayesian_digital_twins:
self.update_data = new_data
updated_data = self._preprocess_ue_update_data()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this as a helper static method to generate dummy data (for e.g. in a notebook) and then use that (as if it were real data) to train the twins.

if not isinstance(new_data, pd.DataFrame):
raise TypeError("The input 'new_data' must be a pandas DataFrame.")

expected_columns = {"mock_ue_id", "longitude", "latitude", "tick"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected := [lat, lon, cell_id, "rsrp_dbm"] where 'cell_id' can be cross-referenced into topology (to get cell_lat and cell_lon).


return predicted, full_prediction_df

def _connect_ue_to_all_cells(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _connect_ue_to_all_cells(
def _prepare_all_UEs_from_all_cells_df(

except Exception as e:
print(f"An unexpected error occurred: {e}")

def save(bayesian_digital_twins, file_loc):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return NotImplemented()

to refine the decision process for UE cell attachment.
"""
self.simulation_data = get_ue_data(self.mobility_params)
ue_data = self._preprocess_ue_simulation_data()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here, we need to use (previously trained) twins to predict each lat/lon from each cell.

except Exception as e:
print(f"An unexpected error occurred: {e}")

def solve(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def solve(self):
def _calculate_metric(self, lambda: perform_attachment, **kwargs):

have another method :

def solve(self) -> Optional[Tuple[float]]:
   # repeatedly evaluate self._calculate_metric(perform_attachment)
   # return new optimized parametrization of perform_attachment
   # currently `perform_attachment` has no params
   # e.g. self._calculate_metric(perform_attachment)
   # in the future, you will have `perform_attachment_hyst_ttt`
   # that can be optimized by a simple for-loop grid search
   # through TTT and hyst, where we repeatedly call 
   # self._calculate_metric(perform_attachment_hyst_ttt, **kwargs)
   # and return the optimal [TTT, hyst]

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

Successfully merging this pull request may close these issues.

3 participants