NEWS
LinuxCNC 2.5.2 Release
There are no translations available.

LinuxCNC 2.5.2 Update Released (changelog).
 
LinuxCNC 2.5.1 Release
There are no translations available.

LinuxCNC 2.5.1 Update Released (changelog). If the Package Manager does not prompt you to upgrade see this page.

 
LinuxCNC 2.5.0 Release
There are no translations available.

New major release (changelog). See the instructions to update your system from EMC 2.4 to LinuxCNC 2.5.
 
Home Forum Hardware Driver Boards servo control: two PID loops or three?

Welcome, Guest
Username: Password: Remember me

TOPIC: servo control: two PID loops or three?

Re:servo control: two PID loops or three? 31 Lug 2012 10:03 #22641

  • djdelorie
  • djdelorie's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
  • Thank you received: 1
  • Karma: 1
For refefence, here's how the hardware works...

The chip is an RX/62T microprocessor, which has hardware specificlaly for motor control (the T series == extra timers). The third-generation multi-timer unit (MTU3) chains two 16-bit timers, three capture registers, and three other control/buffer register together to both track phase counts and measure speed. The speed portion works as follows:

There's a 16-bit counter that runs at a high MHz (2.5 MHz in my case). At each edge of one of the incoming encoder signals, the count value is copied to one of the other registers and then cleared. This means that other register always has the width of the most recent period, to whatever accuracy and range your clock allows.

At 2.5MHz and 16-bit counters, that means the RPM range is 70,000 RPM down to 1.1 RPM, with precision improving from 0.3% at 3000 RPM (my motor's top speed) up to 0.003% at 1.1RPM. With my 20 KHz inner loop rate, that means "one measurement per loop period" happens at 600 RPM. Note: for consistency, I pre-read all my measurements at the start of the loop and use the stored values, rather than re-read that register every time. Since the new PWM values take effect at the start of the *next* loop, that means I'm pretty much always one loop behind on the correlation between measurements and control output. Oh well. The ADC, RPM, and PWM measurements and calculations are carefully choreographed to fit within the PWM waveforms, since my hardware can only measure phase currents when the low-side PWM driver is on (er, Fairchild FNB41560 inverter chip).

Given that my control loop is always a loop behind, which is better? Always using the latest RPM and letting the motor's inertia (at 600+ RPM) do the averaging, or averaging some even-older RPM readings? (hypothetical question, since I can't change my hardware anyway) My opinion is that the hardware is accurate enough that the "noise" is really actual changes in RPM and I should just use the latest values, adjusting the master clock to get the precision I need at my common working RPMs.
Last Edit: 31 Lug 2012 10:05 by djdelorie. Reason: disable inline smileys
The administrator has disabled public write access.

Re:servo control: two PID loops or three? 31 Lug 2012 10:24 #22642

  • PCW
  • PCW's Avatar
  • OFFLINE
  • Moderator
  • Posts: 1651
  • Thank you received: 87
  • Karma: 116
Unfortunately this is not ideal since quadrature error will contribute a fair amount of error (say 5-30% every edge)

N/Tn or period averaging is better, that is its as good as it can be at low speeds and improves with higher speeds
Last Edit: 31 Lug 2012 10:25 by PCW. Reason: ommision
The administrator has disabled public write access.
Moderators: PCW, jmelson
Time to create page: 1.274 seconds
Powered by Kunena Forum
© 2013 LinuxCNC.org
Joomla! is Free Software released under the GNU General Public License.