Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir...

Post on 21-Dec-2015

216 views 0 download

Tags:

Transcript of Applying Design Patterns to Wireless Sensor Network Sajjad Soroush soroosh@aut.ac.ir AmirKabir...

Applying Design Patterns to Wireless Sensor Network

Sajjad Soroush soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010 1

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

2

• 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 soroosh@aut.ac.ir

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

• Design patterns for Sensor Networks:

Mediator Façade Chain of responsibility Watchdog

Sajjad Soroush soroosh@aut.ac.ir

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

Mediator in WSN

• Intent

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

Sajjad Soroush soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

5

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

6

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

7

Mediator in WSN• Structure

Sajjad Soroush soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

8

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

9

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

10

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

11

• 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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

Few more Patterns at a glance

12

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

13

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

14

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

15

Applying Design Patterns to Wireless Sensor Network Programming

MIDDLEWARES FOR WSN

• TinyDB• EnviroTrack

Sajjad Soroush soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

16

Applying Design Patterns to Wireless Sensor Network Programming

The three kinds of tasks are :

1. Nest

2. Offline Delivery

3. Tracking

Sajjad Soroush soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

17

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 soroosh@aut.ac.ir

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

Applying Design Patterns to Wireless Sensor Network Programming

Sajjad Soroush soroosh@aut.ac.ir

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

In-network Result Sharing Pattern

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

Sajjad Soroush soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

20

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

21

In-network Result Sharing Pattern

• Sequence of the In-network Result Sharing Pattern

Sajjad Soroush soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

22

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

23

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

24

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

25

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 soroosh@aut.ac.ir

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

Advanced design pattern CourseFall 2010

26