Chief Delphi

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

baronep 26-02-2012 19:56

PID In-Range Ideas
 
Does anyone have any ideas about how to determine if a PID loop has settled out yet? We have our PID loop running relatively well, but I am trying to find a way to sense if the loop has settled out in order to trigger our intake system to shoot the ball. I tried if ERROR < 5 then RUN INTAKE. But it runs momentarily on the overshoot and undershoot. I was able to partially fix this by only allowing it to shoot after 3 seconds, but I feel that there is a better way to do this?

Patrick

~Cory~ 26-02-2012 19:59

Re: PID In-Range Ideas
 
We accomplished by averaging. If the average was in range, then fire.

baronep 26-02-2012 20:41

Re: PID In-Range Ideas
 
Is there a VI that will do averaging for you? If not, how do you do it?

apalrd 26-02-2012 23:50

Re: PID In-Range Ideas
 
You combine a check of error with a timer.

The psudocode would be:
Code:


int timer = 0; //Make sure you use a signed type to prevent underflow


int delta_t = time_now - time_last; //delta_t is millisecond loop time - in LabVIEW it would be a Tick Count block and a shift register/feedback node to store the last time

if(abs(error) < threshold) timer += delta_t;
else timer -= delta_t;

if(timer <= 0) timer = 0;

if(timer >= threshold) fire();



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

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