问题描述
我如何在 OMNeT++ 和 SUMO 中创建交通 灯,我必须创建交通灯并使用静脉示例在 XML 文件中配置该文件.
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.
推荐答案
适用于 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{
....
}
这篇关于在 SUMO 和 OMNeT++ 中创建交通灯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!