main content

model traffic intersections as a queuing network -凯发k8网页登录

this example shows how to create a simevents® model to represent a vehicle traffic network and to investigate mean waiting time of vehicles when the network is in steady-state.

suppose a vehicle traffic network consists of two vehicle entry and two vehicle exit points, represented by brown and green nodes in the next figure. each blue node in the network represents a route intersection with a traffic light, and the arrows represent the route connections at each intersection. the values next to the arrows represent the percentage of vehicles taking the route in that intersection.

the rate of vehicle entries into the network are represented by the poisson processes with rates 0.5 for entry 1 and 0.15 for entry 2. service rates represent the time vehicles spend at each intersection, which are drawn from exponential distribution with mean 1. the arrow values are the probabilities of choosing a route for vehicles in the intersection.

model traffic network

to represent a vehicle traffic network, this model uses entity generator, entity server, entity queue, entity input switch, entity output switch, and entity terminator blocks.

model = 'queueservertransportationnetwork';
open_system(model);

model vehicle arrivals

the two entity generator blocks represent the network entry points. their entity intergeneration time is set to create a poisson arrival process.

this is the code in the intergeneration time action field of the entry 1 block.

% random number generation
coder.extrinsic('rand');
valentry1 = 1;
valentry1 = rand();
% pattern: exponential distribution
mu = 0.5;
dt = -1/mu * log(1 - valentry1);

in the code, mu is the poisson arrival rate. the coder.extrinsic('rand') is used because there is no unique seed assigned for the randomization. for more information about random number generation in event actions, see . to learn more about extrinsic functions, see .

model vehicle route selection

entities have a route attribute that takes value 1 or 2. the value of the attribute determines the output port from which the entities depart an entity output switch block.

this code in the entry action of the entity server 1 represents the random route selections of vehicles at the intersection represented by node 1.

coin1 = 1;
coder.extrinsic('rand');
coin1 = rand;
if coin1 <= 0.2
    entity.route = 1;
else
    entity.route = 2;
end

this is an example of random route attribute assignments when entities enter the entity server 1 block. the value of route is assigned based on the value of the random variable rand that takes values between 0 and 1. route becomes 1 if rand is less than or equal to 0.2, or 2 if rand is greater than 0.2.

model route intersections

each blue node represents a route intersection and includes an infinite capacity queue, and a server with service time drawn from an exponential distribution with mean 1.

entity server 1 contains this code.

% pattern: exponential distribution
coder.extrinsic('rand');
val1 = 1;
val1 = rand();
mu = 1;
dt = -mu * log(1 - val1);

calculate mean waiting time for vehicles in the network

the network is constructed as an open jackson network that satisfies these conditions.

  • all arriving vehicles can exit the network.

  • vehicle arrivals are represented by poisson process.

  • vehicles depart an intersection as first-in first-out. the wait time in an intersection is exponentially distributed with mean 1.

  • a vehicle departing the intersection either takes an available route or leaves the network.

  • the utilization of each traffic intersection queue is less than 1.

in the steady state, every queue in an open jackson network behaves independently as an m/m/1 queue. the behavior of the network is the product of individual queues in equilibrium distributions. for more information about m/m/1 queues, see m/m/1 queuing system.

the vehicle arrival rate for each node $i$ is calculated using this formula.

$\lambda_i = r_i   \sum_{j=1}^n \theta_{ji} \lambda_j,$

in the formula:

  • $r_i$ is the rate of external arrivals for node $i$.

  • $j=1,\ldots,n$ is the total number of incoming arrows to node $i$.

  • $\theta_{ji}$ is the probability of choosing the node $i$ from node $j$.

  • $\lambda_j$ is the total vehicle arrival rate to node $j$.

for all of the nodes in the network, the equation takes this matrix form.

$\lambda = r(i-\theta)^{-1}$

here, $\theta$ is the routing matrix, and each element represents the probability of transition from node $j$ to node $i$.

for the network investigated here, this is the routing matrix.

$\theta = \left[\begin{array}{cccc} 0 & 0.2 & 0.8 & 0\\ 0 & 0 & 0.7 & 0.3\\ 0 & 0 & 0 & 0.4\\ 0 & 0 & 0 & 0 \end{array}\right]$

$r$ is the vector of external arrivals to each node.

$r = \left[\begin{array}{cccc} 0.5 & 0 & 0 & 0.15 \end{array}\right]$

using these values, the mean arrival rate is calculated for each node.

$\lambda = \left[ \begin{array}{cccc} 0.5 & 0.1 & 0.47 & 0.368 \end{array}\right]$

each node behaves as an independent m/m/1 queue, and the mean waiting time for each node $i$ is calculated by this formula. see m/m/1 queuing system.

$\rho_i=\frac{\lambda_i}{1-\lambda_i}$

mean waiting time for each node is calculated by incorporating each element of $\lambda$.

$\rho = \left[\begin{array}{cccc} 1 & 0.11 & 0.88 & 0.58 \end{array}\right]$

view simulation results

simulate the model and observe that the mean waiting time in each queue in the network matches the calculated theoretical results.

  • the waiting time for the queue in node 1 converges to 1.

  • the waiting time for the queue in node 2 converges to 0.11.

  • the waiting time for the queue in node 3 converges to 0.88.

  • the waiting time for the queue in node 4 converges to 0.58.

references

[1] jackson, james r. operations research vol. 5, no. 4 (aug., 1957), pp 518-521.

网站地图