Amazing technological breakthrough possible @S-Logix pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to change the data packet interval in RPL contiki cooja simulator?

Description

To varying the data packet send interval in RPL using cooja network simulator

Source code

Step 1: udp-client.c – handles the data packet sending
Default interval defined. We can change interval of transmission.
#define PERIOD 10 // change the interval
#define START_INTERVAL (15 * CLOCK_SECOND)
#define SEND_INTERVAL (PERIOD * CLOCK_SECOND)
#define SEND_TIME (random_rand() % (SEND_INTERVAL))

Step 2: code to calling function.
PROCESS_THREAD(udp_client_process, ev, data)
{
etimer_set(&periodic, SEND_INTERVAL);
while(1) {
PROCESS_YIELD();
if(ev == tcpip_event) {
tcpip_handler();
}
if(etimer_expired(&periodic)) {
etimer_reset(&periodic);
ctimer_set(&backoff_timer, SEND_TIME, send_packet, NULL);
}
}

Output