Bridgeport Torq-Cut TC4G Retrofit

More
09 Mar 2021 01:57 - 09 Mar 2021 02:03 #201509 by chopper79
Still working on the comp file.

Currently the gears change based on rpm, but having the following issues and do not know how to solve them yet.

1) Rpm needs to drop to 11rpm for gear change (gears grind) Currently the gears change at commanded rpm (thankfully I have the max rpm set low)
2) Once gear change occurs the corresponding outputs all stay on and no change will occur until an m5 is issued.
3) Change from low to high or high to low will not occur unless m5 is issued first

So the question is how would I reduce the rpm to 11 rpm and then back up after change?
How would I shut off outputs once they are on?

I was thinking that an end if would work for the outputs. Seems that } ends the program anyway from what I have read, but the outputs still stay on. For the gear change speed I would think something like a param rw change-speed =xx would be nice, but not sure how to implement at the moment. This way I can change the param value in the hal file instead of recompiling the comp anytime I made a change to that parameter.

Attached is the one Andy Pugh created and I am just trying to implement it to get basic functionality before modifying.

Any general help would be appreciated please. New to working with comp files (or c in general) so please take that into consideration on my questions. I am trying..
Attachments:
Last edit: 09 Mar 2021 02:03 by chopper79.

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

More
09 Mar 2021 22:34 #201611 by andypugh
Here is the current version of the component, that attempts to shift gears on the fly (but only during a G0 move)

Your shifting logic would probably be different.

But is there much call for changing spindle speed without a tool change with a milling machine?
component gearchoice "A component to choose spindle gears according to spindle speed";
pin in float speed-command;
pin in float motor-speed-fb;
pin in float spindle-speed-fb;
pin in signed motion-mode;
pin in signed motion-mask = 3;
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;

include "rtapi_math.h";

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

;;

FUNCTION(_){
    static int state;
    double des_motor_speed;
    
    switch (state) {
    case 0: // spindle off
        if (spindle_on){
            if (manual_high){
                state = 1;
            } else if (manual_low){
                state = 2;
            } else if (speed_command > max_low){
                state = 1;
            } else {
                state = 2;
            }
        } else { // spindle off
            high_gear = 0;
            low_gear = 0;
            brake = brake_enable;
        }
        break;
    case 1: // high
        high_gear = 1;
        low_gear = 0;
        brake = 0;
        motor_speed = speed_command * high_ratio;
        if( ! spindle_on){
            state = 0;
        }
        if (speed_command <= 0.9 * max_low) {
            if ( ! manual_high && (1 << motion_mode & motion_mask)){
                state = 3;
                high_gear = 0;
            }
        }
        break;
    case 2: // low
        high_gear = 0;
        low_gear = 1;
        brake = 0;
        motor_speed = speed_command * low_ratio;
        if( ! spindle_on){
            state = 0;
        }
        if (speed_command > max_low) {
            if ( ! manual_low && (1 << motion_mode & motion_mask)){
                state = 4;
                low_gear = 0;
            }
        }
        break;
    case 3: // High to low gear shift
        des_motor_speed = spindle_speed_fb * low_ratio;
        motor_speed = 1.2 * des_motor_speed;
        if( ! spindle_on){
            state = 0;
        }
        if (fabs(des_motor_speed - motor_speed_fb) < 100){
            state = 2;
        }
        break;
    case 4: // Low to High gear shift
        des_motor_speed = spindle_speed_fb * high_ratio;
        motor_speed = 0.9 * des_motor_speed;
        if( ! spindle_on){
            state = 0;
        }
        if (fabs(des_motor_speed - motor_speed_fb)  < 300){
            state = 1;
        }
        break;
    }
}
The following user(s) said Thank You: chopper79

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

More
10 Mar 2021 01:21 - 10 Mar 2021 01:39 #201620 by chopper79
Well did some more work on the gear change component. Seems that I am now getting the result I was looking for (during testing anyway). Will do some more testing before I call it good to go.

Gear change speed is set in the ini at 11 rpm along with other parameters. This can be changed in the ini file as needed also which is nice. This way the component can be left alone and not complied every time a change is made to some of the parameters that are user defined.

Last edit: 10 Mar 2021 01:39 by chopper79.

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

More
10 Mar 2021 01:33 - 10 Mar 2021 21:06 #201621 by chopper79

Here is the current version of the component, that attempts to shift gears on the fly (but only during a G0 move)

Your shifting logic would probably be different.

But is there much call for changing spindle speed without a tool change with a milling machine?


I believe there is a need in some cases. I sometimes use the same tool at different rpm depending on the feature and goal try to achieve. A random example would be:

Face mill at 600rpm for roughing and then use the same face mill for a final skim cut at 1200rpm. Changing speed and gear ratio without doing a tool change or issuing an M5 would be nice.

Currently the component I have been modifying works well. Only thing it seems that it is missing is ability to change rpm using just an Snnn. You must first issue an M5 and then you can M3Snnn.

Maybe I will work on that at some point down the road. No big deal at the moment.
Last edit: 10 Mar 2021 21:06 by chopper79.

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

More
10 Mar 2021 18:31 #201674 by Michael
Mind sharing your hal and ini up to this point? Curious what your tool change looks like.

Clean machine you have there. I am disassembling my enclousre and cleaning/prepping for paint while I wait for my spindle to get back. Mine is pretty beat though.

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

More
14 Mar 2021 03:39 - 14 Mar 2021 03:47 #202186 by chopper79
Thanks it has taken a lot to clean it back up so far. I will share them this weekend or first of the week. I have to clean them up a bit to get rid of all my trial and errors.

Reworking the orientation side and can not get the spindle index to function correctly. The orientation works but without the index the spindle stops in random places. Trying to set the spindle index true when I first tart LCNC. Then on first rotation of spindle the index goes low.

Tried the following in hal.

sets spindle-index-enable = 1
sets spindle-index-enable = TRUE
sets spindle.0.index-enable = 1
sets spindle.0.index-enable = TRUE

Also tried adding this to hal " setp hm2_[HOSTMOT2](BOARD).0.encoder.05.index-enable 1" with no luck

None of them will set in hal and I get an error startup which is "spindle-index-enable not found". When I comment it out and launch LCNC. I go into the halshow and the signals show up. I can set it in halshow using sets spindle-index-enable 1

When I set it in halshow the index and orientation work as planned. Then on next start up I have to repeat the process.

Any ideas on why I can not set it in my hal?

**** Every example I have came across while researching issue shows exactly what I have been doing and nobody as reported an issue doing it ****
Last edit: 14 Mar 2021 03:47 by chopper79.

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

More
14 Mar 2021 13:04 #202208 by andypugh

None of them will set in hal and I get an error startup which is "spindle-index-enable not found".


You have to "sets" the signal _after_ it is created. (assuming that it is created)

It won't exist until the "net spindle-index-enable...." line in one of the HAL files.
The following user(s) said Thank You: chopper79

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

More
14 Mar 2021 15:36 #202217 by chopper79
Hmm..

I have the following in my hal file.

net spindle-index-enable <=> hm2_[HOSTMOT2](BOARD).0.encoder.05.index-enable
net spindle-index-enable <=> spindle.0.index-enable
sets spindle-index-enable 1

Figured that is what I needed to do and it shows up in the halshow and able to force it high in halshow as stated earlier.

I have to comment out sets spindle-index-enable 1 to get LCNC to launch without getting an error of spindle-index-enable not found.

I will try to rearrange the position of the items in hal to see if that helps.

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

More
14 Mar 2021 15:48 #202221 by andypugh
That should work.

One possible issue is that we have had trouble with the docs build inserting dashes "–" in the docs rather than hyphens "-", so perhaps if you copy-pasted that would cause the problem.
Otherwise, I am puzzled.

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

More
15 Mar 2021 02:39 #202298 by Michael
Can you see the index in halmeter going true/false every rotation? How are you trying to get orientation working? The signal you are using should just be flipping themselves back and forth. I think something else is causing the random positions.

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

Moderators: cncbasher
Time to create page: 0.093 seconds
Powered by Kunena Forum