LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need instruction in PID control

Hi,

I'm doing a project which needs a simple PID control. The main purpose of this project is to maintain sample's pH at a certain preset pH by injecting base or acid. We choose a preset pH at the beginning, and a pH meter keeps reading pH from the sample. LabVIEW program starts comparing two values and then injecting base or acid. For example, if the preset pH is 5.0 and the sample's current pH is 4.0, base starts being injected to the sample until the current pH equals to the preset pH.

The thing is, I want to add a simple PID control into this program without using NI's extra PID toolkit: if the difference between preset and current pH is quite large, the program can automatically speed up injections. Furthermore, injections slow down when current pH comes close preset pH. I think this kind of PID control is pretty easy and common.

I have been doing some research on general PID control system but not that clearly so far. It seems that I need a proportional part and a derivative part at most if this program doesn't require too much complexity. However, the question is, what is my first step doing this? Do I need to find out a transfer function of base/acid controller and how to find it out? I'm kind of confused when it comes from theory to real application.

Actually, I've come out another not-that-sharp approach without following the fixed PID algorithm. Firstly, I select a basic injection rate of 1X (1 time). If the pH difference is not quite large (ex: below 0.2), we keeps the injection rate at 1X. Otherwise, the injection rate starts at 5X until the difference comes to 0.2. When the difference is becoming quite small (ex: 0.05), the rate is down to 0.5X to make overshoot as small as possible. Well, this way is kind of dull.

Can anyone give me any instruction and hint? Thanks!! 😄


Scottie
0 Kudos
Message 1 of 7
(3,030 Views)
Sounds like you have the basic idea of Proportional control, and an idea of Derivative. You didn't mention the "I",which is Integral. Also, PH is one of the more difficult process properties to control with precision, largely because the PH measurement scale is logarithmic, not linear. This requires either compensation for the non-lineariity at the measurment side, or as is more commonly the case, at the output of the PID device. A detailed discussion of the control of PH is beyond the short scope of this type of discussion forum. My advice to you would be either to study-up on PH, and chemical neutralization methods and characteristics, or better, change to a linear process. You have chosen a rather difficult row-to-hoe.

Good luck,
Dave
0 Kudos
Message 2 of 7
(3,028 Views)
Scottie wrote:
“Actually, I've come out another not-that-sharp approach ... . Well, this way is kind of dull.”

It may be dull, but that’s pretty well how the several stand-alone pH controllers that I’ve got kicking around work ... and they do work for the systems I deal with. It’s also how I programmed pH control by old PLCs a few times in the last century when all the standalones were tied up. The cautions that Dave raises above are good ones, but a lot depends on the details of your process/”sample” and your requirements.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
Message 3 of 7
(3,007 Views)
Hi Dave,

Currently I'm on the stage of building PID control. I use built-in "simple PID" structure from one of LabVIEW6.1 examples. As you said, pH measurement is logarithmic, not linear; this requires a compensation. I have tried both kinds of value representation to run this PID: pH value type(4.50, 5.00, etc) and logarithmic type(10^-4.5, 10^-5, etc). Using pH value type works fine, but I think it lacks real "PID's essence". However, using logarithmic type would result in generating quite strange PID outputs due to its logarithmic characteristic. Can you kindly explain what the compensation you meant at the output of the PID device? Besides, what is what you said "change to a linear process"? Any information would help. Thanks in advance.


Regards,
Scottie
0 Kudos
Message 4 of 7
(2,926 Views)
"Any information would help."

Scottie,
A couple of examples of compensation strategies for pH non-linearity on the measurement side can be found here and here.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 5 of 7
(2,897 Views)
... and what Dave may have been referring to in his mention of nonlinear compensation "at the output" is the fact that the control valves frequently used for acid/base addition are often nonlinear (i.e. their output flow is not exactly linear in relation to the input current) and therefore conditioning is required. Another example from the web, this time dealing with both input and output compensation, is here.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 6 of 7
(2,866 Views)
Donald,

I'm trying to absorb those articles. Thanks for helping.


Regards,
Scottie
0 Kudos
Message 7 of 7
(2,860 Views)