Real time detection through Generalized Likelihood Ratio Test of

Real time detection through Generalized
Likelihood Ratio Test of position and speed
readings inconsistencies in automated moving
objects
Sternheim Misuraca, M. R.
Degree in Electronics Engineering, University of Buenos Aires, Argentina
Project Engineer, Sistemas Industriales, ABB Argentina
Email: [email protected]
Abstract
In the present work we describe a system to detect inconsistencies of position and
speed readings in automated moving objects to prevent collisions. The system is
implemented through a Generalized Likelihood Ratio Test (GLRT) strategy. Position and speed measurements are used as inputs of an hypothesis testing system for
consistency checking. Type I error (false alarm) probability can be specified and
set, while minimizing type II error (mis-detection) probability. Also, we show the
results of the successful implementation of this strategy in the transelevator control
system we installed in April 2013, in the Distribution Center of Molinos Rio de La
Plata in Barracas, Buenos Aires, Argentina.
1
Introduction and problem set up
There are several industrial applications where automated moving objects relay on
position and speed readings to control its movement, such as cranes and transelevators. Independent position and speed measurements are easily implemented
through laser positioning, bar codes or encoders. However they are usually noisy,
leaving consistency checking systems open to errors such as stating that the readings are not consistent when they are (type I or false alarm error), or stating that
the readings are consistent when they are not (type II or mis-detection error).
We examine the Distribution Center of Molinos Rı́o de la Plata S.A, located
in Barracas, Buenos Aires, Argentina, where we implemented the system in the
trans-elevator control program we developed and installed in April 2013.
The Distribution Center consists on a vertical warehouse that storages pallets
carrying comestible loads of up until one ton. The warehouse has three corridors,
each of 100m long x 12m high, with capacity for 2200 pallets. Through each corridor, a fully automated trans-elevator of two ton moves at 10km/h - see figure
1.
1
1 Introduction and problem set up
2
In the event of a mechanical or electronic issue in the position or speed readings
used for positioning control, it is of the essence that the control system stop the
device in order to protect the people and the facilities involved.
Fig. 1: Empty trans-elevator moving through the warehouse
In this work we present a strategy of hypothesis testing using Generalized Likelihood Ratio Test (GLRT). The system is implemented in real time with negligible
computational burden, and allows to set false alarm probability while minimizing
mis-detection error probability.
The aforementioned trans-elevators are automated by means of a AC800M controller, model PM851. Movement is controlled individually for each axis, by means
of an ACS800 drive attached controlling the corresponding motor. The drive receives motor speed measurements through an incremental encoder plugged to the
motor axis, and position measurements of the trans-elevator jail through a different
incremental encoder plugged to an independent mechanical system - (elevation is
taken from a wire, and horizontal movement from a timing chain).
We added the consistency check layer to the existing control system without
adding computational burden to the controller. In the next section we detail the
2 Mathematical model
3
implemented algorithm and we compare it with more conventional integration and
differentiation methods to address this issue.
2
Mathematical model
We start modeling available measurements. Time is discretized according to the
execution time of the controller’s task running the program, which we will call ∆t.
Time is referenced by a subindex (e.g. xi ).
For each axis, at instant i, independent position - xi - and speed - v i measurements are available. They are, however, noisy, with mean equal to the actual
position and speed, respectively. Noise statistics are approximated by a gaussian
distribution (due to it being mathematically easy to use). We thus have
x i = xi + η i
(1)
v i = vi + ν i
(2)
With η i ∈ R and ν i ∈ R gaussian, zero mean and variances σx2 and σv2 respectively. We assume they are both ergodic processes (measurement noises are
uncorrelated if measurements are taken at different times, though the statistical
parameters are equal).
Next we derive the most common approaches to this problem, along with the
issues they present - differentiation and integration, and finally we describe the
method we chose to implement, the generalized likelihood ratio test.
2.1
Differentiation strategy
The most simple strategy to check for consistency is to approximate the derivative
of the position via finite differences, and then compare it to the speed measurement.
We start by defining Λ
xi − xi−1
dx
(i) ∼
dt
∆t
xi − xi−1
Λ=
− vi
∆t
(3)
(4)
Now we define > 0 as the bound for the difference between measured speed
and approximated speed through derivatives. Thus, when |Λ| > , inconsistency
warning is set.
This strategy presents several issues. First, position measurement noise is amplified, since 3 is a high pass filter, which effect is to filter out the mean and to
amplify the random component. Since successive position measurements are taken
very fast compared to the trans-elevator speed, the means are similar, rendering it
vulnerable to the filter. Moreover, since the subtraction is divided by a very small
factor (∆t), the noise is even more amplified.
Secondly, speed measurement v i is unfiltered, so its noise is not mitigated,
which is not desirable.
Finally, there is no control over the error probabilities.
2 Mathematical model
2.2
4
Integration strategy
Instead of derivating position to compare it with speed, we will try integrating
speed to compare it with the position. Speed measurement, at each moment, is
multiplied by the time interval ∆t (and by a factor ρ if speed needs scaling); and
then it is added to approximate the integral of the speed. We then calculate the
discriminant as
Λ = (xN − x1 ) − ρ∆t
N
X
vi
i=1
Again, the decision strategy boils down to comparing the absolute value of the
discriminant with the bound - if it is greater, we decide there is an inconsistency
in the measurements.
This strategy is better than derivating since speed measurement noise is mitigated. Proof lies on averaging zero mean noise components. Due to eq 2, we
have
N
X
vi =
N
X
vi +
i=1
i=1
N
X
ηi
i=1
Since adding independent, identically distributed (i.i.d.) samples and dividing by the number of samples is an unbiased estimator of the mean (remember
measurement noise is ergodic by hypothesis) we then write
N
X
vi =
i=1
N
X
vi + N µ̂η
i=1
However µη = 0 by hypothesis, thus noise effect is mitigated.
Another improvement is that position measurement noise is not as highly amplified, since means of position separated by the data window (N) are bound to
be less similar (unless the trans-elevator is not moving at all). Besides, we are no
longer dividing it by the sampling factor ∆t.
We must underline the fact that, as in the previous case, we don’t have means
to quantify the errors, much less set them according to specifications.
2.3
Likelihood ratio strategy
2.3.1
Constructing the sample set
To overcome the problems inherent to integration, we will use hypothesis testing.
We start defining the random variable z as follows
z N = (xN − x1 ) − ρ∆t
N
X
vi
(5)
i=1
This random variable is gaussian, due to being a linear combination of gaussian,
independent variables, with mean equal to the linear combination of their means,
and variance equal to the sum of individual variances, weighted by the squared
coefficients. Since the linear combination of the means is equal to zero (in normal
2 Mathematical model
5
conditions, the mean value of the integral of the speed is equal to the position
difference) we have
z ∼ N (0, 2σx2 + ρ2 ∆t2 N σv2 ) = N (0, σz2 )
(6)
Using 5 we build the sample set {z 1 . . . z N } of (i.i.d.) variables. Samples will be
i.i.d. if data windows are independent. However, this will delay sample production,
so data overlapping will be permitted if needed out of the application sample speed
requirement, assuming i.i.d. samples to simplify the mathematical model.
2.3.2
Generalized Likelihood ratio test - GLRT
Next we define two hypothesis. Null hypothesis is that the mean of z is zero, which
corresponds to speed and position measurements consistency. Alternative hypothesis is defined as having non-zero mean, which signifies that there is a deterministic
difference between speed and position measurements dynamics, and thus an inconsistency in the data which might be caused by electrical or mechanical issues.
Formalizing
H0 : µz = 0
HA : µz 6= 0
To contrast such hypothesis, we use Likelihood Ratio Test, which consists on
obtaining the discriminant comparing the probability of obtaining the sample set
conditioned to the null hypothesis or the alternative hypothesis.
At this point, we must redefine the alternative hypothesis (to avoid comparing
the zero mean probability to every mean probability) - alternative mean is now
equal to the maximum likelihood estimator of the mean computed from the sample
set, which is equal to the data set average. We don’t lose generality in the process,
in the sense that even if the alternative hypothesis will always be more likely, the
key is to accept the null hypothesis when it is not likely enough. Later we will
see that the error probability, which can now be computed, will help us set the
bound to choose the alternative or null hypothesis. See [1] and [2] for details of this
detection strategy.
Next we formally redefine the hypothesis
H0 : µz = 0
LE
HA : µz = µM
=
z
Λ0 =
N
1 X
zi
N i=1
p(z 1 . . . z N |H0 )
p(z 1 . . . z N |µz = 0)
=
LE )
p(z 1 . . . z N |HA )
p(z 1 . . . z N |µz = µM
z
Since samples are independent and gaussian, we write
(7)
2 Mathematical model
6
N
Y
Λ0 =
z2
1
√
σ 2π
i=1 z
N
Y
i=1
1
√
σz 2π
e
−
e
− 2σi2
z
LE )2
(z i −µM
z
2
2σz
Taking logarithms and simplifying constants, we have
Λ1 = −
N
N
LE 2
X
X
z 2i
(z i − µM
)
z
+
2
2
2σ
2σ
z
z
i=1
i=1
LE 2
dividing by 2σz2 and expanding (z i − µM
) we obtain
z
Λ2 =
LE
−N µM
z
2
=−
N
X
!2
zi
i=1
Finally, dividing by the constant and taking squared root (note that Λ1 is always
negative or zero since Λ0 ≤ 1, since the denominator of 7 is always greater than
the numerator by definition of maximum likelihood estimator)
N
X
Λ=
zi
(8)
i=1
Discriminant Λ is then compared with . Should it be smaller, null hypothesis
is accepted and the system is branded consistent. Else, null hypothesis is rejected,
branding the system inconsistent
Si Λ ≤ null hypothesis is accepted, system is consistent
Si Λ > null hypothesis is rejected, system is inconsistent
The most important difference with the previously described methods is that
we are now allowed to compute the probability of false alarm (type I error) α, that
is, the probability of Λ being greater than the discriminant conditioned to z having
zero mean (inconsistency warning is set, though system is consistent)
α = p(Λ > |µz = 0)
Statistics of Λ can be derived from the statistics of z.
the absolute value of a zero mean gaussian variable, with
6), namely Folded Normal Distribution. The variance is a
(linear-angular speed ratio), sampling time ∆t and σx y σv
Accordingpto (8), Λ is
variance (N )σz (see
function of the ratio ρ
standard deviations.
Applying the same principle we derive a mis-detection error bound βDet , which
means Λ being smaller that the discriminant given non-zero mean (readings are
inconsistent but warning is not set)
βDet = p(Λ ≤ | |µz | > µβDet )
3 Implementation
7
According to Neyman-Pearson theorem ([1]), likelihood ratio test minimizes
mis-detection error once false alarm error is set, which renders the method optimal
when such error is set by the system’s specifications.
High values of mis-detection errors are more acceptable than high values of false
alarm errors. The reason is that monitoring is done in real time (a check for each
time instant), thus the probability of a standing type II error through k instants
k
is βDet
. This is the reason why a low type I (false alarm) error should be set to
a small value, and then type II error be minimized. Details on how to choose the
bound for the discriminant are given in the next section.
To minimize the global error, Bayesian estimation methods should be used,
which requires a priori knowledge of the class probability density functions (i.e.
the a priori probability for the system of being consistent/inconsistent), see [2] for
details.
3
Implementation
3.1
Algorithm description and computational burden
The algorithm consists on building position and speed measurements vectors, and
the sample vector, to choose for system consistency/inconsistency
1. Initialize position and speed measurements vectors, and sample vector z of
size N. Initialize the cumulative sum of speed measurements and the cumulative sum of samples z.
2. Refresh measurement vectors, eliminating the oldest measurement and adding
the newest one. By the same token, refresh cumulative speed measurement.
3. Compute a new sample z, according to 5. Refresh samples vector cumulative
sum of samples vector z, as seen in the previous step.
4. Take absolute value of z to build discriminant Λ, according to 8, and compare
it to the decision boundary . Set inconsistency warning if the discriminant
surpasses the decision boundary.
5. Increment time and go back to step 2.
The algorithm is O(1) regarding vector size, since the number of operations
is independent of such size. The system is therefore implementable in real time
without burdening the process controller.
3.2
Practical considerations
Next we detail the implementation of the system in the elevation axis of the transelevators in the Distribution Center of Molinos Rio de La Plata S.A. located in
Barracas, Buenos Aires, Argentina. Procedures for horizontal movement is analogous.
Linear-angular speed ration ρ is identified setting the trans-elevator to move at
constant speed to have constant movement difference and constant speed integral.
We selected ∆t = 60ms, and vector size N=20. We approximated standard
deviation of speed measurement as σv = 0.1mHz, and position measurement as
3 Implementation
8
σx = 1mm.
3.3
Type I and II error selection
Using data according to the previous section, we obtained curves that allows to set
false alarm and mis-detection errors.
Next we show false alarm error probability function, setting the decision boundary to = 0.15, which determines type I error α < 1%. For this type of error,
increasing the decision boundary improves performance.
Fig. 2: Estimation of P (Λ ≥ x | H0 )
Finally, we show detection error probability function, setting the same decision
1seg
boundary = 0.15, which determines a mis-detection error of β15cm
= 0.1%. For
this type of error, lowering the decision boundary improves performance.
Fig. 3: Estimation of P (Λ < x| HA )
It is not possible to lower both error types probabilities simultaneously. However, due to Neyman-Pearson theorem, fixing one type of error minimizes the other.
4 Conclusions
9
In this case, selecting = 0.15 renders a false alarm error of α < 1% and
a mis-detection lower error bound (for a displacement of 15cm) of β15cm = 50%.
Recall that the probability of a detection error of a displacement over 15cm to last
10
over 600ms is β15cm
= 0.1%. The value 15cm is an acceptable distance for the
trans-elevator to stop in the event of an inconsistency in the speed and position
readings.
Test conducted on site supported the simulated results. In the event of inducted
failures regarding encoders, trans-elevators stopped safely and reported inconsistency warnings.
4
Conclusions
We have implemented, in real time, a GLRT strategy to detect inconsistencies in
the position and speed readings of an automated moving object, with minimum
computational and hardware requirements. Implemented system constitutes a security layer to avoid collisions, and its performance can quantified and false alarm
error adjusted to have it meet the application requirements, whereas mis-detection
error is optimally minimized. Finally, we describe the implemented solution in the
trans-elevator system of the Distribution Center of Molinos Rio de La Plate S.A.
located in Barracas, Buenos Aires, Argentina.
Acknowledgments
To Alejandro Carrasco, Engineering Manager of Industrial Systems - ABB Argentina, for his assistance in the writing of the present paper.
To Juan Pablo Giuttari, Service Engineer - ABB Argentina, for his assistance
in the testing process.
5
Bibliography
[1] S. Kay, Fundamental of Statistical Signal Processing Vol II Detection Theory.
New Jersey: Prentice Hall, 1998.
[2] O. Duda, P. Hart, and D. Stork, Pattern Classification 2da. Ed. Nueva York:
John Wiley & Sons, Inc., 2000.
[3] S. Kay, Fundamentals of statistical signal processing, volume I: Estimation theory. Prentice Hall, 1993.
[4] Kailath, A. H. Sayed, and Hassibi, Linear Estimation. New Jersey: Prentice
Hall, 2000.