MINISTRY OF EDUCATION AND TRAINING HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION FACULTY FOR HIGH QUALITY TRAINING GRADUATION PROJECT AUTOMATION & CONTROL TECHNOLOGY PID CONTROL FOR A CART AND POLE SYSTEM SIMULATION AND APPLICATION LECTURER: PhD. NGUYEN VAN DONG HAI STUDENT: DANG THAI BAO NGUYEN TIEN THANH SKL 0 0 9 3 0 3 HO CHI MINH CITY, 08/2022 HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION FACULTY FOR HIGH QUALITY TRAINING GRADUATION PROJECT PID CONTROL FOR A CART AND POLE SYSTEM SIMULATION AND APPLICATION STUDENTS: DANG THAI BAO 18151002 NGUYEN TIEN THANH 18151035 COURSE: 2018 – 2022 MAJOR: AUTOMATION & CONTROL TECHNOLOGY ADVISOROR: PhD. NGUYEN VAN DONG HAI HO CHI MINH CITY, 08/2022 HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION FACULTY FOR HIGH QUALITY TRAINING GRADUATION PROJECT PID CONTROL FOR A CART AND POLE SYSTEM SIMULATION AND APPLICATION STUDENTS: DANG THAI BAO 18151002 NGUYEN TIEN THANH 18151035 COURSE: 2018 – 2022 MAJOR: AUTOMATION & CONTROL TECHNOLOGY ADVISOR: PhD. NGUYEN VAN DONG HAI HO CHI MINH CITY, 08/2022 BỘ GIÁO DỤC VÀ ĐÀO TẠO CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM TRƯỜNG ĐH SƯ PHẠM KỸ THUẬT Độc lập – Tự do – Hạnh phúc THÀNH PHỐ HỒ CHÍ MINH KHOA ĐÀO TẠO CHẤT LƯỢNG CAO NGÀNH CNKT ĐIỀU KHIỂN VÀ TỰ ĐỘNG HÓA NHIỆM VỤ LUẬN VĂN TỐT NGHIỆP 1.
Thông tin sinh viên Họ và tên nhóm sinh viên : Đặng Thái Bảo – Nguyễn Tiến Thành MSSV: 18151002 - 18151035 Tel: 0869295827 Email: 18151002@student. Thông tin đề tài Tên đề tài: “PID Control for Cart and Pole system: Simulation and Application” Mục đích của đề tài: Nghiên cứu và ứng dụng giải thuật điều khiển. Đồ án tốt nghiệp được thực hiện tại: Bộ môn Tự động điều khiển, Khoa Đào tạo Chất lượng cao, Trường Đại Học Sư Phạm Kỹ Thuật Thành Phố Hồ Chí Minh. Thời gian thực hiện: Từ ngày / / 2022 đến / / 2022 3.
Các số liệu, tài liệu ban đầu Giáo viên hướng dẫn cung cấp một số bài nghiên cứu có sẵn để phục vụ cho việc làm đề tài. Các nhiệm vụ cụ thể của đề tài - Tìm hiểu hệ phương trình động lực học của hệ con lắc ngược trên xe (C&P). - Xây dựng giải thuật điều khiển PID cho hệ C&P trên mô phỏng và cả thực nghiệm (trên mô hình có sẵn). - Khảo sát tìm ra các thông số tối ưu hóa giải thuật PID bằng giải thuật di truyền (GA).
Sản phẩm - Mô hình thực nghiệm hệ C&P hoàn chỉnh. - Chương trình mô phỏng cho hệ C&P - Chương trình nhúng hệ C&P 6. Lời cam đoan của sinh viên Tôi là SV Đặng Thái Bảo cam đoan ĐATN là công trình nghiên cứu của nhóm tôi dưới sự hướng dẫn của TS. Nguyễn Văn Đông Hải.
Các kết quả công bố trong ĐATN là trung thực và không sao chép từ bất kỳ công trình nào khác.HCM, Ngày tháng năm 2022 SV thực hiện đồ án Đặng Thái Bảo - Nguyễn Tiến Thành Giáo viên hướng dẫn xác nhận về mức độ hoàn thành và cho phép được bảo vệ: Sinh viên thực hiện đề tài đúng thời hạn. Kết quả mô phỏng và thực nghiệm đều hoàn thành đầy đủ. Cho phép bảo vệ trước hội đồng.HCM, Ngày tháng năm 2022 TRƯỞNG NGÀNH GIẢNG VIÊN HƯỚNG DẪN (Ký ghi rõ họ tên và học hàm học vị) THE SOCIALIST REPUBLIC OF VIETNAM Independence – Freedom– Happiness -------- Ho Chi Minh City, August , 2022 ADVISOR’S EVALUATION SHEET Student name: .Đặng Thái Bảo.Nguyễn Tiến Thành.Automation and Control Engineering. Project title: PID control for a Cart and Pole system: Simulation and Application.
Nguyễn Văn Đông Hải. Content of the project:. Approval for oral defense? (Approved or denied) .) Ho Chi Minh City, August , 2022 ADVISOR (Sign with full name) THE SOCIALIST REPUBLIC OF VIETNAM Independence – Freedom– Happiness -------- Ho Chi Minh City, August , 2022 EVALUATION SHEET OF THE DEFENSE COMMITTEE MEMBER Student name: .Đặng Thái Bảo.Nguyễn Tiến Thành. Automation and Control Engineering.
Project title: …PID control for a Cart and Pole system: Simulation and Application. Name of Defense Committee Member:. Content and workload of the project .) Ho Chi Minh City, August , 2022 COMMITTEE MEMBER (Sign with full name) CỘNG HOÀ XÃ HỘI CHỦ NGHĨA VIỆT NAM Độc lập – Tự do – Hạnh Phúc XÁC NHẬN CHỈNH SỬA ĐỒ ÁN TỐT NGHIỆP Họ và tên nhóm sinh viên: Đặng Thái Bảo – Nguyễn Tiến Thành MSSV: 18151002 - 18151035 Lớp: 18151CLA2 Khóa: 2018 Ngày bảo vệ: /08/2022 Chuyên ngành CNKT Điều khiển và Tự Động Hóa - Khoa Đào tạo Chất lượng cao hệ CLA Căn cứ ý kiến nhận xét của Hội đồng chấm Khóa luận tốt nghiệp (HĐ số ) Sinh viên đã sửa chữa, hoàn chỉnh một số nội dung sau: STT Nội dung cũ Nội dung đã chỉnh sửa Trang Tp. Hồ Chí Minh, ngày tháng năm 2022 SINH VIÊN THỰC HIỆN GIẢNG VIÊN HƯỚNG DẪN ACKNOWLEDGEMENT While studying and completing the project, my team received a lot of dedicated guidance from my instructor and my friends.
With deep gratitude we would like to express our thanks: • The board of directors of the HCMUTE FHQ created all conditions for our team to complete my good map. • We would like to thank the teacher Dr. Nguyen Van Dong Hai who wholeheartedly helped, protected, encouraged and created all conditions for me to successfully complete the project. • Sincere thanks to the teachers in the examination committee for their comments so that we can improve the writing in the best way.
• Thank you to the previous students who helped us a lot in the process of finding documents to be able to complete the project. • Thank you to our parents and friends who are always there to encourage and help with our studies for today to complete the important map in student life. Although we tried to complete the set goals for this project, there will certainly be some shortcomings. Therefore, we longed for your sympathy.
We would love to receive suggestions from you to further improve upon this project.HCM, August , 2022 Students Đặng Thái Bảo – Nguyễn Tiền Thành CONTENTS NHIỆM VỤ LUẬN VĂN TỐT NGHIỆP. ii XÁC NHẬN CHỈNH SỬA ĐỒ ÁN TỐT NGHIỆP. viii LIST OF FIGURES. x LIST OF TABLES.
xii LIST OF ACRONYMS. xiv CHAPTER 1: OVERVIEW. 3 Chapter 2: Theoretical Basis and Mathematical Model and Controlling Algorithm. 3 Chapter 3: Controller Design.
3 Chapter 4: Constructing the Model. THEORETICAL BASIS MATHEMATICAL MODEL AND CONTROLLING ALGORITHM. CONSTRUCTING THE MATHEMATICAL MODEL .1 PID CONTROLLER BASICS .2 STRUCTURE OF A PID CONTROLLER .3 STRUCTURE OF A SIMPLE GA PROGRAM.4 IMPLEMENTATION IN MATLAB .5 INVERTED PENDULUM MODEL BLOCK .6 PID CONTROLLER BLOCKS .7 USING THE GA TO FIND OPTIMAL PID’S PARAMETERS. CONSTRUCTING THE MODEL .1 EXPERIMENTAL MODEL AND CHOOSING THE RIGHT EQUIPMENTS .4 CONTROLLING PROGRAM FOR THE MODEL:.1 EXPERIMENT RESULTS OF THE SET OF FIRST PID PARAMETERS .2 EXPERIMENT RESULTS OF THE SET OF SECOND PID PARAMETERS.
68 LIST OF FIGURES Figure 1.1: Quanser’s Cart and Pole system.1: Cart and Pole system .2: Structure of the motor .1: Continuous PID Controller Block Diagram.2: Discrete PID Controller Block Diagram .3: Effect of adjusting Kp on the system .4: Effect of adjusting Ki on the system .8: Effect of adjusting Kd on the system .9: A simple GA Program’s Structure .10: Simulation model of the C&P system .11: Inside of Inverted Pendulum block .12: Cart PID Controller Block .1: Cart & Pole system in experiment .2: STM32F4 Discovery Board .3: STM32F4 Discovery Board – Pin Diagram.4: Omron Encoder E6B2-CWZ6C .5: Omron encoder E6B2-CWZ6C pinout .6: JGB37-545 DC Geared Motor DC Servo Motor .7: Switching Mode Power Supply S-60-12.9: H-Bridge L298 Pin Diagram .10: Bridge Working Principle .13: Cart & Pole data transmission diagram .15: Matlab – Simulink Interfaces .17: Model’s controlling program .18: Inside PWM_Position_DC encoder conversion block .19: Inside PWM_Angle encoder conversion block .20: Inside Angle_Limiter block .21: Inside L298H Bridge block .1: Pole’s angle under PID Controller – Balanced (rad) .2: Cart’s position under PID Controller – Balanced (m) .3: Pole’s angle under PID Controller – Sine Wave (rad) .4: Cart’s position under PID Controller – Sine Wave (m) .5: Pole’s angle under PID Controller – Square Wave (rad) .6: Cart’s Position under PID Controller – Square Wave (rad) .7: Angle of pendulum & position of cart in table 5.8: Angle of pendulum & position of cart after decrease pendulum Kp 10% .9: Angle of pendulum & position of cart after increase pendulum Kp 10% .10: Angle of pendulum & position of cart after decrease cart Kp 10% .11: Angle of pendulum & position of cart after increase cart Kp 10%.12: Angle of pendulum & position of cart after decrease pendulum Kd 10% .13: Angle of pendulum & position of cart after increase pendulum Kd 10% .14: Angle of pendulum & position of cart after decrease cart Kd 10% .15: Angle of pendulum & position of cart after increase cart Kd 10%.16: Angle of pendulum & position of cart in table 5.17: Angle of pendulum & position of cart after decrease pendulum Kp 10% .18: Angle of pendulum & position of cart after increase pendulum Kp 10% .19: Angle of pendulum & position of cart after decrease cart Kp 10% .20: Angle of pendulum & position of cart after increase cart Kp 10%.21: Angle of pendulum & position of cart after decrease pendulum Kd 10% .22: Angle of pendulum & position of cart after increase pendulum Kd 10% .23: Angle of pendulum & position of cart after decrease cart Kd 10% .24: Angle of pendulum & position of cart after increase cart Kd 10%. 61 LIST OF TABLES Table 2.1: Parameters of the system .1: Pins of Omron encoder .2: Pins of DC Motor’s encoder.1: First PID parameters .2: First PID parameters, decreasing Kp1 by 10% .3: First PID parameters, increasing Kp1 by 10% .4: First PID parameters, decreasing Kp2 by 10% .5: First PID parameters, increasing Kp2 by 10% .6: First PID parameters, decreasing Kd1 by 10% .7: First PID parameters, increasing Kd1 by 10% .8: First PID parameters, decreasing Kd2 by 10% .9: First PID parameters, increasing Kd2 by 10% .10: Second PID parameters .11: Second PID parameters, decreasing Kp1 by 10% .12: Second PID parameters, increasing Kp1 by 10%.13: Second PID parameters, decreasing Kp2 by 10% .14: Second PID parameters, increasing Kp2 by 10%.15: Second PID parameters, decreasing Kd1 by 10% .16: Second PID parameters, increasing Kd1 by 10%.17: Second PID parameters, decreasing Kd2 by 10% .18: Second PID parameters, increasing Kd2 by 10%. 61 LIST OF ACRONYMS Acronyms Meaning GA Genetic Algorithm PID Proportional-Integral-Derivative C&P Cart and Pole (Inverted Pendulum on Cart) HCMUTE Ho Chi Minh city University of Technology and Education LQR Linear-quadratic regulator SMPS Switching Mode Power Supply SMC Sliding Mode control SISO Single Input - Single Output SIMO Single Input - Multiple Output PWM Pulse Width Modulation ABSTRACTS C&P system has a simple structure, but with its high non-linearity characteristics, it is extremely suitable to become the standard model used in many Automation Labs all around the world. In this project, we aim to implement a PID Control and a GA Algorithm to stabilize the system at the desired position.
Results are then verified on simulation and experiment. Keywords: Balancing control; PID control; Genetic Algorithm; Stabilize; C&P. OVERVIEW CHAPTER 1: OVERVIEW 1. INTRODUCTION Cart and Pole (C&P, also known as Inverted Pendulum) is a classic mathematic problem, is primarily used in many experiments about controlling theory because of its non-linearity and high instability.