OMNeT++ 无法识别 VACaMobil 创建的节点
Posted
技术标签:
【中文标题】OMNeT++ 无法识别 VACaMobil 创建的节点【英文标题】:OMNeT++ doesn't recognize nodes created by VACaMobil 【发布时间】:2015-12-07 23:54:29 【问题描述】:我开始在一个项目中使用 VACaMobil。但是,我遇到了问题。 我不知道我是不是错了,但我明白 TraCIScenarioManagerLaunchd (因此,VACaMobil)动态创建代表每辆车的节点,即。 e. car 模块没有在网络文件中定义,但它在 omnetpp.ini 文件中声明,在 参数“.manager.moduleType”和“.manager.moduleName”。就我而言,模块 type 是基于 inet/examples/VACaMobil/Cars 的 Car 模块的自定义汽车模块,并且 模块名称是“coche”。
这里是 omnetpp.ini 文件:
[General]
network = Cars
cmdenv-express-mode = true
cmdenv-autoflush = true
cmdenv-status-frequency = 10000000s
repeat = 10
tkenv-plugin-path = ../../../etc/plugins
tkenv-image-path = bitmaps
#sim-time-limit = 6000s
check-signals = true
**.manager.**.scalar-recording = true
**.manager.**.vector-recording = true
**.manetrouting.**.scalar-recording = true
**.movStats.**.scalar-recording = true
**.movStats.**.vector-recording = true
**.mac.**.scalar-recording = true
**.mac.**.vector-recording = true
**.scalar-recording = true
**.vector-recording = true
*.channelControl.carrierFrequency = 2.4GHz
*.channelControl.pMax = 2mW
*.channelControl.sat = -110dBm
*.channelControl.alpha = 2
*.channelControl.numChannels = 1
# TraCIScenarioManagerLaunchd
*.manager.updateInterval = 1s
*.manager.host = "localhost"
*.manager.port = 9999
*.manager.moduleType = "rcdp9.TAdhocHost"
*.manager.moduleName = "coche"
*.manager.moduleDisplayString = ""
*.manager.autoShutdown = true
*.manager.margin = 25
*.manager.doNothing = false
# nic settings
**.wlan.bitrate = 24Mbps
**.wlan.opMode = "g"
**.wlan.mgmt.frameCapacity = 10
**.wlan.mgmtType = "Ieee80211MgmtAdhoc"
**.wlan.mac.basicBitrate = 24Mbps
**.wlan.mac.controlBitrate = 24Mbps
**.wlan.mac.address = "auto"
**.wlan.mac.maxQueueSize = 14
**.wlan.mac.rtsThresholdBytes = 3000B
**.wlan.mac.retryLimit = 7
**.wlan.mac.cwMinData = 7
**.wlan.radio.transmitterPower = 2mW
**.wlan.radio.thermalNoise = -110dBm
**.wlan.radio.sensitivity = -85dBm
**.wlan.radio.pathLossAlpha = 2
**.wlan.radio.snirThreshold = 4dB
**.getStatistics = true
**.statFiles = "$resultdir/$configname-$runnumber-"
**.channelNumber = 0
[Config RCDP]
**.coche[0..49].app1.localPort = 1000
**.coche[0..49].app1.destPort = 1000
**.coche[0..49].app1.messageLength = $50000000B ! length
**.coche[0..49].app1.burstSize = 10
**.coche[0..49].app1.bandWidth = 147200bps
**.coche[0..49].app1.alpha = 0.5
**.coche[0..49].app1.beta = 0.8
**.coche[0..49].app1.destAddresses = moduleListByPath("**.coche[50..99]")
**.coche[0..49].networkLayer.configurator.networkConfiguratorModule = "configurator"
**.coche[50..99].app2.localPort = 1000
**.coche[50..99].app2.messageLength = $length = 50000000B
**.coche[50..99].app2.bandWidth = 147200bps
**.coche[50..99].app2.maxBandWidth = 24Mbps
#**.meanNumberOfCars = $100, 200, 300, 400
**.meanNumberOfCars = 100
**.warmUpSeconds = 0s
**.autoShutdown = false
*.manager.launchConfig = xmldoc("VACaMobil/Milan/downtown.launch.xml")
# manet routing
**.routingProtocol = $"AODVUU", "DYMO", "OLSR"
[Config TCP]
**.coche[0..49].app3.localPort = 1000
**.coche[0..49].app3.startTime = 0s
**.coche[0..49].app3.stopTime = 100s
**.coche[0..49].app3.thinkTime = 1s
**.coche[0..49].app3.idleInterval =3s
**.coche[0..49].app3.requestLength = 50000000B
**.coche[0..49].app3.numRequestsPerSession = 100
**.coche[0..49].app3.connectAddress = moduleListByPath("**.coche[50..99]")
**.coche[0..49].networkLayer.configurator.networkConfiguratorModule = "configurator"
**.coche[50..99].app4.dataTransferMode = "object"
#carGRCnator
**.getStatistics = true
**.statFiles = "$resultdir/$configname-$runnumber-"
#**.meanNumberOfCars = $100, 200, 300, 400
**.meanNumberOfCars = 100
**.warmUpSeconds = 0s
**.autoShutdown = false
*.manager.launchConfig = xmldoc("VACaMobil/Milan/downtown.launch.xml")
# manet routing
**.routingProtocol = $"AODVUU", "DYMO", "OLSR"
这是汽车模块(TAdhocHost.ned):
package rcdp9;
import inet.base.NotificationBoard;
import inet.networklayer.autorouting.ipv4.HostAutoConfigurator;
import inet.networklayer.common.InterfaceTable;
import inet.mobility.single.TraCIMobility;
import inet.networklayer.ipv4.RoutingTable;
import inet.transport.tcp.TCP;
import inet.transport.udp.UDP;
import inet.nodes.inet.NetworkLayer;
import inet.linklayer.ieee80211.Ieee80211Nic;
import inet.networklayer.IManetRouting;
module TAdhocHost
parameters:
@node();
string routingProtocol @enum("AODVUU","DYMOUM","DYMO","DSRUU","OLSR","OLSR_ETX","DSDV_2","Batman") = default("");
gates:
input radioIn @directIn;
submodules:
notificationBoard: NotificationBoard
parameters:
@display("p=60,160");
interfaceTable: InterfaceTable
parameters:
@display("p=60,240");
app1: RCDPClient
parameters:
@display("p=304,56");
app2: RCDPServer
parameters:
@display("p=210,56");
app3: TCPClient
parameters:
@display("p=378,56");
app4: TCPServer
parameters:
@display("p=147,56");
mobility: TraCIMobility
parameters:
@display("p=60,459");
routingTable: RoutingTable
parameters:
IPForward = true;
routerId = "";
routingFile = "";
@display("p=60,326");
udp: UDP
parameters:
@display("p=304,192");
tcp: TCP
parameters:
@display("p=219,192");
networkLayer: NetworkLayer
parameters:
proxyARP = false;
@display("p=304,327;q=queue");
gates:
ifIn[1];
ifOut[1];
manetrouting: <routingProtocol> like IManetRouting if routingProtocol != ""
@display("p=522,307");
wlan: Ieee80211Nic
parameters:
@display("p=304,461;q=queue");
ac_wlan: HostAutoConfigurator
@display("p=60,401");
connections allowunconnected:
udp.appOut++ --> app1.udpIn;
udp.appIn++ <-- app1.udpOut;
udp.appOut++ --> app2.udpIn;
udp.appIn++ <-- app2.udpOut;
udp.ipOut --> networkLayer.transportIn++;
udp.ipIn <-- networkLayer.transportOut++;
tcp.appOut++ --> app3.tcpIn;
tcp.appIn++ <-- app3.tcpOut;
tcp.appOut++ --> app4.tcpIn;
tcp.appIn++ <-- app4.tcpOut;
tcp.ipOut --> networkLayer.transportIn++;
tcp.ipIn <-- networkLayer.transportOut++;
wlan.upperLayerOut --> networkLayer.ifIn[0];
wlan.upperLayerIn <-- networkLayer.ifOut[0];
networkLayer.transportOut++ --> manetrouting.from_ip if routingProtocol != "";
networkLayer.transportIn++ <-- manetrouting.to_ip if routingProtocol != "";
radioIn --> wlan.radioIn;
这是网络文件(Cars.ned):
package rcdp9;
import inet.world.VACaMobil.VACaMobil;
import inet.networklayer.autorouting.ipv4.IPv4NetworkConfigurator;
import inet.nodes.inet.AdhocHost;
import inet.world.radio.ChannelControl;
import inet.world.traci.TraCIScenarioManagerLaunchd;
network Cars
submodules:
configurator: IPv4NetworkConfigurator
@display("p=396,221");
channelControl: ChannelControl
@display("p=396,310");
manager: VACaMobil
@display("p=322,405");
connections allowunconnected:
问题是在 omnetpp.ini 中,OMNeT++ 给出了以下警告 在以“.channelNumber”、“.wlan.”、“.coche”和“.routingProtocol”开头的行中: “警告:未使用的条目(不匹配任何参数)不匹配任何模块参数。” 显然,OMNeT++ 抱怨是因为模块 TAdhocHost,其名称为“coche”, Cars.ned 中没有定义,但不假定 OMNeT++ 自动识别“coche” 是由 VACaMobil 创建的?我做错了什么?我将不胜感激。
【问题讨论】:
【参考方案1】:在最简单的情况下(所有模块都是通过模拟的 .ned 文件中的适当语句创建的),IDE 可以简单地解析所有 .ned 文件以了解存在哪些模块。
但是,Veins TraCIScenarioManager
直接使用 OMNeT++ C++ API 在运行时创建附加模块。在运行模拟之前,OMNeT++ IDE 无法知道会发生这种情况。
如果不了解您的 C++ 代码的作用,它就无法知道 .ini 文件中的模块参数将(不是在开始时,而是在模拟的后期)引用将存在的模块。
可能有办法解决这个问题(在 .ned 文件中声明不应自动创建模块,但可以假定它仍然存在),但我不记得任何不是 hack 的方法。
【讨论】:
谢谢,克里斯托夫。我以为 OMNeT++ 无法识别 VACaMobil 创建的节点,但我错了。我正在检查我的项目,问题是节点不通过 UDP 或 TCP 进行通信,这是我的目标。对于第一个配置,我有两个 UDP 应用程序(客户端和服务器),对于第二个配置,我有两个 TCP 应用程序(客户端和服务器)。我只看到了一个 UDP 或 TCP 应用程序的示例。这有可能吗?我做错了什么? *** 旨在为好问题收集好答案。为此,最好不要将多个问题合二为一。您在评论中提出的问题听起来与您原来的问题不同。如果您不介意,可以单独提出一个问题吗?以上是关于OMNeT++ 无法识别 VACaMobil 创建的节点的主要内容,如果未能解决你的问题,请参考以下文章