-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: generate solar profiles during HIFLD grid-building #256
Conversation
027f3e5
to
7e7b63b
Compare
from prereise.gather.griddata.hifld.data_process.transmission import build_transmission | ||
|
||
|
||
def create_csvs(output_folder): | ||
def create_csvs(output_folder, nrel_email, nrel_api_key, solar_kwargs={}): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the user perspective, do we want to enable the user to generate the grid without generating the profiles? If so, we could add a flag input, and add default None
values for the profile-specific input parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, we may want the user to be able to create the full Grid CSVs, and then use these for multiple years. We could break create_csvs
into a grid-step and a profiles step, or allow the user to pass a list of years to have everything handled automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree it makes sense to be able to create the grid and profiles separately. Assuming this isn't something that would be used often, I might leave it at something like create_grid
and create_profiles
, or make create_csvs
a wrapper around those if it's convenient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. EDIT: The refactor has also been tested and behaves as expected when calling the create_csvs
wrapper function.
There's another branch |
Similarly, there's a branch to add hydro profiles, see daniel/hifld_solar_profiles...daniel/hifld_hydro_profiles. |
"""Convert the data to the format expected by nrel-pysam for local files. See | ||
https://developer.nrel.gov/docs/solar/nsrdb/psm3-download/. | ||
|
||
:return: (*list*) -- a list of lists which can be passed to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically I think metadata_values
is a tuple, but would expect that's fine.
e8ffbfe
to
c8a0a38
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic looks good.
Solar profile and grid-building works.
Thank you!
0d0e239
to
7cb4d14
Compare
…rofiles feat: generate solar profiles during HIFLD grid-building
…rofiles feat: generate solar profiles during HIFLD grid-building
…rofiles feat: generate solar profiles during HIFLD grid-building
…rofiles feat: generate solar profiles during HIFLD grid-building
Purpose
Simplify solar profile generation process, now that SAM can handle leap years.EDIT: this no longer appears possible, see Update solar profile generation to reflect that nrel-pysam can now handle leap years #254 (comment)What the code is doing
Pipfile
,Pipfile.lock
, andrequirements.txt
: updating the version of PySAM. Then, we add Python 3.10 to the test matrix in.github/workflows/test.yml
.const.py
, we add references to the tables of 'extra' EIA data in the blob storage.generators.py
, we make sure that the plant index gets named (unrelated to main objectives).prereise.gather.griddata.hifld.data_process.profiles
, which takes the 'extra' data table for solar, joins it with the solar plants from the plant dataframe, and passes this (with some pre-processing) to individualized profile generation function introduced in refactor/feat: decouple solar profile generation from Grid object, add individual calculation #247. Most of this new code is copy-and-pasted from the usage examples in that PR.orchestration.py
, we call the new function fromprereise.gather.griddata.hifld.data_process.profiles
, and then save the resulting profiles to CSV at the same time as we save the rest of the Grid CSVs.nrel_api.py
:Psm3Data
data structure back to the file format expected by SAM. For whatever reason, the way that weather data are attached to aPySAM.PVWatts
object is different than how they're attached to aPySAM.TcsgenericSolar
object:TcsgenericSolar
needs a filename for a file formatted in a particular way.sam.py
:we remove the leap-year-specific logic, now that SAM handles lear years properly.calculate_power
tocalculate_power_pv
, and add a parallelcalculate_power_csp
function, which saves weather data into a temporary location and then tells the CSP model to load it from this location (it's ugly, but I don't know if there's a better way).retrieve_data_individual
, we look at each plant's prime mover code to determine whether to calculate profiles using the PV model or the CSP model.Testing
CSP profile generation code has been manually tested.
Manual testing of profiles for the full solar fleet is in progress, should be done by this afternoon (data are being re-downloaded from NREL with leap days).EDIT: tested manually, the solar profiles are generated and saved and match the number of solar plants in the plant CSV table.Usage Example/Visuals
Time estimate
1 hour. None of the individual pieces are too complex, but there are a lot of moving parts here. Assuming that y'all approve of the overall logic flow, I'll submit a follow-up PR to add wind profile generation to the orchestration script as well (or I can add it to this PR).