; PILOT Script
FILEO PRINTO[1] = "{CATALOG_DIR}\applications\transit.mas"
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.



; Create TRANSIT.MAS file
copy,
 FILE = "{CATALOG_DIR}\APPLICATIONS\TRANSIT.MAS"

DESCRIPTION                  {SCENARIO_FULLNAME}
ZONESA                       {ZONESA}

; AutoCon-Related Files
; Input
StatDataFile                 {SCENARIO_DIR}\output\STATION_{ALT}{YEAR}.DAT
XtraAutoFileAM               {SCENARIO_DIR}\input\XTRAAUTO_{YEAR}{ALT}.DAT
XtraAutoFileMD               {SCENARIO_DIR}\input\XTRAAUTO_{YEAR}{ALT}.DAT
AutoDelFileAM                {SCENARIO_DIR}\input\AUTDELPK_{YEAR}{ALT}.DAT
AUTODELFILEMD                {SCENARIO_DIR}\input\AUTDELOP_{YEAR}{ALT}.DAT
NodesFile                    {SCENARIO_DIR}\output\XY_{ALT}{YEAR}.DAT
TransitLineFile              {SCENARIO_DIR}\input\troute_{YEAR}{ALT}.lin
RHSKIMS                      {SCENARIO_DIR}\output\RHSKIMTT.{ALT}{YEAR}
FHSKIMS                      {SCENARIO_DIR}\output\FHSKIMTT.{ALT}{YEAR}
; Output
AUTOCONRPT                   {SCENARIO_DIR}\output\AUTOCON.OUT
PNRAUTOAM                    {SCENARIO_DIR}\output\NTLEG2PK_{ALT}{YEAR}.NTL
PNRAUTOMD                    {SCENARIO_DIR}\output\NTLEG2OP_{ALT}{YEAR}.NTL
KNRAUTOAM                    {SCENARIO_DIR}\output\NTLEG2PK_KNR{ALT}{YEAR}.NTL
KNRAUTOMD                    {SCENARIO_DIR}\output\NTLEG2OP_KNR{ALT}{YEAR}.NTL
; AutoCon Parameters
AUTOCONVERSION               1
ZONESI                       {ZONESI}
CBDZONE                      {CBDZONE,EditBox-INTEGER,"","733",1,1640}
TERM                         2.00
DEF                          2.00
NOPT                         1
BACK                         1
BACKD                        4.0
BACKPC                       0.30
UNITS                        200
MAXMODE                      27
MODENUM (not used)            21 22 23 24 25 26 27
PREMIUMFLAG                    0  1  0  1  1  1  1
MODEPRIORITY                   7  5  7  2  1  4  3
VOTAM                         6.00
VOTMD                         3.00
OVTRATIOAM                    2.00
OVTRATIOMD                    2.00
AATRATIOAM                    1.50
AATRATIOMD                    1.50
AUTOCCPNR                    {OCCPNRAccess}
AUTOCCKNR                    {OCCPNRAccess}
AOC                          {hwyopcost}
InflTransitFare              {InflationFare}
InflAOC                      {InflationAOC}
InflParkingCost              {InflationParkCost}
AUTODATAM                    {SCENARIO_DIR}\output\NTLDA2PK_{ALT}{YEAR}.TIM
AUTODATMD                    {SCENARIO_DIR}\output\NTLDA2OP_{ALT}{YEAR}.TIM
ACONLISTAM                   {SCENARIO_DIR}\output\NTLEG2PK_{ALT}{YEAR}.PRN
ACONLISTMD                   {SCENARIO_DIR}\output\NTLEG2OP_{ALT}{YEAR}.PRN


endcopy

; End of PILOT Script

LOOP ACCESS = 1, 2, 1

; PILOT Script


IF (ACCESS == 1)
    ACCESS_NAME='Walk'
    ACCESS_MODE=0
    DELACCMODE='2'
    DELEGRMODE='2'
ELSEIF (ACCESS == 2)
    ACCESS_NAME='Auto'
    ACCESS_MODE=1
    DELACCMODE='1'
    DELEGRMODE='2'
ENDIF

; End of PILOT Script

  LOOP MODE = 1, 1, 1

; PILOT Script



IF (MODE==1)                                  ; transit paths
  MODE_NAME='Transit'
  DELMOD=''
ENDIF

FAVMODE=1.00
LOWMODE=1.30
NOMODE=9.99
CRMODE=1.00




; End of PILOT Script

; Script for program MATRIX in file "D:\JOB\D3\Model\A\APPLICATIONS\TPMAT00B.S"

; 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\TPMAT00G.PRN" MSG='create FACTORS file'
FILEI LOOKUPI[1] = "{CATALOG_DIR}\parameters\TRN_COEFFICIENTS.DBF"
FILEO PRINTO[1] = "{SCENARIO_DIR}\output\@Access_Name@@Mode_Name@.FAC"

LOOKUP NAME=COEFF, 
       LOOKUP[1]=1, RESULT=2,
       FAIL=0,0,0,
       LIST=Y,
       INTERPOLATE=N,
       LOOKUPI=1

ZONES=1
_ovtam =COEFF(1,3)/COEFF(1,1)     ; out-of-vehicle time factor (OVT time and Wait factor)
valtime   =0.6*COEFF(1,1)/COEFF(1,4)  ; value of time (in $/hr)
aatfactor =COEFF(1,5)/COEFF(1,1)     ; drive access to transit time factor
_xpena=COEFF(1,6)/COEFF(1,1)

  comment=';'

  PRINT FORM=5.0,
    list="",comment, " PT Factors File for ********",'@ACCESS_NAME@'," Access - ",'@MODE_NAME@'," ********",
         "\n",comment, " FSUTMS Transit Model - July 2008, AECOM Consult",
         "\n",
         "\n",comment, "Global Settings",
         "\n BESTPATHONLY=T",
         "\n MAXFERS=5",
         "\n SERVICEMODEL=FREQUENCY",
         "\n RECOSTMAX=300.0",
         "\n FREQBYMODE=T",
         "\n\n",comment, "Global Settings",
         "\n DELACCESSMODE = ",'@DELACCMODE@',
         "\n DELEGRESSMODE = ",'@DELEGRMODE@',
         "\n\n",comment, "Fare and Wait Times",
         "\n FARESYSTEM=1, OPERATOR=1",
         "\n FARESYSTEM=2, OPERATOR=2",
         "\n FARESYSTEM=3, OPERATOR=3",         
         "\n IWAITCURVE=1,  NODES={NODEMIN}-99999",
         "\n XWAITCURVE=1, NODES={NODEMIN}-99999",
         "\n WAITFACTOR=2.00, NODES={NODEMIN}-99999",
         "\n\n",comment, "Runfactors",
         "\n RUNFACTOR[1]   =",_ovtam(5.2),
         "\n RUNFACTOR[2]   = 1.00",
         "\n RUNFACTOR[4]   = 9.99",
         "\n RUNFACTOR[11]  =",_ovtam(5.2),
         "\n RUNFACTOR[12]  =",_ovtam(5.2),
         PRINTO=1

    if (@MODE@==1)
      list="",
         "\n RUNFACTOR[21]  = ",@FAVMODE@(4.2),
         "\n RUNFACTOR[22]  = ",@FAVMODE@(4.2),
         "\n RUNFACTOR[23]  = ",@FAVMODE@(4.2),
         "\n RUNFACTOR[24]  = ",@FAVMODE@(4.2),
         "\n RUNFACTOR[25]  = ",@FAVMODE@(4.2),
       
         PRINTO=1
    
    endif

    list="",
         "\n\n",comment, "Boarding and Transfer Penalties",
         "\n BRDPEN[21]  = 2.0",
         "\n BRDPEN[22]  = 2.0",
         "\n BRDPEN[23]  = 2.0",
         "\n BRDPEN[24]  = 2.0",
         "\n BRDPEN[25]  = 2.0",  
         "\n XFERPEN=0.00, from=21-200, to=21-200",
         "\n XFERFACTOR=1.00, from=21-200, to=21-200",
         "\n XFERCONST=",_xpena(4.2),", from=21-200, to=21-200",
         "\n  ",
         PRINTO=1

ENDRUN


  ENDLOOP

; PILOT Script



; End of PILOT Script

ENDLOOP

; Script for program NETWORK in file "D:\JOB\D3\Model\A\APPLICATIONS\TPNET00C.S"

; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=NETWORK PRNFILE="D:\JOB\D3\Model\A\APPLICATIONS\TPNET00C.PRN" MSG='Transit speed for peak period'
FILEI LINKI[1] = "{SCENARIO_DIR}\OUTPUT\PREASSIGN_{ALT}{Year}.NET"
FILEI LOOKUPI[1] = "{Catalog_Dir}\Parameters\TRANSPD.dbf"
FILEO NETO = "{SCENARIO_DIR}\output\HWYLOAD2_{Alt}{Year}.NET"

PROCESS PHASE=LINKMERGE

  ;If auto travel time is not present or is zero, a default value of 15 mph is used.
  IF (TIME_1>0)
    _AUTOSPEED=60*DISTANCE/TIME_1
  ELSE
    _AUTOSPEED=15
  ENDIF

;**************************************************************
;BEGIN POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

;************************************************************************************************
;* DEFAULT TRANSIT SPEEDS SET EQUAL TO AUTO SPEEDS. APPLY APPROPRIATE TRANSIT SPEED CURVES HERE.*
;************************************************************************************************

lookup name=curve,
     lookup[1]=CURVE_NO, result=LOW_MODE,
     lookup[2]=CURVE_NO, result=HIGH_MODE,
     lookup[3]=CURVE_NO, result=LOW_FT,
     lookup[4]=CURVE_NO, result=HIGH_FT,
     lookup[5]=CURVE_NO, result=LOW_AT,
     lookup[6]=CURVE_NO, result=HIGH_AT,
     lookup[7]=CURVE_NO, result=SPEEDRATIO,
     interpolate=n,fail=0,0,0,list=y,lookupi=1
array lm=500,hm=500,lf=500,hf=500,la=500,ha=500,sr=500

loop _nn=1,500
   LM[_nn]=CURVE(1,_nn)
   HM[_nn]=CURVE(2,_nn)
   LF[_nn]=CURVE(3,_nn)
   HF[_nn]=CURVE(4,_nn)
   LA[_nn]=CURVE(5,_nn)
   HA[_nn]=CURVE(6,_nn)
   SR[_nn]=CURVE(7,_nn)
if (lm[_nn]>0) _numberofcurves=_nn ; obtain the total number of curves fromt he curve file
if (lm[_nn]<=0) break
endloop

;**************************************************************
;END POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************
      ; Bus time overrides
; IF   (TBSSPEED>0 && TBSTIME==0) TBSTIME = (DISTANCE/TBSSPEED)*60.0
; IF   (TBSTIME>0)
;       M21TIMEPK=TBSTIME
;       M22TIMEPK=TBSTIME
;       M23TIMEPK=TBSTIME
; ENDIF

  LOOP _nn=1,_numberofcurves
    if ((FACILITY_TYPE >= LF[_nn]) & (FACILITY_TYPE <= HF[_nn]) & (AREA_TYPE >= LA[_nn]) & (AREA_TYPE <= HA[_nn]))
     if ((LM[_nn] >= 21) & (HM[_nn] <= 21)) spdratioM21 = SR[_nn]
     if ((LM[_nn] >= 22) & (HM[_nn] <= 22)) spdratioM22 = SR[_nn]
   ;  if ((LM[_nn] >= 23) & (HM[_nn] <= 26)) spdratioM23 = SR[_nn]
    ; if ((LM[_nn] >= 27) & (HM[_nn] <= 27)) spdratioM27 = SR[_nn]
   ;  if ((LM[_nn] >= 31) & (HM[_nn] <= 31)) spdratioM31 = SR[_nn]
   ;  if ((LM[_nn] >= 32) & (HM[_nn] <= 32)) spdratioM32 = SR[_nn]
   ;  if ((LM[_nn] >= 33) & (HM[_nn] <= 36)) spdratioM33 = SR[_nn]
   ;  if ((LM[_nn] >= 37) & (HM[_nn] <= 37)) spdratioM37 = SR[_nn]
    endif
  ENDLOOP
     ; APPLY DEFAULT CURVES
     IF (_AUTOSPEED>0)
       _TSPD21=spdratioM21*_AUTOSPEED  ; Bus Speeds
       _TSPD27=spdratioM22*_AUTOSPEED  ; Project mode
    ;   _TSPD23=spdratioM23*_AUTOSPEED  ; Circulator Speeds (assumed same as buses)
    ;   _TSPD27=spdratioM27*_AUTOSPEED  ; Project mode
    ;   _TSPD31=spdratioM31*_AUTOSPEED  ; Bus Speeds
    ;   _TSPD32=spdratioM32*_AUTOSPEED  ; BRT Speeds (assumed same as buses)
    ;   _TSPD33=spdratioM33*_AUTOSPEED  ; Circulator Speeds (assumed same as buses)
    ;   _TSPD37=spdratioM37*_AUTOSPEED  ; Project mode

       M21TIMEPK=60*(DISTANCE)/_TSPD21
       M27TIMEPK=60*(DISTANCE)/_TSPD27
 ;      M23TIMEOP=60*(DISTANCE)/_TSPD23
 ;      M27TIMEOP=60*(DISTANCE)/_TSPD27
 ;      M31TIMEOP=60*(DISTANCE)/_TSPD31
 ;      M32TIMEOP=60*(DISTANCE)/_TSPD32
 ;      M33TIMEOP=60*(DISTANCE)/_TSPD33
 ;      M37TIMEOP=60*(DISTANCE)/_TSPD37
     ENDIF
;OVERRIDES BUS TIMES FOR BUS LINKS FROM NETWORK
  ;   IF (TBSTIME>0)
  ;      M21TIMEOP=TBSTIME
  ;      M22TIMEOP=TBSTIME
  ;   ENDIF



      ; WALK CONTROLS
      WALKTIME=60*DISTANCE/{AVGWLKSPD}
 IF (FACILITY_TYPE=10-19,70-99)
      WALKTIME=999.99
 ENDIF
 IF (FACILITY_TYPE=59)
      WALKTIME=1
      DISTANCE=0.05
      ADJDISTANCE=DISTANCE
 ENDIF

 IF((A={FromNode}) && (B={ToNode}))

      list="\n\n"
      list="     An     Bn   Dist   ASpd   Atim   TSpd   Ttim    Crv"
      list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME_8(7.2),_TSPD21(7.2),M21TIMEPK(7.2),_CURVEMODE21(7.0)," MODE21"
      list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME_8(7.2),_TSPD22(7.2),M27TIMEPK(7.2),_CURVEMODE22(7.0)," MODE27"
     ; list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME_1(7.2),_TSPD23(7.2),M23TIMEPK(7.2),_CURVEMODE23(7.0)," MODE23"
     ; list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME_1(7.2),_TSPD24(7.2),M24TIMEPK(7.2),_CURVEMODE24(7.0)," MODE24"
     ; list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME_1(7.2),_TSPD25(7.2),M25TIMEPK(7.2),_CURVEMODE25(7.0)," MODE25"
     ; list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME_1(7.2),_TSPD26(7.2),M26TIMEPK(7.2),_CURVEMODE26(7.0)," MODE26"
     ; list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME_1(7.2),_TSPD27(7.2),M27TIMEPK(7.2),_CURVEMODE27(7.0)," MODE27"
      list="\n\n"
 ENDIF

 ENDPROCESS

ENDRUN


; Script for program NETWORK in file "D:\JOB\D3\Model\A\APPLICATIONS\TPNET00B.S"
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=NETWORK PRNFILE="{SCENARIO_DIR}\Output\TPNET00L.PRN" MSG='Transit speeds for off-peak period'
FILEI LINKI[1] = "{SCENARIO_DIR}\output\unloaded_{alt}{year}.net"
FILEO PRINTO[1] = "{SCENARIO_DIR}\Output\XY_{alt}{year}.DAT"
FILEI LOOKUPI[1] = "{Catalog_Dir}\Parameters\TRANSPD.dbf"
FILEO NETO = "{SCENARIO_DIR}\output\unloaded2_{alt}{year}.net"

PROCESS  PHASE=NODEMERGE
; Use this phase to make computations and selections of any data on the NODEI files.
  print list=n(6.0),x(20.2),y(20.2),printo=1
ENDPROCESS

PROCESS PHASE=LINKMERGE

  ;If auto travel time is not present or is zero, a default value of 15 mph is used.
  IF (TIME>0)
    _AUTOSPEED=60*DISTANCE/TIME
  ELSE
    _AUTOSPEED=15
  ENDIF

;**************************************************************
;BEGIN POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

;************************************************************************************************
;* DEFAULT TRANSIT SPEEDS SET EQUAL TO AUTO SPEEDS. APPLY APPROPRIATE TRANSIT SPEED CURVES HERE.*
;************************************************************************************************

lookup name=curve,
     lookup[1]=CURVE_NO, result=LOW_MODE,
     lookup[2]=CURVE_NO, result=HIGH_MODE,
     lookup[3]=CURVE_NO, result=LOW_FT,
     lookup[4]=CURVE_NO, result=HIGH_FT,
     lookup[5]=CURVE_NO, result=LOW_AT,
     lookup[6]=CURVE_NO, result=HIGH_AT,
     lookup[7]=CURVE_NO, result=SPEEDRATIO,
     interpolate=n,fail=0,0,0,list=y,lookupi=1
array lm=500,hm=500,lf=500,hf=500,la=500,ha=500,sr=500

loop _nn=1,500
   LM[_nn]=CURVE(1,_nn)
   HM[_nn]=CURVE(2,_nn)
   LF[_nn]=CURVE(3,_nn)
   HF[_nn]=CURVE(4,_nn)
   LA[_nn]=CURVE(5,_nn)
   HA[_nn]=CURVE(6,_nn)
   SR[_nn]=CURVE(7,_nn)
if (lm[_nn]>0) _numberofcurves=_nn ; obtain the total number of curves fromt he curve file
if (lm[_nn]<=0) break
endloop
  LOOP _nn=1,_numberofcurves
    if ((FACILITY_TYPE >= LF[_nn]) & (FACILITY_TYPE <= HF[_nn]) & (AREA_TYPE >= LA[_nn]) & (AREA_TYPE <= HA[_nn]))
     if ((LM[_nn] >= 21) & (HM[_nn] <= 21)) spdratioM21 = SR[_nn]
     if ((LM[_nn] >= 22) & (HM[_nn] <= 22)) spdratioM22 = SR[_nn]
endif
  ENDLOOP
  IF (_AUTOSPEED>0)
       _TSPD21=spdratioM21*_AUTOSPEED  ; Bus Speeds
       _TSPD27=spdratioM22*_AUTOSPEED  ; Project mode

       M21TIMEOP=60*(DISTANCE)/_TSPD21
       M27TIMEOP=60*(DISTANCE)/_TSPD27
    ENDIF
  ; WALK CONTROLS
       WALKTIME=60*DISTANCE/{AVGWLKSPD}
     IF(FACILITY_TYPE=10-19,70-99)
       WALKTIME=999.99
     ENDIF
     IF(FACILITY_TYPE=59)
       WALKTIME=1
       distance=0.05
       ADJDISTANCE = DISTANCE
     ENDIF

     IF (A=={FromNode} && B=={ToNode})
       list="\n\n"
       list="     An     Bn   Dist   ASpd   Atim   TSpd   Ttim    Crv"
       list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME(7.2),_TSPD21(7.2),M21TIMEOP(7.2),_CURVEMODE21(7.0)," MODE21"
       list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME(7.2),_TSPD22(7.2),M27TIMEOP(7.2),_CURVEMODE27(7.0)," MODE27"
       ;list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME(7.2),_TSPD23(7.2),M23TIMEOP(7.2),_CURVEMODE23(7.0)," MODE23"
       ;list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME(7.2),_TSPD24(7.2),M24TIMEOP(7.2),_CURVEMODE24(7.0)," MODE24"
       ;list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME(7.2),_TSPD25(7.2),M25TIMEOP(7.2),_CURVEMODE25(7.0)," MODE25"
       ;list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME(7.2),_TSPD26(7.2),M26TIMEOP(7.2),_CURVEMODE26(7.0)," MODE26"
       ;list=A(7.0),B(7.0),DISTANCE(7.2),_AUTOSPEED(7.2),TIME(7.2),_TSPD27(7.2),M27TIMEOP(7.2),_CURVEMODE27(7.0)," MODE27"
       ;list="\n\n"
     ENDIF

ENDPROCESS

ENDRUN


; Script for program NETWORK in file "D:\JOB\D3\Model\A\APPLICATIONS\TPNET00A.S"
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=NETWORK PRNFILE="{SCENARIO_DIR}\output\TPNET00A.PRN" MSG='Build CBD xfer conn, station conn, & create station data file'
FILEO PRINTO[7] = "{SCENARIO_DIR}\output\mpocounty.dat"
FILEO PRINTO[1] = "{SCENARIO_DIR}\output\ZONESAT.DAT"
FILEO PRINTO[6] = "{SCENARIO_DIR}\output\STATION_{alt}{year}.DAT"
FILEI LOOKUPI[1] = "{SCENARIO_DIR}\Output\XY_{alt}{year}.DAT"
FILEI LINKI[2] = "{SCENARIO_DIR}\output\HWYLOAD2_{Alt}{Year}.NET"
FILEI LINKI[1] = "{SCENARIO_DIR}\output\unloaded2_{alt}{year}.net"

FILEO PRINTO[5] = "{SCENARIO_DIR}\output\StationConn_{alt}{year}.DAT"
FILEO PRINTO[3] = "{SCENARIO_DIR}\output\CBDxfer_TMP.DAT"
ARRAY STATSTOP=99999 STATNUMB=99999, statspaces=99999, PNRTERM=99999, KNRTERM=99999, nrz=99999

PROCESS PHASE=NODEMERGE
; put nodes, x and y coordinates into memory for lookup nearest TAZ question
lookup lookupi=1,
       name=netcoord,
       lookup[1]=1, result=2,
       lookup[2]=1, result=3,
       fail=0

IF(N=1)
 _CNT=1
  ; Print out code for generating CBD sidewalks to a temporary file
 PRINT FORM=5.0, list="GENERATE, COST=(LW.WALKDISTANCE),EXTRACTCOST=(LW.WALKTIME),MAXCOST=200*{XFERACC},LIST=T,",
 "\n  EXCLUDELINK=(LI.FACILITY_TYPE=10-19,69,70-99),NTLEGMODE=12,MAXNTLEGS=200*{MAXWLKACCLNKS},DIRECTION=3,ONEWAY=F,",
 "\n  FROMNODE=",PRINTO=3
ENDIF

IF(n<(_zones+1)) print list=n(5.0),mpo(5.0),county(5.0),printo=7

; extract station info from network for later calculations

IF (TSTYPE=1)
 workstat=N
 workstatx=netcoord(1,workstat,0)
 workstaty=netcoord(2,workstat,0)
 mindist=99999.99
LOOP _ww=1,{ZONESA}
  zx=netcoord(1,_ww,0)
  zy=netcoord(2,_ww,0)
IF (_ww!=workstat) dist=sqrt((workstatx-zx)^2+(workstaty-zy)^2)
IF (dist<mindist) mindist=dist, nearestzone=_ww
ENDLOOP


 PRINT FORM=5.0, list="GENERATE, COST=(LW.WALKDISTANCE),EXTRACTCOST=(LW.WALKTIME),MAXCOST=200*3.0,LIST=T,",
 "\n  EXCLUDELINK=(LI.FACILITY_TYPE=10-19,69,70-99),NTLEGMODE=1,MAXNTLEGS=200*{MAXWLKACCLNKS},DIRECTION=3,ONEWAY=F,",
 "\n  FROMNODE=",N,",TONODE=1-{ZONESA}",PRINTO=5

 ; Station data file
 PRINT LIST=_CNT(4.0),N(6.0),NEARESTZONE(6.0),TSRANGE(6.1),TSPARK(6.0),TSCOSTAM(6.0),TSCOSTMD(6.0),
                           TSPNRTERM(6.1),TSKNRTERM(6.1),"  1 ",TSNAME(24),PRINTO=6
 _CNT=_CNT+1

ENDIF
ENDPROCESS

PHASE=LINKMERGE
  IF( (LI.1.A <> _lastnode) && (LI.1.A > {ZONESA}) )
  IF(LI.1.AREA_TYPE>10 && LI.1.AREA_TYPE<20)                    ;list only CBD zones
    PRINT FORM=5.0, list= LI.1.A(6.0),",", PRINTO=3
  ENDIF
  ENDIF

  ; list zones with area types (replaces CBDZONES.SYN and EXURBS.SYN files)
  IF ( (LI.1.A <> _lastnode) && (LI.1.A <= {ZONESA}) )
  IF (LI.1.A > 0) PRINT list=LI.1.A(10.0), LI.1.AREA_TYPE(10.0), printo=1
  ENDIF

  _lastnode = LI.1.A
ENDPHASE

PHASE=SUMMARY
  PRINT FORM=5.0, list= "TONODE={NODEMIN}-99999", PRINTO=3
ENDPHASE

ENDRUN


; Script for program MATRIX in file "D:\JOB\D3\Model\A\APPLICATIONS\TPMAT00F.S"
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=MATRIX MSG='Create STATDATA DBF file'
FILEO RECO[1] = "{SCENARIO_DIR}\output\STATDATA_{alt}{year}.DBF",
 FORM=10.0, FIELDS=TAZ,STNODE,STNUM, FORM=10.2, FIELDS=STMAXD,STPKSP,STPKCS1,STPKCS2,STWALKPR,STWALKKR,FORM=5.0, FIELDS=TSTYPE, CFORM=30, FIELDS=STNAME
FILEI RECI = "{SCENARIO_DIR}\output\STATION_{alt}{year}.DAT",
 SORT=TAZ,
   STATION=1-4, STATNODE=5-10, TAZ=11-16, DRV=17-22, SPACES=23-28,
   A1=29-34, A2=35-40, B1=41-46, B2=47-52, C1=54-55, NAME(C)=56-85

RO.TAZ=RI.TAZ
RO.STNODE=RI.STATNODE
RO.STNUM=RI.STATION
RO.STMAXD=RI.DRV
RO.STPKSP=RI.SPACES
RO.STPKCS1=RI.A1
RO.STPKCS2=RI.A2
RO.STWALKPR=RI.B1
RO.STWALKKR=RI.B2
RO.TSTYPE=RI.C1
RO.STNAME=RI.NAME

WRITE RECO=1

ENDRUN


; Script for program MATRIX in file "D:\JOB\D3\Model\A\APPLICATIONS\TPMAT00G.S"
;;<<GENERATED SCRIPT>><<MATRIX>>;;
;>>>
;>>>
;;>>>
;Input Matrix File 1:
;Output DBF File:
;Output CSV File:
;**********************************************************************
;THIS SCRIPT READS A MAT FILE, CREATE TWO MATRICS IN CSV AND DBF      *  
;**********************************************************************
; BY CITILABS
;
;;<<End Parameters>>;;


; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=MATRIX MSG='Store MPO and County of TAZs in DBF File'
FILEO RECO[1] = "{SCENARIO_DIR}\output\mpocounty.dbf",
fields=taz,mpo,county
FILEI RECI = "{SCENARIO_DIR}\output\mpocounty.dat",
taz=1-5,mpo=6-10,county=11-15

RO.TAZ=RI.TAZ
ro.mpo=ri.mpo
ro.county=ri.county
write reco=1



ENDRUN


; Script for program PUBLIC TRANSPORT in file "D:\JOB\D3\Model\A\APPLICATIONS\TPPTR00A.S"
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=PUBLIC TRANSPORT PRNFILE="{SCENARIO_DIR}\output\TPPTR00A.PRN" MSG='Build peak access connectors'
FILEI NETI = "{SCENARIO_DIR}\output\HWYLOAD2_{Alt}{Year}.NET"
FILEO NETO = "{SCENARIO_DIR}\output\NTLEGPK.NET"
FILEO NTLEGO = "{SCENARIO_DIR}\output\NTLEGPK_{year}{alt}.TEM"
FILEO REPORTO = "{SCENARIO_DIR}\output\TPPTR00B.PRN"
FILEI FACTORI[1] = "{SCENARIO_DIR}\output\WalkTransit.FAC"
FILEI FAREI = "{Scenario_Dir}\Input\TFARES_{Year}{ALT}.FAR"
FILEI SYSTEMI = "{CATALOG_DIR}\parameters\TSYSD.PTS"
FILEI LINEI[1] = "{SCENARIO_DIR}\INPUT\TROUTE_{YEAR}{ALT}.LIN"

;**************************************************************
;BEGIN POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

; OVERALL PARAMETERS OF RUN
PARAMETERS USERCLASSES=1,FARE=N, MAPSCALE={Units}, HDWAYPERIOD=1,
           NOROUTEERRS=999999, NOROUTEMSGS=999999,
           TRANTIME=LW.TRANTIME,
           TRANTIME[21]=LI.M21TIMEPK,
      ;     TRANTIME[22]=LI.M22TIMEPK,
      ;     TRANTIME[23]=LI.M23TIMEPK,
       ;    TRANTIME[24]=LI.M24TIMEPK,
           TRANTIME[27]=LI.M27TIMEPK

;**************************************************************
;END POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

REPORT LINES=T
PROCESS PHASE=LINKREAD
           LW.TRANTIME=LI.M21TIMEPK
           LW.WALKTIME=LI.WALKTIME
           LW.WALKDISTANCE=LI.DISTANCE
           LW.DISTANCE=LI.DISTANCE
ENDPROCESS

PROCESS PHASE=DATAPREP

  ; 1 - Generate Walk Access Connectors
 
 GENERATE, COST=(LW.WALKDISTANCE),EXTRACTCOST=(LW.WALKTIME),MAXCOST=200*{WALKACC},LIST=T,EXCLUDELINK=(LI.FACILITY_TYPE=10-19,69,70-99),
            NTLEGMODE=1,MAXNTLEGS=200*{MAXWLKACCLNKS},DIRECTION=3,ONEWAY=F,FROMNODE=1-{ZONESA},TONODE={NODEMIN}-99999

 ; 4 - Generate All-Walk Connectors
  GENERATE, COST=(LW.WALKDISTANCE),EXTRACTCOST=(LW.WALKTIME),MAXCOST=200*7,LIST=T,EXCLUDELINK=(LI.FACILITY_TYPE=10-19,69,70-99),
            NTLEGMODE=4,MAXNTLEGS=200*{MAXWLKACCLNKS},DIRECTION=3,ONEWAY=F,FROMNODE=1-{ZONESA},TONODE=1-{ZONESA}

  ; 11 - If micro-coding exists, generate Fixed-guideway to bus transfer connectors
   IF ({isMicroCode} <> 0)
   GENERATE, COST=(LW.DISTANCE),EXTRACTCOST=(LI.WALKTIME),MAXCOST=200*{WALKACC},LIST=T,INCLUDELINK=(LI.FACILITY_TYPE=59),
            NTLEGMODE=11,MAXNTLEGS=200*{MAXWLKACCLNKS},DIRECTION=3,ONEWAY=F,FROMNODE={NODEMIN}-99999,TONODE={NODEMIN}-99999
  endif

  ; 12 - Generate CBD sidewalk connectors
   READ, FILE = "{SCENARIO_DIR}\OUTPUT\CBDXFER_TMP.DAT"
ENDPROCESS

ENDRUN


; Script for program MATRIX in file "D:\JOB\D3\Model\A\APPLICATIONS\TPMAT00A.S"
; 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\TPMAT00A.PRN" MSG='Subdivide connectors into separate files by mode'
FILEO PRINTO[6] = "{SCENARIO_DIR}\output\NTLEG4PK_{alt}{year}.NTL"
FILEO PRINTO[4] = "{SCENARIO_DIR}\output\NTLEG11PK_{alt}{year}.NTL"
FILEI RECI = "{SCENARIO_DIR}\output\NTLEGPK_{year}{alt}.TEM"
FILEO PRINTO[5] = "{SCENARIO_DIR}\output\NTLEG12PK_{alt}{year}.NTL"
FILEO PRINTO[1] = "{SCENARIO_DIR}\output\NTLEG1PK_{alt}{year}.NTL"

s1=strpos('NT',reci)
s2=strpos('LEG',reci)
s3=strpos('MODE',reci)
s4=strpos('COST',reci)
s5=strpos('DIST',reci)
s6=strpos('ONEWAY',reci)
s7=strpos('XN',reci)

; get the origin and destination zone
s8=(s3-s2)
leg1=substr(reci,s2,s8)
s9=strpos('=',leg1)
s10=strpos('-',leg1)
s11=(s9+1)
s12=(s10-1)
s13=(s10+1)
zonei=val(substr(leg1,s11,s12))
zonej=val(substr(leg1,s13,strlen(leg1)))

; get the mode number
s14=(s4-s3)
mode1=substr(reci,s3,s14)
s15=strpos('=',mode1)
s16=(s15+1)
mode=val(substr(mode1,s16,strlen(mode1)))

; get the time on the connector (cost field in the NT leg file)
s17=(s5-s4)
time1=substr(reci,s4,s17)
s18=strpos('=',time1)
s19=(s18+1)
time=val(substr(time1,s19,strlen(time1)))

; get the distance
s20=(s6-s5)
dist1=substr(reci,s5,s20)
s21=strpos('=',dist1)
s22=(s21+1)
dist=val(substr(dist1,s22,strlen(dist1)))

; get the rest of the string
s23=substr(reci,s6,strlen(reci))

if (i==1 && _ctr==0)
  PRINT LIST=";;<<PT>>;;", PRINTO=1
  PRINT LIST=";;<<PT>>;;", PRINTO=4
  PRINT LIST=";;<<PT>>;;", PRINTO=5
  PRINT LIST=";;<<PT>>;;", PRINTO=6
  _ctr = _ctr + 1
endif
;modes - walk, pnr, knr, all-walk, platcform connectors, sidewalk
if (mode=1) PRINT LIST="NT LEG=",zonei(5.0),"-",zonej(5.0)," MODE=",mode(2.0)," COST=",time(6.2)," DIST=",dist(5.2)," ",s23,PRINTO=1
if (mode=4) PRINT LIST="NT LEG=",zonei(5.0),"-",zonej(5.0)," MODE=",mode(2.0)," COST=",time(6.2)," DIST=",dist(5.2)," ",s23,PRINTO=6
if (mode=11) PRINT LIST="NT LEG=",zonei(5.0),"-",zonej(5.0)," MODE=",mode(2.0)," COST=",time(6.2)," DIST=",dist(5.2)," ",s23,PRINTO=4
if (mode=12) PRINT LIST="NT LEG=",zonei(5.0),"-",zonej(5.0)," MODE=",mode(2.0)," COST=",time(6.2)," DIST=",dist(5.2)," ",s23,PRINTO=5


ENDRUN


; Script for program PUBLIC TRANSPORT in file "D:\JOB\D3\Model\A\APPLICATIONS\TPPTR00B.S"
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=PUBLIC TRANSPORT PRNFILE="{SCENARIO_DIR}\output\TPPTR00C.PRN" MSG='Build off-peak access connectors'
FILEI NETI = "{SCENARIO_DIR}\output\unloaded2_{alt}{year}.net"
FILEO NETO = "{SCENARIO_DIR}\output\NTLEGOP.NET"
FILEO NTLEGO = "{SCENARIO_DIR}\output\NTLEGOP_{year}{alt}.TEM"
FILEO REPORTO = "{SCENARIO_DIR}\output\TPPTR00D.PRN"
FILEI FACTORI[1] = "{SCENARIO_DIR}\output\WalkTransit.FAC"
FILEI FAREI = "{Scenario_Dir}\Input\TFARES_{Year}{ALT}.FAR"
FILEI SYSTEMI = "{CATALOG_DIR}\parameters\TSYSD.PTS"
FILEI LINEI[1] = "{SCENARIO_DIR}\INPUT\TROUTE_{YEAR}{ALT}.LIN"

;**************************************************************
;BEGIN POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************
; OVERALL PARAMETERS OF RUN
PARAMETERS USERCLASSES=1,FARE=N, MAPSCALE={Units}, HDWAYPERIOD=2,
           NOROUTEERRS=999999, NOROUTEMSGS=999999,
           TRANTIME=LW.TRANTIME,
           TRANTIME[21]=LI.M21TIMEOP,
           ;TRANTIME[22]=LI.M22TIMEOP,
           ;TRANTIME[23]=LI.M23TIMEOP,
           ;TRANTIME[24]=LI.M24TIMEOP,
           TRANTIME[27]=LI.M27TIMEOP

;**************************************************************
;END POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

  REPORT LINES=T
  PROCESS PHASE=LINKREAD
          LW.TRANTIME=LI.M21TIMEOP
          LW.WALKTIME=LI.WALKTIME
          LW.WALKDISTANCE=LI.DISTANCE
          LW.DISTANCE=LI.DISTANCE
  ENDPROCESS

  PROCESS PHASE=DATAPREP

  ; 1 - Generate Walk Access Connectors
  GENERATE, COST=(LW.WALKDISTANCE),EXTRACTCOST=(LW.WALKTIME),MAXCOST=200*{WALKACC},LIST=T,EXCLUDELINK=(LI.FACILITY_TYPE=10-19,69,70-99),
            NTLEGMODE=1,MAXNTLEGS=200*{MAXWLKACCLNKS},DIRECTION=3,ONEWAY=F,FROMNODE=1-{ZONESA},TONODE={NODEMIN}-99999

  ; 4 - Generate All-Walk Connectors
  GENERATE, COST=(LW.WALKDISTANCE),EXTRACTCOST=(LW.WALKTIME),MAXCOST=200*7,LIST=T,EXCLUDELINK=(LI.FACILITY_TYPE=10-19,69,70-99),
            NTLEGMODE=4,MAXNTLEGS=200*{MAXWLKACCLNKS},DIRECTION=3,ONEWAY=F,FROMNODE=1-{ZONESA},TONODE=1-{ZONESA}

  ; 11 - If micro-coding exists, generate Fixed-guideway to bus transfer connectors
  IF({isMicroCode} <> 0)
  GENERATE, COST=(LW.DISTANCE),EXTRACTCOST=(LI.WALKTIME),MAXCOST=200*{WALKACC},LIST=T,INCLUDELINK=(LI.FACILITY_TYPE=59),
             NTLEGMODE=11,MAXNTLEGS=200*{MAXWLKACCLNKS},DIRECTION=3,ONEWAY=F,FROMNODE={NODEMIN}-99999,TONODE={NODEMIN}-99999
  endif

  ; 12 - Generate CBD sidewalk connectors
   READ, FILE = "{SCENARIO_DIR}\OUTPUT\\CBDXFER_TMP.DAT"

ENDPROCESS

ENDRUN


; Script for program MATRIX in file "D:\JOB\D3\Model\A\APPLICATIONS\TPMAT00C.S"
; 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\TPMAT00N.PRN" MSG='Subdivide connectors into separate files by mode'
FILEO PRINTO[6] = "{SCENARIO_DIR}\output\NTLEG4OP_{alt}{year}.NTL"
FILEO PRINTO[4] = "{SCENARIO_DIR}\output\NTLEG11OP_{alt}{year}.NTL"
FILEI RECI = "{SCENARIO_DIR}\output\NTLEGOP_{year}{alt}.TEM"
FILEO PRINTO[5] = "{SCENARIO_DIR}\output\NTLEG12OP_{alt}{year}.NTL"
FILEO PRINTO[1] = "{SCENARIO_DIR}\output\NTLEG1OP_{alt}{year}.NTL"

s1=strpos('NT',reci)
s2=strpos('LEG',reci)
s3=strpos('MODE',reci)
s4=strpos('COST',reci)
s5=strpos('DIST',reci)
s6=strpos('ONEWAY',reci)
s7=strpos('XN',reci)

; get the origin and destination zone
s8=(s3-s2)
leg1=substr(reci,s2,s8)
s9=strpos('=',leg1)
s10=strpos('-',leg1)
s11=(s9+1)
s12=(s10-1)
s13=(s10+1)
zonei=val(substr(leg1,s11,s12))
zonej=val(substr(leg1,s13,strlen(leg1)))

; get the mode number
s14=(s4-s3)
mode1=substr(reci,s3,s14)
s15=strpos('=',mode1)
s16=(s15+1)
mode=val(substr(mode1,s16,strlen(mode1)))

; get the time on the connector (cost field in the NT leg file)
s17=(s5-s4)
time1=substr(reci,s4,s17)
s18=strpos('=',time1)
s19=(s18+1)
time=val(substr(time1,s19,strlen(time1)))

; get the distance
s20=(s6-s5)
dist1=substr(reci,s5,s20)
s21=strpos('=',dist1)
s22=(s21+1)
dist=val(substr(dist1,s22,strlen(dist1)))

; get the rest of the string
s23=substr(reci,s6,strlen(reci))

if (i==1 && _ctr==0)
  PRINT LIST=";;<<PT>>;;", PRINTO=1
  PRINT LIST=";;<<PT>>;;", PRINTO=4
  PRINT LIST=";;<<PT>>;;", PRINTO=5
  PRINT LIST=";;<<PT>>;;", PRINTO=6
  _ctr = _ctr + 1
endif
if (mode=1) PRINT LIST="NT LEG=",zonei(5.0),"-",zonej(5.0)," MODE=",mode(2.0)," COST=",time(6.2)," DIST=",dist(5.2)," ",s23,PRINTO=1
if (mode=4) PRINT LIST="NT LEG=",zonei(5.0),"-",zonej(5.0)," MODE=",mode(2.0)," COST=",time(6.2)," DIST=",dist(5.2)," ",s23,PRINTO=6
if (mode=11) PRINT LIST="NT LEG=",zonei(5.0),"-",zonej(5.0)," MODE=",mode(2.0)," COST=",time(6.2)," DIST=",dist(5.2)," ",s23,PRINTO=4
if (mode=12) PRINT LIST="NT LEG=",zonei(5.0),"-",zonej(5.0)," MODE=",mode(2.0)," COST=",time(6.2)," DIST=",dist(5.2)," ",s23,PRINTO=5


ENDRUN


; PILOT Script
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.

*if exist {SCENARIO_DIR}\output\AUTOCON.OUT del {SCENARIO_DIR}\output\AUTOCON.OUT
*if exist {SCENARIO_DIR}\output\AUTOCONPK.OUT del {SCENARIO_DIR}\output\AUTOCONPK.OUT
*if exist {SCENARIO_DIR}\output\AUTOCONOP.OUT del {SCENARIO_DIR}\output\AUTOCONOP.OUT

*AUTOCON.exe AM
*copy {SCENARIO_DIR}\output\AUTOCON.OUT {SCENARIO_DIR}\output\AUTOCONPK.OUT
;*AUTOCON.exe MD
;*if exist {SCENARIO_DIR}\output\AUTOCON.OUT copy {SCENARIO_DIR}\output\AUTOCON.OUT {SCENARIO_DIR}\output\AUTOCONOP.OUT
;*if exist {SCENARIO_DIR}\output\AUTOCON.OUT del {SCENARIO_DIR}\output\AUTOCON.OUT
; End of PILOT Script

; PILOT Script
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.

*if exist {SCENARIO_DIR}\output\AUTOCON.OUT del {SCENARIO_DIR}\output\AUTOCON.OUT
;*if exist {SCENARIO_DIR}\output\AUTOCONPK.OUT del {SCENARIO_DIR}\output\AUTOCONPK.OUT
;*if exist {SCENARIO_DIR}\output\AUTOCONOP.OUT del {SCENARIO_DIR}\output\AUTOCONOP.OUT
*AUTOCON.exe MD
*copy {scenario_dir}\output\autocon.out {scenario_dir}\output\AUTOCONOP.out
; End of PILOT Script

; PILOT Script

DistributeMultiStep ProcessID="FSUTMSdist" ProcessNum=1

; End of PILOT Script

; Script for program PUBLIC TRANSPORT in file "D:\JOB\D3\Model\A\APPLICATIONS\TRPTR00A.S"
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=PUBLIC TRANSPORT PRNFILE="D:\JOB\D3\Model\A\APPLICATIONS\TRPTR00A.PRN" MSG='Walk-Access Paths/Skims - peak'
FILEI NTLEGI[2] = "{Scenario_Dir}\Output\NTLEG2PK_{ALT}{Year}.NTL"
FILEI NETI = "{SCENARIO_DIR}\output\HWYLOAD2_{Alt}{Year}.NET"
FILEI NTLEGI[4] = "{SCENARIO_DIR}\output\NTLEG12PK_{alt}{year}.NTL"
FILEI NTLEGI[3] = "{SCENARIO_DIR}\output\NTLEG11PK_{alt}{year}.NTL"
FILEI NTLEGI[1] = "{SCENARIO_DIR}\output\NTLEG1PK_{alt}{year}.NTL"
FILEO MATO[1] = "{SCENARIO_DIR}\output\TSKIMAM1_{alt}{year}.MAT",
  MO=1-15, NAME=WALKTIME,AutoTIME,SidewalkTIME,BUSTIME,PBUSTIME,CIRCTIME,RAILTIME,COMRLTIME,OTHTIME,PRJTIME,XFER,IWAIT,XWAIT,FARE,TOTTIME
FILEO LINEO = "{SCENARIO_DIR}\output\pkwalk.lin"
FILEO NTLEGO = "{SCENARIO_DIR}\output\pkwalk.ntl"
FILEO ROUTEO[1] = "{SCENARIO_DIR}\output\TPATHAM1_{alt}{year}.RTE",
  REPORTI={FromNode}, REPORTJ={ToNode}, TRACEI={FromNode}, TRACEJ={ToNode}
FILEO REPORTO = "{SCENARIO_DIR}\output\pkwalk.rpt"
FILEO NETO = "{SCENARIO_DIR}\output\PKWalk.NET"
FILEI FACTORI[1] = "{SCENARIO_DIR}\output\WalkTransit.FAC"
FILEI FAREI = "{Scenario_Dir}\Input\TFARES_{Year}{ALT}.FAR"
FILEI SYSTEMI = "{CATALOG_DIR}\parameters\TSYSD.PTS"
FILEI LINEI[1] = "{SCENARIO_DIR}\INPUT\TROUTE_{YEAR}{ALT}.LIN"

;**************************************************************
;BEGIN POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************
;PAR ZONE={ZONESA}
; OVERALL PARAMETERS
PARAMETERS USERCLASSES=1,FARE=N, MAPSCALE={Units}, HDWAYPERIOD=1,
           NOROUTEERRS=999999, NOROUTEMSGS=999999,
           TRANTIME=LW.TRANTIME,
           TRANTIME[21]=LI.M21TIMEPK,
           ;TRANTIME[22]=LI.M22TIMEPK,
           ;TRANTIME[23]=LI.M23TIMEPK,
           ;TRANTIME[24]=LI.M24TIMEPK,
           ;TRANTIME[25]=LI.M25TIMEPK
           ;TRANTIME[26]=LI.M26TIMEPK,
           TRANTIME[27]=LI.M27TIMEPK
           ;TRANTIME[31]=LI.M31TIMEPK,
           ;TRANTIME[32]=LI.M32TIMEPK,
           ;TRANTIME[33]=LI.M33TIMEPK,
           ;TRANTIME[34]=LI.M34TIMEPK,
           ;TRANTIME[35]=LI.M35TIMEPK
           ;TRANTIME[36]=LI.M36TIMEPK,
           ;TRANTIME[37]=LI.M37TIMEPK

;**************************************************************
;END POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

PROCESS PHASE=LINKREAD
           LW.TRANTIME=LI.M21TIMEPK
           LW.WALKTIME=LI.WALKTIME
           LW.WALKDISTANCE=LI.DISTANCE
           LW.DISTANCE=LI.DISTANCE
ENDPROCESS

PROCESS PHASE=DATAPREP

          ; Generate walk-access links
          GENERATE READNTLEGI=1
          ; Generate station-access links
          READ, FILE = "{SCENARIO_DIR}\OUTPUT\STATIONCONN_{ALT}{YEAR}.DAT"
          ; Generate auto-access links
          GENERATE READNTLEGI=2
          IF({isMicroCode} <> 0)
            ; Generate fixed-guideway to bus links
            GENERATE READNTLEGI=3
          ENDIF
          ; Generate CBD transfer links
          GENERATE READNTLEGI=4
ENDPROCESS
;**************************************************************
;BEGIN POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

PROCESS PHASE=SKIMIJ
  MW[1]=TIMEA(0,1)                                   ; Walk time
  MW[2]=TIMEA(0,2)                                   ; Auto time
  MW[3]=TIMEA(0,11)+TIMEA(0,12)                      ; Sidewalk time
  MW[4]=TIMEA(0,21)+TIMEA(0,31)                      ; Local bus time
  MW[5]=TIMEA(0,22)+TIMEA(0,32)                      ; Premium bus time
  MW[6]=TIMEA(0,23)+TIMEA(0,33)                      ; Circulator time
  MW[7]=TIMEA(0,24)+TIMEA(0,34)                      ; Light/Heavy Rail time
  MW[8]=TIMEA(0,25)+TIMEA(0,35)                      ; Commuter Rail time
  MW[9]=TIMEA(0,26)+TIMEA(0,36)                      ; Other mode time
  MW[10]=TIMEA(0,27)+TIMEA(0,37)                     ; Project mode time
 IF (BRDINGS(0,TMODES) > 0)
   MW[11]=BRDINGS(0,TMODES)-1                        ; Number of transfers
 ELSE
   MW[11]=0
 ENDIF
  MW[12]=IWAITA(0)                                    ; Initial wait time
  MW[13]=XWAITA(0)                                     ; Transfer wait time
  MW[14]=FAREA(0)                                    ; Fare matrix
  MW[15]=TIMEA(0,ALLMODES)                            ; Time on all modes
ENDPROCESS

;**************************************************************
;END POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

ENDRUN


; PILOT Script

EndDistributeMultiStep

DistributeMultiStep ProcessID="FSUTMSdist" ProcessNum=2
; End of PILOT Script

; Script for program PUBLIC TRANSPORT in file "D:\JOB\D3\Model\A\APPLICATIONS\TRPTR00B.S"

; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=PUBLIC TRANSPORT PRNFILE="D:\JOB\D3\Model\A\APPLICATIONS\TRPTR00D.PRN" MSG='Auto-Access Paths/Skims - peak'
FILEI NTLEGI[2] = "{Scenario_Dir}\Output\NTLEG2PK_{ALT}{Year}.NTL"
FILEI NETI = "{SCENARIO_DIR}\output\HWYLOAD2_{Alt}{Year}.NET"
FILEI NTLEGI[3] = "{SCENARIO_DIR}\output\NTLEG11PK_{alt}{year}.NTL"
FILEI NTLEGI[4] = "{SCENARIO_DIR}\output\NTLEG12PK_{alt}{year}.NTL"
FILEI NTLEGI[1] = "{SCENARIO_DIR}\output\NTLEG1PK_{alt}{year}.NTL"
FILEO MATO[1] = "{SCENARIO_DIR}\output\TSKIMAM3_{alt}{year}.MAT",
  MO=1-15, NAME=WALKTIME,AutoTIME,SidewalkTIME,BUSTIME,PBUSTIME,CIRCTIME,RAILTIME,COMRLTIME,OTHTIME,PRJTIME,XFER,IWAIT,XWAIT,FARE,TOTTIME
FILEO LINEO = "{SCENARIO_DIR}\output\pkwalk.lin"
FILEO NTLEGO = "{SCENARIO_DIR}\output\pkauto.ntl"
FILEO ROUTEO[1] = "{SCENARIO_DIR}\output\TPATHAM3_{alt}{year}.RTE",
  REPORTI={FromNode}, REPORTJ={ToNode}, TRACEI={FromNode}, TRACEJ={ToNode}
FILEO REPORTO = "{SCENARIO_DIR}\output\pkauto.rpt"
FILEO NETO = "{SCENARIO_DIR}\output\PKAuto.NET"
FILEI FACTORI[1] = "{SCENARIO_DIR}\output\AutoTransit.FAC"
FILEI FAREI = "{Scenario_Dir}\Input\TFARES_{Year}{ALT}.FAR"
FILEI SYSTEMI = "{CATALOG_DIR}\parameters\TSYSD.PTS"
FILEI LINEI[1] = "{SCENARIO_DIR}\INPUT\TROUTE_{YEAR}{ALT}.LIN"

;**************************************************************
;BEGIN POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

; OVERALL PARAMETERS
PARAMETERS USERCLASSES=1,FARE=N, MAPSCALE={Units}, HDWAYPERIOD=1,
           NOROUTEERRS=999999, NOROUTEMSGS=999999,
           TRANTIME=LW.TRANTIME,
           TRANTIME[21]=LI.M21TIMEPK,
         ;  TRANTIME[22]=LI.M22TIMEPK,
         ;  TRANTIME[23]=LI.M23TIMEPK,
         ;  TRANTIME[24]=LI.M24TIMEPK,
         ;  TRANTIME[25]=LI.M25TIMEPK
         ;  TRANTIME[26]=LI.M26TIMEPK,
           TRANTIME[27]=LI.M27TIMEPK
         ;  TRANTIME[31]=LI.M31TIMEPK,
         ;  TRANTIME[32]=LI.M32TIMEPK,
         ;  TRANTIME[33]=LI.M33TIMEPK,
         ;  TRANTIME[34]=LI.M34TIMEPK,
         ;  TRANTIME[35]=LI.M35TIMEPK
         ;  TRANTIME[36]=LI.M36TIMEPK,
         ;  TRANTIME[37]=LI.M37TIMEPK

;**************************************************************
;END POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

PROCESS PHASE=LINKREAD
           LW.TRANTIME=LI.M21TIMEPK
           LW.WALKTIME=LI.WALKTIME
           LW.WALKDISTANCE=LI.DISTANCE
           LW.DISTANCE=LI.DISTANCE
ENDPROCESS

PROCESS PHASE=DATAPREP

           ; Generate walk-access links
           GENERATE READNTLEGI=1
           ; Generate station-access links
           READ, FILE = "{SCENARIO_DIR}\OUTPUT\STATIONCONN_{ALT}{YEAR}.DAT"
           ; Generate auto-access links
           GENERATE READNTLEGI=2
        IF({isMicroCode} <> 0)
           ; Generate fixed-guideway to bus links
           GENERATE READNTLEGI=3
        ENDIF
           ; Generate CBD transfer links
           GENERATE READNTLEGI=4
ENDPROCESS
;**************************************************************
;BEGIN POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

PROCESS PHASE=SKIMIJ
  MW[1]=TIMEA(0,1)                                                              ; Walk time
  MW[2]=TIMEA(0,2)                                                              ; Auto time
  MW[3]=TIMEA(0,11)+TIMEA(0,12)                                                 ; Sidewalk time
  MW[4]=TIMEA(0,21)+TIMEA(0,31)                                                              ; Local bus time
  MW[5]=TIMEA(0,22)+TIMEA(0,32)                                                             ; Premium bus time
  MW[6]=TIMEA(0,23)+TIMEA(0,33)                                                              ; Circulator time
  MW[7]=TIMEA(0,24)+TIMEA(0,34)                                                             ; Light/Heavy Rail time
  MW[8]=TIMEA(0,25)+TIMEA(0,35)                                                             ; Commuter Rail time
  MW[9]=TIMEA(0,26)+TIMEA(0,36)                                                              ; Other mode time
  MW[10]=TIMEA(0,27)+TIMEA(0,37)                                                            ; Project mode time
 IF(BRDINGS(0,TMODES) > 0)
   MW[11]=BRDINGS(0,TMODES)-1                                                   ; Number of transfers
 ELSE
   MW[11]=0
 ENDIF
  MW[12]=IWAITA(0)                                                              ; Initial wait time
  MW[13]=XWAITA(0)                                                              ; Transfer wait time
  MW[14]=FAREA(0)                                                               ; Fare matrix
  MW[15]=TIMEA(0,ALLMODES)                                                      ; Time on all modes
ENDPROCESS

;**************************************************************
;END POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

ENDRUN


; PILOT Script
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.

EndDistributeMultiStep

DistributeMultiStep ProcessID="FSUTMSdist" ProcessNum=3
; End of PILOT Script

; Script for program PUBLIC TRANSPORT in file "D:\JOB\D3\Model\A\APPLICATIONS\TRPTR00C.S"

; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=PUBLIC TRANSPORT PRNFILE="D:\JOB\D3\Model\A\APPLICATIONS\TRPTR00E.PRN" MSG='Walk-Access Paths/Skims - off-peak'
FILEI NTLEGI[2] = "{Scenario_Dir}\Output\NTLEG2OP_{ALT}{Year}.NTL"
FILEI NTLEGI[1] = "{SCENARIO_DIR}\output\NTLEG1OP_{alt}{year}.NTL"
FILEI NETI = "{SCENARIO_DIR}\output\unloaded2_{alt}{year}.net"
FILEI NTLEGI[4] = "{SCENARIO_DIR}\output\NTLEG12OP_{alt}{year}.NTL"
FILEI NTLEGI[3] = "{SCENARIO_DIR}\output\NTLEG11OP_{alt}{year}.NTL"
FILEO MATO[1] = "{SCENARIO_DIR}\output\TSKIMMD1_{alt}{year}.MAT",
  MO=1-15, NAME=WALKTIME,AutoTIME,SidewalkTIME,BUSTIME,PBUSTIME,CIRCTIME,RAILTIME,COMRLTIME,OTHTIME,PRJTIME,XFER,IWAIT,XWAIT,FARE,TOTTIME
FILEO LINEO = "{SCENARIO_DIR}\output\opwalk.lin"
FILEO NTLEGO = "{SCENARIO_DIR}\output\opwalk.ntl"
FILEO ROUTEO[1] = "{SCENARIO_DIR}\output\TPATHMD1_{alt}{year}.RTE",
  REPORTI={FromNode}, REPORTJ={ToNode}, TRACEI={FromNode}, TRACEJ={ToNode}
FILEO REPORTO = "{SCENARIO_DIR}\output\opwalk.rpt"
FILEO NETO = "{SCENARIO_DIR}\output\OPWalk.NET"
FILEI FACTORI[1] = "{SCENARIO_DIR}\output\WalkTransit.FAC"
FILEI FAREI = "{SCENARIO_DIR}\\Input\TFARES_{Year}{ALT}.FAR"
FILEI SYSTEMI = "{CATALOG_DIR}\parameters\TSYSD.PTS"
FILEI LINEI[1] = "{SCENARIO_DIR}\INPUT\TROUTE_{YEAR}{ALT}.LIN"

;**************************************************************
;BEGIN POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

; OVERALL PARAMETERS
PARAMETERS USERCLASSES=1,FARE=N, MAPSCALE={Units}, HDWAYPERIOD=2,
           NOROUTEERRS=999999, NOROUTEMSGS=999999,
           TRANTIME=LW.TRANTIME,
           TRANTIME[21]=LI.M21TIMEOP,
           ;TRANTIME[22]=LI.M22TIMEOP,
           ;TRANTIME[23]=LI.M23TIMEOP,
           ;TRANTIME[24]=LI.M24TIMEOP,
           ;TRANTIME[25]=LI.M25TIMEOP
           ;TRANTIME[26]=LI.M26TIMEOP,
           TRANTIME[27]=LI.M27TIMEOP
          ; TRANTIME[31]=LI.M31TIMEOP,
          ; TRANTIME[32]=LI.M32TIMEOP,
          ; TRANTIME[33]=LI.M33TIMEOP,
          ; TRANTIME[34]=LI.M34TIMEOP,
          ; TRANTIME[35]=LI.M35TIMEOP
          ; TRANTIME[36]=LI.M36TIMEOP,
          ; TRANTIME[37]=LI.M37TIMEOP
;**************************************************************
;END POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

PROCESS PHASE=LINKREAD
           LW.TRANTIME=LI.M21TIMEOP
           LW.WALKTIME=LI.WALKTIME
           LW.WALKDISTANCE=LI.DISTANCE
           LW.DISTANCE=LI.DISTANCE
ENDPROCESS

PROCESS PHASE=DATAPREP

           ; Generate walk-access links
           GENERATE READNTLEGI=1
           ; Generate station-access links
           READ, FILE = "{SCENARIO_DIR}\OUTPUT\STATIONCONN_{ALT}{YEAR}.DAT"
           ; Generate auto-access links
          GENERATE READNTLEGI=2
        IF({isMicroCode} <> 0)
           ; Generate fixed-guideway to bus links
           GENERATE READNTLEGI=3
        ENDIF
           ; Generate CBD transfer links
           GENERATE READNTLEGI=4

ENDPROCESS
;**************************************************************
;BEGIN POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

PROCESS PHASE=SKIMIJ
  MW[1]=TIMEA(0,1)                                                              ; Walk time
  MW[2]=TIMEA(0,2)                                                              ; Auto time
  MW[3]=TIMEA(0,11)+TIMEA(0,12)                                                 ; Sidewalk time
  MW[4]=TIMEA(0,21)+TIMEA(0,31)                                                               ; Local bus time
  MW[5]=TIMEA(0,22)+TIMEA(0,32)                                                             ; Premium bus time
  MW[6]=TIMEA(0,23)+TIMEA(0,33)                                                               ; Circulator time
  MW[7]=TIMEA(0,24)+TIMEA(0,34)                                                               ; Light/Heavy Rail time
  MW[8]=TIMEA(0,25)+TIMEA(0,35)                                                               ; Commuter Rail time
  MW[9]=TIMEA(0,26)+TIMEA(0,36)                                                             ; Other mode time
  MW[10]=TIMEA(0,27)+TIMEA(0,37)                                                              ; Project mode time
 IF (BRDINGS(0,TMODES) > 0)
   MW[11]=BRDINGS(0,TMODES)-1                                                   ; Number of transfers
 ELSE
   MW[11]=0
 ENDIF
  MW[12]=IWAITA(0)                                                              ; Initial wait time
  MW[13]=XWAITA(0)                                                              ; Transfer wait time
  MW[14]=FAREA(0)                                                               ; Fare matrix
  MW[15]=TIMEA(0,ALLMODES)                                                      ; Time on all modes
ENDPROCESS

;**************************************************************
;END POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

ENDRUN


; Script for program PUBLIC TRANSPORT in file "D:\JOB\D3\Model\A\APPLICATIONS\TRPTR00D.S"
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=PUBLIC TRANSPORT PRNFILE="D:\JOB\D3\Model\A\APPLICATIONS\TRPTR00G.PRN" MSG='Auto-Access Paths/Skims - off-peak'
FILEI NTLEGI[2] = "{Scenario_Dir}\Output\NTLEG2OP_{ALT}{Year}.NTL"
FILEI NTLEGI[1] = "{SCENARIO_DIR}\output\NTLEG1OP_{alt}{year}.NTL"
FILEI NETI = "{SCENARIO_DIR}\output\unloaded2_{alt}{year}.net"
FILEI NTLEGI[4] = "{SCENARIO_DIR}\output\NTLEG12OP_{alt}{year}.NTL"
FILEI NTLEGI[3] = "{SCENARIO_DIR}\output\NTLEG11OP_{alt}{year}.NTL"
FILEO MATO[1] = "{SCENARIO_DIR}\output\TSKIMMD3_{alt}{year}.MAT",
  MO=1-15, NAME=WALKTIME,AutoTIME,SidewalkTIME,BUSTIME,PBUSTIME,CIRCTIME,RAILTIME,COMRLTIME,OTHTIME,PRJTIME,XFER,IWAIT,XWAIT,FARE,TOTTIME
FILEO LINEO = "{SCENARIO_DIR}\output\OPAuto.lin"
FILEO NTLEGO = "{SCENARIO_DIR}\output\OPAuto.ntl"
FILEO ROUTEO[1] = "{SCENARIO_DIR}\output\TPATHMD3_{alt}{year}.RTE",
  REPORTI={FromNode}, REPORTJ={ToNode}, TRACEI={FromNode}, TRACEJ={ToNode}
FILEO REPORTO = "{SCENARIO_DIR}\output\OPAuto.rpt"
FILEO NETO = "{SCENARIO_DIR}\output\OPAuto.NET"
FILEI FACTORI[1] = "{SCENARIO_DIR}\output\AutoTransit.FAC"
FILEI FAREI = "{Scenario_Dir}\Input\TFARES_{Year}{ALT}.FAR"
FILEI SYSTEMI = "{CATALOG_DIR}\parameters\TSYSD.PTS"
FILEI LINEI[1] = "{SCENARIO_DIR}\INPUT\TROUTE_{YEAR}{ALT}.LIN"

;**************************************************************
;BEGIN POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

; OVERALL PARAMETERS
PARAMETERS USERCLASSES=1,FARE=N, MAPSCALE={Units}, HDWAYPERIOD=2,
           NOROUTEERRS=999999, NOROUTEMSGS=999999,
           TRANTIME=LW.TRANTIME,
           TRANTIME[21]=LI.M21TIMEOP,
        ;   TRANTIME[22]=LI.M22TIMEOP,
        ;   TRANTIME[23]=LI.M23TIMEOP,
        ;   TRANTIME[24]=LI.M24TIMEOP,
        ;   TRANTIME[25]=LI.M25TIMEOP
        ;   TRANTIME[26]=LI.M26TIMEOP,
           TRANTIME[27]=LI.M27TIMEOP
        ;   TRANTIME[31]=LI.M31TIMEOP,
         ;  TRANTIME[32]=LI.M32TIMEOP,
         ;  TRANTIME[33]=LI.M33TIMEOP,
         ;  TRANTIME[34]=LI.M34TIMEOP,
         ;  TRANTIME[35]=LI.M35TIMEOP
         ;  TRANTIME[36]=LI.M36TIMEOP,
         ;  TRANTIME[37]=LI.M37TIMEOP

;**************************************************************
;END POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

PROCESS PHASE=LINKREAD
           LW.TRANTIME=LI.M21TIMEOP
           LW.WALKTIME=LI.WALKTIME
           LW.WALKDISTANCE=LI.DISTANCE
           LW.DISTANCE=LI.DISTANCE
ENDPROCESS

PROCESS PHASE=DATAPREP

           ; Generate walk-access links
           GENERATE READNTLEGI=1
           ; Generate station-access links
           READ, FILE = "{SCENARIO_DIR}\OUTPUT\STATIONCONN_{ALT}{YEAR}.DAT"
           ; Generate auto-access links
           GENERATE READNTLEGI=2
           IF({isMicroCode} <> 0)
             ; Generate fixed-guideway to bus links
             GENERATE READNTLEGI=3
           ENDIF
           ; Generate CBD transfer links
           GENERATE READNTLEGI=4

ENDPROCESS
;**************************************************************
;BEGIN POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

PROCESS PHASE=SKIMIJ
  MW[1]=TIMEA(0,1)                                                              ; Walk time
  MW[2]=TIMEA(0,2)                                                              ; Auto time
  MW[3]=TIMEA(0,11)+TIMEA(0,12)                                                 ; Sidewalk time
  MW[4]=TIMEA(0,21)+TIMEA(0,31)                                                               ; Local bus time
  MW[5]=TIMEA(0,22)+TIMEA(0,32)                                                                ; Premium bus time
  MW[6]=TIMEA(0,23)+TIMEA(0,33)                                                                ; Circulator time
  MW[7]=TIMEA(0,24)+TIMEA(0,34)                                                               ; Light/Heavy Rail time
  MW[8]=TIMEA(0,25)+TIMEA(0,35)                                                                ; Commuter Rail time
  MW[9]=TIMEA(0,26)+TIMEA(0,36)                                                                ; Other mode time
  MW[10]=TIMEA(0,27)+TIMEA(0,37)                                                              ; Project mode time
 IF (BRDINGS(0,TMODES) > 0)
   MW[11]=BRDINGS(0,TMODES)-1                                                   ; Number of transfers
 ELSE
   MW[11]=0
 ENDIF
  MW[12]=IWAITA(0)                                                              ; Initial wait time
  MW[13]=XWAITA(0)                                                              ; Transfer wait time
  MW[14]=FAREA(0)                                                               ; Fare matrix
  MW[15]=TIMEA(0,ALLMODES)                                                      ; Time on all modes
ENDPROCESS



;**************************************************************
;END POTENTIAL SCRIPT ADJUSTMENT
;**************************************************************

ENDRUN


; PILOT Script
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.

EndDistributeMultiStep

DistributeMultiStep ProcessID="FSUTMSdist" ProcessNum=4
; End of PILOT Script

; Script for program PUBLIC TRANSPORT in file "D:\JOB\D3\Model\A\APPLICATIONS\TRPTR00E.S"
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=PUBLIC TRANSPORT PRNFILE="D:\JOB\D3\Model\A\APPLICATIONS\TRPTR00I.PRN" MSG='All-walk paths'
FILEI NETI = "{SCENARIO_DIR}\output\unloaded2_{alt}{year}.net"
FILEI NTLEGI[1] = "{SCENARIO_DIR}\output\NTLEG4PK_{alt}{year}.NTL"
FILEO MATO[1] = "{SCENARIO_DIR}\output\AllWalk_{alt}{year}.MAT",
  MO=1, DEC=D,NAME=ALLWALK
FILEO ROUTEO[1] = "{SCENARIO_DIR}\output\AllWalk_{alt}{year}.RTE",
  REPORTI={FromNode}, REPORTJ={ToNode}, TRACEI={FromNode}, TRACEJ={ToNode}
FILEO REPORTO = "{SCENARIO_DIR}\output\AllWalk.rpt"
FILEO NETO = "{SCENARIO_DIR}\output\AllWalk.net"
FILEI FACTORI[1] = "{CATALOG_DIR}\parameters\AllWalk.FAC"
FILEI FAREI = "{Scenario_Dir}\Input\TFARES_{Year}{ALT}.FAR"
FILEI SYSTEMI = "{CATALOG_DIR}\parameters\TSYSD.PTS"
FILEI LINEI[1] = "{SCENARIO_DIR}\INPUT\TROUTE_{YEAR}{ALT}.LIN"

; OVERALL PARAMETERS OF RUN
PARAMETERS USERCLASSES=1,FARE=N, MAPSCALE={UNITS}, HDWAYPERIOD=2,
           NOROUTEERRS=999999, NOROUTEMSGS=999999, 
           TRANTIME=LW.TRANTIME

PROCESS PHASE=LINKREAD
           LW.TRANTIME=LI.M21TIMEOP
           LW.DISTANCE=LI.DISTANCE
ENDPROCESS

PROCESS PHASE=DATAPREP
           ; Generate all-walk links
           GENERATE READNTLEGI=1
ENDPROCESS

PROCESS PHASE=SKIMIJ
           MW[1]=TIMEA(0,4)                                         ; All Walk time
ENDPROCESS

ENDRUN


; PILOT Script
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.

EndDistributeMultiStep

Wait4Files Files=FSUTMSdist1.script.end, FSUTMSdist2.script.end, FSUTMSdist3.script.end, FSUTMSdist4.script.end, PrintFiles=SAVE
; End of PILOT Script

; Script for program MATRIX in file "D:\JOB\D3\Model\A\APPLICATIONS\TRMAT00D.S"
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=MATRIX PRNFILE="D:\JOB\D3\Model\A\APPLICATIONS\TRMAT00C.PRN" MSG='Path-Conditioning Walk'
FILEO MATO[3] = "{SCENARIO_DIR}\output\TSKIMOP1.{alt}{year}",
 MO=61-75,  NAME=WalkTime,AutoTime,SideWalkTime,BusTime,PBusTime,CircTime,RailTime,CommRailTime,OthTime,PRJTime,XFERs,IWAIT,XWAIT,FARE,TOTTIME
FILEO MATO[1] = "{SCENARIO_DIR}\output\TSKIMPK1.{alt}{year}",
MO=21-35, NAME=WalkTime,AutoTime,SideWalkTime,BusTime,PBusTime,CircTime,RailTime,CommRailTime,OthTime,PRJTime,XFERs,IWAIT,XWAIT,FARE,TOTTIME
FILEI MATI[4] = "{SCENARIO_DIR}\output\TSKIMMD1_{alt}{year}.MAT"
FILEI MATI[2] = "{SCENARIO_DIR}\output\TSKIMAM1_{alt}{year}.MAT"
FILEI MATI[1] = "{SCENARIO_DIR}\output\AllWalk_{alt}{year}.MAT"
FILEI LOOKUPI[1] = "{CATALOG_DIR}\parameters\TRN_COEFFICIENTS.DBF"

; Check skims to see if they are better than the all-walk path & if they have required IVT

DistributeINTRAStep ProcessID="FSUTMSDist" ProcessList=1-4

ZONEMSG=100

LOOKUP NAME=COEFF, LOOKUP[1]=1, RESULT=3,
FAIL=0,0,0,LIST=Y,INTERPOLATE=N,LOOKUPI=1

_ovtam =COEFF(1,3)/COEFF(1,1)     ; out-of-vehicle time factor (OVT time and Wait factor)
valtime   =0.6*COEFF(1,1)/COEFF(1,4) ; value of time (in $/hr)
aatfactor =COEFF(1,5)/COEFF(1,1)     ; drive access to transit time factor
_xferpen=COEFF(1,6)/COEFF(1,1)     ; transfer penalty
_boardingpen = 2.0

; Apply OVT factor to all-walk skims

FILLMW MW[11]=MI.1.1
FILLMW MW[21]=MI.2.1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
FILLMW MW[61]=MI.4.1,2,3,4,5,6,7,8,9,10,11,12,13,14,15


LOOP x=1,6
  LOOP y=1,15
    _idx=20 + 20*(x-1) + y
    if ((_idx%20)=14)
      COMP total = ROWFAC(_idx,100.0)
    endif
  ENDLOOP
ENDLOOP

; Apply OVT factor to all-walk skims
COMP total = ROWFAC(11,_ovtam)

JLOOP

  IF (I=={FromNode} && J=={ToNode}) LIST="Trace ",I(5.0),"-",J(5.0)
  IF (I=={FromNode} && J=={ToNode}) LIST="            ","       IVT","      Path","      wOVT","      wTOT"
  IF (I=={FromNode} && J=={ToNode}) LIST="All-Walk    ","          ","          ",MW[11](10.2),MW[11](10.2)

; Check skims to see if they are better than the all-walk path & if they have required IVT
  ; Walk-bus - peak (20 series)
    _ivt = MW[24] + MW[25] + MW[26] + MW[27] + MW[28] + MW[29] + MW[30]
    _pth = MW[24] + MW[26]
    _ovt = MW[22] + _ovtam * (MW[21] + MW[23] + MW[32] + MW[33]) + _boardingpen*(mw[31]+1) + _xferpen * MW[31]
    _tot = _ivt + _ovt
  IF (I=={FromNode} && J=={ToNode}) LIST="Walk-Bus  pk",_ivt(10.2),_pth(10.2),_ovt(10.2),_tot(10.2)
  IF (((MW[11]>0) && (MW[11]<_tot))||(_ivt==0))
    MW[21]=0, MW[22]=0, MW[23]=0, MW[24]=0, MW[25]=0
    MW[26]=0, MW[27]=0, MW[28]=0, MW[29]=0, MW[30]=0
    MW[31]=0,  MW[32]=0, MW[33]=0, MW[34]=0, MW[35]=0
  ENDIF
  
    ; Walk-bus - off-peak (60 series)
    _ivt = MW[64] + MW[65] + MW[66] + MW[67] + MW[68] + MW[69] + MW[70]
    _pth = MW[64] + MW[66]
    _ovt = MW[62] + _ovtam * (MW[61] + MW[63] + MW[72] + MW[73])  + _boardingpen*(mw[71]+1) + _xferpen * MW[71]
    _tot = _ivt + _ovt
  IF (I=={FromNode} && J=={ToNode}) LIST="Walk-Bus  op",_ivt(10.2),_pth(10.2),_ovt(10.2),_tot(10.2)
  IF (((MW[11]>0) && (MW[11]<_tot)) || (_ivt==0))
    MW[61]=0, MW[62]=0, MW[63]=0, MW[64]=0, MW[65]=0
    MW[66]=0, MW[67]=0, MW[68]=0, MW[69]=0, MW[70]=0
    MW[71]=0,MW[72]=0, MW[73]=0, MW[74]=0, MW[75]=0
  ENDIF
   
ENDJLOOP
ENDRUN


; Script for program MATRIX in file "D:\JOB\D3\Model\A\APPLICATIONS\TRMAT00G.S"
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=MATRIX PRNFILE="D:\JOB\D3\Model\A\APPLICATIONS\TRMAT00F.PRN" MSG='Path-Conditioning Auto'
FILEO MATO[2] = "{SCENARIO_DIR}\output\TSKIMOP3.{alt}{year}",
MO=61-75
FILEO MATO[1] = "{SCENARIO_DIR}\output\TSKIMPK3.{alt}{year}",
MO=21-35
FILEI LOOKUPI[1] = "{CATALOG_DIR}\parameters\TRN_COEFFICIENTS.DBF"
FILEI MATI[2] = "{SCENARIO_DIR}\output\TSKIMMD3_{alt}{year}.MAT"
FILEI MATI[1] = "{SCENARIO_DIR}\output\TSKIMAM3_{alt}{year}.MAT"
DistributeINTRAStep ProcessID="FSUTMSDist" ProcessList=1-4

 ZONEMSG=100

 ; Check skims to see if they have required IVT

 LOOKUP NAME=COEFF,
     LOOKUP[1]=1,
     RESULT=3,
     FAIL=0,0,0,
     LIST=Y,
     INTERPOLATE=N,
     LOOKUPI=1

 _ovtam =COEFF(1,3)/COEFF(1,1)     ; out-of-vehicle time factor (OVT time and Wait factor)
 valtime   =0.6*COEFF(1,1)/COEFF(1,4) ; value of time (in $/hr)
 aatfactor =COEFF(1,5)/COEFF(1,1)     ; drive access to transit time factor
 _xferpen=COEFF(1,6)/COEFF(1,1)     ; transfer penalty
 _boardingpen = 2.0

 ; Check skims to see if they are better than the all-walk path & if they have required IVT
 FILLMW MW[21]=MI.1.1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
 FILLMW MW[61]=MI.2.1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
 
 LOOP x=1,4
  LOOP y=1,15
      _idx=20 + 20*(x-1) + y
   IF((_idx%20)=14)
      COMP total = ROWFAC(_idx,100.0)
   ENDIF
  ENDLOOP
 ENDLOOP

 JLOOP

  IF (I=={FromNode} && J=={ToNode}) LIST="Trace ",I(5.0),"-",J(5.0)
  IF (I=={FromNode} && J=={ToNode}) LIST="            ","       IVT","      Path","      wOVT","      wTOT"

    ; Auto-bus - peak (20 series)
    _ivt = MW[24] + MW[25] + MW[26] + MW[27] + MW[28] + MW[29] + MW[30]
    _pth = MW[24] + MW[26]
    _ovt = MW[22] + _ovtam * (MW[21] + MW[23] + MW[32] + MW[33])
    _tot = _ivt + _ovt
  IF (I=={FromNode} && J=={ToNode}) LIST="Auto-Bus  pk",_ivt(10.2),_pth(10.2),_ovt(10.2),_tot(10.2)
  IF (_ivt==0)
    MW[21]=0, MW[22]=0, MW[23]=0, MW[24]=0, MW[25]=0
    MW[26]=0, MW[27]=0, MW[28]=0, MW[29]=0, MW[30]=0
    MW[31]=0, MW[32]=0, MW[33]=0, MW[34]=0, MW[35]=0
  ENDIF
    
    _ivt = MW[23] + MW[24] + MW[25] + MW[26] + MW[27]
    _pth = MW[23]
    _ovt = MW[22] + _ovtam * (MW[21] + MW[29] + MW[30])
    _tot = _ivt + _ovt
  IF(I=={FromNode} && J=={ToNode}) LIST="            ",_ivt(10.2),_pth(10.2),_ovt(10.2),_tot(10.2)

   ; Auto-bus - off-peak (60 series)
    _ivt = MW[64] + MW[65] + MW[66] + MW[67] + MW[68] + MW[69] + MW[70]
    _pth = MW[64] + MW[66]
    _ovt = MW[62] + _ovtam * (MW[61] + MW[63] + MW[72] + MW[73])
    _tot = _ivt + _ovt
  IF (I=={FromNode} && J=={ToNode}) LIST="Auto-Bus  op",_ivt(10.2),_pth(10.2),_ovt(10.2),_tot(10.2)
  IF (_ivt==0)
    MW[61]=0, MW[62]=0, MW[63]=0, MW[64]=0, MW[65]=0
    MW[66]=0, MW[67]=0, MW[68]=0, MW[69]=0, MW[70]=0
    MW[71]=0,  MW[72]=0, MW[73]=0, MW[74]=0, MW[75]=0
  ENDIF
   
    _ivt = MW[63] + MW[64] + MW[65] + MW[66] + MW[67]
    _pth = MW[63]
    _ovt = MW[62] + _ovtam * (MW[61] + MW[69] + MW[70])
    _tot = _ivt + _ovt
  IF(I=={FromNode} && J=={ToNode}) LIST="            ",_ivt(10.2),_pth(10.2),_ovt(10.2),_tot(10.2)
   
 ENDJLOOP

ENDRUN


; PILOT Script





*echo Transit Paths/Skims                               = %date%  %time% >>{SCENARIO_DIR}\Output\runtime.prn
; End of PILOT Script

; PILOT Script

DistributeMULTISTEP ProcessID="FSUTMSDist", ProcessNum=1

; End of PILOT Script

; Script for program PUBLIC TRANSPORT in file "D:\JOB\D3\Model\A\APPLICATIONS\STPTR00K.S"
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=PUBLIC TRANSPORT PRNFILE="{SCENARIO_DIR}\output\STPTR00I2.PRN" MSG='pnr-bus stop to stop file'
FILEI ROUTEI[1] = "{SCENARIO_DIR}\output\TPATHAM3_{Alt}{year}.RTE"
FILEI NETI = "{SCENARIO_DIR}\output\PKauto.NET"
FILEO REPORTO = "{SCENARIO_DIR}\output\STPTR00J2.PRN"
FILEO STOP2STOPO = "{SCENARIO_DIR}\output\ST2STPK3_{alt}{year}.DBF",
     ACCUMULATE=firstlast, MODES=21,23, N={NODEMIN}-99999

PARAMETERS NOROUTEERRS=99999999, NOROUTEMSGS=99999999,USERCLASSES=1,HDWAYPERIOD=1,
           TRIPSIJ[1]=10

ENDRUN


; Script for program MATRIX in file "D:\JOB\D3\Model\A\APPLICATIONS\STMAT00A.S"
; 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\STMAT00A.PRN" MSG='Write out station zone, parking cost and terminal time to matrix'
FILEO MATO[1] = "{SCENARIO_DIR}\output\ST2STPK_bus_{alt}{year}.MAT",
 MO=1,21-24,
 NAME=FromStation_pnrb,StationTAZ_pnrb,PKParkCost_pnrb,termtimpnr,termtimknr
FILEI LOOKUPI[1] = "{SCENARIO_DIR}\output\STATION_{alt}{year}.DAT"
FILEI MATI[1] = "{SCENARIO_DIR}\output\ST2STPK3_{alt}{year}.DBF",
 PATTERN=IJM:V FIELDS=I,J,0,FROMNODE

PAR ZONES={ZONESA} zonemsg=100

;STATION PARKING COST INTO A LOOKUP TABLE - station, statnumber, spaces,pnrterm,knrterm,nearestzone(distance),nearestzone(statdata input),ampnrcost,mdpnrcost

LOOKUP LOOKUPI=1, 
  NAME=STATIONS,
  LOOKUP[1]=2, RESULT=3,; STATION ZONE
  LOOKUP[2]=2, RESULT=6,; Peak Period Pakring Cost
  LOOKUP[3]=2,result=8,
  LOOKUP[4]=2,result=9,
  FAIL=0

  MW[1]=MI.1.1 

JLOOP
 ;FIRST FIGURE OUT THE STATION EQUIVALENT FOR EACH CELL, 0 IF NO MATCH
 ;NEXT, ASSIGN THE STATION EQUIVALENT FOR EACH CELL TO A WORK MATRIX
  STATZONE1=STATIONS(1,MW[1][J],0)
  PARKINGCOST1=STATIONS(2,MW[1][J],0)
  termtimpnr=stations(3,MW[1][j],0)
  termtimknr=stations(4,MW[1][j],0)
  MW[21][J]=STATZONE1
  MW[22][J]=PARKINGCOST1
  MW[23][j]=termtimpnr
  MW[24][j]=termtimknr

; If no station for a zone, write 0 as the station
 IF(MW[21][J] == 0) MW[1][J]=0

ENDJLOOP

ENDRUN


; Script for program PUBLIC TRANSPORT in file "D:\JOB\D3\Model\A\APPLICATIONS\STPTR00O.S"
; Do not change filenames or add or remove FILEI/FILEO statements using an editor. Use Cube/Application Manager.
RUN PGM=PUBLIC TRANSPORT PRNFILE="{SCENARIO_DIR}\output\STPTR00Q2.PRN" MSG='pnr-bus stop to stop file'
FILEI ROUTEI[1] = "{SCENARIO_DIR}\output\TPATHMD3_{Alt}{year}.RTE"
FILEI NETI = "{SCENARIO_DIR}\output\OPauto.NET"
FILEO REPORTO = "{SCENARIO_DIR}\output\STPTR00R2.PRN"
FILEO STOP2STOPO = "{SCENARIO_DIR}\output\ST2STOP3_{alt}{year}.DBF",
     ACCUMULATE=firstlast, MODES=21,23, N={NODEMIN}-99999

PARAMETERS NOROUTEERRS=99999999, NOROUTEMSGS=99999999,USERCLASSES=1,HDWAYPERIOD=2,
           TRIPSIJ[1]=10

ENDRUN


; Script for program MATRIX in file "D:\JOB\D3\Model\A\APPLICATIONS\STMAT00D.S"
; 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\STMAT00C.PRN" MSG='Write out station zone, parking cost and terminal time to matrix'
FILEI LOOKUPI[1] = "{SCENARIO_DIR}\output\STATION_{alt}{year}.DAT"
FILEI MATI[1] = "{SCENARIO_DIR}\output\ST2STOP3_{alt}{year}.DBF",
 PATTERN=IJM:V FIELDS=I,J,0,FROMNODE
FILEO MATO[1] = "{SCENARIO_DIR}\output\ST2STOP_bus_{alt}{year}.MAT",
 MO=1,21-24,
 NAME=FromStation_pnrb,StationTAZ_pnrb,OPParkCost_pnrb,termtimpnr,termtimknr
    
PAR ZONES={ZONESA} zonemsg=100

; STATION PARKING COST INTO A LOOKUP TABLE
;station, statnumber, spaces,pnrterm,knrterm,nearestzone(distance),nearestzone(statdata input),ampnrcost,mdpnrcost

LOOKUP LOOKUPI=1, 
  NAME=STATIONS,
  LOOKUP[1]=2, RESULT=3,; STATION ZONE
  LOOKUP[2]=2, RESULT=7,
  LOOKUP[3]=2,result=8,
  LOOKUP[4]=2,result=9,; Off-Peak Period Pakring Cost
  FAIL=0

  MW[1]=MI.1.1

JLOOP
 ;FIRST FIGURE OUT THE STATION EQUIVALENT FOR EACH CELL, 0 IF NO MATCH
 ;NEXT, ASSIGN THE STATION EQUIVALENT FOR EACH CELL TO A WORK MATRIX
  STATZONE1=STATIONS(1,MW[1][J],0)
  PARKINGCOST1=STATIONS(2,MW[1][J],0)
  termtimpnr=stations(3,MW[1][j],0)
  termtimknr=stations(4,MW[1][j],0)

  MW[21][J]=STATZONE1
  MW[22][J]=PARKINGCOST1
  MW[23][j]=termtimpnr
  MW[24][j]=termtimknr

  ; If no station for a zone, write 0 as the station
  IF(MW[21][J] == 0) MW[1][J]=0

ENDJLOOP

ENDRUN


; Script for program MATRIX in file "D:\JOB\D3\Model\A\APPLICATIONS\STMAT00G.S"
; 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\STMAT00E.PRN" MSG='STATION TO STATION MATRIX'
FILEO MATO[1] = "{SCENARIO_DIR}\output\ST2ST_{alt}{year}.MAT",
 MO=1-8,NAME=PKStationTAZ_pnrb,PKParkCost_pnrb,termtimpnr,termtimknr,             
              OPStationTAZ_pnrb,OPParkCost_pnrb,termtimpnr,termtimknr
              

FILEI MATI[3] = "{SCENARIO_DIR}\output\ST2STOP_bus_{alt}{year}.MAT"
FILEI MATI[1] = "{SCENARIO_DIR}\output\ST2STPK_bus_{alt}{year}.MAT"

zonemsg=100

; pull out only station zone number
FILLMW MW[1] =MI.1.2   ; pk pnr-transit    Station TAZ
FILLMW MW[2] =MI.1.3   ;                   Parking Cost
FILLMW MW[3] =MI.1.4   ;                  PNR Terminal Time
FILLMW MW[4] =MI.1.5   ;                   KNR Terminal Time
FILLMW MW[5] =MI.3.2   ; op pnr-transit
FILLMW MW[6] =MI.3.3
FILLMW MW[7] =MI.3.4
FILLMW MW[8] =MI.3.5

ENDRUN


; PILOT Script



EndDistributeMULTISTEP
; End of PILOT Script

