Conditions
Question
We are considering adapting the DK for our electrical utility and power outage management system for the purpose of a "switch planning solution", i.e., if I remove power from one node, which other nodes will go off as well; or if I restore power, which other nodes will go on. Grids must be organized on regional boundaries with GIS attributes. We want to create functionality such as: i) find a route from a node to one of a number of other nodes, while making sure that e.g. all nodes in the path have the attribute "powered" set to true, ii) find the best route (defined by e.g. weighing attributes), iii) find the "nearest" node with a certain attribute (typically with the lowest number of nodes passed), iv) iterate through the nodes connected to a given node. Can we achieve such functionality with the DK?
Answer
We believe that the answer is yes. DK routing is managed by “cost”. So you can apply a cost factor when traversing any links within a network. Please refer to the DK “Geocoding” sample, which can be downloaded from the TatukGIS web site at part of DK sample set #2. This provides a sample of the use of the DK for geocoding-routing functionality using a vector file representing a road network. There are two classes of roads (main and local), as coded in one of the vector attribute fields. The preference for the use of one or the other class of road (the relative cost of the two road types) in the calculation of the optimal route can be modified by the user, allowing the user to easily and quickly modify the routing behavior of the entire network. There are two options for applying the link costs:
1) Each route link has a unique type identifier (recorded to a vector attribute field) and a rule setting that results in a cost factor for each link based on the type/class. In this way, one connection with a length of 50 units might be assigned a cost of “1”, whereas a second connection of a different type, but also with a length of 50 units, might be assigned a cost factor of 1.75. The result is that the connection of the second type is 75% more “expensive” to traverse than the connection of the first type, despite the equal physical distances. But I suppose that this approach is not very useful to your electrical power grid management needs.
2) Use the event OnLinkCost to provide a "cost" for each link (defined by e.g. weighing attributes)
So how to address your requirements:
i) find a route from a node to one of a number of other nodes, while making sure that, e.g., all nodes in the path have the attribute "powered" set to true
Method: Assign a very high cost ( e.g. 1e200) to each node that is not "powered", thereby making it impossible that the chosen route would pass though a node that is not "powered".
ii) find the best route (defined by e.g. weighing attributes)
Method: Use the event OnLinkCost to assign a "cost" to each link (defined by, e.g., weighing attributes)
iii) find the "nearest" node with a certain attribute (typically with the lowest number of nodes traversed)
Method: Assign a cost of 1 to each node. Then the shortest route is the route passing the smallest number of nodes.
iv) Iterate through the nodes connected to a given node.
Method: Find a route between two nodes and then call OnPath event for each segment of such route.