01-16-2019 10:12 AM
Hello,
I am having some difficulty figuring out how to use a PID loop in order to control the pressure and angle that the valve should be at in order to maintain a set point pressure. I have been through the tutorials and examples online and haven't quite wrapped my head around how I can accomplish this. If anyone can help it would be very appreciated. Attached is valve attempt which contains the main program and baratron with usb 6003 which is a subvi used within the the main program.
01-16-2019 01:21 PM
Does anyone have any ideas?
01-16-2019 02:09 PM - edited 01-16-2019 02:11 PM
Hi mjacsouza,
figuring out how to use a PID loop in order to control the pressure and angle that the valve should be at in order to maintain a set point pressure.
There is no PID in any of your loops!
Why do you need to create a DAQmx task and delete it with every call of the subVI?
Why do you need to use BytesAtPort with that serial communication? (That's wrong nearly all the times!)
What is that broken comparison part in the main VI?
Why is there a race condition with those serial port settings in the main VI?
What have you tried to include the PID function from LabVIEW?
Why do you need to create an array of 1000 elements of the same value in your sub VI? Why not use InitArray instead? Why use an array at all when a scalar value would work the same way? (Ever heard of polymorphism?)
01-16-2019 02:16 PM
@mjacsouza wrote:
Does anyone have any ideas?
Yes.
First look around for some tutorials on LV. There a lot of things in your code that indicate the tutorials can help; Now for some specifics;
That seq structure is not doing what you thing. If you watch the code in execution highlighting (turn on the light bulb and watch the code in slow motion) you will see you read what in the FP and use that to set your VISA session and THEN you over-write what was in the control to start with.
I have NEVER seen a floating point value that was EQUAL to a constant. EQUAL is a myth when doing floats and real world measurements. Instead look for InRange.
Using a compare on a string datatype will give you an "EQUAL" if the string is exactly the same. But "Greater than" (makes my head spin thinking about it ) will only happen when the string that you are testing is latter in the alphabet. Do you compares on the numeric value not the string.
Watch you code in slow motion and keep watching it until you can predict what happens in what order and watch were things do not go as you intend.
SO those are my ideas.
Take care and have fun!
Ben
01-16-2019 03:05 PM
Hi GerdW,
I just wanted to say thank you for replying and helping me out. The deleting of the daqmx every time was due to me writing the program to see if the part i bought would work with the pressure transducer. Once i saw it did i just unwittingly changed it into a subvi without double checking the code. I have one more question for you though, where is the race condition in the main program?
01-16-2019 07:38 PM
I have only one request for you... PLEASE SAFETY FIRST. If you play with pressure controlled automatically, ensure that you have hardware protection in the case your software get stuck at maximum or minimum pressure... You can kill someone.
I strongly suggest you to play with PID on something inoffensive like incandescent light and a digital thermometer.
Once you master you PID loop and Tuning method, then you can try on the real hardware.
If you do mistake in your software it's better to kill an incandescent lamp than a system that cost a lot or even worst: LIFE
Benoit
01-17-2019 01:03 AM - edited 01-17-2019 01:04 AM
Hi mjacsouza,
where is the race condition in the main program?
Here is a race condition:
Which settings will be used? The one made in the control or the one written to the local of the control?
Solution: Set suitable default values in the "serial settings" control and get rid of that whole sequence frame!
01-17-2019 01:08 PM
hello all,
I am trying to get this valve to work for some time now and have run into issues. The valve and pressure transducer are hooked up to a vacuum pump. What I am trying to accomplish is the valve to close to a certain angle that will hold a pressure around 200 Torr. The DAQ assistant is going to a USB 6003 which is reading a 0-10V signal from the pressure transducer. The pressure transducer reads 0-1000 Torr. What was happening is the valve kept shutting all the way and then jumping back open to an angle around 13 degrees when I actually ran it with the vacuum pump. Without the vacuum pump the valve works pretty well at holding a certain pressure.
01-17-2019 07:13 PM
1- Do you understand PID how it works?
2-Can you read the VI PID documentation?
3-You answer is in the VI documentation.
4-If you still didn't get it, what about dt?
5-If you still don't get it, Stay far from your system... because it will kill you. llol
Benoit
01-18-2019 01:26 AM
Hi mjacsouza,
more questions:
- Do you know the difference between Mean and Median?
- Why do you use a Pt-By-Pt function to calculate the median of a waveform (hidden in a DDT wire)?
- Do you knw that using BytesAtPort is ALMOST ALWAYS WRONG?
- Is there a reason to round a pressure reading to integer numbers?
- Do you know the influence of such "signals with steps" on PID controllers?
- How did you determine the PID gains?
- Did you determine the influence of your vacuum pump on your control loop?