- 浏览: 896665 次
- 性别:
- 来自: 太原
文章分类
- 全部博客 (198)
- Linux/Unix (38)
- TinyOS / NS-2 for『WSN』 (44)
- 思想的拼图 (5)
- 开源 OpenSource (2)
- Framework 开发框架 (0)
- Software Engineering 软件工程 (2)
- IT项目管理 (6)
- Networking 网络技术 (2)
- Java (6)
- C语言 ANSI C (22)
- .NET / C# (9)
- C++ (12)
- Web 语言 Html/Xml (5)
- Groovy on Grails (1)
- Algorithm 算法 (1)
- Database 数据库技术 (5)
- Tools (21)
- VM 虚拟机 (3)
- WSN (wireless sensor network) (2)
- Linux 命令专辑 (3)
- PHP (0)
- 办公软件 (3)
最新评论
-
cfczdws:
感谢楼主,查了半天终于发现居然是htmlentities()做 ...
htmlentities()函数把中文转成了乱码 -
decoxiaohan:
这本书的名字 有谁知道????~~~
OMNeT++中文用户手册(完全版) -
huonie:
怎么下载啊
OMNeT++中文用户手册(完全版) -
huonie:
没有内容啊
OMNeT++中文用户手册(完全版) -
kyx0413:
谢谢先 先看看
OMNeT++中文用户手册(完全版)
Lesson 1
provides and uses interfaces
A component provides and uses interfaces.
The provided interfaces are intended to represent the functionality that the component provides to its user in its specification
The used interfaces represent the functionality the component needs to use them to perform its job in its implementation.
Interfaces are bidirectional: they specify a set of commands, which are functions to be implemented by the interface's provider, and a set of events, which are functions to be implemented by the interface's user. For a component to call the commands in an interface, it must implement the events of that interface.
A single component may use or provide multiple interfaces and multiple instances of the same interface.
The set of interfaces which a component provides together with the set of interfaces that a component uses is considered that component's signature.
BlinkC -> MainC.Boot; BlinkC.Timer0 -> Timer0; BlinkC.Timer1 -> Timer1; BlinkC.Timer2 -> Timer2;
= 等号是把提供接口等同于它的实现
-> 箭头是将使用接口与提供实现的接口导通起来, 而=是将提供接口与module中的实现等同起来
Configurations and Modules
Modules provide the implementations of one or more interfaces.
Configurations are used to assemble other components together, connecting interfaces used by components to interfaces provided by others.
Lesson 2
As most mote platforms do not have hardware-based memory protection, there is no separation between a "user" address space and a "system" address space; there is only one address space that all components share. This is why many TinyOS components try to keep their state private and avoid passing pointers: since there is no hardware protection, the best way to keep memory uncorrupted is to share it as little as possible.
Datatype
Rather than the standard C names of int, long, or char, TinyOS code uses more explicit types, which declare their size. In reality, these map to the basic C types, but do so differently for different platforms.
TinyOS code avoids using int, for example, because it is platform-specific. For example, on mica and Telos motes, int is 16 bits, while on the IntelMote2, it is 32 bits.
Additionally, TinyOS code often uses unsigned values heavily, as wrap-arounds to negative numbers can often lead to very unintended consequences. The commonly used types are:
8 bits | 16 bits | 32 bits | 64 bits | |
signed | int8_t | int16_t | int32_t | int64_t |
unsigned | uint8_t | uint16_t | uint32_t | uint64_t |
There is also a bool type. You can use the standard C types, but doing so might raise cross-platform issues. Also, uint32_t is often easier to write than unsigned long.
Most platforms support floating point numbers (float almost always, double sometimes), although their arithmetic is in software rather than hardware.
Interface
Invoking an interface command requires the call keyword, and invoking an interface event requires the signal keyword. BlinkC does not provide any interfaces, so its code does not have any signal statements (也就是说如果provide interface的话,需要用signal来区分它使用interface的event和提供的interface的event。 use interface的event需要加signal)
TinyOS Execution Model: Tasks
So far, all of the examples we've looked at have been direct function calls. System components, such as the boot sequence or timers, signal events to a component, which takes some action (perhaps calling a command) and returns. In most cases, this programming approach works well. Because sync code is non-preemptive, however, this approach does not work well for large computations.
A component needs to be able to split a large computation into smaller parts, which can be executed one at a time. Also, there are times when a component needs to do something, but it's fine to do it a little later. Giving TinyOS the ability to defer the computation until later can let it deal with everything else that's waiting first.
Tasks enable components to perform general-purpose "background" processing in an application. A task is a function which a component tells TinyOS to run later, rather than now. The closest analogies in traditional operating systems are interrupt bottom halves and deferred procedure calls.
A task is declared in your implementation module using the syntax
task void taskname() { ... }
where taskname() is whatever symbolic name you want to assign to the task. Tasks must return void and may not take any arguments. To dispatch a task for (later) execution, use the syntax
post taskname();
The post operation places the task on an internal task queue which is processed in FIFO order. When a task is executed, it runs to completion before the next task is run.
Internal function
Internal functions 没有command or event modifier修饰符
Internal functions act just like C functions: they don't need the call or signal keywords.
Split-Phase Operations
操作分割成 invocation 和 completion 两个阶段。 因为等程序调用一个运行时间很长的操作时, 不会返回除非完成这个操作(造成程序阻塞)。In a split-phase system, when a program calls a long-running operation, the call returns immediately, and the called abstraction issues a callback when it completes.
好处:
- First, split-phase calls do not tie up stack memory while they are executing.
- Second, they keep the system responsive: there is never a situation when an application needs to take an action but all of its threads are tied up in blocking calls.
- Third, it tends to reduce stack utilization, as creating large variables on the stack is rarely necessary.
发表评论
-
几种用于WSN的仿真工具
2009-12-09 15:26 4241为评价无线传感器网络协议算法的性能,仅通过实验是无法实现的,特 ... -
OMNeT++中文用户手册(完全版)
2009-11-18 22:36 16647http://www.netforum.com.cn/view ... -
改变Telos 系列节点Serial baud rate
2009-08-21 18:50 2198如果节点与PC通信时出现非正常丢包或者serial不稳定当收包 ... -
TinyOS编译问题
2009-08-18 20:47 13241. 有时候编译提示找不到某个文件时, 可能是由于在linux ... -
改变节点transmission power, radio power level (tx_power)
2009-08-11 20:03 4317使用 CC2420Packet 中 setPower 来改变每 ... -
Tcl/tk 小记
2009-07-22 23:43 15331. 检查variable变量是否声明 在使用Tcl时候会经常 ... -
NS无线仿真中无法设置节点颜色的解决方案
2009-07-22 18:57 1935NS中提供了配置节点与 ... -
awk: malloc(): memory corruption 错误
2009-07-09 21:56 7250问题如下: *** glibc detected *** aw ... -
ns2 对无线网络模拟
2009-07-06 19:52 2663在模拟无线网络时需要对tcl模拟脚本文件的参数进行设置,比如P ... -
使用Gnuplot 绘制ns2模拟结果图
2009-06-25 17:48 8215Gnuplot(command-driven inter ... -
ns2模拟无线网络的NAM动画
2009-06-24 22:26 5010无线的各个参数 ####################### ... -
ns2 模拟WSN协议之手记
2009-06-23 23:55 2958ns2中模拟WSN,用Timestamp时间戳计算点对点Del ... -
ns2 中得到Agent的实例
2009-06-16 21:02 2914下面代码说明了如何访问其他节点的Agent,以AODV协议为例 ... -
TinyOS使用MIG时报错!
2009-04-06 01:30 1829在Makefile中加入启用MIG的选项后,编译出现一下错误: ... -
Tinyos 2.0 笔记小结(1)
2009-03-16 20:11 23661. configure组件注意事项 一般在confi ... -
Tinyos 2.0使用笔记
2009-03-06 19:48 27931.编译与安装程序到节点 引用 $ make mica2 ... -
Tinyos 中常用术语
2009-03-05 03:32 1095EOFF 关断能量损耗 用于 device off, stop ... -
什么是 nx_ type
2009-03-01 03:29 1515nx_ types 是在nesC 1.2,tinyos中用到的 ... -
TinyOS 下安装 JNI 的问题
2009-02-25 00:05 32271. "java not found, not i ... -
『TinyOS』学习笔记 #11?
2009-02-20 01:09 3811Lesson 11 TOSSIM Compiling ...
相关推荐
总的来说,TinyOS的学习涵盖了nesC语言的特性和编程范式,包括组件接口、并发模型、任务调度以及事件处理。理解这些知识点对于编写和调试TinyOS应用程序至关重要。通过深入学习和实践,开发者能够更好地掌握如何利用...
TinyOS自学笔记主要关注的是nesC语言,这是一种针对传感器网络节点设计的编程语言,特别适用于资源有限的环境。nesC是C语言的一种扩展,其设计原则和执行模型都是为了体现TinyOS操作系统的核心特性。 1. **结构和...
### TinyOS 教程知识点详解 #### 一、硬件简介 **MICA2 Mote (MPR400CB)** - **处理器**: Atmel ATmega128L 微处理器,运行频率为 7.3827MHz。...通过上述知识点的学习,可以更好地理解 TinyOS 的架构和开发流程。
根据给定文件内容,我们可以提炼出以下知识点: TinyOS是一个为无线嵌入式传感器网络设计的开源...通过学习这些教程,开发者可以掌握如何利用TinyOS所提供的工具和机制,实现快速部署和有效管理资源有限的嵌入式系统。
tinyos-nesc-note note of nesc programming ###nesc 学习笔记 记录在学习这新的一门知识的过程中遇到的问题和解决办法,还有一些重要知识点。 一些nesc程序。
### Zigbee学习笔记要点 #### 一、Zigbee学习误区与正确方向 在学习Zigbee技术的过程中,很多初学者容易陷入一个误区——过度关注协议栈代码的细节。这实际上并不是一种高效的学习方法,主要原因有两点: 1. **从...
通过以上步骤的学习和实践,不仅可以帮助初学者熟悉 MoteWorks 和 MoteView 的使用,还能让他们了解 TinyOS 下的应用程序开发流程,以及如何控制无线传感器网络中的节点行为。这对于新手来说是非常有价值的实践经验...
学习者可以使用Arduino代码来编写程序,并且ZigDuino同样支持多种开源无线传感器网络操作系统,如Contiki、TinyOS和Nank-RK等,这为更深入地学习物联网提供了可能。 在学习资源方面,ZigDuino的开发社区提供了大量...
4. **TinyOS**:是一种专为WSNs设计的操作系统,强调低功耗和模块化,常用于教学和研究。 5. **Ad hoc节点结构**:与标准传感器节点相比,Ad hoc节点通常具有更多辅助设备,如显示器、键盘等,更像是简化版的笔记本...
2. 软件设计:主要包括固件开发,涉及操作系统的选择(如FreeRTOS或TinyOS),驱动程序编写,以及数据处理算法的设计。软件设计需考虑实时性、节能优化和网络协议栈的实现。 三、物联网传感器类型及功能 1. 温湿度...