LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pH control with solenoid valve

Hello everyone, I want to make pH control in biogas production. Many reference said that the optimum pH for biogas production is ranges from 6.8-7.4. I want to use acid and base reagent as an addition when pH value exceed its ranges. The problem is that I only have a solenoid valve (on-off valve) so I think I can't use PID or Fuzzy controller. Can you tell me how to make controller that suitable for this system?Thank You 😄

 

Regards

juventom

0 Kudos
Message 1 of 11
(6,160 Views)

I found some idea for this case (attachment), but the VI still has a problem. When pH value exceed the limit and exceed the limit time (t1) I want to make open valve time (t2) and mixer time (t3) undisturbed (must appropriate with state diagram) but the problem is when pH value (slider) return to allowed limit while in valve&mixer state, it immediately return to initial state (check pH value). Can you help me fix this VI? Thank You Smiley Happy

 

note: in this VI t1=5s t2=3s t3=3s t4=5s

 

Regards

juventom

 

Download All
0 Kudos
Message 2 of 11
(6,122 Views)

I found some idea for this case (attachment), but the VI still has a problem. When pH value exceed the limit and exceed the limit time (t1) I want to make open valve time (t2) and mixer time (t3) undisturbed (must appropriate with state diagram) but the problem is when pH value (slider) return to allowed limit while in valve&mixer state, it immediately return to initial state (check pH value). Can you help me fix this VI? Thank You Smiley Happy

 

note: in this VI t1=5s t2=3s t3=3s t4=5s

 

Regards

juventom

 

Download All
0 Kudos
Message 3 of 11
(6,122 Views)

Hi Juventom,

 

I believe the error in your codes' logic occurs because the outer-most case structures are defaulting to false after reaching the valve and mixer states which result in your state machine going back to the check pH value state before going to the wait for t4 state. You are definitely on the right track using a state machine for your system but you can further refine your system by integrating all of your cases in to one case structure. This way you do not need two different case structures for adding acid and adding base. 

 

Hope this helps!

 

 

Allison M.
Applications Engineer
National Instruments
ni.com/support
0 Kudos
Message 4 of 11
(6,090 Views)

Outer-most case structures (state 5) refer to "Wait for t4" state so both valve and mixer must off (both have false boolean). I think the problem is in the main case structure (true-false case structure) because if pH value not exceed the limit (false), both valve&mixer will switched off automatically no matter in what state that the ph value exceed. So how to make this false condition (not exceed the limit) only intended for state 1,2 but not for state 3,4,5?Thank You Smiley Happy

 

notes: State 1= Check pH Value, State 2=Check Exceed Time, State 3=Open Valve, State 4=Mixer, State 5=Wait

 

Regards

juventom

0 Kudos
Message 5 of 11
(6,072 Views)

Hi Juventom,

 

I think you need to separate your states as follows because the Acid Valve Open and Base Valve open are technically different states so this is my new list of states:

 

State 0: Check pH

State 1: Check Exceed Time Acid

State 2: Check Exceed Time Base

State 3: Acid Valve Open

State 4: Base Valve Open

State 5: Mixer On

State 6: Wait

 

I created the shell for your cases as seen in this picture. This will ensure that cases 3,4 & 5 happen in sequence and cannot revert back to State 1.

State 0.pngState 1.png

Allison M.
Applications Engineer
National Instruments
ni.com/support
0 Kudos
Message 6 of 11
(6,054 Views)

It looks my pictures did not embed properly. Please see the attached VI.

 

Regards,

Allison M.
Applications Engineer
National Instruments
ni.com/support
Download All
Message 7 of 11
(6,053 Views)

Hi Allison M Thanks for your idea :smileyhappy, it really works and I can solve this on-off control problem.

Now I want to improve this system so it will work like this:

1. The pH limit is also 6.8-7.4 (Setpoint 7.1)

2. Specify the Cycle Time (ex. 60s)

3. Cycle Time will influence ON time and OFF time of the solenoid valve

4. If measured pH still far from the limit then ON time will be longer than OFF time (ex. ON for 5s then OFF/Wait for 55s)

5. If measured pH closer to the limit then ON time will be shorter than OFF time (ex. ON for 1s then OFF/Wait for 59s)

6. No control occurs if the pH value is beetwen the limit

What control system should I use? Can I use PID toolkit to proportionally control the cycle time according to the measured pH and setpoint/pH limit?

 

Regards

juventom

0 Kudos
Message 8 of 11
(5,969 Views)

Hi juventom,

 

What kind of hardware are you using to acquire the inputs? You will have no issues using the PID toolkit to implement the improvements you mentioned in your post.

 

Best Regards,

Allison M.
Applications Engineer
National Instruments
ni.com/support
0 Kudos
Message 9 of 11
(5,937 Views)

My hardware is NI USB-6008. I use one analog input to acquire voltage change from pH sensor (voltage to pH conversion in labview) and two digital output to control base & acid solenoid valve. So how to implement PID toolkit to my system?Can I use PID.vi output (output percentage) directly to control my cycle time or there is another method to convert PID.vi output?ThanksSmiley Happy

 

Regards

juventom

0 Kudos
Message 10 of 11
(5,932 Views)