Manual gear change and max rpm (for constant surface speed)

More
12 Dec 2016 18:36 #83962 by Hakan
I would like to have a parameter say #<_maxrpm> that I can use in G96 statements, like
G96 D#<_maxrpm> S150

My lathe has a six speed manually operated gearbox. #<_maxrpm> needs to have its value set after which gear is used.
Right now I use a set of M101 - M106 command to manually set up the scaling for the speed. This works fine, except that I keep forgetting to enter the right M-code when I change gears. I can live with that. Here is an example for M104.
#!/bin/bash
R=0.8846
MAXRPM=1770
halcmd setp scale.0.gain $R
halcmd setp scale.1.gain $(echo "scale=5;1.0 / $R"| bc -q)
exit 0

What I want is to have access to the MAXRPM value in a global parameter #<_maxrpm>.
When I enter a high max rpm in the G96 command, say
G96 D2000 S150
and the gearbox is in fourth gear and the spindle will only do 1770 rpm. The program stops here.
So I want to set the rpm in D to the max possible for the specific gear in use.
G96 D#<_maxrpm> S150
would work for any gear.

Is there a way to define a global parameter from M-code? Or even better from hal,
then I can use the auto-detection of gear.

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

More
13 Dec 2016 13:01 #84025 by andypugh
There may be a neater way to do this.

linuxcnc.org/docs/2.7/html/remap/remap.h...remap:existing-codes

You can probably re-map the S-command to perform a G96 Sn Dxxxx automatically when G96 is in effect.

Having said that, is this really necessary? Presumably the spindle drive will just fail to go any faster if the required spindle speed is too high? Or is there a problem with spindle-at-speed not being set? If that is the case you could pass the spindle speed request through a limit block and compare to that.

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

More
13 Dec 2016 16:52 - 13 Dec 2016 20:02 #84044 by Hakan

Presumably the spindle drive will just fail to go any faster if the required spindle speed is too high?


I checked this. The vfd is a Huan Yang and it refuses to start with a higher speed commanded than its max. So it is the speed to the vfd that needs to be limited. I can put a limit to the max speed to the vfd, but what happens to the feed? Aren't the feed and speed out of sync?
motion.spindle-speed-out-abs is the wanted speed. motion.spindle-speed-in is the actual speed. Is motion okay with a large difference in set speed vs actual speed?

Edit:
On the last question I will answer YES. According to the documentation motion.spindle-speed-in is used by G96 and G95. Also my tests show that it works to put a limit on the rpm command sent to the vfd. I have not done any actual turning yet, but it looks ok running in the air, and the value of pins look ok at inspection.

So with that I think you are right andy, there is no need for a gear-specific rpm limit for G96. It is okay to set the highest rpm value that is comfortable for the lathe, and then the actual speed will be limited by the max limit in the vfd, if needed. Perfect. Better.
Last edit: 13 Dec 2016 20:02 by Hakan. Reason: Tests done

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

Time to create page: 0.098 seconds
Powered by Kunena Forum