Tags:
create new tag
, view all tags

Sending and Receiving Packets with Monash Packet Radio Modules

Build Your First Model

In this experiment, you will use the following files to construct your first Monash packet radio setup:

  • SmartPacketRadio.ned, SmartPacketRadio.cc SmartPacketRadio.h: Source files for creating the OMNeT++ object to provide the link with the physical Monash packet radio module
  • Source.ned, Source.cc, Source.h: Source files for creating the object that periodically generates a packet to send
  • Sink.ned, Sink.cc, Sink.h: Source files for creating the object to process the received packets
  • SourceSink.ned: Compound module that brings together the SmartPacketRadio, Source, and Sink simple modules to create the packet radio object that is capable of creating, sending, receiving and processing packets.
  • RawPacket.h: For defining the format of the packets traveling between the OMNeT++ process and Monash packet radio.
  • PollScheduler.cc, PollScheduler.h are for the event scheduling algorithm (you don't need to modify these)
  • omnetpp.ini: Simulation configuration file. You need to edit this file to enter the address of your Monash packet radio module (their 1-byte addresses are written on them)
All the files mentioned above are available in this compressed tar archive: sprPkSendReceive.tar.gz.

Run Your First Model

Let's create the OMNeT++ executable:

  1. Download the archive: sprPkSendReceive.tar.gz.
  2. Assuming that it is downloaded to the directory ~/Downloads, open a terminal window, cd ~/Downloads, and run the command tar zxvf sprPkSendReceive.tar.gz. The files should now be extracted into the Downloads directory.
  3. Start OMNeT++ with the command omnetpp.
  4. Create a new empty project, give it the name sprPkSendReceive.
  5. From the pull down menu: File --> Import --> General --> Filesystem
  6. Navigate to the directory where the files are ( ~/Downloads directory if you followed the directions as above), tick the files we want to get.
  7. Build and run the project sprPkSendReceive.
You may like to check out this video. Observe that your Monash Packet Radio transmit LED (red) periodically flashes. This means that your model is now broadcasting packets. If your friends at the workstations nearby started doing the same as well, your packet radio should now pick up and display these broadcasts.

Tasks

  1. What is the frequency of packet transmissions? Find the location of the source lines that determine the frequency of packet transmissions. Double the rate of packet transmissions and re-run your project.
  2. Investigate how the packet contents are filled. I think it is the right time to start working on the frame format. The desired frame format for our packet radio experiments and assignments is shown below (note that, in the sample programs this format is not implemented):
img7a8898a7c4a0d3c94d425edfe5ede87c.png
Frame format
  1. Referring to the above diagram, modify the Source.cc to add Destination Address (value = OxFF to denote broadcast), Source Address (value = your radio device address), Control (value = 0x00) and Payload Length (value to be calculated) fields.
  2. Modify the packet contents to broadcast the current time of your computer as its payload. Hint:
    std::time_t current_time = std::time(0);
    Do not forget to fill in the correct value into the Payload Length field. We will ignore the CRC field in this experiment.
  3. Modify the PacketSink to create a table of neigbours by recording the addresses of the received packets and the times they advertise.
  4. You will continuously receive packets from your neighbours with the current time announced, update your table of neighbours with current time information column, and whenever it is updated print the table on screen in this format:
      <neighbour id> <number of packets received so far> <current time>
      <neighbour id> <number of packets received so far> <current time>
      ....
      <neighbour id> <number of packets received so far> <current time>
Topic revision: r6 - 2013-08-11 - AhmetSekercioglu
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback