LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with converting PID output to actual valve position

 

Hi

 

 

First, I am sorry for the stupidity of this question (I assume many of you will find it simple) but I am unable to get it working. I have a larger VI to control a vacuum system and testing chamber, the last part to completing it is being able to control a valve's position between 0 degrees "closed" and 90 degrees "open" (which in turn controls the pressure in my chamber). I am only basically fimilar with PID control but do understand the basics. My starting point was the "General Auto PID Simulator" VI. I understand the input to PID is the error between set-point and actual value and how the output is the +/- percentage on 100% scale.

 

Now my problem is that I am unsure how to take this ouput (+\-percent change from PID controls) and transfer it to the actual valve position. What ends up happening is I always have a problem once I get close to the set-point, my code either keeps trying to drive the valve output to zero (once it gets close to the set-point) or it tries to drive the output to inf (which I max at 90). 

So lets say for example to meet the set-point my valve should be open to 75 degrees. How do I use the PID output to actually drive the valve to that 75 degrees and keep it there (not drive to 0 or 90 once it gets close to the set-point value).  

 

I am attaching the basic example VI which I used as my start (After all my tinkering, my version is not a good starting point any more). I will provide any other info if this was not clear or you need more details to help me.

Thank you very much and I greatly appreciate your help with this. 

 

Jason

0 Kudos
Message 1 of 4
(3,092 Views)

Hi Jason,

 

So lets say for example to meet the set-point my valve should be open to 75 degrees. How do I use the PID output to actually drive the valve to that 75 degrees and keep it there (not drive to 0 or 90 once it gets close to the set-point value).

The question is: how is your valve controlled? How do you output your "75 degree" value to the valve?

How to you actually drive your valve?

 

Note: I usually use the PID.vi or the AdvancedPID. AutoTuningPID is just for experimental usage or at setup stage IMHO…

 

Example:

Let's assume your valve is operated by a voltage signal of 0-10V, representing a range of 0 to 90 degree. Then you have two options:

- set the output range of the PID to [0, 10] and output voltage directly (making it a little bit harder to read the degree value from output signal).

- set the output range to [0, 90], using "degree" as unit. Then you can display the current output signal in an indicator to read it, but you would need an additional convertion from engineering unit (your "degree") to voltage. For this example it's just a multiplication with "1/9"…

I prefer the first method for simple setups and the second one for more advanced setups/programming. You just have to adapt the PID gains when switching between both options…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(3,041 Views)

 

Hi GerdW

 

Thank you for your response. That was a good point you brought up, I actually send my valve RS232 commands to set the output state/degree. 

I also agree with you comment about the PID.vi "Auto". I was using that (as a testing platform) because my actually code that this PID contol goes into is very large and complex and not sutable for posting and having other people try to find the problem area.  

 

However you may have caused me to think of the problem, because how I had the PID controls set-up in my code was how you described in your response( changing output to 0- 90).

I may have had a problem running this part of the code too fast for my RS232 comms to keep up, so it may have been updating with the same value several times in a row driving the PID response either to zero or maximum.  

 

Thank you very much for your helpful advice. 

 

Jason

 

0 Kudos
Message 3 of 4
(3,023 Views)

Hi Jason,

 

I may have had a problem running this part of the code too fast for my RS232 comms to keep up, so it may have been updating with the same value several times in a row driving the PID response either to zero or maximum.

Running the PID (much) faster than the actuator can respond is not the real problem: the PID parameters (aka gains) need to be set to meet the requirements of your control loop…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 4
(2,996 Views)