Reference

Agent generation

SmartTransitionSim.RectType

Rect type represent rectangle area on map

Fields

  • p1 : Latitude-Longitude coordinates of first rectangle corner
  • p2 : Latitude-Longitude coordinates of second rectangle corner
source
SmartTransitionSim.AgentType

Agent type stores information about agents

Fields

  • smart : logical value indicating if agent use re-routing service
  • start_node : starting point of agent's route
  • end_node : ending point of agent's route
  • route : array of nodes determining agent's route (may be changed by re-routing)
  • start_time : time after which agent starts moving
  • travel_time : time spent in simulation
  • edge : current edge agent is on
  • active : indicates if agent is active in simulation
source
SmartTransitionSim.pick_random_nodeFunction

pick_random_node function is used to get starting and ending node of agents. Nodes are randomly chosen from set of provided areas.

Input parameters

  • OSMmap : OpenStreetMapX mapData object with road network data
  • rects : vector of Rect types interpreted as a set of rectangle areas
source
SmartTransitionSim.get_nodes_setFunction

get_nodes_set function is used to get set of nodes within passed area.

Input parameters

  • OSMmap : OpenStreetMapX mapData object with road network data
  • rects : vector of Rect types interpreted as a set of rectangle areas
source
SmartTransitionSim.generate_agentsFunction

generate_agents function creating vector of agents and returning travel time for initial routes travelled with maximal speed

Input parameters

  • OSMmap : OpenStreetMapX MapData object with road network data
  • N : number of agents to be generated
  • StartArea : vector of areas from which agents randomly pick starting point
  • EndArea : vector of areas from which agents randomly pick ending point
  • α : percentage of smart agents
  • k : number of fastest routes used in k-path algorithm
  • T : control variable for k-path algorithm probability distribution
  • AvgStartTime : average agents start time in minutes
  • k_routes_dict : dictionary with multiple shortest paths (values) between vertices (keys)
  • seed : set seed for random function
source

Rerouting

SmartTransitionSim.k_shortest_path_rerouting!Function

k_shortest_path_rerouting! change agents current route according to traffic conditions

Input parameters

  • OSMmap : OpenStreetMapX MapData object with road network data
  • k_routes_dict : dictionary with multiple shortest paths (values) between vertices (keys)
  • inAgent : modified agent
  • speeds : current speed matrix
  • max_speeds : matrix with maximal speeds on edges
  • k : number of fastest routes returned
  • T : control variable for probability distribution
  • upd_period : update period in seconds - if different from 0 enables rerouting based on distance travelled during one update period
source
SmartTransitionSim.yen_a_starFunction

yen_a_star is modified version of LightGraphs yenkshortest_paths function

Input parameters

  • g : road network graph
  • source : source vertex
  • target : target vertex
  • distmx : weight matrix
  • K : number of routes to be calculated
source

Traffic model

SmartTransitionSim.get_max_densitiesFunction

get_max_densities calculate maximal traffic densities on all edges

Input parameters

  • OSMmap : OpenStreetMapX MapData object with road network data
  • density_factor : road length reserved for one vehicle
source
SmartTransitionSim.update_weights!Function

update_weights! change speeds in given speedmatrix for edges listed in newdensities

Input parameters

  • speed_matrix : matrix with average speeds on edges
  • new_densities : dictionary with edges as keys and new traffic density as value
  • max_densities : matrix with maximal densitites on edges
  • V_max : matrix with maximal speeds on edges
  • V_min : minimal speed on road
source
SmartTransitionSim.update_weights_and_events!Function

update_weights_and_events! update events time and weights in speed matrix

Input parameters

  • inAgents : set of agents created with generate_agents function
  • agents_pos : vector with agents current position (edges)
  • events : vector with events time
  • speed_matrix : matrix with average speeds on edges
  • edges : one or two edges that took part in an event
  • dens : dictionary with current density on edges
  • max_densities : matrix with maximal densities
  • V_max : matrix with speed limits
  • V_min : minimal speed allowed on road
source
SmartTransitionSim.traffic_constantsFunction

traffic_constants create maximal traffic densities and speeds matrices

Input parameters

  • OSMmap : OpenStreetMapX MapData object with road network data
  • density_factor : road length reserved for one vehicle
source
SmartTransitionSim.init_traffic_variablesFunction

init_traffic_variables create data used in calculating velocities change during simulation

Input parameters

  • OSMmap : OpenStreetMapX MapData object with road network data
  • Agents : set of agents created with generate_agents function
source
SmartTransitionSim.next_edgeFunction

next_edge returns time required to reach next junction for one agent

Input parameters

  • Agent : single instance of Agent
  • speeds : current speeds matrix
  • lengths : road lengths matrix
source

next_edge returns time required to reach next junction for set of agents

Input parameters

  • Agents : set of agents created with generate_agents function
  • speeds : current speeds matrix
  • lengths : road lengths matrix
source
SmartTransitionSim.update_event_agent!Function

update_event_agent! update densities matrix, progress agents to next edge and deactivate agents

Input parameters

  • inAgent : agent connected with occuring event
  • curr_time : current simulation time
  • densities : current traffic densitites dictionary
  • vertices_map : mapping from nodes to vertices
source

Simulation

SmartTransitionSim.simulation_runFunction

simulation_run run traffic simulation in two modes.

Input parameters

  • mode : simulation model switch
    • :base : simulation with regular agents only
    • :smart : simulation with smart agents enabled
  • OSMmap : OpenStreetMapX MapData object with road network data
  • inAgents : set of agents created with generate_agents function
  • density_factor : road length reserved for one vehicle
  • k_routes_dict : dictionary with multiple shortest paths (values) between vertices (keys)
  • U : period of weights updates
  • T : distribution parameter in k-shortest path rerouting
  • k : number of fastest routes generated in rerouting function
  • debug : debug messages switch
  • track_avg_speeds : return average speeds on edges if true
source
SmartTransitionSim.gather_statisticsFunction

gather_statistics return various measures describing TMS model quality

Input parameters

  • smart_ind : vector with smart agent indicators
  • times_base : agents travelling time in base scenario
  • times_smart : agents travelling time in smart scenario
source

Utilities

SmartTransitionSim.print_map_statisticsFunction

print_map_statistics prints basic map file properties and characteristics of road network (OpenStreetMapX.MapData type) built on top of that

Fields

  • datapath : path to map file
  • mapfile : map file name
  • roadclass : highest road classe available on the map
source