How I can create traffic light in OMNeT++ and SUMO, i have to create the traffic light and configure in XML file from which file using veins example.
The OMNeT++ proxy modules for SUMO traffic lights are available since Veins 4.7.
If you have a network including a traffic light, you need to add the following lines to your omnetpp.ini file:
*.manager.trafficLightModuleType = "org.car2x.veins.nodes.TrafficLight"
*.manager.trafficLightModuleName = "trafficLight"
*.manager.trafficLightModuleDisplayString = default
*.manager.trafficLightFilter = "MYTRAFFICLIGHTID"
*.trafficLight[*].mobility.x = 0
*.trafficLight[*].mobility.y = 0
*.trafficLight[*].mobility.z = 3
*.trafficLight[*].applType = "YOURAPPLAYERTYPE"
*.trafficLight[*].logicType = "YORUTRAFFICLIGHTLOGIC"
The term MYTRAFFICLIGHTID
needs to be replaced with the ID you're using in your SUMO network. If you have multiple traffic lights to control, you can list SUMO IDs separated by spaces.
A traffic light consists of an application (YOURAPPLAYERTYPE
) and a logic (YORUTRAFFICLIGHTLOGIC
). Both properties are mandatory and need to be specified in your omnetpp.ini.
In the current Veins master branch, the YOURAPPLAYERTYPE
is an OMNeT++ module, that uses the DemoBaseApplLayer
as a the base module.
class YOURAPPLAYERTYPE: public DemoBaseApplLayer {
....
}
The YORUTRAFFICLIGHTLOGIC
is an OMNeT++ module, that uses the TraCITrafficLightAbstractLogic
as a the base module.
class YORUTRAFFICLIGHTLOGIC: public TraCITrafficLightAbstractLogic{
....
}