Equations for Solar Tracking

Direct sunlight absorption by trace gases can be used to quantify them and investigate atmospheric chemistry. In such experiments, the main optical apparatus is often a grating or a Fourier transform spectrometer. A solar tracker based on motorized rotating mirrors is commonly used to direct the light along the spectrometer axis, correcting for the apparent rotation of the Sun. Calculating the Sun azimuth and altitude for a given time and location can be achieved with high accuracy but different sources of angular offsets appear in practice when positioning the mirrors. A feedback on the motors, using a light position sensor close to the spectrometer, is almost always needed. This paper aims to gather the main geometrical formulas necessary for the use of a widely used kind of solar tracker, based on two 45° mirrors in altazimuthal set-up with a light sensor on the spectrometer, and to illustrate them with a tracker developed by our group for atmospheric research.


Introduction
Spectroscopic analyses of direct incident sunlight are commonly used in atmospheric research. Such experiments make use of the Sun as a light source to quantify molecular absorptions in the atmosphere and then retrieve trace gas abundances. Stratospheric ozone [1] and greenhouse gases [2] are routinely measured with this technique from ground-based Fourier transform infrared (FTIR) spectrometers, e.g., within the Network for the Detection of Atmospheric Composition Change (NDACC, http://www.ndacc.org/). In the UV-visible range, light scattering is more important and enables spectroscopic studies of the atmosphere in other geometries such as zenith measurements [3]. However, direct sunlight is also used [4,5], its unique and unambiguous light path making it advantageous for some applications [6]. Beside the spectrometer, the main part of the involved apparatus in direct sunlight spectrometry is the solar tracker, required to compensate for the Sun's diurnal motion.
Several kinds of trackers, sometimes referred to as heliostats, are used for atmospheric spectrometry, based on setups of one or several rotating mirrors. Some of them are equatorially mounted, like in Table  Mountain Facility [4] or Harestua [7]. In this case, one rotational axis is parallel to the Earth's axis. It enables a high tracking accuracy without a computer, since only one axis has to be driven at the Earth's rotation speed. To our knowledge, it is the only setup working without feedback on the Sun's position. On the other hand, equatorial mounts are large, need to be aligned accurately and their mechanical design is difficult. Most of the trackers used today are controlled by a computer enabling remote operation and automation. The computer first calculates the Sun position, moves the mirrors to point to the Sun and then controls these mirrors to optimize the signal on some kind of light sensor. For some trackers, the light sensor is attached to the moving part, whether it is a single mirror [8] or a mount of two mirrors [9]. Compared to the solution presented below, the retroaction is simplified. The drawback is that the tracking is done some meters away from the spectrometer and is thus less accurate and stable. Figure 1 shows a popular altazimuthal tracker design. It consists of two elliptical mirrors held in 45 degrees relative to the vertical, facing each other (M1 and M2). Both M1 and M2 rotate along the azimuthal axis and M2 rotates as well around a horizontal axis (altitude direction). M0, and possibly other fixed mirrors, direct the light beam into the spectrometer optical axis. A 4-quadrant photodiode is used as a position sensor for a closed-loop control of the mirrors position once their positioning towards the Sun has been set with enough accuracy, i.e., once the Sun's image is visible by the photodiode. This altazimuthal setup is used with FTIR systems, e.g., in Kiruna [10] and Park Falls, Wisconsin [11]; it has been installed in Harestua to replace the equatorially mounted system [12]. Compact versions have also been developed for field campaigns [13,14]. A commercial version is sold by Bruker to be installed on their FTIR spectrometers [15]. A recent progress in the pointing accuracy has been reported [16], replacing the traditional quadrant diode with a CCD camera, but the problems discussed hereafter remain the same.
Because developing a solar tracker is typically a master's thesis work [10,13,14], technical implementations are difficult to access in the literature. Some more information is available about the systems used in solar energy applications but their geometries differ [17][18][19][20]. Someone building a Sun tracker can quickly find ephemeris calculations in many programming languages, but other issues arise quickly. It is first necessary to characterize the field-of-view (FOV) of the 4-quadrant diode in the considered optical design. This serves two purposes: determining the accuracy needed for the ephemeris's algorithm and making sure this FOV is larger than the Sun's apparent diameter (9 mrad). This last point is important to track constantly the center of the Sun, which reduces the uncertainties in the air mass factor and avoids Doppler shifts on the edges of the Sun ( [16]). A second problem lies in the correction of the tracker orientation compared to the altazimuthal system in which the ephemeris is given, necessary for the calculated mode if the base of the solar tracker is not leveled. Thirdly, the relationship between the quadrant signal and the correction to apply on the mirrors positions depends on the tracker position itself [16]. Understanding this relationship is compulsory to achieve a smooth tracking. This article deals with these three problems successively. Figure 1. Geometrical setup of the considered solar tracker, using two 45-degree mirrors, M1 and M2, rotating along orthogonal axes. Mirror M0 directs the Sun light into a spectrometer. A fraction of the light beam is deflected toward a 4-quadrant photodiode enabling a closed-loop control of the mirrors position.

Ephemeris Accuracy and Field of View of the 4-Quadrant Diode
Calculating the Sun position in the sky given the time of observation and the geographical coordinates is well documented. A reference algorithm is given by Jean Meeus in [21], for which C( [22]) or Matlab (http://www.mathworks.com/matlabcentral/fileexchange/4605-sunposition-m) versions are available. This accuracy degrades with larger zenithal angle due to atmospheric refraction, which depends on local meteorological conditions (for an accurate and wavelength dependent refraction formula, see [23]). Irregular variations in Earth rotation also limit the accuracy of ephemerids independently of refraction. On the other hand, the absolute accuracy of commercial rotation stages used in Sun trackers, e.g., Newport RV-160, is only 0.01 • . This reduces the interest of using an accurate but complex algorithm for ephemeris's calculation, which is anyway not necessary providing a closed-loop control is performed on the mirrors' position. In this case, the lowest acceptable accuracy is thus determined by the field of view of the 4-quadrant diode: once the Sun image hits the quadrant, the tracking can be performed in closed-loop. Figure 2 shows the typical optical scheme between the tracker and the quadrant diode, the optical axis has been aligned for the sake of clarity. The distance L is measured from the first mirror which reflects the sunlight, i.e., M2 in Figure 2. Close to the spectrometer, a part of the beam from the tracker, with diameter Φ T corresponding to the small axis of M1 and M2 on Figure 2, is deflected by a mirror of diameter Φ M to a lens which focuses the beam onto the quadrant. The maximum field-of-view seen by the diode (F OV 1 ) depends on the focal length of the lens (f ) and on the diameter of the quadrant (Φ D ), according to F OV 1 = arctan Φ D f . The lens L1 is unlikely to reduce the FOV assuming its size superior to the mirror's one. Indeed, the beam is parallel before the lens which implies that distance D can be reduced if necessary. The tracker aperture, in our case defined by the azimuthal stage free aperture, is more important, especially since the diameter of a rotation stage is limited and the distance between the tracker and the deflecting mirror (M4) depends on the observatory configuration. The mirror's FOV due to the tracker is F OV 2 = arctan Φ T L . Considering our set-up in Brussels, which is a typical FTIR station, the tracker's mirrors are 10 cm (Φ T ) wide and the optical path to the spectrometer (L) 5 m long, which leads to a F OV 2 of 20 mrad. On the other hand, the quadrant diameter (Φ D ) is 6 mm while the focal length of the lens ((f )) is 200 mm, which gives 30 mrad for F OV 1 . The actual FOV is the minimum, 20 mrad, limited by the tracker size. This value is superior to the apparent diameter of the Solar disk which is important to track the center of the Sun. A simple algorithm can achieve such an accuracy for the ephemeris calculation, like the one given in the appendix. It is however necessary to take into account the orientation of the tracker, which can lead to pointing errors superior to the FOV.

Correcting the Tracker Orientation
One source of error, when pointing to the calculated Sun position, is the orientation of the baseplate of the tracker compared to the altazimuthal system. Depending on the observatory configuration, it may be difficult or impossible to align accurately the tracker along the North-South direction. If it was the only problem, the remaining constant offset could be simply fitted and added in the calculated azimuth. However, because the baseplate is never completely leveled either, other offsets are added to the calculated positions, affecting both azimuth and elevation in a way that depends on the pointing direction of the tracker. Some tracker uses an active search method to solve this problem. In practice they reach the calculated position and achieve spiral motion around this point to set the sun spot in the field-of-view of the sensor. Misalignment effect can on the other hand be taken into account in the calculation requires determining the Euler angles of the observatory and the tracker baseplate, respectively, compared to the azimuthal system. We discuss the Euler angles before describing our way to determine them. For the sake of simplicity, we only mention the observatory in the following, considering that the baseplate to be part of it. Euler angles of an observatory may be seen, as in Figure 3, as consecutive rotations around three orthogonal axes needed to account for the pitch, roll and yaw of this observatory. Converting the solar altitude and azimuth to the observatory frame requires thus to compute the multiplication of three rotation matrices along the different axes, i.e., R x (γ), R y (β) and R z (α). The resulting matrix M of f set expresses the transformation of coordinates due to the Euler angles.
The calculations leads to: cos α cos β − sin α cos β sin β cos α sin β sin γ + sin α cos(γ) cos α cos γ − sin α sin β sin γ − cos β sin γ sin α sin γ − cos α sin β cos γ cos α sin γ + sin α sin β cos γ cos β cos γ    (2) In Cartesian coordinates, the unit vector (x t ,y t ,z t ) giving the direction of the Sun in the observatory frame will thus be related to the solar spherical coordinates(az 0 ,alt 0 ) in the altazimuthal system: Substituting M of f set with Equation (2) we get the following expressions for those coordinates: These new Cartesian coordinates can then be converted to altitude (alt t ) and azimuth (az t ) angles relative to the tracker: In the above equation, atan 2 (y, x), available in many programming languages, stands for the argument of the complex number x + iy. It is closely related to the arctangent of y/x but it indicates unambiguously the quadrant of this angle on the trigonometric circle.
Determining Euler angles accurately by measurements is not easy. An analytical method to estimate them is given in [17] which basically consists of recording the position of the tracker at three different times and solving Equation (4). This is appropriate for the studied case, i.e., a collector for solar energy application installed outside with only one mirror and no closed-loop control. With our considered two-mirror tracker, which does not collect light but directs it toward a spectrometer, other sources of misalignments appear. Indeed, the tracker is also likely to be misaligned compared to the spectrometer, and mirror themselves can be tilted. Other angles can be considered in M of f sets and is done in [10]. In practical applications, despite the three Euler angles, the calculated mode is likely able to reach the Sun within the FOV of the 4-quadrant diode. With the closed-loop control it is easy to track the Sun during a whole clear-sky day providing an operator correctly sets the Sun tracker initially. Euler angles can then be fitted using all the recorded positions of the mirrors during the day. It has the advantage that other sources of misalignment are included: even if only three angles are fitted which may not exactly be the Euler angles, they minimize simultaneously the effects of all offsets. We implement this method in Section 4. This requires the closed-loop control of the tracker on the Sun position.

Ray Tracing in the Tracker
The photodiode signal indicates that the Sun beam is tilted compared to the optical axis of the spectrometer. The photodiode signals must be converted into angular movements of the altitude and azimuth axes of the tracker to correct the misalignment. If the photodiode was placed on the reference frame of the mirror M2 this conversion would be straightforward, but due to its position after the tracker it depends on the position of the tracker mirrors. A trial-and-error method to correct the misalignment is theoretically possible using analogue electronics without a computer but a smoother tracking can be achieved if the conversion is understood.
The conversion can be expressed once again by a matrix, which transforms in this case a vector hitting mirror M1 to a vector pointing to a direction in the sky given by its altitude and azimuth. It is the opposite of the light direction but is simpler to figure out, and considering Fermat principle, yields the same information.
The rotation of the two motorized stages can be accounted for using rotation matrices as described in the previous section. The reflection on the two mirrors is modeled using another matrix which takes the form: where I is the identity matrix and n the normal vector to the mirror surface. At reference position, the mirror are parallel and thus their normal is the same, given by the vector (0, 1 √ 2 ,− 1 √ 2 ). The transformation matrix for the two mirror is thus the same, M R , which is, from Equation (6): Figure 4 presents the tracker pointing to an azimuth θ 1 and a zenith angle of θ 2 . The reference frames 1 and 2 are respectively attached to the mirrors M 1 and M 2 , with the x axes in the direction of their small semi-axes and the y axes along the line joining the two mirrors. The optical system inside the frame, with only mirrors M 1 and M 2 , can be expressed as a transformation whose matrix M tracker is: The above formula is derived as follow: (a) the reflection on M 2 (M R ) is expressed in the reference frame of 1 with a change of basis involving R y (−θ 2 ); (b) this product of three matrices is multiplied on its right side by the preceding (seen from the spectrometer) reflection on M 1 (M R ); (c) another change of basis is performed to express the transformation in 0 , involving R z (−θ 1 ). i.e.,  . The tracker mirrors and their rotation can be modeled as rotation matrices in their reference frames, which apply to the beam vector. Note that the z and y axes are the same respectively for ( 0 , 1 ) and ( 1 , 2 ).
Developing the matrix product yields the matrix of the tracker optical system as a function of the tracker position (θ 1 ,θ 2 ): The transformation expressed by M tracker can now be applied to a vector corresponding to the Sun light beam direction on the spectrometer side of the tracker. It will lead to the position of the Sun in Cartesian coordinates. The vector is built from the 4 diode signals (VA,VB,VC,VD), as represented in Figure 5. Basically an offset position (ε 1 ,ε 2 ) is computed for the Sun spot on the diode plane compared to its center by: The spot offset (ε 1 ,ε 2 ) defines 2 coordinates of the beam vector. The last one, Λ, should represent the distance from the diode to mirror M1. Multiplying M tracker by the quadrant vector (ε 1 ,ε 2 ,Λ) would yield accurate Sun angles after conversion to spherical coordinates, but is not practically possible with a diode, contrary to an imaging sensor. The calculated position (x s ,y s ,z s ) hereafter is thus not absolute but is sufficient to get the sign of the rotations to apply on the axes. Λ can be chosen arbitrarily as long as its absolute value is large enough compared to ε 1 and ε 2 . The solar pseudo-coordinates are then: In practice, the quadrant vector may differ from (ε 1 ,ε 2 ,Λ) due to reflections such as on the mirrors M0 and M4q on Figure 1, necessary to deviate a part of the beam to the 4-quadrant photodiode. Defining the position vector thus requires to pay attention to the optical path from M1 to the photodiode. In section 4, we explain how we deal with the problem in our particular case.

Automation Issues
From a control theory perspective, the altazimuthal tracker and its feedback is a non-linear multi-input multi-output (MIMO) system. Indeed, two outputs defining the pointing direction (θ 1 and θ 2 ) are controlled by two inputs, i.e., the coordinates of the Sun spot on the photodiode(ε 1 and ε 2 ), and the relationship between the inputs and the outputs varies with the position of the tracker. However, having modeled this relationship in the previous section, it is possible to change the feedback scheme while tracking. In control theory, this is an example of adaptive control.
The correction of the azimuth and altitude angles discussed earlier only takes into account the current error, i.e., the tilt of the solar beam compared to the optical axis of the spectrometer. This is very coarse and can lead to oscillations. A proper feedback loop includes the derivative and integral of the error relative to the time as well, respectively to reduce the overshoot and the residual part of the errors. This involves to tune the three parameters of a proportional-integral-derivative (PID) controller. Considering the two outputs, the setup needs two PID controllers. Figure 6 suggests a feedback loop for the tracker. Note that ε 1c and ε 2c are null if the photodiode is correctly aligned compared to the spectrometer optical axis. The adaptive control algorithm on the figure (f (θ 1 (t), θ 2 (t))) originates from the formula derived in the previous section. There are 6 parameters to tune to optimize the feedback, which corresponds to the proportional, derivative and integral terms of the two PID controllers. Several methods exist to optimize PID parameters, with different complexity. We think the simple Ziegler-Nichols method could be appropriate. It consists in setting Ki and Kd to 0 and increasing Kp from 0 to the value Kpc with which oscillations occur at constant amplitude, with a period Tc. Three good values for Kp, Ki and Kd can then be derived as: Considering the latitude of the Reunion Island observatory where the tracker is installed (20.9 • S) it is worth considering an issue occurring with the altazimuthal geometry, i.e., the singularity at zenith. As the altitude gets closer to zenith, the azimuth rotation gets more and more difficult to control. At Reunion Island, the maximum altitude is reached around November the 26th and January the 16th. Around this date, the measurement dead time can reach one hour. To our knowledge, there is no good solution to solve the problem. Nevertheless, to limit the measurement dead time around noon, we propose to implement in the adaptive controller another mode starting when the altitude is too high and the problem happens: shifting the azimuth mode from feedback controlled to calculated mode. The elevation is still controlled by the photodiode. This may not be accurate enough to keep the Sun spot in the spectrometer's iris, but it would at least avoid possible incoherent movement of the tracker.

Application for a FTIR Measurement Station
Our group has been doing FTIR measurements at Reunion Island for several years ( [24][25][26]). The place is interesting since atmospheric measurements are sparse in the tropical and subtropical regions. Aiming at long-term monitoring and cost-effectiveness, a station at Saint-Denis (20.9 • S, 55.5 • E, 50 m a.s.l.) has been automated [9], which includes Sun tracking, meteorological logging and FTIR measurements with a Bruker 120M. The solar tracker currently used was developed at Denver University. Since September 2009, this station is officially part of the NDACC network and in Spring 2012 it will move to the new Maido Observatory (21.1 • S, 55.4 • E, 2200 m a.s.l.).
A second FTIR station has been installed in Saint-Denis in September 2012. This station, which is also automated, is based on a Bruker 125 HR spectrometer, more appropriate to measure CO 2 atmospheric loading, in the framework of the new Total Carbon Column Observing Network (TCCON). The geometry of the Sun tracker is altazimuthal. It was built at our institute and used to validate the methods described in the last section.
This new solar tracker uses a Newport RV-160 rotation stage for the azimuth rotation and a Vexta stepping motor with a gear box for the altitude. Both rotations are driven by a Newport XPS controller, linked to the controlling PC. The tracker mirrors are elliptical with a 10 cm minor axis. The photodiode setup was purchased from Bruker with the spectrometer and is installed at the input window of the spectrometer. It consists of a 1 cm mirror which reflects a small portion of the incoming light to a 18 cm focal length lens which focuses the beam onto the 4-quadrant photodiode. The optical path is shown in Figure 7. The FOV of the 4-quadrant photodiode is 20 mrad (see Section 2.1). The algorithm used to compute the ephemeris is the one given in appendix. During operation, the mirrors positions are refreshed every half second according to the calculated position or to the signal on the 4-quadrant photodiode using the methods described in Section 2.3. From Figure 7, it is clear than the beam from the tracker undergoes two orthogonal reflections before hitting the photodiode, which we take into account multiplying M tracker on its rigth side by the corresponding factors derived from Equation (6).  Around one hundred points were extracted from the log file of the tracker position and used to fit the Euler Angles with an unconstrained nonlinear minimization. The three angles α,β and γ described in Section 2.2 were respectively estimated to be 9.96 • , 0.888 • and 0.174 • . The right panel shows how these fitted angles improve the calculated Sun position. The maximum offset between calculated and actual position is now 0.5 • , i.e., 9 mrad, which is under the 20 mrad of the photodiode's FOV. Providing this accuracy in the calculated mode, the tracking system is able to set the Sun's image onto the 4-quadrant photodiode and then start the active tracking without the need of an operator. Figure 8. Fit of the Euler Angles to take into account the alignment offsets in the calculation mode. The track was performed on 12 September 2011.

Conclusions
We have derived the geometrical formulas needed to track the Sun with a kind of altazimuthal tracker widely used in atmospheric remote sensing. The setup is based on two rotating 45 • mirrors facing each other and a 4-quadrant photodiode involved in a closed-loop control of the tracker. After discussing the required accuracy for the calculated mode and calculating the FOV of the sensor, we described how to take into account and estimate the Euler angles, representing the orientation of the tracker compared to the ground. These sections can actually be applied to other tracking setups. On the other hand, even if the method is general, the formula for the active tracking depends strongly on the optical configuration and may not be used for other trackers' geometries. We have proposed a control loop with PID to achieve a smooth tracking while reducing overshoot and the residual part of the error. Finally, we have tested the formulas with a custom-built solar tracker that has been installed together with a FTIR spectrometer at Reunion Island in September 2011.
Among the future work will be the improvement of the tracking smoothness, and particularly the tuning of the six parameters of the PID controllers. We will also implement the solution presented in Section 3 and check whether the measurement dead time can be reduced.
A characteristic of the Maido observatory is the very regular cloud cycle. At noon, the clouds reach the observatory almost every day. This is very convenient for clouds studies but less for solar occultation trace gases measurements. On the other hand, the nights are so clear up there that the observatory was first supposed to be dedicated to astronomical research. This is thus a good place to try Moon tracking and we plan to work on that in the future.
The solar hour angle, in degrees, comes from the true solar time as: For a given latitude, the hour angle and the declination are converted to horizontal coordinates, i.e., solar zenith angle (φ) and azimuth (θ, from south positive eastwards) as: φ = arccos (sin lat sin δ + cos lat cos δ cos ha) (20) θ = − atan 2 (sin ha cos δ , cos ha sin lat cos δ − cos lat sin δ ) Finally, the effect of refraction in arcminutes can be approximated using Saemundsson's formula [21]:  (22) where h is the unrefracted altitude in degree.