First approach -- track motion of each car
Let
be the location of the j'th car at time t, measured in
miles along the road, say.
The primary assumption that allows us to track the motion of the cars is
that the velocity of the j'th car depends on the distance between
this car and the next. In other words, drivers adjust their speed
depending on how crowded the road is just in front of them. The distance
to the next car is
.
The velocity of the j'th car depends on
in some way, but it is
more usual to re-express it in terms of the density of traffic, which
might be measured in cars/mile. The symbol
is usually used for
density, and can vary between
(empty road) and
where
L is the length of a car (in miles!) so that
corresponds to
bumper-to-bumper traffic.
Then the density seen by the j'th driver is
Now we will suppose the velocity of traffic is given by some function of the
density,
is the velocity in miles/hour. A simple example might be
the linear relation shown below. The velocity is 0 when
(bumper-to-bumper) and increases to some maximum value, say 55 miles/hour,
as the density decreases.
The motion of the j'th car is then determined by a differential equation,
This can be approximated by taking discrete time steps of length
and moving each car a little bit over each time step based on the density
seen at the corresponding time. Let
denote the approximate
location of the j'th car at time
. Then we can update the
car positions by
where the density seen by the j'th car at time
is
.
This is the approach used to generate the animation seen on the web page.
Second approach -- A finite volume method for density
In modeling the flow of air it is not possible to keep track of how every
molecule moves, since there are on the order of
molecules in
any region of interest. The approach usually used is to split the region up
into small pieces (finite volumes) and keep track of the density in each
region.
In the case of traffic flow, this amounts to subdividing the highway into short stretches of highway as indicated below:
Each stretch (grid cell) has length
(in miles) and if
is an estimate of the density in the i'th cell at time
(in cars/mile),
then the number of cars in the i'th cell is roughly
.
How many cars will be on this stretch of highway at time
? Assuming
cars don't vanish or appear spontaneously, the number will change only becuase
of cars entering the cell at
or leaving at
. The flow of
cars past a given point per unit time is called the flux of cars.
This can be computed as the product of the density (cars/mile) times the
speed (miles/hour) giving a flux in cars/hour:
The flux of cars passing the point
is approximately
based on the density in the cell to the left, from which cars
are arriving at
.
Over a short time period
, the number of cars passing
will be
approximately
, so the total number of cars in this cell at time
can be approximated by
This gives a formula for updating the density:
In computing this, we use the relation
to calculate the velocity
based on the density in each cell, e.g.,
.
Note that we can rewrite this formula as
If we let
and
go to zero, this suggests a partial
differential equation:
Partial differential equations of this sort are the basic tool for studying fluid dynamics.
Here's how the density evolves with this sort of finite volume method.
(Actually a more complicated method is used which gives ``sharper'' results.)
Each circle
represents one value
. In this calculation there were 100 cells.
Here the density function was rescaled so that
corresponds to
bumper-to-bumper traffic, i.e., the density is measured in ``cars per car
length''.
Can you figure out how cars are moving from these density plots?