Influence of pid tuning to CPU
13 Oct 2015 14:23 #63732
by REEEN
Influence of pid tuning to CPU was created by REEEN
Hello,
I just did the pid tuning for a machine with glass scales and old velocity ac servo drives with tacho feedback. The Gui is gmoccapy and the latency on this pc is very good, under 20k.
The tuning is very good the machine is perfectly exact now.
But I recognized that typing in the MDI window is very lame, the reaction from my keyboard is very slow now.
I think this really comes from the PID tuning, I did not recognized this behaviour before.
The config was made with pnc config, base period is not mentioned in the ini and my servo period is 1000000.
I read somewhere that old vel drives with a high servo period can cause trouble, should I slow down my servo period or base period ?
Thank you very much !!
I just did the pid tuning for a machine with glass scales and old velocity ac servo drives with tacho feedback. The Gui is gmoccapy and the latency on this pc is very good, under 20k.
The tuning is very good the machine is perfectly exact now.
But I recognized that typing in the MDI window is very lame, the reaction from my keyboard is very slow now.
I think this really comes from the PID tuning, I did not recognized this behaviour before.
The config was made with pnc config, base period is not mentioned in the ini and my servo period is 1000000.
I read somewhere that old vel drives with a high servo period can cause trouble, should I slow down my servo period or base period ?
Thank you very much !!
Please Log in or Create an account to join the conversation.
13 Oct 2015 19:24 #63746
by andypugh
The PID component takes the same amount of CPU whether it is tuned or untuned. It runs in the servo-thread and is not especially CPU-intensive.
What do you have running in the base thread? Do you even need a base thread?
Replied by andypugh on topic Influence of pid tuning to CPU
I think this really comes from the PID tuning, I did not recognized this behaviour before.
The PID component takes the same amount of CPU whether it is tuned or untuned. It runs in the servo-thread and is not especially CPU-intensive.
What do you have running in the base thread? Do you even need a base thread?
Please Log in or Create an account to join the conversation.
13 Oct 2015 19:48 #63749
by REEEN
Replied by REEEN on topic Influence of pid tuning to CPU
Hello Andy,
I don't have anything in my Base thread, so I think I don't need one.
I have several conponents running in the servo thread, a very big one for the tool changer.
About 2500 lines of code.
I don't have anything in my Base thread, so I think I don't need one.
I have several conponents running in the servo thread, a very big one for the tool changer.
About 2500 lines of code.
Please Log in or Create an account to join the conversation.
13 Oct 2015 19:54 #63750
by andypugh
Is that one that you wrote yourself?
Realtime components need to run very quickly, typically they do one thing, or nothing, then exit. Then next time they may do a different thing.
If there is _any_ wait loop in your component, then that is bad.
The carousel component is an example of how to wait for a toolchanger without waiting, a state-machine built from a switch statement.
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...96d546b0f9a7a16e4806
Replied by andypugh on topic Influence of pid tuning to CPU
I have several conponents running in the servo thread, a very big one for the tool changer.
Is that one that you wrote yourself?
Realtime components need to run very quickly, typically they do one thing, or nothing, then exit. Then next time they may do a different thing.
If there is _any_ wait loop in your component, then that is bad.
The carousel component is an example of how to wait for a toolchanger without waiting, a state-machine built from a switch statement.
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...96d546b0f9a7a16e4806
Please Log in or Create an account to join the conversation.
14 Oct 2015 01:59 #63759
by REEEN
Replied by REEEN on topic Influence of pid tuning to CPU
Hello Andy,
I don't exactly know what youean with wait loop ?
I also use switch case todo the steps.
At the beginning I often have some if states to encode things or set some variables or else, but most of the code uses case.
The carousel changer is very similar built.
I see there is if !enable return in the first switch. What does the return do, I don't use return.
Thanks
I don't exactly know what youean with wait loop ?
I also use switch case todo the steps.
At the beginning I often have some if states to encode things or set some variables or else, but most of the code uses case.
The carousel changer is very similar built.
I see there is if !enable return in the first switch. What does the return do, I don't use return.
Thanks
Please Log in or Create an account to join the conversation.
15 Oct 2015 01:55 #63764
by andypugh
A realtime component must never wait for anything, it should exit then look again next invocation.
It sounds like you already understand this.
You might find it useful to look at the thread and function times, see if any component functions are running longer than expected.
Replied by andypugh on topic Influence of pid tuning to CPU
I don't exactly know what youean with wait loop ?
A realtime component must never wait for anything, it should exit then look again next invocation.
It sounds like you already understand this.
You might find it useful to look at the thread and function times, see if any component functions are running longer than expected.
halcmd show thread
halcmd show funct
The following user(s) said Thank You: REEEN
Please Log in or Create an account to join the conversation.
15 Oct 2015 02:21 - 15 Oct 2015 09:49 #63765
by dgarrett
Replied by dgarrett on topic Influence of pid tuning to CPU
With linuxcnc2.7, you can make a histogram of a component's execution time and total thread time. Example:
You probably need to adjust minval,binsize, nbins -- it is convenient to first increase
binsize and then make additional adjustments.
ref: linuxcnc.org/docs/2.7/html/hal/tools.html
$ hal-histogram --help # for command options
$ hal-histogram pid.0.do-pid-calcs.time &
$ hal-histogram servo-thread.time &
You probably need to adjust minval,binsize, nbins -- it is convenient to first increase
binsize and then make additional adjustments.
ref: linuxcnc.org/docs/2.7/html/hal/tools.html
Last edit: 15 Oct 2015 09:49 by dgarrett.
The following user(s) said Thank You: REEEN
Please Log in or Create an account to join the conversation.
18 Oct 2015 23:35 #63903
by REEEN
Replied by REEEN on topic Influence of pid tuning to CPU
Thank you all very much, I will try this out
Please Log in or Create an account to join the conversation.
Time to create page: 0.109 seconds