NEMS Open: porting EIA's NEMS to Python, checked against EIA's own Fortran

Hi all,

I’m porting EIA’s National Energy Modeling System (the model behind the Annual Energy Outlook) to open Python, and I’m looking for people who know the supply side to help with the solver modules.

EIA published the NEMS source on GitHub, but it needs Intel Fortran plus AIMMS, GAMS and a licensed S&P macro model to run, so almost nobody outside EIA can use it. The approach: compile EIA’s original Fortran with gfortran, run it outside NEMS on the published AEO2026 restart file, and dump its internal state before and after each routine. A Python port only counts when it reproduces that state.

So far the commercial buildings module’s core (floorspace, service demand, technology choice, consumption) matches EIA to float rounding, and US commercial energy use in 2050 matches to four decimals. Residential now matches too, and industrial and transportation are in progress.

Where I need help is the optimization side: electricity (ECP and EFD in AIMMS), coal, natural gas, refining (LFMM in GAMS), and an open stand-in for the S&P macro model. Those can’t match bit for bit on a different solver, so the first job is agreeing what a fair tolerance is. I’ve opened a scoping issue for each.

Repo: GitHub - joshuaag77-sketch/nems-open: Open Python rebuild of EIA's National Energy Modeling System, checked against EIA's own Fortran · GitHub

Any pointers welcome, including “someone already tried this, talk to X”.

Josh

This recently publicized C‑NEMS community project might be of interest: Announcing the development of Community NEMS.