PID Loop question

tgaljar

Member
Join Date
Apr 2006
Location
Virovitica
Posts
69
Hi guys,



I have one question about PID loop. I am doing system that controls flow of water and it consists of flow meter (has output 4-20mA) and valve (has output which shows % of opening and three inputs OPEN, STOP and CLOSE).

So I have decided to use PID function to calculate desired percentage of valve opening. Input to PID is flow and I am scaling output to 0-100%.

Than I am subtracting PID output of current scaled output of valve and if result is negative valve goes into opening and if it is positive valve goes to closing. Valve is stopped when difference between PID output and current output are almost equal (+/-2%) and that means flow is around 25l/s.



My questions are:

Do I need to scale input value of flow as “scaled for PID”?

Can PID scale output to 0-100% or I need to use scale function?

Flow is 25l/s and valve needs 1min from open to close do I need to calculate PID output every PLC scan of once in second is enough?

AND IF THIS IS NOT GOOD IDEA DOES ANYONE KNOWS BETTER?



My problem is also that I don’t have PLC just a simulator (which doesn’t simulate PID) and I want to be sure that this will work in a real plant!



Thanks!
 
So I have decided to use PID function to calculate desired percentage of valve opening.
Just curious,
How are you doing this? (using pressure feedback, or calculate from the piping design, etc.)

Than I am subtracting PID output of current scaled output of valve

This I don't understand. Please explain or draw a control system diagram and post.


This is what i suggest:

You said that you can compute the expected valve position for your particular flow. This is the best information. Use it by first setting the valve to that position. Then wait for the valve to get there, this can be up to a minute as you stated. Once in position start the PID using the expected flow as the setpoint and the actual flow as the feedback. If your PID will drive the valve directly then you should just use I, no P or D.

Your suggested scan time of 1 sec. maybe too fast. Your time constant will be the time to nudge the valve plus the delay in the flow sensor recognizing the new flow. This may be as long as 3 sec. or longer. This will be a slow control loop.

 
OK I draw small diagram of my PID loop.



Valve gives me information about its position by current output (4-20mA). But valve doesn’t have input so I can’t drive him directly.



Gerry M, jour idea is not bad but I need to put valve in some position before I start PID. That is wasting of time if PID and two comparators can do everything (I hope so).



What about “scaled for PID” do I need to do this?
 
Last edited:
Hi, Tgaljar.

As Gerry M said, I also do not understand why you subtract PID output of current scaled output of valve. Can you give us a explain? And is there any disturbance of your process?

For a general routine, you need a AI module which can convert the 4~20mA signal into a raw value, then you need to scale the raw value into the engineering value and transfer it to PID_PV. For PID_output, it is always a value from 0~100%. When this output is used to drive a valve, usually you need to scale it back to a ran value, then move it to the real AO module.
Weather you need to use the Scale function or not, depends on which plant form you are using. In RSLogix5000, the PID has integrated the scale function. But for your usage, I don't know.
 
The process will determine if you can scale the PID output from 0 – 100%. You need to know if a 1% change in the valve’s setting will allow you enough control. In most processes I have done a 1% change in the valve’s position is too great to offer any control.

For the valve control I would take the PID output and compare it to the valve position. Then open or close the valve to make the valve position match the PID output. This is done in separate logic.
 
Now I get it. I would still not use the actual valve pos. quite that way.

Error = Flow Setpoint - Flow Actual

PID output = PID x Error

If PID output > 0 then open the valve,
If PID output < 0 then close the valve.

The PID output represents the change in the valve position, not the actual valve position. So the sign of the PID output determines which way to move the valve.

But for how long do you pulse the open or close outputs to the valve?
This should be calculated using the magnitude of the PID output, the actual valve position, and the one minute actuator rating.
You also need to consider the delay between the valve postion movement and the corresponding change in flow feedback.

My comments regarding presetting of the valve using expected flow data is faster, not slower. If you do know of a good starting position for the valve then you should use it, then let the PID take over to adjust for any offsets. The PID alone will be slower.

In most processes I have done a 1% change in the valve’s position is too great to offer any control.
Good point regarding controlability. I assumed that was already accounted for. Never assume too much or it'll make you look like an ##$%@.(
##$%@ is right in the word 'assume' just to remind you)
 
Last edited:
Error = Flow Setpoint - Flow Actual

PID output = PID x Error

If PID output > 0 then open the valve,
If PID output < 0 then close the valve.

Gerry M, why should I multiply PID output with error if I afterwards just testing the sign +/-. The sign of error will always determine the sign result of multiplication. PID output doesn’t have any effect. Or I’m wrong? What are the inputs to PID?


But for how long do you pulse the open or close outputs to the valve?

I will try not to pulse commands to valve. First I’ll try to give continuous command to valve until error reaches almost zero. Than valve will stop its movement. This should be very slow process.

 
The Error is the input to the PID. You are correct about the sign it simply determines open or close.

I was suggesting using the PID Output to determine the length of the pulse.


There are also stand alone controllers to do this same thing, rather than using a PLC if that would work for you.
 
tgaljar
I don't know why you are even using PID for this. It seems all you really need is to compare the flow to the target and if the flow is greater or less than than the target by a deadband amount (2% in your notes) you close or open the valve until the value is within your tolerance. You can add manual mode for open and close if you wish. You are not trying to control valve position here - you are trying to control flow. The valve should be moved to give you the correct flow not to a particular position. You can use the postion feedback to limit the opening or closing and also to alarm if the valve does not move even though asked to if you want to do something elaborate.
If the deadtime between moving the valve and seeing a flow limit is long you may need to pulse the open close outputs to allow for the flow signal to be read before overshooting the target.
 
Thanks John M your ideal looks better than PID loop. Now I've deleted my code with PID and done like yours. I’m opening valve for 2 sec and after I have pause of 2 sec for flow to settle. Than am checking error between setpoint and actual flow and according to that deciding where will valve go in next 2 seconds. If a flow error is inside of +/-2% deadband I’m doing nothing.
 
We have a hot water boiler system at work and the main mixing valves are controled with PID and analog outputs. Each valve is tested weekly and timed, the time it takes the valve to open is inputed into the PLC. So the postion of the valve is timed based. So it can work this way.
 
As you have valve position, use 2 PID loops, 1 for PV = flow that has a CV = valve position and 2 for valve position PV= position and convert CV to a open/close pulse width modulation.
 

Similar Topics

Good morning guys, I have a machine that fills bags of prepared food at a variable speed, and a machine that checks the weight of the bag. What...
Replies
23
Views
6,804
Thanks in advance to all who read this. The PID I am looking at controls the injection of ozone into the water just before it goes into our...
Replies
7
Views
7,226
Hi all I've just been fiddling around with the PID loop in an S7 313C , using the Function block CONT_C FB41. My question is should I be calling...
Replies
15
Views
7,759
Hello, I am attempting to tune a PID loop on a process. The process involves a valve with electronic actuator that has quite a high deadband...
Replies
10
Views
2,155
We have a PID loop at the plant that measures our drum outlet temp. It adjusts a damper to control the temp within the set point. We have a...
Replies
8
Views
1,410
Back
Top Bottom