第9篇TOSSIM (教程lesson 5)

从本篇开始,都是介绍如何使用TOSSIM仿真模拟TinyOS,教程的lesson1, 4, 5, 6, 7都仿真成功。寻求仿真帮助的同学,可以在这里找到你们需要的答案。

 

TOSSIM TinyOS 模拟器,它的优点是:直接由TinyOS 代码编译而来,所以他和tinyos是整合在一起的,而且模拟程序可以直接在PC运行。TOSSIM 能模拟上千节点的运行,系统默认的网络最大节点数是1000.经过修改,我能找到的最大节点数是9324,后文会加入如何更改的方法.

 

TOSSIM的最大缺点是:TOSSIM不是异步模拟器,也就是说,模拟中的每个节点只能运行相同的TinyOS 程序。唯一的方法是在程序当中设置节点ID,然后对不同的id编写不同的代码让他们运行。

 

TOSSIM 提供运行时配置的调试输出,允许使用者从不同角度检视应用程序的执行情况而不需要重新编译。TOSSIM 还提供了多种与网络进行交互的机制,还可监视数据包的流量、静态或动态地往网络中注入数据包等。

 

TOSSIM仿真实现过程如下所示:
进入cygwin应用程序,进入目录 c:/cygwin/opt/tinyos-1.x/apps/Blink
运行命令: make pc
然后运行命令:export  DBG=led
最后运行:build/pc/main.exe   3
3
为节点的数量。

TOSSIM对应的运行参数设置如下:

The TOSSIM executable is named main.exe, and resides in build/pc. It has the following usage:

Usage: ./build/pc/main.exe [options] num_nodes

[options] are:

-h, --help Display this message.

-gui pauses simulation waiting for GUI to connect

-a= specifies ADC model (generic is default)

options: generic random

-b= motes boot over first seconds (default: 10)

-ef= use for eeprom; otherwise anonymous file is used

-l= run sim at times real time (fp constant)

-r= specifies a radio model (simple is default)

options: simple static lossy

-rf= specifies file input for lossy model (lossy.nss is default)

-s= only boot of nodes

-t= run simulation for virtual seconds

num_nodes number of nodes to simulate

 

The -h or --help options prints out the above usage message, and some additional information.

 

The -a option specifies the ADC model to use. TOSSIM currently supports two models: generic and random. Section 4 describes these models.

 

The -b option specifies the interval over which motes boot. Their boot times are uniformly distributed over this interval. The default value is ten seconds.

 

The -e option is for named EEPROM files. If -e isn’t specified, the logger component stores and reads data, but this data is not persistent across simulator invocations: it uses an anonymous file.

 

The -l option is for making TOSSIM run at a rate representative of real time. The scale argument specifies what relative rate should be used. For example, -l=2.0 means twice as fast as real time (two virtual seconds run in one real second), while -l=0.1 means one tenth of real time (one virtual seconds runs in ten real seconds.). TOSSIM can only run so fast; specifying it to run faster than it can will cause it to run as quickly as possible. Using this option imposes a significant performance overhead; it shouldn’t be used when trying to run simulations quickly.

 

The -r option specifies the radio model to use. TOSSIM currently supports two models: simple and lossy. Earlier versions also supported a “static” model, but this has been subsumed by the lossy model.

 

The -s option tells TOSSIM to only boot a subset of the number of nodes specified. This is useful if you want some to boot later, in response to user input. If the -s option is specified, TOSSIM boots mote IDs 0-(num - 1).

 

The -t option tells TOSSIM to run for a specified number of virtual seconds. After sec seconds have passed, TOSSIM exits cleanly.

 

The num nodes option specifies how many nodes should be simulated.

 

TOSSIM当中的其他问题:

在这里罗列一下,还没有解决.

1.radio related: like lossy,bit errors and packet errors.

2.ADC related.

3. EEPROM related.

你可能感兴趣的:(TinyOS学习)