applying design patterns to wireless sensor network sajjad soroush [email protected] amirkabir...

27
Applying Design Patterns to Wireless Sensor Network Sajjad Soroush [email protected] AmirKabir University of Technology, Department of Computer Engineering & Information Technology Advanced design pattern Course Fall 2010 1

Post on 21-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Applying Design Patterns to Wireless Sensor Network

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010 1

Page 2: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

References

[1] S.O. Amin and C.S. Hong, “On Design Patterns for Sensor Networks,” The 27TH KIPS Spring Conference, 2007.

[2] K. Tei, Y. Fukazawa, and S. Honiden, “Applying design patterns to wireless sensor network programming,” Computer Communications and Networks, 2007. ICCCN 2007. Proceedings of 16th International Conference on, 2007, pp. 1099–1104.

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

2

Page 3: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

• sensor representation ‘Object’ of OOP

• sensing the environment and responding it ‘methods’ of an object

• Sensor states ‘attributes’ of an OOP object

• Modeling sensors as an OOP objects Enhancement in the management of sensor networks good sensor network design

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

Apply Design Patterns of other Domains in Sensor Networks

3

Page 4: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

• Design patterns for Sensor Networks:

Mediator Façade Chain of responsibility Watchdog

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

Apply Design Patterns of other Domains in Sensor Networks

4

Page 5: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Mediator in WSN

• Intent

Encapsulates objects interactions Promotes loose coupling Lets you vary their interaction independently Decouples many peers

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

5

Page 6: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Mediator in WSN

• Motivation Multi agent system Agent decomposition to enhance reusability Distribution of behavior results in many interconnections Solution is encapsulating collective behavior in a separate mediator

module

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

6

Page 7: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Mediator in WSN

• Motivation (example)

in smart ubiquitous environment, mediator contains the control logic adding a new smart appliance requires only modification of the mediator decouples all the appliances within the system from each other

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

7

Page 8: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Mediator in WSN• Structure

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

8

Page 9: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Mediator in WSN

• Applicability

When a set of modules communicate in well-defined but complex ways When it is difficult to reuse a module because it refers to and

communicates with many other modules.

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

9

Page 10: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Mediator in WSN• Consequences

vary and reuse Colleague and Mediator independently Simplifies the maintenance of the system New functionality can be added at mediator without affecting colleagues Simplifies the communication protocol Mediator can become overly complex

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

10

Page 11: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Few more Patterns at a glance

• Façade makes subsystem easier to use Provides simplified view to its users For example in smart ubiquitous environment, as soon as house

owner puts his keychain on Smart key stand many related work such as turning on the lights, switching on the answering machine and so on, can be started as a sub layer.

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

11

Page 12: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

• Chain of responsibility User wants to detect some activity If one sensor has not detected any action, it can ask the next sensor Each sensor that detect the activity, it can respond a vehicle may contain multiple sensors that can accomplish a given task Provides a way for the sensor to be selectable

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

Few more Patterns at a glance

12

Page 13: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

K. Tei, Y. Fukazawa, and S. Honiden, “Applying design patterns to wireless sensor network programming,” Computer Communications and Networks, 2007. ICCCN 2007. Proceedings of 16th International Conference on, 2007, pp. 1099–1104.

Applying Design Patterns to Wireless Sensor Network Programming

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

13

Page 14: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Applying Design Patterns to Wireless Sensor Network Programming

Middleware for WSN abstracts a network as an entity and hides programming difficulties from programmers.

Step 1: discuss major middleware languages and compare the capabilities of their primitives.

Step 2: extract design patterns from the representative middlewares to cover the missing capabilities identified in the comparison.

Step 3: Apply this extract design patterns.

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

14

Page 15: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Applying Design Patterns to Wireless Sensor Network Programming

• Various middlewares have been proposed by reseachers in the WSN community.

• Each middleware has different advantages and disadvantages in terms of : energy efficiency robustness number of tasks which a sensor node can hold simultaneously.

• Due to the diversity, a WSN administrator can select a middleware best suited for his or her the WSN.

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

15

Page 16: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Applying Design Patterns to Wireless Sensor Network Programming

MIDDLEWARES FOR WSN

• TinyDB• EnviroTrack

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

16

Page 17: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Applying Design Patterns to Wireless Sensor Network Programming

The three kinds of tasks are :

1. Nest

2. Offline Delivery

3. Tracking

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

17

Page 18: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Applying Design Patterns to Wireless Sensor Network Programming

• Type of Pattern: In-network Result Sharing Pattern Out-network Result Sharing Pattern In-network Data Repository Pattern In-network Tracking Pattern

18Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

Nest Task

Offline Delivery Task

Tracking Task

In-network Result Sharing Pattern

Page 19: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Applying Design Patterns to Wireless Sensor Network Programming

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

Extracting Design Patterns• A pattern consists of the six essential elements:

19

Page 20: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

In-network Result Sharing Pattern

Design Patterns for Nest• name it the In-network Result Sharing Pattern.

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

20

Page 21: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

In-network Result Sharing Pattern

• Tasks can share their results through the in-network data repository• The sub-tasks store their results in the data repository• The main task loads the results from it to execute its own task• This pattern uses an in-network data repository, which is maintained at

each sensor node

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

21

Page 22: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

In-network Result Sharing Pattern

• Sequence of the In-network Result Sharing Pattern

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

22

Page 23: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

In-network Result Sharing Pattern

• Related pattern

The In-network Result Sharing Pattern is strongly related to the In-network Data Repository Pattern

A variation of the In-network Result Sharing Pattern can be conceived, i.e., the Out-network Result Sharing Pattern.

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

23

Page 24: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Applying Design Patterns• Applying the In-network Result Sharing Pattern

Consider the case that a main task uses a result of a sub-task. The sub-task is described as follows.

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

24

Page 25: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Applying Design Patterns• Informally, the main task is described as follows.

• Modify the sub-task to store its result in a buffer as follows.

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

25

Page 26: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering

Applying Design Patterns

• Modify the main task to retrieve a result of the sub-task from the buffer, as follows.

• The main task is formal, and can use the result of the sub-task. With this conversion, Nest can be described in TinyDB.

Sajjad Soroush [email protected]

AmirKabir University of Technology, Department of Computer Engineering & Information Technology

Advanced design pattern CourseFall 2010

26

Page 27: Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir University of Technology, Department of Computer Engineering