Fault-Tolerant Temperature Control Algorithm for IoT Networks in Smart Buildings

The monitoring of the Internet of things networks depends to a great extent on the availability and correct functioning of all the network nodes that collect data. This network nodes all of which must correctly satisfy their purpose to ensure the efficiency and high quality of monitoring and control of the internet of things networks. This paper focuses on the problem of fault-tolerant maintenance of a networked environment in the domain of the internet of things. Based on continuous-time Markov chains, together with a cooperative control algorithm, a novel feedback model-based predictive hybrid control algorithm is proposed to improve the maintenance and reliability of the internet of things network. Virtual sensors are substituted for the sensors that the algorithm predicts will not function properly in future time intervals; this allows for maintaining reliable monitoring and control of the internet of things network. In this way, the internet of things network improves its robustness since our fault tolerant control algorithm finds the malfunction nodes that are collecting incorrect data and self-correct this issue replacing malfunctioning sensors with new ones. In addition, the proposed model is capable of optimising sensor positioning. As a result, data collection from the environment can be kept stable. The developed continuous-time control model is applied to guarantee reliable monitoring and control of temperature in a smart supermarket. Finally, the efficiency of the presented approach is verified with the results obtained in the conducted case study.


Introduction
The advances in communications techniques, network topologies and control methods, have contributed to the development of Networked Control Systems (NCSs), expanding their possibilities.As a result, in the last several decades, NCSs have received considerable attention form the scientific community, mainly due to their wide-ranging application possibilities [1].Once an Internet of Things (IoT) network is formed by multiple IoT nodes, controller or actuator nodes, it is feasible for them to capture data from a large range of existing structures.However, when the accuracy of IoT nodes is reduced, the data they capture is faulty and causes inappropriate decisions.Therefore, it is critical to increase the ability of the IoT network to detect IoT nodes which are not operating properly [2].This work introduces a new predictive temperature control algorithm for fault tolerant detection of a large number of IoT nodes, providing an efficient temperature control.The implementation of a system to control and monitor the precision states of the IoT nodes will ensure reliability of the data captured by the IoT network.The discrete time control focuses on system efficiency at a discrete time range rather than a continuous time range.The discrete-time control issues, such as linear systems have been investigated.Amato et al. deal with the finite-time stabilization of continuous-time linear systems is considered.The main result provided is a sufficient condition for the design of a dynamic output feedback controller which makes the closed loop system finite-time stable [3,4].Therefore, Polyakov et al. consider the control design problem for finite-time and fixed-time stabilizations of linear multi-input system with nonlinear uncertainties and disturbances, so the robustness properties of the network are improved [5].The works presented above show that the quality of any linear control algorithm is estimated by different performance indices such as robustness with respect to disturbances.Although these authors make their study in discrete time, the algorithm we have developed is an important starting point.Meanwhile, the studies on the discrete-time control of nonlinear system have also been carried out for triangular systems [6] or nonlinear dynamical networks [7].These two papers have a different approach to the problem of discrete-time control.Korobov et al. solve the issue of global stabilization in finite-time for a general class of triangular multi-input multi-output (MI MO) systems with singular input-output links combining the controllability function method with a modification of the global construction.Hui et al. focus on the analysis of semistability and stability in finite time and on the synthesis of systems with a continuous equilibrium.These two approaches address the problem of control in nonlinear systems in very specific cases of triangular and semi-stable systems.Although these are two rather limited case studies, they give a very good focus on how to deal with nonlinear control problems.Discrete-time control techniques have been applied for many practical applications, for instance, multi-agent systems [8] and secure communications [9].Both works present a new adaptive fuzzy output feedback control approach composed for a type of nonlinear single input and single output feedback control systems with unmeasured status and input saturation.In these two works, we can see that fuzzy control is a good approach to the problem of nonlinear control, but the authors think that, for this case, it is an invalid technique, since all the control functions of the system are known.Feedback nonlinear systems representing a class of nonlinear control systems have been widely considered [10,11].The problem we address is the topic of predictive maintenance of IoT networks in continuous-time, with the aim of increasing the monitoring and control reliability of IoT networks, as it is done in continuous-time.By using continuous-time Markov chains to predict the future accuracy states of sensors, IoT networks will collect quality data because their nodes will always work in an optimal state.Motivated by the above observation, this paper proposes a new feedback control algorithm to improve predictive maintenance of the IoT networks.The algorithm finds the IoT nodes that do not function correctly and collect false data.To optimize the monitoring and control processes of the IoT network, a novel application of the continuous-time Markov chains is used.We predict the future accuracy states of the IoT nodes and, in case it is predicted that a sensor will become faulty after the time control period has expired, the controller sends a signal that this IoT node has to be replaced.Moreover, if an IoT node has to be replaced, the control algorithm creates a virtual sensor in that position.This virtual sensor estimates the temperature of that sensor based on the temperature of its neighboring nodes.In this way, the IoT network collects data in continuous-time range without any loss of reliability in the data due to malfunctions in the IoT devices.
The problem of data quality and the detecting of incorrect data has been extensively studied [12]; these works search the quality of data applying different techniques as game theory [13] or other types of metrics [14].These articles provide a solid design of how to increase the quality of data; in our opinion, these works are focused on homogeneous data and discrete time; even so, they are an excellent support for our research.The above-mentioned studies on data quality and detection of incorrect data concern discrete time, and the outputs for continuous time systems are quite limited.Actually, continuous time control systems have been applied in a large range of fields, such as feedback control of nonlinear systems [15,16].These papers deal with the stability of discrete-time networked systems with multiple sensor nodes under dynamic scheduling protocols.In fact, this is a great advancement for the stability of nonlinear systems because it addresses dynamic systems with multiple nodes.
In our research, we are using similar techniques for improve fault tolerant control with multiple IoT nodes.Although the work of these authors is in discrete time, the techniques they use are very sophisticated and useful in the field of control theory.Decision-support is an important topic in control theory.Automated trading plays a crucial role in supporting decision-making in bilateral energy transactions [17,18].In fact, a proper analysis of the past actions of opposing traders can increase the decision-making process of market players, allowing them to choose the most appropriate parties with whom to trade in order to increase their performance.Demand-response aggregators were developed and deployed around the world, and more in Europe and the United States.Aggregator involvement in energy markets increases the access of a small resource to them, enabling case studies to be presented for flexibility of demand [19,20].Real-time simulations [21,22] have applications to control theory.In fact, this work analyzes the way in which the players' features are modeled, particularly in their small-scale performance, thus simplifying the simulations while preserving the quality of the results.Authors also carried out a comparative analysis of the real values of the electricity market with the market results obtained from the scenarios generated.In [23,24], Zhang et al. proposes a new time-delay communications algorithm based on adapted control.Although in our research we have used a control algorithm based on feedback, we think that a possible improvement of our proposal is that the control algorithm is adaptive.This article is a good example of how to use adaptive control to stabilize a system.In addition, control theory has several applications in the field of demand response.In [21,25], the authors propose an algorithm to predict demand response based on a simplex optimization method.Although this is a nice approach to solve this kind of problem, we think that this approach can be optimized for its application to control theory.However, some problems related with the above topics can be solved using neural networks [26].In other areas such as supply chain [27,28], fraud detection [29] and edge/fog computing architectures [30], control techniques are beginning to be applied to optimize processes.Control algorithms face the following challenges in the field of temperature data quality and predictive maintenance of IoT networks.
1.For the fault tolerant control in continuous time, solving differential equations with complex conditions and boundaries that change in every loop is needed.2. Algorithms that improve data quality and detect incorrect data can lead to false positives.
It is essential to differentiate between a hot (cold) temperature point and a faulty IoT node.
In this paper, we address research gaps in the supervision and control of continuous time networked systems with multiple IoT devices.Our goal is to present an optimized control algorithm to achieve maximum efficiency in fault tolerant control.A unified model of a continuous time hybrid control system is presented along with a data quality and incorrect data recognition algorithm and a feedback control algorithm to provide prediction of the accuracy status of the IoT nodes.The output of the data quality algorithm is the input of the predictive feedback control algorithm.The main contribution of this paper can be summarized as follows: 1. To the best of our knowledge, the suggested method provides efficient feedback control for the continuous time system model regarding detection of incorrect data or malfunction of IoT devices.2. A new way of predicting IoT node accuracy states from error measurements and, through the Markov continuous time chains, algorithm predict future IoT node accuracy states in continuous time.

A novel control algorithm capable of integrating the above contributions to provide an innovative
IoT network temperature control mechanism.
The efficiency of the presented approach is illustrated by a numerical case study.Preliminary results on the improvement of data quality and detection of wrong date in WSNs have been presented in the work of Casado et al. [13].
The rest of the paper is organized as follows.Section 2 shows the procedure of the control algorithm design in this paper.A case study is shown in this section and simulation studies are performed in Section 3. Finally, Section 4 concludes this paper.

System Model
This section presents the control algorithm that we have developed.The control algorithm is a hybrid of two other algorithms: (1) Cooperative control algorithm (Section 2.1).This algorithm receives the data collected by the IoT network and increases the quality of the data by searching and self-correcting false data.The output variables of this algorithm are the input variables of the following algorithm; (2) accuracy state prediction algorithm (Section 2.2).This algorithm implements a predictive maintenance system to make the IoT network more robust.Figure 1 shows the model described in this paper, where is the measurement error that temperature IoT node are allowed to have.u (t+k) is the controller function, this function detects if an IoT node is faulty or operates correctly at time t + k (i.e., t is the current algorithm step time, while k is a time interval that we want to control.In this way, t + k is the time interval that elapses from the current time t).z (t+k) is the prediction accuracy states function; this function predicts the accuracy state of IoT nodes in the time window t + k (i.e., we know the accuracy state of the IoT nodes at time t, so this function gives us the most probably precision state in time t + k).f (t) is the feedback function at time t.The algorithm proposed in this paper controls the temperature of a smart building.For this purpose, data collected in time t from the IoT network is the input of the algorithm (i.e., T (t) i in blue block).The cooperative control algorithm forms coalitions of neighboring IoT nodes to detect incorrect data and thus auto-correct temperature.This first part of the proposed algorithm calculates the difference between the collected temperature collected by the IoT network and the optimal output temperature of the cooperative control algorithm.Then, this calculated error (i.e., T (t) e ) in time t is sent to the controller as input of the prediction step.The prediction step resolves the Markov strings in continuous-time resulting in the probability that the IoT nodes have the same error that in time t or this error will change.Forecasts of the accuracy state of the IoT nodes are sent to the actuator (i.e., thermostats) to set the process (i.e., smart building) temperature.From the controller, there are two send signals: (1) Since t is the current time in the current loop, assume that k is the time interval to be determined; z (t+k) predicts the accuracy of the IoT nodes at the end of the time interval t + k.
(2) The second signal that comes out of the controller u (t+k) determines which IoT nodes need to be repaired and which are operating correctly.The process sends the final temperature coming out of the algorithm to the feedback function that compares the prediction of the accuracy states with the new temperature inputs of the algorithm and corrects the error in the predictions for the next step of the algorithm.

Cooperative Control Algorithm
The cooperative control algorithm is located in the reference input.The cooperative control algorithm requires the data to be in a matrix.The input of this algorithm is the temperature collected by the IoT network of the smart building.This data has a transformation process until it is in the correct form so that the algorithm can process it.The IoT nodes collect the data as follows, IoT node places in: s (i,j) have the following temperature: t s (i,j) .The other IoT nodes behave in a similar way.Therefore, the first transformation that data has is to place them in an ordered mesh from point (1, 1) to point (n, n) so that each of these points matches the position of the smart nodes.It is easy to create a matrix from the mesh and apply the cooperative control algorithm to it.If we have a mesh with n sensors ordered from (1, 1) to (n, n), a matrix shown in Equation ( 1) is created without loss of generality:

Mathematical Description of the Algorithm
Let n ≥ 2 be the amount of players in the game, ordered from 1 to n, and let N ={1, 2, ..., n} be the group of players.A coalition, S, is formed to be a subgroup of N, S ⊆ N, and the group of the whole coalitions is called by S. A cooperative game in N is a function u (characteristic function of the game) that applies to every coalition S i ⊆ S a real number u(S i ).Moreover, one of the conditions is that u(∅) = 0.In this case, the game will be non-negative (the outputs of the characteristic function are always positive), monotonous (if there are more players in the coalition, the expected characteristic function value does not change), simple and 0-normalized (the players are required to cooperate with one another, as each player will obtain no profit on his own).
In this case, the group of players is the group of organized IoT nodes S and the characteristic function u is denoted as: so that, for every coalition of nodes, u = 1 or 0 according to a particular coalition can vote or not, respectively (see Equantions ( 2) and (3)): where R are the Real numbers.

Cooperative IoT Nodes Coalitions
The potential for IoT nodes to form coalitions will be restricted by their location, i.e., coalitions can only be composed of neighbouring IoT nodes.Let us consider the matrix of the IoT nodes and a pair of IoT nodes s i,j and s k,m will be in the same neighbourhood if and only if: in other words, if every IoT node to which the game is applicable is the centre of a Von Neumann neighborhood, its neighbors are those who are at a Manhattan range (in the matrix) equal to one.In addition, authorized coalitions have to meet the following conditions: 1. Coalition of IoT nodes have to be in the same neighborhood as presented in Equation (4).
2. Coalitions cannot be formed by a single IoT node.

A Characteristic Function to Find Cooperative Temperatures.
In the suggested game, we want to decide in a democratic way the temperature of the current IoT nodes.To do this, the IoT nodes will create coalitions that will determine the final temperature of the IoT nodes, which will be decided by whether or not they can vote in the election process.From the characteristic function defined in Equation ( 2), if the value is 1(0), the coalition can vote (not vote) respectively.Assume that s i is the master IoT node with its related temperature t s i , the characteristic function is built in the following way: 1. First, the average temperature of all the IoT node is calculated: Here, T 1 s i represents the average temperature of the IoT node' neighbourhood s i (including it) in the first iteration of the game and V is the amount of neighbours in the coalition.2. The next iteration is to compute an absolute value for the temperature difference between the temperatures of each IoT node and the average temperature: 3. Using the differences in temperature values with regards to the average temperature T k s i (see Equation ( 6)), a confidence interval is created and defined as follows: In Equation (7), we use the Student'st-distribution with a significance level of α = 1%.4. In this step, we use a hypothesis test.If the temperature of the sensor lies in the interval I k s i , it belongs to the voting coalition; otherwise, it is not in the voting coalition.Once the confidence interval is calculated, the algorithm runs the characteristic function of the game (u k ) to find which elements will be in the voting coalition: 5. The characteristic function will repeat this process iteratively (k is the number of the iteration) until all the IoT nodes in that iteration belong to the voting coalition.In the cooperative game theory, the Payoff Vector (PV) is the outcome of cooperative actions carried out by coalitions (i.e., the output of applied the characteristic function to the coalitions).At each iteration k, the following PV of the coalition is available S j (with 1 ≤ j ≤ n where n is the number of sensors in the coalition) in step k (PV(S k j )): The stop condition of the game steps is PV(S k j ) = PV(S k+1 j ), at which the algorithm ends.
That is, let PV(S k j ) = (u k (s 1 ), . . ., u k (s n )) and let PV(S k+1 j ) = (u k+1 (s 1 ), . . ., u k+1 (s n )).The step process ends when both payoff vectors contain the same elements.This process is shown in the following equation: Then, the game can find the solution that is shown in the following subsection.

Solution of the Cooperative Game
Once the characteristic function has been applied to all IoT nodes involved in this iteration of the game, a payoff vector is available in iteration k (see Equation ( 9)).Since the proposed game is cooperative, the solution is a coalition of players that we have called game equilibrium (GE).The GE of the proposed game is defined as the minimal coalition with more than half of the votes cast.Let n be the amount of players in this iteration of the game.The winning coalition has to comply with the following conditions: 1.The sum of the elements of the coalition PV must be higher than half plus 1 of the votes cast: 2. The coalition is maximal (i.e., coalition with the greatest number of elements, different from 0, in its payoff vector PV(S k j )).
Therefore, the solution to the proposed game is the coalition, from among all possible coalitions that are formed at each step k of the game, that satisfies both conditions.

Temperatures of the Winning Coalition
Once the characteristic function finds which is the winning coalition, it is possible to compute the temperature of the main IoT node.Let {s 1 , . . ., s j } be the winning coalition's IoT node and {t s 1 , . . ., t s j } be their related temperature.
The temperature that the game has voted to be the main IoT node's temperature (MST) is computed as follows: where |S| is the amount of elements in the winning coalition.Therefore, the MST will be the maximum temperature that has the highest involved frequency.In the case of a draw, it is resolved by the Lagrange criterion.

Diffuse Convergence
There is a temperature matrix at each game iteration (see Equation ( 1)).Hence, we define a sequence of arrays {M n } n∈N where the M i element corresponds to the temperature matrix in step i of the game.Therefore, it can be said that the sequence of matrices is convergent if: That is, if the element m i−1 n,m ∈ M i−1 and the element m i n,m ∈ M i are set and the convergence criterion is applied, we have: Therefore, by applying the criterion of convergence in Equation ( 14) to all the elements, a new matrix is obtained; it calculates the difference in the temperatures obtained in the game's previous step and those obtained in the current step: For the succession of matrices to be convergent, each of the sequences of elements that are formed with the |m i−1 n,m − m i n,m | must be less than the fixed > 0. In this work, it is established that = 0.01.With the definitions provided above, we are now ready to define the diffuse convergence of the game.The game is diffuse convergent if at least 80 % of the elements of the matrix are convergent; then, the game reaches the equilibrium.

Accuracy State Prediction Algorithm
In this subsection, we propose a new feedback control algorithm for predictive fault tolerant control to improve the monitoring and control of the IoT networks.Section 2.2.1 presents the accuracy state categories of IoT nodes.The predictive algorithm is based in the continuous-time Markov chains, and, in our model, we compute the solution of this equation in Section 2.2.2.We provide the theoretical solution of the Markov chains (i.e., the transition matrix).Finally, in Section 2.2.3, the elements of the algorithm are shown (i.e, controller, feedback and process).

Initial Accuracy State
Initially, it is necessary to define a scale of accuracy degradation expressed in percentages.This is done according to the data obtained by the algorithm that we had developed in previous research [13].This scale will be the discussion universe of the random variable X n that defines the current state of precision of the system related to the error of the sensors.Therefore, the sensors' possible states are X n = {A = high accuracy, B = accurate, C = low accuracy, F = f ailure}.Below, Table 1 has the selection made for each variable.f be the final temperatures, obtained after applying the data quality algorithm.Then, the accuracy error matrix of the sensors, according to the data quality algorithm, is given by the following equation: where the coefficients e ij of the matrix e are the differences between the initial and final temperature in absolute value for each sensor.
Given the T

(t)
e matrix, we now apply the error correction given by the allowed error margin , and adjust the error matrix: Now, let's centralize these measures to calculate the states of the sensors.To this end, we calculate the average of the elements of the array m and the maximum of the array T (t) that we call max .
Therefore, the centralizing measure is defined as: This measure is applied to the matrix T (t) to calculate the percentages associated with each error and therefore calculate the states of each sensor: Then, one can define the following function in order to estimate the accuracy state of the sensors in time t.For this purpose, we use the Solution of Kolmogorov's differential equations to design this function: defined as follows: where t i,j ∈ T (t) δ , and let T g(t) be the matrix with the accuracy states of the sensors at time t.

Transition Matrix
Let λ A be the time the sensor remains in state A (exponential distribution).λ B and λ C are defined in a similar way.In addition, let ξ A be the time the sensor that remains in state A. Let µ A (µ B , µ C ) be the probability that a sensor in state A (B, C) at time t shifts to state F in the time interval (t, ∆t + t).Thus, if the sensor was in state A at time t i , the probability of the sensor remaining in state A at time t i+1 is given by the following equation: Similarly, the probability that a sensor in state A at the beginning will shift to state B is given by the following equation: In this way, we can build the transition matrix between t and t + ∆t, where the coefficients of the transition matrix are the probabilities of the sensors' switching states (e.g., p AF is the probability that a sensor in state A at the beginning will eventually shift to state F in the interval (t, ∆t + t)).
In this way, the transition matrix P(t) is built:

Predictive Control Algorithm
Here, we describe how the control algorithm works.This algorithm is used by the sensor control system to monitor and control the accuracy of the sensors.In Figure 1, the set point (green arrow) with the reference inputs contain the following variables: (1) The accuracy error matrix, T e (see Equation ( 16)).This matrix has the precision errors of the mesh of sensors.For each step of the algorithm at every time t, this matrix is introduced to update the data of the algorithm.( 2) The allowed error .This parameter enters the flow in each of the steps of the algorithm.

Controller
The first action performed by the controller is the prediction step.
In this stage of the algorithm, the transition matrix of the developed model is used (see Equation ( 24)).Let z (t) : T g(t) −→ z (t) (T g(t) ) = T z(t+k) be the prediction function of accuracy states (i.e., Prediction step) for each time t and let t + k where k ∈ {1, 2, • • • } be the predicted time.Given t δ i,j ∈ T δ , the controller function u is defined as follows: Let z (t) (T g ) = T z(t+k) be the matrix of the states of accuracy given by the prediction function.The output of this function is the accuracy state of the sensors at time t.
The next step of the algorithm is to compare the measurements with the feedback function in order to update them.Let x (t) : T z(t) xT f (t−k) −→ x (t) (T z(t) ) = T x(t) be the comparison function defined by the following numerical values {A = 1, B = 2, C = 3, F = 4} as follows: where w x n (t) with n ∈ {1, 2} are the weights given for each of the coordinates of the function x.Let y (t) : T x(t) −→ y (t) (T x(t) ) = T y(t) be the update function defined as follows: The update function refreshes the accuracy states of the prediction function with the results obtained from the comparison function.
Let u : T y(t) −→ u (t) (T y(t) ) = T u(t) be the controller function (i.e., output estimate step) and let T u(t) be the system controller matrix at time t.Then, this function finds sensors that are in faulty state (F).In this way, the system creates a virtual sensor to maintain system monitoring.In addition, it will send a request to the service staff to replace the malfunctioning sensor.Given t y(t) i,j ∈ T y(t) , u is defined as follows: Thus, if u(y (t) ) = 1, the system creates a virtual sensor in the position (i, j) and requests maintenance.

Feedback
Let h (t) : T g(t) xT g(t+k) xT z(t+k) −→ h (t) (T z(t+k) ) = T h(t) be the auxiliary feedback function.Given k ∈ {1, 2, • • • } and the accuracy states in numerical values are {A = 1, B = 2, C = 3, F = 4}, h is defined as follows: where w h n (t) with n ∈ {1, 2, 3} are the given weights for each of the coordinates of the function h.Let f (t) : T h(t) −→ f (t) (T h(t) ) = T f (t) be the feedback function defined as follows: The feedback function returns the accuracy state of the sensor (i, j) back to the flow.In this way, it is verified that the controller is working correctly and that virtual sensors are not created for the repair of sensors that are working properly.

Process
The process matrix T p(t) shows when sensors need maintenance.The process matrix is defined as follows: Thus, when the coefficient of the matrix corresponds to a particular sensor, it means that it has to be replaced t p(t) (i,j) ≥ 0.5%t max time periods with t p(t) (i,j) ∈ T p(t) (i.e., assuming that t max = 5 years, then a sensor has to be replaced if t p(t) (i,j) ≥ 9 days ).Then, the controller function sends a signal to the process which sends back the matrix of final virtual temperatures at time t (i.e., T (t) v f ).When the controller sends the signal that a sensor is in the state of failure, the process creates a virtual sensor in that position and simulates the temperature so that the monitoring and control of the building does not lose efficiency.Let {T (t) f } t≥0 be the matrix succession with the final temperatures at time t given by the algorithm described in Casado et al. [13].
Moreover, let VS (t) i,j be the virtual sensor in the position (i, j) at time t.Then, the temperature of the t v i,j is provided by the temperature t i,j ∈ T (t) f .

Results
In this section, we present the case study and the results obtained during the experiment.The control algorithm gets data collected by the IoT nodes and auto-corrects the faulty data.Furthermore, in case the controller predicts that an IoT node will be in fault state, it will create a virtual temperature sensor in order to keep the reliability of the IoT network.In this way, the monitoring and control efficiency of the IoT network is improved.This section is organized as follows: In Section 3.1, we provide the solution of the continuous-time Markov chain and its transition matrix (P(t)) for every t.Section 3.2 shows the experimental details of the case study (i.e., hardware, temperature collected, etc.).Finally, Section 3.3 presents the results of the application of the control algorithm in the case study and the error decrease in the IoT nodes.

Case Study Experimental Setup
This case study supposes that the IoT nodes (i.e., temperature sensor) can undergo four accuracy states throughout their useful life (A = high accuracy, B = accurate, C = low accuracy, F = failure).The probability that a sensor in state A at instant t shift to state F in the time interval (t, t + ∆t) is 0.1∆t + o(∆t), if it is in state B it is 0.2∆t + o(∆t) and if it is in state C it is 0.5∆t + o(∆t).In this simulation, we assume that the time during which the sensors remain in state A is an exponential time of 2.1 in state A and 1.2 in state B.
From A in a time interval (t, t + ∆t), the sensor can pass to F with probability 0.1∆t + o(∆t).If ξ is the time the sensor stays at A, you have: Therefore, Equation ( 32) is the probability of remaining in state A at instant t i+1 if it was in A at instant t i .Then, the probability of shifting to B between t and t + ∆t is In the successive stages, we finally reach a calculation in which the transition matrix is between t and t + ∆t, as shown in Table 2.
Table 2.In this simulation, we have assumed that state F is absorbent.That is, for the sensor to move from F to any other state, it needs to be repaired by a maintenance worker.
Thus, the derivative of the matrix in the zero is: which may be expressed using the Jordan matrix form for the whole period of time t as follows: For example, the term p AF (t) represents the probability that a sensor that begins its useful life at stage A functions incorrectly at time t, so: In Figure 2, the graphical representation of the Markov chain is presented.Probabilities of changes in the accuracy states of the sensors are shown in Table 2.The instance simulation presented in this section demonstrates that sensors in any of the precision states (i.e., A,B,C) can move to the fault state (F)-while from state A it goes to state B, and from state B to state C.This is so, since, in this example, we assume that the sensor from any of its precision states can fail, while we assume that a high accuracy sensor (A) has to go through the precise state (B) before moving to the low accuracy state (C).Given the Markov chain used for this simulation with transition matrix given by Equation (35), the stationary paths given by the probabilities of change of precision state of the sensors are shown in Figure 2.This figure illustrates the probability that a sensor's initial accuracy, state A, will shift to a different state in time t.Let's assume that t max = 5 years (i.e., lifespan of the sensor is five years), then, at t = 0, the probability that the sensor remains in state A is 1, while, at t ≥ 0, the probability that the sensor remains in state A decreases.Thus, the greater the value of t , the greater the probability that a sensor changes to state B, C and F, respectively.For t −→ ∞, the accuracy state F of the sensor has a probability of 1 (i.e., the sensor is in failure state) [31].

General Description of the Experiment
To validate the proposed algorithm, we have selected a smart building.In the moment that the IoT nodes measured the temperature, the actuator (i.e., thermostat) in the selected building showed 23 • C. A grid was applied to locate the IoT nodes on the ground.With the assistance of laser measurements, the IoT nodes were vertically positioned in each section of the building.A total of 25 IoT nodes were deployed.
A combination of the ESP8266 microcontroller in its commercial version "ESP-01" was the type of sensor deployed in the building and a DHT11 temperature and humidity IoT nodes (Figure 2).The sum of the two allows us more versatility in data gathering and adaptation to the case study, as the DHT11 sensor is specifically designed for indoor environments (it has an operating range of 0 • C to 50 • C) according to its datasheet [32].The microcontroller obtains the data of this IoT nodes through the onewire process and transmits it to the surroundings through Wi-Fi by using HTTP protocols and GET/POST petitions.The ESP-IDF scheduling system supplied by the microcontroller maker was used to schedule the device.
The temperature sensors had been collecting data at 15 minute intervals, for an entire day.For the analysis, we selected the data collected by the sensors in the following time interval 2018-11-02T08:30:00Z and ended on 2018-11-02T21:30:00Z.A particular point in time has been chosen because the game is static and not dynamic (in other words, the game does not handle data in a time period).Below, a mathematical overview of the measured values with the IoT nodes is provided in Table 3.We assume that t = 5 years, so if we want to find an interval of one day, we have to do some transformation in t.In this experiment, we have considered the next time interval (t, t + ∆t), a year has 365 days, and 5 years has (365 • 5) days, so an interval of one day in five years is written as follows: ∆t = 1 365•5 (i.e., a day).To validate the model, we applied the accuracy state prediction model to the data collected by the sensors placed in the building.

Case Study Results
In this case study, we have tested the proposed model to increase the efficiency of monitoring and control of an IoT network.This is achieved by improving the quality of data collected by the IoT nodes and the predicted maintenance of these nodes.In this way, the reliability of the data is increased and the energy efficiency of the smart building is increased.The temperature collected by the IoT nodes is the input of the control algorithm.In Figure 3, the evolution of the temperature can be found from its initial state (i.e., data collected by the IoT nodes) until the control algorithm sends the data to the process to set the regulators that control the temperatures of the building sections.The building temperature is slightly warmer in areas where there are large temperature differences.The control algorithm finds these zones and self-corrects if necessary these temperatures to reach the equilibrium in which the temperatures are consistent in the whole building.Graphic representation of the matrix of initial temperatures, the evolution of the temperature and the final temperatures in this case study.In Figure 3 (1) can be found the temperatures collected by the IoT nodes.In addition, the measurements that the control algorithm will find as false data can be found in the same figure.Also, the evolution of the controlled temperature is shown in Figure 3 (2)-( 5).Final temperatures after the control algorithm is executed are shown in Figure 3 (6).
The suggested algorithm performs an efficient transformation in the ETL system.We can implement our approach as a process step included in the ETL system for the creation of new temperature data, which are self-corrected and ready-to-use.A major part of the thermal noise caused by the data arriving from the IoT node is removed (noise is generated when the IoT node is faulty or non-accurate).Figure 4 provides the amount of IoT nodes (in percents) containing thermal noise for every step of the game.It can be remarked that, when changing the accuracy of the IoT nodes from 0.05 • C to 0.1 • C, the results achieved are quite distinct.In the display board, the noise of the % in the temperature matrix is shown opposite the amount of steps.For every one of them, the permitted error range for the temperature collected by the IoT nodes is variable.As the allowable error range is increased, the thermal noise in the temperature matrix also is increased.
However, if it changes to 0.05 • C, 45% of the IoT nodes had thermal noise, and, in a few (<10) steps, the noise was decreased to less than 15%.When the relative permitted error was incremented, the percentages of IoT nodes that had a bit of thermal noise also incremented.For instance, with 0.1 • C of relative error, 70% of the IoT nodes had thermal noise and as the step increment was decreased below 25 percent.However, at a certain point, the noise began to freeze.These IoT nodes will keep having some noise for the selected error (Table 4).There are also two useful implementations of our current approach: (1) Identifying the IoT nodes that supply incorrect data and setting up the new IoT node by inserting them in the IoT network; (2) Smart detecting of incorrect data in an IoT network is a major issue, as it allows fault tolerant control of the IoT network and a high quality of data.Furthermore, predictive maintenance allows the good operation of the IoT network.As faulty IoT nodes are detected, the maintenance cost is significantly decreased, as the service technician can focus only on faulty nodes.

Conclusions
This paper has addressed the problem of fault tolerant control of IoT nodes in continuous-time NCSs.The feasibility of the proposed approach was verified with a case study in which the closed-loop system was modeled as a continuous-time feedback system with the continuos-time Markov chains to improve the quality of the data collected by the IoT nodes.Through a newly constructed feedback control-based algorithm, an improved control system has been created.It allows for deriving a smart building's maximum allowable energy efficiency such that the resulting closed-loop system improves the control of an IoT network.A numerical case study illustrates the efficiency of our model in Section 3. Figure 3 shows a graphic representation of the evolution of the temperatures and how the fault tolerant control algorithm works.In this figure, one can find how the incorrect data are self-corrected by the control algorithm, improving the monitors and controls of the IoT network.In addition, in Figure 4, we present the percentage of IoT nodes that are collecting incorrect data and how the control algorithm decreases the amount of malfunction IoT nodes.This claim is also supported by Table 4.In it, you can find that, after applying the control algorithm, the amount of malfunctioning IoT nodes is greatly reduced.However, in many real scenarios, the ability to detect an imprecise or malfunctioning IoT node from a hot (cold) spot is limited.In a future work, we will try to solve this problem with artificial intelligence.

Figure 1 .
Figure 1.This algorithm improves the fault tolerance of the IoT network via the designed control algorithm in the time interval (t, t + k), where k is the interval of time that we want to control.

Figure 2 .
Figure 2. Graphical representation of the Markov chain of the solution of the Kolmogorov differential equations of the proposed simulation.

Figure 3 .
Figure 3. Graphic representation of the matrix of initial temperatures, the evolution of the temperature and the final temperatures in this case study.In Figure3(1) can be found the temperatures collected by the IoT nodes.In addition, the measurements that the control algorithm will find as false data can be found in the same figure.Also, the evolution of the controlled temperature is shown in Figure3(2)-(5).Final temperatures after the control algorithm is executed are shown in Figure3(6).

Figure 4 .
Figure 4. Board with thermal noise reduction in the progression of the algorithm with several confidence intervals from 0.05 • C to 0.1 • C.In the display board, the noise of the % in the temperature matrix is shown opposite the amount of steps.For every one of them, the permitted error range for the temperature collected by the IoT nodes is variable.As the allowable error range is increased, the thermal noise in the temperature matrix also is increased.

Table 1 .
Accuracy state of sensors.

Table 3 .
Statistical table of measurements of the IoT nodes.

Table 4 .
Table showing the possible errors and % of noise both during and after applying the game.