Locational Marginal Carbon Emissions (LMCEs) quantify the carbon impact of a load change at a specific grid node, but are only valid for load shifts of limited size. This repository provides tools to compute LMCE validity ranges using two methods:
- Analytical: largest load perturbation that preserves the current OPF basis. Fast, computed directly from the LP basis matrix
- Hybrid: extends the analytical range across basis pivots where LMCE is unchanged.
Both methods support single-bus and multi-bus (directional) load shifts. The directional extension enables analysis of coordinated load shifting across multiple nodes, including spatial load swapping (net-zero total demand).
This repository does not include network data.
- Clone https://github.com/GridMod/RTS-GMLC
- Copy the following into
data/rts_data/:
data/rts_data/
├── bus.csv
├── gen.csv
├── branch.csv
└── DAY_AHEAD/
├── DAY_AHEAD_regional_Load.csv
├── DAY_AHEAD_wind.csv
├── DAY_AHEAD_pv.csv
├── DAY_AHEAD_rtpv.csv
└── DAY_AHEAD_hydro.csv
Place any standard .m case file in data/matpower_data/. MATPOWER cases
can be downloaded from https://github.com/power-grid-lib/pglib-opf.
Note: MATPOWER cases do not include emissions data. Emissions intensities are
assigned from a cost-based mapping. See script/quick_start.jl
to customize.
Edit the USER SETTINGS block at the top of scripts/quick_start.jl:
const DATA_SOURCE = :rtsgmlc # :rtsgmlc or :matpower
const RTS_START = (2020, 2, 1, 22) # (year, month, day, period)
const RTS_NT = 1
const MATPOWER_FILE = "pglib_opf_case24_ieee_rts.m"
const BUS = "101" # use "1" for MATPOWER cases
const DIRECTION_RAW = Dict("101" => 1.0, "102" => -0.5, "103" => -0.5)Then run:
julia scripts/quick_start.jl
============================================================
Data Parsing + DC-OPF
============================================================
termination_status = OPTIMAL
objective_value = 14011.007423720866
============================================================
Single-Bus LMCE
============================================================
LMCE at bus 101 = 1036.4631013737035 kg/MWh
Analytical LMCE validity range at bus 101:
Δ ∈ [-149.3, 5.7] MW
Δ ∈ [-1.4932, 0.0568] PU
Hybrid LMCE validity range at bus 101:
Δ ∈ [-149.3, 5.7] MW
Δ ∈ [-1.4932, 0.0568] PU
============================================================
Directional LMCE
============================================================
Direction:
bus 101: +0.5
bus 102: -0.25
bus 103: -0.25
LMCE at bus 101 = 1036.4631 kg/MWh
LMCE at bus 102 = 1036.4631 kg/MWh
LMCE at bus 103 = 1036.4631 kg/MWh
Analytical directional validity range:
λ ∈ [-4.7809, 6.1265] PU (scale factor)
Load changes at λmax:
bus 101: +306.3 MW
bus 102: -153.2 MW
bus 103: -153.2 MW
Load changes at λmin:
bus 101: -239.0 MW
bus 102: +119.5 MW
bus 103: +119.5 MW
Hybrid directional validity range:
λ ∈ [-4.7809, 6.1265] PU (scale factor)
Load changes at λmax:
bus 101: +306.3 MW
bus 102: -153.2 MW
bus 103: -153.2 MW
Load changes at λmin:
bus 101: -239.0 MW
bus 102: +119.5 MW
bus 103: +119.5 MW
This code is provided under a BSD license as part of the Emissions Flexibility project, O5002.