Troubleshooting for VANET Simulation
Guide for Sumo
- Link for the Sumo Website - http://www.dlr.de/ts/en/desktopdefault.aspx/tabid-9883/16931_read-41000/ for help related to Sumo.
- In case sumo Configuration files do not open, Right click on any Sumo Configuration file, go to propertiesopen withsumo.
- While Running NetSim Vanet Simulation – If any message pops up as “SUMO_HOME” Not found Go to My computer System Properties Advanced system settings Environment Variables. Add an Environment variable as “SUMO_HOME”.
- Sumo Configuration File must contain the paths of the Vehicle routes and Networks file.
- Set the exact End Time for Sumo Simulation in Sumo Configuration File.
Guide for Python
- Any Python 2.7 version Installer would work fine for running simulations.
- If you have installed python by an external Installer, make sure the Python Path is set. It would be set automatically by python installer that comes with NetSim.
- In case “Pywin 32” is not getting installed, or during simulation, error occurs as “win32 modules not found” try the code below (Run it as a python Code).
import sys
from _winreg import *
tweak as necessary
version = sys.version[:3]
installpath = sys.prefix
regpath = "SOFTWARE\Python\Pythoncore\%s\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%s\Lib\;%s\DLLs\" % (
installpath, installpath, installpath
)
def RegisterPy():
try:
reg = OpenKey(HKEY_CURRENT_USER, regpath)
except EnvironmentError as e:
try:
reg = CreateKey(HKEY_CURRENT_USER, regpath)
SetValue(reg, installkey, REG_SZ, installpath)
SetValue(reg, pythonkey, REG_SZ, pythonpath)
CloseKey(reg)
except:
print "* Unable to register!"
return
print "--- Python", version, "is now registered!"
return
if (QueryValue(reg, installkey) == installpath and
QueryValue(reg, pythonkey) == pythonpath):
CloseKey(reg)
print "=== Python", version, "is already registered!"
return
CloseKey(reg)
print "* Unable to register!"
print "* You probably have another Python installation!"
if name == "main":
RegisterPy()
VANET Simulation
- Changing Vehicle (Node) Names, Moving or deleting vehicles etc are disabled in Vanets Simulation.
- On running simulation, Backend calls Python file.
- Backend waits for the Pipes connection to be established.
Python
- SUMO_HOME Environment variable is checked. If Environment variable is not present, Error is displayed as “key interrupt error” in SUMO_HOME.
- Python File waits for Pipes connection. (“waiting for pipes to connect”).
- It reads initial data as GUI enable/disable from backend.
- “Checking sumo” is printed. If the environment variable SUMO_HOME points to wrong directory, error is displayed.
- Sumo Simulation is started where Sumo Binary is checked (To check Sumo.exe or Sumo GUI are working in the system or not). Then a TCP connection is made
- A while loop runs – It follows the following procedure
- Send Garbage value to Backend to clear pipe buffers (pipes).
- Read Vehicle name from NetSim (pipes).
- Compare with each vehicle present in Sumo. If vehicle is present –Then write confirmation (pipes) and read its position from NetSim (2pipes for X and Y coordinates). Also, sumo is stepped forward for every first vehicle In the list of current vehicles in sumo.
- If vehicle not present, fail (‘f’) is sent.
- Pipes and TCP closed.
Backend
- After establishing the connection, Backend checks for GUI flag, send ‘1’ if animation status is online.
- Simulation proceeds. Each time, backend Sends vehicle name to python, and receives XY positions, which are passed from python.
- Positions are updated and simulation proceeds.