1 / 45

Avrora Scalable Sensor Simulation with Precise Timing

Avrora Scalable Sensor Simulation with Precise Timing. Ben L. Titzer UCLA CENS Seminar, February 18, 2005 IPSN 2005. Background - WSNs. Wireless Sensor Networks Microcontroller and battery powered Wireless communication Event-driven programming model Programmed with TinyOS and nesC.

jontae
Download Presentation

Avrora Scalable Sensor Simulation with Precise Timing

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. AvroraScalable Sensor Simulation with Precise Timing Ben L. Titzer UCLA CENS Seminar, February 18, 2005 IPSN 2005

  2. Background - WSNs • Wireless Sensor Networks • Microcontroller and battery powered • Wireless communication • Event-driven programming model • Programmed with TinyOS and nesC Mica2 Dot - based on Atmel AVR microcontroller http://compilers.cs.ucla.edu/avrora

  3. Background - Microcontrollers • Microcontrollers are small • 128KB code, 4KB RAM, 4KB EEPROM • Processor, memory, IO on a single chip • 4 - 16mhz clockspeed • Interrupt-driven programming model • No operating system http://compilers.cs.ucla.edu/avrora

  4. Motivation • Developing sensor software is hard • Constrained resources, bare hardware • Narrow interface for debugging • Delicately timed driver code • Distributed communication • Precise measurements are difficult • Current tools do a poor job • TOSSIM, AtEmu http://compilers.cs.ucla.edu/avrora

  5. The Question • Can we achieve simulation of entire sensor networks? http://compilers.cs.ucla.edu/avrora

  6. The Question • Can we achieve simulation of entire sensor networks? • --[1] And make it precise? http://compilers.cs.ucla.edu/avrora

  7. The Question • Can we achieve simulation of entire sensor networks? • --[1] And make it precise? • --[2] And make it flexible? http://compilers.cs.ucla.edu/avrora

  8. The Question • Can we achieve simulation of entire sensor networks? • --[1] And make it precise? • --[2] And make it flexible? • --[3] And make it fast? http://compilers.cs.ucla.edu/avrora

  9. The Question • Can we achieve simulation of entire sensor networks? • --[1] And make it precise? • --[2] And make it flexible? • --[3] And make it fast? • --[4] And make it scalable? http://compilers.cs.ucla.edu/avrora

  10. The Goals of Avrora • Build a simulator for sensor networks • Cycle accurate • Energy accurate • Simulates sensor devices • Scales to large sensor networks • Allow detailed profiling and instrumentation http://compilers.cs.ucla.edu/avrora

  11. [1] Precision • Can we make it precise? • Instruction-level simulation • Cycle accurate • Accurate device models • Accurate radio / interference model • Well-known http://compilers.cs.ucla.edu/avrora

  12. [2] Flexibility • Can we make the simulator flexible? • Well-designed software architecture • Clear interfaces • Implemented in Java, object-oriented • Instrumentation infrastructure • “Nonintrusive Precision Instrumentation of Microcontroller Software” submitted to LCTES 2005 http://compilers.cs.ucla.edu/avrora

  13. Avrora Software Architecture Platform On-chip devices are controlled by the program through IOReg objects Off-chip devices are controlled through individual pins or through UART and SPI interfaces Time-triggered behavior is accomplished by inserting events into the event queue Microcontroller Simulator Interpreter Event queue interface IOReg interface SPI Ports Timer On-chip devices Pin interface SPI interface Radio LEDs Off-chip devices http://compilers.cs.ucla.edu/avrora

  14. [3] Speed - Event Queue • How can we achieve speed while retaining cycle accuracy? • Naïve implementation scales poorly • Event interface simplifies devices • Better performance • Key to achieving parallelism for sensor network simulations http://compilers.cs.ucla.edu/avrora

  15. 4 24 7 12 83 Event Queue Illustration Simulator DeltaQueue Interpreter Timer0Event ProfilingEvent UARTEvent • Interpreter tracks cycles consumed by each instruction • Decrement head of queue and fire event(s) when necessary • Retains cycle accuracy • Allows for sleep optimization http://compilers.cs.ucla.edu/avrora

  16. Single-node Performance http://compilers.cs.ucla.edu/avrora

  17. [4] Scalability • Sensor networks have many nodes (10’s-1000’s) • Software controlled radios • Micro-second level interactions • High-fidelity simulation needed for precise measurements http://compilers.cs.ucla.edu/avrora

  18. The AtEmu Approach • Introduce global clock • Step all nodes one clock cycle at a time • Compute radio waveform (bit level) • Problems: • Slow • Scales poorly - O(n^2) interactions • No parallelism http://compilers.cs.ucla.edu/avrora

  19. Observations • Communication has latency • Nodes only influence each other through communications • Other than that, nodes run in parallel • Hmm…. http://compilers.cs.ucla.edu/avrora

  20. Parallel Simulation • Allow all nodes to run in parallel • One thread per node • Extends single-node simulation to network • Better overall simulation performance • New Problem: • Synchronization necessary to preserve timing and order of communications • Efficient solutions? http://compilers.cs.ucla.edu/avrora

  21. Receive A1 Send-Receive Problem • Nodes send bytes to each other • No node should be allowed to run too far ahead of other nodes that might try to send a byte to it T=k+L T=0 T=k Send A1 Node A Node B Node B should never be more than L cycles ahead of A http://compilers.cs.ucla.edu/avrora

  22. RSSI Sampling Problem • Nodes can sample current radio traffic • Sample cannot be computed until all possible transmitters have passed the time when sampling was begun T=0 T=k+S T=k Send A1 Node A Node B Node B cannot complete sample until node A passes time k http://compilers.cs.ucla.edu/avrora

  23. Reality • RSSI sampled infrequently • Nodes both send and receive • Latency L to send a byte on mica2 • 7372800hz / 2400bps = 3072 cycles • Sampling time S to estimate RSSI • 13 ADC cycles * 64 = 832 cycles http://compilers.cs.ucla.edu/avrora

  24. Two Approaches • Synchronization Intervals • Threads can’t run too far ahead • Period has to be smaller than L • Utilize event queue of each simulator • Wait for Neighbors • Each thread waits for neighbors when necessary (sample or receive) • Requires fast global data structure • Avrora uses both http://compilers.cs.ucla.edu/avrora

  25. Delivery point Synchronization point Starting point D B E C A Synchronization Illustration Network T=0 T=1L T=2L T=3L Node A Node B Node C Node D Node E http://compilers.cs.ucla.edu/avrora

  26. Delivery point Synchronization point Starting point D B E C A Synchronization Illustration Network T=0 T=1L T=2L T=3L Node A Node B RSSI Node C Node D Node E http://compilers.cs.ucla.edu/avrora

  27. Delivery point Synchronization point Starting point D B E C A Synchronization Illustration Network T=0 T=1L T=2L T=3L Node A Node B RSSI Send C1 Node C Node D Node E http://compilers.cs.ucla.edu/avrora

  28. Delivery point Synchronization point Starting point D B E C A Synchronization Illustration Network T=0 T=1L T=2L T=3L Node A Node B RSSI Send C1 Node C Node D Node E http://compilers.cs.ucla.edu/avrora

  29. Delivery point Synchronization point Starting point D B E C A Synchronization Illustration Network T=0 T=1L T=2L T=3L Node A Node B RSSI Send C1 Node C Node D Node E http://compilers.cs.ucla.edu/avrora

  30. Delivery point Synchronization point Starting point C1 D B E C A Synchronization Illustration Network T=0 T=1L T=2L T=3L Node A Node B Send C2 RSSI Send C1 Node C Node D Node E http://compilers.cs.ucla.edu/avrora

  31. Delivery point Synchronization point Starting point C1 C1 D B E C A Synchronization Illustration Network T=0 T=1L T=2L T=3L Node A Node B Send C2 RSSI Send C1 Node C Node D Node E http://compilers.cs.ucla.edu/avrora

  32. Delivery point Synchronization point Starting point C1 C1 D B A E C Synchronization Illustration Network T=0 T=1L T=2L T=3L Node A RSSI Node B Send C2 RSSI Send C1 Node C Node D RSSI Node E http://compilers.cs.ucla.edu/avrora

  33. Delivery point Synchronization point Starting point C1 C1 D B A E C Synchronization Illustration Network T=0 T=1L T=2L T=3L Node A RSSI Node B Send C2 RSSI Send C1 Node C Node D RSSI Node E http://compilers.cs.ucla.edu/avrora

  34. Delivery point Synchronization point Starting point C2 C1 C1 C2+E1 D B A E C Synchronization Illustration Network T=0 T=1L T=2L T=3L Node A RSSI Node B Send C2 RSSI Send C1 Node C Node D Send E1 RSSI Node E http://compilers.cs.ucla.edu/avrora

  35. Delivery point Synchronization point Starting point C2 C1 C1 C2+E1 D B A E C Synchronization Illustration Network T=0 T=1L T=2L T=3L Node A RSSI Node B Send C2 RSSI Send C1 Node C Node D Send E1 RSSI Node E http://compilers.cs.ucla.edu/avrora

  36. Delivery point Synchronization point Starting point C2 C1 C1 C2+E1 D B A E C Synchronization Illustration Network T=0 T=1L T=2L T=3L Node A RSSI Node B Send C2 RSSI Send C1 Node C Node D Send E1 RSSI Node E http://compilers.cs.ucla.edu/avrora

  37. Results - Scalability http://compilers.cs.ucla.edu/avrora

  38. Results - Parallelism http://compilers.cs.ucla.edu/avrora

  39. Measurements • Accurate timing useful for • AEON: power and lifetime estimation • MAC layer tuning • Debugging driver code • Latency estimation for in-network processing • Real-time monitoring http://compilers.cs.ucla.edu/avrora

  40. Channel Utilization http://compilers.cs.ucla.edu/avrora

  41. Partial Preamble Loss • Real radios take time to lock on • First few bits of transmission lost • Subsequent bytes misaligned • MAC software layer must compensate • Latency L between transmission and first reception larger • Admits more concurrency in simulation http://compilers.cs.ucla.edu/avrora

  42. R: A2+A3 R: A2+A3 Adaptive Synchronization • Assume first k [kl, kh] bits lost of first bytes transmitted • Latency for first byte is then: Lf = L + kl * cyclesbit T=0 T=k T=k+L T=k+2L T=k+3L S: A4 S: A1 S: A3 S: A2 Node A Node B kl http://compilers.cs.ucla.edu/avrora

  43. Can we achieve simulation of entire sensor networks? --[1] And make it precise? yes --[2] And make it flexible? yes --[3] And make it fast? yes --[4] And make it scalable? yes Back to the Question http://compilers.cs.ucla.edu/avrora

  44. Future Work • Performance Improvements • Sleeping nodes, M:N thread model • Single-node improvements • Port to other mote platforms • Co-simulation with real network • Implement partial preamble loss • Measure properties of k http://compilers.cs.ucla.edu/avrora

  45. Acknowledgements • NSF: money • Jens Palsberg: patience • Daniel Lee: device implementations • Simon Han: testing, timing validation • Olaf Lansiedel: AEON energy model • CENS: access to a stupidly big Sun V880 machine • Sun: for donating said machine http://compilers.cs.ucla.edu/avrora

More Related