使用RandomWPMobility,omnet ++模拟环境时出错

时间:2017-10-19 13:42:54

标签: c++ omnet++ inet

我正在使用AODV协议(作为INET库的一部分实现),在omnet ++(版本5.1.1,ubuntu 16.04,x64)上模拟无线通信模拟教程。 我使用了以下代码:

*.host*.mobilityType = "RandomWPMobility"
*.host*.mobility.waitTime= uniform (100s,500s)
*.host*.mobility.speed = uniform(1mps, 10mps)
*.host*.mobility.updateInterval = 0.1s

运行代码时出现错误:

  

无法在网络初始化期间将消息(omnetpp :: cMessage)移至过去,t = -9.22337e + 06 - 在模块(inet :: RandomWPMobility)Basic.hostA.mobility(id = 39)中

有人可以帮我解决这个错误吗?

1 个答案:

答案 0 :(得分:0)

我在本教程中遇到了同样的错误。我不知道它究竟来自哪里,但这是我找到的解决方案:

omnetpp.ini

[Config TestRandomWPMobility2]
network = MobileNetwork

*.host[0].udpApp[0].typename = "UDPBasicApp" # Protocole de communication
*.host[1].udpApp[0].typename = "UDPSink"    # hostMobB = jette les messages recus
*.host*.wlan[0].typename = "IdealWirelessNic"

**.constraintAreaMinX = 0m
**.constraintAreaMinY = 0m
**.constraintAreaMinZ = 0m
**.constraintAreaMaxX = 600m
**.constraintAreaMaxY = 400m
**.constraintAreaMaxZ = 0m
**.updateInterval = 0.1s # test with 0s too, and let getCurrentPosition update the display string from a test module

*.numHosts = 5
**.host*.mobilityType = "RandomWPMobility"
**.host[0].mobility.speed = 10*uniform(20mps,50mps)
**.host*.mobility.speed = uniform(20mps,50mps)
**.host*.mobility.waitTime = uniform(3s,8s)

MobileNetwork.ned:

network MobileNetwork
{
    parameters:
        int numHosts;
        @display("bgb=600,400");
    submodules:
        host[numHosts]: MobileHost {
            parameters:
                @display("p=400+50*numHosts,300+50*numHosts;r=,,#707070");
        }
}

我希望这会对你有所帮助。