且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 SUMO 和 OMNeT++ 中创建交通灯

更新时间:2023-01-14 21:06:54

适用于 SUMO 交通灯的 OMNeT++ 代理模块自 Veins 4.7 起可用.

The OMNeT++ proxy modules for SUMO traffic lights are available since Veins 4.7.

如果您的网络包含交通灯,则需要将以下几行添加到您的 omnetpp.ini 文件中:

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"

术语 MYTRAFFICLIGHTID 需要替换为您在 SUMO 网络中使用的 ID.如果您要控制多个交通灯,您可以列出用空格分隔的 SUMO ID.

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.

交通灯由应用程序(YOURAPPLAYERTYPE)和逻辑(YORUTRAFFICLIGHTLOGIC)组成.这两个属性都是必需的,需要在您的 omnetpp.ini 中指定.

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.

在当前的 Veins 主分支中,YOURAPPLAYERTYPE 是一个 OMNeT++ 模块,它使用 DemoBaseApplLayer 作为基础模块.

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 {
....
}

YORUTRAFFICLIGHTLOGIC 是一个 OMNeT++ 模块,它使用 TraCITrafficLightAbstractLogic 作为基础模块.

The YORUTRAFFICLIGHTLOGIC is an OMNeT++ module, that uses the TraCITrafficLightAbstractLogic as a the base module.

class YORUTRAFFICLIGHTLOGIC: public TraCITrafficLightAbstractLogic{
....
}