Hindawi Publishing Corporation International Journal of Distributed Sensor Networks Volume 2014, Article ID 938698, 11 pages http://dx.doi.org/10.1155/2014/938698

Research Article

Temporal Alignment Model for Data Streams in Wireless Sensor Networks Based on Causal Dependencies

Jose Roberto Perez Cruz1 and Saul E. Pomares Hernandez1,2,3

1 Department of Computer Science, Instituto Nacional de Astrofísica, (Optica y Electrónica (INAOE), 72840 Tonantzintla, PUE, Mexico

2 CNRS, LAAS, 31400 Toulouse, France

3 Universite de Toulouse, LAAS, 31400 Toulouse, France

Correspondence should be addressed to Jose Roberto Perez Cruz; jrpc@ccc.inaoep.mx

Received 31 July 2013; Revised 25 January 2014; Accepted 13 February 2014; Published 30 March 2014

Academic Editor: Marimuthu Palaniswami

Copyright © 2014 J. R. Perez Cruz and S. E. Pomares Hernandez. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

New applications based on wireless sensor networks (WSN), such as person-locator services, harvest a large amount of data streams that are simultaneously generated by multiple distributed sources. Specifically, in a WSN this paradigm of data generation/transmission is known as event-streaming. In order to be useful, all the collected data must be aligned so that it can be fused at a later phase. To perform such alignment, the sensors need to agree on common temporal references. Unfortunately, this agreement is difficult to achieve mainly due to the lack of perfectly synchronized physical clocks and the asynchronous nature of the execution. Some solutions tackle the issue of the temporal alignment; however, they demand extra resources to the network deployment since they try to impose global references by using a centralized scheme. In this paper, we propose a temporal alignment model for data streams that identifies temporal relationships and which does not require the use of synchronized clocks, global references, centralized schemes, or additional synchronization signals. The identification of temporal relationships without the use of synchronized clocks is achieved by translating temporal dependencies based on a time-line to causal dependencies among streams. Finally, we show the viability and the effectiveness of the model by simulating it over a sensor network with multihop communication.

1. Introduction

Emerging applications based on wireless sensor networks (WSN) such as remote monitoring of biosignals, multimedia surveillance systems, and person locator services [1] ubiquitously (in this context, the term ubiquitous refers to the capacity to collect information from several places at the same time.) harvest a large amount of continuous time-based data, as audio or video, that is generated from several sensor nodes in a distributed and concurrent way [2-4]. Specifically, the adopted transmission paradigm in such environments is called event-streaming, which represents the generation and the transmission of data as a continuous stream of events reported by multiple sources [5]. In order to be useful to the application, all the collected data require a certain degree of postprocessing (e.g., data fusion (Data fusion refers

to the alignment, association, correlation, filtration, and aggregation of the collected data [6,7])).

For example, suppose that there is a network of fixed cameras along an area, which aims to monitor a person (see Figure 1). As each camera has a limited vision field, the resultant single video must be formed from multiple possible video sequences, collected by different cameras. Thus, all the collected video sequences will be processed/fused to produce useful information (see Figure 1).

To perform some kind of analysis or processing, all the data originated through the event-streaming must be temporally aligned in some way to make them functional and coherent. To achieve this, the sensors in the network may need to agree on some common temporal references to the whole system [2, 8-10]. Unfortunately, the characteristics and restrictions of a WSN make it difficult to establish such

Figure 1: Scenario of a person monitoring system.

references. This is mainly due to (1) the resources' constraints, (2) the channel variability, (3) the dynamicity in the topology, (4) the lack of perfectly synchronized physical clocks, (5) the absence of shared memory, and (6) the asynchronous nature of the event-streaming [3].

In order to avoid the use of synchronized clocks, a clock-free alignment approach for data streams was proposed in [10]. This solution is based on the fact that in most sensor networks, some sensor nodes act as intermediate nodes to aggregate or to collect the data streams which are later sent to another sensor or sink. Assuming the previous communication scheme, the approach has shown that aligning the data streams on the intermediate nodes without synchronizing the clocks of all sensors is sufficient. Nevertheless, this solution requires a synchronization server that broadcasts synchronization signals to the sensors to establish a global reference, and it also needs dedicated devices (data servers) to align the streams according to the broadcasted signals. These two additional requirements imply extra network resources.

In this paper, we propose a new model called EventStreaming Logical Mapping (ES-LM), for the temporal data alignment in WSNs. The ES-LM model is based on the event-streaming paradigm, the logical mapping model [11], and the data alignment approach described in [12]. The ES-LM uses pairwise interactions between nodes based on the happened-before relation [13]. The ES-LM performs the data alignment by translating temporal dependencies among streams, based on a time-line, to causal dependencies. Such translation allows us to construct a virtual time-line. By using the resulting virtual time-line we can avoid (1) the use of synchronized clocks, (2) the use of global references, (3) the use of centralized schemes, and (4) the use of additional synchronization signals. Finally, we show the viability and the effectiveness of the model by simulating it over a sensor network with multihop communication.

This paper is structured as follows. Section 2 presents the system model and the background, including our definition of the event-streaming as an abstract data type. Section 3 presents a description of the proposed temporal data alignment model for event-streaming. In Section 4 we present the analysis of the model and the simulation results. Finally, Section 5 presents the conclusions.

2. Preliminaries

2.1. System Model. We specify a WSN as a distributed system, which consists of the following three main components.

(i) Processes. Each entity associated with the WSN (sensors or sink) is represented as an individual process. Hence, a WSN is a set of processes P = [p^pj .} that communicate with each other by message passing. A process can only send one message at a time.

(ii) Messages. We consider a finite set of messages M sent by a process p e P. Such messages contain the samples of audio, video, or many other physical signals that each sensor collects. Henceforth, we will refer to a sample as a message. For a message, the sample time x is the time instant at which a process p conducts such a sample. Thus, each message m e M can be identified as m(p, x).

(iii) Events. An event represents an instant execution performed by a process. For our problem of data alignment, we only consider the send and delivery events.

(1) The send event refers to the emission of a message executed by a process.

(2) The delivery event refers to the execution performed by a process to present the received information to an application or another process.

Let m be a message. We denote by send(m) the emission event and by delivery(p,m) the delivery of m to the process p. The whole set of events in the system is the finite set: E = [send(m) : m e M} U [delivery(p,m) : m e M,p e P}.

Furthermore, for the transmissions in a WSN we consider the following two main characteristics.

(i) Transmission Delay. For a message m e M there is a time period to contend for the transmission media and the network propagation.

(ii) Synchronization Error of Two Samples. This refers to the difference between the local time reference assigned at the reception, which can be used to estimate the sample time and the sample time of the source.

2.2. Background and Definitions. A suitable way to order events in an asynchronous distributed system is the happened-before relation (HBR) defined by Leslie Lamport [13]. This relation establishes the rules to determine whether an event is the cause or the effect of another event, without using global references.

The HBR is a strict partial order on events, defined as follows.

Definition 1. The happened-before relation, " ^" is the smallest relation on a set of events E satisfying the following conditions.

(1) If a and b are events belonging to the same process, and a was originated before b, then a ^ b.

(2) If a is the sending of a message by one process, and b is the reception of the same message in another process, then a ^ b.

(3) If a ^ b and b ^ c, then a ^ c.

Based on Definition 1, Lamport defines that a pair of events is concurrently related "a || b" as follows.

Definition 2. Two events, a and b, are said to be concurrent if a b and b a; it is denoted by a lib [13].

Immediate Dependency Relation (IDR). The IDR is the transitive reduction of the HBR [14]. The IDR is defined as follows.

Definition 3. Two events a,b e E have an immediate dependency relation (denoted by "X") if

a [b if a —>b AVc e E, -(a —> c —>b). (1)

Note that an event a causally and immediately precedes an event b, if and only if, there is no other event c e E, such that c belongs to the causal future of a and to the causal past of b.

Intervals. An interval is a set of events which occur during a period of time. If the events that compose an interval satisfy a certain order, then such interval is called ordered interval. The works of Shimamura et al. [15] and Pomares et al. [11] define the following ordered interval composition.

Definition 4. Let X be an interval of sequentially ordered events at a process pt; X c E, and x-, e, x+ e X, where x-is the left endpoint and x+ is the right endpoint of interval X, such that ye e X, x- ^ e ^ x+ and x- = e, x+ = e.

When |X| = 1, this implies that x- = x+; in this case, x-and x+ are denoted indistinctly by x.

Happened-Before Relation for Intervals. Lamport establishes in [16] that an interval A happens before another interval B if

Table 1: Logical mappings expressed by endpoints.

Logical mappings Expressed by endpoints

Precedes: A ^ B a+ - ^ b -

Simultaneous: C ||| D c -\d~ , c+ \ d+

Ends: A ^ (C ||| D) + a c -\d J + , a , c+ \ d+

Starts: (C ||| D) ^ B c+ c -\\d- > b-. ,c+\\ ,d+ d+ b~

Overlaps: A ^ (C ||| D) ^ B + a c+ c IK > b~, + , a , c+ \ ,d+ d+ d-b~

all the elements that compose an interval A causally precede all the elements of interval B.

Definition 5. The causal relation " ^ " is established at a set level by satisfying the following conditions:

(1) A ^ B if a ^ b, y(a, b) eAxB,

(2) A ^ B if 3C I (A ^ C AC ^ B).

According to Definition 4 and Pomares et al. [11], the happened-before relation in regard to ordered intervals can be expressed only in terms of the endpoints as follows.

Property 1. Let A, B, and C be sets of sequentially ordered events. The set of events A occurs before the set of events B if any of the following conditions are satisfied:

(1) A ^ B if a+ ^ b-,

(2) A ^ B if 3C, such that a+ ^ c- Ac+ ^ b-.

Definition 6. Let A and B be two ordered intervals. A and B are said to be simultaneous (denoted by A ||| B) if the following condition is satisfied [11]:

AmB if fl- lib- Aa llb+. (2)

The definition above means that one interval A can take place at the "same time" as another interval B.

2.2.1. The Logical Mapping Model. The logical mapping model introduced in [11] is useful to represent pairwise interactions between processes. Such model expresses temporal relations between sets of events in terms of the happened-before relation for intervals.

The logical mapping translation involves every pair X, Y of intervals of a temporal relation. Each pair is segmented into four subintervals: A(X, Y), C(X, Y), D(X, Y), and B(X, Y), as shown in Table 1.

The logical mapping model identifies five logical mappings, which are sufficient to represent all possible temporal relations between continuous media (interval-interval relations [17]), discrete media (point-to-point relations), and discrete-continuous media relations [18].

2.2.2. Event-Streaming Abstract Data Type. We propose a definition of the event-streaming oriented to the data alignment problem. Assuming that an event-streaming is composed of several events, we begin by defining the concept of an atomic event.

Atomic Event. An atomic event indicates that an entity has sent or delivered a message containing a sample. In other words, an atomic event indicates that a portion of data has been collected from the environment.

Definition 7. An atomic event is a tuple e(pj, m(pi, x)),where pj refers to the process where the event is executed and m(pi, x) is a message (m e M) originated by process pt.

As we stated above, we consider only two types of events: send and delivery. We denote the atomic delivery event by delivery(pp m(pi, x)), and we denote the atomic send event only by send(m(pi, x)) since pt = pj.

Based on the concept of atomic event, for our solution we distinguish two kinds of data streams generated by the nodes in a WSN: the local-streams and the event-streamings.

Local-Streams. In a WSN, each process generates a certain number of atomic events throughout the communication process. When some of these events are generated sequentially by a process pt during a period of time, we say that the process pt e P has generated a local-stream. We formally define a local-stream as follows.

Definition 8. A local-stream is a poset (St, ^ ¡) where St is a finite set of atomic events St = {e1,e2,... en} generated by the process pt e P and arranged according to the local causal relation ^¡.

A local-stream can be expressed by its endpoints, similarly to the intervals (see Definition 4). For a local-stream St = {e1, e2,..., en}, the endpoints are S- = e1 and S+ = en. The endpoint S- refers to the beginning of the local-stream, while S+ refers to its end.

Event-Streamings. An event-streaming is a collection of subsets of local-streams generated by different processes. Such subsets of local-streams are grouped and arranged according

to their causal dependencies into sets denoted as Qqq, where Rq denotes the set of identifiers of the processes that generated

the events in Qqq. Thus, in a generic way, an event-streaming ES0 can be viewed as the general causal structure:

I " [Pi ---

-V- -V- -V—

ES0 = Qf1 Q22 ----> Cfc Q&T. (3)

We formally define an event-streaming as follows:

Definition 9. An event-streaming is a poset (ES0, ^) where ES0 is a finite set of subsets of events ES0 =

^1 ,Q2 2,..., Qmm} arranged according to the causal relation ^; 0 is the set of the identifiers of the processes that generated the events; and each Qqq e ES0 is a subset of events generated by the processes whose identifiers form the set Rq.

qR1 qR2 qR3 qR4

Figure 2: Representation of the subsets of an event-streaming.

Within an event-streaming each set Q_q is a collection of subsets of local-streams Qt, Qj,..., Qk, where Q; c St, Qj C Sj, and Qk c Sk such that Qt ||| Qj ||| ••• ||| Qk(i, j,... ,k e Rq). Furthermore, the events in any set Qq are arranged according to the local causal relation ^ q, which form the poset (Qq, ^ q). For example, suppose that three processes pt, pp and pk generated three local-steams as depicted in Figure 2. When a process collects such local-streams, it constructs four subsets: q{,} containing events exclusively generated by pt, Q^containing events generated by pj and pj, containing events generated by pt, pj, and

pk, and Q^'^ containing events generated by pj and pk. We note that in a similar way to the local-streams and the

intervals, each subset Qqq can be expressed by its endpoints. However, unlike local-streams and intervals, the endpoints of a subset Qqq are sets of events formed by the endpoints of

each set Qq e Qqq, respectively. Thus, when a set Qqq contains events generated by the processes pt, pj, and pk, we denote

the left set endpoint as -Qqq which is composed as follows:

-Qqq = {&-> m-, }, where w- e Q¡, w- e Qj and wk e Qk.

Likewise, we denote the right set endpoint as +Qqq which is

composed as follows: +Qqq = where e Q¡,

e Qj, and w+ e Qk.

3. Temporal Data Alignment for EventStreaming

3.1. The Problem of Data Alignment for Event-Streaming. Based on the definition of the data stream alignment problem given in [10], we define the problem of data alignment for event-streaming as follows.

Definition 10 ( Definition (data alignment problem for event-streaming)). Given a set of local-streams: {S1, S2, S3,...} and considering a certain maximum transmission delay, the problem is to assign a temporal reference that can be used as an estimated sample time for each interested message, such that for every two messages m(pi, x) and m(pj, y), their synchronization error is bounded.

For our solution, the messages of interest are the causal messages sent within an event-streaming. Explicitly, they are

the endpoints of the subsets Qqq. In this sense, the synchronization error establishes the temporal distance between the execution of a pair of messages of interest.

Table 2: Event-streaming logical mapping.

Data alignment for event-streaming

ES logical mappings

fîw W

(i) If e -Qqq, 3y~ e Yk : x

[x e Qqq : delivery(pk,x) (ii) otherwise, 0

(i) If / e Yk : +Qqq ^ y+

7 , send(y-)}

(q? -Qaa (Yk -{yeYk : delivery (pk, x+) ^ send (7)})

(ii) if Vx+ e +Qqq, 3y+ e Yk : y+

({x e Qqq : delivery (pk, x) ^ send (/+)}- )uYk (iii) otherwise, (Qqq ) U Yk

(i) if Vx+ e +Qq", 3y+ e Yk : y+ ^ x+,

Q1^ - {x e Qqq : delivery (pk,x) ^ send(y+)}

(ii) otherwise,

{y e Yk : delivery (pk,x) ^ send(y+)}

s-precedes: ^ Q^"

s-simultaneous: 0 ^ Qu1"

s-ends: QRa° ^ Q*b

s-overlaps: Q*" ^ Q*b ^ Qfr

s-starts: Q*b ^ Q^

3.2. Event-Streaming Logical Mapping Model (ES-LM). The native logical mapping identifies five logical mappings: precedes, simultaneous, ends, starts, and overlaps to determine how two intervals (local-streams) are related. However, for our problem this covers only the base case, which is the alignment of streams whose events have all been generated by a single process. In the following sections, we present an extension to the native logical mapping called eventstreaming logical mapping model (ES-LM). The ES-LM establishes how an event-streaming ES0 (a stream composed by events generated by several processes) is related to a local-stream Yk in order to determine the events that have causal dependencies and the subsets of events that concur. To achieve this, it is necessary to determine how each subset Qqq e ES0 is related to a local-stream Yk. We note that

any subset Qqq is considered as a subevent-streaming. In our ES-LM model, without loss of generality, it is assumed that

Yk or QJ || Yk . Therefore, when a subset Qq

is aligned to a local-stream Yk, a new subevent-streaming is generated according to the left column of Table 2. The resultant subevent-streaming has the following general causal structure:

llll llll llll

Figure 3: Aligning the first subset of the first event-streaming.

Xc Hill

ESe -HHI

Figure 4: Aligning the second subset of the first event-streaming.

From this causal structure, five new logical mappings are identified. These logical mappings represent all the ways that an event-streaming can be related to a local-stream. These new logical mappings are s-precedes, s-simultaneous, s-ends, s-overlaps, and s-starts (see right column of Table 2).

The ES-LM is the core of the data alignment scheme that we propose, which is presented in the following section.

3.3. Data Alignment Description. The data alignment process is described through four stages as follows.

(A.1) Initial Stage: Alignment of Two Local-Streams. Initially, we have two local-streams Xc and Yd (X~ ^ Yd or X~ || Yd).

Applying the native logical mapping, we generate the first event-streaming ES0 as follows.

We construct a first subset Q{c} with the first non-concurrent events in Xc (see Table 3). To determine those nonconcurrent events, we need to identify all the events x e Xc that precede the beginning of Yd (see Figure 3).

Then, according to Table 3, we proceed to construct a second subset Qi,c'd} with the concurrent events between Xc and Yd. The concurrent segments of both local-streams will be bounded by the beginning of Yd and the end of any of the two local-streams (see Figure 4).

The last subset Q^"' is constructed depending upon which local-stream finishes first. If Xc finishes first, the last subset will contain the remaining events of Yd (see Table 3).

——

——

Table 3: A.1 Alignment of two local-streams.

(i) If e Xc, y- eYd : x- ^ y-{x e Xc : deliver

(ii) otherwise, 0

Q'jcl ^ [x e Xc : delivery(pd,x) ^ send(y )}

(i) If e Xc, / eYd : x+ ^ y+,

(Xc - Q|cl) u (Yd -[yeYd : delivery (pd, x+)

[c,d] send M})

^ (ii) if x+ e Xc, / eYd : y+ ^ x+,

qR1 qR2 qR3

\ : ^ : \ : • \ \ \ \ \ \ \ \ \ \ \ \

Yk-------\___\_A

\ \ \ It:

\ \ \ i

\ \ \ i

\ \ \ i

, \ \ . \ . i .

■Uáita

q;1 q;2 q;3 q;4

({% e Xc : send (x) ^ delivery (pc, y+)} - Q|cl) U Yd (iii) otherwise, (Xc - Qjcl) U Yd

^ t * Q3""1 ^ Xc - ({* e Xc : send(x) ^ delivery (pc,y+)} - Ql{Cl)

(ii) otherwise, {yeYd : delivery (pd,x+) ^ send(y)}). Figure 6: Aligning the first subsets of events of an event-streaming.

Xc HUI

Yd --Hi ES0-HH

Q?" by detecting the

Yd Hill

ESe-H|||

Figure 5: Aligning the last subset of the first event-streaming. (a) Xc finishes first, (b) Yd finishes first.

Otherwise, the last subset will contain the remaining events of Xd (see Table 3). These two cases are illustrated in Figure 5. Therefore, the first event-streaming has the general causal

structure ES@ = Q{cl or d.

Q3 , where w may be c

Once the first stage has finished, we proceed to align two streams: an event-streaming and a local-stream. The eventstreaming is labeled as the set Xp, where p is the set of identifiers of the processes that generated the events, while the local-stream is labeled as Yk, where k is the identifier of the local process. Each resultant event-streaming is merged with the next most-left local stream Yk according to the causal dependencies among the events of Yk and the eventstreaming Xp.

Using Xp and Yk, we construct a new event-streaming

forming the subsets Qqq of the general causal structure ES@ =

concurrences between Xp and Yk.

Assuming that the initial stage was accomplished, the logical mapping proceeds according to the three stages that are detailed below.

(B.1) Aligning the First Subsets of Events without Concurrences between an Event-Streaming and a Local-Stream. In the first step, we determine if there are some subsets Qaa e Xp that precede the local-stream Yk to form the first subsets of the new event-streaming (see stage B.1 of Table 4). These subsets have events that are not concurrent with the events of Yk and are integrated directly to the new event-streaming to form the first subsets Qa" e ES0 (see Figure 6).

If a subset Qf" e Xp has events that are concurrent with a part of the local-stream Yk, this subset is segmented to form two new subsets for the new event-streaming ES0. The new subset QTa, the first of the two new subsets, will contain the part of Qf" whose events have no concurrence. To determine the events without concurrences, it is necessary to identify the event x e Qa that immediately precedes the beginning of the local-stream Yk, (see line 1.2 ofTable 4). For the example

depicted in Figure 6, the new subset Q?" corresponds to the

subset Q^. The remaining events of Qj* are aligned as stated

in the following stage.

(B.2) Aligning the Subsets of Events with Concurrences between an Event-Streaming and a Local-Stream. If during stage B.1 a subset Q^ was detected containing events concurrent with a portion of the local-stream Yk, such a portion of Yk is attached to the part of Qa with concurrent events to form a new subset QT (see line 2.1 ofTable 4).

Once the beginning of the concurrent parts of both streams are detected, according to stage B.2 of Table 4 (lines 2.2 and 2.3), all the subsequent subsets Qa e Xp are attached with the corresponding concurrent events of Yk, until one of the two streams finishes. This means that for each subset Q^ in the concurrent part of Xp, a new subset Qp will be constructed for the new event-streaming ES0 (see Figure 7).

The final subsets of the resulting event-streaming will be constructed depending upon which stream finishes first.

Table 4: Alignment process between an event-streaming and a local-stream.

If Vx e X-, 3y e Yk : x ^ y a new set Qa" is created as follows

(i) For each Qf" e X0 : —(3x e Q£" : delivery(pk,x) j send(y ))

(ii) If 3x e Q^" : delivery (pk, x) j send(y-), Q' = {x e 0^" : delivery (pk,x) ^ send(y-)}

1.1 1.2

Case A. If Q*" -Q' = 0,a new set Q/c is created by (Qa" - Q') U (Yk -{yeYk : delivery (p^Q^) ^ send (7)})

Case B. If Vx+ e X^, 3y+ e Yk : x+ ^ y+ a new set Q/c is created as follows for each QRhb eXp - (Qf1 u---uQ£),

Qt" U {(Yk -{yeYk :yeQTl1 U---U q}_-}) -{yeYk : delivery (pk,+Ql") ^ send(y)}}

Case C. If Vx+ e X+, 3y+ e Yk : y+ ^ x+ a new set Q/ is created for each Q*" e Xfi - (Qf1 U---UQ?

such that Vx e QR" : delivery(pk, x) ^ send(y+), asfollows:

(i) for each Q*" e X^ : -(3x e Q*" : delivery(pk, x) j send(y+)),

^ Q0" U {(Yk - {yeYk :yeQTT U--U Q^ })-{yeYk : delivery^; Qf") ^ send(y)}}

(ii) if 3x e QR" : delivery(pk,x) j send(y+),

Q" = {* e Q%" : delivery (pk ,x) ^ send (/)} u(Yk -{yeYk : y e QT U---U Q/"})

qR3 qR4 qR5 qR6

\ 1 t : t : \ 1 1 \ 1 ( \ t : t :

qT3 qT4 qT5 QT6 qT7 :

B.3 a Case A. If Vx+ e X+, 3y+ e Yk : y+ ^ x+ a new set Q1/ as follows (i) if Qt" -Q" = 0, Qt" -Q" (ii) otherwise, for each Q^ e {Xp - QT U---UQ/} 3.1 3.2

a Case B. If Vx+ e X+, 3y+ e Yk : x+ ^ y+ a new set Q/d is created by Yk-{yeYk :yeQtt u---uqt/ } 3.3

qR6 qR7 qR8 qR9

X« HH

Yk -HH

: • : •. \ : \ \ \ \ \ •. 1 \ •I \ \ : \ \ \ \ \ \ : \ \ \ \ \ \ \ \ \ \

TTn \ \ \ 1 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

qT7 qT8 qT9 qTI° qTÎ1

Figure 7: Aligning the subsets of events with concurrences.

Figure 8: Aligning the last subsets of events without concurrences when y+ ^ X+.

If the local-stream Yk finishes first (y+ ^ X+), the last

concurrent subset Qb" e Xp can contain some events that are concurrent with Yk and other events that have no concurrence (see Figure 8). If this is the case, Qb" needs to be segmented to construct two new subsets for the new event-streaming ES&. The new subset Q/c, the first of the two new subsets, will contain the concurrent part of Qb" and the concurrent events of Yk. To determine such concurrent events, it is necessary to identify the event x e Qb" that immediately precedes the end of the local-stream Yk and the concurrent part of the local-stream (see line 2.4 in Table 4). For the example depicted in

remaining events of Qb" are aligned as stated in the following stage.

(B.3) Aligning the Last Subsets of Events without Concurrences. This stage is explained through two cases.

Case A (Yk finishes before Xp). If at the end of stage B.2, the last subset Qb" was segmented, the second created subset, denoted as Qdd, will contain the remaining nonconcurrent events of Qb" (see line 3.1 of Table 4). In the example of

Figure 8, such subset Qdd corresponds to the subset Qg8. The fact that the local-stream Yk finishes first (y+ ^

Figure 8, the new subset Qlcc corresponds to subset Q,j7. The X+) implies that the concurrent parts of both streams finish

X -Hill

Qqq represents a unique time-slot and each event belongs to a unique time-slot.

Yk --Ml

ES« -Hill

Q¡6 QT

Figure 9: Aligning the last subsets of events without concurrences

when X+ ^ y+.

along with Yk. Therefore, according to line 3.2 of Table 4, the remaining subsets Qfc e Xp will become the last subsets

Qdd e ES0. In the example of Figure 8, the last subsets Qd

are the subsets , Q^0, and Qjj1.

Case B (Xp finishes before Yk). The fact that the eventstreaming Xp finishes first (X+ ^ y+, y+ e Yk) means that the concurrent parts of both streams finish along with the event-streaming Xp. After the last subset Qcc e ES0 was constructed with the concurrent events of Xp and Yk, only

one more subset Qdd is constructed according to line 3.3 of Table 4. Such subset Qdd will contain the remaining events of the local-stream Yk. In the example of Figure 9, the last subset

Qdd corresponds to the subset Qgs.

The event-streaming logical mapping will continue until

there are no more concurrent local-streams to be merged.

In terms of data alignment, we note that by the way

in which the subsets of events are constructed and causally

ordered, each resultant event-streaming ES0 is a finite colT

lection of disjoint subsets Qqq arranged one after another

without interruption. This arrangement of subsets Qq in an

ES0 allows us to establish a relative time-line, where each T

subset Qqq represents a unique time-slot. The fact that the

Proof. We divide this proof into two parts. In the first part we prove that an event-streaming is a causal arrangement of subsets of events that establishes a time-line. In the second part we prove that each subset Qqq in an event-streaming represents a unique time-slot.

Part I. To demonstrate that an event-streaming is a causal arrangement of subsets of events that establishes a time-line, we formulate and prove the following Lemma.

Lemma 12. An event-streaming is a causal arrangement of subsets ofevents that establishes a time-line.

Before proving Lemma 12, we need to consider the following. Definition 8 states that a local-stream is a poset (St, ^ ), where St is a set of atomic events generated by the same process. Thus, (St, ^) is a sequence St = [ea ^ ea+i ^ ^ en-i ^ en}. The fact that the events of St are arranged by ^ implies that each event happens before another at a different instant, which determines a chronologically order. Therefore, a local-stream St represents a time-line for a process i.

Proof of Lemma 12. We demonstrate Lemma 12 by a direct proof. According to the ES-LM (Tables 2, 3and 4) during the data alignment, the subsets of events that compose a new event-streaming ES^ are formed by segmenting two streams (a local-stream and an event-streaming or two local-streams). From Tables 3 and 4 (specifically, stage B.1; cases B and C of stage B.2; and stage B.3) we have that a segmentation is triggered by the identification of an endpoint which determines the beginning or the ending of an overlap between a pair of streams. Whichever the case, each segmentation establishes the creation of two new subsets Q^-^ and Q^". Let Yc be a local-stream and let X denote a local-stream or an eventstreaming such that Vx~ e X, 3y~ e Yc : ^ y~. Assuming that e* (e* e Yc or e* e X) is the endpoint (e* = y- Ve* = y+ Ve* = x+), whose identification triggered the segmentation, Vx+ e X, Qand Q^" are constructed

subsets Qqq are disjoint implies that each event in an event- according to one of the three following cases:

streaming belongs to a unique subset Qqq, and therefore it is located at a specific time-slot.

4. Analysis and Results

4.1. Proof of the Temporal Data Alignment. In this section we prove that by following the ES-LM model, the sequential arrangement of subsets of events that compose an eventstreaming establishes a virtual time-line, where each subset represents a unique time-slot and each event is aligned with respect to only one of them.

Theorem 11. The arrangement of subsets Qqq in an eventstreaming establishes a virtual time-line, where each subset

(1) if e* e Yc, e* = y , and x ^ y , then Q^1 = [x e X : delivery(pc, x) ^ send(e*)| and Q^" = {e*} U {x e X : send(e*) ^ delivery(pc,x)} u [y e Yc : send(y) ^ delivery(pc, x+)};

(2) if e* e X, e* = x+,andx+ ^ y+ ,then Q^1 = [e*}u [x e X : delivery(pc, x) ^ delivery(pc,e*)} u [y e Yc : send(y) ^ delivery(pc,e

Yc : delivery(pc,e*) ^ send(y)};

(3) if e* e Yc, e* = /, and / ^ ,then Q^ 11 = {e*} U [x e X : delivery(pc,x) ^ send(e*)} u [y e Yc : send(y) ^ send(e*)} and Q*" = [x e X : send(e*) ^ delivery(pc,x)}.

In each of these three cases, happened-before relationships are established among the left endpoints of Qf^1 and the right endpoints of Q^". This means that for a pair of subsets Qf^1 and Q^» (Qf^.Qf" e ES^) we have that

V(to+,tofc ) e +q;

Furthermore, all the events that compose Qf-11 and Q^" are extracted from local-streams by preserving their causal order. Thus, let to; and to+ be two events such that e Q;,

D _1 ,

Q; e Q^ 1 , and Q; c (for any local-stream S;); if to; = to+ then to; ^ to+. By the transitive property of the HBR we have that to; ^ tofc, Vtofc e Q^" .Moreover, foranyevent tofc e Q^", tofc = tofc, tofc ^ tofc;thereby, transitively to; ^ tofc .Therefore, by Definition 5 we have Qf^1 ^ Q^". Thus the subsets of an event-streaming are chronologically ordered representing

a time-line, where each subset q is a time-slot.

Corollary 13. Each subset Q„q e ES& represents a time-slot.

Part II. To demonstrate that each subset q in an eventstreaming represents a unique time-slot, we formulate and prove the following Lemma.

Lemma 14. Each subset q represents a unique time-slot; therefore, any pair of subsets Q^" and , that compose an event-streaming ES@, is disjoint. Consider the following:

,QfV e ES0,w = v n QfV =

Proof of Lemma 14. We prove Lemma 14 by contradiction. Therefore, we suppose that VQ£",Qfv e ES0,w = v : Qf" n Qfv = 0; that is, : ^ e e Qfv.

According to the ES-LM model, the subsets Q^q of an event-streaming are created by aligning two local streams or aligning a local stream with an event-streaming. Whichever way an event-streaming is generated, a subset Q^" must be related to another Q^V (w = v) according to one of the five logical mappings described in Table 2. This means that for

any e Qf" and any Cf, e Qfv, ^ Cf, or ^ ^ V

Thus, if there is such that e Q^" e Q^V implies that ^ is a contradiction, according to the happened-before relation (systems in which an event can happen before itself do not seem to be physically meaningful). □

4.2. Simulation Results. We have simulated the temporal data alignment model for event-streaming using the Castalia simulator [19]. The simulation scenario is within a set of 50 nodes that were arranged into multihop paths, where the nodes are separated by distances between 5 and 10 meters in a field of 200 x 200 meters. Through each multihop path, a node reaches the sinkhelped by up to 10 relay nodes. With this arrangement, each relay node aligns the streams generated by the predecessor nodes in the path in such a way that if there exist nr nodes behind a node _p;, _p; aligns at most nr streams.

For the simulation, we implemented the model using the well-known vector clock structure [20, 21] to identify and preserve the causal relations among events. Therefore, we obtain a computational cost as well as communication and storage overheads of 0(nr), where nr is the number of nodes that are related to a certain node during the data transmission.

To transmit a local-stream we use two types of causal messages: fce^f'n and end, and a type of FIFO message: /i/o_p which does not carry any causal information. So, a process _p; generates a local-stream by sending a fce^f'n message (S_) followed by certain number of /i/o_p messages. Finally, to notify a process that the transmission of the local-streaming has been finished, the process _p; sends an end message (S+).

The simulation was configured with the TMAC protocol for the MAC sublayer and the CC2420 radio protocol for wireless transmissions. The data payload for the Application layer packets was fixed to 2000 bytes.

In the simulation scenario, each node generated a random number of local-streams throughout the simulation. Each generated local-stream was composed by a random number of messages between 9 and 100 that were generated using sampling rates between 25 and 1000 milliseconds.

In order to measure and to show that the synchronization error is bounded, we took the simulation time as a global clock. We note that the simulation time was not used in the ES-LM. The ES-LM use only the causal dependencies between the event-streamings to perform the data alignment and do not use any kind of physical time.

At each hop we took the causal messages fce^f'n and end exchanged during the transmissions of the local-streams to determine the synchronization error between a pair of streams.

Let e* denote the send event executed by process _p; to transmit the causal message m(_p;, a) (fce^f'n or end), and let e* be the send event executed by process to transmit m(_pj, which is the latest aligned message before the reception of m(_p;, a); when receives m(_p;, a), the synchronization error of a pair of local-streams is determined by the difference between the sampling time of m(_p;, a) and m(_pj,

For example, in the scenario depicted in Figure 10, process _p; sends the message m(_p;,a) to pj, which indicates the beginning of the local-stream . Assuming that pj is generating the local-stream S.-, the synchronization error between and Sj is determined by the difference between the sampling time of m(_p;, a) and the sampling time of m(_pj,

Thus, by considering the simulation time as a global clock, the synchronization error is estimated by using the following formula:

ei (e>;) = I TS; (*;) - TS, (Ol : e; e S,,e; e Sj, e* |

where is the synchronization error measured at process pj and TSX is a sample time at process

By using sampling rates between 25 and 1000 milliseconds, we show that the synchronization error can be bounded according to the transmission delay as shown in Figure 11.

p¡ --------rn.

S- =!e„ "■■• e«+i'

* ! ^ ^ I ?

TSj«) TS/ep

Figure 10: Example of the alignment of causal messages.

0.4 -, 0.35 -0.3 -

| 0.25 -

0.15 -

0 200 400 600 800 1,000

Sampling rate (ms)

■ ■ * ■ ■ Transmission delay - -i- - Synchronization error

Figure 11: Difference between the synchronization error and the transmission delay

With respect to why the average synchronization error is bounded between sampling rates of 75 ms to 830 ms we present the following analysis (see Figure 11). The synchronization error cannot be bounded lower than 75 ms because a faster sampling rate causes a greater saturation in communication channels and indeterminism of the transmission delay. The latter is mainly due to the signal-to-noise ratio (SNR) as well as to the medium access contention. On the other hand, the synchronization error cannot be bounded when the sampling rates are greater than 830 ms by our solution since the temporal distance between two consecutive local samples at a process pj is much larger than the maximum transmission delay of the current hop.

5. Conclusions

A temporal alignment model for data streams in WSNs called event-streaming logical mapping (ES-LM) has been presented. One original aspect of our model is that the data alignment is performed without using synchronized clocks, global references, centralized schemes, or additional synchronization signals. This was achieved by translating temporal dependencies based on a time-line to causal dependencies among streams. The ES-LM model constructs a virtual timeline by arranging the transmitted data into causally ordered sets of events. In terms of the problem of temporal data alignment, it was proven that each ordered set of events determines a specific and unique time slot. An instantiation of the model was simulated over a sensor network with multihop communication. The simulation results show that the synchronization error is bounded according to the transmission delay.

Conflict of Interests

4.2.1. Analysis of the Results. Based on the ES-LM, the data alignment is performed in the intermediate nodes while the streams are propagated through the network. In our case the data alignment is achieved by ensuring that at each intermediate node the synchronization error £j(e*,e*) is bounded by the transmission delay for a pair of endpoints e* and e*. This means that the execution of the send events of such pair of endpoints takes place at most at £j(e*,e*) units of time one with respect to the another. This result is achieved as follows. When pj locally constructs an event-streaming, such event-streaming is the output of the alignment of two or more local-streams according to the causal relations established by ES-LM. In such event-streaming, according to the local view of pj, a pair of endpoints (e*a, e*p) is related as shown in Figure 10. When such endpoints are retransmitted/propagated to another node (final or intermediate) and because they have the same source, their transmission delays will be affected by the same network conditions and therefore the synchronization error remains bounded according to the transmission delay of the current hop. This phenomenon is quite similar to the relative velocity between two physical objects.

The only funding source for this work is mentioned in the acknowledgment section of the paper. The authors declare that there is no conflict of interests regarding the publication of this paper.

Acknowledgment

Jose Roberto Perez Cruz would like to thank to the Council of Science and Technology (CONACYT) of Mexico for the doctoral scholarship with which his studies were supported.

References

[1] I. F. Akyildiz, T. Melodia, and K. R. Chowdhury, "A survey on wireless multimedia sensor networks," Computer Networks, vol. 51, no. 4, pp. 921-960, 2007.

[2] A. D. Kshemkalyani, "Predicate detection using event streams in ubiquitous environments," in Proceedings of the EUC 2005 Workshops: UISW, NCUS, SecUbiq, USN, and TAUES, pp. 807816, Springer, Nagasaki, Japan, 2005.

[3] P. Chandra and A. D. Kshemkalyani, "Causality-based predicate detection across space and time," IEEE Transactions on Computers, vol. 54, no. 11, pp. 1438-1453, 2005.

[4] S. Reilly, "Multi-event handlers for sensor-driven ubiquitous computing applications," in Proceedings of the 7th Annual IEEE International Conference on Pervasive Computing and Communications (PerCom '09), pp. 1-2, IEEE ComputerSociety, Washington, DC, USA, March 2009.

[5] A. D. Kshemkalyani and M. Singhal, Distributed Computing: Principles, Algorithms, and Systems, Cambridge University Press, New York, NY, USA, 2008.

[6] D. L. Hall and S. A. H. McMullen, Mathematical Techniques in Multisensor Data Fusion, Artech House Information Warfare Library, Artech House, Norwood, Mass, USA, 2004.

[7] J. M. Bahi, A. Giersch, and A. Makhoul, "A scalable fault tolerant diffusion scheme for data fusion in sensor networks," in Proceedings of the 3rd International Conference on Scalable Information Systems (InfoScale '08), pp. 10:1-10:5, Institute for Computer Sciences, Social-Informatics and Telecommunications Engineering, Brussels, Belgium, 2008.

[8] M. Gao, X. Yang, R. Jain, and B. C. Ooi, "Spatio-temporal event stream processing in multimedia communication systems," Proceedings of the 22nd International Conference on Scientific and Statistical Database Management, Springer, Berlin, Germany, vol. 6187, pp. 602-620, 2010.

[9] E. Besada-Portas, J. A. Lopez-Orozco, J. Besada, and J. M. De La Cruz, "Multisensor fusion for linear control systems with asynchronous, out-of-sequence and erroneous data," Automatica, vol. 47, no. 7, pp. 1399-1408, 2011.

[10] G.-L. Lee and C.-S. Shih, "Clock free data streams alignment for sensor networks," in Proceedings of the 13th IEEE International Conference on Embedded andReal-Time Computing Systems and Applications (RTCSA '07), pp. 355-362, August 2007.

[11] S. E. Pomares Hernandez, L. A. Morales Rosales, J. Estudillo Ramirez, and G. Rodriguez Gomez, "Logical mapping: an intermedia synchronization model for multimedia distributed systems," Journal of Multimedia, vol. 3, no. 5, pp. 33-41, 2008.

[12] J. R. Perez Cruz, S. E. Pomares Hernandez, and E. Munoz de Cote, "Data alignment for data fusion in wireless multimedia sensor networks based on M2M," KSII Transactions on Internet and Information Systems, vol. 6, no. 1, pp. 229-240, 2012.

[13] L. Lamport, "Time, clocks, and the ordering of events in a distributed system," Communications of the ACM, vol. 21, no. 7, pp. 558-565, 1978.

[14] S. P. Hernandez, J. Fanchon, and K. Drira, "The immediate dependency relation: an optimal way to ensure causal group communication," in Annual Review of Scalable Computing, Series on Scalable Computing, pp. 61-79, World Scientific, 2004.

[15] K. Shimamura, K. Tanaka, and M. Takizawa, "Group communication protocol for multimedia applications," in Proceedings of the International Conference on Computer Networks and Mobile Computing (ICCNMC '01), pp. 303-308, IEEE Computer Society, Washington, DC, USA, 2001.

[16] L. Lamport, "On interprocess communication—part I: basic formalism," Distributed Computing, vol. 1, no. 2, pp. 77-85,1986.

[17] J. Allen, "Maintaining knowledge about temporal intervals," Communications of the ACM, vol. 26, no. 11, pp. 832-843,1983.

[18] M. B. Vilain, A System for Reasoning about Time, National Conference on Artificial Intelligence, MIT Press, 2nd edition, 2013.

[19] A. Boulis, "Castalia: a simulator for wireless sensor networks," 2013, http://castalia.research.nicta.com.au/index.php/en/.

[20] F. Mattern, "Virtual time and global states in distributed systems," in Proceedings of the International Workshop on Parallel

and Distributed Algorithms, pp. 215-226, North-Holland, Gers, France, 1988.

[21] C. J. Fidge, "Timestamps in message-passing systems that preserve the partial ordering," in Proceedings of the 11th Australian Computer Science Conference (ACSC '88), pp. 56-66,1988.

Copyright of International Journal of Distributed Sensor Networks is the property of Hindawi Publishing Corporation and its content may not be copied or emailed to multiple sites or posted to a listserv without the copyright holder's express written permission. However, users may print, download, or email articles for individual use.