Читать книгу CNC Control Setup for Milling and Turning: - Peter Smid - Страница 11

Оглавление
3 PROGRAM INTERPRETATION

When working with CNC machining centers or CNC lathes programs, the machine operator monitors not only the numerous tool motions, but also the actual program flow. This is especially true - and a very important observation - for the beginning of the actual production run. During full production, the CNC operator will frequently check the program as it is displayed on the control monitor (screen), to keep an eye on the machining process. This initial evaluation usually takes place at the control system of the machine during part setup. Many machine shops also issue a printed copy of the part program to make the monitoring a bit easier, particularly for programs that are only a page or two.

Regardless of the extent a CNC operator is involved with a particular part program (on screen or on paper), it is important that he or she fully understands its contents - what exact information does the program really provide? There is a lot more information provided even in a short program than a brief simple look can absorb. The first step in the process of understanding the program itself is to understand the way it was written - to understand the program structure.

PROGRAM STRUCTURE

A CNC program can be written in so many different ways that is makes it impossible to find any degree of consistency between individual part programmers, even within the same company. Operators can greatly influence any programming style, based on their experience of using many programs to machine various parts. Operators can also communicate their preferences to the CNC programmer, who should use such information in the best way to improve program structure.

Logical Structure

Every part program has a single and very specific purpose that will always be the same - to machine a part. The way it is written has to be logical in many ways, some of them quite obvious. For example, the order of tools in the program is the order of tools for actual machining. If coolant is required for a certain operation or for the whole part, it is logical to include coolant ON function (usually M08) in the program. Machining order must also be logical - roughing will always be done before finishing, heavy operations before light operations, etc. All these structural features are generally followed by all CNC programmers, otherwise their programs would not work.

The area of the ‘not-so-obvious’ program structure flaws can be quite large. Poor program structure will increase lead time and also can make a life of the operator a bit unpleasant or even difficult. These flaws of structure belong to the logical program features and mainly relate to G-codes and M-functions, particularly to their application within a program.

One very common break of logical structure is using the right G-codes in the wrong place. Typical example are G-codes used before tool change, for example:

N1 G21 G17 G40 G80 G90 G54 G00 G49

N2 T01 M06

N3 . . .

Although technically correct, this structure has several potential problems. One is having G21 (or G20) in the same block with other G-codes, which is not allowed on some controls, especially those that can convert metric and imperial mode between each other. That may not be important for one machine, but for another, it may be very important. Placing G20/G21 in a block by itself will make the program available to more similar machines and prevents problems on those machines that require it.

Is G20/G21 Really Needed ?

Some programmers do not use G20 or G21 unit selection in the program at all. They often based their reasoning on the fact that only metric jobs or only jobs in imperial units are ever done on that machine. While that may be true today, it may not be true tomorrow. Programmers who do not use the proper G-code for units selection count on the following control feature:

Units set before machine shut-off remain in effect after machine power-on

In absolute terms, command G20 or G21 is not needed in the program, providing the units are set at the control. However, including the units selection in the program will guarantee that that only those units will be in effect - now or in the future. There is no practical difference between units set through the program and units set at the control.

This observation slightly changes the earlier example:

N1 G21

N2 G17 G40 G80 G90 G54 G00 G49

N3 T01 M06

N4 . . .

By isolating the G20 or G21 command, the program is one step closer to being portable between machines with similar control systems.

G17 is Good for ...?

Preparatory command G17 is often part of the program initial blocks, and surprisingly many CNC programmers (and operators) have no idea why it is there in the first place or what it is for.

By definition, G17 is the first of three similar preparatory commands - each define a unique working plane:

▪G17 - XY plane

▪G18 - ZX plane

▪G19 - YZ plane

Plane selection is important only in two major areas:

Circular interpolation... G02 and G03
Cutter radius offset... G41 and G42

In circular interpolation, it supplies the MISSING AXIS:

Consider this simple example ...


... and a section of the part program:

N1 G21
N2 G17 G40 G80 G90 G54 G00 G49
...
N21 G01 X0 Y25.0 F200.0(P1)
N22 G02 X20.0 I20.0 J0(P2)
N23 G03 X36.0 I8.0 J0(P3)
N24 G01 ...

Note that in block N21, the linear motion ends and arc motion begins (P1). Both X and Y axes are programmed in this block. The following two blocks are both circular motions. As per drawing, the Y-axis is identical for both start points P1 and P2. Since axis commands are modal, they do not have to be repeated in every block. That accounts for only X being programmed for both arcs.

Considering that arcs always require two axes, and also considering that they can be machined in ZX and YZ planes, the control system has to replace the axis that is not included. This is where the plane selection command comes in. In the example, G17 in block N2 provides the missing axis as the Y-axis. Control system will interpret the program as:

N1 G21

N2 G17 G40 G80 G90 G54 G00 G49

...

N21 G01 X0 Y25.0 F200.0 (P1)

N22 G02 X20.0 Y25.0 I20.0 J0 (P2)

N23 G03 X36.0 Y25.0 I8.0 J0 (P3)

N24 G01 ...

In cutter radius offset mode, it supplies the DIRECTION:

Cutter radius offset is programmed by two preparatory commands:

▪G41 ... cutter radius offset to the LEFT
▪G42 ... cutter radius offset to the RIGHT

The left and right descriptions indicate position of the cutter when viewed into the cutting direction. As this direction is always relative to the three available planes, the correct plane selection command has to be included in the program.

Initial Settings

In addition to the plane selection command, such as G17, the initial block N2 contains several other G-codes:

N2 G17 G40 G80 G90 G54 G00 G49

Note that all are included before tool change, which is an important consideration.

Many CNC programmers include these G-codes at the program beginning, mainly for two reasons:

▪Cancellation of commands that may be in effect

▪Initialization of the program mode

The block that contains these codes is often called the safety block. Although well meant, it also presents a sense of false security. There is no guarantee that the program will run smoothly, regardless of this block.

There are three common cancellations in block N2:

▪G40 ... Cancel cutter radius offset
▪G80 ... Cancel fixed cycle
▪G49 ... Cancel tool length offset

Are these cancellations necessary? In one word - no. They are mainly a leftover from early days of NC and even CNC and have gained a permanency of their own. What do they represent at the program beginning?

The answer uses three words ‘just in case’. Just in case the cutter radius is active when cutting was interrupted; just in case the fixed cycle has not been canceled; just in case the tool length offset is still active. Are these situations possible? They may be in some very extreme cases, but practically, they are not likely. The main reason is that when you press the RESET key on the control panel, these cancellations are automatically performed. On the other hand, it does no harm to include G40 and G80 in the program, ‘just in case’.

G49 cancellation is different. This command cancels the tool length compensation. There is no reason to program it at all - in fact, by using G49 in the program, you may create a situation that could create more problems than it supposed to solve.

That leaves three other G-codes that need to be addressed. They are the initiations commands:

G90 ... Absolute mode of programming
G54 ... Work offset
G00 ... Rapid motion

Again, these are good commands in a bad place:

N1 G21

N2 G17 G40 G80 G90 G54 G00 G49

N3 T01 M06

N4 X50.0 Y100.0 S900 M03 T02

N5 G43 Z10.0 H01 M08

... <G90 IS IN EFFECT>

...

N17 G91 X-10.0

N18 Y23.0 (... UNWANTED INTERRUPTION !)

...

If the program flows from the beginning to the end without a problem, it may appear that it is a good program in terms of its structure. Now consider that for some reason, the machining has to be interrupted in block N18. Perhaps because the tool may have broken or some other mishap. The typical course of action in this case is to remove the broken tool, replace it, set a new tool length offset and - start machining from block N4 -this is the block after tool change. The proper holder with the tool is already in the spindle, so it makes sense to start from block N4. Here is where the real problem lies - the control is still in G91 mode, although it should be in G90 mode. The same is to be said about G54 work offset setting and G00 rapid motion. A change from a possible G55 command or G01 command may have serious consequences. A simple solution is to program these codes after tool change, not before:

N1 G21

N2 G17 G40 G80

N3 T01 M06

N4 G90 G54 G00 X50.0 Y100.0 S900 M03 T02

N5 G43 Z10.0 H01 M08

... <G90 IS IN EFFECT>

...

N17 G91 X-10.0

N18 Y23.0

...

N.. G90

...

Note that G90 is (and should be) programmed later in the program, to bring the control system to its ‘normal’ mode (typical mode).

Tool Change Block

Block N3 makes the actual tool change. It is the block where the Automatic Tool Change (ATC) takes place:

N3 T01 M06

On most machining centers, the T01 is a function that makes the tool magazine to rotate and place tool one (T01) into a special magazine position, to be ready for tool change. T-word in this case does not make any tool change, it only makes the selected tool to be ready for tool change. This method shortens the tool change time.

There is nothing wrong with this block in terms of programming, but for CNC operators, it may cause some inconvenience. As both tool call T01 and tool change function M06 are in the same block, they will be processed simultaneously. Tool search will always be first, followed by the actual tool change. That is not the problem. Think how it will affect running the first part.

During the first part run, the operator generally selects Dry Run mode along with Single Block mode. Other settings may also be in effect. In single block mode, when the block N3 is activated, tool T01 should be placed into the spindle. What happens when the wrong tool had been registered and is placed into the spindle instead? At best, it forces the operator to remove the tool from the spindle, place it back to the magazine and re-register it. On the other hand, if the commands currently in block N3 were in individual blocks, the operator can look at the magazine a see if the right tool is ready before the tool change. An improvement to the program structure is simple:

Instead of N3 T01 M06, use:

N3 T01 (MAKE TOOL 1 READY FOR ATC)
N4 M06 (MAKE ACTUAL TOOL CHANGE)

Even a small program change like this can go a long way. Similar changes may be done in other blocks. Compare the original version with the modified version:

(ORIGINAL VERSION)

N1 G21 G17 G40 G80 G90 G54 G00 G49

N2 T01 M06

N3 . . .

(MODIFIED VERSION)

N1 G21

N2 G17 G40 G80 T01

N3 M06

N4 G90 G54 G00 X.. Y.. S.. M03 T02

N5 . . .

Even the G17 could be placed after the tool change.

This section, as many others in the book, relates to the program development, which is the responsibility of the CNC programmer. The machine operator works with the resulting program - or programs - and has to understand the program contents. Programs reaching the machine shop are often written by more then one programmer, and even if only one programmer is responsible, the final programs may lack one important feature - consistency.

Program Structure Consistency

Many small machine shops usually employ only one CNC programmer, or - more likely - only one CNC programmer/operator, who is responsible for both programming and machine operation. Larger shops and large companies may employ several programmers who do not operate machine tools, as their main responsibility is only program development. In these cases, most CNC operators will agree that programs developed by different programmers ‘look and feel’ quite different.

By itself, the difference does not present any major problem, unless is very significant. If those programs are good, they will be usable and present no problems.

In spite of all that, the CNC operator will have no choice but to interpret each program in a different way, depending on who he programmer was. The fact that all programs may be correct is not the issue here - the real issue is the efficiency of the CNC operator.

On the other hand, if all programs written by different programmers ‘look and feel’ the same, the operator has a much easier - and more efficient - approach to program interpretation and part setup. The keyword that describes a program following a certain structure is consistency.

Consistency in program development means using the same approach to program development by all programmers

Typical problems related to consistency are usually found in the program structure before and after the actual machining. Consider just a small example:

N5 G43 Z25.0 H01 M08

The initial level was set to 25 mm before machining, for example, using a fixed cycle. When the cycle is finished, the programmer retracted the tool to 10 mm:

N18 G80 Z10.0 M09

There is absolutely nothing wrong with either block. The intent here is not to look for minute details like this one. The real issue is that the CNC operator make try to find if there was a reason. This particular example may not present the strongest argument for the importance of programmimng consistency, but it illustrates the idea.

PROGRAM INTERPRETATION

The ability of a CNC operator to interpret a part program is one of the most important skills in CNC setup and machining. It is unfortunate that not every part program that reaches the machine tool is flawless, but it does present a very real situation. Programming errors do happen, and in many cases, it is up to the CNC operator to find these errors and ‘debug’ the program.

Program interpretation requires at least some basic knowledge of CNC programming

As an example, consider the following program listing. You are at the machine, drawing is not available and the CNC display shows this program:

O1001 (ELEVATION PLATE)

(T7 - 12.7 MM DIA SPOT DRILL)

N1 G21

N2 G17 G40 G80 T07

N3 M06

N4 G90 G54 G00 X20.0 Y60.0 S900 M03 T10

N5 G43 Z25.0 H07 M08

N6 G99 G82 R2.0 Z-2.6 P250 F200.0

N7 X30.0 Y100.0

N8 X100.0

N9 Y60.0

N10 G80 Z25.0 M09

N11 G28 Z25.0 M05

N12 M01

...

The above program is very simple, but it may present a surprise or two.

When evaluating a part program, some internal information is readily available, such as program number (if available), block numbers, messages and comments, and some others. In the example above, it is obvious that the part name is Elevation Plate. It is a bit less obvious that the tool used for this operation is a half-inch spot drill, converted to millimeters (12.7 mm = 0.5 inch). This is a common method in North American machine shops, where a metric part uses inch type cutting tools (imperial measures). What else can be gathered from the program?

Units

For any CNC machine setup, it is always important to know - and understand - the dimensional units. In an environment where both metric and imperial units are used, there are two methods to find out which one is active - by the program code - G20 (imperial) or G21 (metric) sets the units through the program. The other method is to find out directly at the control unit, usually under Settings. As the example contains G21 command (N1), we know the program is in metric units.

Type of Operation

Even without an elaborate tool specification or detailed messages, the CNC operator should be able to find out what type of operation is taking place from the program itself. Prevailing use of G01, G02 and G03 commands suggests a roughing or finishing of a contour or a pocket. When XYZ axes are used frequently together with G01 motion, the chances are that a 3D machining is taking place, typically collaborated by the tool used, often a spherical end mill (or similar). Machining holes uses various fixed cycles, typically in the range of G81 to G89, along with G73, G74 and G76. Also associated with fixed cycles are retract commands G98 and G99 and cycle cancellation command G80. In the sample program, the existence of both G99 and G82 (as well as G80 cancellation) means the type of machining is a fixed cycle that requires a pause at the bottom of the hole, such as a spot drill in the example. Spot drilling can be further identified by a rather shallow cutting depth, dwell (P), and the existence of a drill as the next tool in the part program.

Speeds and Feeds

For a safe machining operation, identifying the spindle speeds and cutting feedrates in the program helps to make intelligent decisions about the use of spindle and feedrate overrides, if necessary, particularly for the first part trial. As a CNC operator, keep in mind that even the most experienced and reliable programmer may not be always exact in the area of speeds and feeds. In fact, optimizing speeds and feeds at the machine control is often one of the most important functions of a CNC operator.

The example above has only one spindle speed and one feedrate programmed for the tool. While it is common to have only one spindle speed for the tool, it is very common to have two or even more feedrates for the same tool. Typical example would be in milling, where a plunging feedrate along the Z-axis is lighter than the cutting feedrate in XY axes. The program example shows spindle speed as 900 r/min (S900) and the cutting feedrate as 200 mm/min (F200.0) or about 8 inches per minute.

Not to be missed is the spindle rotational direction. When interpreting a part program, look for miscellaneous functions relating to spindle rotation - M03 (rotation CW) and M04 (rotation CCW). There is also M05 available as the spindle stop function. M03 is the standard rotation for right hand tools, M04 is used for left hand tools, for example, to make a left hand tap.

Tool Numbers

Many severe errors at the machine happen because of a wrong tool selection. In the program, the tool number is identified by the address T. Its exact meaning is determined by the type of automatic tool changer (ATC). In case of a fixed type tool changer, where the tool returns to the same pocket it came from, the address T indicates both the pocket number of the tool changer as well as the tool number. In case of the more common and efficient random type tool changer, the address T indicates the next tool to be used.

There are actually two T addresses in the above example - one in block N2 and the other in block N4. Block N2 contains the first T function - T07. Note that the following block N3 contains the actual tool change function M06. Once the tool change had been completed, another T address appears (block N4), this time it is T10. To interpret these blocks, read block N2 as ‘get tool T07 ready for tool change’. The actual tool change follows in block N3 (M06), which caused T07 to be in the spindle. Block N4 should be interpreted as ‘get the next tool T10 ready for tool change’. Having the next tool waiting is one of the greatest advantages of the random type tool changer. Calling the next tool (T10) is not required for CNC machines where the tool returns to its original pocket of the tool magazine.

Dwell Time

Programmers place a dwell function (a pause) in strategic places of the program structure, to force a delay in machining, when justified. In addition to optimizing speeds and feeds at the machine, the programmed dwell time is another function to be optimized. Unfortunately, some programmers use a dwell of unnecessarily long duration. Multiplied by a large number of parts, long dwell time can increase the cost per part quite significantly. A qualified CNC operator can change the dwell time to be both functional and efficient. The first requirement is the identification of dwell in the program.

There are two methods of programming a dwell:

▪As a single block entry, using the G04 command

▪Using the P address in certain fixed cycles

In both cases, the dwell address is followed by the dwell time. Single block entry for dwell can have three basic forms:

G04 X. . (mills and lathes)

... for example, G04 X0.5 is 0.5 seconds dwell

G04 P. . (mills and lathes)

... for example, G04 P500 is 500 ms dwell or 0.5 sec.

G04 U. . (lathes only)

... for example, G04 U0.5 is 0.5 sec. dwell

Milliseconds can also be used with the X and U addresses, but seconds (with a decimal point) cannot be used with the P address. Typical use of the P address is in fixed cycles G82 and G89. G04 command is not used with fixed cycles (it is built into the cycle internally).

Once a dwell is identified in the program, make sure you understand the reason for its inclusion. As a rule of thumb, pay special attention to dwells longer than one half of a second. A longer dwell than that is not necessarily a waste of time. A long dwell is often programmed to make sure a certain mechanical function of the CNC machine is fully completed before program processing continues. That may apply to activities such as clamping and unclamping, automatic door closing, delay due to acceleration, tailstock application, bar feeder, and many others. In these cases, you should not change the dwell time. For machining, the dwell time change (usually a reduction) is quite often justified.

In order to optimize dwell time, you have to understand what a minimum dwell is:

Minimum dwell is the time required to complete ONE spindle revolution

Based on the definition, a formula can be established to calculate minimum dwell:

▪Minimum dwell = 60 / rpm

As an example, the minimum dwell is 60/900 = 0.067 seconds or 67 ms (milliseconds). Programmers often increase the minimum dwell to allow for more than one revolution, and also for the possibility that spindle speed override is set to 50% (normal minimum override). P250 in block N6 allows fewer than four revolutions while the dwell is in effect.

Dwell should never be shorter than twice the minimum dwell calculation

Other Considerations

There is a lot more that can be found in the above program or any other program. An experienced CNC operator will be able to visualize various tool motions before testing the program or running the first part. One of the more important skills of being a first class CNC operator is to be able to identify program errors.

PROGRAM ERRORS

Mistakes are part of the human condition and CNC programmers are not immune in this area. Manual programming is prone to errors, but even a computer generated program may contain errors if the post processor is not properly configured. Entering program codes in MDI (Manual Data Input) mode can also contain errors.

Program errors can be very costly in production, causing expensive downtime. When evaluating a program before actual machining, looking for errors is often a time well spent. There are generally two groups of errors in the program:

▪Syntax errors

▪Logical errors

In addition, errors caused by equipment failure can be also added, but these belong to the area outside of the operator’s influence.

Syntax Errors

Syntax errors are easy to detect. In fact, there is no real need for manual detection, because the control system will identify all syntax errors anyway. When evaluating a program, it is always a good idea to look for syntax errors before actual program run.

As the name suggests, syntax errors are equivalent to misspelled words in typical regular text. In CNC, syntax errors include all illegal characters, characters not available on a particular control unit, wrong order of characters, letter O instead of numeral 0 (or vice versa), and similar errors. All following examples are syntax errors:

MO8 instead of M08
... letter O instead of numeral 0
(only one letter per word is allowed)
-X5.0 instead of X-5.0
... minus sign in front of an address
instead of the number
1000S instead of S1000
... address (letter) must always be
the first character
Y 5.0 instead of Y5.0
... no spaces allowed within a word

These and other similar errors will be detected by the control, even if you miss them during program evaluation. By far, the most common syntax error is the letter O instead of numeral 0 or numeral 0 instead of letter O.

Zeros are visually narrow... 00000 Letter O is visually wide... OOOOO

Logical Errors

Logical errors present a much more serious group of errors, as they can lead to a scrap or even a collision. In short, a logical error can be defined as a program entry that is correct in its syntax but wrong in context. A very common example is a misplaced decimal point, an error in programming and program editing at the machine. The control has no way of selecting the correct dimension, as both are perfectly legitimate:

X100.0 instead of X10.0

Another common error is the change of G-code mode, for example:

G00 Z2.0 ... rapid to 2 mm above top of part
Z-5.0 F150.0 ... feed to 5 mm deep at 150 mm/min
...

Feedrate is NOT effective in rapid mode

Missing Decimal Point

Also a very common error is a missing decimal point. This is an area that requires a little deeper explanation. Try to answer this question - what is the decimal equivalent of a program entry of X34720 ?

Don’t rush with the answer yet - ask yourself another question first - what units are used in the program? Machine shop programmers and operators who work with both metric and imperial units have to think twice. Here is some background for better understanding.

In the very early stages of numerical control, the decision was made to limit every dimensional entry into the maximum of eight numerals (8-bit format), ranging from 00000000 to 99999999. At the same time, virtually all machine NC (hard wired) controls have been set to accept leading zero suppression as default. Its definition is quite clear:

Leading zero suppression allows all zeros before the first significant digit to be dropped

The example of X34720 is in reality equivalent to X00034720, with insignificant zeros dropped. Decimal point programming did not become widespread in part programming until the middle or even late 1980s (!). Until then, the decimal point had to be implied.

The rule was as simple as it was logical:

For METRIC units, the implied decimal point is THREE decimal places left of the last of 8 digits

For IMPERIAL units, the implied decimal point is FOUR decimal places left of the last of 8 digits

In both cases, the number of decimal places indicates the smallest resolution - the smallest amount of motion possible for each system of units. That means the example of X34720 is equivalent to:

▪Metric units:

X34720 is equivalent to X34.720 (= X34.72) mm

▪Imperial units:

X34720 is equivalent to X3.4720 (= X3.472) inches

For those interested in the trailing zero suppression (not a required knowledge), the same program word X34720 would have to be written as X0003472 with the following results:

▪Metric units:

X0003472 is equivalent to X34.720 (= X34.72) mm

▪Imperial units:

X0003472 is equivalent to X3.4720 (= X3.472) inches

Trailing zero suppression is not used on CNC machines, because of its impracticality.

Offset Errors

As this section covers the subject of logical errors that cannot be normally detected by the control system, there is at least one notable exception:

In G41/G42 cutter radius offset mode, the control system will issue an alarm when the cutter radius is greater than the inside arc radius

More on the subject of Cutter Radius Offset is covered in a separate comprehensive chapter (page 135).

Entering the wrong offset amount into the control system is also an error that can have serious consequences. For every dimensional problem, check not only the program but check the offset settings as well.

Incorrect Units

If parts to be machined frequently change from one unit system to another (metric to imperial or vice versa), a common error is to use a frequently used dimension is one format and using it in the other format.

For example,

G99 G81 R2.0 Z-10.0 F200.0

... is a normal metric example. In imperial units, the feedrate start point in R-level will be 2 inches, and - even worse - the depth of cut will be 10 inches. Feedrate will also be extremely fast, at 200 inches per minute.

Many other programming errors can be listed, but the most common have been covered.

CNC Control Setup for Milling and Turning:

Подняться наверх