traci_helpers module
Helper functions building on TraCI
- traci_helpers.get_all_state_definition(traffic_lights)
Return all phase states for a given list of tls.
- Parameters
traffic_lights (list) – List of tls IDs
- Returns
List of dictionaries containing all state phases of a list of tls
- Return type
list
- traci_helpers.get_emissions(vehicles)
Calculate the mean emmision values for a list of vehicles.
- Parameters
vehicles (list) – List of vehicle IDs
- Returns
Five return values: mean NOx, mean PMx, mean CO2, mean CO, mean HC emissions emitted by the given list of vehicles
- Return type
float, float, float, float, float
- traci_helpers.get_lane_density(laneID)
Calculate the density of a given lane, i.e. number of vehicles in relation to the lane length.
- Parameters
laneID (str) – ID of the SUMO lane for which to calculate the density
- Returns
Lane density
- Return type
float
- traci_helpers.get_state(tlsID)
For a given tls return the average lane density for each controlled lane, i.e. number of vehicles in relation to the lane length.
- Parameters
tlsID (str) – ID of the SUMO traffic light system for which lanes to calculate the densities.
- Returns
List of lane densities
- Return type
list
- traci_helpers.get_state_definition(tlsID)
Return all phase states for a given tls.
- Parameters
tlsID (str) – ID of the tls
- Returns
Dictionary containing all state phases of a tls
- Return type
dict
- traci_helpers.get_vehicle_numbers(lanes)
For each given lane return the number of vehicles in those lanes.
- Parameters
lanes (list) – IDs of the SUMO lanes for which to count the number of vehicles.
- Returns
Dictionary where lanes are the keys and number of vehicles on those lanes are the values.
- Return type
dict
- traci_helpers.get_waiting_time(lanes)
Sum up the total waiting time for a list of lanes.
- Parameters
lanes (list) – List of lane IDs for which the waiting time should added to the sum.
- Returns
Sum of total waiting times for all vehicles on all given lanes.
- Return type
float
- traci_helpers.getnetworkwaitingtime(vehicles)
Calculate the average waiting time for a list of vehicles.
- Parameters
vehicles (list) – List of vehicle IDs.
- Returns
Average waiting time in the given vehicle group.
- Return type
float
- traci_helpers.getqueuelen(junction)
Sum up the queue length of all lanes controlles by given tls
- Parameters
junction (str) – ID of junction for which to sum up the queue length.
- Returns
Total queue length of the given junction
- Return type
int
- traci_helpers.phaseDuration(junction, phase_time, phase_state)
Set the phase of a given tls to a given phase for a given duration.
- Parameters
junction (str) – ID of the junction to set
phase_time (float) – Duration for which the state should be set
phase_state (str) – State to which the junction should be set
- Returns
None
- Return type
NoneType