Gearchange configuring

More
18 Aug 2016 14:52 - 18 Aug 2016 16:14 #79000 by terkaa
Hi,

Ok project goes on and it is time to consider spindle and gear changing. This has two gears 1st gear is lowered 1:6 and second gear is 1:1. We can rotate our spindle motor with VFD from 100-3600 RPM. VFD runs motor in closed loop.(But it will be open loop between VFD and LinuxCNC) So 1st gear speed range is 100-600 and second gear range 600-3600 rpm. Will gearchange component work with this combo? Any examples ?


Tero
Last edit: 18 Aug 2016 16:14 by terkaa.

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

More
19 Aug 2016 13:40 #79072 by andypugh
Replied by andypugh on topic Gearchange configuring
Yes, the gearchange .comp should work.

If you want to get fancy you might be able to auto-detect the gear:
forum.linuxcnc.org/forum/47-hal-examples...indle-gear-detection

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

More
24 Aug 2016 16:52 #79361 by terkaa
Replied by terkaa on topic Gearchange configuring
Ok,

I have been studying this and I would like to have auto gear selection, ie. if under 600 RPM is needed then low gear is selected and output to engage low gear hydraulic solenoid is activated. If over 600 is needed then high gear is selected. Gear switching is only possible when spindle is still. Would it be simple solution to modify gearchange component a bit? Also we have to check limit switch for correct gear is activated before enable is output.

Is feedback of spindle absolutely necessary? I have only encoder on input shaft(before gearbox). Encoder has A,B,Z pulses. A and B are already used by VFD for closed loop control. Encoder output is push-pull by OL7272 line driver. Can I build feedback with these and Mesa 7i84? Or 7i70?

Tero

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

More
24 Aug 2016 19:05 - 24 Aug 2016 19:06 #79372 by andypugh
Replied by andypugh on topic Gearchange configuring

Ok,

I have been studying this and I would like to have auto gear selection, ie. if under 600 RPM is needed then low gear is selected and output to engage low gear hydraulic solenoid is activated. If over 600 is needed then high gear is selected. Gear switching is only possible when spindle is still. Would it be simple solution to modify gearchange component a bit?


Which "gearchange component" ? The one included with LinuxCNC isn't really ideal for your situation.

A better solution is the system I have on my lathe (I didn't realise you had an electronically controlled gearbox).

It uses this HAL component (confusingly also called "gearchange"):
component gearchange "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;
    }
}

You can save the file as gearchange.comp then install it on your system with
sudo halcompile --install gearchange.comp
If you want to not over-write the built-in gearchange then change the filename _and_ the "component gearchange" line.

It allows for manual over-ride to high or low (in my case with a three-way switch) and also allows for manual or auto brake engagement (again, controlled by a switch on my machine).

This is the HAL.
loadusr -W hy_vfd -d /dev/ttyUSB0
loadrt gearchange
addf gearchange.0 servo-thread
setp gearchange.0.max-low 500
setp gearchange.0.high-ratio 1
setp gearchange.0.low-ratio 3
setp gearchange.0.brake-enable 0

setp   pid.s.Pgain     [SPINDLE_9]P
setp   pid.s.Igain     [SPINDLE_9]I
setp   pid.s.Dgain     [SPINDLE_9]D
setp   pid.s.bias      [SPINDLE_9]BIAS
setp   pid.s.FF0       [SPINDLE_9]FF0
setp   pid.s.FF1       [SPINDLE_9]FF1
setp   pid.s.FF2       [SPINDLE_9]FF2
setp   pid.s.deadband  [SPINDLE_9]DEADBAND
setp   pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT
setp   pid.s.error-previous-target true
setp   pid.s.maxerror .0005

net spindle-index-enable  <=> pid.s.index-enable
net spindle-enable        =>  pid.s.enable
net spindle-vel-cmd-rpm     => pid.s.command
net spindle-vel-fb-rpm      => pid.s.feedback
net spindle-output        <=  pid.s.output

# ---Encoder feedback signals/setup---

net spindle-revs             <=   hm2_5i24.0.resolver.04.position
net spindle-vel-fb-rps       <=   hm2_5i24.0.resolver.04.velocity
net spindle-index-enable     <=>  hm2_5i24.0.resolver.04.index-enable

# ---setup spindle control signals---

net spindle-vel-cmd-rps        <=  motion.spindle-speed-out-rps
net spindle-vel-cmd-rps-abs    <=  motion.spindle-speed-out-rps-abs
net spindle-vel-cmd-rpm        <=  motion.spindle-speed-out
net spindle-vel-cmd-rpm-abs    <=  motion.spindle-speed-out-abs
net spindle-enable             <=  motion.spindle-on
net spindle-cw                 <=  motion.spindle-forward
net spindle-ccw                <=  motion.spindle-reverse
net spindle-brake              <=  motion.spindle-brake
net spindle-revs               =>  motion.spindle-revs
net spindle-at-speed           =>  motion.spindle-at-speed
net spindle-vel-fb-rps         =>  motion.spindle-speed-in
net spindle-index-enable      <=>  motion.spindle-index-enable

# ---Connect the VFD---

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
net spindle-vel-cmd-rpm-abs gearchange.0.speed-command
net manual-low gearchange.0.manual-low <=
net manual-high gearchange.0.manual-high <=
net motor-speed gearchange.0.motor-speed => hy_vfd.speed-command

net low-gear gearchange.0.low-gear => hm2_7i84.008a.output-11
net high-gear gearchange.0.high-gear => hm2_7i84.008a.output-10
net brake gearchange.0.brake => hm2_7i84.008a.output-12


File Attachment:

File Name: gearchange.comp
File Size:1 KB
Attachments:
Last edit: 24 Aug 2016 19:06 by andypugh.

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

More
25 Aug 2016 08:10 #79398 by terkaa
Replied by terkaa on topic Gearchange configuring
Ok,

This is what I am looking for thank you. I am a bit confused by line:

net spindle-enable hy_vfd.spindle-on gearchange.0.spindle-on

according to hy_vfd manpage spindle-on is input also gearchange.0.spindle-on is an input??
Should I connect motion.spindle-on => gearchange.0.spindle-on

Tero

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

More
25 Aug 2016 09:28 #79399 by andypugh
Replied by andypugh on topic Gearchange configuring

This is what I am looking for thank you. I am a bit confused by line:
net spindle-enable hy_vfd.spindle-on gearchange.0.spindle-on


There are three lines connecting up the spindle-enable signal. You can keep adding things to a net, and even spread the net commands through several separate HAL files.
...
net spindle-enable        =>  pid.s.enable
...
net spindle-enable             <=  motion.spindle-on
...
net spindle-enable hy_vfd.spindle-on gearchange.0.spindle-on

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

More
25 Aug 2016 11:51 #79409 by terkaa
Replied by terkaa on topic Gearchange configuring
Ok, Now I see it. I added sensing of low/high gear switches before outputting motor-speed(added to gearchange.comp) Also renamed this component to gearbox. Now it works by using MDI commands ie. M3 S500 / M04 S1200. But when using manual buttons for some reason CCW rotation always engages low gear.... I have to check why.

Tero

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

More
25 Aug 2016 11:58 #79410 by andypugh
Replied by andypugh on topic Gearchange configuring

But when using manual buttons for some reason CCW rotation always engages low gear.... I have to check why.


That is why I added the manual-high and manual-low inputs. The manual spindle buttons start the spindle at 100 rpm, and go up in increments. Once the spindle is running the component won't change gear.

Or, to put it another way, the component has no way to tell what speed you intend to go to when you first start the spindle with the manual buttons.

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

More
25 Aug 2016 12:44 - 25 Aug 2016 13:14 #79414 by terkaa
Replied by terkaa on topic Gearchange configuring
It does that also after rotating spindle with MDI commands. Reason is that I used motion.spindle-speed-out it outputs negative numbers when rotating ccw. I fixed this by editing gearchange component. to check if speed-command is between negative and positive value.


Tero
Last edit: 25 Aug 2016 13:14 by terkaa.

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

More
25 Aug 2016 13:48 #79418 by andypugh
Replied by andypugh on topic Gearchange configuring

It does that also after rotating spindle with MDI commands. Reason is that I used motion.spindle-speed-out it outputs negative numbers when rotating ccw. I fixed this by editing gearchange component. to check if speed-command is between negative and positive value.


Ah :-)

else if (manual_low){
high_gear = 0;
low_gear = 1;
brake = 0;
} else if (absf(speed_command) <= max_low){
high_gear = 0;
low_gear = 1;
brake = 0;

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

Time to create page: 0.111 seconds
Powered by Kunena Forum