英文:
How can I add wireless mobile node location to statistic collection in OMNeT++ with INET4?
问题
我正在尝试在OMNeT++中运行一个模拟,以收集与移动无线节点位置相关的吞吐量。我需要能够在模拟过程中收集节点的x和y坐标作为一个向量。似乎没有任何模块自动记录节点的位置,而且我也无法使用cOutVector来手动添加它。
我找到的移动模块中没有一个似乎记录节点的位置(主要使用TurtleMobility,但我也查看了其他几个)。我还尝试过使用cOutVectors和signals手动记录它们,但我没有成功,因为INET中的大多数重要函数都被定义为const,并且cOutVectors函数和用于信号的emit()函数似乎都需要非const项(cOutVector或sigsim_t)来操作。
英文:
I am trying to run a simulation in OMNeT++ to collect throughput with respect to a mobile wireless node location. I need to be able to collect the x and y coordinates of a node as a vector over the course of the simulation. It does not appear that any module automatically records the location of a node, and I have not been able to use cOutVector to add it myself.
None of the mobility modules I found (mostly using TurtleMobility, but I looked at several others) seem to record the node's position. I have also tried to record them manually with cOutVectors and signals, but I have not had success, as most of the important functions in INET are defined as const, and the cOutVectors functions and the emit() function for signals both seem to require non-const items (the cOutVector or sigsim_t) to operate on.
答案1
得分: 0
有一个信号,它在移动模型的每次更新时发出。然而,由于某种原因,默认情况下它不会被添加到最终的统计数据中。
因此,您可以在您的应用程序或主机模块中重新定义相同的信号,但在ned文件中使用@statistic
指令,就像这里。有关信号+统计数据聚合机制的更多信息,请参阅这里。
英文:
There is a signal, which is emitted on every update of mobility model. However, it is not added to the final statistic by default for some reason.
So, you may redefine the same signal in your application or in your host module but with @statistic
directive in the ned file, like here. Here is more about signal+statistic mechanism of data aggregation.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论