Hi, I have a few questions regarding PID control. I am using a basic algorithm I found in wiki and here it is:
previous_error = 0
integral = 0
start:
error = setpoint - actual_position
integral = integral + (error*dt)
derivative = (error - previous_error)/dt
output = (Kp*error) + (Ki*integral) + (Kd*derivative)
previous_error = error
wait(dt)
goto start
So my questions are:
1.) Does the sum of kp, ki and kd have to equal 1? meaning should for example kp = .5, ki = .3, kd = .2?
2.) According to wiki, the system becomes stable if the oscillations decay. So if i have an array of inputs - say, 30, 31, 32,29,29,30,30,30,30. which of these set of outputs make a stable system
a.)0,20,40,-20,-10,10,0,0,0,0.
b.)0,20,40,-20,-10,10,1,-1,1,-1.
c.)0,20,40,-20,-10,6,-4,1,0,-1.
My guess is (c) since it is decaying to 0, but I'm not quite sure.
3.) Is the dt or time period supposed to also be found by experiments? or can it be any value? right now I'm using .05secs and .1secs as my dt. Are my dt too big or too small?
Thanks all