Traffic Flow Modeling ===================== We derive the continuity equation to study traffic flow and explore the Greenshields model to relate flow, speed and concentration. Counting Cars ------------- On two measure points (e.g., one mile apart), we count cars, as shown in :numref:`figCountingCars`. .. _figCountingCars: .. figure:: ./figCountingCars.png :align: center Counting cars between two measure points. In :numref:`figCountingCars`: * :math:`N_1` is the number of cars counted at point 1, * :math:`N_2` is the number of cars counted at point 2. Denote :math:`\Delta N = N_2 - N_1`. The direction of traffic moves from 1 to 2. If :math:`\Delta N < 0`, then :math:`N_2 < N_1`, and there more cars at 1 than at 2, which means that the :index:`concentration of cars` between 1 and 2 increases. Let :math:`q` be the number of cars per time unit :math:`\Delta t`. .. math:: \begin{array}{rcl} q_2 & = & N_2/\Delta t \\ - q_1 & = & N_1/\Delta t \\ \hline \Delta q & = & \Delta N/\Delta t \end{array} We have :math:`\Delta N = \Delta q \Delta t`. As :math:`\Delta t > 0`, :math:`\Delta q` has the same sign as :math:`\Delta N`. If :math:`\Delta N < 0`, when the concentration of cars increases, then :math:`\Delta q < 0` and the :index:`flow of cars` decreases. Let :math:`k` be the number of cars per unit length :math:`\Delta x`. .. math:: \begin{array}{rcl} k_1 & = & N_1/\Delta x \\ - k_2 & = & N_2/\Delta x \\ \hline \Delta k & = & (-\Delta N)/\Delta x \end{array} If :math:`\Delta N < 0`, then the flow of cars decreases and the concentration increases, as :math:`\Delta N < 0` implies :math:`\Delta k > 0`. If there is no exit nor entry between the measure points 1 and 2, then we have *continuity* and .. math:: \begin{array}{rcl} \Delta N & = & \hphantom{-} \Delta q \Delta t, \\ \Delta N & = & - \Delta k \Delta x. \end{array} Eliminating :math:`\Delta N` leads to :math:`\Delta q \Delta N = - \Delta k \Delta x`, or equivalently: .. math:: \frac{\Delta q}{\Delta x} + \frac{\Delta k}{\Delta t} = 0. Taking limits as :math:`\Delta x \rightarrow 0` and :math:`\Delta t \rightarrow 0`, we have the *continuity equation* .. math:: \frac{\partial q}{\partial x}(x, t) + \frac{\partial k}{\partial t}(x, t) = 0. Adding the change in flow to the change in concentration equals zero. Speed, Flow, and Concentration ------------------------------ We introduce the Greenshields model. Observe the units: * The units of concentration :math:`k` are the number of cars per mile. * The units of speed :math:`v` are the number of miles per hour. .. _figGreenshieldsSpeedConcentration: .. figure:: ./figGreenshieldsSpeedConcentration.png :align: center Speed in function of concentration. In the :index:`Greenshields model`, as shown in :numref:`figGreenshieldsSpeedConcentration`, the speed depends on the concentration. * :math:`v_f` is the *free traffic speed*, when the road is free. * :math:`k_j` is the *jam density*, :math:`v=0` at a traffic jam. .. index:: free traffic speed, jam density We can flip the axes in :numref:`figGreenshieldsSpeedConcentration` and express concentration in function of speed: .. math:: v(k) = v_f \left( 1 - \frac{k}{k_j} \right) = v_f \left( \frac{k_j - k}{k_j} \right) \quad \Rightarrow \quad \begin{array}{l} k_j v = v_f ( k_j - k) \\ k_j v - v_f k_j = - k v_f \end{array} .. _figGreenshieldsConcentrationSpeed: .. figure:: ./figGreenshieldsConcentrationSpeed.png :align: center Concentration in function of speed. In the Greenshields model, as shown in :numref:`figGreenshieldsConcentrationSpeed`, the concentration depends on the speed. * If :math:`v = 0`, then traffic is jammed and :math:`k = k_j`. * If :math:`v = v_f`, then there is no traffic and :math:`k = 0`. While :math:`v_f` can be set to the speed limit, the jam density :math:`k_j` is the intercept of a least squares fit, as shown in :numref:`figGreenshieldsObserved`. .. _figGreenshieldsObserved: .. figure:: ./figGreenshieldsObserved.png :align: center The solid red dots represent observed data points. Now let us express flow as a function of concentration. Speed :math:`v` and concentration :math:`k` are linearly correlated. Flow :math:`q` is expressed in the number of cars per hour. Observe the following: * If :math:`k = 0` (no cars per mile), then no cars per hour, :math:`q = 0`. * If :math:`k = k_j` (traffic is jammed), then no speed and no flow either. * The maximum flow occurs for some :math:`k` in between zero and :math:`k_j`. Flow and concentration can thus not be correlated linearly. Therefore, let us use a concave down parabola. .. _figGreenshieldsFlowConcentration: .. figure:: ./figGreenshieldsFlowConcentration.png :align: center Flow in function of concentration. A parabolic model for flow, shown :numref:`figGreenshieldsFlowConcentration`, as function of concentration is: .. math:: q(k) = a_2 k^2 + a_1 k + a_0 Observe the following: 1. :math:`q(0) = 0 \Rightarrow a_0 = 0`, 2. :math:`q'(k) = 2 a_2 k + a_1 \Rightarrow a_1 = q'(0)`, 3. :math:`q''(k) = 2 a_2 < 0`, concave down. Where is :math:`v_f`? Look at :numref:`figGreenshieldsFlowConcentration`. There is no flow at the traffic jam: .. math:: q(k) = a_2 k^2 + q'(0) k = k \left( \vphantom{\frac{1}{2}} a_2 k + q'(0) \right) There is no flow at the traffic jam concentration, at :math:`k = k_j`: .. math:: q(k_j) = \underbrace{k_j}_{\not= 0} \left( \vphantom{\frac{1}{2}} a_2 k_j + q'(0) \right) \quad \Rightarrow \quad a_2 = -\frac{q'(0)}{k_j}. We have thus the parabolic model for flow in function of concentration: .. math:: q(k) = k \left( \vphantom{\frac{1}{2}} - \frac{q'(0)}{k_j} k + q'(0) \right) = q'(0) k \left( \vphantom{\frac{1}{2}} 1 - \frac{k}{k_j} \right). By the continuity equation, .. math:: \frac{\Delta q}{\Delta x} + \frac{\Delta k}{\Delta t} = 0 \quad \Rightarrow \quad q(k) = v_f k \left( \vphantom{\frac{1}{2}} 1 - \frac{k}{k_j} \right). Because speed and concentration are linearly correlated as .. math:: k(v) = k_j \left( 1 - \frac{v}{v_f} \right) \quad \Rightarrow \quad q(v) = k_j v \left( \vphantom{\frac{1}{2}} 1 - \frac{v}{v_f} \right). In :numref:`figGreenshieldsFlowSpeed` we see this relation. .. _figGreenshieldsFlowSpeed: .. figure:: ./figGreenshieldsFlowSpeed.png :align: center Flow in function of speed. A three dimensional model is shown in :numref:`figGreenshieldsSpeedFlowConcentration`. .. _figGreenshieldsSpeedFlowConcentration: .. figure:: ./figGreenshieldsSpeedFlowConcentration.png :align: center Figure 4.1 in *Traffic Flow Theory* by D. L. Gerlough and M. J. Huber. Accelerating Traffic Flow ------------------------- The model relates speed :math:`v` to flow :math:`q` and concentration :math:`k` as .. math:: v = \frac{q}{k} \quad \mbox{with units} \quad \frac{\mbox{number of cars per hour}}{\mbox{number of cars per mile}} = \frac{mile}{hour}. If in the continuity equation .. math:: \frac{\partial q}{\partial x} + \frac{\partial k}{\partial t} = 0 we replace :math:`q` by :math:`k` times :math:`v`: .. math:: v \frac{\partial k}{\partial x} + \frac{\partial k}{\partial t} = 0, then we obtain the transport equation with solution .. math:: k(x,t) = f(x - v t), \quad \mbox{where $f$ is the density profile at } t = 0. For some constant :math:`C`, :math:`x - v t = C` defines a *characteristic curve*, shown in :numref:`figCharacteristicCurves` .. _figCharacteristicCurves: .. figure:: ./figCharacteristicCurves.png :align: center Characteristic curves. Characteristic curves can be applied to model an accelerating platoon of cars. Consider a sequence of cars. * At :math:`t = t_0`, the spacing between all cars is the same. * At :math:`t > t_0`, the lead car accelerates. .. _figPlatoonCars: .. figure:: ./figPlatoonCars.png :align: center Characteric curves of a platoon of cars. In :numref:`figPlatoonCars`, at the horizontal cross sections, we see the position of each car. Observe that no two lines meet so we have no collisions. With characteric curves, we can model what happens when a fast moving car meets a slow moving truck, as shown in :numref:`figShockWave`. .. _figShockWave: .. figure:: ./figShockWave.png :align: center A fast care meets a slow moving truck. To model moving cars when stop light flips from red to green, we consider the transport equation with diffusion: .. math:: v \frac{\partial k}{\partial x} + \frac{\partial k}{\partial t} = v \alpha^2 \frac{\partial^2 k}{\partial x^2} which has a traveling concentration profile as solution, shown in :numref:`figConcentrationTrafficLight`. .. _figConcentrationTrafficLight: .. figure:: ./figConcentrationTrafficLight.png :align: center Concentration profile of cars released at a traffic light. Observe in :numref:`figConcentrationTrafficLight`: 1. :math:`k_1(t)` is the concentration at the red light, 2. :math:`k_2(t)` is the concentration at the green light, 3. :math:`k_3(t)` is the concentration after the green light. Proposal for a Topic of a Project --------------------------------- The models are experimentally verified via least squares. Apply least squares fitting on observed traffic data. Do the following: * Collect data from an real highway. * Fit the data for :math:`k(v)` and :math:`q(v)`. * Examine how realistic the models are. In particular, can your model * constructed with the data from one day, * predict the traffic of the next day? Exercises --------- 1. Let :math:`\Delta x` be one mile and :math:`\Delta t` be one hour. Consider the equation .. math:: \frac{\Delta q}{\Delta x} + \frac{\Delta k}{\Delta t} = 0. Verify that both terms in the equation have the same units, so the addition makes sense. 2. Let :math:`\Delta x` be one mile and :math:`\Delta t` be one hour. Consider the :math:`\Rightarrow` in the equation .. math:: \frac{\Delta q}{\Delta x} + \frac{\Delta k}{\Delta t} = 0 \quad \Rightarrow \quad q(k) = v_f k \left( \vphantom{\frac{1}{2}} 1 - \frac{k}{k_j} \right). Use the units to verify that the slope of the traffic flow equals indeed the free traffic speed at zero concentration. .. _figSpeedFlow: .. figure:: ./figSpeedFlow.png :align: center Speed in function of flow. 3. Consider :numref:`figSpeedFlow`. 1. Compute the formula for :math:`v(q)`. 2. Write a paragraph to explain the picture. 4. Write one paragraph to interpret the picture in :numref:`figShockWave`. Bibliography ------------ 1. Daniel L. Gerlough and Matthew J. Huber: *Traffic Flow Theory. A Monograph*. Transportation Research Board Special Report 165, 1975. 2. Richard Haberman, chapter 12 on characteristic curves of *Applied Partial Differential Equations with Fourier Series and Boundary Value Problems*. Pearson, 2013. 3. Charles R. MacCluer, section 11.6 of *Industrial Mathematics. Modeling in Industry, Science, and Government*, Prentice Hall, 2000.