Getting the location of two different modules

元气小坏坏 提交于 2019-12-13 02:09:02

问题


I have 2 types of submodules in my network.

  1. AdhocHost which is standard definition in INET framework.
  2. module of type IMobility with its mobility type of type RandomWPMobility, both are standard INET modules.

I can get the location of modules of type AdhocHost by this code:

module = simulation.getModuleByPath("Mynet.host[1]");
c = MobilityAccess().get(module)->getCurrentPosition();

host[*] being of type AdhocHost.

But when I replace host[1] with blockage[1] (blockage is of type IMobility), before running simulation this error appears:

Error in module (MyMobileController) Mynet.mymobilecontroller during network initialization: Model error: module (IMobility)mobility not found.

The module mymobilecontroller is the module that contains this fraction of code. This module does not need to move. Its duty is just to record the location of mobile modules in the network.

What is the problem?


回答1:


The 'MobilityAccess' code expects that you pass a NetworkNode to it that contains a submodule named mobility with the type IMobility. In the first case it is true (with a StandardHost) however in the second case you pass directly an module that has a type of IMobility.

Long story short, a module with a type of IMobility is meant to exist INSIDE of a network node and not at the network level.

Solution: I'm not sure what is the blockage module supposed to do, but it should NOT be a type of IMobility, instead it should be a module that contains a submodule with a type IMobility.



来源:https://stackoverflow.com/questions/31302789/getting-the-location-of-two-different-modules

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!