-
Notifications
You must be signed in to change notification settings - Fork 29
Bus Routes Generation
Objective: Generate Bus Routes.
The bus routes is generated based on stops data for each bus line. Bus route generation needs to be run once, only when adding new stops or new bus lines.
The input tables in database.supply required for bus routes generation are listed below:
1. Bus Stop
Table name: bus_stop
This bus_stop table (data structure found here) stored geometry and characteristics of the bus stops, such as bus stop id, segment id, bus stop's name and others.
2. Sequence of Bus Stop
Table name: pt_bus_stops
This pt_bus_stops table (data structure found here) stored the list of sequence of bus stops for each bus line.
3. Frequency of bus dispatching
Table name: pt_bus_dispatch_freq
This pt_bus_dispatch_freq table (data structure found here) stored the list of dispatching frequency for each bus lines.
4. "dummy" Bus Routes
Table name: pt_bus_routes
This pt_bus_dispatch_freq table (data structure found here) will store the result of bus routes generation. However, it is required to provide dummy data for bus routes generation. How to prepare dummy bus routes table:
-
all bus line must included. Because it will generate bus routes for those bus line existing in this table.
-
set a random segment (must existed in supply.segment) as the first segment
-
for example:
route_id sequence_no section_id 100_1 0 13456 188_1 0 13456 200_1 0 13456
There are some settings in config xml files for bus routes generation are listed below:
1. Minimize the run time to make bus route generation faster.
File name: Basic/Data/simulation.xml
<!-- Reasonable values for MidTerm -->
<base_granularity value="5" units="seconds"/>
<total_runtime value="10" units="minutes" />
<total_warmup value="10" units="seconds" />
<start_time value="08:00:00"/>
2. Check stored procedures
File name: Basic/Data/simrun_MidTerm.xml
Make sure the below 3 stored procedures included:
<mapping name="pt_bus_dispatch_freq" procedure="get_pt_bus_frequency()"/>
<mapping name="pt_bus_routes" procedure="get_pt_bus_routes()"/>
<mapping name="pt_bus_stops" procedure="get_pt_bus_stops()"/>
3. Enable bus controller
File name: Basic/Data/simrun_MidTerm.xml
<busController enabled="true" busline_control_type="headway_based"/>
4. Enable generateBusRoutes
File name: Basic/Data/simrun_MidTerm.xml
<generateBusRoutes enabled="true" />
Run SimMobility from the simmobility directory:
./Release/SimMobility_Medium data/simulation.xml data/simrun_MidTerm.xml
The output file of bus routes generation will be produced in Basic/routes.csv which is ready to replace and import into database.supply.pt_bus_routes table.
In SimMobility, bus routes will be generated based on "Shortest Path", the shortest path (segments) between two bus stops is computed. However, there are some cases which buses are not taking shortest routes in the real world. Therefore, we need Virtual Bus Stop to correct the bus routes.
Virtual Bus Stop is the dummy bus stop where buses have to pass through (without boarding and alighting) and will be added into database.supply.bus_stop and pt_bus_stops in order to correct bus routes.
For example, bus route 100_1: