CS434/534: Topics in Networked (Networking) Systems WSN/Mobile Systems Yang (Richard) Yang Computer Science Department Yale University 208A Watson Email:

Slides:



Advertisements
Similar presentations
How to use TinyOS Jason Hill Rob Szewczyk Alec Woo David Culler An event based execution environment for Networked Sensors.
Advertisements

A System Architecture for Tiny Networked Devices
MIDP Mobile Information Device Profile Johnny Yau CIS 642 Prof. Insup Lee.
1 Mobile Software Development Framework: TinyOS, J2ME 10/2/2012 Y. Richard Yang.
Multimedia Network Communications Subject:T0934 / Multimedia Programming Foundation Session:13 Tahun:2009 Versi:1/0.
Writing Your First MIDlet Running JAVA on a Cell Phone Jon A. Batcheller January 27, 2004.
UNDERSTANDING JAVA APIS FOR MOBILE DEVICES v0.01.
Introduction to Java 2 Micro Edition Mark Balbes, Ph.D. Senior Software Engineer Jeff Brown Senior Software Engineer.
Developing an Application with J2ME Technology Scott Palmer, Nat Panchee, Judy Sullivan, Karen Thabet, Sten Westgard.
Jason Hill, Robert Szewczyk, Alec Woo Spring 2000 TinyOS Operating System for Networked Sensors Networked SensorsSystem Structure Composing Components.
Developing Software for Wireless Devices
1 TinyOS Mohammad Rahimi CSCI599-Spring Motivation  The new class of distributed tiny devices  The new generation of software.
PDA Programming Using J2ME Presenter :涂俊凱 Date : 2003/4/8.
TinyOS Software Engineering Sensor Networks for the Masses.
Developing J2ME Applications Mobile and Wireless Networks.
Cosc 4730 Phone Programming in Java An Introduction.
Java 2 Platform, Micro Edition (J2ME) By Xiaorong Wang.
1 Mobile Software Development Framework: Android Activity, View/ViewGroup, External Resources, Listener 10/9/2012 Y. Richard Yang.
J2ME Java for Mobile Environments Based on J2ME In A Nutshell, by Kim Topley, O’Reilly & Associates Inc., 2002, and Tetris by Alexei Patinov.
An Introduction to the Java ME Project Jens A Andersson.
1 Mobile Software Development Framework 4/14/2009 Richard Yang.
A System Architecture for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Michael Brockway Advanced Applications Development in Java J2ME -- Introduction l Introduction / Overview l Java 2 Micro Edition n CLDC n MIDP l Examples.
1 OFDM, Mobile Software Development Framework 9/27/2012 Y. Richard Yang.
April 15, 2005TinyOS: A Component Based OSPage 1 of 27 TinyOS A Component-Based Operating System for Networked Embedded Systems Tom Bush Graduate College.
Computer Science Wi-Fi App using J2ME and MVC Architecture Advisor : Dr. Chung-E Wang Department of Computer Science Sacramento State University Date:
J2ME Presented by May Sayed & Menna Hawash. Outline Introduction “Java Technology” Introduction “What is J2ME?” J2ME Architecture J2ME Core Concepts 
1Basics of J2ME. 2 Objectives –Understand the different java API’s and how the mobile edition API’s fit in –Understand what a mobile configuration and.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 12 lcdui Rob Pooley
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 13 lcdui and OXO Rob Pooley
Overview of: System Architecture Directions for Networked Sensors John Kerwin CSE 291 Sensor Networks Paper by: Jason Hill, Robert Szewczyk, Alec Woo,
Dhanshree Nimje Smita Khartad
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presented by Yang Zhao.
Simulation of Distributed Application and Protocols using TOSSIM Valliappan Annamalai.
HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 TinyOS & NesC.
Part 2 TinyOS and nesC Programming Selected slides from:
System Architecture Directions for Networked Sensors Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kris Pister Presenter: James.
TinyOS Sandeep Gupta. Operating System (OS) What is an OS? Main functions  Process management  Memory management  Resource management Traditional OSs.
System Architecture Directions for Networked Sensors.
1 Introduction to J2ME Outline MIDP Building J2ME Apps- Tool J2ME Wireless Toolkit Demo MIDlet Programming -- MIDlet Transition States -- Midlet Skeleton.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Why does it need? [USN] ( 주 ) 한백전자 Background Wireless Sensor Network (WSN)  Relationship between Sensor and WSN Individual sensors are very limited.
Software Architecture of Sensors. Hardware - Sensor Nodes Sensing: sensor --a transducer that converts a physical, chemical, or biological parameter into.
TinyOS Sandeep Gupta. TinyOS basics TinyOS is  Single tasking OS  Interrupt driven Written using a Component based language A set of components put.
Advance Computer Programming Market for Java ME The Java ME Platform – Java 2 Micro Edition (J2ME) combines a resource- constrained JVM and a set of Java.
1 Mobile Systems Richard Yang. 2 Admin. r Homework 4 m due Friday Dec. 8th.
1 Mobile Application Development Framework 4/16/2009 Richard Yang.
The Java Platform Micro Edition Java ME
Introduction to Operating Systems Concepts
INTRODUCTION TO WIRELESS SENSOR NETWORKS
Simulation of Distributed Application and Protocols using TOSSIM
Monitoring Robot Prepared by: Hanin Mizyed ,Abdalla Melhem
OPERATING SYSTEMS CS3502 Fall 2017
Mobile Systems Richard Yang.
Activities and Intents
MOBILE DEVICE OPERATING SYSTEM
Wireless Instant Messaging Using J2ME
Mobile Software Development Framework: TinyOS, J2ME
Mobile Software Development Framework
CMPE419 Mobile Application Development
Real-time Software Design
By Jeff Heaton An Overview of J2ME By Jeff Heaton
Mobile Software Development Framework: Android
Lecture Topics: 11/1 General Operating System Concepts Processes
Java for Mobile Devices
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Lecture 1 Runtime environments.
Foundations and Definitions
CMPE419 Mobile Application Development
Presentation transcript:

CS434/534: Topics in Networked (Networking) Systems WSN/Mobile Systems Yang (Richard) Yang Computer Science Department Yale University 208A Watson Email: yry@cs.yale.edu http://zoo.cs.yale.edu/classes/cs434/

Admin. Project planning Start: Apr. 5 A meeting w/ instructor; Due: team, potential topics Checkpoint I: Apr. 13 (updated; Thursday) Initial ideas; survey of related work; feedback from instructor/TF Checkpoint II: Apr. 20 (updated) Initial design; feedback from instructor/TF Checkpoint III: Apr. 27 (updated) Design refined; key components details Final report: May 4 No more than 6 page write up

Recap: Software Defined Radio Instead of hardware-centric radio, making wireless networking systems software-centric. Key challenges Handle large data volume Provide hard deadline and accurate timing control Provide easy to use, compose signal processing blocks

Recap: GNURadio Software/Execution Model Software model C++ Composite pattern to build a hierarchy of blocks Python Application management (e.g., GUI) Flow graph construction Non-streaming code (e.g., MAC-layer) Execution model Python thread for each top_block Python Application development Flow graph construction C++ Signal processing blocks

Recap: Sora Software Radio Efficient impl of blocks using LUT/SIMD Utilizing multi-core for streaming processing Dedicated core for real-time support

Outline Admin and recap Wireless and mobile software framework GNURadio SORA TinyOS

Recap: Settings and Requirements of TinyOS Flexible configuration of attached devices Small foot print devices have limited memory and power resources 1.5” x 1.5”

TinyOS: Software Concept TinyOS: Generate customized OS + application for each given scenario support one application at a time but flexible reprogramming

Schematic Diagram

TinyOS: Software Concepts A TinyOS consists of one or more components linked together software components motivated by hardware component Each component specifies that it provides some interfaces allows other components to control it also uses some interfaces control other components

A uses interfaces I1 and I2 An interface declares a set of functions called commands that provider must implement another set of functions called events that the interface user must implement A uses interfaces I1 and I2 I1 I2 commands events commands events B provides I1 C provides I2 C provides I3

Interface: Examples Timer.nc ADC.nc StdControl.nc interface StdControl {   command result_t init();   command result_t start();   command result_t stop(); } Timer.nc interface Timer { command result_t start( char type, uint32_t interval);   command result_t stop();   event result_t fired(); } ADC.nc interface ADC { async command result_t getdata();   async command result_t getContinuousData();   event result_t dataReady(uint 16_t data); }

Example Application A simple TinyOS application which periodically reads in the light intensity value, computes a moving average, displays it on the LED

Module: Definition SenseTask Leds Timer ADC ADCControl SenseTaskM.nc module SenseTaskM { provides { interface StdControl; } uses { interface Timer; interface ADC; interface StdControl as ADCControl; interface Leds; … SenseTask Timer ADC start/stop fired getData dataReady Leds ADCControl init/start/stop xxxOn/Off()

Module: Implementation Define commands and event handlers frame (storage) statically allocated, fixed size to know memory requirement and avoid overhead of dynamic allocation See SenseTaskM.nc Component Internal Tasks Internal State Commands Events can invoke lower level commands, but cannot block

Explicit Linking of Components Two types of components: modules: individual components configurations : assemble components together, connecting interfaces (objects) used by components to interfaces (objects) provided by others See SenseTask.nc

TinyOS Execution Model xxxOn/Off() SenseTask LED start/stop fired getData init/start/stop dataReady Timer ADC ADCControl Design options?

TinyOS Execution Model Concurrency model: only two threads long running tasks that can be interrupted by hardware event handlers Tasks perform the primary computation work commands and event handlers post tasks call lower level commands signal higher level events schedule other tasks within a component Tasks are posted to a FIFO queue each task is atomic with respect to other tasks run to completion, but can be preempted by events the task scheduler is a simple FIFO scheduler See SenseTaskM.nc details

Running tinyOS Program make mica ncc -o main.exe -target=mica SenseTask.nc avr-objcopy --output-target=srec main.exe main.srec Use uisp to install

A More Complete Sample Application Sensor network monitoring monitor temperature and light conditions periodically transmit measurements to a base station sensors can forward data for other sensors that are out of range of the base station dynamically determine the correct routing topology for the network

Internal Component Graph RFM Radio byte Radio Packet UART UART Packet I2C Temp Light Active Messages Clocks bit byte packet Ad hoc Routing Application application HW SW Hardware abstraction components, like the RFM radio component, map physical hardware into our component model. They translate hardware interrupts into events, and export commands to manipulate the individual I/O pins of the hardware. Synthetic hardware components simulate the behavior of advanced hardware. For example, the Radio Byte component shifts data into or out of the underlying RFM module, and signals when an entire byte has completed. High level software components perform control, routing, and all data transformations.

Message Send Transition Total propagation delay up the 5 layer radio communication stack is about 80 instructions Timing diagram of event propagation

Evaluation: Storage Scheduler only occupies 178 bytes Component Name Code Size (bytes) Data Size (bytes) Routing AM_dispatch AM_temperature AM_light AM RADIO_packet RADIO_byte RFM Light Temp UART UART_packet I2C 88 40 78 146 356 334 810 310 84 64 196 314 198 32 8 1 Processor_init TinyOS scheduler C runtime 172 178 82 30 16 Total 3450 226 Scheduler only occupies 178 bytes Complete application only requires 3 KB of instruction memory and 226 bytes of data (less than 50% of the 512 bytes available) Only processor_init, TinyOS scheduler, and C runtime are required

Evaluation: Timing Operations Cost (cycles) Time (µs) Normalized to byte copy Byte copy 8 2 1 Post an Event Call a Command Post a task to scheduler Context switch overhead 10 46 51 2.5 11.5 12.75 1.25 6 Interrupt (hardware cost) 9 2.25 Interrupt (software cost) 71 17.75

Summary: TinyOS Two threads exec Components Configurations TinyOS ADC.nc interface ADC { async command result_t getdata();   async command result_t getContinuousData();   event result_t dataReady(uint 16_t data); } Components provide commands and require callback hooks for event-driven programming Configurations Link components TinyOS an app (configuration) at a time, linking only necessary components Two threads exec one for event one for task configuration SenseTask { // this module does not provide any interfaces } implementation { components Main, SenseTaskM, LedsC, TimerC, DemoSensorC as Sensor; Main.StdControl -> TimerC; Main.StdControl -> Sensor; Main.StdControl -> SenseTaskM; SenseTaskM.Timer -> TimerC.Timer[unique("Timer")]; SenseTaskM.ADC -> Sensor; SenseTaskM.Leds -> LedsC;

Discussion: Compare GNURadio/Sora/TinyOS What are some similar software concepts? What are some differences?

Discussion Can we use GNURadio/SORA/TinyOS for writing mobile applications for mobile phones/tablets, or in other words, what are missing? Mobile phones/tablets are GUI apps

Outline Admin and recap Wireless and mobile software framework GNURadio SORA TinyOS Java ME

Java Platforms Java is divided into multiple platforms, e.g., Enterprise Edition (EE) business applications Standard Edition (SE) general applications Micro Edition (ME) small devices such as mobile phone, PDA, car navigation Oracle’s claims on Java on mobile devices http://www.java.com/en/about/

Java ME Basic Concepts: Versioning To accommodate heterogeneous mobile devices, define configurations and profiles A configuration provides fundamental services for a broad category of devices (e.g., lang, io, util) A profile supports higher-level services common to a more specific class of devices or market (e.g., life cycle, GUI) An optional package adds specialized services that are useful on devices of many kinds, but not necessary on all of them http://www.oracle.com/technetwork/java/embedded/javame/overview/index-jsp-138655.html

Example ME Configurations Connected Limited Device Configuration (CLDC) 160 KB to 512 KB of total memory available 16-bit or 32-bit processor low power consumption and often operating with battery power connectivity with limited bandwidth examples: cell phones, certain PDAs Connected Device Configuration (CDC) 2 MB or more memory for Java platform 32-bit processor high bandwidth network connection, most often using TCP/IP examples: set-top boxes, certain PDAs

CLDC Classes java.lang java.util java.io Boolean Byte Character Class Integer Long Math Object Runnable Runtime Short String StringBuffer System Thread Throwable ByteArrayOutputStream ByteArrayInputStream DataOuput DataInput DataInputStream DataOutputStream InputStream InputStreamReader OutputStream OutputStreamWriter PrintStream Reader Writer Calendar Date Enumeration Hashtable Random Stack TimeZone Vector java.lang java.util java.io

Example ME Profiles Mobile Information Device Profile (MIDP) GUI, multimedia and game functionality, end-to-end security, and greater networked connectivity mobile phones and entry level PDAs with display Foundation Profile set of Java APIs that support resource-constrained devices without a standards-based GUI system Personal Profile Full set of AWT APIs, including support for applets and Xlets CDC + Foundation Profile + Personal Profile for high-end PDA …

MIDP Packages addition in version 2.0 version 1.0 javax.microedition.lcdui.game javax.microedition.media javax.microedition.media.control javax.microedition.pki java.io java.lang java.util javax.microedition.io javax.microedition.lcdui javax.microedition.rms javax.microedition.midlet addition in version 2.0 version 1.0

MIDP Technology Stack

Discussion What are some major differences between desktop GUI app design and mobile (phone/tablet) GUI app design? Limited screen: one thing at a time Limited resources: more dynamic apps (life cycle) More heterogeneous display: decoupling between display and logic

Some Key Features of Mobile UI App Limited screen real estate one thing at a time Limited resources need more dynamic system management on app life cycle; give app chances to adapt, better mem management Limited screen: one thing at a time Limited resources: more dynamic apps (life cycle) More heterogeneous display: decoupling between display and logic

MIDlet An MIDP application is called a MIDlet similar to the SE applet A MIDlet moves from state to state in the lifecycle, as indicated start – acquire resources and start executing pause – release resources and become quiescent (wait) destroy – release all resources, destroy threads, and end all activity

MIDP Visual Display Each MIDP has one instance of Display Display.getDisplay(this) to get the manager At any instance of time at most one Displayable object can be shown on the display device and interact with user display.setCurrent(<Displayable object>)

MIDP Visual Display Displayable Canvas GameCanvas Screen Alert, List, TextBox, Form Form can contain multiple form items for organization Labels, Image Items, String Items, Text Fields, Date Fields, Gauges, Choice Groups

MIDP: User Interaction Displayable objects can declare commands and declare a command listener: addCommand(Command cmd) addCommandListener() Command(<label>, <type>, <priority>) Type: BACK, CANCEL, EXIT, HELP, ITEM, OK, SCREEN, and STOP

HelloWorldMIDlet.java import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class HelloWorldMIDlet extends MIDlet implements CommandListener { private Command exitCommand; private Display display; private TextBox t; public HelloWorldMIDlet() { display = Display.getDisplay(this); exitCommand = new Command("Exit", Command.EXIT, 2); t = new TextBox(“CS434", "Hello World!", 256, 0); t.addCommand(exitCommand); t.setCommandListener(this); } public void startApp() { display.setCurrent(t); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } public void commandAction(Command c, Displayable s) { if (c == exitCommand) { destroyApp(false); notifyDestroyed();

Summary: Java ME MIDP Architecture Lifecycle callbacks startApp pauseApp destroyApp disp=Display.getDisplay(this) disp.setCurrent(disp) disp.addCommand() A set of commands MIDP Current Displayable Command listener disp.setCommandListener()

MIDP: Persistent State Record store defined in javax.microedition.rms Record store identified by name: static String[] listRecordStores(); recordStore = RecordStore.openRecordStore("scores", true); recordId = addRecord(byte[] data, int offset, int numBytes); getRecord(int recordId);

Summary: Java ME Scale down a popular programming environment to ease learning Use virtual machines to mask device heterogeneity Use configuration/profiling to handle device heterogeneity and avoid using lowest common denominator MIDLet to manage app life cycle Displayable to visual display, commands and provides command listener Introduce persistent record store

Discussion on Java ME What designs of Java ME do you like and hence expect later frameworks (e.g., IOS, Android) may have too? What features do you think are missing in Java ME?

Common Features We Expect of Mobile UI App Framework Limited screen real estate one thing at a time Limited resources: more dynamic system management on app life cycle give app chances to adapt, better mem management Limited screen: one thing at a time Limited resources: more dynamic apps (life cycle) More heterogeneous display: decoupling between display and logic

Mobile GUI App Screen real-estate is limited => Focus on one thing at a time

Mobile GUI App Screen real-estate is limited => Focus on one thing at a time

Mobile GUI App Workflow App lifecycle callbacks/custom start pause … App

Mobile GUI App Workflow: Do One Thing App lifecycle callbacks/custom start pause … App Display Composite Display Composite

Mobile GUI App Workflow: Switch to Another GUI App lifecycle callbacks/custom start pause … App Display Composite Display Composite Display Composite Display Composite

Mobile GUI App Workflow: Display Content Based on Underlining Data App lifecycle callbacks/custom start pause … App Display Composite Display Composite Data/Model Data/Model

Mobile GUI App Workflow: Handle Events App lifecycle callbacks/custom start pause … App Display Composite Display Composite Event Handler Event Handler Data/Model Data/Model