Skip to content

Tutorials

Four narrative walkthroughs, difficulty-tiered, each self-contained but building on the one before it. If Getting started is a five-minute install-and-first-solve, these are the five-to-eight-minute-each story of what the package actually does and why — prose-heavy, with the "why" explained alongside the "what," rather than the terse one-concept-per-script style of the examples.

Notebook Difficulty What it covers
1. Your first power flow Beginner Load a MATPOWER case, run pf.solve_dc and pf.solve_ac, read bus voltages and branch flows
2. DC-OPF and N-1 screening Intermediate opf.solve_dc_opf for cost-minimising dispatch and LMPs, contingency.n1 for branch-outage screening
3. A nodal market Intermediate market.solve_nodal with elastic demand, LMP congestion splits, and settlement
4. Where next Guided fork market.agents (strategic bidding) and io.* (interchange formats) — pick your own next stop

The arc

Each tutorial answers a progressively harder question about the same kind of network:

  1. What's happening right now, given a dispatch someone else already chose (a plain power flow)?
  2. What should happen, if a single planner is free to choose the cheapest dispatch, and is that dispatch still safe if any one branch trips?
  3. What happens when participants get to bid — offers and elastic demand, cleared at a price with real settlement, rather than one planner minimising cost?
  4. Where does the story go from here — two independent directions, strategic bidding and real-world interchange formats, so you can pick whichever matches what you're actually building.

Every code cell in every notebook actually runs — they're executed fresh in CI on every push (nbmake), so the code you see is proven to run, not hand-typed illustration. The numbers rendered on this site are what running that code printed the last time someone re-executed and saved the notebook file, not something recomputed on every site build — CI proves the code doesn't break, it doesn't re-render this page's output. If you want fresh numbers, clone the repository and run the notebook yourself.

Prefer a faster, terser reference once the narrative isn't needed anymore? See Examples (thirteen short scripts, one concept each) or the Manual (the full class-by-class and module-by-module reference).