Monday, December 8, 2008

types of compensations in cnc

Now let's discuss the compensation types for the two most popular forms of CNC machine tools, machining centers and turning centers. Keep in mind that while the actual use of these functions vary dramatically from one machine to the next, the basic reasoning behind each compensation type remains remarkably similar. With an understanding of why the compensation type is required, and with an elementary understanding of how it is applied to one specific control, you should be able to adapt to any variations that you come across.

Tool length compensation

This machining center compensation type allows the programmer to forget about each tool's length as the program is written. Instead of having to know the exact length of each tool and tediously calculating Z axis positions based on the tool's length, the programmer simply instates tool length compensation on each tool's first Z axis approach movement to the workpiece.

At the machine during setup, the operator will input the tool length compensation value for each tool in the corresponding offset. This, of course, means the tool length compensation value must first be measured.

If tool length compensation is used wisely, the tool length compensation value can be measured off line (in a tool length measurement gage) to minimize setup time. With this method, the tool length compensation value is simply the length of the tool.

Many CNC controls allow the length of the tool to be used as the offset value. One popular command to instate tool length compensation is G43. Within the G43 command, the programmer includes an H word that specifies the number of the offset containing the tool's length value. Here is an example program that utilizes tool length compensation with two tools. The program simply drills two holes (one with each tool). Notice that tool length compensation is being instated in lines N015 and N055.

Program
O0001 (Program number)
N005 T01 M06 (Place tool number one in the spindle)
N010 G54 G90 S400 M03 T02 (Select coordinate system, absolute mode, start spindle CW at 400 RPM, get tool number two ready)
N013 G00 X1.0 Y1.0 (Rapid to first XY position)
N015 G43 H01 Z.1 M08 (Instate tool length compensation on first Z move, turn on coolant)
N020 G01 Z-1.5 F4. (Drill hole)
N025 G00 Z.1 M09 (Rapid out of hole, turn off coolant)
N030 G91 G28 Z0 M19 (Return to tool change position, orient spindle)
N035 M01 (Optional stop) N040 T02 M06 (Place tool number two in spindle)
N045 G54 G90 S400 M03 T01 (Select coordinate system, absolute mode, start spindle at 400 RPM, get tool number one ready)
N050 G00 X2. Y1. (Rapid to first XY position)
N055 G43 H02 Z.1 M08 (Instate tool length compensation on tool's first Z move, turn on coolant)
N060 G01 Z-1.2 F5.5 (Drill hole)
N065 G00 Z.1 M08 (Rapid out of hole, turn off coolant)
N070 G91 G28 Z0 M19 (Return to tool change position, orient spindle)
N075 M30 (End of program)

As stated, this feature varies dramatically in use from one control model to the next. You must reference your control manufacturer's programming manual to learn more about how tool length compensation applies to your particular machining center. Sizing with tool length compensation

In the marksman analogy, we said that the marksman would not know for sure whether the initial sight adjustment is perfectly correct until the first shot is fired. In similar fashion, the CNC operator will not know for certain whether the tool length compensation value is perfectly correct until the first workpiece is machined. Say for example, the tool length measurement was made incorrectly. During the measurement, the operator finds the tool to be 6.5372 in long. But the actual tool length is 6.5355 in. In this case, the tool would machine slightly shallower in Z that it is supposed to. After machining, the minor depth change can be made by adjusting the offset, NOT THE PROGRAM.

In some cases, even if the tool length value is measured perfectly, other problems may cause the tool not to machine to the proper depth. If, for example, the workpiece or setup is quite weak, tool pressure may cause the workpiece to tend to push away from the tool doing the machining.

For critical surfaces or when tool pressure is unpredictable, the operator can even trial cut the workpiece under the influence of an offset slightly LARGER than the measured value to ensure that some excess stock will be left. After machining, the operator can measure the surface to determine precisely how much offset change is necessary to machine the workpiece to size.

Cutter radius compensation

Just as tool length compensation allows the machining center programmer to forget about the tool's length, so does cutter radius compensation allow the programmer to forget about the cutter's radius as contours are programmed. While it may be obvious, let us point out that cutter radius compensation is ONLY used for milling cutters and only when milling on the periphery of the cutter. You would NEVER consider using cutter radius compensation for a drill, tap, reamer, or other hole machining tool.

Reasons for cutter radius compensation

Let's begin by discussing four reasons why cutter radius compensation is not only required, but also very helpful to the CNC user.

Program coordinates are easier to calculate

Without cutter radius compensation, machining center programmers must program the centerline path of all milling cutters. An example program using this technique was shown during our discussion of motion types (key concept number three). When programming centerline path, the programmer must know the precise diameter of the milling cutter and calculate program movements based on the tool's centerline path.

With cutter radius compensation, the programmer can program the coordinates of the work surface, NOT the tool's centerline path. This eliminates the need for many calculations.

Keep in mind that we are now talking about manual programming. If you have a CAM (computer aided manufacturing) system, your CAM system can probably generate centerline path just as easily as work surface path.

Range of cutter sizes

Say you do program centerline path for a given workpiece contour and do not use cutter radius compensation. Say you have programmed based on a one inch diameter tool. But when the job is to be run, you find that your company does not have any one inch end mills. Say the closest you have is a 0.875 in cutter. In this case, the entire cutter path would have to be changed in the program to match the new cutter size. With cutter radius compensation, handling this problem is as simple as changing an offset value.

Easy sizing

As with tool length compensation, the operator can use the cutter radius compensation offset to help with sizing. If the contour is not coming out to size (possibly due to tool pressure), an offset can be changed to allow for the imperfection.

Roughing and finishing

This is also a manual programming related reason for using cutter radius compensation. If contours must be rough and finish milled, cutter radius compensation allows the programmer to used the same programmed coordinates needed to finish mill the workpiece to rough mill the workpiece. This keeps the programmer from having to calculate to sets of milling coordinates (one for roughing and one for finishing). To leave stock for finishing during the rough milling, the operator will simply make the cutter radius compensation offset value slightly larger than the cutter's actual size. This will keep the cutter away from the surface being milled and leave the desired finishing stock.

How to program cutter radius compensation

The usage of cutter radius compensation does vary from one control to the next. Additionally, each control will have a set of strict rules that specify how cutter radius compensation is instated, used, and cancelled. Here we just show the basics of how it is programmed and give an example for how it is used on one popular control model. You must refer to your CNC control manufacturer's manual for more on your particular control.

Most controls use three G codes with cutter radius compensation. G41 is used to instate a cutter left condition (climb milling with a right hand cutter). G42 is used to instate a cutter right condition (conventional milling). G40 is used to cancel cutter radius compensation. Additionally, many controls use a D word to specify the offset number used with cutter radius compensation.

To determine whether to use G41 or G42, simply look in the direction the cutter is moving during machining and ask yourself if the cutter is on the left or right side of the surface being machined. If on the left, use G41. If on the right, use G42. Figure 4.6 shows some examples that should help you understand how to determine whether to use G41 or G42 to instate. Figure 4.6 - Drawings show how to determine whether to use G41 or G42 to instate cutter radius compensation.

Once cutter radius compensation is properly instated, it the cutter will be kept on the left side or right side (depending on whether G41 or G42 is used to instate) of all surfaces until the G40 command to cancel compensation.

Dimensional tool (wear) offsets

This compensation type applies only to turning centers. When setting up tools, it is infeasible to expect the setup person to perfectly set each tool into position. It is likely that some minor positioning problem will exist. And even if all tools could be perfectly positioned, as any single point turning or boring tool begins cutting, it will begin to wear. As a turning or boring tool wears, the tool wear will affect the size of the workpiece being machined.

For these reasons, and to allow easy sizing of turned workpieces, dimensional tool offsets are required (also called simply tool offsets). Tool offsets are instated as part of a four digit T word. The first two digits command the tool station number and the second two digits command the offset number to be instated. The command T0101, for example, rotates the turret to station number one and instates offset number one. It is wise to always make the number of the primary offset used with a tool the same as the tool station number.

When a tool offset is instated, the control actually shifts the entire coordinate system by the amount of the offset. It will be as if the operator could actually move the tool in the turret by the amount of the offset.

Each dimensional offset has two values, one for X and one for Z. The operator will have control of what the tool does in both axes as the workpiece is being machined. Here's an example that should help you understand how dimensional tool offsets work. Say you have written a program to use tool number one (with offset number one) to turn a three inch diameter. After machining the three inch diameter, it is measured and found to be 3.005 in. That is, the workpiece is 0.005 in oversize. In this case, the X value of offset number one will be reduced by 0.005 in. When the program is run again, tool number one will machine the workpiece 0.005 smaller.

How to guarantee your first workpiece comes out on size

If working on an engine lathe, manually turning a precise diameter, you would first allow the tool to skim cut to find out exactly where the tool is located. After skim cutting, you can determine precisely how much to turn the crank or handle to make the tool turn the desired diameter.

In the same way, you can use dimensional tool offsets to ensure that any tool will not violate the workpiece on its first cut. Outside diameter turning tools, for example, could be offset slightly plus in X to ensure that some excess stock is left. Inside diameter bored holes could be offset slightly minus in X for the same purpose. In either case, the first time the tool is run, the operator can rest assured that the workpiece will come out with some excess finishing stock (it will NOT be scrapped). After machining the first time, the surface can be measured. The operator will then adjust the corresponding offset accordingly and re-machine with the tool This time the surface will be machined perfectly to size. Using this technique on each tool in the program will almost guarantee that the first workpiece will not be scrapped.

Tool nose radius compensation

This turning center compensation type is very similar to cutter radius compensation. In fact the same three G codes are used. G41 instates tool nose radius compensation in a tool left condition. G42 instates with a tool right condition. G40 cancels tool nose radius compensation. For this reason, minimize our discussion of tool nose radius compensation to avoid repeating information. Just as cutter radius compensation allows the programmer to program work surface coordinates (not allowing for tool radius), so does tool nose radius compensation.

To determine G41 or G42, simply look in the direction the tool is moving during the cut and ask yourself which side of the workpiece the tool is on. If the tool is on the left, use G41 (this would be the case when boring toward the chuck). If the tool is on the right, use G42 (turning toward the chuck). Once you determine which to use, include the proper G code in the tool's first approach to the workpiece. Once tool nose radius compensation is instated, it remains in effect until cancelled.

Keep in mind that the tool nose radius is quite small (usually 1/64, 1/32, 3/64, or 1/16 in), meaning the deviation from the work surface will also be quite small. It is possible that if you are only chamfering corners to break sharp edges, you may not need tool nose radius compensation. However, if the surfaces being machined are critical (Morse taper, for example), you must compensate for the radius of the tool. Also, you should only need tool nose radius compensation when finishing. You should not use it for roughing operations.

Other types of compensation

The compensation types shown have been for machining centers and turning centers. But all forms of CNC equipment have some form of compensation to allow for unpredictable situations. Here are some other brief examples.

CNC Wire EDM machines have two kinds of compensation. One, called wire offset works in a very similar way to cutter radius compensation to keep the wire centerline away from the work surface by the wire radius plus the overburn amount. It is also used to help make trim (finishing) passes using the same series of motion coordinates.

The second form of compensation for wire EDM machines is taper cutting. For machining the clearance angle needed with dies and form tools, the programmer can easily specify the direction of the taper (left or right) and the angle desired. The operator fills in some offsets to tell the control the position of the upper guide relative to the workpiece and the control does the rest.

Laser cutting machines also have a feature like cutter radius compensation to keep the laser the radius of the laser beam away from the surface being machined. CNC press breaks have a form of compensation to allow for bend allowances based on the workpiece material and thickness. Generally speaking, if the CNC user is faced with any unpredictable situations during programming, it is likely that the CNC control manufacturer has come up with a form of compensation to deal with the problem. 

No comments: