From 21c08bd80a282206a4ba4c4e6525acbdadc9d1fd Mon Sep 17 00:00:00 2001 From: Yunzhi-Chen Date: Thu, 14 May 2026 13:20:50 -0600 Subject: [PATCH 1/3] Fix the geohydro bug by not apply geo discovery in exogenous capacity --- reeds/core/setup/c_model.gms | 14 +++++++------- reeds/core/solve/3_solve_oneyear.gms | 16 +++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/reeds/core/setup/c_model.gms b/reeds/core/setup/c_model.gms index c6a8b834..644c3916 100644 --- a/reeds/core/setup/c_model.gms +++ b/reeds/core/setup/c_model.gms @@ -1025,9 +1025,13 @@ eq_rsc_INVlim(r,i,rscbin,t)$[tmodel(t) *but the combination of m_rsc_con and rsc_agg allows for those investments *to be limited by the numeraire techs' m_rsc_dat -*capacity indicated by the resource supply curve (scaled by rsc_capacity_scalar) - m_rsc_dat(r,i,rscbin,"cap")$[not evmc(i)] * ( - 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)] + - sum{(ii,v,tt)$[tfirst(tt)$rsc_agg(i,ii)$exog_rsc(i)], + capacity_exog_rsc(ii,v,r,rscbin,tt) } ) + * (1$[not rsc_capacity_scalar_i(i)] + + rsc_capacity_scalar(i,r,t)$rsc_capacity_scalar_i(i)) * available hydro upgrade capacity + hyd_add_upg_cap(r,i,rscbin,t)$(Sw_HydroCapEnerUpgradeType=1) @@ -1037,10 +1041,6 @@ eq_rsc_INVlim(r,i,rscbin,t)$[tmodel(t) sum{(ii,v,tt)$[valinv(ii,v,r,tt)$(yeart(tt) <= yeart(t))$rsc_agg(i,ii)], INV_RSC(ii,v,r,rscbin,tt) * resourcescaler(ii) } -*plus exogenous (pre-start-year) capacity, using its level in the first year (tfirst) - + sum{(ii,v,tt)$[tfirst(tt)$rsc_agg(i,ii)$exog_rsc(i)], - capacity_exog_rsc(ii,v,r,rscbin,tt) } - ; * --------------------------------------------------------------------------- diff --git a/reeds/core/solve/3_solve_oneyear.gms b/reeds/core/solve/3_solve_oneyear.gms index dde80524..bc0c00ea 100644 --- a/reeds/core/solve/3_solve_oneyear.gms +++ b/reeds/core/solve/3_solve_oneyear.gms @@ -42,10 +42,15 @@ $ifthene.post_startyear %cur_year%>%startyear% * infeasible or result in very tiny number (order 1e-16) in the matrix rhs_eq_rsc_INVlim(r,i,rscbin,t)$[tmodel(t)$rsc_i(i)$m_rscfeas(r,i,rscbin)$m_rsc_con(r,i)] = -*capacity indicated by the resource supply curve (with undiscovered geo available -*at the "discovered" amount and hydro upgrade availability adjusted over time) - m_rsc_dat(r,i,rscbin,"cap") * ( - 1$[not geo_hydro(i)] + geo_discovery(i,r,t)$geo_hydro(i)) +*capacity indicated by the resource supply curve minus exogenous (pre-start-year) +*capacity, using its level in the first year (tfirst), scaled by rsc_capacity_scalar +*(which equals geo_discovery for geo_hydro and adjusts undiscovered geo to the +*"discovered" amount), plus hydro upgrade availability adjusted over time + ( m_rsc_dat(r,i,rscbin,"cap") + - sum{(ii,v,tt)$[tfirst(tt)$rsc_agg(i,ii)$exog_rsc(i)], + capacity_exog_rsc(ii,v,r,rscbin,tt) } ) + * (1$[not rsc_capacity_scalar_i(i)] + + rsc_capacity_scalar(i,r,t)$rsc_capacity_scalar_i(i)) + hyd_add_upg_cap(r,i,rscbin,t)$(Sw_HydroCapEnerUpgradeType=1) *minus the cumulative invested capacity in that region/class/bin... *Note that yeart(tt) is stricly < here, while it is <= in eq_rsc_INVlim. That is because @@ -53,9 +58,6 @@ rhs_eq_rsc_INVlim(r,i,rscbin,t)$[tmodel(t)$rsc_i(i)$m_rscfeas(r,i,rscbin)$m_rsc_ *values from prior solve years. - sum{(ii,v,tt)$[valinv(ii,v,r,tt)$(yeart(tt) < yeart(t))$rsc_agg(i,ii)], INV_RSC.l(ii,v,r,rscbin,tt) * resourcescaler(ii) } -*minus exogenous (pre-start-year) capacity, using its level in the first year (tfirst) - - sum{(ii,v,tt)$[tfirst(tt)$rsc_agg(i,ii)$exog_rsc(i)], - capacity_exog_rsc(ii,v,r,rscbin,tt) } ; From fc19f8f0aeea6d1d98155036d273e4bd9e1c6742 Mon Sep 17 00:00:00 2001 From: Yunzhi-Chen Date: Wed, 20 May 2026 16:01:10 -0600 Subject: [PATCH 2/3] Create cases_geohydro.csv --- cases_geohydro.csv | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 cases_geohydro.csv diff --git a/cases_geohydro.csv b/cases_geohydro.csv new file mode 100644 index 00000000..584e1a5e --- /dev/null +++ b/cases_geohydro.csv @@ -0,0 +1,6 @@ +,Default Value,Western_Interconnect,Reference +ignore,0,, +GSw_Region,,interconnect/western, +GSw_ZoneSet,,z3109, +endyear,2050,, +GSw_GasCurve,2,, \ No newline at end of file From f00fa332ef5cf756e6e296fe85de61298c320a7f Mon Sep 17 00:00:00 2001 From: Yunzhi-Chen Date: Thu, 21 May 2026 12:58:38 -0600 Subject: [PATCH 3/3] Update b_inputs.gms --- reeds/core/setup/b_inputs.gms | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/reeds/core/setup/b_inputs.gms b/reeds/core/setup/b_inputs.gms index e2a65430..5ffdc0aa 100644 --- a/reeds/core/setup/b_inputs.gms +++ b/reeds/core/setup/b_inputs.gms @@ -6386,8 +6386,8 @@ cap_prescribed(i,r)$rsc_i(i) = sum{(pcat,t)$[(sameas(pcat,i) or prescriptivelink *Loop over all regions loop(r, -*Loop over non-geothermal rsc technologies - loop(i$[rsc_i(i)$sum{(v,t)$newv(v), valcap(i,v,r,t) }$(not prescriptivelink("geothermal",i))], +*Loop over non-geothermal rsc technologies (exclude geo_hydro since it needs discovery-aware adjustment) + loop(i$[rsc_i(i)$sum{(v,t)$newv(v), valcap(i,v,r,t) }$(not prescriptivelink("geothermal",i))$(not geo_hydro(i))], *Get total available supply for all ii associated with pcat of i. *For example, if i = {upv_2}, then ii = {upv_2, upv_3, ...} and pcat = {UPV}. @@ -6415,18 +6415,28 @@ rsc_cap_diff(r,i,rscbin) = m_rsc_dat(r,i,rscbin,"cap") - m_rsc_dat_original(r,i, *Round up to the nearest 3rd decimal place m_rsc_dat(r,i,rscbin,"cap")$m_rsc_dat(r,i,rscbin,"cap") = ceil(m_rsc_dat(r,i,rscbin,"cap") * 1000) / 1000 ; -*Geothermal is not a tech with sameas(i,pcat), so handle it separately here -*Loop over regions that have geothermal prescribed builds -loop(r$sum{(i,t)$[prescriptivelink("geothermal",i)$tmodel_new(t)], noncumulative_prescriptions("geothermal",r,t) }, +*Geothermal is not a tech with sameas(i,pcat), so handle it separately here. +*Need to handle both "geothermal" pcat AND "geohydro_allkm" pcat because prescribed +*builds from the generator database use pcat "geohydro_allkm" (not "geothermal"). +*Loop over regions that have geothermal prescribed builds (either pcat) +set geo_pcat(pcat) "geothermal pcats that need discovery-aware feasibility adjustment" ; +geo_pcat("geothermal") = yes ; +geo_pcat("geohydro_allkm") = yes ; + +parameter geo_prescrip_total(r) "--MW-- total geo prescribed capacity in a region across geo pcats" ; +geo_prescrip_total(r) = sum{(pcat,t)$[geo_pcat(pcat)$tmodel_new(t)], + noncumulative_prescriptions(pcat,r,t) } ; + +loop(r$geo_prescrip_total(r), *Then loop over eligible geothermal technologies - loop(i$[prescriptivelink("geothermal",i)$sum{(v,t)$newv(v), valcap(i,v,r,t) }$geo_discovery(i,r,"%startyear%")], + loop(i$[sum{pcat$geo_pcat(pcat), prescriptivelink(pcat,i) }$sum{(v,t)$newv(v), valcap(i,v,r,t) }$geo_discovery(i,r,"%startyear%")], *If capacity is insufficient, add enough capacity to make the model feasible -*Use the 2010 geothermal discovery (geo_discovery) rate for the calculation. That will slightly +*Use the startyear geothermal discovery (geo_discovery) rate for the calculation. That will slightly *overestimate geothermal resource for any prescribed builds happening after the discovery rate *begins to increase (currently after 2021) - m_rsc_dat(r,i,"bin1","cap")$[((sum{(rscbin), m_rsc_dat(r,i,rscbin,"cap") } * (1$[not geo_hydro(i)] + geo_discovery(i,r,"%startyear%")$geo_hydro(i))) < sum{t$tmodel_new(t), noncumulative_prescriptions("geothermal",r,t) }) + m_rsc_dat(r,i,"bin1","cap")$[((sum{(rscbin), m_rsc_dat(r,i,rscbin,"cap") } * (1$[not geo_hydro(i)] + geo_discovery(i,r,"%startyear%")$geo_hydro(i))) < geo_prescrip_total(r)) $(1$[not geo_hydro(i)] + geo_discovery(i,r,"%startyear%")$geo_hydro(i))] = - (sum{t$tmodel_new(t), noncumulative_prescriptions("geothermal",r,t) } + (geo_prescrip_total(r) - sum{(rscbin), m_rsc_dat(r,i,rscbin,"cap") } + m_rsc_dat(r,i,"bin1","cap") ) / (1$[not geo_hydro(i)] + geo_discovery(i,r,"%startyear%")$geo_hydro(i)) ;