traffsimpy


Nametraffsimpy JSON
Version 0.1.12 PyPI version JSON
download
home_page
SummarySimulate traffic flow
upload_time2023-06-26 12:36:35
maintainer
docs_urlNone
author
requires_python>=3.10
licenseMIT 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.
keywords simulation traffic vehicules roads
VCS
bugtrack_url
requirements colorama matplotlib numpy pandas pygame PyYAML webcolors
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "traffsimpy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "simulation,traffic,vehicules,roads",
    "author": "",
    "author_email": "Hippolyte Cosserat <hippolytecosserat@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/c4/09/d03cd09cac97155948e039856787bd636caedcfab0ec2b70bcde4f953219/traffsimpy-0.1.12.tar.gz",
    "platform": null,
    "description": "# TraffSimPy\n\nModule Python permettant de mod\u00e9liser le trafic routier de n'importe quel r\u00e9seau.\n\n## D\u00e9marrage rapide\n\nSimulons une route droite, o\u00f9 la vitesse des v\u00e9hicules est limit\u00e9e \u00e0 50 km/h et o\u00f9 des voitures arrivent toutes les deux secondes.\n\n#### On importe les objets de bases du module\n\n```\nfrom traffsimpy import Simulation, CarFactory\n```\n\nL'objet Simulation g\u00e8re l'affichage et la mod\u00e9lisation, l'objet CarFactory g\u00e8re la cr\u00e9ation de nouveaux v\u00e9hicules.\n\n#### On cr\u00e9e un objet Simulation\n\n```\nsim = Simulation(\"Route droite\", 1440, 820)\n```\n\nLe titre de la simulation sera \"Route droite\" et la fen\u00eatre qui l'affichera sera de taille 1440\u00d7820.\n\n#### On cr\u00e9e un objet CarFactory\n\n```\nfreq = 2\ncar_factory = CarFactory(freq)\n```\n\nIl cr\u00e9era un nouveau v\u00e9hicule toutes les deux secondes.\n\n#### On d\u00e9finit le r\u00e9seau routier\n\n```\nroad_list = [{\"start\": (-60, 410), \n\"end\": (1500, 410), \n\"v_max\": 13.9, \n\"car_factory\": car_factory}]\n\nsim.create_roads(road_list)\n```\n\nIl est constitu\u00e9 d'une seule route, qui va des points (-60, 410) \u00e0 (1500, 410), qui a pour limite de vitesse 13.9 m/s \u2248 50 km/h et qui a pour usine \u00e0 voitures le CarFactory d\u00e9finit pr\u00e9c\u00e9dement.\n\n#### On lance la simulation\n\n```\nsim.run()\n```\n\nElle restera ouverte jusqu'\u00e0 ce que l'utilisateur quitte. Pendant la simulation, on peut ralentir, acc\u00e9lerer et arr\u00eater le temps, bouger dans le r\u00e9seau routier et prendre des captures d'\u00e9cran.\n\n",
    "bugtrack_url": null,
    "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. ",
    "summary": "Simulate traffic flow",
    "version": "0.1.12",
    "project_urls": {
        "Homepage": "https://github.com/hcosserat/traffsimpy"
    },
    "split_keywords": [
        "simulation",
        "traffic",
        "vehicules",
        "roads"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1be460abc2b4522cc71407f99638358b23674067313ebd22d9fb3218bcd5c02c",
                "md5": "9d811a471ed1094b379398ae2104e926",
                "sha256": "0ed2ce6e18ea419fa178f48cde106a04eb7f082a3e2f6d73940497ffe86f0fef"
            },
            "downloads": -1,
            "filename": "traffsimpy-0.1.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9d811a471ed1094b379398ae2104e926",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 130092,
            "upload_time": "2023-06-26T12:36:33",
            "upload_time_iso_8601": "2023-06-26T12:36:33.473232Z",
            "url": "https://files.pythonhosted.org/packages/1b/e4/60abc2b4522cc71407f99638358b23674067313ebd22d9fb3218bcd5c02c/traffsimpy-0.1.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c409d03cd09cac97155948e039856787bd636caedcfab0ec2b70bcde4f953219",
                "md5": "ee7f76bad55721828f0bcb85a3bae7d5",
                "sha256": "120a6e267eafa7642754a275b8baa41492129579c68a11a7aed295127c8470c6"
            },
            "downloads": -1,
            "filename": "traffsimpy-0.1.12.tar.gz",
            "has_sig": false,
            "md5_digest": "ee7f76bad55721828f0bcb85a3bae7d5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 130643,
            "upload_time": "2023-06-26T12:36:35",
            "upload_time_iso_8601": "2023-06-26T12:36:35.726338Z",
            "url": "https://files.pythonhosted.org/packages/c4/09/d03cd09cac97155948e039856787bd636caedcfab0ec2b70bcde4f953219/traffsimpy-0.1.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-26 12:36:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hcosserat",
    "github_project": "traffsimpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "colorama",
            "specs": [
                [
                    "==",
                    "0.4.6"
                ]
            ]
        },
        {
            "name": "matplotlib",
            "specs": [
                [
                    "==",
                    "3.7.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.24.2"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "==",
                    "1.5.3"
                ]
            ]
        },
        {
            "name": "pygame",
            "specs": [
                [
                    "==",
                    "2.1.3"
                ]
            ]
        },
        {
            "name": "PyYAML",
            "specs": [
                [
                    "==",
                    "6.0"
                ]
            ]
        },
        {
            "name": "webcolors",
            "specs": [
                [
                    "==",
                    "1.12"
                ]
            ]
        }
    ],
    "lcname": "traffsimpy"
}
        
Elapsed time: 0.08502s