Cost in Network Analysis is a way to set costs for each hierarchy level of segments. If you want to learn how to use cost in a network practically, follow the Network Analyst Tutorial. Download tutorial data. An example of what you want can be found in "Workflow" folder,"OfficeBuilding" geodatabase. In this geodatabase:
Ok.You need to use script to cost each of levels. Suppose your Hierarchy field name is "Type" and "1" means "Highways".
If [Type] = 1 Then
N = 1
If .... Then
N = ...
result = N+5
Simple solution of using cost:
- Create a new Field in the network, named HiCost (Feel free to name this field).
- Calculate the costs of each hierarchy level in the field. ex: set 5 for all highways. 3 for all mainstreets and ... .
- Create a Cost with Integer data type then set this field for it.
This video can be help you for the simple solution.
Note: Be sure your network one-way and directions are correct. They are very important.