Parametric Subroutines:

 One of the major expenses in NC manufacturing is the cost of Programming. Efforts are made to reduce this cost to the minimum. As mentioned earlier, canned cycles save time of programming and keep the program short. This reduces processing time and chances of error occurring due to largeness of data. Canned cycles are more of fixed type. These do not offer optimization in programming because these are designed for the general situation. Programming costs can be reduced considerably if the time involved is decreased by using canned cycles, which the programmer writes himself. This can be done by storing a number of part program blocks more appropriately called subroutines, in the controller and call them for action by the main program.

For example, referring to following figure pertaining to a turning operation on a lathe, the subroutine will be as follows:

 

 G25 (Start of Subroutine)

$L11 (Identification number)

N1001 G01 X-7500 F0 S400 M03

N1002 G95 Z-255000 F250

N1003 X2500 Z2500

N1004 Z252500 F0

G26 (End of Subroutine)

Steps 001 to 004 represent blocks of information pertaining to certain moves 1 through 4 in figure.

 The main program will be

N01 G80

N02 G01 X22500 Z405000 F0

N03 G91

N04 L1101             enter subroutine 11

N05 G90                enter main program

N06 G00 X37500 Z405000 F0

 

Steps N02 and N06 represent operation reaching the starting point while N04 leads to calling the subroutine L11 and run it one (01) time and the subroutine is searched and acted upon and when finished returns to main program at block N05 and continues. If this subroutine is required again, it can be called similarly. However this cycle is for fixed dimensions since in this case all values are assigned in the subroutine.

 If repetitive subroutine mode is used, it will be more beneficial since it will eliminate many steps in programming, e.g. if it is mentioned "N04L1104" in the main program, then the subroutine L11 will be repeated four times. This is really useful since it will give a series of cuts. In the first run of the subroutine, the tool feed will be 7.5mm and retract 2.5mm, in the second run 5.0mm of metal will be removed and so on. This procedure not only reduces the programming time but also the length of program considerably. 

The most important aspect of parametric subroutine is that it allows the programmer to make his own canned cycles. What is done is that the common sequence of motion of components on machine tool is decided and subroutine is written without the dimensions. For example, in lathe operations, the common moves are longitudinal, transverse motions and other important parameters are feed rate, spindle speed and direction. The values for these parameters for any component are put in the main part program in the block, which calls the subroutine. This is similar to tool length/radius compensation, discussed earlier. For example the subroutine will be: 

G25

$L11

$L11 (Identification number)

N1001 G01 X; 01 F; 02 S400 M03

N1002 G95 Z; 03 F;04

N1003 X; 05 Z;06

N1004 Z;07 F0

G26 

The call block in the main pat program will be

N04 L1104; -7500; 0; -255000; 250; 2500; 2500; 252500

The value of X, Z and F were not given in the subroutine while a number was assigned to them, e.g.01 & 05 for X, 02 & 04 for feed (F) and 3,6 & 7 for Z. 

Thus it can be seen that parametric subroutine is really useful for roughing outs, thread cutting, key way milling, drilling etc, where a sequence of motions is involved. By allowing subroutine with large number of parameters, concept of 'family of parts' of GT (Group Technology) programming can be evolved. 

To make use of NC highly productive, one must aim at improving programming as far as possible by reducing length of program and requirement of skill. Parametric subroutine offers these advantages to large extent. Use of such techniques consequently reduces costs, programming errors and most important of all increases programming flexibility. 

Hosted by www.Geocities.ws

1