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: deduplicate interconnect passed to grid constructor #510

Merged
merged 2 commits into from
Jun 28, 2021
Merged

Conversation

jenhagg
Copy link
Collaborator

@jenhagg jenhagg commented Jun 28, 2021

Purpose

Improve experience of using the grid object by allowing users to provide interconnects as a set, and removing duplicates if a list is provided. Basically, eliminating the requirement of calling code to do Grid(list(set(interconnect))).

What the code is doing

Described above, and some test updates. Also, include tests in code coverage report.

Testing

There are good unit tests already, just modified as needed.

Usage Example/Visuals

In [1]: from powersimdata import Grid

In [2]: Grid({'Eastern', 'Texas'})
Reading bus.csv
Reading plant.csv
Reading gencost.csv
Reading branch.csv
Reading dcline.csv
Reading sub.csv
Reading bus2sub.csv
Reading zone.csv
Out[2]: <powersimdata.input.grid.Grid at 0x10f376cd0>

In [3]: Grid(['Texas', 'Texas'])
Reading bus.csv
Reading plant.csv
Reading gencost.csv
Reading branch.csv
Reading dcline.csv
Reading sub.csv
Reading bus2sub.csv
Reading zone.csv
Out[3]: <powersimdata.input.grid.Grid at 0x10f376df0>

In [4]: grid = _

In [5]: grid.interconnect
Out[5]: ['Texas']

Time estimate

10 min

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.

Make sense. Thanks for taking care of the tests.

Copy link
Contributor

@danielolsen danielolsen left a comment

Choose a reason for hiding this comment

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

Thanks

@jenhagg jenhagg merged commit 8b15e52 into develop Jun 28, 2021
@jenhagg jenhagg deleted the jon/grid branch June 28, 2021 23:39
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.

3 participants