-
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: add top-level HIFLD grid orchestration function #236
Conversation
691cf38
to
8350004
Compare
8350004
to
b99ef4c
Compare
442a44e
to
8ceef91
Compare
This code has been tested to successfully make the CSVs necessary to create a grid, once it's rebased onto the code from #240, and has been validated using code from Breakthrough-Energy/PowerSimData#566. The original post has also been updated with what this branch currently does. Therefore, I'm converting this PR out of draft stage. |
After tweaking the output plant CSV a bit more (adding type, adding heat rate columns, translating to PowerSimData naming expectations), we can also successfully call |
3e0724b
to
1060315
Compare
1060315
to
79c4e35
Compare
Encountered this warning from scipy:
I assume it is not critical. |
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.
First check check_grid(Grid("USA", "hifld"))
passes. Second check fails:
>>> check_grid(Grid("Eastern", "hifld"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/kmueller/.local/share/virtualenvs/PreREISE-X1G9x7gr/lib/python3.8/site-packages/powersimdata/input/check.py", line 50, in check_grid
raise ValueError(f"Problem(s) found with grid:\n{collected}")
ValueError: Problem(s) found with grid:
This grid contains 920 connected components, but is specified as having 1 interconnects: ['Eastern'].
Debugging:
gg = nx.from_pandas_edgelist(g_e.branch, "from_bus_id", "to_bus_id")
>>> num_connected_components = len([c for c in nx.connected_components(gg)])
>>> num_connected_components
920
@kasparm the first issue is from the generator heat rate curve-fitting, it doesn't seem to be a problem. The second issue was from a commit that I missed when cherry-picking from my testing branch, fixed with the latest push. |
For some reason I'm still getting the same error. |
Even after running the latest PreREISE code and putting the resulting CSVs into the right folder in PowerSimData? The source of the error is the |
Looks good now. My installation was off. |
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.
Thank you @danielolsen looks good. The only change I would suggest is to place the create_csv function into it's on file in hifld and then import it in the init.py
ccd9069
to
6678d50
Compare
Looks good. Thanks for making the change. |
6678d50
to
f231e87
Compare
feat: add top-level HIFLD grid orchestration function
feat: add top-level HIFLD grid orchestration function
feat: add top-level HIFLD grid orchestration function
feat: add top-level HIFLD grid orchestration function
feat: add top-level HIFLD grid orchestration function
feat: add top-level HIFLD grid orchestration function
feat: add top-level HIFLD grid orchestration function
feat: add top-level HIFLD grid orchestration function
Pull Request doc
Purpose
Add a single function that kicks off all processing of raw HIFLD data to outputs compatible with PowerSimData. Closes #226.
This is a draft PR for now at least until #235 is merged and #233 is addressed, intended to start conversation on feature design and identify lower-level issues to be addressed in separate PRs. Outstanding issues that are already on my radar to address as part of this PR (design/implementation suggestions welcome!):
Columns irrelevant to PowerSimData need to be dropped.EDIT: doneThe bus.csv file needs an entry added in const.py for its columns with default values.EDIT: done.We need to add missing column information to some data tables:EDIT: done.branch.csv:r
,b
,ratio
, andfrom_bus_id
,to_bus_id
for non-transformer branchesbus.csv:bus_id
(I think we just need to rename the existing index),type
,zone_id
bus2sub.csv:interconnect
dcline.csv:from_bus_id
,to_bus_id
sub.csv:name
(probably just a rename),interconnect_sub_id
,lat
,lon
(renames)generators need types, fuel prices, and heat-rate information.EDIT: done.Ideally, the PowerSimData
check_grid
function (powersimdata.input.check_grid
) will help us identify other similar issues, once Breakthrough-Energy/PowerSimData#551 is complete.What the code is doing
There's new user-facing function
create_csvs
within the init.py file. It:data_process
sub-modules,const.py gets the column default values.
Within transmission.py:
changes the, (EDIT: done via feat: filter DC lines out of AC transmission network processing within HIFLD construction #237)build_transmission
function to use the"line2sub"
method by defaultadds the transformer-creation (from feat: add function to create transformers within substations #218), branch-parameter-assignment steps (from feat: add functions to estimate branch parameters (impedance and rating) #219), (EDIT: done via feat: filter DC lines out of AC transmission network processing within HIFLD construction #237)assign_buses_to_lines
which translated line-to-substation mapping to line-to-bus, and applies it withinbuild_transmission
.add_substation_info_to_buses
which adds interconnect and zone IDs to buses, and applies it withinbuild_transmission
.interconnect_sub_id
column to the substations table (I don't remember if we use this for anything, but PowerSimData expects it).Within generators.py: changing the expected column names for latitude and longitude, to match the renaming in transmission.py.
Testing
Tested manually.
Files are created in the right location, although there are a few issues with the outputs, which I think should be addressed in separate PRs to fix the lower-level functions:Within branch.csvCurrently, lines (either present in the original HIFLD data or added to connect the minimum spanning tree) don't getEDIT: done.from_bus_id
orto_bus_id
assigned in the branch table, only transformers do. Lines do haveSUB_1_ID
,SUB_2_ID
, andVOLTAGE
, which should be enough to uniquely identify a bus, since buses are created via the set of unique voltages of lines connected to a given substation.Dataframe indices aren't unique after the individual frames for the original lines, the minimum-spanning-tree lines, and the transformers are appended together.EDIT: fixed via fix: various issues with HIFLD transmission loading/processing #239.Tested via the test branch
daniel/hifld_top_level_rebased
, which combines the code from #236 and #240. Validation uses draft code from the branch for Breakthrough-Energy/PowerSimData#566.The whole script takes a while to run (about 20 minutes on my laptop), even with a cached minimum spanning tree, since we don't cache the EPA AMPD data that's downloaded or the heat rate curves that are fitted to these data, along other things. We could improve at least part of this with some KDTree refactors.
Time estimate
30-60 minutes for what's in here currently. Longer if we want to add some caching to speed up performance and/or design pass-throughs to the keyword arguments of
build_transmission
andbuild_plant
.