Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cases.csv
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ coalscen,"Coal price scenario (inputs\fuelprices\{coalscen}.csv). The options fo
demandscen,Demand scenario (see inputs\load),N/A,AEO_2025_reference,
dr_shedscen,DR shed scenario,demo_data_January_2025,demo_data_January_2025,
evmcscen,EVMC scenario for load and supply curve and flexibility,Baseline,Baseline,
GSw_FINITO_Link,Switch to enable linkage with FINITO,0; 1,0,
finito_dir,Directory with cloned FINITO repository,N/A,/projects/finito/molmezt/FINITO,
finito_cases_file,"extension of the FINITO cases file including all scenarios to be run, e.g., 'linked' for cases_linked.csv",N/A,linked,
finito_case,Case name for FINITO in {finito_dir}/cases_linked.csv; use 'same' if the scenario name in cases_linked.csv matches the scenario name in the cases file,N/A,BAU,
first_year_finito,First year when the FINITO module is enabled,N/A,2018,
geodiscov,Annual discover rates for new geothermal sites,BAU; TI,BAU,
geohydrosupplycurve,Geohydro Supply Curve,ATB_2023,ATB_2023,
egssupplycurve,EGS Supply Curve,ATB_2023; reV,reV,
Expand Down
44 changes: 44 additions & 0 deletions cases_finito.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
,Default Value,ReEDSonly,BAUreg,Reference,Reference-AEO,Reference-HOG,TradeReference,TradeReference-AEO,Trade-HOG,Reference-LowBio,Reference-HighBio,Tax200,Tax200-AEO,NetZero,NetZero-LowBio,NetZero-HighBio,NetZero-SlackLim1500,NetZero-SlackLim1500-CO2Stor-Mid,NetZero-SlackLim1500-CO2Stor-Low,NetZero-SlackLim500-CO2Stor-Low,NetZero-SlackCost2500-CO2Stor-Low,aggreg_54_level
ignore,1,1,0,1,1,1,1,1,1,,,,,,,,,,,,,
GSw_FINITO_Link,1,0,,,,,,,,,,,,,,,,,,,,
finito_dir,/path/to/FINITO/directory,0,,,,,,,,,,,,,,,,,,,,
finito_cases_file,linked,,,,,,,,,,,,,,,,,,,,,
finito_case,BAU,,BAUreg,,BAU-AEO,AEO-HOG,TradeReEDS,TradeReEDS-AEO,TradeReEDS-HOG,BAU-LowBio,BAU-HighBio,,BAU-AEO,NetZero,NetZero-LowBio,NetZero-HighBio,NetZero-SlackLim1500,NetZero-SlackLim1500-CO2Stor-Mid,NetZero-SlackLim1500-CO2Stor-Low,NetZero-SlackLim500-CO2Stor-Low,NetZero-SlackCost2500-CO2Stor-Low,aggreg_54_level
coalscen,AEO_2025_reference,,,,,,,,,,,,,,,,,,,,,
ngscen,AEO_2025_reference,,,,,AEO_2025_HOG,,,AEO_2025_HOG,,,,,,,,,,,,,
uraniumscen,AEO_2025_reference,,,,,,,,,,,,,,,,,,,,,
GSw_Region,country/USA,,st/CO,,,,,,,,,,,,,,,,,,,
GSw_ZoneSet,z54,,,,,,,,,,,,,,,,,,,,,z54
GSw_GasCurve,1,,2,,,,,,,,,,,,,,,,,,,
GSw_gopt,2,,,,,,,,,,,,,,,,,,,,,
GSw_NewValCapShrink,1,,,,,,,,,,,,,,,,,,,,,
endyear,2050,,2035,,,,,,,,,,,,,,,,,,,
yearset,2010_2015_2020..2050..5,,,,,,,,,,,,,,,,,,,,,
first_year_finito,2018,,,,,,,,,,,,,,,,,,,,,
incentives_suffix,obbba,,,,,,,,,,,,,,,,,,,,,
GSw_Upgrades,0,,,,,,,,,,,,,,,,,,,,,
GSw_AnnualCap,0,,,,,,,,,,,,,,,,,,,,,
GSw_AnnualCapScen,start2023_100pct2035,,,,,,,,,,,,,,,,,,,,,
GSw_Clean_Air_Act,0,,,,,,,,,,,,,,,,,,,,,
GSw_CSP,0,,,,,,,,,,,,,,,,,,,,,
GSw_Geothermal,0,,,,,,,,,,,,,,,,,,,,,
GSw_H2,2,,,,,,,,,,,,,,,,,,,,,
GSw_H2_PTC,0,,,,,,,,,,,,,,,,,,,,,
GSw_H2_Demand_Case,BAU,,,,,,,,,,,,,,,,,,,,,
GSw_H2_SMR,1,,,,,,,,,,,,,,,,,,,,,
GSw_H2_Transport,0,,,,,,,,,,,,,,,,,,,,,
GSw_H2Combustion,1,,,,,,,,,,,,,,,,,,,,,
GSw_H2Combustionupgrade,1,,,,,,,,,,,,,,,,,,,,,
GSw_H2CombinedCycle,1,,,,,,,,,,,,,,,,,,,,,
GSw_DAC,1,,,,,,,,,,,,,,,,,,,,,
GSw_BECCS,1,,,,,,,,,,,,,,,,,,,,,
GSw_TCPhaseout,1,,,,,,,,,,,,,,,,,,,,,
GSw_CO2_Detail,1,,,,,,,,,,,,,,,,,,,,,
numhintage,4,,,,,,,,,,,,,,,,,,,,,
GSw_CarbTax,0,,,,,,,,,,,1,1,,,,,,,,,
GSw_CarbTaxOption,default,,,,,,,,,,,t200_2050,t200_2050,,,,,,,,,
GSw_PRM_CapCredit,0,,,,,,,,,,,,,,,,,,,,,
GSw_PRM_StressIterateMax,0,,,,,,,,,,,,,,,,,,,,,
GSw_HourlyNumClusters,9,,,,,,,,,,,,,,,,,,,,,
GSw_HourlyChunkLengthRep,4,,,,,,,,,,,,,,,,,,,,,
GSw_HourlyChunkLengthStress,4,,,,,,,,,,,,,,,,,,,,,
9 changes: 9 additions & 0 deletions helpers/restart_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import shutil
import subprocess
import argparse
import re
from glob import glob
from pathlib import Path
sys.path.append(str(Path(__file__).parent.parent))
Expand Down Expand Up @@ -95,6 +96,14 @@

#%% Copy additional files if desired
for f in more_copyfiles:
if f.lower().startswith('finito'):
# if file starts with 'finito' append the finito directory
sw = reeds.io.get_switches(case)
if int(sw.GSw_FINITO_Link):
f_copy = re.sub("^finito/", "" , f, flags=re.IGNORECASE)
shutil.copy(os.path.join(sw.finito_dir,f_copy), os.path.join(case,f))
else:
shutil.copy(os.path.join(reeds_path,f), os.path.join(case,f))
shutil.copy(f, Path(case, f))
if copy_reeds:
shutil.copytree(Path(reeds_path, 'reeds'), Path(case, 'reeds'), dirs_exist_ok=True)
Expand Down
11 changes: 11 additions & 0 deletions reeds/core/setup/a_createmodel.gms
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ $setglobal ds /
$endif.unix

$include reeds%ds%core%ds%setup%ds%b_inputs.gms

$ifthene.finito_link %GSw_FINITO_Link% == 1
$include finito%ds%model%ds%finito_input.gms
$include finito%ds%model%ds%finito_vars_eqs.gms
$endif.finito_link

$include reeds%ds%core%ds%setup%ds%c_model.gms

$ifthene.finito_link %GSw_FINITO_Link% == 1
$include finito%ds%model%ds%finito_model.gms
$endif.finito_link

$include reeds%ds%core%ds%setup%ds%d_objective.gms
$include reeds%ds%core%ds%setup%ds%d_mga.gms
$include reeds%ds%core%ds%setup%ds%e_solveprep.gms
11 changes: 9 additions & 2 deletions reeds/core/setup/b_inputs.gms
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,8 @@ set tmodel(t) "years to include in the model",
tfix(t) "years to fix variables over when summing over previous years",
tprev(t,tt) "previous modeled tt from year t",
stfeas(st) "states to include in the model",
tsolved(t) "years that have solved" ;
tsolved(t) "years that have solved",
tfuel(t) "years that use ReEDS fuel supply curve module (otherwise uses supply curves in FINITO)" ;

*following parameters get re-defined when the solve years have been declared
parameter mindiff(t) "minimum difference between t and all other tt that are in tmodel(t)" ;
Expand All @@ -1031,7 +1032,7 @@ tfix(t) = no ;
stfeas(st) = no ;
tprev(t,tt) = no ;
tsolved(t) = no ;

tfuel(t)=no;

*==============================
* Year specification
Expand All @@ -1046,6 +1047,12 @@ tprev(t,tt)$[tmodel_new(t)$tmodel_new(tt)$(tt.val<t.val)] = yes ;
mindiff(t)$tmodel_new(t) = smin{tt$tprev(t,tt), t.val-tt.val} ;
tprev(t,tt)$[tmodel_new(t)$tmodel_new(tt)$(t.val-tt.val<>mindiff(t))] = no ;

* If FINITO linkage is on, remove all modeled years from tfuel after first_year_finito
* as the FINITO supply curves will be used instead of those in ReEDS;
* otherwise, all modeled years use ReEDS supply curves and are eligible for tfuel
tfuel(t)$[tmodel_new(t)]=yes;
tfuel(t)$[tmodel_new(t)$Sw_FINITO_Link$(t.val>=%first_year_finito%)] = no ;

* In order to fill all necessary dimensions of upgrade techs parameters, we require
* Sw_UpgradeYear in ban(i) to be a modeled year and thus we compute as either
* the GSw_UpgradeYear option or the next modeled years after GSw_UpgradeYear
Expand Down
76 changes: 66 additions & 10 deletions reeds/core/setup/c_model.gms
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,14 @@ eq_loadcon(r,h,t)$tmodel(t)..
* (the effect is the same but avoiding the h-indexed OP_LOADSITE reduces solve time)
+ OP_LOADSITE(r,h,t)$[Sw_LoadSiteCF$(Sw_LoadSiteCF<1)$val_loadsite(r)]
+ CAP_LOADSITE(r,t)$[(Sw_LoadSiteCF=1)$val_loadsite(r)]

* [plus] load for industrial and converted fuel facilities (FINITO),
* including the PRM for stress periods
* USE_ELE_FINITO is end-use, so divide by (1-distloss) to convert it to busbar
* [MWh/hr = MW]
$ifthene.linked_load Sw_FINITO_Link==1
+ (USE_ELE_FINITO(r,h,t) / (1.0 - distloss))$[t_finito(t)] * (1 + prm(r,t)$h_stress(h))
$endif.linked_load
;

* ---------------------------------------------------------------------------
Expand Down Expand Up @@ -2881,7 +2889,7 @@ eq_national_gen(t)$[tmodel(t)$national_gen_frac(t)$Sw_GenMandate]..
* ---------------------------------------------------------------------------

*gas used from each bin is the sum of all gas used
eq_gasused(cendiv,h,t)$[tmodel(t)$((Sw_GasCurve=0) or (Sw_GasCurve=3))]..
eq_gasused(cendiv,h,t)$[tmodel(t)$tfuel(t)$((Sw_GasCurve=0) or (Sw_GasCurve=3))]..

sum{gb,GASUSED(cendiv,gb,h,t) }

Expand All @@ -2898,7 +2906,7 @@ eq_gasused(cendiv,h,t)$[tmodel(t)$((Sw_GasCurve=0) or (Sw_GasCurve=3))]..
* ---------------------------------------------------------------------------

* gas from each bin needs to less than its capacity
eq_gasbinlimit(cendiv,gb,t)$[tmodel(t)$(Sw_GasCurve=0)]..
eq_gasbinlimit(cendiv,gb,t)$[tmodel(t)$tfuel(t)$(Sw_GasCurve=0)]..

gaslimit(cendiv,gb,t)

Expand All @@ -2909,7 +2917,7 @@ eq_gasbinlimit(cendiv,gb,t)$[tmodel(t)$(Sw_GasCurve=0)]..

* ---------------------------------------------------------------------------

eq_gasbinlimit_nat(gb,t)$[tmodel(t)$(Sw_GasCurve=3)]..
eq_gasbinlimit_nat(gb,t)$[tmodel(t)$tfuel(t)$(Sw_GasCurve=3)]..

gaslimit_nat(gb,t)

Expand All @@ -2922,7 +2930,7 @@ eq_gasbinlimit_nat(gb,t)$[tmodel(t)$(Sw_GasCurve=3)]..

* ---------------------------------------------------------------------------

eq_gasaccounting_regional(cendiv,t)$[tmodel(t)$(Sw_GasCurve=1)]..
eq_gasaccounting_regional(cendiv,t)$[tmodel(t)$tfuel(t)$(Sw_GasCurve=1)]..

sum{fuelbin, VGASBINQ_REGIONAL(fuelbin,cendiv,t) }

Expand All @@ -2935,7 +2943,7 @@ eq_gasaccounting_regional(cendiv,t)$[tmodel(t)$(Sw_GasCurve=1)]..

* ---------------------------------------------------------------------------

eq_gasaccounting_national(t)$[tmodel(t)$(Sw_GasCurve=1)]..
eq_gasaccounting_national(t)$[tmodel(t)$tfuel(t)$(Sw_GasCurve=1)]..

sum{fuelbin,VGASBINQ_NATIONAL(fuelbin,t) }

Expand All @@ -2948,7 +2956,7 @@ eq_gasaccounting_national(t)$[tmodel(t)$(Sw_GasCurve=1)]..

* ---------------------------------------------------------------------------

eq_gasbinlimit_regional(fuelbin,cendiv,t)$[tmodel(t)$(Sw_GasCurve=1)]..
eq_gasbinlimit_regional(fuelbin,cendiv,t)$[tmodel(t)$tfuel(t)$(Sw_GasCurve=1)]..

Gasbinwidth_regional(fuelbin,cendiv,t)

Expand All @@ -2959,7 +2967,7 @@ eq_gasbinlimit_regional(fuelbin,cendiv,t)$[tmodel(t)$(Sw_GasCurve=1)]..

* ---------------------------------------------------------------------------

eq_gasbinlimit_national(fuelbin,t)$[tmodel(t)$(Sw_GasCurve=1)]..
eq_gasbinlimit_national(fuelbin,t)$[tmodel(t)$tfuel(t)$(Sw_GasCurve=1)]..

Gasbinwidth_national(fuelbin,t)

Expand All @@ -2973,10 +2981,10 @@ eq_gasbinlimit_national(fuelbin,t)$[tmodel(t)$(Sw_GasCurve=1)]..
*==============================
* -- Bioenergy Supply Curve --
*==============================
* defer to FINITO representation when models are linked

* ---------------------------------------------------------------------------

eq_bioused(r,t)$[sum{(i,v)$(bio(i) or cofire(i)), valgen(i,v,r,t) }$tmodel(t)]..
eq_bioused(r,t)$[sum{(i,v)$(bio(i) or cofire(i)), valgen(i,v,r,t) }$tmodel(t)$tfuel(t)]..

sum{bioclass, BIOUSED(bioclass,r,t) }

Expand All @@ -2995,7 +3003,7 @@ eq_bioused(r,t)$[sum{(i,v)$(bio(i) or cofire(i)), valgen(i,v,r,t) }$tmodel(t)]..
* ---------------------------------------------------------------------------

* biomass consumption limit is annual
eq_biousedlimit(bioclass,usda_region,t)$tmodel(t)..
eq_biousedlimit(bioclass,usda_region,t)$[tmodel(t)$tfuel(t)]..

biosupply(usda_region,bioclass,"cap")

Expand Down Expand Up @@ -3565,6 +3573,11 @@ eq_h2_demand(p,t)$[(sameas(p,"H2"))$tmodel(t)$(yeart(t)>=h2_demand_start)$(Sw_H2
+ sum{(i,v,r,h)$[valgen(i,v,r,t)$h2_combustion(i)$h_rep(h)],
GEN(i,v,r,h,t) * hours(h) * h2_combustion_intensity * heat_rate(i,v,r,t)
}

* hydrogen demand from indusrty (FINITO): FINITO demand [MMBtu/yr] * conversion [metric tons-H2/MMBtu-H2]
$ifthene.linked_h2_nat Sw_FINITO_Link==1
+ [sum{(r,h)$h_rep(h), hours(h) * USE_H2_FINITO(r,h,t) * h2_metric_tons_per_mmbtu }]$t_finito(t)
$endif.linked_h2_nat
;

* ---------------------------------------------------------------------------
Expand Down Expand Up @@ -3596,6 +3609,11 @@ eq_h2_demand_regional(r,h,t)
+ sum{(i,v)$[valgen(i,v,r,t)$h2_combustion(i)],
GEN(i,v,r,h,t) * h2_combustion_intensity * heat_rate(i,v,r,t)
}

* regional hydrogen demand for industry (FINITO)
$ifthene.linked_h2_reg Sw_FINITO_Link==1
+ [ USE_H2_FINITO(r,h,t) * h2_metric_tons_per_mmbtu ]$t_finito(t)
$endif.linked_h2_reg
;

* ---------------------------------------------------------------------------
Expand Down Expand Up @@ -3838,6 +3856,11 @@ eq_co2_capture(r,h,t)

* capture from DAC
+ sum{(i,v)$[dac(i)$valcap(i,v,r,t)$i_p(i,"DAC")], PRODUCE("DAC",i,v,r,h,t) }$Sw_DAC
* (ReEDS-FINITO) capture from industry [metric_tons-CO2/hr]:
* calculation: hours_per_year [yrs/hr] * capture [scaled_metric_tons-CO2/yr] / co2_scale [scaled_metric_tons-CO2/metric_tons-CO2]
$ifthene.linked_co2_capture Sw_FINITO_Link==1
+ [CAPTURE_CO2EM(r,h,t) / co2_scale]$[t_finito(t)$h_rep(h)]
$endif.linked_co2_capture
;

* ---------------------------------------------------------------------------
Expand Down Expand Up @@ -3867,6 +3890,11 @@ eq_co2_spurline_caplimit(r,cs,h,t)$[Sw_CO2_Detail$r_cs(r,cs)$tmodel(t)$(yeart(t)
=g=

CO2_STORED(r,cs,h,t)
* (ReEDS-FINITO) extraction of CO2 [metric_tons-CO2/hr]
* calculation: hours_per_year [yrs/hr] * (1 / co2_scale [scaled_metric_tons-CO2/metric_tons-CO2]) * use [scaled_metric_tons-CO2/yr]
$ifthene.linked_co2_spurline_caplimit Sw_FINITO_Link==1
+ [ (1 / co2_scale) * EXTRACT_CO2_CS(cs,r,h,t) ]$[h_rep(h)$t_finito(t)]
$endif.linked_co2_spurline_caplimit
;

* ---------------------------------------------------------------------------
Expand All @@ -3886,6 +3914,18 @@ eq_co2_sink(r,h,t)$[tmodel(t)$Sw_CO2_Detail$(yeart(t)>=co2_detail_startyr)]..

* net trade
+ sum{rr$co2_routes(r,rr), CO2_FLOW(rr,r,h,t) - CO2_FLOW(r,rr,h,t) }

* (ReEDS-FINITO) extraction - use of CO2 [metric_tons-CO2/hr]
*calculation: hours_per_year [yrs/hr] * (1 / co2_scale [scaled_metric_tons-CO2/metric_tons-CO2]) * extraction/use [scaled_metric_tons-CO2/yr]
$ifthene.linked_co2_sink Sw_FINITO_Link==1
+ (1 / co2_scale) * [
* extraction from all cs sites in r
+ sum{cs$[csfeas(cs)$r_cs(r,cs)], EXTRACT_CO2_CS(cs,r,h,t)}
* total use of CO2, equivalent to supply
- USE_CO2(r,h,t)
]$[h_rep(h)$t_finito(t)]
$endif.linked_co2_sink

;

* ---------------------------------------------------------------------------
Expand All @@ -3899,6 +3939,14 @@ eq_co2_injection_limit(cs,h,t)$[Sw_CO2_Detail$tmodel(t)$(yeart(t)>=co2_detail_st

* must exceed metric tons per hour entering storage
sum{r$r_cs(r,cs), CO2_STORED(r,cs,h,t) }



* (ReEDS-FINITO) extraction of CO2 for use [metric_tons-CO2/hr]
* calculation: hours_per_year [yrs/hr] * (1 / co2_scale [scaled_metric_tons-CO2/metric_tons-CO2]) * use [scaled_metric_tons-CO2/yr]
$ifthene.linked_co2_injection_limit Sw_FINITO_Link==1
+ (1 / co2_scale) * sum{r$[r_cs(r,cs)], EXTRACT_CO2_CS(cs,r,h,t) }$[h_rep(h)$t_finito(t)]
$endif.linked_co2_injection_limit
;

* ---------------------------------------------------------------------------
Expand All @@ -3915,6 +3963,14 @@ eq_co2_cumul_limit(cs,t)$[tmodel(t)$Sw_CO2_Detail$(yeart(t)>=co2_detail_startyr)
$[(yeart(tt)<=yeart(t))$(tmodel(tt) or tfix(tt))$(yeart(tt)>=co2_detail_startyr)
$r_cs(r,cs)$h_rep(h)],
yearweight(tt) * hours(h) * CO2_STORED(r,cs,h,tt) }

* (ReEDS-FINITO) cumulative amount extracted over time
$ifthene.linked_co2_storage_cumul_limit Sw_FINITO_Link==1
- sum{(r,h,tt)
$[(yeart(tt)<=yeart(t))$(tmodel(tt) or tfix(tt))$(yeart(tt)>=co2_detail_startyr)
$r_cs(r,cs)$(tfuel(tt))],
yearweight(tt) * hours(h) * EXTRACT_CO2_CS(cs,r,h,tt) }$[t_finito(t)]
$endif.linked_co2_storage_cumul_limit
;
* ---------------------------------------------------------------------------

Expand Down
Loading