
Handling Time and Reactivity for Synchronization and Clock Drift Calculation in Wireless Sensor/Actuator Networks Marcel Baunach Graz University of Technology, Institute for Technical Informatics, Graz, Austria Keywords: Event Timestamping, Reaction Scheduling, Time Synchronization, Clock Drift Calculation, Information Tagging. Abstract: The precise temporal attribution of environmental events and measurements as well as the precise schedul- ing and execution of corresponding reactions is of utmost importance for networked sensor/actuator systems. Apart, achieving a well synchronized cooperation and interaction of these wirelessly communicating dis- tributed systems is yet another challenge. This paper summarizes various related problems which mainly result from the discretization of time in digital systems. As an improvement, we’ll present a novel technique for the automatic creation of highly precise event timestamps, as well as for the scheduling of related (re- )actions and processes. Integrated into an operating system kernel at the lowest possible software level, we achieve a symmetric error interval around an average temporal error close to 0 for both the timestamps and the scheduled reaction times. Based on this symmetry, we’ll also introduce a dynamic self-calibration technique to achieve the temporally exact execution of the corresponding actions. An application example will show that our approach allows to determine the clock drift between two (or more) independently running embedded systems without exchanging any explicit information, except for the mutual triggering of periodic interrupts. 1 INTRODUCTION nally obtained values in order to properly correlate the contained information, and to trigger adequate re- Wireless sensor/actuator networks (WSAN) are com- actions. In fact, measured or otherwise obtained en- monly deployed to observe and interact with their en- vironmental information is often useless unless it is vironment. In this respect, temporal and spatial in- associated with temporal and spatial information. formation are the two most fundamental measures for This paper starts with a discussion of various the “attribution” or “tagging” of states and events (i.e. problems regarding time in digital systems. Next, we state transitions) within any observed environment. In present a novel approach for taking timestamps, for this context, the states describe a set of physical and measuring and specifying temporal delays, and for logical conditions at a given position and at a certain scheduling and ensuring reaction times with a sym- time, and they are specified by one or more continu- metric temporal error around 0. Finally, a real-world ous or discrete state values. test bed shows how periodically communicating em- bedded systems can determine their relative clock Recorded over a certain period of time, variations drifts without any additional information exchange. in the state values allow the detection and analysis of events and event patterns within the environment (Wittenburg et al., 2010) (Romer,¨ 2008). These vari- ations do not only indicate the events’ spatial extend, 2 TIME IN DIGITAL SYSTEMS propagation speed, and influence on the environment, but most commonly they also allow the prediction of In contrast to specific position vectors and state values future states for both the observing system and its sur- of e.g. sensor nodes (which can change sporadically, rounding. In this regard, the interaction with the envi- arbitrarily and independently from each other), time ronment, which we already proclaimed to be the most is a common property. It is system independent, and central objective in sensor/actuator systems, typically advances continuously with a globally constant rate requires the precise knowledge of time and space to of change. If the sensor nodes manage to establish a be associated with a node’s self-captured and exter- network-wide and consistent notion of time, this in- Baunach M.. 63 Handling Time and Reactivity for Synchronization and Clock Drift Calculation in Wireless Sensor/Actuator Networks. DOI: 10.5220/0004680400630072 In Proceedings of the 3rd International Conference on Sensor Networks (SENSORNETS-2014), pages 63-72 ISBN: 978-989-758-001-7 Copyright c 2014 SCITEPRESS (Science and Technology Publications, Lda.) SENSORNETS2014-InternationalConferenceonSensorNetworks formation provides a natural base for their joint inter- applied “delta time” is constant and won’t adapt to action and with the environment. Since processors in changing system loads as well. synchronous digital systems like sensor nodes are al- In the following we’ll indicate and discuss the ways driven by a clock generator C with frequency fC causes and effects of the mentioned problems in de- 1 and period lC = , time and time intervals can easily tail, and present an approach at the kernel level to re- fC and individually be measured – at least in theory: If it liably compensate the related imprecision in the aver- is possible to count the number of elapsed clock peri- age case. ods since a well defined point in time, e.g. the system start, each captured event e, e.g. indicated by an inter- Problem P1: Discretization of time. The differ- rupt, can be attributed with its current counter value ence between the true global time t0 and the individual ce. Consequently, the event’s absolute local system system time t˜ has already become visible in Eq. (1) time t˜e can easily be recovered by and Eq. (4). While the first advances continuously, the use of a digital counter leads to a discretization of t˜e := ce ·lC; (1) the latter, and imposes a resolution which directly de- ˜ and the time difference (i.e. the delay) De1;e2 between pends on the counter’s clock frequency fC. This may two events e1;e2 computes as lead to serious systematic errors for the time measure- ment and the subsequent scheduling of reactions: D˜ e ;e := t˜e −t˜e = (ce − ce )·lC: (2) 1 2 2 1 2 1 The simple capturing of a timestamp t for an event ˜ Obviously, both the time t˜e and the delay De1;e2 al- – the so called timestamping – is immediately affected ready involve a concept-inherent imprecision caused by some inevitable rounding, and suffers from a mea- by the discretized counter values ce 2 N. In addition, surement error Et 2 I1 with jI1j = lC. For the na¨ıve we silently assumed for Eq. (1) and Eq. (2) that lC is and adverse reading of the timer counter, rounding perfectly known and constant. Neither is true under down results in I1 := [0;lC), and induces a symmetry 1 real-world conditions, and leads to well-known prob- around the average measurement error Et;av = 2 lC. lems, we’ll address and counteract in this paper. Depending on the use of such timestamps, the emerg- Furthermore, as often requested for interactive ing errors might accumulate during the system run- systems, a reaction r can be scheduled for a captured time. Similarly, the explicit specification of delays 0 R 0 event e. Its intended execution time tr 2 is com- Dt in software is also subject to rounding errors ED. 0 R monly related to any event timestamp te 2 by the However, we can round half up (e.g. according to 0 R specification of a corresponding delay De;r 2 : DIN 1333) manually when selecting a delay, and thus 1 1 the corresponding error is ED 2 I3 := [− lC;+ lC). t0 = t0 + D0 (3) 2 2 r e e;r Though not avoidable entirely, I3 is at least symmetric However, in the best case, i.e. if the (operating around 0, and the average error is 0. system) scheduler permits the timely switch to the re- Based on these two fundamental error intervals sponding task’s context, the reaction will be triggered I1 and I3, other intervals can be derived, and con- upon reaching the corresponding counter value cr 2 N sequently exhibit an imprecision, too: For the mea- and the corresponding system time t˜r. In any case, the surement of delays DE , we see the implicit compen- finally observable reaction delay depends on the res- sation of the asymmetry in I1: ED 2 I2 := I1 − I1 = olution lC of the system timer: (−lC;+lC). In contrast, the scheduling of reaction 0 0 times t on external events inherits the asymmetry in I1: D D 1 3 e;r e;r Et 2 I4 := I1 + I3 = [− lC;+ lC). System reactions cr = ce + t˜r = t˜e + ·lC (4) 2 2 lC lC will consequently suffer from an average systematic 1 Although the inherent rounding imprecision is lateness of 2 lC. quite intuitive and introduces various hidden imple- Table 1 summarizes the error types and their cor- mentation problems in real systems, it is commonly responding intervals which must be expected for the simply ignored. Moreover, for concurrent task sys- na¨ıve capturing of timestamps by simply reading the tems with dynamic execution flows, there is an addi- timer register after the corresponding event occur- rence (e.g. within an IRQ handler). The resulting ef- tional error in t˜r which is neither constant nor pre- dictable. Since most embedded operating systems fects, and our proposed solution to compensate this silently accept even this problem, application devel- asymmetry, will be discussed later. opers are urged to compensate the imprecision with little control at the task level. SensorOS (Kuorilehto Problem P2: Capturing of timestamps. The cre- et al., 2007) at least tries to execute reactions in time ation of reactive systems demands for the precise by scheduling the responsible task earlier. Yet, the assignment of timestamps for internal and external 64 HandlingTimeandReactivityforSynchronizationandClockDriftCalculationinWirelessSensor/ActuatorNetworks Table 1: Error intervals for different discretization techniques (system time resolution: lC). Na¨ıve discretization Our discretization approach problem / error type derived from error interval symmetry error interval symmetry 1 1 1 P1: capturing of fundamental I1 = [0;lC) E 2 lC E I3 = [− 2 lC;+ 2 lC) 0 timestamps P2: measurement of I1 − I1 I2 = (−lC;+lC) 0 I2 = (−lC;+lC) 0 delays 1 1 1 1 P3: specification of fundamental I3 = [− 2 lC;+ 2 lC) 0 I3 = [− 2 lC;+ 2 lC) 0 delays 1 3 1 P4: scheduling of I1 + I3 I4 = [− 2 lC;+ 2 lC) E 2 lC E I4 = [−lC;+lC) 0 reaction times events.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages10 Page
-
File Size-