Skip to content

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

License

Notifications You must be signed in to change notification settings

WSL-IIITB/Traffic-Interventions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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,
    colour=(255,0,0)
)

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

Sample Usage: Stressed Junctions Detection

import trafficinterventions


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

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

Sample Usage: Polluted Junctions Detection

import trafficinterventions


ej = trafficinterventions.EmissionJunction.EmissionJunction(
    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()