How to send messages in veins? - omnet++

I need to send a message only to one vehicle that i want to choose. I am reading the available TraCIDemo11p and the cars are broadcasting the message to all cars. How can change that and make it send the message to only one care for example to car number 3.Thank you

Keep in mind that communication between cars in Veins (or any MANET simulator) is wireless which means that many cars can hear the MAC frame that sent to a specific node.
To send a message from car A to another car B, they must be in their wireless range or they support an ad-hoc routing protocol to reach other not-in-range cars (which is not implemented in Veins, AFAIK).
If you are sure that both sending and receiving cars are in range, then you can fill the destination address in WSM by the ID of the intended car and let the WAVE application to delete any message that has a destination address different from the local ID.

Related

Veins : multiple WSMs for different purpose

I want to send two WSMs, one on regular intervals to enable a vehicle (V1) receive the information about vehicle behind them (V2) from the vehicle (V3), which is behind V2.
The second WSM is only sent out in certain cases (as a warning message) and as soon as vehicles receive the warning WSM, I want them to change the lane.
Question is: how can I implement two WSM actions independent from each other? Can I at all use multiple WSMs for this purpose or shall I define a new message type for it?

Retrieval of the originating address (sender's number) by SMSC

I'm trying to implement SMS transmission between two GSM devices. I've searched and read standards and articles a lot but couldn't find the answer to the following question. Does anyone know how does SMSC get aware of the sender's number and insert it in the TP-OA field of the SMS-Deliver packet stack?
Actually I'm not sure that either this is what you need or this would help you but anyways..
In GSM network there are a lot of nodes and each does certain things for which it is responsible. They communicate to each other with messages, that contain certain information needed for processing of required operation: establishing a call, sending SMS, doing Update Location etc.
So the information about sender's number comes to SMSC from another node called VLR/MSC together with a message saying to it "Yo, one guy wants to send SMS to another guy. So here is this message and information about these guys. Please, forward it".
Here is scenario of user A sending SMS to user B:
User A sends SMS to VLR/MSC together with information about its destination
VLR/MSC then invokes MAP message ForwardSM (Forward Short Message) to send received data further through the network to a node called SMS IMSC
SMS IMSC is a node that plays a role of interface between network and SMSC
SMS IMSC on receipt of ForwardSM message sends TPDU (Transfer Protocol Data Unit) message towards SMSC with the text of sent SMS and routing information
After this SMSC sends reply to user A with a result of receiving the SMS. If it's successful then SMSC starts routing this SMS through the network towards user B
So the message you are looking for is TPDU message from Point 3. Type of this message is SMS-SUBMIT according to TPDU types.
Edit:
Authentication is separate operation that takes place when subscriber starts his activity (eg turns on his phone) or roams to another area that is being served by another VLR/MSC. Anyway, VLR/MSC treats this user as new to this area. Skip this part if you know what is VLR/MSC:
HLR is a node that stores all the information about every subscriber in operator's network. So basically it's a database that has all the info about every single subscriber in the entire operator's network.
And network covers huge geographical area so it's divided is smaller areas called cells. VLR/MSC is a node similar to HLR (it also stores subscribers' data). But it is responsible for one certain cell, so it stores data of subscribers who currently operate in this certain cell. So when new subscriber comes to its area VLR/MSC downloads his data from HLR. And when subscriber leaves this area VLR/MSC removes his data.
And if some node would need to get subscriber's data, it won't "ask" HLR for it, but instead it will "ask" VLR/MSC in whose area the subscriber is currently active.
So when VLR/MSC sees a new subscriber coming to its area, before downloading his data from HLR it triggers authentication process to check if this user is valid and that someone else doesn't pretend to be this user:
VLR/MSC sends Send Authentication Info MAP message together with IMSI (mobile subscriber number which is uniquely identified by his SIM card) to HLR
HLR checks the given IMSI and validates subscriber. If subscriber exists and there is no troubles with him then HLR sends IMSI to AUC (Authentication Center)
On IMSI reception AUC generates a triplet (some encryption keys needed for subscriber identification) that contains SRES, RAND and Kc values and sends this data back to HLR
HLR forwards this data back to VLR/MSC which triggered authentication process
VLR/MSC after reception of SRES, RAND and Kc sends received RAND to mobile subscriber
After mobile subscriber receives the RAND he calculates SRES using given RAND and Ki (some value that is written in user's SIM card) and sends calculated SRES back to VLR/MSC
On the final step VLR/MSC compares SRES generated by AUC with SRES generated by user. And if they match then user is identified successfully, VLR/MSC fetches subscriber's data from HLR and authentication process is completed.
After VLR/MSC downloaded data from HLR every other node that would need data of this subscriber would fetch it from VLR/MSC not HLR. And after that authentication process won't start every time subscriber wants to do something (make a call, send SMS and so on).
So when user A sends SMS to user B the data about user A (his number for example) is stored in VLR/MSC already and it arrives to SMSC from VLR/MSC together with the SMS user A sent.

how can i send bid messages to all neighbors in wireless range in ONE simulator?

I am trying to develop a routing protocol and i need send some bid messages to all nodes which are in my wireless range in ONE simulator and they should reply to this message, and according to information in their reply messages i will choose one of those nodes for my next hope. how can send bid messages to all of nodes which are in my neighborhood?
This depends a lot what you mean by "bid messages" and when exactly you want to send them. You can get all currently connected hosts with the getConnections method in the routing module and you could for example iterate over that list when you want to make the bid and exchange this information (similar to what MaxProp does in changedConnection).

Broadcasting and Fetch Data On UART

I have a computer (that use as server) and several board with Atmega microcontroller Something like:
The computer connect to board on UART & RS485 (with a USB to RS485 converter)(I have limitation that lead to I could not use ModBus). I want to broadcast a message from server over bus and fetch the ID from of each board (Board ID is 4 digit).
When the boards receive broadcast message and try to send their own ID and the server receive some fake ID and I think it related to Collisions problem when all boards want to send data in one time.
After I search about this problem found a way that put a constant in each board that save a special delay for send data and when board receive broadcast message send ID with that delay...in this way it work fine and I dont see the Collisions but have some problem:
May be the delay number of 2 board be same.
Good way for small count of board.
Extra process when want to install board on bus.
Anybody know with this problem and could help me how to solve this problem with better solution?
You are mentioning Modbus in your question although some of your other stated facts seem to deviate from there (like 4-digit device numbers, and Modbus only has 1-255). Also, Modbus does not support responses to broadcast messages. I thus doubt a bit you are actually using Modbus.
A scheme you could use (and that is classically used in MA networks) would be:
Once a broadcast is received, have the clients scan the bus for responses for a time frame based on its station ID. If your client can see one, have it wait a minimum bus time (the time a module needs to answer your broadcast message based on current bus timing + the round trip for the master acknowledging the broadcast answer) plus an additional time based on its module ID, then go back to (1)
If a client sees the bus unoccupied for the specified time, send back a broadcast answer.
Have the master acknowledge the broadcast response from this client with the shortest possible message.
If a client that has sent a broadcast response does not receive a proper ack, go back to (1)
This is not 100% secure and absolutely not according to the Modbus specification, but could work.
* is a transmission, - is a "wait"
**** (Bus master broadcast)
--------- station 100 waits 100ms
------------------ station 200 waits 200ms
**** Station 100 sends broadcast response
------------------ station 200 sees bus active and waits another 200ms
*** master acknowledges broadcast response of 100
------------------ station 200 sees bus active again and waits 200ms from last seen activity
**** Station 200 has seen bus quiet for 200ms and sends broadcast response
*** master acks brc response of 200
This can take quite a bit of time and needs the waiting times finely adjusted against the transmission time of broadcast responses and response acks, but can work, and actually is implemented that way in a lot of CSMA/CD networks.
It will probably take longer, but here is another way to do it. First, design your protocol so that each command contains (or an can contain) an ID, and boards only respond to commands for their ID. Then, on your host, you would iterate through each of the possible IDs and send a simple command to each of them. If you get a response, you know there is a board with that ID. If you don't get a response after some period of time, you know there is no board there.

How to send beacon with viens

I know How to send a message for car a to car b or rsu. but I need to send beacons. what is different between sending a message and sending beacons. I cant see any sendBeacon(). How should I send one?
Fundamentally, a beacon is simply a repeated broadcast message that carries some information of general interest in the vicinity of the sender. You can achieve this in Veins by having your application call its sendDown method every once in a while.
You can find some example code that does this in https://github.com/sommer/veins/blob/veins-4.5/src/veins/modules/application/ieee80211p/BaseWaveApplLayer.cc#L242

Resources