
Matlab Cosimulate Sumo Simulink
Build Simulink models that co-simulate with Eclipse SUMO traffic simulator.
Install
npx skills add matlab/matlab-agentic-toolkit --skill matlab-cosimulate-sumo-simulink -g -a claude-code -y- Repository
- matlab/matlab-agentic-toolkit1.2k
- Category
- Testing
- Updated
- 8d ago
- License
- See repository
- Context cost
- Mediumabout 3,000 tokens
- Runs scripts
- No, instructions only
What it does
Build Simulink models that co-simulate with Eclipse SUMO traffic simulator. Use when creating SUMO-Simulink co-simulation, traffic simulation, TraCI connection, vehicle-in-the-loop testing, or ADAS scenario validation with SUMO. Covers Server/Client setup, Reader/Writer/Actor block configuration, random traffic generation, ego vehicle control, and SUMO file creation. Also use when the user mentions SumoInterfaceLibrary, .sumocfg files, or wants to connect Simulink to an external traffic simulator.
Build SUMO-Simulink Co-simulation
Create Simulink models that run synchronized co-simulation with Eclipse SUMO using the SumoInterfaceLibrary blocks from the Automated Driving Toolbox Interface for Eclipse SUMO Traffic Simulator.
When to Use
- Building a Simulink model that connects to Eclipse SUMO
- Setting up traffic co-simulation for ADAS/AD controller testing
- Reading vehicle states (position, speed) from SUMO into Simulink
- Controlling an ego vehicle in SUMO from a Simulink controller
- Spawning or removing vehicles dynamically during simulation
- Generating random background traffic without writing route files
When NOT to Use
- Pure SUMO simulation without Simulink (use SUMO's CLI or Python TraCI directly)
- Vehicle dynamics modeling (use Vehicle Dynamics Blockset)
- Scenario design with Driving Scenario Designer (different workflow)
Prerequisites
- Eclipse SUMO installed with
SUMO_HOMEenvironment variable set - Support package installed: "Automated Driving Toolbox Interface for Eclipse SUMO Traffic Simulator"
- Windows: append trailing separator to
SUMO_HOME, The Server block's launcher concatenatesSUMO_HOME + "bin\..."without a separator. IfSUMO_HOMElacks a trailing\or/, everysim()fails with "Failed to launch Eclipse SUMO simulator" even though SUMO is installed correctly. Always run before building/simulating:
if ~endsWith(getenv('SUMO_HOME'), filesep)
setenv('SUMO_HOME', [getenv('SUMO_HOME') filesep]);
end
- Verify:
getenv('SUMO_HOME')must return a valid path ending with a separator.


