Metadata-Version: 2.1
Name: traffsimpy
Version: 0.1.8
Summary: Simulate traffic flow
Author-email: Hippolyte Cosserat <hippolytecosserat@gmail.com>
License: MIT License
        
        Copyright (c) 2023 Hippolyte Cosserat
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/hcosserat/traffsimpy
Keywords: simulation,traffic,vehicules,roads
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: colorama (>=0.4.6)
Requires-Dist: matplotlib (>=3.7.0)
Requires-Dist: numpy (>=1.24.2)
Requires-Dist: pandas (>=1.5.3)
Requires-Dist: pygame (>=2.1.3)
Requires-Dist: PyYAML (>=6.0)
Requires-Dist: webcolors (>=1.12)

# TraffSimPy

Module Python permettant de modéliser le trafic routier de n'importe quel réseau.

## Démarrage rapide

Simulons une route droite, où la vitesse des véhicules est limitée à 50 km/h et où des voitures arrivent toutes les deux secondes.

#### On importe les objets de bases du module

```
from traffsimpy import Simulation, CarFactory
```

L'objet Simulation gère l'affichage et la modélisation, l'objet CarFactory gère la création de nouveaux véhicules.

#### On crée un objet Simulation

```
sim = Simulation("Route droite", 1440, 820)
```

Le titre de la simulation sera "Route droite" et la fenêtre qui l'affichera sera de taille 1440×820.

#### On crée un objet CarFactory

```
freq = 2
car_factory = CarFactory(freq)
```

Il créera un nouveau véhicule toutes les deux secondes.

#### On définit le réseau routier

```
road_list = [{"start": (-60, 410), 
"end": (1500, 410), 
"v_max": 13.9, 
"car_factory": car_factory}]

sim.create_roads(road_list)
```

Il est constitué d'une seule route, qui va des points (-60, 410) à (1500, 410), qui a pour limite de vitesse 13.9 m/s ≈ 50 km/h et qui a pour usine à voitures le CarFactory définit précédement.

#### On lance la simulation

```
sim.run()
```

Elle restera ouverte jusqu'à ce que l'utilisateur quitte. Pendant la simulation, on peut ralentir, accélerer et arrêter le temps, bouger dans le réseau routier et prendre des captures d'écran.

