获取两个不同模块的位置 [英] Getting the location of two different modules

查看:70
本文介绍了获取两个不同模块的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网络中有2种类型的子模块.

I have 2 types of submodules in my network.

  1. AdhocHost是INET框架中的标准定义.
  2. 类型为IMobility
  3. 模块及其移动性类型 类型为RandomWPMobility的都是标准INET模块.
  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.

我可以通过以下代码获取类型为AdhocHost的模块的位置:

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[*]的类型为AdhocHost.

但是当我将host[1]替换为blockage [1](blockage类型为IMobility)时,在运行模拟之前会出现以下错误:

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

在执行期间,模块(MyMobileController)Mynet.mymobilecontroller中的错误 网络初始化:模型错误:模块(不可移动性)移动性不佳 找到了.

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

模块mymobilecontroller是包含这段代码的模块.该模块不需要移动.它的职责只是记录移动模块在网络中的位置.

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.

出什么问题了?

推荐答案

"MobilityAccess"代码期望您向其传递 NetworkNode ,该网络节点包含名为mobility且类型为.在第一种情况下,它是正确的(使用StandardHost),但是在第二种情况下,您直接传递具有IMobility类型的模块.

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.

长话短说,具有IMobility类型的模块应该在网络节点的 INSIDE 中存在,而不是在网络级别.

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.

解决方案:我不确定阻塞模块应该做什么,但是它不应该是IMobility的类型,而应该是包含类型为IMobility的子模块的模块

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.

这篇关于获取两个不同模块的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆