Wave Short Message content - omnet++

I used veins 4a2 and OMNET++ (4.6). I like to know the content of messages exchanged between vehicles in the veins example.
I have consulted waveshortmessage.msg, WaveShortMessage_m.cc and WaveShortMessage_m.h but I have not found messages content.
In waveshortmessage.msg, what means this line "string wsmData = "Some Data"" please?
And in TraCIDemp11p.cc, what means "blockedRoadId" declared in sendMessage function?

The demo application that comes with Veins 4.4 (and 4a2 as well) and that is used for the Veins tutorial reacts to messages that contain the name of a road to avoid because a car has stopped there for longer than 10s (and vice versa: the demo application sends a message when a car is stopped for longer than 10s).
The demo application is defined in TraCIDemo11p. It uses a demo message type, WaveShortMessage, as the container to inform other cars about a blocked road. For this, it stores the name of the blocked road (variable blockedRoadId) in the wsmData field of the message.

Related

OMNeT++/Veins: Why WSM message is sent/broadcasted ONLY for the first accident scheduled?

I am doing some simulations using the Veins framework (with the RSU scenario). I defined two accidents for node[*0] as shown in the code below. However, node[*0] sends WSM message to neighboring nodes (i.e., vehicles and RSU) only for the first accident. When it arrives to the second accident, it stops for a while but does not send any message. I further tested this by scheduling more accidents, but the message is still sent/broadcasted only for the first accident. My question is, why node[*0] is not sending WSM message when it arrives to each of the other scheduled accidents? I would greatly appreciate it if someone could help me clarifying this issue. Thank you.
*.node[*0].veinsmobility.accidentCount = 2
*.node[*0].veinsmobility.accidentStart = 60s
*.node[*0].veinsmobility.accidentDuration = 40s
*.node[*0].veinsmobility.accidentInterval = 70s
The application used in the Veins example simulation is https://github.com/sommer/veins/blob/veins-5.2/src/veins/modules/application/traci/TraCIDemo11p.cc#L96. As you can see, it uses a bool member to track whether it has already sent a message and, if it has, refuses to send another.

Populating messages with data in veins

I am working on a project where an RSU sends beacons to the cars in its range .When this beacon is received by the car it should send its id back to the RSU.I made a custom message file with just the vehicle id in it.This is how i am handling the beacons now.
void MyVeinsApp::onBSM(DemoSafetyMessage* bsm)
{
findHost()->getDisplayString().setTagArg("i", 1, "green");
if(sentMessage==false){
sendDown(bsm);
//scheduleAt(simTime() + 2 + uniform(0.01, 0.2), wsm->dup());
sentMessage=true;
}
}
This does not work for me at all.Is there any way I can send messages from cars to RSU?
I am not an expert but i recently started working on a similar project with yours. So your message includes a parameter like, let say, vehicle_id and upon receiving a beacon you have to send the message to the RSU with the id include. To do such thing you have to first of all fill the message with the vehicle id like
bsm->setVehicle_id(findHost()->getIndex());
When you create a new message file with variables inside it and then building it the program also creates the get() and set() functions in order to handle those parameters.
Now for the RSU to simply acquire the message variable you have sent it must call the get() function like:
RSU_vehicle_id=wsm->getVehicle_id();
So now you have a variable that includes the received vehicle node id.
I highly suggest you to offer a couple of day just to understand the principles behind the Veins tutorial and how it handles all its aspects.

SWIFT MT Message SEME Uniqueness

As far as I understand, the SEME (sender's message reference) attribute of a SWIFT MT message has to be unique per sender (it is the sender's responsibility to ensure uniqueness). So, let's say there are two sending entities A and B and I am the receiver. Then it would be a valid scenario to have both of them send out a SWIFT MT message with the same SEME, right? How could I differentiate messages coming from sender A and B? What is common practice in such a case?
In the documentation (MT 558 in that case) it says:
Reference assigned by the triparty agent to unambiguously identify the
message.
The MIR in the {2: Application Header Block} seems to be the one according to me.
MIR: message input reference, unique identifiers containing the date, logical terminal (including branch code), session and sequence numbers.
Info source: https://www.prowidesoftware.com/about-SWIFT.jsp

what policy is based vehicle rerouting in case of accident?

I'm doing a scenario where there is 1 route at the beginning and then it splits into 3, then merges into 1 again. I'm stopping the car in the first lane, the second car stops also, the third one reroutes in the middle lane, the fourth goes to the queue, the fifth reroutes, the sixth goes to the queue, the seventh reroutes.....why is it behaving like that? I can't understand where to change this "balancing" or "threshold". Any suggestion?
The Veins 4.6 sample application behaves as follows:
if a vehicle is stopped (and has been driving) and has not yet sent a warning message, it sends a message containing its current road (TraCIDemo11p.cc, line 82)
if a vehicle receives a warning message, it tries to find a new route through the road network that avoids this road (TraCIDemo11p.cc, line 48); in addition, if it has not yet sent a warning message, it re-sends the received message (TraCIDemo11p.cc, line 54)
So, if you use this sample application and observe that some vehicles do not change their route, this can be attributed (among others) to either of the following effects:
they never received a message that told them about the congestion
they received a message, but couldn't find a route through the road network that would avoid the congestion
Why a vehicle did not receive a message can again be attributed (among others) to any of the following:
a warning message was transmitted to them, but they could not receive it (e.g., due to interference)
a warning message was transmitted through the network before they started their trip (remember, warning messages are not repeated by the example application)

Broadcasting of Messages in Veins example

I noticed that in the Veins demo scenario a node broadcasts the data message it creates to each and every other node in the simulation.
I tried to modify that a bit. I modified the sendMessage() function in TraCIDemo11p.cc file by initializing the address of the recipient in the WSMusing the setRecipientAddress() function. But while running the simulation in Veins 3.0, I find that this message is still being broadcast to all the nodes apart from the target node.
How do I implement this p2p connection?
How do I generalize by adding an RSU to the scenario to implement a heterogeneous communication framework?
In its basis the 802.11p standard, which is the main communication standard for Vehicular Communication (and also the one used in Veins), does broadcast.
So basically, whatever you send via a 802.11p network interface, it will always be broadcasted, however you can make-up some type of p2p by doing "source-destination checking" from the frames.
You can extend the WaveShortMessage to contain Source and Destination fields specific for your application, and then perform checks if the destination is receiving from the intended sender.
Lets say we have two nodes nodeSender and nodeReceiver who want to communicate.
nodeSender would need to include its own identifier (name, ID etc) in the message:
msgToSend->setSourceAddress("nodeSender")
nodeReceiver would need to check if the message it "hears" is from the intended sender. Because in reality it will be hearing from multiple senders due to the broadcast nature of 80211p
if(receivedMsg->getSourceAddress() == 'nodeSender')
{
/* this is the message which I need */
else
{
/* do nothing with the message from other senders */
}
You can use vehicles SUMO id as their unique identifier for the addresses. You can obtain that by querying the TraCIMobility module:
cModule *tmpMobility = getParentModule()->getSubmodule("veinsmobility");
mobility = dynamic_cast<Veins::TraCIMobility*>(tmpMobility);
ASSERT(mobility);
mySumoID = mobility->getExternalId();

Resources