PID Control Algorithm

Hi,

I read a lot about these PID Algorithms and i wonder now if my approach is totaly wrong.

I just have a P-only controller and the error between SP (SetPoint) and PV(PorcessVariable)
is everywhere listed as

error = SP - PV
value = Kp * error

I know you can tune the Parameter that it is not oscillating but it is a pain.
My try is to calculate a procentual value of the change

value = SP / PV * value

This is working really well and i wonder why it isn´t used or even mentioned.
Is this a complete wrong approach ?

regards

This is working really well

Post your code so that we can see how well it works.

Pete

well.. i did post it :slight_smile:

this is a P-Controller, so nothing that magical...

just give it a SP of 500
and a PV as an analog input.

send the value to an digital Potentiometer on the analog input

tdrat:
This is working really well and i wonder why it isn´t used or even mentioned.
Is this a complete wrong approach ?

It's not completely wrong. There are lots of different control algorithms that work well in different situations. Which one works best usually depends on the characteristics of the system you are trying to control. The more inherently stable your system is, the easier it will be to control it. If you have a system without any inherent inertia or delay, as yours is, all you need is a form of successive approximation - the 'integral' component of a conventional PID, and that's what your algorithm provides. When the inertia and delay become more significant, you'll find you need some form of derivative feedback to damp the system down. The PID algorithm is one of the most generally useful algorithms, which can be tuned to work well in a wide variety of situations, but it's not the only one.

If you're trying to understand how to tune a PID system, then I find it helps me to visualise it in terms of a simple mechanical system such as one corner of a car suspension system.

The 'proportional' element corresponds to the spring. As you apply more weight the spring will sag until it can support the weight.
The 'derivative' element corresponds to the damper. If you don't have enough damping, the system will tend to overshoot and oscillate. Typically, what you're aiming for is just enough damping to prevent the system from overshooting. This is termed 'critical damping'. The more damping you add beyond this, the more time the system will take to settle to an equilibrium.
The 'integral' element corresponds to a load levelling system. After the spring has sagged, the load levelling system will slowly return the system to its original position.

Yes, the PID control strategy allows for three control elements the P, the I, and the D. The P proportional is always enabled and it's tuning variable is adjusted for the system being controlled. The I and D elements are optional depending on the properties of the process being controlled. By adjusting the tuning elements for the I and D to zero you are effectively eliminating them and utilizing P only. Your program is just implementing simplistically the P only portion of a more complete PID algorithm. So while your specific requirement may be able to work OK with using P control only, it's not a good general purpose solution that would be usable for a more general purpose control solution. So nothing wrong with your approach, but it just lacks the ability to scale to other uses.

In the refinery I worked at before retirement we had thousands of control loops, only a very few used P only control, the majority utilized just P and I control variables and many used full PID elements. The physical process being controlled determines what control elements should be used and what the tuning values end up at.

Lefty

I'm using a jrk controller from Pololu that has a nice PID control interface. You can tune the P, I and D separately. For my application, I found that P alone works very well, but P and D works best. I get too much oscillation with any I, so I don't use that.

It seems like the only way to control a system is to manually tune it trying all of P, I and D. That you got good results using one alone means a lot for your application. But to think that other applications will get the same results may be a little naive.

Thank you for your valuable answers.

After reading a lot it is most important to match your needs to the System controlled.
I have some Problems getting a real PID Algorithm to work properly but i have to tune the values a little bit more.

Is there a name for a Controller who does not take the difference but the Fraction like my Formula ?
I don´t seem to find a specification name for it.