Keywords

1 Introduction

The Inverted Pendulum is one of the most ancient problems of control engineering. Inverted Pendulum is highly nonlinear system and unstable (upwards) in open loop. It consists of a moving cart and oscillating pendulum. The aim of the work is to move the cart to its commanded position without causing the pendulum to tip over. PID Controller is a commonly used in controlling industrial loops owing to its simple structure, easy implementation, robust nature, and less numbers of parameters [1, 2]. Proportional, integral, and derivative are the controllers output, a control variable (CV) is a measure of error (e) between set point (SP) and process variable (PV) [3]. However, the method is not suitable for higher order systems. Fuzzy control techniques can provide a good solution for those above problems by introducing linguistic information. Fuzzy systems are knowledge-based or rule-based systems that contain descriptive IF-THEN rules that are created from human knowledge and experience. ANFIS is a combination of both Neural Network and Fuzzy system. The ANFIS control is developed using supervised learning (i.e., the input–output data sets are known). ANFIS refers to a set of adaptive networks, having a similar function corresponds to fuzzy inference systems.

The acumen method based on Fuzzy Logic and ANFIS for tuning a PID Controller has been compared. The controller tuned by various methods has been used for the control of Inverted Pendulum. The acumen methods provide better performance in terms of various performance specifications than the PID Controller.

This paper is organized in four sections. Section 1 gives the general introduction of the paper. Section 2 represents the problem formulation. Section 3 the tuning of PID Controller using various acumen methods such as Fuzzy Logic and ANFIS has been discussed. The results, comparison, and discussion are given in Sect. 4. At the end conclusion and brief list of references are given.

2 Problem Formulations

The aim of this paper is to design a PID, Fuzzy Logic and ANFIS controller. The Inverted Pendulum is unstable in an open loop system (i.e., without any controller). To control this system, we have to design a controller. Finally, these controllers which will give the effective output are compared. The dynamic equation of the cart and pendulum in Laplace transform form is as follows:

$$\left( {I + ml^{2} } \right)\varPhi \left( s \right)s^{2} - mgl\varPhi \left( s \right) = mlX\left( s \right)s^{2}$$
(1)
$$\left( {M + m} \right)X\left( s \right)s^{2} + bX\left( s \right)s - ml\varPhi \left( s \right)s^{2} = U(s)$$
(2)

The plant has two transfer function model. The first is the Cart’s position and the second is the pendulum of the angle given below [4]:

$$\begin{aligned} T \cdot F_{\text{Position}} & = \frac{X(s)}{U(s)} = \frac{5.841}{{s^{2} }} \\ T \cdot F_{\text{Angle}} & = \frac{{\Phi (s)}}{U(s)} = \frac{3.957}{{s^{2} + 6.807}} \\ \end{aligned}$$

3 Conventional and Acumen Methods

3.1 PID Controller

A control loop feedback device for a Proportional-Integral-Derivative (PID) controller is extensively used in industrial control loops [5]. It calculates an error value as the deviation between PV and SP. The output of the PID Controller in the time domain is as follows [6]:

$$u\left( t \right) = k_{p} e\left( t \right) + k_{i } \mathop \smallint \nolimits e(t){\text{d}}t + k_{d} \frac{{{\text{d}}e}}{{{\text{d}}t}}$$
(3)

The control signal (u) to the plant is the super-positioned output of the proportional (k p ), derivative (k d ) and integral term (k i ) of the error with respect to time.

3.2 Fuzzy Logic Controller

Nonlinear, unstable, process dynamics system proves that the conventional PID Controller will not produce better performance. To get better response, it is essential to tune automatically the PID Controller. Fuzzy Logic controller will do the automatic tuning of PID Controller. Fuzzy Logic system translates the linguistic control scheme into robotic control scheme. A fuzzy is characterized by a membership function which provides a grade between 0 and 1 for all the objects defined in the set. Fuzzy sets allow partial membership which means that an element may partially belong to more than one set [7]. The inputs are error and the rate of change of error (Δe) while the output is controller output (y). For finding the universe of discourse for the input and output membership functions, the PID Controller has been tuned using Ziegler–Nicholas method, and hence the input output membership functions will be found out [8].

The position FIS has nine rules with the three membership functions triangular type. The input1 (error) membership function ranges are from −1 to 1 and the input2 (derivative) membership function ranges are from −1 to 1 respectively. The output membership function ranges are from −1 to 1 respectively. The angle FIS structure has twenty five rules with the five membership functions triangular type. The input1 (error) membership function ranges are from −5 to 5 and the input2 (derivative) membership function ranges are from −7 to 7 respectively. The output membership function ranges are from −35 to 35 respectively.

3.3 ANFIS Controller

ANFIS is a combination of neural network and Fuzzy Logic features [9]. ANFIS develops a Takagi Sugeno fuzzy inference system (FIS) with the help of the input output dataset. Using the back propagation algorithm, error tolerance, and epochs the membership functions are acquired. The input–output dataset will be taken from the PID Controller tuning using conventional method for both position and angle [1013]. The inputs are error and the rate of change of error, while the output is controller output (y). The input–output dataset will be loaded in the ANFIS toolbox for both position and angle.

Initially, the position data set will be loaded and then by assigning the above terms will acquire the membership function. We have to reduce the average error into minimum range and then it will be saved as a FIS structure. Figure 1 shows that the loading of training data in ANFIS and Fig. 2 shows that the training of FIS in ANFIS for position control.

Fig. 1
figure 1

Loading of training data in ANFIS

Fig. 2
figure 2

Training of FIS in ANFIS for position control

A total of 736 data points are considered which are collected from PID position control and stored in workspace of MATLAB ANFIS toolbox. FIS are generated using subtractive clustering with two membership function and two rules. The average testing error of position control is as 0.23624. Figure 3 shows that the loading of training data in ANFIS and Fig. 4 shows that the training of FIS in ANFIS for angle control.

Fig. 3
figure 3

Loading of training data in ANFIS

Fig. 4
figure 4

Training of FIS in ANFIS for angle control

A total of 2740 data points are considered which are collected from PID angle control and stored in workspace of MATLAB ANFIS toolbox. FIS are generated using grid partition with five membership function and twenty five rules. The error of angle control is as 0.57216. That FIS structure should be placed in the control system block instead of controller. The input can be any test signal, usually we use step signal as input for the position control and we use discrete impulse as input for the angle control. Hence, the output should track the input which we are giving.

4 Results, Comparison, and Discussion

The transfer function of Cart’s Position is subjected to step input and the transfer function of Pendulum’s angle is subjected to discrete impulse. The design of the controller corresponds to various methods has been shown in Figs. 5, 6, 7, 8, 9 and 10 using different tuning methods.

Fig. 5
figure 5

Step response for position of PID Controller

Fig. 6
figure 6

Discrete impulse response for angle of PID Controller

Fig. 7
figure 7

Step response for position of FUZZY controller

Fig. 8
figure 8

Discrete impulse response for angle of FUZZY controller

Fig. 9
figure 9

Step response for position of ANFIS controller

Fig. 10
figure 10

Discrete impulse response for angle of ANFIS controller

4.1 PID Controller

The response of the PID Controller for the position of the cart with input step time as 2 and final set point value as 1.

The response of the PID Controller for the Pendulum’s angle with discrete impulse input delay as 2 and final set point value as 0.

4.2 Fuzzy Logic Controller

The response of the Fuzzy Logic controller for the position of the cart with input step time as 1 and final set point value as 1.

The response of the Fuzzy Logic controller for the angle of the pendulum with discrete impulse input delay as 2 and final set point value as 0.

4.3 ANFIS Controller

The response of the ANFIS controller for the position of the cart with input step time as 1 and final set point value as 1.

The response of the ANFIS controller for the angle of the pendulum with discrete impulse input delay as 2 and final set point value as 0.

The comparison among different acumen methods in terms of various performance specifications using acumen and conventional methods has been shown in Table 1.

Table 1 Comparison among two acumen methods for tuning a PID Controller

From comparison among two acumen methods for tuning a PID Controller can be concluded that

  • The rise time is less in conventional PID Controller than the acumen methods.

  • Settling time and overshoot has given best performance in ANFIS and PID.

  • Hence, the acumen methods give the better performance when compared with conventional PID Controller.

5 Conclusion

The controller for Inverted Pendulum has been designed. The tuning of a PID Controller is compared with Fuzzy Logic and Adaptive Neuro Fuzzy Inference System (ANFIS). The controller tuned by the acumen methods is used to control the Inverted Pendulum. This investigation result shows that by using both PID and Fuzzy Logic approach, ANFIS provides better performance. The future work can be carried out by applying neuro fuzzy architecture techniques like FALCON, GARIC, or NEFCON to control the Inverted Pendulum.