Design and Application of Modern Control Theory Simulation Experiment Platform Based on MATLAB

Abstract

Taking the linear inverted pendulum as the controlled object, the inverted pendulum simulation experimental platform is designed and implemented by Matlab/GUI. The platform includes six simulation experiments. Through the application of this platform in the experimental teaching and theoretical teaching of “modern control theory”, the practice shows that the platform can meet the requirements of verification, openness, design and other different levels of experiments, and through this platform, students can understand from the theoretical concept of control system to the specific control realization, which changes the previous dogma mode and realizes the combination of theory and practice.

Share and Cite:

Yang, G.H. and Li, H.H. (2020) Design and Application of Modern Control Theory Simulation Experiment Platform Based on MATLAB. Open Access Library Journal, 7, 1-12. doi: 10.4236/oalib.1107030.

1. Introduction

“Modern Control Theory” is a specialized basic course for university automation majors and plays an important role in the undergraduate teaching of automation majors. It is also a basic course for postgraduate students such as “Linear system Theory” and “Optimal control theory” [1] . However, because the teaching content of modern control theory contains a large number of complex mathematical operations, the course content is more theoretical, more abstract concepts, students are not easy to understand, learning, feeling very difficult. According to the course characteristics of modern control theory, the design of modern control theory simulation experiment platform under Matlab environment can help students learn control theory. At present, many schools have studied and opened the course of “inverted pendulum control system”. The application of inverted pendulum control system in teaching has long attracted people’s attention, and it is recognized as a typical experimental equipment in modern control theory and a rare typical physical model in control theory teaching and scientific research [2] . Guilin University of Technology also introduced the linear two-stage inverted pendulum system of Shenzhen Gugao Company. Literature [3] introduces a self-developed first-level inverted pendulum teaching experiment system for small car models, which enables students to understand more about the control process of the electromechanical system of inverted pendulum from theory to practice. Based on Matlab/GUI design realization of inverted pendulum simulation experiment platform, integrate multiple simulation experiment platform does not need to move the actual inverted pendulum hardware, completely with the aid of computer and software operation, can be validated by the simulation experiment platform of abstract control theory and demonstration and solve our no teaching equipment in practical teaching and practical problems of the difficult to achieve.

2. The Development Environment

Hardware requirements: PC processors I3, I5, AMD Athlon or higher; At least 1GB of memory, recommended above 2 GB.

Software requirements: Microsoft Windows XP or Microsoft Windows 7; Matlab7.0 or Matlab R2013a.

Matlab is a software product developed by Math Works of the United States. It provides a good teaching tool for experimental teaching of modern control theory courses. The reason why the simulation experiment platform is designed and developed in Matlab environment is that the software has the following important characteristics [4] .

1) The software centralizes all the GUI supported User controls in GUIDE (Graphical User Interface Development Environment) and provides the User with a series of Graphical User Interface tools.

2) This software integrates rich and powerful toolbox functions, which are used to expand its symbolic calculation function, graphical modeling and simulation function, word processing function and real-time interaction with hardware function. It is very convenient for users to directly conduct high-level research without writing basic programs within the scope of their own disciplines.

3) The software has superior data processing ability, which can realize the inverted pendulum simulation platform to process the data and draw the curve, which is easier for students to understand the application of control theory.

4) Simulink is an integrated software package based on Matlab environment for dynamic system modeling, simulation and comprehensive analysis. On the GUI provided by Simulink, complex simulation models can be constructed by simply dragging and dropping the mouse. Moreover, by combining the external mode of Simulink with RTWT (real-time Windows Target), users can use Simulink model as GUI for signal visualization and module parameter adjustment [5] .

3. Design of Modern Control Theory Simulation Platform

3.1. Linear One-Stage Inverted Pendulum Mathematical Model

The main body of the linear inverted pendulum system includes pendulum rod, cart, portable bracket, guide rail, DC servo motor and so on. After ignoring the air resistance and various frictions, the linear one-stage inverted pendulum system can be abstracted into a system composed of trolley and homogenizing rod, as shown in Figure 1. In the analysis and design of the control system, the mathematical model of the controlled system should be established first, and the mathematical model of the linear one-stage inverted pendulum system should be established by using Newton-Euler method [6] . According to reference [6] , the parameters in Figure 1 are described in Table 1.

Figure 1. Schematic diagram of linear one-stage inverted pendulum model.

Table 1. Parameters of inverted pendulum system.

Assumed system state X = [ x x ˙ ϕ ϕ ˙ ] T , the force on the trolley and pendulum rod was analyzed respectively, and the system state equation with the external force (u representing the input force F of the controlled object) as the input was obtained:

[ x ˙ x ¨ ϕ ˙ ϕ ¨ ] = [ 0 1 0 0 0 ( I + m l 2 ) b I ( M + m ) + M m l 2 m 2 g l 2 I ( M + m ) + M m l 2 0 0 0 0 1 0 m l b I ( M + m ) + M m l 2 m g l ( M + m ) I ( M + m ) + M m l 2 0 ] [ x x ˙ ϕ ϕ ˙ ] + [ 0 I + m l 2 I ( M + m ) + M m l 2 0 m l I ( M + m ) + M m l 2 ] u (1)

y = [ x ϕ ] = [ 1 0 0 0 0 0 1 0 ] [ x x ˙ ϕ ϕ ˙ ] + [ 0 0 ] u (2)

If you take the acceleration of the car as the input u = x ¨ , the motion equation was established for the force analysis of the pendulum rod:

( I + m l 2 ) ϕ ¨ m g l ϕ = m l x ¨ (3)

I = 1 3 m l 2 (4)

Simplifying it:

ϕ ¨ = 3 g 4 l ϕ + 3 4 l x ¨ (5)

Then the system state equation with the acceleration of the trolley as the input is:

[ x ˙ x ¨ ϕ ˙ ϕ ¨ ] = [ 0 1 0 0 0 0 0 0 0 0 0 1 0 0 3 g 4 l 0 ] [ x x ˙ ϕ ϕ ˙ ] + [ 0 1 0 3 4 l ] u * (6)

y = [ x ϕ ] = [ 1 0 0 0 0 0 1 0 ] [ x x ˙ ϕ ϕ ˙ ] + [ 0 0 ] u * (7)

3.2. Design of Inverted Pendulum Experiment Platform

The software design part of the simulation experiment platform is mainly the offline simulation GUI design. In order to build an integrated operation interface for system modeling, parameter setting and simulation control, the GUI of the inverted pendulum experiment system was compiled under the GUIDE environment of Matlab. GUI design adopts object-oriented, event-driven programming technology, that is, through the master interface to call different experimental pages. For each experiment, the actions the GUI can implement include:

1) Each experiment is carried out in different steps. Set the step button to enter different experimental interfaces.

2) In the simulation experiment, the output response and state response are displayed in real time when the control parameters change. During the experiment, students can change the parameters of the controller by dragging the mouse or manually entering the controller. After the parameter modification, it takes effect immediately and is displayed on the GUI in the form of response curve.

3) The GUI can modify system parameters based on the recommended values for the inverted pendulum system parameters. Because with the use of the system, the equipment will have different degrees of wear, for parameters such as the coefficient of friction will be changed. Thus provide the interface in the GUI, students can easily adjust system parameters.

4) The platform sets aside interfaces. Students can input algorithm code according to Matlab grammar rules by editing window, or they can encapsulate their own S-function module and create their own algorithm module by applying s-function Builder to carry out open and design experiments.

3.3. Simulation Experiment of Modern Control Theory

3.3.1. Main Interface of the Simulation Experiment Platform

Type GUIDE in the command window of Matlab, select New in the pop-up dialog box, open the GUIDE interface or open the existing FIG screen. GUI design USES object-oriented, event-driven programming technology, users can control the program flow. In the design, a hierarchical structure is adopted, that is, different experimental pages are called through the main control interface. The main control interface of the simulation experiment platform is shown in Figure 2. Click an experimental item with the mouse and press the “run” button, or double-click the experimental item to switch to the corresponding experimental interface.

3.3.2. Specific Experimental Design

Take the “State space Pole assignment Control Experiment” as an example to illustrate, enter the experiment interface as shown in Figure 3, and click the operation steps of the experiment.

The main steps are as follows:

STEP1: Establish a system

Taking the inverted pendulum system as the controlled object, the mathematical model of the controlled object is established, such as formula (6) and (7), and the parameters are substituted into Table 1.

Figure 2. Main interface of modern control theory simulation experiment platform.

Figure 3. “State space Pole assignment Control” experimental project interface.

State space model of inverted pendulum:

[ x ˙ x ¨ ϕ ˙ ϕ ¨ ] = [ 0 1 0 0 0 0 0 0 0 0 0 1 0 0 48.3 0 ] [ x x ˙ ϕ ϕ ˙ ] + [ 0 1 0 4.9 ] u * (8)

y = [ x ϕ ] = [ 1 0 0 0 0 0 1 0 ] [ x x ˙ ϕ ϕ ˙ ] + [ 0 0 ] u * (9)

Program code is as follows:

Clear;

A=[0 1 0 0;0 0 0 0;0 0 0 1;0 0 48.3 0];

B=[0;1;0;4.9];

C=[1 0 0 0;0 0 1 0];

D=[0;0];

sys=ss(A,B,C,D)

STEP2: Test system controllability

The system control matrix was established by applying “M=ctrb(A,B)”, and the system controllability was analyzed by rank(M). The rank N1 of the state controllability matrix of the system was equal to the state dimension of the system (4), and the rank N2 of the output controllability matrix of the system was equal to the dimension of the output vector of the system (2), indicating that the system was controllable.

Program code is as follows:

Clear;

A=[0 1 0 0;0 0 0 0;0 0 0 1;0 0 48.3 0];

B=[0;1;0;4.9];

C=[1 0 0 0;0 0 1 0];

D=[0;0];

M1=[B A*B A^2*B A^3*B];

M2=[C*B C*A*B C*A^2*B C*A^3*B D];

N1=rank(M1)

N2=rank(M2)

STEP3: Calculate the eigenvalue

According to the requirements and with a certain margin (set the adjustment time as 2 seconds), the expected closed loop poles are calculated, and then the expected characteristic equation of the system and the original system characteristic equation are obtained.

The performance index of the system is made as follows by designing the controller:

1) Adjustment time: t s = 0.5 s ;

2) Maximum overshoot: M p 20 % .

The expected closed-loop poles are calculated as follows:

1) Determine the position of the expected pole s of the closed loop, based on the maximum overshoot:

M p = e ( ξ / 1 ξ 2 ) 20

Get ξ = 0.5 .

ξ = cos θ , get θ = 60 .

2) And by the t s = 4 ξ ω n , that is 4 0.5 ω n = 2 .

Get ω n = 4 .

So the expected closed loop pole: s 3 , 4 = ω n ( cos θ ± j sin θ ) = 2 ± j 2 3

s 3 , 4 is the dominant pole, the other two poles are more than 5 times away from the imaginary axis.

Get s 1 = 10 , s 2 = 10 .

So, select the desired closed-loop poles:

s 1 = 10 , s 2 = 10 , s 3 = 2 + j 2 3 , s 4 = 2 j 2 3 .

Therefore, the expected characteristic equation is as follows:

s s 1 ( s s 2 ) ( s s 3 ) ( s s 4 ) = ( s + 10 ) ( s + 10 ) ( s + 2 + j 2 3 ) ( s + 2 j 2 3 ) = s 4 + 24 s 3 + 196 s 2 + 720 s + 1600

Result is: a 1 = 24 , a 2 = 196 , a 3 = 720 , a 4 = 1600 .

The characteristic equation of the original system is as follows:

| s I A | = | s 1 0 0 0 s 0 0 0 0 s 1 0 0 48.3 s | = s 4 48.3 s 2

a 1 = 0 , a 2 = 48.3 , a 3 = 0 , a 4 = 0 .

STEP4: Calculate the gain matrix of state feedback

K = [ a 4 a 4 a 3 a 3 a 2 a 2 a 1 a 1 ] T 1 = [ 1600 720 196 24 ] [ 0.0207 0 0.0042 0 0 0.0207 0 0.0042 0.00000 0.00000 0.2041 0 0 0 0 0.2041 ] = [ 33.1263 14.9068 56.6176 7.9402 ]

controlled variable:

u = K X = 33.1263 x 14.9068 x ˙ + 56.6176 ϕ + 7.9402 ϕ ˙

STEP5: simulation running

K = acker ( A , B , P ) is applied to calculate the state feedback matrix. Under the initial state x 0 = [ 0 0 0 0 ] T , run the prepared M file, and obtain the state response of the inverted pendulum state feedback closed-loop system. The simulation running results are shown in Figure 4. In the figure, “CartPos” is the position of the trolley, “CartSpd” is the speed of the trolley, “PendAng” is the Angle of the pendulum rod, and “PendSpd” is the angular speed of the pendulum rod. The Angle of the pendulum rod, the angular velocity of the pendulum rod and the speed of the trolley are all stable at 0, and the position of the trolley is stable at 0.01 m to the left of the origin, indicating that the designed controller can enable the inverted pendulum closed-loop control system to achieve the control goal of “the pendulum rod is vertically upward and the trolley is at the origin”.

Figure 4. Experimental results interface.

STEP6: Program code display

The program code interface to show this experiment is shown in Figure 5.

4. Teaching Practice of Modern Control Theory

The revised syllabus of modern Control Theory of Guilin University of Technology contains 38 theoretical periods and 10 experimental periods. The modern control theory simulation experiment platform developed based on MATLAB can not only solve the difficulty of insufficient hardware experimental equipment, but also facilitate the understanding of abstract and abstruse control theory and concepts for students to conduct independent and exploratory learning after class [7] .

4.1. Optimize the Experimental Teaching by Combining the Simulation Experiment Platform

In the experimental teaching, a linear one-stage inverted pendulum is taken as the controlled object, which is combined with the simulation experimental platform. Teachers rely on this simulation experimental platform for on-site demonstration and programming guidance. Students start from the mathematical modeling of the controlled object and master the whole process of how to design the control system according to the control task. For example, in the “Inverted pendulum pole assignment experiment”, the control problem with the control objective of “the pendulum rod is vertically upward and the car is at the origin” was studied. The students used the ctrb( ) function and rank( ) function of Matlab to obtain the controllability matrix of the system and judge the controllability of the system. The place( ) function was used to obtain the feedback matrix of the system pole assignment state. lsim( ) function is applied to compile the system

Figure 5. Experimental project code display interface.

state feedback M file, test the state response of the closed-loop system, observe the system state curve by running the program, compare the system output before and after the state feedback, and test the control performance of the designed state feedback controller. And the state feedback matrix is obtained by continuously allocating the hope poles, and the state response of the closed-loop system is tested until the output curve of the system reaches the optimal state. Through such a simulation test process, students can understand and master the theoretical relationship between the control performance index and pole position, as well as the implementation of pole assignment algorithm. By using the simulation experiment platform to realize the intuitive display of the state output of the control system, it is helpful for students to understand the principle, process and method of the state feedback controller design based on pole assignment, and facilitate students to verify relevant theories and methods in the experiment, so as to deepen their understanding of concepts, theories and methods. Combining the basic principles and basic knowledge learned in classroom teaching with the control of practical system not only deepens the understanding of book knowledge, but more importantly, cultivates students’ practical working ability.

4.2. Taking the Inverted Pendulum as the Research Object, Biochemical Theory Teaching

Because this course involves a lot of mathematical operations and abstract theoretical knowledge, students in our school have poor theoretical foundation, which leads to students’ difficulty in learning and lack of interest in traditional teaching. In order to solve the practical problems in teaching for many years, the teaching application of modern control theory is based on the experimental simulation platform of inverted pendulum. In classroom teaching, the inverted pendulum is taken as the application background. Through the understanding of the structure and principle of the inverted pendulum system, students can have a detailed understanding of the realization of a control system. From the concept of control system in theory to the concrete realization of control system, it changes the previous dogmatic mode and realizes the combination of theory and practice. It can intuitively show many abstract control concepts, such as system stability, controllability, system convergence speed and anti-interference ability, etc. [8] [9] [10] .

5. Conclusion

“Modern Control Theory” simulation experiment comprehensive platform takes the inverted pendulum control system as the research object, relies on Matlab powerful numerical calculation and digital simulation function, can complete the establishment of the control system model, analysis, comprehensive design, simulation research of the whole process. It meets the requirements of verification, openness, design and other different levels of experiments. Moreover, this platform can help students understand the relevant concepts, theories and methods in modern control theory, and learn scientific research methods in the specific research process to improve the ability to solve practical problems. From the concept of control system in theory to the concrete realization of control system, it changes the previous dogmatic mode and realizes the combination of theory and practice.

Acknowledgements

1) Guangxi higher education undergraduate teaching reform project (NO. 2020JGB201).

2) Undergraduate teaching construction project of Guilin University of Technology: Inverted pendulum, virtual simulation experiment teaching project.

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.

References

[1] Wang, C.Q. and Ding, Y. (2004) Practice and Discussion of Modern Control Theory Course Teaching Reform. Journal of Nanjing University of Aeronautics and Astronautics, 6, 72-75.
[2] Zhang, Y.N. (2006) Experimental Design and Implementation of Control System in MATLAB. Chongqing University, Chongqing, 4.
[3] Li, D., Chen, Q., Sun, Z.-G. and Liu, P.-F. (2006) Design of Cart-Pendulum Teaching System and Its Application. Experimental Technology and Management, 23, 100-102+106.
[4] Brief Introduction to Matlab. http://www.fosu.edu.cn/li/math/SXRJ/Matlab/MatlabJIANJIE.htm
[5] (2002) Real-Time Windows Target User’s GUIDE. The Math Works Inc.
[6] (2019) Portable Test Instruction for Inverted Pendulum. Shenzhen Qianhai Gezhi Technology Co. LTD., Shenzhen.
[7] He, D.-F., Yu, L. and Xu, J.-M. (2016) Experimental Teaching Practice of Modern Control Theory Based on MATLAB. Experimental Technology and Management, 33, 123-126.
[8] Wang, Z.-M., Yao, H.-H. and Wang, J.-M. (2004) Research and Practice on Classroom Teaching and Individualized Training Model of Inverted Pendulum Control System. Higher Education Research, 20, 68-69.
[9] Zhu, J. (2009) Intelligent Control of the Swing and Stability of the Linear Inverted Pendulum. Shandong University, Jinan.
[10] Li, J.S., Yan, G.Z., Feng, J.Z., et al. (2010) Establishment of Inverted Pendulum Experimental System Based on Linear Quadratic Optimal Control Strategy. Laboratory Research and Exploration, 29, 38-40, 60.

Copyright © 2024 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.