## Abstract

The grating measurement systems can be used for displacement and angle measurements. They require of zero reference codes to obtain zero reference signals and absolute measures. The zero reference signals are obtained from the autocorrelation of two identical zero reference codes. The design of codes which generate optimum signals is rather complex, especially for larges codes. In this paper we present a global optimization method, a DIRECT algorithm for the design of zero reference codes. This method proves to be a powerful tool for solving this inverse problem.

©2005 Optical Society of America

## 1. Introduction

The grating measurement systems are widely used to measure the relative displacement which occurs between one grating and another. Typically, one large grating serves as a measuring reference, and is named scale grating. The other one is smaller, it is named index grating and is used to “read” position along the scale grating. This set-up, along with adequate opto-electronic elements, is allows to achieve motion control and is known as optical encoder. Relative motion is detected through any of the typical effects appearing in a double grating system: moire, self-imaging or Lau effects. In many cases, a zero reference signal is necessary in order to obtain an absolute measure. To acquire a zero reference signal, gratings with adjacent Zero Reference Codes (ZRC) have been developed since the seventies. The ZRC consist of a group of unequally spaced slits. In general, a ZRC can be described by the following sequence of binary data

$c=[c0,c1,c2,…,cn]$

where n+1 is the length of the ZRC, ci =1 if a transparent slit is located at the i-position, and cj =0 elsewhere. The sizes of the transparent and opaque regions in the code are integer multiples of the width of a single slit, that we will name b. Finally, the number of transparent and opaque slits are respectively n 1 and n 0, so that n 1+n 0=n+1.

The transmittance of a code can be expressed as the following sum

$t(x)=∑j=0ncjrect(x−jb)$

where the rect function is defined by

$rect(x)={1if∣x∣<12,0if∣x∣≥12.$

When the index grating moves with respect to the scale grating, the two ZRC overlap. A parallel ray beam propagates through both codes and the total amount of transmitted light is registered by means of a photodiode. The output signal is the correlation between the two ZRC’s. In order to increase the maximum of this signal, the two codes are made identical so that the reference signal becomes the autocorrelation of the ZRC.

The design of optimum codes to obtain suitable reference signals has been studied in references [15]. In all these works, the authors consider the properties of the autocorrelation function and they establis h the necessary conditions to achieve a suitable signal. The main difficulty in designing good ZRCs, is that there is not a systematic method of calculus from which arbitrary length ZRCs can be obtained. Some hints are given by Yajun [25] to heuristically construct optimum ZRCs according to predefined criteria. The method consists of filling the code with ones or zeros to fulfill the necessary conditions of optimality, these conditions are only applicable to small-length ZRC, up to 10–12 elements. We address this problem and we present an algorithm for the design of ZRC which generate optimum reference signal for arbitrary size of codes by means of a direct search algorithm.

## 2. General considerations

We will assume that the illuminating light is a parallel ray beam, and diffraction effects are negligible. This approach is valid when the gap between ZRC’s is close with regard to the width of the code slits and the width of the code slits is greater than wavelength of the illuminating light. Under these conditions, the light flux that passes through the two codes when one of them is shifted by displacement t is

$S(τ)=∫−∞+∞t(x)t(x−τ)dx=∑j=−nnaj·Λ(τ−jb)$

where the triangle function is defined as

$Λ(x)={1−∣x∣if∣x∣≤10if∣x∣>1$

and the components of the vector a is defined by

$ak=a−k=∑j=0n−kcjcj+k,k=0,1,…,n.$

If the signal S is sampled at integer multiples of the slit width, it coincides with the vector a,

$S(kb)=Sk=ak,k=0,1,…,n.$

We will work with this sampled version of the autocorrelation signal. Further simplification can be made if we take into account the symmetry of the autocorrelation signal. As Sk=S-k , only the last n+1 terms are needed, and we define de vector S=[S 0,…Sn ]. The next propert ies can be easily demonstrated:

1. The maximum of the autocorrelation signal, S 0, is the number of transparent slits of the ZRC, S 0=$∑j=0n$ $cj2$ =$∑j=0n$ cj =n 1.

2. The width of the central peak is twice the width of the slits of the ZRC.

3. From equation (4) and (7), the value of Sk is equal to the number of subsequences in the ZRC of the type $(1,X,…,X,1︸k−1)$, with X∊{0,1}. When the relative shift between the two codes is kb, the first “one” of the subsequence of the shifted code is faced with the last “one” of the same subsequence in the other code. This property is used to design a suitable ZRC.

The parameters that characterize a zero reference signal are presented in [1] but in metrological applications, the most important parameter is

$K=σS0,$

where σ is the second maximum of the signal, σ=max{S 1,…,Sn }. A good zero reference signal must be a single and well distinct peak, so the secondary maxima of the correlation signal are regarded as noise. According to this, the parameter K quantifies the noise in relation to the signal peak. The smaller its value, the higher the sensitivity and robustness of the zero reference signal.

In the design procedure of Yang and Yin [2], the parameters S 0 and K (and henceforth also σ) are previously selected and fixed. Then the code with the smallest length is chosen. The ZRC design process consists on the addition of subsequences (see property 3.) while the number of repeated subsequences is not greater than σ. There are several possibilities depending on the order in which the subsequences are arranged, and it is necessary to compare these structures one by one to get an optimum result. This process is difficult to program and ZRC longer than 40 bits are very difficult to obtain.

Considering property 3, Yajun [3] has calculated an inferior bound for σ

$σ≥[(2n+1)−(2n+1)2−4n1(n1−1)]2.$

Although there are some simple cases in which this bound is reached, up to now there is no evidence that for any values of n and n1, at least one ZRC could be found for which the equality sign holds. In the design procedure of Yajun [3], once n and n1 has been fixed, the lower bound is computed. Then a ZRC for which the bound is reached is searched using property 3. If it is not possible, the bound is increased in one unit and the search starts once again. The process is repeated until a ZRC with the lowest K is obtained.

Yajun have proposed other designing methods in [4]. He proposes a computer program to calculate all possible ZRC with fixed values of n and n 1, and compare the performance of the obtained autocorrelation signals to obtain the optimal. The computer must consider $C(n−1,n1−2)=(n−1)!(n1−2)!(n−n1+1)!$ ZRC’s. This problem is named “the combinatorial explosion”: the most powerful computer in this moment (Earth Simulator Center, Japan) takes 5×1028 years in the case of n=170 and n 1=85.

In [5], Yajun proposes a method for calculating the ZRC when the autocorrelation signal is known but in general, the optimum signal is not known.

Normally, the period of the grating of the measuring system fixes the wide of the slits of the ZRC. The diameter of the light beam limits the length of the code and the electronic requirement establish a minimum of the S/N ratio of the zero reference signal. This requirement determines the minimum number of slits of the ZRC. According with these working requirements, we have n and n 1 predetermined and we have to minimize the second maximum of the signal, σ. A new design method must therefore be sought.

## 3. Direct algorithm

DIRECT is an algorithm developed by Donald R. Jones et al. [6] for finding the global minimum of a multivariate function subject to simple bounds, using no derivative information. DIRECT is a sampling algorithm. That is, the algorithm samples points in the domain of the function, and uses the information it has obtained to decide where to search next. DIRECT can be useful when the objective function is a “black box” function and we do not know the gradient function. It is guaranteed to converge to the global minimum value if the objective function is continuous in the neighborhood of a global minimum.

The name DIRECT comes from “DIviding RECTangles”, which describes the way the algorithm moves towards the minimum. The first step in the algorithm is to transform the search space in a unit hypercube. The function is then sampled at the center of this hypercube. The hypercube is then divided into smaller hyperrectangles whose center-points are also sampled. Normally, the Lipschitz constant of the objective function is utilized for determining the next rectangle to sample. As the Lipschitz is not known, DIRECT identifies a set of “potentially optimal” rectangles corresponding to all the combinations of Lipschitz constants and rectangles sizes in each iteration. All “potentially optimal” rectangles are further divided into smaller rectangles whose centers are sampled. This method does not have a natural way of defining convergence and DIRECT typically terminates when a user-supplied limit of function evaluations is reached. Unless the global minimum value is known, there is no way to assure that it is reached. In practice, if the optimal value does not change when increasing the number of evaluations we can consider it a global minimum.

## 4. Description of the modeling and results

The DIRECT algorithm deals with problems of the type [7]:

$minxf(x)$
$Lx≤x≤Ux$
$LB≤A·X′≤UB$
$xi∈Iinteger.$

x,Lx,Ux ∊ℝn, A∊ℝm×n and LB, UB∊ℝm.

where Lx and Ux are lower and upper bound for the solution. LB and UB are lower and upper linear constraints, A is a matrix with the linear coefficients of the constraints and x′ is the transpose of x.

For the designing of ZRC, the function to optimize is

$f(c)=max{S1,…,Sn},Sk=∑j=0n−kcjcj−k$
$[0,…,0]≤c≤[1,…,1]$
$n1L≤[1,…,1]·[c1⋮cn]≤n1U$
$c∈ℤn+1$

where f(c)=σ is the second maximum of the autocorrelation signal. The vector c=[c 1,…cn ] is a integer vector and the integer are binary, that is, Lx =[0,…,0] and Ux =[1,…,1]. A is a vector which contains ones and A·c′ is the number of transparent slits in the ZRC, which is bounded between n1L and n1U . Physically, n1L is the minimum value allowed in the center of the autocorrelation signal, its value is matched with the sensibility of the detector, and n 1U is the maximum number of allowed slits, which we can set as the total number of elements of the ZRC.

In order to test the performance of the algorithm, we have first applied it to a low dimension case, which can be treated with previous techniques obtaining the same results. There is a class of ZRC’s for which the second maximum of the autocorrelation signal is one. For these codes, the equality sign in Eq. (9) holds, and the theoretical lower bound is reached. Then, from property 3, the number of repeated subsequences (1,X,…,X,1) cannot be greater than one and the design procedure consists of the addition of subsequences without repetition. Moreover, the optimal objective function value in equation (11) is 1 and this is the global minimum.

An example with 21 elements is: [1,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1]. In [8], Yajun compute the ZRC’s necessary to obtain an autocorrelation signal whose second maximum is one and he show the number of elements and slits of these ZRC’s. We have applied the DIRECT algorithm in these cases and it reaches the global minimum with values up to: n=100 and n 1=11. With these parameters, the number of points in the feasible region is 1.4×1014.

In a general case, a comparison between the theoretical lower bound of s given by the Eq. (9) and the value of the second maximum reached with DIRECT is shown in Fig. 1. The optimizations were done with a fixed number of elements, n=50, and with a variable number of slits in the interval from 1 to 49. From this figure, it can be seen that in few cases it is possible to reach the theoretical lower bound and this takes place when the number of slits is small. There are two reasons to think that the optimal is the global optimal. First, in all cases the number of points in the feasible region is smaller than 1.4×1014, in which case DIRECT find the global optimum. Second, the solution does not change when the number of function evaluations is increased, although the increase of the function evaluations is limited for the computer memory.

Fig. 1. Height of the second maximum of the autocorrelation signal respect to the number of slits in the ZRC. The ZRC has 50 elements. The continuous graph is the reached with the optimization and the dotted one is a lower bound calculated theoretically.

In Fig. 2 we display some of the optimum autocorrelation signals found by DIRECT in a case whose dimension makes it unmanageable for others design methods: n=50 and n 1=25. The algorithm finds 136 solutions with σ=11.

Fig. 2. Six of the 136 autocorrelation signals found by the algorithm with n=50 and s=25. The value of the second maximum is S1 =11.

The ZRC’s which generate the autocorrelation signals presented in the Fig. 2 are shown in Fig. 3. From the point of view of the optimization of the autocorrelation, all these codes are equivalent. Another advantage of the DIRECT method is that, among the 136 solutions it finds, it is possible the selection of the ZRC’s by taking into consideration other secondary (optical) criteria : sensibility to diffraction, sensibility to non-uniformity of the light beams, etc.

Fig. 3. Six of the 136 ZRC’s found by the algorithm with n=50 and s=25.

## 5. Conclusions

The necessary calculations for the design of the zero reference marks are laborious. The generation of long codes can even be impracticable with the currently available designing tools. We have proposed a method for designing zero reference codes with global optimization techniques. A simple model of the problem is presented and global optimal results are obtained. The results have been proved in known cas es and the optimal is reached up to codes of 100 elements. Moreover, the algorithm obtains all solutions with the same optimal value of the objective function. A selection is possible in order to obtain codes with other properties.

## Acknowledgments

This research was supported by the national research program, Project No. DPI2001-1238.

## References and Links

1. Li Yajun, “Autocorrelation function of a bar code system” J. Mod. Opt. 34, 1571–5 (1987). [CrossRef]

2. Xiangyang Yang and Chunyong Yin, “A new method for the design of zero reference marks for grating measurement systems” J. Phys. E Sci. Instrum. 19, 34–7 (1986). [CrossRef]

3. Li Yajun, “Optical valve using bar codes” Optik 79, 67–74 (1988).

4. Li Yajun, “Characterization and design of bar code systems for accurate alignment” Appl. Opt. 27, 2612–20 (1988). [CrossRef]

5. Li Yajun and F. T. S. Yu, “Design of bar code systems for accurate alignment: a new method” Appl. Opt. 29, 723–5 (1990). [CrossRef]

6. D. R. Jones, C. D. Perttunen, and B. E. Stuckman. “Lipschitzian Optimization without the Lipschitz Constant” J. Optim. Theory Appl. 79, 157–181 (1993). [CrossRef]

7. Donald R. Jones. DIRECT Global optimization algorithm. Encyclopedia of Optimization. (Kluwer Academic Publishers, Dordrecht, 2001).

8. Li Yajun, “Bar codes with special correlations like those of the Barker codes” Optics Communications 83, 15–20 (1991). [CrossRef]

9. Bjorkman, Mattias, Holmstrom, and Kenneth. “Global Optimization Using the DIRECT Algorithm in Matlab” Advanced Modeling and Optimization , 1, 17–37 (1999).

10. C. T. Kelley. Iterative Methods for Optimization. (SIAM, Portland1999). [CrossRef]

11. Daniel E. Finkel. DIRECT Optimization Algorithm User Guide. (2003).

12. Daniel E. Finkel and C. T. Kelley. “Convergence analysis of the DIRECT algorithm” Optimization Online (2004).

13. J. M. Gablonski. DIRECT Version 2.0 User Guide. (CRSC Technical Report, Raleigh, 2001).

### References

• View by:

1. Li Yajun, “Autocorrelation function of a bar code system” J. Mod. Opt. 34, 1571–5 (1987).
[Crossref]
2. Xiangyang Yang and Chunyong Yin, “A new method for the design of zero reference marks for grating measurement systems” J. Phys. E Sci. Instrum. 19, 34–7 (1986).
[Crossref]
3. Li Yajun, “Optical valve using bar codes” Optik 79, 67–74 (1988).
4. Li Yajun, “Characterization and design of bar code systems for accurate alignment” Appl. Opt. 27, 2612–20 (1988).
[Crossref]
5. Li Yajun and F. T. S. Yu, “Design of bar code systems for accurate alignment: a new method” Appl. Opt. 29, 723–5 (1990).
[Crossref]
6. D. R. Jones, C. D. Perttunen, and B. E. Stuckman. “Lipschitzian Optimization without the Lipschitz Constant” J. Optim. Theory Appl. 79, 157–181 (1993).
[Crossref]
7. Donald R. Jones. DIRECT Global optimization algorithm. Encyclopedia of Optimization. (Kluwer Academic Publishers, Dordrecht, 2001).
8. Li Yajun, “Bar codes with special correlations like those of the Barker codes” Optics Communications 83, 15–20 (1991).
[Crossref]
9. Bjorkman, Mattias, Holmstrom, and Kenneth. “Global Optimization Using the DIRECT Algorithm in Matlab” Advanced Modeling and Optimization,  1, 17–37 (1999).
10. C. T. Kelley. Iterative Methods for Optimization. (SIAM, Portland1999).
[Crossref]
11. Daniel E. Finkel. DIRECT Optimization Algorithm User Guide. (2003).
12. Daniel E. Finkel and C. T. Kelley. “Convergence analysis of the DIRECT algorithm” Optimization Online (2004).
13. J. M. Gablonski. DIRECT Version 2.0 User Guide. (CRSC Technical Report, Raleigh, 2001).

#### 1999 (1)

Bjorkman, Mattias, Holmstrom, and Kenneth. “Global Optimization Using the DIRECT Algorithm in Matlab” Advanced Modeling and Optimization,  1, 17–37 (1999).

#### 1993 (1)

D. R. Jones, C. D. Perttunen, and B. E. Stuckman. “Lipschitzian Optimization without the Lipschitz Constant” J. Optim. Theory Appl. 79, 157–181 (1993).
[Crossref]

#### 1991 (1)

Li Yajun, “Bar codes with special correlations like those of the Barker codes” Optics Communications 83, 15–20 (1991).
[Crossref]

#### 1988 (2)

Li Yajun, “Optical valve using bar codes” Optik 79, 67–74 (1988).

#### 1987 (1)

Li Yajun, “Autocorrelation function of a bar code system” J. Mod. Opt. 34, 1571–5 (1987).
[Crossref]

#### 1986 (1)

Xiangyang Yang and Chunyong Yin, “A new method for the design of zero reference marks for grating measurement systems” J. Phys. E Sci. Instrum. 19, 34–7 (1986).
[Crossref]

#### Bjorkman,

Bjorkman, Mattias, Holmstrom, and Kenneth. “Global Optimization Using the DIRECT Algorithm in Matlab” Advanced Modeling and Optimization,  1, 17–37 (1999).

#### Finkel, Daniel E.

Daniel E. Finkel. DIRECT Optimization Algorithm User Guide. (2003).

Daniel E. Finkel and C. T. Kelley. “Convergence analysis of the DIRECT algorithm” Optimization Online (2004).

#### Gablonski, J. M.

J. M. Gablonski. DIRECT Version 2.0 User Guide. (CRSC Technical Report, Raleigh, 2001).

#### Holmstrom,

Bjorkman, Mattias, Holmstrom, and Kenneth. “Global Optimization Using the DIRECT Algorithm in Matlab” Advanced Modeling and Optimization,  1, 17–37 (1999).

#### Jones, D. R.

D. R. Jones, C. D. Perttunen, and B. E. Stuckman. “Lipschitzian Optimization without the Lipschitz Constant” J. Optim. Theory Appl. 79, 157–181 (1993).
[Crossref]

#### Jones, Donald R.

Donald R. Jones. DIRECT Global optimization algorithm. Encyclopedia of Optimization. (Kluwer Academic Publishers, Dordrecht, 2001).

#### Kelley, C. T.

Daniel E. Finkel and C. T. Kelley. “Convergence analysis of the DIRECT algorithm” Optimization Online (2004).

C. T. Kelley. Iterative Methods for Optimization. (SIAM, Portland1999).
[Crossref]

#### Kenneth,

Bjorkman, Mattias, Holmstrom, and Kenneth. “Global Optimization Using the DIRECT Algorithm in Matlab” Advanced Modeling and Optimization,  1, 17–37 (1999).

#### Mattias,

Bjorkman, Mattias, Holmstrom, and Kenneth. “Global Optimization Using the DIRECT Algorithm in Matlab” Advanced Modeling and Optimization,  1, 17–37 (1999).

#### Perttunen, C. D.

D. R. Jones, C. D. Perttunen, and B. E. Stuckman. “Lipschitzian Optimization without the Lipschitz Constant” J. Optim. Theory Appl. 79, 157–181 (1993).
[Crossref]

#### Stuckman, B. E.

D. R. Jones, C. D. Perttunen, and B. E. Stuckman. “Lipschitzian Optimization without the Lipschitz Constant” J. Optim. Theory Appl. 79, 157–181 (1993).
[Crossref]

#### Yajun, Li

Li Yajun, “Bar codes with special correlations like those of the Barker codes” Optics Communications 83, 15–20 (1991).
[Crossref]

Li Yajun, “Optical valve using bar codes” Optik 79, 67–74 (1988).

Li Yajun, “Autocorrelation function of a bar code system” J. Mod. Opt. 34, 1571–5 (1987).
[Crossref]

#### Yang, Xiangyang

Xiangyang Yang and Chunyong Yin, “A new method for the design of zero reference marks for grating measurement systems” J. Phys. E Sci. Instrum. 19, 34–7 (1986).
[Crossref]

#### Yin, Chunyong

Xiangyang Yang and Chunyong Yin, “A new method for the design of zero reference marks for grating measurement systems” J. Phys. E Sci. Instrum. 19, 34–7 (1986).
[Crossref]

#### Advanced Modeling and Optimization (1)

Bjorkman, Mattias, Holmstrom, and Kenneth. “Global Optimization Using the DIRECT Algorithm in Matlab” Advanced Modeling and Optimization,  1, 17–37 (1999).

#### J. Mod. Opt. (1)

Li Yajun, “Autocorrelation function of a bar code system” J. Mod. Opt. 34, 1571–5 (1987).
[Crossref]

#### J. Optim. Theory Appl. (1)

D. R. Jones, C. D. Perttunen, and B. E. Stuckman. “Lipschitzian Optimization without the Lipschitz Constant” J. Optim. Theory Appl. 79, 157–181 (1993).
[Crossref]

#### J. Phys. E Sci. Instrum. (1)

Xiangyang Yang and Chunyong Yin, “A new method for the design of zero reference marks for grating measurement systems” J. Phys. E Sci. Instrum. 19, 34–7 (1986).
[Crossref]

#### Optics Communications (1)

Li Yajun, “Bar codes with special correlations like those of the Barker codes” Optics Communications 83, 15–20 (1991).
[Crossref]

#### Optik (1)

Li Yajun, “Optical valve using bar codes” Optik 79, 67–74 (1988).

#### Other (5)

Donald R. Jones. DIRECT Global optimization algorithm. Encyclopedia of Optimization. (Kluwer Academic Publishers, Dordrecht, 2001).

C. T. Kelley. Iterative Methods for Optimization. (SIAM, Portland1999).
[Crossref]

Daniel E. Finkel. DIRECT Optimization Algorithm User Guide. (2003).

Daniel E. Finkel and C. T. Kelley. “Convergence analysis of the DIRECT algorithm” Optimization Online (2004).

J. M. Gablonski. DIRECT Version 2.0 User Guide. (CRSC Technical Report, Raleigh, 2001).

### Cited By

Optica participates in Crossref's Cited-By Linking service. Citing articles from Optica Publishing Group journals and other participating publishers are listed here.

Alert me when this article is cited.

### Figures (3)

Fig. 1. Height of the second maximum of the autocorrelation signal respect to the number of slits in the ZRC. The ZRC has 50 elements. The continuous graph is the reached with the optimization and the dotted one is a lower bound calculated theoretically.
Fig. 2. Six of the 136 autocorrelation signals found by the algorithm with n=50 and s=25. The value of the second maximum is S1 =11.
Fig. 3. Six of the 136 ZRC’s found by the algorithm with n=50 and s=25.

### Equations (17)

Equations on this page are rendered with MathJax. Learn more.

$c = [ c 0 , c 1 , c 2 , … , c n ]$
$t ( x ) = ∑ j = 0 n c j rect ( x − j b )$
$rect ( x ) = { 1 if ∣ x ∣ < 1 2 , 0 if ∣ x ∣ ≥ 1 2 .$
$S ( τ ) = ∫ − ∞ + ∞ t ( x ) t ( x − τ ) dx = ∑ j = − n n a j · Λ ( τ − j b )$
$Λ ( x ) = { 1 − ∣ x ∣ if ∣ x ∣ ≤ 1 0 if ∣ x ∣ > 1$
$a k = a − k = ∑ j = 0 n − k c j c j + k , k = 0 , 1 , … , n .$
$S ( kb ) = S k = a k , k = 0 , 1 , … , n .$
$K = σ S 0 ,$
$σ ≥ [ ( 2 n + 1 ) − ( 2 n + 1 ) 2 − 4 n 1 ( n 1 − 1 ) ] 2 .$
$min x f ( x )$
$L x ≤ x ≤ U x$
$LB ≤ A · X ′ ≤ UB$
$x i ∈ I integer .$
$f ( c ) = max { S 1 , … , S n } , S k = ∑ j = 0 n − k c j c j − k$
$[ 0 , … , 0 ] ≤ c ≤ [ 1 , … , 1 ]$
$n 1 L ≤ [ 1 , … , 1 ] · [ c 1 ⋮ c n ] ≤ n 1 U$
$c ∈ ℤ n + 1$