Skip to content

Step by step guide to run SimMobilityMT

smart-fm edited this page Nov 29, 2018 · 6 revisions

Here are the steps the user should follow to run SimMobilityMT.

Configure and Run SimMobility-MT

  • SimMobility software includes data for a prototypical city which has all the properties of a normal city. More detail about the data you can find here.

  • Road network and all other required data must be pushed in a postgresql database. For more info about the database setup and connection you can find here.

  • The source code must be downloaded from Github master branch and compiled. For more info please check this.

Check the following before you start the run:

  • The code is compiled properly and the SimMobility_Medium executable is present in the /dev/Basic/Release folder
  • simulation.xml, 'simrun_MidTerm.xml, pathset_config.xml files are placed in either dev/Basic/data or dev/Basic/private folder

Step 1: Simulation Settings

In simulation.xml should have the following setting

  • Database Connection
           <database id="fm_hpchead" dbtype="postgres">
                <host value="xx.xx.xx.xx"/> <!-- IP of the server where Database is installed -->
                <port value="xx"/>          <!-- postgresql port -->
                <dbname value="xx"/>        <!-- Name of the database where Virtual City data is stored -->
            </database>


	   <plaintext-credential id="fm_hpchead">
                <username value="xxxxx"/>     <!-- database username -->
                <password value="xxxxx"/>     <!-- password to access the database -->
            </plaintext-credential>
  • Run time
        <!-- Reasonable values for MidTerm -->
        <base_granularity   value="5"   units="seconds"/>  <!-- frame-tick value for MidTerm simulator --> 
        <total_runtime      value="1439"      units="minutes" /> <!-- 1439 minutes indicate 24 hours -->

        <total_warmup       value="10"     units="seconds" />
        <start_time         value="00:00:00"/> <!-- 00:00:00 indicates simulation start time at midnight -->
  • Controller Setting
  <controller 
        id="5" 
        type="7" 
        tripSupportMode = "|SMS|SMS_Pool|Rail_SMS_Pool|Rail_SMS|" 
        vehicleIds="" 
        scheduleComputationPeriod="1" 
        maxFleetSize="500" 
        maxAggregatedRequests="6" 
        studyAreaEnabledController="false" 
        toleratedExtraTime="900" 
        maxWaitingTime = "900" 
        parkingEnabled="true"/>
    <controller                                                                                                                    
        id="4" 
        type="1"                
        tripSupportMode = "|Taxi|" 
        vehicleIds="" 
        scheduleComputationPeriod="1" 
        maxFleetSize="2000" 
        maxAggregatedRequests="1" 
        studyAreaEnabledController="false" 
        toleratedExtraTime="1800" 
        maxWaitingTime = "1800" 
        parkingEnabled="true"/>

</mobilityServiceController>

controller id: Identification of the controller. Please note that this controller id is used in the database for the fleet data and the parking data.

tripSupportMode:What are the modes supported by the controller. So the fleets under the designated controller will serve only these trip modes.

scheduleComputationPeriod:The interval of the controller for computing it's schedule to assign the driver to the request.

maxFleetSize:Fleet table in the database will hold the number of vehicles for each controller id. This configuration will limit the number of vehicles for each controller. Please note that if this number is greater than the database rows of that type of controller then the minimum of the two will be the actual fleet size to be used in the simulation.

maxAggregatedRequests: Maximum number of people sharing a single vehicle

studyAreaEnabledController:SimMobility is capable of running the vehicles under a particular controller with the study area. In this case pre-day need to run with study-area enabled so that all the pickup/drop off demand for that trip mode will be in that area only.

toleratedExtraTime:Maximum accepted delay time for the pickup.

maxWaitingTime:Maximum allowed waiting time by the passenger.

In simrun_MidTerm.xml should have the following setting

Run mode Settings

Since the same XML file provide the run option both pre-day and within-day so it require the specific run mode. Admissible values are "logsum","activityschedule","predayfull", "withinday", "supply", and "midtermfull". Values "withinday" and "supply" runs the same code. Two different values are allowed just for convenience.

 <mid_term_run_mode value="midtermfull"/> 

Please note if midterm full is used then the software will do the following:

  • Run the pre-day logsum mode
  • Run the pre-day simulation mode
  • Insert the activity_schedule.csv in the table specified in simian_MidTerm.xml file
 <!-- table containing activity schedule of each individual in the population. -->
        <activity_schedule_table schema="demand" table="das_VC" procedure="update_das_table" fileName="activity_schedule" vehicleTable="virtual_city.vehicle_map"/>
  • Run the supply mode

If the other modes are specified then only that mode is run. For more info about the different run mode please check here

Stored procedure settings

All the stored procedures is stored in the public schema of the database under Function sub-menu

 <proc_map id="simmobcity" format="aimsun">

One xml file can hold data for multiple networks and each proc_map will indicate the set of stored_procedures used for each set of network

  • Road network

Road network stored procedures will fetch data from the supply schema tables. These stored procedures will provide data for road infrastructure.

            <mapping name="nodes" procedure="get_nodes()"/>
            <mapping name="links" procedure="get_links()"/>
            <mapping name="turning_groups" procedure="get_turning_groups()"/>
            <mapping name="turning_paths" procedure="get_turning_paths()"/>
            <mapping name="turning_polylines" procedure="get_turning_polylines()"/>
            <mapping name="turning_conflicts" procedure="get_turning_conflicts()"/>
            <mapping name="road_segments" procedure="get_road_segments()"/>
            <mapping name="segment_polylines" procedure="get_segment_polylines()"/>
            <mapping name="lanes" procedure="get_lanes()"/>
            <mapping name="lane_polylines" procedure="get_lane_polylines()"/>
            <mapping name="lane_connectors" procedure="get_lane_connectors()"/>
            <mapping name="screen_line" procedure="get_screen_line_segments()"/>
  • Path
    During the simulation when an agent move from origin to destination they need to select path to traverse. SimMobility will pre-compute all node to all node all feasible alternate paths and store them in the database. During simulation run agents will select one particular path based on his/her own characteristics. The following stored procedures will allow users to select public or private paths from the database.
            <mapping name="pvt_pathset" procedure="get_pvt_pathset"/>
            <mapping name="pt_edges" procedure="get_pt_tr_edges()"/>
            <mapping name="pt_vertices" procedure="get_pt_tr_vertices()"/>
            <mapping name="pt_pathset" procedure="get_pt_pathset_tr"/>
  • Bus Supply
    The following stored procedure will provide the bus supply related data e.g. frequency, route, stops etc. If the bus_controller = 'true' then these stored procedures are required.
            <mapping name="bus_stops" procedure="get_bus_stops()"/>
            <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()"/>
            <mapping name="pt_stop_stats" procedure="get_pt_stop_stats()"/>
  • Train supply
    Similarly the following stored procedures will provide the data for train supply related data.
            <mapping name="mrt_road_segments" procedure="get_pt_train_segments()"/>
            <mapping name="rail_transit_edges" procedure="get_rail_transit_edges()"/>
            <mapping name="pt_platform" procedure="get_pt_train_platforms()"/>
            <mapping name="pt_mrt_dispatch_freq" procedure="get_pt_train_dispatch_freq()"/>
            <mapping name="pt_mrt_block" procedure="get_pt_train_blocks()"/>
            <mapping name="pt_mrt_route" procedure="get_pt_train_route()"/>
            <mapping name="pt_mrt_platform" procedure="get_pt_train_route_platform()"/>
            <mapping name="pt_mrt_block_polyline" procedure="get_pt_train_block_polylines()"/>
            <mapping name="pt_opposite_lines" procedure="get_pt_opposite_lines()"/>
            <mapping name="get_train_fleet" procedure="get_train_fleet()"/>
  • Road Pricing
    In many cities (e.g. Singapore) people need to pay when driving some roads. SimMobility offer the capability of storing the road pricing data in the database which will be used for selecting the route. Note: Current VC data doesn't contain any road with electronic pricing scheme
            <mapping name="erp_gantry_zone" procedure="get_erp_gantry_zone()"/>
            <mapping name="erp_gantry_zone" procedure="get_erp_gantry_zone()"/>
            <mapping name="erp_section" procedure="get_erp_section()"/>
            <mapping name="erp_surcharge" procedure="get_erp_surcharge()"/>
  • Restricted Region
    SimMobility has the capability of restricting private vehicle entering a region. This restriction will only work if the following flag is set to true. By default it is false
<region_restriction enabled="false"/>

Please note: if the restriction is enabled then the pvt_pathset must be generated with the restriction enabled. Please check here for more info

            <mapping name="restricted_reg_segments" procedure="get_section_banned_area()"/>
            <mapping name="restricted_reg_in_turning" procedure="get_banned_area_in_turning()"/>
            <mapping name="restricted_reg_out_turning" procedure="get_banned_area_out_turning()"/>
            <mapping name="restricted_reg_nodes" procedure="get_restricted_region_nodes()"/>
  • Demand Setting
    Demand table need to be populated by the activity_schedule generated at the end of the pre-day run. For more information how to populate this table please check here._ This stored procedure must point to the actual demand table.
  <mapping name="day_activity_schedule" procedure="get_persons_between"/> <!-- name of the stored procedure which will point to the DAS table -->
  <mapping name="freight_trips" procedure="get_freight_between"/> <!-- freight trips demand for VC there is no such demand -->

System settings

The following configuration connects the two XML files simulation.xml and simian_MidTerm.xml. Database string and credentials are provided in simulation.xml file and the proc_map is provided in the other XML file. So based on the proc_map it will determine which network to look at and based on the database info it will determine which database it must connect.

        <network_database database="fm_hpchead" credentials="fm_hpchead" proc_map="simmobcity"/>
        <population_database  database="fm_hpchead" credentials="fm_hpchead" proc_map=""/>


Please note:

  • Fleet Supply

If in the simulation.xml file contains one controller (e.g. id=5) then this SP should contain filter that “subscribed_controllers = 5” if it contains two ids then the supply also must contain the fleet for those controllers

  • Trajectory printing
<onCallTaxiTrajectory enabled="false"/>
<onHailTaxiTrajectory enabled="false"/>

This one can be set to ‘true’ if want to print Taxi Trajectory

  • Database connectivity This setting must match with the simulation.xml setting
<network_database database="fm_hpchead" credentials="fm_hpchead" proc_map="singapore_2030"/>
        <population_database  database="fm_hpchead" credentials="fm_hpchead" proc_map=""/>

proc_map value should be same as proc_map_id in the <db_proc_groups>

  • Public Transit Configuration There are configuration related to Public Transit route choice and PT supply.
<public_transit enabled="true"/>

This setting will enable the PT route choice for the agents

<busController enabled="true"/>

Bus supply configuration

<trainController enabled="true"/>

Train supply configuration

Now consider the following:

Case 1:

<public_transit enabled="true"/>
<busController enabled="true"/>
<trainController enabled="true"/>

consequence: If all the above is enabled then people can do route choice for PT and as per their preferred route they can take Bus and Train. Please note currently if certain train line data is not provided then those agents will be teleported from origin train station to destination train station.

Case 2:

<public_transit enabled="false"/>	
<busController enabled="true"/>
<trainController enabled="true"/>

consequence: In the above setting empty bus and trains will run as people are unable to do their route choice

Case 3:

<public_transit enabled="true"/>
<busController enabled="false"/>
<trainController enabled="false"/>

consequence:In the above case people can do the route choice so they will reach to the bus stop or train station but they cannot board in the bus or train as the supply of the bus and train is set to false. So the agents will wait at the bus or train stop until the end of the simulation. So their subsequent trips will also not be simulated.

Case 4:

<public_transit enabled="false"/>
<busController enabled="false"/>
<trainController enabled="false"/>

consequence: Agent’s public transit trips will not be simulated and their subsequent trips even if they are through some other mode.

Step 2: Checking the Setting

At dev/Basic folder run this script: python check_xml.py

This will show you the most important settings

Step 3: Running Simulation

IN Console
Release/SimMobility_Mediuam data/simulation.xml data/simrun_MidTerm.xml

-- The code can be compiled under Debug mode which will print more console messages and also it will go through more internal consistency checks but it will run slower than the Release mode.

Step 4: Checking Simulation Output

**Checking the output Once the job is finished successfully you can quickly analyze the data by the two scripts by the following command

  1. python analyze_within_day.py
  2. ./check_controller.sh

First one will give the overall statistics about the count, travel time, travel distance, waiting time etc.

Second one will give the statistics about the controller performance request received, request served, sharing statistics etc.

Clone this wiki locally