第12篇 tinyviz和TOSSIM深入研究——最大节点数(网络的大小)

 

我的科研课题是建立在几千甚至几万个节点的超大型传感器网络上的topology control,所以最大节点数成为我关心的第一大问题。

 

本文摘自我的research progress report

To test the scalability of TinyOS and TOSSIM that I am using, I tried to test many different testing values for TinyOS compilation and TOSSIM simulation.

 

With using the TInyViz graphic interface, I started the simulation from 100 nodes. I have tried 100, 200, 300, 400, 500, 600 and 700 nodes reprehensively. With the increasing numbers of the nodes, the system initial time increased accordingly.

ScreenShot 1 Successful running of 700 nodes

After 700 nodes, I have tried 800, 900 nodes on the same platform but I cannot make a successful simulation and the TinyViz console gave the follow error:

 

ScreenShot2 Out of Memory Error for 750 nodes and above in TinyViz

 

 

结论1 tinyviz750个节点的时候,出现内存溢出错误。事实上,在tinyviz中显示700个节点,已经非常密密麻麻,肉眼难以分辨,看着很累。从这里开始,tinyviz已经不再被考虑使用了。

I got an out of memory error with 750 nodes. It is the reason for abandoning TinyViz (GUI) from now on. I continued the testing without the GUI. It was good for simulating nodes 800,900 and less than 1000. However, when I specified the node of 1100, it gave the follow message: I am compiled for maximum of 1000 nodes and you have specified 1100 nodes.

ScreenShot3 1000 nodes

I went to read the TOSSIM documentation and found the following description:

1.    The official introduction of TOSSIM:  “TOSSIM: Accurate and Scalable Simulation of Entire TinyOS Applications

When it talked about the Scalability, it said:

The simulator must be able to handle large networks of thousands of nodes in a wide range of configurations. The largest TinyOS sensor network that has ever been deployed was approximately 850 nodes; the simulator must be able to handle this and the much larger systems of the future.

So based on this, I believed they determined the standard TinyOS node upper bound is 1000.

Then I went another document for TOSSIM:

 

2.    TOSSIM: A Simulator for TinyOS Networks

I got this information here:

When compiling for TOSSIM, the nesC compiler modifies code generation for components such that fields declared in components result in arrays of each field. The maximum number of nodes that can be simulated is determined at compile time. It says that the upper bound is specified in /apps/Makerules. By default, the standard TinyOS distribution sets this value to be 1000.

 

When compiling for the pc, each declaration of a component field is followed by [, the value of tossim num nodes, and ], where tossim num nodes is specified by the flag -fnesc-tossim tosnodes= in Makerules, or by default, set to 1000. This is the way TOSSIM simulates multiple motes. TOSSIM keeps an array for each variable of state, and references each mote’s corresponding state when running code for that mote.

 

I went to /apps/Makerules and edited the the flag -fnesc-tossim tosnodes=1200.

ScreenShot4 change 1000 to 1200

I saved file and compiled the application again. However, it did not work. It was still 1000 and did not change.

ScreenShot5 still 1000

 

I tried run the application and failed. It gave the same error prompt.

ScreenShot6 I cannot run 1100 nodes

I found the official documents were cheaters and sent email to the TinyOS/TOSSIM developers.

I found /opt/tinyos-1.x/tools/make/pc.target, and -fnesc-tossim tosnodes, changed it to 1300.

ScreenShot7 change the flag in pc.target

结论2: 官方文档是骗人的。他让修改的地方其实并没有任何效果。真实的修改地方在于/opt/tinyos-1.x/tools/make/pc.target, 修改-fnesc-tossim tosnodes

Screenshot 8 successful run for more than 1000 nodes

 

事实上,我们还有另外一个方法修改最大节点数,就是直接修改nido.h文件,同样DEFAULT_EEPROM_SIZE也可以在这里被指定:

 

Second, after checking many library files, I finally found a head file “nido.h” located here :opt/tinyos-1.x/tos/platform/pc. And saw the code segment:

enum {

  TOSNODES = TOSH_NUM_NODES,

  DEFAULT_EEPROM_SIZE = (512*1024)  // 512 KB

};

/* in nesc/nesc-cpp.c, the TOSH_NUM_NODES macro is defined, so that

   TOSNODES is set to the value specified to the nesc compiler by the flag

   "-fnesc-nido-tosnodes=___" */

 

The flag “TOSNODES = TOSH_NUM_NODES” is the actual definition place of the default max network size. We must set the TOSNODES to TOSH_NUM_NODES, so we can just edit the  flag “-fnesc-tossim tosnodes” in the file “pc.target” to set the upper bound of default max nodes in TOSSIM. Of course, we can specify a value to TOSNODES to set the bound directly.

 

结论3nido.h当中定义了TOSSIM运行的默认参数,很多TOSSIM运行时的参数和端口都可以在这里找到。

 

为了找到TOSSIM能支持的最大节点数,我们可以继续做如下实验:

Since I broke the upper bound of 1000, I wanted to know if it was good for 5000-node simulation. Therefore, I modified “-fnesc-tossim tosnodes” flag to 5000. The compilation is successful.

Screenshot 9 successful compilation for 5000 nodes

 

However, it has the EEPROM error during the running time and automatic stop. I kept on tracking on the max number of nodes on running time. 4096(12th power of 2) was the max number so far.

Screenshot 10 EEPROM Error

 

I remembered there was another flag located in “nido.h” named DEFAULT_EEPROM_SIZE. This should be the right place for EEPROM_SIZE. I changed it to 1024*1024 and recompiled the application. Then, a 5000-node simulation worked.

 

 

 

Screenshot 11 successful running for 5000 nodes

 

5000 had been achieved. I tried 6000,7000,8000,9000 and failed again at 10000. It had the system error of WIN32 ERROR 8 and Segmentation fault (core dumped). I tried to get to max number and tested for a lot of times. I finally got 9324 as the max that we could achieve. I did not know why this was the final one. It was not some power of 2 and it seemed strange.

Screenshot 12 core dumped when reach 10000 nodes

 

结论4TOSSIM能模拟的最大的节点数是9324,超出将无法运行,出现的错误是segmentation fault,错误原因不明,但以个人经验估计是内存问题。

 

以上实验的平台是:
The hardware platform is Intel Pentium 4 with 1G memory.

The software is Microsoft Window XP 32bit and TinyOS 1.3 run on Cygwin.

 

后来我又在实验室的新PC上重做了以上所有实验,结论相同。

The hardware platform is Intel i7 950 with 24G memory (对,你没看错,不是2G,也不是4G就是二十四G的内存).

The software is Microsoft Window 7 64bit and VMwin xp 32 bitTinyOS 1.3 run on Cygwin.

 

手头没有64位的xp,所以其实给虚拟机我也只是分配3G内存,分多了也没有意义。

所以没有在4G以上的内存上运行过tinyos1.3,不知道在64位系统上,是否能有改观?或者tinyos1.x能不能支持64位?

我正在学习使用ubuntu10.04 64bit 去运行 tinyos1.x,但安装是个问题:

第一, 没有教程在linux 64位系统下安装tinyos1.x

第二, linux 64位下安装java都很痛苦

第三, SourceforgeCVS登录不上去,非常的痛苦。

有解决了的同学请不吝赐教,谢谢!

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值