This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28388D: About the PID Controller in the pid_grando.h of the C2000Ware_MotorControl_SDK-3.02.00

Part Number: TMS320F28388D

Hi Master

i am tunning the PID Gain on the speed control base on the f2838x  Example Code

runPID () function in the pdi_granddo.h

A little question is the derivation term 

the follow code is original source 

===============================================================================

// derivative term
in->data.d2 = in->param.Kd * (in->term.c1 * (in->term.Ref * in->param.Km - in->term.Fbk)) - in->data.d2;
in->data.ud = in->data.d2 + in->data.d1;
in->data.d1 = in->data.ud * in->term.c2;

===============================================================================

but there is a little difference with general derivative term 

the follow figure is that I thought of the following differentiation model

so modified the code to follow

(in->data.d0, in->data.d01 is added to store the previous d0)

===============================================================================

//in->data.d2 = in->param.Kd * (in->term.c1 * (in->term.Ref * in->param.Km - in->term.Fbk)) - in->data.d2;    // comment

in->data.d0 = in->param.Kd * (in->term.c1 * (in->param.Kd * (in->term.c1 * (in->term.Ref * in->param.Km - in->term.Fbk))));

in->data.d2 = in->data.d0 – in->data.d01;

In->data.d01 = in->data.d0;

in->data.ud = in->data.d2 - in->data.d1; (change  d2 plus d1 to d2 minus d1)   ====> ud[n]=d2[n]-c2∗ud[n-1]

in->data.d1 = in->data.ud * in->term.c2;

===============================================================================

would you tell me my opinion is correct or not ?

thank you. Master