**5. Numerical results and discussion**

The system response is simulated for the following parameter values:

$$\begin{aligned} m\_1 &= 0.1 \text{kg} \\\\ m\_2 &= 0.1 \text{kg} \\\\ l\_1 &= 1 m \\\\ l\_2 &= 1 m \end{aligned}$$

The FISs are tuned for 2 cases: (1) Without noise and (2) With 5% measurement noise applied to the inputs.

#### **5.1. FIS tuned without noise**

The rulebase obtained after tuning is shown in **Table 2**. The membership function boundaries are obtained as *R(10,15) = [0.5642 8.3738 7.1121 1.0264 4.2160 3.1641].*

#### *5.1.1. With zero initial angular velocity*

The system response, with zero initial angular velocity, is shown in **Figure 4**. The system was tested for different starting positions and in each case, the response settles within 5 s. Settling time is the time it takes the response to settle within an absolute value of 0.01 rad. The genetic fuzzy controller works well even when it is subjected to noise in the angle measurements. The responses for 5 and 10% noise are shown in **Figure 5**. For the 5% noise scenario shown in **Figure 5(a)**, the controller brings the system to settle in a very smooth manner. Both *θ<sup>1</sup>* and *θ<sup>2</sup>* settle within 5 s. In the case of 10% noise shown in **Figure 5(b)**, *θ<sup>1</sup>* settles within 5 s, but *θ<sup>2</sup>* takes close to 10 s to settle. The response for *θ<sup>2</sup>* also shows a slight oscillation before settling down.


**Table 2.** Rulebase obtained after training [13].

*If θ*<sup>1</sup> *is N AND is P*, *thenT* 1 *is R*(3).

32 Fuzzy Logic Based in Optimization Methods and Control Systems and Its Applications

our simulations, the simulation is performed for 5 s and hence *T = 5*.

The cost function that needs to be minimized by GA is given in Eq. (7). Since the cost function is an integral over time, it ensures that the system settles to the inverted position quickly. In

**Figure 3.** GA string values assigned to the input and output membership function boundaries for FIS1 [13].

**Figure 4.** Controllers trained without noise: Plots showing *θ<sup>1</sup> (t)* and *θ<sup>2</sup> (t)* under no noise with zero initial angular velocities [13].

**Figure 5.** Controllers trained without noise: Plots showing *θ<sup>1</sup> (t)* and *θ<sup>2</sup> (t)* under (a) 5% noise and (b) 10% noise with zero initial angular velocities [13].

genetic fuzzy controller works well even when it is subjected to noise in the angle measurements. The responses for 5 and 10% noise are shown in **Figure 7**. For the 5% noise scenario shown in **Figure 7(a)**, the controller brings the system to settle within 10 s. Some oscillation can be observed,

*(t)* and *θ<sup>2</sup>*

*(t)* and *θ<sup>2</sup>*

Development of a Genetic Fuzzy Controller and Its Application to a Noisy Inverted Double…

settles within 10 s, but *θ<sup>2</sup>*

 *= 0; θ<sup>2</sup> = 0.*

*(t)* under (a) 5% noise and (b) 10% noise with

*(t)* under no noise with initial angular velocities

http://dx.doi.org/10.5772/intechopen.78786

35

although insignificant. In the case of 10% noise shown in **Figure 7(b)**, *θ<sup>1</sup>*

**Figure 6.** Controllers trained without noise: Plots showing *θ<sup>1</sup>*

**Figure 7.** Controllers trained without noise: Plots showing *θ<sup>1</sup>*

initial angular velocities of 2 rad/s [13].

of 2 rad/s [13].

takes close to 15 s to settle. There is significant oscillation before it settles to *θ<sup>1</sup>*

#### *5.1.2. With non-zero initial angular velocities*

In this case, initial angular velocities of 2 rad/s are considered (*θ*̇ <sup>1</sup> <sup>=</sup> <sup>2</sup> *rad*/*s*, *<sup>θ</sup>*̇ <sup>2</sup> <sup>=</sup> <sup>2</sup> *rad*/*s*). The system response is shown in **Figure 6**. The system was tested for different starting positions and in each case, the response settles within 10 s. Just like the previous case with no initial angular velocity, the Development of a Genetic Fuzzy Controller and Its Application to a Noisy Inverted Double… http://dx.doi.org/10.5772/intechopen.78786 35

**Figure 6.** Controllers trained without noise: Plots showing *θ<sup>1</sup> (t)* and *θ<sup>2</sup> (t)* under no noise with initial angular velocities of 2 rad/s [13].

**Figure 7.** Controllers trained without noise: Plots showing *θ<sup>1</sup> (t)* and *θ<sup>2</sup> (t)* under (a) 5% noise and (b) 10% noise with initial angular velocities of 2 rad/s [13].

genetic fuzzy controller works well even when it is subjected to noise in the angle measurements. The responses for 5 and 10% noise are shown in **Figure 7**. For the 5% noise scenario shown in **Figure 7(a)**, the controller brings the system to settle within 10 s. Some oscillation can be observed, although insignificant. In the case of 10% noise shown in **Figure 7(b)**, *θ<sup>1</sup>* settles within 10 s, but *θ<sup>2</sup>* takes close to 15 s to settle. There is significant oscillation before it settles to *θ<sup>1</sup> = 0; θ<sup>2</sup> = 0.*

*5.1.2. With non-zero initial angular velocities*

initial angular velocities [13].

**Figure 5.** Controllers trained without noise: Plots showing *θ<sup>1</sup>*

**Figure 4.** Controllers trained without noise: Plots showing *θ<sup>1</sup>*

34 Fuzzy Logic Based in Optimization Methods and Control Systems and Its Applications

velocities [13].

In this case, initial angular velocities of 2 rad/s are considered (*θ*̇

response is shown in **Figure 6**. The system was tested for different starting positions and in each case, the response settles within 10 s. Just like the previous case with no initial angular velocity, the

*(t)* and *θ<sup>2</sup>*

*(t)* and *θ<sup>2</sup>*

<sup>1</sup> <sup>=</sup> <sup>2</sup> *rad*/*s*, *<sup>θ</sup>*̇

*(t)* under (a) 5% noise and (b) 10% noise with zero

<sup>2</sup> <sup>=</sup> <sup>2</sup> *rad*/*s*). The system

*(t)* under no noise with zero initial angular

#### **5.2. FIS tuned with 5% noise**

In this case, the FIS is tuned with 5% noise and the response of the resulting controller is examined. The rulebase obtained is same as the one shown in **Table 2**. The membership function boundaries are obtained as *R(10:15) = [0.3100 11.9261 7.4158 0.8904 3.8477 3.5883].*

#### *5.2.1. With no initial angular velocity*

The system response, with zero initial angular velocity, is shown in **Figure 8**. The system was tested for different starting positions and in each case, the response settles within 5 s. The genetic fuzzy controller works well even when it is subjected to noise in the angle measurements. The responses for 5 and 10% noise are shown in **Figure 9**. The controller is able to bring the system to settle within 5 s even in the presence of noise. Although there is a small undershoot, *θ<sup>1</sup>* settles much faster compared to the responses shown in **Figures 4** and **5**. There are no significant oscillations in the system response. It can be observed from **Figures 8** and **9** that the noise has a minuscule effect on the system response thus proving that the controller is very robust. Thus, when there is no initial angular velocity, the controller tuned for 5% noise performs much better, as expected.

#### *5.2.2. With non-zero initial angular velocities*

In this case, initial angular velocities of 2 rad/s are considered (*θ*̇ <sup>1</sup> <sup>=</sup> <sup>2</sup> *rad*/*s*, *<sup>θ</sup>*̇ <sup>2</sup> <sup>=</sup> <sup>2</sup> *rad*/*s*). The system response is shown in **Figure 10**. The system was tested for different starting positions

**Figure 8.** Controllers trained with 5% noise: plots showing *θ<sup>1</sup> (t)* and *θ<sup>2</sup> (t)* under no noise with zero initial angular velocities [13].

and in each case, the response settles within 5 s. The response of the controller when subjected to 5 and 10% noise are shown in **Figure 11**. For both cases, the controller brings the system to settle within 5 s. Even in the case of non-zero initial angular velocity, the controller is very resilient to noise. The settling time is less compared to the controller tuned without noise.

*(t)* and *θ<sup>2</sup>*

*(t)* and *θ<sup>2</sup>*

Development of a Genetic Fuzzy Controller and Its Application to a Noisy Inverted Double…

*(t)* under (a) 5% noise and (b) 10% noise with zero

http://dx.doi.org/10.5772/intechopen.78786

37

*(t)* under no noise with initial angular velocities

**Figure 9.** Controllers trained with 5% noise: plots showing *θ<sup>1</sup>*

**Figure 10.** Controllers trained with 5% noise: plots showing *θ<sup>1</sup>*

of 2 rad/s [13].

initial angular velocities [13].

Development of a Genetic Fuzzy Controller and Its Application to a Noisy Inverted Double… http://dx.doi.org/10.5772/intechopen.78786 37

**Figure 9.** Controllers trained with 5% noise: plots showing *θ<sup>1</sup> (t)* and *θ<sup>2</sup> (t)* under (a) 5% noise and (b) 10% noise with zero initial angular velocities [13].

**Figure 10.** Controllers trained with 5% noise: plots showing *θ<sup>1</sup> (t)* and *θ<sup>2</sup> (t)* under no noise with initial angular velocities of 2 rad/s [13].

and in each case, the response settles within 5 s. The response of the controller when subjected to 5 and 10% noise are shown in **Figure 11**. For both cases, the controller brings the system to settle within 5 s. Even in the case of non-zero initial angular velocity, the controller is very resilient to noise. The settling time is less compared to the controller tuned without noise.

**Figure 8.** Controllers trained with 5% noise: plots showing *θ<sup>1</sup>*

velocities [13].

**5.2. FIS tuned with 5% noise**

*5.2.1. With no initial angular velocity*

*5.2.2. With non-zero initial angular velocities*

*(t)* and *θ<sup>2</sup>*

In this case, the FIS is tuned with 5% noise and the response of the resulting controller is examined. The rulebase obtained is same as the one shown in **Table 2**. The membership function boundaries are obtained as *R(10:15) = [0.3100 11.9261 7.4158 0.8904 3.8477 3.5883].*

The system response, with zero initial angular velocity, is shown in **Figure 8**. The system was tested for different starting positions and in each case, the response settles within 5 s. The genetic fuzzy controller works well even when it is subjected to noise in the angle measurements. The responses for 5 and 10% noise are shown in **Figure 9**. The controller is able to bring the system to

faster compared to the responses shown in **Figures 4** and **5**. There are no significant oscillations in the system response. It can be observed from **Figures 8** and **9** that the noise has a minuscule effect on the system response thus proving that the controller is very robust. Thus, when there is no initial angular velocity, the controller tuned for 5% noise performs much better, as expected.

system response is shown in **Figure 10**. The system was tested for different starting positions

settle within 5 s even in the presence of noise. Although there is a small undershoot, *θ<sup>1</sup>*

In this case, initial angular velocities of 2 rad/s are considered (*θ*̇

36 Fuzzy Logic Based in Optimization Methods and Control Systems and Its Applications

*(t)* under no noise with zero initial angular

<sup>1</sup> <sup>=</sup> <sup>2</sup> *rad*/*s*, *<sup>θ</sup>*̇

settles much

<sup>2</sup> <sup>=</sup> <sup>2</sup> *rad*/*s*). The

**Figure 11.** Controllers trained with 5% noise: plots showing *θ<sup>1</sup> (t)* and *θ<sup>2</sup> (t)* under (a) 5% noise and (b) 10% noise with initial angular velocities of 2 rad/s [13].

**Table 3** compiles the results obtained for the double pendulum system. The table compares the settling time and the integral square error (ISE) for the two different controllers. The ISE is given by,

$$ISE = \int\_{0}^{\ast} e^{2}(t)dt\tag{8}$$

scenario in the case of the controller tuned without noise is on the higher side. But, this gets reduced when the controller is tuned for 5% noise. Thus, the overall performance of the sys-

Development of a Genetic Fuzzy Controller and Its Application to a Noisy Inverted Double…

http://dx.doi.org/10.5772/intechopen.78786

39

This chapter discussed the design of genetic fuzzy controllers to control an inverted double pendulum. While fuzzy logic by itself works well, tuning the parameters involved to satisfy a specific requirement might need a lot of trial and error to be done by the researchers. Incorporating GA to tune these parameters solves this problem. In this chapter, the objective was to bring the system to its inverted position. The time-integral cost function ensured that

The genetic fuzzy controller was able to stabilize the double pendulum at the inverted position starting from any initial position. The controller was tuned for two cases: (1) when there is no noise, and (2) when subjected to 5% noise. For each of the two cases, the results were shown for two sub-cases: (a) with zero initial angular velocities and (b) with non-zero initial angular velocities. The controller tuned for 5% has a better performance than the one tuned without noise. Tuning the controller with 5% noise improves the robustness of the system for a larger window of uncertainty. Since a lot of real-life systems suffer from measurement noise, it is important to

Department of Aerospace Engineering and Engineering Mechanics, University of Cincinnati,

[1] Omatu S, Fujinaka T, Yoshioka M. Neuro-PID control for inverted single and double pendulums. In: IEEE International Conference on Systems, Man and Cybernetics; 2000

[2] Azad M, Featherstone R. Angular momentum based controller for balancing an inverted double pendulum, Romansy 19–robot design, Dynamics and Control. Vienna: Springer;

[3] Walker A, Putman P, Cohen K. Fuzzy logic attitude control of a magnetically actuated

CubeSat. In: AIAA Infotech@ Aerospace (I@ A) Conference; 2013

develop robust controllers that can make decisions even when the inputs are noisy.

tem increases by tuning the controller with 5% measurement noise.

the FISs are trained to reduce the settling time.

**6. Conclusions**

**Author details**

USA

**References**

2013. pp. 251-258

Anoop Sathyan\* and Kelly Cohen

\*Address all correspondence to: sathyaap@ucmail.uc.edu

where e(t) is the error obtained by subtracting the actual response and the desired response which in our case is zero.

It can be seen from **Table 3** that the settling time and ISE are better in the case of the controller tuned with 5% noise. Optimizing the controller with 5% noise helps with the system response for larger window of uncertainty. As can be seen from **Table 3**, the ISE values for 10% noise


**Table 3.** Comparison of settling times (Ts in seconds) and the ISE for the scenarios discussed before [13].

scenario in the case of the controller tuned without noise is on the higher side. But, this gets reduced when the controller is tuned for 5% noise. Thus, the overall performance of the system increases by tuning the controller with 5% measurement noise.
