Public transport
The public transport converter used in Creario is a reimplementation of the pt2matsim converter by Flavio Poletti but with several adaptations. This report provides a quick recap of the functionality of the original pt2matsim converter but focuses on the adaptations.
Scope
Since agents are allowed to choose activities outside the study area, a buffer zone of 35km is created around the study area. The public transport schedule contains all lines that serve at least on stop within the study area or the buffer zone in order to obtain more realistic travel diaries. The analysis in the report are calculated for the entire schedule, if not specified otherwise.
Input data
The main input for the generation of a transit schedule is a General Transit Feed Specification (GTFS) feed. A GTFS feed consists of a collection of comma separated files that contain information about public transport lines, routes, stop locations, timetables and optional data such as transfer times or fares. If the user has access to a GTFS dataset for the study area, they can upload it for processing. Alternatively, Creario provides access to over 1.000 GTFS feeds from all over the world and allows users to simply select one of the datasets covering their model area. The public transport routes are mapped to the MATSim network. In order to ensure that the network contains all relevant links, the full network before cleaning and simplifying is used.
Overview Processing
The generation of the public transport schedule is organised in the following steps.
- Create TransitStopFacilities
- Create MinimalTransferTimes
- Create TransitLines and TransitRoutes
- Filter stops and lines in region
- Clean schedule
- Create StopAreas
- Map routes to network
- Check plausibility
First, the stop facilities, transfers and transit lines are created for the entire scope of the GTFS feed. Then, the stops and lines relevant for the study area are filtered and the schedule cleaner combines identical routes, removes unused stop facilities and removes unused minimal transfer times. Subsequently, the stop facilities are grouped into stop areas. Finally, the transit lines are routed on the MATSim network. This leads to an updated network with additional links necessary of the public transport mapping.
Create TransitStopFacilities
A TransitStopFacility is created for every stops in GTFS feed. The stopId is the same as in the GTFS feed. The stop is assigned a coordinate and - if available - a parentStationId which is later used for the generation of stop areas (see Section Create StopAreas). The stop is not yet assigned a link. This is done later in conjunction with the route mapping (see Section Map routes to network).
Create MinimalTransferTimes
Transfers are optional in a GTFS feed, but if they are available, they are used to add minimalTransferTimes to the MATSim schedule. Each entry in the transfer.txt file consists of four elements: fromStop,toStop,transfer type and minimum transfer time. There are four transfer types coded in GTFS, as outlined in Table 1.
GTFS transfer type | Interpretation |
---|---|
RECOMMENDED_TRANSFER_POINT | Recommended transfer point between routes |
TIMED_TRANSFER_POINT | Timed transfer point between two routes, departing vehicle is expected to wait for the arriving one |
REQUIRES_MIN_TRANSFER_TIME | Transfer requires a minimum amount of time between arrival and departure to ensure a connection |
TRANSFER_NOT_POSSIBLE | Transfer not possible |
Table 1: Transfers Types
Minimal transfer times are created in the MATSim schedule for the first of these transfer types. For the transfer type REQUIRES_MIN_TRANSFER_TIME the minimal transfer time specified in the GTFS feed is used. For the other two transfer types, the minimal transfer time is calculated with the following equation:
where the detour factor is set to 1.4 and the transfer speed to 1m/s.
Create TransitLines and TransitRoutes
TransitLines and associated TransitRoutes in the MATSim schedule are derived from the GTFS tables routes.txt and trips.txt. For each entry in routes.txt, a TransitLine is created. A TransitRoute contains a.o.
- a sequence of stops including arrival and departure times at each stop relative to the departure time at the first stop
- list of departure times at the first stop of the route
- (optionally) a network route, i.e. the sequence of network links,which are determined in the step Mapping routes to network (see Section Map routes to network).
A TransitRoute is created for each entry in trips.txt and assigned to its associated TransitLine. No TransitRoutes are generated for trips without stop times.
Filter stops and lines in region
So far, the stops, lines and transfer times have been created for the entire scope of the schedule, which might exceed the study area. In this step, the TransitLines are filtered so that only TransitLines remain which serve at least one stop within the study area (incl. buffer zone).
Clean schedule
The schedule cleaner currently contains the following procedures:
- combineIdenticalTransitRoutes
- removeUnusedStopFacilities
- removeUnusedMinimalTransferTimes
- addMinimalTransferTimesForStopAreas
combineIdenticalTransitRoutes identifies TransitRoutes with identical stop sequences and merges them by adding all departures to the merged route. removeUnusedStopFacilities removes stop facilities that are not used by at least one of the filtered TransitRoutes, whereas removeUnusedMinimalTransferTimes" removes minimal transfer times to and from stops that are no longer part of the schedule. The last procedure, addMinimalTransferTimesForStopAreas, ensures that there are minimal transfer times between all stops of a stop area. If there is not already a minimum transfer time for a stop combination, the minimal transfer time is calculated using the equation in Section Create transfers.
Create StopAreas
Since train stations or larger bus and tram stops are often represented by several stops in GTFS (e.g. one for each platform or track), stops with the same parent station are grouped together to so-called stop areas. Stop areas have no impact on the schedule or the simulation, but they are used in later analyses such as the calculation of the public transport quality class (see Section Determine public transport quality class (PTQC)).
Currently, the consolidation of stops into stop areas in Creario is solely done based on the parentStationId. Stops without a parent station are assigned to single-stop stop areas. The coordinate of the stop area is the centre point of all stops belonging to the stop area.
Map routes to network
The goal of this step is to find the most likely path that a public transport vehicle servicing a TransitRoute has most likely taken. The basic algorithm, as implemented in pt2matsim, is described in detail in Poletti (2016).
The algorithm used by Creario consists of the same five steps as algorithm in pt2matsim:
- Determine TransitStopFacilities per mode
- Determine link candidates for each TransitStopFacility and mode combination
- Build a pseudo graph where the nodes represent the link candidates and the links the path between these links
- Find the least-cost path in the pseudo graph
- Translate the least-cost path into a NetworkRoute
There are, however, a few differences between the implementation of the route mapping in pt2matsim and in Creario.
The main difference is, that the mapping is done one a higher resolution network.
In Creario, the TransitRoutes are mapped before any network cleaning or simplifying to ensure that all relevant links are still part of the network and that the network topology is as close to reality as possible.
Because of this, instead of using a mode dependent router, mode specific networks are created and used in all steps of the algorithm.
The network for bus routes also contains car links. But links that are not marked as bus links get a penalty. In addition, the routing in Creario is based on travel time not length.
The higher network resolution also requires a different set of parameters for search radius and number of link candidates.
Particularly for bus and tram routes, the number of link candidates needs to be much higher than the default parameters in pt2matsim to ensure that the relevant links are part of the link candidate set.
To prevent the link candidate set becoming too big, network segments are used for the mapping of bus routes. As described here, a network segment is a set of links between two intersections. For each stop, the set of link candidates can only contain one link per segment, i.e. the link closest to the stop.
Check plausibility
Currently, the following plausibility checks for the public transport schedule are implemented in Creario:
- Loops
- Strong direction changes
- Implausible travel times
For each plausibility check, a separate csv-file is delivered with the Creario results. This enables the user to investigate the detected TransitRoutes and correct any errors in the route mapping. Most conveniently, this should be done in a graphic editor such as Tramola.
Loops
Loops in this application are defined as NetworkRoutes that contain at least one link twice. The csv-file provides the lineId and routeId, the number of links in a loop and the first and last link of the loop. If a NetworkRoute contains more than one loop, each loop is a separate entry in the csv-file.
Strong direction changes
Direction changes are considered strong if the angle between two succeeding links of the NetworkRoute is more than 60° for trams, subways, trains or funiculars or more that 120° for buses, ferries, cable cars or gondolas. The csv-file provides the lineId and routeId, the number of strong direction changes and an indicator whether the NetworkRoute contains a loop.
Implausible travel times
Implausible travel times in this check are cases where the travel time along the NetworkRoute at free-flow speed is higher than the travel time in the schedule. For this check, the travel time of the NetworkRoute is calculated based on the free-flow speed and length of each link along the NetworkRoute. The csv-file provides the lineId and routeId, the NetworkRoute and scheduled travel times, the absolute and relative difference between those travel times and an indicator whether the NetworkRoute contains a loop or strong direction changes.