LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PID loop outputs min and max with small gain

Hello,

 

I am trying to control a pnuematic actuator using an precision flow control valve and a lvdt for feedback. The valve needs 0-10 volts out with 5V being no movement. Less than 5 pushes grater than 5 pulls. I am using cRIO with the lvdt coming in on 9215, and the signal to the valve is out on a 9263. I am trying to control it in a simple while loop, however with any input ( .02) the output oscillates between the min and max values.

 

My question is What should I have my min and max on the pid.vi set at? Should I use it in a percentage format instead of an engineering units format. Right now I have the Min @ 0 and the Max at 10.

 

Thanks in advance for any help.

 

Dammond 

0 Kudos
Message 1 of 12
(6,969 Views)

Can you share your code?

 

What are your PID tuning values?  Start with a small value for P alone and see if you can eliminate the oscillation.

 

If 5V is no movement, you may want to set your PID limits to -5 to +5, then add 5 to the output value, so that when the PID output is 0 you get no movement.

0 Kudos
Message 2 of 12
(6,964 Views)

Thanks Nathand,

 

I set the limits like you said but it still didn't make a difference.

 

Here is the VI. 

 

Thanks for you help.

 

 

0 Kudos
Message 3 of 12
(6,960 Views)

I'm sorry, I don't understand what you're trying to do.  Why is there no setpoint wired to the PID VI?  Why is there a second subVI called "PID 1.vi" that you didn't include?  Can you simplify your VI to run only the control of your valve (remove the event structure and everything else) until you have that portion working?

0 Kudos
Message 4 of 12
(6,958 Views)

Sorry about that Nathand, 

 

Let me make a simple one and put it on here.

 

Thanks

 

 

0 Kudos
Message 5 of 12
(6,947 Views)

Lets try this one. This PID loop basically puts out a squarewave min to max output for control with a very small gain input.

 

 

 

0 Kudos
Message 6 of 12
(6,930 Views)

Could you post a screenshot of the front panel while it's running, showing the behavior you're seeing and the PID tuning values you are using?  What is possible range of values for the Setpoint and Process Variable?  If the process variable and setpoint range are 0-100, and your proportional gain is set to 1, then a difference between the setpoint and process variable of 5 (say the setpoint is 55 and the process variable is 60) is sufficient to drive the valve from the neutral position all the way to one limit or the other.  If that's what you're seeing, you need a much smaller value for the proportional gain.  Obviously I don't have your hardware to test, but if I change the process variable to a control and put an indicator on the output, I can see that it responds exactly as would be expected.

 

Two minor style issues in your code:

1) There should be a wait inside your while loop.  Loops with no delay run as fast as possible, consuming all available CPU time.

2) Create the analog out task and set the range once, outside the while loop.  No need to do that over and over again.

0 Kudos
Message 7 of 12
(6,915 Views)

Sorry it has taken me so long to get back. I wrote another simple VI using the % of input/output and setpoint. My setpoint is based on a LVDT that is from 0-450mm. I am reading the lvdt on CRio 9215 that is 0-10V. My output is on a 9263 0-10V.

 

I have added a screen shot of the oupt of the system.

 

Again thanks for your help

 

 

Download All
0 Kudos
Message 8 of 12
(6,874 Views)

I can't download your VI - looks like the website has an issue with the % (probably because % is also used as a formatting character, for example a space is replaced by %20 in the HTTP request to download that file).  You might need to rename and re-upload it.

 

It looks like there's something odd or non-linear about your system response.  In the graph it appears that when you decrease the setpoint the PID output decreases, as expected, and the process variable decreases as well but further and slightly slower.  As soon as the process variable cross the setpoint, the proportional control drops to 0, putting you back near the same output as before the setpoint change.  The integral control then builds very slowly (because the process variable is below the setpoint) but there seems to be no response from the system.  Then when you increase the setpoint you get a large proportional response added to the integral output that had built up, causing some overshoot before the system settles down.

 

Have you looked at the response of your system in open-loop operation?  If you start from neutral output and then slowly either increase or decrease the output, do you see a smooth change in the process variable (this would be good) or large jumps (this is harder to control)?  Is there some limit on the range of your sensor, and when you're below that limit it reads some constant low value?

0 Kudos
Message 9 of 12
(6,861 Views)

Thanks for your quick response. see if you can download this one. I do have what I consider a large "deadband" in the valve that is about 1v to 1.5v around the "0" value. This is about 15% of the range. could this be causing my problem?

 

 

0 Kudos
Message 10 of 12
(6,857 Views)