PID Control for Embedded Systems

Slides:



Advertisements
Similar presentations
PID Control Loops Guy Zebrick.
Advertisements

Advanced Piloting Cruise Plot.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 5 Author: Julia Richards and R. Scott Hawley.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
FIGURE 12.1 Two variable process-control loops that interact.
FIGURE 9.1 Control of temperature by process control.
Curtis Johnson Process Control Instrumentation Technology, 8e]
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
0 - 0.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
1 Learning Touchmath *Graphics taken from
Year 6 mental test 5 second questions
ZMQS ZMQS
Unit 4 The Performance of Second Order System Open Loop & Close Loop Open Loop: Close Loop:
BT Wholesale October Creating your own telephone network WHOLESALE CALLS LINE ASSOCIATED.
Controllers Daniel Mosse cs1657 cs1567.
ERT 210 Process Control & dynamics
PID Controllers and PID tuning
Modern Control Systems (MCS)
1 ChE / MET Apr 12. Feedback Controller Tuning: (General Approaches) 1)Simple criteria; i.e QAD via ZN I, t r, etc easy, simple, do on existing.
Discrete Controller Design
Jan Jantzen Fuzzy PID Control Jan Jantzen
ABC Technology Project
Build to kick kick to win. Shooting skills 2 Outline Shooting mechanism System description Actuator design Lob shots Identification Calibration Towards.
Squares and Square Root WALK. Solve each problem REVIEW:
1 Chapter 4 The while loop and boolean operators Samuel Marateck ©2010.
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Addition 1’s to 20.
25 seconds left…...
Maximum ??? Minimum??? How can we tell?
Week 1.
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Chapter 4: Basic Properties of Feedback
Introduction to Control: How Its Done In Robotics R. Lindeke, Ph. D. ME 4135.
LECTURE#11 PID CONTROL AUTOMATION & ROBOTICS
Proportional/Integral/Derivative Control
Robot Sensors Kevin Watson and Rich Petras. Overview ➲ Sensors ● Micro Switch ● Gyro ● Encoders ➲ Command Sequencing ➲ PID Control.
Agenda Path smoothing PID Graph slam.
CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Feedback Control.
Control of Robot Manipulators
Design Realization lecture 22
PID. The proportional term produces an output value that is proportional to the current error value. Kp, called the proportional gain constant.
PID CONTROLLERS By Harshal Inamdar.
CSCI1600: Embedded and Real Time Software Lecture 12: Modeling V: Control Systems and Feedback Steven Reiss, Fall 2015.
Control systems KON-C2004 Mechatronics Basics Tapio Lantela, Nov 5th, 2015.
Control 3 Keypoints: PID control
BIRLA VISHWAKARMA MAHAVIDHYALAYA ELECTRONICS & TELECOMUNICATION DEPARTMENT o – ANKUR BUSA o – KHUSHBOO DESAI UNDER THE GUIDENCE.
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
PID Control Systems (Proportional, Integral, Derivative)
PID Controllers Jordan smallwood.
Feedback Control System
Introduction to PID control
Lec 14. PID Controller Design
Control Loops Nick Schatz FRC 3184.
CSCI1600: Embedded and Real Time Software
6: Processor-based Control Systems
Basic Design of PID Controller
Electronic Control Systems Week 7 – PID Control
Advanced LabVIEW
Presentation transcript:

PID Control for Embedded Systems Richard Ortman and John Bottenberg

The Problem Add/change input to a system Did it react how you expected? Could go to fast or slow External environmental factors can play a role (i.e. gravity)

Feedback Control Say you have a system controlled by an actuator Hook up a sensor that reads the effect of the actuator (NOT the output to the actuator) You now have a feedback loop and can use it to control your system! Actuator Sensor http://en.wikipedia.org/wiki/File:Simple_Feedback_02.png

Example: Robotic Arm Tell this arm to go to a specified angle Potentiometer Reads 0 to 5 V Robot Motor/Gearbox Takes -12 to 12 V PWM later http://www.chiefdelphi.com/media/photos/27132 Tell this arm to go to a specified angle

Introduction to PID Stands for Proportional, Integral, and Derivative control Form of feedback control http://en.wikipedia.org/wiki/File:PID_en_updated_feedback.svg

Simple Feedback Control (Bad) double Control (double setpoint, double current) { double output; if (current < setpoint) output = MAX_OUTPUT; else output = 0; return output; } Why won't this work in most situations?

Simple Feedback Control Fails Moving parts have inertia Moving parts have external forces acting upon them (gravity, friction, etc)

Proportional Control Get the error - the distance between the setpoint (desired value) and the actual value Multiply it by Kp, the proportional gain That's your output! double Proportional(double setpoint, double current, double Kp) { double error = setpoint - current; double P = Kp * error; return P; }

Actuator + potentiometer Set-point (5V) Actual (2V) Error (3V) Actuator + potentiometer

Proportional Tuning If Kp is too large, the sensor reading will rapidly approach the setpoint, overshoot, then oscillate around it If Kp is too small, the sensor reading will approach the setpoint slowly and never reach it

What can go wrong? When error nears zero, the output of a P controller also nears zero Forces such as gravity and friction can counteract a proportional controller and make it so the setpoint is never reached (steady-state error) Increased proportional gain (Kp) only causes jerky movements around the setpoint

Proportional-Integral Control Accumulate the error as time passes and multiply by the constant Ki. That is your I term. Output the sum of your P and I terms. double PI(double setpoint, double current, double Kp, double Ki) { double error = setpoint - current; double P = Kp * error; static double accumError = 0; accumError += error; double I = Ki * accumError; return P + I; }

PI controller The P term will take care of the large movements The I term will take care of any steady-state error not accounted for by the P term

Limits of PI control PI control is good for most embedded applications Does not take into account how fast the sensor reading is approaching the setpoint Wouldn't it be nice to take into account a prediction of future error?

Proportional-Derivative Control Find the difference between the current error and the error from the previous timestep and multiply by the constant Kd. That is your D term. Output the sum of your P and D terms. double PD(double setpoint, double current, double Kp, double Kd) { double error = setpoint - current; double P = Kp * error; static double lastError = 0; double errorDiff = error - lastError; lastError = error; double D = Kd * errorDiff; return P + D; }

PD Controller D may very well stand for "Dampening" Counteracts the P and I terms - if system is heading toward setpoint, D term is negative! This makes sense: The error is decreasing, so d(error)/dt is negative

PID Control Combine P, I and D terms! double PID(double setpoint, double current, double Kp, double Ki, double Kd) { double error = setpoint - current; double P = Kp * error; static double accumError = 0; accumError += error; double I = Ki * accumError; static double lastError = 0; double errorDiff = error - lastError; lastError = error; double D = Kd * errorDiff; return P + I + D; }

Saturation - Common Mistake PID controller can output any value, but actuator has a minimum and maximum input value double saturate(double input, double min, double max) { if (input < min) return min; if (input > max) return max; return input; } // Saturate the output of your PID function double pid = PID(setpoint, current, Kp, Ki, Kd); double output = saturate(pid, min, max); // Send this output to your actuator! Actuator = output;

Timesteps - Common Mistake

Timesteps - Common Mistake Calling a PID control function at different or erratic frequencies results in different behavior Regulate this by specifying dt! double PID(double setpoint, double current, double Kp, double Ki, double Kd, double dt) { double error = setpoint - current; double P = Kp * error; static double accumError = 0; accumError += error * dt; double I = Ki * accumError; static double lastError = 0; double errorDiff = (error - lastError) / dt; lastError = error; double D = Kd * errorDiff; return P + I + D; }

PID Tuning Start with Kp = 0, Ki = 0, Kd = 0 Tune P term - System should be at full power unless near the setpoint Tune Ki until steady-state error is removed Tune Kd to dampen overshoot and improve responsiveness to outside influences PI controller is good for most embedded applications, but D term adds stability

PID Applications Robotic arm movement (position control) Temperature control Speed control (ENGR 151 TableSat Project) Taken from the ENGR 151 CTools site

More information Take EECS 461! Learn about PID transfer functions. Great tutorial: Search "umich pid control" http://ctms.engin.umich.edu/CTMS/index.php?example=Introduction&section=ControlPID

Conclusion PID uses knowledge about the present, past, and future state of the system, collected by a sensor, to control an actuator In PID control, the constants Kp, Ki, and Kd must be tuned for maximum performance

Questions?