Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   PID Help (http://www.chiefdelphi.com/forums/showthread.php?t=131699)

GuyM142 25-12-2014 11:05

PID Help
 
Hey,
I'm the head programmer of my team 3339.

I want to teach my crew how to use PID properly and I'm having a hard time finding a good presentation that will explain each parameter and the general principals.

Moreover, I am looking for a simulation for PID in order to demonstrate how it works. The one I've found in LabVIEW is not responding fast enough as a real motor would.

Can you help me?

plnyyanks 25-12-2014 11:36

Re: PID Help
 
There are many, many threads on CD and the general internet about PID control. Try searching around.

Here's some good resources from NI:
Quote:

Originally Posted by plnyyanks (Post 1399862)
Additionally, if you search through NI's website, they have some great resources about PID theory (and their examples are in LV). You can also view the complete help page for the PID VI here.

And here are some more resources:
Quote:

Originally Posted by plnyyanks (Post 1332235)
The PID VI is entirely mathematical - it doesn't care what the inputs are, all it does it brings the error of the system (Setpoint - Process Variable) down to zero. It will work exactly the same with encoder rates and distances, provided that the SP and PV are scaled the same way (and the constants are tuned properly). I'd be more than happy to explain how some of the math works, if you'd like.

As for your specific system issues, it just looks like the constants aren't tuned properly. Read a little bit about PID Theory (also: wikipedia) and take a look at some tips on designing a good controller (the rest of that page is helpful too). You may also want to start with the Ziegler-Nichols method for tuning (start with all zero, bring P up until it oscillates, add D to dampen and add I to correct for steady state error.

Just another note - if I remember, the LabVIEW implementation of the algorithm doesn't use Kp, Ki, and Kd as straight constants. It actually uses time constants for I and D (so it has Kp, Ti, and Td). You can see details of the NI implementation here. You can verify this in the help popup (ctrl-H) for the VI. Plan your constants accordingly.

And this page looks like it has some cool simulation resources, and some overviews about the theory behind the controller.

GuyM142 25-12-2014 13:00

Re: PID Help
 
Quote:

Originally Posted by plnyyanks (Post 1416861)
There are many, many threads on CD and the general internet about PID control. Try searching around.

Here's some good resources from NI:


And here are some more resources:


And this page looks like it has some cool simulation resources, and some overviews about the theory behind the controller.

Thanks alot!

I have question about the Labview implantation (your 2nd quote):
Should I use Ti and Td differently of what is written about Ki and Kd or is it the same?

plnyyanks 25-12-2014 14:53

Re: PID Help
 
Take a look at this page specifically, it details the exact math behind each of the P, I, and D parts of the controller.
Integral:

Derivative:


So in the integral case, Ki = Kc/Ti. It's a similar thing for the derivative part.

Disclaimer: I have no idea if NI has changed their implementation since I last looked at it (a year or two ago), so verify exactly what constants are used with the 2015 docs when they come out.

DonRotolo 25-12-2014 20:38

Re: PID Help
 
One story I've found to help people understand is a car's Cruise Control. We all know that it's a system used to keep a car moving at a constant speed.

P is the difference between the set speed and the actual speed. When P is non-zero, the system takes action to move this 'error' towards zero.

D is how fast you want to accelerate (or decelerate) back to the set speed. You may want to adjust this depending on engine power: with a very weak engine would want to go to full throttle quickly, with a very powerful engine you'd want to add throttle slowly. If you add too much power, you'd go past the set speed and have to slow down...the system would go too fast then too slow, continuously.

I is a little tricky, but basically it's fine control right around the set speed, allowing small speed errors to accumulate over time and allow for corrective action (like P) that is gentle instead of a large response (like D)

Jared 25-12-2014 20:45

Re: PID Help
 
I made a PID simulator to teach some of our programmers. It simulates an arm with or without gravity pulling it down.

Check out my post about it here: http://www.chiefdelphi.com/forums/sh...d.php?t=130801

For a sample of a well tuned loop, try setting a setpoint of 200, a mass of 0.03, kP of .35, and kD to 5, then click start.

The simulation is fairly realistic, and takes into account motor torque curves and the inertia of the arm.


All times are GMT -5. The time now is 08:50.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi