Go to Post You are not allowed to think outside of the box, but you are allowed to think diagonally in the box. - eugenebrooks [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 31-12-2005, 17:50
phrontist's Avatar
phrontist phrontist is offline
Proto-Engineer
AKA: Bjorn Westergard
FRC #1418 (Vae Victus)
Team Role: College Student
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Falls Church, VA
Posts: 828
phrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond reputephrontist has a reputation beyond repute
Send a message via AIM to phrontist
Integral Window for PID Control

How do you determine how many error samples to include in your PID model? For the derivative portion you presumably just use the last sample (or is it common to do the average difference over a few samples?). There are well defined methods for tuning the constants in a PID algorithm, but how do you choose how far back the algorithm should look?
__________________

University of Kentucky - Radio Free Lexington

"I would rather have a really big success or a really spectacular crash and failure then live out the warm eventual death of mediocrity" - Dean Kamen
  #2   Spotlight this post!  
Unread 09-01-2006, 00:06
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Re: Integral Window for PID Control

Quote:
Originally Posted by phrontist
How do you determine how many error samples to include in your PID model? For the derivative portion you presumably just use the last sample (or is it common to do the average difference over a few samples?). There are well defined methods for tuning the constants in a PID algorithm, but how do you choose how far back the algorithm should look?
If you want the result to be zero error, you don't use a sliding finite
time window for the integral feedback. You start with zero integral
when you activate the control system and let the time integral of the
error be a running sum. The question is when to start the integral
feedback. If the proportional and derivative signals are arranged
to produce a critically damped system the system will not overshoot
at all (as a PD system). Delaying the start of the integral signal will
limit any overshoot that the integral signal injects into the system.

With regard to averaging the time derivative signal, you have to be
careful about the time delay when you do this. If you use an average
from too far back in time you could produce a sizable delay.
If you delay the signal too much you will get growing oscillations
instead of the damping that you want.

Have fun,
Eugene
  #3   Spotlight this post!  
Unread 16-02-2008, 17:32
LieAfterLie's Avatar
LieAfterLie LieAfterLie is offline
Registered User
FRC #2028
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Hampton, VA
Posts: 35
LieAfterLie is an unknown quantity at this point
Re: Integral Window for PID Control

I used a running sum for my error, but with the current sum cut down by a % each loop, so that the more recent error has more "weight". You also get the advantage of not having to keep and manage an error array for a time window.

Code:
// Integral control
Integral_Sum = (Integral_Sum *995) / 1000 + Err;
Integral_Counter = (Integral_Counter *995) / 1000 + 1;

Iout = Ki * (Integral_Sum / Integral_Counter);
Using this, every loop the current sum and number of sums is multiplied by 0.995, or cut down a half a percent, then the current sum is added. The average error of the old sum stays the same since the count is reduced too. The current sum gets added while all the old sums get repeatedly reduced.

Sums from 38 loops (1 second) ago to now make up 17% of the running sum.
0.995^38 = 0.827

Sums from 114 loops (3 seconds) ago to now make up 43% of the running sum.
0.995^114 = 0.565

Sums from 191 loops (5 seconds) ago to now make up 62% of the running sum.
0.995^191 = 0.384

Sums from 382 loops (10 seconds) ago make up 85% of the running sum.
0.995^382 = 0.147

Sums from 763 loops (20 seconds) ago make up 98% of the running sum.
0.995^763 = 0.022

You can change the 0.995 to make your running sum more recent or keep older sums more important.

I haven't seen this online anywhere, I don't know what it's called or if it even works yet, but it made sense to me. If anyone sees anything wrong with it let me know.
__________________
SEMPER UBI SUB UBI
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Concept of PID explained ConKbot of Doom Technical Discussion 11 27-01-2008 00:11
Pre-manufactured control box for FIRST Ben.V.293 Technical Discussion 19 22-08-2005 12:53
2005 RadioShack Innovation In Control Award--What Won? Billfred Control System 8 12-06-2005 01:51
What do you wish you knew about the new control system? Joe Ross Control System 2 09-01-2004 21:47
Looking for window kit parts archiver 2000 2 23-06-2002 22:50


All times are GMT -5. The time now is 04:35.

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