monee

_images/monee-logo.drawio.svg

Modular Network-based Energy Grid Optimization

Model, simulate, and optimize interconnected electricity, gas, and heat networks in one Python framework.

pip install monee

Features

Multi-energy networks

Electricity, gas, and water/heat in one model. Networks are directed graphs, so any topology works.

Data model

Energy-carrier coupling

Connect carriers with built-in units: P2H (power-to-heat), G2P (gas-to-power), P2G, G2H, and CHP. Bidirectional flows are handled automatically.

Multi-energy coupling

Steady-state simulation

Run energy-flow calculations across all carriers simultaneously. Results come back as typed dataframes, one row per component.

Quickstart

Optimisation

Swap run_energy_flow() for run_energy_flow_optimization() and pass a problem. Load shedding ships built in; add your own objectives and constraints.

01 · Minimum-cost load curtailment

Flexible solver back-ends

Solves with IPOPT by default, and routes any other solver name to Pyomo (HiGHS, Gurobi, GLPK, SCIP, CBC). Switch back-ends without changing model code. A MISOCP relaxation is available for convex OPF.

Solvers & Backends

Import

Read networks from MATPOWER, pandapower, and SimBench formats. One function call per format.

Import MATPOWER case files

Validated

Results are checked against pandapower and pandapipes on identical networks: voltages, pressures, and temperatures agree, and coupled multi-energy solves match the reference to machine precision.

Validation against pandapower and pandapipes

Quick look

Couple an electricity grid to a district heating loop and solve it in a handful of lines:

from monee import mx, run_energy_flow

net = mx.create_multi_energy_network()

# Electricity grid
bus_0 = mx.create_bus(net)
bus_1 = mx.create_bus(net)
mx.create_line(net, bus_0, bus_1, length_m=100,
               r_ohm_per_m=7e-5, x_ohm_per_m=7e-5)
mx.create_ext_power_grid(net, bus_0)
mx.create_power_load(net, bus_1, p_mw=0.1, q_mvar=0.0)

# District heating grid
j_supply = mx.create_water_junction(net)
j_mid    = mx.create_water_junction(net)
j_return = mx.create_water_junction(net)
mx.create_ext_hydr_grid(net, j_supply)
mx.create_water_pipe(net, j_supply, j_mid, diameter_m=0.12, length_m=100)
mx.create_sink(net, j_return, mass_flow_kgs=1)

# Couple: the electric bus drives a heat pump feeding the heating loop
mx.create_p2h(net, bus_1, j_mid, j_return,
              heat_energy_mw=0.1, diameter_m=0.1, efficiency=0.9)

result = run_energy_flow(net)
print(result.dataframes["Bus"][["id", "vm_pu", "va_degree"]])

Where to go next

Quickstart

A five-minute guided tour of the core workflow.

Quickstart
Concepts

Physical equations, formulations, solvers, and the data model.

Concepts
Tutorials

End-to-end worked examples including optimisation and time-series simulation.

Tutorials
API Reference

Complete auto-generated reference for every public function and class.

API-reference