Simulation Result Manager

class SimResultManager[source]

The Simulation Result Manager.

This class is responsible for managing the simulation results. This includes saving, loading, displaying, plotting, etc.

static _filepath(sim_configs: SimConfig, system_configs: SystemConfig) Path[source]

Generate the file path where the simulation results should be saved. The filename is generated based on the name of the simulation configuration and the name of the system configuration.

Parameters:
  • sim_configs (SimConfig) – The configuration settings of the simulation.

  • system_configs (SystemConfig) – The configuration settings of the system.

Returns:

filepath – The filepath for the simulation results.

Return type:

Path

static search_results(sim_configs: SimConfig, system_configs: SystemConfig) bool[source]

Search for previously executed simulation results with the same simulation and system configuration. If they exist, return True. Otherwise, return False.

Parameters:
  • sim_configs (SimConfig) – The configuration settings of the simulation.

  • system_configs (SystemConfig) – The configuration settings of the system.

Returns:

exists – True if the simulation results exist already, False otherwise.

Return type:

bool

static load_results(sim_configs: SimConfig, system_configs: SystemConfig) SimResult[source]

Load simulation results from a previously executed simulation with the same simulation and system configuration.

Parameters:
  • sim_configs (SimConfig) – The configuration settings of the simulation.

  • system_configs (SystemConfig) – The configuration settings of the system.

Returns:

sim_result – The loaded simulation results.

Return type:

SimResult

static save_results(sim_result: SimResult) None[source]

Save the simulation results to a .npz file.

Parameters:

sim_result (SimResult) – The simulation results to save.

static display(sim_result: SimResult, configs: bool = False, detailed: bool = True, precision: int = 3) str[source]

Display simulation results in a readable table format.

Parameters:
  • sim_result (SimResult) – The simulation results to display.

  • configs (bool) – If True, also prints the system and simulation configuration settings in the header.

  • detailed (bool) – If True, also prints per-UT metrics for each SNR point.

  • precision (int) – Number of decimal digits for floating-point formatting.

static _plot_filename(sim_results: list[SimResult], plot_type: str) Path[source]

Generate the file path where the plot should be saved. The filename is generated based on the name of the simulation configuration and the name of the system configuration, and the type of plot.

Parameters:
  • sim_results (list[SimResult]) – A list of simulation results for which the plot is generated.

  • plot_type (str) – A string indicating the type of plot.

Returns:

filepath – The filepath for the plot.

Return type:

Path

static _plot_get_label(system_configs: SystemConfig, label_type: str = 'default') str | None[source]

Generate the label for the plot legend based on the system configuration.Multiple labels for the same system configuration are available, and the label_type parameter is used to specify which one to use.

Parameters:
  • system_configs (SystemConfig) – The system configuration for which the label is generated.

  • label_type (str) –

    The type of label.

    Possible options:
    • ’default’: Default label type, which is the name of the system.

    • ’PT’: The precoding technique used in the system. (e.g. ‘WMMSE’)

    • ’BL’: The bit loader configurations. (e.g. ‘4-QAM’)

    • ’SD’: The system dimensions. (e.g. ‘Nt=8, Nr=2, K=2’)

Returns:

label – The generated label for the plot legend.

Return type:

str | None

static plot_system_performance(sim_result: SimResult, ber: bool = True, ibr: bool = True, R: bool = True, ana_result: AnaResult | None = None)[source]

Plot the system performance.

Saves three separate plots: system-wide BER, IBR, and achievable rate as a function of the SNR. The opacity of the points in the plots is proportional to the average data stream activation rate (only needed if not all stream AR are 100%).

Parameters:
  • sim_result (SimResult) – The simulation results to plot.

  • ber (bool, optional) – Whether to plot and save the system-wide BER. Default is True.

  • ibr (bool, optional) – Whether to plot and save the system-wide IBR. Default is True.

  • R (bool, optional) – Whether to plot and save the system-wide achievable rate. Default is True.

  • ana_result (AnaResult or None, optional) – If provided, the analytical results are overlaid on the simulation plots. Default is None.

Returns:

  • fig_ber (matplotlib.figure.Figure) – The figure object of the BER plot.

  • fig_ibr (matplotlib.figure.Figure) – The figure object of the IBR plot.

  • fig_R (matplotlib.figure.Figure) – The figure object of the R plot.

static plot_ut_performance(sim_result: SimResult, ber: bool = True, ibr: bool = True, R: bool = True, ana_result: AnaResult | None = None)[source]

Plot the performance of each UT in the system.

Saves three separate plots: per-UT BER, IBR, and R as a function of the SNR. The opacity of the points in the plots is proportional to the average UT activation rate (only needed if not all UT ARs are 100%). Different UTs are plotted in different colors.

Parameters:
  • sim_result (SimResult) – The simulation results to plot.

  • ber (bool, optional) – Whether to plot the BER (default is True).

  • ibr (bool, optional) – Whether to plot the IBR (default is True).

  • R (bool, optional) – Whether to plot the achievable rate (default is True).

  • ana_result (AnaResult or None, optional) – If provided, the analytical results are overlaid on the simulation plots. Default is None.

Returns:

  • fig_ber (matplotlib.figure.Figure) – The figure object of the BER plot.

  • fig_ibr (matplotlib.figure.Figure) – The figure object of the IBR plot.

  • fig_R (matplotlib.figure.Figure) – The figure object of the R plot.

static plot_stream_performance(sim_result: SimResult, ber: bool = True, ibr: bool = True, R: bool = True, ana_result: AnaResult | None = None)[source]

Plot the performance of each stream in the system.

Saves three separate plots: per-stream BER, IBR, and R as a function of the SNR. The opacity of the points in the plots is proportional to the average stream activation rate (only needed if not all stream ARs are 100%). Different UTs are plotted in different colors. Different streams are plotted with different markers.

Parameters:
  • sim_result (SimResult) – The simulation results to plot.

  • ber (bool, optional) – Whether to plot the BER (default is True).

  • ibr (bool, optional) – Whether to plot the IBR (default is True).

  • R (bool, optional) – Whether to plot the R (default is True).

  • ana_result (AnaResult or None, optional) – If provided, the analytical results are overlaid on the simulation plots. Default is None.

Returns:

  • fig_ber (matplotlib.figure.Figure) – The figure object of the BER plot.

  • fig_ibr (matplotlib.figure.Figure) – The figure object of the IBR plot.

  • fig_R (matplotlib.figure.Figure) – The figure object of the R plot.

static plot_system_performance_comparison(sim_results: list[SimResult], ber: bool = True, ibr: bool = True, R: bool = True, label_type: str = 'default', ana_results: list[AnaResult] | None = None)[source]

Plot the system performance of multiple systems for comparison.

Saves three separate plots: system-wide BER, IBR, and R as a function of the SNR. Different systems are plotted in different colors.

Parameters:
  • sim_results (list[SimResult]) – A list of simulation results to plot.

  • ber (bool, optional) – Whether to plot and save the system-wide BER comparison. Default is True.

  • ibr (bool, optional) – Whether to plot and save the system-wide IBR comparison. Default is True.

  • R (bool, optional) – Whether to plot and save the system-wide R comparison. Default is True.

  • label_type (str, optional) –

    The type of label to use for the legend.

    Possible options:
    • ’default’: Default label type, which is the name of the system.

    • ’PT’: The precoding technique used in the system. (e.g. ‘WMMSE’)

    • ’BL’: The bit loader configurations. (e.g. ‘4-QAM’)

    • ’SD’: The system dimensions. (e.g. ‘Nt=8, Nr=2, K=2’)

  • ana_results (list[AnaResult] or None, optional) – If provided, analytical results are overlaid on the simulation plots. Must have the same length as sim_results. Default is None.

Returns:

  • fig_ber (matplotlib.figure.Figure) – The figure object of the system-wide BER comparison plot. None if ber=False.

  • fig_ibr (matplotlib.figure.Figure) – The figure object of the system-wide IBR comparison plot. None if ibr=False.

  • fig_R (matplotlib.figure.Figure) – The figure object of the system-wide R comparison plot. None if R=False.

static plot_ut_performance_comparison(sim_results: list[SimResult], ber: bool = True, ibr: bool = True, R: bool = True, label_type: str = 'default', ana_results: list[AnaResult] | None = None)[source]

Plot the user terminal performance of multiple systems for comparison.

Saves three separate plots: per-UT BER, IBR, and achievable rate as a function of the SNR. Different systems are plotted in different colors. Different UTs are plotted with different markers.

Parameters:
  • sim_results (list[SimResult]) – A list of simulation results to plot.

  • ber (bool, optional) – Whether to plot and save the per-UT BER comparison. Default is True.

  • ibr (bool, optional) – Whether to plot and save the per-UT IBR comparison. Default is True.

  • R (bool, optional) – Whether to plot and save the per-UT achievable rate comparison. Default is True.

  • label_type (str, optional) –

    The type of label to use for the plots.

    Possible options:
    • ’default’: Default label type, which is the name of the system.

    • ’PT’: The precoding technique used in the system. (e.g. ‘WMMSE’)

    • ’BL’: The bit loader configurations. (e.g. ‘4-QAM’)

    • ’SD’: The system dimensions. (e.g. ‘Nt=8, Nr=2, K=2’)

  • ana_results (list[AnaResult] or None, optional) – If provided, analytical results are overlaid on the simulation plots. Must have the same length as sim_results. Default is None.

Returns:

  • fig_ber (matplotlib.figure.Figure) – The figure object of the per-UT BER comparison plot. None if ber=False.

  • fig_ibr (matplotlib.figure.Figure) – The figure object of the per-UT IBR comparison plot. None if ibr=False.

  • fig_R (matplotlib.figure.Figure) – The figure object of the per-UT achievable rate comparison plot. None if R=False.