Go to Post A wet noodle of a chassis won't matter how much drop you have. - Andrew Schreiber [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 38 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 16-01-2012, 17:59
baronep's Avatar
baronep baronep is offline
Student President
FRC #2848 (Jesuit All-Sparks)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dallas TX
Posts: 167
baronep is on a distinguished road
PID Tuning Process?

Can someone please outline to me how to PRACTICALLY tune a PID control loop? (specific steps for labview would be best)
Reply With Quote
  #2   Spotlight this post!  
Unread 16-01-2012, 19:16
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,114
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: PID Tuning Process?

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.
Quote:
Originally Posted by Wikipedia
If the system must remain online, one tuning method is to first set Ki and Kd values to zero. Increase the Kp until the output of the loop oscillates, then the Kp should be set to approximately half of that value for a "quarter amplitude decay" type response. Then increase Ki until any offset is corrected in sufficient time for the process. However, too much Ki will cause instability. Finally, increase Kd, if required, until the loop is acceptably quick to reach its reference after a load disturbance. However, too much Kd will cause excessive response and overshoot. A fast PID loop tuning usually overshoots slightly to reach the setpoint more quickly; however, some systems cannot accept overshoot, in which case an over-damped closed-loop system is required, which will require a Kp setting significantly less than half that of the Kp setting causing oscillation.
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.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android

Last edited by plnyyanks : 16-01-2012 at 19:24.
Reply With Quote
  #3   Spotlight this post!  
Unread 16-01-2012, 19:19
baronep's Avatar
baronep baronep is offline
Student President
FRC #2848 (Jesuit All-Sparks)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dallas TX
Posts: 167
baronep is on a distinguished road
Re: PID Tuning Process?

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.
Attached Files
File Type: vi Tach.vi (29.5 KB, 48 views)
Reply With Quote
  #4   Spotlight this post!  
Unread 16-01-2012, 20:58
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,011
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: PID Tuning Process?

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.
__________________

I am N2IRZ - What's your callsign?
Reply With Quote
  #5   Spotlight this post!  
Unread 16-01-2012, 23:17
baronep's Avatar
baronep baronep is offline
Student President
FRC #2848 (Jesuit All-Sparks)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dallas TX
Posts: 167
baronep is on a distinguished road
Re: PID Tuning Process?

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?
Reply With Quote
  #6   Spotlight this post!  
Unread 16-01-2012, 23:34
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,579
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: PID Tuning Process?

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.
Attached Thumbnails
Click image for larger version

Name:	PID_Forms.png
Views:	203
Size:	3.8 KB
ID:	11412  
Reply With Quote
  #7   Spotlight this post!  
Unread 17-01-2012, 11:59
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: PID Tuning Process?

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.)
Reply With Quote
  #8   Spotlight this post!  
Unread 18-01-2012, 18:11
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: PID Tuning Process?

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:

http://www.chiefdelphi.com/forums/sh...d.php?t=100555

-Kevin
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 22:21.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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