CoMSES Net Discourse Forums

3D Urban Traffic Simulator (ABM) in Unity

3D Urban Traffic Simulator (ABM) in Unity (version 1.0.0)

The Urban Traffic Simulator is an agent-based model developed in the Unity platform. The model allows the user to simulate a number of autonomous vehicles (AVs) with the ability to tune granular parameters such as vehicle downforce, adherence to speed limits, top speed in mph and mass. The model allows researchers to tune these parameters, run the simulator for a given time period and export data from the model for analysis (an example is provided in Jupyter Notebook).

The data the model is currently able to output is the following:

  • AgentID: the unique agent identifier.
  • xAxisPos : the x-axis position of the agent.
  • zAxisPos : the y axis position of the agent.
  • topSpeed(mph): the top speed the vehicle is set to achieve throughout its drive cycle.
  • currentSpeed(mph): the current speed of the vehicle in mph.
  • distanceOfTravel(meters): the distance the vehicle has travelled over its drive cycle.
  • raycastLength : the length at which the vehicle can identify objects, 1 - very short to 10 high vision distance.
  • tractionControl : traction control initiated, some vehicles will have traction control others will not, this is entirely arbitrary.
  • VelocityMagnitude(BETA): the magnitude of the velocity for the vehicle.
  • VehicleMass: the vehicle weight in kg.
  • Downforce: the force applied to the vehicle to create more grip, 0.1 - small force to 10.0 - more force.
  • date-time: date and timestamps for each data point collected, currently its milliseconds and multiple actions by the raw physics engine can occur throughout the simulation. Therefore, large amounts of data points are collected for each run in short amounts of time.

NOTE! The simulation requires a decent computer to run, as the number of agents increase the computation complexity gets severe.

Release Notes

The Urban Traffic Simulator was developed in Unity 2019.3.03. The core model only requires Unity version 2019.3.03+ and the source code in the Assets folder to deploy. Unity can be downloaded here: https://unity3d.com/get-unity/download.

The following features are available: - The simulator can run 1 to 500 autonomous vehicles in 3D space that applies physics laws. - A menu UI is present, which allows the parameters to be tuned; these include the number of vehicles, maximum mass, maximum downforce, traction control. - The output data is exported to a directory provided by the user post model run. These data include the current speed of vehicles in mph, velocity magnitude, top speed in mph and distance travelled in meters. - A Jupyter Notebook is provided which runs some data analysis on data produced by the model for two example scenarios. - N number of vehicles can be set NOT to adhere to speed limits. This allows the user to compare scenarios where vehicles may drive faster than other vehicles. The subsequent impact of these vehicles can be observed regarding congestion, energy expenditure, and pollution. Congestion will likely occur in the Urban Street Network if most vehicles do NOT adhere to speed limits as vehicles can collide at intersections, preventing other vehicles from continuing their journey.


This is a companion discussion topic for the original entry at https://www.comses.net/codebases/32e7be8c-b05c-46b2-9b5f-73c4d273ca59/releases/1.0.0/