PID Tuning Process?

Can someone please outline to me how to PRACTICALLY tune a PID control loop? (specific steps for labview would be best)

Really, the best way to tune PID constants in Guess and Check - after a little practice, you get pretty good at guessing the correct constants. This is pretty much the method we use on 1124, and we haven’t really found the need to migrate away from it.

In our robots, we’ve found that an I parameter is rarely needed - we usually get what we want with only PD (or sometimes just P) controllers. It’s really dependant on your application and the type of feedback you want. There’s no really easy way to say it: it’s a long, time consuming process.

Some more links to read into

To do this in LabVIEW, you have your PID VI, and one of its inputs is a cluster of three doubles, which are the P,I, and D constants that you tune to your liking. The best way to tune quickly is to probably run your code through a computer (using the Run button on Robot Main.vi - not building/running as startup) and modify that parameter cluster until you get satisfactory results. Just remember to reinitialize your PID VI (it’s another control - wire that input to a button on your front panel or something like that) to “apply” your changes. NI also has a good whitepaper about working with PID in LV. It’s a good read - check it out.

The reason I am asking is because I am trying to use a PID loop to run our flywheels (2 axles with 2 motors) at a desired setpoint (different setpoints). I can adjust Kp to about .01 to .02 to get a pretty good response but the value is often 100 rpm under my setpoint. How do I tune this???

My code is posted below. The tachometer is the retro-reflective sensors from last year reading four pieces of tape around the perimeter of the wheel.

Tach.vi (29.5 KB)


Tach.vi (29.5 KB)

P reacts to the difference between setpoint and actual.
I reacts to the long-time - small-error differences between setpoint and actual
D reacts by limiting the rate at which actual can change

If you have a long-time error of 100 RPM, perhaps I needs a higher value.

So we have divided our PV by 10 so that a 2000rpm would input as 200 and we are using the PID input filter. We are using a P of .01. What would the values of I and D look like essentially? Would they be like .001 or 10?

One thing to realize is that there are several forms of PID equations commonly used. Asking for help tuning without specifying the form can lead to misleading answers. See the attached picture for the equations of common forms (as defined in the LabVIEW help). Wikipedia calls the Academic form the standard form, the the Parallel form the Ideal Parallel form.

LabVIEW uses the academic form, however, I think most people answering your questions are using the parallel form.

For example, to make the integral term have more effect, you increase the integral constant in the parallel form, or make it smaller in the Academic form.

PID_Forms.png


PID_Forms.png

If you’re trying to control wheel speed, consider what happens when a typical proportional controller determines that the speed is correct. The error term goes to zero, removing power from the motor. It’ll slow down until the error term is high enough to add power, and eventually you’ll reach a steady state with the speed much slower than you are asking for.

If you leave the P term at zero and pretend the I term is actually the P term, you can get something much closer to what you want.

(What we’ve done in the past is to take the output of the PID and use it to add to or subtract from the current motor control value.)

Team 2168 just posted a video tutorial on how to tune PID gains… without using guess and check.

The method uses the modern control approach where you model your plant, simulate your controller, and design gains.

Its easy to do, and I believe it is explained in such a way that no prior control experience is needed.

The tutorial uses matlab and simulink (Industry defacto tools for control and filter design). If you don’t have a license Math works provides free licenses to first teams - all you have to do is email them.

check out this thread:

-Kevin