; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=MATRIX PRNFILE="{SCENARIO_DIR}\output\MCMAT00A2.PRN" MSG='Calculate HOV time savings (to be used in mode choice model)'
FILEO MATO[3] = "{SCENARIO_DIR}\OUTPUT\RHSKIM.MAT",
mo=41-49,name=STOLL,SDISTANCE,STIME,STIME2,HTOLL,HDISTANCE,HTIME,HTIME2,TERMTIME
FILEO MATO[2] = "{SCENARIO_DIR}\OUTPUT\FFSKIM.MAT",
mo=31-39,name=STOLL,SDISTANCE,STIME,STIME2,HTOLL,HDISTANCE,HTIME,HTIME2,TERMTIME
FILEI MATI[3] = "{SCENARIO_DIR}\Output\FREESKIM_{ALT}{YEAR}.MAT"
FILEI MATI[1] = "{SCENARIO_DIR}\Output\CONGSKIM_{ALT}{YEAR}.MAT"

FILEO MATO[1] = "{SCENARIO_DIR}\output\HOVSavings_{alt}{year}.MAT",
 MO=21-22,DEC=2*2,NAME=HOVsaveOP,HOVsavePK

PAR ZONEMSG=100

;DistributeINTRASTEP ProcessID="FSUTMSDist", ProcessList=1-3
FILLMW MW[1] =MI.1.9   ; note that time2 is used here (time2 contains both time and time-equivalent of toll)
FILLMW MW[2] =MI.1.5
FILLMW MW[11]=MI.3.9
FILLMW MW[12]=MI.3.5
FILLMW MW[31]=MI.3.1,2,3,5,6,7,8,9,4
FILLMW MW[41]=MI.1.1,2,3,5,6,7,8,9,4


MW[22]=MW[1] - MW[2]   ; hov time savings during off-peak hours
MW[21]=MW[11] - MW[12] ; hov time savings during peak hours

JLOOP
 IF (MW[21] > 0) MW[21]=0.0   ; if less than HOVMIN zero out the savings
 IF (MW[22] > 0) MW[22]=0.0
 IF (MW[21] < {HOVMIN}) MW[21]=0.0   ; if less than HOVMIN zero out the savings
 IF (MW[22] < {HOVMIN}) MW[22]=0.0
ENDJLOOP
ENDRUN
