Skip to main content

Iberian day-ahead electricity market clearing simulator

Project description

iberian-day-ahead-market-simulator

A Python simulator for the MIBEL (Mercado Ibérico de Electricidad) Iberian day-ahead electricity market clearing process.

The package replicates the OMIE/MIBEL market-clearing algorithm, including:

  • Simple and complex bid orders
  • Paradoxical order inclusion and removal
  • Spain–Portugal interconnection capacity constraints
  • France exchange integration

Requirements

Solver support

The simulator uses Pyomo SolverFactory, so you can choose the solver with solver_factory_type.

  • Recommended/default: Gurobi (solver_factory_type="gurobi")
  • Also possible: HiGHS (solver_factory_type="highs"), or any solver plugin available in your Pyomo environment

Note: model performance and feasibility behavior can vary by solver. Gurobi is the most tested option in this project.

If you use Gurobi, install gurobipy and configure your licence:

pip install gurobipy

If you use HiGHS, install highspy:

pip install highspy

If you use other solvers, install the corresponding solver binaries in your system and use the appropriate solver_factory_type.

Installation

pip install iberian-day-ahead-market-simulator

Or install from source:

git clone https://github.com/EloyID/iberian-day-ahead-market-simulator.git
cd iberian-day-ahead-market-simulator
pip install -e .

Quick Start

from iberian_day_ahead_market_simulator.clearing_process import run_iberian_day_ahead_market_simulator
from iberian_day_ahead_market_simulator.plot_helpers import (
    plot_clearing_prices,
    plot_spain_portugal_transmissions,
)

# These files are available in OMIE
det_date = "path/to/det_file.1"
cab_date = "path/to/cab_file.1"
capacidad_inter_date = "path/to/capacidad_inter_file.1"

# Data available in ENTSO-E Transparency Platform
# The df must have date_sesion, int_periodo and 
# float_price_fr columns
price_france_date = "path/to/price_france_file.parquet"

results = run_iberian_day_ahead_market_simulator(
    det_date=det_date,
    cab_date=cab_date,
    capacidad_inter_date=capacidad_inter_date,
    price_france_date=price_france_date,
    n_jobs=10, # Number of parallel processes for scenario analysis
    solver_factory_type="gurobi", # "gurobi" or "highs"
)

# Now you can analyze the results, for example:
plot_clearing_prices(results["clearing_prices"])
plot_spain_portugal_transmissions(
    results["spain_portugal_transmissions"]
)

Usage examples

Some examples can be found in the examples/ directory:

Data sources

OMIE files used by this project are:

  • Cabecera de las ofertas (Header of bids for Day-ahead Market, CAB files). Contains one entry per bidding unit (e.g., unit identifier, buy/sell flag, and fixed-cost parameter)
  • Detalle de las ofertas (Day-ahead market bid details, DET files). Contains the detailed bid curves and non-convex information, with one entry per bid element (period, price, quantity, block identifier, exclusive-group identifier, and additional SCO parameters when applicable).
  • Capacidad y ocupación de las interconexiones tras la casación del mercado diario (Capacity and occupation of the interconnectors after Day-ahead matching process, capacidad_inter files). Contains the information about the interconnection flows and available capacities.

French day-ahead prices can be obtained from the ENTSO-E Transparency Platform.

Project Structure

src/iberian_day_ahead_market_simulator/
├── clearing_process.py        # Main iterative clearing loop
├── make_model.py              # Pyomo MILP model builder
├── run_model.py               # Pyomo solver wrapper (configurable solver)
├── data_preprocessor.py       # Input data processing
├── parse_omie_files.py        # OMIE flat-file parsers
├── paradoxal_orders_tools.py  # Paradoxical order utilities
├── residual_demand_curve.py   # RDC computation & interpolation
├── schemas/                   # Pandera data-validation schemas
└── data/                      # Bundled reference data

Data Documentation

For a complete data dictionary of inputs, transformed datasets, outputs, enums, and validation rules, see docs/data_book.md.

Licence

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iberian_day_ahead_market_simulator-0.1.0.tar.gz (80.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iberian_day_ahead_market_simulator-0.1.0.tar.gz.

File metadata

File hashes

Hashes for iberian_day_ahead_market_simulator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 730d700a7c588a0a720c14caca3f6736f12c95474e6857e5ce9ad5efab5e5b6b
MD5 20560acff12ae1cd4ab127e08072fb9e
BLAKE2b-256 c6fb71ea460f345cb39e65b6510868a09a6b1cd7b9ad5dcad432f6d511d33208

See more details on using hashes here.

File details

Details for the file iberian_day_ahead_market_simulator-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for iberian_day_ahead_market_simulator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdc392e4a3f4c0ab7ed91bd7b46cb217eadecf084c342f284613831d5ee04c23
MD5 f60bba103f3d98f2d99c78c4ed183df4
BLAKE2b-256 e410d1fb4b4287d3aa8113102c3bc01ee4f1e28d419b67df6911b167eaeb53dc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page