0% found this document useful (0 votes)
79 views

PID Tuning

The document discusses PID tuning and PID implementation. It describes two main methods for PID tuning: 1) Ziegler-Nichols Method and 2) another unspecified method. It then discusses several concerns for PID implementation, including using a regular sample time, removing the derivative kick, enabling on-the-fly tuning changes, mitigating reset windup, enabling on/off functionality, ensuring bumpless transfer during initialization, and ensuring the correct sign for tuning parameters. It provides sample PID implementation code that addresses some of these concerns, such as only running the PID calculation if enough time has passed since the last sample time.

Uploaded by

Valo Ram Serr
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views

PID Tuning

The document discusses PID tuning and PID implementation. It describes two main methods for PID tuning: 1) Ziegler-Nichols Method and 2) another unspecified method. It then discusses several concerns for PID implementation, including using a regular sample time, removing the derivative kick, enabling on-the-fly tuning changes, mitigating reset windup, enabling on/off functionality, ensuring bumpless transfer during initialization, and ensuring the correct sign for tuning parameters. It provides sample PID implementation code that addresses some of these concerns, such as only running the PID calculation if enough time has passed since the last sample time.

Uploaded by

Valo Ram Serr
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

PID Tuning

1st method:
Ziegler-Nichols Method
Ziegler-Nichols Method (cont)
2nd Method:
PID Implementation
output_type PID(kp,ki,kd){
get current time
deltaT = last time - current time

compute:
current error = desired state - measured states
error sum = last error sum + (current error * deltaT)
error derivative = (current error - last error) / deltaT

output = (kp * current error) + (kd * error derivative)
+ (ki * error sum)

last time = current time
last error sum = error sum

return output
}
From: http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction
Sample Time - The PID algorithm functions best if it is evaluated at a regular
interval. If the algorithm is aware of this interval, we can also simplify some of
the internal math.

Derivative Kick - Not the biggest deal, but easy to get rid of, so were going to
do just that.

On-The-Fly Tuning Changes - A good PID algorithm is one where tuning
parameters can be changed without jolting the internal workings.
Reset Windup Mitigation -Well go into what Reset Windup is, and implement a
solution with side benefits

On/Off (Auto/Manual) - In most applications, there is a desire to sometimes
turn off the PID controller and adjust the output by hand, without the controller
interfering

Initialization - When the controller first turns on, we want a bumpless
transfer. That is, we dont want the output to suddenly jerk to some new value

Controller Direction - This last one isnt a change in the name of robustness
per se. its designed to ensure that the user enters tuning parameters with the
correct sign.
PID Implementation Concerns
PID Implementation Concerns - Sample Time
define desired sample time

output_type PID(kp,ki,kd){
get current time
deltaT = last time - current time

if (deltaT >= desired sample time){

compute:
current error = desired state - measured states
error sum = last error sum + (current error * sample time)
error derivative = (current error - last error) / sample time

output = (kp * current error) + (kd * error derivative)
+ (ki * error sum)

last time = current time
last error sum = error sum

return output
}
else {
don't do anything
}

}

You might also like