Updated: Jul 26
This is a guest post from Sanchit Divadkar. He is currently pursuing his B.Tech in Mechanical Engineering at MIT WPU, Pune. After asking some interesting questions regarding a traffic simulation in the AnyLogic LinkedIn group, we invited him to write a blog post and share his experience with the wider Anylogic community.
Hello, fellow simulation enthusiasts!
Today, I will share my experience with a fascinating project I completed using the traffic toolbox of the AnyLogic Software. For those unfamiliar, AnyLogic is a robust simulation software capable of developing sophisticated simulation models for various systems. AnyLogic was chosen because it specializes in simulation tools and vast features in the traffic toolbox. This blog post will walk you through my process, providing a step-by-step guide to help you create a similar simulation.
Let's dive in!
Step 1: Understanding the Objective
The first step before creating the model was understanding the objective, which was to develop a roundabout intersection simulation to understand the efficiency and capacity of a roundabout at different vehicle speeds. Having a good understanding of the objective helped me design the model and set appropriate parameters. Making linear intersections is quite easy with the Intersection feature in the Space Markup window. However, making a circular intersection from roads is done something using the Make Segment Linear/Arc-based feature as shown below in the picture (Ref Fig 1.)
Fig 1. Intersection and circular arcs generation options
Step 2: Sketching the Layout
I began by sketching the layout of the roundabout, defining the number of entry and exit points, and the overall size and shape of the roundabout. This was done to establish the complexity of the model and its interaction with traffic. These layouts can be configured by using stop lines and adding traffic lights.
Fig 2. Stop line with traffic light generation
Step 4: Designing the Logic
After designing the road and intersections, the next step is designing the logic blocks. You have to familiarize yourself with all the blocks you will be requiring and add them accordingly to build your own structure. I added 'Car Source' elements on each entry point to allow for traffic flow. After that a ‘Select Output’ block was added, which assigns probabilities to the movement of the car (For example: A probability of value 1, will indicate all cars moving in a particular direction). ‘Select Output 5’ can also be used if multiple probabilities have to be assigned. The most important step is using a ‘Car Move To’ block, which determines on which road the car will turn, depending on the probability assigned to it. Finally the 'Car Dispose' element at the exits indicates an end to the required traffic block.
Fig 3. Sample Logic Diagram using Elements of the Traffic Toolbox
Step 5: Configuring the Parameters
I set the 'Car Source' element to generate vehicles at a rate of 1000 cars per hour, distributed evenly among the different entry points. Distribution of the cars evenly can be done using the ‘Interarrival time’ block in the Car Source feature. I ensured the 'Car Sink' was set up correctly to remove cars from the system once they exited.
Fig 4. Frequency of cars generation
Step 7: Running the Simulation
After all the elements were set, I clicked on the 'Run' button to start the simulation. I observed the behaviour of the cars as they navigated through the roundabout. It was a fascinating sight to see 1000 cars being managed efficiently through the roundabout.
Step 8: Analyzing the Results
To analyze the simulation, I used the data collection and visualization features of AnyLogic. I paid particular attention to parameters such as the average time taken by a car to pass through the roundabout and the number of cars within the roundabout at a given time. There are numerous features one can use to analyse their results.
Step 9: Making Adjustments
Based on the results of the initial simulation run, I made adjustments to optimize the traffic flow. This included tweaking the car generation rate and traffic light timings (if any). The beauty of simulation is the ability to quickly change parameters and see the results.
Step 10: Documentation and Reporting
Finally, I documented all the findings, interpretations, and conclusions from the project. It's always important to effectively communicate your findings, and AnyLogic provides various tools to help generate comprehensive reports.
Creating a roundabout intersection with a simulated traffic flow of cars per hour was a thrilling experience. It allowed me to use AnyLogic's features to the fullest and provided valuable insights into the functioning and efficiency of roundabouts under heavy traffic. The project truly epitomized the power of simulation in solving real-world problems.
There were numerous challenges that I faced on my way to simulate the project
1. Creating roundabouts- The very first step I was stuck at was creating roundabouts. With the help of the make arc segment as explained above, I was able to do it.
2. Arrival of cars at the same time- Defining the rate of cars and then making them arrive at the same point at the start can be a tedious problem. Here the interarrival time feature helped and solved my issue.
3. Defining different speeds for different roads- As I wanted different speeds for the vehicles on the roundabout and the road, debugging the issue was done using stop lines and assigning speed limits to it.
PS: Here is an overall view of a simple model I have created and is downloadable below or on AnyLogic cloud here
Finally, would like to thank Mr. Jaco Ben Vosloo, Mr. Enrico Miranda, Mr. Benjamin Schumann, Mr. Bipin Deshpande and Mr. Felipe Haro for guiding me throughout the project and assisting wherever I needed.
Thank you for taking the time to read about my journey with AnyLogic. I hope you found it enlightening and inspiring for your own simulation projects. If you have any questions or need further clarification, please leave a comment below.
Sanchit .S. Divadkar
Snachit is a simulation enthusiast and guest writer for The AnyLogic Modeler. Contact him on LinkedIn to get in touch.
If you liked this post, you could read more posts by following the links above. Why not subscribe to our blog or follow us on any of the social media accounts for future updates? The links are in the Menu bar at the top, or the footer at the bottom. You can also join the mobile app here!
If you really want to make a difference in supporting us please consider joining our Patreon community here
If you want to contact us for some advice, maybe a potential partnership or project or just to say "Hi!", feel free to get in touch here, and we will get back to you soon!