1 Mathematical model of the primary inverted pendulum system
For the inverted pendulum system, if air resistance and various frictions are ignored, the linear first-order inverted pendulum system can be abstracted into a trolley moving along a smooth guide rail and a uniform pendulum connected by a bearing, as shown in Figure 1. Among them, the mass of the trolley is M=1.32 kg, the mass of the pendulum is m=0.07 kg, the distance from the center of mass of the pendulum to the center of rotation is l=0.2 m, the angle between the pendulum and the vertical downward direction is θ, and the sliding friction coefficient of the trolley is fc=0.1.
There are two general methods to establish the mathematical model of the inverted pendulum control system: using the analytical method of Newtonian mechanics and the Lagrange equation modeling in analytical mechanics. This paper adopts the Lagrange equation modeling.
The Lagrange equation of the first-order inverted pendulum system should be:
Where: L is the Lagrangian operator; V is the kinetic energy of the system; G is the potential energy of the system.
Where: D is the system dissipated energy; fi is the external force of the system on the i-th generalized coordinate.
The total kinetic energy of the primary inverted pendulum system is:
The primary inverted pendulum system has four state variables, namely
, write the system state equation according to formula (7), and perform linearization at the equilibrium point to obtain the state space model of the system as follows:
2 Inverted Pendulum Performance Analysis
The controllability of the system is the premise of controller design, so the controllability analysis of the system is carried out before design. According to the controllability matrix T0=[B, AB, A2B, A3B], using the rank command in Matlab, it can be obtained that rank(T0)=4. It can be seen that the system is completely controllable, so the controller of the system can be designed to make the system stable.
3 Design of LQR controller
3.1 LQR controller principle
The control object of the linear quadratic regulator is a linear system, which must be in the form of a state space, namely:
, Y=Cx+Du. By determining the matrix K of the optimal control quantity U*=R-1BTPX=-KX, the performance index
The value of is extremely small. Among them, the weighted matrices Q and R are used to balance the weights of state variables and input variables; P is the solution of the Riccati equation. At this time, solve the Riccati algebraic equation:
The P value and the optimal feedback gain matrix K value can be obtained:
The schematic diagram of LQR for a single-stage pendulum is shown in Figure 2.
When selecting Q and R, the following aspects are mainly considered:
(1) Q is a positive definite or semi-positive definite matrix, and R is a positive definite matrix.
(2) The elements on the diagonal of the Q matrix correspond one-to-one to the state variables. The larger the value, the more significant the impact of the state variable on the system.
(3) The weighting matrix R should not be too small, otherwise it will lead to an increase in the control amount. If the control amount is too large, it will exceed the capacity of the system actuator. The R matrix should not be too large, otherwise the control effect will be too small and affect the control performance.
Considering the above, we take Q=diag([100, 100, 100, 100]), R=1, and use the LQR function provided by Matlab to get the controller gain matrix:
K=[-10.000 0 -24.140 8 250.036 0 158.553 3]
3.3 Using genetic algorithm to optimize Q matrix
Genetic algorithm is a random search algorithm based on the principle of natural selection and natural genetic mechanism in the biological world. It simulates the life evolution mechanism in the biological world and is used in artificial systems to achieve the optimization of specific goals.
The specific steps of using genetic algorithm to optimize the weighted matrix Q are as follows:
(1) Select an encoding strategy to convert parameters into chromosome structure space.
(2) Determine the decoding method.
(3) Determine the type and mathematical description form of the optimization objective function, and take the objective function J in LQR optimal control, J = trace(P).
(4) Design genetic operators.
(5) Determine the genetic strategy. Set the population size to 80, the maximum number of iterations to 200, the crossover probability to 0.9, the mutation probability to 0.01, and generate the initial population randomly.
(6) Calculate the fitness value of the individuals or chromosomes in the population after decoding. In this design, the fitness value is taken as the inverse of the objective function value, that is, f=1/J.
(7) Perform the genetic algorithm search process, that is, use the random sampling method to select individuals, generate new individuals through crossover and mutation, and then calculate the objective function value J' of the new individuals.
(8) Determine whether the group performance meets the indicator or whether the number of iterations has been completed. If not, repeat step (7).
The above algorithm can be used to determine the value of the element to be optimized in the weighted matrix Q that minimizes the objective function value, thereby determining the vector K of the feedback control law.
4 Simulation Results and Analysis
When Q=diag([100, 100, 100, 100]) and R=1, the obtained first-order inverted pendulum simulation waveform is shown in Figure 3. As can be seen from the figure, the car reaches equilibrium after 5.2 s, and the pendulum angle reaches equilibrium after 6.5 s. After optimizing the Q array, the system response overshoot is reduced, the response speed is accelerated, the adjustment time is reduced, and the static and dynamic characteristics of the system are improved, as shown in Figure 4.
5 Conclusion
This paper uses the Lagrange equation to establish a mathematical model of the linear first-order inverted pendulum control system, analyzes the performance of the system on this basis, and uses the LQR controller to control it. The results show that the LQR controller has a good control effect on the system.
Previous article:Application of ESP904 in ROV control system
Next article:Design of DMA controller adapting to various timings
- Popular Resources
- Popular amplifiers
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
- Using capacitive PGA, Naxin Micro launches high-precision multi-channel 24/16-bit Δ-Σ ADC
- Fully Differential Amplifier Provides High Voltage, Low Noise Signals for Precision Data Acquisition Signal Chain
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- ESP32-C3 porting has begun
- Using FPGA to achieve accurate timing when GPS is out of step.pdf
- 【TI recommended course】#Lecture on Basic Knowledge of Electronic Circuits - Power MOSFET#
- How to get 9V/12V from PD charger to power products for fast charging? Overview of Lederui PD power chip
- TMS320F28379d dual-core usage record
- Modifying the L3 RAM distribution on IWR1642/AWR1642
- Is OpenRF the future? Let's discuss it together.
- DLSM in DSP Core Architecture
- GaN Memory Sticker
- Functions and applications of MS90C386B and MS90C385B