Setting up Closed loop Spindle speed control and Feedback (0-10V Analog)

More
05 Aug 2020 09:06 #177362 by denhen89
Update: PID works after I changed what the line that Andy Pugh wrote.
The spindle overshoots quiet a lot and it takes time until the PID manages to get to the commander rpm, but it does work and the RPM is exactly as commanded.
Due to the fact that It takes quiet a lot of time, i am wondering if lincurce is not a better option.
Is it correct that I do not need PID for constant surface speed ? If not, I will test lincurve

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

More
05 Aug 2020 15:42 #177396 by andypugh
I would typically expect spindle PID to be almost entire FF0 and I. If the settling time is too long, try increasing I until the point that the speed starts to slowly oscillate then back it off a bit (actually, back it off quite a lot)

You can try adding a bit of P then to speed up the tracking even more.
The following user(s) said Thank You: denhen89

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

More
05 Aug 2020 16:38 #177401 by denhen89
I played around with P and I, and I would say it worked okay but there are 2 problems.
1. When decelerating from a higher RPM let's say 800 rpm to 250 rpm, the rpm goes down to about 170rpm, stays there for about 3 seconds, then goes up to 250 rpm quiet fast.
2. Due to the fact that when accelerating the rpm overshoots quiet much, so when I start a program the axis does not wait until the RPM is settled correctl, it starts to move already when the rpm overshoots. It does overshoot quiet a lot but settle down pretty quickly.
Example: S800 : rpm goes over 920, axis starts to move already because it got the spindle at speed signal when reached 800 rpm.
When doing threading for example, the axis starts to move at the overshoot very fast and goes slower when the rpm settles down.

I could lower the I that much that the overshoot would be less or no overshoot at all, but then it takes long until the rpm is reached.

For now I put all PID to 0, only FF0 set to 1

RPM ist not accurate, but I have no overshoot.

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

More
05 Aug 2020 16:47 - 05 Aug 2020 16:49 #177404 by PCW
Overshoot with "I" term is expected if the spindle speed command slews
faster than the VFDs acceleration rate, so its guaranteed with a step change
in the commanded RPM. This is usually addressed by passing the commanded
spindle RPM through the limit2 component before it goes to the PID command input.
Last edit: 05 Aug 2020 16:49 by PCW.

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

More
05 Aug 2020 16:48 - 05 Aug 2020 16:48 #177405 by Todd Zuercher
I know the cheep VFDs I recently set up had parameters for linearizing the analog command input for making the commanded speed actually match what the drive output. You might need to read through your drive's manual to figure it out.
Last edit: 05 Aug 2020 16:48 by Todd Zuercher.

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

More
05 Aug 2020 16:53 #177406 by andypugh

I played around with P and I, and I would say it worked okay but there are 2 problems.
1. When decelerating from a higher RPM let's say 800 rpm to 250 rpm, the rpm goes down to about 170rpm, stays there for about 3 seconds, then goes up to 250 rpm quiet fast.


This is due to "Integral windup". All the time that the spindle is above the new set speed the I term increases in magnitude, and them it is too large when the setpoint speed is reached.

linuxcnc.org/docs/2.8/html/man/man9/pid.9.html

You can reduce this effect by using the pid.N.maxerrorI term. I _think_ that you would set that to the maximum rpm error that you see. So probably 20 rpm. But note that I am not 100% sure that the I limit is in rpm, it might be volts...

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

More
05 Aug 2020 21:18 - 05 Aug 2020 22:15 #177424 by denhen89
Thanks guys and sorry for the late reply, but my gf is at my place and dont want to spend too much time here on today.

@PCW:

Overshoot with "I" term is expected if the spindle speed command slews
faster than the VFDs acceleration rate

That i do understand, but not this:

so its guaranteed with a step change
in the commanded RPM

This is usually addressed by passing the commanded
spindle RPM through the limit2 component before it goes to the PID command input.

I will take a look if i manage to configure it in my .HAL on tomorrow, but first i try to find some example configs with limit2.
Thanks for that!

@Todd Zuercher:

I know the cheep VFDs I recently set up had parameters for linearizing the analog command input for making the commanded speed actually match what the drive output. You might need to read through your drive's manual to figure it out.

I was looking for something like that in the manual about an week ago, but could not find any settings for that on the Toshiba VF-S11.
Still, thanks for that info.

@andypugh:

This is due to "Integral windup". All the time that the spindle is above the new set speed the I term increases in magnitude, and them it is too large when the setpoint speed is reached.
linuxcnc.org/docs/2.8/html/man/man9/pid.9.html

You can reduce this effect by using the pid.N.maxerrorI term. I _think_ that you would set that to the maximum rpm error that you see. So probably 20 rpm. But note that I am not 100% sure that the I limit is in rpm, it might be volts...

Thank you very much for the explanation, i do get it. I found that in the PID manual: Limit on error integrator. The error integrator used by the Igain term will be limited to this value, unless it is zero. Can be used to prevent integrator windup and the resulting overshoot during/after sustained errors. Not normally needed.
It sounds like that could help me and i will try that on tomorrow as soon as i will by in my workshop.

Thanks again. On tomorrow i will let you know if i got set it up better. If its not possible, i will not use PID. For me its only important that the spindle rpm is quiet accurate, that i can get good results when threading and to be able to use CSS. The rpm is out by about 60rpm at max rpm: S1420 rpm = 1483 rpm. The lower the RPM, the smaller the error.

One other thing i would need to set up is the 2. gear (1:8), but i am not sure if i have to use the Linuxcnc gearchange component or the gear change component written by andypugh.
I do have a physical spindle speed potentiometer. I am mentioning this, because on some thread i have read that someone had problems when change speed with the potentiometer, but to be honest, i have thought much about it because first i want to get done the other spindle related things.
PS: The gear has to be changed by a physical switch handle, not by clutches or so. In future i would like to use e.g. a linear actuator to change the the automaticly, but thats is just a idea for now. Also i haven't thought much about that for now.

Have a good evening.
Last edit: 05 Aug 2020 22:15 by denhen89.

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

More
06 Aug 2020 11:40 #177494 by denhen89
Hello,
the first thing I have tried when I went to my shop an hour ago was to test with the pid.N.maxerrorI command. I have set it to 10. Works very good! I would say that the spindle rpm problems are solved. It does overshoot, the higher the rpm the more it overshoots, but only for maybe a half second. When decelerating from high rpm e.g. 1200 to low rpm 250rpm the rpm does not any more go down to minimum rpm and stays there for couple seconds, but it does overshoot (or undershoot? :D) only to about 220rpm and settles to 250rpm with a second. I put the acceleration to max rpm from 5seconds to 10 seconds. It seems that it does overshoot less now when accelerating to high rpm.

So, that's solved. Thanks you very very much for that.

I will now try to get the gear change done, but I think I will have problems with that. If so, I will post it.

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

More
06 Aug 2020 12:58 - 06 Aug 2020 12:59 #177506 by denhen89
Andy, would you help me out to implant your auto gear select config to my config. It might be easier for me if you would also you PID control instead of lincurve. Its seems to be a bit complicated to get it done by me self.
Would really appreciate your help.

PS: the gearchange thing is the last control related thing I need to do. After that I just need to mount the tool holder and I can start to turn something. :)
Last edit: 06 Aug 2020 12:59 by denhen89.

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

More
12 Aug 2020 11:21 #178028 by RotarySMP
My lathe set up is very similar to yours, and I am also struggling with the spindle configuration. Could you please post your final HAL and INI, so I can copy the HAL set up.
Mark

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

Time to create page: 0.127 seconds
Powered by Kunena Forum