1

I am trying to monitor positions (X coordinate, it is horizontal) of vehicles in a linear flow.

In TraCIDemo11p::handlePositionUpdate method, I added current vehicle position (by getCurrentPosition().x) and vehicle id (by getExternalId()) to message data using,

wsm ->setWsmData (parameters) and sent it down via sendDown(wsm).

Then in TraCIDemo11p::onWSM(WaveShortMessage* wsm), those information is retrieved and added to a std::map which I use for my calculations.

However in an arbitary momnet during the simulation vehicle positions can be found like this (v0:439.60 v1:389.60 v2:339.60 v3:339.60 v4:289.60) in the map. This is because v2 has not updated its position after v3 updated its position. I would appreciate any advice on this to avoid this inconsistency.

Thank you.

enter image description here

Julian Heinovski
  • 1,822
  • 3
  • 16
  • 27
user8561039
  • 115
  • 10
  • Have you considered that the update message of v2 might have gotten lost on the way from sender to receiver? – Christoph Sommer Sep 23 '17 at 09:23
  • Thank you very much for asking and sorry for the late reply. While looking for an answer, I realized that BSM's contains the primary information such as position and speed so I do not need to create a WSM and manipulate its data property. So I overrode OnBSM inside TraCIDemo11p.cc, and the problem the list got updated more frequently than previously in such way that solves my problem. I commented OnWSM entirely out. I still do not have 100% clearance on why it did not happen with WSM. – user8561039 Sep 30 '17 at 02:25
  • Further I found that 'BaseWaveApplLayer::handleSelfMsg(msg)' inside handleSelfMsg plays a role here. How does handleSelfMsg get called though I do not schedule self messages in TraCIDemo11p? I would highly appreciate if you can provide me an insight. Thank you. – user8561039 Sep 30 '17 at 02:34
  • Have you considered that a superclass might have scheduled a self message? – Christoph Sommer Sep 30 '17 at 05:30
  • Thank you very much for the input. I am digging into the code now and yes, BaseWaveAppLayer class has implemented it. – user8561039 Oct 01 '17 at 12:40
  • Can this be a result of lane change or any traffic condition like breaking due to road network congestion? Is it recurring? – Pasha M. Feb 22 '22 at 09:47

0 Answers0