Fix eq_rsc_INVlim infeasibility for geohydro_allkm by not applying geo_discovery to exogenous capacity - #94
Open
Yunzhi-Chen wants to merge 10 commits into
Open
Fix eq_rsc_INVlim infeasibility for geohydro_allkm by not applying geo_discovery to exogenous capacity#94Yunzhi-Chen wants to merge 10 commits into
Yunzhi-Chen wants to merge 10 commits into
Conversation
wesleyjcole
approved these changes
Jun 16, 2026
wesleyjcole
left a comment
Contributor
There was a problem hiding this comment.
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?
| 1$[not rsc_capacity_scalar_i(i)] + rsc_capacity_scalar(i,r,t)$rsc_capacity_scalar_i(i)) | ||
| *capacity indicated by the resource supply curve minus exogenous (pre-start-year) | ||
| *capacity (scaled by rsc_capacity_scalar) | ||
| (m_rsc_dat(r,i,rscbin,"cap")$[not evmc(i)] |
Contributor
There was a problem hiding this comment.
@Max-Vanatta - should this [not evmc(i)] be here? It is the only place where it is used in the entire model.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix eq_rsc_INVlim infeasibility for geohydro_allkm and other technologies that use rsc_capacity_scalar.
Previously, rsc_capacity_scalar was applied to the full resource supply curve capacity:
For geohydro_allkm, rsc_capacity_scalar is based on geo_discovery and can be less than 1 in early years. This incorrectly applied the discovery factor to exogenous capacity that had already been built and was therefore already discovered.
If exogenous capacity exceeded m_rsc_dat * geo_discovery, eq_rsc_INVlim could become infeasible together with eq_forceprescription_power. This occurred at p35023 in 2015 for geohydro_allkm_9 bin1 in a county-level Western Interconnection case.
The equation is reformulated as:
With this formulation, existing exogenous capacity is treated as already discovered. The capacity scalar is applied only to the remaining resource available for new investment.
For technologies that do not use a capacity scalar, the multiplier is 1 and the reformulated equation is algebraically equivalent to the previous equation. Therefore, behavior is preserved for non-scalar technologies.
Code changes
Updated eq_rsc_INVlim to:
Updated the rhs_eq_rsc_INVlim pre-solve calculation to match the revised model equation. Keeping these two formulations synchronized is necessary because rhs_eq_rsc_INVlim is used to identify very small resource limits and fix the corresponding INV_RSC variables to zero.
Interaction with PR #12
An earlier version of this PR also included a temporary b_inputs.gms change that extended the pcat-based geothermal prescribed-build adjustment to geohydro_allkm.
PR #12 subsequently removed the pcat dependency and reworked prescribed-build handling. The current main branch now:
As a result, the temporary b_inputs.gms change is no longer needed and is not part of the current PR diff.
Issue resolved
Closes #84.
Validation and testing
The original county-level Western Interconnection reproducer was previously infeasible and solved successfully with this equation change.
The original comparison run used a maximum iteration count of 1 because the default configuration took more than five days for a single solve year due to PRAS convergence difficulties associated with initial transmission capacity. The complete run finished in approximately 70 hours.
Comparison report:
https://github.com/user-attachments/files/28815528/report.2.html
Reference-case report:
https://github.com/user-attachments/files/28815517/report.1.html
After merging the latest main branch and the prescribed-build changes from PR #12:
Checklist
Details to double-check
[ ] Charge code provided to reviewers
[x] Included comparison reports for appropriate test cases
[x] Documentation updated if necessary; no user-facing switches or input files changed
[x] Code formatting standardized
[x] Reusable functions used where appropriate
General information
[x] No expected impact on default-case results for technologies without rsc_capacity_scalar
[x] No large data files added or modified
[x] No substantive expected impact on runtime
[x] No substantive expected impact on case folder size
[x] No change to process flow
[x] No change to code organization
[x] No change to package requirements
LLM usage
GitHub Copilot was used to implement the suggested fix and draft the original PR description.