-
Notifications
You must be signed in to change notification settings - Fork 490
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
Make bus element checks in create_switches optional #2343
base: develop
Are you sure you want to change the base?
Conversation
I think, we can add a flag to enable not checking that switches are added only to valid buses and elements (should not be named |
3712676
to
de22036
Compare
@SteffenMeinecke just vectorized the bus/element validation. Now takes less than a second to run 50,000 switches. |
b2a5382
to
ed0e8e5
Compare
The tests in |
I agree: The switches are not correctly defined in https://github.com/e2nIEE/pandapower/blob/develop/pandapower/protection/example_grids.py#L27 and https://github.com/e2nIEE/pandapower/blob/develop/pandapower/protection/example_grids.py#L54 and https://github.com/e2nIEE/pandapower/blob/develop/pandapower/protection/example_grids.py#L88 and maybe also at all other positions of the file where switches are created. |
After talking to @gourab2009, it seems that I did not checked sufficiently. @thomas-whaley-poco, isn't it possible that the switches are created correctly in the tests? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #2343 +/- ##
===========================================
- Coverage 76.40% 76.40% -0.01%
===========================================
Files 280 280
Lines 32427 32420 -7
===========================================
- Hits 24776 24770 -6
+ Misses 7651 7650 -1 ☔ View full report in Codecov by Sentry. |
@SteffenMeinecke Apologies for the delay, yes that is true, the original code causes the tests to pass. I'll resolve this. |
@SteffenMeinecke after digging around in the old code, I've found that the new code in the PR has the exact same functionality as the old code, except for this line: https://github.com/e2nIEE/pandapower/blob/develop/pandapower/create.py#L4446. This meant that while the tests were passing, it actually wasn't testing the entire contents of the input given into this function, hence my new code failing. If I replace |
This PR makes the bus element checks in
create_switches
optional as specified in #2303 .I am writing a pipeline that converts large DataFrames to a large pandapower network. I estimate the size of the DataFrame containing switch data to be over 50,000 rows. Simply running the create_switches function with this DataFrame takes 10-20 minutes, whereas functions like create_lines take less than a minute with a similar sized DataFrame.
I understand this is caused because it is checking if the bus and element matches the element type and is a valid bus. In my situation, I would prefer to have this function run in less than a minute than being sure the busses are valid.
This PR introduces a new flag in create_switches (
validate_busses=True
), which would determine if the validation loop runs or not.