Skip to content

Charging station integration guide

πŸ“˜ Introduction

This guide explains how to integrate electric vehicle charging stations into SUMO simulations using OpenStreetMap (OSM) data. The process involves modifying network XML files to add charging infrastructure while preserving existing traffic flow.

πŸ› οΈ Prerequisites

  • πŸ§ͺ SUMO simulation environment

  • πŸ—ΊοΈ OSM network data (processed via WebWizard)

  • 🧠 Basic understanding of XML structure

  • ✏️ Text editor for XML modification

🌐 Importing OSM Data

Before starting, you'll need to import your map data from OpenStreetMap: 1. Use SUMO's OSM Web Wizard 2. Select your desired map area and download the generated files

πŸ” Workflow overview

graph TD
    A[Original Network] --> B[Extract Edge/Node Files]
    B --> C[Modify Network Structure]
    C --> D[Add Charging Station]
    D --> E[Update Route Files]
    E --> F[Run Simulation]

🧩 Detailed Implementation Steps

  1. 🧾 Extract Network Components

Convert the main network file into editable components:

netconvert --sumo-net-file osm.net.xml --plain-output-prefix extracted_

This creates:

  • .edg.xml (road edges)

  • .nod.xml (intersection nodes)

  • .con.xml (connections)

  • .tll.xml (traffic lights)

  • .typ.xml (road types)

  • 🧱 Modify Network Structure

2.1 πŸ” Identify Target Edge

Select the edge where the charging station will be inserted. Example:

 <edge id="58404360#1" from="4260133805" to="4260133831" name="Calle Rodrigo de Escobedo" priority="3" type="highway.residential" numLanes="1" speed="5.56" spreadType="center" disallow="tram rail_urban rail rail_electric rail_fast ship">
        <lane index="0">
            <param key="origId" value="58404360"/>
        </lane>
    </edge>

2.2 βž— Calculate Insertion Point

Compute midpoint coordinates:

new_node_x = (start_x + end_x)/2 = 568.98 new_node_y = (start_y + end_y)/2 = 1013.235

<node id="cs_node" x=" 568.98" y="1013.235" type="priority"/>

2.3 βœ‚οΈ Split the Edge

Replace original edge with two segments:

 <edge id="58404360#1a" from="4260133805" to="cs_node" name="Calle Rodrigo de Escobedo" priority="3" type="highway.residential" numLanes="1" speed="5.56" spreadType="center" disallow="tram rail_urban rail rail_electric rail_fast ship">
      <lane index="0"/>
  </edge>

 <edge id="58404360#1b" from="cs_node" to="4260133831" name="Calle Rodrigo de Escobedo" priority="3" type="highway.residential" numLanes="1" speed="5.56" spreadType="center" disallow="tram rail_urban rail rail_electric rail_fast ship">
      <lane index="0"/>
  </edge>
  1. πŸ”Œ Add Charging Station Infrastructure

3.1 🧷 Create Nodes

  <node id="unifier_node" x="573" y="1013"/>        
  <node id="entry_node" x="578" y="1013"/>      
  <node id="exit_node" x="708" y="1013"/>        

3.2 πŸš— Create Edges

<edges>
  <edge id="way_entry_edge" from="cs_node" to="unifier_node" numLanes="1" speed="20"/>
  <edge id="way_exit_edge" from="unifier_node" to="cs_node" numLanes="1" speed="20"/>

  <edge id="cs_entry_edge" from="nodo_unificador" to="entry_node" numLanes="1" speed="20.00"/>
  <edge id="cs_exit_edge" from="exit_node" to="unifier_node" numLanes="1" speed="20.00"/>

  <edge id="charging_edge" from="entry_node" to="exit_node" numLanes="3" speed="5">
    <lane  index="0"/>  
    <lane  index="1" />  
    <lane  index="2" />  
  </edge>
</edges>

3.3 βš™οΈ Define Charging Stations

Create infrastructure.add.xml

<additional>
      <chargingStation id="cs1" lane="charging_edge_0" startPos="0" endPos="20" power="22000" efficiency="0.95"/>
      <chargingStation id="cs2" lane="charging_edge_1" startPos="0" endPos="20" power="22000" efficiency="0.95"/>
      <chargingStation id="cs3" lane="charging_edge_2" startPos="0" endPos="20" power="22000" efficiency="0.95"/>
</additional>

βœ… Verification & Simulation

  1. πŸ”§ Rebuild Network
netconvert --node-files extracted_.nod.xml --edge-files extracted_.edg.xml --output-file osm.net.xml
  1. ▢️ Run Simulation
sumo-gui -c simulacion.sumocfg

🐞 Troubleshooting

❗missing routes : ensure all route files reference the new ids (a, b) instead of the original edge