Help needed to get my 7i76E + 7i85S + 7i73 on my mill going.

More
11 Aug 2018 21:31 #115920 by andypugh

Can anybody give me a hint on what to do next?
I think that above new *table* of gear handling may need changes in gearcomp2 ?


Yes, you have more than 2 gears to the normal HAL component won't work.

Does the machine have a way to work out which gear it is in?

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

More
12 Aug 2018 06:53 #115944 by tecno
I have following *aids* to let LCNC know what gear is set

forum.linuxcnc.org/39-pncconf/33069-help...ing?start=410#103461

Hi / Lo = Input 15 Hi or Lo

forum.linuxcnc.org/39-pncconf/33069-help...ing?start=410#103440

A to E = Inputs 10 - 11 - 12 - 13 - 14

On given Sxxxx command
I want LCNC to check what gear setting is now, if within gear range OK start spindle.
If not, find a solution to given Sxxxx and then start spindle when in range for a gear set.

Cheers
Bengt

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

More
12 Aug 2018 10:26 #115950 by rodw
I had forgotten I had written a component for you.

As I said I don't understand spindles and Andy might have some cleverer solution but I think I would expand the component idea so it took
motion.spindle−speed−out (so it knows the requested speed)
motion.spindle−on (so it knows when to turn the spindle on)

and an output pin that is connected to your VFD (to turn it on) that would not be enabled until the right gear was selected.
Just make sure motion.spindle−at−speed is connected so motion will not start until you are at speed so if you have to change gears, motion is enabled.

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

More
12 Aug 2018 12:29 #115954 by tecno
Thanks Rod,

lets see what kind of card Andy has in his sleeve for this.

Cheers
Bengt

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

More
13 Aug 2018 13:19 #116003 by andypugh
I think Rod is on the right track with intercepting motion.spindle-on and only passing it through when conditions are met.

It is fairly easy with a component, though the pin numbering is not easy to make neat.
Writing from scratch in C you could make the pin names AL, AH, BL, BH, CL, CH etc, but for this component the same gears would be 1,7,2,8,3,9 etc
component gearblocker;
pin in bit spindle-enable-in;
pin out bit spindle-enable-out;
pin in float spindle-speed-in;
pin out float motor-speed-out;
pin in float gear.#.min-speed[10];
pin in float gear.#.max-speed[10];
pin in float gear.#.ratio[10];

pin in bit high-gear;
pin in bit gear-A;
pin in bit gear-B;
pin in bit gear-C;
pin in bit gear-D;
pin in bit gear-E;

license "gpl";
function _;

;;

FUNCTION(_){
int i;
int gear;
if (spindle_speed_in == 0) return;
switch  (gear_A  + gear_B * 2 + gear_C * 4  + gear_D * 8 + gear_E * 16 ) {
case 1: // Gear A
    gear = (high_gear != 0) ? 1 : 6;
    break;
case 2: // Gear B
    gear = (high_gear != 0) ? 2 : 7;
    break;
case 4: // Gear C
    gear = (high_gear != 0) ? 3 : 8;
    break;
case 1: // Gear D
    gear = (high_gear != 0) ? 4 : 9;
    break;
case 1: // Gear E
    gear = (high_gear != 0) ? 5 : 10;
    break;
case else: // gear selection is bitmasked to be able to spot double-engagement
    gear = 0;
}

if (spindle_speed_in >= min_speed(gear) && spindle_speed_in <= max_speed(gear)) {
    motor_speed_out = spindle_speed_ * gear_ratio(gear);
    spindle_enable_out = spindle_enable_in;
} else {
    motor_speed_out = 0;
    spindle_enable_out = 0;
}
}

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

More
13 Aug 2018 18:33 #116010 by tecno
OK, thanks Andy for that. Now som questions.
pin in bit high-gear;
pin in bit gear-A;
pin in bit gear-B;
pin in bit gear-C;
pin in bit gear-D;
pin in bit gear-E;

Is this correct entries in HAL ?
# gearbox input signals
# gearbox Hi/Lo
net high-gear  <=  hm2_7i76e.0.7i76.0.0.input-15

# gearbox A - B - C - D - E
net gear-A  <=  hm2_7i76e.0.7i76.0.0.input-10
net gear-B  <=  hm2_7i76e.0.7i76.0.0.input-11
net gear-C  <=  hm2_7i76e.0.7i76.0.0.input-12
net gear-D  <=  hm2_7i76e.0.7i76.0.0.input-13
net gear-E  <=  hm2_7i76e.0.7i76.0.0.input-14

How do I net following?
pin in bit spindle-enable-in;
pin out bit spindle-enable-out;
pin in float spindle-speed-in;
pin out float motor-speed-out;
pin in float gear.#.min-speed[10];
pin in float gear.#.max-speed[10];
pin in float gear.#.ratio[10];


File Attachment:

File Name: cb_gearbox.ini
File Size:5 KB

File Attachment:

File Name: cb_gearbox.hal
File Size:17 KB
Attachments:

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

More
13 Aug 2018 18:38 #116011 by andypugh
First of all, does that component even compile?

Secondly, your net statements in the code above will also need to mention the component pins. (I am not 100% sure what they will be called, probably gearblocker.0.gear-A and similar.

(Unless you change the component name, and you might want to)

And you might want "change up" and "change down" outputs too. Or an output to display the suggested gear.

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

More
13 Aug 2018 18:47 #116012 by tecno
Ahh, will give a try tomorrow to see if it compiles.

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

More
14 Aug 2018 09:39 #116026 by tecno
Sorry No-Go

bengt@debian:~/linuxcnc$ halcompile gearblocker.comp
Traceback (most recent call last):
File "/usr/bin/halcompile", line 1353, in <module>
main()
File "/usr/bin/halcompile", line 1322, in main
process(f, mode, outfile)
File "/usr/bin/halcompile", line 1192, in process
a, b = parse(filename)
File "/usr/bin/halcompile", line 417, in parse
a, b = f.split("\n;;\n", 1)
ValueError: need more than 1 value to unpack
bengt@debian:~/linuxcnc$

Obviously I am doing something wrong but what?

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

More
14 Aug 2018 10:05 #116027 by andypugh

Obviously I am doing something wrong but what?


Much more likely to be my fault. I typed that component on a Windows PC in my lunch break.

The problem is that halcompile is not finding the ;; separator.

Specifically, it is looking for \n;;\n (newline, two semi colons, newline)

There is a ;; in the file, but it turns out to be wrapped in Windows-style CR / LF sequences. I have fixed this. The attached file should work well enough to find the next problem.
Attachments:

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

Moderators: cmorley
Time to create page: 0.131 seconds
Powered by Kunena Forum