Documente Academic
Documente Profesional
Documente Cultură
v
Abstract
Wireless sensor networks (WSN) are predicted to play a key role in future technological
developments like the internet of things. Already they are beginning to be used in
many applications not only in the scientific and industrial domains. One of the biggest
challenges, when using WSNs, is to fuse and evaluate data from different sensor nodes.
Synchronizing the data acquisition of the nodes is a key enabling factor for this. So far
research has been focused on synchronizing the clocks of the nodes, largely neglecting
the implications for the actual measurement results.
This thesis investigates the relation between synchronization accuracy and quality of
measurement results. Two different classes of time synchronous data acquisition are
investigated: event detection and waveform sampling. A model is developed that de-
scribes a WSN as a generic multi-channel data acquisition system, thus enabling direct
comparison to other existing systems. With the help of this model it is shown, that syn-
chronization accuracy should best be expressed as uncertainty of the acquired timing
information. This way, not only the contribution of the synchronization to the over-
all measurement uncertainty can be assessed, but also the synchronization accuracy
required for an application can be estimated.
The insights from the uncertainty analysis are used to develop two distinct approaches
to synchronous data acquisition: a proactive and a reactive one. It is shown that the
reactive approach can also be used to efficiently implement synchronous angular sam-
pling, i.e. data acquisition synchronous to the rotation of a machine’s shaft. Further-
more, testing methods are suggested, that evaluate the synchronized data acquisition of
an existing WSN as a whole. These methods can be applied to other data acquisition
systems without changes, thus enabling direct comparisons.
The practical realization of a WSN is described, on which the developed data acqui-
sition methods have been implemented. All implementations were thoroughly tested
in experiments, using the suggested testing methods. This way it was revealed, that a
system’s interrupt handling procedures may have a strong influence on the data acquisi-
tion. Furthermore, it was shown that the effective use of fixed-point arithmetic enables
synchronous angular sampling in real-time during a streaming measurement. Finally,
two application examples are used to illustrate the utility of the implemented data ac-
quisition: the acoustic localization of two sensor nodes on a straight line and a simple
order tracking at an induction motor test bench.
vii
Kurzfassung
viii
Contents
1. Introduction 1
1.1. Thesis structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2. Thesis contribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Literature review 5
2.1. Wireless sensor networks . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.1. Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.2. Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1.3. Network topologies . . . . . . . . . . . . . . . . . . . . . . . . 16
2.1.4. Network protocols . . . . . . . . . . . . . . . . . . . . . . . . 18
2.1.5. Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.2. Time synchronization protocols . . . . . . . . . . . . . . . . . . . . . . 28
2.2.1. Classes of synchronization . . . . . . . . . . . . . . . . . . . . 28
2.2.2. Building blocks of synchronization protocols . . . . . . . . . . 30
2.2.3. Evaluation of synchronization protocols . . . . . . . . . . . . . 35
2.2.4. Synchronization protocols for wireless sensor networks . . . . . 36
2.2.5. Synchronization protocols in other domains . . . . . . . . . . . 40
2.2.6. Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.3. Data Acquisition with wireless sensor networks . . . . . . . . . . . . . 44
2.3.1. Data acquisition . . . . . . . . . . . . . . . . . . . . . . . . . 45
2.3.2. Time synchronous data acquisition . . . . . . . . . . . . . . . . 48
2.3.3. Wireless sensors and smart sensors . . . . . . . . . . . . . . . 49
2.3.4. Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.4. Synchronous angular sampling . . . . . . . . . . . . . . . . . . . . . . 52
2.4.1. Significance and applications . . . . . . . . . . . . . . . . . . . 52
2.4.2. Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
2.5. Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3. Theoretical foundations 59
3.1. Time and synchronization . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.1.1. Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.1.2. Clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.1.3. Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.1.4. Generalized time . . . . . . . . . . . . . . . . . . . . . . . . . 63
ix
Contents
4. Modeling 99
4.1. System model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
4.1.1. Event detection . . . . . . . . . . . . . . . . . . . . . . . . . . 99
4.1.2. Waveform sampling . . . . . . . . . . . . . . . . . . . . . . . 100
4.2. Acquisition errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
4.2.1. Event detection . . . . . . . . . . . . . . . . . . . . . . . . . . 101
4.2.2. Waveform sampling . . . . . . . . . . . . . . . . . . . . . . . 106
4.2.3. Specification of synchronization precision . . . . . . . . . . . . 113
4.3. Estimation of the required synchronization precision . . . . . . . . . . 113
4.4. Approaches to time synchronous data acquisition . . . . . . . . . . . . 114
4.4.1. Event detection . . . . . . . . . . . . . . . . . . . . . . . . . . 115
4.4.2. Waveform sampling . . . . . . . . . . . . . . . . . . . . . . . 115
4.5. Approaches to synchronous angular sampling . . . . . . . . . . . . . . 116
4.6. Testing data acquisition systems . . . . . . . . . . . . . . . . . . . . . 118
4.6.1. Synchronous event detection . . . . . . . . . . . . . . . . . . . 118
4.6.2. Synchronous waveform sampling . . . . . . . . . . . . . . . . 119
4.6.3. Synchronous angular sampling . . . . . . . . . . . . . . . . . . 121
5. Implementation 123
5.1. Wireless sensor network for experiments . . . . . . . . . . . . . . . . . 124
5.1.1. Sensor nodes . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
5.1.2. Execution environment . . . . . . . . . . . . . . . . . . . . . . 128
5.1.3. TDMA-protocol . . . . . . . . . . . . . . . . . . . . . . . . . 134
5.1.4. Data acquisition framework . . . . . . . . . . . . . . . . . . . 135
5.1.5. Application transducers . . . . . . . . . . . . . . . . . . . . . 147
5.1.6. Installation at induction motor test bench . . . . . . . . . . . . 157
5.2. Time synchronous data acquisition . . . . . . . . . . . . . . . . . . . . 159
5.2.1. Synchronization services . . . . . . . . . . . . . . . . . . . . . 159
5.2.2. Event detection . . . . . . . . . . . . . . . . . . . . . . . . . . 165
5.2.3. Waveform acquisition . . . . . . . . . . . . . . . . . . . . . . 165
x
Contents
6. Experiments 181
6.1. Wireless sensor network . . . . . . . . . . . . . . . . . . . . . . . . . 181
6.1.1. Power consumption . . . . . . . . . . . . . . . . . . . . . . . . 181
6.1.2. Data throughput . . . . . . . . . . . . . . . . . . . . . . . . . 188
6.2. Time synchronous event detection . . . . . . . . . . . . . . . . . . . . 192
6.2.1. Experimental setup . . . . . . . . . . . . . . . . . . . . . . . . 193
6.2.2. Relative drift of clocks . . . . . . . . . . . . . . . . . . . . . . 194
6.2.3. Synchronization precision . . . . . . . . . . . . . . . . . . . . 195
6.2.4. Power consumption . . . . . . . . . . . . . . . . . . . . . . . . 203
6.2.5. Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
6.3. Application example: acoustic localization . . . . . . . . . . . . . . . . 205
6.3.1. Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
6.3.2. Estimation of required synchronization accuracy . . . . . . . . 206
6.3.3. Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
6.3.4. Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
6.3.5. Uncertainty analysis . . . . . . . . . . . . . . . . . . . . . . . 212
6.3.6. Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
6.4. Time synchronous waveform acquisition . . . . . . . . . . . . . . . . . 217
6.4.1. Experimental setup . . . . . . . . . . . . . . . . . . . . . . . . 217
6.4.2. Signal quality . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
6.4.3. Missing samples . . . . . . . . . . . . . . . . . . . . . . . . . 224
6.4.4. Power consumption . . . . . . . . . . . . . . . . . . . . . . . . 225
6.4.5. Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
6.5. Synchronous angular sampling . . . . . . . . . . . . . . . . . . . . . . 227
6.5.1. Analysis of measurement chain for angular sampling . . . . . . 227
6.5.2. Test of resampling algorithms . . . . . . . . . . . . . . . . . . 231
6.5.3. Acquisition of generated signals . . . . . . . . . . . . . . . . . 236
6.5.4. Data acquisition at motor test bench . . . . . . . . . . . . . . . 240
6.5.5. Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Bibliography 263
xi
Contents
Appendix 285
A. Sensor Nodes 287
xii
Nomenclature
Notations
Notation Description
E ( x) expectation value of random variable x
Qm.n Q-format of a fixed-point number
Var ( x) variance value of random variable x
X ( jω) Fourier transform of x(t )
∆x systematic error in x
∆x difference in x
x̄ empirical mean of x
δx random error in x
ϵx error in measurement of x
{ }
F x(t ) Fourier transform of x(t )
O( f ( x)) Bachmann–Landau notation, i.e. grows asymptotically like f ( x)
σx true standard deviation of x
X matrix
x vector
x̂ estimate or measurement value of x
x̃ value or measurement for x that is afflicted by error
a{b event a happened before event b
f ( x) mathematical function
fX probability density function of random variable X
sx empirical standard deviation of x
ux standard measurement uncertainty of x
x′ modified version of x′ /quantity similar to, but different from x
x(t ) continuous time signal
x[n] discrete time signal
xn nth member of a set of values
xiii
Symbols
Symbols
xiv
Symbol Description Unit
ρ clock drift ppm
σ true standard deviation
ϑ temperature °C
c(t ) clock s
ci sensitivity factor of uncertainty contribution arb
fg filter 3 dB-cutoff frequency Hz
fϕ angular rate 1/rev
f frequency Hz
hc counter of a clock
h impulse response of a LTI-system
k coverage factor of uncertainty
l counting index
nrot rotational speed rpm
n counting index
pt p-value of a t-test
p clock precision s
q numeric resolution or counting index
s empirical standard deviation
t time instant s
uc combined standard uncertainty arb
u standard uncertainty arb
v sound speed of sound m/s
v degrees of freedom
w white noise arb
x generic quantity or signal arb
Abbreviations
xv
Abbreviations
xvi
Abbreviations
xvii
Abbreviations
PC personal computer
PCB printed circuit board
PI proportional-integral
PHY physical layer
PLL phase-locked loop
PLC power-line-cycle
PPG Photoplethysmogram
PPS one pulse per second
PTP Precision Time Protocol
RAM random access memory
RBS Reference Broadcast Synchronization
RC resistor-capacitor circuit/oscillator
RDC radio duty-cycling
rev revolution
RF radio frequency
RFD reduced-function device
RITS Routing Integrated Time Synchronization
RMS root-mean-square value
RMSE root-mean-square error
RPL Routing Protocol for Low-Power and Lossy Networks
RTC real-time clock
RTP Real-Time Transport Protocol
RTSI Real-Time System Integration bus
SAR successive approximation ADC
SCTS Self-Correcting Time Synchronization
S&H sample-and-hold
SI International System of Units
SINAD signal-to-noise and distortion ratio
SNMP Simple Network Management Protocol
xviii
Abbreviations
xix
1. Introduction
Wireless sensor networks (WSN) are networks of small, low-cost sensing devices
with integrated processing capabilities that communicate wirelessly with each other
[64, 138, 50]. They are seen as a key component in technological visions like ambient
intelligence [64], the internet of things [128] or cyber-physical systems [80]. Already
a broad spectrum of applications for WSNs has been explored in areas including envi-
ronmental monitoring, health care, home automation, condition monitoring, industrial
automation and scientific data acquisition [64, 138, 50].
The key advantage of WSNs is the ease of installation and extension that arises from
not having to lay cables [64, 81, 113, 63, 59]. The resulting reduction in working
time together with reduced material usage can lead to significant cost reductions [64,
63]. Furthermore, digitizing and processing sensor data directly at the spot, where it
is acquired, can increase its quality as well as its utility. Other advantages of WSNs
are the mobility of the wireless sensing devices [64] and the possibility to easily extend
their capabilities through software updates [63].
WSNs are a comparatively new research topic, with only few publications before the
year 2000 [138]. However, in the last 16 years, WSNs have enjoyed strongly increas-
ing attention from scientist and science funding bodies [138]. WSNs are an inherently
multidisciplinary area of research. The topics involved range from the miniaturization
of electronic components over energy storage, low power electronics, radio communi-
cation and software design to measurement data processing and user interaction [64].
One of the biggest challenges, when using WSNs, is to efficiently combine and process
the measurements from multiple sensor nodes. Knowing the time relation between
data from different nodes is a prerequisite for deriving a consistent observation of the
environment. Therefore, synchronizing the data acquisition of multiple nodes is of key
importance. So far, a lot of research effort has been put into accurately and efficiently
synchronizing the clocks of wireless sensor nodes [79, 119, 64]. However, the effect
of the synchronization accuracy on the quality of measurement results has hardly been
studied. Not even a commonly accepted measure of synchronization accuracy seems
to exist. Furthermore, the focus on synchronizing clocks has occluded the fact, that in
many applications it is more important to synchronize to external events or processes.
An example of this is the angular position of a rotation machine in synchronous angular
sampling.
1
1. Introduction
The goal of this thesis is to investigate key metrological aspects of synchronous data
acquisition with WSNs, especially the relation between synchronization accuracy and
quality of measurement results. The results of this investigation are used to optimize
strategies for time synchronous data acquisition. Furthermore, the strategies for time
synchronous sampling are generalized, in order to enable synchronous angular sam-
pling on a WSN. A focus is put on applications in the scientific and industrial domains.
As WSNs are a very multidisciplinary topic, this thesis aims to be understandable to
readers from various backgrounds in engineering and computer science. Therefore,
fundamental concepts from the individual disciplines are briefly introduced before their
usage.
2
1.2. Thesis contribution
Furthermore, the installation of the WSN at an induction motor test bench is presented.
Finally, the implementations of time synchronized data acquisition and synchronous
angular sampling on the WSN are described in detail.
Chapter 6 - Experiments
The experiments, which were done to characterize the implementations of synchronous
data acquisition, and their results are presented in this chapter. First, the data throughput
and power consumption of the WSN are investigated. Next, the synchronous event
timestamping of the WSN is examined and used for the acoustic localization of sensor
nodes. Furthermore, experimental results for synchronous waveform acquisition with
the WSN are discussed. The chapter concludes with synchronous angular sampling
experiments on simulated signals as well as at an induction motor test bench.
Chapter 7 - Conclusions and outlook
This chapter summarizes and discusses the key results of the investigations. As a re-
sult of this discussion, answers to the guiding questions of this thesis are formulated.
Finally, possible directions for new research following this thesis are outlined.
3
1. Introduction
4
2. Literature review
This chapter presents a review of the literature on synchronous data acquisition with
wireless sensor networks. An overview of the currently available hard- and software
as well as the state-of-the-art protocols is given in section 2.1. Due to their special
relevance to the purpose of this thesis time synchronization protocols are reviewed sep-
arately in section 2.2. Section 2.3 gives an overview of current applications and solu-
tions for data acquisition with wireless sensor networks. The literature on a special type
of synchronized data acquisition: synchronous angular sampling is reviewed in section
2.4. Finally the conclusions that can be drawn from the literature review are presented
in section 2.5.
Wireless sensor networks (WSNs) are defined by most authors as networks of small,
low-cost devices with sensing, processing and communication capabilities [64, 138,
50]. Despite the literal meaning of the term, it is generally understood that they can also
contain actuator components [64]. This section gives an overview of the state-of-the-art
in WSNs regarding hardware, software and protocols with a focus on applications in
the scientific and industrial domain.
2.1.1. Hardware
The electronic devices that form WSNs are called wireless sensor nodes, motes or sim-
ply sensors [50]. In [64], their main components are named as: sensor and actuator
circuits, microprocessor, wireless communication interface and power supply. Within
the past years many different hardware platforms for wireless sensor nodes have been
developed. Overviews of the platforms used by the scientific community can be found
in [10, 184, 166]. A review of different platforms for the use in industrial applications
can be found in [59].
The sensor nodes used by the scientific community are often just bare printed circuit
boards (PCBs) and do not include a power supply or actual sensing circuits. The pur-
pose of these nodes is to serve as basic test systems in a lab environment. Alternatively,
5
2. Literature review
they can be used as a generic basis for building application specific sensor nodes. Of
those basic general purpose nodes, the family of mica nodes, originally developed at
the university of Berkeley and later marketed by Crossbow and Memsic inc., have been
amongst the most widely used [184, 64, 138, 50, 56, 87, 77, 42]. The Tmote Sky sensor
nodes [183] have served as a reference platform for the Contiki operating system [186]
for a long time. Now, nodes like the Z1 [192] or econotag [167] gradually replace
them [186]. Other sensor nodes used by the scientific community are the GINA [92]
and MANTIS [13] nodes. Examples of sensor nodes developed at German universi-
ties are the SPISA (Technische Universität Berlin) [117, 181], ESB (Freie Universität
Berlin) [50] and INGA [171] nodes (Technische Universität Braunschweig) nodes. In
recent years an increasing number of sensor nodes using ARM’s Cortex-M3 core have
emerged, e.g. the Preon32 [179] or OpenMote-CC2538 [176].
Table 2.1 shows the key features of typical general purpose nodes. A more comprehen-
sive table of sensor nodes is provided in appendix A (tables A.1 to A.3). Unfortunately,
different manufacturers specify the power consumption for different operational condi-
tions. Likewise, sensor nodes do contain a differing amount of components, e.g. the
MicaZ includes a battery holder, whereas the Preon32 does not even include a volt-
age regulator. Thus, the numbers for power supply and dimensions merely illustrate
the range that can be found, but are not well suited for direct comparisons between
individual nodes.
Apart from the general purpose sensor nodes, application specific sensor nodes have
been developed in research projects (see table 2.2). Examples are the sensor node
developed for condition monitoring in the ECoMoS project [63] or a pulseoximeter
developed by the chair of Electronics and Medical Signal Processing (EMSP) at the
TU Berlin [108]. Examples of commercial sensor nodes that are tailored to specific
applications are the wireless temperature sensor STM 330 by EnOcean and the wireless
data acquisition module WSN-3202 by National Instruments.
Based on the properties of the sensor nodes described above as well as literature on
WSNs the common properties of the key components: controller, communication in-
terfaces, clocks, sensing hardware and power supply will be given in the following.
6
2.1. Wireless sensor networks
7
2. Literature review
8
2.1. Wireless sensor networks
2.1.1.1. Controller
Wireless sensor nodes almost exclusively use microcontrollers that have a Harvard ar-
chitecture [130]. They contain a central processing unit (CPU), non-volatile program
memory (FLASH), volatile data memory (RAM) as well as a number of peripheral
units, like analog-to-digital converters (ADCs), timers or digital communication inter-
faces. The microcontrollers used tend to be small, low-cost and low-power models.
In the past 8 bit microcontrollers like those of the AVR family from Atmel and 16 bit
microcontrollers like those of the MSP430 family from Texas Instruments were used
almost exclusively. Their processor clock was typically in the range of 4–16 MHz.
Memory sizes were in the range of 2–16 kB for the RAM and 48–256 kB for the
FLASH. Typical examples of this class of sensor nodes are the Micaz [173], Tmote
Sky [183] or Z1 [192] sensor nodes. Despite some authors predicting that the ad-
vances in computer technology would not lead to more capable sensor nodes [130],
there has been a trend towards more powerful microcontrollers in recently developed
sensor nodes. They are mostly based on low-power ARM processors with Cortex-M3
core and feature processor clocks of up to 72 MHz, RAM sizes of up to 96 kB and
FLASH sizes of up to 512 kB. Examples are the econotag [167], Preon32 [179] or
OpenMote-CC2538 [176].
Most microcontrollers have a power consumption in the range of several 10 mW when
operating, but can reduce it to 1–100 µW by entering a sleep-mode. Most microcon-
trollers offer a set of different sleep modes that allow the user to select the remaining
functionality. An analysis given in [63] shows that using a more potent microcon-
troller may result in a lower overall power consumption because calculations are fin-
ished quicker and the node can rest longer in sleep-mode. In other words, more potent
microcontrollers often have a better efficiency in terms of energy per executed instruc-
tion [63].
The second essential component of a wireless sensor node is its wireless communica-
tion interface. In most cases it uses electromagnetic waves in the radio frequency (RF)
spectrum as a transmission medium 1 . See section 2.1.4.1 for a discussion of transmis-
sion standards and frequency bands.
Most wireless sensor nodes, e.g. the MicaZ [173] and Preon32 [179], use dedicated
transceiver chips. These transceivers take care of the low level communication, like
modulation and demodulation. They usually contain a buffer for incoming as well
as outgoing data and have a digital interface over which the controller can read and
1 Examples of other transmission media are sound and ultrasound waves as well as infrared and visible light
pulses [64].
9
2. Literature review
write entire data packets. In some cases this functionality is already implemented as an
additional peripheral on the microcontroller, e.g. in the OpenMote [176].
There is a wide consensus that the wireless transceiver has a major influence on a node’s
total power consumption [64, 130, 34, 63]. In [64] it is stated that transceivers typically
consume about 20 . . . 30 mW when transmitting, but the power actually radiated is only
about 1 mW, i.e. the energy cost of signal processing clearly outweighs that of the
actual transmission. Furthermore, the power consumption during reception may even
be higher than during transmission: typically 10 . . . 40 mW. Shucker et al. [130] state
that the energy cost of transmitting one bit is approximately one thousand times higher
than that of processing a bit. A similar statement is made in [112]: transmitting 1 Kb
over 100 m and executing 3 million instructions require the same amount of energy.
This is echoed by the findings reported in [59] that calculating the fast Fourier transform
(FFT) on a wireless sensor node and only transmitting the frequency limes of interest
can save over 98 % of energy compared to transmitting the entire raw data.
Apart from the wireless communication interface wireless sensor nodes have a number
of wired interfaces that enable them to communicate with other devices like external
sensors or computers. Simple digital interfaces like a universal asynchronous receiver
transmitter (UART), a serial peripheral interface (SPI) or an interface for the I2C-bus
are present on nearly all sensor nodes (compare table 2.1). But also more complex
interfaces like USB or CAN-Bus can be found, e.g. on the Preon32 node.
2.1.1.3. Clocks
Wireless sensor nodes need a stable clock signal for time keeping, to run the processor
and for the wireless communication. The oscillator circuits used to generate it are
mostly crystal- or RC-oscillators and less frequently MEMS-resonators [137].
Crystal-oscillators have a frequency stability in the range of 1–100 ppm [137]. How-
ever, their power consumption is relatively high and rises with the clock frequency.
RC-oscillators are much cheaper and require less power [137]. Furthermore, they can
be integrated into the silicon chip of the microcontroller enabling smaller sensor nodes.
Yet their frequency stability is only in the order of several 1000 ppm.
As a consequence, many sensor nodes use a separate 32 kHz crystal oscillator for time
keeping, e.g. the Inga [171] and Preon32 [179] nodes. This makes it possible to
turn off the high-frequency clock of the processor during sleep modes to minimize
the power consumption. Another possibility is to run the processor from a less stable
RC-oscillator, thus saving power without losing accuracy for time keeping. This also
speeds up the wake-up from sleep modes because RC-oscillators need less time to start
than crystal oscillators [137].
10
2.1. Wireless sensor networks
The actual sensors used in wireless sensor nodes are highly application specific and
generally the same that are used in other sensing devices, e.g. thermocouples in [39] or
MEMS accelerometers in [80]. According to [149] the cost for the sensors can easily
surpass that of the rest of the node hardware. The controllers of wireless sensor often
contain a number of peripheral modules that help interfacing to sensor circuits.
One of the most important is the ADC, which can be used to digitize analog volt-
ages. The ADCs in wireless sensor nodes are mostly successive approximation (SAR)
types with a resolution of 10–12 bit and a maximum sampling rate in the order of 10–
100 ksamples/s, in some cases up to 1 Msamples/s (see table 2.1). Furthermore, the con-
trollers usually contain a number of timer modules, which can be used to measure
times. They are 8–32 bit wide and can be clocked through a variable prescaler either
directly from the processor clock or from an external oscillator.
For the user to have the full benefit of a wireless sensor not only its communication but
also its power supply has to work without wires [76]. As a consequence most wireless
sensor networks are currently using batteries for power supply [121]. Other types of
energy storage, e.g. ultracapacitors, have been investigated, but one disadvantage is
common to all: the finite capacity of the storage limits the maximum time that the
sensor node can be operated [121].
A possibility to overcome this limitation is to obtain electrical energy from ambient en-
ergy sources. This energy-harvesting or -scavenging has been investigated for a variety
of energy sources including: solar radiation, thermal gradients, mechanical vibrations
and RF-energy [121, 64, 114]. A range of commercial energy harvesting solutions for
solar, thermal and mechanical energy is provided by the company EnOcean [169]. The
Powercast Corporation offers a solution to harvest energy from RF-sources in the 850–
950 MHz frequency band [178]. A problem common to all energy harvesting solutions
is that the amount of power actually available may strongly vary over time. Thus, they
have to be combined with an energy storage and power management circuitry that pro-
vides a continuous power supply to the sensor node [64].
Table 2.3 shows an overview of the energy- and power densities that typically can be
expected from energy storages and energy harvesting solutions. Comparing that to the
power consumption of wireless sensor nodes in tables 2.1 and 2.2 shows that power
on a wireless sensor node is scarce. Only very large energy storages or harvesters can
sustain the active power consumption of a wireless sensor node, which typically is of
the order of several 10 mW, for a long time. Therefore it is often important to put the
node into a sleep mode, where the power consumption is much less (0.001–1 mW), as
11
2. Literature review
Table 2.3.: Typical energy- and power densities of power supplies for wireless sensor
nodes.
Power source Power density Energy density Reference
[mW/cm2 ] [J/cm3 ]
primary battery 0.090 mW/cm3 ·yr a 2880 [121]
secondary battery 0.034 mW/cm3 ·yr a 1080 [121]
solar (outside) 10 - [114]
solar (inside) 0.01 - [114]
temperature difference 0.025–10 - [114]
vibrations 0.004–0.1 - [114]
RF-harvesting 0.0001–0.001 - [114]
often as possible. In some applications, however, it may be more feasible to use a mains
connected power supply that obliterates these restrictions on power consumption (see
e.g. [113]).
A possibility to keep many advantages of a mains powered solution without having to
use wires is to transmit power through electromagnetic coupling. Powercast, for exam-
ple, sells a transmitter that generates RF-energy for its corresponding harvesters.
Another means of wireless power transmission is inductive power transfer with loosely
coupled coils [101, 160]. ABB provides an inductive power supply with a frequency
of 120 kHz for their wireless automation products that is capable of supplying 10–
100 mW to all sensors within a 6 × 6 × 3 m volume [136]. A wireless temperature
sensor developed under the supervision of the author uses a closely coupled inductive
power supply with a frequency of 3 kHz and secondary power output of 112 mW [Fun6,
Stud4].
Many authors, e.g. [50], envisage wireless sensor nodes that are so small that they are
barely visible and can be deployed nearly everywhere. Another vision often expressed
is that sensor nodes will become so cheap that they can be deployed in huge masses
without significant cost [50]. In this context wireless sensor nodes are often referred to
as smart dust [50].
Today’s wireless sensor nodes are still quite far away from this vision. According
to [149] the term smart rocks might be more fitting for them. The PCBs of most wireless
sensor nodes have edge lengths of several centimeters. Adding power supply and casing
volumes of 10 . . . 1000 cm3 are easily reached. Although it has been demonstrated that
12
2.1. Wireless sensor networks
complete sensors nodes with a volume below 1 cm3 are technologically possible [99,
100], this kind of miniaturized sensor nodes does not appear to be used in most practical
applications. Possible reasons are the costs and the design limitations connected to
miniaturization.
According to [149] the typical a cost of one sensor node is about 100 $. This is in good
agreement with the price for a single OpenMote-CC2538 which is 90 ¤ as of June 2015
[176]. When adding a power supply and a casing this cost often increases significantly.
Application specific sensor circuits can add to the price of a sensor node even more
[149]. Kagelmaker et al. estimated the cost for one complete sensor node including
housing, sensors and energy harvester to be about 800 ¤ in the ECoMoS project [63].
The entire cost of installing and running the system of 1000 sensors over a ten year
period was estimated to be 865,000 ¤. Comparing this to the 1,450,000 ¤ estimated
for a similar system using a wired field bus the wireless solution is significantly cheaper.
This is due to cheaper hardware (1,320,000 ¤ wired vs. 805,000 ¤ wireless) and greatly
reduced installation costs (120,000 ¤ wired vs. 10,000 ¤ wireless) [63].
2.1.2. Software
There is a wide consensus that the severely limited energy supply, computing power,
memory size and communication bandwidth present unique challenges to software de-
sign for WSN [34, 130, 64]. Many projects have therefore been using simple pro-
grams that are specifically designed for the given application and run directly on the
sensor nodes [63, 60, 108]. However, also a number of operating systems, that are
specially designed for wireless sensor nodes, have been described [34, 130, 64, 30]
and used [113, 42, 87, 77]. These operating systems are often so minimal that they
may not even be operating systems in the conventional sense [130] but rather execution
environments as [64] suggests.
Dutta and Dunkels [34] argue that since wireless sensor nodes have to simultaneously
read sensors, process data and communicate with other nodes, concurrent process ex-
ecution is essential. As opposed to the multi-threaded execution model found in con-
ventional OSs, many wireless sensor OSs use an event driven one. Under this model
13
2. Literature review
external or internal events cause the execution of handler functions that are usually exe-
cuted to the end. The entire program can be modeled as a state machine with the handler
functions managing the transitions. Advantages of the event based model are reported
to be greatly reduced memory requirements and shorter execution times. This model
works very well as long as the CPU is idle most of the time and handler functions exe-
cute fast. If, however, longer calculations are performed, the CPU may be blocked for a
long time, as handler functions often cannot be interrupted [34]. Shucker [130] argues
that this is a major disadvantage, because the programmer always needs to care about
the execution time and porting algorithms from other platforms becomes complicated.
As a consequence, hybrid execution models like protothreads have been developed,
which allow for a programming style similar to multi-threaded systems but avoid the
use of multiple stacks [34, 32]. Other approaches implement multi-threading libraries
on top of an event-driven kernel [34].
Another challenge for wireless sensor OSs is the efficient management of memory. It
is stated in [34] that in order to avoid fragmentation of data memory, dynamic memory
allocation is usually avoided. Instead the programmer preallocates static buffers for
different tasks. This also has the advantage that the memory requirements of a program
are mostly known at compile time [34].
It is stated in [34], that in order to minimize the power consumption, unused compo-
nents need to be switched off whenever possible. Doing this duty-cycling through the
task management of the OS or the device drivers helps to keep application programs
simple [34]. However, Shucker [130] argues that the energy management is often more
efficient when controlled by the application, as it has more knowledge about the future
behavior of the program.
Shucker [130] states that the network communication stack of a wireless sensor OS
may be much more complex than the application program. Due to this complexity
communication protocols are discussed separately in section 2.1.4.
Dutta and Dunkels name TinyOS and Contiki as the two most widely known wireless
sensor OSs [34]. This view is supported by [8]. Other operating systems mentioned
in [34] are: Mantis OS (MOS), SOS and LiteOS. Due to their relevance to the re-
cent research on WSNs the key characteristics TinyOS and Contiki shall be introduced
briefly:
TinyOS [189, 85] is an open source operating system developed specifically for wire-
less sensor networks. It was started by the University of Berkeley together with Intel
Research and Crossbow Technology around the year 2000. Now, it is developed by a
14
2.1. Wireless sensor networks
worldwide community [154, 189]. TinyOS is written in NesC, a dialect of C that en-
ables the user to create applications by connecting different components through spec-
ified interfaces [85, 130]. It supports an event-based execution model where every task
is invoked by an event and runs to completion [64, 130]. Furthermore, TinyOS contains
a comprehensive network communication stack. TinyOS is widely used throughout the
scientific community. In [64] it is even regarded as the de-facto standard OS for wire-
less sensor networks. Many wireless sensor protocols have first been implemented for
TinyOS, e.g. the FTSP time synchronization protocol [87] and the CTP data collection
protocol [43]. The weaknesses of TinyOS are that its unusual programming model cre-
ates a comparatively steep learning curve and that it is not well suited for longer running
computations [142]. Newer versions of TinyOS include a multi-threading library that
aims to reduce these problems [142].
Contiki [186, 30] is an open source operating system designed for wireless sensor net-
works. It was started in 2002 by Adam Dunkels at the Swedish Institute of Computer
Science and is now being developed by a worldwide community [151]. It is closely
linked to the company Thingsquare later founded by Adam Dunkels [186, 140]. Contiki
is written in the C programming language. Like TinyOS it uses an event driven execu-
tion model, but supported optional multi-threading from the beginning [30]. Contiki’s
key features are protothreads, a very memory efficient way of thread-like program-
ming [32], and a full IP networking stack [186]. Amongst its other features are the
ability to dynamically load code during runtime, a lightweight file system for flash
memories and a command shell [30, 186]. The target application area of Contiki is
the internet of things [186]. Contiki is used in a variety of commercial products in-
cluding clip-on powerline sensors, smart thermostats and an urban noise monitoring
system [186].
More recently developed OSs are Nano-RK [174, 36], RIOT OS [182, 8] and OpenOS
[177, 147]. Nano-RK is a preemptive real-time operating system for wireless sensor
networks developed at the Carnegie Mellon University. The first paper about it was
published in 2005 [36]. Nano-RK explores a number of alternative concepts in real-
time communication [174]. However, it seems not to be used outside the Carnegie
Mellon University. RIOT OS was first released in 2013 [182]. Its aim is to bridge the
gap between standard OS and wireless sensor OS [8]. RIOT OS is implemented in C
and C++. It puts a stronger emphasis on real-time capabilities than TinyOS or Contiki.
RIOT OS also uses an IP-based network stack and is oriented towards the internet of
things [182]. The OpenWSN project had its first release in 2011 [177]. It is focused on
developing an open source network communication stack for the internet of things that
is based on standards like IEEE 802.15.4 and 6LoWPAN. However, it also contains a
simple priority based non-preemptive scheduler called OpenOS [8].
In [5] the embedded real-time operating system FreeRTOS [170] is extended with a
wireless communication stack and used for a WSN. Another alternative to using a
specialized wireless sensor OS is programming the wireless sensor nodes using higher
15
2. Literature review
level programming environments like the Java virtual machine marketed by Virtenio
[190] or LabVIEW that is supported by some sensor nodes from National Instruments
[175].
According to [64] a WSN can be represented as a graph, where each sensor node is
represented as a node. An edge exists between two nodes, if they can communicate
directly. The topology of a WSN is defined as the subset of this graph that is actually
used for communication [64]. It is commonly assumed that the network graph of a
WSN and thus also its topology may change frequently due to node mobility or changes
in the environment [34, 64, 194].
Three general classes of WSN topologies are described in [64]: In a flat topology all
nodes have the same functionality, whereas in a hierarchical topology some nodes have
specialized roles. A typical form of the latter is a network where several nodes form
a backbone and communication only takes place to and along the backbone as shown
in figure 2.1e. The third class is a clustered topology, where nodes are grouped into
clusters. Communication takes place mostly within these clusters. Cross-cluster com-
munication is only possible via gateway nodes.
In [34] three different types of nodes for a hierarchical network topology are defined:
Leaf nodes have the least processing power and tightest power constraints. They only
acquire data and communicate with the next mesh node. Mesh nodes, having slightly
more power available, also relay communication for other nodes. Finally root nodes
or base stations establish the connection to the user or external networks. They are
described as being mains-powered and having significantly more processing and stor-
age capabilities than mesh or leaf nodes [34]. A similar concept is described in the
IEEE 802.15.4 standard [194]. Here, reduced-function devices (RFDs) communicate
only with the next full-function device (FFD). FFDs can communicate with FFDs as
well as RFDs.
Apart from those general classes, a number of typical topology forms are described in
the literature. In [34] a star topology is described where all nodes only communicate
directly with a central coordinator (see figure 2.1a). Furthermore, a multi-hop mesh
is described, where the topology graph can take any form (figure 2.1c). It is stated
in [34] that a multi-hop mesh has higher reliability and reach as well as lower power
consumption compared to a star. In [64] it is, however, reported that multi-hop commu-
nication only radiates less power in form of radio waves, but may in total consume more
power due to additional computations on the forwarding nodes. In [120] two additional
network topologies are described: networked star (figure 2.1d) and tree (figure 2.1b).
16
2.1. Wireless sensor networks
17
2. Literature review
General reviews of WSN protocols can be found in [138, 64, 50, 34]. They largely stress
the need for wireless protocols to deal with frequent and unpredictable transmission er-
rors, while efficiently using the scarce resources of the sensor nodes. WSNs are there-
fore also often characterized as low-power and lossy networks (LLNs) [109, 144]. Spe-
cific discussions of protocols for industrial applications found in [125, 53, 23, 38, 59]
largely agree with that but emphasize the need for secure and reliable data transmis-
sions. Furthermore, depending on the application, guaranteed maximum transmission
delays are required [23, 136]: > 10 ms for process automation and data acquisition, 1–
10 ms for control applications, maintenance and diagnosis applications may even work
without hard timing guarantees [23].
The required data throughput is reported to be higher in industrial applications than in
other applications [59] of WSNs. Yet, it is not always a top priority [136].
Network communication involves many different tasks, which are commonly addressed
by a number of different protocols. They are typically categorized into several layers
similar to those defined in the ISO/OSI reference model [38, 34, 64]. The following
protocol layers for WSNs are described in [38]:
• physical layer (ISO/OSI layer 1)
• data link layer (ISO/OSI layer 2)
• network layer (ISO/OSI layer 3)
• transport layer (ISO/OSI layer 4)
• upper layers (ISO/OSI layer 5–7)
Similar layer definitions can be found in [34, 64]. A review of the most relevant proto-
cols in the different layers is given in the following sections. This is concluded with an
overview of the most widely used protocol stacks.
The physical layer (PHY) mainly deals with encoding and transmission of the data us-
ing some physical medium [64]. In most applications electromagnetic waves in the RF
spectrum are used as transmission medium [64]. Mostly license-free industrial, scien-
tific and medical (ISM) radio frequency bands are chosen, of which the 2.4 GHz band
is by far the most popular [64]. Sometimes also the 433 MHz or 868 MHz frequency
bands are used. In those bands it is possible to achieve a higher transmission range
at the same radiated power. Yet, they can only sustain lower data rates [198]. Higher
frequency bands on the other hand, have the advantage of favoring smaller antenna
sizes [64].
18
2.1. Wireless sensor networks
There is a wide consensus that a number of physical phenomena can cause frequent
and unpredictable transmission errors, referred to as fading [64, 34, 136, 21]. Exam-
ples are dampening or reflection of electromagnetic waves by static or moving objects
in the transmission path [64, 136, 21]. Since the frequency bands used by wireless sen-
sor networks are open also to other wireless transmission systems, interference between
different radio signals is also a major issue [64, 136]. It is even common for the original
signal to be interfered by its own reflections 2 [64]. Furthermore, wireless communica-
tion can be disturbed by electromagnetic radiation from machinery. It is interesting to
note in this context that according to [136] typical industrial processes do not radiate
significant power at frequencies above 1.5 GHz.
According to [64] one approach to address these problems is to use direct-sequence
spread spectrum (DSSS) modulation. It multiplies the original signal with a pseudo-
random sequence known to both transmitter and receiver. This spreads the signal energy
over a wider frequency band and lets it appear to be random noise to other systems. At
the same time the receiver can recover the signal more easily from a noisy background
by using correlation techniques [64]. Another method, discussed in [64, 136] is the
frequent and pseudo-random change of transmission frequency. This reduces the likeli-
hood of an interference destroying larger parts of the transmission [136]. Furthermore,
several antennae at different locations may be used simultaneously to reduce the likeli-
hood of fading 3 [136].
Several physical layer protocols have been standardized. According to [34] the one
defined by the IEEE 802.15.4 standard [194] is the most popular in WSNs. It is intended
for simple, low-cost radio systems with limited power and short transmission range. In
[59] it is also reported to be the best suited for industrial applications. Table 2.4 shows
the frequency bands, transmission channels and data rates defined in the IEEE 802.15.4
standard [194]. In all bands DSSS is used to achieve a more robust transmission [194].
The radiated power is not defined in the standard, but it is stated that typically it is in
the range of −3 . . . 10 dBm [194].
Table 2.4.: Frequency bands, transmission channels and data rates in the IEEE 802.15.4
standard [194].
Frequency band Number of Channels Bit rate Region
[MHz] [kbps]
868–868.6 1 20 Europe
902–928.0 10 40 North America
2400–2483.5 16 250 worldwide
19
2. Literature review
The physical layers defined in the standards IEEE 802.15.1 (Bluetooth) and IEEE
802.11 (WLAN) have also been discussed for the use in wireless sensor networks
[59, 198, 23]. Both use the 2.4 GHz frequency band and define higher data rates than
IEEE 802.15.4: 1 Mbit/s in IEEE 802.15.1 and > 10 Mbit/s in IEEE 802.11 [23]. Fur-
thermore, IEEE 802.15.1 uses frequency hopping to increase transmission robustness
[23]. However, the radiated power and the power consumption of the transceiver chips
are significantly higher for IEEE 802.15.1 and IEEE 802.11 than for IEEE 802.15.4
[59, 23]. Therefore, [59] concludes that they are not well suited for the use in wire-
less sensor networks. Nevertheless, the company ABB uses a modified version of the
IEEE 802.15.1 physical layer in their industrial wireless products [136, 205]. The ver-
sion 4.0 of the Bluetooth specification introduced the Bluetooth Smart technology also
known as Bluetooth low energy (BLE). It is much more power efficient than the original
Bluetooth [164]. Compared to IEEE 802.15.4, BLE appears to be significantly more
efficient at low data rates (≪ 1 kB/s), whereas at higher data rates (≥ 1 kB/s) it is about
equal4 [131, 98]. While BLE appears to be increasingly adopted in consumer products,
applications using it for WSNs currently seem to be rare.
Karl and Willig [64] state that in WSNs the most important function of the data link
layer is to coordinate the access to the shared communication medium. One reason for
this is that minimizing the listening and idle times of the wireless transceiver is essential
to saving energy. Another reason is that multiple nodes sending at the same time on the
same frequency channel will destroy each others’ messages, which is called a collision.
Therefore the medium access control (MAC) is treated as a separate layer in [64]. It has
a key influence on the throughput efficiency, stability, fairness and delay of the wireless
communication [64].
In [64] two classes of MAC-protocols are distinguished: contention- and schedule-
based. In contention-based protocols every node tries to transmit whenever it has data
ready [64]. This may lead to collisions which waste energy and reduce the data through-
put. Therefore, protocols try to avoid collisions, i.e. by listening for an ongoing trans-
mission before starting their own or through randomized transmission delays [64]. To
save energy nodes, typically listen only for short periods of time. The sending nodes
then try to learn about the listening times of their neighbors and only send data when
those are listening [64, 34].
In schedule-based MAC-protocols every node is assigned a time slot for transmis-
sion [64]. This has the advantage of avoiding collisions while enabling higher through-
put and more precisely timed sleeping periods. The major disadvantage of schedule-
4 A direct comparison between IEEE 802.15.4 and BLE is difficult, as their power consumptions are strongly
dependent on the chosen transmission parameters. In case of IEEE 802.15.4 it is even dependent on the
MAC protocol used.
20
2.1. Wireless sensor networks
based protocols is the effort that is needed to setup and adapt the schedule to changing
requirements. This makes it especially difficult to manage large and frequently chang-
ing networks. In addition, the schedule needs to be communicated to the participating
nodes and all nodes need to be synchronized to a common time, which both introduce
additional communication and memory overhead [64].
21
2. Literature review
The classic IEEE 802.15.4 defines a schedule-based MAC-protocol that contains con-
tention access periods, i.e. time-slots that are not dedicated to any node but in which all
nodes can access the channel using CSMA/CA [194].
Other data link layer tasks named in [64] are framing, error control, flow control and
link management. Typically the data is organized into relatively short frames or packets,
e.g. 127 bit in the IEEE 802.15.4 standard. Furthermore, error checking mechanisms
like the cyclic redundancy check (CRC) [64, 194] are employed. Also, data link frames
are often encrypted [194, 203, 110].
Routing, packet forwarding and packet format adaptation are named as typical network
layer services in [34]. It is also stated in [34] that unlike in conventional networks
many-to-one (data collection) and one-to-many (data dissemination) are the dominant
communication patterns in WSN. Direct communication of individual nodes (one-to-
one) is deemed to be rare. Similar views are also expressed in [109, 64]. Furthermore,
the topology of a WSN changes much more frequently than that of a conventional wired
network. Therefore, the routing protocols originally developed for wired networks, are
generally not well suited for WSNs [64].
Flooding is a primitive approach to data forwarding in a multi-hop WSN, which is often
described in the literature [34, 64, 50]. Here a sending node broadcasts its data to all its
neighbors, which in turn re-broadcast it to their neighbors. This way the entire network
is flooded with the data. A unique message identifier ensures that every packet is resent
exactly once by every node. While flooding is effective in ensuring that the data reaches
its destination, it leads to a lot of unnecessary packets being sent and may also increase
number of packet collisions [34].
According to [64], routing algorithms that calculate minimum cost paths for packet
transmission in a wireless network perform best in terms of energy consumption and
data throughput. Typical cost metrics are the number of hops from source to destina-
tion [64], the expected energy for end-to-end transmission [64] or the expected num-
ber of transmission attempts in individual hops [34]. In [64] two classes of routing
protocols are described: proactive protocols maintain accurate routing information all
the time, while reactive protocols only build it when needed. Furthermore, protocols
that calculate the routing paths in a centralized or distributed fashion can be distin-
guished [64]. Finally, the routing information may be stored by the nodes or a packet
may contain the route it is to be sent along6 [21].
A list of requirements on routing protocols for WSNs in industrial application is given
in [109]. It advocates the use of a proactive protocol and states that the routing protocol
6 This is called source-routing.
22
2.1. Wireless sensor networks
should support multiple cost metrics, prioritize packets depending on the application
and quickly recompute paths in case of topology changes. Load balancing should be
done between different nodes and their energy state should be taken into account. Fur-
thermore, the protocol should support redundant routes.
A proactive routing protocol that has been designed by the Internet Engineering Task
Force (IETF) to meet the requirements set in [109] is the Routing Protocol for Low-
Power and Lossy Networks (RPL) [155]. It has received considerable attention in the
literature [34, 128, 144]. According to [144] it has been found to show satisfactory
performance especially regarding the speed of route repairs.
According to [109] networking protocols for WSNs should be compatible to version six
of the Internet Protocol (IPv6), as it supports a large address space and provides easy
connectivity to other networks, e.g. industrial Ethernet solutions. In [34] it is stated that
the layered architecture of IP-protocols allows to retain many optimizations for WSNs
and at the same time ensures interoperability with other networks. A standardized so-
lution to efficiently transport IPv6 network traffic over IEEE 802.15.4 based wireless
links is 6LoWPAN [128]. It defines header compression mechanisms that significantly
reduce transmission overhead [34, 128]. Furthermore, it supports splitting larger IPv6
data packets (up to 64 kB) into smaller fragments that fit into the much smaller wireless
data frames [128]. However, this fragmentation requires large memory buffers on the
receiver side as all received fragments of not yet reassembled packets have to be stored.
The loss of individual fragments can further complicate the situation. Therefore, it is
recommended in [128] to avoid fragmentation in the network layer whenever possi-
ble. 6LoWPAN has received considerable attention in the literature [34, 128, 203] and
has been implemented on most wireless operating systems and protocol stacks includ-
ing Contiki [186], TinyOS [70], RiotOS [182] and OpenWSN [177] (see also section
2.1.2.1).
According to [34] reliable and unreliable data transfer, congestion avoidance and flow
control are common transport layer services. Furthermore, encryption is often used in
the transport layer to provide confidential end-to-end communication [203, 21]. Flam-
mini et al. [38] state that the transport layer is usually only implemented in WSNs if
they are to be accessed through other networks, e.g. the internet.
23
2. Literature review
The problem of reliable end-to-end data transfer has often been discussed in the con-
text of the transport layer: Dutta and Dunkels [34] state that the end-to-end acknowl-
edgments needed in this context generally cause too much traffic for WSNs. Karl and
Willig [64] also argue that it is not practical to achieve reliable end-to-end data transfer
solely in the transport layer. Instead it should also be dealt with in the network and
application layer.
The Transmission Control Protocol (TCP) is a connection oriented protocol that ensures
reliable transmission through end-to-end acknowledgments [128]. However, it gener-
ates a significant amount of additional protocol data [128]. Furthermore, its congestion
control mechanism reduces the packet-rate whenever data loss is detected resulting in
suboptimal performance on lossy links [64]. Therefore [128] and [64] agree that TCP
is generally not well suited for the use in WSNs.
The User Datagram Protocol (UDP) is a connectionless protocol that uses best-effort
data transmission [128]. 6LoWPAN provides a header compression mechanism that
eliminates most of the protocol overhead from UDP [128]. According to [128] UDP is a
suitable choice for most applications in WSNs and is also most frequently used. UDP’s
lack of end-to-end reliability can be compensated by a suitable application protocol
[33].
According to [38, 34] all protocol layers above the transport layer are usually condensed
into a generic application layer in WSNs. Data representation and transfer of data
items are the typical services of this layer [34]. Shelby and Bormann state that it is
often feasible to use standard internet application protocols like HTTP, SNMP or RTP
in WSNs [128]. A lightweight alternative to the Hypertext Transfer Protocol (HTTP)
for the implementation of web services is the Constraint Application Protocol (CoAP)
[129]. It is implemented in many wireless operation systems, e.g. Contiki [73] and
OpenWSN [147]. Application layer protocols for industrial field buses like the HART
protocol have also been used as application level protocols in WSNs [109, 133]. The
IEEE Standard for a Smart Transducer Interface for Sensors and Actuators also defines
an application layer protocol that can be used on top of a 6LoWPAN-based WSN (see
section 2.3.3).
24
2.1. Wireless sensor networks
A number of different protocol stacks for WSNs have been developed. Figure 2.2 gives
an overview of the most prominent ones in the context of industrial automation and the
internet of things.
The Wireless Interface for Sensors and Actuators (WISA) was developed by ABB for
the use in the control level of factory automation [136]. It comprises a complete wire-
less ecosystem consisting of a protocol stack, wireless sensor and actuator nodes as
well as a wireless power supply (see also section 2.1.1.5). It is optimized for high
transmission reliability, minimum latency transmission and a high node density. The
overall data throughput was not a priority [136]. Commercial products based on WISA
have been available since 2004. Although WISA was originally an entirely proprietary
technology, efforts appear to be made to turn it into an industrial standard [145]. As a
physical layer, WISA uses a modified version of IEEE 802.15.1 (Bluetooth) which uses
antenna diversity to make the transmission more robust [136]. In the data link layer a
custom TDMA-MAC is used in combination with frequency hopping and frequency di-
vision duplex. No network layer protocols are implemented since only a star topology
is supported. A simple custom protocol with acknowledgments from the base station is
used in the transport layer. In [136] a telegram error rate below 10−9 is reported. The
transmission latency is given as 1–5 ms in the typical and 20 ms in the worst case [136].
Furthermore, it is shown that the performance of a WISA transmission deteriorates only
slightly under the influence of a wireless local area network (WLAN) [136].
The WirelessHART standard is developed by the HART Communication Foundation
as a part of the HART field bus for process automation. The first version of the Wire-
lessHART specification was officially released in 2007 [21]. WirelessHART uses the
physical layer of IEEE 802.15.4 in the 2.4 GHz band [21]. Its data link layer is based on
the TSMP protocol [110]. Encryption is used both in the data link and in the transport
25
2. Literature review
layer. In the network layer three different centralized proactive routing algorithms are
supported: graph routing, source routing and superframe routing. All can be use to build
a self-organizing and self-healing multi-hop mesh network with redundant transmission
paths. In the transport layer end-to-end acknowledgments are used to ensure reliable
transmission. The application layer of WirelessHART is the same as in HART, allowing
for seamless integration of WirelessHART devices into a HART network [21].
The ISA100.11a standard is developed by the International Society of Automation
(ISA) [203]. Its first version was officially released in 2009. ISA100.11a is intended
to be used in non-critical industrial monitoring and control applications that tolerate
latencies in the order of 100 ms. It was designed to enable scalable and extensible
networks with robust and deterministic communication on low energy nodes. The
ISA100.11a standard is intended to be compatible with a wide range of existing com-
munication standards including e.g. HART, FOUNDATION Fieldbus, Modbus and
PROFIBUS [23]. ISA100.11a uses the physical layer of IEEE 802.15.4 in the 2.4 GHz
band [203]. Its data link layer is based on the TSMP protocol [110]. The network layer
of ISA100.11a is intended to be compatible with IPv6 networks using 6LoWPAN, while
a custom centralized proactive routing protocol is used. Various network topologies are
supported including star, star-mesh and mesh. UDP is used in the transport layer and
a custom object oriented protocol in the application layer [203]. ISA100.11a defines
encryption mechanisms in both the data link and the transport layer.
ZigBee is a wireless standard developed by the ZigBee Alliance [188]. It is indented for
the use in applications like home and building automation, smart metering and health
care [74]. The first ZigBee specification was released in 2004. Since then it has been
updated and extended multiple times [74]. ZigBee uses IEEE 802.15.4 as physical and
data link layer [74]. In the network layer ZigBee uses three different routing protocols:
a proactive tree-based protocol, an on-demand protocol (AODV [106]) and source rout-
ing [74]. ZigBee has an object based application layer that defines application profiles
including: home automation, building automation, health care and smart energy [74].
Furthermore, security and encryption are managed at the application layer [74]. Several
commercial implementations of ZigBee are available, e.g.: BitCloud (Atmel) [163],
EmberZNet PRO (Silicon Labs) [168], Z-Stack (Texas Instruments) [161].
The OpenWSN project aims to implement an open source protocol stack for the inter-
net of things based on open standards [147, 177]. It is developed at the University of
Berkeley and other research institutions. Its first release was in 2011. OpenWSN uses
IEEE 802.15.4 as physical and IEEE 802.15.4e as a data link layer [147]. The network
layer employs IPv6 with 6LoWPAN header compression and RPL as a routing proto-
col. The user can choose between UDP and TCP as transport layer protocols. In the
application layer CoAP or standard internet protocols like HTTP are used. Encryption
in the link layer as well as end-to-end encryption using DTLS is supported [177].
Scholl et al. report ZigBee as being widespread in home automation, WirelessHART as
the de-facto standard for process automation and WISA as most promising for factory
26
2.1. Wireless sensor networks
2.1.5. Conclusions
WSNs are networks of small, low-cost sensor or actuator modules. Today the typical
volume of a module is in the range of 10 . . . 1000 cm3 and its typical cost between
100 and 1000 ¤. Thus the expected cost reduction from the use of WSNs is estimated
be mainly due to reduced installation and maintenance costs but sometimes also due
to cheaper hardware. The modules are commonly based on low-cost and low-power
microcontrollers. An increase in memory sizes and computing power has been visible
over the past years with 32 bit ARM controllers being increasingly favored over 8 or
16 bit architectures. The key limitations of wireless sensor nodes are energy supply, cost
and size. Today, most sensor nodes are powered from batteries that can only supply a
finite amount of energy. Energy harvesting solutions have the potential of overcoming
this limitation. Yet at the moment, they can only generate very low amounts of electrical
power, which in addition may vary greatly over time and are often difficult to predict.
Thus, whenever it is not possible to power the nodes from mains power or with an
inductive power supply, power saving strategies are of great importance. The most
effective strategy for this purpose seems to be duty-cycling, i.e. operating parts of the
sensor node only for a short time and then putting them to sleep.
The limitations of the sensor hardware in terms of size, cost and power also limit the
software that can be run on a wireless sensor node. This has lead to the development
of specialized operating systems that aim to reduce the processor and memory usage.
Yet also here, a trend towards programming models also found on standard computers
is visible.
In addition to the limited energy, frequent changes and data loss in the wireless trans-
mission medium pose major challenges for communication protocols in WSNs. Thus,
a plethora of specialized communication protocols has been suggested. However, most
only address one of the many communication tasks and compatibility with other pro-
tocols is not always warranted. In the physical layer IEEE 802.15.4 transceivers in
the 2.4 GHz band are predominantly used. The protocols for the MAC layer can be
27
2. Literature review
divided into two classes: contention-based and scheduled protocols. In industrial ap-
plications there is a clear preference for scheduled protocols, as they provide a greater
degree of determinism and more data throughput. This is, however, at the expense of
flexibility. Additionally, frequency hopping is often used to increase the robustness to
interference. In the networking and application layers there is a trend towards IPv6-
based protocols as they simplify the integration of WSNs into existing networks. The
RPL routing protocol, which proactively maintains a routing tree, is commonly used in
this context. Smaller networks, especially in industrial applications, often make use of
a much simpler star topology. Already, a number of standardized protocol stacks have
been suggested. In the industrial domain WirelessHART and ISA100.11a are the most
prominent. ISA100.11a is designed towards IPv6-compatibility and displays interest-
ing parallels to the OpenWSN-stack, which is mainly oriented towards the internet of
things.
Time synchronization is widely seen as an important service in a WSN [79, 119, 64].
Römer et al. [119] state that it is needed to communicate the time of observations or
actions to the user, to manage communication within the WSN and to interpret sensor
readings. The challenge for time synchronization protocols in WSN is reported to be
the management of a possibly large network with dynamically changing topology, while
putting a minimum burden on the scarce resources of the sensor nodes [119]. Typical
tradeoffs described in [119] are those between synchronization quality on the one hand
and the additional communication, computation or memory use on the other hand.
This section reviews the current state-of-the-art regarding time synchronization in WSNs.
Summaries of synchronization protocols for WSNs can be found in [79, 119, 64].
There, the numerous existing protocols are classified according to a number of crite-
ria that are given in section 2.2.1. Furthermore, the protocols are commonly subdivided
into several blocks, which are presented in section 2.2.2. Evaluation methods for wire-
less sensor nodes, commonly found in the literature, are given in section 2.2.3. Section
2.2.4 presents an overview of the currently most relevant time synchronization protocols
for WSNs. Finally, section 2.2.5 reviews a number of time synchronization protocols
from other domains and compares them to those used in WSNs.
It is pointed out in [119] that time synchronization may have many different forms. In
order to choose the optimal time synchronization approach for a given application it is
vital to realize the form of synchronization actually needed. This section summarizes
the classes of time synchronization commonly found in the literature.
28
2.2. Time synchronization protocols
Internal or external: Römer et al. [119] distinguish between internal and external
time synchronization. While internal time synchronization only requires all member of
a network to be synchronized, external time synchronization additionally requires the
synchronization to an externally provided time scale. A similar distinction can be found
in [64].
Scope: According to [119] the scope of synchronization defines which nodes actu-
ally take part in it. In [64] synchronization protocols are classified as to which nodes
they actually synchronize: In broadcast synchronization all nodes within a broadcast
domain are synchronized. In receiver-receiver synchronization all nodes that receive a
signal are synchronized but not the sending node. In sender-receiver the sender and the
receiver are synchronized.
Absolute or relative: Relative or rate synchronization only ensures that time inter-
vals are the same on all nodes, i.e. it makes all clocks run at the same rate. Absolute
synchronization additionally ensures that all clocks show the same time [119, 64].
29
2. Literature review
Kusy et al. [77] analyzed the applications of WSNs that require time synchronization.
They concluded that most applications’ needs can be satisfied by one of the four canon-
ical time synchronization services shown in table 2.5. It is stated that virtual global
time is often implemented because it is conceptually simple. Yet, it is argued that this
requires continuous, a priori synchronization and often causes an unnecessarily high
communication overhead. It is found that the majority of services requiring time syn-
chronization can be implemented with less effort using only on-demand or a posteriori
synchronization [77].
Table 2.5.: Canonical time synchronization services and their typical applications
according to [77].
Canonical service Synchronization class Typical application
event timestamping on-demand, a posteriori intrusion detection
countersniper system
source localization
data series timestamping continuous habitat monitoring
(during acquisition), structural monitoring
on-demand (otherwise), environment monitoring
a priori/a posteriori volcano event monitoring
target classification
beamforming
virtual global time continuous, a priori debugging traces
coordinated action on-demand, a priori scheduled data collection
communications scheduling
Time synchronization protocols are structured into several blocks in [64, 119]: Resyn-
chronization event detection or synchronization maintenance decides when it is time
for nodes to synchronize. Remote clock reading obtains the present value of a remote
clock. Remote clock estimation establishes the relation between a local and a remote
clock using one or more readings. Clock correction decides how synchronization er-
rors are compensated. Finally, synchronization mesh setup deals with the organization
in multi-hop networks. This section gives a summary of the main techniques used in
every block.
30
2.2. Time synchronization protocols
Both [119] and [64] report that in order to continuously maintain synchronization, it
has to be refreshed periodically, because node clocks tend to drift apart. In [119] an
equation for the maximum resynchronization period T round is given:
ϵt,max − ϵt,sample
T round ≤ . (2.1)
ρmax
Here, ϵt,sample is the remaining error directly after synchronization, ϵt,max is the maxi-
mum accepted synchronization error and ρmax the maximum drift of the clock.
The task of remote clock reading is to establish the values of a remote clock and the
local clock at a common time instant. Figure 2.3 shows the message exchanges in the
most common remote clock reading techniques.
Figure 2.3.: Remote clock reading techniques according to [119]: a) unidirectional syn-
chronization, b) round-trip synchronization, c) reference broadcast.
31
2. Literature review
32
2.2. Time synchronization protocols
Many methods have been suggested to improve the precision of the synchronization
by combining multiple readings of the remote clock. The simplest method, presented
in [64], is to calculate the mean of multiple readings of the clock offset. Assuming zero
drift and a zero-mean white Gaussian distribution for the synchronization error, this
reduces the variance of the synchronization error to:
σ2one
σ2mean = , (2.2)
N
where σ2one is the variance of one reading and N the number of readings used.
Linear regression is presented in [64, 119] as a way to estimate both offset and drift of
a clock. In [119] it is, however, stated that it is sensitive to outliers and may perform
badly if the drift is not constant. Römer et al. also point out a tradeoff between the
quality of estimates and the effort in terms of memory and computation time, when
choosing the number of samples for regression.
Two heuristic methods that estimate the drift of a clock based on multiple samples of
the upper and lower bound for synchronization have been described by [158]. They
are reported to be very robust to outliers while requiring only minimal memory and
computation time [158].
Another method described in [119] is the use of a digital phase-locked loop (PLL). Here
the clocks are synchronized by adjusting their rate through a proportional-integral (PI)-
controller. According to [119] this method requires less memory but may need more
33
2. Literature review
time to converge than linear regression. Furthermore, the frequent clock updates from
the control loop may interrupt sleep-periods of the controller and increase its energy
consumption [119].
A number of maximum-likelihood estimators have been suggested that optimally es-
timate the clock offset or drift when the synchronization error is not Gaussian dis-
tributed [64, 83, 141]. Many of their authors assume an exponentially distributed mes-
sage delay during synchronization [83, 141]. Finally, various Kalman filter designs
have been suggested for time synchronization in WSN [2, 6, 86, 67].
34
2.2. Time synchronization protocols
point of view to use the same tree for routing and synchronization, this will result in a
suboptimal synchronization quality. They suggest that to construct the tree for synchro-
nization the frequency error variance of a node should be used as a cost metric instead
of the expected number of transmissions used by many routing protocols.
In the unstructured approach the multi-hop synchronization problem is not explicitly
solved [119]. Instead, nodes add synchronization information to packets that are trans-
mitted for other reasons. The advantage of this approach is that its communication
overhead is very low [119].
Synchronization protocols may be evaluated with regard to various criteria. Karl and
Willig [64] name the following:
• precision
• energy consumption
• memory usage
• error tolerance
Römer et al. [119] additionally stress the importance of the convergence time, i.e. the
time a protocol needs to establish synchronization.
According to [119] the precision is to be given as a single scalar value for an entire
network. They define the instantaneous precision p(t ) as:
{ }
p(t ) = max ci (t ) − c j (t )
i, j
where ci (t ) is the clock value of the i-th node at the time t. It is also mentioned in [119]
that alternative definitions of the precision exist that use the standard deviation, the
average absolute value or the 99 %-quantile of the pairwise clock difference instead of
the maximum.
Furthermore, a steady state precision P is defined in [119]. It describes the synchro-
nization precision in a network after the initial stabilization of the synchronization. The
time needed to reach this steady state is called the convergence time tconv . It is defined
as:
{ }
P = max p(t ) , t ≥ tconv
t
Alternative definitions use the average instead of the maximum [119].
35
2. Literature review
It is stated in [119] that the usage of these differing precision measures often makes
results reported by different authors difficult to compare. The fact that the precision
heavily depends on the scope and time, for which it is measured, further complicates
the situation [119].
Several methods have been used to evaluate synchronization protocols. Römer et al.
[119] summarize them as: measurements on target platform, simulations and analytic
calculations. Measurement on the target platform are reported to provide the most real-
istic precision values but do not scale well with network size. Simulations on the other
hand can handle also very large networks and make it simple to keep external condi-
tions constant. Finally, analytic calculations are the only way to determine absolute
worst-case boundaries.
A large number of synchronization protocols have been suggested for WSNs. Table 2.6
gives an overview of the most prominent or interesting protocols. For each protocol
the classes of synchronization, types of building blocks used and assumptions made are
given. More extensive overviews can be found in [79, 119, 64].
Reference Broadcast Synchronization (RBS) was the first protocol to use reference
broadcasting to minimize synchronization errors. It uses linear regression to determine
the relative offsets and drifts of all clocks in a broadcast domain [119, 35]. These
values are then used to transform timestamps on transmission from one node to another
[119]. Multiple broadcast domains can be linked through gateway nodes resulting in
a clustered network organization√ [119, 35]. The synchronization error in this setup is
reported to grow only with O( n) [119].
36
2.2. Time synchronization protocols
bidirectional com. - X - - X - X
constant rate - - - X - - -
bounded drift - - - - - - X
extra sync. channel - X - - - - -
MAC timestamping - - X X X - X
clock reading RB RB UD UD RT UD special
blocks
37
2. Literature review
RITS is minimal as no additional synchronization messages are sent, only a field with
elapsed time needs to be added to every message [77].
The Timing-Sync Protocol for Sensor Networks (TPSN) uses round-trip synchroniza-
tion and MAC-layer timestamping to achieve very accurate synchronization. The net-
work is organized in a spanning tree [119].
Table 2.7 shows reported experimental results for the precision of the synchronization
protocols described above. It is striking that different authors report largely different
results for the RBS and TPSN protocols. This may be due to the use of different sensor
nodes, clock resolutions T clock and synchronization periods T sync . But also differences
in the software implementations and experimental methods may play a role. In case
of the TPSN protocol the huge differences between the values reported by [42] and
[118] may also be related to the fact that [42] measured timestamp differences between
nodes directly after a posteriori synchronization, while [118] continuously monitored
the clock differences of the number of nodes between periodic synchronizations.
Due to the differences in the experimental methods and precision measures a direct
comparison of the protocols is hardly possible. Yet, it can be concluded that with cur-
rent synchronization protocols precisions in the order of 1–10 µs can be achieved for
a single hop. The results given for FTSP at different synchronization periods T sync
show that a more frequent exchange of synchronization messages improves the syn-
chronization accuracy. When the number of hops increases, the synchronization preci-
sion decreases for all protocols. On direct comparison by the same authors protocols
like SCTS that correct offset and drift have a clear advantage over those like TPSN that
only correct offset [118].
38
2.2. Time synchronization protocols
39
2. Literature review
Time synchronization is important not only for WSN. A number of time synchro-
nization techniques have been developed in different domains, some of which are in
widespread use and very mature. This section presents the most well known of those
synchronization techniques outside and analyzes them for their relevance to WSN.
The Network Time Protocol (NTP) is used to synchronize the clocks of computers
connected to the internet [96]. It was first standardized by the IETF in 1985 [94] and has
recently been updated to its fourth version [95]. According to [96] NTP is continuously
being used by 10–20 million servers and clients all over the world.
In NTP a client synchronizes to a server using round-trip synchronization [97]. Clock
offset and drift are estimated and digital PLL is used to control the clocks [97]. The
network organization is based on a tree-structure, which is independent of the underly-
ing physical network. At the root is a server that has access to national time standards,
e.g. through GPS or DCF77 (see sections 2.2.5.3 and 2.2.5.4). The depth of the tree
is measured in strata, where a stratum 1 server is at the root, stratum 2 servers syn-
chronize to stratum 1 servers, etc. [96]. Many stratum 1 servers and thus also many
synchronization-trees exist on the internet. Clients may synchronize with many differ-
ent servers in order to make use of redundancy and diversity effects [97]. Thus, they
may be part of more than one tree. The synchronization accuracy of NTP is generally
reported to be in the order of several milliseconds [96, 27], but efforts are being made
to achieve microsecond precision [96].
Römer et al. argue that while being most advanced and time-tested NTP is not well
suited for the use in WSNs [119]. It is said to consume too much energy, as servers need
to be always reachable by clients, the digital PLL-requires frequent processor activity
and only continuous synchronization is supported. Furthermore, it is deemed to be
not flexible enough as its hierarchy is mostly static and configured manually. Also the
network independent nature of its hierarchy is seen to be detrimental, as it may cause
large and unpredictable end-to-end delays that the protocol is not designed to meet.
Finally, it is stated that NTP does not scale well over many strata/hops. Thus, time needs
to be injected at many places in a large network, as it is done in the internet [119].
The Precision Time Protocol (PTP) was developed to enable sub-microsecond syn-
chronization in Ethernet networks [27, 200]. Additional design goals were to minimize
40
2.2. Time synchronization protocols
41
2. Literature review
Figure 2.5.: PTP network structure [200]. Figure 2.6.: PTP synchronization mes-
sage exchange [200].
It can be observed that like in table 2.7 very different precision values are reported for
the same synchronization protocol. Furthermore, the values show that, using special-
ized synchronization hardware as well as a high clock resolution and short synchroniza-
tion intervals, synchronization precisions well below 1 µs can be achieved. However,
the energy consumption is expected to rise under these conditions. Unfortunately, not
all authors report values for this.
DCF77 is a long wave radio transmitter that is used to disseminate the official time in
the Federal Republic of Germany [57]. Similar transmitters are used in many other
countries (see [153]). The DCF77 transmitter uses a highly accurate carrier frequency
of 77.5 kHz and has a transmission range of about 2000 km [57]. Bits are transmitted by
lowering the signal amplitude for 0.1 s or 0.2 s at the beginning of a second. This way a
message containing the current time is transmitted every minute. Additionally, pseudo-
random phase noise is added to the signal to enable a more accurate synchronization of
receivers. For two receivers spaced 50 km apart a maximum synchronization error of
20 . . . 50 µs is reported [57]. The DCF77 system is essentially a unidirectional broadcast
synchronization protocol similar to one-hop FTSP. According to [64] it is not feasible
to use systems like DCF77 in WSNs as he receiving circuits are generally too large, too
costly and too energy-hungry. Furthermore, it may not be possible to pick up the signal
everywhere due to occlusions by buildings or terrain [64].
42
2.2. Time synchronization protocols
Today the Global Positioning System (GPS) is the world’s principle source of accu-
rate time [3]. It uses a system of satellites that possess highly stable synchronized
atomic clocks. The GPS-system time is synchronized to the Coordinated Universal
Time (UTC) as estimated by the United States Naval Observatory [3] (compare section
3.1.1). Each satellite continuously broadcasts messages containing its position and the
current GPS-system time. After receiving timestamped messages from four different
satellites a receiver can set-up four equations and solve them for the unknowns posi-
tion (three coordinates) and GPS-system time [3]. This way synchronization precisions
of 20–500 ns are achieved [57, 3]. Using the signal from one GPS-satellites as a ref-
erence broadcast, even higher synchronization accuracies of 5–20 ns can be achieved.
This method, called GPS Common-View is used by the international standards organi-
zations for time transfer between different timing centers [3]. Many observations over
a long period of time and complex signal processing algorithms are necessary to reach
the high accuracies given above [3].
According to [64] it is not feasible to use GPS as a source of synchronized time in
WSNs. The receiving circuits are deemed to be too large, too costly and to energy-
hungry. In addition, it is probably not possible to receive the GPS signal everywhere
wireless sensor nodes are deployed.
Many laboratory devices use digital pulses transmitted through a wire to synchronously
trigger data acquisition. One example is the Real-Time System Integration bus (RTSI)
43
2. Literature review
used in data acquisition cards from National Instruments [208]. Furthermore, many
frequency normals and GPS receivers output a one pulse per second (PPS) signal for
other devices to synchronize to [57, 11].
2.2.6. Conclusions
Data acquisition is one of the major applications for WSNs. Section 2.3.1 presents
an overview of data acquisition applications reported in the literature. The relation of
wireless sensors to smart sensors is examined in section 2.3.3. Finally, section 2.3.2
looks into strategies for time-synchronous data acquisition.
44
2.3. Data Acquisition with wireless sensor networks
Welsh [149] reports on his experience with a WSN for volcano monitoring. In this
application 10–20 sensor nodes recorded seismic and acoustic signals with a sampling
rate of 100 samples/s. The deployment of the nodes was rather sparse and irregular with
nodes placed several hundreds of meters apart. Finally, it was observed that the scien-
tists tended to be rather conservative regarding the data acquisition. Welsh summarized
this with the sentence [149]:
Scientists simply want all of the data produced by all of the sensors, all of
the time.
Thus, it was suggested that WSNs should transmit data based on an application domain
specific prioritization in order to minimize wireless traffic. Additionally, all data should
be logged to a local memory on every node for later analysis.
Pflugradt et al. [108] describe a WSN for the monitoring of cardiovascular activity.
They used custom sensor nodes with two MSP430 microcontrollers, where one ac-
quired data and the other managed the wireless communication. In contrast to most
other applications Bluetooth was used for the wireless transmission. The nodes were
equipped with an electrocardiogram (ECG) or Photoplethysmogram (PPG) and a three-
axis accelerometer, all of which were sampled at a rate of 500 samples/s. The microcon-
troller responsible for data acquisition was always active and continuously acquiring
samples, but the Bluetooth interface was set to sleep mode between the wireless mes-
sages to save power. The resulting mean active current is reported to be 40 mA. As
the sensor nodes were supplied by lithium-ion batteries with a capacity of 1300 mAh,
continuous measurements were possible for more than 24 h.
Medina et al. [91] present a WSN that, using ultrasonic ranging, can determine node
positions with an accuracy below 1 mm. IEEE 802.15.4/ZigBee is used together with
a TDMA-MAC-layer for the wireless communication. The network topology is a one-
hop star. Time synchronization in the MAC-layer is used to minimize power consump-
tion by activating the wireless transceiver only when communication is expected. In the
45
2. Literature review
given application, the nodes have an average current consumption of 11.8 mA allow-
ing for 167 h of operation. Ultrasonic pulses with a carrier frequency of 40 kHz were
generated at the sending nodes and sampled with a rate of 17.78 kHz at the receiving
nodes using a bandpass sampling scheme. The sampled signal was fed through a digital
correlator. Further digital signal processing on the nodes determined the time-of-flight
of the ultrasonic pulses, which was used to calculate the node’s position.
Hou and Bergman describe a WSN for condition monitoring of electrical motors [60].
IEEE 802.15.4/ZigBee is used for the wireless transmission. The network consists of
one coordinator and three leaf nodes using a single-hop star topology. Current and
vibration signals are recorded with a sampling rate of 3.1 ksamples/s. The fast Fourier
transform (FFT) is used to compute the signal spectra locally on the nodes. A neu-
ral network classifier performs local fault classification. Only the classification results
are transmitted to the coordinator where decision level fusion is done. One diagno-
sis run consists of data acquisition, signal processing and result communication. The
sensor enters into a sleep state between the diagnosis runs. An analysis of energy con-
sumption showed that running the fast Fourier transform (FFT) and neural network on
the node needs only 22.3 mJ per run, whereas transmitting the raw data would require
33.7 mJ. Using two AAA alkaline batteries as power source this enabled 121 h of oper-
ation with one diagnosis run every 3 s. Using a fixed-point FFT-algorithm instead of a
floating-point, this could be increased to 150 h. The system was demonstrated to detect
imbalances as well as loose feet, i.e. an inadequate motor fixture.
Another wireless condition monitoring system was developed in the ECoMoS project
[63, 12, 156]. Here the aim was to detect bearing faults of machines in a paper factory.
A custom node hardware was designed that contained a vibration sensor, a fixed-point
digital signal processor (DSP) and a thermal energy harvester. Wireless transmission
was done in the 868 MHz band using a custom protocol. Vibration data was sampled
with a rate of 32 ksamples/s. The signal spectrum was calculated and evaluated directly
on the nodes. Only the diagnosis results were transferred to a central control station.
One diagnosis consisting of measurement, evaluation and transmission was reported to
last for 10 s and to need less than 250 mJ. Using a similar sleeping pattern as in [60] the
energy obtained from the thermoelectric harvester was sufficient to run one diagnosis
every 30 min.
A very different wireless sensor for machine vibration monitoring is described in [61].
It uses a two-processor architecture, where an 8 bit processor with integrated wireless
interface manages the communication and a more powerful 32 bit ARM Cortex-M3
processor manages the data acquisition. IEEE 802.15.4 is used in beacon-enabled mode
for the MAC-layer. Data is acquired at a rate of 20 ksamples/s, stored to a Micro-SD card
and only transmitted after the acquisition. The system is reported to consume 403.3 mW
in full operation and 0.518 mW in full sleep. Using a 1000 mAh lithium battery as
energy source, this leads to a lifetime of 9.17 h in operation and 297.6 d in sleep mode.
Table 2.9 gives an overview the described data acquisition applications and the used
node hardware.
46
Example Volcano Process Medical Ultrasonic Condition Condition Vibration
monitoring monitoring ranging monitoring monitoring measurement
[149] [113] [108] [91] [60] [63, 12, 156] [61]
number of nodes 10–20 15 3 7 4 n/a 2
network extent 200. . . 400 m 2500 m2 human body 2–6 m lab desk factory n/a
between nodes between nodes
topology n/a tree, 3 hops star, 1 hop star, 1 hop star, 1 hop many stars, star, 1 hop
1 hop,
backbone
PHY n/a IEEE 802.15.4, Bluetooth, IEEE 802.15.4, IEEE 802.15.4, IEEE 802.15.4, IEEE 802.15.4,
2.4 GHz 2.4 GHz 2.4 GHz 2.4 GHz 868 MHz 2.4 GHz
MAC n/a TDMA Bluetooth TDMA IEEE 802.15.4 custom IEEE 802.15.4
(beaconed)
execution environment custom Contiki custom custom custom custom custom
(modified)
sensor node custom Tmote Sky custom, 2 µC custom custom custom custom, 2 µC
sensors seismometer, pressure, flow acceleration, ultrasound vibration, vibration vibration
geophone ECG, PPG current
sampling rate [ksamples/s] 0.1 n/a 0.5 17.78 3.1 32 20
data acquisition n/a n/a continuous bursts bursts bursts bursts
activity interval n/a n/a - 6.4 s 3s 30 min n/a
synchronization n/a none periodic periodic none none periodic
beacons beacons beacons
synch. accuracy - - 100 µs < 1 µs - - 87.85 ns
on node signal processing n/a none none correlation, FFT, neural FFT, diagnosis none
Table 2.9.: Examples of data acquisition with WSNs.
peak-detection network
power supply battery mains power battery battery battery therm. energy battery
harvester
avg. power [mW] n/a 0.1 . . . 1 120 35.4 ≤ 7.4 ≈ 0.5 403.3
operation time n/a ∞ > 24 h 167 h 150 h ∞ 9.17 h
47
2.3. Data Acquisition with wireless sensor networks
Time synchronous data acquisition is essential to many but not all application exam-
ples presented in the previous section. Pflugradt et al. [108] used two different wireless
senor nodes to measure the Pulse Transit Time, i.e. the time between a peak in the
Electrocardiogram and the start of the pulse wave. Any synchronization error directly
leads to an error in this measurement. Both, nodes trigger their sampling with a timer
clocked from a 16 MHz crystal oscillator with 50 ppm accuracy. Synchronization mes-
sages were sent at an interval of 250 ms. The nodes adjusted their local timer values in
order to compensate for offset and drift. This way a maximum sampling jitter of 100 µs
could be achieved.
Medina et al. measured the time-of-flight of ultrasonic pulses to determine the node
positions [91]. Sending and receiving nodes were synchronized through two synchro-
nization messages sent by the network coordinator at the beginning of a TDMA-frame,
i.e. every 6.4 s. As in PTP, the first message was used as a common reference point
and the second message contained the exact time at which the first was sent (compare
section 2.2.5.2). The timestamps were generated directly in the MAC-layer to achieve
a good precision. All nodes in the network used the synchronization information to
calculate their local drifts and offsets. To lower the standard deviation of consecutive
drift estimates an IIR-lowpass filter was used. The calculated drifts and offsets were
used by the sending nodes to calculate the correct time for sending a pulse and by the
receiving nodes to correct the pulse detection times. A detailed analysis of the measure-
ment error for the time-of-flight given in [91] shows that a clock offset causes a bias
in the measurement and a drift a bias that changes over time. With the offset and drift
compensation of the clock this error was smaller than 0.01 µs. A much larger bias of
about 250 µs was introduced through the group delay of the receivers’ analog bandpass
filters. Therefore, it was suggested in [91] to remove this influence by calibration.
Another error contribution came from the variance of the correlator output which de-
pends on the signal-to-noise (SNR) of the received ultrasonic signal. It was estimated to
be about 0.71 µs in [91]. Finally, the clock resolution was identified as a major influence
factor. At a clock resolution of 1 µs its error contribution was found to be about 0.6 µs.
The overall error of the time-of-flight measurement was reported to be 0.6 . . . 1.9 µs for
distances between the nodes of 2 . . . 5.5 m. The error increases with the distance due to
a reduction in the SNR of the received signal. The resulting positioning accuracy was
reported as 0.31 . . . 0.64 mm.
The wireless sensor presented for vibration measurement in [61] uses periodic messages
at an interval of 2 s for synchronization. The corresponding start of frame pulses from
the wireless transceiver are wired directly to a microcontroller interrupt and used to
adjust both offset and drift of an internal timer, which used to trigger the sampling of
the input signal. This way an average synchronous triggering error of 87.85 ns (max.
190 ns) between two neighboring nodes was achieved during the acquisition of 200
samples.
48
2.3. Data Acquisition with wireless sensor networks
An even more powerful wireless system for synchronous data acquisition is described
in [159]. It is based on a 600 MHz ARM Cortex-A8 processor and uses WLAN for
data transmission. The sampling rate is synchronized to the PPS output signal of a GPS
receiver. This way, a synchronous triggering error of 15 ns could be achieved at a sam-
pling rate of 100 ksamples/s. No information is given on the systems power consumption
or cost. Yet, it is to be assumed that the system is too costly and needs too much power
to be considered a wireless sensor node in the conventional sense.
The IEEE 1451 family of standards has been introduced with the aim to improve inter-
operability between transducers from different manufactures, thus enabling a plug-and-
play style of use [196]. It defines a transducer as a device that is either a sensor or an ac-
tuator. Every smart transducer under the IEEE 1451 standard should be described by a
transducer electronic data sheet (TEDS), which contains all relevant information about
it in a standardized machine-readable form. Transducers are connected to transducer
interface modules (TIMs). They provide a standardized command interface, contain
the TEDS and perform signal conversion as well as conditioning. Many TIMs may be
connected to a network-capable application processor (NCAP). It provides a network
based user interface and can perform arbitrary processing functions. Figure 2.7 shows
an overview of the IEEE 1451 reference model. Various different hardware interfaces
are defined for the communication between TIMs and NCAP including USB, CAN,
WLAN, Bluetooth, ZigBee and 6LoWPAN. A short summary of the current members
of the IEEE 1451 family is given in table 2.10.
49
2. Literature review
Figure 2.7.: IEEE 1451 reference model according to [196]. Grayed out parts are out
of scope for IEEE 1451.
50
2.3. Data Acquisition with wireless sensor networks
IEEE 1451 is explicitly intended to be used in WSNs. Adaptation layers for the com-
munication between NCAP and TIM over 6LoWPAN and other wireless technologies
are defined in IEEE 1451.5 [197]. Higuera and Polo [54, 55] describe an implementa-
tion of IEEE 1451 for TinyOS using TelosB sensor nodes. They discuss three possible
network architectures for implementing IEEE 1451 on a WSN: In the first, there is only
one NCAP. It is also the gateway node that connects the WSN to another network, e.g.
the internet. In the second, multiple NCAPs are connected via a backbone network.
Finally in the third, the WSN is not connected to any other network and the NCAP
serves as network coordinator. In all three cases the other nodes in the network work as
TIMs.
A very similar implementation using the same operating system and node hardware
is described in [45]. The memory footprint of this implementation is reported with
2.900 kB RAM and 26.660 kB Flash on the TIM 3.295 kB RAM and 19.014 kB FLASH
on the NCAP. A HTTP-server was implemented on the NCAP to allow access from
web applications. Five wireless transducer interface modules (WTIMs) with light, tem-
perature and humidity sensors were constructed and tested on a university campus. The
final intended application was the monitoring of a wildlife habitat.
2.3.4. Conclusions
Wireless data acquisition has been used in a wide range of applications. Most appli-
cations still rely on customized hard- and software solutions. Quite often, relatively
powerful hardware is used for the nodes, e.g. a two processor architecture where one
manages the data acquisition and the other the communication. This, however, comes
at a clear penalty regarding power consumption. The vast majority of data acquisition
applications use batteries for power supply. Operational lifetimes range from several
hours to about half a year, depending on the highly application specific power con-
sumption. Applications using energy harvesting are currently rare. Reasons may be
the relatively low amount of power that can be harvested and a difficult design process.
When possible, mains powered solutions are chosen, as they significantly reduce the
design effort and provide an unlimited operational lifetime.
In the MAC-layer schedule based protocols are used almost exclusively. The presented
applications use only few nodes (2. . . 20). Thus, a simple one-hop star topology is used
in the majority of cases. The only application with a multi-hop network uses a three-hop
tree topology.
The, MAC-protocols are the major source of time synchronization, which is generally
performed in a continuous manner. Specialized synchronization protocols are generally
51
2. Literature review
not used. However, key techniques like MAC-layer timestamping and drift compensa-
tion are often adopted. A very interesting finding of [91] is that the measurement errors
caused by synchronization inaccuracies may be marginalized by other error influences,
like the input signal noise.
The sampling rates used for data acquisition vary in the range of several samples to tens
of kilosamples per second. Two major acquisition patterns can be observed: continu-
ous streaming and acquisition bursts with longer sleep periods in between. The latter
is especially used to minimize power consumption in monitoring applications. Another
strategy to minimize the amount of data transmitted as well as to save power is to pro-
cess the data directly on the nodes and only transmit the results. The users of the data,
on the other hand, often prefer to have access to the entire raw data. A possible com-
promise may be only transmitting the processed data but storing the raw data locally on
the sensor nodes for offline analysis.
As all wireless sensor nodes digitize and process the acquired data they may be con-
sidered smart sensors. The IEEE 1451 defines a standardized interface to all kinds of
smart sensing systems that abstracts from the underlying communication architecture.
Wireless sensor nodes that use this standard may be integrated more easily into future
measurement applications.
Synchronous angular sampling is an important tool for the analysis and diagnosis of
rotating machinery. It is also referred to as synchronous sampling [72], angle do-
main sampling [15] or angular sampling [9, 17]. Section 2.4.1 briefly introduces the
definition of synchronous angular sampling and its main uses. An outline of current
algorithms for synchronous angular sampling is given in section 2.4.2.
52
2.4. Synchronous angular sampling
A concept closely related to synchronous angular sampling is order tracking. In [18, 72]
it is defined as:
Frequency analysis of the instantaneous root-mean-square values of pe-
riodic components of rotating machine vibrations as a function of rota-
tional speed.
However, in [15, 17] any digital signal processing method intended primarily for rotat-
ing machinery is named order tracking.
According to [15] synchronous angular sampling is the second most often used method
in rotating machine analysis and diagnosis. Its key advantage is the possibility to per-
form a leakage free discrete Fourier transform (DFT) with a constant order resolution
over time [15]. Its major disadvantage is that this order resolution is not very high,
which causes problems at non-stationary order amplitudes [15].
According to [72] the main application of synchronous angular sampling is the analysis
and diagnosis of rotating machinery at variable speeds. This is especially interesting,
as it allows covering the entire speed range of a machine in a short time. This way,
critical resonant frequencies and instabilities in rotors or bearings can be detected. Fur-
thermore, varying the rotational speed helps to decide whether observed phenomena
are rotation related or not. Finally, specific errors can be detected, since they often give
rise to signal components at characteristic orders [72].
53
2. Literature review
2.4.2. Algorithms
This synchronous angular resampling, was introduced by Hewlett Packard in 1989 [15,
111], but the details were considered to be proprietary and not published. Today, many
commercial hard- and software products provide synchronous angular resampling, but
the implementation details are generally not disclosed [14].
A simple method for synchronous angular resampling has been described in [17]. Here,
spline-interpolation is used to obtain the signal values at the desired angular instants.
However, this method is only suitable for small speed changes as the lowpass charac-
teristic of the spline-interpolation is not very good and would lead to aliasing errors
during resampling at larger speed changes (compare section 3.3.2).
Two more sophisticated methods for synchronous angular resampling have been pub-
lished in [14]. The first is upsampled linear interpolation, where the signal is first up-
sampled by a factor L and then interpolated to the desired angular instants using linear
interpolation (see figure 2.10). The lowpass filter after the upsampling suppresses inter-
polation images and ensures that the signal is sufficiently narrow-band to be used in the
linear interpolation. In order to avoid aliasing errors the sampling rate at the output of
the linear interpolator needs to be at least as large as the original sampling rate. As this
can lead to undesired oversampling, an optional decimation stage can be used to reduce
54
2.4. Synchronous angular sampling
the output rate by a factor M. The SNR of the output signal is strongly influenced by
the upsampling factor L: higher L lead to a better SNR. Simulations in [14] resulted in
an SNR of 50 dB at L = 2 and one of 60 dB at L = 16. The method generally requires
a high computational effort. However, this can be reduced by calculating only those
upsampled values actually needed for the interpolation as well as by using polyphase
interpolation and decimation filters (compare section 3.3.2.1).
The second method for synchronous angular resampling presented in [14] is an upsam-
pled interpolation filter. Here samples are interpolated at the desired angular instants
using truncated sinc-interpolation. This corresponds to first reconstructing a continuous
signal from the acquired samples, continuously filtering it with a lowpass filter and then
sampling it again (see figure 2.11). The impulse response of the lowpass filter is equal
to a truncated sinc-function. It is stressed in [14] that this method is computationally
very efficient as it only requires 12–18 multiply and add operations per output sample, if
the values of the sinc-function have been calculated in advance. However, a large num-
ber of these precalculated values are needed. If fewer values are used more broadband
noise is introduced in the output signal. The SNR of the method is reported to be in
the range of 70 . . . 80 dB for 18 times 512 to 8192, i.e. 9.216 . . . 147.456, precalculated
values.
55
2. Literature review
2.5. Conclusions
WSNs are networks of small, low-cost sensor and actuator devices. Although WSNs
have been a subject of research for more than 15 years this field is still very much in
development. The trend in wireless sensor node hardware is towards low-power 32 bit
ARM processors. Radio transceivers based on the IEEE 802.15.4 standard using the
2.4 GHz frequency band are used in the majority of applications. In most cases wireless
sensor nodes are powered using batteries. Applications based on energy harvesting look
interesting but are still very rare. Reasons are the low amount of power harvested and
problems to reliably predict it during system design. Thus, the power consumption of
wireless sensor nodes has to be minimized regardless of whether batteries or energy
harvesting is used. However, in some applications it is feasible to power the nodes
directly from the power grid or through an inductive power supply. In these cases,
power consumption is much less critical.
Starting from very diverse experimental systems and protocols wireless sensor software
is slowly converging towards some standards. There is a tendency to use solutions
already known from conventional systems, e.g. multi-threading schedulers or IP-based
network protocols. Yet, the limitations of wireless sensor nodes in terms of power
consumption, computational power and memory size still pose major challenges for
software development. Today a number of specialized operating systems for WSN
are available. Yet, many applications still use entirely custom execution environments.
For the MAC-layer, protocols based on time-synchronized channel hopping (TSCH)
are increasingly being used not only in industrial applications. In the networking and
higher protocol layers, a trend towards IPv6-based protocols is clearly visible. The
IEEE 1451 standard defines a common interface not only to wireless sensors but to all
kinds of smart sensors. It may greatly ease system integration efforts in the future.
Time synchronization is a key factor in many applications using WSNs. It has been
shown to be a multi-faceted problem with much room for optimization by tailoring the
kind of time synchronization to the individual application. A plethora of protocols for
time synchronization has been suggested. The generation of timestamps in the MAC-
layer, as close as possible to the actual sending process, has been shown to be key to
maximizing synchronization precision. Direct comparisons between synchronization
protocols are very difficult, as precision numbers reported in the literature are often
based on different assumptions and measurement methods. Furthermore, the properties
of the underlying hardware, especially the stability and resolution of the clock, have a
major influence. Yet, some authors see the FTSP-protocol as the current state-of-the-art
for time synchronization in WSN. A different kind of standard for time synchronization
in WSN may well be set by time synchronized MAC-protocols that are already predom-
inantly used as a means for synchronization in data acquisition applications. Various
experiments with synchronization on wireless sensor nodes have shown that synchro-
nization accuracies well in the sub-microsecond region can be realized, thus coming
56
2.5. Conclusions
57
3. Theoretical foundations
This chapter summarizes the theoretical background necessary for understanding the
modeling and analysis in this thesis. First, in section 3.1, a definition of synchronization
is given and its relations to time and time measurement through clocks are investigated.
In order to better understand the influence of synchronization on the acquired data,
the basics of data acquisition using uniform and nonuniform sampling are presented
in section 3.2. An important tool to synchronize data after its acquisition is digital
resampling. Its theoretical background and fundamental algorithms are given in section
3.3. Finally, the state of the art quality indicators for measurement results and acquired
signals are discussed in section 3.4. Those indicators will be used to assess the influence
of synchronization errors on measurement results in the following chapters.
The Oxford advanced learners dictionary defines the verb to synchronize as to make
something happen at the same time as something [148]. Thus, in order to understand
synchronization it is essential to know what “at the same time” means. The concept of
time itself is closely linked to its representation through clocks.
This section starts with a brief summary of the philosophical and technical aspects of
time in section 3.1.1. In the next step, in section 3.1.2, the mathematical modeling
of clocks as a source of time is discussed. This modeling is used to define synchro-
nization in the context of WSNs in section 3.1.3. Finally, section 3.1.4 shows that the
fundamental properties of time do not only apply to physical time itself.
3.1.1. Time
59
3. Theoretical foundations
60
3.1. Time and synchronization
around the sun, leap years, i.e. years with one extra day, are introduced at regular
intervals. Furthermore, leap seconds can be introduced by international agreement at
the end of a month [3]. The reference time point for UTC is the supposed year of
Christ’s birth. A number of other timescales exist, that like UTC use the second as the
basic unit of time intervals but have different reference points. A famous example is
the Unix time, which is used by many computers. It measures time in seconds since
00:00:00 on the first of January 1970 [150].
3.1.2. Clocks
Devices that measure physical time are called clocks. Today they are almost exclusively
made up of an oscillator, which generates events at a fixed time interval, and a counter,
which counts them [119, 3]. Examples of this design are mechanical clocks, where
the oscillator is realized as a pendulum and the counter by a gearbox with a dial; digital
clocks with quartz oscillators and digital counting circuits; or even atomic clocks, where
photon emissions of caesium 133 atoms are used to generate an electrical signal at
9,192,631,770 Hz, whose periods are counted [3]. In order for such a clock to represent
a standardized timescale, e.g. UTC, the point in time at which it was started needs to be
added to the counter value. This immediately leads to the following widely used clock
model [118, 64, 119]:
Here, the clock value c at the time t is given by the value of a counter hc scaled with its
counting period T clock and shifted by an offset t0 1 .
Bearing in mind that the key characteristic of time is the ordering of events, this model
can be generalized as follows: a clock is a function c, that maps physical time t to a real
number such that [118, 64, 119]:
An ideal clock according to (3.1) would map physical time onto itself [118]:
cideal (t ) = t. (3.4)
1 Thecounter value hc is by definition discrete. However, this fact is not paid much attention to by most
authors [118, 64, 119]. Instead clock and counter are largely treated as if they where continuous.
61
3. Theoretical foundations
Thus, its clock rate f (t ) would be exactly one at all times [119, 118]:
dcideal (t )
fideal (t ) = = 1, ∀t. (3.5)
dt
However, the rate of a real clock generally differs from this ideal, i.e. the clock has a
drift ρ , 0 [119]:
ρ(t ) = f (t ) − 1. (3.6)
In many applications the clock drift changes only very slowly with time. Thus, a model
with constant drift can be used for short timespans [119]:
dρ(t )
≤ Θmax . (3.9)
dt
Apart from the low frequency changes in clock rate, which are generally referred to as
drift, every oscillator shows some fluctuations in its period from cycle to cycle. This
phenomenon is called jitter and can be described by adding a random error δt (t ) to the
clock value:
Finally, a real clock may also differ from the ideal clock by a constant offset:
62
3.2. Data acquisition
3.1.3. Synchronization
As already stated in the introduction to this section, synchronization makes things hap-
pen at the same time. With reference to clocks, this generally means that two clocks
show the same clock value at the same physical time. Thus, two clocks ci (t ) and c j (t )
are synchronized to the precision p if [64]:
⏐⏐ ⏐
⏐ci (t ) − c j (t )⏐⏐ < p (3.12)
If this condition holds true for all pairs of clocks from a set i, j ∈ {1, 2, . . . , N}, it is
called a synchronized set of clocks. If the ideal clock is included in the set, the set is
called externally synchronized, if not, it is called internally synchronized [64, 119].
The difference ϵ sync. (t ) = ci (t ) − c j (t ) is called the synchronization error. It is the
result of the individual clocks’ drift, jitter and offset with reference to physical time
(see section 3.1.2).
From the previous discussion of time and clocks, it becomes apparent that the key
property of physical time, i.e. its ability to order events, may not be exclusive to it.
Any function that fulfills the clock property (3.3) can be used, to uniquely order events,
regardless of whether it is synchronized to physical time or not. The only property
required by (3.3) is that the function is monotonically increasing. Thus, also other
physical quantities may be used as a substitute for time in a given application. One
example would be the rotational position of a machine shaft, provided that it doesn’t
stop or change direction (see also sections 2.4 and 4.5).
Any such clock or group of clocks can be seen as creating its own individual timescale.
However, combining observations from different timescales is only possible, if the
clocks have been synchronized. Seen in this light, the key function of international
time standards, like the second or the UTC, is to facilitate the communication of time
information.
Data acquisition is the process of obtaining data from measurements for storage and
analysis [84]. Today, data acquisition is mostly done with acquisition systems that
produce digital data for storage and processing on a computer system. Two very distinct
types of data acquisition are treated in this thesis:
63
3. Theoretical foundations
1. In event detection the occurrence of an event, e.g. a sound pulse or the cross-
ing of a light barrier, is detected and the time of occurrence is recorded, i.e. a
timestamp is assigned to the event.
Sampling is the conversion of a continuous signal x(t ) into a discrete one x[n] by taking
its value at discrete time instants tn . For uniform sampling the timing instants are given
by a constant sampling interval T s [102]:
The Nyquist-Shannon sampling theorem states that a signal x(t ) is uniquely determined
by its samples x[n], if its Fourier transform X ( jω) is zero for frequencies larger than
half the sampling frequency ω s [102]:
ωs π
X ( jω) = 0 for |ω| ≥ = . (3.14)
2 Ts
ωs
The frequency ωN = 2 is called the Nyquist frequency and 2ωN the Nyquist rate
[102].
Sampling can be modeled mathematically by the multiplication of the signal x(t ) with
a comb function s(t ) [102] 2 :
∞
∑
s(t ) = δ(t − nT s ) (3.15)
n=−∞
x s (t ) = x(t ) s(t ), (3.16)
2 The resulting signal x s is strictly speaking still continuous, but it is only nonzero at the sampling instants.
64
3.2. Data acquisition
where δ is the Dirac delta function. In the frequency domain the multiplication becomes
a convolution:
1
X s ( jω) = X ( jω) ∗ S ( jω), (3.17)
2π
where X s , X and S are the Fourier transforms of x s , x and s. Thus, the spectrum X s of
the sampled signal is the periodic repetition of the continuous signal spectrum X (see
figure 3.1).
If the signal bandwidth W is larger than the Nyquist frequency ωN , i.e. the Nyquist-
Shannon sampling theorem is violated, the original spectrum and its repetitions will
overlap [102]. This phenomenon is called aliasing, as it lets energy from higher fre-
quency components appear at lower frequencies as shown in figure 3.2.
Figure 3.2.: Example of an amplitude spectrum with aliasing. Dotted green lines show
the individual repetition spectra. Red filled areas mark frequency intervals
where a reconstructed signal would be distorted by aliasing.
65
3. Theoretical foundations
For nonuniform sampling the time interval between the sampling instants is not con-
stant. Instead the signal is acquired at a set of time instants {tn }n∈ [88]. A conse-
quence of this is that no unique sampling frequency can be defined anymore and that
the Nyquist-Shannon sampling theorem does not apply. However, a sampling theorem
for nonuniform sampling given in [88] states, that a continuous signal is uniquely de-
termined by its nonuniform samples {tn }, if the average sampling frequency is above
the Nyquist rate [88]:
If the nonuniform samples {tn } satisfy the Nyquist rate on average, it can
uniquely represent a band-limited signal [. . . ] if the samples are not the
zero-crossings of a band-limited signal of the same bandwidth. The set {tn }
is then called a sampling set.
[. . . ]
If the average sampling rate is higher than the Nyquist rate, irrespective
of the set {tn }, there is always a unique solution.
In [89, 88] the spectrum of nonuniformly sampled signals has been derived, for the
case that the nonuniform sampling instants tn deviate from a uniform grid nT s by a
finite amount, i.e.:
tn = nT s + Θ(tn ), (3.21)
where Θ(tn ) is a band-limited function. Then the signal x s sampled at the nonuniform
time instants tn can be modeled as the product of the original signal x and the comb
66
3.2. Data acquisition
function x p :
x s (t ) = x(t ) x p (t ) (3.22)
∑∞
x p (t ) = δ(t − tn ). (3.23)
n=−∞
It is noted in [88] that x p is essentially a phase modulated signal. Figure 3.3 shows an
example from [88] of the spectrum of a series of nonuniform sampling pulses x p .
If the bandwidth of Θ is WΘ < π/T s , the modulation spectra of x p do not overlap with
the base band component [88]. Thus, lowpass filtering yields [88]:
⏐⏐ ⏐
⏐1 − Θ̇(t )⏐⏐
x p,lp (t ) = (3.26)
Ts
If in addition the bandwidths W and WΘ of x and Θ fulfill the condition π/T s > W +
WΘ , there is also no overlap with the base band component in x s and lowpass filtering
yields [88]:
⏐⏐ ⏐
⏐1 − Θ̇(t )⏐⏐
x s,lp (t ) = x(t ) . (3.27)
Ts
67
3. Theoretical foundations
x s,lp (t )
x̃(t ) = ≈ x(t ). (3.28)
x p,lp (t )
For waveform sampling, data acquisition systems employ a typical sequence of pro-
cessing steps [65, 84, 48]. Figure 3.4 shows this sequence, also referred to as the digital
measurement chain. First, a sensor converts the physical signal x phys (t ) into an electri-
cal signal xel (t ). This then is amplified or dampened in order to fit the input range of the
successive processing elements. A lowpass filter, the anti-aliasing filter, ensures that all
signal components above half the sampling frequency are damped below an acceptable
level 3 . Next, the filtered signal x f ilt (t ) is sampled by a sample-and-hold (S&H) circuit
and its amplitude is quantized by an ADC. After this, the signal x[n] is fully digital and
ready for further processing.
68
3.2. Data acquisition
(a) parallel
(b) multiplexed
69
3. Theoretical foundations
In digital resampling an already sampled signal is sampled again and translated to an-
other sampling grid. As will be shown in chapter 4, this can be used to synchronize data
even after its acquisition. Furthermore, digital resampling makes it possible to change
the output sampling rate of data acquisition system without changing the hardware, es-
pecially the anti-aliasing-filter. Thus, the use of digital resampling greatly increases the
flexibility of a wireless sensor.
This section starts by introducing the major classes of digital resampling algorithms
and their spectral effects in section 3.3.1. After this the most relevant filter algorithms
are briefly presented in section 3.3.2. Finally, in section 3.3.3, practical issues for the
implementation of these algorithms on digital processors are discussed.
This section starts with sampling rate reduction and increase by an integer factor (sec-
tions 3.3.1.1 and 3.3.1.1). After this, sampling rate changes by a rational factor and
arbitrary resampling are treated in sections 3.3.1.3 and 3.3.1.4.
To reduce the sampling rate ω s of a discrete signal by an integer factor, only every M th
sample is kept and the rest are discarded [25]:
In the spectrum this leads to a convolution of the original signal spectrum with a delta
comb of the spacing ω′s = ω s /M. Thus, the original spectrum is replicated at multiples
of the new sampling rate ω′s as shown in figure 3.6.
70
3.3. Digital resampling
If the original signal x has a bandwidth larger than the new Nyquist frequency ω′N =
ω′s /2, the spectral replications overlap and aliasing occurs. To avoid this, a digital
lowpass filter is commonly used before decimation (see figure 3.7).
In order to avoid all aliasing, the filter H in figure 3.7 needs to have a stopband that
starts at the new Nyquist frequency ω′N and dampens all signal components below an
acceptable error threshold δ s . The passband ω p of the filter should encompass the
entire signal bandwidth that is to be used for further evaluation. In the passband the
ripple caused by the filter should not exceed an error threshold δ p . Figure 3.8(a) shows
this type A tolerance scheme together with the signal spectra V after filtering and Y
after decimation [93]. The required steepness of the filter is dependent on the relative
width of the passband ∆ω = 2π(ω′N − ω p )/ω s . Thus, at high rate change factors
M the passband quickly gets very narrow and very steep filters with high orders are
required:
ω′N − ω p 2π ( ω s )
∆ω = 2π = − ωp (3.30)
ωs ω s 2M
π
⇒ ∆ω < . (3.31)
M
However, the required steepness of the filter can be reduced by accepting aliasing in
the filter’s transition band (see figure 3.8(b)). This is only a minor concession, as the
transition band is generally not used for further evaluation [93]. In fact, the only signal
bands that really need to be damped below δ s , are the frequency bands of ±ω p around
multiples of the new sampling frequency ω′s , as they are mapped to the filter’s passband
during decimation (see figure 3.8(c)). Very efficient filter structures exist for this type
C tolerance scheme (compare section 3.3.2).
71
3. Theoretical foundations
Figure 3.8.: Tolerance schemes for digital anti-aliasing filters (after [93]). V is the sig-
nal amplitude spectrum after filtering and Y the signal amplitude spectrum
after decimation. Red shaded areas mark the frequency bands where alias-
ing may occur.
72
3.3. Digital resampling
This interpolation leads to an increase of the signal bandwidth (see figure 3.9). Thus,
in general, components from the spectral repetitions around the original sampling rate
ω s appear in the baseband of the interpolated signal. This effect, called imaging, can
be suppressed by filtering the interpolated signal with a lowpass filter (see figure 3.10).
This filter also needs to have a gain of L in order to obtain an amplitude of 1/T s′ =
L/T s in the output signal [122, 102]. Similar to an anti-aliasing filter, an anti-imaging
filter can be designed to suppress all signal components above the original Nyquist
frequency. However, the frequency bands critical for imaging, are actually only those
of ±W around multiples of the original sampling rate ω s . Thus, it is sufficient for the
filter to dampen only those bands. This can be used to construct very efficient filters,
especially for highly oversampled input signals.
73
3. Theoretical foundations
Digital resampling that changes the sampling rate by a rational factor R = L/M can
easily be achieved by combining an interpolator and a decimator with the integer factors
L and M [25]. In this case, the digital lowpass filters after the interpolator and before
the decimator can be replaced by one that fulfills the spectral requirements of both an
anti-aliasing and an anti-imaging filter. This approach has been successfully been used
to resample acquired data from motors at constants speeds in [47].
This section introduces a number of basic digital resampling algorithms. A focus is put
on decimation filters, as they are more relevant for this thesis.
74
3.3. Digital resampling
Lowpass filters with finite impulse response (FIR) are well suited for interpolation and
decimation with integer rate change [25, 122]. The transfer function and difference
equation of an FIR filter are [102, 25]:
Q
∑
H (z) = h[q]z−q (3.33)
q=0
Q
∑
y[n] = h[q] · x[n − q], (3.34)
q=0
where Q is the filter order and h the impulse response of the filter. The difference
equation of a FIR-decimator with the structure from figure 3.7 can be directly obtained
by combining (3.29) and (3.34):
A consequence of (3.37) is that although the lowpass filtering logically comes before
the decimation, it is possible to calculate the entire FIR filter at the lower output rate.
This is also referred to as the polyphase implementation of an FIR decimator, as it in-
volves creating Q + 1 intermediate signals v, whose phase differs by one input sampling
period (compare 3.13(a)). Corresponding polyphase FIR interpolation filters can also
be derived [25].
Unlike infinite impulse response (IIR) filters, FIR filters are always stable and can be
designed with a linear phase response. Since FIR decimation and interpolation filters
in polyphase implementation are as efficient as IIR filters, FIR filters are generally
preferred in resampling applications [122, 25]. Anti-aliasing filters of types A and B can
be easily designed with FIR filters. Furthermore, iterative least-squares and equiripple
design algorithms for FIR filters, allow approximating nearly any desired frequency
response [102, 47].
A major disadvantage of FIR resampling filters is that the required filter order increases
quickly with the rate change factor. Therefore, they are primarily used at small factors
(range 1 . . . 10).
75
3. Theoretical foundations
magnitude [dB]
−20
−40
−60
−80
−100
−120
0 0.5 1 1.5 2
ω/ω’s [1]
The minimum filter order Q of an FIR lowpass filter using equiripple design can be
estimated as [102]:
−10 log10 (δ p δ s ) − 13
Q= , (3.38)
2.324∆ω
where δ p and δ s are the allowed frequency response ripple in the pass- and stopband
and ∆ω = 2π (ω stop − ω p ) /ω s is the normalized transition bandwidth. For a type A
decimation filter the stopband edge ω stop is directly dependent on the decimation ration
M:
ωs
ω stop = ω′N = (3.39)
2M
As the passband edge ω p has to be smaller than ω stop , it can be written as:
76
3.3. Digital resampling
Table 3.1 shows the computational and memory requirements of a polyphase FIR deci-
mator. A key feature of this filter is that the rate of mathematical operations, i.e. addi-
tions and multiplications, is independent of the high input sampling frequency.
A different class of filters for decimation and interpolation with integer rate changes
are cascaded integrator-comb (CIC) filters [58]. Their key feature is that they do not
require any multiplications and can thus be implemented very efficiently. As shown in
figure 3.14(a), a CIC-decimator of the order Q consists of a cascade of Q integrators
before the decimation and Q comb filters after it [58]. In a CIC-interpolator the comb
filters come before and the integrators after the interpolation.
0
magnitude [dB]
−20
−40
−60
−80
−100
−120
0 2 4 6
ω/ω’s [1]
The frequency response of a CIC filter referenced to the higher sampling rate is:
)Q ⎡⎢ MP−1 ⎤Q
1 − z−MP
(
⎢⎢⎢ ∑ −q ⎥⎥⎥⎥
H (z) = = ⎢⎢⎢⎣ z ⎥⎥⎥⎦ . (3.45)
1 − z−1 q=0
77
3. Theoretical foundations
Thus, a CIC is equivalent to a cascade of FIR filters and like them possesses a linear
phase response. There are only three integer valued parameters in a CIC filter: the rate
change factor M, the filter order Q and the differential delay P [58]. The filter order is
commonly chosen in the range of Q = 1 . . . 6 and the differential delay P = 1, 2. Figure
3.14(b) shows the magnitude frequency response of a CIC-decimator. It is obvious that
CIC filters only offer type C alias or imaging suppression. Furthermore, the passband
attenuation is relatively high and alias suppression is only effective in narrow bands
around multiples of the output sampling rate. The decisive advantage of CIC filters is
that they can be used to realize very large M (above 100) at very little computational
costs (see table 3.2).
multiplication rate 0
ω′
operation rate Q 2πs + Q ω
2π
s
78
3.3. Digital resampling
1.5
0
magnitude [dB]
amplitude [1]
1 −20
−40
0.5 −60
−80
0
−100
−0.5 −120
−2 −1 0 1 2 0 2 4 6
t/Ts [1] ω/ωs [1]
Finally, if four samples of the signal are interpolated by a cubic function using La-
grangian interpolation and the center interval is evaluated, the impulse response of the
filter is a piecewise polynomial:
As can be seen from figure 3.15(b), polynomial interpolation, especially at low orders,
has only a very narrow passband with tolerable attenuation. The alias attenuation is
79
3. Theoretical foundations
also relatively poor, as the filter slopes are not very steep. However, the magnitude
frequency responses of polynomial filters show high damping around multiples of the
input sampling rate. Thus, they provide a reasonable imaging suppression for highly
oversampled signals.
a Values were calculated by the author assuming Neville’s algorithm and a uniform input sampling interval.
The transposed Farrow filter [7] implements the hybrid filter model shown in figure
3.12. As the model has only discrete in- and outputs the convolution integral (3.52) of
the continuous filer ha can be reduced to a sum [7]:
∫ ∞
y(t ) = x(τ)ha (t − τ) dτ (3.52)
−∞
∞
∑
y[l] = y(lT s′ ) = x(tn )ha (lT s′ − tn ). (3.53)
n=−∞
where M is the polynomial order and Q the number of polynomial segments. The
polynomials are expressed in terms of a kernel fm and polynomial coefficients cm that
underlie a symmetry constraint:
⎧ ( )m
2(t−qT s′ )
⎪
⎪ ′
Ts − 1 , qT s′ ≤ t < (q + 1)T s′
fm (q, t ) = ⎪ (3.55)
⎨
⎪
⎩ 0, otherwise
{
cm [q] , m even
cm [ Q − 1 − q] = . (3.56)
−cm [q] , m odd
80
3.3. Digital resampling
The fractional interval µn ∈ [0, 1) specifies the location of the nth input sample with
reference to the lnth output sample, which is the output sample that occurs directly at or
before it:
tn = (µn + ln )T s′ . (3.57)
The polynomial kernel fm evaluated for t = ln T s′
− tn can be expressed as 4:
(1 − 2µn )m , µn , 0
{
fm (q, lT s′ − tn ) = . (3.58)
(−1)m , µn = 0
Substituting (3.54) to (3.56), (3.58) into (3.53) and rearranging the order of summation
yields:
(q,l) Basis multipliers
⎡ ⎤
∑M Q−1
∑ ⎢⎢⎢ nup∑ ⎥⎥⎥⎥
y(lT s′ ) = x(tn ) fm (q, lT s′ − tn )⎥⎥⎥⎥,
⎢
cm [q] ⎢⎢⎢⎢ (3.59)
⎢ ⎥
⎢⎣ ⎥⎦
m=0 q=0 n=nlow (q,l)
Integrate & dump
Cm
where nlow (q, l) and nup (q, l) mark the lower and upper boundaries of the interval,
where ha is nonzero. The filtering equation 3.59 can be expressed as the structure
shown in figure 3.16.
81
3. Theoretical foundations
The transposed Farrow filter is very efficient in resampling signals, when the output
sampling rate is lower than the input sampling rate. Its computational and memory
requirements are given in table 3.4. Figure 3.17 shows a typical magnitude frequency
response of a transposed Farrow filter. It is obvious that only type C alias suppression
is provided. Furthermore, there is notable signal attenuation in the passband.
0
magnitude [dB]
−20
−40
−60
−80
−100
−120
0 1 2 3
ω/ω’s [1]
Table 3.5 summarizes the properties of the resampling filter algorithms that have been
introduced. An ideal resampling filter would provide type A alias suppression and low
passband distortion for any rate change factor at a minimum filter order and computa-
tional load. It is apparent that no filter can satisfy all these demands. For integer rate
changes FIR filters offer good frequency response properties, but can only efficiently
handle small rate change factors. CIC filters on the other hand are very efficient also
for high rate change factors, but introduce significant signal distortions.
Arbitrary rate changes are easy to implement with low order polynomial interpolation.
However, this often does not offer a satisfactory signal quality. The transposed Far-
82
3.3. Digital resampling
row filter on the other hand has a much more complex algorithm, but offers a good
compromise between signal quality and computational complexity. Yet, it still shows
significant passband attenuation.
In many resampling applications the best results can be achieved by cascading different
types of filters. In [58] it is, for example suggested, to use CIC filters only for the
largest part of the rate change and to combine them with an FIR filter in the last stage.
The frequency response of this FIR filter can then be designed to provide type A alias
suppression as well as to compensate for the passband attenuation of the CIC filter. For
similar reasons, transposed Farrow filters have been cascaded with FIR filters in the
output stage [82].
Signed integer numbers on a computer are generally represented in the two’s comple-
ment [117]:
N−2
∑
A = −2N−1 aN−1 + 2n an , (3.60)
n=0
83
3. Theoretical foundations
where A is the represented number, N the number of bits and an the bit values. By
mentally multiplying the number with a scaling factor 2− exp(a) , also fractional numbers
can be represented [102, 117]:
⎡ N−2
⎤
⎢ ∑ ⎥
− exp(a) ⎢⎢⎢⎢ N−1 n ⎥⎥⎥⎥
A=2 ⎢⎣−2 aN−1 + 2 an ⎥⎦ (3.61)
n=0
=a
− exp(a)
A = a·2 , (3.62)
where a is called the mantissa and exp(a) ∈ the exponent. Only the mantissa and not
the exponent is stored on the computer. Thus, the processor treats it the same as any
other integer number. The programmer alone is responsible for interpreting and using
a fixed-point number according to its exponent.
To denote fixed-point numbers with different exponents the Q-format is used [117]. A
number in the Qm.n format has N = m + n + 1 bits, with m bits in the integer part, n
bits in the fractional part and one bit for the sign. The range that can be represented is
[−2m , 2m − 2−n ] and the resolution is q = 2−n [117].
The fixed-point format of a number can be changed by bit-shifting the mantissa, i.e.
multiplying it with a scaling factor [117]:
′ ′
a · 2− exp(a) = a · 2exp(
a )−exp(a) − exp(a )
·2 (3.63)
= a′
Depending on the direction of the shift (right or left), trailing or leading bits are lost
during this operation, which can lead to round-off or overflow errors (see also section
3.3.3.3).
Two fixed-point numbers A and B can only be added or subtracted, if they are in the
same format Qm.n. In this case the result C is:
C = A·B (3.65)
−(exp(a)+exp(b))
C = a·b·2 (3.66)
However, the result requires significantly more bits, i.e. C is Q(m + k + 1).(n + l), if
A is Qm.n and B is Qk.l [117].
84
3.3. Digital resampling
The biggest drawback of fixed-point number formats is their small dynamic range, i.e.
it is generally not possible to accurately represent very small and very big numbers
within the same number format, due to the fixed exponent [102]. Therefore floating
point numbers, store the exponent as well as the mantissa. This makes it possible to
dynamically adapt the exponent to the size of the number. The IEEE 754 standard
defines the following representation for a 32 bit floating point number [16]:
where s is the sign bit, f a 23 bit number, that represents an unsigned fraction in the
range [0, 0.5), and p an unsigned 8 bit integer, denoting the exponent.
Arithmetic operations with floating-point numbers essentially work the same way as
with fixed-point numbers. Yet, for floating-point numbers the computer has to perform
the format changes necessary to keep a constant number of bits dynamically during the
calculations. On powerful modern computers these calculations are accelerated by a
hardware floating-point unit (FPU). Yet, on the low-cost embedded microprocessors
typically used in WSN, a FPU is usually not available [117]. Thus, fixed-point calcu-
lations generally run significantly faster than floating-point calculations on such hard-
ware, as the programmer can minimize the needed format conversions in advance.
85
3. Theoretical foundations
8 bit. This may cause large nonlinear errors, as the number wraps around and may be
interpreted as negative, e.g. −106 in the example above. An interesting property of
the two’s complement is that, if the sum of multiple values is within the representable
range, it will be calculated correctly, even if intermediate results overflow [102].
Quantization errors arise because numbers cannot be represented with infinite precision.
They are often also referred to as round-off or truncation errors, depending on whether
a number is rounded to the closest number, which can be represented within the given
resolution, or simply truncated after the least significant bit.
Digital filters are affected by quantization errors in two ways: First, the quantization
of their coefficients changes the filter characteristic. Second, quantization of results
creates additional noise in the output signal. Regarding the coefficient quantization FIR
filters are far less sensitive than IIR filters [102, 16]. Furthermore, higher order FIR
filters are more strongly affected than lower order ones, as their zeros are placed more
closely together [102]. In [71] it is even shown, that when approximating a desired
frequency response with an FIR filter having finite wordlength coefficients, there is
a filter order Qmax , beyond which the approximation quality does not improve. The
exact value of Qmax is dependent on both the number of bits for the coefficients and the
desired frequency response. Calculation of Qmax is only possible through an iterative
search algorithm. In [71], Qmax is calculated to be in the range of 36 . . . 53 for 12 bit
coefficients and six different target frequency responses.
The additional noise in the output signal, caused by result quantization, is generally
modeled to be stationary, white and uncorrelated with the signal. Its distribution is
assumed as uniform with a variance of [16] (see also section 3.4.2.1):
q2
σ2q = . (3.70)
12
For a Qth -order FIR filter with rounding after every multiplication the output noise
variance is [102, 16]:
q2
σ2q = ( Q + 1) . (3.71)
12
If, however, the intermediate results are not rounded after every multiplication and
instead an accumulator with double-wordlength is used the output noise variance is
only [102, 16]:
q2
σ2q = , (3.72)
12
as rounding only takes place at the output stage. This optimization is only possible
in fixed-point arithmetic, because in floating-point arithmetic rounding automatically
takes place after every operation. Thus, using fixed-point arithmetic offers better control
over quantization errors and may, in some cases, even enable more accurate calculations
[16].
86
3.4. Quality of measurements and signals
A key characteristic of any measurement or data acquisition device is the quality of the
results that can be expected from it. The measurement uncertainty, which is introduced
in section 3.4.1, today is the accepted way to express the quality of any single valued
measurement result. For acquired signals, that consist of a set of samples other qual-
ity measures are used. These are introduced in section 3.4.2. Sine wave signals are
frequently used to assess the performance of measurement systems (compare section
4.6). Therefore, algorithms to estimate their parameters and purity are given in section
3.4.3.
3.4.1.1. Concepts
ϵ x = ∆x + δx, (3.73)
87
3. Theoretical foundations
The systematic error ∆x is constant and repeatable, while the random error δx arises
from unpredictable, stochastic temporal or spacial variations. The GUM assumes that
all known significant systematic effects have been removed from the measurement re-
sult prior to its evaluation [199]. Thus, the measurement uncertainty is only caused by
random and unknown systematic errors.
The general procedure for evaluating the uncertainty of a measurement, given in [107],
is as follows:
2. Record measurements
4. Report results
A procedure, that focuses more on the calculation of the uncertainty itself, is given in
the GUM [199]:
1. Express mathematical relationship between the measurand Y and the input quan-
tities Xi : Y = f ( X1 , . . . , XN )
In the following, the calculation of the standard, combined and expanded uncertainty is
described in more detail.
88
3.4. Quality of measurements and signals
When evaluating the standard uncertainties of the input quantities Xi , the GUM distin-
guishes between type A and type B evaluation [199]:
Type A evaluation is based on empirical data. For N independent measurements xi,n of
the input quantity Xi , the estimate x̂i is in most cases given as the arithmetic mean:
N
1 ∑
x̂i = X i = xi,n (3.74)
N n=1
The standard uncertainty u( x̂i ) of this estimate is the empirical standard deviation s( x̂i )
of the estimate x̂i , which is calculated from the individual observations as follows:
√ N
1 ∑
s ( xi ) = ( xi,n − xi )2 (3.75)
N − 1 n=1
s( xi )
u( x̂i ) = s( x̂i ) = √ (3.76)
N
The degrees of freedom v should always be given with the uncertainty; in this case:
v = N − 1.
Another frequent application is the estimation of the parameters ai of a M-th order
linear model [49, 199]:
y = Xa+ϵ (3.77)
with:
y = (y1 , · · · , yN )T (3.78)
⎜⎜⎜ 1 x1 · · · x1M ⎟⎟
⎛ ⎞
where X is a matrix containing the observed input values, y a vector of observed output
values, a is the parameter vector and ϵ a vector with noise. Then, the estimate â of the
parameters that minimizes the noise energy in a least-squares sense is:
( )−1
â = X T · X ·X T · y (3.81)
=D
89
3. Theoretical foundations
with:
N
1 ∑
s2 (ϵ ) = (yn −ŷn )2 (3.83)
N − M − 1 n=1
( )−1
and (dii ) N a vector with the main diagonal’s elements from D = X T · X . Again the
standard uncertainty is the empirical standard deviation of the estimates:
The combined standard uncertainty expresses the uncertainty of the estimate for the
measurand. It is calculated from the standard uncertainties of the input quantities by
Gaussian error propagation [199]:
N (
∂f 2
∑ )
u2c (ŷ) = u2 ( x̂i ) (3.87)
i=1
∂xi
∑N
= (ci u( x̂i ))2 , (3.88)
i=1
90
3.4. Quality of measurements and signals
Table 3.6.: Coverage factors and confidence levels for a Gaussian distribution [199].
Coverage factor k [1] 1.000 1.645 1.960 2.000 2.576 3.000
Confidence level p [%] 68.27 90.00 95.00 95.45 99.00 99.73
Often the expanded uncertainty Uk = kuc (ŷ) is given in addition to the combined stan-
dard uncertainty [107, 199]. Its meaning is that the interval ŷ ± Uk encompasses a large
portion of the value distribution of y [199]. This concept is similar to the confidence
interval in statistics. However, the definitions only match exactly, when all contributing
uncertainties have been obtained from type A evaluation [199]. The coverage factor k
determines the size of the portion from the value distribution that is covered. It is gen-
erally not possible to link k exactly with a level of confidence, as the exact probability
distribution of y is usually unknown [199]. However, in most applications an approx-
imately Gaussian distribution is assumed, due to the central limit theorem [57]. Table
3.6 shows a selection of coverage factors and confidence levels for a Gaussian distribu-
tion. In metrology the common choice for the coverage factor is k = 2 [57, 107, 199].
Reporting of results
When reporting a measurement result, the estimateŷ of the measurand and its combined
standard uncertainty should be given [199]. This is often done in the form of a complete
measurement result [107]:
Y = ŷ ± uc (ŷ) (3.90)
If the extended uncertainty is used instead of the standard one, the coverage factor k
has to be given. In addition, the estimates for the input quantities together with their
uncertainties, sensitivity coefficients and degrees of freedom should be given, in order
91
3. Theoretical foundations
uncertainty contribution
sensitivity coefficient
assumed uncertainty
standard uncertainty
degrees of freedom
distribution
influence
estimate
weight
√
δ S E G u c v u
√
δI 1.000 A 0.010 A uniform 1/ √3 0.006 A 10.00 V 1 0.058 W
δU 10.00 V 0.010 V uniform 1/ 3 0.006 V 1.000 A 1 0.006 W
uc 10.000 W 1 0.058 W
Uk=2 10.000 W 0.116 W
to make the calculation of the result transparent [199]. In [107] it is suggested to present
this information as an uncertainty budget in a table. Table 3.7 shows an example of such
an uncertainty budget. This presentation also helps to analyze the relative strengths of
different input quantities and to optimize measurement setups, in order to minimize
uncertainty.
When acquiring a physical signal, the result is a digital waveform, which is character-
ized not by a single value, but by a set of samples (compare section 3.2). Therefore
quantities other than the measurement uncertainty are needed to express its quality as
a whole5 . This section briefly presents the errors, which may occur in signals and
measures to quantify the relative magnitude of those errors.
92
3.4. Quality of measurements and signals
Common systematic signal errors with linear effect are offset, gain, phase shift:
ϵ x,o f f (t ) = const. (3.92)
ϵ x,gain (t ) = a · x(t ), a ∈ , a = const. (3.93)
ϵ x,shi f t (t ) = x(t + ϵt ) − x(t ), ϵt ∈ , ϵt = const. (3.94)
The consequence of (3.94) is, that the timing error ϵt can equally be expressed as an
amplitude error ϵ x . Small time errors ϵt can be easily transformed into amplitude errors
and vice versa, by locally linearizing the signal [201, 65]:
⏐
dx(t ) ⏐⏐⏐
ϵ x (t0 ) = · ϵ t ( t0 ) (3.95)
dt ⏐t=t0
⏐
Another kind of systematic error occurs, when a signal is fed through an amplifier with
a non-linear characteristic a( x):
x̃non−lin. (t ) = a ( x(t )) · x(t ). (3.97)
This also alters the frequency content of the signal and may especially give rise to new
harmonic components, called harmonic distortions [201, 84].
Random signal errors are often modeled as zero-mean Gaussian white noise ϵ x (t ) =
w(t ), but also other probability distributions may occur [84]. A common type of addi-
tive amplitude noise is the quantization noise that occurs in data acquisition systems,
when the continuous signal amplitude is discretized. The quantization error ϵq is dis-
tributed uniformly over the interval [−q/2, q/2], where q is the quantization step of the
data acquisition system. The expectation value and variance of the quantization noise
are [66]:
E(ϵq (t )) = 0 (3.98)
q2
Var(ϵq (t )) = . (3.99)
12
Three ratios are commonly used to quantify the purity of signals: the SINAD, the SNR
and the THD. The signal-to-noise and distortion (SINAD) is the ratio of a signal’s root-
mean-square (RMS) value αrms to that of noise and distortion (NAD) [201], i.e. the
RMS of the error ϵ in (3.91):
αrms
S INAD = . (3.100)
NAD
93
3. Theoretical foundations
The NAD can be split up into the energy of noise η2 and the total energy of harmonic
distortions THE [201]:
This leads to the definitions of the signal-to-noise (SNR) ratio and the total harmonic
distortion (THD) [201]:
αrms
S NR = (3.102)
η
√
T HE
T HD = . (3.103)
αrms
All three ratios are commonly expressed in the logarithmic pseudo-unit Decibel (dB),
e.g.:
In order to assess the quality of an acquired waveform, signal parameters like the am-
plitude, or purity measures like the SNR need to be estimated from the samples. This
section presents algorithms to estimate the parameters of acquired sine wave signals
(section 3.4.3.1), the phase difference between two sine waves (section 3.4.3.1) as well
as the purity of a sine wave (section 3.4.3.3).
Alternatively, every sine wave can be expressed as the sum of a sine and a cosine com-
ponent:
recommends two algorithms to estimate the parameters of a recorded sine wave signal
[201].
94
3.4. Quality of measurements and signals
The first algorithm, referred to as the three-parameter algorithm, can be used to estimate
the parameters: amplitude, phase and offset, when the frequency ω of the signal is
known [201]. The algorithm minimizes the sum of squared approximation errors:
N
∑
ϵ2 = ( x[n] − A0 cos(ωtn ) − B0 sin(ωtn ) − C0 )2 , (3.107)
n=1
where x[n] are the signal samples taken at the times tn . The least-squares estimate ŝ
of the parameter vector s = ( A0 , B0 , C0 )T is obtained through a closed form linear
equation:
( )−1 ( )
ŝ = DT0 D0 DT0 x , (3.108)
with
and
( )T
ŝi = Âi , B̂i , Ĉi , ∆ωi .
The algorithm is reported to converge rapidly and achieve good results after fewer than
six iterations [201].
95
3. Theoretical foundations
The Cramér-Rao bound (CRB) is a lower bound to the variance of an estimator like the
three- and four-parameter algorithms. Thus, it can be used to get an impression of the
estimate’s quality and how it is influenced by various quantities. In [4] the CRB for the
estimation of sine parameters have been derived:
2η2
Var(α) ≥ CRB(α) = (3.111)
⎧N 2
2η 1
= ,
⎪
⎪ three-parameter estimation
Var(ϕ) ≥ CRB(ϕ) = ⎪
⎨ N·α2
⎪
N·S NR2
2 (3.112)
⎩ 8η
⎪
⎪ = 4
, four-parameter estimation
N·α2 N·S NR2
η2
Var( x0 ) ≥ CRB( x0 ) = (3.113)
N
24η2 12
Var(ω) ≥ CRB(ω) = 3 2 = 3 , four-parameter estimation (3.114)
N ·α N · S NR2
Thus, all estimates improve with an increasing number of samples and deteriorate with
increasing signal noise. The variance of the phase estimate increases by a factor of four
when the frequency has to be estimated as well.
The phase difference ∆ϕ of two sine waves x1,2 with the same frequency can be es-
timated by estimating their phases ϕ1,2 , using the three- or four parameter algorithm
introduced above, and calculating the difference [115, 127]:
∆ϕ = ϕ1 − ϕ2 (3.115)
However, when the frequency of the two sine waves is unknown, more accurate results
can be obtained by estimating the parameters of both sine waves simultaneously [115].
The resulting seven parameter algorithm minimizes following error term [115]:
N
∑
ϵ2 = ( x1 [n] − A1 cos(ωtn ) − B1 sin(ωtn ) − C1 )2
n=1
N
∑
+ ( x2 [n] − A2 cos(ωtn ) − B2 sin(ωtn ) − C2 )2 , (3.116)
n=1
where A1 , B1 , C1 are the parameters of the first sine wave, A2 , B2 , C2 those of the second
sine wave and ω is their common frequency. Minimization of the error term is done
iteratively, similar as in the four parameter algorithm. The phase differences estimated
with this seven parameter algorithm have been found to show only half the variance of
the estimates obtained from the four parameter algorithm [115]. According to [127],
the seven parameter algorithm is currently the most accurate and robust algorithm for
the estimation of phase difference.
96
3.4. Quality of measurements and signals
To estimate the SINAD of a recorded sine wave signal x, the standard IEEE 1057 rec-
ommends to calculate the best fit x̂ using the four-parameter algorithm (see section
3.4.3.1) [201]. Then the NAD is the RMS difference between x and x̂:
√ N
1 ∑
NAD = ( x[n] − x̂[n])2 (3.117)
N n=1
(3.118)
The SINAD can then be calculated by using the estimate α̂rms , for the RMS-amplitude
of x, that has been obtained from the sine fit as well:
α̂rms
S INAD = (3.119)
NAD
For the estimation of the total harmonic energy (THE), the standard IEEE 1057 suggests
to estimate the RMS-amplitudes of the signal harmonics by repeatedly applying the
three-parameter sine fitting algorithm to the fit residuals [201]. Then the THE is:
Nh
1∑
T HE = α̂2h , (3.120)
2
h=2
where α̂h is the amplitude of the hth signal harmonic, i.e. the component with the
frequency ωh = h · ω. By default the nine lowest harmonics of a signal are evaluated
for the THE, i.e. Nh = 10 [201]. The THD is then calculated as:
√
T HE
T HD = (3.121)
α̂rms
Using sine fitting for the estimation has the advantage over alternative methods, e.g.
using the FFT, that it is less sensitive to errors from non-coherent sampling, i.e. the
signal not having been recorded exactly over an integer number of periods.
97
4. Modeling
In this chapter models of synchronous data acquisition with WSNs are developed. This
will provide first answers to the central questions of this thesis. First, the modeling of
a WSN as a data acquisition system is introduced in section 4.1. Section 4.2 describes
the modeling of acquisition errors, which leads to the definition of a useful measure of
synchronization precision. This basis is used in section 4.3 to develop a strategy for
estimating the synchronization precision necessary in a given application. Approaches
to time synchronous data acquisition are suggested in section 4.4 and approaches to
synchronous angular sampling in section 4.5. Finally, section 4.6 suggests ways to test
the synchronization precision in the individual data acquisition scenarios.
This section introduces the model of a synchronous multi-channel event detection sys-
tem as well as that of a multi-channel waveform sampling system.
In a multi-channel event detection system, every channel i detects events and assigns
timestamps ti to them. The event detection is synchronous if all channels observing the
same event a assign the same timestamp to it:
99
4. Modeling
Figure 4.1.: Model of a generic multi- Figure 4.2.: Model of a generic multi-
channel event detection sys- channel sampling system
tem applied to a WSN. applied to a WSN.
This modeling is equally valid for WSNs as for other multi-channel data acquisition
systems [Fun1, Fun2, Fun4]. In a WSN one or more channels may be located on a
single node. All nodes transmit the acquired data to a common data sink, where the
combined output signal x[n] is formed. This mapping of the model matches well with
the IEEE 1451 standard for smart sensors: acquiring nodes can be treated as TIMs and
the data sink as a NCAP. The modeling also shows that data acquisition applications
tend to assume a star topology for the underlying system (compare section 2.1.3).
1 This model has been previously published by the author in [Fun2, Fun4].
100
4.2. Acquisition errors
The first central question of this thesis is how synchronization precision can be defined
in a way that is meaningful for measurement applications. To answer this question, the
influence of synchronization and more generally timing errors on the final measurement
result is modeled. This modeling is based on the concepts of the GUM that were intro-
duced in section 3.4.1. First, the modeling of event detection is done in section 4.2.1.
In a second step, waveform sampling is treated in section 4.2.2. Finally, section 4.2.3
concludes on a useful measure for synchronization precision.
In case of event detection the measurement result is a single number, i.e. the time in-
stant tevent at which the event occurred (compare section 3.2). Although comparatively
simple, event detection already involves several steps. A typical acquisition chain is
shown in figure 4.3.
First, the physical quantity that contains the event is transformed to an electrical quan-
tity by a sensor, e.g. a photodiode in a rotary encoder. Then, an analog signal processing
stage amplifies and filters the resulting electrical signal, in order to make the event eas-
ier to detect. Next the processed signal is converted into a one-bit digital signal by a
threshold comparator. The occurrence of an event is signified by a rising or falling edge
in the digital signal. This edge triggers the reading of a clock by a digital circuit, often
a microcontroller. The resulting clock value is the timestamp ˆ tevent of the event.
101
4. Modeling
tevent = tevent + ϵt
ˆ (4.3)
= tevent + ∆t + δt . (4.4)
The contribution of the individual processing steps to the error ϵt and the measurement
uncertainty ut is analyzed in the following.
The sensor and analog signal processing are summarized as the analog stage of the
event detection chain. Due to various phenomena like internal capacities or inertia,
many sensors have a lowpass characteristic. More generally, sensors are often modeled
as linear time-invariant (LTI)-systems (H1 in figure 4.3). Likewise, the amplification
and filtering during the analog signal processing is generally modeled as a LTI-system
(H2 in figure 4.3). The group delay of these systems influences the event’s propagation
along the chain. Its error contribution is modeled to be purely systematic ∆t,ana . The
reason for this is that the components of sensors and analog circuitry generally do not
change their properties over time, apart from a small temperature drift.
In the threshold comparator, amplitude errors ϵ x of the input signal change the time,
at which an edge is generated, by ϵt,comp . For small errors ϵ x the time error is given
by (3.96). Constant amplitude errors, like gain or offset errors, result in a systematic
component ∆t,comp of ϵt,comp . Random amplitude noise causes a random error δt,comp .
As amplitude noise is commonly modeled to be zero-mean and Gaussian, δt,comp is also
assumed to be zero-mean and Gaussian, with a standard deviation of:
⎛ ⏐ ⎞−1
⎜⎜⎜ dx(t ) ⏐⏐
σt = ⎜⎜⎝ ⎟⎟⎠ σ x ,
⎟⎟⎟
⏐⏐ (4.5)
dt ⏐t=t 0
where t0 is the time of detection and σ x is the standard deviation of the amplitude
noise.
102
4.2. Acquisition errors
The propagation delays in digital circuits are usually constant. Thus, a constant com-
ponent ∆t,digi is contributed. However, when using the interrupt of a microcontroller to
detect a digital edge and read the clock, interrupt blocking code sections may introduce
a random delay δt,int (see also section 5.1.2.1). If an interrupt blocking code section is
T block long, recurs with a period T rep and is uncorrelated with the event to be detected,
the probability of it causing a delay is:
T block
Pdelay = . (4.6)
T rep
Its length is distributed uniformly between 0 and T block . The situation is the same, if the
blocking section occurs randomly with a probability of Pdelay . If T block varies randomly
between T block,min and T block,max , the edges of the uniform distribution will round off at
the edges, as large delays are less likely in this case. The exact form depends on the
distribution of T block . When multiple blocking sections occur independently of each
other their probability densities superpose.
When reading a discrete clock c at a time instant t1 the result is the clock’s counter
value hc,1 = hc (t1 ). This is commonly transformed into a time reading using the clock
model from (3.1):
t1 = hc,1 T clock + t0 .
ˆ (4.7)
However, as the clock counter is only incremented at discrete time instants, the infor-
mation actually contained in the reading, is that t1 is somewhere in the interval between
two clock updates:
Thus, there is a random error δt,read in the clock reading, that is uniformly distributed
over the interval (−T clock , 0], (see figure 4.4(a)). The expectation value is:
T clock
E(δt,read ) = − , (4.9)
2
t1 is biased. The variance of δt,read is:
i.e. the time estimate ˆ
2
T clock
Var(δt,read ) = . (4.10)
12
103
4. Modeling
In this case, the probability density function fX,∆ (δ∆t ) of the random error δ∆t in ∆t
ˆ is
obtained from those of the single clock readings through convolution:
∫ δ∆t
fX,∆ (δ∆t ) = fX,t (u) fX,t (δ∆t − u) du. (4.12)
−∞
The result is a triangular distribution (see figure 4.4). This assumes that the two clock
readings, i.e. the reading instants’ relative positions to the clock updates, are statisti-
cally independent. It is not necessary that the clocks or reading instants are uncorre-
lated. With the same clock resolution for both readings, the expectation value of δ∆t
is:
E(δ∆t ) = 0, (4.13)
The clock value itself may contain errors, e.g. an offset ˜ t0 , t0 (compare (4.7)) or a
drift error ρ , 0. Offset errors cause a systematic error contribution:
∆t,o f f = ˜
t0 − t0 . (4.15)
104
4.2. Acquisition errors
If the drift is constant ρ(t ) = a, the clock error ϵc increases linearly with time:
Often synchronization algorithms are used to limit the maximum clock error ϵc,max by
periodically resetting the error to a value ϵc,min that is close to zero (compare section
2.2.2.1). In this case the drift error of the clock becomes a sawtooth function. Thus,
when reading the clock at random instants, the resulting error δt,dri f t is uniformly dis-
tributed between ϵc,min and ϵc,max .
The synchronization process itself may also introduce an error δt,sync into the clock
value. Many publications report this to be approximately Gaussian distributed [124,
22, 35, 26]. However, also non-Gaussian error distribution are reported, e.g. bimodal
in [42] and one-side truncated Gaussian in [77]. Apparently, the synchronization error
is the combination of many error influences that, due to the central limit theorem, often
verges on a Gaussian distribution but may also differ significantly from it.
4.2.1.6. Conclusions
Table 4.1 summarizes the modeled systematic and random error influences on event de-
tection times. The distribution of the combined random error δt is a superposition of the
individual influences and depends very much on their relative strengths. If, for example,
the drift error is dominating, an approximately uniform distribution is expected. While
a dominant influence from amplitude noise would lead to a Gaussian distribution. If
none of the influences dominates the others, an approximately Gaussian distribution is
expected due to the central limit theorem.
The known systematic influences should be used to correct the estimate ˆ tevent of the
event time. The variance of the unknown systematic influences and that of the combined
105
4. Modeling
random error influences constitute the uncertainty of the measurement (compare section
3.4.1):
√
′
tevent tevent − ∆t,known ± Var(∆t,unknown ) + Var(δt ) .
=ˆ (4.17)
=ˆ
tevent,corr = ut
A measure for timestamping precision that allows for easy comparison between differ-
ent systems can be obtained by solving (4.10) for the clock resolution T clock :
√
T clock = 12σt , (4.18)
where σt is the standard deviation of a clock reading. If this is replaced with the timing
uncertainty ut , an effective clock resolution T clock,e f f is obtained:
√
T clock,e f f = 12ut . (4.19)
An acquired waveform consists of a number of signal values x[n] and their correspond-
ing sampling instants tn . As signals are usually sampled on a uniform sampling grid,
the sampling instants are often specified only implicitly through the sampling interval
T s and the timestamp of the first sample t0 .
tn = nT s + t0 . (4.20)
Errors in the signal values may result from the sensor, analog signal processing or the
characteristic of the ADC. They are commonly categorized as follows (see also section
3.4.2.1):
• offset error
• gain error
• non-linear distortion
• additive noise2
2 This includes quantization noise.
106
4.2. Acquisition errors
As in the case of event detection, errors in the acquired time values can arise from delays
along the digital measurement chain or errors of the clock. In a WSN one cause may be
the suboptimal synchronization between the individual nodes. Yet similar effects may
also occur in non-wireless acquisition devices, e.g. through multiplexed acquisition or
propagation delays of the clock signal on its path. It is often not possible to distinguish
between errors in the signal and errors in the time values, as both may change the
shape of the signal in the same way (see section 3.4.2.1). Thus, a common approach
is to assume the time information to be exact and to attribute all errors to the signal
values.
In the following, the signal errors that arise from the time base errors offset, drift (con-
stant and changing), jitter and time step are analyzed. For each error, its effect on an
acquired sine wave and its spectrum is shown as an example. The errors are modeled
as happening before the sampling of the signal. Thus, continuous signals and spec-
tra are analyzed. The acquired waveform is obtained by sampling the error containing
signals. An analysis largely identical to this section has been published by the author
in [Fun2, Fun4].
4.2.2.1. Offset
An offset error ∆t0 in the time instants causes a time shift in the sampled waveform:
to f f set,n = tn + ∆t0
˜ (4.21)
to f f set,n ) = x(nT s + ∆t0 ) = x̃o f f set (tn ).
x(˜ (4.22)
Due to the shift property of the Fourier transform [103] the spectrum X̃o f f set (ω) of the
acquired waveform is phase shifted towards the spectrum of the original signal:
with
∆ϕ = ω∆t0 . (4.25)
107
4. Modeling
ideal offset
1 0.6
sampling instant [s]
magnitude [arb.]
1
signal [arb.]
0.4
0.5 0
0.2
−1
0 0
0 50 100 0 50 100 0 0.2 0.4
sample no. sample no. normalized frequency
When the actual time instants drift away from the ideal ones by a constant rate ρ, the
resulting waveform is stretched or compressed along the time axis:
tdri f t,n = [1 + ρ] · tn
˜ (4.26)
tdri f t,n ) = x([1 + ρ] · nT s ) = x̃dri f t (tn ).
x(˜ (4.27)
Due to the time-frequency scaling property of the Fourier transform [103] the spectrum
of the sampled waveform is a frequency scaled version of the original one:
ω
( )
1
X̃dri f t (ω) = X (4.28)
|1 + ρ| 1 + ρ
1
= X (ω̃) (4.29)
|1 + ρ|
with
ω
ω̃ = . (4.30)
1+ρ
4.2.2.3. Jitter
Jitter between the ideal and real-time instants can be modeled by the addition of zero-
mean white Gaussian noise wt :
t jitter,n = tn + wt (tn ).
˜ (4.31)
108
4.2. Acquisition errors
magnitude [arb.]
1
signal [arb.]
0.4
0.5 0
0.2
−1
0 0
0 50 100 0 50 100 0 0.2 0.4
sample no. sample no. normalized frequency
As can be seen form (3.95), the effect of jitter in the sampling instants is equivalent to
additive amplitude noise w x :
⏐
dx(t ) ⏐⏐⏐
w x (tn ) = · wt (tn ) (4.32)
dt ⏐t=tn
⏐
x(˜
t jitter,n ) = x(nT s + wt (tn )) (4.33)
= x(nT s ) + w x (tn ) = x̃ jitter (tn ) (4.34)
If the signal is completely linear, like a triangle or sawtooth, the distribution of w x will
be the same as that of wt . Otherwise, its distribution will be shaped by the distribution
of the signal’s gradient dx(t )/dt. In the spectrum this noise is spread over a broad band
of frequencies (see figure 4.7). In [134] it is shown, that for a periodic signal x(t ) the
power of this noise is:
M
∑ a2m ω2m σ2t
η2jit = , (4.35)
m=1
2
where am are the Fourier coefficients of x(t ) at the frequencies ωm and σ2t = Var(wt ).
For a sine signal x(t ) = α sin(ωt ) equation (4.35) reduces to:
α2 ω2 σ2t
η2jit,sin = . (4.36)
2
In this case, the signal’s SNR as a result of timing jitter is [65] (compare (3.102)):
√
α/ 2 1
S NR = = (4.37)
η jit,sin ωσt
( )
1
S NRdB = 20 log10 . (4.38)
ωσt
109
4. Modeling
The denominator in equation 4.38 can also be treated as the standard deviation of an
angle jitter:
σϕ = ωσt (4.39)
( )
1
S NRdB = 20 log10 . (4.40)
σϕ
ideal jitter
1 0.6
sampling instant [s]
magnitude [arb.]
1
signal [arb.]
0.4
0.5 0
0.2
−1
0 0
0 50 100 0 50 100 0 0.2 0.4
sample no. sample no. normalized frequency
tn − ∆t0 n < n0
{
˜t step,n = . (4.41)
tn n ≥ n0
Alternatively, more gradual updates may be done, e.g. through a PLL. This causes a
changing drift in the signal:
In both cases the effect on the acquired waveform can be modeled by frequency modu-
lating the original one with:
t (t )
d˜
ω(t ) = 2π . (4.43)
dt
The result is a complex non-linear distortion of the signal that adds a number of modu-
lation bands to the waveform’s spectrum (compare section 3.2.2.1).
110
4.2. Acquisition errors
magnitude [arb.]
1
signal [arb.]
0.4
0.5 0
0.2
−1
0 0
0 50 100 0 50 100 0 0.2 0.4
sample no. sample no. normalized frequency
magnitude [arb.]
1
signal [arb.]
0.4
0.5 0
0.2
−1
0 0
0 50 100 0 50 100 0 0.2 0.4
sample no. sample no. normalized frequency
111
4. Modeling
If the actual acquisition times ˜tn of the samples are known, it is theoretically possi-
ble to perfectly correct the distortion to the acquired signal, as long as the sampling
theorems for uniformly or for nonuniformly sampled signals apply (see sections 3.2.1
and 3.2.2). However, the interpolation methods given by the sampling theorems cannot
be evaluated exactly, as they involve infinite sums. Even their approximate evaluation
is often too computationally expensive. Yet, practical interpolation methods exist that
work well as long as the sampling rate is significantly larger than the signals Nyquist
rate (compare section 3.3). They can be used to correct for the phase shift of a tim-
ing offset or the signal stretching of a constant drift error. The interpolation methods
for nonuniformly sampled signals are generally more complex than those for uniformly
sampled ones (compare section 3.3 and 5.3.1). Yet, the available algorithms also enable
the reconstruction of signals affected by changing drift, if the actual acquisition times
are known with enough precision.
Assuming that the uncertainty influences are stationary, the same uncertainty u( x[n]) =
u x can be used for all samples n.
The contribution u x, jit of timing jitter to the uncertainty u x of a periodic signal is given
by (4.35):
M
∑ a2m ω2m σ2t
u2x, jit = σ2x, jit = , (4.45)
m=1
2
where am are the Fourier coefficients of x(t ) at the frequencies ωm . More generally, the
jitter induced uncertainty, for any band-limited signal x(t ), is bounded through the first
moment M1 of its Fourier transform X (ω) [105, 66]:
112
4.3. Estimation of the required synchronization precision
Small uncertainties of the timing offset or small and frequent timing steps can also be
expressed through a variance σ2t and converted into amplitude uncertainties with equa-
tions (4.45) and (4.46). Yet, for drift errors and rare larger time steps, it is not possible
to derive a meaningful uncertainty this way, because they are not well described by a
variance.
However, in many cases not the entire waveform is of interest, but only some of its
properties, e.g. its amplitude, phase or frequency. In those cases it is more sensible
to treat these properties as the measurands and attribute uncertainties directly to them.
In this case (4.25) can be used to transform between timing and phase and (4.30) to
transform between drift and frequency uncertainty.
The error modeling of the previous section can be used to give an answer to the ques-
tion, which synchronization precision is needed for a given application. The basic
approach is to set an upper limit to the overall measurement uncertainty and then use
uncertainty analysis to calculate the maximum allowed timing uncertainty (compare
section 3.4.1). More precisely, the following procedure is suggested:
1. Define the measurand of the application and set an upper limit uc,max for the
allowed measurement uncertainty. If it appears easier to set an upper limit ϵmax
for the measurement error, use a suitably high coverage factor k and convert this
into an uncertainty uc,max = ϵmax /k (compare section 3.4.1.2).
2. Build a mathematical model of the relationship between measurand and input
quantities, especially the relationship between the measurand and the acquisition
timing. The equations given in section 4.2 can be helpful in this step.
113
4. Modeling
3. Obtain a first estimate for the maximum allowed timing uncertainty, by assuming
that it is the only error influence and inverting (3.88):
∂f
⏐⏐ ⏐⏐
ct = ⏐⏐⏐ ⏐⏐⏐ (4.48)
∂t
uc,max
ut,max = (4.49)
ct
4. Refine this estimate by taking the uncertainty contributions of other input quanti-
ties into account and build an uncertainty budget. If not sufficient information on
the other uncertainty contributions is available, ut,max should be chosen such that
there is a margin for unknown uncertainties. The overall uncertainty uc,max can
be modeled as the combination of the maximum timing uncertainty ut,max and
the combined uncertainty uother of all other influences:
Table 4.2.: Uncertainty margin for other influences at given timing uncertainty.
uncert. margin uother /uc,max [%] 25.0 50.0 66.6 80.0 90.0 99.5
timing uncert. ct ut,max /uc,max [%] 96.8 86.6 74.6 60.0 43.6 10.0
In this section approaches to time synchronous data acquisition are developed for event
detection (section 4.4.1) and waveform sampling (section 4.4.2). They are based on
the classification of time synchronization protocols into a priori and a posteriori syn-
chronization introduced in section 2.2.1 and the analysis of acquisition errors in section
4.2.
114
4.4. Approaches to time synchronous data acquisition
The approach to time synchronous event detection is to use a time synchronization pro-
tocol to obtain synchronized timestamps for the events. This may be done with the help
of an a priori protocol that always maintains synchronized clocks on all nodes. Alter-
natively, the event may first be timestamped from a local unsynchronized clock and the
synchronized timestamps are obtained later through a posteriori synchronization.
Figure 4.10.: Sampling systems with different approaches to time synchronous sam-
pling.
115
4. Modeling
been done, timestamps are assigned to the samples from a synchronized clock (see fig-
ure 4.10(b)). This may be done directly on the acquiring node using an a priori syn-
chronized clock. Alternatively it can also be done during transmission to the sink using
a posteriori synchronization. Under the reactive approach, the samples from different
channels will in general not have been sampled at the same timing instants, i.e. they
are not synchronous according to the definition in section 4.1.2. However, it is possible
to obtain synchronous samples through interpolation and resampling as long as the sig-
nals have been sampled in accordance with the Shannon-Nyquist theorem (see section
3.2.1). Accurate resampling is even possible when the original samples do not lie on a
uniform sampling grid (see section 3.2.2).
A hybrid approach that combines the proactive and reactive elements is also possible
[Fun2, Fun4]: The samples are acquired based on a synchronized clock and later they
are timestamped in order to increase precision.
In the proactive approach the most effort is put into triggering acquisition at the right
time. This requires a very good real-time performance of the underlying soft- and
hardware. Corrections made to the sampling clock, e.g. by a time synchronization
algorithm will lead to increased timing jitter or signal distortion. No extra effort is
needed for signal processing in the proactive approach.
In the reactive approach by contrast, the extra effort needed before and during acquisi-
tion is minimal. The only crucial point at this stage is the generation of accurate time-
stamps. After the acquisition, significant effort is needed for the resampling of acquired
waveforms. The quality of the measurement result greatly depends on the accuracy of
the algorithms used for resampling. So far, practical realizations of synchronized wave-
form sampling seem to use only the proactive approach [108, 91, 61, 159].
116
4.5. Approaches to synchronous angular sampling
In order to better understand the process of angular resampling, its signal theoretic
background was investigated. As stated in section 3.1.4 any monotonically nondecreas-
ing quantity can be used as “time”. Thus, a signal’s representation in angle domain, i.e.
as a function of the rotation angle ϕ, is just as valid as its representation in time domain,
i.e. as a function of time t. The only constraint is, that the direction of rotation does
not change, because otherwise ϕ would not be monotonically nondecreasing. By ap-
plying the Fourier transform to a signal in time domain it is transformed into frequency
domain. In analogy to this, applying the Fourier transform to a signal in angle domain
transforms it to order domain, where the order is the analog of the frequency. A sig-
nal in angle domain, in general, has a different shape and different “time-frequency”
properties than the same signal in time domain. The amplitude properties of the signal,
however, remain unchanged. Figure 4.11 shows an example of a signal x, that is repre-
sented in time and in angle domain. In angle domain the signal is a constant frequency
sine wave. In time domain it is a linear chirp function. This illustrates that, more gen-
erally, signals recorded from rotation machinery at changing speeds, are non-stationary
in time domain but stationary in angle domain. Thus, representing such signals in angle
domain greatly simplifies later signal processing. This is the key advantage of syn-
chronous angular sampling and the reason for its frequent use in the analysis of rotation
machinery (see also section 2.4).
Figure 4.11.: Representation of the same signal in time- and angle domain. The marked
positions show time, angle and signal values of a uniform sampling grid
with spacing T s in time domain.
A signal sampled on a uniform sampling grid in time domain, will in general, have
been sampled on a nonuniform sampling grid in angle domain and vice versa (see fig-
ure 4.11). Thus, the process of synchronous angular resampling (see section 2.4)
117
4. Modeling
In order to get meaningful results, the test measurements should be as similar as pos-
sible to the later application. Yet, at the same time they should not to cause too much
extra cost and provide repeatable and comparable results. So far publications on WSN-
synchronization have mostly focused on measuring the synchronization precision of
clocks. This however, makes it difficult to compare the results to non-wireless acqui-
sition systems, where usually no figure is given for synchronization precision. Fur-
thermore, other parts of the system that may have a significant influence on the mea-
surement results, e.g. interrupt delays, are neglected. Therefore, this section presents
testing methods that focus on the systems’ overall performance. They are all appli-
cable to WSNs as well as to non-wireless data acquisition systems, in order to enable
direct comparisons between the two. Three data acquisition scenarios are treated: event
detection (section 4.6.1), waveform sampling (section 4.6.2) and synchronous angular
sampling (section 4.6.3).
Synchronous event detection by several event detectors means that all assign the same
timestamp to the same event (compare (3.3)). The most straight forward way to test this
is to generate an event that is detected by all detectors. This method has already been
used to characterize the synchronization of clocks in [119, 87]. In the simplest case, the
event is a digital edge that is wired to the interrupt inputs of all sensor nodes as shown
in figure 4.12. In order to avoid a bias from the test setup, it should be ensured that
the propagation time from the event’s source is the same for all detectors. To obtain
representative results, the timestamps of many different events should be evaluated.
Doing this, the intervals between the events should be randomized, in order to avoid
correlation with internal processes of the WSN. Furthermore, the time between two
events should be significantly larger than the maximum expected synchronization error,
in order to avoid ambiguities in matching timestamps to events.
The obtained timestamps can be used to estimate the measurement error. If all detec-
tors were perfectly synchronized, they would all generate exactly the same timestamp.
118
4.6. Testing data acquisition systems
A deeper insight may be gained by evaluating the histogram of the timestamp differ-
ences. Its shape may offer indications regarding the dominant error influences (compare
section 4.2.1.6). Furthermore, the average relative drift of the clocks can be obtained
through linear regression.
119
4. Modeling
120
4.6. Testing data acquisition systems
The four parameter algorithm also estimates the amplitude and offset of the waveform,
which can be used to determine the gain and offset error of the acquisition channel.
A time offset error ϵt0 between two channels leads to a phase difference ∆ϕ in the
recorded signals [Fun1]:
∆ϕ
ϵt0 = . (4.57)
ω signal
Similar to the synchronous event detection in section 4.6.1 the phase shift during the
transmission from the signal source should the same for all channels, in order to avoid a
bias from the setup. The algorithm introduced in section 3.4.3.2 can estimate the phase
difference between two sine waves with an accuracy even higher than that of the four
parameter algorithm, if their frequency is identical. This assumption will hold true in
the suggested setup, as long as the frequency drift between the individual channels is
negligible. However, the estimate for the phase difference can only be unambiguous for
the interval [−π, π). Thus, the signal period should be chosen larger than the maximum
expected time offset error.
The SNR of an acquired waveform can be estimated using the algorithm introduced
in section 3.4.3.3. Time jitter during acquisition, caused e.g. by a synchronization
algorithm, will decrease the SNR. Yet, it is hardly possible to determine the jitter based
on the SNR as many other influences contribute to it, e.g. additive amplitude noise.
Thus, it is suggested to observe the influence of the synchronization by comparing the
SNR of the same data acquisition system with and without synchronization.
The THD can also be estimated for an acquired waveform (compare section 3.4.3.3).
Changing clock drifts or clock adjustments during the acquisition increase it. Again,
it is not feasible to determine their strengths from the measured THD due to other
influence, e.g. the input non-linearity. Instead, their influence should be observed by
comparing the THD with and without synchronization.
The estimation algorithms for the THD and SNR are closely linked and it is often
difficult to distinguish between harmonic- and noise energy. Therefore, it is often more
feasible to use the SINAD, which expresses their combined strength.
To test synchronous angular sampling algorithms the use of linear chirp signals is rec-
ommended in [14]. They are representative of signals from a machine undergoing a
speed change. In addition, a pulse signal is needed that has pulses at equidistant phase
angles thus simulating a tachometer signal. This choice of test signal is adopted here,
also because linear chirp signals are transformed into constant frequency sine waves
by synchronous angular sampling. This is very convenient, as it allows using the same
121
4. Modeling
estimation algorithms to assess their quality, which have been previously suggested for
waveform sampling. To check, whether the signal frequency is really constant, i.e. syn-
chronous angular sampling was successful, the signal’s spectrogram, obtained form a
short-time Fourier transform (STFT), should be examined.
122
5. Implementation
To test the modeling of the previous chapter in real measurements a WSN was built up
and algorithms for time synchronization as well as data acquisition were implemented
on it. The primary aim was to realize all variants of synchronous data acquisition
discussed in chapter 4. A target application was data acquisition at a test bench for
induction motors. Furthermore, the WSN should be easily adapted to new tasks in
future research projects. Especially the monitoring and diagnosis of machines were
intended as prospective applications. Another aim was to use the WSN for student
projects as well as bachelor and master theses.
These requirements are in conflict with a very low-power operation. Furthermore, us-
ing comparatively large batteries or even mains power was feasible in most places at
the test bench. Therefore, the WSN was not optimized for minimum power consump-
tion. In order to integrate well with the existing test bench infrastructure, the WSN
needed to support suitable hard- and software interfaces. Furthermore sensors were re-
quired to measure digital signals, low voltage analog signals, voltages and currents at
the induction motor, sound and temperature. In order to keep the implementation effort
manageable and to accurately represent the state-of-the-art it was decided to build upon
already existing hard- and software wherever feasible.
This chapter is structured as follows: Section 5.1 describes the hardware as well as the
software of the WSN and its integration into the induction motor test bench. The im-
plementations of time synchronization and time synchronous data acquisition are pre-
sented in section 5.2. Finally, section 5.3 describes the implementation of synchronous
angular sampling.
123
5. Implementation
This section describes the WSN that was built-up. It starts with the hard- and software
that were chosen in sections 5.1.1 and 5.1.2. The following sections 5.1.3 and 5.1.4
describe the software modifications and extensions that were made by the author. Sec-
tion 5.1.5 presents the application sensors that were created during the research for this
thesis. Finally, section 5.1.6 describes the installation of the WSN at a test bench for
induction motors.
The sensor node chosen for the WSN is the Preon32 from the Virtenio GmbH [190].
It was one of the first sensor nodes to use a microcontroller with ARM’s Cortex-M3
processor core. Thus, it provided significantly more computing power and memory
than previous 8 or 16 bit architectures at roughly the same energy cost. In addition
to the microcontroller, a Preon32 sensor node contains an IEEE 802.15.4 compatible
2.4 GHz wireless transceiver, an 8 Mbit data flash memory and a 32 kHz real-time clock
on a small PCB [179]. The block diagram of the Preon32 is shown in figure 5.2. Table
5.1 shows the key features of a Preon32 sensor node. See tables A.1 to A.3 in appendix
A for a comparison to other sensor nodes on the market.
To be usable, the Preon32 needs to be soldered to another PCB that provides it with
a power supply and usually also contains application specific connectors and sensors.
The Preon32Shuttle from Virtenio is used for this purpose (see figure 5.1). It provides,
amongst other things, a linear voltage regulator, a USB-interface that connects to the
Preon32’s serial port via a USB-to-serial bridge, as well as a number of pin headers.
Table 5.2 shows the key features of the Preon32Shuttle. The properties of the Preon32
that are most relevant for this thesis are discussed in more detail in the following sub-
sections.
124
5.1. Wireless sensor network for experiments
Table 5.1.: Key features of Preon32 [179]. Table 5.2.: Key features of Preon32Shuttle
[180].
CPU family ARM Cortex-M3 peripherals 4 LEDs
CPU clock 8 . . . 72 MHz 2 buttons
RAM 64 kB
digital interfaces 2x16 pin headers with
program-FLASH 256 kB
GPIOs, ADCs, UART,
data-FLASH 8 Mb
etc.
wireless standard IEEE 802.15.4 1 USB2.0 connector
frequency band 2.4 GHz
supply voltage 3.6 . . . 13.2 V
ADC resolution 12 bit operating voltage 3.3 V
max. sampling-rate 1000 kSamples/s (linear voltage reg.)
interfaces GPIO, UART, I2C,
dimensions 32 x 33 x 14 mm
SPI, CAN, USB
(l x w x h)
supply voltage 2.7–3.6 V
dimension(l x w x h) 27.5 x 19.0 x
3.3 mm
operating system (Contiki), Java
The Preon32 contains three different oscillator circuits whose properties are summa-
rized in table 5.3. A cascade of adjustable frequency divide and multiply circuits gen-
erates the system clock for the CPU-core and the peripherals from a given clock source
(see figure 5.3). Using the internal 8 MHz RC-oscillator as a source, a system clock
in the range of 8 . . . 36 MHz can be generated. The maximum system clock rate of
72 MHz can only be achieved, when using the clock signal from the wireless trans-
ceiver. This configuration, however, greatly increases the current consumption as it
requires the wireless transceiver to permanently stay in active mode (compare section
5.1.1.4). Therefore the sensor nodes were run with a system clock of 36 MHz generated
from the RC-oscillator throughout all experiments.
125
5. Implementation
a temperature = −10 . . . 80 °C
The microcontroller of the Preon32 contains a total of seven 16 bit timers. They can all
be clocked from the system clock with a variable prescaler and can be used to measure
times or generate periodic interrupts. Four of the 16 bit timers also have quadrature
encoder inputs. Furthermore, the microcontroller contains an integrated real-time clock
module. It has a 32 bit counting register and is clocked from the 32.768 kHz watch
crystal.
The Preon32 uses the wireless transceiver AT86RF231 from Atmel. Together with its
predecessor the AT86RF230 it is one of the most frequently used chips in wireless sen-
sor nodes. The AT86RF231 handles signal modulation as well as demodulation and
has a 128 Byte on-chip first in, first out (FIFO)-buffer for incoming and outgoing pack-
ets. It uses the 2.4 GHz frequency band and is compatible to IEEE 802.15.4, ZigBee
and WirelessHART [162]. The transceiver can automatically verify the checksum of a
received packet and send an acknowledgement. Also a number of automatic retransmis-
sions can be configured in case no acknowledgement is received. The microcontroller
communicates with the wireless transceiver through a SPI-interface. In addition, a dig-
ital line goes from the transceiver to the microcontroller that can trigger interrupts at
various transceiver events, including the start of packet reception [162].
126
5.1. Wireless sensor network for experiments
The microcontroller of the Preon32 supports four power modes (see table 5.4). In RUN-
NING mode, the CPU is active and performs operations. Furthermore, all peripherals
may be operated or shut-down depending on the application’s needs. The power con-
sumption in RUNNING-mode is highly dependent on the system clock frequency and
the state of the peripherals. In IDLE-mode the CPU is shut-off, but the system clock is
still running so that the peripherals can continue operating. In STANDBY-mode, also
the system clock and the internal RC-oscillator are deactivated. Thus, no peripherals
can operate any more. The only exceptions are the RTC that operates from an external
watch-crystal and the external interrupts. The deepest sleep-mode is the POWEROFF-
mode, which shuts-off the power supply to the entire processor core. This causes the
contents of the registers and RAM to be lost except for a few special backup-registers.
The wireless transceiver of the Preon32 has a complex state machine with a total of 13
different states. However, most of these states are purely transitional and only active for
a very short time [162]. Thus, its power consumption is determined by the three major
states: RECEIVE, TRANSMIT and SLEEP.
Table 5.4.: Major operating states and sleep modes of microcontroller and wireless
transceiver on the Preon32. Values for I supply are taken from [179].
Mode I supply Description
[mA]
RUNNING 3.7a full operation
28.3b
µC
a CPU-clock = 8 MHz
b CPU-clock = 72 MHz
127
5. Implementation
The Contiki operating system was chosen as the central part of the WSN’s software
execution environment. Contiki is specifically designed for WSNs and offers a wide
range of attractive features including a multi-process execution model, a set of different
time services, comprehensive power management and profiling mechanisms as well as
a complete IPv6-based networking stack (see also section 2.1.2.1). Compared to the
other widely used wireless sensor operating system, TinyOS, Contiki has the advan-
tage of using standard C and a module-based approach. Thus, it is more accessible to
beginners, especially students. Other OSs appeared immature (Nano-RK) or were not
available (RIOT OS, OpenOS) at the time of decision (first half of 2010). The use of an
embedded real-time operating system like FreeRTOS was precluded, as the integration
of wireless communication was poor at the time. Originally, the Preon32 was intended
to be programmed in the Java-Programming language. While this approach enables
programmers to quickly build programs for common applications, it very much limits
the access to the capabilities of the underlying hardware. Furthermore, the exact tim-
ing of operations is very difficult to control in such a virtualized execution environment
and its overhead too high to allow for the implementation of powerful signal processing
algorithms.
The software execution environment of the WSN is completed by three other compo-
nents: a firmware library with drivers for the Preon32 hardware, the Contiki platform
for the Preon32, i.e. an adaptation layer and the CMSIS-DSP-library. The driver li-
brary as well as the Preon32 Contiki platform were created by Virtenio. While the
source code for the Preon32 platform was available to the author, the driver library was
provided in binary form only. Contiki OS itself is open source and was obtained from
the official repository1 . The version used was the development branch (Contiki 3.x) as
of September 5th 20142 . Table 5.5 summarizes the software components, as well as
their authors and licenses. In the following subsections Contiki’s key features with re-
gard to this theses goals are described. More information about Contiki and its internals
can be found in [187, 186].
1 https://github.com/contiki-os/contiki
2 git hash of commit: 4c4c468907534238d7962f0bb2315694e86da3a0
128
5.1. Wireless sensor network for experiments
A Contiki process consists of a protothread (see section 2.1.2.1) plus some management
information. Every Contiki deployment contains at least one process that is started
automatically after the system has booted. Other processes may be started during the
course of the program. Many Contiki services, e.g. the network stack, use processes
that are started on initialization [187].
Contiki manages processes with a simple cooperative scheduler [187]. This means that
processes cannot be interrupted by the scheduler. Instead processes themselves release
the CPU, when they are done or wait for events. Thus, the programmer needs to ensure
that no process blocks the CPU for too long. When a process releases the CPU, the
scheduler invokes the next process that is ready to run. Contiki’s multithreading library,
which would allow also for preemptive multitasking, is currently not available on the
Preon32 platform.
In contrast to process events, interrupts are generated by the hardware and handled
by predefined functions. On the Preon32 platform interrupts and processes together
form exactly two preemption levels: Interrupts can preempt processes, but neither can
interrupts preempt other interrupts nor processes other processes. No prioritization of
interrupts or processes is currently supported.
129
5. Implementation
The Contiki operating system provides a number of time services that can be used
by applications. The clock module provides the system time, which on the Preon32
platform is derived from the real-time clock of the microcontroller. When a sensor
node is powered on, the clock is initialized with zero and keeps running as long as the
power supply is connected. The hardware driver library uses a virtual 64 bit register
to count the ticks of the real-time clock (RTC). One RTC-tick is T tick,rtc = 2−14 s ≈
61.0 µs. Thus, it can run for about 3.6 · 107 y without wrap-around. However, the clock
values in the Contiki operating system are 32 bit values. They can be read either in the
unit of seconds or clock ticks, which is T tick,clock = 2−7 s ≈ 7.81 ms on the Preon32
platform.
A number of timer libraries that use the clock module are available in Contiki. The
timer library allows to set a timer that expires in a given time interval starting from
the current time. The program needs to actively check whether the timer has already
expired or not [187]. In the etimer library a Contiki process is run in the background
that periodically checks all etimers for expiration [187]. When an expired etimer is
detected, an asynchronous event is sent to the process that started the etimer. A similar
mechanism is provided by the ctimer library. Here a callback function is executed on
expiration [187].
Since all timer services described above require the software to check for expiration,
they are not suited for real-time operation. The rtimer library, on the other hand, relies
directly on hardware interrupts [187]. When an rtimer expires, a predefined handler
function is called directly from the interrupt routine. To allow for a finer time resolu-
tion, the rtimer library uses a separate clock module [187], which on the Preon32 plat-
form is the unscaled RTC: T tick,rtimer = T tick,rtc = 2−14 s. As the rtimer clock value
is 32 bit wide, it wraps-around after about 72.8 h. In contrast to the software timer li-
braries, the rtimer library is restricted to handle only one timer at a time. Furthermore,
rtimer tasks need to be short as they execute in the interrupt context (compare section
5.1.2.1). Since the rtimer is essential for implementing synchronous data acquisition
its relevant functions are shown in listing 5.1.
Finally, the hardware driver library also provides access to the 16 bit hardware timers of
the microcontroller (see section 5.1.1.1). Their clocks are derived from the microcon-
troller’s system clock instead of the real-time clock. Thus, a much higher resolutions
can be achieved. Yet, the timing precision is lower, due to the less precise oscillator.
The hardware timers can also trigger interrupts and thus may be used as a replacement
for the rtimer, when the lower width and precision are not critical.
130
5.1. Wireless sensor network for experiments
1 /**
* D e s c r i p t i o n : post a real −time t a s k
3 * Parameters :
* task : pointer to the task
5 * time : t i m e i n s t a n t when t h e t a s k i s t o be e x e c u t e d
* d u r a t i o n : unused argument
7 * func : a f u n c t i o n t o be c a l l e d when t h e t a s k i s e x e u t e d
* ptr : p o i n t e r t h a t w i l l be p a s s e d a s a r g u m e n t t o f u n c
9 * R e t u r n v a l u e : 0 −> f a i l u r e , o t h e r w i s e −> s u c c e s s
*/
11 i n t r t i m e r s e t ( s t r u c t r t i m e r * task , r t i m e r c l o c k t time ,
r t i m e r c l o c k t d u r a t i o n , r t i m e r c a l l b a c k t func , void * p t r ) ;
13
/**
15 * Description : get the current time
*/
17 # d e f i n e RTIMER NOW ( ) r t i m e r a r c h n o w ( )
19 /**
* D e s c r i p t i o n : g e t t h e t i m e t h a t a t a s k l a s t was e x e c u t e d
21 * Parameters :
* task : the task
23 * R e t u r n v a l u e : t h e t i m e t h a t a t a s k l a s t was e x e c u t e d
*/
25 # d e f i n e RTIMER TIME ( t a s k ) ( ( t a s k ) −> t i m e )
In the physical or radio layer, only one module is available, which is the driver for the
Preon32’s transceiver chip. It was created by Virtenio and consists of an upper-layer,
for which the source code was available, and a lower-layer in binary form. The framer-
layer creates and parses MAC-layer data frames. Contiki provides an IEEE 802.15.4
compatible framer (framer-802154) and a framer to create packets with only minimal
protocol overhead (framer-nullmac). Only the former was used for this thesis.
131
5. Implementation
The RDC-layer is responsible for duty-cycling the wireless transceiver of a sensor node.
A minimal implementation that simply always keeps the transceiver on is provided
by the nullrdc module. Alternatively, a module implementing the ContikiMAC-
protocol [29] was used for this thesis. ContikiMAC tries to minimize the on-time of
the transceiver (see also section 2.1.4.2). Another low-power radio duty-cycling proto-
col X-MAC [19] is also available on Contiki. It is a precursor of ContikiMAC and has
been largely superseded by it.
The MAC-layer coordinates the access of multiple nodes to the common communi-
cation channel. Here Contiki provides a dummy implementation nullmac. It simply
allows any node to send right away without any checks or collision avoidance mecha-
nisms. In addition, a classic CSMA/CA is provided. No TDMA implementation was
present. Therefore a basic one was created by the author (see section 5.1.3).
In the network layer, Contiki provides one of the world’s leading implementations of
IPv6 for WSNs. It uses 6LoWPAN-header compression to minimize protocol over-
head. The RPL-protocol is used for multi-hop routing and UDP for data transport. An
alternative layer is provided by the rime network module [28]. It originally studied
innovative ways of structuring the network stack of a WSN. However, today, there is
a strong trend towards IPv6-based solutions (see section 2.5) and therefore this option
was favored.
132
5.1. Wireless sensor network for experiments
Contiki already provides a simple time synchronization service in the timesynch mod-
ule. It is described in section 5.2.1 to allow for a better overview on the implemented
time synchronization services.
In order to minimize power consumption, Contiki supports the duty-cycling of the CPU
as well as the radio transceiver. The duty-cycling of the transceiver is implemented in
the RDC layer of the network communication stack (see section 5.1.2.3).
The duty-cycling of the CPU is implemented in the main scheduler loop (see also sec-
tion 5.1.2.1). Whenever no process is ready to run, the processor sleeps in a low-power
mode. It is scheduled to wake up, when the next etimer expires (see section 5.1.2.2).
When an interrupt occurs the sleep period aborted. For the Preon32 the IDLE-mode was
chosen as the sleep mode. Its power consumption is larger than that of the STANDBY
mode, yet it allows for peripherals to continue operating and thus does not interfere
with ongoing measurements.
Contiki contains a mechanism called powertrace that profiles the power consumption
of a sensor node during operation without any external instrumentation [31]. It sim-
ply uses the rtimer to measure the accumulated times that the CPU spends running
and sleeping. The same is done for the power modes of the transceiver. Based on
the assumption that the power consumption in one state is always the same, a node’s
overall power consumption can be estimated from this data. The power estimates of
the powertrace module for the Preon32 are experimentally verified in section 6.1.1.
Powertrace is used throughout chapter 6 to observe the effects of different data acqui-
sition algorithms on the nodes’ power consumption.
Contiki provides a simple text-based command shell that is accessed through the serial
interface of a sensor node. Commands are passed as a single line terminated by a line
feed character (ASCII: 10). Parameters are passed in the same line as the command
and separated by spaces (ASCII: 32). The output of shell commands is also printed to
the serial line. When a command is detected, a corresponding process is started. Shell
commands are defined together with their processes in application specific modules.
During the initialization of the shell, all commands are registered with the main shell
engine. This mechanism makes it very easy to add, remove or define new commands.
The Contiki shell supports Unix-like pipelines making it easy to use the output of one
command as input for another.
133
5. Implementation
5.1.3. TDMA-protocol
Table 5.6 shows the parameters that were chosen for the WSN together with the re-
sulting theoretical maximum data throughput. The resulting maximum latency by the
MAC-layer is equal to the time T f rame needed for one frame.
Precise timing of send operations is essential for the operation of a TDMA-protocol.
As discussed in section 5.1.2.1, the optimal timing service for such tasks is the rtimer.
Yet, using it for the TDMA-protocol would have had a number of important disad-
vantages. Firstly, the send operation of the radio driver only returns after the entire
packet has been sent. Thus, calling it directly from an rtimer-task would block other
interrupts for up to 4.3 ms. This would make precise timestamping of external events
impossible. Secondly, using the rtimer for the TDMA-protocol would make it im-
possible to use it elsewhere, e.g. to trigger the acquisition of data. Therefore, it was
134
5.1. Wireless sensor network for experiments
parameter
max. packet size 110 Byte
T beacon 2.747 ms (45 Ticks)
T slot 6.714 ms (110 Ticks)
T f rame 21.667 ms (355 Ticks)
result
decided to use an internal hardware timer of the Preon32 instead. Furthermore, the
packets are not directly sent in the timer interrupt routine. Instead, a poll event is issued
to a Contiki-process that does the sending. As significant latencies may occur on this
path, the sending process checks, whether there is still enough time within the slot, just
before actually sending. If this check fails, the sending of the packet is postponed to
the next slot. This way, of course, the actual data throughput is reduced, but it was still
acceptable for the purpose of this thesis.
In order to save power, the leaf nodes turn off their wireless transceivers when they are
neither transmitting nor expecting a transmission from another node. The coordinator
node always has its radio on, as it is assumed to have access to mains-power.
In order to easily adapt the WSN to a multitude of data acquisition scenarios a software
framework, called the MDT smart transducer library (MSTL), was developed. It is
based on the IEEE 1451 standard, as this describes a powerful generic smart data acqui-
sition architecture, that is equally applicable to wireless and non-wireless measurement
systems (see also section 2.3.3). However, not all required features of IEEE 1451 were
implemented in MSTL. Currently the framework allows for one-shot as well as con-
tinuous data acquisition. Furthermore, it is possible to discover the nodes of a network
and to remotely configure the acquisition channels.
Figure 5.6 shows the communication model of the MSTL. It follows mostly the IEEE-
1451 reference model (compare figure 2.7). One or more Preon32 sensor nodes, acting
as TIMs, acquire data from sensors, e.g. through their ADCs. A further Preon32 sensor
node serves as NCAP and provides the user interface. The function of the MSTL is to
provide generic interfaces for the interaction of transducer drivers and TIMs, TIMs and
NCAP as well as NCAP and user applications. Thus, transducers or TIMs can be added
or removed with only minimal modifications.
135
5. Implementation
Figure 5.6.: Structure and communication model of the data acquisition framework.
Within MSTL the TIM-identification numbers (IDs) required by IEEE 1451 are equal to
the two digit inventory numbers of sensor nodes. Thus, the TIM-ID uniquely identifies
a physical sensor node at the Chair of Electronic Measurement and Diagnostic Tech-
nology (MDT) at the TU Berlin. Two IDs, however, are reserved for special purposes:
0 addresses all TIMs in the network and 1 its NCAP. The following subsections briefly
describe the implementation of IEEE 1451 key elements in the MSTL. Examples of
typical data acquisition scenarios are given in section 5.1.4.6.
5.1.4.1. Transducers
Under the IEEE 1451 standard, transducers are handled as channels. Besides the actual
acquisition channels, there are also virtual ones that read or control internal properties
of the acquisition hardware, e.g. the sampling rate of an ADC. The TIM communicates
with a transducer channel driver through a set of generic functions. Table 5.7 gives a
brief overview of the functions currently implemented.
In IMMEDIATE sampling mode, sampling may be started by an explicit trigger command
from the user, or implicitly by a read operation on the transducer channel. IEEE 1451.0
also allows external trigger sources, but this function has not been implemented. Once
sampling has been triggered, a channel acquires samples until its repetition count has
been reached. The collection of all samples acquired at one trigger is called the data
set of a transducer. It is stored in one or more output buffers of the transducer channel.
There is also a CONTINUOUS sampling mode that, after having been triggered, endlessly
acquires samples and writes data sets to the output buffers.
136
5.1. Wireless sensor network for experiments
The transmission of the acquired data sets from a transducer’s output buffer to the
NCAP is governed by the transmission mode. In user initiated mode (ON COMMAND)
the buffer is only read when the user issues a read command to the NCAP. In stream-
ing mode, data is automatically transmitted to the NCAP. This may happen either at
a fixed time interval (INTERVAL) or whenever a buffer is full (BUFFERFULL). Refer to
IEEE 1451.0 [196] for a more in depth description of the commands and their function-
ality.
5.1.4.2. TIM
The TIMs manage the transducers and relay data between them and the NCAP. On
start-up the Contiki application running on the TIMs calls an initialization function for
every transducer channel, which registers its interface functions with the TIM. Thus,
transducer channels can be added and removed with only minimal changes to the TIM
software. After start-up, the TIM application starts a Contiki process that listens for
commands from the NCAP on UDP-Port 5689. When a command arrives the corre-
sponding transducer driver function is selected and called based on the channel number
as well as the numerical ID of the command as defined in IEEE 1451.0 [196]. If the
command requires a response to be sent to the NCAP, the transducer driver needs to
call the corresponding functions from IEEE 1451.0 network layer. Commands regard-
ing the TEDS are not handled by the individual transducer drivers. Instead a common
TEDS manager module has been implemented. For every TEDS it maintains one file
on Contiki’s FLASH file system, which it reads and writes as needed. IEEE 1451.0
specifies a number of different TEDS-types to describe different aspects of TIMs and
transducers [196]. Table 5.8 gives an overview of the TEDS-types that are currently
implemented in the MSTL.
137
5. Implementation
5.1.4.3. NCAP
The NCAP manages the TIMs in the network. It contains RAM-buffers for the TEDS
and measurement data received from the transducer channels. Furthermore, it provides
a user interface to the WSN through the Contiki-shell (see next section 5.1.4.5). A
sensor node that acts as a NCAP can additionally also run the TIM application and
acquire data. When the NCAP and this local TIM communicate, the IEEE 1451.0 layer
bypasses the IEEE 1451.5 layer and relays the messages directly. The TIM application
itself is identical to that running on normal TIM nodes.
The network layer manages the transmission of commands and measurement data be-
tween NCAP and TIMs by packing them into 6LoWPAN messages and passing those
to Contiki’s network stack. As Contiki’s networking stack does not support interleaved
reception of IPv6-packet fragments from different packets, fragmentation of larger
messages is handled by the MSTL-network layer. In the current implementation the
maximum MSTL-payload per packet is 60 Bytes and the maximum allowed size of an
IEEE 1451.0 message is 256 Bytes.
Contiki’s shell is used on the NCAP to provide a user interface to the data acquisition
framework. Table 5.9 shows an overview of the implemented shell commands. Most of
them were adopted from the HTTP-application programmers interface (API) defined in
IEEE 1451.0 [196]. Only the streaming functions are not from this API. The parameters
to the commands are mostly transmitted as plain text separated by white spaces. Only,
larger blocks of data are transferred to the NCAP as binary data encoded in an ASCII-
character stream with base64 encoding [62] (commands WriteData and WriteTeds).
All commands return two 16 bit binary numbers followed by the command specific
return data. The first is the error codes as defined in IEEE 1451.0 and the second the
number of data bytes that follow. The command specific return data is a block of binary
data.
138
5.1. Wireless sensor network for experiments
In order to simplify user access to the WSN, a MATLAB class interface that commu-
nicates with the NCAP using its command shell has been created by the author. It
provides equivalent functions for all shell commands from table 5.9. Furthermore, a
LabVIEW program [Stud1] and an Android application [Stud14] that interface with the
NCAP shell have been implemented in student projects.
To illustrate the working of the data acquisition framework a simple one-shot and a
continuous measurement will be described in more detail.
Listing 5.2 shows the MATLAB script of the one-shot measurement. After connecting
to the NCAP (lines 11,12) the program looks for connected TIMs and their channels
(line 14 to 27). Figure 5.7 shows the sequence of communication during this pro-
cess. To get a list of all known TIMs the script sends the TIMDiscovery command
to the shell of the NCAP. In the consequence the IEEE 1451 layers query the RPL-
neighbor table of the node and a list is returned that contains the IDs of all TIMs to
which routes are known. The actual discovery of new nodes is done independently by
the RPL-routing engine. When the TIM with the ID 41 has been found, the NCAP
stops the search and obtains a list of the TIM’s transducer channels by issuing the
TransducerDiscovery command. The IEEE 1451 layers then obtain the contents of
the META-TEDS from the TIM, which contains the needed information. After this pro-
cess the contents of the META-TEDS is cached on the NCAP, so that no transmission
between TIM and NCAP takes place when its contents is read in line 30 of listing 5.2.
At this stage, also other TEDS of the channel could be read to obtain more information
about its properties and purpose, e.g. Name- or Channel-TEDS.
139
5. Implementation
1 %% P a r a m e t e r s %%
timID = 41; % ID o f TIM t o a c q u i r e d a t a f r o m
3 adcChannel = 1; % channel t o a c q u i r e data from
perChannel = 2; % channel to c o n t r o l sampling period
5 muxChannel = 3 ; % c h a n n e l t o c o n t r o l t h e adc mux
timeout = TimeDuration ( 3 , 0 ) ; % timeout f o r a c q u i s i t i o n (3 s )
7 mode = IEEE1451 . SamplingMode . IMMEDIATE ; % s a m p l i n g mode
9 try
%% 0 . c o n n e c t i o n S e t u p
11 n c a p = IEEE1451 ( ) ;
n c a p . c o n n e c t ( ’/dev/ ttyUSB2 ’ ) ;
13
%% 1 . s c a n f o r TIMs
15 timsFound = [ ] ;
f p r i n t f ( 1 , ’tim discovery ’ ) ;
17 w h i l e ( ˜ i s e m p t y ( s e t d i f f ( timID , t i m s F o u n d ) ) )
pause ( 1 )
19 f p r i n t f ( 1 , ’.’ ) ;
21 % r e a d c o n n e c t e d TIMs
timsFound = ncap . t i m D i s c o v e r y ( ) ;
23 end
f p r i n t f ( 1 , ’OK\n’ ) ;
25
%% 2 . r e a d c h a n n e l s
27 c h a n n e l s = ncap . t r a n s d u c e r D i s c o v e r y ( timID ) ;
29 %% 3 . Read TEDs
t e d s T i m M e t a = n c a p . r e a d T e d s ( timID , chanID , t i m e o u t , . . .
31 IEEE1451 . T e d s C l a s s .META) ;
33 %% 4 . c o n f i g u r e t r a n s d u c e r
% s e t number o f s a m p l e s p e r b l o c k t o 128
35 n c a p . sendCommand ( timID , a d c C h a n n e l , t i m e o u t , . . .
IEEE1451 . CommandClass . XDCR IDLE , . . .
37 IEEE1451 . CommandsXdcrIdle . SET XDCR CH REPETITION COUNT , 1 2 8 ) ;
% s e t s a m p l i n g p e r i o d t o 1000 m i r c o s
39 n c a p . w r i t e D a t a ( timID , p e r C h a n n e l , t i m e o u t , mode , u i n t 3 2 ( 1 0 0 0 ) ) ;
% s e t i n p u t mux o f adc t o c h a n n e l 19
41 n c a p . w r i t e D a t a ( timID , muxChannel , t i m e o u t , mode , u i n t 8 ( 1 9 ) ) ;
43 %% 5 . s i n g l e − s h o t m e a s u r e m e n t
d a t a = n c a p . r e a d D a t a ( timID , a d c C h a n n e l , t i m e o u t , mode ) ;
45 catch exception
disp ( exception . getReport () ) ;
47 end
49 %% 6 . C o n n e c t i o n s h u t d o w n
d e l e t e ( ncap )
140
5.1. Wireless sensor network for experiments
After having detected the TIM and its channels, one transducer channel, an ADC, is
configured (lines 35 to 41 in listing 5.2). The sequence of communication is illus-
trated by figure 5.8. First, the number of samples per data block is set by sending the
setDataRepetition command to the transducer channel with the help of the shell
command SendCommand.
After this, two virtual actuator channels are written that control properties of ADC:
the sampling period (in µs) and the analog input multiplexer. In each case the shell
command WriteData is used. This first puts the corresponding channel into operation
mode (command: channelOperate) and then writes data to its data set (command:
writeDataSetSegment). Finally, the channel is put back into idle state (command:
channelIdle).
The data acquisition itself is done in line 44. Its communication sequence is shown in
figure 5.9. The shell command ReadData is used to first put the acquisition channel into
operating mode. The subsequent reading of the data set triggers the data acquisition on
the channel. When the acquisition is finished, the data is returned to the NCAP, which
relays it to the PC.
141
5. Implementation
142
5.1. Wireless sensor network for experiments
Listing 5.3 shows a MATLAB script that performs a continuous acquisition. The dis-
covery and configuration steps would be identical to the one-shot case and have been
therefore omitted. The corresponding sequence of communication is shown in figure
5.10. First a new stream is started with the StartStream command. This causes
the sampling mode of the transducer to be set to CONTINUOUS, its data transmission
mode to BUFFERFULL and puts it into operating mode. In the given example the
last action of the StartStream shell command is to start the acquisition by send-
ing the triggerCommand to the transducer channel. By setting the last parameter of
StartStream (the waitFlag) to 1 this step could be skipped. The acquisition would
then be started with the shell command StartTrigger. This makes it possible to start
acquisitions on multiple TIMs at the same time, by first separately setting up all chan-
nels for acquisition with StartStream and then sending StartTrigger as a broadcast
command3 . After the acquisition has started the transducer continuously streams data
to the NCAP, where it is stored in a FIFO-buffer. The MATLAB program is then re-
sponsible to repeatedly read and clear this buffer by issuing the measurementUpdate
command on the shell. To stop streaming the stopStream command needs to be called,
which also puts the transducer channel back into idle mode.
3 SendingStartStream as a broadcast is often not possible as the IDs of acquisition channels may vary
from node to node.
143
5. Implementation
%% P a r a m e t e r s %%
2 N = 24; % number o f s a m p l e s t o a c q u i r e p e r b l o c k
Nb = 16; % number o f b l o c k s t o a c q u i r e
4 timID = 41; % ID o f TIM t o a c q u i r e d a t a f r o m
adcChannel = 1; % channel t o a c q u i r e data from
6 timeout = TimeDuration ( 3 , 0 ) ; % timeout for a c q u i s i t i o n (3 s )
8 try
%% 0 . c o n n e c t i o n S e t u p
10 n c a p = IEEE1451 ( ) ;
n c a p . c o n n e c t ( ’/dev/ ttyUSB2 ’ ) ;
12
%% 1 . d i s c o v e r and c o n f i g u r e t r a n s d u c e r
14 % . . . ( s e e one − s h o t a c q u i s i t i o n )
16 %% 2 . s t r e a m i n g m e a s u r e m e n t
% start
18 n c a p . s t a r t S t r e a m ( timID , a d c C h a n n e l , 0 ) ;
20 % r e c e i v e data
data = [ ] ;
22 t0 = 0;
tic () ;
24 w h i l e ( i s e m p t y ( d a t a ) | | ( d a t a . L e n g t h < (N* Nb ) ) )
% t r y t o g e t d a t a new d a t a
26 temp = n c a p . m e a s u r e m e n t U p d a t e ( timID , a d c C h a n n e l ) ;
i f ( ˜ i s e m p t y ( temp ) && ( max ( [ temp . L e n g t h ] ) >0) )
28 d a t a = a p p e n d ( d a t a , temp ) ;
tic ()
30 f p r i n t f ( 1 , ’.’ ) ;
else
32 pause ( 0 . 1 )
end
34
% check f o r timeout
36 i f ( toc ( )>timeout . sec )
e r r o r ( ’timed out waiting for data ’ ) ;
38 end
end
40
catch exception
42 disp ( exception . getReport () ) ;
end
44
%% 3 . s t o p s t r e a m i n g
46 try
ncap . s t o p S t r e a m ( timID ) ;
48 f p r i n t f ( 1 , ’DONE\n’ ) ;
catch exception
50 disp ( exception . getReport () ) ;
end
52
%% 4 . c o n n e c t i o n s h u t d o w n
54 d e l e t e ( ncap )
144
5.1. Wireless sensor network for experiments
Contiki as well as the added software for data acquisition follow the recommendations
from the literature and avoid dynamic memory allocation (see section 2.1.2). Instead all
buffers are allocated statically during compile time. This enables an easy static analysis
of memory usage.
Figure 5.11(a) shows the usage of data memory (RAM) on a TIM programmed for
synchronous angular sampling (see also section 5.3.5). This is the most resource de-
manding application that has been realized for this thesis. The transducer drivers are the
largest part and consume about 45 % of the memory. This is because the analog voltage
sensor driver uses resampling filters with large buffers in this application. The MSTL
library takes up about 10 %. Another 18 % are needed for the base system, consisting of
the Contiki operating system, the device drivers supplied by Virtenio and other symbols
mainly from the standard C library. The rest, about 25 % of the total memory space, is
not statically allocated. However, some of it will be used by the program stack.
Figure 5.11(b) shows the usage of program memory (FLASH) on the same TIM. Only
about 31 % of the total memory is used. Most of this is taken up by the base system.
The MSTL and filtering algorithms need only about 7 % of the total memory. In other
applications the amount of RAM allocated for transducer drivers is often significantly
smaller. The size of the other memory sections does not change much between appli-
cations.
drivers
other 18.3 kB
0.4 kB
drivers other
3.8 kB 10.5 kB
transducer unused
29.0 kB contiki 177.1 kB
7.6 kB
145
5. Implementation
Figure 5.12(a) shows the usage of data memory (RAM) on the NCAP. The largest part
is the NCAP application that uses about one third of the entire memory, most of it to
buffer incoming data. Contiki, the MSTL and the device drives each use about 15 %.
The memory consumption of Contiki and the MSTL is again mostly determined by the
size of network communication buffers. For the device drivers the size of the serial
communication buffer is by far the largest part.
Figure 5.12(b) shows the usage of the program memory (FLASH) on the same NCAP.
About one third of the entire memory is used. The MSTL and NCAP application to-
gether need only about 10 % of the total memory, the rest is taken up by the base system.
The investigated NCAP configuration is suitable for a wide range of applications with-
out any changes. The only exception is when a local TIM is run on the same node (see
section 5.1.4.3). In this case the size of communication buffers can be reduced in order
to make room for it in the data memory.
drivers
drivers
16.5 kB
9.2 kB
NCAP other unused
21.2 kB 9.6 kB 167.0 kB
contiki
10.0 kB
146
5.1. Wireless sensor network for experiments
A number of application transducers have been implemented for the data acquisition
framework described in the previous section. They include both hardware modules
and transducer drivers. Table 5.10 gives an overview of the transducers as well as the
commands and operating modes supported by them. The microphone and the curren-
t/voltage sensor are not included in table 5.10, as they are pure hardware modules that
rely on software drivers already shown in the table. All transducers’ hardware and
software will be described in more detail in the following.
Table 5.10.: Overview of commands and operation modes supported by the individual
application transducers.
digital actuator
analog voltage
rotary encoder
digital event
powertrace
Sensor
decimation ratio
sample period
ADC-MUX
filter select
filter coeff.
Channel
ADC
Name
Type VS S A S VA VA VA VA VA S
setDataRepetition X
setSamplingMode X X
setDataTransmissionMode X
Commands
readDataSetSegment X X X
writeDataSetSegment X X X X X X
triggerCommand X X X
channelOperate X X X X X X X X X X
channelIdle X X X X X X X X X X
deviceClear X X X
readDataRepetitionCount X
Sampling
modes
IMMEDIATE X X X X X X X X X
CONTINUOUS X X X
Transmission
ON COMMAND X X X X X X X X X
modes
BUFFERFULL X X
INTERVAL X
147
5. Implementation
The powertrace sensor is a virtual sensor that integrates Contiki’s powertrace mecha-
nism into the data acquisition framework (see also 5.1.2.5). Thus, it enables wireless
transmission of powertrace statistics. Whenever the sensor is read it returns a data set
with the current powertrace data. Table 5.11 shows the data set of the powertrace sen-
sor. It includes the accumulated times the sensor node has spent in the individual power
modes since the node has booted and since the last read of powertrace data. The pro-
tocol statistics at the end of the data set allow analyzing the power consumption of the
individual protocols in more detail. Listening and transmit times are given for both in-
coming and outgoing packets, to account for acknowledgement or beacon packets that
are sent in the opposite direction.
The digital event sensor uses a user-interrupt request (IRQ) of the Preon32 to generate
a timestamp whenever an event occurs. Both the IRQ and the event type (rising/falling
edge) are configured statically at compile time. The sensor supports both one-shot and
continuous operation. Figure 5.13 shows the block diagram of the sensor.
Whenever the configured interrupt occurs, the Preon32’s rtimer is read and the times-
tamp written to the sensor’s data set. Table 5.12 shows the structure of the sensor’s data
set. The first field is one if an event occurred since the sensor was last cleared. Other-
wise it is zero. The event counter contains the number of events since the sensor was
initialized. Finally, the last field contains the timestamp of the event. The sensor has
a buffer that holds exactly one data set, which can be read through the sensor channel.
If the sensor is in continuous operation the data set is send and the sensor is cleared
immediately after an event occurred. Section 5.2.2 describes how the sensor can be
used for time synchronous event detection.
148
5.1. Wireless sensor network for experiments
149
5. Implementation
The digital actuator is a simple transducer that controls a digital output pin of the
Preon32. Only single shot operation is supported. The pin of the actuator is config-
ured statically at compile time. The actuator’s data set consists of a single signed 8 bit
integer. Writing a zero to the actuator channel causes a logic low-level at the output
pin, writing a positive value causes a logic high-level. When a negative value is writ-
ten, the pin generates a digital pulse of 1 ms length (see table 5.13). Figure 5.14 shows
the block diagram of the digital actuator.
This sensor serves to acquire analog voltage signals using the Preon32’s ADC. It sup-
ports both one-shot and continuous operation. Signal filtering, resampling and scaling
functions are included in the sensor, making it the most complex and versatile that was
implemented.
Figure 5.15 shows the block diagram of the analog voltage sensor. The entire sensor
contains one sensor- and five virtual actuator channels that control various properties
of the acquisition and signal processing. At the input, the ADC-multiplexer, controlled
through a virtual actuator, selects the analog input channels that are sampled. In ad-
dition to the 16-ADC-channels of the Preon32, two virtual ADC-channels return sim-
ulated signals: a ramp-signal and a unit impulse. Another two channels are reserved
for the Preon32’s internal voltage reference and temperature sensor. Up to 8 channels
can be selected by the multiplexer at any time. If multiple channels are selected, they
are acquired time-multiplexed (compare section 3.2.3) and the output signal is vector
valued. The samples in the vector are stored in interleaved mode, i.e. all samples ac-
quired at the same time are stored consecutively and the channel changes from sample
to sample [196]. The analog voltage sensor operates on blocks of data. Their size can
be set through the repetition count of the ADC sensor channel. Another virtual actuator
controls the sampling period of the ADC.
150
5.1. Wireless sensor network for experiments
The acquired data is written to a memory space using DMA-transfer (compare section
5.1.1.2). This memory space is used as an acquisition buffer that can contain up to two
blocks of data. During continuous acquisition these two blocks are alternately writ-
ten and an interrupt is triggered every time one of them has been fully written. Inside
the corresponding interrupt routine, the data block is copied to the processing buffer,
which is a FIFO-buffer that can hold up to 3 data blocks. The acquired data may be
filtered using an FIR-filter with up to 128 coefficients. The filtering algorithm is taken
from the CMSIS-DSP-library provided by ARM. Filter coefficients and decimation ra-
tio are controlled by virtual actuator channels. It is preceded by a CIC-decimator that
can be configured at compile time. Alternatively, the acquired data may be resampled
with a simple S&H-resampler or the resampling filter discussed in section 5.3. The
filtered data can be rescaled using a linear function, e.g. to convert it into units of the
International System of Units (SI). The gain and offset for this operation are loaded
from the channels calibration-TEDS. Finally, the output data is stored in one-block
output buffer, where it can be accessed through the ADC-sensor channel.
Table 5.14 shows the structure of the analog voltage sensor’s output data set. The first
field is the sampling period, with which the samples were acquired. It is followed by the
timestamp of the first sample and the repetition count, which is the number of samples
per channel. At the end of the data set is an array with the samples. Section 5.2.3
describes the generation of timestamps during the acquisition process and shows how
the sensor can be used for synchronous data acquisition.
151
5. Implementation
5.1.5.5. Microphone
The microphone module contains a simple circuit that can be plugged on top a Preon32-
Shuttle, in order to detect short bursts of sound. The module was designed and three
prototypes built within a Bachelor’s project [Stud22] supervised by the author of this
dissertation. No dedicated software driver was created for the microphone module
Instead the digital event sensor, described previously in this section, was used. Figure
5.16 shows the block diagram of the microphone module. The signal of an electret
microphone is fed through a highpass filter ( fg = 50 Hz) and amplified with a variable
amplifier. Within this process the negative part of the signal is cut off. After this, a
comparator, with configurable threshold and hysteresis, generates digital pulses out of
the signal. This digital signal is connected to a user interrupt of the Preon32. The
complete circuit diagram of the microphone module is given in appendix C.1.
A sensor module was created that measures the currents and voltages of a 3-phase
electric motor. No dedicated software driver was created for it. Instead the analog
voltage sensor, previously described in this section, is used. Figure 5.17 shows the block
diagram of the sensor module. It consists of four submodules: one current/ voltage
transducer module for every phase and a signal conditioning module. The voltages are
measured towards a virtual star point created by the internal resistances (47 kΩ) of the
voltage transducers.
152
5.1. Wireless sensor network for experiments
The current/voltage transducer modules were created in a collaborative effort of the staff
at the Chair of MDT at the TU Berlin. They convert the motor voltages and currents
into proportional low voltage signals (±12 V) using closed loop converters. They also
include anti-aliasing filters. Table 5.15 lists the key technical data of the current/voltage
transducer modules. Their complete circuit diagram is given in appendix C.2.
The conditioning module was created within a Master’s project [Stud9] supervised by
the author. It maps the output signals of the current/voltage transducers to the input
voltage range of the Preon32’s ADC. A Preon32Shuttle can be plugged into a socked on
the module. The conditioning module’s circuit diagram is also given in appendix C.2.
Figure 5.18 shows three current/voltage transducer modules and the signal conditioning
modules installed in a control cabinet.
153
5. Implementation
Figure 5.18.: Three current/voltage transducer modules and signal conditioning module
installed in a control cabinet.
The rotary encoder sensor acquires timestamps at equidistant angular intervals Φ that
can be used e.g. for synchronous angular sampling (see section 5.3). The sensor only
supports continuous operation. Figure 5.19 shows the block diagram of the sensor.
The sensor hardware consists of a circuit board (see figure 5.20) that houses a Preon32
on a shuttle and provides an interface to an incremental rotary encoder. The interface to
the encoder is a standard quadrature output with two square wave signals Ua1 and Ua2 .
Depending on the direction of rotation the phase shift between the signals is 90 ° or -
90 °. One period of the signals is equivalent to one angular step. In addition, a reference
154
5.1. Wireless sensor network for experiments
pulse is generated every time the encoder crosses its zero position. All three signals are
transmitted by the rotary encoder as differential signals that are converted to standard
3.3 V CMOS-logic levels by comparators on the sensor board. The quadrature inputs
are connected to the quadrature encoder interface of one of the Preon32’s hardware
timers. The complete circuit diagram of the sensor board is given in appendix C.3.
The quadrature encoder interface of the timer automatically detects the direction of
rotation and generates one counting pulse for every edge of the two signals, leading
to four counts per signal period. When the value in the counter register reaches the
value stored in a compare register an interrupt is generated and the counter is reset. In
the interrupt routine, the current time of the sensor node’s rtimer is stored. This way
timestamps are generated at uniform angular intervals. Alternatively, the timestamp
generation can be triggered with a user interrupt. This enables the simulation of a
rotary encoder signal with a simple square wave generator.
The generated timestamps are stored in a buffer. An etimer is used to transmit buffered
timestamps at a fixed time interval. Table 5.16 shows the contents of the data set trans-
mitted by the sensor. The first field is the angular interval Φ, at which the timestamps
155
5. Implementation
have been generated. Next is the angular position ϕ0 of the first timestamp in the data
set. It is obtained by summing over all angular intervals since the sensor started operat-
ing. The repetition count denotes the number of timestamps in the data set. In order to
reduce the amount of data, only the first timestamp t0 in the data set is stored with full
32 bit resolution. For the other timestamps, the difference ∆T to the preceding times-
tamp is stored as a 16 bit value. At the given rtimer resolution of 61 µs this means,
that two timestamps may not be more than 2 s apart. This is not a significant limitation
as rotary processes usually generate timestamps at a much higher rate.
The standard configuration of the rotary encoder sensor used for this thesis, generates
30 timestamps per revolution. At rotary speeds in the range of 15 to 1500 rpm this
leads to timestamp intervals in the range of 133 to 1.33 ms. The standard transmission
interval is 100 ms, leading to 0 . . . 76 timestamps being transmitted per interval.
156
5.1. Wireless sensor network for experiments
As the targeted application area of the WSN was motor test benches, an existing test
bench for an induction motor was equipped with wireless sensors. The test bench was
driven by a three-phase squirrel-cage induction motor. The mechanical load was gener-
ated by a DC-motor, which was run as generator whose output energy was dissipated at
a 1.9 Ω load resistance. Table 5.17 shows the specification data of the two motors.
Both motors were connected through a torque shaft (HBM T30FN) with a rated torque
of 50 Nm and a rated speed of 3000 rpm. It measured the torque and shaft speed, gen-
erating proportional analog voltage signals for both quantities. These signals were
recorded by the test bench PC using a USB6009 data acquisition (DAQ)-card from
National Instruments. An optical incremental rotary encoder (Heidenhain ROD426)
with 6000 pulses/revolution was connected to the end of the shaft behind the direct cur-
rent (DC)-motor (see figure 5.22). The induction motor was driven by an inverter
(SINAMCIS G120), which controlled both the amplitude and frequency of the mo-
tor’s supply voltage. The entire test bench was controlled by a PC that ran a dedicated
LabVIEW-Program.
In order to install the WSN at the test bench, the NCAP was connected to a USB-port
of the control PC (see figures 5.21 and 5.24). The current/voltage sensor described in
section 5.1.5 was installed in the control cabinet of the test bench, where it measured
the voltages and currents at all three-phases of the induction motor (see figure 5.23).
The TIM of this sensor will be referred to as data TIM in this thesis. Another TIM
with a rotary encoder sensor module (see section 5.1.5) was connected to the rotary
encoder (rotation TIM in figure 5.22). The wireless recording of the induction motor’s
rotor temperature was realized through a TIM installed in the shaft of the test bench.
Furthermore, a TIM with a vibration sensor was installed at the test bench. However,
157
5. Implementation
the last two TIMs were not used in experiments for this thesis and have therefore not
been described in detail.
Figure 5.22.: Rotary encoder and TIM at the back- Figure 5.23.: Control cabinet
side of the breaking engine. with data TIM.
158
5.2. Time synchronous data acquisition
This section describes the mechanisms for time synchronous data acquisition that were
implemented. The aim was to support both approaches to synchronous data acqui-
sition outlined in section 4.4. First, section 5.2.1 describes the implementation of the
time synchronization services. The following sections describe their application to time
synchronous event detection (section 5.2.2) and analog waveform acquisition (section
5.2.3).
Contiki’s timesynch service (see section 5.1.2) was used for a priori synchronization.
It was modified, in order to exploit the time synchronization already provided by the
TDMA-protocol (see section 5.1.3) [Fun4]. For a posteriori synchronization, the ETA-
primitive (see section 2.2.4) was implemented [Fun4]. Essential for both synchroniza-
tion services is the precise timestamping of packets in the radio driver.
159
5. Implementation
The timestamping was implemented by the author in the upper level of the radio driver,
which was available as source code (radioAdv.c) (see also section 5.1.2).
For outgoing packets, Contiki requires a radio driver to distinguish between normal
data packets, which should be sent unaltered, and synchronization packets, where a
timestamp should be written to the last four bytes. This is done through the packet
type attribute that is set to TIMESTAMP for the latter. Timestamping on for the Preon32
was implemented such that the current rtimer-timestamp is written to an outgoing
synchronization packet just before it is transferred from the processor to the transceiver-
chip. Care was taken to disable all automatic back-off and retransmission mechanisms
of the transceiver chip (compare section 5.1.1.3 and [162]). This way, the delay time
T send,delay between timestamp generation and transmission is deterministic and as short
as possible on this hardware platform. However, T send,delay depends linearly on the
number of bytes Nbyte, f rame in the transmitted radio frame. The following equation was
determined empirically and used to correct the generated timestamps:
160
5.2. Time synchronous data acquisition
Figure 5.25.: Remote clock reading technique of Contiki’s timesynch a priori syn-
chronization service.
The global synchronized time is calculated by adding the local offset to the local rtimer
time. Applications can access it by calling the function timesynch time (see listing
5.4). This synchronized time is also included in the synchronization messages that a
node itself broadcasts.
The interval T sync between two messages starts a defined minimum value and is doubled
after every message until a defined maximum value is reached. When a node changes
its authority level, the interval is reset again to its minimum value. The aim of this
mechanism is probably to quickly achieve synchronization in the beginning or after
topology changes and to minimize the number of messages, when synchronization in
the network has stabilized. To avoid collisions between synchronization messages from
different nodes, a randomized delay is introduced in the timesynch process4 before
the synchronization message is actually sent. Similar mechanisms are used for the
route maintenance within the RPL routing protocol [109] or the CTP data collection
protocol [43].
As the timesynch service uses the unidirectional remote clock reading technique (com-
pare section 2.2.2.2), it is essential that the delay d between the generation of send and
reception timestamps is constant and as small as possible, if a good synchronization
precision is to be reached. Therefore the Contiki timesynch module relies on the ra-
dio driver to generate the timestamps right at transmission and reception. This approach
has been shown to enable high synchronization accuracies (see also section 2.2.4).
161
5. Implementation
The time synchronization service then only contains a handler function that is called
when a beacon has been received and updates the local time offset tolocal
f f . This way
all nodes within a TDMA-cell are synchronized to the coordinator clock without any
additional synchronization messages or changes to the application interface.
162
5.2. Time synchronous data acquisition
The RITS-protocol, originally introduced in [77], defines a simple but very efficient
mechanism for a posteriori time synchronization. Its basic idea is to transmit the time
T elapsed that has elapsed since an event occurred instead of the event’s timestamp tevent .
This way the only additional information that a receiving node needs to calculate the
local :
event’s timestamp relative to its local clock, is the local reception timestamp treceive
local local
tevent = treceive − T elapsed (5.3)
163
5. Implementation
Figure 5.27.: Remote clock reading technique of the ETA-primitive for a posteriori syn-
chronization.
164
5.2. Time synchronous data acquisition
Time synchronous event detection was implemented using the digital event sensor de-
scribed in section 5.1.5.2. A priori as well as a posteriori synchronized event detection
is supported. The focus was on continuous data acquisition, as this was relevant for the
targeted applications. In both approaches, a 32 bit wide timestamp with a resolution of
∆t = 61, 0 µs is generated within the handler function of a user IRQ. In the case of a
priori synchronization this timestamp is obtained from the timesynch-service. When
a posteriori synchronization is used, the current rtimer time is used instead.
At the start of a continuous measurement, the transducer driver starts a Contiki process
that waits for events. When an event occurs, the IRQ-handler sends a poll event to
this process (see also section 5.1.2.1), which in turn sends the data set with the event
timestamp to the NCAP through the IEEE 1451 layers. If a priori synchronization is
used, a standard data message is sent. If a posteriori synchronization is used, the mes-
sage is marked as an ETA-message. Figure 5.29 shows the communication sequence
during continuous synchronized event detection with a priori synchronization and fig-
ure 5.30 that for a posteriori synchronization. A thorough experimental evaluation of
both approaches is given in section 6.2. The IMMEDIATE acquisition mode can, at this
stage, only be used in combination with a priori synchronization. It was not used for
experiments within the scope of this thesis.
Time synchronous waveform acquisition has been implemented using the analog volt-
age sensor described in section 5.1.5.4. It can acquire analog waveforms using either
the proactive or the reactive approach introduced in section 4.4.2. A precursor of this
implementation has been described by the author in [Fun4]. The reactive approach may
be combined with a priori or a posteriori time synchronization. Again the focus was
on continuous acquisition for both approaches. Like in the continuous event detection
a Contiki process, in this case the daq process, which manages the data transfer, is
started at the beginning of the acquisition.
165
5. Implementation
In the proactive approach the ADC is run with a block size of one, i.e. after hav-
ing been triggered it acquires one sample. The rtimer is used to trigger the ADC
at synchronized time instants. If more than one sample is acquired within one block,
their sampling intervals are generated by one of the Preon32’s 16 bit timers (see section
5.1.1.1).
Listing 5.5 shows the Contiki process that runs the data acquisition. The nth sampling
instant t sample,n on the global timescale is defined as:
t sample,n = t0 + T s · n, (5.4)
where t0 is the start of acquisition and T s the sampling interval. Using the timesynch-
service, the sampling instants on the global timescale are converted to the local rtimer
timescale of each node. This way the rtimers of all participating nodes are set
to trigger acquisition synchronously. Similar to the event detection process shown
in figure 5.29, the ADC issues an interrupt when the acquisition of one block has
been completed. The corresponding interrupt handler then issues a poll event to the
daq process, which in turn reads the data and sends it to the NCAP.
The reactive approach has been implemented in two variants. The first one is very sim-
ilar to the proactive approach, which facilitates direct comparisons. It is used during
the experimental comparison of both approaches in section 6.4. Listing 5.6 shows the
corresponding daq process. The only differences to the proactive acquisition process
in listing 5.5 are that the sampling instants are calculated without synchronization. In-
stead, the data is sent using a posteriori synchronization with the RITS protocol (see
section 5.2.1.3). The timestamp of the acquired data is derived from the rtimer and
166
5.2. Time synchronous data acquisition
1 PROCESS THREAD ( d a q p r o c e s s , ev , d a t a )
{
3 static struct rtimer rt ;
static int i ;
5
PROCESS BEGIN ( ) ;
7
f o r ( i =0; i < n s a m p l e s ; i ++) {
9 /* reset rtimer */
r t i m e r s e t (& r t , t i m e s y n c h t i m e t o r t i m e r ( t 0 +SAMPLE PERIOD * i ) , 1 ,
t r i g g e r s a m p l e , NULL) ;
11
/ * y i e l d cpu u n t i l s a m p l e h a s b e e n a c q u i r e d * /
13 PROCESS YIELD UNTIL ( ev == PROCESS EVENT POLL ) ;
15 / * r e a d d a t a and s e n d i t * /
read and send () ;
17 }
PROCESS END ( ) ;
19
return 0;
21 }
set in the interrupt handler of the ADC, which is called at the end of acquisition. This
procedure is similar to the reactive event detection process shown in figure 5.30.
The second variant of the reactive approach uses a priori instead of a posteriori time
synchronization. This has been proven to be advantageous in situations where high
data rates require using the TDMA-MAC and it is not desired to trigger the acquisi-
tion directly from the program, e.g. to reduce the processor load or the sampling jitter.
This variant of reactive synchronized data acquisition is used for the synchronous an-
gular sampling in section 5.3. The ADC is used in continuous acquisition mode in this
variant, i.e. it continuously acquires data triggered by an internal 16 bit timer of the
Preon32 (see section 5.1.1.1). The acquired data is written to the acquisition buffer of
the analog sensor using DMA-transfer (see section 5.1.5.4). Every time, one complete
block has been acquired, the ADC-interrupt is triggered. Within the interrupt handler a
timestamp is generated using the timesynch service. This timestamp corresponds to
the acquisition time of the last sample in the block. Using also the timestamps from
previous blocks the sampling rate and the acquisition time of the first sample can be
calculated with reference to synchronized time (compare section 5.3.5).
167
5. Implementation
1 PROCESS THREAD ( d a q p r o c e s s , ev , d a t a )
{
3 static struct rtimer rt ;
static int i ;
5 static rtimer clock t tprev ;
7 PROCESS BEGIN ( ) ;
13 / * y i e l d cpu u n t i l s a m p l e h a s b e e n a c q u i r e d * /
PROCESS YIELD UNTIL ( ev == PROCESS EVENT POLL ) ;
15
/ * r e a d d a t a and s e n d i t * /
17 read and send eta () ;
An algorithm for synchronous angular resampling should provide output signals with a
good SINAD, i.e. high SNR and low THD, for a wide range of rotational speeds and
also at fast speed changes (compare sections 2.4.2 and 4.5). Its input sampling rate
ωin has to stay constant. It is given a lower bound by the maximum rotation frequency
ωrot,max and the maximum order Omax in the output signal through the Shannon-Nyquist
sampling theorem:
ωin ≥ 2ωrot,max · Omax . (5.5)
168
5.3. Synchronous angular sampling
5 A type A filter is required as imaging components outside the signal band might be mapped onto the signal
169
5. Implementation
170
5.3. Synchronous angular sampling
8192, i.e. 9.216 . . . 147.456, precalculated values are given. This means that assum-
ing a 32 bit resolution6 , at least 32 kB of memory would be needed to store all values,
which is too much for most sensor nodes. Furthermore, the upsampled interpolation
filter, suffers from the same problem regarding the high order of the output decimation
filter as the upsampled linear interpolation.
Algorithms based on low pass filtering employ the hybrid model of a resampling filter
(compare figure 3.12). First, the continuous signal is reconstructed by modulating a
delta comb with the acquired samples and feeding it through a lowpass filter. Then
the continuous signal is resampled at the desired instants. However, this reconstruction
method is only exact for uniformly sampled signals and an ideal lowpass filter. If
applied to nonuniformly sampled signals it leads to multiplicative noise in the output
signal (compare (3.27)).
Polynomial interpolation algorithms that use small polynomial orders suffer from the
same problem as the spline interpolation in [17] that was discussed above. With higher
polynomial orders the quality can be improved, but then the computational load quickly
becomes too high [139].
Another reconstruction filter for radio communication was proposed in [82]. It is based
on the method described by (3.28). Its block diagram is shown in figure 5.32. The
input signal, sampled at the time instants tn , is denoted as x(tn ) = x[n]. Transposed
Farrow filters are used to do the low-pass filtering of x s and x p as well as to translate
the samples to a common uniform sampling grid with the sampling interval T out /M.
Two additional FIR lowpass filters with the transfer function G (z) are used to narrow
the transition bands and to remove transition band noise [82]. It was observed in [82]
that the input sampling rate of the transposed Farrow filters should be at least four
times the signal bandwidth, in order to achieve a good reconstruction quality. Thus,
the FIR decimator D(z) with a downsampling factor of M is used at the output. This
filter structure is capable of offering a good signal quality [82]. M is generally small,
e.g. 2, thus the pass- and transition bands of the FIR-filters G and D are relatively
large, enabling reasonably small filter orders. As all filters are designed with respect to
the output frequency, this is independent of the input speed range. Thus, this filtering
algorithm appears to be the best option for synchronous angular resampling with a
WSN.
6 Lower resolutions are unlikely to provide satisfactory results, as the value of the sinc function is 1 at the
171
5. Implementation
The chosen resampling algorithm, as given in figure 5.32, translates a signal from a
nonuniform sampling grid {tn } to a uniform one tl = lT out . In order to use the al-
gorithm for synchronous angular resampling, the input time instants tn need to be re-
placed with the angular instants ϕn = ϕ(tn ) and the output sampling interval T out with
the angular interval Φout . Yet in a practical setup, usually only the timestamps tn and
tϕ,l′ = t (l′ Φout ) are available (compare section 5.3.4), where l′ is the counting index at
M-times the output rate. Thus, the angular instants ϕn need to be calculated by linear
interpolation:
Φout /M ( ) Φout
ϕn = tn − tϕ,ln′ + ln′ · , (5.14)
tϕ,ln′ +1 − tϕ,ln′ M
where tϕ,ln′ +1 > tn ≥ tϕ,ln′ . However, the quantity that is actually needed for the operation
of a transposed Farrow filter is the fractional interval µn (compare section 3.3.2.4). For
synchronous angular resampling, it can be calculated as follows:
ϕn ϕn
µn = M · − ⌊M · ⌋ (5.15)
Φout Φout
tn − tϕ,ln′
= . (5.16)
tϕ,ln′ +1 − tϕ,ln′
As the upper and lower Farrow filter in figure 5.32 use the same fractional interval µn ,
its calculation only needs to be done once for both filters. Figure 5.33 shows the block
diagram of the filter with the modifications for synchronous angular resampling.
The filter was designed assuming an input frequency ωin ≥ 2ωout and a signal band-
width of W sig ≤ ωout /4 (compare section 5.3.1). Thus, the passband edge was chosen
as ω p = 0.25ωout , the stopband edge as ω stop = 0.5ωout and the decimation factor of
the output stage as M = 2.
172
5.3. Synchronous angular sampling
The coefficients for the transposed Farrow filter were taken from [7]. The impulse
response of this filter consists of N = 4 polynomials of the order M = 3. The FIR filter
G at the output of the Farrow filter was designed with the help of MATLAB, using an
optimal least-squares design. Its passband characteristic was designed in such a way
that it compensates for the passband ripple of the transposed Farrow filter. The filter
order of G is Q = 61. The Output FIR decimator D was designed with MATLAB,
using an optimal equiripple design. It has a filter order of Q = 34. The MATLAB code
used for the filter design is given in appendix D.1.
The magnitude frequency responses of the individual filters are shown in figure 5.34,
that of the entire filter cascade in figure 5.35. The latter neglects effects from demodu-
lation by the divisor.
The entire designed filter has a maximum passband ripple of 0.004 dB and a minimum
stopband attenuation of 62.8 dB. Better results might be achieved using the method
for the calculation of optimal coefficients described in [146]. Yet, the current filter
characteristics were already sufficient for the targeted applications.
0
−20
magnitude [dB]
−40
−60
−80
−100
−120
0 1 2 3 4 5 6 7 8 9 10
ω/ωout [1]
173
5. Implementation
0
−20
magnitude [dB]
−40
−60
−80
−100
−120
0 1 2 3 4 5 6 7 8 9 10
ω/ωout [1]
At first the filter was implemented and tested in MATLAB. The implementation fol-
lowed directly from the filter structure in figure 5.33 and the equation of the transposed
Farrow filter introduced in section 3.3.2.4. Its code is given in appendix D.2. After-
wards, it was implemented in C, in order to be run on the Preon32. Since Preon32’s
processor does not possess an FPU, it was not possible to run a floating-point imple-
mentation of the algorithm in real-time. Therefore, the final implementation for the
Preon32 was done in fixed-point arithmetic. Section 6.5.2 presents test results compar-
ing the MATLAB, floating-point C and fixed-point C implementations of the algorithm.
The fixed-point implementation of the algorithm is described in more detail in the fol-
lowing.
The transposed Farrow filter and the calculation of the fractional interval were imple-
mented by the author. For the FIR filters G and D library functions from the CMSIS
DSP library, provided by ARM [165], were used. To minimize the computational load
and memory requirements of the implementation a 16 bit fixed-point format (Q0.15)
was chosen for the in- and output values of the filter (compare section 3.3.3). This also
covers the full digital output range of the ADC. However, it was not feasible to use this
fixed point format throughout the entire filter algorithm for the following reasons:
1. The size of a Farrow filter’s output values is about N-times that of the input
values x, where N is the number of input samples that contribute to one output
sample. Thus, a 32 bit format (Q16.15) was chosen for the outputs of the Farrow
filters and the following FIR-filtering. Also, the coefficients of the FIR-filters
were taken as 32 bit numbers (Q0.31).
174
5.3. Synchronous angular sampling
175
5. Implementation
Figure 5.37.: Number formats used in the calculation of the fractional interval.
Figure 5.38.: Number formats used in the implementation of the Farrow filter.
176
5.3. Synchronous angular sampling
Figure 5.39 shows the network layout that was chosen for synchronous angular resam-
pling. One TIM, the data TIM, acquires analog samples uniformly over time using the
analog voltage sensor described in section 5.1.5.4. It is synchronized to the clock of the
NCAP with the timesynch-service (see section 5.2.1.2) and uses the second variant of
reactive synchronous sampling described in section 5.2.3.2. The maximum acquisition
block size is 2048 samples with one block per 102.4 ms. As described in section 5.2.3.2,
the data acquisition process generate a timestamp tend at the last sample of every block.
Using the timestamp from the previous block, the actual sampling interval T in,i of the
ith block is calculated:
tend,i − tend,i−1
T in,i = (5.17)
2048
Before this division, the 32 bit timestamps (Q17.14) are extended to the 64 bit format
(Q33.30) used by the filter and shifted 16 digits to the left. Due to the averaging over
211 samples, the effective time resolution after the division is 2−(14+11) s = 29.8 ns 7 ,
which allows for an accurate representation of the sampling interval (nominally 50 µs).
The resampling filter itself is integrated into the processing stage of the analog sensor
(compare figure 5.15).
177
5. Implementation
A second TIM, the rotation TIM, generates timestamps tϕ,l′ at equidistant angular in-
tervals Φ using the rotary encoder described in section 5.1.5.7. This TIM is also syn-
chronized to the NCAP using the timesynch-service. Thus, the timestamps tϕ,l′ are
from the global synchronized time. They are buffered and transmitted as one block in
a broadcast message at a constant interval of T Block = 100 ms. The data TIM receives
the timestamps tϕ,l′ and stores them in a second buffer. Every time a new data block
becomes available, the data TIM resamples the buffered data until no fitting timestamps
are available anymore. The resampled data is then sent to the NCAP. It also receives
the timestamps from the rotation TIM making both, the resampled data and the rotation
information, available to the user.
At the current implementation with an output sampling rate of fϕ = 15 samples/rev, the
first three signal orders can be represented accurately8 . The limiting factor is the num-
ber of timestamps tϕ,l′ that can be transmitted per interval. The TDMA-MAC protocol
currently allows reliably transmitting up to 32 packets/s, i.e. 3 Packets in one 100 ms inter-
val (see section 6.1.2). As one MSTL packet can carry a payload of 60 Byte (see section
5.1.4.4), this means that 180 Byte can be sent per interval. Considering the structure of
the rotary encoder’s data set in table 5.16, it follows, that up to 83 timestamps can
be transmitted per 100 ms interval. Thus, the product of maximum supported speed
nrot,max and timestamp rate fϕ,t = 2 fϕ is limited to:
nrot,max
830 timestamps/s ≥ fϕ,t · , (5.18)
60
i.e., at fϕ,t = 30 timestamps/rev, nrot,max = 1660 rpm is the maximum supported speed. If
the number of output samples per revolution and thus also the number timestamps was
to be increased, the maximum supported speed would be reduced.
Similarly, it can be calculated that the maximum sampling rate possible at the output of
the data TIM is about 840 samples/s, i.e.:
nrot,max
840 samples/s ≥ fϕ · . (5.19)
60
Thus, the output sampling rate could be increased to up to 30 samples/rev, or the maxi-
mum speed increased to up to 3360 rpm, if the timestamps could be transmitted more
efficiently. Possible solutions for this might be to interpolate every second tϕ on the data
TIM, or to transmit the coefficients of a spline approximation, instead of the timestamps
themselves.
In order for the resampling algorithm to work, the time interval T ϕ between two time-
stamps tϕ must not be larger than the time interval T Bu f f er , for which samples can be
stored in the input buffer. For the current implementation this means that:
178
5.3. Synchronous angular sampling
60
nrot,min = (5.21)
T ϕ,max · fϕ,t
60
= = 6.5 rpm. (5.22)
T bu f f er · fϕ,t
Considering that some safety margin is needed, in order to compensate for latencies in
the network communication, a minimum speed of 10 rpm is more realistic. Increasing
the buffer size is hardly possible, as the three blocks of stored samples, together with the
output buffer of the ADC already take up (3 + 2) · 2048 · 2 Byte = 20 kB, i.e. roughly
one third of the sensor node’s entire RAM. Yet, the lower speed boundary could be
reduced, if more timestamps were generated per revolution, i.e. if a higher fϕ,t was
used.
179
6. Experiments
This chapter presents the experiments that were done to evaluate the performance of
the WSN for the three types of synchronous data acquisition modeled in chapter 4 and
whose implementations were described in chapter 5. Section 6.1 describes the mea-
surements of the WSN’s power consumption and data throughput. The results of these
measurements are used to better interpret the performance of the data acquisition in
the following experiments. Section 6.2 shows experiments to evaluate the synchronous
event detection of the WSN. Its influence in a practical application, the acoustic local-
ization of sensor nodes, is analyzed in section 6.3. Section 6.4 presents measurements
to test the synchronous waveform sampling of the WSN. Finally, experiments on syn-
chronous angular sampling are given in section 6.5. Throughout this chapter the indi-
vidual physical sensor nodes used, will be identified by their unique IDs (see section
5.1.4).
This section presents experiments that were done to determine basic characteristics of
the used WSN: its power consumption (section 6.1.1), data throughput and transmis-
sion reliability (section 6.1.2). Although these were not in the focus of this thesis and
therefore have not been fully optimized, they still are relevant performance metrics.
As power is often scarce in WSNs the power consumption of a wireless sensor node
is an important performance metric (compare section 2.1.1). The Contiki operating
system used in this thesis provides a mechanism called powertrace that estimates
the power consumption of a node during operation. The experiments presented in this
section serve to calibrate the powertrace mechanism for the Preon32 sensor node.
Furthermore, the powertrace estimates were validated through comparison with mea-
surements from a digital multimeter (DMM).
181
6. Experiments
Figure 6.1 shows the experimental setup used to measure the current of the sensor
nodes. A sensor node, mounted on a Preon32Shuttle, was connected to a laboratory
power supply (Gossen 33K7EU5/2x25R1) with Vin = 3.8 V. The actual supply voltage
V supply = 3.3 V of the Preon32 was generated from this by a linear voltage regulator
on the Preon32Shuttle (see also section 5.1.1). A DMM (FLUKE 8846A) was used to
measure the supply current. In some experiments a second node was used to communi-
cate with and collect powertrace data from the node whose current consumption was
measured.
The integration time T inter for the dual-slope ADC of the multimeter was set to 100
power-line-cycles (PLC). At the given power-line frequency of 50 Hz this resulted in
T inter = 2 s. Thus, the current measurement of the multimeter was the average current
drawn by the sensor node over this time. A PC connected to the serial interface of
the multimeter was used to automatically acquire current readings with a MATLAB-
script. The Preon32 was run from its internal RC-oscillator at a system clock frequency
of 36 MHz throughout these experiments as well as in all other experiments in this
chapter (compare section 5.1.1).
Figure 6.1.: Experimental setup used to measure the supply current of a node.
The first round of experiments served to measure a sensor node’s current consumption
in the different power states. For this purpose a set of simple Contiki applications was
created that all enter an infinite loop after initialization (see figure 6.2). Thus, the con-
trol over the microcontroller stays with the application and never returns to the Contiki
scheduler (compare section 5.1.2). In order to measure the current consumption of the
different microcontroller power modes, the wireless transceiver was turned off during
the initialization of the program. Then in the infinite loop the microcontroller was re-
peatedly put to sleep in the selected power mode for 10 min (see figure 6.2 a)). To get an
impression of how processor operations affect its current consumption a variable was
182
6.1. Wireless sensor network
repeatedly incremented within the loop instead of calling the sleep routine (see figure
6.2 b)). This will be referred to as power mode BUSY in the following descriptions.
In order to measure the transceiver’s listening current consumption, it was turned on at
the initialization of the program and the microcontroller was set to sleep in RUNNING
mode in the infinite loop (see figure 6.2 c)). Finally, the sleep routine in the infinite loop
was replaced by the sending of a wireless packet of maximum length (127 Byte) (see
figure 6.2 d)). This way the node was sending out packets at the maximum possible
rate. For this case, both the maximum (3 dBm) and the minimum (-17 dBm) transmis-
sion power setting of the transceiver were investigated.
Figure 6.2.: Activity diagrams of test applications used to measure a sensor node’s cur-
rent consumption.
In the experiments, the program for the investigated power mode was first compiled
and downloaded to the sensor node via its USB-interface. Then the USB-Interface
was disconnected from the sensor node and the power supply was connected to the
power socket of the Preon32Shuttle. After resetting the node and waiting for 1 min,
10 automated measurements of the node’s supply current were taken over a period of
approximately 10 s. This was repeated for every investigated power mode.
Table 6.1 shows the results of the current measurements with node number 41. The
current values I supply are the average values from the N = 10 measurements. The
uncertainties Uk,I are the expanded uncertainties that were calculated for a coverage
factor of k = 2 from the standard deviation smeas of the measurement values and the
specified uncertainty uDMM of the multimeter [40, 41]:
√
s2meas
Uk,I = k · + u2DMM (6.1)
N
183
6. Experiments
Table 6.1.: Current consumption of node 41 measured for the different power modes.
Mode Current consumption
microcontroller transceiver I supply Uk=2,I unit
BUSY OFF 19.903 0.107 mA
RUNNING OFF 17.273 0.063 mA
IDLE OFF 6.778 0.016 mA
STANDBY OFF 65.133 0.076 µA
POWEROFF OFF 25.404 0.010 µA
RUNNING LISTEN 30.861 0.161 mA
BUSY TX (3 dBm) 28.654 0.014 mA
BUSY TX (-17 dBm) 24.875 0.021 mA
Comparing the measured values in table 6.1 to the specification values in table 5.4, the
current consumption measured for the POWEROFF mode matches very well. Also the
values for the BUSY, RUNNING and IDLE modes are within the expected range. It is
worth noting that there is quite a large difference in current consumption (about 15 %)
between the microcontroller sleeping in RUNNING mode and the processor constantly
incrementing a variable (BUSY mode). The current measured for the STANDBY mode
is significantly lower than the one given in the specifications (1.3 mA). Interestingly, a
similar value could be measured by skipping the initialization of the wireless transceiver
during the Contiki boot. The wireless transceiver apparently consumes more current,
when left uninitialized compared to being shut-down after initialization.
To separate the listening current consumption of the wireless transceiver from that of
the microcontroller, the current consumption measured for the RUNNING mode with
transceiver off was subtracted from that measured during RUNNING mode with lis-
tening for wireless communication. The resulting value is about 1 mA higher than the
specified current consumption (see tables 5.4 and 6.2).
To obtain the transmitting current consumption of the wireless transceiver the current
consumption measured for the processor in BUSY mode was subtracted from that mea-
sured during transmission. This was chosen, because the processor was constantly busy
generating and sending packets to the wireless transceiver during these measurements.
The resulting current consumption (about 8.7 mA for 3 dBm) is, however, much lower
than the one specified in table 5.4. To further investigate this phenomenon, a 10 Ω re-
sistor was connected in series to the Preon32Shuttle and the voltage drop over it was
measured with an oscilloscope (PicoScope 2205MSO). Figure 6.3 shows an extract of
the measured current trace. Obviously, the current consumption is periodically chang-
ing, with a period of about 6.5 ms. The length of the upper plateau (about 4 ms) fits
well with time-on-air (∼ 4.3 ms) that is expected for the packet length used. Thus, the
transceiver apparently does not stay in transmitting mode all the time, but goes through
some intermediate states although the controller is constantly sending packets to it. As
184
6.1. Wireless sensor network
a consequence the average current consumption is lower than that of the transmit state.
For this reason the current of the upper plateau in the trace was used to determine the
current in transmit state instead of the multimeter measurement. Its mean value was
34.2 mA and its standard deviation 0.22 mA over a total of 20 periods. Taking the
precision of the oscilloscope ±15 mV and that of the resistor ±0.1 Ω into account the
expanded uncertainty of the measurement was calculated. The results given in table 6.2
match very well with the specifications.
40
amplitude [mA]
30
20
10
−2 0 2 4 6 8 10 12 14 16 18
time [ms]
Finally, the measured current values were assigned to the four power modes used
by Contiki’s powertrace mechanism (see section 5.1.2). The CPU-active mode in
powertrace (short: cpu) was equated with the BUSY mode of the processor. For the
low-power mode (short: lpm) the IDLE mode of the processor was used, as this is the
mode Contiki’s scheduler switches to when no process is running (see 5.1.2.5). The
current consumption for the listen and transmit modes in powertrace were calculated
by subtracting the current consumption of the microcontroller from measured current
values as explained above. For the transmit mode (short: tx) the maximum transmission
power of 3 dBm was assumed, as this is the standard setting in Contiki.
185
6. Experiments
In order to check the ability to predict a node’s power consumption from the recorded
powertrace values, a second round of experiments was done. A comparison was made
between the average power consumption of a TIM, as calculated from the average cur-
rent measured by the multimeter, and that estimated from the powertrace values. The
TDMA-MAC was chosen for the experiments as it caused a varying current profile that
was approximately stationary within the integration time of the multimeter. Otherwise,
the TIM was left idle, i.e. no measurement application was active. Three different
configurations of the TDMA-MAC were investigated:
1. Every node in the network, i.e. the NCAP as well as the TIM, always sent a
packet in its assigned slot. If no packet had been handed to the network stack for
transmission, a dummy packet was generated by the MAC-layer. This caused the
nodes to frequently transmit as well as receive packets and also caused a higher
load on the processor.
2. No dummy packets were generated. Thus, the only packets that were regularly
transmitted were the beacons from the NCAP and the wireless traffic was strongly
reduced compared to the first configuration.
3. The same as the second configuration, but this time the wireless transceiver of
the TIM was switched off between the beacons. This strongly reduced the time
the wireless transceiver spent in listening mode.
The experimental procedure was the same for every configuration: First, the program
was configured and downloaded to the TIM. Then, its USB-interface was disconnected
and the node was reset. After, waiting for one minute, powertrace values were read
wirelessly from the TIM through the NCAP and current values were read from the
multimeter alternately within a loop. A total of N = 10 measurements were acquired
this way. To get an impression of the variance in power consumption between different
nodes, the nodes 27, 31 and 41 were investigated this time.
After the N = 10 measurements, the average power consumption of the respective TIM
was calculated in two different ways:
1. From multimeter:
N
1 ∑
PDMM = V supply · I supply,i (6.2)
N i=1
2. From powertrace values: For every mode, its share in the power consumption
was calculated from its current value in table 6.2 and its active time tmode recorded
186
6.1. Wireless sensor network
by powertrace for the time T i between the first and second collection of values
in the loop:
tmode
P pwrt.,mode,i = V supply Imode (6.3)
Ti
This was repeated for every iteration. In the end, the power values were averaged
over all N = 10 iterations.
Figure 6.4 shows the results of the power estimations. The differences between the three
configurations are as expected. Significantly more power is consumed by the transmit
mode in configuration 1 than in 2 or 3. The share of the listen mode is about the same in
configurations 1 and 2. In configuration 3 it decreases drastically. The processor load
decreases from configuration 1 to 2, as fewer packets have to be processed. In config-
uration 3 the processor load increases again, due to the radio duty-cycling operations.
The overall power consumption is dominated by the low power and the listening mode
as they are active for most of the time.
The estimates from the powertrace values are similar to those obtained from the mul-
timeter in all cases. Yet, they often don’t match within the calculated uncertainty inter-
vals. This may be due to the fact that the actual power consumption of the processor in
running mode is dependent on the types of instructions that it executes. In addition, pe-
ripherals like the timer used by the TDMA-MAC probably cause an additional current
consumption that is not accounted for in the simplified model used by powertrace.
Furthermore, the time reported by powertrace for every mode is calculated by sum-
ming up the active times of the mode during operation. As every part of this sum is
only precise up to one rtimer tick (T rtc ≈ 61 µs), the quantization errors may accu-
mulate over time leading to an estimation uncertainty of unknown size. It increases
in magnitude, when mode changes occur frequently. Apparently, differences in power
consumption between individual nodes running the same application are present but
small and mostly negligible.
187
6. Experiments
60
DMM
Pavg [mW]
pwrt. lpm
40 pwrt. cpu
pwrt. listen
pwrt. tx
20
0
1 2 3 1 2 3 1 2 3
Configuration Configuration Configuration
Figure 6.4.: Power consumption of nodes as calculated from current measurements with
multimeter (DMM) and as estimated from powertrace (pwrt.). The error
bars show the expanded uncertainty Uk=2 .
6.1.1.4. Conclusions
The current consumption of one node was measured for the different power modes
using a relatively simple setup. Comparison with the specification values showed an
essentially good match. Yet, it was also shown that modeling the power consumption
with a small number of different modes is a significant simplification. Therefore, it is
not always trivial to achieve and observe these modes in real operation.
Nevertheless, the power consumption estimated using powertrace about matches that
obtained from current measurements with a multimeter. Significant deviations were
observed, that are probably due to simplifications in the powertrace approach. Never-
theless, the powertrace estimates are very useful for observing the effect of software
changes on the power consumption and for comparing the contributions of different
components.
In order to determine the transmission bandwidth usable for data collection in later
experiments, the data throughput and the reliability of transmission were measured
for the WSN. The IEEE 802.15.4 standard defines a bit rate of 250 kbps for wireless
communication in the 2.5 GHz band [194]. However, already the data link layer defined
in IEEE 802.15.4 introduces an overhead so that the actually usable data bandwidth is
significantly lower. Delays caused by the MAC-layer as well as failed transmissions and
188
6.1. Wireless sensor network
To evaluate the performance of the MAC-layer, a simple test setup was used, where
one or more nodes each transmitted 1000 UDP-packets at a fixed rate. All packets had
a payload of 60 Byte. An additional receiver node was used to count the number of
successfully received packets. At the end of the experiment, this count was used to
calculate the percentage of successful transmissions. Furthermore, powertrace data
was recorded during the experiment.
Table 6.3 shows the three configurations of RDC- and MAC-layer that were investi-
gated. For all layer-configurations two different network topologies were examined:
one sender and one receiver (one-to-one) as well as two senders and one receiver (two-
to-one). The packet rate was varied between 1 and 64 packets/s for the one-to-one trans-
mission and between 1 and 42 packets/s for the two-to-one transmission. For the TDMA-
MAC the receiving node was chosen to be the coordinator, as this configuration is
typical of data acquisition applications.
Figure 6.5 shows the success rate during transmissions for one-to-one transmissions.
Up to 32 packets/s, the success rate is 100 % for all investigated network configurations.
After this there is a clear drop in the transmission success for the TDMA-MAC while
the other two configurations maintain a near 100 % success rate even at the maximum
investigated packet rate of 64 packets/s. The reason for this is that the simple TDMA-
MAC, used in this thesis, is statically configured for a network of three nodes. Thus,
in one-to-one transmission only a third of the total bandwidth can be used. This limi-
tation does not apply if CSMA-based protocols are used. With the TDMA-MAC, the
189
6. Experiments
receiver
110
100
success rate [%]
90
80
70
60
50
4 8 16 25 32 42 64
packet rate [1/s]
CSMA,nullrdc CSMA,ContikiMac TDMA
Figure 6.5.: Transmission success during transmissions of one sender to one receiver.
theoretical maximum packet rate is 46 packets/s per node (see table 5.6). Yet in practice,
a node will fail to use some of its allocated timeslots due to imprecision in the process
scheduling, thus reducing the actual packet rate (see also section 5.1.3).
The transmission success rate for two-to-one transmissions is shown in figure 6.6. Here
the TDMA-MAC is the only protocol that maintains a 100 % success rate up until a
packet rate of 32 packets/s. For the CSMA-MAC without radio duty-cycling the suc-
cess rate is only slightly worse, while for the configuration using ContikiMAC radio
duty-cycling there is a significant deterioration already at 16 packets/s. This is due to the
collisions that inevitable occur when multiple nodes transmit and a contention based
MAC is used. For ContikiMAC this is particularly pronounced, because here a node
makes many transmission attempts shortly after another.
Figures 6.7 and 6.6 show the average power consumption of the nodes during the ex-
periments. In general the average power consumption is rising with the packet rate.
Obviously, the configuration not using radio duty-cycling has about the maximum
power consumption in all cases. On the receiver side the power consumption of the
TDMA-MAC is mostly close to it and sometimes even surpasses it. This is because the
TDMA-MAC does not use radio duty-cycling on the coordinator (see section 5.1.3).
On the sender side where radio duty-cycling is used, the TDMA-MAC shows a power
consumption that is at least as low as that of ContikiMAC. At higher data rates it is
even significantly lower. The reason for this is that due to the scheduled transmission
there are far fewer failed transmission attempts with the TDMA-MAC than with Con-
tikiMAC.
190
6.1. Wireless sensor network
receiver
110
100
success rate [%]
90
80
70
60
50
4 8 16 25 32 42 64
packet rate [1/s]
CSMA,nullrdc CSMA,ContikiMac TDMA
Figure 6.6.: Transmission success during transmissions of two senders to one receiver.
receiver sender
120 120
avg. power [mW]
100 100
80 80
60 60
40 40
20 20
4 8 16 25 32 42 64 4 8 16 25 32 42 64
packet rate [1/s] packet rate [1/s]
Figure 6.7.: Average power consumption during transmissions of one sender to one re-
ceiver.
191
6. Experiments
receiver sender
120 120
avg. power [mW]
100 100
80 80
60 60
40 40
20 20
48 16 25 32 42 64 48 16 25 32 42 64
packet rate [1/s] packet rate [1/s]
Figure 6.8.: Average power consumption during transmission of two senders to one re-
ceiver.
6.1.2.4. Conclusions
The investigation of the different RDC and MAC-layer configurations showed that re-
liable packet transmission is possible up to a rate of 32 packets/s. If multiple nodes are
transmitting simultaneously the CSMA-MAC suffers from collisions during transmis-
sions. Also its average power consumption at the sender side is significantly higher
than that of the TDMA-MAC for the investigated packet rates. At much lower packet
rates this picture may change, as the TDMA-MAC constantly sends beacons even if no
communication takes place. At the receiver side, the power consumption for the TDMA
is much higher. Yet, this was a deliberate design decision, as the coordinator is assumed
to have access to mains power. Thus, the TDMA-MAC appears to be advantageous for
most cases of networked data acquisition.
192
6.2. Time synchronous event detection
The experimental setup shown in figure 6.9 follows the test procedure for event detec-
tors that was introduced in section 4.6.1. For the experiments a WSN with one NCAP
and two TIMs was used. Interrupt inputs of all three nodes were connected to the digi-
tal output of a fourth sensor node that did not participate in the WSN. The connections
were made with four identical 50 Ω Bayonet Neil-Concelman (BNC)-cables of 1.3 m
length. On both TIMs and the NCAP the event sensor described in section 5.1.5.2 was
used in continuous acquisition mode. The time synchronized event detection mecha-
nism described in section 5.2.2 was used to generate a timestamp every time a pulse
was detected. These timestamps were transmitted to the NCAP, from where they were
read by a computer.
The time between two pulses was chosen randomly from the interval [1.5, 2.5 ] s, us-
ing the pseudo-random number generator of the standard C-library, on the pulse node.
During the experiments data on the nodes’ power supply was collected using Contiki’s
powertrace mechanism (see also sections 5.1.2 and 6.1.1). Furthermore, the clock
corrections performed by the synchronization algorithm were recorded via the USB
interface of each node.
Table 6.4 shows the network configurations that were investigated during the exper-
iments. The CSMA-MAC was always used in combination with the ContikiMAC-
protocol. But, the actual radio duty-cycling was turned off in configurations 1 to 6,
in order to prevent it from influencing the timestamping. The same was done for the
TDMA-MAC. Furthermore, the synchronization interval of the a priori timesynch
protocol was varied. For every configuration a total of 1000 timestamp triples were
recorded over about 33 min.
193
6. Experiments
Table 6.5.: Relative drifts between TIMs and NCAP. The uncertainties given are the
expanded uncertainties (k = 2) calculated for the variances of the regression
parameters.
TIM i RMSE ρN,i t-test (αt = 5 %)
pt Sig.?
[Ticks] [ppm] [%]
1 0.61 10.376 ± 0.004 < 0.01 Yes
2 0.91 72.629 ± 0.006 < 0.01 Yes
The first network configuration, shown in table 6.4, served to characterize the clocks
of the involved nodes. Thus, the event timestamping was performed without any time
synchronization between the nodes. Figure 6.10 shows the timestamp differences ∆t
between the NCAP and the two TIMs. Without any synchronization, the offset of the
clocks is the time difference between powering on the different nodes. This is arbitrary
and does not contain any useful information. Thus, the offset was subtracted from
the ∆t, in order to improve the visibility of the relative drift. Linear regression was
performed on the ∆t to estimate the drifts ρN,i of the TIMs’ clocks relative to that
of the NCAP. The variances of the estimates were calculated and used to determine
their expanded uncertainties (coverage factor of k = 2). T-tests were done to check the
significance of the drift estimates. Table 6.5 shows the results of the regression analysis.
194
6.2. Time synchronous event detection
3000 183.11
TIM 1
TIM 2
2000 122.07
∆t [Ticks]
∆t [ms]
1000 61.04
0 0.00
0 200 400 600 800 1000 1200 1400 1600 1800 2000
t [s]
Figure 6.10.: Recorded timestamp differences of TIMs to NCAP without time synchro-
nization. The initial clock offset was removed to improve the visibility of
the relative drifts.
The root-mean-square error (RMSE) of the linear fits is low (< 1 Tick) for both nodes.
Thus, the behavior of their clocks can be well described by a constant drift model for
the observed time interval. The relative drift between the NCAP and TIM2 is about
seven times larger than that between NCAP and TIM1. This may be linked to the fact,
that TIM2 (i.e. node 41) is from a different hardware revision than the other two (i.e.
nodes 27 and 31) and uses a different clock oscillator.
195
6. Experiments
Table 6.6.: Theoretical maximum synchronization errors rounded to next larger integer
number of Ticks. Exact values obtained from (2.1) are given in brackets.
Conf. ϵt,max,N,T 1 ϵt,max,N,T 2 ϵt,max,T 1,T 2
[Ticks] [Ticks] [Ticks]
3 1 (0.50) 1 (0.52) 1 (0.52)
4 1 (0.67) 2 (1.69) 2 (1.52)
5 4 (3.22) 20 (19.54) 17 (16.82)
7 1 (0.50) 1 (0.52) 1 (0.52)
8 1 (0.67) 2 (1.69) 2 (1.52)
Figure 6.11 shows a boxplot of the recorded timestamp differences for each of the three
node pairs in the experiment. Dashed green lines mark a ±1 Tick environment around
zero. The medians of the individual series are shown as red lines. Blue boxes show
the ranges covered by the center 50 % of all values. Their lower edges correspond to
the 25 %-percentile P0.25 and the upper edges to the 75 %-percentile P0.75 respectively.
Similarly the whiskers indicate the span of the center 95 % of all values 1 . Values
outside the range of the whiskers are shown as red crosses. Since the large spread of
values in configurations 6 to 8 dominates much of the visible range in figure 6.11, figure
6.12 shows the same data with zoomed vertical axis.
In the majority of configurations and node pairs the median time difference is zero. The
only cases where the median is not in the ±1 Tick interval are in configuration 5 for
pairs with TIM2. This, however, was expected due to high relative drift of TIM2 (see
table 6.5).
Comparing the results in figures 6.11 and 6.12 to the theoretical maximum synchro-
nization errors in table 6.6 shows, that the center 95 % of all timestamp differences are
within the predicted interval for configurations 2 to 5. However, in nearly all cases there
are also a few values outside these intervals. This is particularly pronounced in config-
urations 6 to 8, where also the center 95 % range is significantly larger than expected
and values outside this range scatter even more widely.
1 As the timestamp differences are discrete values, two of them may be exactly equal. In this case the center
95 % range of all values cannot be defined exactly. It is instead the smallest range that contains at least
the center 95 % values. The same applies for the center 50 % range.
196
6.2. Time synchronous event detection
40 2.441
30
20 1.221
∆t N ,T 1 [Ticks]
∆t N ,T 1 [ms]
10
0 0.000
−10
−20 −1.221
−30
−40 −2.441
40 2.441
30
20 1.221
∆tN ,T 2 [Ticks]
∆t N ,T 2 [ms]
10
0 0.000
−10
−20 −1.221
−30
−40 −2.441
40 2.441
30
20 1.221
∆t T 1,T 2 [Ticks]
∆t T 1,T 2 [ms]
10
0 0.000
−10
−20 −1.221
−30
−40 −2.441
2 3 4 5 6 7 8
CSMA TDMA CSMA CSMA CSMA TDMA CSMA
RITS (0.02,0.02) TS(0.25,1) TS(4,16) RITS (0.02,0.02) TS(0.25,1)
off off off off on on on
Network configuration
Figure 6.11.: Recorded timestamp differences with synchronization. The red lines mark
the median. The blue boxes show the center 50 % and the whiskers the
center 95 % of all values. Values outside these ranges are drawn as red
crosses.
197
6. Experiments
16 0.977
14
12 0.732
∆t N ,T 1 [Ticks]
10
∆t N ,T 1 [ms]
8 0.488
6
4 0.244
2
0 0.000
−2
−4 −0.244
16 0.977
14
12 0.732
∆tN ,T 2 [Ticks]
10
∆t N ,T 2 [ms]
8 0.488
6
4 0.244
2
0 0.000
−2
−4 −0.244
16 0.977
14
12 0.732
∆t T 1,T 2 [Ticks]
10
∆t T 1,T 2 [ms]
8 0.488
6
4 0.244
2
0 0.000
−2
−4 −0.244
2 3 4 5 6 7 8
CSMA TDMA CSMA CSMA CSMA TDMA CSMA
RITS (0.02,0.02) TS(0.25,1) TS(4,16) RITS (0.02,0.02) TS(0.25,1)
off off off off on on on
Network configuration
Figure 6.12.: Recorded timestamp differences with synchronization with zoomed verti-
cal axis. The red lines mark the median. The blue boxes show the center
50 % and the whiskers the center 95 % of all values. Values outside these
ranges are drawn as red crosses.
198
6.2. Time synchronous event detection
Abbreviations: N=NCAP; T1=TIM1; T2=TIM2; std.= standard deviation; ex. kurt.= excess kurtosis;
pgauss = p-value of a χ2 goodness of fit test for a Gaussian distribution; n2σ = percentage of values within a
±2σ interval
For further examination, the histograms of timestamp differences are shown in figure
6.13. Fitted Gaussian probability density functions are also shown; as the analysis
in section 4.2.1 revealed that an approximately Gaussian error distribution is likely.
Table 6.7 shows a summary of statistical parameters that where estimated from the
recordings.
The histograms for configurations 2 to 4, especially those of the pair (TIM1, TIM2),
visually appear to agree quite well with a Gaussian distribution. Yet, all histograms
clearly fail a χ2 goodness-of-fit test for a Gaussian distribution. The reason appears to
be a lack of values in the tails of the distributions. The histograms of the pairs that in-
volve TIM2 in configuration 5 seem to approximate a uniform distribution. Histograms
of configurations 6 to 8 show a wide spread of infrequent extreme values and sometimes
multiple modes, that both cause large standard deviations.
199
6. Experiments
CSMA 60
2 RITS frel. [%] 40
off 20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
TDMA 60
frel. [%]
3 (0.02, 0.02) 40
off 20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
CSMA 60
frel. [%]
4 TS(0.25,1) 40
off 20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
CSMA 60
frel. [%]
5 TS(4,16) 40
off 20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
CSMA 60
frel. [%]
6 RITS 40
on 20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
TDMA 60
frel. [%]
7 (0.02, 0.02) 40
on 20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
60
CSMA
frel. [%]
8 TS(0.25,1) 40
on 20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
200
6.2. Time synchronous event detection
An observation common to all configurations is that the histograms of the pairs, which
consist of the NCAP and one TIM, are often skewed and have a strong excess kurtosis.
The histograms of the pair that consists of two TIMs, on the other hand, mostly have
a skew close to zero and less excess kurtosis. Also the means and standard deviations
of timestamp differences tend to be smaller for this pair. A not perfectly compensated
delay in the transmission of synchronization timestamps between NCAP and TIMs is
a plausible explanation for this behavior. In most cases the percentage n2σ of values
that are within an interval of two standard deviations is larger than 95 %. In the other
cases it is at least 92 %. This shows that even though the histograms of the timestamp
difference significantly differ from a Gaussian distribution, their standard deviations are
still a useful measure of the spread of values.
The values given for T clock,e f f in table 6.7 show that in the best configurations (2 to 4)
the loss of timestamping precision due to synchronization can be roughly equated to
putting a factor of 1.5 to 2.3 on the clocks resolution, i.e. about one bit of the clocks
resolution is effectively lost (see also section 4.2.3).
A comparison to the performance of other synchronization protocols from the literature
is problematic due to differences in the underlying platform and experimental methods
(see also section 2.2.4). Yet, it can be noted that the observed synchronization precision
is in the same order of magnitude as the results from other state-of-the-art protocols
(compare table 2.7). An interesting fact is that the resolutions of the underlying clocks
reported in the literature are disproportionately higher than in the present experiments.
Thus, the implemented synchronization protocol may be said to be especially efficient
in utilizing the clock resolution.
In configuration 5 the distribution of timestamp differences for pairs including TIM2
resembles a uniform distribution rather than a Gaussian one. As pointed out in section
4.2.1 this indicates a dominant error influence from clock drift. This is confirmed by
the timestamp differences and clock updates during the first 100 s that are shown in
figure 6.14. Here the sawtooth behavior typical of a drifting clock that is periodically
corrected by a synchronization algorithm is clearly visible when TIM2 is involved.
Further evidence to this point is that the drift of TIM2 relative to the NCAP and TIM1
has been found to be particularly strong (see section 6.2.2). In the other configuration
using a priori synchronization this behavior is in theory also present. Yet, it is much
weaker and probably shadowed by other influences. Another effect of the clock drift is a
bias in the mean timestamp difference of ∆tmax /2. This explains the increased median
value for configuration 5 observed in figure 6.12. Unfortunately, a classic correlation
analysis of the timestamp differences could not be performed, as they were acquired
nonuniformly over time. Yet, apart from configuration 5 there is no obvious periodicity
in the time difference values.
201
6. Experiments
40
∆tN ,T 1 [Ticks]
20
0
−20
−40
0 10 20 30 40 50 60 70 80 90 100
40
∆t N,T 2 [Ticks]
20
0
−20
−40
0 10 20 30 40 50 60 70 80 90 100
40
∆tT 1,T 2 [Ticks]
20
0
−20
−40
0 10 20 30 40 50 60 70 80 90 100
t [s]
∆cT 1 [Ticks]
40
20
0
−20
0 10 20 30 40 50 60 70 80 90 100
∆cT 2 [Ticks]
40
20
0
−20
0 10 20 30 40 50 60 70 80 90 100
t [s]
Figure 6.14.: First 100 s of recorded timestamp differences and clock updates for con-
figuration 5.
Another phenomenon that needs further analysis is the occurrence of unusually large
timestamp differences especially in configurations 6 to 8. The most probable cause for
this are code sections during which interrupts are blocked (compare section 5.1.2.1).
Table 6.8 shows a number of such code sections that could be identified. Their length
was obtained by setting a general-purpose input/output (GPIO)-pin high during their
execution and measuring the pulse width with a logic analyzer (Tektronix TLA 704).
The maximum execution time of the radio interrupt correlates very well with the max-
imum timestamping differences observed in configurations 3 and 4. The duration of
the radio on and off operations of the TDMA-MAC match equally well with the times-
tamping differences observed in configuration 7. The maximum timestamp differences
observed in configurations 6 and 8 correspond to the maximum execution time of an
rtimer task that ContikiMAC uses in its radio duty-cycle.
202
6.2. Time synchronous event detection
70
60 lpm
cpu
avg. power [mW]
50
listen
40 tx
30
20
10
0
Node: N T1T2 N T1T2 N T1T2 N T1T2 N T1T2 N T1T2 N T1T2 N T1T2
1 2 3 4 5 6 7 8
CSMA CSMA TDMA CSMA CSMA CSMA TDMA CSMA
none RITS (0.02,0.02) TS(0.25,1) TS(4,16) RITS (0.02,0.02) TS(0.25,1)
off off off off off on on on
Network configuration
Figure 6.15.: Mean power consumption of nodes during timestamping experiments es-
timated from powertrace.
Figure 6.15 shows the powertrace statistics gathered during the timestamping experi-
ments. The listening and low power modes dominate the overall power consumption,
as they are active for most of the time. Consequently, the activation of the radio duty-
cycling on the TIMs in configurations 6 to 8 leads to the strongest power savings. No
effect is visible on the NCAP because it does not use radio duty-cycling. It is assumed
to always have access to mains power.
203
6. Experiments
6.2.5. Conclusions
The majority of the measured timestamp differences are within the expected bounds for
synchronization precision. Interrupt blocking code sections were identified as the cause
of a relatively small number of more extreme values. If no significant drift occurs be-
tween synchronization events, the distribution of the timestamp differences looks very
similar to a Gaussian distribution. Yet, it tends to be more strongly centered. Further-
more, transmission delays between NCAP and TIMs often cause a slight asymmetry in
the distribution. Yet, a Gaussian model still seems to be a useful approximation in most
cases. No significant advantages of either a priori or a posteriori synchronization with
regard to synchronization precision could be found. The best, i.e. minimal, standard
deviation for both approaches was about s∆t = 0.60 Ticks. Thus the timing uncertainty
of the WSN is at least:
s
ut = √∆t = 0.42 Ticks = 25.9 µs. (6.4)
2
This can also be interpreted as the loss of less than one bit on the clocks effective
resolution. The absolute value of the observed synchronization precision is in the same
order of magnitude as that reported in the literature for state-of-the-art synchronization
protocols. In relation to the underlying clock resolution it even clearly better.
The power consumption of the sensor nodes during the experiments was found to be
most strongly influenced by their current consumption in low power mode and the lis-
tening current of the radio transceiver. Thus, using radio duty-cycling is the most ef-
fective way to save power. Yet, the duty-cycling operation was found contain a number
of interrupt blocking sections that adversely affect the timestamping precision. This
effect illustrates the complex interactions of software on small resource constraint sys-
tems like wireless sensor nodes. Overcoming this trade-off is not easy as hardware
duty-cycling often requires wait periods that should not be interrupted. Yet, it is key
to achieving both low-power and high precision operation. In a priori synchronization
smaller synchronization periods cause higher power consumption. This effect, however,
is strongest on the NCAP where at the same time it is not very critical. Yet, in a multi-
hop network this increase is expected to be also visible on mesh nodes, which may have
more constrained power supplies. A posteriori synchronization generally seems to have
204
6.3. Application example: acoustic localization
a slight advantage in terms of power efficiency over a priori synchronization. Yet, its
use is only feasible, when the MAC protocol does not already include or require an a
priori time synchronization.
Acoustic localization techniques are used in a variety of applications, e.g. indoor po-
sitioning [126, 91] or sniper localization [132]. WSNs are especially well suited for
these tasks, as they are comparatively easy to install over large areas. Localization
techniques are commonly based on the time-of-flight of acoustic signals between two
or more nodes or the differences in time-of-arrival at the nodes [132, 91, 126]. There-
fore accurate time synchronized timestamping is of key importance for an accurate
localization.
6.3.1. Model
A very basic example of acoustic localization was investigated. Figure 6.16 shows its
general setup: two microphones and one acoustic source are located on a straight line.
Both microphones detect sounds that are emitted by the source. If a sound is detected
at the time t1 by the first and at t2 by the second microphone, the distance d between
the microphones can be calculated from the following equation:
where v sound is the sound velocity and T sound the time that the sound traveled between
the microphones.
Figure 6.16.: General setup for passive acoustic localization on a straight line.
205
6. Experiments
The measurand is the distance d. Its maximum location uncertainty is chosen as uc,max =
1 cm. Equation (6.5) already models the relationship between measurand and time-
stamps. The sensitivity coefficients for the timestamps t1 and t2 are:
⏐ ∂d ⏐⏐⏐
⏐⏐ ⏐
ct = ⏐⏐ = v sound . (6.6)
⏐ ∂t1,2 ⏐⏐
Thus, the first upper limit for the timing uncertainty ut,max is:
As nothing is known about other uncertainty influences, e.g. comparator noise and
jitter, at this point, a suitable error margin has to be included. Table 6.9 shows the max-
imum timing uncertainty needed for various localization uncertainties and uncertainty
margins.
Table 6.9.: Maximum timing uncertainty ut,max of a single timestamp in µs for different
maximum location uncertainties ud,max and uncertainty margins for v sound =
343 m/s.
uncertainty margin/ud,max 0.0 % 50.0 % 90.0 % 99.5 %
10 cm 206.15 178.53 89.86 20.59
5 cm 103.08 89.27 44.93 10.29
2 cm 41.23 35.71 17.97 4.12
1 cm 20.62 17.85 8.99 2.06
1 mm 2.06 1.79 0.90 0.21
Previous experiments have shown, that the timestamping uncertainty of the WSN used
is at least ut = 25.9 µs (see section 6.2). Comparing this to the values in table 6.9,
a localization accuracy of about 2 cm should be achievable. If the observed accuracy
was significantly worse, uncertainty influences other than the synchronization accuracy,
would need to be reduced in order to improve it. In order to have a realistic chance of
reaching a localization accuracy of 1 cm the timestamping uncertainty would need to
206
6.3. Application example: acoustic localization
be reduced to about 17.85 µs. However, it is unlikely that this can be achieved at the
given clock resolution. The uncertainty√of the clock reading that is caused by the clock
resolution is already ut,clock = T clock / 12 = 17.62 µs and every time synchronization
procedure will cause at least a small extra uncertainty.
6.3.3. Experiments
Figure 6.17 shows the experimental setup that was realized. Two TIMs were equipped
with the microphone modules described in section 5.1.5. A piezo buzzer (Multicomp
MCKPI-G2210L-3672) was used as a sound source. Its resonant frequency is specified
as (4.2 ± 0.5) kHz and its sound pressure as 90 dB at distance of 10 cm and an operating
voltage of 12 V [202]. The two sensor nodes with microphones and the piezo buzzer
were placed along the edge of a laboratory bench (see figure 6.17). Microphones and
piezo buzzer were oriented perpendicular to the bench’s plane, as this was found to lead
to more stable sound detections and also simplified fixation. Short burst of sound were
periodically generated by the buzzer, which was connected to the output of a waveform
generator (HAMEG HM8150). The buzzer was turned on and off using a square wave
with a frequency of 1 Hz, a pulse width of 1 ms and an amplitude of 10 V.
207
6. Experiments
As described in section 5.1.5.5, the microphone modules set a digital output high when
the sound level crosses a threshold. As no low-pass filtering is done, this usually leads
to a train of digital pulses with about one pulse per signal period (see figure 6.18). The
outputs of the microphone modules were connected to interrupt-inputs of the corre-
sponding sensor nodes. Detection timestamps where generated in the corresponding
interrupt handlers. The interrupt of the sensor nodes were disabled for 2 ms after the
detection of a pulse. This avoided the generation of multiple timestamps per sound
burst. In addition to the sensor nodes, the digital outputs of the microphone modules
were connected to the inputs of a frequency counter (HAMEG HM8123). It measured
the interval T sound,cnt. between the first pulse on the first input and the consecutive pulse
on the second input.
The WSN was configured with the TDMA-MAC and a priori time synchronization
(see section 5) as this combination had been proven to offer both good synchronization
accuracy (see section 6.2) and high transmission reliability (see section 6.1.2). Radio
duty-cycling (RDC) was deactivated by default, as it had been found to cause significant
timestamping errors (see section 6.2). Nevertheless, measurements with active RDC
were recorded at selected distances in order to investigate the effect of the additional
errors. Timestamps generated at the TIMs were transmitted to the NCAP and read
into a PC. There the timestamps were matched and the time intervals T sound,wsn were
calculated. Two timestamps t2 and t1 were taken to belong to the same sound burst,
if t2 > t1 and t2 − t1 < 10 ms. This corresponds to a maximum accepted distance of
3.43 m at a sound velocity of 343 m/s (literature value for ϑ = 20 °C [68]); which is
much more than the maximum distance of 1.8 m possible in the setup.
6.3.3.1. Procedure
Before the experiments both microphone modules were placed at the maximum dis-
tance from the piezo buzzer and their amplifiers were set to generate approximately
the same output voltage. Figure 6.18 shows the output of one microphone amplifier to-
gether with the module’s digital output in this configuration. During the experiments the
distance d between the two TIMs was varied between 20 . . . 100 cm in steps of 10 cm.
For every distance N = 60 time intervals were recorded with both the WSN and the
frequency counter. For the distances 30, 50, 70, 90 cm also measurements with active
RDC were recorded. During the experiments room temperature and air humidity were
repeatedly monitored using a standard consumer thermo- and hygrometer (TechnoLine
WS9119). The temperature was in the range of 26-28 °C and the humidity between
40 and 45 % throughout the experiments. Furthermore, the air velocity was repeatedly
measured using a thermal anemometer (Testo 405-V1). It was below 0.02 m/s in all
measurements.
208
6.3. Application example: acoustic localization
3 amplifier
digital
amplitude [V]
0
−10 −5 0 5 10
time [ms]
6.3.4. Results
The time intervals measured by the frequency counter at the distances of 20, 40, 60,
80 and 100 cm were used to calibrate the localization system. The measurements were
found to contain a number of values that significantly deviated from the majority of
values. This was, probably caused by a microphone module triggering on a different
peak from time to time. To remove these outliers a filter was applied, that selected the
median of three consecutive samples. Thus, N samp = 20 samples per distance were
used for calibration. Linear regression was used to calculate v sound and d0 in the model
equation below.
d = v sound T sound + d0 . (6.10)
Figure 6.19 shows the measured time intervals and the calibration curve. The numerical
results of the calibration process are given in table 6.10. Both, slope and offset of
the calibration curve have been proven to be statistically significant in a t-test (p <
10−27 ). The slope of the calibration curve is significantly lower than the speed of sound
expected at the given environmental conditions (v sound = 347, 5 m/s at ϑ = 27 °C
[68]). This may indicate that the sound received by the sensor nodes did not simply
travel straight along the line of connection but was influenced by multipath effects, like
e.g. reflection and superposition (see also the discussion of error influences in section
6.3.5).
The measurements taken at the distances of 30,50,70 and 90 cm were used to validate
the fitted model. The RMSE for the validation points given in table 6.10 is equal to that
of the fit, showing that the model is also valid for non-calibration points. Judging by
the graph in figure 6.19 and the data in table 6.10 the fitted model seems to be a valid
representation of the localization process. Yet, the comparatively high RMSE indicates
a significant amount of uncertainty in the model.
209
6. Experiments
100
node distance [cm]
80
60
40 calibration point
calibration curve
20
verification point
0
0 0.5 1 1.5 2 2.5 3 3.5 4
time difference [ms]
Figure 6.19.: Linear calibration of the localization system. The error bars indicate an
interval of two standard deviations.
Table 6.10.: Calibration results for the localization system. The error intervals corre-
spond to the expanded uncertainty Uk=2 , as estimated from the fit residu-
als.
v sound d0 RMS E f it RMS Eval.
[m/s] [cm] [cm] [cm]
317.0 ± 4.3 −7.9 ± 1.0 1.9 1.9
After calibrating the localization system the time intervals measured with the WSN
were used to calculate the distances between the nodes. This was done for all four
distances also used during the validation of the model.
Figure 6.20 shows the means and doubled standard deviations of the localization errors
for each distance. It can be observed that mean localization error is in some cases sig-
nificantly different from zero and varies in sign and magnitude between the distances.
Where the mean localization error is comparatively large, it has about the same sign
and magnitude for all devices. This indicates a device independent cause. The standard
deviation of the localization errors also varies with the distance. However at every dis-
tance, the standard deviation of the counter measurements is the lowest and that of the
WSN with active RDC the highest.
Table 6.11 shows statistic values calculated over all localization errors at the distances
of 30, 50, 70 and 90 cm. To investigate the influence of the median filtering on the local-
ization errors, the same statistics were also calculated for data sets that were obtained
by selecting N samp = 20 uniformly spaced samples from the recorded data.
The overall mean localization errors are always significantly smaller than the overall
standard deviations. Thus, the RMSE is almost equal to the overall standard deviation.
To separate distance dependent from distance independent errors the RMSE was split
210
6.3. Application example: acoustic localization
−5
30 50 70 90
distance [cm]
Figure 6.20.: Mean localization errors obtained with filtered timestamps. The error bars
indicate an interval of two standard deviations.
up into the standard deviation smean of the mean localization errors ϵ for every distance
and the standard deviation sdev of the errors ϵ for every distance with the mean error
removed:
N∑
samp
1
ϵi = ϵi j (6.11)
N samp j=1
Ndist
1 ∑
s2mean = ϵ 2i (6.12)
Ndist i=1
Ndist N∑
samp
1 ∑
s2dev
= (ϵi j − ϵ i )2 (6.13)
Ndist N samp i=1 j=1
√
RMS E = s2mean + s2dev , (6.14)
211
6. Experiments
with N samp the number of samples per distance and Ndist the number of distances. It is
striking to see, that in the filtered case smean is independent of the measurement device.
In contrast to this, sdev clearly increases from the frequency counter over the WSN
to the WSN with active RDC. In the unfiltered case the localization errors increase
drastically for the WSN with active RDC, whereas in the other cases the increase is
only slight. This shows, that the median filtering not only removes outliers caused by
acoustic effects, but also those caused by interrupt blocking code sections (see also
section 6.2).
The standard deviations of the localization error in table 6.11 match well with the lo-
calization precision of about 2 cm estimated in section 6.3.2. For further analysis of
the individual uncertainty contributions the measurement model (6.5) is extended with
a number of error quantities:
Here d0 is the localization offset that is the result of all constant error influences. It is
compensated by the calibration processes. The error influences that are dependent on
the distance between the nodes are expressed as modeling error δmodel . Random error
influences that affect the propagation of the sound burst and its detection are summa-
rized as δ prop and δT is the error of the time interval measurement. Table 6.12 shows a
summary of physical error influences that contribute to the individual quantities.
Table 6.13 shows the uncertainty budget for δT of the counter. According the counter’s
specifications, the time interval measurement is affected by three error influences: the
resolution of the clock δres,counter , a system error δ sys,counter and the accuracy of the
internal time base δbase,counter [51]. The latter depends on the length of the time in-
terval. Here it was calculated for an interval of 3.4 ms which is slightly more than the
maximum interval measured during the experiments. The combined measurement un-
certainty of the counter uc,T ,counter is about three orders of magnitude smaller than the
overall standard deviation sdev for the counter in table 6.11. Therefore, sdev,counter can
be used as an estimate for the uncertainty u prop ≈ sdev,counter that is introduced by δ prop .
Similarly, the overall standard deviation of the mean errors smean for the counter in table
6.11 is used as an estimate for the uncertainty umodel ≈ smean,counter that is introduced
by δmodel .
212
Category Influence Effect Treatment
constant distance random
dependent
position yard stick accuracy x neglected (= 1.3 mm)
positioning error x neglected (≤ 1 mm)
rel. position of microphone x compensated by calibration (d0 )
acoustic sound repeatability x modeled (δ prop )
external noise x modeled (δ prop )
air movement x x compensated by calibration (v sound ),
modeled (δ prop )
sound damping x modeled (δmodel )
multipath propagation x modeled (δmodel )
electric amplifier noise x modeled (δ prop )
amplifier gain x compensated by calibration (d0 )
microphone sensitivity x compensated by calibration (d0 )
group delay x compensated by calibration (d0 )
trigger threshold x compensated by calibration (d0 )
trigger jitter x modeled (δ prop )
time interrupt latency x modeled (δT )
measure- clock resolution x modeled (δT )
ment clock synchronization x modeled (δT )
Table 6.12.: Influence quantities affecting the localization measurement.
213
6.3. Application example: acoustic localization
6. Experiments
Table 6.13.: Uncertainty budget for time interval measurement with frequency counter.
uncertainty contribution
sensitivity coefficient
assumed uncertainty
standard uncertainty
degrees of freedom
distribution
influence
estimate
weight
√
δ S E G u c v u
√
δres,counter 10.0 ns R 1/ √3 5.8 ns 1 ∞ 5.8 ns
δ sys,counter 4.0 ns R 1/ √3 2.3 ns 1 ∞ 2.3 ns
δbase,counter 1.7 ns R 1/ 3 1.0 ns 1 ∞ 1.0 ns
uc,T ,counter 6.3 ns 1 ∞ 6.3 ns
The estimates for u prop and umodel obtained from the frequency counter measurements
were used to build uncertainty budgets for the localization measurements with all three
devices. The standard deviations given in table 6.7 for the nodes 31 (T1) and 41 (T2) in
configurations 3 and 7 are used as estimates for the uncertainty uT of the time interval
measurement with the WSN. Tables 6.14 to 6.16 show the corresponding uncertainty
budgets. The RMSE of the measured localization errors are given for comparison.
The estimated uncertainty of the distance measurement matches quite well with the
measured RMSE from the filtered samples in case of the frequency counter and the
WSN without RDC. In case of the WSN with RDC estimated the uncertainty matches
roughly the RMSE from the unfiltered samples. This shows again, that the median fil-
tering is also effective in removing outliers caused by synchronization or timestamping
errors.
It is apparent that the influence of time interval measurement uncertainty on the overall
localization uncertainty quickly decreases as it gets smaller. Consequently, the local-
ization uncertainty for the frequency counter is only about 20 % smaller than that for
the WSN, although the counter’s time interval measurement uncertainty is about three
orders of magnitude better. Considering an idealized WSN, where only the clock reso-
lution of T tick = 2−14 s contributes to the time interval measurement uncertainty, yields
a localization uncertainty of 2.1 cm. Thus, only 0.1 cm or 4.5 % of the localization
uncertainty can be attributed to synchronization or timestamping errors.
214
6.3. Application example: acoustic localization
uncertainty contribution
sensitivity coefficient
standard uncertainty
degrees of freedom
influence
δ u c v u
uc,T ,counter 6.3 ns 317.0 m/s ∞ 2.0 µm
u prop 0.7 cm 1 76 0.7 cm
umodel 1.8 cm 1 76 1.8 cm
ud 76 1.9 cm
RMSE (filtered) 80 1.9 cm
RMSE (unfiltered) 80 2.2 cm
degrees of freedom
influence
δ u c v u
uT ,WS N 36.6 µs 317.0 m/s 999 1.2 cm
u prop 0.7 cm 1 76 0.7 cm
umodel 1.8 cm 1 76 1.8 cm
ud 76 2.3 cm
RMSE (filtered) 80 2.1 cm
RMSE (unfiltered) 80 2.2 cm
215
6. Experiments
Table 6.16.: Uncertainty budget for localization with WSN and active RDC.
uncertainty contribution
sensitivity coefficient
standard uncertainty
degrees of freedom
influence
δ u c v u
uT ,WS N 319.8 µs 317.0 m/s 999 10.1 cm
u prop 0.7 cm 1 76 0.7 cm
umodel 1.8 cm 1 76 1.8 cm
ud 76 10.3 cm
RMSE (filtered) 80 2.7 cm
RMSE (unfiltered) 80 13.9 cm
6.3.6. Conclusions
216
6.4. Time synchronous waveform acquisition
The aim of the experiments on synchronous waveform acquisition, was to observe the
influence of the synchronization precision on the frequency, phase, SNR and THD of
an acquired waveform. Furthermore, the proactive and reactive approaches to syn-
chronous sampling were compared. (see also section 4.4.2). Most of this section has
been previously published by the author in [Fun4].
The test method suggested in section 4.6.2 was used for the experiments. Figure 6.21
shows the setup. Two TIMs separately acquire a sine wave from a waveform generator
and wirelessly transmit the samples to the NCAP. The analog voltage sensor described
in section 5.1.5.4 was run in continuous mode for the experiments. Every sample was
triggered and transmitted individually, i.e. the acquisition block size was one. The
rtimer triggered the samples at a fixed rate of f sample = 32 samples/s. Both, the reactive
and the proactive approach were investigated in the experiments (see section 5.2.3 for
their implementation).
The waveform generator used in the experiments (HAMEG HM8150) had a frequency
resolution of 10 mHz and a specified frequency accuracy of 15 mHz. For a sine signal
with a peak-to-peak voltage of V pp = 1.0 V a SNR of 65 dB and a THD of -65 dB are
specified [52]. During the experiments a sine signal with a peak-to-peak amplitude of
V pp = 3.0 V and a DC component of Vdc = 1.6 V was used, in order to cover most of
the ADC’s input range.
An advantage of the test method is that it can equally be applied to WSNs as to con-
ventional multi-channel data acquisition systems. Therefore a USB DAQ-card (Na-
tional Instruments USB6009) was used as a reference. The DAQ-card contains a 16 bit
217
6. Experiments
successive-approximation ADC with four multiplexed inputs, two of which were used
to sample the sine wave from the generator simultaneously. As only input voltage
ranges symmetrical to 0 V are supported by the DAQ-card, an input range of ±2 V was
chosen for the experiments. The peak-to-peak amplitude of the waveform generator
was set to V pp = 3.8 V and its DC-component to Vdc = 0 V. Otherwise the same
parameter settings as for the WSN were used.
Table 6.17 gives an overview of the configurations that were investigated. Radio duty-
cycling was deactivated in all experiments. Two sine frequencies were used: one low
and one high relative to the WSN’s sampling rate. They were chosen following the
recommendations outlined in section 4.6.2.
For each configuration 100 waveforms of 2048 synchronously acquired samples were
recorded from each node. By taking the samples recorded with the reactive approach
before the resampling and discarding the timestamps a set of unsynchronized wave-
forms was obtained. A set of waveforms for the hybrid approach was generated by
using the timestamps recorded within the proactive approach to do a resampling of the
data. During configurations 1 and 2 the histogram of clock updates was recorded in
addition to the sampled data.
The frequency error ϵ f , the offset error ϵt0 as well as the SNR and THD of the wave-
forms were calculated as described in section 4.6.2. Table 6.18 shows the means and
standard deviations of the results calculated over all N = 100 waveforms for every
configuration. Figure 6.22 shows the means of the estimated pairwise time offsets.
The error bars indicate and interval of two standard deviations. As all approaches to
synchronized sampling show significantly lower offsets than the unsynchronized case,
figure 6.23 shows the same data with a zoomed y-Axis.
218
6.4. Time synchronous waveform acquisition
Table 6.18.: Frequency errors ϵ f and time offset errors ϵt0 calculated from the acquired
waveforms.
Synch. f signal ϵt0 ϵf
Approach TIM 1 TIM 2
mean std. mean std. mean std.
[Hz] [µs] [µs] [mHz] [mHz] [mHz] [mHz]
none 0.27 2575.1 4589.4 −3.9 2.8 −3.9 2.8
reactive 0.27 −8.1 81.3 −3.9 2.8 −3.9 2.8
proactive 0.27 −7.7 70.5 4.44390 0.00042 4.44388 0.00037
hybrid 0.27 −9.6 68.9 4.44390 0.00043 4.44388 0.00037
DAQ-card 0.27 14.1 8.8 −4.86757 0.00008 −4.86758 0.00007
none 7.11 2081.6 3121.7 −3.82316 0.0030 −3.3526 0.0068
reactive 7.11 495.8 157.6 −3.78406 0.0030 −3.678 0.013
proactive 7.11 2.2 2.6 −1.0 4.3 −1.0 4.3
hybrid 7.11 1.1 2.4 −1.0 4.3 −1.0 4.3
DAQ-card 7.11 17.7 0.3 −3.73427 0.00076 −3.73427 0.00076
10 10
5 5
ǫt 0 [ms]
ǫt 0 [ms]
0 0
−5 −5
e
e
e
d
id
id
ne
ne
tiv
tiv
tiv
tiv
ar
ar
br
br
no
no
−c
−c
ac
ac
ac
ac
hy
hy
Q
Q
o
o
re
re
pr
pr
A
A
D
Figure 6.22.: Mean pairwise time shifts T shi f t . The error bars indicate an interval of
twice the standard deviation.
219
6. Experiments
0.2 0.2
0.1 0.1
ǫt 0 [ms]
ǫt 0 [ms]
0 0
−0.1 −0.1
−0.2 −0.2
e
e
rd
id
ne
e
e
d
id
ne
iv
iv
iv
tiv
ar
br
a
no
br
ct
t
no
−c
ct
ac
−c
hy
ac
oa
hy
oa
Q
re
Q
re
pr
pr
A
D
D
(a) f signal = 0.27 Hz (b) f signal = 7.11 Hz
Figure 6.23.: Mean pairwise time shifts T shi f t with zoomed y-axis. The error bars indi-
cate an interval of twice the standard deviation.
The offset in the unsynchronized case is surprisingly small (ca. 2.5 ms). This is because
the acquisition was started with the same broadcast message on both TIMs. This way,
the nodes were implicitly synchronized to some degree. The remaining time offset
was only due to timing differences in the process scheduling of the individual nodes.
In nearly all cases, the standard deviation is smaller at the higher signal frequency
compared to the lower. This is due to the time offset estimate being less sensitive to
variance in the phase estimate at higher signal frequencies (compare (4.57)).
For all approaches to synchronized sampling the time offsets are minimal at the lower
signal frequency ( f signal = 0.27 Hz). They vary only in a range of roughly two ticks of
the rtimer T T ick ≈ 61.0 µs. For the higher signal frequency ( f signal = 7.11 Hz), the
time offset from the reactive approach shows a big increase. This is due to the linear
interpolation used in the reactive approach being less accurate at signal frequencies
close to the WSN’s Nyquist frequency ( f sample /2 = 16 Hz) (compare section 3.3.2).
The time offset of the DAQ-card is caused by its analog input multiplexer (see section
3.2.3). The mean offset is larger than in most cases of synchronized sampling with the
WSN, but the standard deviation is significantly smaller.
The estimates for the frequency error ϵ f , shown in table 6.18, are much smaller than
the specified frequency accuracy of the generator (15 mHz [52]). Thus, no drift error
could be detected for either of the acquisition methods or the DAQ-card.
To get a further insight into the performance of the sensor nodes’ clocks their average
sampling rate was calculated from the acquired sample timestamps (see 6.17). The fact
that the sampling rate is always exactly 32 samples/s for the resampled data (reactive and
220
6.4. Time synchronous waveform acquisition
hybrid approach) just shows that the resampling algorithm wrote the correct sampling
interval into the waveforms it generated. In the unsynchronized measurements it can
be observed that the sampling frequency of TIM2 (node 42) was off by -1.89 mHz (-
59.1 ppm), while it was only 0.25 mHz (7.8 ppm) for TIM1 (node 26). These results
correlate well with the drifts of nodes 31 and 41 relative to node 27 given in table 6.5.
Thus, the observed difference in sampling rates is probably due to drift errors of the
nodes’ real-time clocks. The resulting frequency error in the recorded signal would
be 0.05555 mHz for TIM1 and -0.41993 mHz for TIM2 at the higher signal frequency
(7.11 Hz). This matches with the observed difference in frequency errors for two TIMs
in the unsynchronized case (see table 6.18). In the proactively synchronized measure-
ments the error in sampling rate is significantly smaller, showing the effectiveness of
the synchronization.
The results of the SNR estimation are given in figure 6.24. In the unsynchronized case
the data acquisition is not influenced by any synchronization algorithm. Thus, the SNR
for this case indicates the general performance of the ADC and is used as a reference.
It is, however, about 10 dB lower than the specified SNR of the waveform generator
and about 17 dB lower than the ideal SNR of a 12 bit ADC. This may be due to noise
from the sensor nodes’ other components affecting the signal quality. Furthermore, it
is observed that TIM1 generally shows a slightly lower SNR than TIM2. The SNR of
the signals acquired with the DAQ-card matches well with the specified SNR of the
waveform generator (65 dB). At the lower signal frequency all approaches show a SNR
close to that of the unsynchronized data. At the higher signal frequency the SNR of the
reactive approach is much lower than for the other approaches. This again, is caused
by a decrease in interpolation accuracy close to the Nyquist frequency.
221
6. Experiments
70 TIM1/Ch1 70
TIM2/Ch2
60 60
SNR [dB]
SNR [dB]
50 50
40 40
30 30
e
e
d
id
ne
e
e
rd
id
ne
iv
tiv
ar
iv
tiv
br
no
br
ct
no
−c
ct
ac
−c
hy
ac
oa
hy
oa
Q
re
Q
re
pr
A
pr
D
D
To investigate why the SNR of TIM2 is about 15 dB lower than that of TIM1 for the
reactive approach at the higher signal frequency, two acquired waveforms, one from
TIM1 and one from TIM2, were also resampled for output sampling rates other than
the desired 32 samples/s. If the original sampling rate of TIM1 is chosen as the output
sampling rate for the resampling, the SNR is about equal to that in the unsynchronized
case (51.3 dB) and much lower for TIM2 (30.1 dB). If the original sampling rate of
TIM2 is chosen for the resampling, it is the other way around (TIM1: 30.1 dB; TIM2:
54.5 dB). If the average of the original sampling rates is taken the SNR is 35.8 dB for
both nodes. At resampled rates of 31.5 and 32.5 samples/s the SNR is 20.9 dB. Thus,
the decrease in SNR seems to grow with increasing sampling rate change during the
resampling. This again shows the poor performance of the used interpolation at signal
frequencies close to the Nyquist frequency.
Although the differences are not statistically significant, it is also worth noting, that
the SNR of the data acquired with the proactive approach is constantly slightly lower
than that of the unsynchronized data. At the higher signal frequency this difference
is a little bigger that at the lower. To check whether this could be related to an in-
creased jitter from clock updates, the histograms of the clock updates shown in figure
6.25 were evaluated. They show that in most synchronization intervals the clock did
not need to be updated because it was still synchronized (clock correction zero). In the
other cases the corrections are mostly very small (1-2 Ticks). This behavior is consis-
tent with the clock update histograms obtained for the same synchronization method
during the event detection experiments (see appendix E.2). Inserting the standard devi-
ation calculated from the histogram data into (4.38) the SNR was calculated assuming
time base jitter to be the only noise source. The results were 83.4 dB for the lower and
55.0 dB for the higher signal frequency. Comparing this to the SNR in the unsynchro-
222
6.4. Time synchronous waveform acquisition
nized case shows that at the lower frequency the overall SNR is probably dominated by
other noise sources, while at the higher frequency the noise from the synchronization
jitter has about the same strength. Thus, the slight drop in SNR for the proactive and
hybrid approach at the higher signal frequency appears indeed to be caused by synchro-
nization jitter. For cases with more frequent or larger clock updates a more significant
deterioration of the signal quality is expected.
0.6 0.6
frel. [1]
0.4 0.4
0.2 0.2
0 0
< −5 −4 −2 0 2 4 >5 < −5 −4 −2 0 2 4 >5
∆cT 1 [Ticks] ∆cT 2 [Ticks]
Figure 6.25.: Histogram of clock updates during acquisition of all records for configu-
rations 1 and 2.
The results of the THD estimation are displayed in figure 6.26. The THD in the un-
synchronized case is representative of the ADC’s general performance, as it is not in-
fluenced by any time synchronization algorithm. This THD was estimated to be about
5 dB better than the specified THD of the generator. Signals acquired with the DAQ-
card show an equally high THD. The reason for this may be the amplitude being higher
than in the specified case or a conservative specification by the generator’s manufac-
turer. At the lower signal frequency all approaches show essentially the same THD val-
ues as in the unsynchronized case. At the higher signal frequency the reactive approach
shows a significantly worse THD, while that of the proactive and hybrid deteriorate
only slightly. The differences in THD between the two TIMs in the reactive approach,
like the differences in SNR, are caused by the slight difference in sampling rate.
223
6. Experiments
−90 −90
TIM1/Ch1 TIM1/Ch1
−80 TIM2/Ch2 −80 TIM2/Ch2
THD [dB]
THD [dB]
−70 −70
−60 −60
−50 −50
−40 −40
e
e
rd
id
ne
e
e
rd
id
ne
iv
iv
iv
tiv
br
a
no
br
a
no
ct
t
−c
ct
ac
−c
hy
ac
oa
hy
oa
Q
re
Q
re
pr
pr
A
D
D
(a) f signal = 0.27 Hz (b) f signal = 7.11 Hz
As the output samples are obtained through linear interpolation in the reactive approach,
it has the inherent capability to compensate for samples that were lost during the trans-
mission. Yet, as no samples were lost in the experiments described in the previous
subsection, this feature could not be evaluated there. In a later experiment, however, a
waveform was acquired were about 3.8 % had been lost, probably due to interference
from another wireless system. The setup for this recording matched that of configura-
tion 3 in table 6.17.
Figure 6.27 shows the original and resampled data points for a section of the recording.
The frequency error, the SNR and the THD of the signal before and after resampling
are given in table 6.20. While the frequency error appears to be unaffected by the
loss of samples there is a big deterioration in the signal’s SNR and THD. After the
resampling, however, both are restored to about the same levels that there observed for
signals without sample loss in the previous subsection.
Table 6.20.: Quality parameters of signal with lost samples before and after resampling.
before after
ϵf [mHz] 6.1 -5.4
SNR [dB] 15.0 49.8
THD [dB] -41.6 -69.1
224
6.4. Time synchronous waveform acquisition
original resampled
3
amplitude [V]
0
5.5 6 6.5 7 7.5
time [s]
Figure 6.27.: Section of signal showing recorded and resampled data points. Intervals
with missing samples are highlighted.
In later experiments, powertrace data was collected during waveform acquisition with
the WSN. The network configurations 1 to 4 shown in table 6.17 were investigated.
Figure 6.28 shows the results.
Like in sections 6.1.1 and 6.2.4 the average power consumption is dominated by the lis-
tening consumption of the radio transceiver and the low power mode of the CPU. Also
similar to section 6.2.4, the configurations using the proactive approach show a slightly
increased power consumption of the NCAP compared to those using the reactive one.
The more critical power consumption of the TIMs, however, is practically the same
for both approaches. The increased NCAP power consumption is caused by the send-
ing of synchronization packets as well as more CPU activity. If the resampling during
the reactive approach was done on the NCAP instead of the PC, this would increase
the power consumption of the NCAP in the reactive case, diminishing the difference
to the proactive case or even reversing the relation. If the network was to spend more
time without any transmission of measurement data, the reactive approach is expected
to have larger advantages over the proactive one in terms of power consumption, as it
doesn’t require regular synchronization messages.
225
6. Experiments
80
70 lpm
cpu
60
avg. power [mW]
listen
50 tx
40
30
20
10
0
Node: N T1 T2 N T1 T2 N T1 T2 N T1 T2
1,2 1,2 3,4 3,4
TDMA TDMA CSMA CSMA
0.27 Hz 7.11 Hz 0.27 Hz 7.11 Hz
Configuration
Figure 6.28.: Mean power consumption of nodes doing synchronous waveform sam-
pling.
6.4.5. Conclusions
226
6.5. Synchronous angular sampling
To evaluate the synchronous angular sampling algorithm presented in section 5.3 and
its implementation on the WSN, several simulations and experiments were done. First
the effects of different components in the measurement chain on signals sampled over
the angle are examined during simulations in section 6.5.1. Section 6.5.2 presents sim-
ulations to detect possible differences between the different implementations of the al-
gorithm. The performance of the algorithm running on a WSN is investigated by re-
sampling signals from a waveform generator, in section 6.5.3. Finally, experiments
using synchronous angular resampling with a WSN at a motor test bench are pre-
sented in section 6.5.4. Most of this chapter has already been published by the author
in [Fun5, Fun7].
To investigate the effect of the components in the measurement chain on signals sam-
pled over the angle, simulations in MATLAB/SIMULINK were done. They started
with an idealized sampling model as introduced in section 2.4.1. Then step by step,
components were added to model non-ideal effects found in real measurement setups.
The parameters of the measurement chain were chosen in accordance with those of the
WSN (compare section 5).
Figure 6.29 shows the setup used for the simulations. A rotating machine is simulated,
that accelerates linearly from 15 to 1500 rpm within 2 s. The rotation angle ϕ is obtained
by integrating over the speed signal. A cosine function with ϕ as its argument represents
a harmonic signal at the second order of rotation. The rotation angle ϕ is also used to
generate sampling pulses at equidistant angular intervals of Φ s = 2π/25.
Table 6.21 shows the different configurations of the simulation setup that were used.
The first simulated the ideal synchronous angular sampling model introduced in sec-
tion 2.4.1. Then, in configuration 2, a zero-order hold was added, that sampled the
continuous input signal at equidistant time instants tn = nT s = n/ f s before the an-
gular resampling. To investigate the effect of the analog sampling frequency f s it was
doubled in configuration 3. In order to account for the amplitude quantization by an
ADC, a 12 bit-quantizer was added in configuration 4. Finally, configurations 5 and 6
investigated the effect of the group delay from an analog anti-aliasing filter. The filter
used was a continuous 8th-order lowpass filter with a cutoff-frequency of 2 kHz.
227
6. Experiments
For all configurations the SINAD of the output signal x(lΦ s ) was taken as a quality
indicator, as it includes the effects of both harmonic distortions and noise. The SINAD
was calculated using the algorithm described in section 3.4.3.3.
6.5.1.2. Results
Figure 6.30 shows the SINAD of the output signal x(lΦ s ) for the different configu-
rations. It is obvious from figure 6.30a that in the first configuration the SINAD is
much higher than in all others. In this configuration the value of the SINAD is prob-
ably only limited by the numerical accuracy of the simulation software. Apparently,
the introduction of uniform time sampling already leads to a strong decrease in the
SINAD although the sampling rate of 20 ksamples/s is much higher than the maximum
angular sampling frequency of 0.625 ksamples/s and both are much higher than twice the
maximum signal frequency of 50 Hz.
228
6.5. Synchronous angular sampling
55
200
SINAD [dB]
SINAD [dB]
150 50
100
45
50
1 2 3 4 5 6 1 2 3 4 5 6
Configuration Configuration
a) b)
Figure 6.30.: SINAD of output signals synchronous to the rotation angle. Graph b)
shows the same data as graph a) but with zoomed y-axis.
The reason for this is, that when sampling over time before the angular sampling, the
signal value obtained for an angular sampling instant tϕ,l is equal to that of the preceding
time sampling instant tn ≤ tϕ,l < tn + T 0 . Thus, the effect is the same as if the angular
sampling instants were quantized with a resolution of T 0 , i.e. the time sampling period.
Consequently, the resulting quantization error of the angular sampling instants causes
a jitter in the angular sampling interval Φ s . Assuming a uniform distribution for the
quantization error the RMS-value of this jitter in the time domain is:
T0
T ϕ, j = √ . (6.16)
12
To transfer this jitter to the angle domain a first order Taylor approximation is used:
dϕ(t )
ϕ j (t ) ≈ T ϕ, j = ω(t )T ϕ, j . (6.17)
dt
As the rotational speed ω was changing during the simulations, the speed ωavg,ϕ av-
eraged over the angle was used to calculate an average jitter in angle domain. This
average angle jitter was used with (4.40) to obtain a theoretical value for the SNR of
the sampled signal. Figure 6.31 shows a comparison of the theoretical values for the
SNR and those calculated from simulated signals at various uniform time sampling
rates. The very good match between the theoretical and the simulated values shows,
that the modeling is accurate. The fact that the SNR-values in figure 6.31 are about
equal to the SINAD-values in figure 6.30, shows that no significant harmonic distortion
occurred.
The addition of amplitude quantization in configuration 4 has no significant effect on
the signals SINAD. This is plausible, when considering that the ideal SNR of a 12 bit-
quantizer is about 72 dB. Thus, its contribution to the overall signal noise is insignificant
compared to that of the sampling jitter.
229
6. Experiments
65
theoretical
60
simulation
SNR [dB]
55
50
45
40
10 20 40 60 80 100
f0 [kHz]
Figure 6.31.: Relation between analog sampling rate and SNR of angular signal.
1
ϕ(t + T grp ) =αrot (t + T grp )2 + ω0 (t + T grp ) (6.19)
2
1 αrot 2
= αrot t2 + ωo t + αrot T grp t + T + ω0 T grp . (6.20)
2
2 grp
ϕ(t ) Φgrp
Thus, the phase shift of the signal was increasing linearly with time during the simula-
tion, which caused an increasing error in the angular resampling positions. To compen-
sate for this effect, the angle signal used for the resampling was delayed by a constant
time of 290 µs, which is approximately equal to the group delay of the filter in the
given frequency range. The fact, that the SINAD of the output signal for configuration
6 is about the same as for configurations 2 and 4 shows, that this compensation was
effective.
230
6.5. Synchronous angular sampling
Figure 6.32 shows the block diagram of the simulation setup. As in the previous sim-
ulation a harmonic signal at the second order is obtained from a linear speed ramp
(n = 15 . . . 1500 rpm within 2 s). The amplitude of the signal was one arbitrary unit
(1 arb.).
231
6. Experiments
The signal was sampled at time instants tn distributed uniformly over time at a sampling
rate of 20 ksamples/s. To simulate the influence of the ADC the signal was quantized
with a resolution of 12 bit. The rotation angle ϕ(t ) was also used to sample the sys-
tem clock at 25 equidistant angular intervals per revolution, generating the timestamps
tϕ,l = t (lΦ s ). The timestamps tϕ,l were quantized with the resolution of the Preon32’s
rtimer: T rtc = 2−14 s. To check the rejection of noise, zero-mean white Gaussian
noise with a standard deviation of σ = 10−2 arb. was added in a second simulation.
In a third simulation, the rejection of spurious frequencies was checked by adding a
constant frequency sine at f spur = 1.25 kHz with an amplitude of 1 arb. instead of the
noise.
The simulated samples x(tn ) and timestamps t (lΦ s ) were fed into the resampling filter
described in section 5.3, in order to obtain the signal x(lΦ s ) sampled uniformly over
the rotation angle. The S&H resampling can be described to as zeroth-order polyno-
mial resampling (see also 3.3.2). Higher polynomial orders would not have improved
performance here, because the resolution of the timestamps ∆t ≈ 61 µs was already
bigger than the sampling period T in = 50 µs.
A sine fit, using the four-parameter algorithm described in 3.4.3, was performed on the
resampled signals and their RMS-value, frequency and SINAD were calculated.
The same simulated signals were resampled using the MATLAB implementation of the
filter on a PC, as well as the two C implementations on a sensor node. For the latter the
simulated input data was sent to and the resampled signal received from a sensor node
via its USB-interface. The evaluation of the output signals was done in MATLAB on a
PC in all cases.
To measure the computational load of the algorithm on the sensor node, a sine wave
signal with a constant frequency of 50 Hz and an input sampling rate of 20 ksamples/s
was resampled for a speed of 1500 rpm and an angular rate of 25 samples/rev. The time
needed to resample 8192 input samples (i.e. 256 output samples) was measured using
the internal clock of the sensor node.
The
√ deviations of the output signals’ RMS-values from the nominal RMS-value of
1/2 arb. are shown in figure 6.33. No error bars are given because only one input
sequence was used in each case. It was exactly the same for all three implementations.
No systematic difference in terms of RMS-deviation is observed between the imple-
mentations. The key observation is that the deviations are very small (absolute value
≤ 2 · 10−4 ) in all cases.
232
6.5. Synchronous angular sampling
0 Q15
F32
−100 MATLAB
−200
Figure 6.34 shows the deviations from the nominal order of 2. It is observed that the
order error for the fixed-point implementation (Q15) is always slightly larger than for
the floating-point (F32) or MATLAB-implementation. Yet, the key observation is that
the deviations are very small (absolute value < 10−6 ) in all cases.
−1.0
−0.9
Order-Error [ppm]
−0.8 Q15
F32
−0.7 MATLAB
−0.6
−0.5
only chirp with noise with spurious
The results for the SINAD of the resampled signals are shown in figure 6.35. All
implementations perform about equally well, with only a slight disadvantage for the
fixed-point-implementation. The S&H-resampling always results in a lower SINAD.
This is especially prominent in the simulation with a spurious component, where it
drops to 0.5 dB.
233
6. Experiments
50
40
SINAD [dB]
Q15
30 F32
MATLAB
20 S&H
10
0
only chirp with noise with spurious
To further illustrate the effect of the spurious component the input and output signals
for this simulation as well as the corresponding spectrograms are given in figure 6.36.
The input signal with the spurious component is given in figure 6.36 a), its spectrogram
in figure 6.36 b). As the frequency of the spurious component is much higher than
the maximum output sampling frequency, it cannot be resampled correctly under the
Nyquist theorem:
1500 rpm
fout,max = 25 · = 625 Hz < 2 f spur . (6.21)
60
Without the resampling filter, this leads to a heavily noised signal; as the spurious
component is aliased into the frequency band many times (see figure 6.36 c) and d)).
The resampling filter, by contrast, completely eliminates the spurious component, and
outputs a clean constant sine wave at the order two (see figure 6.36 e) and f)). Thus, it
is effective in suppressing aliasing during resampling.
The time needed to resample a constant frequency sine wave with 8192 input and 256
output samples on the Preon32 was measured to be 655.5 ms for the floating-point and
68.2 ms for the fixed-point implementation. In order to be suitable for real-time oper-
ation in the designated measurement system, the filtering algorithm needs to process
2048 input samples within 102.4 ms and still leave enough time for radio communi-
cation and buffer handling (see also section 5.3.5). Thus, it is not possible to use the
floating-point implementation (expected time 163.9 ms). The fixed-point implementa-
tion, however, is well suited (expected time 17.1 ms). Its causes a computational load
of only about 16.7 %.
234
6.5. Synchronous angular sampling
2 1.5
amplitude [arb.]
1
input x(t )
f [kHz]
0
0.5
−1
−2 0
0 0.5 1 1.5 2 0.5 1 1.5
a) time [s] b) time [s]
2
S&H resampling x(lΦ s )
10
amplitude [arb.]
1
order [1]
0
5
−1
−2 0
0 5 10 2 4 6 8 10 12 14
c) angle [rad/2π] d) angle [rad/2π]
2
resampling filter x(lΦ s )
10
amplitude [arb.]
1
order [1]
0
5
−1
−2 0
0 5 10 2 4 6 8 10 12 14
e) angle [rad/2π] f) angle [rad/2π]
235
6. Experiments
For a first evaluation of the WSN’s synchronous angular sampling performance it was
tested on generated signals.
A two-channel waveform generator (Agilent 33500B) was used to generate both a sine
wave and a pulse signal (see figure 6.37). The frequency of the pulse signal was fixed
at exactly f pulse = 30 f sine throughout the experiment. This way the sine wave signal
emulates a generic machine signal at the order one, while the pulse signal emulates the
output of a rotary encoder with 30 pulses per revolution.
The sine signal was sampled with an analog sampling frequency of 20 ksamples/s on the
data TIM and stored in blocks of 2048 samples. The rotation TIM transmitted a new
block of timestamps every 100 ms. Thus, the block rates were about the same on both
TIMs. The TDMA-MAC, described in section 5.1.3, was chosen in order to maximize
data throughput and provide time synchronization.
Constant frequency sine waves at 2.5 Hz= ˆ 150 rpm and 25 Hz=ˆ 1500 rpm as well as a
variable speed profile with periodically changing speed were investigated. Figure 6.38
shows one cycle of this profile. Every cycle contains 110 simulated revolutions leading
to 1650 output samples. The input signal had a peak-to-peak amplitude of 3.20 V and
a DC-offset of 1.65 V in all experiments. Thus, most of the sensor node’s input voltage
range was covered. The amplitude accuracy of the waveform generator is specified
as 1 mV + 1 % of amplitude at 1 kHz. Its signal purity is specified with a THD below
-70 dBc and non-harmonic noise below -75 dBc for signal frequencies below 20 kHz.
236
6.5. Synchronous angular sampling
Resampling using the resampling filter, S&H resampling and direct sampling were used
to acquire the signals. In direct sampling the synchronous angular sampling is achieved
for constant speeds by setting the sampling rate of the analog-to-digital converter to the
required output rate. For variable speeds this method is, of course, not applicable. A
total of 100 recordings with 2048 output samples were acquired for every combination
of input signal and sampling method. Like in the experiments in section 6.5.2 the RMS-
value, order and SINAD of the resampled signals were calculated using sine fitting.
1500
speed [rpm]
150
0
0 1 2 3 4 5 6 7 8
time [s]
Figure 6.38.: One period of the variable speed profile used in waveform generator ex-
periments.
The same setup was also used to measure the average power consumption of the senor
nodes during acquisition using Contiki’s powertrace mechanism. For this purpose
one recording was evaluated at each constant speed: 150 rpm and 1500 rpm.
Figure 6.39 shows the mean RMS-values over all 100 recordings. The error bars indi-
cate an interval of two standard deviations. It is observed that the measured RMS-values
are about equal for all sampling methods. All values are well within the specified accu-
racy of the generators amplitude setting.
237
6. Experiments
1.140
amplitude [V RMS]
filter
1.130 S&H
direct
1.120
Figure 6.39.: RMS-values of acquired generator signals. The solid horizontal line indi-
cates the nominal value set at the waveform generator. The dashed hori-
zontal lines indicate the specified accuracy of this setting
Figure 6.40 shows the mean order of the recorded signals. It is observed that the order
of the resampled signals matches very well with the nominal setting for all speeds,
regardless of whether the resampling filter or S&H-resampling was used. The order
of signals recorded with direct sampling deviates by about 0.4 %. This is probably
due to the limited resolution and accuracy of the sampling frequency setting of the
sensor node. However, these results also show that resampling is very effective in
compensating for those effects.
1.000
0.999
order [1]
filter
0.998 S&H
direct
0.997
0.996
0.995
150 rpm 1500 rpm variable
Figure 6.40.: Order of acquired generator signals. The nominal order is indicated by
the horizontal line.
238
6.5. Synchronous angular sampling
Figure 6.41 shows the mean SINAD of the recorded signals. The SINAD of the re-
sampled signals is significantly higher at 150 rpm than at 1500 rpm, whereas it stays
constant for directly sampled signals. This is probably due to the output sampling time
intervals being larger at lower speeds, while the resolution of the angular timestamps
stays constant. As a consequence the relative time base jitter is smaller at lower speeds.
Furthermore, the resampling filter removes the noise energy of signal components with
f > 0.25 fout . Thus, it causes a strong increase in SINAD at lower speeds. In case
of the S&H resampling and direct sampling the noise energy of the higher frequency
components is instead aliased to the lower bands. The SINAD from the variable speed
recordings is in between that of the 150 rpm and 1500 rpm recordings for the suggested
filter. For the S&H resampling it is even lower than that of the 150 rpm recordings.
65
60
SINAD [dB]
55
filter
50 S&H
direct
45
40
35
150 rpm 1500 rpm variable
An early finding of the experiments on power consumption was that putting the CPU
into low power mode caused infrequent glitches in the resampled data. The delays
during by the duty-cycling of the CPU apparently cause overflows in the acquisition
buffers. This points to a suboptimal behavior of the process scheduling mechanism,
since the computational load calculated in section 6.5.2 as well as the powertrace data
shown in figure 6.42 indicate that the CPU is far from working at maximum load. Due
to the problems with CPU duty-cycling, the results for the signal quality described
above were obtained with CPU duty-cycling deactivated.
239
6. Experiments
110
100
lpm
90
cpu
avg. power [mW]
80
listen
70
tx
60
50
40
30
20
10
0
TIM−dat.
TIM−dat.
TIM−dat.
TIM−dat.
TIM−rot.
TIM−rot.
TIM−rot.
TIM−rot.
NCAP
NCAP
NCAP
NCAP
Node−ID:
150 rpm 1500 rpm 150 rpm 1500 rpm
− − CPU duty−cycling CPU duty−cycling
Configuration
Figure 6.42.: Average power consumption of nodes doing synchronous angular sam-
pling.
The average power consumptions of the nodes displayed in figure 6.42 show that with-
out CPU duty-cycling the power consumption is about the same, i.e. 110 mW, for all
nodes and speeds. Active CPU duty-cycling reduces the average power consumption by
about 25 %. Furthermore, the amount of computation it performs determines a node’s
power consumption in this case. Thus, the rotation TIM has the lowest average power
consumption and the data TIM the highest. At 1500 rpm, the power consumption of all
nodes is higher than at 150 rpm. The increase is strongest on the rotation TIM due to
the highly increased number of angular timestamps transmitted per unit of time.
On the data TIM the increase is only marginal, as its power consumption is mainly
determined by the analog sampling rate and the output block rate, which both are inde-
pendent of the rotational speed. The situation is similar for the NCAP where a slight
increase in power consumption is caused by the increase in the size of transmitted data
blocks.
To test the synchronous angular resampling with the WSN in a more application ori-
ented scenario, measurements were carried out at the motor test bench introduced in
section 5.1.6. Figure 6.43 shows the setup that was used to record the voltage of one of
the induction motor’s three phases.
240
6.5. Synchronous angular sampling
Like in the experiments described in the previous subsection, measurements were taken
at constant speeds of 150 rpm and 1500 rpm as well as at a variable speed profile. The
variable speed profile was generated by periodically changing the speed setting of the
inverter between 150 rpm and 1500 rpm. The actual speed gradient was limited by the
inverter’s settings and breaking capabilities, so that a ramp signal similar to that in figure
6.38 was expected. Again, resampling with the suggested filter, S&H resampling and
direct sampling were used to acquire the motor voltage. For comparison, it was also
acquired with a DAQ-card (USB6009, National Instruments) at a constant sampling
rate of 20 ksamples/s. A total of 10 recordings with 2048 output samples were acquired
for every combination of speed setting and acquisition method. For the experiments
at constant speed the RMS-value, order and SINAD were calculated using a sine fit as
described in section 3.4.3. For the variable speed experiments no meaningful sine fit
was possible, as the motor voltage changes its amplitude with the speed.
The torque shaft of the test bench outputs an analog voltage signal that is proportional
to the shaft speed. This signal was also recorded with the DAQ-card and used as a refer-
ence for the speed readings. Furthermore, a frequency counter (HM8123, Hameg) was
used to measure the average rotational speed and the frequency of the motor voltage.
241
6. Experiments
Figure 6.44 shows the mean RMS-voltage of the motor over all 10 recordings. The
error bars indicate an interval of two standard deviations. It is observed that the results
from all measurements recorded with the sensor node are in well agreement with those
recorded with the USB data acquisition card (USB6009).
250
200
amplitude [V RMS]
filter
150
S&H
direct
100
USB6009
50
Figure 6.45 shows the mean orders of the motor voltage. The order of the signals
recorded using the suggested resampling filter and S&H resampling are always identi-
cal and slightly larger than the order measured with the frequency counter. This may
be explained by an inaccuracy of the timestamps used for resampling. Like in the
recordings from the frequency generator given in section 6.5.3, the order of the sig-
nals recorded without resampling deviates from the others due to inaccuracies of the
sampling frequency. An interesting observation is that the order of the voltage is sig-
nificantly lower at 1500 rpm than at 150 rpm. This may indicate an increased slip of the
induction motor at low speeds due to higher friction losses.
2.020
2.010 filter
order [1]
S&H
2.000 direct
USB6009
1.990
1.980
150 rpm 1500 rpm
242
6.5. Synchronous angular sampling
Figure 6.46 shows the mean SINAD of the motor voltage. The values are generally
lower than those for the recordings from the frequency generator (see section 6.5.3).
This indicates that at the test bench the signals were generally noisier. One reason for
this is probably that the motor voltage is generated by the inverter through pulse-width-
modulation of a square wave. Thus, it contains more high frequency noise.
36
34
SINAD [dB]
filter
32 S&H
direct
30 USB6009
28
Due to the good lowpass characteristic of the suggested resampling filter, the signals
recorded with it always have a significantly higher SINAD than those recorded with
S&H resampling or direct sampling. The decrease in SINAD at higher speeds that
was observed in section 6.5.3 is not visible here, probably because the influence of
other noise sources is much stronger than that of the resampling jitter in this case.
At 150 rpm, the signals recorded with the data acquisition card USB6009 display a
SINAD higher than those recorded with the resampling filter. This may be due to the
USB6009 having a higher input voltage range and resolution than the Preon32 sensor
node. At 1500 rpm, however, the SINAD of the USB6009 drops well below that of the
Preon32 with resampling filter. This is likely to have been caused by an increase of
high frequency components in the motor voltage at higher speeds.
Figure 6.47 shows the speed profile measured with the torque shaft and rotation node
during one cycle. Both measurements are in good agreement, but the results from
the rotation node exhibit more noise due to the limited timestamp resolution (T T ick =
61.0 µs). The speed cycle can be divided into four segments. In figure 6.47 they are
separated with vertical red lines and labeled with numbers. In segment one the motor
is decelerating, in segment two it has a constant speed of about 150 rpm. In segment
three it accelerates back to 1500 rpm and keeps this speed throughout segment four.
The length of the deceleration and acceleration segments is determined by the speed
change limits and breaking capabilities of the inverter.
243
6. Experiments
1500
Preon32 torque shaft
speed [rpm]
1000
500
150
1 2 3 4
0
0 1 2 3 4 5 6 7 8
time [s]
Figure 6.47.: Speed profile acquired during one cycle. Vertical red lines separate the
four segments of the profile.
Figure 6.48 shows the speed profile, motor voltage and order spectrogram of the same
cycle as figure 6.47 with the rotation angle instead of the time as x-axis. The order
spectrogram was obtained by calculating the STFT for the resampled signal. A rect-
angular window of 60 samples, i.e. two revolutions, was used. It is obvious from the
spectrogram that the signal is constantly at the second order of rotation. Furthermore,
the spectrogram displays hardly any signs of leakage components, which shows that
resampling has worked as expected. In segment three an increased noise level can be
observed. This may be due to the modulation spectra arising from the change of ampli-
tude in this segment. Furthermore, also noise from the inverter power electronics may
have an influence.
In segment one no such effects are visible, possibly because the speed gradient was
much less there. The voltage amplitude in figure 6.48 matches well with the RMS-
values measured at constant speeds (compare figure 6.44).
244
6.5. Synchronous angular sampling
magnitude [dBV]
40
20
0
4
100
80
3
angle [rad/2π]
2
40 60
1
20
0
−200
1500
1000
500
200
order [1]
speed [rpm] motor voltage [V]
Figure 6.48.: Speed, motor voltage and order spectrogram of one cycle. The green line
in the motor voltage plot is the amplitude of the second order calculated
from the spectrogram.
245
6. Experiments
6.5.5. Conclusions
The simulations in section 6.5.2 show that the implemented resampling filter can ef-
fectively convert a linear chirp into a constant order sine signal. The SINAD of the
output signal is always higher when using the resampling filter compared to a simple
S&H-resampler. This advantage increases in the presence of additive white Gaussian
noise and is especially high frequency spurious components. The quality of the output
signal is the same for all implementations of the filter. This shows that on the targeted
platform the round-off errors in the calculations are negligible in relation to those from
the amplitude and time-quantization during acquisition. The fixed-point implementa-
tion of the resampling filter is the only one that can be run in real-time on the targeted
WSN. It is about ten times faster than the floating-point implementation, but still offers
the same signal quality.
Experiments in sections 6.5.3 and 6.5.4 show that the implemented synchronous angu-
lar sampling scheme can successfully be run on a WSN. The signals acquired with the
resampling filter show no significant drawbacks in terms of signal quality compared to
acquiring the signal directly without resampling. At high downsampling ratios there is
even a significant increase in SINAD.
246
7. Conclusions and outlook
This chapter starts by summarizing the key findings of this thesis in section 7.1. From
this, conclusions are drawn in section 7.2 regarding the answers to the guiding questions
formulated at the end of chapter 2. Finally, an outlook on possible directions for future
research is given in section 7.3.
7.1. Summary
In chapter 4, generic models for systems doing synchronous event detection and syn-
chronous waveform sampling were introduced. The key feature of these models is that
they can be used to describe WSNs as well as more conventional DAQ systems. Using
these models as a basis, the influence of synchronization errors on the measurement re-
sult has been modeled and compared to other error influences, like signal noise, analog
group delays or the clock resolution itself. The main result of this analysis is that the
effect of synchronization errors on the measurement result is in many cases the same
as that of other error influences. It has been suggested to describe the synchronization
error by a mean and a standard deviation and apply measurement uncertainty analy-
sis, as defined in the GUM, to evaluate the influence of all error influences. Using the
concept of measurement uncertainty, also a general procedure, that allows estimating
the synchronization accuracy required for a given application, has been suggested in
section 4.3. This method was shown to work well for practical experiments on acoustic
localization in section 6.3.
Building on the developed models and error analysis, two approaches to time synchro-
nized DAQ were derived in section 4.4 a proactive and a reactive one. In the proactive
approach data acquisition is steered by synchronized clocks, while in the reactive one
data acquisition is initially unsynchronized. The synchronization only takes place dur-
ing later signal processing. Both approaches have been implemented on a WSN using
state of the art commercial sensor nodes and the Contiki operating system (see chapter
5). For the data acquisition a software framework inspired by the IEEE 1451 stan-
dard has been implemented, that already allows to flexibly access a number of different
sensors through a unified MATLAB interface. For time synchronization a simplified
version of the FTSP protocol was used.
247
7. Conclusions and outlook
Both approaches were tested for synchronous event detection and synchronous wave-
form acquisition in experiments (see sections 6.2 and 6.4). No clear advantages of
any approach over the other regarding synchronization precision or power consump-
tion could be found. The distribution of synchronization errors during the experiments
on synchronous event detection was found to be similar to a Gaussian distribution, but
to significantly differ from it regarding the frequency of extreme values. A synchroniza-
tion precision close to the clock resolution could be achieved, highlighting the discrete
nature of time values in a WSN. This shows the relevance of the clock resolution for
synchronized DAQ. Furthermore, it was shown that the overall timestamping precision
of a WSN can be characterized by an effective clock resolution (see sections 4.2.1.6 and
6.2). Another important result of the experiments is that interrupt blocking sections in
the duty-cycling code of the sensor nodes’ operating system caused significant errors
in the synchronized data acquisition. This shows that the entire software of a wireless
sensor node should show a good real-time performance in order to enable accurately
synchronized DAQ.
7.2. Conclusions
At the end of chapter 2 four central questions were formulated, that could not satisfac-
torily be answered from the current scientific literature. The analysis and experiments
presented in this thesis were aimed at these questions. Now as a conclusion, answers to
them shall be attempted:
248
7.2. Conclusions
249
7. Conclusions and outlook
Under the reactive approach the data is initially acquired without synchronization. Syn-
chronization takes place later during data processing. This way, there is no interference
with the data acquisition of the ADC and no effort needs to be put into maintaining syn-
chronized clocks all the time. However, the a posteriori synchronization of the acquired
data through digital resampling only works well, if significant oversampling is used.
The implementations of the proactive and reactive approach for this thesis, performed
about equally well in terms of power consumption and synchronization precision during
the experiments. Thus, the choice of approach should be guided by the anticipated
pattern of communication (see sections 6.2 and 6.4). The proactive approach matches
better with regular and the reactive better with irregular communication patterns.
Synchronous angular sampling is better implemented with the reactive approach. This
way, the difficult direct control of the ADC is not necessary and no anti-aliasing filters
with variable frequency response are required (see section 4.5). As synchronous an-
gular sampling can be described as a nonuniform reconstruction problem, an efficient
filter, originally developed for communication systems, could be adopted from the lit-
erature (see section 5.3). An implementation of this filter in fixed-point arithmetic has
been shown to enable real-time data acquisition at an induction motor test bench. Fur-
thermore, the filter provides a good signal quality in terms of SINAD and effective
alias-suppression.
7.3. Outlook
The analysis presented in this thesis allows for a consistent treatment of the measure-
ment uncertainty that arises from synchronization errors. Furthermore, the timing un-
certainty expressed as a standard deviation was identified as the key quantity in speci-
fying and assessing synchronization precision. It is to be hoped that these insights will
be adopted by a wider audience and lead to a better comparability between published
results. Furthermore, the direct comparison between WSNs and other DAQ systems,
which is now possible, can help to establish WSNs as just another type of measurement
system.
As the experimental results in chapter 6 have shown, the real-time performance of WSN
software has a significant influence on the synchronized data acquisition. Here, con-
cepts are needed that solve the current conflict between efficient duty-cycling and data
acquisition. One approach might be to make better use of interrupt prioritization, which
is supported by many modern microcontrollers. Also, more recent operating systems
250
7.3. Outlook
for WSN like RIOT OS appear to offer better real-time performance than Contiki. Nev-
ertheless, efficiently integrating the various algorithms, which have been developed for
different tasks in WSN, into one well performing system, appears to be a major chal-
lenge for the future. This could possibly be significantly eased through better hardware
support. The timestamping operation for example, which is central to time synchro-
nization and data acquisition, could be done much more accurately and efficiently by
dedicated hardware.
A hardware coupling between a synchronized clock and an ADC might also make it
possible to use the proactive approach to synchronized waveform sampling at higher
sampling rates. The performance of the reactive approach at higher signal frequencies
on the other hand, might be improved by using more powerful resampling algorithms
like e.g. the filter suggested for synchronous angular sampling.
The resampling filter itself, might also profit from a hardware implementation. Espe-
cially the idea of combining it with a delta-sigma modulator and this way building a
delta-sigma ADC with reactively synchronized output seems interesting. Furthermore,
the filter might be extended to simultaneously resample multiple input channels. This
might be done quite efficiently, as the lower branch of the filter, which filters the time-
stamps, could be used for all channels simultaneously. Currently, the limiting factor
for the filter with regard to the supported speed range and maximum signal order at the
output is the transmission bandwidth of the WSN. This might be overcome by finding
a way to encode and transmit timestamps more efficiently, e.g. as spline functions.
In general, more efficient encoding and compression techniques could increase the util-
ity for WSN in scientific and industrial applications. One approach might be to ex-
tend the efficient compression techniques for text and image data suggested in [116]
to other kinds of measurement data. Furthermore, there seems to be great potential in
distributing the processing steps in a WSN such that the amount of data transmitted is
minimized.
251
List of Figures
2.1. Topologies for WSNs. . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2. Protocol stacks for wireless sensor networks. . . . . . . . . . . . . . . 25
2.3. Remote clock reading techniques according to [119]: a) unidirectional
synchronization, b) round-trip synchronization, c) reference broadcast. . 31
2.4. Typical message delay sources according to [87]. . . . . . . . . . . . . 33
2.5. PTP network structure [200]. . . . . . . . . . . . . . . . . . . . . . . . 42
2.6. PTP synchronization message exchange [200]. . . . . . . . . . . . . . . 42
2.7. IEEE 1451 reference model according to [196]. Grayed out parts are
out of scope for IEEE 1451. . . . . . . . . . . . . . . . . . . . . . . . 50
2.8. Principle of synchronous angular sampling. . . . . . . . . . . . . . . . 53
2.9. Principle of synchronous angular resampling. . . . . . . . . . . . . . . 54
2.10. Block diagram of upsampled linear interpolation algorithm [14]. . . . . 55
2.11. Block diagram of upsampled interpolation filter [14]. . . . . . . . . . . 55
253
List of Figures
254
List of Figures
6.1. Experimental setup used to measure the supply current of a node. . . . . 182
6.2. Activity diagrams of test applications used to measure a sensor node’s
current consumption. . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
6.3. Node current during transmission. . . . . . . . . . . . . . . . . . . . . 185
6.4. Power consumption of nodes as calculated from current measurements
with multimeter (DMM) and as estimated from powertrace (pwrt.).
The error bars show the expanded uncertainty Uk=2 . . . . . . . . . . . 188
6.5. Transmission success during transmissions of one sender to one receiver. 190
6.6. Transmission success during transmissions of two senders to one receiver.191
6.7. Average power consumption during transmissions of one sender to one
receiver. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
6.8. Average power consumption during transmission of two senders to one
receiver. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
6.9. Experimental setup used for event timestamping tests. . . . . . . . . . . 193
255
List of Figures
256
List of Figures
257
List of Figures
258
List of Tables
259
List of Tables
6.1. Current consumption of node 41 measured for the different power modes.184
6.2. Current consumption assigned to powertrace modes. . . . . . . . . . . 185
6.3. Configuration of network layers investigated for data throughput. . . . . 189
6.4. Network configurations investigated in event detection tests. . . . . . . 194
6.5. Relative drifts between TIMs and NCAP. The uncertainties given are
the expanded uncertainties (k = 2) calculated for the variances of the
regression parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . 194
6.6. Theoretical maximum synchronization errors rounded to next larger in-
teger number of Ticks. Exact values obtained from (2.1) are given in
brackets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
6.7. Estimated statistical parameters of timestamp difference distribution. . . 199
6.8. Known sections of interrupt blocking on Preon32. . . . . . . . . . . . . 203
6.9. Maximum timing uncertainty ut,max of a single timestamp in µs for dif-
ferent maximum location uncertainties ud,max and uncertainty margins
for v sound = 343 m/s. . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
6.10. Calibration results for the localization system. The error intervals cor-
respond to the expanded uncertainty Uk=2 , as estimated from the fit
residuals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
6.11. Overall statistics of localization errors. . . . . . . . . . . . . . . . . . . 211
6.12. Influence quantities affecting the localization measurement. . . . . . . . 213
6.13. Uncertainty budget for time interval measurement with frequency counter.214
6.14. Uncertainty budget for localization with frequency counter. . . . . . . . 215
6.15. Uncertainty budget for localization with WSN. . . . . . . . . . . . . . 215
6.16. Uncertainty budget for localization with WSN and active RDC. . . . . . 216
6.17. Configurations for waveform acquisition tests. . . . . . . . . . . . . . . 218
6.18. Frequency errors ϵ f and time offset errors ϵt0 calculated from the ac-
quired waveforms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
6.19. Average sampling rates calculated from sample timestamps. . . . . . . 221
6.20. Quality parameters of signal with lost samples before and after resam-
pling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
6.21. Configurations of simulations on idealized angular sampling. . . . . . . 228
260
List of Tables
261
Bibliography
[1] Abrach, H. et al.: MANTIS: System Support for multimodAl NeTworks of In-situ
Sensors. In Proceedings of the 2Nd ACM International Conference on Wireless
Sensor Networks and Applications, WSNA ’03, pp. 50–59, New York, NY, USA,
2003. ACM, ISBN 1-58113-764-8. DOI:10.1145/941350.941358.
[2] Abubakari, H.: IEEE 1588 Style Synchronization over a Wireless Link. Mas-
ter’s thesis, University of Akron, 2008. http://etd.ohiolink.edu/view.cgi?
acc_num=akron1226631636.
[3] Allan, D.W., N. Ashby, and C.C. Hodge: The Science of Timekeeping. Hewlett
Packard Application Note 1289, 1997. http://literature.agilent.com/
litweb/pdf/5965-7984E.pdf, visited on 2015-05-12.
[4] Andersson, T. and P. Handel: IEEE Standard 1057, Cramér-Rao bound and the
parsimony principle. Instrumentation and Measurement, IEEE Transactions on,
55(1):44–53, Feb. 2006, ISSN 0018-9456. DOI:10.1109/TIM.2005.861497.
[5] Aoun, M., J. Catalano, and P. Stok: Distributed Task Synchronization in Wireless
Sensor Networks. In Proceedings of the 6th European Conference on Wireless
Sensor Networks, EWSN ’09, pp. 150–165, Berlin, Heidelberg, 2009. Springer-
Verlag, ISBN 978-3-642-00223-6. DOI:10.1007/978-3-642-00224-3 10.
[6] Aoun, M., A. Schoofs, and P. van der Stok: Efficient time synchronization
for wireless sensor networks in an industrial setting. In Proceedings of
the 6th ACM conference on Embedded network sensor systems, SenSys ’08,
pp. 419–420, New York, NY, USA, 2008. ACM, ISBN 978-1-59593-990-6.
DOI:10.1145/1460412.1460482.
[8] Baccelli, E. et al.: RIOT OS: Towards an OS for the Internet of Things. In Computer
Communications Workshops (INFOCOM WKSHPS), 2013 IEEE Conference on,
pp. 79–80, Apr. 2013. DOI:10.1109/INFCOMW.2013.6970748.
263
Bibliography
[9] Badaoui, M.E. and F. Bonnardot: Impact of the non-uniform angular sampling on
mechanical signals. Mechanical Systems and Signal Processing, 44(1–2):199–210,
2014, ISSN 0888-3270. DOI:10.1016/j.ymssp.2013.10.008. Special Issue on In-
stantaneous Angular Speed (IAS) Processing and Angular Applications.
[11] Beard, R.L. and J.D. White: GPS Application to Time Transfer and Dissemination.
GPS Solutions, 3(1):17–25, 1999, ISSN 1080-5370. DOI:10.1007/PL00012774.
[13] Bhatti, S. et al.: MANTIS OS: An embedded multithreaded operating system for
wireless micro sensor platforms. MOBILE NETWORKS & APPLICATIONS,
10(4):563–579, Aug. 2005, ISSN 1383-469X. DOI:10.1007/s11036-005-1567-8.
2nd International Workshop on Wireless Sensor Networks and Application (WSNA
2003), San Diego, CA, SEP 19, 2003.
[14] Blough, J.: Adaptive Resampling - Transforming from the time to the Angle do-
main. In 24th Conference and Exposition on Structural Dynamics 2006, IMAC-
XXIV, 2006.
[15] Blough, J.R.: A survey of DSP methods for rotating machinery analysis, what
is needed, what is available. Journal of Sound and Vibration, 262(3):707–720,
2003, ISSN 0022-460X. DOI:10.1016/S0022-460X(03)00118-4. 2001 India-USA
Symposium on Emerging Trends in Vibration and Noise Engineering.
[16] Bomar, B.W.: Finit Wordlength Effects. In Digital signal processing fundamen-
tals. CRC Press, 2009, ISBN 978-1-4200-4606-9.
[18] Brandt, A. et al.: Main principles and limitations of current order tracking meth-
ods. Sound and Vibration, 39(3):19–22, 2005, ISSN 1541-0161.
[19] Buettner, M. et al.: X-mac: A short preamble mac protocol for duty-cycled
wireless sensor networks. In in SenSys, pp. 307–320, 2006, http://www.cs.
colorado.edu/˜rhan/Papers/xmac_sensys06.pdf.
264
Bibliography
[20] Caligiuri, L.M. and A. Nastro: About the conventionality of simultaneity and syn-
chronization. In 20th IMEKO TC4 Symposium on Measurements of Electrical
Quantities, 2014.
[22] Cho, H., S. Son, and Y. Baek: Implementation of a precision time protocol
over low rate wireless personal area networks. In Computer Systems Archi-
tecture Conference, 2008. ACSAC 2008. 13th Asia-Pacific, pp. 1–8, Aug. 2008.
DOI:10.1109/APCSAC.2008.4625431.
[23] Christin, D., P.S. Mogre, and M. Hollick: Survey on Wireless Sensor Net-
work Technologies for Industrial Automation: The Security and Quality of
Service Perspectives. Future Internet, 2(2):96–125, 2010, ISSN 1999-5903.
DOI:10.3390/fi2020096.
[25] Crochiere, R.E. and L.R. Rabiner: Multirate Digital Signal Processing. Prentice
Hall, 1983, ISBN 0-13-605162-6.
[26] Dai, H. and R. Han: TSync: a lightweight bidirectional time synchronization ser-
vice for wireless sensor networks. SIGMOBILE Mob. Comput. Commun. Rev.,
8(1):125–139, 2004, ISSN 1559-1662. DOI:10.1145/980159.980173.
[28] Dunkels, A.: Rime - a lightweight layered communication stack for sensor net-
works. In European Conference on Wireless Sensor Networks (EWSN), Jan. 2007,
http://www.sics.se/˜adam/dunkels07rime.pdf.
[29] Dunkels, A.: The ContikiMAC Radio Duty Cycling Protocol. SICS Techni-
cal Report T2011:13, 2011, ISSN 1100-3154, http://www.sics.se/˜adam/
dunkels11contikimac.pdf.
[30] Dunkels, A., B. Gronvall, and T. Voigt: Contiki - a lightweight and flexible
operating system for tiny networked sensors. In Local Computer Networks,
2004. 29th Annual IEEE International Conference on, pp. 455–462, Nov. 2004.
DOI:10.1109/LCN.2004.38.
265
Bibliography
[34] Dutta, P. and A. Dunkels: Operating systems and network protocols for wire-
less sensor networks. Philosophical Transactions of the Royal Society of Lon-
don A: Mathematical, Physical and Engineering Sciences, 370(1958):68–84, 2011,
ISSN 1364-503X. DOI:10.1098/rsta.2011.0330.
[35] Elson, J., L. Girod, and D. Estrin: Fine-grained network time synchronization
using reference broadcasts. SIGOPS Oper. Syst. Rev., 36(SI):147–163, 2002,
ISSN 0163-5980. DOI:10.1145/844128.844143.
[38] Flammini, A. et al.: Wired and wireless sensor networks for industrial applica-
tions. Microelectronics Journal, 40(9):1322–1336, 2009.
[39] Flammini, A. et al.: A real-time Wireless Sensor Network for temperature moni-
toring. In Industrial Electronics, 2007. ISIE 2007. IEEE International Symposium
on, pp. 1916–1920, June 2007. DOI:10.1109/ISIE.2007.4374900.
[40] FLUKE: 8845A/8846A Digitial Multimeter - User Manual, 3rd ed., June 2006.
266
Bibliography
[42] Ganeriwal, S., R. Kumar, and M.B. Srivastava: Timing-sync protocol for sensor
networks. In SenSys ’03: Proceedings of the 1st international conference on Em-
bedded networked sensor systems, pp. 138–149. ACM, 2003.
[43] Gnawali, O. et al.: Collection Tree Protocol. Technical Report SING-09-01, 2009,
http://sing.stanford.edu/pubs/sing-09-01.pdf, visited on 2011-09-23.
Stanford University.
[44] Greunen, J. van and J. Rabaey: Lightweight time synchronization for sensor net-
works. In Proceedings of the 2Nd ACM International Conference on Wireless Sen-
sor Networks and Applications, WSNA ’03, pp. 11–19, New York, NY, USA, 2003.
ACM, ISBN 1-58113-764-8. DOI:10.1145/941350.941353.
[45] Guevara, J. et al.: A framework for WSN using TinyOS and the IEEE1451 stan-
dard. In Communications (LATINCOM), 2011 IEEE Latin-American Conference
on, pp. 1–5, Oct. 2011. DOI:10.1109/LatinCOM.2011.6107420.
[46] Göckler, H.G. and A. Groth: Multiratensysteme. J. Schlembach Fachverlag, 2004,
ISBN 3-935340-29-X.
[47] Gühmann, C.: Stromanalyse zur Diagnose seriengefertigter Universalmotoren.
PhD thesis, TU Berlin, 1995, ISBN 3-89574-087-X.
[48] Gühmann, C.: Messdatenverarbeitung. TU Berlin, lecture notes, Mar. 2011.
[49] Gühmann, C.: Modellbildung und Echtzeitsimulation technischer Systeme - Kapi-
tel 7. TU Berlin, lecture notes, Dec. 2015.
[50] Haenselmann, T.: Wireless Sensor Networks. Oldenbourg Verlag, 2011, ISBN
978-3-486-70798-4.
[51] HAMEG Instruments: 3 GHz Programmable Counter HM8123, HM8123-X -
User Manual. 2015-09-15.
[52] HAMEG Instruments: Arbitrary Function Generator 12.5 MHz HM8150 -
Datasheet. 2014-06-22.
[53] Heynicke, R., D. Krüger, and G. Scholl: Wireless automation. In SENSOR+TEST
Conference, 2011.
[54] Higuera, J. and J. Polo: Understanding the IEEE 1451 standard in 6loWPAN sen-
sor networks. In Sensors Applications Symposium (SAS), 2010 IEEE, pp. 189–193,
2010. DOI:10.1109/SAS.2010.5439427.
[55] Higuera, J. and J. Polo: IEEE 1451 Standard in 6LoWPAN Sensor Networks Using
a Compact Physical-Layer Transducer Electronic Datasheet. Instrumentation and
Measurement, IEEE Transactions on, 60(8):2751–2758, 2011, ISSN 0018-9456.
DOI:10.1109/TIM.2011.2129990.
267
Bibliography
[56] Hill, J. and D. Culler: Mica: a wireless platform for deeply embed-
ded networks. Micro, IEEE, 22(6):12–24, Nov. 2002, ISSN 0272-1732.
DOI:10.1109/MM.2002.1134340.
[57] Hoffmann, J. (ed.): Taschenbuch der Messtechnik. Fachbuchverl. Leipzig im Carl-
Hanser-Verl., 4th ed., 2004. ISBN 3-446-22860-8.
[58] Hogenauer, E.: An economical class of digital filters for decimation and in-
terpolation. Acoustics, Speech and Signal Processing, IEEE Transactions on,
29(2):155–162, Apr. 1981, ISSN 0096-3518. DOI:10.1109/TASSP.1981.1163535.
[59] Hou, L. and N. Bergmann: System requirements for industrial wireless sensor
networks. In Emerging Technologies and Factory Automation (ETFA), 2010 IEEE
Conference on, pp. 1–8, 2010. DOI:10.1109/ETFA.2010.5641163.
[60] Hou, L. and N.W. Bergmann: Novel Industrial Wireless Sensor Networks for
Machine Condition Monitoring and Fault Diagnosis. Instrumentation and Mea-
surement, IEEE Transactions on, 61(10):2787–2798, 2012, ISSN 0018-9456.
DOI:10.1109/TIM.2012.2200817.
[61] Huang, Q., B. Tang, and L. Deng: Development of high synchronous acquisition
accuracy wireless sensor network for machine vibration monitoring. Measurement,
66(0):35–44, 2015, ISSN 0263-2241. DOI:10.1016/j.measurement.2015.01.021.
[62] Josefsson, S.: The Base16, Base32, and Base64 Data Encodings. RFC 4648, Oct.
2006. https://tools.ietf.org/html/rfc4648.
[67] Kim, J.S. et al.: Robust clock synchronization in wireless sensor networks
through noise density estimation. Signal Processing, IEEE Transactions on,
59(7):3035–3047, July 2011, ISSN 1053-587X. DOI:10.1109/TSP.2011.2141660.
[68] Kinsler, L.E. et al.: Fundamentals of acoustics. Wiley, 4th ed., 2000,
ISBN 0-471-84789-5.
268
Bibliography
[69] Klingler, F.M. and H.G. Göckler: Conversion between arbitrary sampling
rates: An implementation cost trade-off study for the family of farrow
structures. In Proc. 5th Karlsruhe Workshop on Software Radios, pp.
1–8, 2008, http://www.dsv.ruhr-uni-bochum.de/imperia/md/content/
public/wsr08_klinglergoeckler.pdf.
[70] Ko, J. et al.: A.: Evaluating the Performance of RPL and 6LoWPAN. In in TinyOS.
In: Workshop on Extending the Internet to Low power and Lossy Networks (IP+SN
2011), 2011.
[71] Kodek, D.M.: Length limit of optimal finite wordlength FIR filters.
Digital Signal Processing, 23(5):1798–1805, 2013, ISSN 1051-2004.
DOI:10.1016/j.dsp.2013.07.004.
[72] Kolerus, J. and J. Wassermann: Zustandsüberwachung von Maschinen. expert-
Verl., 4th ed., 2011, ISBN 978-3-8169-2597-2.
[73] Kovatsch, M., S. Duquennoy, and A. Dunkels: A Low-Power CoAP for Contiki.
In Mobile Adhoc and Sensor Systems (MASS), 2011 IEEE 8th International Con-
ference on, pp. 855–860, Oct. 2011. DOI:10.1109/MASS.2011.100.
[74] Krauße, M. and R. Konrad: Drahtlose ZigBee-Netzwerke : ein Kompendium.
Springer, 2014, ISBN 978-3-658-05821-0.
[75] Kreuzer, J.: Wenn mich niemand danach fragt, weiß ich es.“ – Die Re-
”
alität der Zeit. Hamburger Akademie der Wissenschaften, Nov. 2015.
http://www.awhamburg.de/fileadmin/redakteure/Downloads/2015-
11-26_AkadVL_Kreuzer_Handout.pdf, visited on 2016-04-30, handout.
[76] Krüger, D., R. Heynicke, and G. Scholl: Wireless sensor/actuator-network with
improved coexistence performance for 2.45 GHz ISM-band operation. In Systems,
Signals and Devices (SSD), 2012 9th International Multi-Conference on, pp. 1–5,
2012. DOI:10.1109/SSD.2012.6198099.
[77] Kusy, B. et al.: Elapsed time on arrival: a simple and versatile primitive for
canonical time synchronisation services. International Journal of Ad Hoc and Ubiq-
uitous Computing, 1(4):239–251, 2006. DOI:10.1504/IJAHUC.2006.010505.
[78] Lamport, L.: Time, clocks, and the ordering of events in a dis-
tributed system. Commun. ACM, 21(7):558–565, 1978, ISSN 0001-0782.
DOI:http://doi.acm.org/10.1145/359545.359563.
[79] Lasassmeh, S. and J. Conrad: Time synchronization in wireless sensor networks:
A survey. In IEEE SoutheastCon 2010 (SoutheastCon), Proceedings of the, pp.
242–245, 2010. DOI:10.1109/SECON.2010.5453878.
[80] Lee, E.A. and S.A. Seshia: Introduction to Embedded Systems - A Cyber-Physical
Systems Approach. LeeSeshia.org, 2011, ISBN 978-0-557-70857-4.
269
Bibliography
[81] Lee, H.C. et al.: The Tube: A Rapidly Deployable Wireless Sensor Platform
for Supervising Pollution of Emergency Work. Instrumentation and Measure-
ment, IEEE Transactions on, 61(10):2776–2786, Oct. 2012, ISSN 0018-9456.
DOI:10.1109/TIM.2012.2200392.
[85] Levis, P. et al.: TinyOS: An Operating System for Sensor Networks. In Weber, W.,
J. Rabaey, and E. Aarts (eds.): Ambient Intelligence, pp. 115–148. Springer Berlin
Heidelberg, 2005, ISBN 978-3-540-23867-6. DOI:10.1007/3-540-27139-2 7.
[87] Maróti, M. et al.: The flooding time synchronization protocol. In SenSys ’04:
Proceedings of the 2nd international conference on Embedded networked sensor
systems, pp. 39–49. ACM, 2004.
[88] Marvasti, F.: Nonuniform sampling: theory and practice. No. 1 in Information
technology–transmission, processing, and storage. Kluwer Academic/Plenum Pub-
lishers, 2001, ISBN 9780306464454.
[89] Marvasti, F. et al.: Reconstruction of speech signals with lost samples. Signal
Processing, IEEE Transactions on, 40(12):2897–2903, 1992, ISSN 1053-587X.
DOI:10.1109/78.175734.
[90] McFadden, P.: Interpolation techniques for time domain averaging of gear
vibration. Mechanical Systems and Signal Processing, 3(1):87–97, 1989,
ISSN 0888-3270. DOI:http://dx.doi.org/10.1016/0888-3270(89)90024-1.
[91] Medina, C., J.C. Segura, and A. de la Torre: A Synchronous TDMA Ultra-
sonic TOF Measurement System for Low-Power Wireless Sensor Networks. In-
strumentation and Measurement, IEEE Transactions on, 62(3):599–611, 2013,
ISSN 0018-9456. DOI:10.1109/TIM.2012.2218056.
270
Bibliography
271
Bibliography
[104] Outler, A.C.: Augustine: Confessions, newly translated and edited, 1955.
http://www.georgetown.edu/faculty/jod/augustine/conf.pdf, visited
on 2016-08-13.
[105] Papoulis, A.: Error analysis in sampling theory. Proceedings of the IEEE,
54(7):947–955, July 1966, ISSN 0018-9219. DOI:10.1109/PROC.1966.4940.
[106] Perkins, C., E. Belding-Royer, and S. Das: Ad hoc On-Demand Distance Vector
(AODV) Routing. RFC 3561 (Experimental), July 2003. http://www.ietf.org/
rfc/rfc3561.txt.
[107] Pesch, B.: Bestimmung der Messunischerheit nach GUM. Books On Demand
GmbH, Norderstedt, 2004, ISBN 3-8830-1039-8.
[108] Pflugradt, M. et al.: A novel pulseoximeter for bluetooth synchronized mea-
surements in a body sensor network. In Education and Research Confer-
ence (EDERC), 2014 6th European Embedded Design in, pp. 21–25, 2014.
DOI:10.1109/EDERC.2014.6924351.
[109] Pister, K. et al.: Industrial Routing Requirements in Low-Power and Lossy Net-
works. RFC 5673 (Informational), Oct. 2009. http://www.ietf.org/rfc/
rfc5673.txt.
[110] Pister, K.S.J. and L. Doherty: TSMP: Time Synchronized Mesh Protocol. In
Proceedings of the IASTED International Symposium Distributed Sensor Networks,
2008.
[111] Potter, R.: New order tracking method for rotating machinery. S V Sound and
Vibration, 24(9):30–34, 1990.
[112] Pottie, G.J. and W.J. Kaiser: Wireless integrated network sensors. Commun.
ACM, 43(5):51–58, 2000, ISSN 0001-0782. DOI:10.1145/332833.332838.
[113] Pöttner, W.B. et al.: WSN Evaluation in Industrial Environments First results
and lessons learned. In 3rd Workshop on Performance Control in Wireless Sensor
Networks 2011 (PWSN 2011) in conjuction with IEEE DCOSS 2011, pp. 1–8, 2011.
[114] Raju, M.: Energy Harvesting - ULP meets energy harvesting: A game-changing
combination for design engineers. Techn. rep., Texas Instruments, 2008.
[115] Ramos, P.M. and A.C. Serra: A new sine-fitting algorithm for ac-
curate amplitude and phase measurements in two channel acquisi-
tion systems. Measurement, 41(2):135–143, 2008, ISSN 0263-2241.
DOI:10.1016/j.measurement.2006.03.011. Advances in Measurements of
Eelectrical Quantities.
[116] Rein, S.: Low Complexity Text and Image Compression for Wireless Devices and
Sensors. PhD thesis, TU Berlin, 2010. DOI:10.14279/depositonce-2484.
272
Bibliography
[117] Rein, S. and M. Reisslein: Low-Memory Wavelet Transforms for Wireless Sensor
Networks: A Tutorial. Communications Surveys Tutorials, IEEE, 13(2):291–307,
Feb. 2011, ISSN 1553-877X. DOI:10.1109/SURV.2011.100110.00059.
[118] Ren, F., C. Lin, and F. Liu: Self-correcting time synchronization using refer-
ence broadcast in wireless sensor network. Wireless Communications, IEEE,
15(4):79–85, Aug. 2008, ISSN 1536-1284. DOI:10.1109/MWC.2008.4599225.
[119] Römer, K., P. Blum, and L. Meier: Time Synchronization and Calibration in
Wireless Sensor Networks. In Handbook of Sensor Networks: Algorithms and Ar-
chitectures. Wiley, 2005, ISBN 978-0-471-68472-5.
[120] Römer, K. and F. Mattern: The design space of wireless sensor net-
works. Wireless Communications, IEEE, 11(6):54–61, 2004, ISSN 1536-1284.
DOI:10.1109/MWC.2004.1368897.
[121] Roundy, S. and L. Frechette: Energy Scavenging and Nontraditional Power
Sources for Wireless Sensor Networks. In Handbook of Sensor Networks: Algo-
rithms and Architectures. Wiley, 2005, ISBN 978-0-471-68472-5.
[122] Schafer, R. and L. Rabiner: A digital signal processing approach to inter-
polation. Proceedings of the IEEE, 61(6):692–702, 1973, ISSN 0018-9219.
DOI:10.1109/PROC.1973.9150.
[123] Schmid, T. et al.: A case against routing-integrated time synchronization.
In Proceedings of the 8th ACM Conference on Embedded Networked Sen-
sor Systems, SenSys ’10, pp. 267–280, New York, NY, USA, 2010. ACM,
ISBN 978-1-4503-0344-6. DOI:10.1145/1869983.1870010.
[124] Schmid, T., P. Dutta, and M.B. Srivastava: High-resolution, low-power time
synchronization an oxymoron no more. In IPSN ’10: Proceedings of the 9th
ACM/IEEE International Conference on Information Processing in Sensor Net-
works, pp. 151–161, New York, NY, USA, 2010. ACM, ISBN 978-1-60558-988-6.
DOI:10.1145/1791212.1791231.
[125] Scholl, G. et al.: Wireless Automation. In 16th International Conference On
Sensors and Measurement Technology, 2013.
[126] Schweinzer, H. and G. Kaniak: Ultrasonic device localization and its potential
for wireless sensor network security. Control Engineering Practice, 18(8):852–862,
Aug. 2010, ISSN 0967-0661. DOI:10.1016/j.conengprac.2008.12.007.
[127] Sedlacek, M. and M. Krumpholc: Digital measurement of phase difference -
a comparative study of dsp algorithms. Metrology and Measurement Systems,
XII:427–448, 2005, ISSN 0860-8229.
[128] Shelby, Z. and C. Bormann: 6LoWPAN: The Wireless Embedded Internet. Wiley,
2009, ISBN 978-0-470-74799-5.
273
Bibliography
[129] Shelby, Z., K. Hartke, and C. Bormann: The Constrained Application Protocol
(CoAP). RFC 7252 (Proposed Standard), June 2014. http://www.ietf.org/
rfc/rfc7252.txt.
[130] Shucker, B. et al.: Embedded Operating Systems for Wireless Microsensor
Nodes. In Handbook of Sensor Networks: Algorithms and Architectures. Wiley,
2005, ISBN 978-0-471-68472-5.
[131] Siekkinen, M. et al.: How low energy is bluetooth low energy? Compara-
tive measurements with ZigBee/802.15.4. In Wireless Communications and Net-
working Conference Workshops (WCNCW), 2012 IEEE, pp. 232–237, Apr. 2012.
DOI:10.1109/WCNCW.2012.6215496.
[132] Simon, G. et al.: Sensor network-based countersniper system. In Pro-
ceedings of the 2nd International Conference on Embedded Networked Sen-
sor Systems, SenSys ’04, pp. 1–12. ACM, 2004, ISBN 1-58113-879-2.
DOI:10.1145/1031495.1031497.
[133] Song, J. et al.: WirelessHART: Applying Wireless Technology in Real-Time
Industrial Process Control. In Real-Time and Embedded Technology and
Applications Symposium, 2008. RTAS ’08. IEEE, pp. 377–386, Apr. 2008.
DOI:10.1109/RTAS.2008.15.
[134] Souders, T. et al.: The effects of timing jitter in sampling systems. Instru-
mentation and Measurement, IEEE Transactions on, 39(1):80–85, Feb. 1990,
ISSN 0018-9456. DOI:10.1109/19.50421.
[135] Stanislowski, D. et al.: Adaptive Synchronization in IEEE802.15.4e Net-
works. Industrial Informatics, IEEE Transactions on, 10(1):795–802, 2014,
ISSN 1551-3203. DOI:10.1109/TII.2013.2255062.
[136] Steigmann, R. and J. Endresen: Introduction to WISA. Tech. Rep. V2.0, ABB
STOTZ-KONTAKT GmbH, 2006.
[137] Stojcev, M.K., L.R. Golubovic, and T.R. Nikolic: Clocks, Power and Syn-
chronization in Duty-Cycled Wireless Sensor Nodes. Facta Universitatis (NIS),
24:183–208, 2011.
[138] Stojmenovic, I. (ed.): Handbook of Sensor Networks: Algorithms and Architec-
tures. Wiley, 2005, ISBN 978-0-471-68472-5.
[139] Sun, Y.R. and S. Signell: Algorithms for nonuniform bandpass sampling
in radio receiver. In Circuits and Systems, 2003. ISCAS ’03. Proceed-
ings of the 2003 International Symposium on, vol. 1, pp. I–1–I–4, 2003.
DOI:10.1109/ISCAS.2003.1205485.
[140] Thingsquare: The World at Your Fingertips. http://www.thingsquare.com/,
visited on 2015-02-27.
274
Bibliography
[143] Toma, D.M. et al.: Precision timing in TDMA-based Wireless Sensor Network
through IEEE 1588 standard. In 19th Symposium IMEKO TC 4 Symposium and
17th IWADC Workshop Advances in Instrumentation and Sensors Interoperability,
2013.
[144] Tripathi, J., J.C. de Oliveira, and J. Vasseur: Proactive versus reactive rout-
ing in low power and lossy networks: Performance analysis and scalabil-
ity improvements. Ad Hoc Networks, 23(0):121–144, 2014, ISSN 1570-8705.
DOI:10.1016/j.adhoc.2014.06.007.
[145] Vallestad, A.E.: WISA becomes WSAN - from proprietary technology to indus-
try standard. In Wireless Summit, Oslo, 2012. http://www.ifea.no/wp-
content/uploads/2012/04/A-Vallestad-WISA_becomes_WSAN-
Wireless-Summit-2012.pdf, visited on 2015-04-18.
[146] Vesma, J. and T. Saramaki: Interpolation filters with arbitrary frequency re-
sponse for all-digital receivers. In Circuits and Systems, 1996. ISCAS ’96., Con-
necting the World., 1996 IEEE International Symposium on, vol. 2, pp. 568–571,
1996. DOI:10.1109/ISCAS.1996.541788.
[149] Welsh, M.: Sensor networks for the sciences. Commun. ACM, 53:36–39, 2010.
DOI:10.1145/1839676.1839690.
275
Bibliography
276
Bibliography
277
Bibliography
278
Bibliography
[196] IEEE Standard for a Smart Transducer Interface for Sensors and Actua-
tors - Common Functions, Communication Protocols, and Transducer Electronic
Data Sheet (TEDS) Formats. IEEE Std 1451.0-2007, pp. 1–335, Sept. 2007.
DOI:10.1109/IEEESTD.2007.4338161.
[197] IEEE Standard for a Smart Transducer Interface for Sensors and Ac-
tuators Wireless Communication Protocols and Transducer Electronic Data
Sheet (TEDS) Formats. IEEE Std 1451.5-2007, pp. C1–236, Oct. 2007.
DOI:10.1109/IEEESTD.2007.4346346.
[198] VDI/VDE-Richtlinie 2185: Radio based communication in industrial automa-
tion, 2007.
[199] Evaluation of measurement data - Guide to the expression of uncertainty in mea-
surement (JCGM 100:2008), 2008. http://www.bipm.org/utils/common/
documents/jcgm/JCGM_100_2008_E.pdf, visited on 2015-08-03.
[200] IEEE Standard for a Precision Clock Synchronization Protocol for Networked
Measurement and Control Systems. IEEE Std 1588-2008 (Revision of IEEE Std
1588-2002), pp. c1–269, July 2008. DOI:10.1109/IEEESTD.2008.4579760.
[201] IEEE Standard for Digitizing Waveform Recorders. IEEE Std
1057-2007 (Revision of IEEE 1057-1994), pp. 1–168, Apr. 2008.
DOI:10.1109/IEEESTD.2008.4494996.
[202] MCKPI-G2210L-3672 (Datasheet). Multicomp, 2009. http://www.newark.
com/pdfs/datasheets/spc/25R0627.pdf, visited on 2015-11-14.
[203] Wireless systems for industrial automation: process control and related applica-
tions. Standard ISA-100.11a-2011, 2011.
[204] IEEE Standard for Local and metropolitan area networks–Part 15.4: Low-Rate
Wireless Personal Area Networks (LR-WPANs) Amendment 1: MAC sublayer.
IEEE Std 802.15.4e-2012 (Amendment to IEEE Std 802.15.4-2011), pp. 1–225,
Apr. 2012. DOI:10.1109/IEEESTD.2012.6185525.
[205] Reliable factory automation - Wireless Automation, 2012. http:
//www05.abb.com/global/scot/scot397.nsf/veritydisplay/
da2ecccaededc5cdc1257c210039f241/$file/3ADR071023B0201.pdf,
visited on 2015-02-04.
[206] Scavenger Transceiver Module STM 300 / STM 300C / STM 300U. enO-
cean, Nov. 2012. https://www.enocean.com/de/enocean_module/stm-
300-data-sheet.pdf, visited on 2015-06-15, Data Sheet.
[207] STM 3xy wireless sensor transmitter module family. enOcean, June
2013. https://www.enocean.com/de/enocean_module/White_Paper_STM_
3xy_EN_20.pdf, visited on 2015-06-09, White Paper.
279
Bibliography
[208] Motion Synchronization Using RTSI. National Instruments, Nov. 2014. http:
//www.ni.com/white-paper/3522/en/, visited on 2015-06-17.
[209] Sensor Transmitter Module STM 330 / STM 331 / STM 330C / STM 332U /
STM 333U. EnOcean, Mar. 2015. https://www.enocean.com/de/enocean_
module/stm-330-data-sheet.pdf, visited on 2015-06-15, Data Sheet, V1.2.
280
Publications
[Fun1] Funck, J. and C. Gühmann: Verfahren zur Messung von Synchro-
nisationsfehlern in mehrkanaligen Messsystemen. In Schmitt, R.
(ed.): XXVI. Messtechnisches Symposium des Arbeitskreises der
Hochschullehrer für Messtechnik e.V. (AHMT), pp. 155–166. AHMT,
2012, ISBN 978-3-8440-1312-2.
[Fun2] Funck, J., R. Knoblich, D. Scholz, S. Nowoisky, and C. Gühmann: Draht-
loses Messsystem für Temperaturen in Kraftfahrzeugkupplungen. tm - Tech-
nisches Messen, 80(3):84–91, Apr. 2013. DOI:10.1524/teme.2013.0014.
[Fun3] Funck, J. and C. Gühmann: Time-Synchronous Sampling in Wireless Sen-
sor Networks. In 19th IMEKO TC4 Symposium Measurements of Electri-
cal Quantities, 2013, ISBN 978-84-616-5438-3, http://www.imeko.org/
publications/tc4-2013/IMEKO-TC4-2013-058.pdf.
[Fun4] Funck, J. and C. Gühmann: Comparison of approaches to time-synchronous
sampling in wireless sensor networks. Measurement, 56(0):203–214, 2014,
ISSN 0263-2241. DOI:10.1016/j.measurement.2014.07.001.
[Fun5] Funck, J. and C. Gühmann: Design of a flexible filter for synchronous resam-
pling in wireless sensor networks. In 20th IMEKO TC-4 International Sym-
posium, Sept. 2014, ISBN 978-92-990073-2-7, http://www.imeko.org/
publications/tc4-2014/IMEKO-TC4-2014-196.pdf.
[Fun6] Bock, A., D. Liu, J. Funck, A. Giedymin, R. Burke, and C. Gühmann:
Wireless Sensor for Temperature and Flux Measurements in an Axial
Flux Machine. In SENSOR 2015, 17th International Conference on
Sensors and Measurement Technology, 2015, ISBN 978-3-9813484-8-4.
DOI:10.5162/sensor2015/C2.1.
[Fun7] Funck, J. and C. Gühmann: A flexible filter for synchronous angular resam-
pling with a wireless sensor network. Measurement, 98:393–406, 2017,
ISSN 0263-2241. DOI:10.1016/j.measurement.2016.07.062.
281
Supervised students’ theses
[Stud1] Ardanuy, X.: Design of a GUI based on the implemented IEEE1451 standard
in a Wireless Sensor Network. Bachelor thesis, TU Berlin, July 2014.
[Stud2] Björn: Interpolation und Nachabtastung von Messdaten aus einem drahtlosen
Sensornetzwerk. Master thesis, TU Berlin, May 2014.
[Stud3] Bock: Inbetriebnahme und Plausibilisierung eines Sensors zur Messung der
Rotortemperatur eines Asynchronmotors. Studienarbeit, TU Berlin, Nov.
2013.
[Stud4] Bock, A.: Implementation of a Wireless Sensor System on an Axial Flux Motor.
Diploma thesis, TU Berlin, Feb. 2015.
[Stud5] Burisch, P.: Induktive Energieversorgung eines drahtlosen Temper-
aturmesssystems. Diploma thesis, TU Berlin, Apr. 2014.
[Stud6] Erik, B.: Entwurf und Charakterisierung eines Energy-Harvesting-Moduls für
einen drahtlosen Sensorknoten. Diploma thesis, TU Berlin, Nov. 2011.
[Stud7] Haase, P.: Implementation einer CAN-Schnittstelle für einen Intelligenten Sen-
sorknoten. Bachelor thesis, TU Berlin, Jan. 2012.
[Stud8] Henckell, B.: Ladezustandsschätzung für batteriebetriebene Sensoren. Bach-
elor thesis, TU Berlin, Aug. 2013.
[Stud9] Hopp, T.: Intelligenter Sensor zur Leistungsmessung im Dreiphasennetz. Mas-
ter thesis, TU Berlin, May 2013.
[Stud10] Jähnel, A.: Fourier-basierte Ordnungsanalyse mit einem drahtlosen Sensor-
knoten. Bachelor thesis, TU Berlin, July 2014.
[Stud11] Kallenbach, E.: Machbarkeitsstudie bezüglich eines energieautarken Strom-
sensors. Bachelor thesis, TU Berlin, Oct. 2013.
[Stud12] Klemm, E.: Bestimmung und Korrektur dynamischer Messfehler von Temper-
atursensoren. Bachelor thesis, TU Berlin, June 2014.
[Stud13] Krauskopf, S.: Messdatenerfassung mit einem drahtlosen Sensornetzwerk.
Bachelor thesis, TU Berlin, Jan. 2013.
283
Supervised students’ theses
[Stud14] Krauskopf, S.: Anbindung eines Android Smartphones an ein drahtloses Sen-
sornetzwerk. Master thesis, TU Berlin, Sept. 2014.
[Stud15] Matern, S.: Drahtloses Sensormodul zur Demonstration von Anwendungs-
beispielen. Bachelor thesis, TU Berlin, Sept. 2015.
[Stud16] Moksha Birk: Zeitsynchronisation in einem drahtlosen Single-Hop Sensor-
netzwerk. Bachelor thesis, TU Berlin, Mar. 2013.
[Stud17] Pawlikowski, J.: Energieautarker drahtloser Sensorknoten zur Raumklimaer-
fassung. Diploma thesis, TU Berlin, Apr. 2015.
[Stud18] Pertiller, A.: Vergleichende Untersuchung von Verfahren zur Schätzung des
Signal-Rausch-Verhältnisses von Analog/Digital-Umsetzern. Diploma thesis,
TU Berlin, Sept. 2012.
[Stud19] Peters, O.: Entwurf eines intelligenten Körperschallsensors. Studienarbeit,
TU Berlin, Nov. 2012.
[Stud20] Peters, O.: Diagnose von Unwuchten mit einem drahtlosen intelligenten
Körperschallsensor. Diploma thesis, TU Berlin, June 2013.
[Stud21] Pilgrim, B.: Integration eines drahtlosen Sensornetzwerkes in eine CAN-Bus
basierte Messdatenaufnahme. Diploma thesis, TU Berlin, Feb. 2013.
[Stud22] Roubal, F.: Akustische Ortung mit einem drahtlosen Sensornetzwerk. Bache-
lor thesis, TU Berlin, Aug. 2013.
[Stud23] Scholz, D.: Entwicklung eines drahtlosen Temperaturmesssystems für eine
Einscheibentrockenkupplung. Diploma thesis, TU Berlin, Mar. 2012.
[Stud24] Siegmund, R.: Elektrische Steuerung einer Gleichstrommaschine als mecha-
nische Last. Bachelor thesis, TU Berlin, May 2012.
[Stud25] Stallenberger, B.: Aufbau eines automatisierten Testsytems für
Analog/Digital-Umsetzer. Bachelor thesis, TU Berlin, Dec. 2011.
[Stud26] Stallenberger, B.: Interpolation und Nachabtastung von Messdaten aus einem
drahtlosen Sensornetzwerk. Master thesis, TU Berlin, May 2014.
284
Appendix
A. Sensor Nodes
287
Table A.1.: General purpose sensor nodes.
Econotag M-12 ESB GINA INGA MANTIS
CPU family ARM7TDMI-S TI MSP430 TI MSP430 Atmel AVR Atmel AVR
CPU bit [bit] 32 16 16 8 8
CPU clock [MHz] 24 8 16 16 n/a
RAM [kB] 96 2 8 16 4
FLASH [kB] 128 60 116 128 128
wireless standard IEEE 802.15.4 none IEEE 802.15.4 IEEE 802.15.4 none
frequency band 2.4 GHz 868 MHz 2.4 GHz 2.4 GHz 915 MHz
ADC resolution [bit] 12 12 12 10 10
max. sampling-rate [kS/s] 300 n/a n/a 15 15
interfaces SSI, I2C,GPIO n/a GPIO, I2C, SPI, GPIO, I2C, SPI, GPIO, I2C, SPI,
UART UART UART
supply voltage [V] 2.1–3.6 4.5a 3.7 2.5–12 3.0
power active [mW] 9b 54 c n/a n/a 39 b
power sleep [mW] 0.45b 0.036c n/a n/a <3
power sending [mW] 105b 108c 90 (max. power)b n/a 120–219b
power receiving [mW] 72 b 74.25c n/a n/a 81–120b
dimensions (l x w) [mm] 48.7 x 30.2 n/a 6 cm2 50 x 40 36.7 x 33
operating system Contiki n/a custom firmware Contiki, MOS
(TinyOS)
manufacturer redwire FU Berlin Berkeley TU University of
Braunschweig, Colorado
wSense
status in 2015 active deprecated unknown active unknown
A. Sensor Nodes
288
c Current consumption specified. Power consumption was calculated assuming 4.5 V supply voltage.
Table A.2.: General purpose sensor nodes (continued)
Mica Mica2 MicaZ OpenMote- Preon32 Spisa
CC2538
CPU family Atmel AVR Atmel AVR Atmel AVR ARM ARM dsPIC
Cortex-M3 Cortex-M3
CPU bit [bit] 8 8 8 32 32 16
CPU clock [MHz] 4 n/a 8 ≤ 32 8 . . . 72 7.37
RAM [kB] 4 n/a 4 32 64 2
FLASH [kB] 128 n/a 128 512 256 48
wireless standard none none IEEE 802.15.4 IEEE 802.15.4 IEEE 802.15.4 none
frequency band 915 MHz 915 MHz 2.4 GHz 2.4 GHz 2.4 GHz 433 MHz
ADC resolution [bit] 10 n/a 10 12 12 12
max. sampling-rate [kS/s] 15 n/a 15 50 1000 100
interfaces GPIO, I2C, SPI, n/a GPIO, I2C, SPI, GPIO, SPI, GPIO, UART, GPIO, UART,
UART UART UART, I2C, I2C, SPi, CAN, I2C, SPI
USB USB
supply voltage [V] 3.0 2.7–3.3 2.7–3.3 2.0–3.6 2.7–3.6 5.6–6.6
power active [mW] 16.5 36 36 39 a 11.1–84.9a n/a
power sleep [mW] 0.06 0.054 0.048 0.004a 3.9a n/a
power sending [mW] 37.5 117 88.2 111a 47.9–121.8 a n/a
power receiving [mW] 31.5 66 95.1 99a 53.1–126.9 a n/a
dimensions (l x w) [mm] 57.2 x 31.8 n/a 58 x 22 32.9 x 22.0 27.5 x 19 70 x 74
operating system TinyOS TinyOS Contiki, TinyOS Contiki, (Contiki), Java custom
FreeRTOS,
OpenWSN, Riot
manufacturer Berkeley Berkeley, Berkeley, OpenMote Tech. Virtenio TU Berlin
Crossbow Crossbow,
Memsic
status in 2015 deprecated deprecated active active active deprecated
reference [56] [172] [173] [176] [179] [117, 181]
289
a Current consumption was specified. Power consumption was calculated assuming 3 V supply voltage.
Table A.3.: General purpose sensor nodes (continued)
SunSPOT TelosB Tmote Sky Xbee Z1
CPU family ARM920T TI MSP430 TI MSP430 n/a TI MSP430
CPU bit [bit] 32 16 16 n/a 16
CPU clock [MHz] 180 8 ≤8 n/a 16
RAM [kB] 512 10 10 n/a 8
FLASH [kB] 4096 48 48 n/a 92
wireless standard IEEE 802.15.4 IEEE 802.15.4 IEEE 802.15.4 IEEE 802.15.4 IEEE 802.15.4
frequency band 2.4 GHz 2.4 GHz 2.4 GHz 2.4 GHz 2.4 GHz
ADC resolution [bit] n/a 12 12 10 12
max. sampling-rate [kS/s] n/a n/a 200 n/a n/a
interfaces n/a GPIO,I2C,SPI GPIO, UART, GPIO GPIO, I2C, SPI,
I2C UART
supply voltage [V] 3.7 ≈ 3.0 V 2.1–3.6 2.8–3.4 2.7–3.6
power active [mW] 259–444 5.4 5.4 n/a 30 a
power sleep [mW] 0.118 0.015 0.0153 0.033 b 0.008a
power sending [mW] n/a n/a 65.4 709.5b 82.2a
power receiving [mW] n/a 74.4 58.5 181.5b 86.4a
dimensions (l x w) [mm] n/a 65 x 31 32 x 80 24.5 cm x 32.9 56.8 x 34.5
operating system Java TinyOS Contiki, TinyOS n/a Contiki, TinyOS
manufacturer Sun Berkeley,Memsic Moteiv Digi zolteria
Microsystems International
Inc.
status in 2015 deprecated active deprecated active active
A. Sensor Nodes
290
B. Evaluating the polynomial kernel
of a transposed Farrow filter
M Q−1
∑ ∑
y(lT s′ ) = x(tn )ha (lT s′ − tn ) (B.1)
m=0 q=0
with
Q−1
∑∑ M
ha (t ) = cm [q] fm (q, t ) (B.2)
q=0 m=0
and
⎧ ( )m
2(t−qT s′ )
⎪
⎪ ′ − 1 , qT s′ ≤ t < (q + 1)T s′
fm (q, t ) = ⎪ T , (B.3)
⎨
s
⎪
⎩ 0, otherwise
compare (3.53) to (3.55). The following derivation is given in [7], for the evaluation of
the polynomial kernel fm at the time t∗ = lT s′ − tn with qT s′ ≤ t∗ < (q + 1)T s′ :
291
B. Evaluating the polynomial kernel of a transposed Farrow filter
Now, let’s consider a situation where t = qT s′ , i.e. an input sample is at exactly the
same position as an output sample 1 . For this case follows from (3.57) that l = ln and
µn = 0. When evaluating (B.10) for this situation, the result is:
fm (q, qT s′ ) = 1m (B.11)
= 1, (B.12)
This contradiction indicates an error in the derivation from (B.4) to (B.7). The problem
appears to be in the transition from (B.6) to (B.7). Unfortunately no explanation is given
in [7] as to the reasoning behind this step. However, the author assumes the following
argument:
In (B.6), (l − ln )T s′ is the distance between the input nth input sample and the lth output
sample rounded up to complete intervals of T s′ . Considering that the filter’s impulse
response ha is defined piecewise over intervals of T s′ , this defines the interval of ha to
evaluate, which is ((q + 1)T s′ , qT s′ ]. Thus, (q + 1)T s′ = (l − ln )T s′ describe the same
time interval, as long as tn is not identical to any output sampling instant (see figure
B.1).
292
However, if tn is identical to an output sampling instant, the fractional interval becomes
µn = 0 and (l − ln )T s′ = qT s′ due to (B.3). Thus, the case of µn = 0 does appear to have
been overlooked in [7]. Therefore, (B.10) needs to be extended as follows, in order to
always yield correct results:
(1 − 2µn )m , µn , 0
{
fm (q, lT s′ − tn ) = . (B.15)
(−1)m , µn = 0
293
Figure C.1.: Circuit diagram of the microphone module [Stud22].
VDD
VDD
VDD
Hochpass Vorstufe Schmitt-Trigger
10k
Mikrofon
R1
TR3
10k
2
R3
JP3
1
1 C1 5 IC1B 500k
4
7 1 3
6.8n
6
MCP6004-I/PP
2
1
C. Application sensors
11
500k
TR1
2
470k
Impedanzwandler
JP2
JP5
1
1
JP4
R2
12 IC1D P2
IC1C
3
2 10 14 2 1 1
3
JP1
GPIO1
500k
8 13 4 3
GND
TR2
1
GPIO0
9 MCP6004-I/PP 6 5 JP7
GPIO6
GPIO7
1
MCP6004-I/PP 8 7
GPIO8
GPIO9
10 9
GPIO10
GPIO11
12 11
GPIO12
VDD
GPIO13
10k
14 13
GPIO14
R4
GPIO15
16 15 1
GPIO16
VDD
GND GND GND GND GND JP8
P1
1 2 RESETN JP6
GPIO37 3 4 GPIO36 1
GPIO35 5 6 GPIO34
GPIO33 7 8 GPIO32
GPIO25 9 10 GPIO24
(GPIO23) 11 12 (GPIO22)
(GPIO21) 13 14 GPIO20
GPIO19 15 16 GPIO18
GND
Stützkondensator für IC
VDD
C.1. Microphone
3 IC1A
C2 1
100n
2
MCP6004-I/PP
AUTHOR: Florian Roubal
GND
GND
294
0V
U$1 P1 P2
1P1 2P1 1P2 2P2
IC5 LP2950Z 3P1 4P1 ADC1 UU 3P2 4P2
V+ 3 1 VDD JP5 5P1 6P1 ADC3 UW 5P2 6P2 UV ADC2 13 TL074D
I O
C5 1 7P1 8P1 ADC5 IV 7P2 8P2 IU ADC4 14
C4 2 9P1 10P1 9P2 10P2 IW ADC6 0V 12
GND 100n 11P1 12P1 11P2 12P2 IC4D
2
13P1 14P1 13P2 14P2
0V 15P1 16P1 15P2 16P2
PREON32
PTC Fuse
V+
1
1
DC2 100u
12V TL074D TL074D TL074D
4
4
4
4
100u 24 1 11 14 C1 2 6 9
91k
12k
20k
R1_ADD_F1C
R1_ADD_F1E
R1_ADD_STROM
L1 COM
D1
C3 13 12 3 22 0V 10u C7 C8 C9 C10 3 5 10
-VIN COM
2 23 C2 IC4A IC4B IC4C
-VOUT
10u 100n 100n 100n 100n U_ADD_F1C U_ADD_F1E
100u
11
11
11
11
DC/DC CONVERTER 10u U_ADD_STROM
100k
100k
100k
X1-2
C6
1u
L3
0V
GND
R2_ADD_F1C
R2_ADD_F1E
JP1
R2_ADD_STROM
1 2
R3_F1E_UU 15,4k
3 4
U
R1_UU R3_F1C_UU R5_UU R1_IU R3_IU R5_IU
UU_IN UU_IN IU_IN
0V 26,1k
100k 100k 100k 16,5k 100k
R2_UU 2 TL074D R4_UU 6 TL074D R2_IU 9 TL074D R4_IU 13 TL074D
IU_IN
0V 1 7 8 14
JP4 100k 100k 100k 100k
DUAL-BNC 3 5 UU 10 12 IU
U_ADD_F1E 1 2 IC1A IC1B IC1C IC1D
0V 0V 0V 0V
3 4
V U_ADD_F1C JP2
1 2
R3_F1E_UV 15,4k
UV_IN
C.2. Current and voltage sensors
0V 3 4
R1_UV R3_F1C_UV R5_UV R1_IV R3_IV R5_IV
IV_IN UV_IN IV_IN
26,1k
0V 100k 100k 100k 16,5k 100k
DUAL-BNC R2_UV R4_UV R2_IV R4_IV
2 TL074D 6 TL074D 9 TL074D 13 TL074D
1 7 8 14
100k 100k 100k 100k
3 5 UV 10 12 IV
W 0V IC2A 0V IC2B 0V IC2C 0V IC2D
UW_IN
0V JP3
1 2
R3_F1E_UW 15,4k
3 4
U_ADD_SPANNUNG
IW_IN
U_ADD_STROM
295
C.2. Current and voltage sensors
+15V
MKDSN1,5/5-5,08
X9-1
X8-1
X8-2
MKDS_5/2-9,50
C5 C7
+
rad 470/35 100n
+
X4-1
22-23-2021 rad 470/35 100n
F2
X9-3
-15V
1
2 J13 1
J3 1
J4 1
KSI1-5085MM
J5
+15V
2
P1 +15V
P2 IN +15V
C114
X7
100n
GND
P3
P4 U$2
V+
R115
GND
100n
C109
R117
GND
P5
4k7
C102
C104
C106
IC11B
1
J1 1
J6 1
J7 1
M 5 1-227161-0
100n
C112
4
4k7
15n
15n
15n
R113
KSI1-5085MM
J8
P6 7 9 TL074CDSMD
R116 13
C108
P7 V- 6 8 TL074CDSMD
4k7
15n
R101 R102
2
P8 LA_35-NP
TL074CDSMD 10 14 3 IC11A
4k7 R103 R104 IC12A GND
P9 IC11C 12 1 3
4
3k9 6k8 R105 R106
11
IC12B
GND
GND
6n8 IC12C
RM101
RM102
TL074CDSMD 2 7 10
64Y-5,0k
100n
C110
100n
C113
3k9 6k8
POT103
4k7
+15V
3
TL074CDSMD 6
3k9 6k8 8 2 12
-15V C103 6n8
82
82
TL074CDSMD 9 14
GND
1
2 J2 1
2 J10 1
11
R111
C105 TL074CDSMD
KSI1-5085MM
J9
J11
13
10k
C115
1
100n
C107
1
1-227161-0
TL074CDSMD
POT101
64Y-5,0k
2 GND
C111
100n
RM103
RM104
GND
2
GND GND
1
64Y-500
POT102
2
MKDS_5/2-9,50
GND
82
82
GND GND
GND
-15V
3
R110
4k7
R112
10k
X1-1
X1-2
-15V
GND
+15V
C209
+15V
100n
RV2 +15V
GND
MKDS_5/2-9,50
C214
X5
100n
I+ LEM2 V+ R215
X2-1 47k
RV1
GND
R217
GND
M 4k7
C202
C204
C206
47k 5
100n IC21B 1-227161-0
C212
4
4k7
15n
15n
15n
R213 TL074CDSMD
RV4 7 9
R216 13
C208
6 8 TL074CDSMD
4k7
15n
R201 R202
C210
IC21A
100n
X2-2 47k
RV3 I- TL074CDSMD 10 14 3
LV_25-P/SP5V- IC21C
4k7
12 1
R203 R204 3 IC22A GND
GND
4
3k9 6k8 R205 R206
11
IC22B
GND
47k IC21D 6n8 2 1 5
3k9 6k8 R207 R208
R209
6n8 IC22C
RM201
RM202
TL074CDSMD 2 7 10
64Y-5,0k
100n
C213
3k9 6k8
POT203
4k7
+15V
-15V C201 6n8 IC22D X3
3
TL074CDSMD 6
3k9 6k8 8 2 12
180
180
C203 TL074CDSMD 6n8 9 14
GND
11
R211
C205 TL074CDSMD 13
-15V
10k
C215
1
100n
C207
1
TL074CDSMD
1-227161-0
POT201
64Y-5,0k
2 GND
C211
100n
RM203
RM204
GND
GND GND
64Y-500
POT202
2
180
180
C. Application sensors
GND
GND GND
GND
3
R210
-15V
4k7
R212
10k
-15V
GND
296
21.12.15 16:28 f=0.69 /home/jfunck/Forschung/Stromwandler/Stromwandler_eagle/CurrentVoltageTransformer.sch (Sheet: 1/1)
+5V
GND GND
IC2EN
6 5 AM26LS32AC IC3
+5V
4 3 ENABLE L4940V5
F1
2
4
6
8
10
12
14
16
2
4
6
8
10
12
14
16
2 1 3 1
LSP1
VO VI
+
LSP3
JP5 C1 GND C2
1
3
5
7
9
1
3
5
7
9
11
13
15
11
13
15
10uF 100nF
JP1
JP2
GND
LSP2
LSP4
R3
120R
AM26LS32AC 4050N
C.3. Rotary encoder
C8 C9
P1 P2
+5V
GND GND
GND
GND
GND RESETN UIRQ1,T0-CH1,CAN0-RX,I2C0-SCL,GPIO1
9 5
GPIO37,SPI2-MOSI T1-CH1,ADC0-1,GPIO6
8 4
GPIO36,SPI2-MISO,JTAG-NTRST UIRQ0,T0-CH0,CAN0-TX,I2C0-SDA,GPIO0
7 3 UA1_P 6 IC2B IC1B
GPIO35,SPI2-SCK,JTAG-TDO T1-CH3,USART1-RX,ADC0-3,GPIO8
6 2 5 5 4
GPIO34,SPI-NSS,JTAG-TDI,UIRW14 T1-CH2,USART1-TX,ADC0-2,GPIO7
1 UA1_N 7
R4
120R
GPIO33,JTAG-TCK,UIRQ13 UIRQ7,DAC1,SPI0-SCK,ADC0-5,GPIO10
AM26LS32AC 4050N GPIO32,JTAG,TMS,UIRQ12 UIRQ6,DAC0,SPI-NSS,ADC0-4,GPIO9
X1 GPIO25 UIRQ8,SPI0-MOSI,ADC0-7,GPIO12
GND GPIO24 SPI0-MISO,ADC0-6,GPIO11
C6 C7 GPIO23,SPI-RF-MOSI ADC0-15,GPIO14
GPIO22,SPI-RF-MISO ADC0-14,GPIO13
220pF 220pF GPIO21-SPI-RF-SCK ADC0-9,GPIO16
GPIO20,USART2-CK,SPI1-NSS,UIRQ11 ADC0-8,GPIO15
+3V3
GPIO19,USART2-RX,I2C-SDA,UIRQ10 VDD1
GPIO18,USART2-TX,I2C-SCL,UIRQ9 VDD2
GND
R5
120R
AM26LS32AC 4050N
C4 C5
IC1D
9 10 220pF 220pF
+5V
+3V3
+3V3
+5V
4050N
1
IC1E GND
16
VCC
VDD
11 12 14 IC2D
R2
56R
R1
150R
8
100nF 100nF
VSS
8
AM26LS32AC GND
IC1F
LED2
YELLOW
LED1
GREEN
14 15
4050N
GND GND GND GND
GND
297
C.3. Rotary encoder
D. Angular resampling filer
27
%% Ouput d e c i m a t o r (D)
29 % d e c i m a t i o n and r i p p l e s p e c i f i c a t i o n
tSNR = 74; % t a r g e t SNR [ dB ]
31 As = tSNR ; % s t o p b a n d r i p p l e [ dB ]
dp = s q r t ( 2 ) * 1 0 ˆ( − tSNR / 2 0 ) ; % passband r i p p l e [1]
33 Ap = 20 * l o g 1 0 ( ( 1 + dp ) / ( 1 − dp ) ) ; % p a s s b a n d r i p p l e [ dB ]
d = f d e s i g n . d e c i m a t o r ( OSRout , ’lowpass ’ , ’fp ,fst ,ap ,ast ’ , . . .
35 wp / OSRout , 0 . 5 , Ap , As ) ;
% c a l c u l a t e FIR d e c i m a t o r c o e f f i c i e n t s u s i n g e q u i r i p p l e method
37 hD = equiripple (d) ;
c o e f f D = hD . N u m e r a t o r ;
298
D.1. Filter design
function [ h , f ] = freqps ( c , f , T)
2 % function [h , f ] = freqps ( c , f , T)
% −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
4 % f i l e n a m e : freqp .m
% author : J u e r g e n Funck ( j u e r g e n . funck@tu − b e r l i n . de )
6 % o r g a n i s a t i o n : TU B e r l i n
% p r o j e c t : wsn
8 % date : 14.02.2014
% −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
10 % description : c a l c u l a t e s the magnitude frequency response of a continuous
% p i e c e w i s e p o l y n o m i a l f i l t e r as d e s c r i b e d i n
12 % Vesma1996 ” I n t e r p o l a t i o n f i l t e r s w i t h a r b i t r a r y f r e q u e n c y
% r e s p o n s e f o r a l l − d i g i t a l r e c e i v e r s ” and B a b i c 2 0 0 8
14 % ” P o l y n o m i a l −Based I n t e r p o l a t i o n F i l t e r s f o r DSP− A p p l i c a t i o n s ” ( p . 4 2 )
% input : c − c o e f f i c i e n t matrix
16 % f − frequency vector
% T − polynomial i n t e r v a l length
18 %
% output h − frequency response
20 % f − frequency vector
22 % get dimensions
[m, n ] = size (c) ;
24 M = m−1;
N = 2* n ;
26
h = zeros (1 , length ( f ) ) ;
28
f o r i =1: l e n g t h ( f )
30 f o r n = 0 : ( (N / 2 ) −1)
f o r m=0:M
32 h ( i ) = h ( i ) + c (m+1 , n +1) *G( n , m, f ( i ) , T ) ;
end
34 end
end
36
end
38
f u n c t i o n g = G( n , m, f , T )
40 w = 2 * p i * f *T ;
i f ( mod (m, 2 ) ==0)
42 % even m
g = 2 * c o s (w * ( n + 0 . 5 ) ) * ( ( ( − 1 ) ˆ (m/ 2 ) ) * f a c t o r i a l (m) * P s i (m, f , T ) + s i n c ( f *
T) ) ;
44 else
% odd m
46 g = 2 * ( ( − 1 ) ˆ ( ( m+1) / 2 ) ) * f a c t o r i a l (m) * s i n (w * ( n + 0 . 5 ) ) * P s i (m, f , T ) ;
end
48 end
50 f u n c t i o n p = P s i (m, f , T )
k = 0 : f l o o r ( ( m−1) / 2 ) ;
52
p = sum ( ( ( p i * f * T ) . ˆ ( 2 * k−m) ) . * ( ( − 1 ) . ˆ k ) . / f a c t o r i a l ( 2 * k ) . * ...
54 ( s i n c ( f * T ) − c o s ( p i * f * T ) . / ( 2 * k +1) ) ) ;
end
299
D. Angular resampling filer
3 % output stage
y = f i l t e r ( h o u t , d o u b l e ( y2 ) ) ;
5 Mout = f l o o r ( ( l e n g t h ( y ) −param . N s e t t l e ) / param . f o u t ) * param . f o u t ;
y = r e s h a p e ( y ( param . N s e t t l e + ( 1 : Mout ) ) , [ ] , 1 ) ;
f u n c t i o n [ y , s t a t e , l k ] = r e s a m p l e A n g u l a r F a r r o w ( x , Tin , t p h i , s t a t e , h F a r O u t )
2 % f u n c t i o n [ y , s t a t e ] = resampleAngularFarrow ( x , tend , t p h i )
% −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
4 % f i l e n a m e : resampleAngularBlock .m
% author : J u e r g e n Funck ( j u e r g e n . funck@tu − b e r l i n . de )
6 % o r g a n i s a t i o n : TU B e r l i n
% p r o j e c t : wsn
8 % date : 22.01.2014
% −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
10 % d e s c r i p t i o n : p e r f o r m e s a n g u l a r r e s a m p l i n g on a b l o c k o f d a t a
% input : x − input signal
12 % tend − time of l a s t sample
% ( t i m e o f f i r s t s a m p l e i s i m p l i c i t l y t 0 =0)
14 % tphi − resampling times with reference to s t a r t of block
% state − structure containing the i n i t a l f i l t e r state
16 %
% output : y − resampled s i g n a l
18 % state − structure containing the f i n a l f i l t e r state
% −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
20 %% p a r a m e t e r s
% c o e f f i c i e n t s of farrow f i l t e r
22 % c ( n , m) , n = 1 . . . 4 , m = 1 . . . 4
c = [ 1/48 , 1/16 , 1/16 , 1/48;
24 23/48 , 5 / 1 6 , −1/16 , −1/16;
23/48 , −5/16 , −1/16 , 1 / 1 6 ;
26 1 / 4 8 , −1/16 , 1 / 1 6 , −1/48];
M = s i z e ( c , 2 ) −1;
28 N = size (c ,1) ;
30 %% i n i t i a l i z a t i o n
% farrow b u f f e r s
32 Min = length (x) ;
Mout = length ( tphi ) ;
34 y = z e r o s ( 1 , Mout ) ;
36 i f ( isempty ( s t a t e ) )
s t a t e . etaX = z e r o s (M+ 1 , 1 ) ;
38 s t a t e . etaP = z e r o s (M+ 1 , 1 ) ;
s t a t e . yXbuf = z e r o s (N, 1 ) ;
40 s t a t e . yPbuf = z e r o s (N, 1 ) ;
s t a t e . zX = z e r o s ( 1 , l e n g t h ( h F a r O u t . N u m e r a t o r ) −1) ;
42 s t a t e . zP = z e r o s ( 1 , l e n g t h ( h F a r O u t . N u m e r a t o r ) −1) ;
end
44
lk = 1;
46
%% f i l t e r l o o p
48 % loop over a l l input samples
f o r k =1: Min
50 % next output interval
w h i l e ( ( ( k −1) * T i n ) > t p h i ( l k +1) )
300
D.2. MATLAB implementation
70 % f i n a l o u t p u t sample
[ tempX , s t a t e . zX ] = f i l t e r ( h F a r O u t . Numerator , 1 , s t a t e . yXbuf ( 1 ) , s t a t e
. zX ) ;
72 [ tempP , s t a t e . zP ] = f i l t e r ( h F a r O u t . Numerator , 1 , s t a t e . y P b u f ( 1 ) , s t a t e
. zP ) ;
74 y ( lk ) = tempX / tempP ;
301
D. Angular resampling filer
D.3. C implementations
# i n c l u d e "dev/leds.h"
2 # i n c l u d e " arm_math .h"
30 /* i n i t i a l i z e f i l t e r s G */
a r m f i r i n i t f 3 2 (& r e s a m p l e r . Gp , FARROW OUTPUT FIR TAPS ,
farrowOutputFirCoeff ,
32 r e s a m p l e r . G p S t a t e , FIR BUFFER SIZE ) ;
a r m f i r i n i t f 3 2 (& r e s a m p l e r . Gx , FARROW OUTPUT FIR TAPS ,
farrowOutputFirCoeff ,
34 r e s a m p l e r . G x S t a t e , FIR BUFFER SIZE ) ;
36 / * i n i t i a l i z e farrow f i l t e r * /
a n g u l a r F a r r o w R e s a m p l e r i n i t f 3 2 (& r e s a m p l e r . f a r r o w ) ;
38 }
/ * −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− * /
40 UInt32
a n g u l a r R e s a m p l e r p r o c e s s f 3 2 ( a n g u l a r F a r r o w R e s a m p l e r I n p u t f 3 2 * in , f l o a t 3 2 t *
out , UInt32 * l k )
42 {
/* init local variables */
44 UInt32 b l o c k S i z e = 0;
46 / * prepare output * /
angularFarrowResamplerOutput f32 farOut ;
48 f a r O u t . yP = r e s a m p l e r . GpBuf+ r e s a m p l e r . pad ;
f a r O u t . yX = r e s a m p l e r . GxBuf+ r e s a m p l e r . pad ;
50
/ * farrow f i l t e r * /
52 * l k = a n g u l a r F a r r o w R e s a m p l e r p r o c e s s f 3 2 (& r e s a m p l e r . f a r r o w , i n , &f a r O u t ) ;
302
D.3. C implementations
b l o c k S i z e = * l k −1 + r e s a m p l e r . pad ;
56 i f ( blockSize % 2) {
b l o c k S i z e −= 1 ;
58 r e s a m p l e r . pad = 1 ;
r e s a m p l e r . saveX = r e s a m p l e r . GxBuf [ b l o c k S i z e ] ;
60 r e s a m p l e r . s a v e P = r e s a m p l e r . GpBuf [ b l o c k S i z e ] ;
}
62 else {
r e s a m p l e r . pad = 0 ;
64 }
66 / * FIR G * /
a r m f i r f 3 2 (& r e s a m p l e r . Gp , r e s a m p l e r . GpBuf , r e s a m p l e r . GpBuf , b l o c k S i z e ) ;
68 a r m f i r f 3 2 (& r e s a m p l e r . Gx , r e s a m p l e r . GxBuf , r e s a m p l e r . GxBuf , b l o c k S i z e ) ;
70 /* divisor */
f o r ( i n t i =0; i < b l o c k S i z e ; i ++) {
72 r e s a m p l e r . GxBuf [ i ] = r e s a m p l e r . GxBuf [ i ] / r e s a m p l e r . GpBuf [ i ] ;
}
74
/* f i r decimator */
76 a r m f i r d e c i m a t e f 3 2 (& r e s a m p l e r . D, r e s a m p l e r . GxBuf , o u t , b l o c k S i z e ) ;
78 / * add s a m p l e s t h a t were n o t p r o c e s s e d t o b e g i n n i n g o f n e x t b l o c k * /
i f ( r e s a m p l e r . pad == 1 ) {
80 r e s a m p l e r . GpBuf [ 0 ] = r e s a m p l e r . s a v e P ;
r e s a m p l e r . GxBuf [ 0 ] = r e s a m p l e r . saveX ;
82 }
84 r e t u r n ( b l o c k S i z e / DECIMATION FACTOR ) ;
}
3 f l o a t 3 2 t f a r r o w C o e f f f 3 2 [ N POLY * (M POLY+1) ] = { 1 . 0 / 4 8 . 0 , 1 . 0 / 1 6 . 0 , 1 . 0 / 1 6 . 0 ,
1.0/48.0 ,
23.0/48.0 , 5.0/16.0 , −1.0/16.0 , −1.0/16.0 ,
5 23.0/48.0 , −5.0/16.0 , −1.0/16.0 , 1.0/16.0 ,
1.0/48.0 , −1.0/16.0 , 1.0/16.0 , −1.0/48.0};
7 / * −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− * /
void
9 angularFarrowResampler init f32 ( angularFarrowResampler f32 * resampler )
{
11 i f ( r e s a m p l e r != NULL) {
f a r r o w F i l t e r i n i t f 3 2 (& r e s a m p l e r −> f i l t e r X ) ;
13 f a r r o w F i l t e r i n i t f 3 2 (& r e s a m p l e r −> f i l t e r P ) ;
}
15 }
/ * −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− * /
17 size t
angularFarrowResampler process f32 ( angularFarrowResampler f32 * resampler ,
19 a n g u l a r F a r r o w R e s a m p l e r I n p u t f 3 2 * in , a n g u l a r F a r r o w R e s a m p l e r O u t p u t f 3 2 *
out )
{
21 size t k = 0;
s i z e t lk = 1;
23 f l o a t 3 2 t f [M POLY+ 1 ] ;
303
D. Angular resampling filer
# i f n d e f FARROW FILTER H
2 # d e f i n e FARROW FILTER H
20 / * * i n i t i a l i z e s a farrow f i l t e r s t r u c t u r e * /
s t a t i c i n l i n e void
22 farrowFilter init f32 ( farrowFilter f32* f i l t e r )
{
24 f i l t e r −> c o e f f = f a r r o w C o e f f f 3 2 ;
memset ( f i l t e r −> e t a , 0 , ( M POLY+1) * s i z e o f ( f l o a t 3 2 t ) ) ;
26 memset ( f i l t e r −>ybuf , 0 , N POLY * s i z e o f ( f l o a t 3 2 t ) ) ;
}
28
/ * * c a l c u l a t e s the f r a c t i o n a l i n t e r v a l for angular resampling * /
30 s t a t i c i n l i n e void
f a r r o w F i l t e r f r a c I n t e r s f 3 2 ( f l o a t 3 2 t Tin , f l o a t 3 2 t * t p h i , s i z e t k , s i z e t l k
, f l o a t 3 2 t * fm )
32 {
i n t m=0;
304
D.3. C implementations
34 f l o a t 3 2 t f =0;
f l o a t 3 2 t mu = ( ( k −1) * T i n − t p h i [ l k − 1 ] ) / ( t p h i [ l k ] − t p h i [ l k − 1 ] ) ;
36
i f ( mu==0) {
38 f = −1;
}
40 else {
f = (1 −2 * mu ) ;
42 }
44 fm [ 0 ] = 1 ;
fm [ 1 ] = f ;
46 f o r (m=2; m<(M POLY+1) ; m++) {
fm [m] = fm [m−1] * f ;
48 }
}
50
/ * * u p d a t e s t h e i n t e r n a l s t a t e o f a f a r r o w f i l t e r w i t h a new f r a c t i o n a l
interval */
52 s t a t i c i n l i n e void
farrowFilter update f32 ( farrowFilter f32 * filter , float32 t * f , float32 t x)
54 {
i n t i =0;
56
f o r ( i =0; i <(M POLY+1) ; i ++) {
58 f i l t e r −> e t a [ i ] = f i l t e r −> e t a [ i ] + x * f [ i ] ;
}
60 }
62 / * * c a l c u l a t e s a new o u t p u t s a m p l e f r o m a f a r r o w f i l t e r */
static inline float32 t
64 farrowFilter output f32 ( farrowFilter f32* f i l t e r )
{
66 i n t n =0;
i n t m=0;
68
f o r ( n =0; n<N POLY ; n++) {
70 i f ( n <(N POLY−1) ) {
f i l t e r −>y b u f [ n ] = f i l t e r −>y b u f [ n + 1 ] ;
72 }
else {
74 f i l t e r −>y b u f [ n ] = 0 ;
}
76
/ * sum o v e r p o l y n o m i a l o r d e r * /
78 f o r (m=0; m<(M POLY+1) ; m++) {
f i l t e r −>y b u f [ n ] = f i l t e r −>y b u f [ n ] + f i l t e r −> c o e f f [ ( N POLY * n ) +m] *
f i l t e r −> e t a [m ] ;
80 }
}
82
/* reset integator buffer */
84 f o r (m=0; m<(M POLY+1) ; m++) {
f i l t e r −> e t a [m] = 0 ;
86 }
88 / * r e t u r n f i n a l o u t p u t sample * /
r e t u r n f i l t e r −>y b u f [ 0 ] ;
90 }
92 # e n d i f / * FARROW FILTER H * /
Listing D.7: Helper functions for the transposed Farrow filter (C floating-point).
305
D. Angular resampling filer
# include "dev/leds.h"
2 # include " arm_math .h"
# include "lib/list.h"
4 # include "lib/memb.h"
54 /* i n i t i a l i z e resampler */
r e s a m p l e r . pad = 0;
56 r e s a m p l e r . saveP = 0;
r e s a m p l e r . saveX = 0 ;
58 }
/ * −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− * /
306
D.3. C implementations
60 UInt8
a n g u l a r R e s a m p l e r p r o c e s s q 1 5 ( a n g u l a r F a r r o w R e s a m p l e r I n p u t q 1 5 * in ,
xdcr DataBlock * out )
62 {
/* init local variables */
64 UInt32 b l o c k S i z e = 0;
UInt8 blockDone = 0;
66 UInt32 lk = 0;
68 / * prepare output * /
angularFarrowResamplerOutput q15 farOut ;
70 farOut . phi0 = 0;
farOut . dphi = 0;
72 f a r O u t . yP = r e s a m p l e r . GpBuf+ r e s a m p l e r . pad ;
f a r O u t . yX = r e s a m p l e r . GxBuf+ r e s a m p l e r . pad ;
74
/ * farrow f i l t e r * /
76 l k = a n g u l a r F a r r o w R e s a m p l e r p r o c e s s q 1 5 (& r e s a m p l e r . f a r r o w , i n , &f a r O u t , &
blockDone ) ;
114 /* f i r decimator */
a r m f i r d e c i m a t e q 3 1 (& r e s a m p l e r . D, r e s a m p l e r . GxBuf , r e s a m p l e r . DBuf ,
blockSize ) ;
116
/ * c o n v e r t t o q15 and c o p y t o o u t p u t * /
118 f o r ( i n t i =0; i <( b l o c k S i z e / DECIMATION FACTOR ) ; i ++) {
o u t −> s a m p l e s [ i ] = ( q 1 5 t ) r e s a m p l e r . DBuf [ i ] ;
120 }
307
D. Angular resampling filer
128 / * s e t number o f o u t p u t s a m p l e s * /
o u t −> r e p C o u n t = ( b l o c k S i z e / DECIMATION FACTOR ) ;
130
return blockDone ;
132 }
308
D.3. C implementations
44 / * −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− * /
static inline uint8 t
46 getInitialResamplingInstants ( q63 t t s t a r t , q63 t tref ,
angularFarrowResampler q15 * resampler )
{
48 w h i l e ( ( r e s a m p l e r −> t p h i l S t a t e < 0 ) | |
( r e s a m p l e r −> t p h i l n e x t S t a t e < 0 ) | |
50 ( r e s a m p l e r −> t p h i l n e x t S t a t e <= t s t a r t ) ) {
/* try updating timestamps */
52 i f (! updateResamplingInstants ( tref , resampler ) ) {
/ * update not p o s s i b l e * /
54 return 0;
}
56 }
58 / * e n s u r e u p d a t e t o new t 0 i n any c a s e * /
r e s a m p l e r −> t p h i l = r e s a m p l e r −> t p h i l S t a t e − t r e f ;
60 r e s a m p l e r −> t p h i l n e x t = r e s a m p l e r −> t p h i l n e x t S t a t e − t r e f ;
r e s a m p l e r −> d e l t a T p h i = ( r e s a m p l e r −> t p h i l n e x t − r e s a m p l e r −> t p h i l ) >>EXP Q ;
62
return 1;
64 }
/ * −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− * /
66 static inline uint8 t
updateResamplingInstants ( q63 t tref , angularFarrowResampler q15 * resampler )
68 {
u i n t 3 2 t t e m p P h i =0 , tempDphi = 0 ;
70 q 6 3 t temp = n e x t T i m e S t a m p ( r e s a m p l e r , &tempPhi , &tempDphi ) ;
72 i f ( temp < 0 ) {
/ * no v a l i d t i m e s t a m p i n b u f f e r * /
74 return 0;
}
76 else {
/ * update timestamp s t a t e * /
78 r e s a m p l e r −> t p h i l S t a t e = r e s a m p l e r −> t p h i l n e x t S t a t e ;
r e s a m p l e r −> t p h i l n e x t S t a t e = temp ;
80
r e s a m p l e r −> t p h i l = r e s a m p l e r −> t p h i l S t a t e − t r e f ;
82 r e s a m p l e r −> t p h i l n e x t = r e s a m p l e r −> t p h i l n e x t S t a t e − t r e f ;
r e s a m p l e r −> d e l t a T p h i = ( r e s a m p l e r −> t p h i l n e x t − r e s a m p l e r −> t p h i l ) >>EXP Q
;
84
r e s a m p l e r −> p h i = t e m p P h i ;
86 r e s a m p l e r −> d p h i = tempDphi ;
88 return 1;
}
90 }
/ * −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− * /
92 size t
angularFarrowResampler process q15 ( angularFarrowResampler q15 * resampler ,
94 a n g u l a r F a r r o w R e s a m p l e r I n p u t q 1 5 * in , angularFarrowResamplerOutput q15 *
out , u i n t 8 t * blockDone )
{
96 s i z e t lk = 1;
q 1 5 t f [M POLY+ 1 ] ;
98 uint16 t scaleOut = 0 x8000 ;
100 PRINTF ( " angularFarrowResampler_process_q15 ... x=%i ,%i ,%i ,...\ n" , i n −>x [ 0 ] , i n
−>x [ 1 ] , i n −>x [ 2 ] ) ;
102 * blockDone = 0 ;
309
D. Angular resampling filer
10 / * r e p r e s e n t a t i o n of u n i t ( 1 ) in choosen Q format * /
# d e f i n e UNIT Q (1<<EXP Q )
12
# d e f i n e M POLY 3 / * polynomial order * /
310
D.3. C implementations
14 # d e f i n e N POLY 4 / * number o f p o l y n o m i a l s e g m e n t s * /
16 typedef struct f a r r o w F i l t e r S t r u c t q 1 5 f a r r o w F i l t e r q 1 5 ;
20 / * * s t r u c t u r e t o h o l d t h e c o e f f i c i e n t s and s t a t e o f a f a r r o w f i l t e r */
struct farrowFilterStruct q15 {
22 q15 t * coeff ; /* pointer to c o e f f i c i e n t s */
q 3 1 t e t a [M POLY+ 1 ] ; / * e t a − v a l u e b u f f e r * /
24 q 6 3 t y b u f [ N POLY ] ; /* output value buffer */
};
26
/ * * i n i t i a l i z e s a farrow f i l t e r s t r u c t u r e * /
28 s t a t i c i n l i n e void
farrowFilter init q15 ( farrowFilter q15* f i l t e r )
30 {
f i l t e r −> c o e f f = f a r r o w C o e f f q 1 5 ;
32 memset ( f i l t e r −> e t a , 0 , ( M POLY+1) * s i z e o f ( q 3 1 t ) ) ;
memset ( f i l t e r −>ybuf , 0 , N POLY * s i z e o f ( q 6 3 t ) ) ;
34 }
54 i f ( mu==0) {
f = −UNIT Q ; / * = −1 i n Q17 . 1 4 f o r m a t * /
56 }
else {
58 f = ( UNIT Q−2 *mu ) ;
}
60
fm [ 0 ] = UNIT Q ; / * = 1 i n Q1 . 1 4 f o r m a t * /
62 fm [ 1 ] = f ;
f o r (m=2; m<(M POLY+1) ; m++) {
64 fm [m] = ( ( q 3 1 t ) fm [m−1] * f ) >>EXP Q ;
}
66 }
68 / * * u p d a t e s t h e i n t e r n a l s t a t e o f a f a r r o w f i l t e r w i t h a new f r a c t i o n a l
interval */
s t a t i c i n l i n e void
70 farrowFilter update q15 ( farrowFilter q15 * f i l t e r , q15 t * f , q15 t x)
{
72 i n t i =0;
74 f i l t e r −> e t a [ 0 ] = f i l t e r −> e t a [ 0 ] + x ;
311
D. Angular resampling filer
82 / * * c a l c u l a t e s a new o u t p u t s a m p l e f r o m a f a r r o w f i l t e r */
s t a t i c i n l i n e q31 t
84 farrowFilter output q15 ( farrowFilter q15* f i l t e r )
{
86 i n t n =0;
i n t m=0;
88
f o r ( n =0; n<N POLY ; n++) {
90 i f ( n <(N POLY−1) ) {
f i l t e r −>y b u f [ n ] = f i l t e r −>y b u f [ n + 1 ] ;
92 }
else {
94 f i l t e r −>y b u f [ n ] = 0 ;
}
96
/ * sum o v e r p o l y n o m i a l o r d e r * /
98 f o r (m=0; m<(M POLY+1) ; m++) {
q 6 3 t temp = ( q 6 3 t ) f i l t e r −> c o e f f [ ( N POLY * n ) +m] * f i l t e r −> e t a [m
];
100 f i l t e r −>y b u f [ n ] = f i l t e r −>y b u f [ n ] + temp ;
}
102 }
Listing D.10: Helper functions for the transposed Farrow filter (C fixed-point).
312
D.3. C implementations
7 /**
* \ b r i e f i n i t i a l i z e s the angular resampler
9 */
void a n g u l a r R e s a m p l e r i n i t f 3 2 ( void ) ;
11 v o i d a n g u l a r R e s a m p l e r i n i t q 1 5 ( t i m e s t a m p F u n c t popTimestamp ) ;
13 /**
* \ b r i e f process a block of input samples
15 * \ param i n i n p u t s t r u c t u r e
* \ param o u t o u t p u t s t r u c t u r e
17 * \ r e t u r n number o f o u t p u t s a m p l e s p r o c e s s e d
*/
19 UInt32 a n g u l a r R e s a m p l e r p r o c e s s f 3 2 ( a n g u l a r F a r r o w R e s a m p l e r I n p u t f 3 2 * in ,
f l o a t 3 2 t * out , UInt32 * l k ) ;
UInt8 a n g u l a r R e s a m p l e r p r o c e s s q 1 5 ( a n g u l a r F a r r o w R e s a m p l e r I n p u t q 1 5 * in ,
xdcr DataBlock * out ) ;
313
D. Angular resampling filer
Listing D.12: Common header for C implementations of the transposed Farrow filter
for resampling.
314
E. Results of event timestamping
experiments
This section shows the recordings of timestamp differences and clock updates for all
experiments describes in section 6.2. Refer to table 6.4 for information on the individual
network configurations.
40
∆t N,T 1 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆t N ,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆tT 1,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
t [s]
315
E. Results of event timestamping experiments
60
frel. [%]
40
20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
316
E.2. Network configuration 3
40
∆tN ,T 1 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆t N,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆tT 1,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
t [s]
317
E. Results of event timestamping experiments
∆cT 1 [Ticks]
40
20
0
−20
0 200 400 600 800 1000 1200 1400 1600 1800 2000
∆cT 2 [Ticks]
40
20
0
−20
0 200 400 600 800 1000 1200 1400 1600 1800 2000
t [s]
60
frel. [%]
40
20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
100 100
rel. frequency [%]
80 80
60 60
40 40
20 20
0 0
−40 −20 0 20 40 −40 −20 0 20 40
∆c31 [Ticks] ∆c41 [Ticks]
318
E.3. Network configuration 4
40
∆t N,T 1 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆t N,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆t T 1,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
t [s]
319
E. Results of event timestamping experiments
∆cT 1 [Ticks]
40
20
0
−20
0 200 400 600 800 1000 1200 1400 1600 1800 2000
∆cT 2 [Ticks]
40
20
0
−20
0 200 400 600 800 1000 1200 1400 1600 1800 2000
t [s]
60
frel. [%]
40
20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
100 100
rel. frequency [%]
80 80
60 60
40 40
20 20
0 0
−40 −20 0 20 40 −40 −20 0 20 40
∆c31 [Ticks] ∆c41 [Ticks]
320
E.4. Network configuration 5
40
∆tN ,T 1 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆t N,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆t T 1,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
t [s]
321
E. Results of event timestamping experiments
∆cT 1 [Ticks]
40
20
0
−20
0 200 400 600 800 1000 1200 1400 1600 1800 2000
∆cT 2 [Ticks]
40
20
0
−20
0 200 400 600 800 1000 1200 1400 1600 1800 2000
t [s]
60
frel. [%]
40
20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
100 100
rel. frequency [%]
80 80
60 60
40 40
20 20
0 0
−40 −20 0 20 40 −40 −20 0 20 40
∆c31 [Ticks] ∆c41 [Ticks]
322
E.5. Network configuration 6
40
∆t N ,T 1 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆tN ,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆tT 1,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
t [s]
60
frel. [%]
40
20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
323
E. Results of event timestamping experiments
40
∆t N,T 1 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆t N,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆tT 1,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
t [s]
324
E.6. Network configuration 7
∆cT 1 [Ticks]
40
20
0
−20
0 200 400 600 800 1000 1200 1400 1600 1800 2000
∆cT 2 [Ticks]
40
20
0
−20
0 200 400 600 800 1000 1200 1400 1600 1800 2000
t [s]
60
frel. [%]
40
20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
100 100
rel. frequency [%]
80 80
60 60
40 40
20 20
0 0
−40 −20 0 20 40 −40 −20 0 20 40
∆c31 [Ticks] ∆c41 [Ticks]
325
E. Results of event timestamping experiments
40
∆tN ,T 1 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆t N,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
40
∆t T 1,T 2 [Ticks]
20
0
−20
−40
0 200 400 600 800 1000 1200 1400 1600 1800 2000
t [s]
326
E.7. Network configuration 8
∆cT 1 [Ticks]
40
20
0
−20
0 200 400 600 800 1000 1200 1400 1600 1800 2000
∆cT 2 [Ticks]
40
20
0
−20
0 200 400 600 800 1000 1200 1400 1600 1800 2000
t [s]
60
frel. [%]
40
20
0
−20 −10 0 10 20 −20 −10 0 10 20 −20 −10 0 10 20
∆t N ,T 1 [Ticks] ∆t N ,T 2 [Ticks] ∆t T 1,T 2 [Ticks]
100 100
rel. frequency [%]
80 80
60 60
40 40
20 20
0 0
−40 −20 0 20 40 −40 −20 0 20 40
∆c31 [Ticks] ∆c41 [Ticks]
327
Advances in Automation Engineering
Hrsg.: Prof. Dr.-Ing. Clemens Gühmann
ISSN 2509-8950 (print)
ISSN 2509-8969 (online)
Wireless sensor networks (WSN) are predicted to play a key role in future technological
developments. One of the biggest challenges, when using WSN, is synchronizing the data
acquisition of different nodes. This thesis investigates the relation between synchroniza-
tion accuracy and quality of measurement results. A WSN is modeled as a generic multi-
channel data acquisition system. With the help of this model it is shown, that synchroni-
zation accuracy should be expressed as uncertainty of the timing information. This way,
not only the contribution of the synchronization to the overall measurement uncertainty
can be assessed, but also the synchronization accuracy required for an application can
be estimated. Two distinct approaches to synchronous data acquisition are developed: a
proactive and a reactive one. It is shown that the reactive approach facilitates data acqui-
sition synchronous to the rotation of a machine‘s shaft. The practical realization of a WSN
is described, on which the developed data acquisition methods have been implemented.
Two application examples are used to illustrate the utility of the implemented data acqui-
sition: the acoustic localization of two sensor nodes on a straight line and a simple order
tracking at an induction motor test bench.
9 I S783798
B N 9 7 8 - 3 - 7 329805
983-2980-5 http://verlag.tu-berlin.de Universitätsverlag der TU Berlin