Flexible start year option & tech classes addition#12
Conversation
Co-authored-by: Wesley Cole <49044852+wesleyjcole@users.noreply.github.com>
patrickbrown4
left a comment
There was a problem hiding this comment.
I haven't gone through the whole thing yet and will take a closer look next week, but some initial thoughts in the meantime. Happy to discuss if helpful (including whether to try some of the suggested changes here or in a followup PR). Thanks!
bsergi
left a comment
There was a problem hiding this comment.
Happy to chat through any of the comments on this one.
|
|
||
| # Only used for one-off modification of geothermal supply curves | ||
| # Remove after hourlize is rerun and resource temp is added to geothermal supply curve | ||
| if sys.platform == 'win32': |
There was a problem hiding this comment.
Does this work for all windows systems?
There was a problem hiding this comment.
I remember it worked for windows for a a stdscens processing script, which Pieter already tested. But we can get someone else with a windows laptop to test again here to be sure.
| ``` | ||
|
|
||
| ### define_tech_classes.py | ||
| Run this scrip after `run_hourlize.py` to generate classification of UPV and wind technologies (`classification_upv.csv`, `classification_wind-ofs.csv`, and `classification_wind-ons.csv`) |
There was a problem hiding this comment.
It would be nice to not have to add another step that users have to remember. Can we add a if __name__== '__main__': block to tech_classes.py to make it importable and then to call directly from resource.py?
Alternatively, you could also just call this function from the create_exog_rsc from within writecapdat.py and create these on the fly for the relevant access case. That would avoid having to store the extra files in the repo; if they are only used for the assigning the exogenous capacity that might be the better route.
There was a problem hiding this comment.
Yes, either way sounds good to me. Let's talk about which one we want to implement today.
There was a problem hiding this comment.
define tech class in create_exog_rsc function now.
| # Aggregate min/max by class and attach access_case | ||
| if tech == 'wind-ofs': | ||
| df['subtech'] = 'fixed' | ||
| df.loc[df['class']>=6,'subtech'] = 'floating' |
There was a problem hiding this comment.
I'm a little worried about hardcoding this value in here. If this depends on the class_bin_num specification in the config file maybe we can read from that?
There was a problem hiding this comment.
I got this from the raw supply curves. It's always that class 1-5 = fixed and above 5 = floating. Originally I processed the classification from the raw windows supply curve which already has fixed and floating categories so I didn't have to do this. But the supply curve in ReEDS repo does not have these categories, so this is more of a one-off modification to add these categories there. I can remove it the next time hourlize is run. Also, it doesn't impact runs since only the class column is read.
| capacity_exog(i,"init-1",r,t)${[yeart(t)-sum{tt$tfirst(tt),yeart(tt) }<maxage(i)]} = | ||
| max(0,capnonrsc(i,r,"value") | ||
| - sum{allt$[allt.val <= t.val], prescribedretirements(allt,r,i,"value") } | ||
| capacity_exog(i,v,r,t)${[yeart(t)-sum{tt$tfirst(tt),yeart(tt) }<maxage(i)]$sameas(v,'init-1')} = |
There was a problem hiding this comment.
The comment above notes "existing capacity equals all 2010 capacity less retirements" -- should this be changed to "all pre-start year capacity"? If so I'm guessing there are other 2010 references that might need to be updated.
|
|
||
| *beginning year value is zero (i.e., no elasticity) | ||
| cd_beta(cendiv,t)$[not tfirst(t)] = cd_beta0_allsector(cendiv) ; | ||
| *beginning year value of 2010 is zero (i.e., no elasticity) |
| $(yeart(tt)<=yeart(t))$(tmodel(tt) or tfix(tt))], | ||
| INV(i,newv,r,tt) + INV_REFURB(i,newv,r,tt)$[refurbtech(i)$Sw_Refurb]} | ||
|
|
||
| INV(i,newv,r,t) + INV_REFURB(i,newv,r,t)$[refurbtech(i)$Sw_Refurb] |
There was a problem hiding this comment.
this approach seems a lot cleaner so I like it. Was the goal to help with numerical instability?
| df_pre['capacity'] = df_pre['capacity'].round(decimals) | ||
| df_pre = df_pre.sort_values(['year',profile_id_col]) | ||
| df_pre.to_csv(os.path.join(outpath, 'results', tech + '_prescribed_builds.csv'), index=False) | ||
| #Reduce supply curve based on exogenous (pre-start-year) capacity |
There was a problem hiding this comment.
I don't understand why you've left this reduction block in. Doesn't the supply curve equation already (eq_rsc_INVlim) already account for exogenous capacity? Wouldn't subtracting here be double couting that capacity?
There was a problem hiding this comment.
Maybe it doesn't matter since you need subtract_exog=True for this to be applied and that isn't the default, but I'm wondering whether we should keep it at all since I can't see a time we'd want to use it.
There was a problem hiding this comment.
I missed this when I deleted the blocks above. Removed this now.
There was a problem hiding this comment.
If we're processing the existing capacity downstream now I think it might be good to remove the remaining pieces in here, otherwise some folks might wander in here and think this is still being used.
| / (1$[not rsc_capacity_scalar_i(ii)] + rsc_capacity_scalar(ii,r,tt)$rsc_capacity_scalar_i(ii)) } ) / 1000 ; | ||
|
|
||
|
|
||
| *** Do we need this part when pcat is removed? |
There was a problem hiding this comment.
pcat is still used above; is the intent to remove it completely? (Don't go out of your way to remove it if it's not necessary for the PR; I was just curious since it's also mentioned in the PR text.)
Lines 1179 to 1208 in 097ea5f
There was a problem hiding this comment.
Thank you for the catch. I removed the remaining mentions of pcat now.
…during run in writecapdat.py
…atch since FIPS have changed
…a instead of 'r' column
Summary
This PR:
startyearswitch and instead establishesstartyearbased onyearsetTechnical details
These changes are made in this PR:
process_unitdata.py: Readunitdata.csvfrominputs_caseand process it to assign sc_point_pids, capacity factors/mean temps to pv, wind, and geothermal units. This file is run immediately aftercopy_files.py. This allows us to remove all the mapping of NEMS units tosc_point_pidsin theReEDS_input_processing repo.WriteHintage.py: Allow start year to be flexible instead of 2010.writecapdat.py: Add mappings to solar, wind, geothermal resource class are based on the resource quality (capacity factors for wind and solar and temperature for geothermal) of the technology as it comes from reV.c_supplymodel.gmspcatset is removed from the model: The equationseq_force_prescription_powerandeq_force_prescription_energy, along with the variablesEXTRA_PRESCRIPandEXTRA_PRESCRIP_ENERGY, are currently indexed bypcat. Since the prescribed generator classes and vintages are now defined inwritecap.py, thepcatindex is no longer needed in these equations or variables. Accordingly, the equations are revised so that the investment (INV) of prescribed generators—indexed by (i, newv, r, t)—is equal to the sum of the prescribed build values and the additional prescribed investments (EXTRA_PRESCRIP) for those same (i, newv, r, t) combinations.eq_cap_new_noretandeq_cap_energy_new_noret. Although this implementation follows the same logic asm_capacity_exog, it explicitly captures prescribed generator builds in the INV variables in the current version of the model.hourlize:exog_cap_{tech}.csvfiles as they are no longer needed.geothermal_classification.csvis not generated inhourlizebut taken from https://pages.github.nrel.gov/ReEDS/ReEDS-2.0/model_documentation.html#technical-resource-potential.Issues resolved
Known incompatibilities
Relevant sources or documentation
Validation, testing, and comparison report(s)
Pending
Checklist for author
Details to double-check
hourlize/resource.pywas rerun to regenerate the existing/prescribed VRE capacity dataGeneral information to guide review
Did you use LLM tools (chatbot or copilot) in the preparation of this PR? If so, describe how
No
Tag points of contact here if you would like additional review of the relevant parts of the model