Skip to content

Fix eq_rsc_INVlim infeasibility for geohydro_allkm by not applying geo_discovery to exogenous capacity#94

Draft
Yunzhi-Chen wants to merge 4 commits into
mainfrom
yc/geohydro_debug
Draft

Fix eq_rsc_INVlim infeasibility for geohydro_allkm by not applying geo_discovery to exogenous capacity#94
Yunzhi-Chen wants to merge 4 commits into
mainfrom
yc/geohydro_debug

Conversation

@Yunzhi-Chen
Copy link
Copy Markdown
Contributor

@Yunzhi-Chen Yunzhi-Chen commented May 14, 2026

Summary

Fix eq_rsc_INVlim infeasibility for geohydro_allkm (and other techs that use rsc_capacity_scalar) by reformulating the constraint so that rsc_capacity_scalar is applied only to the undiscovered portion of the supply curve (m_rsc_dat - capacity_exog_rsc), rather than to the full m_rsc_dat. Existing pre-start-year exogenous capacity is treated as already discovered.

Previously the equation took the form:

m_rsc_dat * rsc_capacity_scalar  >=  sum(INV_RSC) + capacity_exog_rsc

For geohydro_allkm, rsc_capacity_scalar equals geo_discovery (a fraction <1 in early years). When the exogenous (already-built) capacity in a bin happened to exceed m_rsc_dat * geo_discovery, the RHS became larger than the LHS and the constraint became infeasible together with eq_forceprescription_power. This was observed at p35023 in 2015 for geohydro_allkm_9 bin1 (RHS negative by ~0.447 MW) when running a county-level Western Interconnect case.

The reformulated equation is:

(m_rsc_dat - capacity_exog_rsc) * rsc_capacity_scalar  >=  sum(INV_RSC)

The physical interpretation: the supply available for new investment is the total resource minus what is already built; of that remaining resource, only fraction geo_discovery is currently discovered and therefore eligible for new INV_RSC. Existing exogenous plants are "discovered by definition" and do not need a discovery factor applied to them.

For non-scalar techs (rsc_capacity_scalar_i(i) = no), the multiplier collapses to 1 and the equation is unchanged, so behavior is preserved for all non-geothermal techs.

Technical details

Implementation notes

Two synchronized changes:

  1. reeds/core/setup/c_model.gms -- eq_rsc_INVlim: subtract the capacity_exog_rsc sum from m_rsc_dat inside the rsc_capacity_scalar group on the LHS, and remove the standalone capacity_exog_rsc term from the RHS.

  2. reeds/core/solve/3_solve_oneyear.gms -- rhs_eq_rsc_INVlim pre-solve calculation: mirror the equation. Use the general (1$[not rsc_capacity_scalar_i(i)] + rsc_capacity_scalar(i,r,t)$rsc_capacity_scalar_i(i)) factor instead of the previous geo_hydro-specific branch (1$[not geo_hydro(i)] + geo_discovery(i,r,t)$geo_hydro(i)). This is equivalent because rsc_capacity_scalar for geo_hydro already equals geo_discovery, and removes a special-case branch.

The pre-solve RHS calculation must mirror the equation exactly so the flag_eq_rsc_INVlim near-zero detection logic continues to work correctly.

Issues resolved

Closes #84 -- eq_rsc_INVlim infeasibility for geohydro_allkm when exogenous capacity exceeds m_rsc_dat * geo_discovery.

Validation, testing, and comparison report(s)

  • Re-ran county level Western Interconenction -- previously infeasible, now solves.
  • Reference case

Checklist for author

Details to double-check

  • Charge code provided to reviewers
  • Included comparison reports for appropriate test cases
  • Documentation updated if necessary (no user-facing switches or input files changed)
  • Code formatting standardized
  • Reusable functions used where possible instead of copy/pasted code

General information to guide review

  • Zero impact on results of default case (multiplier collapses to 1 for non-scalar techs)
  • No large data file(s) added/modified
  • No substantive impact on runtime for full-US reference case
  • No substantive impact on folder size for full-US reference case
  • No change to process flow (runreeds.py, reeds/core/solve/solve.py)
  • No change to code organization
  • No change to package requirements (environment.yml or Project.toml)

Did you use LLM tools (chatbot or copilot) in the preparation of this PR? If so, describe how

Used GitHub Copilot to commit the fix suggested by @wesleyjcole and draft this PR description.

Tag points of contact here if you would like additional review of the relevant parts of the model

@Yunzhi-Chen Yunzhi-Chen self-assigned this May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eq_rsc_INVlim infeasibility for geohydro_allkm when exogenous capacity exceeds m_rsc_dat * geo_discovery

1 participant