On Thursday 05 July 2012 08:42:02 andy pugh did opine:

> On 5 July 2012 05:18, Jon Elson <el...@pico-systems.com> wrote:
> >> Rollover is a non-issue within the lifespan of most machines
> > 
> > Not necessarily.  Assume 3000 RPM and a 1000 cycle/rev encoder. 
> > Typical 24-bit
> > encoder counters will roll over on a bit over a minute (16 mil/12
> > mil). That gets overflowed to 32 bits, so it would take 358 minutes
> > to overflow the 32-bit count.  I think all the encoder counters on
> > LinuxCNC currently use a 32-bit count internally.
> 
> Having checked, it seems you are correct.
> 
> The software stepgen uses 64-bit accumulators, and the Mesa Resolver
> module uses a 64-bit accumulator too.
> For some reason I thought all the other encoder-like functions were
> using 64 bit internal representation. I can't help feeling that they
> ought to.

Probably.  But at what cost in time used?  Enough of this hunt for 
perfection and the code begins to bloat and slow.  On this box its largely 
moot as it is a 64 bit box, but...

> The software stepgen holds position data in a floating-point (double)
> representation which will lose precision rather than wrap as the
> counts increase as long as the 32-bit counter wrap is handled
> carefully. I think I worked out that it would take an awfully long
> time for the encoder position to become significantly innaccurate.
> (assuming that we want a position accuracy of 0.0001" and a float has
> 15 places of decimal precision, then the notional axis can travel
> 10^11 notional inches before not being able to represent 0.0001". At a
>  travel rate of 1000 in/min that is 190 years.

I'm not inclined to push the panic button. The machine will have worn 
itself out to a lot more slop than .0001" long before that.  Shrug.

> My initial impression is that the software encoder does not handle the
> wrap as well as it might. It probably ought to add delta_counts *
> scale to the position, not recalculate the position from total counts.
> The magic of twos-complement means that calculating deltas on signed
> integers handles the wrap automatically.

Humm, but what happens when 'scale' is itself a floating point value?  My 
ancient mind says there will be a visible loss of precision at the rollover 
point.

I'll get me coat.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
Put cats in the coffee and mice in the tea!

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to