Skip to content
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/data: update HIFLD data to April 2022 version, refactor line assignment #289

Merged
merged 17 commits into from
May 11, 2022

Conversation

danielolsen
Copy link
Contributor

@danielolsen danielolsen commented Apr 8, 2022

Pull Request doc

Purpose

  • Update the data we're pulling to use the latest available (April 2022 for both transmission lines and substations)
  • Refactor the logic to account for the fact that many lines don't have substations at their endpoints
  • Update our set of line/substation interconnect assumptions in light of the above.

What the code is doing

  • In load.py, we're a bit more accommodating of the inconsistent naming of the Shape Length columns that we want to drop.
  • In topology.py, we make sure that we tag all of the separated/reconnected lines with their appropriate interconnects.
  • In transmission.py:
    • We modify the behavior of the map_lines_to_substations_using_coords function so that if there are no substations 'close' to a line's endpoint (as defined by our new optional parameter), we create a new proxy substation for it. We do the KDTree/query process twice, where the first time just collects a list of transmission line endpoints with no substation, then we add proxy substations, and the second time we actually re-map all the lines.
    • We avoid filtering out substations which are tagged as having LINES = 0, since this information seems to be very noisy.

Testing

Tested manually to generate static grid components. The resulting static grid components haven't been tested for network feasibility yet, so we may also need to update some of the line assumptions that were introduced in #276. EDIT: update: the results of this new code have been tested alongside the new code in #286 and new line/substation assumptions have been added which seem to ensure generator-side feasibility.

Usage Example/Visuals

The call signature to map_lines_to_substations_using_coords remains the same, we just add one more optional parameter that controls how far away from any substation a line's endpoint can be before we create a new proxy substation for it (instead of connecting it to an existing one).

Time estimate

30 minutes? The code changes are fairly light, most of the changes are in the constants which required a tedious guess-and-check process. This is a draft PR for now, since the functionality depends partially on #283, and since we may want to make some modifications to the underlying logic, but the code that's here creates the interconnections as we expect. EDIT: #283 is merged, so this is ready to go.

@danielolsen danielolsen self-assigned this Apr 8, 2022
raise ValueError("Interconnections were not separated successfully")
interconnect_sizes = [len(c) for c in sorted_interconnects]
raise ValueError(
f"Interconnections were not separated successfully {interconnect_sizes}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized we require python 3.8 now, so we can add the equals sign to print name=value, e.g.

In [1]: x = [1,2]

In [2]: f"wow so cool {x=}"
Out[2]: 'wow so cool x=[1, 2]'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow so cool!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fancy!

@danielolsen danielolsen force-pushed the daniel/hifld_join_segments branch from 867a7d2 to 94f6245 Compare April 13, 2022 18:50
Base automatically changed from daniel/hifld_join_segments to hifld April 13, 2022 19:55
@danielolsen danielolsen force-pushed the daniel/hifld_fresher_tx_data branch from b2594d1 to c220149 Compare April 13, 2022 20:02
@danielolsen danielolsen marked this pull request as ready for review April 13, 2022 20:05
@danielolsen danielolsen force-pushed the daniel/hifld_fresher_tx_data branch from 89c7873 to a83c3da Compare April 26, 2022 00:12
.round({"VOLTAGE": 3})
)
# Drop columns which aren't relevant to us. Some names are inconsistent b/w versions
shape_lengths = {"SHAPE_Length", "SHAPE__Length"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is bad

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. And this looks familiar to me which reminds me the days playing with country names from different datasets.

Copy link
Collaborator

@rouille rouille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Copy link
Collaborator

@BainanXia BainanXia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@danielolsen
Copy link
Contributor Author

danielolsen commented May 3, 2022

I'm going to wait to finish/merge this until #286 is merged, since the updates for feasibility don't work by themselves without the #286 logic. EDIT feasibility updates also depend on #292, which depends on #286, so I think the preferred merge order is: #286, #292, #289.

@danielolsen danielolsen force-pushed the daniel/hifld_fresher_tx_data branch from 9aca491 to 9152bd1 Compare May 10, 2022 21:20
@danielolsen danielolsen force-pushed the daniel/hifld_fresher_tx_data branch from 9152bd1 to caeb98f Compare May 10, 2022 21:24
@danielolsen danielolsen force-pushed the daniel/hifld_fresher_tx_data branch from caeb98f to a2df748 Compare May 10, 2022 21:39
@danielolsen danielolsen merged commit 1623546 into hifld May 11, 2022
@danielolsen danielolsen deleted the daniel/hifld_fresher_tx_data branch May 11, 2022 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants