在Omnet ++模拟器的日志模块中显示问题(Display issue in the log module of Omnet++ simulator)

编程入门 行业动态 更新时间:2024-10-24 17:18:40
在Omnet ++模拟器的日志模块中显示问题(Display issue in the log module of Omnet++ simulator)

我用静脉-4a2。 首先,我已经执行了一个只有车辆的scnario。 现在我在我的例子中添加了RSU。 我需要每个RSU接收数据,在Omnet ++的模块日志中显示一条消息。 就像我在接收数据时对节点所做的那样,我在TraCIDemp11p的onData()函数中添加了粗线,如下所示:

void TraCIDemoRSU11p::onData(WaveShortMessage* wsm) { findHost()->getDisplayString().updateWith("r=16,green"); annotations->scheduleErase(1, annotations->drawLine(wsm->getSenderPos(), mobi->getCurrentPosition(), "blue")); **EV << " I am an RSU and I have received a data ! \n";** //if (!sentMessage) sendMessage(wsm->getWsmData()); }

我的问题是“我是一个RSU,我收到了一个数据!”没有显示在日志模块中。 当RSU收到数据时,这是omnet ++的日志模块中显示的内容:

** Event #4802 t=9.004337832007 RSUExampleScenario.node[4].nic.phy80211p (PhyLayer80211p, id=161), on `data' (Mac80211Pkt, id=669) node[4]::PhyLayer80211p: AirFrame encapsulated, length: 1326

I use veins-4a2. First, I have executed a scnario with only vehicles. Now I have added RSU in my example. I need that every RSU receives data, displays a message in the module log of Omnet++. Like I did for nodes when they receives data, I have add the bold line in onData() function of the TraCIDemp11p like this:

void TraCIDemoRSU11p::onData(WaveShortMessage* wsm) { findHost()->getDisplayString().updateWith("r=16,green"); annotations->scheduleErase(1, annotations->drawLine(wsm->getSenderPos(), mobi->getCurrentPosition(), "blue")); **EV << " I am an RSU and I have received a data ! \n";** //if (!sentMessage) sendMessage(wsm->getWsmData()); }

My problem is that "I am an RSU and I have received a data ! " isn't displayed in the log module. When an RSU receives a data, this is what is displayed in the log module of omnet++:

** Event #4802 t=9.004337832007 RSUExampleScenario.node[4].nic.phy80211p (PhyLayer80211p, id=161), on `data' (Mac80211Pkt, id=669) node[4]::PhyLayer80211p: AirFrame encapsulated, length: 1326

最满意答案

我不知道您是否了解onData的工作原理。

在默认静脉中,仅在具有名称数据的一个包到达一个汽车/节点或RSU(通过handleLowerMsg)时调用onData。

在您的RSU​​情况下,需要:

汽车/节点需要appl.sendData为true

调用带有名称数据的发送包

与汽车/节点和RSU 的通信范围 。 默认值为1千米直径。

一个好的测试是使用randomTrips.py创建一个小网格,并将RSU设置在中心,所有节点都可以在其中实现。

- 一个评论的大,所以我做了一个新的答案 - 祝你好运!

I don't know if you are aware of how onData works.

In the default veins, the onData is only called where one package with name data arrived in one car/node or RSU (through the handleLowerMsg).

In your case in a RSU, so are needed:

The cars/nodes need the appl.sendData with true

Calls for send packages with name data

Range of communication with the cars/nodes and the RSU. The default is 1 km of diameter.

A good test is create a small grid with the randomTrips.py and set the RSU in center, where all nodes can achieve it.

-Big for one comment, so I make a new answer - Good luck!

更多推荐

本文发布于:2023-07-31 00:24:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1340370.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模拟器   模块   日志   Omnet   Display

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!