2-speed spindle configuration - help

More
05 Mar 2021 17:37 #201109 by Jaro
Good day.
I want to ask you for advice (I don't even know if it's possible), but linuxcnc is very good to bend.
I have two spindle speeds on my mil, which I change manually.
1. 400-4000rpm
2. 10-400rpm
the spindle is controlled by VFD 0-10V.
encoder 2048 pulses / rev
open loop
I would like the software to control the drive based on the required speed in two stages.
I tried to generate some configuration via PNCConf, but it doesn't work for me.
if I enter the G0 S300 M3 display and the spindle is switched to low speed, everything works correctly.
if I enter the display G0 S1000 M3 and the spindle is switched to high speed, its speed is 4000rpm

I thought linuxcnc would recognize the required speeds and drive VFD accordingly.

can anyone advise me how this is solvable. I tried to watch the older posts, but I wasn't wiser.
I am adding .ini and .hal (I apologize for the chaos, but I still did not get to clear both files).
linuxcnc 2.7.15
Thanks for help.

Jaro

File Attachment:

File Name: schaublin_...3-05.hal
File Size:20 KB

File Attachment:

File Name: schaublin_...3-05.ini
File Size:5 KB
Attachments:

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

More
05 Mar 2021 18:24 #201115 by andypugh
Replied by andypugh on topic 2-speed spindle configuration - help
Is your gear selection electronic or manual?

My lathe has a 2-speed gearbox with electromagentic clutches and I control it with this custom hal component:
component gearchoice "A component to choose spindle gears according to spindle speed";
pin in float speed-command;
pin in bit spindle-on;
pin in bit manual-low;
pin in bit manual-high;
pin in bit brake-enable;
pin out float motor-speed;
pin out bit low-gear;
pin out bit high-gear;
pin out bit brake;
param rw float low-ratio=3;
param rw float high-ratio=1;
param rw float max-low = 500;

author "andy pugh";
license "GPL";
function _;

;;

FUNCTION(_){
    static int old_M3;

    if (spindle_on) {
        if (!old_M3){ // spindle off to on transition
            if (manual_high) {
                high_gear = 1;
                low_gear = 0;
                brake = 0;
            }
            else if (manual_low){
                high_gear = 0;
                low_gear = 1;
                brake = 0;
            } else if (speed_command <= max_low){
                high_gear = 0;
                low_gear = 1;
                brake = 0;
            } else {
                high_gear = 1;
                low_gear = 0;
                brake = 0;
            }
        }
    } else { //spindle off
        high_gear = 0;
        low_gear = 0;
        brake = brake_enable;
    }
        
    old_M3 = spindle_on;

    if (high_gear){
        motor_speed = speed_command * high_ratio;
    } else if (low_gear){
        motor_speed = speed_command * low_ratio;
    }
}

(Actually that isn't quite true as I have now modified that component to allow spindle-on gearchanges during G0 moves. But that wouldn't be necessary for a mill)

Note that the .comp is intended for a system with a 3-position high-low-auto switch for the gear ratio and a brake auto-off switch too.
The following user(s) said Thank You: RotarySMP, vre, NewGuyJim

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

More
05 Mar 2021 19:22 #201117 by Jaro
Replied by Jaro on topic 2-speed spindle configuration - help
Thank you Andy.

manual switching and I don't even have a sensor there.
there is only "low" and "high" speed position.
the point is that if I work with speeds up to 450rpm, I know that I need to manually switch the lever to the lower position, when I work with speeds above 450rpm to the upper position.
so far I haven't had a spindle speed scanner (actually a speedometer).
today I mounted a spindle encoder.
until now, I have worked by manually rewriting the spindle speed in .ngc.
for example, I wanted to drill at 400rpm, so I had to write about 3200rpm, because when the gear was switched to the "low speed" position, I actually got 400rpm at this speed.
therefore, I was interested in whether it is possible to solve this problem with respect to VFD on the basis of the required speeds.
it is essentially a matter of, for example:
G0 S400 (lever in low speed position) => 9.2V VFD
G0 S3200 (lever in high speed position) => 9.2V VFD

I thought this was exactly the "Range 1 Max RPM" and "Range 2 Max RPM" in Pncconf.

Jaro

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

More
05 Mar 2021 22:50 #201144 by RotarySMP
Replied by RotarySMP on topic 2-speed spindle configuration - help
Hi Andy, how does it deal with speed changes across the switching threshold due to CSS facing cuts?
Mark

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

More
05 Mar 2021 22:57 #201146 by andypugh
Replied by andypugh on topic 2-speed spindle configuration - help

manual switching and I don't even have a sensor there.
there is only "low" and "high" speed position.


My mill has 8 gears and no sensors, so I have the system work out for itself which gear it is in.

forum.linuxcnc.org/47-hal-examples/27071...gear-detection#39583

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

More
05 Mar 2021 22:59 #201147 by andypugh
Replied by andypugh on topic 2-speed spindle configuration - help

Hi Andy, how does it deal with speed changes across the switching threshold due to CSS facing cuts?


The changes I made were actually to handle CSS.

The idea is that it waits for a G0 move, de-asserts spindle-at-speed (causing a pause at the next G1) and then tries to match motor speed and gearbox speed on-the-fly (like double de-clutching a car) and then engages the clutch.

In practice, it has exactly the same problem as our 1916 fire engine on a hill, you can't change up because the spindle slows faster than the motor.

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

More
06 Mar 2021 18:46 - 06 Mar 2021 19:07 #201203 by Jaro
Replied by Jaro on topic 2-speed spindle configuration - help
Thank you Andy.
today I tried to break up your "gearchange.comp"
by
www.forum.linuxcnc.org/10-advanced-confi...-configuring?start=0

can you advise me on configuration.
I do not use hy_vfd (huanyang vfd).
what to replace:

loadusr -W hy_vfd -d /dev/ttyUSB0

net spindle-at-speed hy_vfd.spindle-at-speed

net machine.on.delayed hy_vfd.enable

net spindle-enable hy_vfd.spindle-on gearchange.0.spindle-on
net spindle-cw hy_vfd.spindle-forward
net spindle-ccw hy_vfd.spindle-reverse

well thank you
Jaro
Attachments:
Last edit: 06 Mar 2021 19:07 by Jaro.

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

More
07 Mar 2021 01:54 #201253 by andypugh
Replied by andypugh on topic 2-speed spindle configuration - help
It's hard to say, as I have no idea what your spindle control pins are called. But use what you have.

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

More
07 Mar 2021 18:35 #201322 by Jaro
Replied by Jaro on topic 2-speed spindle configuration - help
It's done

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

More
07 Mar 2021 19:29 #201338 by J Green
Replied by J Green on topic 2-speed spindle configuration - help
Hope "it's done" means you got the 2 speed transmission wording !
If so would you share your newer HAL an INI files ?
Thank's

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

Time to create page: 0.096 seconds
Powered by Kunena Forum