Wye Delta 1:1 Spindle Gearing Config

More
06 Nov 2018 13:37 - 06 Nov 2018 14:03 #120103 by COlger81
Can anyone point me in the right direction for adding necessary code for Wye Delta spindle gearing. It has only one belt and the ratio is 1:1 . The gearing is internal in the motor. By default the motor is in low range. I have the necessary connection made in Hal to trigger the high range gear. I would like to know what the best code approach is to have the motor automatically change from low to high gear. Additional information below;

Belt Ratio = 1:1 (Wye Delta Motor internal Gearing)
Low range = 1-2500 (In low gear by default)
High Range = 2501 - 7500 (Necessary pin connected)
Dwell needed = 3 seconds (MOTOR MUST STOP COMPLETELY IN BETWEEN GEAR CHANGES)
Last edit: 06 Nov 2018 14:03 by COlger81.

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

More
06 Nov 2018 21:14 - 06 Nov 2018 21:15 #120117 by rodw
Others might have other ideas but motion.spindle−speed−out−abs tells you what is the desired spindle speed.

I think I would write my own component to do this but you might be able to do something with the comp component
comp could tell you when the gear threshold was exceeded and maybe the near component could tell you when the speed fell to near zero. Then if you had a delay on the output to your gear selection pin, you could change gears after your dwell. This is nowhere near a complete solution but it might give you something to think about.

Writing a component would make it much easier to sense when motion.spindle−speed−out−abs was changed and test if its outside the threshold for the currently selected gear and take appropriate action to halt the spindle and change gears.
Last edit: 06 Nov 2018 21:15 by rodw.

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

More
07 Nov 2018 14:55 #120171 by andypugh
This is the HAL component that I use to control my 2-speed, electrically-controlled spindle.
It is compiled and installed by halcompile:
linuxcnc.org/docs/2.7/html/hal/comp.html

My machine has a 3-position switch to select between high speed, low speed and auto. In auto-mode the gear is chosen according to the commanded spindle speed,
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;
    }
}

I have considered adding a facility that allows the system to auto-change speed. It would watch the "motion-type" pin, wait for a G0 move, and then disengage the clutch, wait until the spindle and motor speeds were a match, and then engage a different clutch. None if this is relevant to your system though.

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

More
19 Nov 2018 15:22 - 19 Nov 2018 15:26 #120995 by COlger81
I used your gearchoice component for auto change of wye delta gears. I removed the manual if statements and pins (don't need them). It's functioning as intended but i need it to stop the spindle and change gears if for example; M3S2501 is commanded and it's currently in low gear at 2500. Low gear is 0-2500, High gear is 2501-7500.

Modified code:

File Attachment:

File Name: gearchoice.comp
File Size:1 KB

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 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=1;
param rw float high-ratio=1;
param rw float max-low = 2500;

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

;;

FUNCTION(_){
    static int old_M3;

    if (spindle_on) {
        if (!old_M3){ // spindle off to on transition
            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;
    }
}
Attachments:
Last edit: 19 Nov 2018 15:26 by COlger81.

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

Time to create page: 0.432 seconds
Powered by Kunena Forum