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();
Related
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.
I am working on a wireless routing protocol. I have created a Queue at every node. In this queue, every node kept packet which it already transmitted. If packet is not transmitted by nexthop then previous node will retransmit the packet after timeout. The problem is that when node is trying to retransmitt the packet by calling postRotingHook in handle function to retransmit then it is not doing anything. This postRoutingHook is created locally so it is not actually sending the packet. So how to connect this packet with network for retransmission?
Example: Suppose We have 3 nodes A, B and C. A is source, B is intermediate and C is destination. Node A sent a packet initially. Now node B will forward it to node C. At this time node A will overhear this packet and it will cancel the timer and delete this packet from its Queue. (in normal condition)
Suppose node B could not forward the packet because of some reason then node A should re-transmit the packet after time out. I am unable to achieve this functionality.
My programming scenario is:
I have modified GPSR protocol. Where header file have definition of these 5 INetfilterHooks methods. I didn't use any control packet e.g. request, response, beacon etc. I am directly dealing with data packet which contains some control information. I have implemented my logic in datagramPreRoutingHook() method (when data is received from lower layer) and datagramLocalOutHook() method (when data is received from upper layer).
Source node (at network layer) receives packet from upper layer at IPv4.cc using handlePacketFromHL() ->datagramLocalOutHook(datagram, destIE, nextHopAddr) == INetfilter::IHook::ACCEPT) when it calls datagramLocalOutHook(datagram, destIE, nextHopAddr) then control goes to my routing protocol. It makes necessary changes, Adds source, destination address, creates options and keeps the packet in Queue (for retransmission by scheduling timer) then return ACCEP. Then control again goes to IPv4.cc.
After this process, if time out occurs at my protocol then I am unable to send packet to IPv4.cc. I called postRoutingHook to retransmit the packet then it simly return ACCEPT (as defined in header file) and does nothing. I have tried to call some methods of IPv4.cc by making object of IPv4 in my protocol but these methods are protected so I couldn't access these methods.
I tried with making some public methods of IPv4.cc but it is giving error at further stage.
I have tried to make the object of INetfilter::IHook for calling its postRoutingHook() but is also providing error as object of abstract class can not be created.
With particular regards to Ieee80211 in INet library, I have a question about what happens when a cPacket/cMessage is sent across multiple stations.
It is possible that this is not strictly about INet, but a general behavior of OmNet++. Here's the question:
When sending a cPacket/cMessage and it is received by multiple stations/modules, is it copied or all receivers get a pointer to the same instance?
Real scenario
So, in such a network:
Station A is sending a cMessage which is received by all the other stations. Of course only one station is the receiver, everyone else will drop the packet. So if B is the receiver and C, D, E and F go:
void handleMessage(cMessage *msg) {
if (this->isNotForUs())
delete msg;
}
Will it cause B to have its frame destroyed?
In OMNeT++/INET sending a cMessage to multiple receivers is modelled by creating multiple copies of this message and sending one copy to one receiver. There is dup() method that creates an exact copy of the message. For example:
cMessage *msg2 = msg->dup();
As a consequence, every receiver will receive a new instance of cMessage object, and it can remove or process it in any way. Therefore, in your example deleting a message by C,D,E, and F does not affect the message received by B.
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.
How and why sensor node Id is used ?
what are the different type of kind of a sensor node?
why kind is used ?
i need some example of using kind in sensor node application.
Need references and help.
setKind() and getKind() are used to set different type of sensor nodes you want to create through the msg packet they send.you can setKind() for different type of message packets. for example for mobile node you may want to get location of node through msg packet you received you can set a kind to that msg packet at sending end let call it "positionMsg". similarly you can use getKind() ar receiving end to identify that whether the message was for positionMsg or something else.you can give identity to node as well as message using these methods. Similarly you can setKind() for msg packet delivered by different nodes.And at receiving end you can getKind() to identify from which node message was sent.
similarly you can use setId() and getId() method to use identify different sensor nodes. These methods are useful when you are working with multiple types of nodes .
Sensor nodes can be of different types.It all depends on yours implementation. It is implemented using simple module or compound module.Its nature may vary upon implementation.You can use them as router / gateway,cluster head , mobile node(data mules) etc depending upon your need.
For more information you can use omnet++ user manual 1>https://omnetpp.org/doc/omnetpp/Manual.pdf
use this link for implementation guide https://omnetpp.org/doc/omnetpp/api/classcMessage.html
Use tictoc tutorial and and use these methods with cMessage objects.