Open source Transport Network Simulation - Analysis of traffic behaviour on networks for different traffic scenarios and network configurations.
Documentation can be found: here
You can find the opentnsim book, based on the examples in the notebooks folder on the opentnsim-book website.
Prerequisites:
- Python 3.12 or higher
- pip
- Dependency manager: Poetry or uv (Only need one of them)
If you do not have pip installed, this Python installation guide can guide you through the process. You can read the documentation for other installation methods and a more detailed description.
It is recommended to use either Poetry or uv for as dependency manager. For help on installing, using and trouble shooting these dependencymanagers see Virtual Environments basics folder on opentnsim-book.
To install OpenTNSim, you can choose how to install it into your system The set of commands show the three options for pip, Poetry and uv. Choose your desired installation method and enter the corresponding commands in the terminal:
# using pip
pip install opentnsim
# using Poetry
poetry add opentnsim
# using uv
uv add opentnsim
Then also install the extra dependencies used for testing and notebook support:
# using pip
pip install opentnsim[testing]
# using Poetry
poetry add opentnsim[testing]
# using uv
uv add opentnsim[testing]If you want to contribute or run notebooks follow the steps below:
Clone the repository Clone the repository and navigate to the location on your local machine
# Use git to clone OpenTNSim
git clone git://github.com/TUDelft-CITG/OpenTNSim
cd opentnsimUsing uv install packages.This will also automatically create your virtual environment under .venv
uv sync --extra testingUsing Poetry
poetry install --extras testingActivate your virtual environment:
# Linux
source .venv/bin/activate
# Windows
source .venv\Scripts\activateYou can now run scripts or tests:
## run specific python script
python script.py
# run all tests
pytest
# run single tests
pytest -k test_graph
# run notebooks tests
pytest --nbmake ./notebooks --nbmake-kernel=python3 --ignore ./notebooks/cleanup --ignore ./notebooks/student_notebooks --ignore ./notebooks/broken
# run with coverage
pytest --cov=opentnsim- Check if Jupyter extension is installed with
poetry show ipykerneloruv pip show ipykernel. - Open any
.ipynbfile - Select "opentnsim" kernel. Should look something like:
opentnsim-py3.13.
The benefit of OpenTNSim is the generic set-up. A number of examples are presented in in the notebooks folder on the opentnsim-book website. Additional examples can be found in the notebooks-folder in this repository.
Based on the examples and docs a book can be generated using the commands make book and cleaned up using make clean-book. These commands are unix only.
Code quality is checked using sonarcloud. You can see results on the sonarcloud website. For now we have disabled coverage and duplication checks. These can be enabled when we include coverage measurements and reduce duplication by optimizing the tests.
OpenTNSim makes use of the OpenCLSim code. Both packages are maintained by the same team of developers. You can use these packages together, and combine mixins from both packages. When you experience a problem with integrating the two packages, please let us know. We are working towards further integrating these two software packages.
