我开始在项目中使用VACaMobil。但是,我遇到了问题。 我不知道我是不是错了,但我明白TraCIScenarioManagerLaunchd (因此,蚂蚁,VACaMobil)动态地创建代表每个车辆的节点,即。即 汽车模块没有在网络文件中定义,但它在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 ++给出了以下警告 以&#34; .channelNumber&#34;,&#34; .wlan。&#34;,&#34; .coche&#34;和&#34开头的行; .routingProtocol&#34 ;: &#34;警告:未使用的条目(与任何参数不匹配)与任何模块参数都不匹配。&#34; 显然,OMNeT ++抱怨因为模块TAdhocHost,其名称为&#34; coche&#34;, 在Cars.ned中没有定义,但是没有假设OMNeT ++自动识别出&#34; coche&#34; 是由VACaMobil创建的?我做错了什么?我将不胜感激任何帮助。
答案 0 :(得分:0)
在最简单的情况下(所有模块都是通过模拟文件中的相应语句创建的),IDE可以简单地解析所有.ned文件以了解存在哪些模块。
但是,Veins TraCIScenarioManager
直接使用OMNeT ++ C ++ API在运行时创建其他模块。在运行模拟之前,OMNeT ++ IDE无法知道这种情况会发生。
如果不了解您的C ++代码的作用,它就无法知道.ini文件中的模块参数(不是在开始时,而是在模拟的后期)会引用一个将存在的模块。
可能有办法解决这个问题(在.ned文件中声明不应该自动创建模块,但可以假设它存在),但我不记得任何不是黑客攻击的文件。 / p>