Skip to content

Mid Term Output

Kakali Basak edited this page Dec 4, 2018 · 80 revisions

Pre-Day

Mid-term preday has two modes of execution - logsum and simulation. All necessary logsums from preday choice models are pre-computed in the logsum mode. The simulation mode uses these pre-computed logsums as it iterates through the system of choice models to build an activity schedule for each individual in the population. The procedure to switch between these two modes is explained here. The outputs produced by each of the two modes are listed below.

logsum mode

The logsums generated from the preday logsum computation mode are directly updated in the database logsum table specified in the configuration.

simulation mode

Activity Schedule

The activity schedules generated from preday is written to a CSV file. The CSV file is in the exact same format as the columns in the day activity schedule database table but devoid of the unique record identifier (pid column). This csv file has to be imported into the simmobility database before proceeding to pathset generation and withinday+supply simulations.

Within-Day

Withinday has two modes of execution: pathset generation mode and normal simulation mode. Details about the former can be found in the corresponding page.
Here, we only comment on the outputs of the latter.

out.txt

Gives segment level and link level statistics for each update interval of the simulation. The file contains two different types of comma-separated values for segment level and link level outputs in the same file.

segment level output:
  1. String "seg" to indicate segment level output
  2. Update interval of supply simulation for which current line of output was written.
  3. Road segment id.
  4. Stats number in the segment. In SimMobility Mid-term, every road segment has at least one [SegmentStats] (https://github.com/smart-fm/simmobility-prod/wiki/Conflux#data-structure). Wherever there is a possible queuing point on the road segment, it is split into segment stats. For example, if there is a bus-stop in the segment, the buses would queue up there to serve the stop. So we split at the bus-stop location and create multiple segments stats for the same segment. This field gives the index of the stats within the original segment.
  5. Speed of the segmentstats that is computed based on density at the end of the update interval, (units: meter/second)
  6. Segment flow -number of vehicles moving out from segment.
  7. Density of segmentstats. (units: vehicles/lane-km for the full segment)
  8. Number of agents in the segmentstats (on-road).
  9. Total vehicle length. The total length of all vehicles in the segmentstats, and used for segment's density calculation.
  10. Number of vehicles in segment's moving part. Each segmentstats has a queuing part (where vehicles queue for entering downstream segments or links) and a moving part. This field gives the total number of vehicles in the moving part.
  11. The total length of vehicles in moving part of segmentstats. (units: meter).
  12. Number of vehicles in queuing part of segmentstats.
  13. The total length of vehicles in queuing part of segmentstats. (units: meter).
  14. Number of lanes in the segment.
  15. Segmentstats length. (units: meter)
link level output:
  1. String "lnk" to indicate link level output
  2. Update interval of supply simulation for which current line of output was written.
  3. Link id
  4. Link length. (units: kilometer)
  5. Link density at the end of the update interval. (units: passenger-car-units / km of link)
  6. Number of vehicles which entered the link in this interval
  7. Number of vehicles which exited the link in this interval
  8. Number of cars which exited the link in this interval
  9. Number of taxis which exited the link in this interval
  10. Number of motorbikes which exited the link in this interval
  11. Number of buses which exited the link in this interval
  12. Number of other types of vehicle which exited the link in this interval

Linux shell commands to extract link level outputs is below.

grep lnk out.txt > link_stats_file.csv
sort --field-separator="," --key=3 --key=2 --numeric-sort link_stats_file.csv > tmp
mv tmp link_stats_file.csv

All vehicles are counted only when they enter and exit the link. Count by vehicle type is taken only at the link exit. All trips done by SimMobility agents are from one node to another in our road network graph. If a vehicle enters a link, it goes through the entire length of the link before it exits. In the link level output, we can get the number of vehicles which exited a link in the entire day by summing up the exit counts for each link across all update intervals. All these vehicles have gone through the entire link. Statistics like total distance driven per day on each link can be computed as (Li * Ni), where Li is the length of the link i and Ni is the number of vehicle which went through link i in the simulated day.

IMPLEMENTATION NOTE: These values are printed by the function Conflux::updateAndReportSupplyStats(...) at each time slice.

File: journeytime.csv

Gives information on the arrival times, dwell times and occupancy for every bus/train line for every stop in its route. The name of this file is configurable in simrun_MidTerm.xml.
<journey_time file="journeytime.csv"/>

Table: journey_time

Column name Data Type Description
pt_stop_id character (50) PT stop ID
pt_line_id character (50) PT line ID
trip_id integer Run number ID of that PT line
pc_occ double precision Percentage of occupancy of that vehicle at that stop
sequence_id integer Sequence ID of the stop in the route of the PT line
arrival_time time without time zone Arrival time of the vehicle at that stop
waiting_time time without time zone Waiting/dwell time of vehicle at that stop

File: waitingcount.csv

This output lists the number of passengers waiting at each PT stop in every update interval. The name of this file is configurable and is mentioned in output_statistics section of the simrun_MidTerm.xml file as follows.
<waiting_count file="waitingcount.csv"/>

Table: waiting_count

Column name Data Type Description
pt_stop_id character (50) PT stop ID
curr_time time without time zone Current timestamp
num_waiting integer Number of people waiting at the stop

File: waitingtime.csv

Gives information on the amount of time each person agent has waited at a particular bus stop or train station. The name of this file is configurable and is mentioned in output_pt_statistics section of the simrun_MidTerm.xml file as follows.
<waiting_time file="waitingtime.csv"/>

Table: waiting_time

Column name Data Type Description
person_id character varying Person ID
origin_node character varying Origin node ID
destination_node character varying Destination node ID
start_stop_id character varying Origin bus/train stop code for person's trip
end_stop_id character varying Ending bus/train stop ID
planned_pt_line_id character varying Planned PT line ID
pt_line_id character varying PT line ID
board_time time without time zone Time at which the person was able to board the PT line
wait_time double precision Waiting time of the person at the stop [Unit - seconds]
denied_boarding_count integer No. of times the person was denied boarding at that stop for the same PT line

File: subtrip_metrics.csv

Subtrip level travel time and distance information for public and private traffic. This file can be generated by enabling or disabling subtrip_metrics in the output_statistics section of simrun_MidTerm.xml file as follows.
<subtrip_metrics enabled="true" file="subtrip_metrics.csv" enabled="true"/>
This output can also be disabled by setting the enabled attribute to false.

The format of the CSV that is generated is given below:

  1. person_id.
  2. trip_id.
  3. subtrip_id.
  4. origin_type
  5. origin_node: Origin node id.
  6. origin_taz: Origin TAZ code.
  7. destination_type
  8. destination_node: Destination node id.
  9. destination_taz: Destination TAZ code.
  10. mode.
  11. start_time.
  12. end_time.
  13. travel_time: Total travel time from origin to destination, the sum of cbd_travel_time and non_cbd_travel_time, unit: hours (AA:does it include the waiting time as well?)
  14. total_distance: Total travel distance from origin to destination, the sum of cbd_distance and non_cbd_distance, unit: meters.
  15. cbd_entry_node: The entrance node id to Central Business District (CBD) area.
  16. cbd_exit_node: The exit node id from CBD area.
  17. cbd_entry_time: The time when the person entering the CBD area.
  18. cbd_exit_time: The time when the peson exiting the CBD area.
  19. cbd_travel_time: The travel time of the person travel in the CBD area, unit: hours.
  20. non_cbd_travel_time: The travel time of the person travel outside of CBD area, unit: hours
  21. cbd_distance: The travel distance of the person in the CBD area, unit: meters.
  22. non_cbd_distance: The travel distance of the person outside of CBD area, unit: meters.

traveltime.csv

This output is configured in the output_statistics section of simrun_MidTerm.xml file as follows.
<travel_time file="traveltime.csv"/>
This file contains the travel time for each person for each trip. Travel Time file also includes the waiting time for Public Transit

Currently it includes the following travel modes: ON_BUS, ON_MRT, ON_PBUS (private bus), WALK, WAIT_BUS, WAIT_MRT, ON_SHARINGCAR, ON_TAXI

The format of the CSV that is generated is given below:

  • person_id.
  • trip_origin_id: Trip Starting node id.
  • trip_dest_id: Trip Ending node id.
  • subtrip_origin_id.
  • subtrip_dest_id.
  • subtrip_origin_type: Node/Bus stop/MRT station.
  • subtrip_dest_type: Node/Bus stop/MRT station.
  • travel_mode.
  • arrival_time.
  • travel_time: unit: seconds
  • pt_line: Public transport (Bus/MRT line)

screenLineCount.txt

'A screenline is an imaginary line on a map, composed of one or more straight line segments. Screenline analysis provides a means of comparing the results of a traffic assignment with traffic count data. This is facilitated by comparing the directional (or bi-directional) sum of traffic count volumes across a screenline with the directional (or bi-directional) sum of the assigned traffic volumes across the same screenline and then computing the ratio of the sums, generally the assigned flow sum to the count sum.' (from here)

This output is configured in the output_statistics section of simrun_MidTerm.xml file as follows. <screen_line_count interval="900" file="screenLineCount.txt" enabled="true" />

The format of the CSV that is generated is given below:

  • segment_id.
  • start_time.
  • end_time.
  • mode.
  • vehicle_count: The no. of vehicles which have the same mode passing by the link.

link_travel_time.txt

Gives information on the amount of time a vehicle takes to travel a link. This output is fed back into the simmobility database and used as input in subsequent simulations.

  • LinkId.
  • DownstreamLinkId.
  • StartTime
  • EndTime.
  • TravelTime: The travel time of the link, unit: seconds.

ptstopstats.csv

Gives PT statistics collected for every 5 minute interval of the simulation. This output is meant to be fed back into the supply.pt_stop_stats table to guide the route choices of subsequent withinday+supply simulations.

<pt_stop_stats file="ptstopstats.csv"/>

The format of the CSV that is generated is given below:

  • Interval: index of a 5 min interval in the day. 0 => 12:00 to 12:05 AM; 1 => 12:05 to 12:10 AM; ... 287 => 11:55 PM to 12:00 AM.
  • StopCode: public transit stop code.
  • PT-Line: public transit line id.
  • AverageWaitingTime: Average time a person is expected to wait if he arrives at the corresponding StopCode at the corresponding Interval and wants to board the corresponding PT-Line in that record.
  • AverageDwellTime: Average time a PT vehicle of the corresponding PT-Line dwells at the corresponding StopCode if it arrives at the corresponding Interval in that record.
  • NumPT-Arrivals: The count of PT vehicles of the corresponding PT-Line arriving at the corresponding StopCode at the corresponding Interval in that record
  • NumberofPersonsBoarding: The count of individuals boarding the corresponding PT-Line from the corresponding StopCode at the corresponding Interval in that record.

trip_activities.csv

Gives trips and activities performed by persons in withinday. This output is meant to be part of trip chain input for SimMobility short term along with sub_trips.csv.

<trip_chain_output enabled="true" trip_activities_file="trip_activities.csv" sub_trips_file="sub_trips.csv"/> 

The format of the CSV generated is as below:

  • trip_id
  • person_id
  • trip_start_time
  • activity_start_time
  • activity_end_time
  • origin_type (1: Node, 8: Bus stop, 9: Train stop, 10: Taxi stand)
  • destination_type (1: Node, 8: Bus stop, 9: Train stop, 10: Taxi stand)
  • origin_id
  • destination_id

sub_trips.csv

Gives sub trips performed by the persons in withinday. This output is meant to be part of trip chain input for SimMobility short term along with trip_activities.csv

<trip_chain_output enabled="true" trip_activities_file="trip_activities.csv" sub_trips_file="sub_trips.csv"/> 

The format of the CSV generated is as below:

  • trip_id
  • sequence_num
  • travel_mode
  • pt_line_id
  • cbd_traverse_type (0: Enter CBD, 1: Exit CBD, 2: Pass through CBD, 3: CBD not involved)
  • origin_type (1: Node, 8: Bus stop, 9: Train stop, 10: Taxi stand)
  • destination_type (1: Node, 8: Bus stop, 9: Train stop, 10: Taxi stand)
  • origin_id
  • destination_id

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
current_time time
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

cbd.csv

_Please note currently the file name cbd.csv is hardcoded in the code

When the SimMobility is run with restricted region (check "Running SimMobility" section to know how to configure) this output file is generated to capture the restricted region's entry and exit node.

The below fields will be generated

  • Person_id
  • Trip_origin
  • Trip_destination
  • Restricted_region_start_node
  • Restricted_region_end_node
  • Restricted_region_start_time
  • Restricted_region_end_time
  • travel_mode
  • Traverse_Type (enter only = 0, exit only = 1, Pass = 2)

taxi_trajectory.csv

Output file "taxi_trajectory.csv" will log the taxi status, location and time at every 5 second interval.

The below table will define the Taxi trajectory. The structure of the table is as follows:

column data type explanation
vehicle_id string
driver_id string database driver id
current node id integer current node id showing taxi position
curr_time time logging time
road_segment_id integer segment id of the Taxi's current location
lane_id integer lane id of the Taxi's current location
driver_status string current status(mode) of the drivers
current_occupancy integer no of people currently inside the car
passenger_id string taxi Passenger id

Example:

vehicle_id driver_id Current Node ID curr_time road_segment_id lane_id driver_status (Mode) curr_occupancy passenger_id
SHD3753A 2513243 53 00:01:00 0 0 CRUSING 0 No Passenger
SHA3552D 1589186 92 00:01:10 360 36000 DRIVE_WITH_PASSENGER 1 1334448-1

Note:

  1. The point When any Taxi entered in Simulation, can easily filtered as for that point Segment ID and Lane ID are kept as 0.

  2. Simulation start time for any Taxi can be get from the row when it entered in simulation (from the row for which Segment ID and Lane ID are '0'). Note that this start time is not actually calculated , it is taken from Database.For rest other trajectory point the current time is actually calculated.

3.Currently we have below Driver Status (Mode):

DRIVE_START
CRUISING
DRIVE_TO_TAXISTAND
DRIVE_WITH_PASSENGER
DRIVE_FOR_DRIVER_CHANGE_SHIFT
QUEUING_AT_TAXISTAND
DRIVE_FOR_BREAK
DRIVER_IN_BREAK
DRIVE_ON_CALL
DRIVE_TO_PARK
QUEUED_AT_PARKING
  1. Passenger ID is only reflected for Driver Mode "DRIVE_WITH_PASSENGER". For rest cases ,since there's no Passenger in Taxi. So it will show "No Passenger".
Clone this wiki locally