Discrete math question - derivatives, integrals, and real time motor control applications

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RiTa_288331
Level 2
Level 2
10 replies posted 10 questions asked 5 replies posted

Greetings all!  This is a general question that involves engineering judgement (which I don't have a lot of in the field of motor controls).

1. In discrete math for a real time application, I might code a time derivative as:

y = (x - x[n - 1]) / T     Where x is the current ADC sample, x[n-1] is the previous ADC sample, T is the sampling period, and y is the "derivative"

Similar equation for an integral:

y = y[n-1] + T*x

2. There are more "accurate" equations than the ones above, for instance:

More accurate derivative:

y =    (4 / 3) * (x[n+1] - x[n-1]) / (2*T)   -   (1 / 3) * (x[n+2] - x[n-2]) / (4*T)

QUESTION:

Let's say I want to use the "more accurate" derivative equation in a 100kHz PWM control loop application (for instance, a dc-dc converter, or a motor control application).

The "more accurate" derivative uses an x[n+2] term, which means that whenever I use the equation, I'm always 2 samples "behind".  In the world of 100kHz real time applications, is this 2 sample delay a "big deal", or can I get away with it?

0 Likes
2 Replies
JobinT_31
Employee
Employee
50 solutions authored 25 solutions authored 10 solutions authored

Hi,

Are you trying to implement PID loop for motor speed control. These delays have effect and also the motor/circuit lag will introduce more delay in the system. A proper tuned PID can overcome this.

Thanks

Jobin GT

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

In my experience with PID control, the derivative term is usually unnecessary or diminished. In discrete math it is mostly a noise maker, for that it is not worth improving it with 4-point approximation. Furthermore, increasing sampling rate worsens derivative term accuracy to practically a noise level. I think that 10kHz sampling rate should suffice for a motor control, while 100kHz is not enough for DC-DC converter application.

/odissey1

0 Likes