ELSEVIER
Copyright © IFAC Intelligent Components and Instruments for Control Applications, Aveiro. Portugal. 2003
IFAC PUBLICATIONS www.elsevier.com/locale/ifac
DATA PROCESSING FOR INDUSTRIAL AUTOMATION
Alessandro De Carli - Paolo Di Giamberardino
Department o/Computers and Systems Sciences University 0/ Rome "La Sapienza .. Via Eudossiana 18 - 00184 ROMA a/
[email protected] [email protected]/.it
Abstract. The processing of sampled variables directly acquired from a controlled plant is highly recommended before their utilisation for implementing a control strategy at the field level and the supervisory one. In this paper the algorithms for implementing some pre-processing procedures are presented. The first one allows to determine the bandwidth of the signal utilised for activating a control strategy. A new procedure for designing a non-recursive low-pass filter is then presented. Since the filter model is given by an analytical equation, the computation of its first order derivative and the second order one is direct and very simple. Finally, an algorithm for the on line computation of the estimated mean value is given. The validation tests of all the proposed algorithms conclude the paper. Copyright © 2003 [FAC
Key words: data processing, filter synthesis, first and second derivative estimation, adaptive mean estimation.
I. INTRODUCTION
At the present time. the availability of the historical set of data is not the main problem for acquiring the knowledge of the controlled system behaviour. Since many years, the majority of the variables involved in the evolution of a controlled system are measured and stored in suitable devices (for instance data loggers) at the supervision level. On the contrary, the real problem consists in working out from the measured data the values of the variables really necessary for deducing the dedicated model of the controlled plant and for implementing an appropriate control algorithm at field level and a control procedure at the management and supervision levels. In many applications, the efficiency of the control algorithm and control procedure depends by the pre-processing of the acquired data. This paper presents some algorithms for preprocessing the data directly acquired from the in-
In Industrial Automation, selecting and installing the instrumentation, choosing a simple and conventional control strategy and tuning its parameters during the running operation of the controlled plant, implement a controlled system. For improving the controlled system performances. the new trend consists in working out a feasible dedicated model, selecting a suitable control strategy, and designing its parameters by using the model and its simulation. In order to veri fy the validity of the control strategy, suitable tests should be carried out in the controlled plant. For improving the controlled plant performance, a dedicated control strategy should be designed and implemented. Its parameters should be tuned in terms of the model directly deduced from the set of the data stored during the operation of the plant to be controlled.
183
strumentation. The proposed procedures and the algorithms allow to obtain by filtering the signal suitable for implementing the control strategies, i.e. the fundamental signal, and to determine on-line the mean value that follow up the arithmetic mean with a very small deviation. The proposed procedures and algorithms have been developed to attain the result to work out signals directly usable for the implementation of the control strategies of the plants and the system. In fact, the main objective is to save the harmonic content suitable for the control and not to reproduce the original waveform, as in many problems involving telecommunications. The available literature on the data processing is very poor and for this reason it will be omitted. The theoretical approach of the stand-alone procedures is well known; their assembling in a dedicated procedure is the original contribution of the paper.
tion of a Fast Fourier Transform algorithm usually does not produces feasible results. Better results can be obtained by applying a procedure, which starts from the selection of a suitable observation time interval, and continues by considering the other sampled variables as a periodic signal in which the period is equal to the observation interval, as shown in Figure 2. OBSERVATION INTERVAL
Figure 2 - Observation time interval. In order to smooth the effects of the random noise, the autocorrelation of the sampled variables within the observation interval is carried out. The hypothesis of periodicity of the signal eliminates the problems of the edges in the overlap. The harmonic content of the autocorrelation is carried out by a conventional approach applied to a periodic signal; its spectrum gives results very easy to interpret for working out a feasible value of the bandwidth. In fact, the harmonic amplitude decreases as the frequency increases. In such a way the bandwidth boundary of the spectrum can be very easily determined. To verify the efficiency of this selection, the harmonic content of the sampled variables contained in the observation interval is firstly carried out. Subsequently, the harmonic-by-harmonic reconstruction of the original signal is computed. If the harmonics outside the prefixed bandwidth give a marginal contribution, increasing or decreasing the chosen bandwidth allows to attain the desired accuracy.
2. PRE-PROCESSING OF THE SAMPLED VARIABLES In conventional industrial instrumentation, a sensor detects the measured variable; its output is usually continuous. The storage is effected by a dedicated hardware, which imposes a constant sample rate and a quantization with a prefixed word length. The sampled values contain also the quantization noise as well as the noise produced by the electrical supply or other external sources. A low-pass filter is tuned in terms of the internal clock rate and performs the attenuation of the inducted noise. In the smart instrumentation, preliminary manipulations are carried out to improve the feasibility and the quality of the measured variables. In general, the sampling rate imposed by the dedicated hardware could be higher than the acquisition rate necessary to save information suitable for implementing the control of each plant and of the whole system. The acquisition rate is involved with the control problems and strictly related to the bandwidth of the controlled system. Figure I shows the waveform of the continuous variable detected by a sensor, the corresponding sampled values and the acquired ones.
,
-4,,
,, , ,, ,
hormorucs
Figure 3 - Autocorrelation and its spectrum. Once the bandwidth has been fixed, suitably designed filters extract the fundamental signal, the first order derivative and second order one. Figure 3 shows the autocorrelation of the sampled variables contained in the observation time interval and its harmonic content. ~
sarrpling rate
time
Figure I - Sampling rate and acquisition rate of a measured variable.
4. DESIGN OF THE FILTERS A fourth order Bessel filter, with the bandwidth tuned to the bandwidth of the signal to be filtered, performs a very satisfactory smoothing of the noise and reproduces the waveform of the fundamental signal. It introduces a fixed time delay that should be taken into account in designing the control strat-
3. DETERMINATION OF THE BANDWIDTH Our experience in determining the bandwidth of a sampled variable has shown that the direct applica184
egy parameters. In order to improve the attenuation beyond the bandwidth, the order of the Bessel fi Iter could be increased. By using the Matalb facilities, the design of the filter parameters can very easily carried out. Figure 4 shows the Bode diagram and impulsive response of a fourth order Bessel filter. I
2
irrpulsiue response·
°H~--r-=;:::_~
1
4
10 100 ro (rail sec)
n
Figure 5 - Bode diagram and impulsive response filter of the first derivative.
,
ot-t--i f+..ll~"""""':--+l+ll +-'
By assuming that the fitted impulsive response has the following polynomial equation, i.e.:
inpulsiue response
.01
-
.1 I 1 ro(rail$c)
bandwidth
its first order derivative and second order one, results:
----?'f
Figure 4 - Bode diagram and impulsive response of a fourth order Bessel filter.
g '(t)
There are different and more effective approaches to design a filter with quite similar attenuation characteristics. When the main purpose is to estimate the first order derivative and the second order one, the attention should be focused to design a filter for estimating of the first and second order derivatives in the frequency range of real interest for the control strategy implementation. The derivative of the higher hannonic components of the input signal should be eliminated to save the perfonnance specification of the controlled plant. The derivative of the lower hannonic components should not be effected since it decreases the static gain. The derivative action should include a frequency range spanning approximately from the bandwidth frequency to a decade lower. A filter with the above-mentioned characteristics should have the following transfer function:
=
a/ + 2 al t + 3 a3 t2 + 4 a4 t3 + ...
g"(t) = 2 a2 + 603 t + 12 a4
r + 20 a5 t3 + ...
The time duration TF of the fitted impulsive response is strictly related to the desired bandwidth of the low-pass filter. In practice, it results approximately equal to .75 of the time period T* corresponding to the bandwidth frequency Q*. By examining the peculiarities of the impulsive response of the fourth order Bessel filter and its first order derivative and second order one, the following constraints can be established:
g(O)= 0
g'(O)=O
g"(O)=O
Consequently, the ao, ai, a2 should be set equal zero. Since the impulsive response of these filters, should be hold the zero value beyond the time instant TF, the following constraints should be satisfied:
1 K{zs+l) GF{s) = - - - - -
in which the natural frequency (J)n is a little lower than the bandwidth frequency, the damping ratio ~ equal to .7, the zero z is set at a value ten times lower than the bandwidth and the gain K is tuned so as to obtained that the module should be equal to I when the frequency is I rad/sec. Figure 5 shows the Bode diagram and the impulsive response of the filter proposed for the estimation of the first order derivative. The filtering algorithm can be implemented in a recursive or non-recursive way; the parameters of the recursive filter can be worked out very easily by using the Matlab facilities. An alternative way to detennine the filter coefficients consists in working out a simple polynomial equation fitting the impulsive response of the Bessel filter, in the significant part for the hannonic attenuation. The time derivation of the analytical equation gives the model of the first order derivatitive and the second order one.
g'(TF) = 3 a3 TF 2 + 4 a4 TF 3 + ... = 0 g"(TF)=6a3TF+12a4TF2+ ···=0 Another constraint fixes the gain of the low-pass filter equal to one, i.e.:
f
TF
4
5
g{t)dt = a/4 TF + Q41S TF + ••• = 1
o In order to satisfy the four constraints, the following linear system equation should be solved in which the a3, a4, a5, a6 are the unknown coefficients:
3 a3 + 4 TF a4 + 5 TF 2 a5 + 6 TF 3 a6
=
6 a3 + 12 TF a4 + 20 TF 1 a5 + 30 TF 3 a6
185
6
tiTre (sec)
0 =
0
Figure 6 shows their waveforms; their sampling at the acquisition rate allows to determine the parameters of the non recursive digital filter. law·pass filter
first deriuatiue
.05
.
.04
~.03
second deriuaiue
.»
Cl.
a· 02 .01 OUW~""""""'_
time
o 10 20 order of harmonics
Figure 9 - Autocorrelation of the measured variable and its hannonic content.
Figure 6 - Impulsive response of the low-pass filter, the first order derivative and second order one.
Since the observation interval has a duration of 8 is equal to .78 sec, the fundamental harmonic rad/sec. Since only the first 10 harmonics gives a significant contribution, the bandwidth of the fundamental signal can be set at 8 rad/sec. The hannonic-by-harmonic reconstruction of the measured variable confirms that the bandwidth has been correctly set since the deviation from the original fundamental signal is very small, as shown in Figure 10.
ne
The comparison of the Bode diagrams corresponding to the Bessel filter and low-pass filter is shown in Figure 7.
Figure 7 - Bode diagram of the Bessel filter and of the low-pass fi Iter. Figure 10 - Harmonic-by-harmonic reconstruction of the measured variable and the original fundamental signal.
From this figure can be easily deduced that the attenuation of the low-pass filter outside of the bandwidth is improved. This advantage characterises the new proposed approach.
In order to determine the polynomial equation of the impulsive response of the low-pass filter, the time duration in terms of the bandwidth should be set. By applying the empirical relationship that gives the duration TF of the impulsive response of the lowpass filter in terms of the period T* corresponding to n*, it results the bandwidth frequency .75(8/(21t))=.96 sec. Therefore, the time duration TF can be set at 1 sec. By applying the above mentioned relationships to determine the unknown coefficients, it results:
5. AN EXAMPLE By applying the proposed algorithms to the signal shown in Figure 7, the efficiency of the proposed filtering procedure has been tested. The waveform and the harmonic spectrum of this signal are shown in Figure 8.
18'" " ].4
]2
03
]-
hQT711Dnics of the measured. variable
cs
=
140,04
=
-420, 05
=
420, 06
~
i'l
o
g(() 10
20
30
40
-140.
The impulsive response of the low-pass filter is given by the following equation for (~ [0. I):
.1
~ 0 ~'-------+!I---W--7 0
=
= 140 (3 - 420 (4 + 420
50
r- 140 l
o,der ofharrrr:mics
Consequently, the impulsive response of first order derivative filter results:
Figure 8 - Measured variable and its components
g'(/)
The harmonic spectrum of this signal confirms that it could be difficult to fix the bandwidth by taking into account the amplitude of the harmonics. If the autocorrelation of the measured variable is carried out, the bandwidth can be easily determined as shown in Figure 9.
= 420 l-1680 /3 + 2100/ 4 - 840
r
and the impulsive response of second order derivative filter is: 840 (- 5040/2 + 8400/3 - 4200 /4 By applying the non-recursive filtering algorithms to the measured signal, the filtered signal and the first and second derivative one are worked out. g"(/)
186
=
Their waveform are shown in Figure 11 and the comparison with the original fundamental variable is effected.
An adaptive algorithm for the estimation of the mean value should then be realised. The basic relationship is the following: X(i) = X(i-l) + K(i)
(Xi -
X(i-l))
in which the value of K(i) is updated at each step in terms of the variance Q(i) of the measurement error and the variance P(i) of the estimation error By applying a minimisation procedure for the estimation error variance, the following relationship is deduced: Figure 11 - Filtered signal and its first order and second order derivative
. K (z)-
The time delay of I sec is due to initialisation transient of the non-recursive filter. The obtained results demonstrate the efficiency of the new procedure.
The values of P(i) and Q(i) should be updated at each step. By assuming that the measurement error at the i-th step coincides with the deviation of the measured value Xi from the value of the mean, estimated at the previous step X(i-l), the value of the variance Q(i) at the i-th step is given by the following relationship:
6. ADAPTIVE MEAN VALUE The on-line computation of the mean value presents difficulties when the arithmetic definition of the mean is repetitively applied. By applying the arithmetic definition of the mean value, it results: X = lim{~
i
rl-->
Q(i) = Q(i-l) + a
X(i-l)/
P(i) = K(i-l) Q(i)
To initialise the procedure it is necessary to set the values of X(l) and P(l). X(l) can be assumed as the 0.4 - 0.7 of the first sampled value, i.e. X(l) = (0.40.7) X, , and P(l) at a value much higher than the value ofQ(l). The relationships that give the value of the weighted mean and the adaptive mean are very similar and represent the discrete model of a first order filter. The actual value of K is related with the time constant and consequently with the bandwidth and noise attenuation beyond the bandwidth. In the weighted mean, since be value of K is fixed and consequently the bandwidth, the harmonic components of the deviation between the sampled measured value and the mean value are attenuated only if their frequency is beyond the bandwidth. Otherwise are not attenuated and cause a fluctuation of the mean value with respect to the value obtainable from the arithmetic mean. In the adaptive mean the value of K varies at each step and consequently the bandwidth is adapted to the harmonic content of the deviation. For this reason the adaptive mean tracks the arithmetic mean in a very satisfactory way. In order to evaluate the peculiarities of the abovementioned algorithms, each one has been applied to the same set of data, obtained from the random number generator. It contains 100 data ranging from 0.1 to 0.9.
The estimated value X(i) could present relevant fluctuations when the sampled values have large variations and the average is effected on a small number of samples. The value obtained by a second approach can be indicated as weighted mean and it is given by the following relationship: (Xi -
(Xi -
in which the value of a ranges between 0.00 J and O. J. The value of P(i) is given by the following relationship:
Xi)
in which X, represents the sampled value at the i-th step and X the mean value. The numerical computation of the arithmetical mean X presets some difficulties due to the overflow in the computation of the summation and to the underflow in the computation of the term lIn. In general, the accuracy of the result decreases as the number of terms increase. When the number of the terms of the summation is prefixed, the varying mean is obtained by applying the following relationship:
X(i) = X(i-l) + K
P(i) Q(i-l) +P(i)
X(i-l))
in which the value of K is prefixed so as to obtain a smooth settling of the estimated mean and a quick stabilisation of its value. The standard value of K ranges between 0.00 I and 0.1. Both the mobile mean and weighted mean could present relevant variations from the arithmetical mean. A reduction can be obtained by updating the value of K at each step so as to minimise the variance of the estimation error, according to the Kalman filter approach.
187
G
crl""ri"" mean
.5 I
.
.
arith
.
~.~ :r;;:,=: ',,~ ~#
•...•..•..
01
I.~ ..•t'..· , ," • weiqlUed mean
ance is inevitable and consequently a reduction of the controlled system efficiency. The advantages to detennine the first and second order derivatives, by applying very simple algorithms, give interesting drawbacks in the design of the control strategies. At the level of field control, the possibility to obtain the first derivative of the fundamental signal allows to extend the use of derivative action in proportional and integral controllers. This feasibility is very important in the controlled systems when the attenuation of the load disturbance effects depends on the efficiency of the derivative of the measured variable. More over, it should be considered that the improvements of controlled system perfonnances by the application of a suitable control strategy requires the knowledge of the derivative of the controlled variable inside its bandwidth. The noise filtering and the computation of the first and the second derivative of a measured variable is very useful in the training of a neural network for the black box modelling of a system and in the design of the decisional strategies by applying procedures based on the fuzzy logic. The possibility of a simple procedure for the on-line computation of a feasible value of the mean, allows to find a lot of very interesting applications. The design of an algorithm for the data processing foresees to work out the set and the sequence of the elementary instructions and to arrange their implementation on a dedicated microprocessor device. The use the simulation is fundamental in order to synthesise the peculiarities of the data set suitable to test the algorithm and to verify the effects of the transferring the instructions on a dedicated computing device.
an
~.
•
i
i
••• 4
•
~
.
I
O'O!.--=----'-2-0---4-0---60---'--'--:8:.-:0--~J()():-:? number of s017Jlles
Figure II - The set of data and the profile of the arithmetic mean, the mobile mean and the weighted mean. Figure 11 shows that the adaptive mean follows up the arithmetic mean with a very small deviation since from the first steps. It confinns the advantage and the validity of this approach, which requires a very limited complexity in the computation procedure. 7. CONCLUSIONS The possibility of applying efficient algorithms for processing measured data offers many advantages in their utilization for the implementation of more efficient control strategies at local and supervisory level. For example, the removal of the noise from the measured data allows to apply more simple procedures for working out the dynamic model of the system to be controlled and to design more sophisticated controllers to improve the controlled system perfonnances. In fact, although the conventional control strategies allow the tuning of the controller parameters without the knowledge of a suitable dynamic model, a reduction of the dynamic perfonn-
188