Presentation is loading. Please wait.

Presentation is loading. Please wait.

TinyOS Tutorial Network lab. 김인태

Similar presentations


Presentation on theme: "TinyOS Tutorial Network lab. 김인태"— Presentation transcript:

1 TinyOS Tutorial Network lab. 김인태 quenring@paran.com
Lesson 1: Getting Started with TinyOS and nesC 이장에서는 TinyOS의 기본개념과 그 시스템에서 쓰여질 nesC 언어를 포함하고있습니다. nesC 개념의 간단한 overview와 이러한 환경에서 프로그래밍을 시작하는데 너에게 도움을 줄 구문을 포함하고있습니다. Network lab. 김인태

2 USN(Ubiquitous Sense Network)

3

4

5

6

7

8

9

10 Sensor Network Feature
거의 대부분 sleep 상태 인터럽트 노드를 active 또는 running 상태로 전이시킨다. 인터럽트의 3가지 종류 타이머 인터럽트 데이터를 sensing 할 때 발생하는 인터럽트 송/수신 인터럽트 (communication) Power On INIT SLEEP Interrupt ACTIVE

11 Key Requirement Hardware Software 저전력 소모 기술 다양한 센서를 위한 Flexible 한 I/O
작은 크기 Software 작고 간단한 코드 에너지 효율성 지원 ( 스케쥴 정책, 라우팅 프로토콜, 알고리즘..) 병목 현상의 지양 재사용성 견고, 저전력, ad-hoc network 지원

12 O/S for Sensor Networks
제한된 자원의 사용 프로세싱, 저장, 대역폭, 전력 … 수많은 노드에 뿌려진 Applications 자가 수집 변화하는 네트워크 환경에서의 적응 통신은 기본적인 요소 (ad-hoc , mesh) 병목 현상 처리 센싱 데이터와 네트워크 트래픽 등 (scheduling) 견고성 Critical 한 operation 에 대한 보장 응용 계층과 하위 레벨 계층간의 access가 용이해야 한다.

13 TinyOS와 nesC의 소개 TinyOS의 시스템, 라이브러리, 애플리케이션은 nesC로 작성 nesC
MOTE를 위한 운영체제. 기존의 프로그래밍 모델을 지원 C의 확장 개념인 nesC로 이루어짐. OS Component + apps Component Complete application fit in 4KB data of RAM 빈번히 사용되는 function의 재사용성 네트워킹 스케쥴링 Other components interfaces (clock, sensor..) 모듈화된 구조 Component 들로 구성 Component 들은 매우 특별한 기능을 수행 small images 재사용 가능한 component nesC 구조화된 컴포넌트 기반 application들의 프로그래밍을 위한 새로운 언어 센서 네트워크와 같은 임베디드 시스템에 적용하기 위해 개발 nesC로 표현된 TinyOS의중요한 몇가지 개념 application들은 잘 정의되어있는 component들과 양지향성의 interface들로 만들어진다. nesC는 동시 병행 모델,tasks와 hardware event handlers를 기반, 컴파일 시간에 data races를 감지 하게끔 정의 되어있습니다. TinyOs는 미국 UC(University of California)버클리 대학에서 개발된 무선 센서 네트워크를 위한 전용 운영체제이다. 이름에서도 알 수 있듯이, TinyOS 기반의 프로그램들은 매우 작은 용량의 크기로 컴파일되며, 무선 센서 노드의 일반적인 특징(최소한의 하드웨어, 작은 메모리, 낮은 CPU 성능 그리고 한정된 에너지)을 고려하여 최적화된 운영체제이다. TinyOS는 좀더 편리한 프로그램 개발을 위해 클래스 형태의 컴포넌트구조를 갖는 NesC 언어로 구현되어있음. NesC 기존 C언어의 확장, structured component-based 프로그래밍을 위한 새로운 언어로 센서 네트워크와 같은 임베디드 시스템에 적용하기 위해 개발되었음. C언어와 많이 비슷하지만 몇가지 차이점이 있는데 형태는 컴포넌트 기반 개발 – 기존 C에 비해 편리함- 필요한 컴포넌트들만 연결해 주면 원하는 프로그램 작성 가능 코드 크기- 매우 작음-소규모 임베디드 장비에 최적화 제한점 – 동적 메모리가 없다.

14 MICA Sensor Board Light (Photo) Temperature Used for ranging
Acceleration 2 axis, Resolution: ±2mg Magnetometer Resolution: 134mG Microphone Tone Detector Sounder 4.5kHz Used for ranging Up to 2.5m range 6cm accuracy Dedicated microprocessor 25kHz element

15 Gateway Board 1. Host PC 와 Mote의 매개체 역할 (from Serial or ethernet port)
RS232C_Serial Connection Ethernet Connection MIB510 MIB600 1. Host PC 와 Mote의 매개체 역할 (from Serial or ethernet port) 2. Mote의 Flash Memory에 프로그램을 Uploading

16 Component of MOTE-KIT Gateway Board Sensor Board Processor Board
MIB510 MPR400 MPR500 MTS300 MTS510 MTS400/420 MPR2400 MTS310 MIB600 Gateway Board Sensor Board Processor Board

17 Principle of MOTE-KIT + + + PC와 serial 혹은 Ethernet 연결 PC와 Interface
Base Node (Receiver) + PC와 serial 혹은 Ethernet 연결 Node.0 Send and Receive Data Send and Receive Data + + Node.2 Sensing the Data (light,temp,acoustic…) Node.1 Sensing the Data (light,temp,acoustic…)

18 Component-1.nc(wiring)
Components nesC의 구조는 Code파일인 module, components를 연결하 는 Configuration Command와 events를 실행하는 interfaces로 구성되어있다. top-level Configuration파일은 ***.nc configuration 은 **C.nc module은 ***.nc Main.nc app---.nc interface-1.nc interface-1.nc interface-1.nc Component-1.nc(wiring) Component-2M.nc(code) interface-2.nc interface-2.nc Component-3M.nc(code)

19 기본용어 소개 용어 설명 interface Command와 이벤트의 수집을 정의 module nesC에서 구현한 기본 컴포넌트
configuration 다른 컴포넌트 연결로부터 만든 컴포넌트 components 컴포넌트의 list가 configuration 에 정의 provides 정의된 interface가 컴포넌트에 의해 제공 uses 정의된 interface가 module이나 configuration에 의하여 사용 command 직접 function call이 인터페이스에 의하여 나타남 event call back 메시지가 인터페이스에 의하여 나타남

20 nesC 구성과 구조의 분리 모든 프로그램은 컴포넌트로 구성되어 있고, 인터페이스(interface)와 구현(implementation)의 2개의 범위로 정의된다. nesC application은 실행가능한 형태로 서로 연결된 1개 이상의 component들로 구 성되며 한 컴포넌트는 interface를 “provide”하고 “uses”합니다. 양방향성을 가진 인터페이스 인터페이스의 provider에 의해 commands를 수행하고 인터페이스의 user에 의해 events를 수행하며, 단일 인터페이스를 허용한다. 컴포넌트의 연결 컴포넌트들은 서로 다른 컴포넌트를 경유해서 고정된 상태로 연결한다. Interface NesC에서 interface는 양방향성을 가지며 제공자(provider)와 사용자(user)가 되는 컴포넌트를 연결하는 포트의 역할을 수행한다.

21 Component 컴포넌트는 nesC의 기본 단위로 module과 configuration을 가짐
module: application 코드를 제공하고 하나 이상의 interface를 가집니다. Configuration : 다른 콤포넌트와 함께 wiring에 의하여 만들어진 구현으로 nesC와 연계하여 구현하게 된다. (단순히 wiring만함) 그리고 프로그램을 작성할때 반드시 main컴포넌트를 포함해야하는데 이 main컴포 넌트가 시스템 초기화 루틴을 호출하고 스케줄러를 구동하기 때문이다 (tos/system/main.nc 에 위치)

22 프로그램 수행방식 Task Hardware event handler Task는 수행이 연기된 함수이다.
task는 스케줄링이 되면 task끼리는 선점할 수 없다. Hardware event handler 하드웨어 interrupt 신호에 반응 task와 다른 점은 hardware event handler는 task의 수행이나 다른 handler를 선점 할 수 있다.

23 1Hz 간격 LED on/off 예제 configuration Blink { } implementation {
components Main, BlinkM, SingleTimer, LedsC; Main.StdControl -> SingleTimer.StdControl; Main.StdControl -> BlinkM.StdControl; BlinkM.Timer -> SingleTimer.Timer; BlinkM.Leds -> LedsC;

24 BlinkM.nc module BlinkM { provides { interface StdControl; } uses {
interface Timer; interface Leds; implementation { command result_t StdControl.init() { call Leds.init(); return SUCCESS; } command result_t StdControl.start() { // Start a repeating timer that fires every 1000ms return call Timer.start(TIMER_REPEAT, 1000); command result_t StdControl.stop() { return call Timer.stop(); event result_t Timer.fired() { call Leds.redToggle(); Main StdControl BlinkM Timer Leds LedsC SingleTimer

25


Download ppt "TinyOS Tutorial Network lab. 김인태"

Similar presentations


Ads by Google