Train Controller - smart-fm/simmobility-prod GitHub Wiki

Train Controller

How to enable the train controller.

When the user enables the train controller, the SimMobility will simulate trains’ movement on the network. The user can define different train lines, which will move along the predefined tracks and stop at the platforms. The user activates the train controller using the following element in the configuration file of simrun_MidTerm.xml :

<TrainController enabled="true" />. 

If ‘enabled’ value is ‘true’, the train controller will get active and keep dispatching the trains in the SimMobility, otherwise if ‘enabled’ value is ‘false’, no train is simulated on the rail network.

Supply: Rail Network

In order to run the train simulation, the rail network needs to be provided to the supply. There are few tables to define the rail network, namely train stop, platforms, blocks and block poly-lines. The structure of the platform table will define the geographical location on the map, on which the waiting people will do the boarding and alighting when trains arrive:

train_stop : The building/station where peoples are boarding and alighting on the train. Each train stop is served by at least one or multiple train services.

column data type explanation
shape_id integer train stop id
x double x coordinate
y double y coordinate
z double z coordinate (currently we do not have this data)
platform_name string the name of platform, eg: "EW24/NS1", "EW23"
station_name string the station name, one station may include multiple platforms, eg: "Jurong East", "Clementi"
type string the type of train service, eg: MRT, LRT
op_year string operating year

train_access_segment : The accesses of the train station from road segments.

column data type explanation
mrt_stop_id integer train stop id
segment_id integer segment id

train_platform : The train platform, two platforms are allocated to the single train station with two directions of travel.

column data type explanation
platform_no string platform id, eg: "EW23_1", "EW23_2"
station_no string train stop, eg: "EW23"
line_id string train service line, eg: "EW_1" (East West Line towards Pasir Ris),"EW_2" (East West Line towards Tuas)
capacity integer capacity of train, eg: MRT(1920 persons), LRT(105 persons)
type integer terminal - 1 ; not terminal - 0
block_id integer the block id of the platform
pos_offset double default value: 0
length double the length of the platform, in meters. Default value: MRT(142m), LRT(56m)

pt_train_block : The train track of train platform.

column data type explanation
block_id integer the train block id
default_speed_limit double default value: 70
accelerate_rate double default value: 1.1
decelerate_rate double default value: 1.1
length double the length of train block, in meters

pt_train_block_polyline : The set of points of train block.

column data type explanation
polyline_id integer the train block id
x double x coordinate
y double y coordinate
z double z coordinate (currently we do not have this data)
sequence_no integer order of point in the train block

pt_train_dispatch_freq : This table contains train frequency information.

column data type explanation
frequency_id string frequency id
line_id string train service line id, eg: "EW_1", "EW_2"
start_time string time of first train
end_time string time of last train
headway_sec integer time between trains, in seconds

pt_train_route_platform : This table contains the sequence of train platform of each train route.

column data type explanation
line_id string train service line id
platform_no integer train platform id
sequence_no integer order of platform of train routes

pt_train_route : When running the trains simulation, the train routes need to be provided to the supply. This table contains the sequence of blocks of each train route.

column data type explanation
line_id string train service line id
block_id integer train block id
sequence_no integer order of block of train routes

pt_train_platform_transfer_time : This table contained the transfer time between platforms in each train stations.

column data type explanation
station_no string train stop id, eg: "EW23"
platform_first string from platfrom, eg: "EW23_1"
platform_second string to platfrom, eg: "EW23_2"
transfered_time_sec integer the transfer time between platforms, in seconds. Default value: In the same train stop/station: (Different platfrom, same train line service - 0 second) ; (Different platform, different train line service - 60 seconds)

pt_opposite_lines : This table contains the train line and its opposite travel directions train line.

column data type explanation
line string train service line id
opp_line string the opposite travel direction train service line id

The predefined rail network is supplied to the simulation through the following stored procedures under proc_maps in the simrun_MidTerm.xml file:

<mapping name="pt_platform" procedure="get_pt_platforms()"/>
<mapping name="pt_block" procedure="get_pt_blocks()"/>
<mapping name="pt_block_polyline" procedure="get_pt_block_polylines()"/>
<mapping name="pt_mrt_dispatch_freq" procedure="get_pt_mrt_dispatch_freq()"/>
<mapping name="pt_mrt_route" procedure="get_pt_mrt_route()"/>
<mapping name="pt_mrt_platform" procedure="get_pt_mrt_platform()"/>

There, you can find the corresponding stored procedures that are used to access the train routes table, train platform tables, and train dispatching frequency.

Train controller Output files.

The below the setting of the train movement output files when "output_enabled" inside the "trainController", can control to generate movement output or not.

<trainController enabled="true" train_control_type="moving_block">
    <output_enabled value="true"/>
    <distance_arriving_at_platform value ="0.001"/>
</trainController>    

If output_enable is set as "true" then it will generate below files: pt_mrt_move.csv pt_mrt_dwellTime.csv pt_mrt_passengernfo.csv

pt_mrt_movement.csv In the output file "pt_mrt_movement.csv" about train movement, several columns are included to represent different meanings, the details are descripted as following:

The below table will define the blocks for train movement. The structure of the block table is as follows:

column data type explanation
line_id string mrt line
train_id string the current train id
trip_id string the current trip id
current_speed double the train movement's speed at the moment
next_platform string next approaching platform
distance_to_platform double the distance to next platform
total_distance double the total distance away from the starting point
x_position double current x coordinate
y_position double current y coordinate
acceleration double the current acceleration
passenger_number integer the passengers' number inside the current train
dwell_time double the dwell time if the train is stopping at current platform

pt_mrt_dwellTime.csv

column data type explanation
TimeOfDay string Current Time
train_id string the current train id
trip_id string the current trip id
next_platform string next approaching platform
dwell_time double the dwell time set at first for this train

pt_mrt_passengernfo.csv

column data type explanation
TimeOfDay string Current Time string in hh:mm:ss
passenger_id integer passenger's id
train_id string train id
trip_id string train (driver)trip id
origin_platform string train origin platform
destination_platform string train destination platform

Apart from these files some files generated by default:

: TravelTimeBetweenStations.csv : pt_mrt_Boarding_Alighting_DwellTime.csv : PersonsBoarding.csv : PersonsAlighting.csv : returnedTrainId.csv : pulledTrainId.csv

TravelTimeBetweenStations.csv

column data type explanation
line_id string mrt line
passenger_id integer passenger's id
train_id string train id
trip_id string train (driver)trip id
previous_platform string previous platform
this_platform string this platform
travelTimebetweenStations string time taken to travel these two stations

pt_mrt_Boarding_Alighting_DwellTime.csv : Information about dwell time() of train in a platform. it included passenger alighting/boarding & dwell time

column data type explanation
train_id string train id
TimeOfDay string Current Time string in hh:mm:ss
num_boarding int boarding passenger count
num_alighting int alighting passenger count
passengers int number of passengers in train
initialDwellTime double initial dwell time set by train Controller

PersonsBoarding.csv

: information about boarded passenger in a train at specific platform.

column data type explanation
passenger_id integer passenger's id
TimeOfDay string Current Time string in hh:mm:ss
train_id string train id
trip_id string train (driver)trip id
boarding_platform string platform no.from where person boarded
person_origin_platform string person current subtrip origin platform
person_destination_platform string

PersonsAlighting.csv : information about alighted passenger at specific platform.

column data type explanation
passenger_id integer passenger's id
TimeOfDay string Current Time string in hh:mm:ss
train_id string train id
trip_id string train (driver)trip id
allighted platform string platform no.where person alighted
person_origin_platform string person current subtrip origin platform
person_destination_platform string

returnedTrainId.csv : Train returned to Active Train pools and ready to be rescheduled

column data type explanation
train_id string train id
trip_id string train (driver)trip id

pulledTrainId.csv : Train removed from Active Train pools:

column data type explanation
train_id string train id
trip_id string train (driver)trip id

Train Controller Design Document (NEEDS TO BE UPDATED AS WIKI PAGES): here