## 2 Heliostat Orientation Control
### Embedded System
#### 2.4.1 Controller Parameters  
The algorithms of the FLC and PID controller were designed for the position control of the DC motors at no load. Both controllers were tuned to accomplish with the design parameters of 10 ms sampling time and 100 ms of rising time without overshoot for the smallest change in the reference signal in order to reduce the energy consumed by the DC motors when the heliostat is moving [27]. Figure 12 shows the block diagram of the FLC. It is a two-input and one-output controller, three fuzzy sets in each input and output signal, a rule base with nine \"if-then\" rules, a Mamdani inference engine and the CoS defuzzification method. Additionally, there are two processing blocks due to the difference between the fuzzy sets values and the values of the input and output signals. The processing values are given by (15)-(17). \[e*=\frac{e}{\pi} \tag{15}\]  
\[de*=\frac{deT_{s}}{\pi} \tag{16}\]  
\[u*=uV_{max} \tag{17}\]  
where \(e*\), \(de*\) and \(u*\) represent the processing values of the input and output signals, and \(V_{max}\) represents the maximum voltage signal of the DC motors. The values of the fuzzy sets and the rule base of the FLC are shown in Figure 13 and Table 1, where the negative, middle, and positive values are denoted by the linguistic variables \(N\), \(Z\) and \(P\), respectively. The number and values of the fuzzy sets were selected in order to the control signal of the FLC can modify the position of the DC motor due to the smallest change of the error with a low computational effort. The symmetric shape of the fuzzy sets allows the controller to modify the direction of rotation of the DC motors with the same amplitude of the control signal, which corresponds to the values of the error and change of error. Figure 12: Block diagram of the fuzzy logic controller. The resulted control surface of the FLC is presented in Figure 14, showing the relationship between the inputs and the output as a consequence of the values of the fuzzy sets, the if-then rule base, and the CoS defuzzification method. The output value of the defuzzification varies from \(-1\) to \(1\); therefore, using Equation (17), the DC motor supply voltage ranges from \(-V_{max}\) to \(V_{max}\). For the PID controller, the transfer function of the DC motor is estimated by using the step signal response method in order to obtain the control gains of the PID controller to comply with the design parameters. The angular velocity can be approximated by using a discrete derivative term, as shown in Equation (7). The angular velocity is given by (18). \[\omega(n)=\frac{\theta(n)-\theta(n-1)}{T_{s}} \tag{18}\]  
The step response of the DC motor and the transfer function parameters are shown in Figure 15, where \(\omega=0.5369\ \frac{\mathrm{rad}}{\mathrm{s}}=5.126\ \mathrm{rpm}\) is approximately the rated speed reported in the DC motor datasheet, as shown in Table 3. \begin{table}
\begin{tabular}{c c c c} \hline \hline \(de\) & \(\mathbf{N}\) & \(\mathbf{Z}\) & \(\mathbf{P}\) \\ \hline \(N\) & \(N\) & \(N\) & \(Z\) \\ \(Z\) & \(N\) & \(Z\) & \(P\) \\ \(P\) & \(Z\) & \(P\) & \(P\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Rule base of the fuzzy logic controller. Figure 14: FLC control surface. Figure 13: Fuzzy sets of the fuzzy logic controller. The obtained mathematical model of the DC motor at no load is described by (19). \[G_{M}(s)=\frac{\Theta_{M}(s)}{V_{aA}(s)}=\frac{0.31275}{s^{2}+13.68925s} \tag{19}\]  
Finally, the control gains of the PID controller were obtained by using the Matlab Sisotool Toolbox. A rising time of 0.075 s and an overshoot of less than 5% were chosen as conditions of the output signal of the PID controller in order to accomplish with the design requirements and produce a smooth control signal to reduce the energy consumption for the DC motors. The control gains of the PID controller are shown in Table 2.  
The transfer functions of the DC motors connected to the heliostat axes were also obtained with the same method.