gtfstools icon indicating copy to clipboard operation
gtfstools copied to clipboard

Add `strategy` parameter to `frequencies_to_stop_times()`

Open dhersz opened this issue 3 years ago • 1 comments

Right now stop times trips are added to stop_times following the start_time, end_time and headway_secs exactly. But when exact_times = 0, services don't have a fixed schedule but try to adhere to a specific frequency.

So for example, if we have start_time = 7:00, end_time = 9:00, headway_secs = 120 and exact_times = 1, we can easily say that the new trips in stop_times will depart at 7:00:00, 7:02:00, 7:04:00, ...

If we had the same case but exact_times = 0, we wouldn't know at which time the first trip departed though, but we currently use the same approach as exact_times = 1 above. Another strategy, for example, would be to "offset" the trips with half the headway, yielding trips departir at 7:01:00, 7:03:00, 7:05:00, etc.

Yet another strategy would be to randomize the first departure, similar to what R5 does with frequency-described trips. So the result could look something like 7:00:19, 7:02:19, 7:04:19, etc.

So currently this parameter could take the values c("exact", "half_headway", "random") (the names are definitely not set in stone yet). Any other strategy we could implement?

dhersz avatar May 24 '22 12:05 dhersz

I like the three stratagies you proposed, and I'm fine with the values' names. What strategy should be the default? "half_headway"?

rafapereirabr avatar May 24 '22 12:05 rafapereirabr