1 / 53

TinyOS: Concurrent Execution, and Power control

TinyOS: Concurrent Execution, and Power control. Class 9. Announcements. Sign up for the weeken d classes Review phase 1 requirements Each group update TA on your progress with TinyOS installation . Agenda. TinyOS multi-threading Radio duty cycling Power management in sensors.

vesna
Download Presentation

TinyOS: Concurrent Execution, and Power control

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. TinyOS: Concurrent Execution, and Power control Class 9

  2. Announcements Sign up for the weekend classes Review phase 1 requirements Each group update TA on your progress with TinyOS installation

  3. Agenda TinyOS multi-threading Radio duty cycling Power management in sensors

  4. TinyOS multi-threading TinyOS is a single application OS It supports multi-threading for the application Several threads can be posted in parallel which get scheduled in a FIFO queue Tasks and events are primarily used for doing computation Tasks are for long running computations Events are used for very short computation and for posting long running computations in the FIFO queue

  5. Concurrent execution • uint16_t Samples[SAMPLES]; • Uint16_t i = 0; • event void ReadStream.readDone(error_t ok, uint32_t SensedVal) { • if (ok == SUCCESS){ • i++; • Samples[i] = Val; • if(i == SAMPLES-1){ • i = 0; • post calculateAvg(); • } • } • } • task void calculateAvg() { • uint16_t i, avg, var; • for (avg = 0, i = 0; i < SAMPLES; i++) • avg += Samples[i]; • avg /= SAMPLES; • for (var = 0, i = 0; i < SAMPLES; i++) • { • int16_t diff = Samples[i] - avg; • var += diff * diff; • } • } In readDone, we need to compute the variance of the sample. We defer this “computationally-intensive” operation to a separate task, using post. We then compute the variance

  6. Exercise to understand concurrency Lets have a loop in a task Increment a counter Have a timer fired event where at each fired event we send the counter value to the base station What values do we see at the base station ?

  7. Code Flow Diagram Booted Boot Start Radio StartDone Call Timer Only the first task gets done FIFO scheduler gives preference to events TimerFired Call Sensor Task gets pushed back in the queue ReadDone Post 10 tasks

  8. Radio Duty Cycling

  9. Code from last class How to efficiently duty cycle radio ? • Event based radio turn off • Not duty cycling • Duty cycling: Having a fixed schedule of radio off and on states • Depends on several factors: • Application communication and computation patterns • Emergency communication requirements • In case of networks, base station might sleep when a sensor sends a packet • Leads to packet loss

  10. Lets go step by step • Consider 3 sensors • One base station A • Two sensor nodes B and C • C communicates its data to B and B forwards it to A • The sensors periodically broadcasts messages to their neighbor • All the sensors want to sleep • Design a strategy to duty cycle the radio so that no packet is lost

  11. Solution Sleep Sensor C Awake Sensor B Sensor A Synchronous sleep

  12. Next Step Consider 4 sensors A collects data from B Adjusts it sleep according to B’s sleep schedule D collects data from C and adjusts its sleep according to C’s sleep schedule Design a sleep schedule so that A can send data to D

  13. Solution Sensor B Sensor A Sensor D Sensor C For two sensors to communicate their the sender should know the receiver’s sleep schedule

  14. Generic solution to duty cycling • Each sensor keeps a table of its sleep schedule • Each sensor then sends the table to all its immediate neighbors • The sensors then start their sleep schedule • When sensor A wants to communicate with B • A waits for B to wake up and then transmits • Once a transmission is started none of the sensors sleep until the transmission is finished • When finished both the sensors resume their sleep schedule

  15. SMAC- Sensor Medium Access Control • Need an energy efficient MAC protocol • Design considerations – • Level 1 issues • Collision avoidance-a basic task of MAC protocols • Good scalability – sensors may die or new sensors maybe added • Energy efficiency • Often difficult recharge batteries or replace them • Prolonging the life-time is important • Level 2 issues • Latency, fairness, throughput, bandwidth

  16. Collision Avoidance • When more than one sensor wants to send packets to a receiver there can be collision • Use two flags – • Request To Send (RTS) – If a sensor wants to send a packet to the receiver it sends out an RTS. • Clear To Send (CTS) – The receiver on reception of the first RTS sends out a CTS to the sender allowing access to the channel

  17. Collision Avoidance Time Diagram SYNC to synchronize sleep schedule CS to sense the channel

  18. Overhearing Avoidance • Problem: Receive packets destined to others • In 802.11, each node keeps listening to all transmissions from its neighbors for virtual carrier sensing • Each node should overhear a lot of packets not destined to itself • Solution: Letting interfering nodes go sleep after they hear an RTS or CTS packet • Which nodes should sleep? • All immediate neighbors of sender and receiver • S-MAC lets interfering nodes go to sleep after they hear an RTS or CTS • DATA packets are normally much longer than control packets • How long? • The duration field in each packet informs other nodes the sleep interval • After hearing the RTS/CTS packet destined to a node, all the other immediate neighbors of both the sender and receiver should sleep until the NAV becomes zero

  19. Message Passing • Problem: Sensor net in-network processing requires entire message • Solution: Don’t interleave different messages • Long message is fragmented & sent in burst • RTS/CTS reserve medium for entire message • Fragment-level error recovery — ACK — Extend Tx time and re-transmit immediately if no ACK is received • Advantages • Reduces latency of the message • Reduces control overhead • Disadvantage • Node-to-node fairness is reduced, as nodes with small packets to send has to wait till the message burst is transmitted

  20. Aim to reduce energy Main reason for radio sleep is to save energy Why save energy ? What are the different energy consumers ? How to save energy ?

  21. Power Management

  22. Sources of Power Dissipation Often more than computation Least Power consuming Most Power consuming Power consumption depends on the type of processing Sending < Receiving Communication energy more than 100 times greater than computation energy Sensing + Computation + Communication

  23. Why power management ? • Safety • Energy dissipation causes temperature rise • Sensors on body can cause physical harm • Sensors (Mean Time To Failure) MTTF decreases • Sustainability • Scarce and intermittent energy sources • Often energy is scavenged from the environment • Energy efficiency to reduce power supply needs • Matching power needs

  24. Power management strategies • Sensing • E.g. pulse oximeter operation causes temperature rise on human skin • Temperature rise depends on the sensing frequency • Reduce the frequency to control temperature • Compressed sensing

  25. Power management strategies • Computation • Power consumption depends on different types of computation • Duty cycling of processor • Sleep states • Frequency scaling • Voltage scaling • Scheduling computation when energy is available • Predicting workload characteristics • Periodic vs asynchronous • Periodic workload enables efficient solutions • Async workload requires prediction which may fail often • Making energy available during peak workloads

  26. Power management strategies • Communication • Sending and receiving requires power from the energy supply • Communication power > 100 X computation power • Receiving power more than sending • Low power listening • Radio duty cycling

  27. EEG Application dependency EKG BP SpO2 Base Station Body Sensor Network Motion Sensor • Such strategies are however application dependent • Cannot turn off radio when the sensor needs to send • When an event occurs the radio has to wake up from low power state • Example Ayushman health monitoring system

  28. Ayushman workload Ayushman Workload Frequency Throttling during security phase Sensing Phase Enables Sleep Scheduling Transmission Phase Sleep Cycle Sensor CPU Utilization Security Phase Time • Example: Ayushman health monitoring application is considered as the workload • Sensing Phase – Sensing of physiological values (Plethysmogram signals) from the sensors and storing it in the local memory • Transmission Phase – Send the stored data to the base station in a single burst • Security Phase – Perform network wide key agreement for secure inter-sensor. • The Security phase occurs once in a day • The Sensing phase and Transmission phase alternate forming a sleep cycle

  29. Effects of Power Management Power Profile (Radio-ON) 0.06 0.05 Receiver(Radio ON) 0.04 Sender(Radio ON) 0.03 0.02 0.01 1 2 3 4 5 6 7 Lagrangian 8 9 Poly Gen + Vault Tx/Rx FFT Peak + Quant Ackn Tx/Rx Sensing Add Chaff Interpolation Eval Power Profile (Radio-OFF) 0.06 Receiver(Radio OFF) 0.05 Sender(Radio OFF) 0.04 Power (mW) 0.03 0.02 0.01 0 1 2 3 4 5 6 7 8 9 FFT Peak + Quant Sensing Add Chaff Vault Tx/Rx Lagrangian Poly Gen + Ackn Tx/Rx Interpolation Eval • Periodic sensing and computation application in Ayushman • Sender Side: Sensing + FFT + peak detection + quantization + polynomial evaluation + random number (chaff) generation + data transmission + acknowledgement of transmission • Receiver Side: Sensing + FFT + peak detection + quantization + listen for packet + interpolation + transmit acknowledgement

  30. Energy Savings PKA Computation Energy Consumption for Different Vault Sizes 0.7 Sender(Radio ON) Sender(Radio OFF) Receiver(Radio ON) 0.6 Receiver(Radio OFF) Sensing power >> computation power Sensing 0.5 0.4 Energy (Joules) ~100 mJ savings when radio turned off 0.3 0.2 0.1 0 1000 2000 3000 4000 5000 Vault Size (Chaff Points)

  31. Reduction of data transmission Learn the characteristic of the sensed signal Predict unusual changes Send only when there are changes • To further reduce communication power we may avoid data transmission • Event based data transmission • Consider the context aware radio example in class • Light intensity below 10 is not interesting • So don’t send data • Another example – • Temperature data does not change too often • Quiz: What is an intelligent way to reduce transmission ? • Solution: Transmit only when there is a significant difference

  32. Complex signals • What happens when the signal is complex • Example: Electrocardiogram • Represents electrical activity of the heart • Consists of P, Q, R, S, T waves • The beat morphology and R-R intervals in an ECG are considered important for diagnosis

  33. Generative Models Actual Signal Need to learn the parameters for a given signal Given the parameters the model should be able to regenerate the signal Each wave represented by a Gaussian function z =

  34. Event Based data transmission Normal Expected Change Unexpected Change Morphology and inter beat features do not change Both morphology and inter beat features change Only inter beat features change No communication Use a generative model to represent ECG Send inter beat feature updates Send every sample

  35. The Methodology Sensor matches sensed signal with model If a match don’t send data If model parameters vary, send only parameters If unknown change occurs send sample by sample At the base station use model to regenerate and align with raw signals to show the ECG

  36. Results 42:1 93% Energy and Memory Savings Diagnostic Accuracy Implemented using off-the-shelf sensors Base case for comparison: Send entire ECG

  37. Demo Video http://www.youtube.com/watch?v=NGBq-oyPhGI&feature=channel_video_title

  38. Lessons Learned • Communication more expensive than computation • Communication duty cycling is an useful tool • Application dependent duty cycling • Event based communication enables lot of energy savings • Can only be applied to cases where the sensed signal has a definite pattern

  39. Energy savings in computation • Frequency throttling • Voltage scaling • Example BSN with Atom processors • Allows Advanced Configuration and Power Interface (ACPI) control for frequency and voltage

  40. Atom background • Ultra low power processor for embedded applications • However, order of magnitude higher power dissipation than the state-of-art BSN node • IA-32 microarchitecture helps in easy application development • Can use high level programming languages to develop applications • Six low power sleep states with ultra low power deep sleep state • Sleep scheduling can be employed to reduce power consumption • Intel Speed Step technology enables seven different operating frequency levels • Clock frequency control to reduce operating power • Sleep state and frequency control performed through easy ACPI support (through Model Specific Register (MSR) accesses)

  41. Strategies to Address – Safety and Sustainability Challenges The strategies are closely related to the applications real time requirements. Intelligent design is required to achieve safety and sustainability while respecting the real time requirements of the applications 4. K. Venkatasubramanian et al. Green and sustainable cyber-physical security solutions for body area networks. In BSN ’09: Proc. of the Sixth Intl. Workshop on Wearable and Implantable Body Sensor Networks, pages 240–245, Washington, DC, USA • Challenge - Atom’s high TDP (2.2 W) with respect to present day sensor nodes (~ 80 mW [4]) • Remedy – Power budgeting through sleep scheduling and clock frequency control • Road Blocks – • In a sleep mode the processor cannot compute • Decrease in clock frequency increases computation time • Challenge - Increase lifetime of operation • Remedy – include scavenging nodes in the BSN that will charge the Atom nodes wirelessly and supplement battery • Road Blocks – • The operation of scavenging sources are intermittent depending on the stochastic behavior of the host • Often the scavenging nodes fail to provide appropriate power levels to the nodes

  42. BSN Hardware model • BSN node • Intel N270 single core processor • 1.6 GHz clock frequency, 1 GB RAM • Intel SpeedStep frequency control technology – useful for power management • 6 sleep states including one ultra low power sleep state (C6) – sleep scheduling • Chipcon 2420 radio • 2.45 GHz, 802.15.4 wireless standard • Maximum Power dissipation (58 mW [4]) BSN Node Base Station • Base Station • Atom based mobile phone Wireless Charging • Scavenging Sources • Body Heat, Ambulation, Respiration and Sun Light • Wireless charging of BSN nodes from scavenging sources is assumed • Each source has a specified range upto which it can charge nodes Scavenging Sources

  43. BSN node Software • The power consumption of Atom processor depends on the Operating System used • Mobile Intel 945 GMCH board power consumption • Open Suse Linux = 11.7 W • Moblin OS = 10.4 W • ACPI support required for accessing Intel SpeedStep frequency control and sleep states • Moblin provides ACPI through which one can write to or read appropriate MSR registers to – • Control clock frequency • Sleep States • Measure core temperature • The BSN workload considered is the Ayushman application

  44. Model based Analysis • Model: An abstraction in a mathematical domain • Behavioral models (e.g. control system transfer function) • Consider the system as a black box • Find the relation between the inputs and the outputs • Formal models (e.g. finite state machines, petrinets) • Represent the operation of the system in terms of states and transitions between them • Structural models (XML specifications) • Represent the structure of a system in terms of the basic blocks that are present in the system • Does not necessarily represent operational characteristics

  45. Model based analysis • Model based analysis normally used to verify critical systems such as avionics. • no need for actual scenario generation putting lives/property at risk. • Formal models for abstraction of the system behavior. • Expected system properties depend on the requirements. • Formal models analyzed through model checking to verify the system properties. • We use model based analysis to evaluate effectiveness of crisis response processes. System Profiling System Requirements Models Expected Properties Model Checking Property Verification Requirement Verification

  46. Profiling Requirements • Thermal Safety – The maximum temperature of the skin in contact with the node should not exceed 39 ºC for 24 Hrs of operation • Thermal behavior of Atom under the given workload has to be evaluated • Sustainability – The available power from the scavenging sources should be able to meet the power demands of Atom node under the given workload • Power profiling of Atom processors during execution of Ayushman

  47. Thermal Profiling Turn On GMCH board Set Operating Frequency Read MSR C6 Sleep State Run Ayushman Log Temperature Data Thermal profiling methodology Requires core temperature measurements for different operating points of the Atom processor The Mobile Intel 945 GSE development platform (GMCH) provided by Intel has digital thermal sensors The board thermal sensors were read from Model Specific Registers The maximum core temperature (43 ºC) was observed during PKA execution

  48. Power Profiling Power Meter Board Power Lead Intel Atom N270 on Mobile Intel Chipset 945 GSE AC Mains Table showing Atom power consumption for PKA execution at different operating frequencies Power Measurement Set up • PKA is the most power consuming computation in Ayushman [3] • The difference between idle power and power during PKA execution was measured using the GMCH board • Idle power of Atom N270 processor was added to it to obtain PKA power consumption

  49. Resource Consumption • PKA computation in Ayushman involves signal processing of physiological signals as well as execution of security algorithms • Resource footprint of PKA is evaluated in terms of – • RAM usage, Power Consumption, and Computation Time • Atom compared to TelosB provides very low RAM usage and computation time • However as expected it has around thrice the power consumption Resource Consumption for PKA execution

  50. Safety Analysis • The temperature rise of human skin due to contact with Atom based BSN node has to be evaluated • The temperature rise occurs due to several physical phenomenon and is modeled using the Penne’s bioheat equation - Skin Temperature Radio Power Atom Power Consumption Atom Operating Temperature Heat accumulated Heat transfer by conduction Heat transfer by convection Heat by electromagnetic radiation Heat by power dissipation Heat by radiation Thermal damage parameter calculated according to Henrique and Moritz [5]. Maximum temperature must not exceed this. 5. F. C. J. Henriques et al. Studies of thermal injury: I. the conduction of heat to and through skin and the temperatures attained therein. A theoretical and an experimental investigation. In Am J Pathol., pages 530–549, July. 1947.

More Related