Skip to content
Open
1 change: 1 addition & 0 deletions cases.csv
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ GSw_HourlyClusterRegionLevel,Indicate the region hierarchy level at which to agg
GSw_HourlyClusterWeights,/-delimited relative weights for load and RE profiles used in clustering,^load_\d*.?\d+\/upv_\d*.?\d+\/wind-ons_\d*.?\d+\/wind-ofs_\d*.?\d+$,load_1/upv_1/wind-ons_1/wind-ofs_0,
GSw_HourlyClusterYear,Year to use when clustering EFS and/or climate-modified data,N/A,2035,
GSw_HourlyClusterTimestep,Indicate the time resolution to use in clustering algorithm (period=day or wek depending on GSw_HourlyType),hour; period,period,
GSw_HourlyClusterMapMethod,How to map actual periods to representative periods: 'milp' minimizes sum of absolute errors but is slow; 'bestfirst' is orders of magnitude faster when using many weather years in GSw_HourlyWeatherYears,^(milp|bestfirst)$,milp,
GSw_HourlyMinRElevel,Indicate the region hierarchy level at which to include minimum wind and solar capacity factor days (or False to ignore min-wind/solar CF days),false; False; FALSE; r; nercr; transreg; transgrp; cendiv; st; interconnect; country; usda_region; ccreg,interconnect,
GSw_HourlyNormProfiles,Indicate whether to normalize load/wind/solar profiles before identification of representative periods,0; 1,0,
GSw_HourlyNumClusters,Number of clusters to create (i.e. number of representative days or weks),int,33,
Expand Down
5 changes: 3 additions & 2 deletions cases_test.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
,Default Value,Pacific,USA_defaults,Mid_Case,USA_decarb,github_Pacific,github_Everything,github_MA_county_CC,Pacific_CC,Pacific_weks,Pacific_full_year,Interday_storage,Pacific_2020,Pacific_rep7,WY_county,WECC_county,PJM_county_CC,NYVT_mixed,OR_water,MonteCarlo_Random,MonteCarlo_LHS,Everything,Simple,USA_fast,USA_faster,Pacific_DR,Pacific_MGA,Pacific_LoadSite95,MARICTNYNJPAOH_Offshore,R2P
,Default Value,Pacific,USA_defaults,Mid_Case,USA_decarb,github_Pacific,github_Everything,github_MA_county_CC,Pacific_CC,Pacific_weks,Pacific_full_year,Interday_storage,Pacific_2020,Pacific_rep15,WY_county,WECC_county,PJM_county_CC,NYVT_mixed,OR_water,MonteCarlo_Random,MonteCarlo_LHS,Everything,Simple,USA_fast,USA_faster,Pacific_DR,Pacific_MGA,Pacific_LoadSite95,MARICTNYNJPAOH_Offshore,R2P
ignore,1,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,
GSw_Region,cendiv/Pacific,,country/USA,country/USA,country/USA,,st/ID.WY.NE.IA.IL,st/MA,,,,,,,st/WY,interconnect/western,transreg/PJM,st/NY.VT,st/OR,st/NE.NY.PA,st/NE.NY.PA,st/ID.WY.NE.IA.IL,st/KS,country/USA,country/USA,,,,st/MA.RI.CT.NY.NJ.PA.OH,
endyear,2032,,2050,2050,2050,2029,2060,2026,,,,,,,,,,,2035,2030,2030,2060,2035,2050,2050,,,,,
Expand All @@ -21,7 +21,8 @@ GSw_PRM_CapCredit,,,,,,,,1,1,,,,,,,,1,,,,,,,,,,,,,
GSw_PRM_scenario,,,,,,,,,static,,,,,,,,static,,,,,,,,,,,,,
GSw_HourlyType,,,,,,,,,,wek,year,,,,,,,,,,,,,,,,,,,
GSw_InterDayLinkage,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,
GSw_HourlyWeatherYears,,,,,,,2012_2013,,,,,,2020,2007_2008_2009_2010_2011_2012_2013,,,,,,,,2012_2013,,,,2018,,,,
GSw_HourlyWeatherYears,,,,,,,2012_2013,,,,,,2020,2007_2008_2009_2010_2011_2012_2013_2016_2017_2018_2019_2020_2021_2022_2023,,,,,,,,2012_2013,,,,2018,,,,
GSw_HourlyClusterMapMethod,,,,,,,,,,,,,,bestfirst,,,,,,,,,,,,,,,,
GSw_WaterCapacity,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,
GSw_WaterMain,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,
GSw_WaterUse,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,
Expand Down
2 changes: 1 addition & 1 deletion docs/source/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Here is partial list of remotely hosted files used by ReEDS:
affinity='euclidean', linkage='ward')
```

- If set to 'optimized', then a two-step custom optimization is performed using the `hourly_repperiods.optimize_period_weights()` and `hourly_repperiods.assign_representative_days()` functions to minimize the deviation in regional load and PV/wind CF between the weighted representative periods and the full year.
- If set to 'optimized', then a two-step custom optimization is performed using the `hourly_repperiods.optimize_period_weights()` and `hourly_repperiods.match_act2rep_milp()` functions to minimize the deviation in regional load and PV/wind CF between the weighted representative periods and the full year.
- If set to a string containing the substring 'user', then instead of optimizing the choice of representative periods for this run, the model reads a user-supplied file at `inputs/temporal/period_szn_{GSw_HourlyClusterAlgorithm}.csv`.
- So if you want to use the example period:szn map, set `GSw_HourlyClusterAlgorithm=user` and provide `inputs/temporal/period_szn_user.csv`.
- If you want to specify a different period:szn map, then create a file with your label in the filename and set `GSw_HourlyClusterAlgorithm` to that same label (which must contain the substring 'user'). For example, for `GSw_HourlyClusterAlgorithm=user_myname_20230130`, provide `inputs/temporal/period_szn_user_myname_20230130.csv`.
Expand Down
2 changes: 1 addition & 1 deletion reeds/core/setup/b_inputs.gms
Original file line number Diff line number Diff line change
Expand Up @@ -6029,7 +6029,7 @@ Set
starting_hour_nowrap(allh) "Flag for whether allh is the first chronological hour by day type"
final_hour(allh) "Flag for whether allh is the last chronological hour in a day type"
final_hour_nowrap(allh) "Flag for whether allh is the last chronological hour in a day type"
nextszn(allszn,allszn) "Mapping between one actual period (allszn) and the next"
nextszn(actualszn,actualszn) "Mapping between one actual period (actualszn) and the next"
nextpartition(allszn,allszn) "Mapping between one partition (allszn) and the next"
* Peak demand
maxload_szn(r,allh,t,allszn) "hour with highest load within each szn"
Expand Down
21 changes: 14 additions & 7 deletions reeds/core/solve/2_temporal_params.gms
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ $include inputs_case%ds%stress%stress_year%%ds%nexth.csv
$offdelim
$onlisting
/

nextszn(actualszn,actualszn) "Mapping between one actual period (actualszn) and the next"
/
$offlisting
$ondelim
$include inputs_case%ds%nextszn.csv
$offdelim
$onlisting
/

$ONEMPTY
nextpartition(allszn,allszn) "Mapping between one partition (allszn) and the next"
/
Expand Down Expand Up @@ -181,13 +191,6 @@ starting_hour_nowrap(h)$[sum{szn, h_szn_start(szn,h) }$(not Sw_HourlyWrap)] = ye
final_hour_nowrap(allh) = no ;
final_hour_nowrap(h)$[sum{szn, h_szn_end(szn,h) }$(not Sw_HourlyWrap)] = yes ;

* Get the order of actual periods
nextszn(actualszn,actualsznn)$[(ord(actualsznn) = ord(actualszn) + 1)] = yes ;
nextszn(actualszn,actualsznn)
$[(ord(actualszn) = smax(actualsznnn, ord(actualsznnn)))
$(ord(actualsznn) = smin(actualsznnn, ord(actualsznnn)))]
= yes ;

$onOrder


Expand Down Expand Up @@ -894,10 +897,14 @@ szn_adj_gas(h)$frac_h_quarter_weights(h,"wint") =
avail(i,r,h)$avail(i,r,h) = round(avail(i,r,h),3) ;
can_imports_szn(r,szn,t)$can_imports_szn(r,szn,t) = round(can_imports_szn(r,szn,t),3) ;
can_exports_h(r,h,t)$can_exports_h(r,h,t) = round(can_exports_h(r,h,t),3) ;
frac_h_ccseason_weights(h,ccseason)$frac_h_ccseason_weights(h,ccseason) = round(frac_h_ccseason_weights(h,ccseason),3) ;
gasadder_cd(cendiv,t,h)$gasadder_cd(cendiv,t,h) = round(gasadder_cd(cendiv,t,h),3) ;
h_weight_csapr(h)$h_weight_csapr(h) = round(h_weight_csapr(h),3) ;
hours(h)$hours(h) = round(hours(h),3) ;
load_exog(r,h,t)$load_exog(r,h,t) = round(load_exog(r,h,t),3) ;
load_exog_static(r,h,t)$load_exog_static(r,h,t) = round(load_exog_static(r,h,t),3) ;
minloadfrac(r,i,h)$minloadfrac(r,i,h) = round(minloadfrac(r,i,h),3) ;
numdays(szn)$numdays(szn) = round(numdays(szn),3) ;
szn_adj_gas(h)$szn_adj_gas(h) = round(szn_adj_gas(h), 3) ;
cap_hyd_szn_adj(i,szn,r)$cap_hyd_szn_adj(i,szn,r) = round(cap_hyd_szn_adj(i,szn,r),3) ;
peakdem_static_ccseason(r,ccseason,t)$peakdem_static_ccseason(r,ccseason,t) = round(peakdem_static_ccseason(r,ccseason,t),2) ;
Expand Down
15 changes: 7 additions & 8 deletions reeds/input_processing/hourly_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from pathlib import Path
sys.path.append(str(Path(__file__).parent.parent.parent))
import reeds
from reeds.input_processing import hourly_repperiods
from reeds import plots
plots.plotparams()

Expand Down Expand Up @@ -135,9 +134,9 @@ def plot_ldc(
### Get clustered load, repeating representative periods based on how many
### periods they represent
numperiods = period_szn.value_counts().rename('numperiods').to_frame()
numperiods['yearperiod'] = numperiods.index.map(hourly_repperiods.szn2yearperiod).values
numperiods['year'] = numperiods.index.map(hourly_repperiods.szn2yearperiod).map(lambda x: x[0])
numperiods['yperiod'] = numperiods.index.map(hourly_repperiods.szn2period)
numperiods['yearperiod'] = numperiods.index.map(reeds.timeseries.szn2yearperiod).values
numperiods['year'] = numperiods.index.map(reeds.timeseries.szn2yearperiod).map(lambda x: x[0])
numperiods['yperiod'] = numperiods.index.map(reeds.timeseries.szn2period)
periods = [[row.yearperiod] * row.numperiods for (i,row) in numperiods.iterrows()]
periods = [item for sublist in periods for item in sublist]

Expand All @@ -150,11 +149,11 @@ def plot_ldc(
hourly_out = hourly_in.unstack('h_of_period').loc[periods].stack('h_of_period')

#### Daily
periodly_in = hourly_in.groupby('yperiod').mean()
periodly_in = hourly_in.groupby(['year','yperiod']).mean()
## Index doesn't matter; replace it so we can take daily mean
periodly_out = hourly_out.copy()
hourly_out.index = hourly_in.index.copy()
periodly_out = hourly_out.groupby('yperiod').mean()
periodly_out = hourly_out.groupby(['year','yperiod']).mean()

### Get axis coordinates: properties = rows, regions = columns
properties = periodly_out.columns.get_level_values('property').unique().values
Expand Down Expand Up @@ -563,7 +562,7 @@ def get_profiles(regions, year):
dforig = pd.concat(dforig, axis=1)

### Representative profiles
periodmap = period_szn.map(hourly_repperiods.szn2yearperiod).to_frame()
periodmap = period_szn.map(reeds.timeseries.szn2yearperiod).to_frame()
periodmap['year'] = periodmap.szn.map(lambda x: x[0])
periodmap['yperiod'] = periodmap.szn.map(lambda x: x[1])
periodmap = periodmap.loc[periodmap.year==year].yperiod
Expand Down Expand Up @@ -657,7 +656,7 @@ def plot_load_days(profiles, rep_periods, period_szn, sw, reeds_path, figpath):
"""
"""
### Input processing
idx_reedsyr = period_szn.map(hourly_repperiods.szn2yearperiod)
idx_reedsyr = period_szn.map(reeds.timeseries.szn2yearperiod)
medoid_profiles = profiles.loc[rep_periods]
centroids = profiles.loc[rep_periods]
centroid_profiles = centroids * profiles.stack('h_of_period').max()
Expand Down
Loading
Loading