Skip to content

Sumo Configuration

Finnk11 edited this page Aug 20, 2024 · 2 revisions

Sumo Configuration

The Sumo Configuration for the "Simple Unprotected Right" scenario is located and configured within the nets/simple_unprotected_right directory.

Network Configuration (Netconfig)

The xml files in the netconfig directory are for defining the network parameters for the scenario, which consists of a simple traffic light controlled intersection featuring an additional right-turn traffic signal. For comprehensive details on the required plain XML files, please refer to the official SUMO documentation: SUMO Network Plain XML Documentation.

These files are meant to be edited by hand and are used to generate the actual network and route files used in the simulation.

Nodes

The nodes specified in nodes.nod.xml represent critical points within the network. The central node, positioned at coordinates x=0, y=0, models the junction and is assigned the type traffic_light_unregulated. This indicated that vehicles will enter the intersection as soon as they receive a green signal without considering traffic. When multiple traffic signals display green at the same time, this can potentially lead to collisions. The remaining nodes mark the entry and exit points of vehicles in the simulation. These nodes are tagged with fringe="outer" to inform SUMO that they represent the other boundaries of the simulation.

Edges

Edges are defined as connections between two nodes, with nodes representing junctions and edges corresponding to the streets that connect them. The from and to attributes specify the direction of the edge. The priority of all streets is identical, as right-of-way considerations are not part of this scenario. Each street is composed of a single lane, with the addition of a designated right turning lane only from the south. The speed limit is set at 55.56 m/s (200km/h), which is the maximum velocity for most default vehicle types in SUMO. The speed limit is set high to not interfere with the desired speeds (up to 130 km/h) of the vehicles. All streets are aligned with the center of the intersection.

Connections

Vehicle routing within the simulation is restricted to three specific paths:

  • horizontal through traffic from west to east
  • vertical through traffic from south to north and
  • a right turn from south to east.

Traffic in other directions or other turns are not permitted in this scenario.

Traffic Light Logic

The traffic light sequence in this scenario consists of three distinct phases:

  1. Safe Phase: This phase permits through traffic from west to east while prohibiting other vehicles from entering the intersection.
  2. Unprotected Right Phase: During this phase, both horizontal traffic and the right turn from south to east receive a green light simultaneously, potentially leading to collisions.
  3. Protected Phase: This phase allows both routes from the south to proceed while stopping horizontal traffic.

Each phase is configured to last 27 seconds, followed by a 3-second yellow phase. This alternating sequence between red/green and yellow phases is required for SUMO RL, as these phases represent the discrete actions available to the RL agents.

Vehicle Configuration

The vehicle configuration is managed within the vconfig directory. Currently, vehicle types in vtypes.rou.xml are used only to define the desired speed (in m/s) of each vehicle.

To prepare traffic flow generation, one vehicle is configured per route in vehicles.rou.xml. They are set to spawn at the start/base of their respective streets, matching the speed of the vehicle ahead to minimise the risk of immediate rear-end collisions, particularly in congested conditions. Additionally, vehicles are set to spawn in the optimal lane, reducing the likelihood of lane changes, as lane-changing behaviour is not part of this scenario.

Similar to the Network Configuration, these files are meant to be edited by hand and are used to generate the actual network and route files used in the simulation.

Configuration

Important: All files outside the netconfig and vconfig sub-directories should not be modified manually!

netconvert is used to transform the network files in netconfig into the simple_unprotected_right.net.xml SUMO-road network file. The configuration is located in simple_unprotected_right.netccfg.

The findAllRoutes.py SUMO python tool is used to generate all possible routes, each with ids. This is meant for larger networks and increases scalability. The output of this script is a 'routes.rou.xml' file.

duarouter, configured in simple_unprotected_right.duarcfg, and used solely to merge vehicle types, vehicles and routes into a single route file, producing 'config.rou.xml'.

Finally, the vehicle2flow.py SUMO python tool, converts config.rou.xml into the final route file simple_unprotected_right.rou.xml, by incorporating the vehicle configurations from the vconfig files.

The sumo simulation itself is configured through simple_unprotected_right.sumocfg.