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

.


Introduction
Emerging applications based on wireless sensor networks (WSN) such as remote monitoring of biosignals, multimedia surveillance systems and person locator services [1] ubiquitously 1 harvest a large amount of continuous timebased data, as audio or video, that is generated from several sensor nodes in a distributed and concurrent way [10,6,18].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 [11].In order to be useful to the application, all the collected data require a certain degree of post-processing (e.g.data fusion2 ).
For example, suppose that there is a network of fixed cameras along an area, which aim 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 tem-Figure 1: Scenario of a person monitoring system.porally 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 [8,4,10,14].Unfortunately, the characteristics and restrictions of a WSN make it difficult to establish such 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 [6].
In order to avoid the use of synchronized clocks, a clockfree alignment approach for data streams was proposed in [14].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 commu-nication 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 Event-Streaming 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 [20] and the data alignment approach described in [17].The ES-LM uses pairwise interactions between nodes based on the happened-before relation [12].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 timeline.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 multi-hop 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.

System model
We specify a WSN as a distributed system, which consists of three main components: • Processes.Each entity associated to the WSN (sensors or sink) is represented as an individual process.Hence, a WSN is a set of processes P = {p i , p j , ...} that communicate with each other by message passing.A process can only send one message at a time.
• Messages.We consider a finite set of messages M sent by a process p ∈ P. Such messages contains 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 ∈ M can be identified as m(p, x).
• 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: Furthermore, for the transmissions in a WSN we consider two main characteristics: • Transmission delay.For a message m ∈ M there is a time period to contend for the transmission media and the network propagation.
• 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.

Background and Definitions
A suitable way to order events in an asynchronous distributed system is the happened-before relation (HBR) defined by Leslie Lamport [12].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.

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 ∥ b [12].

Immediate dependency relation (IDR).
The IDR is the transitive reduction of the HBR [19].The IDR is defined as follows: Definition 3 Two events a, b ∈ E have an immediate dependency relation (denoted by "↓") if: Note that an event a causally and immediately precedes an event b, if and only if, there is no other event c ∈ 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. [21] and Pomares et al. [20] define the following ordered interval composition.
Definition 4 Let X be an interval of sequentially-ordered events at a process p i ; X ⊂ E, and x − , e, x + ∈ X; where x − is the left endpoint and x + is the right endpoint of interval X, such that ∀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 [13] that an interval A happens before another interval B if 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:
According to Definition 4 and Pomares et al. [20], 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: 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 [20]: The definition above means that one interval A can take place at the "same time" as another interval B.

The logical mapping model
The logical mapping model introduced in [20] 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 [2]), discrete media (point-to-point relations), and discrete-continuous media relations [15].

Event-streaming abstract data type
We propose a definition of the event-streaming oriented to the data alignment problem.Assuming that an eventstreaming 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(p j , m(p i , x)), where p j refers to the process where the event is executed and m(p i , x) is a message (m ∈ M) originated by process p i .
As we stated above, we consider only two types of events: send and delivery.We denote the atomic delivery event by delivery(p j , m(p i , x)), and we denote the atomic send event only by send(m(p i , x)) since p i = p j .
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 eventstreamings.
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 se-quentially by a process p i during a period of time, we say that the process p i ∈ P has generated a local-stream.We formally define a local-stream as follows: where S i is a finite set of atomic events S i = {e 1 , e 2 , ...e n } generated by the process p i ∈ P and arranged according to the local causal relation → i .
A local-stream can be expressed by its endpoints, similarly to the intervals (see Definition 4).For a local-stream S i = {e 1 , e 2 , ...e n }, the endpoints are S − i = e 1 and S + i = e n .The endpoint S − i refers to the beginning of the local-stream, while S + i 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 Q R q q , where R q denotes the set of identifiers of the processes that generated the events in Q R q q .Thus, in a generic way, an event-streaming ES Θ can be viewed as the general causal structure: We formally define an event-streaming as follows: } arranged according to the causal relation →; Θ is the set of the identifiers of the processes that generated the events; and each Q R q q ∈ ES Θ is a subset of events generated by the processes whose identifiers form the set R q .
Within an event-streaming each set Q R q q is a collection of subsets of local-streams Ω i , Ω j , ..., Ω k , where . Furthermore, the events in any set Ω ς are arranged according to the local causal relation → ς , which form the poset (Ω ς , → ς ).For example, suppose that three processes p i , p j and p k generated three local-steams as depicted in Figure 2. When a process collects such local-streams, it constructs four subsets: Q {i} 1 containing events exclusively generated by p i , Q {i, j} 2 containing events generated by p i and p j , Q {i, j,k} 3 containing events generated by p i , p j and p k and Q { j,k} 4 containing events generated by p j and p k .We note that in a similar way to the local-streams and the intervals, each subset Q R q q can be expressed by its endpoints.
However, unlike local-streams and intervals, the endpoints of a subset Q R q q are sets of events formed by the endpoints of each set Ω ς ∈ Q R q q , respectively.Thus, when a set Q R q q contains events generated by the processes p i , p j and p k , we denote the left set endpoint as − Q R q q which is composed as follows: Likewise, we denote the right set endpoint as q which is composed as follows: 3 Temporal data alignment for eventstreaming

The problem of data alignment for eventstreaming
Based on the definition of the data stream alignment problem given in [14], we define the problem of data alignment for event-streaming as follows.
Definition 10 Data alignment problem for eventstreaming: Given a set of local-streams: {S 1 , S 2 , S 3 , ...}, 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(p i , x) and m(p j , 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 Q R q q .In this sense, the synchronization error establishes the temporal distance between the execution of a pair of messages of interest.

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 event-streaming logical mapping model (ES-LM).The ES-LM establishes how an event-streaming ES Θ (a stream composed by events generated by several processes) is related to a local-stream Y k 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 Q R q q ∈ ES Θ is related to a local-stream Y k .We note that any subset Q R q q is considered as a sub-eventstreaming.In our ES-LM model, without loss of generality, it is assumed that q is aligned to a local-stream Y k , a new sub-event-streaming is generated according to the left column of Table 2.The resultant sub-event-streaming has the following general causal structure: 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 localstream.These new logical mappings are: s-precedes, ssimultaneous, 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.

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 X c and Applying the native logical mapping, we generate the first event-streaming ES Θ as follows.
We construct a first subset Q {c} 1 with the first nonconcurrent events in X c (see Table 3).To determine those non-concurrent events, we need to identify all the events x ∈ X c that precede the beginning of Y d (see Figure 3).
Then, according to Table 3, we proceed to construct a second subset Q {c,d} 2 with the concurrent events between X c and Y d .The concurrent segments of both local-streams will be bounded by the beginning of Y d and the end of any of the two local-streams (see Figure 4).The last subset Q {w} 3 is constructed depending upon which local-stream finishes first.If X c finishes first, the last subset will contain the remaining events of Y d (see Table 3).Otherwise, the last subset will contain the remaining events of X d (see Table 3).These two cases are illustrated in Figure 5. Therefore, the first event-streaming has the general causal structure , where w may be c or d.
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 X β , where β is the set of identifiers of the processes that generated the events, while the local-stream is labeled as Y k , where k is the identifier of the local process.Each resultant event-streaming is merged with the next most-left local stream Y k according to the causal dependencies among the events of Y k and the eventstreaming X β .
Using X β and Y k , we construct a new event-streaming forming the subsets Q T q q of the general causal structure n by detecting the concurrences between X β and Y k .
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 Q R a a ∈ X β that precede the local-stream Y k 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 Y k and are integrated directly to the new eventstreaming to form the first subsets Q T a a ∈ ES Θ (see Figure Figure 6: Aligning the first subsets of events of an eventstreaming If a subset Q R a a ∈ X β has events that are concurrent with a part of the local-stream Y k , this subset is segmented to form two new subsets for the new event-streaming ES Θ .The new subset Q T a a , the first of the two new subsets, will contain the part of Q R a a whose events have no concurrence.To determine the events without concurrences, it is necessary to identify the event x ∈ Q R a a that immediately precedes the beginning of the local-stream Y k , (see line 1.2 of Table 4).For the example depicted in Figure 6, the new subset Q T a a corresponds to the subset Q T 3  3 .The remaining events of Q R a a 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 R a a was detected containing events concurrent with a portion of the local-stream Y k , such a portion of Y k is attached to the part of Q R a a with concurrent events to form a new subset Q T c c (see line 2.1 of Table 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 Q R b b ∈ X β are attached with the corresponding concurrent events of Y k , until one of the two streams finishes.This means that for c will be constructed for the new event-streaming ES Θ (see Figure 7).
Figure 7: Aligning the subsets of events with concurrences.
The final subsets of the resulting event-streaming will be constructed depending upon which stream finishes first.

If the local-stream Y k finishes first (y
b ∈ X β can contain some events that are concurrent with Y k and other events that have no concurrence (see Figure 8).If this is the case, Q R b b needs to be segmented to construct two new subsets for the new eventstreaming ES Θ .The new subset Q T c c , the first of the two new subsets, will contain the concurrent part of Q R b b and the concurrent events of Y k .To determine such concurrent events, it is necessary to identify the event x ∈ Q R b b that immediately precedes the end of the local-stream Y k and the concurrent part of the local-stream (see line 2.4 in Table 4).For the example depicted in Figure 8, the new subset Q T c c corresponds to subset Q T 7  7 .The remaining events of Q R b b are aligned as stated in the following stage.
Table 4: Alignment process between an event-streaming and a local-stream c as follows: ), as follows:  4).In the example of Figure 8, such subset Q T d d corresponds to the subset Q T 8  8 .The fact that the local-stream Y k finishes first (y + → X + β ) implies that the concurrent parts of both streams finish along with Y k .Therefore, according to line 3.2 of Table 4, the remaining subsets Q R c c ∈ X β will become the last subsets Q T d d ∈ ES Θ .In the example of Figure 8, the last subsets Q T d d are the subsets Q T 9 9 , Q T 10 10 and Q T 11 11 .Case B. X β finishes before Y k .The fact that the eventstreaming X β finishes first (X + β → y + , y + ∈ Y k ) means that the concurrent parts of both streams finish along with the event-streaming X β .After the last subset Q T c c ∈ ES Θ was constructed with the concurrent events of X β and Y k , only one more subset Q T d d is constructed according to line 3.3 of Table 4.Such subset Q T d d will contain the remaining events of the local-stream Y k .In the example of Figure 9, the last subset Aligning the last subsets of events without concurrences when y + → X + β .
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 ES Θ is a finite collection of disjoint subsets Q T q q arranged one after another without interruption.This arrangement of subsets Q T q q in an ES Θ allows us to establish a relative time-line, where each subset Q T q q represents a unique time-slot.The fact that the Figure 9: Aligning the last subsets of events without concurrences when q are disjoint implies that each event in an eventstreaming belongs to a unique subset Q T q q , and therefore it is located at a specific time-slot.

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 event-streaming 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 1 The arrangement of subsets Q R q q in an eventstreaming establishes a virtual time-line, where each subset Q R q q represents a unique time-slot and each event belongs to a unique time-slot.
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 Q R q q 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 timeline, we formulate and prove the following Lemma: Lemma 1 An event-streaming is a causal arrangement of subsets of events that establishes a time-line.
Before proving Lemma 1, we need to consider the following.Definition 8 states that a local-stream is a poset (S i , →), where S i is a set of atomic events generated by the same process.Thus, (S i , →) is a sequence The fact that the events of S i are arranged by → implies that each event happens before another at a different instant, which determines a chronologically order.Therefore, a local-stream S i represents a time-line for a process i.
Proof of Lemma 1 We demonstrate Lemma 1 by a direct proof.According to the ES-LM (Tables 2, 3 and 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 R u −1 u−1 and Q R u u .Let Y c be a local-stream and let X denote a local-stream or an event-streaming such that ∀x − ∈ X, ∃y − ∈ Y c : x − → y − .Assuming that e * (e * ∈ Y c or e * ∈ X) is the endpoint (e * = y − ∨ e * = y + ∨ e * = x + ), whose identification triggered the segmentation, In each of these three cases, happened-before relationships are established among the left endpoints of Q R u −1 u−1 and the right endpoints of Q R u u .This means that for a pair of subsets Furthermore, all the events that compose Q R u −1 u−1 and Q R u u are extracted from local-streams by preserving their causal order.Thus, let ω i and ω + i be two events such that ω i , ω By the transitive property of the HBR we have that Thus the subsets of an event-streaming are chronologically ordered representing a time-line, where each subset Q R q q is a time-slot.□ Part II.To demonstrate that each subset Q R q q in an eventstreaming represents a unique time-slot, we formulate and prove the following Lemma: q represents a unique time-slot, therefore, any pair of subsets Q R u u and Q R v v , that compose an event-streaming ES Θ , is disjoint.
Proof of Lemma 2 We prove Lemma 2 by contradiction.Therefore, we suppose that According to the ES-LM model, the subsets Q R 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 R u u must be related to another Q R v v (u v) according to one of the five logical mappings described in Table 2.This means that for any e µ ∈ Q R u u and any , implies that x µ → x µ is a contradiction, according to the assumptions by which the happened-before relation are defined (systems in which an event can happen before itself do not seem to be physically meaningful).□

Simulation results
We have simulated the temporal data alignment model for event-streaming using the Castalia simulator [5].The simulation scenario is within a set of 50 nodes that were arranged into multi-hop paths, where the nodes are separated by distances between 5 and 10 meters in a field of 200 × 200 meters.Through each multi-hop path, a node reaches the sink helped 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 n r nodes behind a node p i , p i aligns at most n r streams.
For the simulation, we implemented the model using the well-known vector clock structure [16,7] to identify and preserve the causal relations among events.Therefore, we obtain a computational cost as well as communication and storage overheads of O(n r ), where n r 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: begin and end, and a type of FIFO message: f i f o p which does not carry any causal information.So, a process p i generates a local-stream S i by sending a begin message (S − i ) followed by certain number of f i f o p messages.Finally, to notify a process p j that the transmission of the local-streaming has been finished, the process p i sends an end message (S + i ).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 begin 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 i to transmit the causal message m(p i , α) (begin or end), and let e * ρ be the send event executed by process p j to transmit m(p j , ρ), which is the latest aligned message before the reception of m(p i , α); when p j receives m(p i , α), the synchronization error of a pair of local-streams is determined by the difference between the sampling time of m(p i , α) and m(p j , ρ).
For example, in the scenario depicted in Figure 10, process p i sends the message m(p i , α) to p j , which indicates the beginning of the local-stream S i .Assuming that p j is generating the local-stream S j , the synchronization error between S i and S j is determined by the difference between the sampling time of m(p i , α) and the sampling time of m(p j , ρ).Thus, by considering the simulation time as a global clock, the synchronization error is estimated by using the following formula: where ε j is the synchronization error measured at process p j and T S x is a sample time at process p x .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.

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 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 take place at most at ε j (e * α , e * ρ ) units of time one with respect to  the another.This result is achieved as follows.When p j 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, a pair of endpoints (e * α , e * ρ ) is related at p j 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.
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-tonoise 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 p j is much larger than the maximum transmission delay of the current hop.

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 time-line 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 multi-hop communication.The simulation results show that the synchronization error is bounded according to the transmission delay.

A Conflict of interests
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 article.

Figure 2 :
Figure 2: Representation of the subsets of an eventstreaming.

Figure 3 :
Figure 3: Aligning the first subset of the first eventstreaming.

Figure 4 :
Figure 4: Aligning the second subset of the first eventstreaming.

Figure 5 :
Figure 5: Aligning the last subset of the first eventstreaming.(a) X c finishes first (b) Y d finishes first.

. 3 B. 3
Aligning the last subsets of events without concurrences This stage is explained through two cases.Case A. Y k finishes before X β .If at the end of stage B.2, the last subset Q R b b was segmented, the second created subset, denoted as Q T d d , will contain the remaining nonconcurrent events of Q R b b (see line 3.1 of Table constructed according to one of the three following cases:1.if e * ∈ Y c , e * = y − , and x − → y − then Q R u −1 u−1 = {x ∈ X : delivery(p c , x) → send(e * )} and Q R u u = {e * } ∪ {x ∈ X : send(e * ) → delivery(p c , x)} ∪ {y ∈ Y c : send(y) → delivery(p c , x + )};2.if e * ∈ X, e * = x + , andx + → y + then Q R u −1 u−1 = {e * } ∪ {x ∈ X : delivery(p c , x) → delivery(p c ,e * )} ∪ {y ∈ Y c : send(y) → delivery(p c , e * )} and Q R u u = {y ∈ Y c : delivery(p c , e * ) → send(y)}; 3. if e * ∈ Y c , e * = y + , and y

Figure 10 :
Figure 10: Example of the alignment of causal messages.

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

Table 1 :
Logical mappings expressed by endpoints

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

Table 2 :
Event-streaming logical mapping Data alignment for event-streaming ES logical mappings