Latency understanding?

More
06 Feb 2011 18:04 #7027 by greeder88
I'm a little befuddled about latency issues.

When setting up several computers to find the best one for emc2 I have run in to a dilemma.
One has better latency but spikes way too high at the start of the test yet settles in low after reset never to spike again.
The other computer is higher but never spikes.
Which one is better?

The other thing that puzzles me is if a computer has 6,000 Max Jitter and another has 12,000 does the lower one move around a circle twice as fast?

Thanks for any enlightenment,
George

Please Log in or Create an account to join the conversation.

More
06 Feb 2011 22:52 - 06 Feb 2011 22:56 #7032 by cmorley
Replied by cmorley on topic Re:Latency understanding?
Which one is better?
The question you should ask is which one does the job you require?
if you are using software steppers, then latency limits your max step speed.
Does the higher latency computer still give you enough step speed? If not then it's not the best choice.
As far as the big spike on startup, I have heard of other people using a computer just fine with the same problem.
I would want to do a lot of testing to make sure that what you say is true. (only on first start up).
If you are not using software steppers (eg using Mesa or PPMC boards) then latency is less important ( at least to a point)

latency is a measurement of how long it takes the computer to stop what its doing and service a realtime event.
realtime is not about speed of execution, its about doing things on time.
A faster ( as in MHz) computer with the same latency as a slower computer gives more time for the computer to service non real time events such as the
GUI. You'll find if you set the base thread of a computer too high that the computer is sluggish to respond to user input.
a faster computer should help as well as lowering the base thread.

Hope that helps
Chris M
Last edit: 06 Feb 2011 22:56 by cmorley.

Please Log in or Create an account to join the conversation.

More
07 Feb 2011 11:35 #7043 by andypugh
Replied by andypugh on topic Re:Latency understanding?
greeder88 wrote:

The other thing that puzzles me is if a computer has 6,000 Max Jitter and another has 12,000 does the lower one move around a circle twice as fast?


Potentially it might, but in practice probably not.

A computer with lower latency can run the base thread more frequently. If you are using software step generation then this means a higher peak step rate.
However, it is quite uncommon for step rate to be the limiting factor. A typical stepper really struggles to get over 3000rpm under load (and, in fact, might not manage 1000rpm in many cases). With 4x microstepping and 200ppr motors, that's a peak step frequency of 40kHz. 40kHz is 25,000nS. So, any computer with a latency of 20uS can probably drive most steppers as fast as they are capable of running.
Of course, going to 8x microstepping changes this somewhat, but I am unconvinced of the benefits of 8x or higher microstepping.

Please Log in or Create an account to join the conversation.

More
07 Feb 2011 17:40 #7052 by step4linux
andypugh wrote:

With 4x microstepping and 200ppr motors, that's a peak step frequency of 40kHz. 40kHz is 25,000nS. So, any computer with a latency of 20uS can probably drive most steppers as fast as they are capable of running..


hi Andy,
I would not agree to the conclusion. With 20 usec latency(jitter!), you would need a BASE_PERIOD of 5 usec, to guarantee a puls rate of 40 kHz at any time. But with 20 usec latency, 5 usec BASE_PERIOD is also not a good idea.
I believe, you will at least have to double the latency time to calculate the max puls rate. So a pulse rate of 40 kHz would require 12.5 usec latency maximum theoretically (probably even less as safety margin).

Gerd

Please Log in or Create an account to join the conversation.

More
07 Feb 2011 18:55 #7054 by andypugh
Replied by andypugh on topic Re:Latency understanding?
Something I have never understood is that it seems normal to set the base period equal to the jitter. It might be that the latency test adds a factor, I am not sure.

I would also expect to have to consider the thread execution time, but that seems to be ignored.

For what it is worth, I have run a servo thread (no base thread) at 100uS with a 110uS execution time, and no errors were raised. I do have one core of the CPU dedicated to realtime, which perhaps helps.

Stepgen can manage one pulse per thread execution if reset is enabled. I don't know if your calculations assumed that or not.

There is also the point that if this hypothetical stepgen is running at 20kHz and it is necessary to increase the motor speed, it has to jump straight to 40kHz, instantaneously doubling motor speed. The stepper is rather unlikely to follow that accelleration.

Please Log in or Create an account to join the conversation.

More
07 Feb 2011 19:59 #7055 by step4linux
andypugh wrote:

Stepgen can manage one pulse per thread execution if reset is enabled. I don't know if your calculations assumed that or not..

yes, otherwise the pulse rate is half of it.
My thoughts are like this:
If the timer shoots an interrupt every BASE_PERIOD, it could happen that at one timer event, there is (almost) no latency, and the next time it is the full range latency. The result will be a time distance of BASE_PERIOD + Latency between two output pulses (reset enabled, otherwise doubled).

Gerd

Please Log in or Create an account to join the conversation.

More
07 Feb 2011 21:05 #7056 by cmorley
Replied by cmorley on topic Re:Latency understanding?
This is an old but good write up on latency and stepper timing:
wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Twe...ftwareStepGeneration
note it discusses using dir hold as number of iterations of period and now it is actual time .

Andy I often wondered about execution time too. I can't see how a thread period that is shorter then the thread execution time can work properly.

Please Log in or Create an account to join the conversation.

More
08 Feb 2011 07:09 #7065 by step4linux
cmorley wrote:

note it discusses using dir hold as number of iterations of period and now it is actual time .

maybe because of my limited english skills, I do not understand this remark, can you explain it ?
It does not discuss the double pulse feature using reset either.

cmorley wrote:

Andy I often wondered about execution time too. I can't see how a thread period that is shorter then the thread execution time can work properly.

Seems actually impossible. Is there a method to display/measure thread exec time ?
What about servo thread ? I assume those "higher" threads are interrupted by the base thread, so their excecution time might be longer than the base period.

Please Log in or Create an account to join the conversation.

More
08 Feb 2011 09:22 #7067 by cmorley
Replied by cmorley on topic Re:Latency understanding?
at the time or writing the dir hold unit was 'number of period cycles'
now it is number of nano seconds.
yes at the time double step was not written yet (i'm pretty sure).

The write up is out of date. I suggested it just to help understand step timing.

Yes a servo thread can be interrupted by the base thread.

I don't know much more then that unfortunately.

Please Log in or Create an account to join the conversation.

Time to create page: 0.371 seconds
Powered by Kunena Forum