Progress Main MPI Module

progress.main_MPI.MCS(samples, sim_hours, system_directory, solar_directory=True, wind_directory=True)

Performs a Mixed Time Sequential Monte Carlo Simulation (MCS) to evaluate the reliability of a power system.

This function iterates over a specified number of Monte Carlo samples (samples) and simulates each sample for sim_hours hours. It then records load curtailment, state-of-charge (SOC) for storage, and renewable generation (wind and solar) outcomes, combining them into reliability indices. Parallel execution is handled via mpi4py.

Parameters:
  • samples (int) – Number of Monte Carlo samples to run.

  • sim_hours (int) – Number of hours to simulate within each sample.

  • system_directory (str) – Path to the directory containing system data (e.g., generator, branch, bus, load, storage).

  • solar_directory (str or bool) – Path to the directory containing solar data files, or False if solar data is not used.

  • wind_directory (str or) – Path to the directory containing wind data files, or False if wind data is not used.

some change

Returns:

A tuple containing:

  • index_all (dict): Dictionary of reliability indices aggregated from all MPI processes. Typically includes final LOLP, EUE, LOLE, and other reliability metrics.

  • rank (int): The MPI rank (process ID). For single-process runs, this is 0.

  • SOC_rec (np.ndarray): 2D array with shape (number_of_storage_units, sim_hours) tracking the state-of-charge for each storage device over time.

  • curt_rec (np.ndarray): 1D array (length = sim_hours) of load curtailment values (in MW or a per-unit equivalent).

  • renewable_rec (dict): Dictionary containing wind and solar generation records for visualization. Keys include:

    • "wind_rec" – 2D array of wind generation by zone vs. hour

    • "solar_rec" – 2D array of solar generation by zone vs. hour

  • bus_name (list[str]): List of bus names from the system model.

  • essname (list[str]): List of energy storage system (ESS) names.

Return type:

tuple

Raises:
  • FileNotFoundError – If one of the required data files (e.g., system or renewable data) is missing.

  • ValueError – If the input parameters or data structures contain invalid entries.

  • RuntimeError – If the underlying optimization solver fails or cannot converge to a solution.