Cooja: Can't add multiple motes in simulation script

0 votes

I am attempting to modify the RPL algorithm in Contiki using Cooja for the simulations. Basically what I'm trying to do is to assess the efficiency of my algorithm by adding nodes to the network randomly by a certain distribution (like Gamma distribution). To do this I've written a script. The problem is, I can't add more than one mote using this script. Here is what I have so far:

var motes_array = new Array(); 
moteType = mote.getType();
for (i = 0; i < 5; i++) {
    motes_array[i] = moteType.generateMote(mote.getSimulation());
    mote.getSimulation().addMote(motes_array[i]);
} 
log.testOK();

The above code adds only one mote, although the loop is executed 5 times as expected.

Can anyone help me out?

Thanks.

Apr 29 in IoT (Internet of Things) by Shubham
• 13,290 points
31 views

1 answer to this question.

0 votes

I can't really find an immediate problem with the code. 

Is it necessary to use YIELD, by the way? Why not simply execute the loop body 5 times?

answered Apr 29 by Upasana
• 8,530 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer

Setting-up a RFID RC522 chip in Raspberry Pi?

First, let me congratulate you on buying ...READ MORE

answered Jul 9, 2018 in IoT (Internet of Things) by nirvana
• 3,060 points
121 views
0 votes
1 answer

Display time in a Windows Core IoT app with a clock!

It is possible, but you should understand ...READ MORE

answered Jul 9, 2018 in IoT (Internet of Things) by nirvana
• 3,060 points
89 views
0 votes
1 answer

Faster communication between two ESP8266 in client-server setup

Try following. Server loop void loop() { // ...READ MORE

answered Jul 13, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
926 views
0 votes
1 answer

Decryption Technique of LORA IOT AES-128

It's not clear what you are using ...READ MORE

answered Sep 4, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
85 views
0 votes
1 answer

serial communication

You can try downloading the npm and node.js through ...READ MORE

answered Nov 22, 2018 in IoT (Internet of Things) by Upasana
• 8,530 points
55 views
0 votes
1 answer

Contiki-OS : CoAP protocol and CoRE link implementation

I don't think there's a standard way to ...READ MORE

answered Jan 21 in IoT (Internet of Things) by Upasana
• 8,530 points
99 views
0 votes
1 answer

What is the time taken by a 200 byte message for transmission in a beacon-enabled network?

Now, data rates of IEEE 802.15.4 are ...READ MORE

answered Aug 23, 2018 in IoT (Internet of Things) by Upasana
• 8,530 points
36 views
0 votes
1 answer

How to trigger Python script on Raspberry Pi from Node-Red

Node-RED supplies an exec node as part ...READ MORE

answered Sep 14, 2018 in IoT (Internet of Things) by Upasana
• 8,530 points
861 views