BayAreaMetro/tm2py

๐Ÿ› Bug: Volume Delay Functions are incorrectly applied

Opened this issue ยท 3 comments

Describe the bug

The volume delay functions used in tm2py should align with the methods used in TM1, as defined here. It appears that the translation to tm2py did not account for the change in the facility types. In TM1, the facility types are as follows:

  1. Freeway-to-freeway connector (BPR)
  2. Freeway (BPR)
  3. Expressway (Akcelik)
  4. Collector (Akcelik)
  5. Freeway ramp (Akcelik)
  6. Dummy link (N/A)
  7. Major arterial (Akcelik)
  8. Managed Freeway (BPR)
  9. Special facility (BPR)
  10. Toll plaza (Akcelik)

For the new TM2 networks, the facility types are as follows:

  1. Freeway
  2. Expressway
  3. Ramp
  4. Divided Arterial
  5. Undivided Arterial
  6. Collector
  7. Local
  8. Dummy

It appears from this code that Akceliks are being applied to the old facility types -- see this snippet:

akcelik_vdfs = [3, 4, 5, 7, 8, 10, 11, 12, 13, 14]

-->

Progress:

  • Sufficient information provided
  • Cause identified/found
  • Test developed/identified
  • Approach determined
  • Test passes

To Reproduce

Magic number error

Failing tests

  • No applicable test failed, need to create.
  • other...specify

Triggering line of code

(https://github.com/BayAreaMetro/tm2py/blob/develop/tm2py/components/network/highway/highway_network.py#L264)

Thoughts on resolution

This array should be:

akcelik_vdfs = [2, 3, 4, 5, 6, 7]

This retains the magic number problem, but fixes the bug. It's also not clear where in the code the BPR parameters are applied for the other facility types.

Full stack trace

Environment

Operating system:
Context (conda, jupyter, etc):
Environment (e.g. output from conda list):

@inrokevin, @e-lo: do either of you know where the BPR parameters are defined in the system?

FYI @lmz, @gregerhardt, @i-am-sijia

@arashasadabadi It looks like the critical speeds you have defined here are not correct. See here for the correct values. These need to be mapped to the correct facility types. Please reference a commit here that fixes this problem.