About Arduino PID Library Issue

Hello,

I have some question and I would like to ask to who has idea about PID_V1 library.These lines are from this PID.

Code:

double input = *myInput;
double error = *mySetpoint - input;
double dInput = (input - lastInput);
outputSum+= (ki * error);
/Add Proportional on Measurement, if P_ON_M is specified/
if(!pOnE) outputSum-= kp * dInput;

  if(outputSum > outMax) outputSum= outMax;
  else if(outputSum < outMin) outputSum= outMin;

  /*Add Proportional on Error, if P_ON_E is specified*/
   double output;
  if(pOnE) output = kp * error;
  else output = 0;

  /*Compute Rest of PID Output*/
  output += outputSum - kd * dInput;

I could not understand the kd part. Why is not the Kd parameter error difference. As you can see, dInput is not error difference. Thanks for helping

double dInput = (input - lastInput);

doesn't dInput represent the change in the value of the input from the preceding value? only the proportional term is calculated from the difference between the target and current position

In theory, dInput is the time rate of change of input, and that should include a term for the input sample rate. Sometimes that is included in the Kd value.

One of many tutorials on PID.

For the PID_v1 library the sample time is a constant so scaling is not needed.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.