a-b-street / a-b-street/abstreet

Consolidate definitions of delay

Đang mở
#549 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
8.2k
Fork
380
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

# Currently, player-facing

abst surfaces the concept of "delay" in a few ways. In the UI, it's in info panels for people and the finished trips stats. There's also raw data measuring the delay any agent experiences crossing an intersection, exposed as a scatter plot and (broken) fan chart.
![Screenshot from 2021-03-02 17-10-06](https://user-images.githubusercontent.com/1664407/109737014-2dd39680-7b7a-11eb-8918-45ffef79c345.png)
![Screenshot from 2021-03-02 17-09-37](https://user-images.githubusercontent.com/1664407/109737016-2e6c2d00-7b7a-11eb-947e-b33b1117f0d9.png)
![Screenshot from 2021-03-02 17-21-44](https://user-images.githubusercontent.com/1664407/109737938-c585b480-7b7b-11eb-873b-b424776ac473.png)

An agent starts "waiting" (and accumulating delay) in a few different situations:

- when a pedestrian reaches a bus stop and starts waiting for their bus/train
- when a pedestrian reaches an intersection and waits to start their turn
- when a vehicle reaches the front of a queue and starts waiting on the intersection to start their turn
- When a vehicle completes the "freeflow time" to cross a lane. This time is `distance / speed`, where speed is the speed limit of the road, or the vehicle's personal max speed (for bikes).

This last case can be counter-intuitive. Say a vehicle is number 5 in a queue on some long road. Their freeflow time is just 100s, but because of a slower vehicle in the front, or somebody parking, or whatever else, after 100s, they've only made it 30% down this queue. At that point, they start waiting, even if they're (slowly) moving. When they get to be the second in line, they're still in `CarState::Queued`, with that same delay increasing. When the leader vehicle at the front finally gets out of the way, they wake up their follower and put them back in `CarState::Crossing`. **This resets the delay**. The vehicle will reach the intersection moments later and start waiting for it. When they enter the intersection, their delay is recorded and associated with that intersection, but it **doesn't include all of that time spent queueing**.

When there's a long backlog of vehicles across multiple intersections, it's a little unclear how to measure delay and attribute it at each intersection.

# Currently, developer facing

There's a "blocked-by graph" in debug mode, which attempts to construct a full dependency graph of why somebody isn't moving. TODO, list out the rules for how it works.

The API has a few methods related to delay.

`/traffic-signals/get-delays` consults a single intersection between a given time interval, and sums up the total delay experienced by all agents, breaking it down by the movement across the intersection. Only works for traffic signals, because measuring it for stop signs too might wind up being lots of prebaked data in `Analytics`.

`/data/get-blocked-by-graph` returns the debug mode blocked-by graph as a bunch of tuples, `(delay, cause, trip, person)`

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.