Skip to content
24 changes: 16 additions & 8 deletions reeds/core/setup/b_inputs.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5789,7 +5789,7 @@ 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(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}.
Expand Down Expand Up @@ -5817,18 +5817,26 @@ 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.
*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)) ;
Expand Down
14 changes: 7 additions & 7 deletions reeds/core/setup/c_model.gms
Original file line number Diff line number Diff line change
Expand Up @@ -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")
- 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)

Expand All @@ -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) }

;

* ---------------------------------------------------------------------------
Expand Down
16 changes: 9 additions & 7 deletions reeds/core/solve/3_solve_oneyear.gms
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,22 @@ $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
*values where yeart(tt)==yeart(t) are variables rather than parameters because they are not
*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) }
;


Expand Down
Loading