Evaluation and Design of Power Controller of Two-Axis Solar Tracking by PID and FL for a Photovoltaic Module

Solar trackers represent an essential tool to increase the energy production of photovoltaic modules compared to fixed systems. Unlike previous technologies where the aim is to keep the solar rays perpendicular to the surface of the module and obtain a constant output power, this paper proposes the design and evaluation of two controllers for a two-axis solar tracker, which maintains the power that is produced by photovoltaic modules at their nominal value. To achieve this, mathematical models of the dynamics of the sun, the solar energy obtained on the Earth’s surface, the two-axis tracking system in its electrical and mechanical parts, and the solar cell are developed and simulated. Two controllers are designed to be evaluated in the solar tracking system, one Proportional-Integral-Derivative and the other by Fuzzy Logic. The evaluation of the simulations shows a better performance of the controller by Fuzzy Logic; this is because it presents a shorter stabilization time, a transient of smaller amplitude, and a lower percentage of error in steady-state. The principle of operation of the solar tracking system is to promote the orientation conditions of the photovoltaic module to generate the maximum available power until reaching the nominal one. This is possible because it has a gyroscope on the surface of the module that determines its position with respect to the hour angle and altitude of the sun; a data acquisition card is developed to implement voltage and current sensors, which measure the output power it produces from the photovoltaic module throughout the day and under any weather conditions. The results of the implementation demonstrate that a Fuzzy Logic control for a two-axis solar tracker maintains the output power of the photovoltaic module at its nominal parameters during peak sun hours.


Introduction
Human dependence on fossil fuels, for the generation of energy, has created numerous environmental catastrophes across the planet. Increased carbon emission, global warming, and ozone depletion area direct consequences of this ill use of fossil fuels [1]. Due to the burning of fossil fuels, greenhouses gases are emitted constantly. One such gas is carbon dioxide (CO 2 ), which was represented in 2016, close to 70% of the total greenhouse gas emissions [2]. As strategies to decrease the world's carbon footprint agreements between nations are formulated, like the "Kyoto protocol," in which the need for cleaner, more sustainable, and more reliable energy production technologies is emphasized [3]. Photo-voltaic systems meet such need since they are eco-friendly and help reduce CO 2 emissions to the atmosphere and its energy source; the sun is constantly available [4]. In 2017, these systems generated an estimate of 460 terawatt-hour (TWh), which represents 2% of the world's energy in that same year [5].
Photovoltaic (PV) systems can be classified as on-grid and off-grid. The elements that make up these systems are photovoltaic modules, batteries, charge regulator (or controller for standalone systems), wiring, and inverter. The efficiency and output power of PV depend upon the solar irradiance, location, face angle of the PV panel, type of PV panel, and efficiency of the components [6]. The photovoltaic module is the element that transforms solar energy into electricity; its average efficiency in the energy conversion process does not surpass 20% [7]. This percentage is affected by design, assembly factors, environmental conditions, installation, and periodical maintenance [8]. During the installation process of PV modules, some considerations are taken such as the adequacy of the installation site and the amount of radiation received by the site, orientation, and inclination. These considerations are taken to assure that the incidence of solar rays is greater and in a perpendicular orientation relative to the PV system's photosensitive surface. To achieve maximum energy absorption and to compensate for variations during different times of the year, solar tracking systems are implemented. Solar tracking systems are categorized according to their degrees of freedom (DOF). Fixed systems have an orientation and inclination based on their installation point. Single-axis systems track the movement of the sun from east to west. Dual-axis systems also track the sun from east to west, with the adding capability of altering their inclination and are therefore able to produce between 38 and 54% more energy than fixed systems [9][10][11].
The preceding works are aimed at controlling the position of PV modules predominantly strive to collect as much solar radiation as possible, and in doing so, reach the maximum energy production possible during the day. Reference [12] describes the design of a proportional, integration, and derivative (PID) controller for solar tracking. It has three tunable parameters which are calculated using equations to determine their value: proportional action, time integration, and time derivative. In [13,14], a PID and a Fuzzy Logic (FL) controller are designed. The FL controllers can handle the uncertainties and imprecision of the controlled plant since the design of the algorithm is based on the knowledge of the human expert of the plant's dynamics [15]. However, the production of electricity over the nominal values of PV modules causes an acceleration in the deterioration of the PV cells, or possible physical damage to the system's electronic components, such as the charge controller and inverter.
The main aim of this paper is to keep the output power of the photovoltaic module at its nominal value. At sunrise, sundown, or a day with low radiation, the controller will allow the inclination of the module surface to be modified to achieve the maximum power available depending on the solar radiation that exists at the time, as long as it does not exceed the nominal power. The control that is developed is with feedback of the output power, by measuring the voltage and current. This poses advantages over solar tracking controllers that do not have feedback on weather conditions, energy production, and module position; they have programmed their movement by GPS, time, or dates of the year, so there is no control or monitoring over electricity production.
This paper is divided into 5 sections. In Section 2.1, the solar position and radiation on a determined point are estimated. The mathematical model of the tracking structure is presented in Section 2.2. Section 2.3 shows the mathematical model for a solar cell. The design of PID and FL controllers are found in Sections 2.4 and 2.5, respectively. In Section 3.1, the system's simulations are shown, and in Section 3.2, the methodology of the algorithm is presented. Sections 4 and 5 presented the obtained results, conclusions.

Materials and Methods
2.1. Estimation of Solar Radiation on an Inclined Surface. To define the inclination and orientation of the solar tracker, it is Figure 3: Five-parameter-diode simple model.    International Journal of Photoenergy necessary to estimate the solar position, particularly, the azimuthal angle (λ) and the solar altitude (α). As shown in Figure 1, the former is defined as the azimuth from the north of the sun's rays on the horizontal plane (clockwise). The latter is the angular height of the sun, measured from the horizontal. These angles are estimated by Equations (1) and (2) [16].
where φ is the latitude of the installation site, δ the declination at solar noon, and ω the angular altitude of the sun measured from the horizontal plane.
To determine the working mode of the solar tracker (stand-by mode and tracking mode), it is important to calculate the solar radiation on an inclined surface (H T ). This is obtained by the sum of Equation (3) [17]: where H B , H D , and H R are the direct, fuzzy, and reflected solar radiation on an inclined surface (J/m 2 ). All previous variables are calculated by Equations (4), (5), and (6) [17]: where β is the inclination angle of the PV module and ρ the reflectance of the ground. H b and H d are the direct and fuzzy radiation over a horizontal surface (J/m 2 ). They are estimated by Equations (7) and (8) [18]: where τ b and τ d are the atmospheric transmittance for the direct and fuzzy solar radiations, θ C is the zenith angle formed between the vertical and the sun's line, and H 0 is the energy incident outside the earth's atmosphere, assuming that it impacts with a 90°angle on a surface [17]. It is defined as where d is the day of the year, and H sc is the radiation constant (1.367 kW/m 2 ) provided by the World Radiation Center (WRC).

Solar Tracking System Model.
To design the PID controller, it is necessary to model the dual-axis solar tracking system. Each axis of freedom is divided into 2 parts: a positioning system and a mechanical structure, as shown in Figure 2. The former consists of a permanent magnet direct current motor (PMDCM), which utilizes magnetic fields induced by an external excitation current that flows through the stator's winding to produce motion. The latter consists of two viscous friction coefficients that represent two rowlocks and the moment of inertia of the PV module.
MN is more-negative, NE is negative, Z is zero, PO is positive, and MP is more-positive in the domain of discourse.

International Journal of Photoenergy
The matrices of the positioning system and the mechanical structure for each axis of freedom are defined as where θ X , Y is the orientation and inclination, i X , Y the armature current for each axis of freedom, B the motor's viscosity coefficient, and B 1 and B 2 are the ideal viscous friction coefficient of the rowlocks (zero). R a is the armature resistance, L a is the armature inductance, K e the electromotive force constant, K M the motor's torque current relation, τ the torque, and J the inertia of the motor's rotor. The moments of inertia for each axis of freedom (J X , Y ) are estimated by Equations (12) and (13) [19]: where M a is the mass, a is the height, and b is the base of the PV module.

Mathematical Model of Photovoltaic Cell Diode.
A PV module transforms the solar radiation into usable electric energy. The basic energy conversion element is the solar cell. This is a semiconductive device, capable of turning sunlight into electricity. Figure 3 represents the 5-diode simple model of a solar cell designed to model the behavior of a solar cell [20]. Equation (14) to estimate the output current i is: where i ph is the photon current, i D is the diode current, and i sh the current that flows through resistance R sh . I ph it is defined as H ref is the solar radiation of reference (1 kW/m 2 ), the solar radiation over the PV cell (H T ), the short-circuit reference current (I ref ), the temperature coefficient of the cell's short circuit current (K I ), the temperature of reference (T r = 298:15°K), and the temperature of the cell (T).
The diode current (I D ) is estimated by where V D is the diode voltage, and V TH is the thermal voltage. The cell's saturation current (i 0 ) is defined by where I SC is the short circuit current, q the charge of the electron, V OC the open-circuit voltage, N S the number of cells, k the Boltzmann constant, and E G the dead band energy. Lastly, according to Kirchhoff's laws, the current that flows through resistance R sh is V is the output voltage, R s series resistance, and R sh parallel resistance.
2.4. PID Control of the Solar Tracking System. The PID control is uðtÞ and consists of a K P parameter (proportional), a T i (integral), and a T d (derivative). This control can modify a system's response. The time-domain Equation (19) of the controller is [21]: Fuzzy logic System Σ Figure 5: Block diagram of the Fuzzy Logic controller.
where eðtÞ is the error value.
The second tuning method proposed by Ziegler-Nichols is used to obtain the values K p , T i , and T d . On it, a T i = 0 and T d = ∞ is set, and the critical gain (K cr ) is obtained. Additionally, s = jω is substituted in the characteristic Equation (19) of the closed-loop system's transfer function Equation (20) to calculate the critical frequency P cr . The values that are calculated through this method and the values tuned experimentally are shown in Table 1.
2.5. Fuzzy Logic Control of the Solar Tracking System. The design of a Fuzzy Logic controller is described in four steps. Fuzzification, the error, and error change signals are normalized to the values inside the universe of discourse ( Table 2). The inference mechanism, the normalized inputs, and outputs are described in different membership functions, as shown in Figure 4. IF-THEN rules contain the linguistic description of the controller (Table 3). In defuzzification, the output signal is turned into a quantifiable value. The inference mechanism and the defuzzification method of this paper are Mamdani and centroid methods [22]. Figure 5 shows the simulation diagram of the fuzzy controller, where Re is the reference and YFL the controllers' output. The fuzzy error (g0), derivative (g1), and gain fuzzy (h f ). These can be tunable values that are used to improve the system's response. Its values are shown in Table 4.

Results and Discussion
3.1. Simulation. To simulate the complete system using Simulink™ and determine the controller to be implemented, the diagram in Figure 6 is followed. Equations (1) to (9) are used to calculate the solar radiation on an inclined surface, and Equations (10) to (13) are used to obtain the mechanical and electrical dynamics of the system. To determine the PV module's behavior, Equations (14) to (17) are used. The equations, charts, and the diagram in Sections 2.4 and 2.5 govern PID and Fuzzy Logic controllers. The simulation data to evaluate solar radiation is shown in Table 5 and in Table 6 is shown the data of the photovoltaic module [23]. The results illustrated in Figure 7 were obtained.
In Figure 7, we can observe that both controllers can maintain the electric power output, within the nominal parameters of the PV module for 1 hour and 30 minutes. However, as exposed in Figure 8, the FL controller shows better performance because it has a stabilization time of 2.4 seconds, maximum output power transient of 0.59%, and a steady-state error of 0.51%. The control with PID for its part has a stabilization time of 2.98 seconds, maximum output power transient of 0.66%, and a steady-state error of 0.59%.

International Journal of Photoenergy
For these reasons, the decision to implement the FL controller was considered. A simulation comparison was made of the energy produced by a photovoltaic module when imple-menting a solar tracker with respect to a fixed system. The results were that, for all times of the year, there is a higher production when using a two-axis monitoring system. For

Methodology of Implementation.
The prototype to implement Fuzzy Logic controller is shown in Figure 9. The solar tracking system is made up of two linear actuators, one for the vertical axis, which corresponds to the azimuthal angle (λ), and the other for the horizontal axis, which corresponds to solar altitude (α). Each axis consists of two rowlocks and a round tube to allow rotation. The gyroscope was installed in the frame of the photovoltaic module, taking care not to interfere with the photovoltaic cells or produce shadows. The implementation methodology of the power control algorithm for a dual-axis solar tracker is shown in Figure 10.
Step 2. According to the installation site of the solar tracker and the design parameters of the PV module, the algorithm is loaded with the data of the observer's meridian's longitude (L Long ), local standard meridian (L mel ), latitude (φ), and the reference power (P ref ).
Step 4. Calculate the solar radiation on an inclined surface (H T ) by Equations (1) to (9).
Step 5. Compare the estimated solar radiation (H T ) with 0.
Step 6. Update of the power output.
Step 7. Compare the output power (P out ) with the reference power (P ref ).
Step 8. Calculate orientation (θ X ) and inclination (θ Y ) angles of maximum power point tracking.
Step 9. Angles θ X and θ Y of the PV module are obtained, to maintain a power output that is within the nominal parameters of the PV module.
Step 10. The control algorithm, either PID or Fuzzy Logic, uses the reference angle estimated in Step 8 or 9 and generates a control signal to modify the solar tracker's position.
Step 11. The control signal is taken to a power stage, which can activate the linear actuators XLA18. For this, a coupling stage using optocouplers 4N25, transistors 2N222 and TIP31C are required. Moreover, feedback to Step 10 is carried out with the gyroscope MPU6050.
Step 12. Orientation and inclination of the PV module.
Step 13. Measuring of output current (I) and voltage (V) using sensors CSNE151 and LV25P, respectively.
Step 14. Compare the output power with 0.
P out < 0 ⟶ Step 15, Step 15. Adjustment of the orientation to θ X = 90°and inclination to θ Y = 45°. Figure 11 shows the flow diagram of the FL controller implementation. The microcontroller Atmega2560 [24] is the device that communicates the computer, which is where the FL control algorithm is implemented with the tracking system. The H-bridge with transistors TIP31 [25] Figure 9: Prototype two-axis solar tracking system to implement Fuzzy Logic controller.

International Journal of Photoenergy
Step 1 Obtain: Y, M, d, h, min and s Step 2 Calculate: LLong, Lmel, and P ref

Step 3 Estimate and
Step 4 Determine H T Step 5 H T > 0 Step 8 P = P max Calculate x and y Step 9 P = P ref Calculate x and y Step 10 Control of position Step 11 Solar tracker Step 12 Photovoltaic module Step 13 Measure I out and V out Step 14 P out > 0 Step 6 Power (w)

End
Step 6 P = 0 + P out   International Journal of Photoenergy are feedbacked to the microcontroller and calculated the output power. Table 7 shows the technical specifications of the sensors used in the implementation. The average energy consumption for the solar tracking system to work is 6.71 w for each hour it is operating; this is because at times of the year where the length of the day is longer, such as in spring and summer, it has a consumption of 80.5 w when considering 12 hours of light and in autumn and winter, daily consumption of 60.39 w when considering 9 hours. The system is kept switched off at night to avoid energy consumption and can be reset when the first rays of sunlight are detected.
To determinate the propagation of the error, the maximum and minimum values of the uncertainty, and the relative error, Equations (26) to (30) are used [29].
I out ± δI out = I out 1 ± δI out I out j j : The product is Maximum value of P max is Minimum value of P min is Relative product error is

Results
Two tests were carried out to verify the functioning of the controller. Test 1 is aimed at maintaining the PV module power output in its nominal power. Test 2 consists of maintaining the PV module's power output following an arbitrary power reference. The data and parameters of the carried-out tests are shown in Table 9 and the results in Figures 12 and 13. Figure 12 shows the results of simulating and implementing the FL controller for test 1. This test started at 9:00 hours, and it is concluded at 16:00 hours, with sampling intervals of current and voltage every 5 minutes, used to estimate the power output. The reference power for the controller is 135.2 W, which is the nominal power output of the PV module. For this test, an uncertainty was considered with minimum and maximum values calculated with Equations (28) and (29). The simulation reaches the desired interval around at 10:00 hours and stays within it until a close to 15:00 hours. As a result, the nominal power generation is obtained with an error of ±13% for 4 hours. Of these 4 hours that the uncertainty interval was reached from 12:00 to 14:00 hours, it remained at the nominal output power 135.2 W. The implementation reaches the desired power output at around 10:30 and falls below it at 14:25 hours. Solar radiation that day allowed the PV module power output to be maintained within ±13% its nominal value close to 4 hours. The nominal output power was maintained from 10:30 to 14:10 hours. The test shows variations in the output power, due to the weather conditions of that day, a difference from the simulation where it has an ideal and gradual increase in solar radiation. Figure 14 presents the propagation of the error throughout test 1. Throughout the test period, an average error of 14.29% is obtained, which represents a difference of 19.32 W. However, once the system reaches the reference   9 International Journal of Photoenergy power at around 10:30 and until 14:10, an average error of 2.16% is obtained, which represents 2.92 W. Figure 13 shows the results of simulating and implementing the FL controller for test 2. In this test, a reference signal with diverse amplitudes is presented to validate the robustness of the algorithm against abrupt changes. This test started at 9:00 hours and concluded at 15:00 hours and followed the same sampling procedure as test 1. The simulation results show that the controller follows the different reference steps quickly and without transients. The implementation graph shows that the controller responds swiftly to reference modifications, succeeding in reaching satisfactory values in the   power output. As in test 1, the variation in output power compared to the simulation is due to changes in solar radiation. Figure 15 presents the propagation of the error throughout test 2. Throughout the test period, an average error of 5.92% is obtained, which represents a difference of 5.77 W. It is observed that the controller responds better to powers equivalent to or greater than 100 W, which is above 70% of the nominal capacity of the photovoltaic module. During the periods with references equal to or greater than 100 W. An average error of -0.75% was presented, which represents -0.68 W of the output power, expected to be delivered by the system. On the other hand, during all test 2, an average error of 5.77% was obtained, which represents 5.98 W more than the expected output power.

Conclusions
This paper presents the design and evaluation of two controls for a two-axis solar tracking system; the first is a Proportional-Integral-Derivative and the other by Fuzzy Logic. Both controls maintain the output power of a photovoltaic module at its nominal value. When carrying out the evaluation and for the performance shown in the simulation, the control by Fuzzy Logic is implemented. For implementation, it develops a data acquisition card made up of voltage,

11
International Journal of Photoenergy current, and gyroscope sensors. This allows the output power values of the module to be monitored in strut throughout the day and under different conditions of solar radiation, thus correcting the position of the collector surface with respect to the sun by moving the structure. This is with the intention of increasing the collection of solar energy and achieving a perpendicular incidence of solar rays, which results in greater energy production from the photovoltaic module. In the future, this type of control and monitoring of energy production allows adjusting and knowing the amount of electricity that is supplied, depending on the load that is connected to a photovoltaic system. Likewise, estimate energy production under different meteorological conditions. In the next works, it is proposed to develop wireless and remote monitoring with storage on a server of the information collected for analysis and study of the solar monitoring system and the photovoltaic system, in addition to integrating a graphical interface that allows the user to view the variables flexible in real-time.

Data Availability
The data, results, codes, and simulations used in this work can be provided upon request from author email address joelontiveros@itculiacan.edu.mx.

Conflicts of Interest
The authors declare that they have no conflicts of interest.