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

More
28 Aug 2018 14:18 #116710 by tecno
OK missed case numbering
component GB_2speed;

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[12];
pin in float gear.#.max-speed[12];
pin in float gear.#.ratio[12]; 
pin in bit high-gear;
pin in bit gear-AH;
pin in bit gear-BH;
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 gear;

if (spindle_speed_in == 0) return;
switch  (gear_AH  + gear_BH * 2 + gear_B * 4  + gear_C * 8 + gear_D * 16 + gear_E *32) {
case 1: // Gear AH
    gear = (high_gear != 0) ? 1 : 7;
    break;
case 2: // Gear BH
    gear = (high_gear != 0) ? 2 : 8;
    break;
case 4: // Gear B
    gear = (high_gear != 0) ? 3 : 9;
    break;
case 8 // Gear C
    gear = (high_gear != 0) ? 4 : 10;
    break;
case 16: // Gear D
    gear = (high_gear != 0) ? 5 : 11;
    break;
case 32: // Gear E
    gear = (high_gear != 0) ? 6 : 12;
    break;
default: // gear selection is bitmasked to be able to spot double-engagement
    gear = 0;
}

if (gear >= 0 && spindle_speed_in >= gear_min_speed(gear) && spindle_speed_in <= gear_max_speed(gear)) {
    motor_speed_out = spindle_speed_in * gear_ratio(gear);
    spindle_enable_out = spindle_enable_in;
} else {
    motor_speed_out = 0;
    spindle_enable_out = 0;
}
}

Always 50Hz = no
Say I want S800
Select Motorspeed LO
Select GearShift LO
Select Gear A ===> 50Hz on that setting will give 1000rpm spindle output and via VFD regulated down to commanded 800rpm

So VFD only regulates all gear settings max/min range === this will give me (more or less) max torque on all gear settings.

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

More
28 Aug 2018 19:37 #116735 by andypugh
I don't understand how BH and B are different input pins.
Why would you check for high-gear if you are already in AH?

is high_gear an input from the motor speed switch or from the gear ratio switch?

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

More
28 Aug 2018 19:47 #116737 by tecno
forum.linuxcnc.org/39-pncconf/33069-help...ing?start=560#116477

Have a closer look at my table that explains all gear settings.

BH = Motor at High Speed and Gear B
B = Gear B

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

More
28 Aug 2018 21:49 #116742 by andypugh

BH = Motor at High Speed and Gear B
B = Gear B


And how is that two separate HAL pins?

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

More
29 Aug 2018 07:29 - 29 Aug 2018 07:30 #116764 by tecno
I see your point Andy, here a new sheet with new pin names that I hope will work OK.




This browser does not support PDFs. Please download the PDF to view it: Download PDF

Attachments:
Last edit: 29 Aug 2018 07:30 by tecno.

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

More
29 Aug 2018 14:54 - 29 Aug 2018 14:57 #116774 by andypugh
So, 13 valid gears.

It probably makes some sense to have overlap between gears. CL and DH are probably about as good as each other at 275 rpm

I think it would be better to _sense_ the position of the motor speed switch than to actively drive the relay. That way the VFD will not be powered up while the speed is changing-over. The VFD would most probably be damaged by that.
component GB_2speed;

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 bit gear-high;
pin in bit motor-high;
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;

pin out unsigned gear-required;
pin out unsigned message;

license "gpl";
function _;

;;

FUNCTION(_){
	int actual, reqd;
	int i;
	// These need to be edited to suit the gearbox
	int speeds[15]    = {0,    80,  125,  160,  215,  270,  360,  450,  595,  750, 1000, 1191, 1500, 2500, 1e99);
	int reqd_gear[15] = {0x0, 0x01, 0x21, 0x02, 0x22, 0x04, 0x24, 0x08, 0x28, 0x10, 0x48, 0x68, 0x50, 0x70, 0x0};

	if (spindle_speed_in == 0) return;
	actual = (high_gear * 0x40 + motor-high * 0x20  + gear_A * 0x10 + gear_B * 0x08  + gear_C * 0x04 + gear_D * 0x02 + gear_E * 0x01);
	for (i = 0, spindle_speed_in > speeds[i] && i < 14; i++);
	gear_required = reqd_gear[i];
	if (gear_required == actual && gear_required != 0x0){ // We are in the right gear
		spindle_enable_out = spindle_enable_in;
		motor_speed_out = speeds[13] * (spindle_speed_in / speeds[i]);
		message = 0;
	} else {
		motor_speed_out = 0;
		spindle_enable_out = 0;
		message = i;
	}
}

This adds an extra output that can be used with the message HAL component to say which gear should be selected. (using bitslice to convert the int to individual bits)
Last edit: 29 Aug 2018 14:57 by andypugh.

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

More
29 Aug 2018 15:03 #116775 by andypugh

This adds an extra output that can be used with the message HAL component to say which gear should be selected. (using bitslice to convert the int to individual bits)


Actually, requiring bitslice is laziness on my part.
component GB_2speed;

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 bit gear-high;
pin in bit motor-high;
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;

pin out unsigned gear-required;
pin out bit message[14];

license "gpl";
function _;

;;

FUNCTION(_){
	int actual, reqd;
	int i;
	// These need to be edited to suit the gearbox
	int speeds[15]    = {0,    80,  125,  160,  215,  270,  360,  450,  595,  750, 1000, 1191, 1500, 2500, 1e99);
	int reqd_gear[15] = {0x0, 0x01, 0x21, 0x02, 0x22, 0x04, 0x24, 0x08, 0x28, 0x10, 0x48, 0x68, 0x50, 0x70, 0x0};

	if (spindle_speed_in == 0) return;
	actual = (high_gear * 0x40 + motor-high * 0x20  + gear_A * 0x10 + gear_B * 0x08  + gear_C * 0x04 + gear_D * 0x02 + gear_E * 0x01);
	for (i = 0, spindle_speed_in > speeds[i] && i < 14; i++);
	gear_required = reqd_gear[i];
	if (gear_required == actual && gear_required != 0x0){ // We are in the right gear
		spindle_enable_out = spindle_enable_in;
		motor_speed_out = speeds[13] * (spindle_speed_in / speeds[i]);
		message = 0;
	} else {
                int j;
		motor_speed_out = 0;
		spindle_enable_out = 0;
		for (j = 0; j < 13; j++) { message(j) = 0; }
                message(i) = 1;
	}
}

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

More
29 Aug 2018 18:37 #116805 by tecno
Now this was a surprise as there are no email notifications on this subject.

Will have a look tomorrow and see if I can grasp this code, thanks Andy.

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

More
29 Aug 2018 19:09 - 29 Aug 2018 19:10 #116811 by andypugh
Again, done at work in Windows, so no guarantees of any sort.

Already spotted one error i have a comma where a semicolon belongs
for (i = 0; spindle_speed_in > speeds && i < 14; i++);
Last edit: 29 Aug 2018 19:10 by andypugh.

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

More
29 Aug 2018 19:41 #116817 by tecno

Again, done at work in Windows, so no guarantees of any sort.

Already spotted one error i have a comma where a semicolon belongs
for (i = 0; spindle_speed_in > speeds && i < 14; i++);


speeds && i < 14; i++);
Is above OK?

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

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