简体   繁体   English

如何使用脚本编辑器 cooja 模拟器从 collect-view 访问 motes 信息?

[英]How to access motes info from collect-view using script editor cooja simulator?

I'm trying to write a script(Javascript) to log mote information from the collect-view tool, I did not find any tutorial nor documentation that shows how to access mote information using the script editor, I would be very thankful for any help.我正在尝试编写一个脚本(Javascript)来记录来自收集视图工具的 mote 信息,我没有找到任何教程或文档来显示如何使用脚本编辑器访问 mote 信息,我将非常感谢任何帮助.

Thank you!谢谢!

TIMEOUT(900000, log.log("Total PRR " + totalPRR + "\n"));

 packetsReceived= new Array();

packetsSent = new Array();

serverID = 1;

nodeCount = 6;

totalPRR = 0;

t_total = 0;

throughput = 0;

PDR=0;

data_length = 100;

Average_delay = 0;

timeReceived= new Array();

timeSent = new Array();

delay = new Array();

for(i = 0; i < ( nodeCount-1); i++) {

packetsReceived[i] = 0;

packetsSent[i] = 0;

timeReceived[i] = 0.0;

timeSent[i] = 0.0;

delay[i] = 0.0;

}

while(1) {

YIELD();

msgArray = msg.split(' ');

// log.log("string: "+msgArray+"\n");



if(msgArray[0].equals("receiver")) {

// Received packet

senderID = parseInt(msgArray[1]);

packetsReceived[senderID]++;

timeReceived[senderID] = time;

log.log("\n" + " SenderID " + senderID + " PRR " + packetsReceived[senderID] / packetsSent[senderID] + "timeReceived[senderID]" +  timeReceived[senderID] + " timeSent[senderID] " + timeSent[senderID] + "\n");

totalReceived = totalSent = 0;

totaldelay = 0;

count1 = 0;

for(i = 0; i < ( nodeCount-1); i++) 
{

    totalReceived += packetsReceived[i];

    totalSent += packetsSent[i];

    if (timeReceived[i] > 0) {

        delay[i] = timeReceived[i] - timeSent[i];

        delay[i] = delay[i] / 10000000 ;


        if (delay[i] > 0) 
        {

         

            totaldelay = totaldelay + delay[i];

            count1++;

        }

}

}

totalPRR = totalReceived / totalSent;

total_simulation_time=time;
log.log("\n"+"Total simulation time"+total_simulation_time+"\n");

throughput = (totalReceived * data_length * 8 *1000) / total_simulation_time;

log.log("\n"+"Total Received " + totalReceived + "totalSent" + totalSent + "\n");
PDR=(totalReceived / totalSent) * 100;

t_total = totalPRR * 100 ;

 

log.log("\n" + "Total Packet reception rate " + totalPRR + " Total_delay " + totaldelay + "Packet Delivery Ratio" + PDR + "\n");

log.log("\n"+ "Throughput "+throughput+"\n");

} 

else if(msgArray[0].equals("sender")) {

// Sent packet
receiverID = parseInt(msgArray[1]);


packetsSent[receiverID]++;

timeSent[receiverID] = time;

log.log( "\n" + " packetsSent[id]"  + packetsSent[receiverID]  + " timeSent[id] " + timeSent[receiverID] +  " id " + receiverID + "\n");

}



}

I have used this script for my project.我已经在我的项目中使用了这个脚本。 It is self-explanatory.这是不言自明的。 But if you have any doubt then ask me.但是,如果您有任何疑问,请问我。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用脚本编辑器和JavaScript访问Chrome活动标签网址 - How to access Chrome active tab URL using Script Editor and JavaScript 使用Laravel从不同的表收集不同的信息 - Collect different info from different tables using Laravel 如何从属性收集信息并将其作为数组发送? - How to collect info from attributes and send them as an array? 如何在骨干网视图中访问Rails配置信息? - How to access Rails configuration info in Backbone View? 当所有节点(节点)都具有特定输出时,如何使用脚本停止contiki中的仿真? - How to stop a simulation in contiki with script when all motes(nodes) have a certain output? 使用 Google Apps 脚本编辑以前提交的表单时如何从表单条目中收集数据? - How to collect data from form entries when editing a previously submitted form using Google Apps Script? 如何将Google脚本编辑器与表单一起使用以收集响应者电子邮件并将其插入工作表中作为答案? - How to use the Google Script editor with Forms to collect respondent email and insert it into a sheet as an answer? 如何使用Java脚本验证Bootstrap编辑器 - How to validate Bootstrap editor using java script 使用 Google Sheets 脚本编辑器访问 Kraken API - Using Google Sheets script editor to access the Kraken API 如何使用JavaScript从文本编辑器中删除菜单项(文件,编辑,查看,格式)和TinyMCE编辑器的字符限制验证 - how to remove menu items (file, edit, view, format) from the text editor and Character Limit validation for TinyMCE editor using JavaScript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM