Skip to content

5.3 AuxiliaryFunctions

smart-fm edited this page Nov 9, 2018 · 8 revisions

A set of auxiliary functions (or sub-functions) that are called by the above main acceleration regimes are detailed.

1. Emergency deceleration

If the current headway is less than a lower threshold, the emergency deceleration regime is triggered. In the emergency regime, drivers apply the minimum of the deceleration necessary to avoid collisions with the leader and at a "normal" deceleration. The normal deceleration depends on the speed of the vehicle. It is computed by the function accOfEmergencyDecelerating as:


Flow chart for accOfEmergencyDecelerating


The dec_norm is a value drawn from a distribution with mean and standard deviation specified inside the XML file (See Section 5.4).


2. CF - Car-following rate

In SimMobility, it is hypothesized that the expected value of the acceleration distribution is greater than zero when the relative speed is positive, the model corresponding to a positive relative speed is called the car-following model. Similarly, the model corresponding to a negative relative speed is called the car-following deceleration model. The acceleration or deceleration applied by driver n at time t is proportional to the stimulus, a function of the front relative speed dV at time (t-tau_n). The reaction time, tau_n, varies from driver to driver, and therefore, is modeled as a random variable. Furthermore, Ahmed extended the GM Model by allowing different sets of parameters for the car-following acceleration and deceleration sensitivities, by incorporating the density of traffic as explanatory variable into the sensitivity term, and by allowing the time at which the explanatory variables are observed to be a parameter to be estimated. The function accOfCarFollowing calculates the acceleration and deceleration rates for the car-following (CF) regime and assumes the following formula:


The above equation assumes different parameters for the acceleration (V<V_lead) and deceleration (V>V_lead) scenarios. The different parameters are specified in the XML configuration file (See Section 5.4).

3. FF - Free flow acceleration rate

When the headway is greater than the threshold, the driver has the freedom to attain its desired speed. The function accOfFreeFlowing calculates the acceleration rate for the free-flow regime. The resulting acceleration can be either 0, the normal deceleration, or the maximum acceleration. Both the normal deceleration and maximum acceleration are random parameters calculated at each drivers decision time step. It also accounts for the subject vehicle speed V, its target speed Vdesired and a buffer sensibility term epsilon.


Flow chart for accOfFreeFlowing

The desired speed of a driver is defined as the speed the driver wants to maintain after considering the speed limit of the section it is traveling, vehicle's mechanical capability, the effect of surrounding traffic, the roadway and weather conditions, and the geometry of the roadway section.

The desired speed is defined by targetSpeed, defined by the function calcDesiredSpeed which depends on the free flow speed, speed limit sign and driver's behavior. calcDesiredSpeed is given by:


The epsilon_speedLimit represents the drivers heterogenety in regarding the speed limit, and is drawn from a normal distribution with zero mean and a predefined variance specified in the XML configuration file.

maxSegmentSpeed is a function that accounts for the segment and lane design characteristics, such as grade and the type of vehicle. If the desired speed is higher than the current speed, drivers are expected to accelerate and vice versa. The magnitude of the applied acceleration depends on the difference between the current and the desired speeds. The free-flow acceleration is computed as:


Furthermore, even if the desired speed is higher than the current speed, the free-flow acceleration function is only active above a beta_0 speed threshold, typically to avoid free-flow states with very slow speeds. The normalDeceleration and epsilon_ff are drawn from the distribution specified in the XML configuration file.

4. FF-CF Mixed acceleration

The function accOfMixOfCFandFF calculates the acceleration rate when there is a vehicle ahead. but the headway is larger than the headway upper threshold. This function may generate two different outcomes: accOfFreeFlowing if the distance to the leading vehicle is greater than distanceToNormalStop; or breakToTargetSpeed otherwise. accOfMixOfCFandFF brings an additional condition checking to the headway threshold upper bound verification. The function distanceToNormalStop computes the distance required to stop a vehicle circulating at a specific speed.


Flow chart for distanceToNormalStop

Three fixed parameters are specified within this function: minSpeed and minResponseDistance are parameters specified in the XML configuration file and DOUBLE_EPSILON is a fixed parameter equal to 0.001. dec_norm is a value drawn from a distribution specified in the XML configuration file. _distance1_can be obtained by the following equation:


5. Merging area check

A merging area is defined when two lanes merge into one, comprising a pre-defined length of both upstream and downstream areas from the defined merging point. It is characterized by the following parameters:

  • upstream area (m)
  • downstream area (m)
  • number of vehicles allowed
  • probability of aggressive merge from ramp

These parameters are constant and should be defined in the config_parameters XML file. The isInMergingArea function checks if a vehicle is within a merging area.


Merging area

"The downstream area is also characterized by the maximum number of vehicles allowed in. An upstream merging area vehicle (i.e. vehicles D or E) is tagged as a merging vehicle if it has yet to be tagged and the number of downstream merging area vehicles have not reached the maximum. All vehicles in the downstream merging area (i.e., vehicles B and C) are tagged as merging vehicles. The acceleration rates for merging vehicles is calculated by relaxing the car-following constraint (negative gap from immediate leading vehicle is allowed) and incorporating a merging constraint (no overtaking is allowed). Vehicles are untagged when they leave the merging area, and the merging constraints are then relaxed".


Flow chart for isInMergingArea

This function uses a flag variable FLAG_MERGING that is then unset by the function calcCarFollowingRate (see Section 6).

6. Check for front vehicle constraint in merging areas

If a vehicle is in a merging area, but under the constraint of the front vehicle, the driver may not be able to apply to the merging acceleration but has to implement car-following regime. This task is implemented in the calcCarFollowingRate function.


Flow chart for calcCarFollowingRate

As in MITSIMLab, in the merging area, vehicles are allowed to overlap. This is a temporary fix to overcome the limitation of discrete lane representation.

7. Deceleration to Stop

The sub-function brakeToStop calculates the deceleration rate when a vehicle wants to stop in a specified distance. It is used by several of the already specified functions.


Flow chart for breakeToStop


In which,


V is the speed of the subject vehicle, dt is the simulation time step, dis is the distance to stop and input of this sub-function and dec_norm is a parameter defined in the XML configuration file (see Section 5.4)

8. Deceleration to Target Speed

The function breakToTargetSpeed calculates the deceleration rate when a vehicle driving at speed V wants to reach a specific speed (v_target) in a specific distance (dx_target). It is used by the accOfEmergencyDecelerating and accOfMixOfCFandFF.


Flow chart for breakToTargetSpeed



where _dt_ is the simulation time step (elapsed time) and epsilon is a C++ small constant.

9. Acceleration to create gaps

The calcCreateGapRate function calculates the maximum acceleration rate subject to the gap from the leading vehicle. It is called by calcYieldingRate when the subject vehicle is already nosing.


Flow chart for calcCreateGapRate


Clone this wiki locally