Christina
Christina

Reputation: 70

How to send a message from the RSU to a car at a specific time (omnet++, veins, sumo)

I'm using omnet++ (v5.6.2) and veins (v5.1) for the first time and I'm trying to send a message from the RSU to the first car (node[0]) at a specific time during the simulation.

My main goal is to create a way to immediately stop the car when the message is sent by the RSU. I had in mind to create a boolean variable that would turn to true when a certain amount of time has passed and that would trigger the RSU to send the message and therefore force the car to stop (probably from the handleMessage that already exists?).

I've turned the sendBeacons to true at the RSU settings from the example that does something similar to what I want to implement but can't find a way to send only one message to only one car at a given time.

I'm currently looking into MyVeinsApp and DemoBaseApplLayer but I haven't figured out a way to actually do that.

I'd appreciate any help or input! Thanks!

Upvotes: 0

Views: 834

Answers (1)

Christoph Sommer
Christoph Sommer

Reputation: 6943

Typically, you would model this in OMNeT++ by letting the initialize method of a module schedule a "self message" for a certain time, then reacting to reception of this "self message" by executing what you wanted to happen at this time. For more details, see the OMNeT++ Tic Toc tutorial.

Veins makes this a little bit easier, by (optionally) providing a TimerManager helper component https://github.com/sommer/veins/blob/veins-5.1/doc/manual/timermanager.md, which allows you to use C++ lambdas to execute code at given times. You can see an example module using this TimerManager at https://github.com/sommer/veins/blob/veins-5.1/subprojects/veins_inet/src/veins_inet/VeinsInetSampleApplication.cc

Upvotes: 0

Related Questions