Template
Template
1 Introduction
The EU Commission has stated that all new buildings after 2021 should be
Nearly Zero Energy Buildings (NZEB) [1]. This will be achieved through inte-
grating local green energy resources in buildings, so that individual buildings
become almost self-satisfied in terms of energy; technically known by islanded
micro-grids [7]. This will require smart grid systems to guarantee profitable
deployment of such infrastructures. The reason behind this is that buildings
can generate enough green energy on their own to satisfy the private demand,
whereas the extra energy can be sold to the grid. Achieving a transparent prof-
itable business model for NZEB requires a monitoring of the building energy
generation and consumption with high accuracy and low latency, as false read-
ings could result in energy shortage or expensive bills.
Different monitoring solutions have been proposed to use sensors to mea-
sure energy and collect data, delivering thus a real time energy state for NZEBs
[11,12,13,14,8]. The conventional solutions often require many sensors that col-
lect large amount of data. This comes at a significant energy cost, both related
2 J Boudjadar et al.
This section describes the system architecture and elements, beside to what is
challenging in the time synchronization of clamp-on wireless sensor networks.
The architecture of the wireless sensor network (WSN) is depicted in Figure. 1.
It consists of a set of sensors sampling voltage and current data in real-time,
and a master node (sink) where all data is deposited. The master node commu-
Time Synchronization for Intelligent Sensor Systems 3
nicates sensors data further to the cloud where control decisions are calculated,
i.e what energy resource to schedule?; when to sell energy to the grid?; etc. Sen-
sors operate on integrated batteries and communicate to the master node in a
wireless way to forward data and receive time synchronization messages given
that the sensors do not have physical clocks; reduced hardware to reduce energy
consumption of the sensors. The master node is able to track physical time given
that it has a clock. To prevent time drifting of sensors, the master node assists
by sending timestamp message (sync) frequently to the sensors to calibrate their
local time.
Fig. 1. Overall system architecture
panels
The energy consumption P at any time point t is calculated using the fol-
lowing equation:
P (t) = V (t).I(t). cos(φ)
where V (t) is the voltage at time t, I(t) is the current at time t and φ is the
angle between voltage and current. This requires that both voltage and current
must be taken at the same time point in order to obtain meaningful readings. If
the sensor readings are non-synchronous, the actual energy consumption state
will be inaccurate, which in turn leads to misleading control actuations.
4 J Boudjadar et al.
In fact, Ti is the number of clock ticks since the sensor is powered on. This
variable can be updated through a synchronization operation. The energy con-
sumption Ei is a critical attribute of the sensor as it determines the life time
and impacts how often the sensor can sample and send data to the master node.
As for behavior, the sensors experience four different operation phases: Standby,
Transmit, Receive and Measure. At Standby phase the sensor is inactive and con-
sume a very minimal energy consumption, whereas in the other three phases the
sensor is either sending, receiving or sampling data while consuming proportional
energy to the data throughput. The different phases can run with different time
intervals depending essentially on the sampling frequency and the time synchro-
nization protocol used to align sensors local time to the clock of the master node.
Further details of the sensors behavior and the underlying energy consumption
is provided in Section. 4.
3 Related Work
Time synchronization and energy efficiency for wireless sensor networks have
been studied thoroughly in the literature [19,20,21,22,5,18,23] for different ap-
plications. Beside to improving time synchronization accuracy and energy effi-
Time Synchronization for Intelligent Sensor Systems 5
ciency, a challenging task is how to balance the trade-off between such conflicting
attributes [9,10].
The authors of [5] proposed a networked control to identify sensors synchro-
nization and estimate potential drifting errors. This might lead to much accurate
synchronization result but on the expense of energy given that a drifting of a
sensor would require a synchronization of the entire network. The larger the
network is, the more frequent synchronization packets are issued. Compared to
that, our protocol calculates the drifting error of sensors individually so that
only the sensors experiencing a drift will issue a sync request.
In [21], Ali et al introduced a time synchronization protocol based on averag-
ing consensus algorithm. The protocol relies on updating the sensors local time
following the expected communication time. This improves time synchronization
accuracy but with an increase in the needed number of communication instances
to estimate the actual communication time, by which the energy consumption
increases.
The authors of [20] proposed a time synchronization protocol for WSNs to
compensate the time discrepancy of sensors. It relies on a broadcast scheme and
timestamping mechanism to achieve low execution time and low network traffic
along with accurate synchronization. However, similarly to [21], performing a
broadcast communication every time a sensor drifts is expensive in terms of
energy and it is even not needed for sensors having clocks well synchronized.
The authors of [19] introduced a protocol, as an integration of two processes,
to reduce the energy consumption of sensors while maintaining high time accu-
racy. Such a protocol relies on the assumption that the master node knows the
complete topology of the network, which makes such a protocol not suitable for
ad-hoc networks due to the lack of flexibility.
The authors of [22] designed a high precision time synchronization based on
common performance clock source. Based on the mutual drift estimation, each
pair of activated sensors fully adjusts clock rate and offset to achieve network-
wide time synchronization without necessarily going through the gateway (mas-
ter node). The protocol considers stochastic communication to model random
packets loss. Given that our protocol does not consider packets loss, this will be
an attractive feature to add in future.
The challenge with wireless sensor networks have a single (master) node equipped
with a physical clock is that sensors may request time synchronization from
the master node for each data packet to send [6]. Although this guarantees
an accurate synchronization of sensors to the master node’s clock, it can end
up in draining the sensor batteries much faster. This situation gets even worse
when sensors operate with high sampling frequency. Such a naive synchronization
approach is depicted in Figure 3.
In order to improve the energy efficiency of WSNs while maintaining sen-
sors highly synchronized, we propose a new time synchronization protocol. The
6 J Boudjadar et al.
One way to reduce the sensors energy consumption is by reducing the size of
the data packets to send. The proposed protocol relies on the assumption that
each sensor is responsible for its own synchronization with the master node.
It first reduces the synchronization request packet by 4 bytes (out of 13 bytes
used in the Naive synchronization) thus enables the sensors to turn on their
transmitters/receivers for a shorter time to communicate with the master node.
Figure 4 depicts the packets structure of the proposed protocol. Given the high
number of data packets to communicate, the longer WSN runs the higher the
energy efficiency our protocol will achieve.
At a second stage, Fig. 4. Data packets for synchronization
the proposed proto-
col reduces the num-
ber of synchroniza-
tion requests/answers
to communicate be-
tween sensors and the
master node. This is
achieved by enabling
each sensor to use
the timestamps (syn-
chronization packets)
Time Synchronization for Intelligent Sensor Systems 7
from the master node to calculate its own clock drifting. Based on its drifting,
the sensor decides to request new synchronization packets only if it has a consid-
erable drifting 3 . Otherwise, as long as the sensor internal time is synchronized
with the master’s clock no synchronization requests will be issued by the sen-
sor, thus no sync packet will be sent by master node to such a sensor. This will
reduce drastically the number of packets to communicate between sensors and
master node, which means longer Standby phase and higher energy savings for
the sensors.
Following such a be-
havior, the sensor can
Fig. 5. PI controller for time synchronization
be seen as a phase-
locked PI controller [4].
PI controller
Figure 5 depicts the
overall behavior of the Kp
sensor with respect to T_world Correction factor
Error
drifting estimation and
correction. The time in- Ki
terval to request a new
synchronization u(t) by
T_Estimate
the PI controller is cal-
culated as follows (dis-
cretized):
Xt
u(t) = Kp .Di (t) + Ki Di (t) − Di (t − 1)
0
where Kp and Ki are cumulative parameters to use for optimization. The drifting
(error) Di (t) of a sensor at time point t is calculated in turn as the difference
between the timestamp, sent by the master node, together with the the trip
time of the synchronization packet, and the sensor time (number of ticks) Ti (t)
at time point t.
In fact, the error calculation is performed as follows:
(Tworld − [Ti (t)]).F
Di (t) =
[Ti (t)] − [Ti (t − 1)]
where Tworld = C + R/2, C is the physical clock value provided by the master
node and R is the round trip time for a message communication between the
sensor and master node. F is a scaling factor defined as follows: F = C(t)−[Ti (t)].
4.2 Optimization
To improve the time accuracy and energy efficiency of the proposed proto-
col further, we have conducted an optimization process using a genetic algo-
rithm [2]. The optimization amounts at calibrating the PI controller parameters
3
By clock drifting we refer to the deviation of a sensor’s time from the physical clock
of the master node.
8 J Boudjadar et al.
(Kp , Ki , F ), so that optimal starting and result values are identified by which a
lower package count will be used for synchronization, i.e. minimize the amount
of sync packets needed before an actual drifting error occurs. Kp dictates how
much the controller should correct for the proportional error. Ki controls how
much of the previous error to correct for, and F is an integrator starting value
used to track the constant error.
200
0
Drifting time
-200
-400
Simulation time
0 100000 200000 300000 400000 500000
The genetic algorithm works by taking a random starting sets of values for
the control parameters and parsing them through a fitness function. In fact, the
fitness function weights the resulting errors for different parameter values. Such
a function is defined as follows:
Wi = |u(t)|.Count(t)
where Count(t) is the number of synchronization packets to send in order to
reach a satisfying synchronization between the sensor time and the master node
clock. The optimization results and sketch code are presented in Sections 5 and
6 respectively.
Python simulations are used to analyze the time accuracy improvement through
optimization.
Without using any time synchronization mechanism, we can see that the
drifting error of a sensor can reach up to 400ms (Figure 6). Using combinatorial
testing of VDM [3], we succeeded to prove that the drifting obtained for our
protocol satisfies the baseline requirement. The drifting can either be positive or
negative.
10
-10
Time error
-20
-30
-40
-50
-60
Simulation time
0 100000 200000 300000 400000 500000
In fact, the drifting of our protocol is far below that requirement and does
not exceed 66ms (Figure 7).
0.8
Probability [%]
0.6
0.4
0.2
0.0
-1.00 -0.75 -0.50 -0.25 0.0 0.25 0.50 0.75 1.00
Clock error [time units]
10 J Boudjadar et al.
t0 − t
EiT (t, t0 ) = It .
Tm
Time Synchronization for Intelligent Sensor Systems 11
In similar way, the energy consumed during Receive phase EiR is calculated
as follows:
t0 − t
EiT (t, t0 ) = Ir .
Tr
where Ii is the energy consumption for receiving a single packet and Tr is the
time duration to receive the packet. We assume that during Transmit and Receive
phases, the sensor is active exactly for the time duration to send, respectively
receive, packets without waiting time between the different packets. As for Mea-
sure phase, the energy consumption is calculated as the consumption rate per
sample (Im ) times how many samples, obtained by the sampling duration on the
sampling frequency H.
t0 − t
EiM (t, t0 ) = Im .
1/H
3.0
2.5
Power [mA]
2.0
1.5
1.0
0.5
1.50
1.25
Power [mA]
1.0
0.75
0.50
0.25
7 Conclusion
References
1. European Commission.: NZEB Buildings. https://ec.europa.eu/energy/topics/
energy-efficiency/energy-efficient-buildings/nearly-zero-energy-buildings en
2. Jayachitra, A. and Vinodha, R.: Genetic algorithm based PID controller tuning
approach for continuous stirred tank reactor. Advances in Artificial Intelligence,
2014
3. T. Kulik, P. W. V. Tran-Jørgensen, J. Boudjadar and C. Schultz: ”A Framework
for Threat-Driven Cyber Security Verification of IoT Systems.” 2018 IEEE Inter-
national Conference on Software Testing, Verification and Validation Workshops
ICSTW, pp. 89-97.
4. Crowe, J. and Johnson, M.: Phase-Locked Loop Methods and PID Control. Springer
Publisher, pp. 259-296. 2005
5. Wang Ting, Cai Chun-yang, Guo Di, Tang Xiao-ming, Wang Heng.: Clock Synchro-
nization in Wireless Sensor Networks: A New Model and Analysis Approach Based
on Networked Control Perspective. Mathematical Problems in Engineering, vol 19.
2014
6. Ranganathan Prakash, Kendall Nygard.: Time Synchronization in Wireless Sensor
Networks: A Survey. International Journal of UbiComp 1(2), 2010
7. M. Banaei, M. Rafiei, J. Boudjadar and M. Khooban: ”A Comparative Analysis
of Optimal Operation Scenarios in Hybrid Emission-Free Ferry Ships.” In IEEE
Transactions on Transportation Electrification, vol. 6, no. 1, pp. 318-333, 2020.
8. Rastislav Ingeli, Miroslav Cekon.: Analysis of Energy Consumption in Building with
NZEB Concept. In Applied Mechanics and Materials 824:347-354, 2015
9. M. Rafiei, M. Khooban, M. A. Igder and J. Boudjadar: ”A Novel Approach to
Overcome the Limitations of Reliability Centered Maintenance Implementation on
14 J Boudjadar et al.
the Smart Grid Distance Protection System.” In IEEE Transactions on Circuits and
Systems II: Express Briefs, vol. 67, no. 2, pp. 320-324, 2020.
10. M. Gheisarnejad, J. Boudjadar and M. Khooban: ”A New Adaptive Type-II Fuzzy-
Based Deep Reinforcement Learning Control: Fuel Cell Air-Feed Sensors Control.”
In IEEE Sensors Journal, vol. 19, no. 20, pp. 9081-9089, 2019.
11. Anna Magrini, Giorgia Lentini, Sara Cuman, Alberto Bodrato, Ludovica Marenco.:
From nearly zero energy buildings (NZEB) to positive energy buildings (PEB): The
next challenge - The most recent European trends with some notes on the energy
analysis of a forerunner PEB example. In Developments in the Built Environment,
Volume 3, 2020
12. Anna Magrini, Giorgia Lentini.: NZEB Analyses by Means of Dynamic Simulation
and Experimental Monitoring in Mediterranean Climate. In Energies Journal, vol
13. 2020
13. Cao, X.; Dai, X.; Liu, J.: Building energy-consumption status worldwide and the
state-of-the-art technologies for zero-energy buildings during the past decade. En-
ergy Build. 2016, 128, 198213
14. Van de Putte, S.; Bracke,W.; Delghust, M.; Steeman, M.; Janssens, A. Compar-
ison of the actual and theoretical energy use in nZEB renovations of multi-family
buildings using in situ monitoring. E3S Web Conf. 2020
15. Anwar Ul Haq, Hans-Arno Jacobsen.: Prospects of Appliance-Level Load Monitor-
ing in Off-the-Shelf Energy Monitors: A Technical Review. In Energies Journal, vol
11, 2018
16. ReMoni.: Clamp-on IoT Sensors https://www.remoni.com/products2/
product-overview/
17. Elson, Jeremy Girod, Lewis Estrin, Deborah.: Fine-Grained Network Time Syn-
chronization using Reference Broadcasts. ACM SIGOPS Operating Systems Review.
Vol 36, 2002.
18. Ganeriwal, Saurabh Kumar, Ram Srivastava, Mani.: Timing sync Protocol for
Sensor Networks. SenSys03: Proceedings of the First International Conference on
Embedded Networked Sensor Systems.
19. Li, Fen He, Guanghui Wang, Xu.: An Improved Hybrid Time Synchronization
Approach in Wireless Sensor Networks for Smart Grid Application. In HPCC con-
ference 2015.
20. Ki-Hyeon Kim, Won-Kee Hong, Hiecheol Kim.: Low Cost Time Synchronization
Protocol for Wireless Sensor Network. IEICE Transactions on Communications 92-
B(4):1137-1143. 2009.
21. Al-Shaikhi, Ali. (2018). Accuracy-Enhanced Time Synchronization Method for
WSNs Using Average Consensus Control. Proceedings of International Multi-
Conference on Systems, Signals and Devices. 2018.
22. Nan Xiong, Minrui Fei, Taicheng Yang, Yu-Chu Tian.: Randomized and Efficient
Time Synchronization in Dynamic Wireless Sensor Networks: A Gossip-Consensus-
Based Approach. Complexity Journal, vol. 2018
23. Upadhyay, D., Dubey, A.K. Santhi Thilagam, P. Time synchronization problem of
wireless sensor network using maximum probability theory. Intl J Syst Assur Eng
Manag 9, 517524 (2018).