Chief Delphi

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

Felipe Sagui 04-02-2010 21:00

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?

Greg McKaskle 04-02-2010 22:12

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

Felipe Sagui 05-02-2010 05:43

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 Sagui 05-02-2010 06:48

Re: PID behavior
 
1 Attachment(s)
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.

Greg McKaskle 05-02-2010 07:20

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

Manoel 05-02-2010 07:41

Re: PID behavior
 
Felipe,

Are you manually increasing the process variable value?


We can discuss this in Portuguese if you'd like.

Felipe Sagui 05-02-2010 08:24

Re: PID behavior
 
Quote:

Originally Posted by Manoel (Post 913825)
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?

Manoel 05-02-2010 08:57

Re: PID behavior
 
Quote:

Originally Posted by Felipe Sagui (Post 913837)
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!

Felipe Sagui 05-02-2010 09:36

Re: PID behavior
 
Quote:

Originally Posted by Manoel (Post 913847)
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.

Joe Ross 05-02-2010 09:39

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.

Felipe Sagui 05-02-2010 10:23

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.

Manoel 05-02-2010 10:48

Re: PID behavior
 
Quote:

Originally Posted by Felipe Sagui (Post 913859)
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.

Felipe Sagui 09-02-2010 08:10

Re: PID behavior
 
Thanks everybody...

We got it :cool:


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

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