**2. Fuzzy logic controller for rotary crane system automation**

#### **2.1 Introduction**

The main purpose of controlling a Rotary crane is transporting the load as fast as possible without causing any excessive sway at the final position. Active sway angle control of Rotary crane consists of artificially generating sources that absorb the energy caused by the unwanted sway angle of the rope in order to cancel or reduce their effect on the overall system.

In Rotary Crane System, two main objectives are to be achieved that is the positioning and at the same time avoiding the swinging of the hooked object. These two functions are depending on the speed of the crane motion. Usually the crane is handled manually by human operator and the balancing control is also done by him/her. The balancing control is depending on the skills/experiences of the human operator to move the payload safely and

$$T = \frac{1}{2}M\dot{\chi}^2 + \frac{1}{2}m(\dot{\chi}^2 + \dot{l}^2 + l^2\dot{\theta}^2 + 2\dot{\omega}\dot{l}\sin\theta + 2\dot{\omega}l\dot{\theta}\cos\theta) \tag{4}$$

$$
\mathcal{U}\lrcorner = -m\!\!\!\!/ \!\!/ \!\!/ \!\!/ \!\!/ \!\!/ \!\!/ \!\!/ \!\!/ \!\!/ \!\!/] \tag{5}
$$

$$
\frac{d}{d\alpha} \frac{\partial L}{\partial q\_f} - \frac{\partial L}{\partial q\_f} = F\_f \tag{6}
$$

$$F\_{\mathbf{x}} = (M+m)\mathbf{x} + ml(\ddot{\theta}\cos\theta - \dot{\theta}^2 \sin\theta) + 2ml\dot{\theta}\cos\theta + m\ddot{\theta}\sin\theta$$

$$l\ddot{\theta} + 2l\dot{\theta} + \ddot{\mathbf{x}}\cos\theta + g\sin\theta = 0\tag{7}$$

$$
\dot{x} = Ax + Bu\tag{8}
$$

$$\mathbf{y} = \mathbf{C}\mathbf{x} \tag{9}$$

$$\mathbf{x} = \begin{bmatrix} \mathbf{x} \ \boldsymbol{\theta} \ \dot{\mathbf{x}} \ \dot{\boldsymbol{\theta}} \end{bmatrix}^{\mathsf{T}}$$

$$\mathbf{A} = \begin{bmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & \frac{mg}{M} & 0 & 0 \\ 0 & \frac{(M+m)g}{Ml} & 0 & 0 \end{bmatrix} \quad \mathbf{B} = \begin{bmatrix} 0 \\ 0 \\ \frac{1}{M} \\ \frac{1}{Ml} \end{bmatrix} \\ \mathbf{C} = \begin{bmatrix} 1 & 0 & 0 & 0 \end{bmatrix} \\ \mathbf{D} = \begin{bmatrix} 0 \end{bmatrix}$$



Fuzzy Logic Controller for Mechatronics and Automation 125

PID controller is one of the most used techniques in motion control system due to its simplicity and performances. However, PID controller could only be used effectively in linear system and does not work well with the nonlinearity system. Even if the model of the system is to be developed with PID controller, it would be complicated and this may affect

Again, fuzzy approach is the most suitable technique in developing the control algorithm that relates with the nonlinearity function. With its capability in simplifying the model of the system, it can realize the high speed high precision of the system. M. M. Rashid et.al [5] in his article proposed a design of PID controller with added fuzzy logic controller (FLC) of fuzzy-tuned PID controller. With the addition of the FLC, the PID controller can adapt, learn

In this design, fuzzy logic is used to determine the PID controller gains, Kp, Ki, Kd as the

or change its parameters based on the conditions and desired performance.

function of error and error rate as illustrated in the following block diagram

In developing the fuzzy-tuned PID controller, two design stages are used as follows: 1. Nominal values for PID controller gains are designed based on the linear model

membership functions and rules are constructed in each fuzzy tuner.

2. Based on the current PID controller gains, the fuzzy tuner is designed to produce Kp, Ki

Since there are three gains to be produced, there would be 3 fuzzy tuners to be designed. Each of them has two inputs (error and error rate) and one output (gain). Different

(a) (b)

Fig. 16. Membership function of a) the error and b) error rate for Kp fuzzy tuner

the performance speed of the hardware.

Fig. 15. Structure of the Fuzzy-tuned PID controller

and Kd.

Where

P = Positive, Z = Zero, N = Negative, PB = Positive Big, PS = Positive Small, NB = Negative Big, NS = Negative Small

For fuzzy inference, Mamdani's Min-Max method is used in both position and anti-swing control. As for defuzzification, centre of area or COA method is used to calculate the crisp value where the final outputs for both controllers are in Voltage. The results of the fuzzy controllers were obtained experimentally and the comparison between classical PID controller and FLC is compared as in following table.


Table 4. Positioning perfomances


Table 5. Anti-swing performances

Fuzzy Controllers show more satisfied result as compared to PID controller where the percentage overshoot and Settling Time were greatly improved. With lower settling time obtained by using the FLC, the performance of the rotary crane system is more stable than with the PID controller.
