1.. Introduction
================

The sun sensor is one of the most important devices for satellites. The early sun sensors were mainly sun appearance sensors and analog sun sensors \[[@b1-sensors-11-02857]\]. With the development of space technology in recent years, requirements for sun sensors has been extended to a large field of view and high accuracy levels. The traditional design and implementation methods cannot meet these the requirements, so the single-axis digital sun sensor \[[@b2-sensors-11-02857]\] appeared, with an accuracy of better than 0.1°. Two of the same single-axis digital sun sensors mounted vertically can constitute a conventional two-axis sun sensor. Such digital sun sensors are widely used currently.

Array image sensors such as CCD or CMOS and so on have been widely applied in space science. The array image sensor-based sun sensor is currently a research focus \[[@b3-sensors-11-02857]\]. This kind of equipment is of high accuracy, high anti-interference. The aperture of sun sensors can be divided into single-aperture \[as shown in [Figure 1(a)](#f1-sensors-11-02857){ref-type="fig"}\] and multi-aperture \[as shown in [Figure 1(b)](#f1-sensors-11-02857){ref-type="fig"}\]. Compared with the traditional linear array sun sensor, the accuracy of a single-aperture sun sensor is increased, however, since only one spot is used in the system, image utilization rate is low, so it is difficult to further enhance its accuracy. The Italian Galileo Avionica Company has developed a single-aperture sun sensor, named Smart Sun Sensor \[[@b4-sensors-11-02857]\].

Compared with the single-aperture sun sensor, a multi-aperture sun sensor has the following three advantages: Accuracy: as the single-aperture sun sensor accuracy depends mainly on the positioning accuracy of the sun spot, and its pointing accuracy is only about 0.03° ,but for the multi-aperture sun sensor the accuracy of the sun spot location centroid is proportional to the square root of the number of apertures. Assuming that the pointing accuracy of a single hole *δ*, and hole arrays of *N* × *N*, then the final pointing accuracy is *δ/N*, This shows that multi-aperture can greatly improve the accuracy of the sun sensor.Reliability: for the single-aperture sun sensor there is a very deadly danger: lack of reliability! When the hole is blocked or partially blocked, the accuracy will be greatly affected or even cause the system to lose function. For the multi-aperture sun sensor, the distribution of the image sensor area is relatively large, so even when part of the holes are completely blocked, using a reasonable method, the system still be able to guarantee the normal operation.The image sensor requirements: the requirements of single-aperture sun sensor for image sensors are relatively high. The existence of bad pixels on the image sensor where the sun spot may fall will affect the accuracy and even function, while for the multi-aperture sun sensor, with a *N* × *N* imaging point, the distribution of the image sensor area is relatively large, the damage to individual pixels has almost no effect on the system accuracy.

From the above analysis we can find that multi-aperture sun sensors are superior to single-aperture sun sensors as far as the accuracy, reliability, and the requirements of the image sensor are concerned, so multi-aperture sun sensors must be the future direction of the technology.

2.. Modeling of the Sun Sensor \[[@b5-sensors-11-02857]\]
=========================================================

A multi-aperture sun sensor is commonly composed of a piece of mask and a CCD or APS (Active pixel sensor) CMOS detector below at a distance of about several millimeters. The sun spot is formed at the detector through the aperture, as shown in [Figure 1(a)](#f1-sensors-11-02857){ref-type="fig"}. In the [Figure 1(a)](#f1-sensors-11-02857){ref-type="fig"}, *m~c~* and *n~c~* denote the coordinates of the sun spot in the sun sensor body coordinates, *l* denotes the distance between the sun spot and hole sight point, *h* denotes the distance between the mask and the focal plane, *θ* denotes the incidence angle and *α*, *β* denote the sunray horizontal and azimuth orientation in the sun sensor body coordinates, respectively.

The relationships are as follows: $$\theta = ~\text{arctan}(\frac{l}{h}),\alpha = ~\text{arctan}(\frac{m_{c}}{h}),\beta = ~\text{arctan}(\frac{n_{c}}{h})$$ $$l = \sqrt{m_{c}^{2} + n_{c}^{2}}$$ $$\text{tan}~\theta = \sqrt{{(\text{tan}~\alpha)}^{2} + {(\text{tan}~\beta)}^{2}}$$

For a given distance *h*, the greater the number of apertures the higher the accuracy. However, the assembly and alignment errors will significantly impact the system accuracy when the location accuracy is of 1/100 pixels, about 0.005°. Generally, the sub-pixel accuracy of a single sun spot is at the level of 0.05--0.1 pixels, to obtain the whole sun spot location centroid accuracy of 1/100 pixels, the number of apertures should be more than 25 (1/100 = 0.05/251/2), so the aperture pattern is designed as a 6 × 6 array in this paper, as shown in [Figure 2](#f2-sensors-11-02857){ref-type="fig"}.

Assuming the sun angles are *α,β* respectively and the sun spot centroid is *m~c~, n~c~* their relationship can be expressed by [Equation (1)](#FD1){ref-type="disp-formula"}. In fact, the Equation becomes much more complicated because of the refraction which occurs when a sun ray goes through different media sequentially (vacuum-mask glass-vacuum-detector protecting glass-air) before it arrives at the detector, as shown in [Figure 3](#f3-sensors-11-02857){ref-type="fig"}.

From [Figure 3](#f3-sensors-11-02857){ref-type="fig"} we can conclude that the greater *h* the higher accuracy, however, the *h* must ensure that the image of sunlight in the field of view (FOV) is still within the photosensitive surface of the detector. So according to the effective detection area of the Star1000 and the sun sensor FOV design *h*, from the [Figure 3](#f3-sensors-11-02857){ref-type="fig"}, we can find *h* = *h~2~* + *h~3~* + *h~4~*; for the specific Star1000 *h~3~* and *h~4~* is fixed, when the image of sunlight in the FOV is within the photosensitive surface of the detector, the greater *h~2~* the higher accuracy. When the incident angle is large, *h~3~* and *h~4~* introduce nonlinear factors which may affect the sun sensor accuracy.

From [Figure 3](#f3-sensors-11-02857){ref-type="fig"}, we can conclude that the relationship between *l* and *θ* is: $$l = h_{2}~\text{tan}~\theta + h_{3}~\text{tan}~\theta_{3} + h_{4}~\text{tan}~\theta_{4}$$ $$\frac{n_{\mathit{Glass}}}{n_{\mathit{Vacuum}}} = \frac{\text{sin}~\theta}{\text{sin}~\theta_{3}}$$ $$\frac{n_{\mathit{Air}}}{n_{\mathit{Glass}}} = \frac{\text{sin}~\theta_{3}}{\text{sin}~\theta_{4}}$$

Where *n~glass~, n~vacuum~, n~air~* denote the light refractive index in the detector protecting glass, vacuum and air, respectively, and *l* is the displacement of the sun spot centroid in the case of normal incidence.

Substitution of *θ~3~* and *θ~4~* from [Equations (5)](#FD5){ref-type="disp-formula"} and [(6)](#FD6){ref-type="disp-formula"} into [Equation (4)](#FD4){ref-type="disp-formula"} yields: $$l = h_{2}~\text{tan}~\theta + h_{3}~\text{tan}(\text{arcsin}(\frac{\text{sin}~\theta}{n_{\mathit{Glass}}})) + h_{4}~\text{tan}(\text{arcsin}(\frac{\text{sin}~\theta}{n_{\mathit{Air}}}))$$

Since *h~2~,h~3~,h~4~,n~glass~, n~air~* are all constants, *l* is a function of the incidence angle *θ*. Conversely, *θ* could be expressed as: $$\theta = f(l) = f(\sqrt{m_{c}^{2} + n_{c}^{2}})$$

Combining [Equations (1](#FD1){ref-type="disp-formula"}--[3)](#FD3){ref-type="disp-formula"} and [(8)](#FD8){ref-type="disp-formula"} yields: $$\begin{array}{l}
{\alpha = ~\text{arctan}\frac{m_{c}~\text{tan}(f(\sqrt{m_{c}^{2} + n_{c}^{2}}))}{\sqrt{m_{c}^{2} + n_{c}^{2}}}} \\
{\beta = ~\text{arctan}\frac{n_{c}~\text{tan}(f(\sqrt{m_{c}^{2} + n_{c}^{2}}))}{\sqrt{m_{c}^{2} + n_{c}^{2}}}} \\
\end{array}$$

[Equations (7](#FD7){ref-type="disp-formula"}--[9)](#FD9){ref-type="disp-formula"} illustrate the process to calculate the sun angles (*α, β*) from the sun spot centroid location (*m~c~, n~c~*) in the sun sensor body coordinates.

3.. APS CMOS Detector Characteristics \[[@b6-sensors-11-02857],15\]
===================================================================

The STAR1000 is a CMOS image sensor with 1,024 by 1,024 pixels on a 15 mm pitch. It features on-chip Fixed Pattern Noise (FPN) correction, a programmable gain amplifier, and a 10-bit Analog-to-Digital Converter (ADC). All circuits are designed using the radiation tolerant design rules for CMOS image sensors, to allow high tolerance against to total dose effects, for more details about this one can refer to \[[@b5-sensors-11-02857]\]. It is different from the CCD read out mechanism, for the APS based image sensors, in that registers that are directly accessed by the external controller contain the X- and Y-addresses of the pixels to be read. This architecture provides flexible operation and allows different operation modes such as (multiple) windowing, subsampling, and so on. Compared with the CCD detector, APS CMOS is more suitable as a detector for a sun sensor.

4.. MEANSHIFT-Based High-Precision Positioning and Tracking Algorithm
=====================================================================

The traditional spot positioning method is the correlation algorithm \[[@b5-sensors-11-02857]\], but this approach has two shortcomings: (1) positioning accuracy is not high, and typically only 0.03° accuracy is achieved (2). It cannot track the movement of the sun spot. If the sun spot location changes with the satellite attitude, the correlation algorithm cannot track the movement of the sun spot and needs to renew the location of the sun spot, which is very complicated and time consuming. In this paper we employ FMMS which not only offers high positioning accuracy but also can be adaptive to track the location of spot movement.

4.1.. The Spot Features Description and Similarity Function
-----------------------------------------------------------

In this paper we locate the coordinates of the centroid by identifying the spot, so we need to define the feature of the spot before identification. {*x~i~*}~*i*\ =\ *1*...*n*~ is a region of the normalized data points set (which could be viewed as pixels) with 0 as the center. An isotropic, convex profile with a monotonically decreasing kernel function *k(x)* weighted for all points, farther away from the center, the smaller the weight.

According to the MEANSHIFT \[[@b7-sensors-11-02857]\] algorithm, calculating the spot features is divided into the following three steps: Characterization of the pixel value ([Figure 4](#f4-sensors-11-02857){ref-type="fig"}). Defined function *b : R*^2^ → {1\...*m*}, for each pixel, 0 ≤ *x* ≤ 255,*b(x)* is the quantified number of the pixels value in the quantitative feature space: $$b(x) = \left\{ \begin{matrix}
1 & {x < t_{1}} \\
2 & {t_{1} \leq x < t_{2}} \\
 \vdots & \vdots \\
m & {t_{n} \leq x} \\
\end{matrix} \right.$$Select kernel function ([Figures 5](#f5-sensors-11-02857){ref-type="fig"} and [6](#f6-sensors-11-02857){ref-type="fig"}). There are many kinds of kernel function mentioned in \[[@b7-sensors-11-02857]\], such as Epanechnikove kernel: $$K_{E}\left( x \right) = \begin{cases}
{C_{k}\left( {1 - \left\| x \right\|^{2}} \right)} & {\left\| x \right\| < 1} \\
{0~~~~~~\left\| x \right\| \geq 1} & \\
\end{cases}$$normal kernel: $$K_{N}\left( x \right) = \left( {2\pi} \right)^{- d/2}~\text{exp}{({- \frac{1}{2}\left\| x \right\|^{2}})}$$

In this paper we employed the Epanechnikove kernel. For the definition of the kernel function one can refer to \[[@b7-sensors-11-02857]\], as no details are provided here. 3. Using the kernel function weighted all the quantified pixel, Calculated the spot feature vector as follows: $${\overset{\frown}{q}}_{u} = C{\sum\limits_{i = 1}^{n}{k_{E}\left( \left\| x_{i} \right\|^{2} \right)\delta\left\lbrack {b\left( x_{i} \right) - u} \right\rbrack,~u = 1\cdots m}}$$

In which constant C is a normalization function, makes the $\sum_{u = 1}^{m}{{\overset{\frown}{q}}_{u} = 1}$, then $C = \frac{1}{\sum_{i = 1}^{n}{k_{E}(\left\| x_{i}^{*} \right\|^{2})}}$.

For a simulated sun spot such as [Figure 7](#f7-sensors-11-02857){ref-type="fig"}. The quantified spot template is shown as [Figure 5](#f5-sensors-11-02857){ref-type="fig"}. The kernel function weight distribution is shown as [Figure 6](#f6-sensors-11-02857){ref-type="fig"} and a 3-dimensional map of the kernel function is shown as [Figure 7](#f7-sensors-11-02857){ref-type="fig"}. The feature vector is: *q*~1~ = 0.08999 *q*~2~ = 0.28798 *q*~3~ = 0.23038 *q*~4~ = 0.14399 *q*~5~ = 0.21886 *q*~6~ = 0.02880*q̑* = \[0.08999, 0.28798, 0.23038, 0.14399, 0.21886, 0.02880\]

We set the candidate target model {*x~i~*}~*i*=1...*n~h~*~, with *y* as the center. Using the same kernel profile, the radius *h*, features *u* = *1...m* probability of occurrence in the candidate target model is: $${\overset{\frown}{p}}_{u}(y) = C_{h}\sum\limits_{i = 1}^{n_{h}}{k_{E}({\|\frac{y - x_{i}}{h}\|}^{2})\delta\lbrack b(x_{i}) - u\rbrack}$$

If *C~h~* is a normalization factor, making $\sum_{u = 1}^{m}{{\overset{\frown}{p}}_{u} = 1}$, then: $$C_{h} = \frac{1}{\sum_{i = 1}^{n}{k({\|\frac{y - x_{i}}{h}\|}^{2})}}$$

The term *h* determines the scale of the candidate target. *q̑~u~* and *p̑~u~* (*y*) is the description of the feature of the goal and the candidate. Using the Bhattacharyya coefficient: $$\overset{\frown}{\rho}(y) \equiv \rho\lbrack\overset{\frown}{p}(y),\overset{\frown}{q}\rbrack = \sum\limits_{u = 1}^{m}\sqrt{{\overset{\frown}{p}}_{u}(y){\overset{\frown}{q}}_{u}}$$we describe the degree of similarity between the feature of the goal and the candidate; the greater the coefficient, the more similarity between the goal and the candidate. The distance between them is defined as follows: $$d(y) = \sqrt{1 - \rho\lbrack\overset{\frown}{p}(y),\overset{\frown}{q}\rbrack}$$

4.2.. The Sun Spot Pointing and Tracking
----------------------------------------

With a description of the goal and the candidate target, and the criteria which can gauge their similarity degree, pointing and tracking the spot becomes a problem of searching for a new spot location in the current frame which made it possible that the function with *y* as independent variables could obtain the minimum distance. Searching begins from the previous location of a spot, and looking around in the neighborhood. Minimizing [Equation (15)](#FD15){ref-type="disp-formula"} is equivalent to maximizing [Equation (14)](#FD14){ref-type="disp-formula"}. Assuming *y*~1~ is the spot location of the previous frame, we first calculate {*p̂~u~* (*y*~1~)}~*u*=1,...*m*~ in the current frame, if we expand the *ρ*\[*p̑*(*y*), *q̑*\] in the predicted location of *y*~1~, we then get the linear approximation of *ρ*\[*p̑*(*y*), *q̑*\]: $$\rho\lbrack\overset{\frown}{p}(y),\overset{\frown}{q}\rbrack \approx \frac{1}{2}\sum\limits_{u = 1}^{m}\sqrt{{\overset{\frown}{p}}_{u}({\overset{\frown}{y}}_{1}){\overset{\frown}{q}}_{u}} + \frac{1}{2}\sum\limits_{u = 1}^{m}{{\overset{\frown}{p}}_{u}(y)\sqrt{\frac{{\overset{\frown}{q}}_{u}}{{\overset{\frown}{p}}_{u}({\overset{\frown}{y}}_{1})}}}$$

This kind of approximation is satisfactory when there is little difference between the candidate {*p̂~u~* (*y*)} ~*u*=1,...*m*~ and the initial {*p̂~u~* (*ŷ*~1~)} ~*u*=1,...*m*~. In general, this assumption for the adjacent two frames is reasonable.

Combining [Equation (13)](#FD13){ref-type="disp-formula"} with [(16)](#FD16){ref-type="disp-formula"} yields: $$\rho\lbrack\overset{\frown}{p}(y),\overset{\frown}{q}\rbrack \approx \frac{1}{2}\sum\limits_{u = 1}^{m}\sqrt{{\overset{\frown}{p}}_{u}({\overset{\frown}{y}}_{1}){\overset{\frown}{q}}_{u}} + \frac{C_{h}}{2}\sum\limits_{i = 1}^{n_{h}}{w_{i}k^{\prime}({\|\frac{y - x_{i}}{h}\|}^{2})}$$in which: $$w_{i} = \sum\limits_{u = 1}^{m}{\delta\lbrack b(x_{i}) - u\rbrack\sqrt{\frac{{\overset{\frown}{q}}_{u}}{{\overset{\frown}{p}}_{u}({\overset{\frown}{y}}_{1})}}}$$

In this way, minimizing *d*(*y*) becomes to maximize the second half of [Equation (17)](#FD17){ref-type="disp-formula"}, which denotes the kernel density estimation calculated by using *k*(*x*) at the *y~1~* in current frame, so that we can use the MEANSHIFT procedure to find the great density estimation value (mode) in the neighborhood. In this process, the kernel shift from the current location *y* to the new location *y~1~*: $$y_{1} = \frac{\sum_{i = 1}^{n_{h}}{x_{i}w_{i}g({\|\frac{y - x_{i}}{h}\|}^{2})}}{\sum_{i = 1}^{n_{h}}{w_{i}g({\|\frac{y - x_{i}}{h}\|}^{2})}}$$in which *g*(*x*)*=−k′*(*x*)

If we set the spot with a feature vector {*q~u~*}~u\ =\ 1,...,m~ at *y~0~* in the previous frame, *y*~1~ is the new spot location. Then the flow of the MEANSHIFT algorithm is:

Set the spot with a feature vector{*q~u~*}~u\ =\ 1,...,m~, at *y~0~* in the previous frame. Calculate the feature vector of candidate spot {*p̑~u~* (*y̑*~0~)} ~*u*=1...*m*~ of the first spot in current frame, and Bhattacharyya coefficient: $$\rho\lbrack\overset{\frown}{p}({\overset{\frown}{y}}_{0}),\overset{\frown}{q}\rbrack = \sum_{u = 1}^{m}\sqrt{{\overset{\frown}{p}}_{u}({\hat{y}}_{0}){\overset{\frown}{q}}_{u}}$$Calculate{*w~i~*}*~i=1...m~* with [Equation (18)](#FD18){ref-type="disp-formula"}. $$w_{i} = \sum\limits_{u = 1}^{m}{\delta\lbrack b(x_{i}) - u\rbrack\sqrt{\frac{{\overset{\frown}{q}}_{u}}{{\overset{\frown}{p}}_{u}({\overset{\frown}{y}}_{1})}}}$$Calculate the new location of spot with [Equation (19)](#FD19){ref-type="disp-formula"} $${\overset{\frown}{y}}_{1} = \frac{\sum_{i = 1}^{n_{h}}{x_{i}w_{i}g({\|\frac{\overset{\frown}{y} - x_{i}}{h}\|}^{2})}}{\sum_{i = 1}^{n_{h}}{w_{i}g({\|\frac{\overset{\frown}{y} - x_{i}}{h}\|}^{2})}}$$$\rho\lbrack\overset{\frown}{p}({\overset{\frown}{y}}_{1}),\overset{\frown}{q}\rbrack = \sum_{u = 1}^{m}\sqrt{{\overset{\frown}{p}}_{u}(y_{1}){\overset{\frown}{q}}_{u}}$.If *ρ*\[*p̑*(*y̑*~1~), *q̑*\] \< *ρ*\[*p̑*(*y̑*~0~), *q̑*\], then $\left. {\overset{\frown}{y}}_{1}\leftarrow\frac{1}{2}({\overset{\frown}{y}}_{0} + {\overset{\frown}{y}}_{1}) \right.$ until *ρ*\[*p̑*(*y̑*~1~), *q̑*\] \> *ρ*\[*p̑*(*y̑*~0~), *q̑*\]If ‖*y̑*~1~ -- *y̑*~0~‖\< *ɛ* then stop iteration to get the spot new location. $$\left. \text{else}~{\overset{\frown}{y}}_{0}\leftarrow{\overset{\frown}{y}}_{1}~\text{jump}~\text{to}~2 \right.$$Repeat steps 1--6 to get the coordinates of other sun spots.Calculate the sun incident angle (*α~i~, β~i~*) *i* = 1...36.Then the final sun incident angle (*α, β*) are $$\alpha = \frac{\sum\limits_{i = 1}^{n}\alpha_{i}}{n},\beta = \frac{\sum\limits_{i = 1}^{n}\beta_{i}}{n}$$

4.3.. Over-Relax Technology Based Multi-Point Fast MEAN Shift Algorithm
-----------------------------------------------------------------------

For a single spot using MEANSHIFT algorithm positioning usually reaches sub-pixel accuracy, and in order to achieve high-precision positioning we need to use spot arrays. For each spot in the array we can get a pair of sun incident angles *α~i~, β~i~,* then the final sun incident angle is: $$\alpha = \frac{\sum\limits_{i = 1}^{n}\alpha_{i}}{n},\beta = \frac{\sum\limits_{i = 1}^{n}\beta_{i}}{n}$$in which *n* is the number of the aperture.

As the MEANSHIFT computing process is complex, a multiple point MEANSHIFT procedure requires a lot of time, so in order to improve the real-time system, we need to study the fast MEANSHIFT algorithm. In this paper we use the over-relaxing method \[[@b8-sensors-11-02857]\] to adjust the step size, and acceleration can be achieved. The over-relaxed bound optimization iteration is: $$y^{(k + 1)} = y^{(k)} + \beta \cdot T_{\mathit{step}}$$

In which *T~step~* is the MEANSHIFT vector. Apparently when the learning rate *β* = 1, over-relaxed optimization reduces to the standard MEANSHIFT algorithm. It is easily seen that when *β* \> 1 acceleration is realized. However by simply assigning a fixed value to *β*, no convergence is secured and it seems quite difficult to get the optimal value for *β*. Xu *et al.* \[[@b9-sensors-11-02857]\] proves that in the case of the Gaussian Mixture Model (GMM) parameter estimation, convergence can be guaranteed using this method when we are close to a local maximum and 0 \< *β* \< 2.This conclusion is generalized to the case of general bound optimization methods in \[[@b10-sensors-11-02857],[@b11-sensors-11-02857]\]. Based on this important proposition, a simple adaptive over-relaxed bound optimization is readily available: the learning rate can be adjusted by evaluating the cost function. When the cost function becomes worse for some *β* \> 1, then *β* has been set too large and needs to be reduced. By simply setting *β* = 1 immediately, convergence can be achieved. In this paper by regarding MEANSHIFT as a special case of bound optimization we presented the accelerated MEANSHIFT algorithm obtained in this way: Initialization: Set the iteration index *k* = 1, and the step parameter *α* \> 1.Iterate until convergence condition is met: Calculate *ŷ*~*i*+1~ with [Equation (19)](#FD19){ref-type="disp-formula"}. And the MEANSHIFT vector m~G~ (*ŷ*~*i*+1~) = *ŷ*~*i*+1~ − *ŷ*~*i*~.*y*~*i*+1~ = *y~i~* + *β* m~G~ (*ŷ~i~*~+1~)If *ρ*(*y*~*i*+1~), \> *ρ*(*y*~*i*~), Accept *y*~*i*+1~ and *β* = 1, *β* = *α* · *β*Else reject *y*~*i*+1~, and *y*~*i*+1~ = *ŷ*~*i*+1~, *β* = 1.Set *k=k+1*, start a new iterationIf m~G~ (y~*i*+1~) \< *ɛ* stop iteration.

5.. The Test and Experiment
===========================

5.1.. The Lab Test Equipment for an APS Sun Sensor
--------------------------------------------------

The equipment used to test and calibrate the sun sensor consists of a sun simulator which can send a bundle of sunlight, a two-axis gimbals rotary table and a theodolite goniometer. The sun simulator has an angular diameter of 32 arcmin and a brightness of 0.1 sun constant. The sun sensor was fixed on the two-axis rotary table. The theodolite goniometer guarantees that the axis of sun sensor is collinear with the sun simulator's. Arbitrary sun incidence angles can be established by rotating the table. The lab test system is shown in [Figure 8](#f8-sensors-11-02857){ref-type="fig"}. The diagram of an APS sun sensor is shown in [Figure 9](#f9-sensors-11-02857){ref-type="fig"}.

The sun spot templates extracted from the sun image when the sun incident angles are both equal to 0. This work is carried out on the lab test equipment. The sun spots array image and a typical single sun spot template are shown in [Figure 10(a,b)](#f10-sensors-11-02857){ref-type="fig"}. For each sun spot, we can get a template with 5 × 5 pixels.

5.2.. Random Noise \[[@b12-sensors-11-02857]\]
----------------------------------------------

The sun sensor was placed on the two-axis turntable for about 1,000 seconds. A single aperture in the mask was chosen from the image with coordinates (*x,y*). The x and y values of the centroid is a function of time. The standard deviation on the x coordinate is 0.02 pixels and the standard deviation on the y coordinate is 0.02 pixels. Assuming a stable sun bundle, the coordinates of this aperture are supposed to be constant. The actual distance between the mask and detector is 4,000 μm, the size of APS CMOS pixel is 15 μm × 15 μm. One pixel therefore has an angle equivalent to arctan(15/4,000) = 0.21°. The random noise on a single aperture is then 0.02 × 0.21° = 0.0042° in each axis. This random noise is for a single aperture. Assuming that the measurements are independent, and the mask consists of 6 × 6 = 36 apertures, then the accuracy will be improved by sqrt (36) = six times. A noise estimate for this kind of sun sensor is then 0.0042°/6 = 0.0007°.

5.3.. Experimental Parameter Setting
------------------------------------

The choice of kernel function for the experimental results has a significant impact; this paper uses the following kernel function profile: $$K_{E}(x) = \left\{ \begin{array}{l}
\begin{array}{ll}
{C_{k}(1 - {\|\frac{x}{z}\|}^{2})} & {\|\frac{x}{z}\| < 1} \\
\end{array} \\
{0~~~~~~\|\frac{x}{z}\| \geq 1} \\
\end{array} \right.$$where *z* denotes effective distance which is decided by the size of the sun spot. The term *x* actually represents the distance between the effective pixels and the center spot. If *z* is set too large or too small it will affect the pointing and tracking performance. If *z* is set too large it increases the computation and affect the system\'s real-time; when *z* is set too small, making the effective pointing and tracking of the region smaller, not only is operational efficiency reduced, but it is difficult to ensure positioning accuracy. In this paper *z* is set at 6.

The election of the gray value of the pixel as a feature in general gray images; in this paper the gray value will be classified as follows ([Figure 11](#f11-sensors-11-02857){ref-type="fig"}): we choose four threshold values *t~1~,t~2~,t~3~,t~4~*. Five features are set: *q~1~ =* \[*0,t~1~*)*, q~2~ =* \[ *t~1~,t~2~*)*, q~3~ =* \[ *t~2~,t~3~*)*, q~4~ =* \[ *t~3~,t~4~*)*, q~5~ =* \[ *t~4~,t~5~*)*,* in which *t~1~,t~2~,t~3~,t~4~* were set as 60,110,160,210, respectively.

According to the general considerations, the number of holes was designed to be 36 in this paper which is explained in Section 2, so that the the point accuracy of the sun spot array image location could reach a 0.01 ∼ 0.02 pixel level.

5.4.. Calibration and Analysis
------------------------------

### 5.4.1.. Calibration

First of all, the sun sensor was fixed on the two-axis turntable, ensuring that the optical axis of the sun sensor was parallel with the sun simulator's, controlling the turntable rotation around the x axis in steps of 1° from −64° to +64°, while keeping the y axis unrotated, then the turntable angle and the sun sensor angle can be recorded: Turntable x axis angle: *X*\[*x*~0~ *x*~1~ ⋯ *x*~128~\]Sun sensor angle: *α*\[*α*~0~ *α*~1~ ⋯ *α*~128~\]

Then we control the turntable rotatation around the y axis and keep the x axis unrotated to get the turntable y axis angle *Y*\[*y*~0~ *y*~1~ ⋯ *y*~128~\] and sun sensor angle *β*\[*β*~0~ *β*~1~ ⋯ *β*~128~\].

Using MATLAB fitplot function (*x*, *α*, 6), the fitplot function (*y*, *β*, 6) is used to fit the two sets of data: $$\begin{matrix}
{x_{0} = A_{0}\alpha_{0}^{6} + A_{1}\alpha_{0}^{5} + A_{2}\alpha_{0}^{4} + A_{3}\alpha_{0}^{3} + A_{4}\alpha_{0}^{2} + A_{5}\alpha_{0}^{1} + A_{6}} \\
{x_{1} = A_{0}\alpha_{1}^{6} + A_{1}\alpha_{1}^{5} + A_{2}\alpha_{1}^{4} + A_{3}\alpha_{1}^{3} + A_{4}\alpha_{1}^{2} + A_{5}\alpha_{1}^{1} + A_{6}} \\
{\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, \vdots} \\
{x_{128} = A_{0}\alpha_{128}^{6} + A_{1}\alpha_{128}^{5} + A_{2}\alpha_{128}^{4} + A_{3}\alpha_{128}^{3} + A_{4}\alpha_{128}^{2} + A_{5}\alpha_{128}^{1} + A_{6}} \\
{y_{0} = B_{0}\beta_{0}^{6} + B_{1}\beta_{0}^{5} + B_{2}\beta_{0}^{4} + B_{3}\beta_{0}^{3} + B_{4}\beta_{0}^{2} + B_{5}\beta_{0}^{1} + B_{6}} \\
{y_{1} = B_{0}\beta_{1}^{6} + B_{1}\beta_{1}^{5} + B_{2}\beta_{1}^{4} + B_{3}\beta_{1}^{3} + B_{4}\beta_{1}^{2} + B_{5}\beta_{1}^{1} + B_{6}} \\
{\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\, \vdots} \\
{y_{128} = B_{0}\beta_{128}^{6} + B_{1}\beta_{128}^{5} + B_{2}\beta_{128}^{4} + B_{3}\beta_{128}^{3} + B_{4}\beta_{128}^{2} + B_{5}\beta_{128}^{1} + B_{6}} \\
\end{matrix}$$to get the two vectors: *A*(*A*~0~, *A*~1~ ⋯ *A*~6~), *B*(*B*~0~, *B*~1~ ⋯ *B*~6~), then we can get the relationship between the measurement angle and the estimated angle ([Figure 12](#f12-sensors-11-02857){ref-type="fig"}).

A high performance Fixed-Point Digital Signal Processor TMS320C6203 which was developed by the Texas Instruments Company was employed in the sun sensor for signal processing. The data update rate is 4 Hz. The final sun sensor accuracy is: X axis: 0.0063°, Y axis: 0.0068° ([Figure 13](#f13-sensors-11-02857){ref-type="fig"}).

### 5.4.2.. The Hole Block Detection Logic and Its Impact on the Accuracy

In space, some sun spots may be missing due to space debris, mask pollution or detector aging, *etc.* The multi-aperture sun sensor based on the FMMS algorithm has the advantage of maintaining a high accuracy even if some sunspots are missing. As the distance between the spots is relatively fixed, it can predict the location of holes in a certain effective area. When a similarity coefficient is less than a certain threshold in MEANSHIFT algorithm iteration process, the hole blocking. This method not only has high accuracy and the computation load is small, but it also does not affect system real-time performance.

A typical sun spot array image with five spots missing is shown in [Figure 14](#f14-sensors-11-02857){ref-type="fig"}. An experiment is carried out to compare the accuracy deterioration under the conditions that one-five sun spots are missing relative to that of no sunspot missed. The experimental data are shown in [Figure 15](#f15-sensors-11-02857){ref-type="fig"}. From [Figure 15](#f15-sensors-11-02857){ref-type="fig"}, we concluded that the average accuracy error is no more than 0.003 pixels, which has almost no impact on the system accuracy. This immunity from missing sun spots significantly improves the adaptability for a harsh space environment, and this immunity cannot be achieved by a conventional single-aperture sun sensor. The conventional single-aperture sun sensor cannot distinguish between the sun spot and noise or bad pixels, while a multi-aperture sun sensor can overcome this drawback and extend the lifetime, since both the FMMS algorithms extract and identify the sun image based on the apertures array pattern, and the immunity to the partial sun spots missing or deterioration keeps the sun sensor away from a fatal fault. [Figure 16](#f16-sensors-11-02857){ref-type="fig"} shows a simulated deteriorated image.

6.. Conclusions and Future Work
===============================

In this paper, based on multi-aperture, APS detector flexible imaging and read out characters and a novel fast multi-point MEANSHIFT (FMMS) algorithm are proposed to improve the accuracy and reliability, the two key performance features of an APS sun sensor. The experimental results show that based on FMMS algorithm the multi-aperture the APS sun sensor presents many advantages compared with the traditional single-aperture sun sensor, particularly in high accuracy and reliability. With this system, the centroid accuracy of the sun image can reach to 0.01 pixels, even when some missing apertures and bad pixels appear on the detector because of aging of the devices and a harsh space environment, while the pointing accuracy of the single-aperture sun sensor using the conventional correlation algorithm is only 0.05 pixels.

When the sun incidence angle is greater than 45°, the sun spot is larger, the shape becomes elliptical, and sun sensor accuracy declined. In the next phase of our work we will study the reasons for this phenomenon and to find solutions to improve accuracy under wide sun angle conditions.

This paper funded by the National Natural Science Foundation (No. 60904089). This research work was mainly carried out in the State Key Laboratory of Precision Instrument Measurement, Tsinghua University, while some of the analysis and simulation was completed at the School of Aeronautics & Aerospace Xi'an Jiaotong University. The authors wish to acknowledge the important contributions made by Yu Li, Wei Li, Dong Xu and Junshen Mo to our APS sun sensor development and Qi Wang for his efforts regarding writing and amending the paper.

![**(a)** single-aperture sun sensor **(b)** multi-aperture sun sensor.](sensors-11-02857f1){#f1-sensors-11-02857}

![6 × 6 multi-aperture mask.](sensors-11-02857f2){#f2-sensors-11-02857}

![illustration of the sunray tracking route in the sun sensor.](sensors-11-02857f3){#f3-sensors-11-02857}

![The quantified spot template.](sensors-11-02857f4){#f4-sensors-11-02857}

![Kernel function weight distribution.](sensors-11-02857f5){#f5-sensors-11-02857}

![3-dimensional map of kernel function.](sensors-11-02857f6){#f6-sensors-11-02857}

![The simulated spot gray distribution.](sensors-11-02857f7){#f7-sensors-11-02857}

![The lab test system for a sun sensor.](sensors-11-02857f8){#f8-sensors-11-02857}

![The diagram of an APS sun sensor.](sensors-11-02857f9){#f9-sensors-11-02857}

![**(a)** Sun spots array image. **(b)** Single sun spot image.](sensors-11-02857f10){#f10-sensors-11-02857}

![Choice of the feature value.](sensors-11-02857f11){#f11-sensors-11-02857}

![Relationship between the measurement angle and estimated angle.](sensors-11-02857f12){#f12-sensors-11-02857}

###### 

The accuracy of a sun sensor with incident angle in the range of −64° to +64°. **(a)** x axis result, **(b)** y axis result.

![](sensors-11-02857f13a)

![](sensors-11-02857f13b)

![The image with one--five missing sun spots.](sensors-11-02857f14){#f14-sensors-11-02857}

![Accuracy analyses with 1--5 sun spots missing.](sensors-11-02857f15){#f15-sensors-11-02857}

![The simulated deteriorated image.](sensors-11-02857f16){#f16-sensors-11-02857}
