Good Morning. I am currently developing a project for which I need to make the preliminary design of the electricity distribution network topology for a population. For this I have the location of the consumers (numbers in red) and the Medium Voltage nodes (numbers in blue) (MV). As shown in the following image:
Using the Network Analyst tools, the possible routes between the different points are generated, within a specified radius, from which the following network is obtained:
The following distribution of the MT nodes to the BT nodes is found with the Closest Facility tool of the Network Analyst:
This solution is an approximation, but it presents some errors, such as the one observed between nodes 85 and 3, because the most logical solution would be the one observed in the following image:
I am looking for this solution to be generated automatically or semi-automatically, but that does not require adding a restriction manually like the one shown in the previous image. The problem stems from the fact that the algorithm used by Closest Facility always looks for the smallest route from the MT node to the consumption (BT) node, but does not consider that it can arrive from an already connected BT node.
I would appreciate your collaboration with some explanation, or the suggestion of a tool or configuration that allows me to perform the procedure outlined.
Ok, based on the information you've provided, it looks like you want to connect the BT nodes to the MT nodes with the least amount of cable/wire/whatever used to connect all the BT nodes. If that's not your goal, please let me know, because the answer to your question might change.
If that is what you are trying to do, then that's what's called a minimum spanning tree problem Minimum spanning tree - Wikipedia . We do not have a solver in Network Analyst that would solve that problem. So the Closest Facility solver is not going to give you what you want, unfortunately.
You can solve for a minimum spanning tree using the networkx module for python Introduction — NetworkX 2.4 documentation . Check out the information for trees (including the minimum spanning tree) in here Tree — NetworkX 2.4 documentation .
The good news is that you don't have to start from scratch with this. Using the arcpy.nax network dataset object (new in Pro 2.4) NetworkDataset—Network Analyst module | ArcGIS Desktop , you can export your network dataset edges to a networkx graph so that you can use that for the analysis. (As a note, based on your screenshots, it looks like you're using ArcMap. You'll need to at least install ArcGIS Pro 2.4 or newer in order to access the arcpy.nax module).
Here https://www.arcgis.com/home/item.html?id=b2227f745a6c4e1c94dd57810729d2a9 is a sample we published showing the export of network dataset edges to a networkx graph. Keep in mind that this sample only exports the edges for topology; it does not export the costs associated with the edges, which you'll need to do in order to solve for your minimum spanning tree.
As I said above, if I haven't understood what you're trying to do correctly, please let me know and I can look into it a bit more. I hope this helps, Andres!