简体   繁体   中英

Change/set new position of a node during the simulation time in Omnet++

I have a simulation that currently has BonnMotionMobility, where I tell where nodes will be during simulation. But I want that, as a consequence of some events, some nodes change their positions to another position during the simulation. Is there any function to "set a new position" that can be called somewhere in the middle of the running simulation (some reactive mobility model)?

I hope I was clear enough on my problem. Thank you for your answers.

Not that way. If you want to implement your own logic how nodes should move, you should implement your own mobility model (deriving from MovingMobilityBase or something appropriate). You should pass all the needed information the mobility module ie send events or signals there and the movement logic should be handled inside the mobility module. In the current architecture, determining the location of the module is the sole responsibility of the mobility module.

What you are suggesting is (by looking for a setCoordinates() like function) is that you want to move that responsibility out into other unrelated modules which is usually not a good decision.

In short, you should write your own mobility module that does that. Obviously you can write a simple model that has a setCoordinates() function and call that from your other code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM