Skip to content

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

Open
Yunzhi-Chen wants to merge 16 commits into
mainfrom
yc/geohydro_debug
Open

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

Conversation

@Yunzhi-Chen

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

Copy link
Copy Markdown
Contributor

Summary

eq_rsc_INVlim previously scaled the entire supply curve by rsc_capacity_scalar but subtracted exogenous capacity at full value:

m_rsc_dat * rsc_capacity_scalar
    >= sum(INV_RSC) + capacity_exog_rsc

This PR revises the constraint to:

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

This implements Solution D from #84. Existing exogenous capacity is treated as already discovered, so the discovery rate applies only to the remaining resource available for new investment. Technologies without a capacity scalar use a multiplier of 1, making the revised formulation algebraically equivalent for those technologies.

The current main-branch preprocessing added by @atpham88 addresses the prescribed-build infeasibility primarily through Solution C, setting geo_discovery to 1 when the available resource is insufficient, with Solution A as a fallback that adds resource to bin 1.

This PR instead resolves the underlying supply-curve accounting through Solution D while retaining a narrower Solution A-style safeguard for prescribed builds. The safeguard adds only the positive bin-1 resource shortfall needed to keep cumulative prescribed builds feasible.

Technical details

Prescribed hydrothermal builds now retain their valid discovery trajectories rather than having geo_discovery overridden to 1 when the resource falls short.

The preprocessing in reeds/core/setup/b_inputs.gms calculates the resource required to support the year-specific cumulative prescriptions under the applicable discovery factor, net of existing capacity:

required resource in year t
    = cumulative prescribed builds through year t / geo_discovery(t)

resource shortfall
    = max(required resource across prescribed years)
      - (total supply-curve resource - existing capacity)

Only a positive shortfall is added to bin 1. This is an A-style feasibility safeguard, but it is limited to the amount needed for prescribed builds and does not replace the discovery trajectory.

Implementation notes

  • reeds/core/setup/c_model.gms — subtracts first-year exogenous capacity from m_rsc_dat before applying rsc_capacity_scalar, and removes the exogenous-capacity term from the investment side of eq_rsc_INVlim.
  • reeds/core/solve/3_solve_oneyear.gms — updates the rhs_eq_rsc_INVlim presolve calculation to match the revised equation. It also uses the generic rsc_capacity_scalar instead of the geothermal-specific geo_discovery; previously, the presolve RHS did not match the model equation for technologies with a non-geothermal capacity scalar.
  • reeds/core/setup/b_inputs.gms — preserves valid geothermal discovery trajectories and calculates any prescribed-build bin-1 top-up using year-specific cumulative prescriptions and discovery factors, net of existing capacity.
  • docs/source/model_documentation.md — documents the treatment of existing capacity and prescribed builds.

Issues resolved

Closes #84.

Validation, testing, and comparison report(s)

Comparison reports against main:

  • Reference case: [REFERENCE COMPARISON REPORT]
  • Western Interconnection case: [WESTERN INTERCONNECTION COMPARISON REPORT]

The comparison results show increased geothermal capacity and generation under the revised formulation. System-cost NPV decreases slightly because the less restrictive geothermal constraint allows the model to select additional geothermal resources.

The Western Interconnection runs were capped at one iteration because a separate issue prevents the stress-period solve from converging.

Checklist for author

Details to double-check

  • Charge code provided to reviewers
  • Included comparison reports for appropriate test cases
  • Documentation updated if necessary
  • Code formatting standardized
  • Reusable functions used where possible instead of copy/pasted code
  • Reran affected geothermal cases after the prescribed-build preprocessing update

General information to guide review

  • Zero impact on results of default case — hydrothermal geothermal results change by design. exog_rsc is otherwise limited to onswind and upv, which do not have a capacity scalar and are algebraically unaffected.
  • 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
  • No change to code organization
  • No change to package requirements

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

GitHub Copilot implemented the initial fix and drafted the original description. Codex refined the prescribed-build logic and revised the PR description. Claude Code reviewed the diff against main and provided feedback on the description.

@Yunzhi-Chen Yunzhi-Chen self-assigned this May 14, 2026
@Yunzhi-Chen
Yunzhi-Chen marked this pull request as ready for review June 10, 2026 22:43
@Yunzhi-Chen
Yunzhi-Chen requested a review from wesleyjcole June 10, 2026 23:23
@Yunzhi-Chen Yunzhi-Chen added bug Something isn't working and removed data_changes labels Jun 10, 2026

@wesleyjcole wesleyjcole left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. If Max says we can remove the evmc(i) piece, I think it can be removed entirely, either here or in a separate PR.

Because it has a pcat change, would you coordinate with An on her startyear PR (#12) before merging this in?

Comment thread reeds/core/setup/c_model.gms Outdated
@atpham88 atpham88 mentioned this pull request Jun 22, 2026
23 tasks
@github-actions github-actions Bot added the docs label Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working docs model_changes

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

2 participants