Study On Control of Inverted Pendulum System Based On Simulink Simulation
Study On Control of Inverted Pendulum System Based On Simulink Simulation
Science (IJAERS)
Peer-Reviewed Journal
ISSN: 2349-6495(P) | 2456-1908(O)
Vol-10, Issue-12; Dec, 2023
Journal Home Page Available: https://ijaers.com/
Article DOI:https://dx.doi.org/10.22161/ijaers.1012.1
School of Mechanical and Electrical Engineering, Guangdong University of Petrochem Technology (GDUPT), Maoming 525000, China
*Corresponding author
Received: 06 Oct 2023, Abstract— This study aims to conduct control research on an inverted
Receive in revised form: 10 Nov 2023, pendulum system using the Simulink simulation platform. The inverted
pendulum system is a classic nonlinear dynamic system with important
Accepted: 22 Nov 2023,
theoretical and practical applications. Firstly, establish a mathematical
Available online: 05 Dec 2023 model of the inverted pendulum system, including the dynamic equation of
©2023 The Author(s). Published by AI the pendulum rod and the sensor measurement model. Subsequently, the
Publication. This is an open access article PID (proportional integral differential) controller design method based on
under the CC BY license the inverted pendulum system and the fuzzy PID controller design methods
(https://creativecommons.org/licenses/by/4.0/). were verified through simulation experiments. The ultimate goal is for the
Keywords— Inverted pendulum system, designed fuzzy PID controller to effectively stabilize the inverted pendulum
Proportional integral differential (PID) system in the vertical position and achieve fast tracking of the target
control, Fuzzy PID control, Nonlinear position. Simulation and experimental results show that compared to
dynamic system, Simulink simulation traditional PID controllers, fuzzy PID controllers can quickly stabilize the
pendulum in the target position and have good practicality, stability, speed,
and accuracy. Future research can further explore the application of other
advanced control strategies in inverted pendulum systems, as well as their
potential applications in practical engineering.
www.ijaers.com Page | 1
Li et al. International Journal of Advanced Engineering Research and Science, 10(12)-2023
system [4, 5, 6, 14, 15]. It controls both the angle of the established using the Simulink module of MTALAB [9, 10,
pendulum and the position of the trolley to be stable, and 11, 13]. Finally, by comparing and analyzing the curves
the steady-state errors of the trolley position and pendulum and parameters of the established traditional PID controller
angle must be controlled within a small range. and fuzzy PID controller, this study is trying to find out
The control of the inverted pendulum is a difficult whether the fuzzy PID control method is better or not than
point in the study of inverted pendulum control, and there the ordinary PID control method in terms of stability and
have been many studies on the inverted pendulum, which speed.
are basically based on the assumption that the trolley track
of the inverted pendulum system is sufficiently long [7]. II. ESTABLISHING MATHEMATICAL MODEL
With the development of technology, new control methods The working principle of a first-order linear inverted
are constantly emerging, and people use inverted pendulum (Figure 1) is that when the data acquisition card
pendulums to test whether new control methods can transmits the collected data from the rotary encoder to the
handle multivariable, nonlinear, and absolute instability. computer and compares it with the set value. The deviation
The inverted pendulum has become an ideal experimental is processed through some calculation, and a control law is
method for testing the effectiveness of control strategies issued to control the motor to make the pendulum swing
[8]. This article focuses on a first-order inverted pendulum left and right into the stable range, thereby achieving the
system. Firstly, a mathematical model is established using pendulum to stand upright and not fall, as well as
the knowledge of Newtonian mechanics, and then a self-swing [12].
simulation model of the inverted pendulum system is
Because establishing a mathematical model of the coefficient of the car rf =0.1N/m/sec, the inertia of the
system is the foundation for studying control methods, the swing rod I=0.0034kg*m2, and the gravitational
first step is to model the inverted pendulum system in this acceleration g=9.8N/ m2. The physical model diagram of
paper. And mathematical modeling is carried out using the the inverted pendulum system is shown in Figure 2. A
Newtonian mechanics method to obtain the state-space detailed decomposition of various forces acting on the
equation of the system and prepare for the subsequent pendulum and trolley using Newtonian mechanics
controller design and simulation. methods is shown in Figure 3. P and N are set as the
The model parameters of the inverted pendulum components of the interaction force in the vertical and
system are the pendulum mass m1=0.109kg, the trolley horizontal directions during the movement or stability of
mass m2=1.096kg g, the angle between the pendulum and the car.
the vertical direction θ (rad), the distance from the center
of the swing rod to the car l=0.25m, the distance the car
moves x (m), the force applied to the car f (N), the friction
www.ijaers.com Page | 2
Li et al. International Journal of Advanced Engineering Research and Science, 10(12)-2023
𝑚1 𝑙 2
𝑠
𝑤
𝑟 2) 𝑟 𝑚 g𝑙
𝑠4 +
𝑓(𝐼+𝑚 1 𝑙 (𝑚
𝑠3− 1
+𝑚 2 )𝑚1 g𝑙𝑠 2 − 𝑓 1 𝑠
𝑤 𝑤 𝑤
According to Figure 3, first analyze the force in the (10)
horizontal direction. wherein,w = [(𝑚1 + 𝑚2 )(𝐼 + 𝑚1 𝑙 2 ) − (𝑚1 𝑙)2 ]。
𝑚2 𝑥̈ = 𝐹 − 𝑟𝑓 𝑥̇ − 𝑁 (1) Using equation (7) for 𝑥̈ and𝜑̈ solve, which will be
𝑑2 𝑥̇ = 𝑥̈
N = 𝑚1 (𝑥 + 𝑙 sin 𝜃) = 𝑚1 𝑥̈ + 𝑚1 𝑙𝜃̈ cos 𝜃 −
𝑑𝑡 2
−(𝐼+𝑚1 𝑙2 )𝑟𝑓 𝑚1 2 g𝑙2 (𝐼+𝑚1 𝑙2 )
𝑚1 𝑙𝜃 2̇ sin 𝜃 (2) 𝑥̈ =
(𝑚1 +𝑚2 )𝐼+𝑚1 𝑚2 𝑙2
𝑥̇ +
(𝑚1 +𝑚2 )𝐼+𝑚1 𝑚2 𝑙2
𝜑+
(𝑚1 +𝑚2 )𝐼+𝑚1 𝑚2 𝑙2
𝑢
Substituting equation (2) into equation (1) yields the
𝜑̇ = 𝜑̈
equation of motion in the horizontal direction
𝑚1 𝑙𝑟𝑓
(𝑚1 + 𝑚2 )𝑥̈ + 𝑟𝑓 𝑥̇ + 𝑚1 𝑙𝜃̈ cos 𝜃 − 𝑚1 𝑙𝜃 2̇ sin 𝜃 = 𝜑̈ = 𝑥̇ +
𝑚1 g𝑙(𝑚1 +𝑚2 )
𝜑+
𝑚1 𝑙
𝑢
{ (𝑚1 +𝑚2 )𝐼+𝑚1 𝑚2 𝑙2 (𝑚1 +𝑚2 )𝐼+𝑚1 𝑚2 𝑙2 (𝑚1 +𝑚2 )𝐼+𝑚1 𝑚2 𝑙2
𝐹 (3)
In the vertical direction, as the car is used as the horizontal (11)
plane, only the force acting on the swing rod needs to be Compiled into a standard state space equation as
analyzed to obtain
0 1 0 0
𝑑2
𝑥̇ −(𝐼+𝑚1 𝑙2 )𝑟𝑓 𝑚1 2 g𝑙2 𝑥
P − 𝑚1 g = 𝑚1 2
(𝑙 cos 𝜃) = −𝑚1 𝑙𝜃̈ sin 𝜃 − 𝑥̈ 0 (𝑚1 +𝑚2 )𝐼+𝑚1 𝑚2 𝑙2 (𝑚1 +𝑚2 )𝐼+𝑚1 𝑚2 𝑙2
0 𝑥̇
𝑑𝑡
[ ]= [𝜑]+
𝜑̇ 0 0 0 1
𝑚1 𝑙𝜃̈ sin 𝜃 − 𝑚1 𝑙𝜃̇ 2 cos 𝜃 (4)
0] 𝜑̇
𝜑̈ 0 𝑚1 𝑙𝑟𝑓 𝑚1 g𝑙(𝑚1 +𝑚2 )
The torque balance equation is [ (𝑚1 +𝑚2 )𝐼+𝑚1 𝑚2 𝑙2 (𝑚1 +𝑚2 )𝐼+𝑚1 𝑚2 𝑙2
0
−P𝑙 sin 𝜃 − 𝑁𝑙 cos 𝜃 = I𝜃̈ (5) (𝐼+𝑚1 𝑙2 )
The second equation of motion can be obtained by using (𝑚1 +𝑚2 )𝐼+𝑚1 𝑚2 𝑙2
𝑢 (12)
0
equations (2) and (4) 𝑚1 𝑙
(I + 𝑚1 𝑙 2 )𝜑̈ − 𝑚1 g𝑙𝜑̇ = 𝑚1 𝑙𝑥̈ (6) [(𝑚1 +𝑚2 )𝐼+𝑚1𝑚2 𝑙2 ]
www.ijaers.com Page | 3
Li et al. International Journal of Advanced Engineering Research and Science, 10(12)-2023
www.ijaers.com Page | 4
Li et al. International Journal of Advanced Engineering Research and Science, 10(12)-2023
The fuzzy rule statement used by the output variable fuzzy controller is as follows:
“if E isαand EC isβthen U isγ” Wherein,α,β,γboth represent the fuzzy sets corresponding to each variable.
Based on the impact of PID parameters on system performance, parameter tuning principles, expert experience, and
cognition, 49 control rules were obtained after processing, as shown in Tables 1–3.
Table 1 Fuzzy Rule Table ofΔKp
𝐾𝑃 E
NB NM NS O PS PM PB
EC
NB PB PB PB PB PM PS O
NM PB PB PB PB PM O O
NS PM PM PM PM O PS PS
O PM PM PS O NS NS NM
PS PS PS O NS NM NM NM
PM PS O NS NM NM NM NB
PB O O NM NM NM NB NB
𝐾𝐼 E
NB NM NS O PS PM PB
EC
NB NB NB NM NM NS O O
NM NB NB NM NS NS O O
NS NB NM NS NS O PS PS
O NM NM NS O PS PM PM
PS NM NS O PS PS PM PB
PM O O PS NM PM PB PB
PB O O PS PM PM PB PB
www.ijaers.com Page | 5
Li et al. International Journal of Advanced Engineering Research and Science, 10(12)-2023
NB PS NS NB NB NB NM PS
NM PS NS NB NM NM NS O
NS O NS NM NM NM NS O
O O NS NS NS NS NS O
PS O O O O O O O
PM PB PS PS PS PS PS PB
PB PB PM PM PM PS PS PB
This design system uses the Mamdani inference parameters of the PID controller.
method to perform fuzzy inference on the established 𝐾𝑃 = 𝐾𝑃0 + △ 𝐾𝑃 (19)
fuzzy rules in order to obtain control variables. Meanwhile, 𝐾𝐼 = 𝐾𝐼0 + △ 𝐾𝐼 (20)
using the center of gravity method to solve the fuzziness of 𝐾𝐷 = 𝐾𝐷0 + △ 𝐾𝐷 (21)
language expression, thus obtaining the exact value
ofΔKp,ΔKI,ΔKD. In addition, the values obtained through Before establishing a fuzzy logic controller, the Tool
fuzzy reasoning and deblurring are multiplied by the Box parameters of the fuzzy logic system need to be set in
corresponding scaling factors to obtain the incremental Simulink (Figure 5). Then use the membership function
adjustment values of PID parameters, which are then parameter setting process of Tool Box (Figure 6) to
substituted into equations (19) - (21) to obtain the control establish the membership function of e, ec,ΔKp,ΔKI,ΔKD.
www.ijaers.com Page | 6
Li et al. International Journal of Advanced Engineering Research and Science, 10(12)-2023
After setting the above parameters, they can be traditional PID controllers have good control effects on the
added to the rule editor, and all output surfaces of the control object that can assume an accurate mathematical
fuzzy inference system can be observed in the output model. They can meet the requirements of system control
surface observer. accuracy and rise time, but there are problems such as long
adjustment times. The fuzzy PID controller can adjust the
IV. COMPARISON BETWEEN TRADITIONAL PID parameters of the system in real time. By doing so, the
PID CONTROL AND FUZZY PID CONTROL PID parameters can be more suitable for the control
Through Simulink simulation (Figure 7 and Figure requirements of the system, resulting in better control
8), it was found that, under appropriate parameters, effects than traditional PID controllers (Figure 9).
Fig.7 Simulink Simulations of Traditional PID and Fuzzy PID Control Systems (Swing Angle)
www.ijaers.com Page | 7
Li et al. International Journal of Advanced Engineering Research and Science, 10(12)-2023
Fig.9 Response Curves of Traditional PID and Fuzzy PID Controller Systems (Swing Angle)
V. CONCLUSIONS [2] Wang, S., Zhang, F., and Chen, Z. Design of LQR controller
The inherent first-order linear inverted pendulum for linear inverted pendulum. Mechanical Manufacturing
system is a typical single-input, multiple-output nonlinear and Automation, 2006, (06): 95-98
system. This article analyzes the motion of the inherent [3] Zhou, M., Miao, X., and Chen, M. Analysis and calibration
first-order linear inverted pendulum system, establishes a of the control system for a linear inverted pendulum trolley.
mathematical model of the first-order linear inverted Electronic Testing, 2018, (09): 43-45
pendulum system using the Newtonian mechanics method, [4] Wang, L., and Kong, Q., Fuzzy PID control of linear
and designs PID controllers and fuzzy PID controllers to inverted pendulum. Southern Agricultural Machinery, 2018,
control the first-order linear inverted pendulum system 49 (18): 83-84
separately. [5] Wang, H., and Kong, Q. Research on PID Control of Linear
By adjusting their proportional constant and integral Inverted Pendulum Based on MATLAB. Mechanical
constant, the three parameters of the differential constant Engineering and Automation, 2015, (05): 179-180+182
enable the first-order linear inverted pendulum system to [6] Chen, C., Zhao, Y., and Gao, J. Comparative analysis of PID
quickly and accurately reach a stable state, ultimately and LQR control algorithms based on a single inverted
achieving a stable system. The superiority of fuzzy PID pendulum. Value Engineering, 2015, 34 (18): 209-2010
controllers over PID control was verified through Simulink [7] Xu, M., Zhou, B., and Hu, G. Simulation and experimental
simulation. Under the action of a fuzzy PID controller, the research on the control of a linear inverted pendulum system.
system has fast response speed, short adjustment time, and Machine Tool and Hydraulic, 2018, 46 (06): 90-95.
high steady-state accuracy, achieving the expected goals. [8] Song, S. Research on Optimization of Control Parameters of
Inverted Pendulum Based on MATLAB. Electronic World,
REFERENCES 2014, (08): 104.
[1] Hong, J. Research on a Level 1 Linear Inverted Pendulum [9] Luan, H., Sun, D., Sun, H., Sui, Y., and Liu, C. Design of an
Control System Based on Improved Active Disturbance Assistant Teaching Example for Inverted Pendulum Control
Rejection Control. Anhui University of Engineering, 2019 Based on Matlab. Journal of Electrical and Electronics
www.ijaers.com Page | 8
Li et al. International Journal of Advanced Engineering Research and Science, 10(12)-2023
www.ijaers.com Page | 9