monee

_images/monee-logo.drawio.svg

Modular Network-based Energy Grid Optimization

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

pip install monee

Features

Multi-energy networks

Electricity, gas, and water/heat in one model. Networks are represented as directed graphs — any topology is supported.

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.

Steady-state simulation

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

Optimisation

Swap run_energy_flow() for run_energy_flow_optimization() and pass a problem formulation. Built-in: load shedding. Supports custom objectives and constraints.

Flexible solver back-ends

Ships with GEKKO (IPOPT, default) and Pyomo (HiGHS · Gurobi · GLPK). Switch back-ends without changing model code. MISOCP relaxations available for convex OPF.

Import / Export

Round-trip networks in MATPOWER, pandapower, and SimBench formats. One function call in each direction.


Quick look

Build a multi-energy network coupling an electricity grid to a district heating loop — and solve it — in under 25 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=1)

# ── Couple: electric bus drives a heat pump feeding the heating loop ──
mx.create_p2h(net, bus_1, j_mid, j_return,
              heat_energy_w=100_000, 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