**2.2 Endpoints, local and global constraints**

242 Principal Component Analysis

Fig. 1. Sketch map of nonlinear time alignment for two univariate trajectories *R* and *T* with

Let *i* and *j* denote the time index of the *T* and *R* trajectories, respectively. DTW will find

and each point *c(k)* is an ordered pair indicating a position in the grid. Two univariate

Most of DTW algorithms can be classified either as symmetric or as asymmetric. Although on the former scheme, both of the time index *i* of *T* and the time index *j* of *R* are mapped onto a common time index *k*, shown as Eqs.1, 2, the result of synchronization is not ideal, because the time length of synchronized trajectories often exceeds referenced trajectories. On the other hand, the latter maps the time index of *T* on the time index of *R* or vice-versa, to expand or compress more one trajectory towards the other. Compared with Eqs.1, 2, the

\* *F c c cK tr K t r* { (1), (2), ( )},max( , ) (1)

*ck ik jk* ( ) [ ( ), ( )] (2)

\* *F c c c j cr* { (1), (2), , ( ), ( )} (3)

optimal route in sequence *F*\* of *K* points on a *t*×*r* grid.

trajectories *T* and *R* in Figure 1 show the main idea of DTW.

DTW

where

and

sequence becomes as follow:

In order to find the best path through the grid of *t*×*r* grid, three rules of the DTW algorithm should be specified.

(1) Endpoint constraints: *c*(1)=(1,1), c(*K*)=(*t*, *r*).

(2) Local constraints: the predecessor of each (*i*, *j*) point of *F*\* except (1,1) is only one from (*i*-1, *j*), (*i*-1, j-1) or (*i*, *j*-1) , which is shown in Fig.2.

(3)Global constraints: the searching area is *M*( ) *M tr* widening strip area around the diagonal of the *t*×*r* grid, which is shown in Fig.3.

The endpoint constraints illustrate that the initial and final points in both trajectories are located with certainty. The local continuity constrains consider the characteristics of time indices to avoid excessive compression or expansion of the two time scales (Myers et al. 1980).

On the requirement of monotonous and non-negative path, the local constrains also prevent excessive compression or expansion from the several latest neighbors (Itakura, 1975). The global constraints prevent large deviation from the linear path.

Fig. 2. Local continuity constraint with no constraint on slope

#### **2.3 Minimum accumulated distance of the optimal path**

As mentioned above, for the best path through a grid of vector-to-vector distances searched by DTW algorithm, some total distance measured between the two trajectories should be minimized. The calculation of the optimal normalized total distance is impractical, a feasible substitute is minimum accumulated distance, *DA*(*i*, *j*) from point (1,1) to point (*i*, *j*)(Kassidas et al., 1998). The suitable one is:

$$\mathcal{D}\_{\Lambda}(i,j) = d(i,j) + \min[\mathcal{D}\_{\Lambda}(i-1,j), \mathcal{D}\_{\Lambda}(i-1,j-1), \mathcal{D}\_{\Lambda}(i,j-1)], \mathcal{D}\_{\Lambda}(1,1) = d(1,1)\tag{5}$$

where

$$d(i,j) = [T(i,:) - R(j,:)] \* \mathcal{W} \* [T(i,:) - R(j,:)]^\top \tag{6}$$

On-Line Monitoring of Batch Process with Multiway PCA/ICA 245

should not be worked out until the final result *DA* (*t*, *r*) to accumulate a large number of the medium result. The programming can be composed with local dynamic programming in strip of adjacent time intervals, following is the improved algorithm under the three

3) The local optimal path could be searched between the columns (*i*–1, :) and (*i*, :). The start point of the path is (*IP*, *JP*) and the relay end point is (*IE*, *JE*), where *IE*=*IP*+1, *JE* is ascertained

argmin[ ( , ), ( , 1), ( , )

<

(7)

*r*), the rest path is from

min{ , [ ( 1) /( 1) ]}

where *fix* is the function that keeps only the integer fraction of the result of computation.

*q r fix I r t M*

*E*

*E A E P A E P A E*

*J DIJ DIJ DIq*

constraints and eq.5, 6, which is shown in Fig.3.

on the following comparison:

the point (*t*, *p*) to the final point (*t*, *r*).

presented.

1) When *i*=1, compute *DA* (*i*, :) from *DA* (1, 1), let *IP*=1, *JP*=1;

\*

*F*

4) Delete the column of *DA* (*i*-1, :), then set *IP*←*IE*, *JP*←*JE*;

5) Repeate step 2 to step 4 till *i*=*t* (*t* is one end point of pair);

6) If (*IP*, *JP*) is (*t*, *r*), searching stops; otherwise if the (*IP*, *JP*) is (*t*, *p*) (*p*

Fig. 3. The local optimization between two columns in the improved DTW

The iterative procedure proposed for the synchronization of unequal batch trajectories (Kassidas et al., 1998) is a practical approach for industrial process, which is now being

First of all, each variable from each batch should be scaled as preparation. Let *Bi*, *i*=1,…,*I* be the result of scaled batch trajectories from *I* good quality raw batches, the scaling method is to find the average range of each variable in raw batches by averaging the range form each batch, then to divide each variable in all batches with its average range, and store average

**2.5 Procedure of synchronization of batch trajectories** 

ranges for monitoring. Then synchronization begins.

2) Then *i*←(*i* +1), compute *DA* (*i*, :) with the aid of the result of *DA* (*i*-1, :);

*d*(*i*, *j*) is the weighted local distance between the *i* vector of the *T* trajectory and the *j* vector of the *R* trajectory, therein **W** is a positive definite weight matrix that reflects the relative importance of each measured variables.
