PID a11 CENG4480_A4 DC motor Control Using PID (proportional-integral-derivative) control.

Slides:



Advertisements
Similar presentations
Unit 4 The Performance of Second Order System Open Loop & Close Loop Open Loop: Close Loop:
Advertisements

PID Control for Embedded Systems
ERT 210 Process Control & dynamics
PID Controllers and PID tuning
Discrete Controller Design
Chapter 4: Basic Properties of Feedback
PID Control -1 + Professor Walter W. Olson
LECTURE#10 PID CONTROLLER
CHE 185 – PROCESS CONTROL AND DYNAMICS
Feedback Controllers Chapter 8
Chapter 10 – The Design of Feedback Control Systems
Chapter 10 – The Design of Feedback Control Systems PID Compensation Networks.
Design of a Control Workstation for Controller Algorithm Testing Aaron Mahaffey Dave Tastsides Dr. Dempsey.
Control Theory (2) Jeremy Wyatt School of Computer Science University of Birmingham.
Process Control Instrumentation II
PID Control & ACS550 and ACH550
LECTURE#11 PID CONTROL AUTOMATION & ROBOTICS
PID Control and Root Locus Method
Proportional/Integral/Derivative Control
Lecture 5: PID Control.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Ch. 6 Single Variable Control
Robot Sensors Kevin Watson and Rich Petras. Overview ➲ Sensors ● Micro Switch ● Gyro ● Encoders ➲ Command Sequencing ➲ PID Control.
CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Feedback Control.
Introduction to ROBOTICS
Low Level Control. Control System Components The main components of a control system are The plant, or the process that is being controlled The controller,
Feedback Controllers Chapter 7.
Feedback Control system
1 Chapter 11 Compensator Design When the full state is not available for feedback, we utilize an observer. The observer design process is described and.
Design Realization lecture 22
University of Virginia PID Controllers Jack Stankovic University of Virginia Spring 2015.
PID. The proportional term produces an output value that is proportional to the current error value. Kp, called the proportional gain constant.
Modern Control System EKT 308
PID CONTROLLERS By Harshal Inamdar.
IVR 30/10/2009 Herrmann1 IVR: Control Theory Overview: PID control Steady-state error and the integral method Overshoot and ringing in system with time.
CSCI1600: Embedded and Real Time Software Lecture 12: Modeling V: Control Systems and Feedback Steven Reiss, Fall 2015.
Chapter 8 Feedback Controllers 1. On-off Controllers Simple Cheap Used In residential heating and domestic refrigerators Limited use in process control.
Control systems KON-C2004 Mechatronics Basics Tapio Lantela, Nov 5th, 2015.
Lecture 25: Implementation Complicating factors Control design without a model Implementation of control algorithms ME 431, Lecture 25.
Miss Hairul Nazirah bt Abdul Halim
Lecture 17: Introduction to Control (part III)
Features of PID Controllers
Control 3 Keypoints: PID control
Chapter - Continuous Control
Chapter 4 A First Analysis of Feedback Feedback Control A Feedback Control seeks to bring the measured quantity to its desired value or set-point (also.
Lecture 9: PID Controller.
SKEE 3143 Control Systems Design Chapter 2 – PID Controllers Design
BIRLA VISHWAKARMA MAHAVIDHYALAYA ELECTRONICS & TELECOMUNICATION DEPARTMENT o – ANKUR BUSA o – KHUSHBOO DESAI UNDER THE GUIDENCE.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Exercise 1 Suppose we have a simple mass, spring, and damper problem. Find The modeling equation of this system (F input, x output). The transfer function.
Process Control. Feedback control y sp = set point (target value) y = measured value The process information (y) is fed back to the controller The objective.
EEN-E1040 Measurement and Control of Energy Systems Control I: Control, processes, PID controllers and PID tuning Nov 3rd 2016 If not marked otherwise,
PID Control for Embedded Systems
Salman Bin Abdulaziz University
Chapter 7 The Root Locus Method The root-locus method is a powerful tool for designing and analyzing feedback control systems The Root Locus Concept The.
PID Controllers Jordan smallwood.
Introduction to PID control
Lec 14. PID Controller Design
Control Loops Nick Schatz FRC 3184.
CSCI1600: Embedded and Real Time Software
Balanduino Supervisor: Dr. Raed Al-Qadi Prepared by: Nadeen Kalboneh Nardeen Mabrouk.
PID Controller.
6: Processor-based Control Systems
Basic Design of PID Controller
Electronic Control Systems Week 7 – PID Control
Chapter 9 Design via Root Locus <<<4.1>>>
Chapter 9 Design via Root Locus <<<4.1>>>
Features of PID Controllers
Dynamical Systems Basics
The Design of Feedback Control Systems
Presentation transcript:

PID a11 CENG4480_A4 DC motor Control Using PID (proportional-integral-derivative) control

PID a12 PID (proportional-integral-derivative) control A more formal and precise method Used in most modern machines

PID a13 Introduction Control for better performance Use PID, choose whatever response you want Good performance Criteria depends on users and applications Too much overshoot/undershoot, not stable Response too slow time Motor speed (w) required

PID a14 values to evaluate a control system Typically value=10% Depends on application Rise time Settling time0 time Target value overshoot Steady state error undershoot

PID a15 control method: PID (proportional-integral-derivative) control Required speed= Wsl_speed_input (u) IR wheel Speed encoder Wsl_speed_measured + - speed (w) Motor Amplifier K1 and Alter PWM for driver L293 wsl_t_on I=integral control delta_speed dt P=proportional and integral control delta_speed dt ; D=derivative control d(delta_speed)/dt ; sum e=error term =delta_speed

PID a16 control method: Theory of a feedback control system Required speed= Wsl_speed_input (u) IR wheel Speed encoder + - speed (w) Motor sum A Controller: Collect error to drive the plant e=error term speed (w) B Plant: use control parameters to derive the system

PID a17 P (proportional) control of speed Required speed= Wsl_speed_input (u) IR wheel Speed encoder + - speed (w) Motor KpeKpe sum speed (w) Set K p =A e=error term

PID a18 PD (proportional-derivative) control of speed alternative names Pre-act or rate control Required speed= Wsl_speed_input (u) IR wheel Speed encoder + - speed (w) Motor KpeKpe sum K d *[d(e)/dt] A speed (w) e=error term

PID a19 PID (proportional-derivative-integral) control of speed Required speed= Wsl_speed_input (u) IR wheel Speed encoder + - speed (w) Motor KpeKpe sum A K i *[ (e)dt] K d *[d(e)/dt] speed (w) e=error term

PID a110 values to evaluate a control system Typically value=10% Depends on application Rise time Settling time0 time Target value overshoot Steady state error undershoot

PID a111 Use of PID control terms are intertwined Kp: Proportional Gain - Larger Kp typically means faster response since the larger the error, the larger the Proportional term compensation. An excessively large proportional gain will lead to process instability and oscillation. Ki: Integral Gain - Larger Ki implies steady state errors are eliminated quicker. The trade-off is larger overshoot: any negative error integrated during transient response must be integrated away by positive error before we reach steady state. Kd: Derivative Gain - Larger Kd decreases overshoot, but slows down transient response and may lead to instability due to signal noise amplification in the differentiation of the error.

PID a112 Reason for proportional control Bigger error will give more input to the plant to enable the output to reach the target faster Improve risetime

PID a113 Reason for Derivative control or called Pre-act or rate control Adjust output based on the rate of change the error Decrease overshoot (caused by the integral term and proportional term) But also amplifier noise, may make system unstable. See

PID a114 Example to show how derivative control reduces overshoot u=setpoint, w t, motor speed measured e t =u-w t, -----(1) If u is stable, w rises from 0 to u Differentiate (1) we get d(e t )/dt = -d(w t )/dt ---(2) When w is increasing, the system suppresses its growth, hence reduces overshoot Setpoint u time w speed

PID a115 Example to show how derivative control reduces oscillation Stable requirement u, changing motor speed w –The robot is moving at a constant speed w  u –A small rock hiders its motion, so reduces the motor speed w t, u=setpoint, –e t =u-w t, -----(1), –d(e t )/dt = -d(w t )/dt ---(2) –From (1) when w t decreases, e increases, so the system increases power to the motor to enable w t+1 approach u. –The reverse is also true, e.g. the robot suddenly goes downhill (or just overcome the small rock) and speed increases, the system should decease the power to the motors. Changing requirement u, stable motor speed w –It is also true for a stable w and increasing u, since de/dt=du/dt, so power is increased to keep up with the required u. w t-1 w t w t+1 u rock

PID a116 Reason for Integral control or called automatic reset In proportional only control the output cannot reach the target value (setpoint) without using a bias. Output=gain*error + bias, E.g. –w=k p *(u-w) + bias, do the following exercise –without bias u=10, Kp=100, bias=0,so w=> –With bias u=10, Kp=100, w=10, so B=>10 –Without a computer the bias is set manually With the computer, the bias can be calculated by the integral term Decrease steady state error It helps the system quickly reaches the set point But it increases overshoot because of the cumulated term Integral Windup problem ( –If error is positive/negative for too long accumulated error will saturate the system or is over the limit that the system can response to (can damage the motor, ie. when the motor is driven by an analog voltage) –Solution: Set maximum and minimum values for the integral term

PID a117 Example: Step response to evaluate a system-- ask the motor to change from 0 to unit speed Matlab code Kp=350; Ki=300; Kd=50; num=[Kd Kp Ki]; den=[1 10+Kd 20+Kp Ki]; t=0:0.01:2; step(num,den,t) Matlab code to valuate the system time speed Good smooth PID control result

PID a118 Effects (in matlab) Reduce Kp Kp=100; Ki=300; Kd=50; Kp=350; increase Ki Ki=3000; Kd=50; Kp=350; Ki=300; Kd=50; Kp=350; Ki=300; Reduce Kd Kd=10; Bad, too much overshoot Too slow Settling time too long high much overshoot Best, near to ideal

PID a119 General tips for designing a PID controller When you are designing a PID controller for a given system, follow the steps shown below to obtain a desired response. Obtain an open-loop response and determine what needs to be improved. (Step input, see output) Add a proportional control (Kp) to improve the rise time Add a derivative control (Kd) to improve the overshoot Add an integral control (Ki) to eliminate the steady-state error Adjust each of Kp, Ki, and Kd until you obtain a desired overall response. See the table in the next slide.

PID a120 Effects of increasing parameters ParameterRise TimeOvershootSettling Time Steady state error KpDecrease step1 IncreaseSmall Change Decrease KiDecreaseIncrease Eliminate step3 KdSmall Change Decrease step2 DecreaseSmall Change

PID a121 PID Implementation

PID a122 ISR for PID control Main() {derivative_gain, proportional_gain, integral_gain should be set in the main program} Interrupt service routine ISR() // set a cycle freq, e.g. 1KHz { 0) measure error 1) Calculate Proportional Term 2) Calculate derivative term 3) Calculate Integral Term 4) Sum Up { Proportional+ derivative+ Integral } and use it to control the output }

PID a123 Checking overflow Checking overflow of terms is essential to make the system reliable

PID a124 1) Calculate Proportional Term (Kp=proportional_gain) To make sure the error term does not overflow /*** Calculate Proportional Term ***/ proportional_term_temp = ((long)this_error * (long)proportional_gain) ; /*** Check For Proportional Term Out Of Range & Apply Saturation ***/ if(proportional_term_temp > (long)((long)32767 * Inputs_Scale_Factor)) { proportional_term = ; } else { if(proportional_term_temp <= (long)((long) * Inputs_Scale_Factor)) { proportional_term = ; } else { proportional_term = (short)((long)proportional_term_temp/Inputs_Scale_Factor) ; } }

PID a125 2) Calculate derivative term (Kd=derivative_gain) //The derivative term is simply calculated /*** Calculate Derivative Term ***/ derivative_term = ((long)(this_error - PID.last_error) * derivative_gain)/(long)Inputs_Scale_Factor ; Motor Required speed= Wsl_speed_input (u) IR wheel Speed encoder + - speed (w) Motor KpKp sum K d *d(e)/dt A e=error tem

PID a126 3) Calculate Integral Term (Ki=integral_gain) /*** Find Accumulated Error ***/ acc_error_temp = ((long)PID.accumulated_error) + (long)this_error ; /*** Check For Accumulated Error Out Of Range ***/ if(acc_error_temp > (long)32767) { // Is error > maximum value? acc_error_temp = ; // Limit to max +ve value } if(acc_error_temp < (long)-32768) { // Is error < minimum value? acc_error_temp = ; // Limit to max -ve value } PID.accumulated_error = (short) acc_error_temp ;

PID a127 Calculate Integral Term -- calculate and check for overflow /*** Calculate Integral Term ***/ integral_term_temp = ((long)PID.accumulated_error * (long)integral_gain) ; /*** Check For Integral Term Out Of Range & Apply Saturation ***/ if(integral_term_temp > (long)((long)32767 * Inputs_Scale_Factor)) { integral_term = ; } else { if(integral_term_temp <= (long)((long) * Inputs_Scale_Factor)) { integral_term = ; } else { integral_term = integral_term_temp/Inputs_Scale_Factor ; } } Integral Windup problem If error is positive/negative for too long accumulated error will saturate the system Solution: Set maximum and minimum values for the integral term

PID a128 4) Sum Up Control Terms /*** Sum Up Control Terms ***/ control_output_temp = (long) integral_term ; control_output_temp += (long)derivative_term ; control_output_temp += (long) proportional_term ; /* Limit Value Of Control Term */ if(control_output_temp > 32767) { control_output_temp = ; } else { if(control_output_temp < 0) { control_output_temp = 0 ; }

PID a129 PID Tuning Tune (adjust manually) –proportional_gain (Kp), –integral_gain (Ki) –derivative_gain (Kd), Set constant speed V1 for a while (5 seconds) and stop at T1 –Record the speed by the computer after T1 and see if it is ok Yes (accept Kp,Ki,Kd) No (tune again) Motor speed V1 (V1)/2 Accepted performance unstable done

PID a130 Summary Studies PID control theory and implementation