Skip to content

Fix various errors in network connections#128

Merged
jnettels merged 6 commits into
devfrom
fix/network_connections
Oct 23, 2023
Merged

Fix various errors in network connections#128
jnettels merged 6 commits into
devfrom
fix/network_connections

Conversation

@jnettels

@jnettels jnettels commented Jun 16, 2023

Copy link
Copy Markdown
Contributor

This PR attempts to resolve #127 and the various problems described in it.
No function interfaces are changed and I think this could be considered a "hotfix" to v0.0.3.

Improve 'weld_segments' function

  • Replace some for-loops with vectorized functions for better performance. The recursive design is still quite slow, but the change showed a 4x speed improvement in one test case.
  • Fix an error that could remove lines unintentionally

Add plot for investigation of node-mismatch errors

  • This helps identify where the error is located, e.g. when a network consists of unconnected components

Update 'boundary' line connection method

  • Catch special cases where the regular street lines already touch the building. This would already fulfill the boundary method, but for dhnx a connection line is required for each building. Use midpoint for these cases.
  • Remove a misplaced 'convex_hull' call

Implement a new function 'drop_parallel_lines'

  • If multiple lines connect the same two points in a network, eomof.solph will throw an error. Keep only the shortest of all lines connecting the same two points.
  • Since this is called only after all building connections have been created, I think it is save to remove those duplicate lines. There should be no circumstances where the solver chooses a longer line over a shorter one.

Prevent OSError exception in unary_union()

jnettels added 5 commits June 16, 2023 17:52
This helps identify where the error is located, e.g. when a
network consists of unconnected components
- Replace some for-loops with vectorized functions for better performance.
The recursive design is still quite slow, but the change showed
a 4x speed improvement in one test case.
- Fix an error that could remove line segments unintentionally
If multiple lines connect the same two points in a network,
eomof.solph will throw an error. Keep only the shortest of all
lines connecting the same two points.
- Catch special cases where the regular street lines already touch the
building. This would already fulfill the boundary method, but for dhnx
a connection line is required for each building. Use midpoint for
these cases.
- Remove a misplaced 'convex_hull' call
@jnettels jnettels changed the title Fix/network connections Fix various errors in network connections Jun 16, 2023
This issue was already discussed in #107 and fixed for connect_points.py
in b25921f. Now the same access violation error came up at this point.
It could be confirmed that the issue happens only with shapely < 2.0
and is not occuring with shapely >= 2.0. If that ever becomes a
requirement, the 'list()' could be removed.
@jnettels jnettels requested a review from joroeder June 17, 2023 22:34
@jnettels jnettels merged commit 63c2f75 into dev Oct 23, 2023
@jnettels jnettels deleted the fix/network_connections branch October 23, 2023 12:52
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.

Various minor issues when connecting networks

1 participant