BayAreaMetro / tm2py

Travel Model Two - python edition
https://bayareametro.github.io/tm2py/
Apache License 2.0
2 stars 8 forks source link

🚀 Feature: highway reliability #75

Open inrokevin opened 2 years ago

inrokevin commented 2 years ago

User Story

Implement highway reliability in Emme assignment based on travel-model-two version (https://github.com/BayAreaMetro/travel-model-two)

Steps:

inrokevin commented 2 years ago

Some notes from cube scripts:

Create networks (CreateFiveHighwayNewtorks.job)

  ; static reliability
  ; lane factor
  if (LANES_@token_period@ = 1) _lanesrel = 0.0
  if (LANES_@token_period@ = 2) _lanesrel = 0.0103589
  if (LANES_@token_period@ = 3) _lanesrel = 0.0361211
  if (LANES_@token_period@ = 4) _lanesrel = 0.0446958
  if (LANES_@token_period@ >= 5) _lanesrel = 0.0

  ; interchange Distance
  _upstream = 0
  _downstream = 0
  if ((FT = 1 | FT = 2) & UPDIST > 0) _upstream = 0.011 * 1 / UPDIST
  if ((FT = 1 | FT = 2) & DOWNDIST > 0) _downstream = 0.0005445 * 1 / DOWNDIST

  ; speed_factor
  if (FFS < 35) _speedrel = 0.0
  if (FFS = 35) _speedrel = 0.0075674
  if (FFS = 40) _speedrel = 0.0091012
  if (FFS = 45) _speedrel = 0.0080996
  if (FFS = 50) _speedrel = -0.0022938
  if (FFS > 50) _speedrel = -0.0046211

  ; freeways
  _fwy_const = 0.1078
  if (FT = 1 | FT = 2)
    _speedrel = 0 ; override speed factor
    if (FFS > 70) _speedrel = 0.01393
    STREL = _fwy_const + _speedrel + _upstream + _downstream
  endif

  ; Arterials
  _art_const = 0.0546552
  if (FT >= 3 & FT <= 7)
    STREL = _art_const + _lanesrel + _speedrel
  endif

  ; placeholder for total reliability
  RELBTY_SD = STREL

AverageNetworkVolumes.job

; V/C based reliability coefficient
; using averaged volumes
VC_REL_FAC = 0.0

IF(vc >= 0.7 & (li.2.FT = 1 | li.2.FT = 2) ) ;LOS C Freeway
  VC_REL_FAC = VC_REL_FAC + ( ( (vc - 0.7) + 0.01 ) * 0.24290 )
ENDIF

IF(vc >= 0.7 & (li.2.FT >= 3 & li.2.FT <= 7) ) ;LOS C Arterial
  VC_REL_FAC = VC_REL_FAC + ( ( (vc - 0.7) + 0.01 ) * 0.1561  )
ENDIF

IF(vc >= 0.8 & (li.2.FT = 1 | li.2.FT = 2) ) ;LOS D Freeway
  VC_REL_FAC = VC_REL_FAC + ( ( (vc - 0.8) + 0.01 ) * 0.1705  )
ENDIF

IF(vc >= 0.8 & (li.2.FT >= 3 & li.2.FT <= 7) ) ;LOS D Arterial
  VC_REL_FAC = VC_REL_FAC + ( ( (vc - 0.8) + 0.01 ) * 0.0     )
ENDIF

IF(vc >= 0.9 & (li.2.FT = 1 | li.2.FT = 2) ) ;LOS E Freeway
  VC_REL_FAC = VC_REL_FAC + ( ( (vc - 0.9) + 0.01 ) * -0.2278 )
ENDIF
IF(vc >= 0.9 & (li.2.FT >= 3 & li.2.FT <= 7) ) ;LOS E Arterial
  VC_REL_FAC = VC_REL_FAC + ( ( (vc - 0.9) + 0.01 ) * 0.0     )
ENDIF
IF(vc >= 1.0 & (li.2.FT = 1 | li.2.FT = 2) ) ;LOS F low Freeway
  VC_REL_FAC = VC_REL_FAC + ( ( (vc - 1.0) + 0.01 ) * -0.1983 )
ENDIF
IF(vc >= 1.0 & (li.2.FT >= 3 & li.2.FT <= 7) ) ;LOS F low Arterial
  VC_REL_FAC = VC_REL_FAC + ( ( (vc - 1.0) + 0.01 ) * -0.1449 )
ENDIF
IF(vc >= 1.2 & (li.2.FT = 1 | li.2.FT = 2) ) ;LOS F high Freeway
  VC_REL_FAC = VC_REL_FAC + ( ( (vc - 1.2) + 0.01 ) * 1.022   )
ENDIF
IF(vc >= 1.2 & (li.2.FT >= 3 & li.2.FT <= 7) ) ;LOS F high Arterial
  VC_REL_FAC = VC_REL_FAC + ( ( (vc - 1.2) + 0.01 ) * 0.0     )
ENDIF

; zero reliability sd on managed lanes and tolled facilities
if (MANAGED == 1 | TOLLBOOTH > 0)
  RELBTY_SD = 0
else
  RELBTY_SD = (VC_REL_FAC + li.2.STREL) * li.2.DISTANCE * li.2.CTIM
endif

Highway skims (HwySkims.job)

;Reliability (variance)
lw.RELBTY_VAR = li.RELBTY_SD ^ 2
           mw[6] = pathtrace(lw.RELBTY_VAR)
           mw[14] = pathtrace(lw.RELBTY_VAR)

; passenger vehicle skims
mato[1] = skims\HWYSKM@token_period@_taz.tpp, mo = 1-42, name = TIMEDA,DISTDA,BTOLLDA,FFTDA,HOVDISTDA,
                                                          TOLLTIMEDA,TOLLDISTDA,TOLLBTOLLDA,TOLLVTOLLDA,TOLLFFTDA,TOLLHOVDISTDA,TOLLTOLLDISTDA,
                                                          RLBTYDA,RLBTYTOLLDA,
                                                          TIMES2,DISTS2,BTOLLS2,FFTS2,HOVDISTS2,
                                                          TOLLTIMES2,TOLLDISTS2,TOLLBTOLLS2,TOLLVTOLLS2,TOLLFFTS2,TOLLHOVDISTS2,TOLLTOLLDISTS2,
                                                          RLBTYS2,RLBTYTOLLS2,
                                                          TIMES3,DISTS3,BTOLLS3,FFTS3,HOVDISTS3,
                                                          TOLLTIMES3,TOLLDISTS3,TOLLBTOLLS3,TOLLVTOLLS3,TOLLFFTS3,TOLLHOVDISTS3,TOLLTOLLDISTS3,
                                                          RLBTYS3,RLBTYTOLLS3,

mw[13]   = sqrt(mi.1.RELBTY_VARDA)
mw[14]   = sqrt(mi.1.TOLLRELBTY_VARDA)

; final reliability skim result is the square root of skimmed reliability (variance)
; if there's no DA from any TAZ to TAZ, this will cause problems in the long run