I need help plz~~

168 views
Skip to first unread message

5842...@qq.com

unread,
Feb 22, 2014, 8:13:13 PM2/22/14
to omn...@googlegroups.com
I am doing a project about Vehicle to Vehicle communication,and each vehicle maintains a table that keep record the position of neighbor vehicles.(The imformation is transmit by Beacon message)But i dont know how to update this table every 2s to avoid outdated imformation .

Please help me

Thank you in advance.

Erik Becker

unread,
Feb 23, 2014, 8:48:49 AM2/23/14
to omn...@googlegroups.com
A vehicle has to send a beacon every 2 seconds (or more frequently to allow for packets to get lost). Then your information will be 2 seconds old (at most).
Also store a timestamp when a position of another vehicle was last updated. When doing something with the data, consider every entry older than 2 seconds to be out of date, delete or ignore it.

Hope this helps you.

Erik Becker

5842...@qq.com

unread,
Feb 24, 2014, 10:47:16 AM2/24/14
to omn...@googlegroups.com
Very thankyou!!!
I can understand what you mean~~~.But as you said "Also store a timestamp when a position of another vehicle was last updated."Where should i save the timestamp?Store in the neighbor list ?
Please said in a little more detail~~~

Thank you in advance.


Lei Cao

Erik Becker

unread,
Feb 24, 2014, 10:54:29 AM2/24/14
to omn...@googlegroups.com
Yes, put it in the neighbor list. In my current solution, I use a vector
as the data structure. It contains structs. Those structs contain
address, position, and other attributes, in your case, one of those
attributes would be the time (exact datatype is simtime_t, but not sure).

Kind regards,
Erik Becker

Am 24.02.2014 16:47, schrieb 5842...@qq.com:
> Very thankyou!!!
> I can understand what you mean~~~.But as you said "Also store a
> timestamp when a position of another vehicle was last updated."Where
> should i save the timestamp?Store in the neighbor list ?
> Please saidin a little more detail~~~
>
> Thank you in advance.
>
>
> Lei Cao
>
>
> On Sunday, February 23, 2014 9:48:49 PM UTC+8, Erik Becker wrote:
>
> A vehicle has to send a beacon every 2 seconds (or more frequently
> to allow for packets to get lost). Then your information will be 2
> seconds old (at most).
> Also store a timestamp when a position of another vehicle was last
> updated. When doing something with the data, consider every entry
> older than 2 seconds to be out of date, delete or ignore it.
>
> Hope this helps you.
>
> Erik Becker
>
> On Sunday, February 23, 2014 2:13:13 AM UTC+1, 5842...@qq.com wrote:
>
> I am doing a project about Vehicle to Vehicle
> communication,and each vehicle maintains a table that keep
> record the position of neighbor vehicles.(The imformation is
> transmit by Beacon message)But i dont know how to update this
> table every 2s to avoid outdated imformation .
>
> Please help me
>
> Thank you in advance.
>
> --
> You received this message because you are subscribed to the Google
> Groups "omnetpp" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to omnetpp+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

5842...@qq.com

unread,
Feb 24, 2014, 9:45:44 PM2/24/14
to omn...@googlegroups.com


Thanks again!!! It is very usefull !!! I can understand how to prevent outdated information now.
But if i want to detect traffic congestion ,i have to estimate the density of vehicles.To estimate the density i make each vehicle calculate the density every 5s.My question is how can i make cars doing something with data that stored in the neighbor list every 5 seconds?Do you have any idea?

Erik Becker

unread,
Feb 25, 2014, 4:37:04 AM2/25/14
to omn...@googlegroups.com
Use selfmessages. Just read the source code of some of the examples,
there should be enough information for you.

Kind regards,
Erik Becker

5842...@qq.com

unread,
Feb 25, 2014, 5:24:10 AM2/25/14
to omn...@googlegroups.com
It is very kind of you !!! Forgive me ,i have an another question.....
First,i used TraCIDemo11p as my application layer. I have already know how to use the selfmessage.But when i add a self message in the TraCIDemo11p.cc,i don't know how to handleSelfMessage.Should i add the code
 "scheduleAt(simTime()+interval, timeoutEvent);" in the TraCIDemo11p,or add it in the BaseWaveApplLayer.cc???
And how can i cancle this selfmessage?
(i will show the file to you)

Pleaseeeee help me again
Thank you in advance!!!
Best

Lei Cao
BaseWaveApplLayer.cc
TraCIDemo11p.cc

Erik Becker

unread,
Feb 26, 2014, 8:04:29 AM2/26/14
to omn...@googlegroups.com
Am 25.02.2014 11:24, schrieb 5842...@qq.com:
> It is very kind of you !!! Forgive me ,i have an another question.....
> First,i used TraCIDemo11p as my application layer. I have already know
> how to use the selfmessage.But when i add a self message in the
> TraCIDemo11p.cc,i don't know how to handleSelfMessage.Should i add the
> code
void ThisIsTheNameOfMyClass::handleSelfMsg(cMessage* msg){...}
My class is a subclass of BaseNetwLayer, not sure where other classes
have this kind of function. If I remember correctly, an incomming
message (of any kind) is first handled by one function that either calls
"handleLowerMessage" or "handleSelfMessage". Not sure
> "scheduleAt(simTime()+interval, timeoutEvent);" in the
> TraCIDemo11p,or add it in the BaseWaveApplLayer.cc???
In that Class where you collect the information and want to process it.
> And how can i cancle this selfmessage?
> (i will show the file to you)
I did not have to cancel messages yet, no idea. Suggested workaround:
When handling the selfmessage, do not do anything.
>
> Pleaseeeee help me again
> Thank you in advance!!!
> Best
>
> Lei Cao

5842...@qq.com

unread,
Feb 28, 2014, 11:25:12 PM2/28/14
to omn...@googlegroups.com
Hello sir
I have tried what you teach me .But there is an erro when i run the simulation:

Error in module (TraCIDemo11p) scenario.host[0].appl (id=8) at event #2, t=0.1: scheduleAt(): message (cMessage)density evt is currently scheduled, use cancelEvent() before rescheduling.

Do you know how to deal with this problem? Please help me

Thanks in advance
LeiCao
Reply all
Reply to author
Forward
0 new messages