How to renumber zones or nodes in a highway network?


Product(s):Cube
Version(s):6.1 to 6.5
Area:Network

Occasionally, we would need to renumber the nodes for non-zonal and zonal cases after editing our network or introducing new zonal data, etc. There are various ways to do this. For this exercise, an example script was provided to show how it can be achieved via scripting.

Solution

;--- creating a lookup file for node numbering

;--- data fields: new# old#

COPY FILE=RENUMBER.DAT 

101 1
102 2
103 3
104 4
105 5
106 6
107 7
108 8
109 9
110 10

ENDCOPY

 RUN PGM=NETWORK 

     NETI[1] = INPUT.NET

     NETO = OUTPUT.NET

     ;--- specifying input lookup file

     ;--- data fields: new# old#

     LOOKUP NAME=RENUM, FILE=RENUMBER.DAT,

     INTERPOLATE=F, FAIL=0,0,0




     ;--- modifying node numbers in nodes

     PHASE=INPUT FILEI=NI.1

          IF (RENUM(N)<>0) N=RENUM(N)

     ENDPHASE




     ;--- modifying node numbers in links

     PHASE=INPUT FILEI=LI.1

          IF (RENUM(A)<>0) A=RENUM(A)

          IF (RENUM(B)<>0) B=RENUM(B)

     ENDPHASE

ENDRUN