metrosim/docs/architecture/overview/road_network.rst

190 lines
8.0 KiB
ReStructuredText

Road Network Representation
===========================
In MetroSim, the road network is represented as a standard graph with nodes (representing intersections) and edges (representing roads).
Edges
-----
Input Values
^^^^^^^^^^^^
In MetroSim, each edge must have the following attributes.
source
The starting node of the edge.
target
The arrival node of the edge.
lanes
The number of lanes on the edge.
speed
The base speed (or free-flow speed) of the edge (in kilometers per hour).
length
The length of the edge (in kilometers).
congestion_function
A function that yields the average speed on the road, given the characteristics of the road and the current number of vehicles (see below).
param1, param2, param3
Set of parameters whose meaning depend on the congestion function.
Congestion Function
^^^^^^^^^^^^^^^^^^^
The congestion function gives the travel time of an edge given its characteristics and the history of its flows since the beginning of the simulation.
The following congestion functions are supported.
Free-flow
~~~~~~~~~
The travel time of the edge is not impacted by the flows of vehicles that take it.
.. math::
{tt} = \text{length} / \text{speed}
Basic Bottleneck
~~~~~~~~~~~~~~~~
The speed of the edge follows of speed-flow function which simulates a bottleneck.
.. math::
{tt} = \left\{
\begin{array}{ll}
\text{length} / \text{speed} & \text{if}\ \text{flow} \leq \text{lanes} \cdot s \cdot \text{length} / \text{speed} \\
\text{flow} / (\text{lanes} \cdot s) & \text{otherwise}
\end{array}
\right.
where :math:`\text{flow}` is the current number of vehicles on the edge and :math:`s` (= param1) is the capacity of the edge in number of vehicles per kilometer per lane per hour.
Bureau of Public Roads Function
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To be done.
True Bottleneck with Vertical Queue
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The travel time on the edge depends on the parameter :math:`s` (= param1) which represents the capacity of the edge in number of vehicles per lane per hour.
The vehicles run at free-flow speed until the end of the edge where they form a vertical queue.
Every :math:`3600 / (\text{lanes} \cdot s)` seconds, the first vehicle in the queue can leave the edge.
True Bottleneck with Horizontal Queue
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To be done.
Dynamic Attributes
^^^^^^^^^^^^^^^^^^
Each edge has a dynamic attribute to keep track of the current number of vehicles on the edge.
This attribute is updated every time a vehicle enters or exists the edge.
Also, for each edge, the average number of vehicles on the edge and the average travel time is computed, at regular recording intervals.
Consider recording interval :math:`T = [\underline{t}, \overline{t}]`.
Denote by :math:`\{t_1, t_2, \dots, t_m\}` the times at which an event occurred for the edge and denote by :math:`\{n_1, n_2, \dots, n_m\}` the number of vehicles on the edge that resulted from the event (with :math:`n_0` the number of vehicles before the first event).
Then, the average number of vehicles on the edge :math:`\bar{n}_T`, for recording interval :math:`T`, is computed as the following weighted average:
.. math::
\bar{n}_T = \frac{
n_0 \cdot (t_1 - \underline{t}) + n_1 \cdot (t_2 - t_1) + \cdots + n_{m-1} \cdot (t_m - t_{m-1}) + n_m \cdot (\overline{t} - t_m)
}{
\overline{t} - \underline{t}
}
The average travel time :math:`\bar{tt}_T` is computed from the congestion function of the edge, assuming that the number of vehicles is equal to the average :math:`\bar{n}_T`.
.. note::
The average number of vehicles :math:`\bar{n}_T` can be computed dynamically, by updating the value each time an event occurs.
The average travel times are then used by the day-to-day model to computed historical travel times.
Both the average number of vehicles and average travel times are output of the simulator.
Nodes
-----
Input Values
^^^^^^^^^^^^
In MetroSim, each node must have the following attributes.
x, y
Coordinates of the node.
priority_function
A function that yields the time taken to cross the intersection, in any direction, given the queue of vehicles at the intersection.
Priority Function (Work-in-Progress)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The priority function is called in two situations:
1. A new vehicle enters the node.
2. An event *EdgePriority* is triggered for the current edge.
In both situations, the function takes as argument the current time and the current state of the edge (the queue of vehicles for each direction and some optional values such as the state of traffic lights).
In the first situation, the function also takes as argument the vehicle entering the node, as well as its upstream edge and its downstream edge.
The function returns a list of *VehicleExitsEdge* events, indicating that a given vehicle exits the edge at a given time, and an optional *EdgePriority* event, indicating when the function must be called again.
.. note:: **Example 1: Exogenous Turn Penalties**
In case of exogenous turn penalties, each vehicle reaching the node from upstream edge :math:`e_{in}` and going toward downstream edge :math:`e_{out}` incurs a time penalty of :math:`p(e_{in}, e_{out})` seconds.
Then, when a new vehicle enters the node, the priority function is called and returns a *VehicleExitsEdge* event that will trigger in :math:`p(e_{in}, e_{out})` seconds from now.
The priority function never returns a *EdgePriority* event and, thus, it is only called when a vehicle enters the node.
.. note:: **Example 2: Traffic Lights**
At any given time, the state of the edge contains:
- The queue of vehicles waiting at the edge, for each upstream and downstream edges.
- The state of the lights (which light is green).
When an event *EdgePriority* is triggerd, the priority function is called and the following happen:
- The lights are switched to the next state.
- For any upstream and downstream edges with green ligths and with a non-null queue, *VehicleExitsEdge* events are created to let the vehicles pass, in the order of the queue, with a correct timing (e.g., one vehicle every two seconds) and the vehicles are removed from the queue.
- If a queue gets empty, the exit time of the last vehicle is recorded, so that if any vehicle arrive while the lights are still green, the priority function can compute its exit time.
- An *EdgePriority* event is created at the time when the lights are expected to switch again.
When a vehicle enters the node, the priority function is called and two different cases can occur:
- If the lights are green and the queue is empty for the upstream and downstream edges of the vehicle, then the vehicle can pass and a *VehicleExitsEdge* event is created with the correct timing (accounting for potential vehicles currently crossing the node).
- Otherwise, the vehicle is added to the queue of vehicles waiting at the edge, for the given upstream and downstream edges.
In the route choice model, the crossing time of the node, from a given upstream edge to a subset of its downstream edges, is used to choose the actual downstream edge chosen.
By default, the historical crossing times are used but convergence could be faster if the priority function can return predicted crossing times, given the current state of the node.
Dynamic Attributes
^^^^^^^^^^^^^^^^^^
When a vehicle exits an edge, the exit time is compared with its entry time to compute the crossing time of the edge.
Then, for each recording interval, the crossing times of all vehicles who *entered* the edge in this interval are averaged.
These crossing times are then used when computing the historical crossing times in the day-to-day model (needed for predicted travel times).
.. note:: This actually needs to be done only if crossing time is endogenous.
The number of vehicles who crossed the edge, for each upstream and downstream edges, is also computed, for each recording interval.
Both crossing times and number of vehicles are an output on the simulator.
Vehicle Types
-------------
TO BE DISCUSSED