Table of Contents
- Requirements
- The Environment
- Brief Run Level 3
- Brief Run Level 5
- Results
- Code Snippets
- Additional Info And Future Work
- To be able to display the behaviours of self driving cars through agent based modelling
- To be able to display the behaviours of none self driving cars through agent based modelling
- To be able to mimic the movements of pedestrians in a typical metropolitan setting
- To be able to allow the user to change the level of autonomy of the cars and analyse their changes
- To be able to record results based on the simulation
The simulation imitates a simple road with a small passage for the pedestrians to pass along, and a taffic light that changes in intervals, as the levels of autonomy change the way the cars behave when faced with a red light change, the model tries to imitate how the self driving cars would behave if they are in a compromised position through hacking, so while a low level autonomous car would drive uncontrollably if compromised a higher level car would still behave erratically but on a lesser scale, the level of autonomy currently ramges from 0 to 5, 5 being the highest.
Results are generated in the in-built graph builder that NetLogo has with every program built on the platformThese respective breed commands creates an set of all the breeds used in the simulation, an agentset can be seen as a collection of similar items and each item is known as the breed name.
;For example every item in the trees breed agentset is a tree.
breed [people person]
breed [cars car]
breed[houses house] ;
breed[trees tree]
breed[lights light]
breed[fires fire]
cars-own [
speed ; the current speed of the car
top-speed ; the maximum speed of the car
target-lane ; the desired lane of the car
patience ; the cars current level of patience
current-autonomy-level ; tracks the cars current level of autonomy
autonomous? ; Boolean variable to check if the car is autonomous or not
Law-Abiding? ; Checks if the car stops at a red light
max-patience ;The max patience for the cars, this is 100.
acceleration ;The rate at which cars accelerate
deceleration ;The rate at which cars decelerate
] ask n-of changed-number cars ;The use of n-of here was influence from this suggestion on stack overflow, linked here.
;https://stackoverflow.com/questions/60636497/how-to-change-the-colour-of-random-turtles-in-netlogo
[ if autonomy-level = 0 [set color blue set current-autonomy-level 0 set autonomous? true ]
if autonomy-level = 1 [set color blue + 1.0 set current-autonomy-level 1 set autonomous? true]
if autonomy-level = 2 [set color cyan set current-autonomy-level 2 set autonomous? true]
if autonomy-level = 3 [set color turquoise set current-autonomy-level 3 set autonomous? true]
if autonomy-level = 4 [set color green set current-autonomy-level 4 set autonomous? true]
if autonomy-level = 5 [set color lime set current-autonomy-level 5 set autonomous? true ]
]
end
to set-patience
;This procedure sets the patience of the autonomous cars.
ask cars with [autonomous? = true]
[
if autonomy-level = 0 [set current-autonomy-level 0 set patience (30 + random 15)]
if autonomy-level = 1 [set current-autonomy-level 1 set patience (40 + random 15)]
if autonomy-level = 2 [set current-autonomy-level 2 set patience (40 + random 15)]
if autonomy-level = 3 [set current-autonomy-level 3 set patience (45 + random 15)]
if autonomy-level = 4 [set current-autonomy-level 4 set patience (65 + random 15)]
if autonomy-level = 5 [set current-autonomy-level 5 set patience (85 + random 15)]
]
endThe PDF ReadMe file uploaded contains instructions on how to download NetLogo and run he program.
Future plans for the project
- Collect more precise information about self driivng cars
- Add more potential factors e.g Weather chages, Fire Hazards, Pollution etc
- Upscalling the GUI.



