Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frequency-based trips #408

Closed
irees opened this issue Feb 11, 2016 · 10 comments
Closed

Frequency-based trips #408

irees opened this issue Feb 11, 2016 · 10 comments
Assignees

Comments

@irees
Copy link
Member

irees commented Feb 11, 2016

Handle frequency.txt style trips, e.g.
https://rawgit.com/CUTR-at-USF/bullrunner-gtfs-realtime-generator/master/bullrunner-gtfs.zip

@irees irees self-assigned this Feb 11, 2016
@irees
Copy link
Member Author

irees commented Feb 17, 2016

Investigate multiplying-trips vs. internally supporting frequency.txt based trips.

@barbeau
Copy link

barbeau commented Feb 19, 2016

I would suggest taking a look at OpenTripPlanner, as they've dealt with this same question. I haven't delved into the code myself, but a student from our group did some prototyping in OpenTripPlanner for supporting frequency-based exact_times=0 real-time info (opentripplanner/OpenTripPlanner#1647), and also created a frequency-based exact_times=0 GTFS-realtime feed for the USF Bull Runner (https://github.com/CUTR-at-USF/bullrunner-gtfs-realtime-generator).

@drewda
Copy link
Member

drewda commented May 31, 2016

@irees @gknisely while this ticket waits on the backburner, likely until next quarter, let's downgrade all frequency-based feeds to import level 2, so they are not imported into Valhalla for routing.

@irees
Copy link
Member Author

irees commented Jun 2, 2016

13 currently active feeds that use frequencies.txt -- trip_count is the total number of trips.txt trips, frequencies_count is the number of frequencies.txt entries.

[{
    "onestop_id": "f-drt-mbta",
    "active_feed_version": "9c1b5facfed0b7cab2742492124f42989d487b7b",
    "operators_in_feed": [{
        "onestop_id": "o-drt-mbta",
        "name": "MBTA"
    }, {
        "onestop_id": "o-drt3p-massport",
        "name": "Massport"
    }],
    "trip_count": 158417,
    "frequencies_count": 21
}, {
    "onestop_id": "f-f25d-socitdetransportdemontral",
    "active_feed_version": "b3cb8fd3828ef9dcabc07b4bd5b86cdbd3478f02",
    "operators_in_feed": [{
        "onestop_id": "o-f25d-socitdetransportdemontral",
        "name": "Société de transport de Montréal"
    }],
    "trip_count": 127566,
    "frequencies_count": 1032
}, {
    "onestop_id": "f-9qh0-anaheim~ca~us",
    "active_feed_version": "c93d84a5208adc5d4a4e6729a10a5d35c24683d0",
    "operators_in_feed": [{
        "onestop_id": "o-9qh0-anaheimresorttransportation",
        "name": "Anaheim Resort Transportation"
    }],
    "trip_count": 13616,
    "frequencies_count": 1
}, {
    "onestop_id": "f-s-anm~it",
    "active_feed_version": "0977871b4b1767955025d9e90853c4326b71146a",
    "operators_in_feed": [{
        "onestop_id": "o-s-aziendanapoletanamobilit",
        "name": "Azienda Napoletana Mobilità"
    }],
    "trip_count": 4756,
    "frequencies_count": 1573
}, {
    "onestop_id": "f-9g3-semovi",
    "active_feed_version": "fd847780ff1c19fdc45756fa47a489a5c0d75b01",
    "operators_in_feed": [{
        "onestop_id": "o-9g3r-ferrocarrilessuburbanos",
        "name": "Ferrocarriles Suburbanos"
    }, {
        "onestop_id": "o-9g3q-serviciodetransporteselctricos",
        "name": "Servicio de Transportes Eléctricos"
    }, {
        "onestop_id": "o-9g3-reddetransportedepasajeros",
        "name": "Red de Transporte de Pasajeros"
    }, {
        "onestop_id": "o-9g3q-nochebscorredoresconcesionados",
        "name": "NOCHEBÚS Corredores concesionados"
    }, {
        "onestop_id": "o-9g3w-sistemadetransportecolectivometro",
        "name": "Sistema de Transporte Colectivo Metro"
    }, {
        "onestop_id": "o-9g3w-metrobs",
        "name": "Metrobús"
    }, {
        "onestop_id": "o-9g3q-corredoresconcesionados",
        "name": "Corredores Concesionados"
    }],
    "trip_count": 1679,
    "frequencies_count": 1679
}, {
    "onestop_id": "f-kzf-nairobi~saccos",
    "active_feed_version": "fdb6aad5e0c21c010414eed2e7245786330911ad",
    "operators_in_feed": [{
        "onestop_id": "o-kzf-nairobi~saccos",
        "name": "Approved SACCOs of Nairobi as mapped by University of Nairobi C4D Lab"
    }],
    "trip_count": 268,
    "frequencies_count": 804
}, {
    "onestop_id": "f-9w28-naipta~az~us",
    "active_feed_version": "0e475297f9e8842754f447f74ec256fa9fa68520",
    "operators_in_feed": [{
        "onestop_id": "o-9w28-mountainline",
        "name": "Mountain Line"
    }],
    "trip_count": 125,
    "frequencies_count": 126
}, {
    "onestop_id": "f-dnjj-clemson~sc~us",
    "active_feed_version": "db1eac59d735f378629c47a18722f0bff56a7425",
    "operators_in_feed": [{
        "onestop_id": "o-dnjj-clemsonareatransit",
        "name": "Clemson Area Transit"
    }],
    "trip_count": 94,
    "frequencies_count": 45
}, {
    "onestop_id": "f-69y7-recursosdatabuenosairesgobar",
    "active_feed_version": "95742a1a65826abfa23f5aeaeeb082e45f066801",
    "operators_in_feed": [{
        "onestop_id": "o-69y7-sbase",
        "name": "Subterráneos de Buenos Aires"
    }],
    "trip_count": 48,
    "frequencies_count": 172
}, {
    "onestop_id": "f-9xhv-nps~romo~shuttles",
    "active_feed_version": "55b23bcff5ccf13a08e1b1fbe49308e34f086ebd",
    "operators_in_feed": [{
        "onestop_id": "o-9xhv-rockymountainnationalpark",
        "name": "Rocky Mountain National Park"
    }],
    "trip_count": 16,
    "frequencies_count": 16
}, {
    "onestop_id": "f-u3qc-metrowarszawskie",
    "active_feed_version": "3a7d41d38edf4e1d1d3340103cc6ab5245e3128b",
    "operators_in_feed": [{
        "onestop_id": "o-u3qc-metrowarszawskie",
        "name": "Metro Warszawskie"
    }],
    "trip_count": 16,
    "frequencies_count": 98
}, {
    "onestop_id": "f-u0-openov~lu",
    "active_feed_version": "72c96e0ef267db148ab09ea6d928035e258f9435",
    "operators_in_feed": [{
        "onestop_id": "o-u0u1-tice",
        "name": "TICE"
    }, {
        "onestop_id": "o-u0u-rgtr",
        "name": "Régime Général des Transports Routiers"
    }, {
        "onestop_id": "o-u0-cfl",
        "name": "Société Nationale des Chemins de Fer Luxembourgeois"
    }, {
        "onestop_id": "o-u0u6-avl",
        "name": "Autobus de la Ville de Luxembourg"
    }],
    "trip_count": 13789,
    "frequencies_count": 947
}, {
    "onestop_id": "f-dhvrs-bullrunner",
    "active_feed_version": "3e3efb8f611d9189ebe819aec85ba030ab6ae8b4",
    "operators_in_feed": [{
        "onestop_id": "o-dhvrs-usfbullrunner",
        "name": "USF Bull Runner"
    }],
    "trip_count": 15,
    "frequencies_count": 15
}]

@barbeau
Copy link

barbeau commented Jun 2, 2016

Are you all currently supporting frequency-based exact_times=1 trips (i.e., the compressed representation of schedule-based trips)? Or are these on back burner for now as well?

@irees
Copy link
Member Author

irees commented Oct 5, 2016

My current concept is to describe frequency-based trips using "ScheduleStopPair" attributes "frequency_headway_seconds", "frequency_start_time", and "frequency_end_time", with arrival & departure times relative to the start of the trip. I don't currently have a flag for exact_times but it could be added.

For example, an SSP with frequency_headway_seconds=600, frequency_start_time=08:00:00, and origin_departure_time=00:05:00 would result in departures at 08:05, 08:15, 08:25, etc.

We've been discussing this lately, and I welcome any feedback and suggestions.

@barbeau
Copy link

barbeau commented Oct 7, 2016

@irees I'm not very familiar with the internal data model of transitland, but what you describe seems to make sense for feeds with exact_times=1. This is effectively a compressed way to represent a fixed schedule without including a bunch of near duplicate trips, and most transit software I've seen treats it exactly as you describe.

However, exact_times=0 (or if exact_times is omitted) is a different beast. This is true frequency-based, meaning that the expected arrival time of the vehicle shifts throughout the day, based on when the vehicle actually arrives.

This has a lot of implications when you start getting into user-facing information, such as answering the question "when is my bus expected to arrive?" For exact_times=1, the answer is the same as normal scheduled trips. For example, assuming lack of real-time info, if it's 8:20, "your bus is scheduled to arrive in five minutes". But for exact_times=0, the answer is "your bus is expected to arrive every 600 seconds." And, if you don't have real-time info, that answer is the same no matter when during the day you ask the question. For routing and calculating wait times, without real-time info systems like OTP use a pessimistic estimate and assume the wait is always the headway. If you have real-time info with a predicted arrival time, then you materialize an estimated arrival time on the fly based on this estimate - in that case, then you can say "your bus is expected to arrive in five minutes".

This seems to be a subtle difference, but in creating a GTFS-rt frequency-based exact_times=0 feed, and trying to add support for this into OTP, we ran into a lot of unexpected issues. IMHO, true frequency-based systems are tricky.

@drewda
Copy link
Member

drewda commented Mar 10, 2017

@irees the one final step that can happen on another issue: adding mention of the new frequency attributes to the SSP docs: https://github.com/transitland/www-transit-land/issues/274

@irees irees closed this as completed Mar 13, 2017
@irees irees removed the in progress label Mar 13, 2017
@barbeau
Copy link

barbeau commented Mar 13, 2017

@irees Nice! So what assumption does Valhalla make for the estimated wait time for the bus for a frequency-based exact_times = 0 system like our USF Bull Runner? IIRC OTP uses a pessimistic approach and assumes you'd need to wait the entire headway defined in GTFS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants