Download presentation
Presentation is loading. Please wait.
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 Boot Start Radio Call Timer
Booted 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
How to efficiently duty cycle radio ?
Code from last class 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 How to efficiently duty cycle radio ?
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 Synchronous sleep Sleep Sensor C Awake Sensor B Sensor A
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 For two sensors to communicate their the sender should know the receiver’s sleep schedule Sensor B Sensor A Sensor D Sensor C
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 , 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
Sensing + Computation + Communication 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
23
Why power management ? Safety Sustainability
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
Application dependency
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 SpO2 EKG EEG BP Base Station Motion Sensor Body Sensor Network
28
Ayushman workload 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 Sensor CPU Utilization Time Sensing Phase Transmission Phase Security Phase Sleep Cycle Ayushman Workload Enables Sleep Scheduling Frequency Throttling during security phase
29
Effects of Power Management
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 1 2 3 4 5 6 7 8 9 0.01 0.02 0.03 0.04 0.05 0.06 Power Profile (Radio-ON) Receiver(Radio ON) Sender(Radio ON) Sensing FFT Peak + Quant Poly Gen + Eval Add Chaff Vault Tx/Rx Lagrangian Interpolation Ackn Tx/Rx 1 2 3 4 5 6 7 8 9 0.01 0.02 0.03 0.04 0.05 0.06 Power (mW) Power Profile (Radio-OFF) Receiver(Radio OFF) Sender(Radio OFF) Ackn Tx/Rx Lagrangian Interpolation Vault Tx/Rx Add Chaff Poly Gen + Eval Peak + Quant FFT Sensing
30
Energy Savings Sensing power >> computation power
PKA Computation Energy Consumption for Different Vault Sizes 0.7 Sender(Radio ON) Sender(Radio OFF) 0.6 Receiver(Radio ON) 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 1000 2000 3000 4000 5000 Vault Size (Chaff Points)
31
Reduction of data transmission
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 Learn the characteristic of the sensed signal Predict unusual changes Send only when there are changes
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 Only inter beat features change Both morphology and 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
Energy and Memory Savings
Results Implemented using off-the-shelf sensors Base case for comparison: Send entire ECG 42:1 93% Energy and Memory Savings Diagnostic Accuracy
37
Demo Video
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) IA 32 architecture allows easily application development Low power sleep states enable sleep scheduling Intel speedStep enables frequency scaling
41
Strategies to Address – Safety and Sustainability Challenges
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 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 Stress on the point that the power budgeting schemes are strongly dependent on the application real time requirements 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
42
BSN Hardware model BSN node Base Station Scavenging Sources 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, 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 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 Turn On GMCH board Set Operating Frequency Read MSR C6 Sleep State Run Ayushman Log Temperature Data Thermal profiling methodology
48
Power Profiling 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 AC Mains Power Meter Intel Atom N270 on Mobile Intel Chipset 945 GSE Board Power Lead Operating Mode (Percent throttling) Power (W) 0.191 13 0.1864 25 0.17 37, 50, 62, 75 0.167 87 0.164 Power Measurement Set up Table showing Atom power consumption for PKA execution at different operating frequencies
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 Platform RAM Usage Power (mW) Computation Time (ms) TelosB 80% 66 2186 Atom 0.006% 164 41 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. Operating Mode (Percent Throttling) Atom Processor Operating Temperature (ºC) Maximum Skin Temperature (ºC) after 24 hrs of operation Thermal Damage Temperature (ºC) 0, 13, 25 43 39.2 37, 50 42 62, 75 41 87 39 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
51
Sustainability Analysis
Duty Cycling of Atom operation during Ayushman execution Sleep mode (C6) during Sensing Phase Power consumption = Psleep for time ts Active mode during data transmission phase Power consumption = Pactive + radio power Pradio for data transmission time ttx Active mode during PKA execution Power Consumption = Pactive + PKA execution power PPKA for time tPKA PKA involves transmission of security related information (vault) between two sensors The Atom processor must be in active state with the radio on. Power Consumption = Pactive + Pradio for time tvault Total energy consumption for n BSN nodes x is the number of sleep cycles required in a day Total Energy Sensing Energy Transmission Energy PKA Computation Energy (Pair wise PKA) PKA communication Energy (Pair wise PKA) Total Sleep Cycle Time Pair wise PKA Execution Time Sensor CPU Utilization Time Sensing Phase Transmission Phase Security Phase Sleep Cycle Ayushman Workload Enables Sleep Scheduling Frequency Throttling during security phase
52
Sustainability Analysis Results
Four energy scavenging sources were considered Body Heat, Ambulation, Respiration and Sun Light The total energy obtained from any combination of scavenging sources should provide EBSN amount of energy for n nodes Scavenging Source Available Power (W) Scavenge Time (Hrs) Body Heat 0.1 – 0.15 24 Ambulation 1.5 2 Respiration 0.42 6 Sun Light 0.1 3 Combination of Scavenging Sources No of Sustained BSN nodes Body Heat and Respiration 25 Ambulation and Respiration 40 All four 110
53
Thank You
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.