Skip to main content

Python Package to perform simple Traffic Interventions and run traffic simulations.

Project description

Traffic-Interventions

Installation

  • python -m pip install --upgrade pip
  • pip install --upgrade trafficinterventions

Documentation

All relevant files can be found here


Interventions

Sample Usage : Edge Manipulation

import trafficinterventions

ce = trafficinterventions.ChangeEdges.ChangeEdges(fileName="sample.xml")

# Sample Intervention
ce.disallowAppendTypes(["bus"], ["-100"], "new_file.xml")

Sample Usage : Lane Manipulation

import trafficinterventions

cl = trafficinterventions.ChangeLanes.ChangeLanes(fileName="sample.xml")

# Sample Intervention
ce.changePriorityLanes(["highway.cycleway"], 100, "new_file.xml")

Sample Usage : Trip Manipulation

import trafficinterventions

ct = trafficinterventions.ChangeTrips.ChangeTrips(fileName="sample.xml")

# Sample Intervention
ct.changeTripStartTime([3], 1.00, "new_file.xml")

Simulations

Sample Usage: Speed Camera Placement

import trafficinterventions


sc = trafficinterventions.SpeedCamera.SpeedCamera(
    maxTimeSteps= 1000,
    nearestNeighbourDisallow= 250.0,
    gridArray=[-10000,10000,10000,-10000],
    pathCFG="map.sumocfg",
    outPath="Outputs/",
    summaryFilePath="summary.txt",
    numLocs=5
)

# Run the simulation and get outputs
sc.runSimulation() 

Sample Usage: Stressed Junctions Detection

import trafficinterventions


sj = trafficinterventions.StressJunction.StressJunction(
        maxTimeSteps=1000, 
        weightsArray=[1,1,1,1,1], 
        pathCFG="map.sumocfg", 
        outPath="Outputs/", 
        pathNET="osm.net.xml", 
        pathSummaryFile="stressed_junctions.txt", 
        numLocs = 5
)

# Run the simulation and get outputs   
sj.runSimulation()

Sample Usage: Polluted Junctions Detection

import trafficinterventions


ej = trafficinterventions.EmissionJunction.EmissionJunction(
    maxTimeSteps=1000, 
    pathCFG="map.sumocfg", 
    outPath="Outputs/", 
    pathNET="osm.net.xml", 
    pathSummaryFile="polluted_junctions.txt", 
    numLocs = 5, 
    initialPoiLocation = (5064.74,3568.48) 
)

# Run the simulation and get outputs   
ej.runSimulation()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trafficinterventions-2.0.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trafficinterventions-2.0.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file trafficinterventions-2.0.1.tar.gz.

File metadata

  • Download URL: trafficinterventions-2.0.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for trafficinterventions-2.0.1.tar.gz
Algorithm Hash digest
SHA256 e3bc532e5ddc2b13010e3a35f8444426ebaf4efdf6e46d4eba7ef66f3a2eaea4
MD5 13a0b6cc3de1cd736baff14c3a7306bf
BLAKE2b-256 8c5d5322baa979e7985d05f722f78150b9bbd2c36c1ee4b51e064326867bceba

See more details on using hashes here.

File details

Details for the file trafficinterventions-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for trafficinterventions-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1e9e34001258ab3b72057af75d39dcc7848fc2a0c143204b74d23eff1b0bfd87
MD5 aa1c8284f35578b83a257062219a148a
BLAKE2b-256 dda1bf4549eb4467c6bf7d724401fa4c27880811cd2752199694d733623d191d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page