Intelligent Tuning of PID Controller to Balance the Shape Memory Wire Actuated Ball and Beam System

The ball on beam system is a highly nonlinear laboratory model which helps to understand the modern and classical control theory. This paper emphasizes the position control of a ball on beam system which is actuated by shape memory alloy wires in an antagonistic configuration. The shape memory alloy actuator provides the necessary force to actuate the beam in the left and right directions of angular position. To achieve effective control of any system it is necessary to design the controller optimally but it is very difficult due to the requirement of proper tuning which is not feasible by the conventionally designed controller. The objective of this paper is the optimal design of the well-received PID controller by using intelligent tuning techniques to drive the system with the best performance. Since the genetic algorithm and particle swarm optimization are the numerical algorithms that have been extensively used to solve all types of complex engineering problems to improve their performance, these algorithms are used to tune the PID controller. The results of genetic algorithm and particle swarm optimization are benchmarked with a conventionally designed PID controller.


INTRODUCTION
The objective of the ball and beam system is to locate the ball at a required position on the beam. The ball on beam system is an open loop unstable system because the ball slides to move to one of the ends of the beam. The position of the ball on the system changes with an acceleration that is proportional to the gradient of the beam. The task of the controller is to automatically control and brace the ball at a required position with the help of actuator output. The control variables are the acceleration of the beam and the voltage output of the actuator. In practice, two configurations of the system are available based on the actuator location. In one configuration the beam is hinged at the center and oscillates about the hinged point. In the other configuration, the two sides of the beam are hinged by lever arms. The gear arrangement is required to transfer the actuator signal to the system. The demerit of this system is that since more mechanical parts are considered in the design, it introduces some complications during the equation formation [1]. In this paper, the centrally hinged contour of the ball on beam system is taken for analysis. The actuator plays a major role in transferring the control action from the controller to the plant in any control system. The electric actuators are best suited for all applications in the areas of mechatronics, robotics and aerospace systems. Generally, DC motor and stepper motors are used as conventional electrical actuators. The advancement of smart material technology, particularly the shape memory alloy (SMA) extends a scope to replace them by alternative means, also to avoid their heavyweight and bulky construction. Actuators based on smart materials like piezoelectric and shape memory alloy are popular, but still the latter is preferable in comparison with the former in this application for reasons like feasibility and applicability [2].
Shape memory alloy is one of the smart materials which is gaining popularity due to its microstructure, molecular characteristics, and distinguished properties such as simple mechanism, lightweight, high force to weight ratio, less space requirement, etc. that make them suitable for actuation and even sensing. Unlike other metals and alloys, shape memory alloys exhibit the shape memory effect, i.e., an shape memory alloy can be strained at low temperature and when raised to a higher temperature returns back to its original undeformed state due to the transformation of states between low temperature martensite M and high temperature austenite A phase [3]. During heating and cooling of shape memory alloy wire due to phase transformation, shape memory alloys can engender the force and displacement and so temperatures are the main variables to be taken into account for building up shape memory alloy actuators [4]. The dynamic performance of the shape memory alloy actuation can be improved by reducing the heating and cooling time. Fast heating can be achieved by electrical resistance heating or Joule heating and it provides safe delivery of power without overheating and fast cooling can be done by natural convection [5]. The repeated and desired actuation of the shape memory alloy wire is achieved in two ways: (i) shape memory alloy wire with bias spring which has no active control of movement during natural cooling, (ii) two shape memory alloy wires with differential or antagonistic arrangement which provide better control by alternate heating and cooling of the shape memory alloy wires [6]. The differential arrangement of shape memory alloy wire is used as the actuator for the system under study.
This paper addresses three issues: the study on the most significant ball on beam control system, implemented with a new smart actuator to prove its capability to drive such a system and to apply and claim improved performance with the optimal design of the well-proven PID control scheme. The PID controller for shape memory alloy actuated ball on beam system is designed using one of the classical tuning techniques such as the Ziegler-Nichols (ZN) method. It is found from the outcomes that the performance of the Ziegler-Nichols method tuned PID controller is not up to the expectation. Hence the nonclassical methods such as the genetic algorithm (GA) and particle swarm optimization (PSO) have been implemented to get the optimal PID controller parameters to improve the system performance using MATLAB simulation and the results are verified experimentally. It is found that these algorithms outperform the conventional PID controller by employing any one of the time-domain specifications such as settling time, overshoot and integral square error (ISE), integral absolute error (IAE), integral time squared error (ITSE) and integral time absolute error (ITAE). The results are compared for Ziegler-Nichols method, genetic algorithm and particle swarm optimization based PID controllers.

ILLUSTRATION OF THE SYSTEM
This ball on beam is a benchmark for nonlinear dynamic, underactuated mechanical system in the laboratory level whose core concept can be applied to some practical control problems such as landing of airplane, problem, moving robot balancing; position control of spaceship and also that is a very useful system to understand modern as well as classical control concepts. The control of such a complex nonlinear system is difficult because the system has two degrees of freedom: the angular position of the beam and the corresponding rolling location of the ball. The objective is to ascend the position of the ball which depends upon the position of the beam.

Experimental Setup
The schematic setup and photograph of the ball on beam system are shown in Fig. 1. The structure of the ball on beam system consists of a centrally supported beam with a ball that moves along the beam. The structure incorporates two shape memory alloy wires whose contour is mechanically parallel and electrically in series which rolls over the pulley to provide antagonistic actuation. Such a contour provides ease of connection and offers double the strain and force. The horizontal beam can be rotated through an angle of 15° by antagonistic shape memory alloy. The wires sliding over the entire length of the beam. The angle of the beam is detected by a servo potentiometer fixed  at the shaft. The location of the ball is acquired by the variable resistance method using two nichrome wires sliding over the entire length of the beam. The two detected signals from the servo and linear potentiometers are given to the controller and the generated control signal is converted to current using voltage to current converter circuit (OPA547). This current is given to the shape memory alloy actuator using a data acquisition card (USB 1408 FS) which produces a force resulting in a torque acting on the beam to rotate the beam by an angle . By controlling the control signal to these actuators, the topographic point of the ball is ascended and maintained at the desired position. The details of the beam, ball, and shape memory alloy wire are shown in Tables 1 and 2.

System Model
The mathematical exemplar of the shape memory alloy actuated ball on beam system consists of two parts: (i) the equation model of the ball and (ii) the equation model of the shape memory alloy actuator as shown in Fig. 2. The model of this centrally pivoted system is derived with the following considerations: the gravity of the beam is neglected and the angles of beam and actuator positions are to be the same. Since the system is open-loop unstable, the closed-loop feedback is necessary to stabilize the system [6,7]. The transfer function of the system relating the ball position x and the beam angle  is given in Eqs. (2) and (3). The shape memory alloy actuator generates a force that acts on the pulley which translates this force to the shaft of the hinged beam. To balance the dynamics of the ball and to bring it to a required set point on the beam, the angle of rotation and strain are very important which are decided by the radius of the pulley and the length of the shape memory alloy wire. Equation (1) shows the relationship between the beam angle and the length of the shape memory alloy wire: 2 , 360 The models of the ball and the shape memory alloy actuator are determined using a system identification approach in MATLAB using the prediction error estimate method. This method is preferred over other methods due to good estimation accuracy. The models obtained are shown in Eqs. (4) and (5)

Control Using Conventional PID
The control objective is to keep the ball at any required set position, by controlling and stabilizing the angle of the beam. The above task is performed by controlling the control signal to shape memory alloy wire actuators by the PID controller.
The PID controller is extensively used in all industries due to its simplicity in function and reliable performance. Its main function is reducing the steadystate error and improving the dynamic response of the system by adding a pole at the origin which increases the system type number by one with integral action and adding a finite zero with the derivative action of the controller, respectively.
The mathematical model of the PID controller is given by Eq. (6) where K p , K i , K d are the proportional, integral, derivative gains of the PID controller respectively and e(t) is the error signal given to the controller which is the deviance between the expected output and the actual output, u(t) is the controller output. To get good control performance it is necessary to design or tune the gains properly. To verify the controller performance, the integral performance indices to the error signal e(t) are often a good choice. They are IAE, ISE, ITAE, and ITSE. Since PID-type controllers are widely used in the process industry, there are many algorithms or methods available among those, Ziegler-Nichols, and Cohen-Coon are familiar, but these have their limitations.
Since the overall order of the system is more than two it is difficult to control the system with a single controller hence PID cascade structure as shown in Fig. 3. This control is preferable for any ball and beam system which contains outer and inner control loops, one with a primary PID controller for controlling the ball position and another with a secondary PID controller to control the beam angle. Various control strategies such as the neural network [8], sliding mode control [9] have been tested on the conventional ball on beam system in which the DC motor acts as the actuator [10]. In this (SMA actuated ball on beam) system, the inner loop governs the shape memory alloy actuator and the outer loop governs the ball position.
Few control strategies have been tested on this system and presented as follows: PWM based control, fuzzy based autoadaptive control [6]. The inner and outer PID controllers are designed using the Ziegler-Nichols method to ascend the topographic point of the ball related to change in the beam angle. To evaluate the controller, the time domain variables such as rise time, overshoot, settling time and the error criterions are considered. PID controller with proper tuning will yield good time-domain specifications and minimum error criterion [11].
The ZN-PID controller performance is verified in the ball on beam system by the tracking performance for various input signals square, sinusoidal and multistep signals as shown in Figs. 4-6.

Outline of Genetic Algorithm
The genetic algorithm is the bioinspired heuristic random search method that emulates natural evolution based on Darwin's survival fittest theory. Genetic algorithm can be used in the complex domain without experiencing any difficulty. Genetic algorithm is characterized by a group of parameters such as chromosome representation (encoding), population size, number of generations, boundary values for variables to be  optimized, probability rate of main operators of GA such as selection, crossover and mutation [11]. An objective function with error criterion ITAE (integral time absolute error) is more suitable for servo control problems since the error signal is forced to settle down at zero as soon as possible. This constraint is formed to design the controller with less overshoot, fast rise time and small settling time. Based on the fitness value of each mortal and probability value, the group of chromosomes are chosen to undergo three basic operations of genetic algorithm: selection, crossover and mutation to create new mortal to produce the best solution as parents that yield the optimal solution as children. In recombination or crossover, the portion of chromosomes which corresponds to the qualities of the parents are exchanged or combined to form the offspring. The new feature of the offspring is obtained by flipping or mutating the single bit or gene in the chromosome.

Implementation of Genetic Algorithm Based PID
The transient response of the system can be improved by tuning the PID controller optimally using genetic algorithm [13]. The schematic structure of the controller design using genetic algorithm is shown in Fig. 7. The parameters of the PID controller such as K p , K i , K d are the genes for the set of chromosomes. The boundary values for the genes are obtained from the conventional tuning method of Ziegler-Nichols. The selection of chromosome for the next generation is based on the fitness values of the chromosome which is the error-index. After the selection process, the crossover and mutation operation are performed over the chromosomes of high fitness value. The geo- Fig. 7. Schematic structure of GA-PID controller of ball on beam system. metrical selection which is simple to implement is applied here, and it has a notable ability to reduce the effect of premature convergence. The arithmetic crossover is employed because it takes the integer values of the parent and produces new offspring based on the arithmetic mean. Uniform mutation uses maximum and minimum uniform random value. The processes are continued for the fixed number of the iterations by termination function. The number of iterations has been chosen based on the convergence of objective function.
The optimal values of the PID controller are implemented in the shape memory alloy actuated ball on beam system and the performance of the system for the optimal gain values are verified for different input signals in simulation as well as in experimentation as shown in Figs. 8-10.

Overview of the Particle Swarm Optimization
It is an evolutionary, stochastic random search technique that imitates the intelligence of the swarm in the scenario of searching for food. It starts with a particle called swarm initialized at random position and velocity in the search space and also each particle   is the solution of the problem. Each particle adjusts/updates its flying position and velocity based on its personal flying experience (cognitive) called P best (personal best) and also the experience of other particles (social) G best (global best). The aim is to optimally find the solution by shuffling the positions of the particles towards the best fitting value and finally converging towards the single solution [14]. The predefined fitness function measures the performance of each particle. The mathematical equation for updating the position and velocity of the particle in the swarm is given by the following Eqs. (7) and (8) and the schematic diagram of the same is given in Fig. 11: where w is the inertia weight factor, V i (t) is the velocity of particle, i(t) is the number of iteration at t, X i (t) is the particle position at iteration i(t), c 1 and c 2 are positive acceleration coefficients used for convergence towards P best and G best solutions, r 1 and r 2 are the random numbers between [0, 1], P best is the best position of the individual particle and G best is the best position of group of particles.

Implementation of Particle Swarm Optimization Based PID Controller
Determining the optimal gains of PID controller such as proportional, integral and derivative constants for minimum error criteria are assigned in the search space with the vector K = [K p , K i , K d ] as the particles of the swarm in particle swarm optimization algorithm. The fitness/objective function is formed based on the error value between the actual output and de-    sired output and the error criterion ITAE. The pseudocode for implementing the particle swarm optimization algorithm for tuning the PID controller gains is given below [14]: 1. Assign initial values for the swarm size, random particles of K p , K i , K d gains with random position and velocity vector, inertia and acceleration constants, and iterations, etc.
2. Determine the objective function value for each particle (K p , K i , K d ).
3. Find the social and personal best particles (PID gains) and their respective fitness function.
4. Update the positions and velocity of each particle using Eqs. (7) and (8). 5. Check if termination condition of minimum error is reached or not if reached then stop; otherwise, go to step 2.
Unlike genetic algorithm, in particle swarm optimization there is a balance between global and local minima thereby it provides controlled convergence of the fitness function and obtains the best solution [15]. In this way, particle swarm optimization provides optimal gain values to the PID control action than the conventional ziegler nichols method and the nonconventional methods of genetic algorithm. The convergence of the fitness function (error value) towards the best optimal solution is obtained and the corresponding optimal solutions are implemented in the shape memory alloy actuated beam and also in the ball on beam system. The performances of the system are validated by the tracking response of the various input signals by simulation as well as experimentation as shown in Figs. 12-14. It is observed that the particle swarm optimization based PID control performs better than conventional and genetic algorithm for square wave, sine wave and multistep input for both ball position and beam angle.

RESULTS AND DISCUSSION
The influences of the optimized PID controller gains are studied from the following results. The gains of the PID controllers for controlling beam angle and ball position are tuned using the conventional ZN method and the tracking responses for different input signals, square, sinusoidal, multistep are simulated and verified experimentally as shown in Figs. 4-6. The Time domain parameters of the system and performance indices are determined and tabulated as shown in Table 3. The objective function (ITAE) is    minimized using the genetic algorithm and particle swarm optimization and the convergence graph for objective function is obtained for optimal values of PID gain parameters as shown in Fig. 15. The tracking response of the system for the step change in the position of ball and beam angle is simulated and checked experimentally with those optimal gain values as shown in Figs. 16, 17. To validate the performance of particle swarm optimization, genetic algorithm based controller with conventional controller, the time domain specifications are observed from the response and the performance indices (error criterion) integral square error (ISE), integral absolute error (IAE), integral time squared error (ITSE) and integral time absolute error (ITAE), are evaluated and tabulated in Table 3. Due to the premature convergence of genetic algorithm based PID, the fitness function converges at local minima. But in particle swarm optimization the inertia weight and acceleration coefficients are used to provide better convergence of the solution than genetic algorithm and avoid premature convergence. It is proved that the particle swarm optimization based PID controller has minimum settling time and overshoot than the conventional controller and genetic algorithm based PID controller. Based on the results it is seen that the particle swarm optimization-PID controller outperforms the ZN-PID and GA-PID controller in terms of ISE, IAE, ITSE and ITAE for both beam angle and the ball position.

CONCLUSIONS
This paper exhibits the implementation of optimization algorithms (genetic algorithm, particle swarm optimization) for the shape memory alloy actuated ball on beam system. This study is considered essential since the implementation of the basic, well-received PID controller on this system did not prove fruitful, due to the most dominating effect of overshoot and large settling time which are of course most undesirable for any control system. The results indicate that the optimally tuned PID controllers control the beam with the action of shape memory alloy actuator wire and hence position control of the ball is attained with minimum settling time and overshoot in comparison to the conventional PID. The performance indices ISE, IAE, ITSE and ITAE are also evaluated and compared for all the three schemes. The results demonstrate that the tuning of the controller based on particle swarm optimization leads to improved performance and increases the tracking accuracy of the shape memory alloy actuator as well as the ball on beam system.