1 / 42

Implementing Context Aware Applications

Implementing Context Aware Applications. Class 5. Steps to implement CA apps. Context Sensing. Contextual Resource Discovery. Food here at 12 noon. Contextual Augmentation. Contextual Adaptation. Example CA application. Contextual Resource Discovery. Contextual Adaptation.

tosca
Download Presentation

Implementing Context Aware Applications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Implementing Context Aware Applications Class 5

  2. Steps to implement CA apps Context Sensing Contextual Resource Discovery Food here at 12 noon Contextual Augmentation Contextual Adaptation

  3. Example CA application Contextual Resource Discovery Contextual Adaptation Context Sensing Contextual Augmentation Detection of epilepsy onset Increase sampling rate Develop an epilepsy detection algorithm Sensing ECG • ECG monitoring • Sample at low rates to save energy • Detection of epilepsy onset • On detection of onset increase sampling rate • End of epilepsy seizure, revert to decreased sampling rate

  4. Implementation Strategy Contextual Adaptation Context Sensing Contextual Resource Discovery Contextual Augmentation Contextual Sensing – Embedded sensors Contextual Resource Discovery – Mobile phone (Location Services) Contextual Adaptation – Context based decision algorithms in mobile devices Contextual Augmentation – Annotation of events in data bases in a central server.

  5. Processing Requirements Communicate to Mobile Phone Sampling and storage of signals Peak Detection Fast Fourier Transform Reduce sampling command Onset of epilepsy • Example: Determination of heart rate variability • Ratio of the high frequency to low frequency components of the heart rate variation is considered

  6. Wireless communication requirements • Packet delivery ratio • The percentage of packets correctly received amongst the number of packets sent • Depends on the antenna design, power input to the antenna, and the properties of the wireless medium • Average radio power consumption • Depends on the radio duty cycle • Duty cycle is the percentage of time the radio is in “ON” state actively transmitting data

  7. Energy and Form Factor Requirements • Battery is the primary source of energy which has a definite capacity • Applications have specific life time requirements • Lifetime is the number of hours the application should run without interruption • This imposes upper limit on the power consumption • Form factor has to be small so that it is wearable • This imposes constraint on the battery size and hence battery capacity

  8. Embedded Sensor Processor + Communication + Memory • Hardware • MSP 430 microcontroller • CC2420 radio (ZigBee) • 10 KB RAM • 256 KB flash • Software • Runs TinyOS • Program using nesC • USB interface to download code

  9. Processors • MSP430 • 16 bit microcontroller • 10 KB RAM • 256 KB ROM • 256 KB programmable memory • 16-bit RISC architecture • 32 MHz clock • IEEE 1149.1 compliant JTAG interface • Intel XScale • 32 bit processor • 256 KB RAM • 32 MB ROM • 32 MB programmable memory • IA 32 Instruction set • 13 - 400 MHz clock • IEEE 1149.1 compliant JTAG interface • Atmega 128 • 8 bit microcontroller • 4 KB RAM • 4 KB ROM • 128 KB programmable memory • 133 fixed point single clock cycle execution instructions • 16 MHz clock • IEEE 1149.1 compliant JTAG interface

  10. Processors - FPGA

  11. FPGA Logic Consider a matrix of NAND gates with connections between them You can build an entire CPU using them Example: Build a XOR circuit

  12. Processor vs FPGA General purpose v.s. application specific FPGAs allow form factor optimization Hardware reconfiguration possible with FPGAs Stringent programming paradigm Develop from scratch

  13. Communication Miniaturized chip antenna Bluetooth antenna Surface mount antenna Inverted F antenna • Radio protocol + Antenna • Protocols • ZigBEE – IEEE 802.15.4 • Bluetooth – IEEE 802.15.1 • Antenna

  14. Physical Layer Basic Square Wave Phase Shift Keying = 1 = 0 Electromagnetic Coupling How to use electromagnetic coupling to transfer information ? = ?

  15. Medium Access Control Layer Wireless Channel (Restricted Bandwidth) Access Policies Collision avoidance

  16. Network Layer Packet formation – a data structure Routing Management Estimation of link quality based on metrics such as received signal strength Security of transmission Mesh Network Master Slave

  17. Application Layer • Data Payload • Data structures supported • Video, Image, Sensed samples • Software interfaces to invoke a radio transfer • Radio sleep scheduler • Radio power control interface • Link quality estimator

  18. Zigbee Low power mesh networking IEEE 802.15.4 Standard, based on Motorola’s proposal “Low power”, “Networked”, “Open standard” Personal Operating Space (POS) of 10m radius, or greater range Mesh self-healing network

  19. Bluetooth Alternatives to cables IEEE 802.15.1 standard (2002) Master Slave “Short range” and “Mobile products” POS of 10m radius, with mobility Ad-hoc connections between devices

  20. Bluetooth is Best But ZigBeeis Better • IF : • The Network is static • Lots of devices • Infrequently used • Small Data Packets For : • Ad-hoc networks between capable devices • Handsfree audio • Screen graphics, pictures… • File transfer

  21. Air Interface: ZigBee DSSS (direct-sequence spread spectrum) 11 chips/ symbol 62.5 K symbols/s 4 Bits/ symbol Peak Information Rate ~128 Kbit/second Bluetooth FHSS (Frequency-hopping spread spectrum) 1 M Symbol / second Peak Information Rate ~720 Kbit/second

  22. So many dimensions to design • Application requirements • What is the sampling rate ? • Need to do 256 point FFT • Need to perform correlation of two signals • Need to store 500 seconds of data • ……….. • Non functional requirements • Lifetime • Low energy • Thermally safe • Reliable • Processor • Which instruction set ? • Clock frequency • How much RAM, ROM, Flash ? • Fixed point or floating point ? • How much power ? • Size ? • Communication • Which radio to use ? • Which antenna ? • What is the range ? • Which communication protocol ? • How much power to input ? • What is the antenna range ?

  23. Gap between application and hardware Application Designer Hardware Designers • Provide datasheet • Need to improve design based on new, emerging applications • Need to objectively compare performance of multiple platforms • Knows contexts to be sensed • Knows adaptation requirements • Need to map to platform specifications • Need to quantify platform performance Require standard evaluation method and performance metrics

  24. Challenges • Mapping diverse platforms to common evaluation ground • Design Coordinate: A feature of a hardware platform that determines its performance, e.g. Available Memory. • Design Space: The space defined by the design coordinates • Quantify design coordinates, performance parameters • Evaluation Metrics, e.g. kB of RAM, W of power consumed • Measure performance in real application scenarios • Develop benchmarks based on building block context aware applications • Search design space for suitable platform

  25. Design Space Determination Solution Methodology DESIGN SPACE REPRESENTATION DESIGN COORDINATES BSNBENCH TASKS Platform requirements of typical BSN applications • EVALUATION METRICS MEASUREMENTS Design Space Exploration SET OF BSN PLATFORMS DESIRABLE DESIGN SUBSPACE • CHOOSE SUITABLE PLATFORM • APPLICATION REQUIREMENTS • DESIGN NEW PLATFORMS

  26. Design Space Determination P1 Set of available platforms P2 P3 P4 Design Coordinates Average Radio Power Consumption Form Factor On-board data memory mW mm3 kB of RAM Metrics BSNBench Datasheet Datasheet Evaluation Method

  27. Design Coordinates (Processor, data and program memory, signal processing capability) COMPUTATION (Radio reliability, average power consumption, interoperability) WIRELESS COMMUNICATION DESIGN COORDINATES (Battery, energy scavenging support) ENERGY SOURCE (Form factor, thermal safety, sensor integration) PHYSICAL ASPECTS Based on typical BSN application requirements Decompose platform functionality into individual modules

  28. Design Space Exploration Average Radio Power Consumption (mW) Form Factor (mm3) P1 P2 P4 P3 Design coordinate axis RAM Availability (KB) Constraints on design coordinates Sensor platforms Appropriate region in the design space

  29. Evaluation Metrics [1] A. Natarajan, B. Silva, K. Yap, and M. Motani. To hop or not to hop: Network architecture for body sensor networks. In IEEE SECON, 2009. • Use suitable metrics to quantify design coordinates: • Some traditional metrics are independent of the target applications. e.g. MIPS, MIPS/W • Consider BSN application characteristicsto develop more suitable metrics. • For example, processor speed measured in units of samples processed per second

  30. SPSW Metric for Processor (No. of Samples Processed) SPSW = (Time taken) (Power consumed) • SPSW (Samples Processed per Second per Watt) is defined as: • Captures tradeoff between processor speed and power consumption. • “Processing a sample” is application-specific. • For example, a platform motes calculates mean of 1000 data samples in 100 ms and consume 25 mWpower. Then, SPSW = 1000/(100 X 25) = 400 samples/mJ

  31. EPC Metric for Radio Fraction of time in state S * Power consumed in state S EPC = ∑ all states • Radio power consumption depends on radio specifications as well as duty cycle. • EPC (Expected Power Consumption) is defined as: • For example, if radio transmits for 5% time, with power draw 10 mW and is in SLEEP state for remaining 95% time, with power 0.1 mW, EPC = 0.05 * 10 + 0.95 * 0.1 = 0.595 mW

  32. BSNBench: A BSN-specific benchmark • Key Observation: In spite of diversity in BSN applications, some basic tasks are common. • Type of benchmark:Microbenchmark • Composition: • Data Operations (Statistics, Differential Encoding) • Signal Processing (FFT, Peak detection) • Radio Communication (Duty-cycled handshake, PDR) • Sensor Interface (Sensed Data Query) • Implemented in TinyOS 2.0

  33. Design Space Exploration Constraints on Design Coordinates Application Requirements Define subspace of design space Prioritize design coordinates Set of suitable platforms Identify most suitable platform

  34. Case Study • We consider two typical BSN applications: • Epileptic Seizure Detection (ESD): • Detect onset of epileptic seizures using an ECG sensor. • Perform peak detection on ECG signal to calculate RR intervals. • Intervals are converted to FFT coefficients and sent to the gateway device. • Continuous Glucose Monitoring (CGM): • Long term monitoring application • Sensor measures the blood glucose level and transmits this data to a gateway device.

  35. Mapping application requirements to design coordinates (ESD) • Requirement 1: store 5 seconds of data at 256 samples per second and perform FFT • Constraint on the RAM = at least (3×256×5×12)/8 = 5.625 KB of RAM required assuming 3 channel ECG • 256 point FFT computation requiring at least 6 KB of RAM. • Requirement 2: power consumption should be limited to 5 mW • Compound constraint: Processing power + communication power < 5 mW • Processing Power = number of samples per second / SPSW = 3 × 256/SPSW • Communication power = EPC at the required duty cycle • Duty Cycle = transmit time / total time • Transmit time = 3 × 256 × 12/22000 assuming 22 kbps bit rate and 12 bit representation of data • Hence, duty cycle = (3 × 256 × 12/22000)/5 = 4.1 % • Compound constraint • Requirement 3: On body PDR greater than 0.7

  36. Mapping platforms into design space Data sheets for RAM FFT signal processing task for RAM requirements EPC – communication task in BSNBench PDR – BSNBench on body and off body PDR

  37. Mapping contd …. Application 2 (app2) B bpB N1 N2 A IF (PB, tB) Application 1 (app1) (PA, tA) C (1-bpB) NA NB NC A B C (PC, tC) (PC, tC) (PA, tA) (PB, tB) • SPSW characterization • Sensor query task, peak detection, and FFT computation task in BSNBench • Combination of SPSW

  38. Constraints and platform mappings Imote2 BSN node v3 TelosB 256 - point FFT Available RAM Mica2 128 – point FFT 0.7 Constraints on signal processing capability and communication reliability (on-body PDR) On-body PDR

  39. Compound constraint Map 112 Imote 2 (104 MHz) Imote 2 (13 MHz) 10 9 Mica 2 8 Suitable Subspace 7 6 EPC at 4.21 % duty cycle (mW) Constraint 5 4 3 Shimmer 2 BSN v3 1 TelosB 0 100 200 300 400 500 600 700 Forms a complex contour in the design space Can be modeled as an optimization objective Sensor Query SPSW (samples/mJ)

  40. Case Study: CGM iMote2 35.62 mW Mica2 EPC (W) BSN node v3 TelosB (50 X 50 X 50) Form Factor (mm3) Set of platforms: TelosB, Mica2, Imote2 and BSN v3 Constraints on EPC and Form Factor coordinates

  41. TinyOS Demo Tutorial

  42. Cross-platform applications Platform-specific applications Platform-specific applications Platform-independent hardware interface Hardware independence HIL 1 HIL 2 HIL 3 HIL 4 HAL 1 HAL 2 HAL 3 HAL 4 HPL 2 HPL 1 HPL 3 HPL 4 HW/SW boundary HW platform 1 HW platform 2 HW platform 3 HW platform 4 Hardware Abstraction Architecture for TinyOS 2.x Combine the component model with aflexible, three-tier organization of the hardware abstraction

More Related