I am implementing PID control for motor speed control. In the specification I have been told to implement filtering technique using the following equation for D part. I am done with Implementing the PI control and it works perfectly fine for me.
Now what I understood so far is that s represents "dx/dt"
generally which corresponds to the rate of change of error but here i can relate it with rate of change of feedback. Td/N
is for limiting the all over gain output(hope i got this right). Now to represent this in terms of C code I tried with the following way.
s = (CurrentFeedback()-Old_Feedback)*100/(MaxFeedback()); //to calculate the % change in feedback
s = s*1000/sampleTime; //1000 is multiplied because sampleTime is in milliseconds
D = (Td*s)/(1+(s*Td/N));
D = D*KP; //Kp is multiplied as per the standard pid equation.
Old_Feedback = CurrentFeedback();
PID = P+I-D;
Well the results by adding D is not what I have predicted. I just want to know that ..did I implement the D portion equation correctly? Am I making in mistake in the understanding the basic maths of differentiation?
NOTE: I am not in liberty to change the recalculate the kp,ti,td as it comes directly from the VFD. Thanks a lot in advance. Sorry for the bad english.