(SOLVED) Spindle PID tuning

More
01 Oct 2021 23:09 #221984 by spumco
Spindle PID tuning was created by spumco
I could use some guidance on getting my spindle commanded speed to match actual speed.  I do not have any PID yet, but fiddling with the values a bit changes the response, so I know it's not running open-loop due to pin/signal issues.

Encoder working properly, feedback speed matches actual speed measured with phototachometer.
I have no analog offset or analog gain changes in the VFD.

LCNC Ver 2.8.2
VFD commanded by 0-10V, 4096-count encoder.
P/I/D all set in .ini to 0.0, FF0 = 1.0

The actual speed varies as follows:
(command) - (actual) (percent off)
1000rpm - 828rpm (17.2%)
1500rpm - 1350rpm (10%)
2000rpm - 1867rpm (6.7%)
2500rpm - 2397rpm (4%)
3000rpm - 2916rpm (2.6%)
3500rpm - 3450rpm (1.4%)
4000rpm - 3983rpm (0.4%)

I've read through a number of threads on PID tuning, but any of the values I tried resulted in slow(ish) runaways or significant undershoots.  No hunting up/down, however.

Anyone have a suggestion on a starting point?
 

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

More
01 Oct 2021 23:24 #221985 by PCW
Replied by PCW on topic Spindle PID tuning
Are the PID command, output, and feedback in RPM or RPS?
(They all have to use the same units or it will not work)

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

More
02 Oct 2021 01:18 #221988 by spumco
Replied by spumco on topic Spindle PID tuning
Thank you, but can you be more specific?  When you refer to 'command', do you mean the pins I was watching (spindle-vel-cmd-rpm and spindle-vel-fb-rpm)?
 

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

More
02 Oct 2021 01:31 - 02 Oct 2021 01:32 #221990 by PCW
Replied by PCW on topic Spindle PID tuning
I was referring to the PID pins do they make sense?
That is, is the PID command pin equal to the commanded RPM
and the PID feedback pin equal to the actual RPM?

Does the PID error make sense? (it should be the difference
between the commanded and actual RPM)
Last edit: 02 Oct 2021 01:32 by PCW.

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

More
02 Oct 2021 01:48 #221991 by spumco
Replied by spumco on topic Spindle PID tuning
Sorry, I should have noted that I'm still very new at LCNC - this is my first installation ever.  I've beed active on the forum for a while trying to get the preliminaries sorted out, but it would help if you were very specific.

"PID command pin" - is that pid.s.command?

Here's what I think you're asking (M3 S1000):
pid.s.command = 1000
pid.s.feedback = 0
spindle-output = 1000
spindle-fb-rpm = 829 (fluctuates +/-3rpm)
spindle-vel-cmd-rpm = 1000

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

More
02 Oct 2021 02:21 #221992 by PCW
Replied by PCW on topic Spindle PID tuning
pid.s.feedback = 0
and
spindle-fb-rpm = 829 (fluctuates +/-3rpm)

Indicate that the PID feedback pin is unconnected

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

More
02 Oct 2021 02:30 #221993 by spumco
Replied by spumco on topic Spindle PID tuning
pid.s.feedback appears to be connected to spindle-vel-fb-rpm-abs, but that signal isn't connected to anything else.

Maybe it would be easier if I posted my HAL and ini.
Attachments:

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

More
02 Oct 2021 03:37 - 02 Oct 2021 03:40 #221994 by PCW
Replied by PCW on topic Spindle PID tuning
I would change this section:

# Use ACTUAL spindle velocity from spindle encoder
# spindle-velocity bounces around so we filter it with lowpass
# spindle-velocity is signed so we use absolute component to remove sign
# ACTUAL velocity is in RPS not RPM so we scale it.

setp scale.spindle.gain 60
setp lowpass.spindle.gain 1.000000
net spindle-vel-fb-rps => scale.spindle.in
net spindle-fb-rpm scale.spindle.out => abs.spindle.in
net spindle-fb-rpm-abs abs.spindle.out => lowpass.spindle.in
net spindle-fb-rpm-abs-filtered lowpass.spindle.out


To this:

# Use ACTUAL spindle velocity from spindle encoder
# spindle-velocity bounces around so we filter it with lowpass
# spindle-velocity is signed so we use absolute component to remove sign

setp lowpass.spindle.gain 1.000000
net spindle-vel-fb-rpm => abs.spindle.in
net spindle-vel-fb-rpm-abs abs.spindle.out => lowpass.spindle.in
net spindle-fb-rpm-abs-filtered lowpass.spindle.out


You could also delete all the scale stuff (loadrt and addf) since the scale
component is not needed.
Last edit: 02 Oct 2021 03:40 by PCW.

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

More
02 Oct 2021 03:51 #221995 by spumco
Replied by spumco on topic Spindle PID tuning
Excellent!  now pid.s.feedback matches spindle-vel-fb-rpm

I suppose now I can start adjusting the PID values in the .ini file, right?

Do you have any suggestions on starting points?

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

More
02 Oct 2021 03:58 #221996 by PCW
Replied by PCW on topic Spindle PID tuning
I guess I would start with a bit of P
(a P term of 1 means an error of 100 RPM means a
correction in the velocity command of 100 RPM )

and then some I
( a I term of 1 means an error of 100 RPM will result in a correction
velocity command of 100 RPM per second)
The following user(s) said Thank You: spumco

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

Time to create page: 0.096 seconds
Powered by Kunena Forum