LINEAR CONTROL SCHEMES FOR ROTARY DOUBLE INVERTED PENDULUM

: In this article, the rotary double parallel inverted pendulum (RDPIP) is researched and presented. Additionally, some linear controllers, such as PID, PID, PID-LQR cascade, are proposed, developed to control RDPIP, and the impact of those controllers on the rotary double inverted pendulum was examined. The research and simulation results are implemented in the Matlab/Simulink toolbox to prove the ability of these types of controller in balancing this model.


Introduction
The research and application of experimental models to life have become increasingly developed and are implemented in diverse fields.And one of them that is used in a range of fields, including aviation (balancing rockets), robotics (cargo transport and load-unload), and two-wheeled balance vehicles, is the rotary inverted pendulum (RIP).These applications bring a lot of benefits to people, helping to optimize productivity and improve quality of life.RIP is a nonlinear and unstable system, and it is considered the most popular model in the families of inverted pendulum systems.Today, it is easy to find RIP at many universities around the world.It is very suitable for both teaching and researching because this system is a simple model and does not cost too much to build.Today, many controllers are conducted on RIP, such as the PID controller [1] [2], the LQR controller [3] [4] [5], the fuzzy controller [6] [7], and the sliding mode controller [8] [9].Additionally, the rotary double serial inverted pendulum (RDSIP) is one of several new systems that have recently been developed from the rotary single-link inverted pendulum.There are diverse articles about RDSIP, and several controllers are proposed for RDSIP, such as the LQR controller [10] [11], and the sliding mode controller [12].
Scientific research articles mentioned above show that RIP and RDSIP are widely studied nowadays.Therefore, a new structure of RIP is suggested and researched in this article.And this model is a rotary double parallel inverted pendulum (RDPIP), which is a popular model in education and research due to its flexibility.So, there are not many articles about RDPIP available right now.RDPIP is built by adding one more parallel link to an existing link at the end of the arm, and both pendulums are opposite each other.This method differs from adding another serial link to an existing link to build RDSIP.The arm rotation in RDPIP has a direct effect on the two parallel pendulums, which are different because the lengths of the two pendulums are different.The short pendulum reacts strongly and is more likely to drop quickly.RDPIP is a single input-multiple output (SIMO) system that is nonlinear and unstable.Therefore, this system makes it difficult to not only control reality but also simulate this system.
Currently, a few studies are conducted on RDPIP to calculate its dynamic equation and investigate for stability [13] [14].In addition, some controllers are also deployed on RDPIP to control and maintain the stability of the system, such as the LQR controller [15] [16] [17] [18], and the neural networks controller [19].The main objective of this investigation is to develop a mathematical model of RDPIP and survey some linear controllers, such as LQR controller, PID-LQR controller, and cascade PID-LQR controller for RDPIP.RDPIP is calculated and simulated using Matlab/Simulink Toolbox.

Fundamentals
Physical structure of RDPIP includes two pendulums, an arm, two encoders, a DC motor, and an iron frame in Fig. 1, and physical parameters of this system are listed in Tab. 1.   [18], the Lagrange function is used to calculate the system's mathematical equation.The following is the Lagrange equation.
The kinetic energy of the RDPIP system where 12 , vv are the first and second pendulums respective velocities.The kinetic energy equation is rewritten as follows: The potential energy of this system is Loss of energy in RDPIP depends on frictional force.
Lagrange operator is calculated with (1)(3)(4) (5) as follows: RDPIP operates with a DC servo motor.The relationship between moment and voltage is given by Parameters of motor are listed in Tab. 2 Tab. 2. Values of parameters of motor.
835271 The dynamical equation of the RDPIP system is deduced from (1)(6) (7), which is written in the form of an equation of state as follows: sin sin

Linearized State Equation
LQR is a type of linear algorithm.However, RDPIP is a nonlinear model.As a result, it must be linearized around the operation point (the upright position).
RDPIP's linearized state equation is as follows: x Ax Bu y Cx And matrices A and B are calculated as follows: where,

Stability Analysis of Linearized RDPIP
The eigenvalue position can be used to determine the stability of system.The characteristic equation can be expressed in det(λI − A) = 0 where λi (i = 1,...,N) are the eigenvalues of A ∈ Rn × n.Values of parameters of RDPIP are presented in Tab. 3 T [0 0 0 0.0123 0.0130 0.0167] B = (29) The open-loop poles of this system are calculated in MATLAB using the eig(A) command, as follows: The results show that system is unstable.

Controllability of RDPIP
Controllability of a system is examined by Mct matrix.If the rank of the matrix is equal to the number of systematic degrees and det is not equal to 0, then this system is controllable.This matrix is calculated from the A and B matrices as follows: Following, the rank() and det() command are used to calculate in Matlab.The result is given as det( ) 0.000061927 ( ) 6; (32) From (32), we see that RDPIP is controllable.

LQR and PID controller
In this research, LQR controller is proposed and deployed on RDPIP.LQR controller is a popular and widely used in balancing of system.Control law of LQR controller is given as ( ) ( ) u t Kx t =− (33) Besides, a PID controller is also deployed to be combined with LQR to design a combined controller, such as PID-LQR or cascade PID-LQR.The PID controller is very popular and is widely used to control positions for many systems.Form of PID controller is as given below ()

Controller Implementation
In this section, there are three linear controllers that are proposed and deployed on the RDPIP system, including the LQR controller in Fig. 2, the PID-LQR controller in Fig. 3, and the cascade PID-LQR controller in Fig. 4. Their schemes are shown in turn as follows:   Three schemes show the structure of controllers on DRPIP model.This process is implemented by using functional blocks in Matlab/Simulink.
Additionally, RDPIP operates with a DC servo motor, and Vin is calculated through controllers, which are listed above.The flowchart below shows the process of receiving and processing signals to calculate an input signal (Vin), which is used to control and maintain stability for this system with LQR controller, PID-LQR controller, and cascade PID-LQR controller.With LQR controller, Q and R matrices are very important, and the choice of Q and R matrices will directly affect the output response of RDPIP.Those matrices are chosen by trial and error method as follows: 10 ,10 ,10 ,0,0,0 ; 0.01 After the choice of Q and R matrices is made, the feedback control gain of LQR controller is obtained as   5 10 0.0316 -7.2934 6.5333 0.0490 -1.6112 1.2497 With PID controller, to find the parameters of controller, trial and error test is also used.The parameters of the PID-LQR controller are given as Kp1 = 2; Kd1 = 1; Ki1=0; (37) And parameters of cascade PID-LQR controller are given as below Kp1 = 2 ; Kd1 = 1 ; Ki1=0 Kp2 = 30 ; Kd2 = 3 ; Ki2=0 Kp3 = 2 ; Kd3 = 0.3 ;Ki3=0 (38)

Simulation Results
In this section, RDPIP is simulated with kinds of linear controllers, which are present above, such as LQR, PID-LQR, and cascade PID-LQR controllers.The followings are the initial angular position and angular velocity points for two pendulums and the arm of this system.
-The initial angular position of pendulum 1: 0.02 rad -The initial angular position of pendulum 2: 0.03 rad -The initial angular position of arm: 0.04 rad -The initial angular velocity of pendulum 1: 0.03 rad/s -The initial angular velocity of pendulum 2: 0.06 rad/s -The initial angular velocity of arm: 0.08 rad/s Firstly, RDPIP is simulated with LQR controller.The result is given below.Fig. 6 and Fig. 7 show the response and control input voltage of this system.The results are fairly good.Both pendulum1 (the long pendulum) and pendulum2 (the short pendulum).Both pendulum1 (long pendulum) and pendulum2 (the short pendulum) oscillate relatively small.After about 3 seconds, both pendulums begin to stabilize and maintain themselves around operation points (the upright position).Meanwhile, arm of this system oscillates more strongly in the first seconds, and it takes 4.5 seconds for arm of RDPIP to be stabilized.Because initial oscillations of system are quite strong, a large voltage is supplied to it.Therefore, it can be concluded that RDPIP operates with LQR controller, which stabilizes after 4.5 seconds from the beginning.
Secondly, RDPIP is simulated with PID-LQR controller.The result is given below  The output response and control input voltage of this system are shown in Fig. 8 and Fig. 9. Pendulum 1 (the long pendulum) and pendulum 2 (the short pendulum) oscillate at a low frequency.Both pendulums begin to stabilize and maintain their position around the operation points after about 3 seconds (the upright position).Besides, the arm of this system oscillates more strongly in the first seconds, and the arm of RDPIP takes 4.5 seconds to stabilize.Because the system's initial oscillations are quite strong, a high voltage is applied to it.As a result, it is possible to conclude that the RDPIP system uses the LQR controller, which stabilizes after 4.5 seconds.
Thirdly, the RDPIP system is simulated with the cascade PID-LQR controller.The result is given below.With cascade PID-LQR controller, RDPIP shows good results when being controlled by cascade PID-LQR controller.Long pendulum (pendulum1) and the short pendulum (pendulum2) have small oscillations.Oscillations of two pendulums are not too different because their lengths are similar.Both pendulums start to stabilize around the upright position (operation points) after about 3 seconds.And arm of RDPIP takes about 4.5 seconds to reach same balance.Besides, it can be noticed that angular velocity of two pendulums and an arm oscillates in the first few seconds, but not too much.According to the results presented, RDPIP with cascade PID-LQR controller stabilizes after 4.5 seconds.

Conclusions
In this research, a RDPIP is suggested, which is an unpopular model.Mathematical modeling of RDPIP is considered to build the dynamic equation for this system.After calculating the dynamic equations for RDPIP successfully, system is linearized around the operation point (the upright position).After that, linear controllers, such as LQR, PID-LQR and the cascade PID-LQR controllers, are proposed and deployed on this system to examine the impact of these controllers on RDPIP.Simulation results show that this model can be effectively controlled by these linear controllers.The development direction of the RDPIP system is to use genetic algorithms (GA) to optimize Q and R matrix selection for the LQR controller and the parameters (KP, KI, and KD) for the PID controller.