# The Research of Temperature Compensation for Thermopile Sensor Based on Improved PSO-BP Algorithm

Authors: Yuanjiang Li; Yuehua Li; Feng Li; Bin Zhao; QingQing Li
Journal: Mathematical Problems in Engineering
 (2015)

---

## Abstract

When thermopile sensor is used for safety monitoring of equipment in industrial environments, particularly for measuring the thermal radiation information of device, the measured result of this kind of sensor is usually affected by ambient temperature due to its unique structure. An improved PSO-BP algorithm is proposed for temperature compensation of thermopile sensor and correcting the error in the condition of the system accuracy requirements reduced by temperature. The core of improved PSO-BP algorithm is to improve the certainty of initial weights and thresholds that belonged to BP neural network and then train the samples by using BP neural network for enhancing the generalization ability and stability of system. The experimental results show that the proposed PSO-BP network outperforms other similar algorithms with faster convergence speed, lower errors, and higher accuracy.


---

## Body

## 1. Introduction

Condition monitoring of man-made systems is an important task in terms of system maintenance and process automation. In order to keep the security operation of various systems, many scholars have been working on the area of fast identification of faulty components based on various types of sensor data and intelligent evolutionary algorithms, which provides a basis for the fault isolation.In the numerous fault monitoring, temperature is an essential factor about health status of the equipment. For the majority of electrical devices, equipment failure usually leads to temperature increment on the surface of device, which is the omen of short circuit or overcurrent. In particular, the joint position is easy to heat. Instead of the point-to-point temperature-measuring device, we use a real-time device named thermopile sensor for monitoring electrical equipment. Thermopile sensor is equivalent to several point-type infrared sensors, which can provide the distribution of temperature about mini-type area around the target. It turned the thermal radiation information into temperature data based on the theory of black-body radiation. The accuracy of temperature measurement is affected by the radiation information of environment or ambient temperature, which is a typical nonlinear programming problem. Several methods or models are proposed for solving this kind of problems such as expert system [1], artificial neural network (ANN) [2], fuzzy theory [3], and optimization theory [4]. These methods still have some disadvantages. For example, the knowledge base of the expert system is difficult to obtain from the complex working conditions. And the accurate fuzzy rules and membership functions are harder to determine. In the framework of ANN-based method, numerous training samples are closely related to the accuracy of output data. But back propagation (BP) neural network is usually used to solve some application problems based on its unique advantages such as high accuracy and simple operation. So our emphasis is on reducing the uncertainty of initial weight value and threshold of BP neural network for improving its directional generalization ability, which is a typical optimization problem.There are many intelligence algorithms with different performance for solving the optimization problem such as genetic algorithm (GA) [4] and particle swarm optimization (PSO) [5]. Compared with other algorithms, PSO has few parameters to adjust, which is easy to implement. So it is one of the most popular optimization algorithms. Lazzús [6] combined the advantage of BP and PSO for predicting thermal properties of the organic compounds, which can improve the convergence speed and prediction accuracy of the traditional BP network. Zhang et al. [7] and Li and Zhou [8] proposed two kinds of improved PSO algorithm for overcoming shortcoming of the traditional BP network, which can adjust the inertia weight coefficients and learning factors adaptively.In this paper, we propose an improved PSO algorithm based on optimizing the initial weight value and threshold for increasing the generalization ability of BP network. Then the improved PSO-BP algorithm is used to solve the temperature compensation of thermopile sensor. In order to demonstrate the effectiveness of the proposed method, we compare the proposed one with traditional BP and two kinds of improved PSO-BP algorithm [7, 8].The rest of this paper is organized as follows. In Section2, we introduce the basic PSO and the improved PSO algorithm. The improved PSO-BP method is proposed in Section 3; then we regarded some temperature data in the different ambient temperature conditions as the test set. The result and analysis of experiments are shown in Section 4 and the important conclusions are drawn in Section 5.


## 2. Basic and Improved PSO Algorithm

### 2.1. Basic PSO Algorithm

The inspiration of PSO algorithm is derived from the phenomenon of birds’ cluster which solves the problem of continuous variable optimization as its background. In the theoretical framework of PSO, every potential feasible solution is represented as a particle existing in the search space. There are two important variables that belonged to each particle: the position vectorX
i
=
(
x
i
,
1
,
x
i
,
2
,
…
,
x
i
,
n
)
T and velocity vector V
i
=
(
v
i
,
1
,
v
i
,
2
,
…
,
v
i
,
n
)
T. The velocity vector is used to control the speed in which the particle moves towards the optimal solution. Meanwhile, every position vector has correlation with the particle fitness value. In the process of iteration, the particle updates its velocity and positions based on the following equations:(1)
V
i
k
+
1
=
w
V
i
k
+
c
1
k
rand
⁡
P
i
-
X
i
k
+
c
2
k
rand
⁡
P
g
-
X
i
k
X
i
k
+
1
=
X
i
k
+
V
i
k
+
1
,where w is the inertia weight, the larger w is easy to result in global optimization, the smaller one is easy to generate local optimization, and rand
⁡
(
)
∈
[
0,1
]. c
1
(
k
) and c
2
(
k
) are learning factors which represent two kinds of evolution ability such as self-learning and social learning, respectively. P
i
=
(
p
i
,
1
,
p
i
,
2
,
…
,
p
i
,
n
)
T is the best solution and P
g
=
(
p
g
,
1
,
p
g
,
2
,
…
,
p
g
,
n
)
T is the best known position existing in the entire swarm.


### 2.2. Improved PSO Algorithm

#### 2.2.1. The Inertia Weightw

In all kinds of improved algorithms, the inertia weightw occupies an important role in the PSO, which is the balance point between the global and local search ability. For avoiding PSO algorithm into local optimum, different solutions are put forward for updating w. Zhan et al. [9] proposed the following adjustment strategies and Zhang et al. [7] proved its effectiveness:(2)
w
=
w
set
if
d
i
-
d
min
⁡
d
max
⁡
-
d
min
⁡
=
0
w
max
⁡
-
k
k
max
⁡
w
min
⁡
d
i
-
d
min
⁡
d
max
⁡
-
d
min
⁡
if
d
i
-
d
min
⁡
d
max
⁡
-
d
min
⁡
≠
0
,where d
m
a
x and d
m
i
n are the maximum and minimum distance between all particles and optimal particle and d
i is Euclidean distance between the ith particle and the optimal particle, which is defined as(3)
d
i
=
∑
j
=
1
τ
X
i
,
j
-
P
g
,
j
2
,where τ is the dimensions of each particle, X
i
,
j and P
g
,
j are the position value on the jth dimension that belonged to the ith particle and the optimal particle at the k-iteration of PSO, respectively. w
set is a constant. w
m
a
x
-
(
k
/
k
m
a
x
)
w
m
i
n is the linear decreasing function for directed searching of w. k is the number of iterations where k
m
a
x is the maximum value. The update rule based on Euclidean distance shown in (2) has more outstanding performance for enhancing the global search result to some extent. But the computational complexity of searching w is more than O
(
n
2
) which increases the burden of computer. Li and Zhou [8] proposed a simple method for updating w based on the fitness function and proved the effectiveness of selection rules in the framework of PSO-BP algorithm. So we also use the fitness function to revise the formula shown in (2), which is written as follows:(4)
w
=
w
set
if
f
x
i
-
f
x
m
i
n
f
x
m
a
x
-
f
x
m
i
n
=
0
w
max
⁡
-
k
k
max
⁡
w
min
⁡
f
x
i
-
f
x
min
⁡
f
x
max
⁡
-
f
x
min
⁡
if
f
x
i
-
f
x
m
i
n
f
x
m
a
x
-
f
x
m
i
n
≠
0
,where f
(
x
)
i is the fitted value in the current position where f
(
x
)
m
i
n and f
(
x
)
m
a
x are the minimum and maximum values, respectively. In addition, w
set
=
0.4.


#### 2.2.2. Learning Factorsc
1
(
k
) and c
2
(
k
)

The learning factorsc
1 and c
2, called acceleration constants, are responsible for controlling individual cognitive component [
P
i
-
X
i
(
k
)
] and group cognitive component [
P
g
-
X
i
(
k
)
]. Due to the lack of methods and formula, the learning factor is usually determined on a general scope. Li and Zhou [8] utilized formula (1) at the different number of iterations for building a special linear difference equation with constant coefficients and gave the value range of c
1
(
k
) and c
2
(
k
). Let c
1
(
k
)
+
c
2
(
k
)
=
η; the range of w and η is shown as follows [8]:(5)
2
w
-
η
+
2
>
0
-
3
<
w
-
η
<
1
η
>
0
.We suppose an extreme case for narrowing the scope ofη. Let us assume that w is equal to η
/
2
-
1, so the ideal range of η is [
0,4
], which can provide the basis of constant selection about the adjusted equation inspired by Gao and Liao [10]. Two learning factors are updated by using the following criterion [10]:(6)
c
1
k
=
η
d
-
k
d
m
a
x
c
2
k
=
η
-
η
d
-
k
d
m
a
x
c
1
k
+
c
2
k
=
η
η
∈
0,4
,where d
- is the average distance between each particle and the optimal particle at the kth iteration, which is shown as(7)
d
-
k
=
∑
i
=
1
N
∑
j
=
1
r
X
i
,
j
-
P
g
,
j
2
N
,where N denotes the number of the swarm. In addition, Gao and Liao [10] proved that the PSO algorithm ultimately tends to the optimal solution with the help of updating the two factors based on the rule mentioned above. In the proposed algorithm, we also use the rule mentioned above and limit the scope of η, which affects the convergence speed and accuracy. In the subsequent trial, we set η
=
2.


## 2.1. Basic PSO Algorithm

The inspiration of PSO algorithm is derived from the phenomenon of birds’ cluster which solves the problem of continuous variable optimization as its background. In the theoretical framework of PSO, every potential feasible solution is represented as a particle existing in the search space. There are two important variables that belonged to each particle: the position vectorX
i
=
(
x
i
,
1
,
x
i
,
2
,
…
,
x
i
,
n
)
T and velocity vector V
i
=
(
v
i
,
1
,
v
i
,
2
,
…
,
v
i
,
n
)
T. The velocity vector is used to control the speed in which the particle moves towards the optimal solution. Meanwhile, every position vector has correlation with the particle fitness value. In the process of iteration, the particle updates its velocity and positions based on the following equations:(1)
V
i
k
+
1
=
w
V
i
k
+
c
1
k
rand
⁡
P
i
-
X
i
k
+
c
2
k
rand
⁡
P
g
-
X
i
k
X
i
k
+
1
=
X
i
k
+
V
i
k
+
1
,where w is the inertia weight, the larger w is easy to result in global optimization, the smaller one is easy to generate local optimization, and rand
⁡
(
)
∈
[
0,1
]. c
1
(
k
) and c
2
(
k
) are learning factors which represent two kinds of evolution ability such as self-learning and social learning, respectively. P
i
=
(
p
i
,
1
,
p
i
,
2
,
…
,
p
i
,
n
)
T is the best solution and P
g
=
(
p
g
,
1
,
p
g
,
2
,
…
,
p
g
,
n
)
T is the best known position existing in the entire swarm.


## 2.2. Improved PSO Algorithm

### 2.2.1. The Inertia Weightw

In all kinds of improved algorithms, the inertia weightw occupies an important role in the PSO, which is the balance point between the global and local search ability. For avoiding PSO algorithm into local optimum, different solutions are put forward for updating w. Zhan et al. [9] proposed the following adjustment strategies and Zhang et al. [7] proved its effectiveness:(2)
w
=
w
set
if
d
i
-
d
min
⁡
d
max
⁡
-
d
min
⁡
=
0
w
max
⁡
-
k
k
max
⁡
w
min
⁡
d
i
-
d
min
⁡
d
max
⁡
-
d
min
⁡
if
d
i
-
d
min
⁡
d
max
⁡
-
d
min
⁡
≠
0
,where d
m
a
x and d
m
i
n are the maximum and minimum distance between all particles and optimal particle and d
i is Euclidean distance between the ith particle and the optimal particle, which is defined as(3)
d
i
=
∑
j
=
1
τ
X
i
,
j
-
P
g
,
j
2
,where τ is the dimensions of each particle, X
i
,
j and P
g
,
j are the position value on the jth dimension that belonged to the ith particle and the optimal particle at the k-iteration of PSO, respectively. w
set is a constant. w
m
a
x
-
(
k
/
k
m
a
x
)
w
m
i
n is the linear decreasing function for directed searching of w. k is the number of iterations where k
m
a
x is the maximum value. The update rule based on Euclidean distance shown in (2) has more outstanding performance for enhancing the global search result to some extent. But the computational complexity of searching w is more than O
(
n
2
) which increases the burden of computer. Li and Zhou [8] proposed a simple method for updating w based on the fitness function and proved the effectiveness of selection rules in the framework of PSO-BP algorithm. So we also use the fitness function to revise the formula shown in (2), which is written as follows:(4)
w
=
w
set
if
f
x
i
-
f
x
m
i
n
f
x
m
a
x
-
f
x
m
i
n
=
0
w
max
⁡
-
k
k
max
⁡
w
min
⁡
f
x
i
-
f
x
min
⁡
f
x
max
⁡
-
f
x
min
⁡
if
f
x
i
-
f
x
m
i
n
f
x
m
a
x
-
f
x
m
i
n
≠
0
,where f
(
x
)
i is the fitted value in the current position where f
(
x
)
m
i
n and f
(
x
)
m
a
x are the minimum and maximum values, respectively. In addition, w
set
=
0.4.


### 2.2.2. Learning Factorsc
1
(
k
) and c
2
(
k
)

The learning factorsc
1 and c
2, called acceleration constants, are responsible for controlling individual cognitive component [
P
i
-
X
i
(
k
)
] and group cognitive component [
P
g
-
X
i
(
k
)
]. Due to the lack of methods and formula, the learning factor is usually determined on a general scope. Li and Zhou [8] utilized formula (1) at the different number of iterations for building a special linear difference equation with constant coefficients and gave the value range of c
1
(
k
) and c
2
(
k
). Let c
1
(
k
)
+
c
2
(
k
)
=
η; the range of w and η is shown as follows [8]:(5)
2
w
-
η
+
2
>
0
-
3
<
w
-
η
<
1
η
>
0
.We suppose an extreme case for narrowing the scope ofη. Let us assume that w is equal to η
/
2
-
1, so the ideal range of η is [
0,4
], which can provide the basis of constant selection about the adjusted equation inspired by Gao and Liao [10]. Two learning factors are updated by using the following criterion [10]:(6)
c
1
k
=
η
d
-
k
d
m
a
x
c
2
k
=
η
-
η
d
-
k
d
m
a
x
c
1
k
+
c
2
k
=
η
η
∈
0,4
,where d
- is the average distance between each particle and the optimal particle at the kth iteration, which is shown as(7)
d
-
k
=
∑
i
=
1
N
∑
j
=
1
r
X
i
,
j
-
P
g
,
j
2
N
,where N denotes the number of the swarm. In addition, Gao and Liao [10] proved that the PSO algorithm ultimately tends to the optimal solution with the help of updating the two factors based on the rule mentioned above. In the proposed algorithm, we also use the rule mentioned above and limit the scope of η, which affects the convergence speed and accuracy. In the subsequent trial, we set η
=
2.


## 2.2.1. The Inertia Weightw

In all kinds of improved algorithms, the inertia weightw occupies an important role in the PSO, which is the balance point between the global and local search ability. For avoiding PSO algorithm into local optimum, different solutions are put forward for updating w. Zhan et al. [9] proposed the following adjustment strategies and Zhang et al. [7] proved its effectiveness:(2)
w
=
w
set
if
d
i
-
d
min
⁡
d
max
⁡
-
d
min
⁡
=
0
w
max
⁡
-
k
k
max
⁡
w
min
⁡
d
i
-
d
min
⁡
d
max
⁡
-
d
min
⁡
if
d
i
-
d
min
⁡
d
max
⁡
-
d
min
⁡
≠
0
,where d
m
a
x and d
m
i
n are the maximum and minimum distance between all particles and optimal particle and d
i is Euclidean distance between the ith particle and the optimal particle, which is defined as(3)
d
i
=
∑
j
=
1
τ
X
i
,
j
-
P
g
,
j
2
,where τ is the dimensions of each particle, X
i
,
j and P
g
,
j are the position value on the jth dimension that belonged to the ith particle and the optimal particle at the k-iteration of PSO, respectively. w
set is a constant. w
m
a
x
-
(
k
/
k
m
a
x
)
w
m
i
n is the linear decreasing function for directed searching of w. k is the number of iterations where k
m
a
x is the maximum value. The update rule based on Euclidean distance shown in (2) has more outstanding performance for enhancing the global search result to some extent. But the computational complexity of searching w is more than O
(
n
2
) which increases the burden of computer. Li and Zhou [8] proposed a simple method for updating w based on the fitness function and proved the effectiveness of selection rules in the framework of PSO-BP algorithm. So we also use the fitness function to revise the formula shown in (2), which is written as follows:(4)
w
=
w
set
if
f
x
i
-
f
x
m
i
n
f
x
m
a
x
-
f
x
m
i
n
=
0
w
max
⁡
-
k
k
max
⁡
w
min
⁡
f
x
i
-
f
x
min
⁡
f
x
max
⁡
-
f
x
min
⁡
if
f
x
i
-
f
x
m
i
n
f
x
m
a
x
-
f
x
m
i
n
≠
0
,where f
(
x
)
i is the fitted value in the current position where f
(
x
)
m
i
n and f
(
x
)
m
a
x are the minimum and maximum values, respectively. In addition, w
set
=
0.4.


## 2.2.2. Learning Factorsc
1
(
k
) and c
2
(
k
)

The learning factorsc
1 and c
2, called acceleration constants, are responsible for controlling individual cognitive component [
P
i
-
X
i
(
k
)
] and group cognitive component [
P
g
-
X
i
(
k
)
]. Due to the lack of methods and formula, the learning factor is usually determined on a general scope. Li and Zhou [8] utilized formula (1) at the different number of iterations for building a special linear difference equation with constant coefficients and gave the value range of c
1
(
k
) and c
2
(
k
). Let c
1
(
k
)
+
c
2
(
k
)
=
η; the range of w and η is shown as follows [8]:(5)
2
w
-
η
+
2
>
0
-
3
<
w
-
η
<
1
η
>
0
.We suppose an extreme case for narrowing the scope ofη. Let us assume that w is equal to η
/
2
-
1, so the ideal range of η is [
0,4
], which can provide the basis of constant selection about the adjusted equation inspired by Gao and Liao [10]. Two learning factors are updated by using the following criterion [10]:(6)
c
1
k
=
η
d
-
k
d
m
a
x
c
2
k
=
η
-
η
d
-
k
d
m
a
x
c
1
k
+
c
2
k
=
η
η
∈
0,4
,where d
- is the average distance between each particle and the optimal particle at the kth iteration, which is shown as(7)
d
-
k
=
∑
i
=
1
N
∑
j
=
1
r
X
i
,
j
-
P
g
,
j
2
N
,where N denotes the number of the swarm. In addition, Gao and Liao [10] proved that the PSO algorithm ultimately tends to the optimal solution with the help of updating the two factors based on the rule mentioned above. In the proposed algorithm, we also use the rule mentioned above and limit the scope of η, which affects the convergence speed and accuracy. In the subsequent trial, we set η
=
2.


## 3. Improved PSO-BP Flow (IPSO-BP)

BP neural network [11] is a feed-forward network, which is composed of input layer, hidden layer, and output layer. It substantially turns an input/output problem into a nonlinear optimization problem. BP algorithm depends on learning and training a certain amount of samples for determining weights and threshold of the network. Traditional BP network not only requires a large number of iterations but easily falls into local minimum. So we use the improved PSO algorithm to optimize the initial weights and the thresholds of basic BP algorithm and then train the samples for enhancing the generalization ability and stability of BP network. When BP network is used for temperature compensation, the original input is the measured temperature based on the thermopile sensor and ambient temperature; meanwhile, the output of network is the actual temperature of targets. The algorithm flow chart is shown in Figure 1.Figure 1
Flow chart for the improved PSO-BP algorithm.The algorithm steps are shown as follows.Step 1.
Considering the process of initialization such as population sizeN, particle dimension τ, the maximum number of iterations k
m
a
x, the error precision of particles ε, the maximum speed V
m
a
x, and the position X
m
a
x.Step 2.
The initial weights and the thresholds of basic BP algorithm are become a column which are the initial population of PSO algorithm. Suppose the number of initial population isr and the number of initial weights and thresholds is n. x
i
,
n is the initial position of one particle, 0
<
i
≤
r.Step 3.
Initialize the velocity vector of particles. The forward network built by newff is regarded as the fitness functionf
(
x
). The output of f
(
x
) is sim
(
n
e
t
,
In
⁡
), where I
n is the data after normalized calibration [8].Step 4.
Compute the fitness value of every particle and find the best position along with updating particle based on formula (1) until training the best position of the whole particle swarm.Step 5.
Terminal condition: if the fitness value is less than the error precision of particlesε or k
m
a
x is reached, the algorithm terminates; otherwise, go to Step 4.


## 4. Experiment and Analysis

### 4.1. Experimental Platform

The infrared temperature measurement system is shown in Figure2, which consists of temperature sensor DS18B20, infrared thermopile sensor MLX90620, ultrasonic ranging module, and the core processor AT91SAM7S256. The role of components is displayed as follows.Figure 2
Infrared temperature measurement system.DS18B20 is a kind of contact-type chip for targets’ surface temperature measurement. After being demarcated by mercurial thermometer with the accuracy of 0.1°C, the accuracy of DS18B20 reaches ±0.2°C within the limits of [−10°C, +85°C], whose data is used to be the reference data.MLX90620 is the thermopile chip of noncontact temperature measurement, whose data is the aim of compensation. The measuring distance affects the accuracy of MLX90620 seriously, and its maximum distance is 1 m.The ultrasonic module HC-SR04 is used for keeping distance between the sensor and the target which has the accuracy of 0.5%.


### 4.2. Sample Data Acquisition

The experiment was carried out on eight different environmental temperatures, and we use MLX90620 sensor to measure the surface temperature of eight different targets at the same distance, respectively. The sample data is shown in Table1, where AT denotes the ambient temperature based on black ball temperature method that reflected environmental thermal radiation information. Reference and measured data are obtained from DS18B20 and MLX90620, respectively. Restricted by experimental conditions and methods, the range of AT is set to [15°C, 50°C].Table 1
Sample data table.
AT = 15.2°C
Reference data  (°C)
20.5
23.9
26.1
28.7
32.4
Measured data (°C)
24.2
25.2
28.9
31.2
36.0
AT = 19.4°C
Reference data  (°C)
21.4
22.6
25.2
29.2
30.2
Measured data (°C)
23.1
24.7
26.9
30.4
32.3
AT = 26.7°C
Reference data  (°C)
22.2
23.6
24.8
30.4
33.8
Measured data (°C)
24.3
25.9
26.1
31.7
34.5
AT = 30.0°C
Reference data  (°C)
20.2
21.6
24.2
25.3
32.8
Measured data (°C)
22.9
23.9
26.4
27.6
33.8
AT = 35.2°C
Reference data  (°C)
25.4
27.5
28.3
31.2
33.5
Measured data (°C)
28.4
29.0
32.1
33.4
36.0
AT = 39.3°C
Reference data  (°C)
24.4
28.5
30.6
31.5
34.6
Measured data (°C)
27.6
30.4
33.1
35.0
37.5
AT = 43.5°C
Reference data  (°C)
23.2
26.5
32.7
35.8
37.7
Measured data (°C)
25.7
29.0
34.4
37.9
40.0
AT = 46.2°C
Reference data  (°C)
24.5
26.7
28.3
33.4
36.7
Measured data (°C)
26.4
28.5
31.6
36.8
39.0We select15.2°C, 19.4°C, 26.7°C, 35.2°C, 39.3°C as the training sample set, and 30.0°C, 43.5°C, 46.2°C is regarded as the test sample set. In order to make the collected data unified, we present a normalization to deal with these data according to formula (8) shown as follows. All the data are normalized to [
0.05,0.95
] as(8)
Z
∗
=
0.9
Z
-
Z
m
i
n
Z
m
a
x
-
Z
m
i
n
+
0.05
,where Z is the ambient temperature, Z
m
a
x and Z
m
i
n are the maximum and minimum of ambient temperature, respectively. Z
∗ is the normalized data. Similarly, we can obtain the target’s normalized data of measured temperature value.


### 4.3. Experimental Results

In this section, we adopt three algorithms such as basic BP, improved PSO-BP [7], and improved PSO-BP [8] for illustrating the effectiveness of the proposed approach. Kinds of basic parameter are set as follows:PSO:w
set
=
0.4, w
m
i
n
=
0.4, w
m
a
x
=
1.8, N
=
100, τ
=
50, k
m
a
x
=
150, ε
=
0.001, V
m
a
x
=
0.5, X
m
a
x
=
10, η
=
2.BP: we adopted three-layer topology for building the network. The numbers of input, hidden, and output layer neurons are 2, 19, and 1, respectively. The training maximum number is 8000 and expects error to be 0.001; the hidden layer transfer function adopts S type tangent function “tansig,” the output layer transfer function uses linear function “purelin,” and the training function is “trainlm.”In order to analyze the compensation effect quantitatively, we contrast the effect by the absolute value of errorE
r, which is written as(9)
E
r
=
Δ
y
y
×
100
%
,where Δ
y is the absolute error and y is the reference value. Temperature compensation results are shown in Tables 2, 3, and 4.Table 2
Temperature compensation result (ambient temperature 30°C and training 30 times).
Reference   data
Measured data
BP
IPSO-BP [7]
IPSO-BP [8]
Proposed PSO-BP
E
r of BP
E
r of IPSO-BP [7]
E
r of IPSO-BP [8]
E
r of proposed PSO-BP
20.2
22.9
19.21
19.78
20.18
20.13
4.90%
2.1%
0.1%
0.35%
21.6
23.9
22.33
22.4
21.93
21.51
3.38%
3.7%
1.5%
0.42%
24.2
26.4
22.16
24.73
24.67
24.50
8.43%
2.2%
1.9%
1.24%
25.3
27.6
22.54
26.1
25.77
25.13
10.91%
3.2%
1.8%
0.67%
32.8
33.8
33.65
31.26
32.49
32.64
2.59%
4.7%
0.9%
0.49%Table 3
Temperature compensation result (ambient temperature 43.5°C and training 60 times).
Reference   data
Measured data
BP
IPSO-BP [7]
IPSO-BP [8]
Proposed PSO-BP
E
r of BP
E
r of IPSO-BP [7]
E
r of IPSO-BP [8]
E
r of proposed PSO-BP
23.2
25.7
22.15
23.14
23.07
23.1
4.5%
0.27%
0.6%
0.4%
26.5
29.0
25.81
25.78
26.77
26.41
2.6%
2.7%
1.1%
0.34%
32.7
34.4
30.9
32.36
32.78
32.55
5.5%
1.0%
0.24%
0.45%
35.8
37.9
33.97
35.4
35.23
35.65
5.1%
1.1%
1.6%
0.41%
37.7
40.0
36.9
37.21
37.92
38.0
2.1%
1.3%
0.58%
0.81%Table 4
Temperature compensation result (ambient temperature 46.2°C and training 90 times).
Reference   data
Measured data
BP
IPSO-BP [7]
IPSO-BP [8]
Proposed PSO-BP
E
r of BP
E
r of IPSO-BP [7]
E
r of IPSO-BP [8]
E
r of proposed PSO-BP
24.5
26.4
21.3
24.03
24.87
24.2
13.1%
1.92%
1.5%
1.2%
26.7
28.5
24.17
26.18
26.51
26.4
9.4%
1.94%
0.71%
1.1%
28.3
31.6
27.23
29.06
29.73
28.35
3.7%
2.67%
0.51%
0.17%
33.4
36.8
31.48
34.14
33.65
33.51
5.7%
2.2%
0.74%
0.32%
36.7
39.0
35.97
36.49
36.81
36.89
2.0%
0.57%
0.31%
0.52%From Tables2 to 4, we can see that temperature compensation algorithm based on BP network is fit for improving the accuracy of measurement. However, BP network has great volatility and contingency in continuous operation with the larger error precision. The maximum error of BP optimization actually reached 13.1%. Compared with traditional BP network, kinds of improved algorithm based on PSO have superiority in the area of reliability and stability with the help of optimizing the weights and threshold of BP network. They reduce the opportunity of falling into local minimum to a large extent, which is very meaningful for enhancing the effectiveness of temperature compensation. From the whole analysis, the proposed IPSO-BP algorithm has lower absolute error than other improved IPSO-BP. Meanwhile, the proposed method gives a higher precision with less training times due to the constraint condition about learning factor and inertia weight which improves the generalization ability. The compensation effect of the proposed method is obviously better than other algorithms, which greatly reduces the influence of ambient temperature on the thermopile sensor. In practical application, we could increase the number of samples based on the requirement of system.


## 4.1. Experimental Platform

The infrared temperature measurement system is shown in Figure2, which consists of temperature sensor DS18B20, infrared thermopile sensor MLX90620, ultrasonic ranging module, and the core processor AT91SAM7S256. The role of components is displayed as follows.Figure 2
Infrared temperature measurement system.DS18B20 is a kind of contact-type chip for targets’ surface temperature measurement. After being demarcated by mercurial thermometer with the accuracy of 0.1°C, the accuracy of DS18B20 reaches ±0.2°C within the limits of [−10°C, +85°C], whose data is used to be the reference data.MLX90620 is the thermopile chip of noncontact temperature measurement, whose data is the aim of compensation. The measuring distance affects the accuracy of MLX90620 seriously, and its maximum distance is 1 m.The ultrasonic module HC-SR04 is used for keeping distance between the sensor and the target which has the accuracy of 0.5%.


## 4.2. Sample Data Acquisition

The experiment was carried out on eight different environmental temperatures, and we use MLX90620 sensor to measure the surface temperature of eight different targets at the same distance, respectively. The sample data is shown in Table1, where AT denotes the ambient temperature based on black ball temperature method that reflected environmental thermal radiation information. Reference and measured data are obtained from DS18B20 and MLX90620, respectively. Restricted by experimental conditions and methods, the range of AT is set to [15°C, 50°C].Table 1
Sample data table.
AT = 15.2°C
Reference data  (°C)
20.5
23.9
26.1
28.7
32.4
Measured data (°C)
24.2
25.2
28.9
31.2
36.0
AT = 19.4°C
Reference data  (°C)
21.4
22.6
25.2
29.2
30.2
Measured data (°C)
23.1
24.7
26.9
30.4
32.3
AT = 26.7°C
Reference data  (°C)
22.2
23.6
24.8
30.4
33.8
Measured data (°C)
24.3
25.9
26.1
31.7
34.5
AT = 30.0°C
Reference data  (°C)
20.2
21.6
24.2
25.3
32.8
Measured data (°C)
22.9
23.9
26.4
27.6
33.8
AT = 35.2°C
Reference data  (°C)
25.4
27.5
28.3
31.2
33.5
Measured data (°C)
28.4
29.0
32.1
33.4
36.0
AT = 39.3°C
Reference data  (°C)
24.4
28.5
30.6
31.5
34.6
Measured data (°C)
27.6
30.4
33.1
35.0
37.5
AT = 43.5°C
Reference data  (°C)
23.2
26.5
32.7
35.8
37.7
Measured data (°C)
25.7
29.0
34.4
37.9
40.0
AT = 46.2°C
Reference data  (°C)
24.5
26.7
28.3
33.4
36.7
Measured data (°C)
26.4
28.5
31.6
36.8
39.0We select15.2°C, 19.4°C, 26.7°C, 35.2°C, 39.3°C as the training sample set, and 30.0°C, 43.5°C, 46.2°C is regarded as the test sample set. In order to make the collected data unified, we present a normalization to deal with these data according to formula (8) shown as follows. All the data are normalized to [
0.05,0.95
] as(8)
Z
∗
=
0.9
Z
-
Z
m
i
n
Z
m
a
x
-
Z
m
i
n
+
0.05
,where Z is the ambient temperature, Z
m
a
x and Z
m
i
n are the maximum and minimum of ambient temperature, respectively. Z
∗ is the normalized data. Similarly, we can obtain the target’s normalized data of measured temperature value.


## 4.3. Experimental Results

In this section, we adopt three algorithms such as basic BP, improved PSO-BP [7], and improved PSO-BP [8] for illustrating the effectiveness of the proposed approach. Kinds of basic parameter are set as follows:PSO:w
set
=
0.4, w
m
i
n
=
0.4, w
m
a
x
=
1.8, N
=
100, τ
=
50, k
m
a
x
=
150, ε
=
0.001, V
m
a
x
=
0.5, X
m
a
x
=
10, η
=
2.BP: we adopted three-layer topology for building the network. The numbers of input, hidden, and output layer neurons are 2, 19, and 1, respectively. The training maximum number is 8000 and expects error to be 0.001; the hidden layer transfer function adopts S type tangent function “tansig,” the output layer transfer function uses linear function “purelin,” and the training function is “trainlm.”In order to analyze the compensation effect quantitatively, we contrast the effect by the absolute value of errorE
r, which is written as(9)
E
r
=
Δ
y
y
×
100
%
,where Δ
y is the absolute error and y is the reference value. Temperature compensation results are shown in Tables 2, 3, and 4.Table 2
Temperature compensation result (ambient temperature 30°C and training 30 times).
Reference   data
Measured data
BP
IPSO-BP [7]
IPSO-BP [8]
Proposed PSO-BP
E
r of BP
E
r of IPSO-BP [7]
E
r of IPSO-BP [8]
E
r of proposed PSO-BP
20.2
22.9
19.21
19.78
20.18
20.13
4.90%
2.1%
0.1%
0.35%
21.6
23.9
22.33
22.4
21.93
21.51
3.38%
3.7%
1.5%
0.42%
24.2
26.4
22.16
24.73
24.67
24.50
8.43%
2.2%
1.9%
1.24%
25.3
27.6
22.54
26.1
25.77
25.13
10.91%
3.2%
1.8%
0.67%
32.8
33.8
33.65
31.26
32.49
32.64
2.59%
4.7%
0.9%
0.49%Table 3
Temperature compensation result (ambient temperature 43.5°C and training 60 times).
Reference   data
Measured data
BP
IPSO-BP [7]
IPSO-BP [8]
Proposed PSO-BP
E
r of BP
E
r of IPSO-BP [7]
E
r of IPSO-BP [8]
E
r of proposed PSO-BP
23.2
25.7
22.15
23.14
23.07
23.1
4.5%
0.27%
0.6%
0.4%
26.5
29.0
25.81
25.78
26.77
26.41
2.6%
2.7%
1.1%
0.34%
32.7
34.4
30.9
32.36
32.78
32.55
5.5%
1.0%
0.24%
0.45%
35.8
37.9
33.97
35.4
35.23
35.65
5.1%
1.1%
1.6%
0.41%
37.7
40.0
36.9
37.21
37.92
38.0
2.1%
1.3%
0.58%
0.81%Table 4
Temperature compensation result (ambient temperature 46.2°C and training 90 times).
Reference   data
Measured data
BP
IPSO-BP [7]
IPSO-BP [8]
Proposed PSO-BP
E
r of BP
E
r of IPSO-BP [7]
E
r of IPSO-BP [8]
E
r of proposed PSO-BP
24.5
26.4
21.3
24.03
24.87
24.2
13.1%
1.92%
1.5%
1.2%
26.7
28.5
24.17
26.18
26.51
26.4
9.4%
1.94%
0.71%
1.1%
28.3
31.6
27.23
29.06
29.73
28.35
3.7%
2.67%
0.51%
0.17%
33.4
36.8
31.48
34.14
33.65
33.51
5.7%
2.2%
0.74%
0.32%
36.7
39.0
35.97
36.49
36.81
36.89
2.0%
0.57%
0.31%
0.52%From Tables2 to 4, we can see that temperature compensation algorithm based on BP network is fit for improving the accuracy of measurement. However, BP network has great volatility and contingency in continuous operation with the larger error precision. The maximum error of BP optimization actually reached 13.1%. Compared with traditional BP network, kinds of improved algorithm based on PSO have superiority in the area of reliability and stability with the help of optimizing the weights and threshold of BP network. They reduce the opportunity of falling into local minimum to a large extent, which is very meaningful for enhancing the effectiveness of temperature compensation. From the whole analysis, the proposed IPSO-BP algorithm has lower absolute error than other improved IPSO-BP. Meanwhile, the proposed method gives a higher precision with less training times due to the constraint condition about learning factor and inertia weight which improves the generalization ability. The compensation effect of the proposed method is obviously better than other algorithms, which greatly reduces the influence of ambient temperature on the thermopile sensor. In practical application, we could increase the number of samples based on the requirement of system.


## 5. Conclusions

An improved PSO-BP network is proposed in this paper, which is superior to the traditional BP neural network in several aspects such as low study efficiency, slow convergence speed, and being easily jumped out of local optimal. The core of the proposed algorithm is to reduce the uncertainty of selecting the initial values and weights of BP network for improving the ability of generalization. Compared with the traditional BP and two kinds of improved PSO-BP [7, 8], we demonstrate the effectiveness of the proposed approach. The compensation results show that the network optimized by the improved PSO algorithm has better performance with faster convergence speed, lower errors, higher accuracy, and learning ability.The proposed algorithm is used for the condition monitoring of electrical equipment which reflects long-term variation trend. So we use upper computer to optimize temperature data and meet the demand of status forecast.



---

*Source: 854945-2015-08-13.xml*