### PID control

greenspun.com : LUSENET : PID Controller Tuning : One Thread

We are having a friendly discussion in the Seattle Robotics group. The issue is does the PID set the Pulse Width Modulation (think of it as voltage) directly or does it tell how much to change?

In a car, if you want to change direction, you turn the steering wheel until the car is going in the desired direction. Then if there is no error the stearing wheel is straight (0) and the car continues in the new direction. Part of the plant portion of the car, makes it want to go at the last heading. There are no forces that want it to head to 0 degrees or north. So the plant part of the car has a component of heading[i] = heading[i-1] or the new heading is the same as the previous heading (if there are no outside influences). If a PID equation were to turn the wheel, then it would would look like Turn[i] = PID

In the case of a motor, to keep it consistant with the car example, if the motor is at the right speed the speed[i] = speed[i-1] therefore the PWM or voltage to the motor must be the same PWM[i] = PWM[i-1] (if there are no outside influences). This is all part of the plant.

With that discussion as the basis, does the PID equation adjust the plant up or down or does it set the input to the plant directly.

One arguement

If the motor is going the correct speed then the error is 0 and so PWM[i] = 0 // Direct output case -- the motor stops?

But if the motor (like the car heading) is set to go the same speed unless adjusted, then if the error is 0 then PWM[i] = PWM[i-1] + 0 the PWM does not change.

The major arguement is that in one case

PWM[i] = PID

The other it ends up

PWM[i] = PWM[i-1] + PID

I have seen it written both ways, and do not know if both are right or only one is right. Maybe it depends on the model being used. What is right?

Kip

-- Kipton Moravec (kip@kdream.com), March 22, 2001

There are 2 kinds of PID send the output to the plant. 1) Position Control Form m = error*(kc+1/s*I+Ds)+bias meaning that at each scanning the controller must recalculate the output regarding the error and past error, say assume the output m is now 44.0% and at next scanning time the error decrease, controller has to recaculate what the output m should be say 39.5% 2)Velocity Control Form Mn-Mn-1=error(kc+1/s*I+D/s) This velocity form is windely use in industry. The controller just calculate and implment the delta output move by based on the past output and just add up the ouput from last scanning time no need to recalculate the output again say. the past output is 40.0% then error decreased the output at present will be -0.5%--> Mn-Mn-1=40.0%-0.5%=39.5%. We call veleocity form. The controller just calculates the change in controler output for each scan period. The change will be added to the previous output to obtain the output (m) of the positional mode

-- Mongkol Janchookiat (mongkol@thaioil.co.th), June 25, 2001.

The so called velocity form of PID equation is correct. The so called positional form of PID equation is incorrect. This is because the control signal given by the positional form of PID equation is zero, which is usually not correct, as you have noted in your example.

However, even for the velocity form of PID, there are still three types: Type A, Type B, and Type C. For more detailed info please take a look at

http://bestune.50megs.com/typeABC.htm

-- Dan Liu (bestune@163.net), March 12, 2002.

what is Ti,Td,Kc,Ku,Pu

-- gohman alex (op09@walla.co.il), April 21, 2004.