Honglin Li
  • Research
  • Projects
  • Publications
  • Software
  • Teaching
  • Learn
  • Notes
  • CV
  • Journeys

City Planner

Plan Prairie City’s heat, cars and rooftop solar, run its energy hub hour by hour against each district’s substation limit, and see what changes for each household group

Sandbox SB3 of Energy Systems, Step by Step: plan a fictional city’s heat pumps, retrofits, district heat, electric cars, rooftop solar and batteries, run its energy hub as a linear program against each district’s substation limit, and read a screening estimate of who pays.
  1. Learn
  2. SB3
  • Analyst to Modeler · L2–L3
  • Sandbox
  • 30 min
  • After F3 and A7 and F9 and A15
  • Completed
  1. 1Brief
  2. 2Bench
  3. 3Results
  4. 4Explain
  5. 5Sources

The brief

The city
Prairie City (fictional): 250,000 people in a dense core, suburbs and a rural fringe, each behind one substation (a teaching simplification); 2025's homes, prices and eight representative days.
You decide
How many furnaces become heat pumps; retrofits; a district-heat network in the core; electric cars (EVs) and how they charge; rooftop solar; batteries; whether substations may be upgraded.
The engine works out
A linear program (LP) runs the city's energy hub hour by hour at the least cost, each hour within each substation's limit, and buys upgrades only where the busiest hour needs them.
Who pays
Bills by household group and their energy burden: home energy bills as a share of income. Groups are bands of area median income (AMI).
It leaves out
Power flow inside a district, outages, growth to 2040, the cars' prices, and how bills are really set: the household table is a screening estimate, not an output of the LP.

Open-ended: start from a preset, change one thing at a time, and copy the plan link to keep a plan. Prairie City is fictional; its numbers are illustrative.

Siting with map layers is in the capstone C3: the same engine, with A19's map for a solar farm.

The bench

Control Default plan Range
Furnaces and resistance heat switched to heat pumps 0 % 0 to 100 %, in steps of 5 %
Buildings retrofitted 0 % 0 to 100 %, in steps of 5 %
Dense core's heat from a district network 0 % 0 to 50 %, in steps of 5 %
Network's heat pump 0 MW heat 0 to 250 MW heat, in steps of 10 MW heat
Network's heat store 0 MWh 0 to 2,000 MWh, in steps of 100 MWh
Cars that are electric 1 % 1 to 100 %, in steps of 1 %
EV charging Unmanaged one of: Unmanaged, Managed
Rooftop solar added 0 MW 0 to 400 MW, in steps of 10 MW
Batteries at the substations (4 hours) 0 MW 0 to 200 MW, in steps of 10 MW
Substation upgrades Allowed one of: Allowed, Not allowed
Upgrade cost 800 $/kW 200 to 2,000 $/kW, in steps of 50 $/kW
Heat a retrofit saves 18 % 10 to 50 %, in steps of 1 %
Retrofit cost 9,000 $/home 3,000 to 25,000 $/home, in steps of 500 $/home
Network cost 12,000 $/home 5,000 to 25,000 $/home, in steps of 500 $/home
Who adopts first Every group alike one of: Every group alike, Lower incomes first, Higher incomes first
Shared costs recovered Per kWh one of: Per kWh, Fixed charge, By income

With JavaScript on, you change these, run the hub in your browser and copy a link to your plan. Prairie City is fictional; its numbers are illustrative.

  • Illustrative: Prairie City, its districts, substation limits and household groups (prairie-city.json); retrofit, district-heat, store and upgrade costs are set for teaching, within ranges you can change.
  • Assumed: the heat network's gas boiler already exists (fuel only); managed cars are plugged in whenever needed; the weather is NOAA's normals on SPP's 2025 days (synthetic).
  • Based on public data: Kansas's 2025 prices (EIA), Wichita's weather normals (NOAA), SPP's 2025 hourly shapes (EIA-930), eGRID's 2023 SPP North CO₂ rate (EPA), DOE LEAD's income bands.
  • Costs: 2025 dollars; heat pumps and rooftop solar from EIA, batteries from NREL, paid yearly at 4% real over each item's life.

Results

Result: 2025 as it is, then "Electrify heat and cars" (80% of furnaces and resistance heat to heat pumps, half the cars electric) Value
2025 as it is: yearly cost against 2025 (2025 dollars; equipment and upgrades as yearly payments) $0.0M
2025 as it is: CO₂ of the three districts' buildings and cars 1,921,977 t a year
2025 as it is: busiest hour against the limit, core · suburbs · fringe 213/250 · 192/230 · 48/60 MW
2025 as it is: substation upgrades bought 0 MW
2025 as it is: energy burden, homes below 80% of area median income (screening estimate) 6.1%
Electrify heat and cars: yearly cost against 2025 (2025 dollars; equipment and upgrades as yearly payments) −$65.8M
Electrify heat and cars: CO₂ of the three districts' buildings and cars 1,527,234 t a year
Electrify heat and cars: busiest hour against the limit, core · suburbs · fringe 276/250 · 288/230 · 67/60 MW
Electrify heat and cars: substation upgrades bought 91 MW
Electrify heat and cars: energy burden, homes below 80% of area median income (screening estimate) 5.4%

Precomputed with HiGHS on 6 November 2026: the hub as a linear program over eight representative days. Prairie City is fictional; its numbers are illustrative. With JavaScript on, the bench runs your own plan.

How the engine works, as diagrams

The hub
Each hour, electricity through the substation, gas and rooftop sun must meet each district's heat, base load and car charging; heat pumps, furnaces, a heat network, batteries and managed charging sit between.
The limit
Each substation's flow stays below its limit every hour, unless the plan buys more room; the busiest hour decides, not the year's total.
It holds when
Eight representative days stand for 2025, storage shifts energy only within a day, and 2025's prices, people and homes stay as they are.
Who pays
Bills and energy burden by household group come from an accounting layer after the LP, with a stated rule for who adopts first.
Go deeper · ModelerThe linear program behind the bench

M12 writes the hub down: building shares as decisions, the balance in each district-hour, the substation’s ceiling and its dual, and a CO₂ cap whose dual is the cost of the last tonne. Its notebook rebuilds the model in Python with SciPy and HiGHS. The capstone C3 plans the city to 2040 on this engine.

Go deeperWhen two answers cost the same: the tie rule

With one electricity price all day, many schedules cost the same: a car can charge at 01:00 or 03:00. Small stated costs, left out of every reported number, pick one:

  • $20 a year per MW of each district's busiest hour, and $10 per MW of the three districts' busiest hour together: flexible loads spread out.
  • $1 per MWh out of a battery and $0.50 per MWh out of the heat store: no cycling for nothing.
  • $0.10 per MWh of managed charging, times the hour's share of SPP's peak demand: quieter hours first.

So the LP minimises the cost plus these small costs. On a few plans it pays a little to keep a busiest hour that is under its limit lower:

  • The price of the ties: under $30 a year in the engine's test, against the cheapest schedule found without them.
  • The same answer: every preset run again with the costs ×2 and ×0.1 gives the same numbers.
  • One answer: each busiest hour, upgrade and the energy bought is the same over all plans within $1 of the best cost.
  • Your plans: not checked this way; their hourly schedules can still differ.

Numbers, sources and what’s next

Inputs the engine uses

Input Value Source
Substation limits: core · suburbs · fringe 250 · 230 · 60 MW prairie-city.json: each district's 2025 busiest hour × 1.15, rounded up to the next 10 MW (17%, 20% and 25% above it; teaching)
Electricity, Kansas 2025: homes · businesses 14.44¢ · 11.19¢ per kWh Electric Power Annual, Table 2.10: Average Price of Electricity to Ultimate Customers by End-Use Sector, by State, 2025 and 2024 (EIA)
Gas, Kansas 2025: homes · businesses $14.81 · $11.90 per thousand cubic feet Natural Gas Prices, Kansas (annual) (EIA)
Grid CO₂ 862 lb per MWh, plus 5% losses EPA eGRID2023, SPP North
Heat pump COP, an illustrative curve 2.4 at −15 °C; 3.2 at 0 °C; 1 below −23 °C anchored to DOE's cold-climate challenge target, 2.4 at −15 °C (U.S. Department of Energy, 24 Sep 2021); the rest is the course's curve (lesson F3), with resistance backup assumed below −23 °C
Heat pump, per home $7,355, 15 years EIA AEO2026, residential (2022 dollars, converted)
Rooftop solar $4,738 per kW, 25 years EIA AEO2026, residential (2022 dollars, converted)
Battery, 4 hours $1,371 per kW, 15 years NREL 2025 update (2024 dollars, converted)
Retrofit: cost a home · heat saved · life $9,000 · 18% · 30 years set for teaching (illustrative): the defaults, which you change on the bench
Heat network: per home-equivalent · plant heat pump · heat store $12,000 (40 years) · $1,200 per kW of heat, COP 3 (25 years) · $3,000 per MWh (30 years) set for teaching (illustrative); 10% of the heat lost in the pipes; the gas boiler (90%) is assumed to exist already: its fuel is counted, not its construction
Substation upgrade $800 per kW, 40 years set for teaching (illustrative): the defaults, which you change on the bench
Managed charging any hours of the same day, at most a sixth of the day's charge in one hour set for teaching: cars plugged in at home or work whenever needed (an upper bound on what managed charging can do)
Yearly payments 4% real, over each item's life lesson 13's rate (NLR ATB 2025)

Keep going

Back to the course map

Built on

  • F3 (heat pumps and furnaces), A7 (flexible demand) and A17 (what a feeder's limit stands for).
  • Formalised in M12; applied in the capstone C3.
  • Open tools for larger city models: PyPSA, JuMP and Pyomo.

Sources and further reading

  • EIA. Electric Power Annual, Table 2.10: average price of electricity by state and sector, 2025.
  • EIA. Natural Gas Prices, Kansas, 2025.
  • EPA. eGRID summary data, eGRID2023 (revision 2): SPP North's CO₂ rate.
  • EIA. Carbon Dioxide Emissions Coefficients.
  • NOAA. U.S. Climate Normals 1991–2020: Wichita.
  • DOE. Low-Income Energy Affordability Data (LEAD) Tool: income bands and the definition of energy burden.
  • EIA. Assumptions to the Annual Energy Outlook 2026: Residential Demand Module, Tables 2–3 (heat pumps, rooftop solar).
  • DOE (24 September 2021). Residential Cold-Climate Heat Pump Technology Challenge Specification, version 1.2: the COP 2.4 at −15 °C target the course's illustrative curve passes through.
  • Cole, Ramasamy and Turan (2025). Cost Projections for Utility-Scale Battery Storage: 2025 Update. NREL/TP-6A40-93281.
  • Tonn and others (2014). Weatherization Works: Summary of Findings from the Retrospective Evaluation of the U.S. Department of Energy's Weatherization Assistance Program. ORNL/TM-2014/338, Oak Ridge National Laboratory (pp. xiv and 12).
  • Geidl and others (2007). Energy hubs for the future. IEEE Power and Energy Magazine 5(1), 24–30.
  • HiGHS. Documentation of the open-source solver that runs the bench in your browser.

Spotted an error, or stuck? Write to hlli@ksu.edu. Corrections are made in place and dated here.

Text licensed CC BY 4.0, code MIT: teachers and students may reuse and adapt it, with credit to Honglin Li.

© 2026 Honglin Li · Kansas State University · hlli@ksu.edu

 

Last updated: November 2026 · Built with Quarto