; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=HIGHWAY PRNFILE="{Scenario_Dir}\OUTPUT\HNHWY00A.PRN"
FILEO MATO[1] = "{SCENARIO_DIR}\OUTPUT\FREESKIM_{ALT}{Year}.MAT",
 MO=1-9, NAME=STOLL,SDISTANCE,STIME,STERMINALTIME,STIME2,HTOLL,HDISTANCE,HTIME,HTIME2
FILEI TURNPENI = "{SCENARIO_DIR}\Input\TURN_{Year}{ALT}.PEN"
FILEI LOOKUPI[1] = "{Catalog_Dir}\Parameters\TTPREP.CSV"
FILEI NETI = "{Scenario_Dir}\OUTPUT\UNLOADED_{ALT}{Year}.NET"

PAR ZONES={ZONESA}
PAR ZONEMSG=100

; ARRAY TERMINAL TIMES INTO MEMORY
;ARRAY ATYPE={ZONESA}
LOOKUP, NAME=TERMTIME, LOOKUP[1]=1, RESULT=2, INTERPOLATE=N, LOOKUPI=1

PROCESS PHASE=LINKREAD
   LW.TIME=li.time+li.svcminutes+li.svcseconds/60+li.cartoll*{ctoll}*60
ENDPROCESS

PROCESS PHASE=ILOOP
   PATHLOAD PATH=LW.TIME, PENI=1, 
      MW[1]=PATHTRACE(LI.CARTOLL), NOACCESS=0,
      MW[2]=PATHTRACE(LI.DISTANCE), NOACCESS=0,
      MW[3]=PATHTRACE(LI.TIME), NOACCESS=0
     ;MW[4]=PATHTRACE(LW.TIME), NOACCESS=0
; BUILD TERMINAL TIME MATRIX
      MW[4]=TERMTIME(1,I)+TERMTIME(1,J)
AG={IZzONE};*2
loop _IZ=1,3;4
  mw[_IZ][i]=lowest(_IZ,{IZzone})/AG
endloop
; set intrazonal array to zero for cost
mw[1][i]=0
MW[5]=MW[3]
MW[6]=MW[1]
MW[7]=MW[2]
MW[8]=MW[3]
MW[9]=MW[5]

ENDPROCESS


;PROCESS PHASE=ADJUST
; This phase is automatically run after the ILOOP phase.  The volume-delay functions (TC) are
; automatically recomputed in this phase to update the link congested travel times based 
; on the volumes from the ILOOP phase.  User defined link computations (LW.varname) that 
; need to be updated based on the new congested travel times should be coded in this phase.


;ENDPROCESS

ENDRUN
