Repository navigation
Fix Monte Carlo random sampling for VRE siting availability - #249
patrickbrown4 wants to merge 25 commits into
Conversation
…n process_unitdata
…apital_adder_per_mw fixed for supply curve files in mcs_sampler.py
| if (tech == 'wind-ofs') and int(sw.GSw_OffshoreZones): | ||
| gdf_joined['r'] = gdf_joined['ba'] | ||
| else: | ||
| gdf_joined['r'] = gdf_joined['r_nearest'] |
There was a problem hiding this comment.
This is the only substantive change to this script (to get offshore zones working again); the rest were just to help me follow things while debugging
| 'copy_files', | ||
| 'process_unitdata', | ||
| 'mcs_sampler', | ||
| 'process_unitdata', |
There was a problem hiding this comment.
Need to run after the sampling since it assigns existing capacity to sites
| ,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,MultiMetricRA,Pacific_DR,Pacific_MGA,Pacific_MGA_RV,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/NY.NJ,,,,,st/MA.RI.CT.NY.NJ.PA.OH, | ||
| 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/ID.WY.NE.IA.IL,st/KS,country/USA,country/USA,st/NY.NJ,,,,,st/MA.RI.CT.NY.NJ.PA.OH, |
There was a problem hiding this comment.
Changed from NE.NY.PA to Pacific to avoid the islanded-zones warning added in #243
| GSw_HourlyClusterAlgorithm,,,,,,,,,,,,,,,,,,,,user,user,,,,,,,,,,, | ||
| MCS_runs,,,,,,,,,,,,,,,,,,,,2,2,,,,,,,,,,, | ||
| MCS_dist_groups,,,,,,,,,,,,,,,,,,,,tech.hydro.nuclear.gas.coal.load_country,upv_tri.nuclear_tri.ng_fuel_price_tri.load_country_unif,,,,,,,,,,, | ||
| MCS_dist_groups,,,,,,,,,,,,,,,,,,,,load_flat_state.gasprice_flat.siting_flat_state.upv.onswind.ofswind.battery.nuclear.geo,load_country_unif.gasprice_tri.siting_country_discrete_flat.upv_tri.nuclear_tri,,,,,,,,,,, |
There was a problem hiding this comment.
I added siting to the LHS case, but it's not yet supported. @bsergi let me know if you'd rather leave it out until we fix it for LHS.
| case=os.path.dirname(os.path.normpath(inputs_case)), | ||
| agg=agg, | ||
| ).reset_index() | ||
| df = reeds.io.get_supplycurve(full_path, case=inputs_case) |
There was a problem hiding this comment.
Now we just get the initial supply curve and assemble the full curve (i.e. add the interconnection costs) only once downstream in writesupplycurves.py, rather than assembling it twice (which complicates the MC sampling)
There was a problem hiding this comment.
We could spend more time unifying the naming of the distributions in this file; let me know if you think we should do that here
There was a problem hiding this comment.
Some of the changes here are just formatting. The main substantive change is that I removed the exogenous/prescribed sampling (since it's now handled downstream in process_unitdata.py) and only sample the capacity from the supply curve, inheriting the cf and profiles from the most permissive siting scenario included in the distribution.
There was a problem hiding this comment.
Sorry, a lot of these changes were just to help understand the organization while I was debugging.
| pd.read_csv(os.path.join(inputs_case, 'classification_geothermal.csv')) | ||
| .query(f"access_case == '{sw.GSw_SitingGeo}'") | ||
|
|
||
| def get_class_cf_min( |
There was a problem hiding this comment.
I think this set of 3 functions is the main substantive change. While testing different zone sets, I was getting issues for cases where there was only a single site in a zone/tech_class combo. Now instead of defining min and max for each class, we just define min, and take the first match.
Summary
This PR partially addresses #41 by fixing the Monte Carlo sampling functionality for VRE siting availability.
Latin hypercube sampling for VRE siting availability is still broken; we can decide whether to fix that here or in a followup PR.
Technical details
Implementation notes
Additional changes
writecapdat.py: I was having trouble following the structure while debugging, so reorganized to put the globals at the top and renamed a few variables (sorry)assign_class(); I was getting float classes (instead of integers) without this change, which were messing up downstream processing.mcs_sampler.py: We no longer need the exogenous or prescribed capacity processing, so those parts are removed along with the recf profile processing.mcs_distributions_default.yaml:Issues resolved
#41 (partially)
Known incompatibilities
MonteCarlo_LHS(latin hypercube) case when siting is included; I'm not sure why it's behaving differently fromMonteCarlo_Random. I think the fix to random sampling is valuable enough to get in on its own, but if the LHS case ends up being a quick/easy fix, we can include it here too.TODO before merge
missing_class_resource.csv)Validation, testing, and comparison report(s)
Changes to USA_defaults are within the noise: results-v20261009_mainK0_USA_defaults,v20261009_mcK0_USA_defaults.pptx
The MonteCarlo_Random case now works with VRE siting included in the distribution.
Here's a full-US example with 10 samples and
MCS_dist_groupsset toload_flat_country.siting_lowmid_country.gasprice_flat.upv.onswind.ofswind.battery.nuclear.geo:results-1,2,3,4,5,6,7,8,9,10.pptx
20261019 update
results-v20261017_mainK0_USA_decarb,v20261017_mcK0_USA_decarb.pptx
cases_small.csvand merge it withcases_test.csv#222Checklist for author
Details to double-check
General information to guide review
Did you use LLM tools (chatbot or copilot) in the preparation of this PR? If so, describe how
No