Spindle PID troubleshooting -- solved

More
6 years 5 months ago #166632 by paulctan
Linuxcnc 2.8pre on mint.

Everything has been working fine for a while now. I started trying to fix my spindle speed (it's been running a little bit slower than programmed). Spindle is controlled from Mesa card via Analog 0-5V output.

I set the P=0.4, FF0=1.0, everything else 0.

See attached photo for halshow.

spindle-vel-fb-rps is 13.94723, and spindle-vel-cmd-rps is 16.66667
but, (see photo circled items), spindle actual rpm is 1293 when I commanded 1000.

What am I missing? Am I looking at the correct hal variables? Is there a hal variable to show the PID error?

Thanks.

Paul Tan.


Code:
[SPINDLE_9] P = 0.4 I = 0.0 D = 0.0 FF0 = 1.0 FF1 = 0.0 FF2 = 0.0 BIAS = 0.0 DEADBAND = 0.0 MAX_OUTPUT = 4700 ENCODER_SCALE = 8192.0 OUTPUT_SCALE = 4700 OUTPUT_MIN_LIMIT = 0 OUTPUT_MAX_LIMIT = 4700

Please Log in to join the conversation.

More
6 years 5 months ago #166637 by tommylight
Can your spindle do 4700 RPM at 5V input ?
Check the scaling so it corresponds to what it actually can do at 5V.

Please Log in to join the conversation.

More
6 years 5 months ago #166647 by paulctan
Yes, the spindle can do 5000 RPM. Scaling is not the issue. The spindle RPM is not linear to the output voltage (or, the output voltage might not be linear). I wanted to use the PID loop to adjust the output voltage accordingly. I.e., at low RPM, e.g. 500 RPM, I get actual RPM of about 420, at 1000 RPM, I get 950, at 2000 RPM I get 1950. At 4500 RPM, I get 4400 RPM. Not perfectly linear. I wanted to close that feedback loop.

Please Log in to join the conversation.

More
6 years 5 months ago #166656 by tommylight
What encoder is on the spindle and how is that scaled in hal ?

Please Log in to join the conversation.

More
6 years 5 months ago #166664 by paulctan
Encoder is built into the DMM DYN4 servo motor. I am scaling it based upon the pulley ratio. But, that's not the issue. My issue is why the PID error is wrong based upon what the system is seeing.

Please Log in to join the conversation.

More
6 years 5 months ago #166672 by paulctan
Hmmm... should I be asking this in the configuring linuxcnc section instead? or maybe in the HAL section? Asking the moderators here if it should be moved or not.

Please Log in to join the conversation.

More
6 years 5 months ago #166676 by tommylight
I can move it there, seems more appropriate .
Thank you.

Please Log in to join the conversation.

More
6 years 5 months ago #166739 by Hakan
Replied by Hakan on topic Spindle PID troubleshooting
First you need to make sure that the pid.s component is actually used. Check the hal file. If you attach it here people can check for you.

If that is all good, I would say to set P=0 and adjust FF0 so the actual spindle speed agrees well with the commanded speed. Judging from your experiments FF0 should be perhaps 1.05.

Then start to increase P until the error is as small as you want. You can go on with I and D. The error is in the pid.s.error pin.

Please Log in to join the conversation.

More
6 years 5 months ago #166777 by PCW
Replied by PCW on topic Spindle PID troubleshooting
Yes, you probably need to increase P, you have

P = 0.4

Which means if you are 100 RPM low the PID output only adds
the equivalent of 40 RPM to the commanded speed...

Please Log in to join the conversation.

More
6 years 5 months ago #166782 by paulctan
That's not the problem. The problem, if you look at the screenshot, is that it's overshooting the compensation, but the hal variables in the screenshot show that it's still below. Screenshot shows the spindle already at 1293 RPM, but the setting is set for 1000 RPM. This is with P=0.4. It should have attempted to decrease the spindle speed, but, if you look at the halshow output, it shows that spindle-vel-fb-rps is 13.94723, and spindle-vel-cmd-rps is 16.6667, so, it's behaving correctly if you look at the rps variables. BUT, the spindle-fb-rpm is 1315.024, and that is CLEARLY above the G code spindle speed of 1000 RPM.

I need someone to tell me what hal variables to look for to further debug this problem.

Thanks.

Paul Tan.

Please Log in to join the conversation.

Time to create page: 0.101 seconds
Powered by Kunena Forum