# Network Analyst - Slope-Switch at Junctions

4077
21
08-11-2010 01:28 AM
New Contributor
Hello everyone,

Im using a street data set with calculated slope and fuel consumption. In my data set there are some roads with a large slope, so the fuel consumption on negative slope is much lower than on positive slope. My goal is to model a network (Routes and/or Service Area), that can pick on the junctions/nodes between the streets the following slope direction (+ or -) and accumulate the fuel consumption.
My tests so far didnt work out properly, the larger the route got, the worse the results became.

Greetings,
Thomas
Tags (2)
21 Replies
New Contributor III
Why not store the positive/negative slope information on the edges themselves (e.g., using a descriptor attribute)? Having +/- slope information stored on the junction can be misleading since each junction can connect to multiple edges, some of which may have positive slope, and some of which may have negative slope.

New Contributor
Right now I got two fields of slope in my street network attribute table: one for the positive slope and one for the negative slope. My goal is to get the exact results over a route with several ups and downs, which lead to different fuel consumption (obviously u need more fuel when driving uphill than downhill). When i want to receive the whole fuel consumption for that route, id like to have my network accumulate the consumption numbers from my attribute table according to the positive and negative slope.
When im "driving" over a route with 4 lines, first + slope, 2nd -, 3rd +, 4th - etc., id like the network analyst to "jump" in the attribute table to one field from another to get the exact consumption over this route.

Hopefully this made it a little more understandable 🙂 I dont have the Slope itsself on the Junctions, i just thought it would be possible to adjust to junctions so they belong to the right slope numbers of the next part of the road.
New Contributor III
Here is what I would suggest:

1. Create two fields in your streets feature class called "FT_FuelConsumption" and "TF_FuelConsumption" to represent the fuel consumption for both directions (From-To and To-From) of a given street, respectively.

2. Calculate these field values (e.g., using a VBScript formula in the Field Calculator) based on whether they have a positive or negative slope for that direction.

3. Create a cost attribute called "FuelConsumption" in your network dataset. Specify the "FT_FuelConsumption" and "TF_FuelConsumption" fields as the sources for this attribute for your streets in the From-To and To-From directions, respectively.

4. Solve your route as before, but specify to accumulate "FuelConsumption" (this can be specified from the Accumulation tab on your Route analysis layer property pages). You can then open your Routes attribute table after a solve and see the total fuel consumption in the "Total_FuelConsumption" field.

Let me know if you have any further questions.
New Contributor
This actually worked out and the Accumulation-Results looked right!
I just have to adjust my Consumption-Formula now, since I have + and - in one attribute field now. (That was the reason why I calculated one field to positive and one to negative slope, so I can use the mathematical expressions easier). As u mentioned, the VBScript will be the way to go 🙂

Will hopefully work out, thx for your help Michael!
New Contributor
Hey,

its me again and I got one more question 🙂 The routing worked out perfectly, but now ive been trying to solve a service area with the same attributes I already used for solving the routing problems. My goal is to produce range maps for the car type im working with. Ive been using the FuelConsumption attribute as impedance setting and the maximum value of fuel the car can handle as my default break.
The problem with solving the service areas now, is, that they arent using the the maximum value, i rather get some random results in between, changing from every location I start from.
Do you have any ideas on how to fix this? I was thinking about service areas cant handle negative values, since there are some in my fuelconsumption attributes.
Thx in advance for any ideas !
New Contributor III
Negative values for an impedance attribute will be considered as "restricted" by the solvers, and the solver will not be allowed to traverse an element with such negative values. This is because the search algorithm is based on a variant of the well-known Dijkstra's algorithm, which cannot properly handle negative values. Therefore, the only way to include such negative values in the results would be to use this as an accumulated attribute rather than the impedance attribute itself.

Is there a reason that some of these values are negative? I would assume that fuel consumption is always a non-negative value. Am I misunderstanding something?
New Contributor
its actually for electric vehicles. when they are driving downhill section and when they are recuperating (reusing breakenergy) then they actually receive some energy when driving downhill, thus the negative values 😉

Using the fuel consumption as accumulated attribute works fine, when i would look for a service area with a certain distance, like 100 km, but thats unfortunately not the case 😕

so is there really no possible way to get this thing worked out with the fuelconsumption as impedance attribute?
New Contributor III
Ah, I see. This is quite an interesting use-case.

so is there really no possible way to get this thing worked out with the fuelconsumption as impedance attribute?

Theoretically, yes; there are shortest path algorithms which will work for negative weight values (assuming no negative weight cycles in the graph). However, this would require some programming to create a custom solver within the Network Analyst framework to handle such negative values appropriately as, unfortunately, there are no out-of-the-box solvers in Network Analyst which can handle this scenario as an impedance attribute. Additionally, programming a custom solver is no trivial task. If you are interested, however, I can point you to some useful resources on this.

Please let me know, and we can proceed from there.
New Contributor
Since I dont see any other option at the moment, i would like to take a look at this, yes. It would be great, when u could link me to some resources. I would take a look at those informations and then I know if I would be able to do this or not.
Looking forward to it, thanks !