NEMX.jl
Market dispatch and network-constrained optimal power flow for the Australian National Electricity Market.
NEMX does three things, which share a data layer and a set of conventions but are useful separately.
It reconstructs AEMO's five-minute regional dispatch from published data, closely enough to reproduce its prices. It lifts the identical market inputs onto a physical network model and re-solves them as an optimal power flow, across the whole PowerModels formulation family. And it models AC/DC optimal power flow with co-optimised frequency control ancillary services.
The second of those is the reason the package exists. A zonal market model and a nodal one usually differ in two ways at once — the network representation and the market data — which makes any difference between their prices uninterpretable. Here the market inputs are held byte-identical and only the network representation varies, so a difference in price is attributable to that change and to nothing else.
Where to start
| If you want to | Read |
|---|---|
| Install and run something immediately | Installation then Quick start |
| Understand how the pieces fit together | Architecture |
| Reproduce AEMO's published prices | Zonal benchmarking |
| Get nodal prices and a congestion decomposition | Network-resolved dispatch |
| Co-optimise energy and FCAS on an AC/DC network | OPF with FCAS |
| Know what a switch does before you flip it | Behavioural flags |
| Run something from the command line | Scripts |
The three submodules
NEMX — Module
NEMXMarket dispatch and network-constrained optimal power flow for the Australian National Electricity Market.
NEMX bundles three related but independently usable model families under one package. They share a data layer and a set of conventions, and they are deliberately kept as separate submodules so that a name defined for one cannot silently collide with a name defined for another.
| Submodule | Folder | What it does |
|---|---|---|
NEMX.ZBenchmark | src/zbenchmark/ | Zonal (copper-plate) reconstruction of the five-minute NEM dispatch from published AEMO data. Downloads the MMS tables and NEMDE case files, assembles a single-interval LP, and recovers regional energy and FCAS prices as its duals. |
NEMX.NBenchmark | src/nbenchmark/ | The same market inputs lifted onto a physical network model and re-solved as an optimal power flow, across the PowerModels formulation family. Yields nodal prices and an energy/congestion/loss decomposition. |
NEMX.OPFFCAS | src/opffcas/ | A modelling library for AC/DC optimal power flow with co-optimised frequency control ancillary services, built on PowerModels and PowerModelsACDC. |
Getting started
using NEMX
const ZB = NEMX.ZBenchmark # zonal reconstruction
const NB = NEMX.NBenchmark # nodal dispatch
const OF = NEMX.OPFFCAS # OPF with FCAS co-optimisationEach submodule's docstring gives its layout, its behavioural flags and a worked example; docs/ carries the full manual, including the data-acquisition workflow and a reference for every flag and script argument.
Runnable drivers live in scripts/, not in src/. Each takes its configuration from command-line arguments or environment variables — including which solver to use — and documents every one of them in its header.
Reproducibility
Every model in this package is deterministic given its inputs. Behavioural switches are module-level Refs whose defaults reproduce the validated configuration; none is changed implicitly by any function in the package, so a result is reproducible from the flag values recorded alongside it. Scripts print their full configuration before doing any work, for exactly that reason.
| Submodule | Folder | Role |
|---|---|---|
NEMX.ZBenchmark | src/zbenchmark/ | Zonal (copper-plate) dispatch reconstruction |
NEMX.NBenchmark | src/nbenchmark/ | Network-resolved nodal dispatch |
NEMX.OPFFCAS | src/opffcas/ | AC/DC OPF with FCAS co-optimisation |
They are separate modules rather than one flat namespace so that a name defined for one cannot silently collide with a name defined for another. Nothing stops you bringing a submodule's exports into scope:
using NEMX.ZBenchmark # dispatch!, get_energy_prices, ... unqualifiedDesign commitments
These are the rules the package holds itself to. They are worth stating because they constrain what it will do, not only what it can.
Defaults reproduce the validated configuration. Every behavioural switch is a module-level Ref whose default is the setting that reproduces published prices. Nothing in the package changes one implicitly. A result is therefore reproducible from the flag values recorded beside it, and scripts print their whole configuration before doing any work.
A quantity that is not identifiable is reported as such. The Queensland lower 6 s and 60 s FCAS prices are the standing example: their constraints are structurally identical, so the dispatch pins only the sum of their duals and the split between them is an artefact of which vertex the solver stopped at. The benchmark scores the sum and says why.
Nothing is dropped to make a result look better. The plotting scripts mark out-of-scale points at the frame edge rather than deleting them, and show a non-converged interval as a gap rather than interpolating across it.
No licensed solver is required. HiGHS, Ipopt and SCS cover everything.
Scope and limits
The synthetic 2000-bus network shipped with the package approximates the NEM's structure and is not a model of the actual transmission system. Quantities computed on it — nodal prices, congestion rents, loss components — are properties of that model. They are useful for comparing formulations against each other on identical inputs, which is what the package is for; they are not measurements of the real network.
Acknowledgements
The zonal reconstruction follows the modelling approach of nempy. The network layer is built on PowerModels.jl and PowerModelsACDC.jl. Market data is AEMO's, published through NEMWeb.