Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Fun with PID

Status
Not open for further replies.

itsmoked

Electrical
Feb 18, 2005
19,114
0
0
US
I have a 100W motor with a built in speed control.
It's hooked to a gear pump.
The pump outlet pressure is fed back via a pressure sensor.
I'm controlling the voltage going to the motor's speed controller with my PID.

I'm feeding a pressure profile to the plant.
With P at 1.0 and I and D zero'd I'm looking for about 100psi and the control system ramps up to about 40psi.

I add more P and the output slowly climbs to about 65psi at about a P of 8.

If I go much above 8.. LOOK OUT! It's a wild ride.

So I cranked back down to about P=6 and dialed in some I starting with 0.01. No observable improvement. As I crank the I up to 4.5 there is only a mild improvement like to maybe 72psi. If I turn up the I to 5.0? Run away!!
2lcpruf.gif


Further info:
I am sampling the pressure at 10ms and averaging 8 readings together.
Then running the loop at 80ms using the average.

I have no control over the motor's internal speed controller which is a 0-5V input. I'm not sure what it's control algorithm is or if it even has one. It may even be open loop.

Would a gear pump be considered a first order system?

What would be your next move on this problem? All thoughts welcome.

Keith Cress
kcress -
 
Replies continue below

Recommended for you

Gear pumps can generate pressure quickly. The pump itself produces flow nearly proportional to speed. The pressure it develops is dependant on the system that the oil is being pumped into.

What is the fluid driving?
 
An orifice would have a squared pressure/flow relationship. Across the orifice:

Delta P = k * (flow)^2.

The fluid will compress as it is pressurized so you do have a "spring/mass" system with a natural frequency. Is the pressure oscillating?

Does the orifice have a spring in it? Spring loaded valves can also become unstable with increase flow. Is there a pressure relief valve in the system?

Another possibility is reflected pressure waves in the oil at certain flow rates. I don't know the mechanism that causes that.

Any chance you can monitor the speed of the motor to see if the speed is acting as expected?
 
Linear. That's good.

No springs and no relief valves.



Thinking about this more...
I think I'm doing this wrong.
I'm essentially changing the setpoint each time I run a PID. It's going to have a horrible time controlling the result.

I think I need to see if I have the CPU time to run 8 PIDs between each setpoint change using unfiltered readings. Does this sound more likely to work?





I am manually creating the pressure profile then playing it back repeatedly. This would work fine in open loop except the orifice,(really a dense filter), has to change between replays. This is why I'm trying to control the pressure, to repeat the pressure profile.

Perhaps it makes more sense to just repeat the original profile with a closed loop integration that just adds or subtracts an offset that gets modified in the direction needed to correct all the played back values - as they play back.


Keith Cress
kcress -
 
Actually you were were proceeding on the right track with tuning your PID loop. With a fixed setpoint, increase the P until the system oscillates. Also record the oscillation period. The P value at oscillation is called Kmax and the oscillation period is called T. Then set:
P = 0.45 * Kmax
I = 1.2 * P / T.
After setting P you should see the system stabilize at a value less than the setpoint. Once the I gain is set, then the system pressure should slowly rise to the setpoint. If it does not then the I protion of your PID controller is not working correctly.
 
Your P=6 seems way too high to me, that's saying you need a 60% change in output to give you a 10% change in pressure.
To add to what "djs" suggests, put P at 1, turn the I off or very low, put the loop in manual and adjust the output so it's close then switch to Auto and play with P.
Is your Integral in Repeats per Minute, Minutes per Repeat or something else? If I'm not sure I set the gain at 1 then make a 10% change in setpoint or PV and time how long it takes to repeat the proportional error.
Good Luck
Roy
 
Greetings Roy.

Sometimes these numbers are a hash when you're writing your own controllers from scratch and they're feeding into a plant that has its own gains and turndowns. Scaling them to some logical(normal) level often causes a need for unavailable cpu time. What I'm saying is that 6 may not be 'six'. But I take you point about 60% for a 10% change.


As for repeats per minute.. I'm actually not sure.

I'm going to change the control algorithm to this, I-PD:

output = last_output
- K[sub]p[/sub][PV[sub]0[/sub]-PV[sub]-1[/sub]]
+ K[sub]i[/sub]T[err[sub]0[/sub]]
- [K[sub]d[/sub]/T][PV[sub]0[/sub]- 2PV[sub]-1[/sub]+ PV[sub]-2[/sub]]

T is 80ms

So Repeats per Minute doesn't compute for me.. I think this is what? 750 repeats per minute?







Keith Cress
kcress -
 
How often are you calculating your PID? That determines the scaling of the I and D gains. You need to somehow schedule the execution of the PID calculation at regular intervals. If you leave it free running then you will get inconsitant results depending on CPU loading.

For most applications, the D factor is nothing but a noise generator. It will amplify any noise present in you process variable (pressure) signal. The only time you really need it is to improve dynamic response to setpoint changes and loop distribustances.
 
Keith,
It seems like your integral may have way too much gain also, try checking it as I suggested in my previous. My gut feeling is it shouldn't repeat more
than 20-30 times per minute.

I once had someone explain proportional gain to me as the gain required to give the overall system a gain of 1
i.e. if you make a 10% change in valve position and the process changes 20% the gain should be set at 0.5.
If it only changed 5% then you need a gain of 2. I know this is pretty simplistic but I thought it was a good explanation.
Regards
Roy
 
If the formula given by djs doesn't work, it doesn't mean that the PID controller will not work. It may mean that the tuning method is na usable for your system. And if this would happen, then it would seem to me that your system is not first order and has a severe nonlinearity problem which would require a better tuning method.

Usually you determine first the value of your proportional gain P. Then the integral and derivative gains I and D can be calculated next, but will depend on the tuning formula. djs may have used a simple PID tuning method such as Ziegler-Nichols of Chien-Hrones-Reswick... I don't know. But if the formula doesn't work, try another tuning method.

If you still can't find the appropriate combinations of P, I, and D, the you may result to model-based design and identify the transfer function of your system.
 
Hi emmgonzalez.

I think my problem is many fold. The biggest is that the setpoint can change every 80ms. 80ms is the update rate! So just how is the PID going to average and logically differentiate to some final value when a new one is desired since the last one was provided. I have been able to tune my loop to look like any typical system when I ramp,(even rapidly), to various setpoints and hold them momentarily.


I am probably going to move to a converging offset algorithm.

Studying the system shows a very linear pressure change with orifice changes.

I'm seeing the same percentage of pressure drop with the same percentage of orifice change regardless of the actual pressure. This means that I can record the original pressure profile and on a point by point basis correct the play-back pressure with incremental pressure point analysis during the replay.

Keith Cress
kcress -
 
Hi itsmoked,

Yes definitely you can move to a converging offset algorithm.

Talking about PID, you can still use PID even if your setpoint changes every 80ms. If your PID is tuned properly, it will be able to handle your problem. It think one of the problems know is how will you tune your PID which I can't help you yet.

Let me help you on this one:

1. What is the unit of measure of your setpoint? Is it in voltage?

2. Is the difference between the pressure sensor output and the setpoint used as an input to your PID?
 
80 ms! Can you plant (motor and pump) respond that fast? How much is the setpoint allowed to change in 80 ms? If it it more than the motor can physically respond to then you will never get the system working.
 
emmgonzalez;

1) The unit of measure of the setpoint is a digitized value that, yes, is the voltage received from the pressure transducer. It's not scaled to anything in particular. It is what the original manual throttle generated in pressure.

2) Yes. That would be in the error term.

Hi djs!

I was surprised to. I happen to sample the inputs every 10ms and average them for 8 samples. I then generate the average on the eighth sample. This then triggers a PID calc on the 80ms point.

I had to guess response for tuning and I just guessed 80ms. When the tuning wasn't working too well the first thing I knew I had to check was that 'guess'.

I set up a digital scope with a single pass trigger. One channel is the output to the motor speed controller. The other is the actual pressure signal.

Instant fire-walling of the speed control shows the pressure change starting in about 79ms.

Setpoint delta is not constrained, but the original profile is human generated and so is not typically going to jump around or have discontinuities in it but will be swept changes likely taking around a second.



All: I am having a hard time seeing how a PID can ever work in this case. Because a change in setpoint is going to evoke a controlled response to reach the new setpoint. But before this response is complete or has even been seen a second time by the PID the setpoint can be changed again!

I considered running a PID every 10ms while allowing setpoint changes only every 80ms. This would allow the PID to run 8 times in an attempt to reach target. Except a system dead time of 80ms would seem to negate that to me.
Further the cpu is requiring 25ms to execute a PID which means I don't have enough time anyway.

I'm working on the offset playback scheme presently.

Thanks for the input folks.


Keith Cress
kcress -
 
If a 100% step change to the speed controller results in a small detectable change in 79 ms, then you are doomed from the start. To get a 80 ms response time, you would need the pressure change to be at least 50% 80 ms after the step input change. This is a fundamental limitation of your mechanical parts. There is nothing a control system can do to change it.
If you can, perform an experiment to determine the intrinsic response of the pump. Starting from 0% command, perform a 100% step change in command and see how long it takes to get to 50% pressure output. I would regard this as the minimum possible response time of your system.
You will then need to filter the setpoint to that response time or slower.
 
Interesting thread.

Is the nozzle open to atmosphere (I assume it is)? If it is, since a gear pump is a positive displacement pump and, as BobM3 pointed out, the system pressure is dependent on system resistance, you may not have enough system resistance to develop the pressure you desire (In other words, you may not be able to run the pump fast enough to push enough flow through the system resistance to develop enough pressure). You may have to control flow since you know the orifice characteristics are fixed.

A PD pump is a flow element, not a pressure element. An electrical analogy is the PD pump is a current source and all voltages are developed based on current (flow) through any resistances in the circuit.

One last thing, if you dead head a PD pump something will give, i.e., the pump casing, piping, etc. so some PD pumps have internal reliefs to prevent this kind of damage. Most well designed closed systems with PD pumps have a relief valve.
 
Status
Not open for further replies.
Back
Top