Imm 7040
Imm 7040
B ACHELOR T HESIS
Author: Supervisor:
Rasmus Alkestrup Christian D. Jensen
Eskesen (s133997) ,
Jacob Thinglev Grundahl
(s133994)
-
Department of Applied Mathematics and Computer Science
Abstract
Contents
Abstract i
1 Introduction 1
1.1 Project Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Project Description . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Project Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Report Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Analysis 7
3.1 System overview and overall description . . . . . . . . . . . . 7
3.2 Product perspective and user characteristics . . . . . . . . . . 10
3.3 Use Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3.1 Turning right in a quad-directional traffic light with
specific turning-lanes and signals . . . . . . . . . . . . . 11
3.3.2 Turning left in a tri-directional traffic light (T-junction)
with specific turning-lanes and signals . . . . . . . . . 13
3.3.3 Traversing straight through a network of two traffic lights 15
3.4 Traffic Simulation Model . . . . . . . . . . . . . . . . . . . . . . 17
3.5 Traffic Control Algorithm . . . . . . . . . . . . . . . . . . . . . 18
3.5.1 Scheduling (computing) . . . . . . . . . . . . . . . . . . 20
3.6 Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.6.1 System architecture . . . . . . . . . . . . . . . . . . . . . 24
3.6.2 Communication . . . . . . . . . . . . . . . . . . . . . . . 29
3.7 Specific requirements . . . . . . . . . . . . . . . . . . . . . . . . 33
3.7.1 Functionality . . . . . . . . . . . . . . . . . . . . . . . . 33
3.7.2 Usability . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.7.3 Reliability . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.7.4 Performance . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.7.5 Supportability . . . . . . . . . . . . . . . . . . . . . . . . 34
5 Evaluation 40
5.1 Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.1.1 Test 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.1.2 Test 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.1.3 Test 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.1.4 Test 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.2 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.3 Potential Project Extensions . . . . . . . . . . . . . . . . . . . . 47
6 Conclusion 50
7 References 51
8 Appendix 52
B - Probability calculations 54
1 Introduction
To give a proper introduction to this project, we are first going to answer the
following questions:
The project motivation is going to seek to answer why we are doing this,
where the project description attempts to answer what we are actually doing,
and finally the project scope should give an idea of how this is going to be
done.
If you have ever stopped at a red light on a completely empty road, you
probably know that it can be quite frustrating, since you might have to wait
patiently until the light turns green for your lane, even though there are no
other cars around, but depending on what type of vehicle you are driving
as well as the kind of traffic light you are waiting at, it might not actually
know you are there. Some traffic lights have fixed timers, whereas others use
sensors to pinpoint where you are.
While many traffic lights still use the fixed timers to control the flow of
traffic, methods such as the so-called green wave has proven to be somewhat
successful. The green wave is essentially created on a busy road with multi-
ple consecutive traffic lights, by turning the lights green one after another in
a synchronized fashion. The idea behind this method, is that a driver should
then be able to drive fairly continuously along the road, without the need to
stop all the time. Another method involves reacting to different preset situa-
tions. An example of these situations could be: rush hour, normal traffic and
night time. In this case the traffic light would be instructed to alter its policy
Chapter 1. Introduction 2
depending on the current situation; during rush hour, two of the lanes might
tend to be especially congested compared to the rest, while night time might
only require a short burst of green in each direction.
Traffic lights using sensors do however seem to have the greatest im-
pact on the improvement of the traffic flow, as it makes the system reactive
and much more dynamic. Some typical kinds of sensors might include cam-
eras/motions sensors and underground electronics such as induction loops
or even weight sensors. Other types of hardware (other than actual sensors)
working as an interface could also include buttons for pedestrian crossings
for instance.
Sensors are great for letting the system know when an object is approach-
ing, where it is approaching from, and maybe even where it is bound to go,
depending on the types of sensors, as well as the structure and layout of the
traffic light. With all this information available to the system, the control unit
can make a better decision than the pretty much random guessing of a fixed
timer.
will be able to conclude that extended knowledge about traffic flows in the
network for each traffic light correlates to an improved traffic flow through
the traffic lights and the network as a whole. An overall goal would be to
improve the quality of life for the users of a traffic network, by providing
a more efficient traffic flow. An improvement to the traffic flow could ul-
timately result in shorter travel times through the network, less pollution,
quicker response times for emergency services, higher road safety and more
value for the money for the users (less fuel cost).
After this introduction to the project, we are going to have a look at the state
of the art; the current relevant technologies and what has already been done
in the area in which we are going to be working.
After establishing what we want to do, and what has already been done,
we will introduce an analysis, where we begin to analyse the problem in
order to determine a suitable solution to the problem. As part of the analysis,
we first describe the overall system and then put the system into perspective
by looking at it as a user. This part includes a few use cases that aim to
ensure an understanding of the systems we have to work with, as well as
how the new system will affect the users. Still as part of the analysis, we
then analyse the product functions by breaking the project into three primary
parts to separate the theory; the traffic simulation model, the traffic control
algorithm and general communication. As the last part of the analysis, we
then establish some specific requirements for the system, to ensure we have
a complete problem before we start to actually design the system.
After analysing the entire system, we then proceed to design and imple-
mentation, where we describe how the system has been developed. This
section first outlines how the system is structured, and then proceeds into
more technical details about how it is build.
This is then followed up by an evaluation, where the system is first tested
using a few different scenarios. After the tests, the results of them are then
discussed relative to the scope of the project. Lastly a few ideas for future
development is outlined to give an idea of where this project could be headed
in the future.
As a roundup of the report, the conclusion will then summarise the work
that has been done, and conclude on whether the project as a whole was suc-
cessful or not and to what extend. At the very end of the report the appendix
is located, where diagrams, calculations and test data is stored for reference
throughout the report.
4
Before analysing the problem further, let us now establish the recent stage
in the development of what we aim to do; what are the newest ideas and
features regarding smart city traffic management. The purpose of this is to
outline the base of operation; the foundation upon which we are going to
build our model.
3 Analysis
Up until this point we have briefly discussed why we want to do this, but
exactly how we are going to fulfill that purpose, we will get into later on. For
now let us instead focus on the details of what we want to do precisely.
There exists a wide variety of different types of traffic lights and two general
factors have a big impact on how the system works.
Firstly, the roads, pedestrian crossing, etc. coming into and going out
from the traffic lights area of effect; are we working with three small roads
intersecting at a T-junction, or are we looking at four major roads - each with
several lanes of different types (cars, buses, taxis, etc.)?
Secondly, the equipment the system has to work with; does each individ-
ual light just have its own local control unit based on a simple timer, or is
the entire system controlled based on inputs from various different sensors
around the traffic light - such as cameras and induction loops. The point is
that traffic lights are not always structured the same way - in fact there can be
Chapter 3. Analysis 8
Primary actor:
• Car: wants to turn right at the intersection with as little wait time as
possible, whilst feeling safe throughout the entire process.
Preconditions:
• The car is driving towards the intersection, thus approaching the traffic
light.
• The car is going the desired direction, and knows that any relevant traf-
fic regulations has been adhered to.
1. The car selects the correct lane for the intended purpose; the right-
turning lane.
3. The car stops and waits for the light to change. [Alt2]
5. The light turns green, and the car begins to drive out into the intersec-
tion itself, waiting for any other potential cars to move first.
6. The car enters the intersection and begins to turn right unto an appro-
priate lane on the new road. [Alt3]
Alternative flows:
• Alt1: There are other cars waiting in the right-turning lane in front of the user.
– The car drives up to a position just behind the current backmost
car.
Chapter 3. Analysis 12
• Alt2: The light is not red to begin with, but instead either red and yellow, or
green.
– The car continues at a respective pace into the intersection, taking
heed of any other cars before skipping to step 6.
• Alt3: Something is obstructing the way the car is headed (e.g. a pedestrian
crossing the road)
– The car waits at an appropriate position until the path is clear, be-
fore continuing.
Exceptions:
If at any time in the use case before step 7 of the main success scenario, the
traffic light malfunctions, the intersections becomes a subject to standard
road-crossing rules and regulations (e.g. priority to the right in Denmark),
assuming there are no other indications of rules - such as signs or a directing
officer.
Chapter 3. Analysis 13
Primary actor:
• Car; A standard car including a driver.
Stakeholders and interests:
• Car: wants to turn left at the intersection with as little wait time as
possible, whilst feeling safe throughout the entire process.
Preconditions:
• The car is driving towards the intersection, thus approaching the traffic
light.
Success guarantee (postconditions):
• The car is going the desired direction, and knows that any relevant traf-
fic regulations has been adhered to.
Main success scenario:
1. The car selects the correct lane for the intended purpose; the left-turning
lane.
3. The car stops and waits for the light to change. [Alt2]
5. The light turns green, and the car begins to drive out into the inter-
section itself, waiting for any other potential cars to move first (when
turning left, it is possible that cars are parked in the intersection waiting
for a clear path)
6. The car enters the intersection and begins to turn left unto an appro-
priate lane on the new road; in this case just the single lane available.
[Alt3]
• Alt2: The light is not red to begin with, but instead either red and yellow, or
green.
– The car continues at a respective pace into the intersection, taking
heed of any other cars before skipping to step 6.
• Alt3: Something is obstructing the way the car is headed (e.g. a pedestrian
crossing the road)
– The car waits at an appropriate position until the path is clear, be-
fore continuing.
Exceptions:
If at any time in the use case before step 7 of the main success scenario, the
traffic light malfunctions, the intersections becomes a subject to standard
road-crossing rules and regulations (e.g. priority to the right in Denmark),
assuming there are no other indications of rules - such as signs or a directing
officer.
Chapter 3. Analysis 15
Primary actor:
• Car; A standard car including a driver.
Stakeholders and interests:
• Car: wants to cross both traffic lights with as little wait time as possible,
whilst feeling safe throughout the entire process.
Preconditions:
• The car is driving towards the first intersection, thus approaching said
traffic light.
Success guarantee (postconditions):
• The car traverses both intersections, and knows that any relevant traffic
regulations has been adhered to.
Main success scenario:
1. The car selects the correct lane for the intended purpose; in this case the
straight lane.
3. The system incorporates the car in its calculations (along with any other
cars in other incoming lanes), and determines a fair wait time, based on
all available inputs.
5. Once the light has turned green, the car traverses the first intersection
and enters the outgoing road, towards the next intersection.
6. The first traffic signal acknowledges that the car has traversed the in-
tersection in the given direction, and sends a signal to the next traffic
light in that direction.
7. The second traffic light receives the signal, and treats the car as an input
to the local system. [Alt1]
8. When the car arrives to the second intersection, the traffic light has al-
ready prepared a suitable solution, given the input from the first traffic
light as well as any standard inputs to the second.
9. The car awaits a green light, and then traverses the second intersection
as well.
Chapter 3. Analysis 16
Alternative flows:
• Alt1: There are other minor intersections between the two traffic lights.
– The second traffic light can not be 100% sure that the output from
the previous traffic light will act as an input. Therefore it either
uses an average success rate of output=input, or overlooks the
data all together - depending on the situation.
Exceptions:
Same exceptions apply as for the previous use case. If a traffic light does
not receive any data, even though it is supposed to, it may make use of its
sensors instead. If the traffic signal has not received any data nor detected
anything from its sensors, the car will not be included in the evaluation of
the situation from the system, and might have a longer wait time than the
ideal. As always, the traffic light will return to a simple timer control, in
cases where no inputs have been detected for a certain amount of time.
Chapter 3. Analysis 17
At an intersection where you can go all three ways from each of the four
directions, there are a total of 12 valid routes that cars can follow, which
corresponds to 12 situations we need to account for - and that is not even
considering combinations of said situations. Since each place where the lines
of different colors intersect means we have a conflict, we can infer that a set
of routes are conflict-free if (and only if) none of the lines of the members of
the set intersect (it is also important to note that routes also intersect if they
arrive at the same lane). To adhere to the standard security requirements of
signaled intersections, we must ensure that all set of routes are conflict-free,
and to achieve the most efficient intersection, the aim is to find the maximum
number of conflict-free sets of routes. There is a few exceptions to the conflict-
free rule however, as we might run into some issues when using combined
straight and left-turning lanes. The problem with these, are the fact that the
left-turning lane intersects with all the other straight lanes as well as two
of the other left-turning lanes. This means that while allowing for cars to
Chapter 3. Analysis 19
turn left from one direction, all the other three straight lanes must be held
back. This would have a huge negative impact on the efficiency - so much so
that it is commonly (at least in Denmark) accepted to allow for both left and
straight lanes at opposite directions at the same time. While this often results
in pile-ups in the middle of the intersection waiting to turn left, it has proven
to be significantly more efficient as a platoon at least get through each time.
While technically breaking the conflict-free rule, it has also proven to be a rel-
atively safe solution, as we are dealing with opposite directions, increasing
the chances of the driver acknowledging the oncoming traffic, more so than
if the traffic was coming from either side.
Let us now look at some different algorithms and analyse which might be the
better solution for what we are trying to achieve.
Randomness
The most common heuristic for signaled intersections, is randomness - as
in fixed timers, based on no knowledge of the traffic flow or infrastructure.
This method essentially provide a practically random timer, thus disregard-
ing any information about the traffic flow or even the infrastructure itself.
However since this method is so basic and simple, it is likewise really reli-
able, which is an extremely important quality for a traffic light, as we’ll get
more into later. While being a reliable and generally simple solution, it is
very inefficient and far from optimal however, since it has no way of adapt-
ing to changes in the traffic flow.
Since randomness is a poor choice due to its lack of adaptability, let us in-
stead consider some adaptive heuristics. Rather than simply deciding and
hardcoding the timers into the traffic lights, we should realise that traffic
lights are there to help its users, thus we should aim to find a more dynamic
solution that continuously satisfies the users in real-time. The only way to do
that however, is to get some form of data from the infrastructure.
Best First
A better alternative could be to sum up sets of lanes that are conflict-free
and could potentially go at the same time. This way the efficiency of the in-
tersection would be improved, as it would look at the situation as a whole,
ultimately letting more cars through.
Other than these somewhat basic methods of traffic control, there are how-
ever more advanced heuristics out there, that has the potential to improve
quality of life even further. One of them would be to give each car a value
corresponding to its priority. This priority could be based on a number of dif-
ferent things depending on the specific situation, but a general one could be
the number of passengers. Assuming that we want to move as many passen-
gers through the intersection over time as possible, the car could acknowl-
edge the number of passengers to the system (or the system could detect it
via sensors). The traffic light could then add these values to one of the above
mentioned methods, e.g. letting a car with three passengers count for three
when calculating the longest queue. This solution also has some ethical ben-
efits, as it would increase the attractiveness of carpooling, knowing that you
would have a higher priority at each traffic light, there more people you have
in the car.
Round Robin
If we look at the real world, and imagine each lane as a process, a very com-
mon algorithm used for traffic control, is Round Robin. Round Robin is great
because it is simple, easy to implement and eliminates the risk of starva-
tion; a lane with cars that doesn’t get processed because the queue length is
too short, the priority is too low etc. (depending on the method of control).
Round Robin assigns time quanta to all processes in a system with equal/no
priority - hence the overall time quanta is divided up in equal portions. In
computing, Round Robin is a common algorithm used in process and net-
work schedulers, since it is a so-called cyclic executive, which is an arguably
good alternative to a real-time operating system. In computing Round Robin
only handles one task at a time, but all processes gets their fair share of the
CPU. This can be translated into traffic control, as each lane (or typically
conflict-free sets of lanes) are being handled one by one, with all lanes being
handled in each cycle. This means that no lanes will be skipped unless ex-
plicitly defined; once a task is completed (a lane is empty) the task (the lane)
will be removed from the scheduler. Once a car enters the lane, it will then
be created once again, to then be included in the scheduler for further cycles.
In a dynamic and adaptive traffic control system, this might prove to be
a relatively counteractive strategy however, as there is no particular use of
the information available to the system. Round Robin essentially disregards
any information given to it, and sticks to the execution time for each cycle
regardless of changes in the traffic flow (It can still change the timings, but it
would affect all the lanes, rather than just the relevant ones).
no risk of starvation, some lanes might have to wait a long time for the light
to turn green.
Work-Conserving Schedulers
This is an overall description of a group of schedulers. These types of sched-
ulers always tries to minimize the time a resource will be unused - in other
words, it aims to keep the scheduled resourced busy.
This could correspond to a traffic light in a way where we try to always
process cars whenever the light is green; ideally a lane should never have a
green light if there are no cars in that particular lane (assuming that there are
other cars waiting in other lanes which are not green). This is an important
feature and ideal for traffic lights, as we ultimately want to process as many
cars as possible as fast as possible. Looking for the perfect algorithm might
therefore be of relevance in this category.
3.6 Communication
While the use of network communication for sharing of information between
nodes might not be necessary for a traffic simulator running locally, it would
be a crucial part of a real life implementation, as the only way for nodes to
share information would be over some form of connection. There are many
different types of networks, as well as many different protocols, so let us take
a look at some of the possible solutions for an implementation of our model
onto a real life system.
As we are dealing with a system where all the components interact with
each other to achieve a common goal, we can safely say that we are looking
at a distributed system where the individual components communicate and
coordinate their actions by passing messages of information. This is ideal due
to the available, transparent and especially scalable nature of such systems.
Centralised
In a centralised network, the core of the
system is located in one central location.
This means that the central server is the
acting agent for all communication in
the system; if two nodes of the network
wants to communicate, it has to go via
the central server. Depending on the
function of the network, the central core
can also have different functions.
In the example above, the server
would act as the postoffice for the mes-
sages. In an example where multiple
nodes send and receive data to a main
server, thus not actually communicating
with each other, but rather just the cen- F IGURE 3.5: Centralised architecture
tral server, the server would act more
like a bank where people can either deposit or withdraw money. A cen-
tralised architecture is easy to maintain, as there only exists one major point
of failure, and is also relatively quick to implement, as only one major part
has to be created, thus it can pretty much be applied anywhere without much
effort. The architecture does have its drawbacks however. While it might be
easy to maintain a single point of a system, it proves a huge stability risk as
only that single part has to fail for the whole system to collapse. If you take
out the central point, no points will be connected. Likewise the architecture
Chapter 3. Analysis 25
is not very scalable, as it has a finite capacity that usually maxes out for really
expansive systems.
Consider a traffic network, where each node in the network graph would
represent a traffic light (controller). The central node would then function
as a primary controller, distributing the messages and relaying them to the
intentional end-points. Whenever a traffic light would sent information to a
neighbouring traffic light, the message would be sent to the central controller,
with the message header specifying the intended receiver. The controller
would first receive the message, and analyse the relevant content. Once de-
termining the intended receiver, it would proceed to sent it to that particular
traffic light. The two traffic lights would then be interacting indirectly, thus
they would not necessarily know of the other traffic light’s location and ad-
dress in the network. While each message would have to be processed by the
central control unit, thus running the risk of being delayed, assuming that the
controller receives multiple requests continuously, the message would never
have to travel on more (or less) than two links, thus only be intercepted once
(by the central controller). In a scenario where the delay from the central
control unit is minimal, and nodes have to communicate over long distances
- beyond other nodes, this could prove to be more efficient, than the message
having to traverse through multiple routers along the way. In a system like
ours however, the nodes are relatively close together - both physically and
regarding potential delay from the network layer. A centralised network ar-
chitecture would generally improve processing delay, as the maximum (but
also minimum) number of routers in the link is one. The transmission delay
would likewise be decreased, as the message would only have to be transmit-
ted twice. That being said, both the queuing and propagation delay would
be increased (relative to a decentralised architecture), as several messages
would have to go through the gap of the central control unit at the same
time, and the distance from sender A and receiver C through the control unit
B, would always be at least the distance from A to B even if A and C are right
next to each other. While the delay and latency of the network can be crucial
to the overall performance, the most prominent issue with a centralised traf-
fic network, is the single point of failure; reliability is a key requirement for
the system, and the risk of a single failure paralysing the entire system is too
high.
Decentralised
A decentralised architecture is the opposite of a centralised one, since there
is no longer a definitive single core of the system. In this type of architecture,
a node in the network can act as both a client and a server, depending on
the situation. Either some nodes are specifically chosen to be intermediate
servers (e.g. so-called super peers in P2P), or each node has the option to
do both (e.g. peers in P2P). What a decentralised architecture lacks in main-
tainability and ease of development, it makes up for in improved (relative to
centralised architectures) stability, reliability, adaptability, scalability and di-
versity. A decentralised architecture is usually great for dynamic and volatile
systems, as it easily adapts to the requirements, once it has been created to
Chapter 3. Analysis 26
start with.
In a traffic network, this architecture
would involve a number of groups of traffic
light controllers, that independently interact
with the central control unit. When a node
A wants to send a message to a node E, it
would first send the message to the central
router B of the local group in which the node
A i residing. The message would include
information about the receiver E, so that
routers along the way would know where
to relay the message. If we compare this ar-
chitecture to a centralised one, the distance
from the sender of the message to the re-
ceiver would be approximately the same for F IGURE 3.6: Decentralised archi-
longer distances, but potentially a great deal tecture
shorter for nodes closer together, as they do
not necessarily have to relay their message via the central control unit, if they
are in the same group of nodes, with the same local router, thus the average
distance between nodes are shorter than that of a centralised architecture.
Consider our model of a traffic network; as the interest of each traffic light
lies solely with its neighbours, it only cares about incoming traffic from said
neighbours, connecting these in a cluster with a shared local central point
would be desired, as a route via a global (within the network) central control
unit, would be ridiculous given the distance the message should travel.
Fully Distributed
A fully distributed architecture is a vari-
ant and ultimately an extreme example of a
decentralised system. In a distributed net-
work, each component knows about only
their neighbour to start with. In the graph
to the right, each node acts as a compo-
nent in the system (e.g. a traffic light con-
troller) and each link shows the connection
between two nodes. Since each node only
knows its immediate neighbours initially,
they must exchange messages in order to ex-
plore the graph (i.e. the network). What
a decentralised architecture masters over a
centralised one, a distributed structure im- F IGURE 3.7: Distributed architec-
proves even further. This does however ture
mean, that the disadvantages of a decen-
tralised structure is even greater for a distributed one. The ultimate essence
of this, is that a distributed system can be difficult to implement and main-
tain, but is otherwise brilliant for an ever-changing large network.
Chapter 3. Analysis 27
Now that we have established some of the primary types of architectures, let
us take a look at some of the more common architectures in (general) dis-
tributed systems that could be relevant for this type of system - more specif-
ically, there are generally four primary types of distributed architectures;
layered/multitier, object-oriented, datacentric and eventbased/eventdriven.
However, as the layered structure is a client-server architecture where each
part of different responsibilities are separated into tiers (i.e. layers), this is
not really a relevant architecture for a traffic network. We will therefore go
over the latter of the three.
Object-Oriented
An object oriented architecture, is one where objects (just like in object-oriented
programming) are distributed across different components (or address spaces)
in a network. The objective of using this architecture, is to make the location
of the objects transparent; ultimately making remote objects seems as though
they are local. This means that each distributed object is able to access data
and invoke methods on remote objects (Remote Method Invocation (RMI))
- just like remote procedure calls in object-oriented programming. The RMI
protocol usually involves message-passing, where the caller-object sends a
message to the remote object, asking for permission to access it. If permis-
sion is granted by the remote object, the result of the invocation is sent back
Chapter 3. Analysis 28
Datacentric
A datacentric architecture, is a centralised net-
work in which the persistent data is shared be-
tween a number of components. This means
that all the eligible components are able to pub-
lish and/or request data depending on their
privileges. It is centralised in nature, as the sys-
tem data is gathered in one single place.
In a traffic network, this might be a suit-
able solution, as the individual components of
the system has a lot of data to publish - just
as they often want to receive new information
about the traffic flow. Gathering the data in the
cloud (so to say) might therefore simplify the
network structure. Each traffic light (controller)
would simply request a certain form of data F IGURE 3.9: Datacentric ar-
from the cloud, that had previously been pub- chitecture
lished by another traffic light, ultimately main-
taining loosely coupled components.
Chapter 3. Analysis 29
Eventdriven
An eventdriven architecture focuses
on interactions using events. An
event is a sudden change of state for
the system. Whether it being a com-
ponent publishing some data, or an-
other component requesting a deliv-
ery of some data, the state of the sys-
tem is altered, and an event is trig-
gered. The events are not actual ob-
F IGURE 3.10: Eventdriven architecture
jects, but rather a concept. The ac-
tual object being sent back and forth
on the event bus, would usually be messages sent asynchronously.
In a traffic network, an event could be triggered whenever a traffic light
component experienced a flow of traffic traversing the intersection, and pub-
lished this data. All other components subscribing to this type of data (e.g.
physically neighbouring traffic light components) would then receive the
data without technically knowing anything about the component that orig-
inally sent the message. This scenario will be analysed in further details in
the subsection publish and subscribe under the next section.
3.6.2 Communication
Regarding the actual form of communication over the network, there are typ-
ically three primary methods for sending messages. If a message is sent
directly from one component to another, the method of communication is
called single-cast. Similarly, multi-casting would involve the message being
sent to a specific group of components, rather than just a single one. The last
option for sending a message over a distributed network, is broadcasting. By
broadcasting a message, the message is sent out to all other components in
the network. When using a publish-subscribe pattern, the receiving compo-
nents could choose to subscribe to a certain component, or even a certain type
of message. Whenever the sender publishes a message, all subscribing com-
ponents will receive it, whereas the ones not subscribing will not. Another
variation of this could be any-casting, where a message is sent to practically
anyone - usually the nearest neighbours in the network.
In the first graph (see fig. 3.11(A)), we see an example of using single-
cast communication to send a message from traffic light A to traffic light
B. By analysing the data, A realises that only B would show interest in this
data, thus sends it directly to B and no one else in the network. If A has
knowledge of the network structure, or even just its neighbours, and it knows
the direction of its processed cars, it will know exactly which traffic light will
receive the cars as input. This allows A to explicitly alert B that a certain
amount of cars are incoming, giving B time to assess the situation and adjust
its timers accordingly. If each node not only has knowledge of neighbouring
nodes, but also of the exact distance and average speed limit between them,
it would even be possible to not only alert the receiver about the amount of
traffic incoming - but also at what exact time they will arrive, allowing B to
make an even more precise decision.
In the second graph (see fig. 3.11(B)), we see an example of using multi-
cast communication to send a message from traffic light A to the group of
traffic lights B,C,D. Once again A analyses the data, and realises that not
only B, but also C and D might have interest in it. If A knows at least two
levels of neighbouring nodes (i.e. its own neighbours and their respective
neighbours), if can send the message to all nodes that are up to two links
away from itself. That way B get the information like with single-cast com-
munication, but C and D also gets information that traffic is incoming to B.
Based on a statistical analysis, both C and D might deduce that some (or all)
of that traffic may comes from B in the future. This would give C and D more
time to evaluate and though some of the data would be based on a qualified
Chapter 3. Analysis 31
networks. MOM practically introduces a new layer to the OSI model, be-
tween the transport layer and the application layer, and basically functions
as the “to” in peer-to-peer for instance.
3.7.1 Functionality
Each node in a given network should be able to send and receive data, as
well as utilize and interpret data from either local inputs or remote signals
without any semantical differences.
The system should be able to handle large amounts of data, without any
noticeable latency and the exchange of data over a network should be secure
and reliable.
Given the relatively general problem we are attempting to solve, the sys-
tem needs to be fairly generic and adaptable; the required effort to imple-
ment the model onto any given network of traffic lights should be as low as
possible.
At any point in time, it should be possible to disable the system on either
a local or global basis, in case of malfunctions or any other situation where
it might be preferred to return to a simplified model temporarily; our model
should be implemented as an addition to the already existing model, rather
than a substitution.
In addition to previously mentioned functionality, it is to be assumed that
each traffic light as a minimum acts and functions as a standard traffic light.
3.7.2 Usability
It is important that the users does not have to alter their routine in order to
traverse the traffic lights. As previously mentioned, there does not need to be
any changes to the interfaces that the users directly and consciously interact
with - such as the actual lights and the lanes of the traffic signals. Other than
the hopefully improved traffic flow, the users should not notice any game
changing differences.
Other than that, it is to be expected that a certain standard is met when it
comes to responsiveness and aesthetics.
3.7.3 Reliability
Traffic lights are critical when it comes to the enforcement of traffic laws and
regulations, as well as general safety. Therefore it is very important to ensure
the availability of the traffic lights. Certain backup/safety measures can be
implemented to ensure acceptable availability during a technical failure. For
Chapter 3. Analysis 34
instance the traffic light could make use of a more simple form of control, in
the case of a failure to the current control unit (e.g. make use of a set timer, if
the otherwise prefered means of control are malfunctioning).
Another way to ensure as high an availability as possible, could be to alert
the relevant authority of any failures. Letting the proper technician know
if there is a technical malfunction, could bring the downtime down signif-
icantly, as the problem could be fixed right away. Regarding the physical
composition of the traffic lights, we are going to assume they are as robust
and durable as standard traffic lights.
In terms of accuracy and general correctness, it is of utmost importance
that the users are not misguided, as that could lead to a severe break of safety.
Frequent monitoring and general maintenance should prevent any malfunc-
tions or at least detect them, so any appropriate fixes can be made in time.
3.7.4 Performance
As the overall goal of this project is to improve the efficiency of traffic lights,
the performance of the actual traffic lights are also of utmost importance. Im-
plementing a new measure of control for a network of traffic signals, would
be for nothing if each traffic light is slow and sluggish, or if the communica-
tion between each node in the network is too delayed. Therefore it is crucial
that the speed and general efficiency of the system is as high as possible.
Other than being fast and efficient, it is also important that the cost of
the system is as low as possible. Just like it needs to be fast and efficient, it
also needs to limit its resource consumption; an appropriate balance must be
found between those two areas.
As an important quality of the system is its scalability, it must also be
capable of upscaling the system without any major upgrades other than of
course the upscaling itself.
3.7.5 Supportability
Serviceability, maintainability, sustainability, repair speed, testability, flexi-
bility, modifiability, configurability, adaptability, extensibility, modularity, in-
stallability and localizability.
These are all very important quality attributes, when working with a
generic and scalable solution to a dynamic problem. It makes sense that each
and every one of these qualities are in the back of our head when implement-
ing the solution. As mentioned briefly when discussing both reliability and
performance, the ability to easily implement, maintain and configure the sys-
tem is extremely important, as this will make the attractiveness of the system
skyrocket.
35
The traffic simulator consists of a bunch of different objects, that for the most
part can be categorised into two primary types; nodes and links. Nodes in-
clude objects like Intersections and Spawn Points, and is where there is an
active form of control present. It is only within nodes, we can actively change
the outcome of the simulation; if we alter the control algorithm of the traffic
lights or decide to spawn more cars at a specific point, the result of the sim-
ulation will be different than if we had not changed anything. Links on the
other hand include objects like Roads and parts of the roads like Lanes, and
acts as connectors between nodes - just like roads are connectors between in-
tersections in the real world. Links have a passive form of control, as they
can only be interfered with indirectly; if we want to change the outcome of a
situation on a link, we have to make a change to a connected node in a way
the changes the outcome of that particular link.
With these two types of objects, it is possible to construct any traffic net-
work from a real world scenario into the traffic simulator, as long as it con-
sists of valid subcategories to either nodes or links - for instance the simulator
supports intersections like three- and four-way traffic lights among others,
but not roundabouts or traffic lights with more than four inputs and/or out-
puts. With this basic structure in mind, let us take a more indepth look at the
model on which the simulator is build.
Chapter 4. Design and Implementation 36
(aka. the two Ways) are in and out. If a road only has one associated way, it
functions as a one-way road.
Technically a link between two traffic lights A and B, works as two indi-
vidual roads; one that acts as the output for A and input for B, and one that
acts as the output from B and input to A.
Lanes are what determines where the cars can go at the intersection. For
instance, a road can have a lane to go left and straight, one to go just straight
and one to go just right. This alleviates some of the pressure at the inter-
section, and allows for a more specific and detailed algorithm to be used for
the traffic control - which is a good thing, since each car becomes part of a
smaller group when analysing the flow/pressure, which in turn means more
focus on each individual car.
The way, or direction, is what determines the flow of traffic; number of
cars over time, whist the lane determines the line/queue of cars. The width
of the lane indicates the number of lanes of the same type, e.g. if there are
two right-turning lanes and one straight lane, there are two lanes where the
right-turning one has a width of two. The lanes is also the object that holds
the actual traffic light, as the light might be different for each type of lane. The
light object only has a state, which indicates what color is currently shown.
Since the road is the overall pathing object, it is also here the spawn nodes
are attached. The spawn nodes are what spawns the cars, since we need to
actually create cars when working with a simulation. These spawn nodes are
usually placed around the outside of the network, acting as the inputs to the
system as a whole. The spawn node dictates the flow, which indicates how
many cars are spawned over time.
The Main class is what initiates and starts the simulation. It creates the traffic
network by initialising the objects and connecting them, and sets the various
parameters, such as which algorithm each traffic light should use, the length
of the roads etc.. As the simulator runs locally simulating a distributed net-
work, each node in the simulation (i.e. traffic light, side road or spawn node)
is started as their own thread, so they are isolated from the rest of the objects.
Once the simulation has started, cars will begin to spawn at the declared
spawn nodes. The spawn nodes makes use of the Random java class to gen-
erate traffic. It does this so as to simulate a degree of randomness to the traffic
flow since real world traffic have a certain degree of uncertainty to it, and in
this way try to mirror real world traffic a bit more. The Random class gener-
ates a stream of pseudorandom numbers (with the use of a 48-bit seed which
is modified using a linear congruential formula) which is used to determine
whether new traffic is spawned or not. If the number (which is between 0
and the max spawn value) is less than the set spawn value, then traffic is
Chapter 4. Design and Implementation 38
spawned and driven into the system. A new number is drawn every spawn
interval (msec) which controls how often a spawn node tries to generate traf-
fic. By default the spawn value is sat so there is 50.01% possibility for traffic
to spawn at each spawn interval. This means that if the spawn interval is sat
to 200 msec, the probability of one or more traffic spawning in one second
(five spawn intervals) is 96.88%. And the probability of five traffic spawning
in one second is 3.13% (for calculations see appendix B).
Each instance of a traffic light, starts both a light controller and a line
controller, each in a new thread, and then proceeds to run for the rest of the
simulation continuously yielding for other threads; essentially giving itself
lower priority for execution by the CPU, and allowing other threads to be
executed until the end of the simulation.
The light controller then decide the light configuration based on the cho-
sen algorithm for the associated traffic light, each so-called lightTime, which
is essentially the tick/refresh rate for the light signal - thus also the minimum
amount of time each light will remain on for.
The line controller essentially updates the lines on each incoming (to the
associated traffic light) road by either incrementing or decrementing each in-
dividual lane coming into the associated traffic light, based on the arriving
flow (at the edges of the network, this would be from spawn nodes exclu-
sively). The line controller can basically be seen as a policeman in the middle
of the intersection guiding the cars with his og her hand signals. The line con-
troller controls where the traffic goes, by practically moving the cars around,
whereas the light controller controls the light signals, by changing them ac-
cording to the result of the algorithm.
The traffic algorithm determines two things; which light is turned on and
for how long. It does this by looking at the current lines at the traffic light;
which light is currently turned on, and incoming traffic. All the traffic al-
gorithm knows about the incoming traffic is their arrival time to the traffic
light. With the data of the incoming traffic and the current lines, the traffic
algorithm tries to determine how long it will be before there is a “hole”(a pe-
riod of time with no traffic) in the traffic flow at the incoming roads, and how
long these “holes” will be. For simplicity’s sake will we call the time before
a “hole” appears on a road clear time and the duration of the hole, hole time.
The traffic algorithm then tries to avoid having a light green in any direction
where there is a hole, thus only having the light green in a direction for that
direction’s clear time. When it becomes time to change the light to the other
direction and the direction which is being changed to has a clear time of zero
Chapter 4. Design and Implementation 39
(no traffic), the traffic algorithm keeps the light green in the current direction
(doesn’t change the light) for the duration of the other directions hole time
(until there is traffic). The maximum hole time that a road can have is that
road’s travel time. Travel time is the time it takes for traffic to transverse the
road to the traffic light. This is a calculation involving the roads length and
speed. This is the maximum hole time since this is the maximum prediction
range the traffic algorithm has (it only knows what traffic is currently travel-
ling directly to it). This is possibly an area of further development. Light time
is the time the traffic algorithm determines that the light should be green for.
This is typically a directions clear time however it does have a max value that
it’s allowed to be. Lets call this max value; max light time. Max light time is
determined by the traffic light to be the max time allowed to pass before the
traffic algorithm has to recalculate and try to change the light. This is so as
to prevent the traffic algorithm from determining that there should be green
in one direction for a very long time, do to high traffic, and then not going
back to recalculate in a long time. This would result in the traffic light not
changing in a long time, ultimately resulting in starvation. Thus max light
time is the max time before the traffic algorithm as to recalculate and thus
give priority to the other directions. This however doesn’t prevent the the
traffic algorithm from not changing the light if there is no other traffic. It
does however protect against long clear times.
One limitation with the current traffic algorithm is that it doesn’t know which
way incoming traffic wants to go, and since it calculates worst time clear
times, meaning that it calculates the longest possible clear time of a road, the
predicted clear times are sometimes longer than the actual clear times. This
is primarily a deficit when incoming traffic arrives before the roads longest
line is cleared. This causes the arrived traffic to be theoretically added to
the longest line thus increasing the clear time. In practice however, the in-
coming traffic might not be going the way where the line is the longest but
a way where the line is shorter, thus not actually increasing the overall clear
time. However since the traffic algorithm doesn’t know where incoming traf-
fic wants to go, it makes predictions based on the worst case scenario.
40
5 Evaluation
Now that we have analysed the problem at hand and proposed a solution,
let us evaluate the result of the chosen solution, by evaluating tests and
discussing the results of them. The purpose of the implementation was to
demonstrate our algorithm in an environment simulated to function as a real
life traffic network. The evaluation will therefore focus on the differences be-
tween our algorithm - which supports communication between traffic lights,
and already commonly used ones, that does not.
5.1 Test
In order to measure how our developed traffic control algorithm measures up
against other implemented algorithms such as time switched based ones, and
sensor based ones, a bunch of tests simulations with the different algorithms
were run with the results measured against each other. These test simulations
were run in a bunch of different scenarios with varying traffic flows so as to
get an idea of how the different approaches handle different scenarios. Each
test is run with 100 simulations of each algorithm where the average wait
time for traffic is measured and the overall average wait time is computed
for each algorithm. It has been decided that we measure the effectiveness of
the algorithm on the user’s(traffic’s) average wait time in the system, since
the less time that the users hold still for a red light the better the experience.
The time based algorithm has no knowledge of the traffic flow through-
out the network, thus the light configuration is purely based on fixed static
timers. The sensor algorithm is based on the time based algorithm, but ad-
ditionally it utilises simulated sensors, that are able to detect cars when they
arrive at the given traffic light. This means that it knows how many cars
that are currently in the lanes for the traffic light, thus it can change the light
configuration accordingly, so as to accommodate for lanes with higher traffic
flow. Our developed algorithm, is somewhat similar to the sensor algorithm,
in that it knows about any cars that are currently in line for the intersection.
What makes it different from the other two however, is its ability to interpret
traffic data from nearby traffic lights, and thereby plan the light configura-
tion according to not only the cars already waiting, but also the cars the are
approaching the intersection.
Chapter 5. Evaluation 41
5.1.1 Test 1
The graph below shows the resulted average wait times of traffic in Test 1.
F IGURE 5.1: One traffic light, four roads, no turn lights and
moderate traffic flow.
Test 1 is run with 100 simulations of each algorithm with a moderate traf-
fic flow in each direction. The east and west direction has a slightly higher
traffic flow. The test involves one standard traffic light (4 roads and no turn
lights), where there is a spawn node attached to each incoming road. The
roads have varying speeds, lengths, and turn chances to each other and are
the same in all the simulations. For all the exact value specifications for the
test please refer to appendix C. The overall average wait times computed for
the three different algorithms are 495.83 msec for the developed algorithm,
1227.1 msec for the time based algorithm, and 723.6 msec for the sensor based
algorithm. This clearly shows that the average wait time at the traffic light
when a time based algorithm is implemented is nearly two and a half times
greater than when our developed algorithm was used in a standard traffic
light with moderate traffic. This indicates that with the developed algorithm
the time users(traffic) spend waiting around for a red light is significantly
lower and thus ensure a better overall user experience. The same can be said
when comparing to the sensor based algorithm. With the sensor based al-
gorithm the average wait time is nearly one and a half times greater than
with the developed algorithm, again showing an improvement in the user
experience when the developed algorithm is used.
Chapter 5. Evaluation 42
5.1.2 Test 2
Test 2 is a test involving our developed traffic light algorithm against both a
standard time based and a standard sensor type algorithm in a standard traf-
fic light with spawn nodes connected to the four incoming roads. The test
looks a lot like test 1 and the network is also the same. The only difference
is that test 2 is overcrowded with traffic, so the spawn interval on the spawn
nodes are half of what they were in test 1, resulting in a lot more traffic since
traffic is being spawned more often. This is to test how the different algo-
rithms compare when there is overcrowded traffic from all directions. The
graph below shows the result of test 2:
F IGURE 5.2: One traffic light, four roads, no turn lights and
extreme traffic flow.
As seen above, the average wait times between the three algorithms are very
similar. This is also as expected since the test involved there being an over-
flow of traffic from all directions. This results in there constantly being long
lines in all directions, and since there is no priority on any specific thing (all
traffic has the same priority), the developed algorithm will switch between
the directions generating max light time, which is sat to be the same as light
time in the time switching one. A similar thing happens with the sensory
algorithm. This results in the average wait times being very similar which
is also evident on the overall average wait times which is 4194.62 msec for
the developed algorithm, 4160.62 msec for the time based one, and 4263.91
msec for the sensory algorithm . For the specific specifications for Test 2 see
appendix D.
Chapter 5. Evaluation 43
5.1.3 Test 3
Test 3 looks at how the developed algorithm stands up to the other algo-
rithms in a traffic light with a bigger high traffic road and a smaller low traf-
fic road. This is a typical example of a main road intersecting with a smaller
road. The graph below shows the result of the test:
F IGURE 5.3: One traffic light, two big and two small roads, no
turn lights and moderate and lopsided traffic flow.
It can clearly be seen that the average wait time is significantly lower with
the developed algorithm when compared to the time based one and the sen-
sory based algorithm. This indicates that the developed algorithm performs
better in this scenario. The average wait times for the different algorithms in
this scenario is 212.74 msec for the developed algorithm, 959.95 msec for the
time based algorithm, and 578.88 msec for the sensor typed algorithm. The
difference between the time based algorithm and the other two can primarily
be accounted to the fact that the other two algorithms only changes the light
to be green for the smaller roads when there is traffic and only for the short
amount of time it would take the traffic to cross where as the time based one
changes after a specified amount of time irrelevant of actual traffic. For more
information on the specific test data and values look in appendix E.
Chapter 5. Evaluation 44
5.1.4 Test 4
Test 4 looks at how the different algorithms perform when implemented in
a traffic network with moderate traffic. It was selected to use a traffic net-
work from the real world as the base for this test so as to better relate to the
results of the test. The selected traffic network is from around Glostrup, Den-
mark. The network spans from the intersection O3 (Nordre Ringvej) - 156
(Hovedvejen) to 156 (Hovedvejen) - Nørre Alle, and some of the roads and
intersections around the area. The traffic network is better described by the
figure below and the test results by the graph. For additional information
about the traffic network and test data please refer to appendix F.
The graph shows the overall average wait time for the whole traffic network
per simulation for each algorithm. By looking at the resulting data it can
be concluded that the developed algorithm far out performed both the time
based algorithm which performed the worst and the sensor based algorithm
which is in the middle. The total average wait time for the entire test per
algorithm is 131,03 msec for the developed algorithm, 953.10 msec for the
time based algorithm, and 580.64 msec for the sensor based algorithm.
5.2 Discussion
Let us now reflect on these test results and compare them to the project scope.
The shared purpose of the four tests above, was to check the developed
algorithm against two more common traffic control algorithms, to see if the
improvement of the average wait time for each car/user was significant. The
hypothesis was tested in three different scenarios for a single traffic light, and
then once for an elaborate network of traffic lights.
In the first test, the hypothesis was tested using a standard traffic light lay-
out with four connected roads of equal size (throughput), no explicit turning
lights and a moderate traffic flow from each direction. The purpose of the
test was to measure the algorithms against each other, to ultimately test our
hypothesis against a common traffic light layout. Just as expected, our de-
veloped algorithm showed to be significantly better at handling traffic flow,
than the algorithm utilising only fixed timers and slightly (yet consistently
Chapter 5. Evaluation 46
Overall the tests that were performed confirms our hypothesis by showing
a significant improvement in our developed algorithm over the more com-
monly used ones. This ultimately proves that traffic lights that implements
an algorithm that utilises information shared between multiple independent
traffic lights, significantly improves the overall traffic flow. The proof is based
on the fact that the relevant tests show a decrease in average wait time consis-
tently over the 100 times we ran each test. Test 2 is the only one that does not
show a significantly consistent change in the traffic flow, but as mentioned
above, this was to be expected from the test scenario, which purpose was to
simply confirm that expectation.
It is worth noting that the addition of various realism-factors probably
would have given a different result - possibly even a less significant differ-
ence. However these factors generally does not affect the outcome of the
scenarios that much and due to the massive improvement to efficiency in
the traffic networks seen above, a few minor changes would likely not have
changed the results in a degree that would have resulted in a different con-
clusion.
Further reach
In the current version, each traffic light is only capable of communicating
with its immediate neighbours. As discussed in the section regarding com-
munication, this might limit the efficiency, as the ability to gather information
from nodes beyond the first level of neighbours could improve the overall ef-
ficiency of the control algorithm. The ability to utilize data from beyond the
first level of connections, would however require some measures of proba-
bility and statistics to estimate the incoming traffic based on how much in-
coming traffic the node outputting the traffic was experiencing.
Imagine a network of three traffic lights in a row - let us call them A, B
and C respectively. A experiences a flow of traffic going in the direction of B.
Rather than just alerting B about the incoming traffic, A also alerts C that B is
receiving an incoming flow of traffic. C now knows that some traffic might
be coming in the near future, but it has no way to be sure how much of it
Chapter 5. Evaluation 48
will actually turn up when the time comes. C then has to make a qualified
guess based on empirical data from previous experience, a predefined static
probability, or complete randomness. While this decreases the accuracy of
the system, it has the potential to increase the efficiency, if used correctly, as
each traffic light controller, gets more time to evaluate more data.
Yellow Light
Right now the traffic lights only has two states; red and green. When the light
is red the cars are not allowed to traverse the intersection, and has to wait in a
line, until the light turns green, at which point they are encouraged to drive.
A possible addition to the state machine, could be a yellow light; as a state
in between the red and green. The light would then change from green to
yellow and only then to red. Likewise the light would change from red to
both red and yellow at the same time (to differentiate from the pre-red light)
and only then to green. This would improve the realism factor, as changing
the light would become slightly less desirable for the algorithm. It does not
make a very noticeable difference however, all used algorithms would be af-
fected the same way, with the same factor - the only difference would be an
increased overall clear time - thus average wait time. In the real world, the
yellow light is mostly present due to increased safety and general quality of
life in the form of additional information for the users - both things that has
no real impact in a simulation, which purpose is to test different traffic light
algorithms.
Model diversity
In the current version of the system, only the most basic forms of nodes
and links are supported, to make it possible to test algorithms on simple
(yet somewhat realistic) traffic networks. A possible extension to the model,
could be to add support for more types of both nodes and links in the model.
Examples of more types of nodes, could be five-way intersections and round-
abouts with traffic lights. Examples of more types of links, could be highways
and bus-lanes. Generally additions of objects to the model would increase its
Chapter 5. Evaluation 49
Priority
Currently each car in the network has the same priority (i.e. none). This
means that all cars are valued equally and decisions on whether to change
the light or not is made without any differentiation between users. A possi-
ble extension to the system, could be a priority attribute on each car; either
a fixed one, or a dynamic one. Imagine if each vehicle was able to send data
to a traffic light (possibly using a VANET or InVANET), including relevant
information about the content of the vehicle. This could for instance include
the number of passengers, or if it was transporting a pregnant woman. The
controller would then give the vehicle a priority based on the data relative
to the other vehicles in the network, making vehicles with a higher prior-
ity weigh heavier when deciding which lane to clear next. Additionally this
could be combined with more user types; where emergency vehicles had a
higher priority than buses that in turn had a higher priority than cars for in-
stance.
Communicating cars
As of right now, the only way to determine the current direction of a car,
is by reading the output from another traffic light in the system that is an
immediate neighbour. Consider a scenario where each car was able to com-
municate with the traffic lights (e.g. using VANETs or InVANETs). The cars
would then be able to tell the entire system where it was going from the en-
tering of the traffic network, and the system would then be able to plan the
entire route from start to finish. This would greatly improve the efficiency
of the system, as each traffic light in theory would know when to expect any
car in the network. It would however require that the cars supported this
feature. Combined with cooperation with the navigation system of the car
or a passenger’s smartphone, this could mean greatly improved traffic flow
throughout the network, as cars could be routed based on the current traffic
situation and traffic lights would know the entire traffic situation throughout
the network in real time.
50
6 Conclusion
The result of this project is a traffic simulator that can be used to test dif-
ferent traffic control algorithms, and an algorithm that is created with the
idea of data communication between traffic lights in mind. The algorithm
serves to prove that utilising traffic information from neighbouring traffic
lights can significantly improve the overall flow in a traffic network, whereas
the sole purpose of the simulator itself is to test different algorithms against
each other, using a model that supports registration of traffic flow.
If we recall the scope of the project from the introduction, the goal of this
project was to prove that traffic lights implementing an algorithm that uses
traffic information gathered from neighbouring traffic lights, would experi-
ence an improved traffic flow - specifically classified as the average wait time
for each user.
By performing multiple tests on different scenarios, that all consistently
confirmed our hypothesis by a significant amount, we are hereby comfort-
able concluding, that by utilising information about the traffic flow from
neighbouring traffic lights in a network using our algorithm, the overall traf-
fic flow of the network is improved, by decreasing the average wait time
for users. As a result of decreased average wait times, the users of the net-
work would experience an increase in the quality of life. As a consequence
of a more efficient traffic flow, users might experience shorter travel times,
less fuel consumption (thus cost), less pollution, better road safety, better re-
sponse times for emergency services and generally a better driving and com-
muting experience.
7 References
• http://www.movsim.org
• http://www.opentrafficsim.org
• http://www.dlr.de/ts/en/desktopdefault.aspx/tabid-9883/16931_read-
41000/
• https://en.wikipedia.org/wiki/Vehicular_ad_hoc_network
• https://en.wikipedia.org/wiki/Urban_Traffic_Management_and_Control
Other than the references above and our general competences, we have drawn
inspiration from course material from various related courses offered at DTU
that we have both previously attended. This includes text and figures from
lecture slides as well as course nodes, all of which has been gained through
the filesharing of https://www.campusnet.dtu.dk.
52
8 Appendix
53
B - Probability calculations
Calculation for probability of at least one traffic spawn in one second when
spawn interval is 200 msec, spawn value is 1800, and max spawn value is
3600: 1-(17993599)50.9688 = 96.88 %
Calculation for the probability of five traffic spawns in one second when
spawn interval is 200 msec, spawn value is 1800, and max spawn value is
3600. (A spawn at each interval): (18003599)50.0313=3.13%
55
Data:
Appendix C. - Test 1 info and data 57
Appendix C. - Test 1 info and data 58
Appendix C. - Test 1 info and data 59
60
Data:
Appendix D. - Test 2 info and data 62
Appendix D. - Test 2 info and data 63
Appendix D. - Test 2 info and data 64
65
Data:
Appendix E. - Test 3 info and data 67
Appendix E. - Test 3 info and data 68
Appendix E. - Test 3 info and data 69
70