This simulation was made for a project at the University of Rostock, with the motivation of simulating an intersection close to our main building to see whether it is possible to improve the intersection.
As that is quite an ambitious project we limited our scope to solely simulating road users, i.e. no bikes, pedestrians or trams. It only simulates cars, buses and trucks.
The simulation is capable of simulating arbitrary intersections, due to limitations with python these can't be all that big though.
This project uses uv for dependency management. Install it, then run:
uv sync
This creates a virtual environment with the correct Python version (see .python-version) and all
dependencies. uv run (see below) also does this automatically, so an explicit uv sync is optional.
Note that a specific version of arcade is pinned in pyproject.toml since newer versions
introduced differences which were interfering with our implementation.
The graphical interface additionally needs system OpenGL libraries (libGL/libGLU), which are not
installable via uv.
The simulation is started through a single entry point:
uv run traffic-sim runs a graphical user interface to visually show the simulation
uv run traffic-sim --no-gui runs the simulation without a graphical interface, to test the maximum speed of the simulation
The python files in the parent directory are the modules behind these two modes and can also be
run directly, e.g. uv run gui_sim.py or uv run speed_test_sim.py.
As you can see the visualizer and the simulator are separated from each other therefore the simulation can work entirely without the visualizer.
- Simulator - Contains the simulator
- Visualisation - Contains the gui which can draw
- Data - The data when running the simulation is saved here
- Evaluation - Data evaluation from the data we have been given
- Intersections - A number of intersections which can be loaded in the simulation
There is no way of loading a different intersection without editing code right now.
To change the intersections go to Simulator/simulator.py, then change real_intersection to
one of the other possible intersections. For example threeway_intersection.
GPLv3, see LICENSE
