Mazak Dyna-turn 2L
I am in the process of converting a Mazak Dyna-turn 2L to Linuxcnc. After having modified the “toolerator3000.comp” and “serialcon2.comp” to handle the toolchange, I am now looking at the gearshift. My plan is to extend the Arduino and .comp code to also handle gearshift but I can’t see how to make the connection from G-code to .comp code, and how to handle the different speed scaling factors, any suggestions?
The lathe has a 4 level gear shift: natural, low, medium and high, the shift is controlled by 4 hydraulic actuators and position feedback is by 4 switches.
Please Log in or Create an account to join the conversation.
I have a 2-speed gearbox on my Holbrook. It is actuated by magnetic clutches, but the LinuxCNC side will look just the same.
In my case I have a .comp file that chooses a gear based on the spindle speed command. In addition there is a front panel switch to force high or low gear. (marked High, Low, Auto).
You probably need something similar, and probably have no need for the Arduino.
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;
}
}
Please Log in or Create an account to join the conversation.
Thanks for the answer.
The control is the problem. I am new to CNC lathe’s and I am not sure that a automatic change based on the speed command is the best solution, it may force a gearshift in the middle of a operation or one may choose a gear based on the load. The old control used a number of M codes for the control and the switch logic was implemented in a large number of 74XX TTL chips. The reason for wanting to use the Arduino is to save I/O pins on the LPT port and to implement the gear switch login in the Arduino. The logic require: check for spindle stopped, enable very low rpm, change gear, wait for feedback, restore spindle rpm, report gear change complete. Would using a number of unused tool numbers bee a solution?
Please Log in or Create an account to join the conversation.
My .comp only chooses the gear when the spindle transitions from off to on, so it won't change speed with the spindle on.I am not sure that a automatic change based on the speed command is the best solution, it may force a gearshift in the middle of a operation
I have considered a modification so that it will detect a G0 move and attempt a speed-switch then (with auto-synchronisation, because with a spindle encoder and a smart VFD that's not so hard to do)
The reason for wanting to use the Arduino is to save I/O pins on the LPT port
I had not for one moment considered the possibility that you were running a Mazak from the parallel port.
Do the Mazak drives even accept step/dir ?
Please Log in or Create an account to join the conversation.
The interface to the original Fanuc drivers was 0-10V and the encoders were connected to the Fanuc controller. After spending a long time to repair the drivers and debugging the Fanuc/Mazak interface logic it tuned out that the controller also was defect. I then decided to replace everything and started with the servo drivers. The drivers are now based on the YAPSC project having STEP/DIR interface, and seems to work ok.
Please Log in or Create an account to join the conversation.
You would probably need to re-code the .comp as a state machine. State machines in .comp look a bit like this, typicallyI failed to recognize that the gear change only too place on the OFF to ON transition, this may work. How do I (from the .comp code) prevent the cycles to continue while the gear change takes place?
...
parameter unsigned state
...
;;
FUNCTION(_){
switch state{
case 0: // Waiting for spindle off
if (! spindle_on){
state = 1
}
case 1; // Waiting for spindle on
if (spindle_on) {
if (some sort of logic to choose gear 1) {
gear1 = 1;
gear2 = 0;
gear3 = 0;
gear4 = 0;
state = 11;
break;
}
if (some sort of logic to choose gear 2) {
gear1 = 0;
gear2 = 2;
gear3 = 0;
gear4 = 0;
state = 12;
break;
}
....
case 11: // Waiting for gear 1 engagement
if (gear_1_engaged) {
state = 21;
}
break
case 12: // Waiting for gear 2 engagement
if (gear_2_engaged) {
state = 22;
}
break;
...
case 21: // gear 1 speed output
speed_out = speed_in * scale_1;
if (! spindle_on){
speed_out = 0;
state = 0;
}
....
}
The "..." show places where code for the other gears needs to be added.
Rather than struggle with limited parallel port IO (and 5V signal levels) you might want to look at something like a Mesa 5i25 / 7i76 combo to add fast step generators and a lot more IO. It will make things easier. Or carry on using the parallel port and connect a Pico USC to the parallel port to achieve the same thing. (16 digital inputs and 8 SSR outputs)The interface to the original Fanuc drivers was 0-10V and the encoders were connected to the Fanuc controller. After spending a long time to repair the drivers and debugging the Fanuc/Mazak interface logic it tuned out that the controller also was defect. I then decided to replace everything and started with the servo drivers. The drivers are now based on the YAPSC project having STEP/DIR interface, and seems to work ok.
Please Log in or Create an account to join the conversation.