Actor-Oriented Programming for Wireless Sensor Networks Elaine Cheong Electrical Engineering and Computer Sciences University of California at Berkeley Technical Report No. UCB/EECS-2007-112 http://www.eecs.berkeley.edu/Pubs/TechRpts/2007/EECS-2007-112.html August 30, 2007 Copyright © 2007, by the author(s). All rights reserved. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission. Actor-Oriented Programming for Wireless Sensor Networks by Elaine Cheong B.S. (University of Maryland, College Park) 2000 M.S. (University of California, Berkeley) 2003 A dissertation submitted in partial satisfaction of the requirements for the degree of Doctor of Philosophy in Engineering – Electrical Engineering and Computer Sciences in the GRADUATE DIVISION of the UNIVERSITY OF CALIFORNIA, BERKELEY Committee in charge: Professor Edward A. Lee, Chair Professor Eric A. Brewer Professor Paul K. Wright Fall 2007 Actor-Oriented Programming for Wireless Sensor Networks Copyright 2007 by Elaine Cheong 1 Abstract Actor-Oriented Programming for Wireless Sensor Networks by Elaine Cheong Doctor of Philosophy in Engineering – Electrical Engineering and Computer Sciences University of California, Berkeley Professor Edward A. Lee, Chair Wireless sensor networks is an emerging area of embedded systems that has the potential to revolutionize our lives at home and at work, with wide-ranging applications, including environmen- tal monitoring and conservation, manufacturing and industrial control, business asset management, seismic and structural monitoring, transportation, health care, and home automation. Building sen- sor networks today requires piecing together a variety of hardware and software components, each with different design methodologies and tools, making it a challenging and error-prone process. In this dissertation, I advocate using an actor-oriented approach to designing, generating, pro- gramming, and simulating wireless sensor network applications. Actor-oriented programming pro- vides a common high-level language that unifies the programming interface between the operating system, node-centric, middleware, and macroprogramming layers of a sensor network application. This dissertation presents the TinyGALS (Globally Asynchronous, Locally Synchronous) pro- gramming model, which is built on the TinyOS programming model. TinyGALS is implemented in the galsC programming language, which provides constructs to systematically build concurrent tasks called actors. The galsC compiler toolsuite provides high-level type checking and code gen- eration facilities and allows developers to deploy actor-oriented programs on actual sensor node hardware. This dissertation then describes Viptos (Visual Ptolemy and TinyOS), a joint modeling and design environment for wireless networks and sensor node software. Viptos is built on Ptolemy II, an actor-oriented graphical modeling and simulation environment for embedded systems, and TOSSIM, an interrupt-level discrete-event simulator for TinyOS networks. This dissertation also presents methods for using higher-order actors with various metapro- 2 gramming and generative programming techniques that enable wireless sensor network application developers to create high-level, parameterizable descriptions and automatically generate sensor net- work simulation scenarios from these models. All of the tools I developed and describe in this dissertation are open-source and freely available on the web. The networked embedded computing community can use these tools and the knowledge shared in this dissertation to improve the way we program wireless sensor networks. Professor Edward A. Lee Dissertation Committee Chair i To the teachers who have challenged, encouraged, and guided me through life. ii Café Ptolemy Executive Chefs: Elaine Cheong and Andrew Mihal Appetizers Avocado Smash and Double-Decker Baked Quesadillas Corn Pancakes with Green Onions, Actors, Crème Fraîche, Avocado, and Cherry Tomatoes Salads Fuyu Persimmon, Avocado & Watercress Salad with Discrete-Event Miso Dressing Corn and Cherry Tomato Salad with Arugula Soups Mexican Chicken Soup Butternut Squash Bisque Why-the-Chicken-Crossed-the-Model Santa Fe-Tastic Tortilla Soup Entrees Chicken Pot Pie Fettuccine with Concurrent Meyer Lemon Butter Sauce Chicken Tikka Masala Farfalle with Ptalon Pesto, Feta, and Cherry Tomatoes Butternut Squash Lasagna Cumin Crusted Chicken with Cotija and Mango-Garlic Sauce with Green Onion Pesto Mashed Motes Butternut Squash, Metacabbage & Pancetta Risotto with Basil Oil Desserts Marillenknödel: Austrian apricot dumplings Zwetschgendatschi: Bavarian plum delicacy Drinks Plum Granita with Limoncello Vinho do IOPorto Lychee-flavoured Ramune (ラムネ) iii Contents List of Figures vi List of Tables viii 1 Introduction 1 1.1 Wireless Sensor Networks .............................. 2 1.2 Actor-Oriented Programming ............................. 3 1.3 Actor-Oriented Programming for Wireless Sensor Networks ............ 5 1.4 Previously Published Work .............................. 8 2 Background 9 2.1 TinyOS ........................................ 9 2.1.1 NesC syntax ................................. 10 2.1.2 TinyOS execution model ........................... 10 2.2 Ptolemy II ....................................... 11 2.2.1 VisualSense .................................. 14 2.3 Summary ....................................... 17 3 TinyGALS and galsC 19 3.1 The TinyGALS Programming Model and galsC Language ............. 22 3.1.1 Programming constructs and language syntax ................ 22 3.1.2 Execution model and language semantics .................. 28 3.1.3 Link model within actors ........................... 36 3.1.4 Type inference and type checking ...................... 38 3.1.5 Summary ................................... 39 3.2 Concurrency and Determinacy Issues ......................... 40 3.2.1 Concurrency ................................. 40 3.2.2 Determinacy ................................. 41 3.2.3 Summary ................................... 48 3.3 Code Generation ................................... 49 3.3.1 Links and connections ............................ 51 3.3.2 Communication ................................ 51 3.3.3 TinyGUYS .................................. 53 3.3.4 System initialization and start of execution ................. 53 iv 3.3.5 Scheduling .................................. 53 3.3.6 Memory usage ................................ 55 3.4 Example ........................................ 55 3.5 Summary ....................................... 57 4 Viptos 59 4.1 Design ......................................... 62 4.1.1 Representation of nesC components ..................... 62 4.1.2 Transformation of nesC components ..................... 64 4.1.3 Generation of code for target deployment .................. 66 4.1.4 Generation of code for simulation ...................... 68 4.1.5 Simulation of TinyOS in Viptos ....................... 69 4.2 Performance Evaluation ................................ 74 4.2.1 Comparison to TOSSIM ........................... 77 4.2.2 Radio ..................................... 78 4.3 Summary ....................................... 79 5 Metaprogramming for Wireless Sensor Networks 81 5.1 Generative Programming and Metaprogramming .................. 81 5.2 Higher-order Functions, Actors, and Components .................. 82 5.3 Ptalon ......................................... 84 5.3.1 A simple example .............................. 84 5.3.2 Reconfiguration in Ptalon .......................... 86 5.4 Specifying WSN Applications Programmatically .................. 89 5.4.1 Motivation .................................. 89 5.4.2 Small World ................................. 90 5.4.3 Parameter Sweep ............................... 90 5.4.4 Higher-order actors .............................. 95 5.4.5 Discussion .................................. 98 5.5 Summary ....................................... 102 6 Related Work 105 6.1 TinyGALS and galsC ................................. 105 6.1.1 Non-blocking ................................. 105 6.1.2 MPI ...................................... 106 6.1.3 Port-Based Objects .............................. 108 6.1.4 Click ..................................... 110 6.1.5 Click and Ptolemy II ............................. 118 6.1.6 Timed Multitasking .............................. 118 6.2 Design, Simulation, and Deployment Environments ................. 119 6.2.1 Design and simulation environments ..................... 119 6.2.2 TinyOS development and editing environments ............... 123 6.2.3 Programming and deployment environments ................ 123 6.3 Summary ....................................... 124 v 7 Conclusion 125 Bibliography 127 vi List of Figures 1.1 Object-oriented design vs. actor-oriented design. Source: Edward A. Lee. ..... 5 1.2 WSN landscape. .................................... 6 2.1 Sample nesC source code. .............................. 11 2.2 Illustration of an actor-oriented model (top) in Ptolemy II and its hierarchical ab- straction (bottom). ................................... 13 2.3 XML representation of the Sinewave source. .................... 15 3.1 Graphical representation of the SenseTag
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages154 Page
-
File Size-