Mixed traffic

In order to simulate the multiple vehicle (mode) types on the network, minimally one need to:

These steps are for the releases and nightly builds after 0.8.x. For earlier versions, see bottom of the page.

  • set the allowed modes for each link in the network file
  • set the leg mode for each trip in the plans file
  • set the available vehicle types (for e.g. car, bicycle) 
  • inform mobility simulation (currently only for "qsim") about main modes, and link dynamics (for e.g. FIFO, PassingQ...)
  • inform the router about network modes
  • set the scoring (utility) parameters 

In the following, these are further explained. 


Network

A list of available (allowed) modes for each link can be set as follows. The list of allowed modes could be different for different links. 

...
  <link id="1" from="1" to="2" length="10000.00" capacity="36000" freespeed="27.78" permlanes="1" modes="car,bicycle" />
<link id="2" from="2" to="3" length="10000.00" capacity="3600" freespeed="27.78" permlanes="1" modes="car,bicycle" />
...

Plans

Assign a leg mode between each pair of activities. Different modes can be set for different trips of a person.

...
<person id="1">
<plan>
<act type="h" x="-25000" y="0" link="1" end_time="06:00" />
<leg mode="car"> </leg>
<act type="w" x="10000" y="0" link="20" dur="00:10" />
<leg mode="car"> </leg>
<act type="h" x="-25000" y="0" link="1" />
</plan>
</person>

<person id="6">
<plan>
<act type="h" x="-25000" y="0" link="1" end_time="06:00" />
<leg mode="bicycle"> </leg>
<act type="w" x="10000" y="0" link="20" dur="00:30" />
<leg mode="bicycle"> </leg>
<act type="h" x="-25000" y="0" link="1" />
</plan>
</person>
...

Vehicles

This is an additional file required for mixed traffic conditions. Minimally, maximum speed and passenger car equivalents (PCE) of a vehicle are required. These are stored as vehicle type in the vehicles.xml file. Depending on the vehicle source, additional information is required. 

If vehicle source in the config is set to

  <param name="vehiclesSource" value="modeVehicleTypesFromVehiclesData" />

only vehicle type information is enough.

...
<vehicleType id="car">
  <maximumVelocity meterPerSecond="16.67"/>
  <passengerCarEquivalents pce="1.0"/>
  ...
 </vehicleType>
 
<vehicleType id="bicycle">
  <maximumVelocity meterPerSecond="4.17"/>
  <passengerCarEquivalents pce="0.25"/>
  ...
 </vehicleType>

However, if vehicle source in the config is set to 

<param name="vehiclesSource" value="fromVehiclesData" />

vehicle information is also required. For example ...

...
<vehicle id="1" type="car"/>
...
<vehicle id="6" type="bicycle"/>
...



Configuration

For the mixed traffic conditions, the mobility simulation (currently only for "qsim") needs to be informed about the main modes, source of vehicles (defaultVehicle, modeVehicleTypesFromVehiclesData, fromVehiclesData), link dynamics (FIFO, PassingQ, SeepageQ) and traffic dynamics (queue, withHoles, kinematicWaves) etc.

<module name="qsim">
   ...
  <param name="vehiclesSource" value="modeVehicleTypesFromVehiclesData" />
  <param name="mainMode" value="car,bicycle" />
  <param name="linkDynamics" value="PassingQ" />
  <param name="trafficDynamics" value="queue" />
</module>

 Main modes are physically simulated on the network, thus router needs to be informed about these modes as follows. 

<module name="planscalcroute" >
   ...
  <param name="networkModes" value="car,bicycle" />
</module>


Also, state, for all main modes, a travel time calculator should be created which will be further used to get the travel dis-utilities.

<module name="travelTimeCalculator" >
     <param name="analyzedModes" value="car,bicycle" />
     <param name="separateModes" value="true" />
</module>


To calculate the dis-utility for the stated mode, the utility parameters should be set, i.e.

<module name="planCalcScore">    
   <parameterset type="modeParams" >
     <param name="constant" value="0.0" />
     <param name="marginalUtilityOfDistance_util_m" value="0.0" />
     <param name="marginalUtilityOfTraveling_util_hr" value="-6.0" />
     <param name="mode" value="bicycle" />
      <param name="monetaryDistanceRate" value="0.0" />
   </parameterset>
</module>

For illustration, minimal inputs files for "equil-network" are created, which are available matsim/examples/scenarios/equil-mixedTraffic.


See the following steps, for the 0.8.x release



  • network – same as above
  • plans – same as above
  • vehicles – in the 0.8.x release, for mixed traffic, only
       <param name="vehiclesSource" value="fromVehiclesData" />

           is supported. Therefore, vehicle type as well as vehicle information is required in the vehicles.xml file (as described above).

  • Configuration 

    <module name="qsim">
       ...
      <param name="vehiclesSource" value="fromVehiclesData" />
      <param name="mainMode" value="car,bicycle" />
      <param name="linkDynamics" value="PassingQ" />
      <param name="trafficDynamics" value="queue" />
    </module>

     Main modes are physically simulated on the network, thus router needs to be informed about these modes as follows. 

    <module name="planscalcroute" >
       ...
      <param name="networkModes" value="car,bicycle" />
    </module>

    To calculate the dis-utility for the stated mode, the utility parameters should be set, i.e.

    <module name="planCalcScore">    
       <parameterset type="modeParams" >
         <param name="constant" value="0.0" />
         <param name="marginalUtilityOfDistance_util_m" value="0.0" />
         <param name="marginalUtilityOfTraveling_util_hr" value="-6.0" />
         <param name="mode" value="bicycle" />
          <param name="monetaryDistanceRate" value="0.0" />
       </parameterset>
    </module>


  • In addition to the above, network router needs a travel time and travel disutility calculator for all network modes other than car. This can be set as follows. One can set own travel time calculator and travel disutility factors.
    ...
    controler.addOverridingModule(new AbstractModule() {
     @Override
     public void install() {
     addTravelTimeBinding("bicycle").to(networkTravelTime());
     addTravelDisutilityFactoryBinding("bicycle").to(carTravelDisutilityFactoryKey());
     }
    });

The requirement of travel time and travel disutility calculators for modes other than car is made configurable in the later releases.  See  MATSIM-585 - Getting issue details... STATUS  for possible progress on this.