Search code examples
c++omnet++inet

error when using RandomWPMobility, omnet++ simulation environment


I am following a tutorial for simulating wireless communication in omnet++ (version 5.1.1, on ubuntu 16.04, x64) using the AODV protocol (implemented as a part of the INET library). I have used the following code:

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

when running the code i get an error:

Cannot schedule message (omnetpp::cMessage)move to the past, t=-9.22337e+06 -- in module (inet::RandomWPMobility) Basic.hostA.mobility (id=39), during network initialization

Can someone please help me with this error?


Solution

  • I've had the same error in this tutorial. I do not know exactly where it comes from, but here is the solution that I found:

    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");
            }
    }
    

    I hope this will help you.