Go to Post The easiest and most effective way to do this for the Championship event is pre-competition scouting, with statistics. Nothing beats it. Hands down. Period. The End. Nothing's better. - Tom Bottiglieri [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: 5 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 04-02-2010, 21:00
Felipe Sagui Felipe Sagui is offline
Registered User
FRC #1382 (EtepTeam)
Team Role: Mentor
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Brazil
Posts: 25
Felipe Sagui is an unknown quantity at this point
Send a message via MSN to Felipe Sagui
PID behavior

We are using the PID advanced .VI (we tried to use the standard PID too) but we are not understanding the behavior of the PID.

We think that a correct PID starts with the maximum on the output (on maximum output range), because the error is bigger, and while the error decreases, the process variable increases and the output signal should to decrease until 0. In the end the set-point = process variable, error = 0 and output = 0.

However the PID on LabView makes the inverse: when the error is maximum the output starts on 0 and is increasing until the maximum output range with the process variable while the error is decreasing until 0.

is this behavior right?
__________________
Felipe Cezar Salgado
ETEPTEAM #1382

Last edited by Felipe Sagui : 04-02-2010 at 21:05.
Reply With Quote
  #2   Spotlight this post!  
Unread 04-02-2010, 22:12
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: PID behavior

When the setpoint and process variable do not match, the PID will modify the output to try and get the process variable to match the setpoint. The output range may help to keep the output within legal values.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 05-02-2010, 05:43
Felipe Sagui Felipe Sagui is offline
Registered User
FRC #1382 (EtepTeam)
Team Role: Mentor
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Brazil
Posts: 25
Felipe Sagui is an unknown quantity at this point
Send a message via MSN to Felipe Sagui
Re: PID behavior

this we understand....but we don't understand is the behavior, the curve on graph that output makes.

but how is this modification (curve/behavior/graph) on the output when the process variable and the set-point do not match?

should the output start with maximum value and decrease while time is passing because the error is trying to be 0?
__________________
Felipe Cezar Salgado
ETEPTEAM #1382
Reply With Quote
  #4   Spotlight this post!  
Unread 05-02-2010, 06:48
Felipe Sagui Felipe Sagui is offline
Registered User
FRC #1382 (EtepTeam)
Team Role: Mentor
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Brazil
Posts: 25
Felipe Sagui is an unknown quantity at this point
Send a message via MSN to Felipe Sagui
Re: PID behavior

Here is what is happening with us.

each time that the process variable is increased the output makes a "pulse" until the output low.

the question is: why it is happening? how can I fix it?

An observation: we tried to change the PID gains, but always happens the same.

thanks.
Attached Thumbnails
Click image for larger version

Name:	PID.jpg
Views:	49
Size:	98.4 KB
ID:	8519  
__________________
Felipe Cezar Salgado
ETEPTEAM #1382
Reply With Quote
  #5   Spotlight this post!  
Unread 05-02-2010, 07:20
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: PID behavior

I cannot reproduce the behavior.

The first thing I'd do is to insert a bundle node between the chart and the PID. Then grow it so you can also chart the setpoint and process variable alongside the output all against Time.

Next zero out the I and D terms and see if the behavior doesn't start making sense.

Finally, I'm confused as to why there are 32 million points on the chart. I suspect it is because there was no delay in the loop at some point. Perhaps that has something to do with it? There is no model to respond to the output, so your PID behavior should be described by the terms and the artifacts from the math.

You may also find it useful to open up examples using PID. Help>>Find Examples and search for PID. Many of those will have models to control against and UIs to look at while altering the parameters.

Note that the PID coefficients for the LV PID are in academic form, not the standard form. That sometimes causes confusion during tuning.

Greg McKaskle
Reply With Quote
  #6   Spotlight this post!  
Unread 05-02-2010, 07:41
Manoel's Avatar
Manoel Manoel is offline
Registered User
FRC #0383 (Brazilian Machine)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Porto Alegre, RS, Brazil
Posts: 608
Manoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond repute
Send a message via ICQ to Manoel Send a message via MSN to Manoel
Re: PID behavior

Felipe,

Are you manually increasing the process variable value?


We can discuss this in Portuguese if you'd like.
__________________
Manoel Flores da Cunha
Mentor
Brazilian Machine
Team # 383
Reply With Quote
  #7   Spotlight this post!  
Unread 05-02-2010, 08:24
Felipe Sagui Felipe Sagui is offline
Registered User
FRC #1382 (EtepTeam)
Team Role: Mentor
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Brazil
Posts: 25
Felipe Sagui is an unknown quantity at this point
Send a message via MSN to Felipe Sagui
Re: PID behavior

Quote:
Originally Posted by Manoel View Post
Felipe,

Are you manually increasing the process variable value?


We can discuss this in Portuguese if you'd like.
yes, I'm increasing manually the process variable value.

What I mean is that when is only P it is ok the behavior: the output starts high and while the PV is increasing the output starts to decrease until 0. This we understand.

The problem is now, when we put P and I: the output starts on 0 e it starts do raise slowly and not like when is only P, that starts directly high.
After, when is running, we start to increase the process variable value, the output came down but after it begin to increase again coming back to the value before ("like an inverse pulse").

When the PV = SP the output starts to be constant but not 0. We guess that it has something with the I term and with the reinitialize boolean on PID .VI

Now we ask: why output doesn't decrease until 0? What we can make to do it in the better way that is possible?
__________________
Felipe Cezar Salgado
ETEPTEAM #1382
Reply With Quote
  #8   Spotlight this post!  
Unread 05-02-2010, 08:57
Manoel's Avatar
Manoel Manoel is offline
Registered User
FRC #0383 (Brazilian Machine)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Porto Alegre, RS, Brazil
Posts: 608
Manoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond repute
Send a message via ICQ to Manoel Send a message via MSN to Manoel
Re: PID behavior

Quote:
Originally Posted by Felipe Sagui View Post
When the PV = SP the output starts to be constant but not 0. We guess that it has something with the I term and with the reinitialize boolean on PID .VI

Now we ask: why output doesn't decrease until 0? What we can make to do it in the better way that is possible?
Yes, it's because of the integral term. Think about this: the controller has no idea of what's going on other than, at that particular output, it drove the error to zero. Why would it want to change its output?

You are too attached to this "output must go to zero" mantra. Truth is, it's not always the case. Suppose you were controlling a motor's speed with a PID loop. When you reached the desired setpoint, would you like the controller output to go to zero? Of course not, because then the motor would stop spinning.

Manually changing the process variable value isn't really a way to test anything, as it doesn't represent anything and isn't even reproducible. You guys should follow Greg's suggestion of trying the PID example VIs - they actually simulate a process and will be a lot more helpful.


PS - It seems you already understand a bit about PID controllers, so what is the purpose of those tests?

Please ask again if you need clarifications, and best of luck!
__________________
Manoel Flores da Cunha
Mentor
Brazilian Machine
Team # 383
Reply With Quote
  #9   Spotlight this post!  
Unread 05-02-2010, 09:36
Felipe Sagui Felipe Sagui is offline
Registered User
FRC #1382 (EtepTeam)
Team Role: Mentor
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Brazil
Posts: 25
Felipe Sagui is an unknown quantity at this point
Send a message via MSN to Felipe Sagui
Re: PID behavior

Quote:
Originally Posted by Manoel View Post
You are too attached to this "output must go to zero" mantra. Truth is, it's not always the case. Suppose you were controlling a motor's speed with a PID loop. When you reached the desired setpoint, would you like the controller output to go to zero? Of course not, because then the motor would stop spinning.
Here we want to attach a motor on a encoder, set a SP and get the encoder pulses as variable process, but we were intending to do an output curve that starts on maximum(error high) and while the PV increases, the output decreases until a value near 0 (motor stops spinning). is possible make it on PID .VI on LV?
we already did it on past years when the programming was on RC (C language), but we decided to try another kind of programming. It was like it:
previous_error = 0
integral = 0
start:
error = setpoint - actual_position
integral = integral + (error*dt)
derivative = (error - previous_error)/dt
output = (Kp*error) + (Ki*integral) + (Kd*derivative)
previous_error = error
wait(dt)
goto start
We tested on the motor before the manually test of the PV. However, we got the same result.
__________________
Felipe Cezar Salgado
ETEPTEAM #1382
Reply With Quote
  #10   Spotlight this post!  
Unread 05-02-2010, 09:39
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,563
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 behavior

Have you read the PID manual that is included with LabVIEW? I think you'll find that Ki and Kd are treated differently then the code you used in the past.

It certainly is possible to write your own PID code, but it's worth the time to understand NI's implementation.
Reply With Quote
  #11   Spotlight this post!  
Unread 05-02-2010, 10:23
Felipe Sagui Felipe Sagui is offline
Registered User
FRC #1382 (EtepTeam)
Team Role: Mentor
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Brazil
Posts: 25
Felipe Sagui is an unknown quantity at this point
Send a message via MSN to Felipe Sagui
Re: PID behavior

We read the PID manual before starts the tests, and we discovered that on LV PID is on Academic formula. Ti divides 1 (inverse of Ki) the Td only sums.

We are wondering too write our own PID like that pseudocode we already used. Or try to discovery another logic that fits to our problem.
__________________
Felipe Cezar Salgado
ETEPTEAM #1382
Reply With Quote
  #12   Spotlight this post!  
Unread 05-02-2010, 10:48
Manoel's Avatar
Manoel Manoel is offline
Registered User
FRC #0383 (Brazilian Machine)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Porto Alegre, RS, Brazil
Posts: 608
Manoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond reputeManoel has a reputation beyond repute
Send a message via ICQ to Manoel Send a message via MSN to Manoel
Re: PID behavior

Quote:
Originally Posted by Felipe Sagui View Post
Here we want to attach a motor on a encoder, set a SP and get the encoder pulses as variable process, but we were intending to do an output curve that starts on maximum(error high) and while the PV increases, the output decreases until a value near 0 (motor stops spinning). is possible make it on PID .VI on LV?
Yes, if properly tuned, your system will behave as described.
__________________
Manoel Flores da Cunha
Mentor
Brazilian Machine
Team # 383
Reply With Quote
  #13   Spotlight this post!  
Unread 09-02-2010, 08:10
Felipe Sagui Felipe Sagui is offline
Registered User
FRC #1382 (EtepTeam)
Team Role: Mentor
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Brazil
Posts: 25
Felipe Sagui is an unknown quantity at this point
Send a message via MSN to Felipe Sagui
Re: PID behavior

Thanks everybody...

We got it
__________________
Felipe Cezar Salgado
ETEPTEAM #1382
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Random behavior RedBarons Programming 9 25-02-2006 23:03
my behavior lil_longo General Forum 1 24-02-2006 13:53
Bizzare Quaderature Behavior phrontist Electrical 8 22-01-2006 09:04
Problematic 2004 RC behavior Danny Diaz Control System 1 21-01-2006 17:48
Strange Behavior Gary Bonner Control System 17 09-11-2005 19:01


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

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