DNC: Faster And Better -- Part One

Direct numerical control (DNC) should solve problems, not create them. If you under-stand how DNC works and follow the tips presented in this article, you can maximize its benefits and avoid headaches with your system. Part One of a two-part series.

Article From: 11/1/1995 Modern Machine Shop,

With the greater availability of computers in the shop, more manufacturers are relying on computer aided design (CAD), computer aided manufacturing (CAM), and digitizing systems to create part programs. Parts are getting more complicated, and the programs are getting longer. It is not uncommon for a CAD/CAM system to create a program with a half-million moves. Many of today's computer numerical controls (CNCs) cannot store programs that have a half-million moves. Instead, the CNC must execute each move as it is received. This "drip feeding" process of sending a move at a time is commonly known as DNC, short for direct numerical control.

A Typical Program

A typical program requiring DNC is made of many point-to-point moves. CAD/CAM and digitizing systems create programs that might take thousands of moves to machine a single pass of your part. Let's say, for example, that currently your CNC machines 100 moves per second (one move every 10 milliseconds) or 6,000 moves each minute (100 moves/second x 60 seconds/minute). Sounds impressive, doesn't it? Or is it?

If a part with a high tolerance has an average move of 0.001 inch, 6,000 moves per minute would result in an effective feed rate of 6,000 x 0.001 or 6 ipm. Most materials can be machined at speeds much greater than 6 ipm. Your parts, then, could be taking much longer to machine than necessary. As the old saying goes, "Time is money." The faster you DNC your parts, the more parts you can produce in the same amount of time.

That's what this article is about: using DNC faster and better than you are currently. The tips suggested here are practical. You can take them right into the shop with you.

DNC From The Inside

In order to DNC faster and better, you need to understand DNC as more than just running a program from a computer. By understanding DNC as a process, you can make improvements that will yield real benefits.

There are three components required for DNC: the CNC, a computer and a serial line connecting them. The program to be machined will be sent by the computer a move at a time to the CNC via the serial line. When a full move has been received by the CNC, the move is processed and added to what is called the Look-Ahead buffer. Processing a move includes executing fixed cycles, computing cutter radius compensation, and making any other calculations necessary to convert the NC code into machine moves.

An important detail to keep in mind is that while the CNC is machining a move, it is also processing upcoming moves. In other words, the CNC is dividing its attention between actually machining the part and calculating what it is going to machine next. In this way, there is no break between the machining of moves; there is a continuous flow of motion. The Look-Ahead buffer is where these next moves are stored.

What is the Look-Ahead buffer? A buffer is something that lessens or absorbs the shock of an impact. By looking ahead, or processing moves to come, the CNC is buffered against actually coming to a stop between moves. Unbuffered motion can cause the CNC to vibrate, as the CNC moves to a location, stops, then moves to another location. The faster the moves, the more violent the vibration. Such vibration can affect the finish and accuracy of your final part. When moves are buffered, the CNC doesn't stop between moves. It moves to a location, and, because it knows where the next location is, it can immediately begin moving to that next location. Instead of vibrating, the CNC flows smoothly between moves, yielding a more accurate part with a better finish.

The serial line is also buffered. While the CNC is machining the current move and processing the next move, the serial line is downloading the moves after that. In the same way that unbuffered moves vibrate the CNC, unbuffered serial input may also cause vibration. The CNC, then, is really doing three things simultaneously during DNC: loading moves, processing moves and machining moves.

The Three Bottlenecks

The key to increasing DNC speed is to increase the speeds at which the CNC loads, processes and machines moves. Note that improving just one or two of these does not increase overall DNC speed. Loading, processing and machining are dependent operations. The faster the CNC loads moves, the faster it needs to process them. And the faster the CNC processes moves, the faster it needs to machine them. Thus, in order to make your DNC faster and better, we need to improve all three of these operations.

The Serial Line

Today, loading programs for DNC consists of a computer sending the CNC a move at a time over a serial line. The serial line (also commonly referred to as an RS-232 line) is like a telephone line between the computer and the CNC; it's how the computer "talks" with the CNC. The speed that moves are sent over a serial line, or downloaded, is called the baud rate.

Typical industry baud rates are 9600, 19,200, and 38,400. What do these numbers mean? The baud rate generally corresponds to the number of bits per second that can be transferred between the computer and the CNC. In general, for each character (letter or number) in a move, 10 bits are sent over the serial line. (It takes ten bits because the character is eight bits long, and then there's usually one start bit and one stop bit. Your computer will take care of this for you.) So at 9600 baud, 960 characters per second are transferred, and at 38,400 baud, 3840 characters per second are transferred. As you can see, 38,400 baud sends four times as many characters as 9600 baud.

Fast Tip 1: Use the highest reliable baud rate your CNC allows.

Remember, we want to send moves to the CNC as fast as possible. For example, if the average move is 10 characters long, at 9600 baud you can send only 960 characters for a maximum of 96 moves per second. Even if your CNC can process 1,000 moves per second, at 9600 baud you will be able to machine only 96 moves. At 38,400 baud, however, you could send 3840 characters for a maximum of 384 moves per second. You're still not up to 1,000 moves per second, but you're a lot closer.

You may have been told that your CNC requires something like "seven data bits, even parity and one stop bit." These settings are required so that the computer and the CNC talk with what we might call the same accent. Changing these settings, say from even parity to odd parity, will not improve your DNC speed because ten bits are still going to be sent over the serial line; the same number of moves will be sent over the serial line using even parity as will be using odd parity.

Protocol

A protocol is the set of rules observed when a computer and a CNC "talk" over a serial line. Protocol is also known as hand-shaking. The reason for a protocol is to make sure that the computer and the CNC aren't trying to send each other information at the same time. When the CNC is sending information, it is not listening to information that is being sent to it. This is how information is lost. To avoid losing information, the computer and CNC follow a protocol to make sure that they don't try to communicate at the same time.

There are two popular protocols used today: XON/XOFF and XModem. XON/XOFF protocol is the faster of the two protocols. The sender, or computer in the case of DNC, talks as fast as it can to the receiver, or the CNC. If the computer talks faster than the CNC can listen, the CNC sends an XOFF to the computer, telling the computer to stop sending until it can catch up. When the CNC has caught up, it sends an XON, and the computer begins sending again.

Serial Errors

The most frustrating part of using XON/XOFF is that you don't know whether or not the serial line had a failure until after you've finished machining the part. Serial communications are not 100 percent reliable. When the computer is sending 38,400 bits per second, it is possible that a few bits might drop off if your shop has a lot of electrical noise or the serial cable you are using is very long. This will result in errors in your parts. Because the CNC has no way of detecting and preventing errors, if an error does occur, your part is possibly scrapped.

Fast Tip 2: Position the computer near the CNC and use a cable that is as short as possible.

Besides being easy to trip over, serial cables are susceptible to electrical noise. Electrical noise is interference from other electrical equipment that is "louder" than the signal you are sending. One of our customers, for example, was unable to implement DNC. When our service engineer inspected the serial cable, he discovered that the cable showed high voltage present without the cable even being hooked up! Upon further investigation, the service engineer noticed that the cable had been suspended from the ceiling by wrapping it aroundother wires used in the shop.

Harmless as it seemed, the other wires were high voltage and through inductance caused an electrical current through the serial cable. This current was stronger than the signal being sent by the computer, and the program was garbled. Rerouting the serial cable away from the high voltage wires fixed the problem.

Error Recovery

XModem protocol allows the CNC to detect and prevent errors by breaking up the program into smaller packets, or pieces. Each packet has a checksum. The checksum is computed by totaling the ASCII value of every character in the packet. The computer computes this checksum while sending the characters, and the CNC computes this checksum while receiving the characters. After an entire packet has been sent, the computer sends the checksum it computed, which the CNC compares to the checksum it computed. If the checksums match, (that is, the checksum is good) then no errors were detected while sending, and the CNC sends an ACK (ACKnowledge) signal to the computer requesting the computer to send the next packet. If the checksum is bad, which means the packet has an error, the CNC sends a NAK (Not AcKnowledged) signal to the computer requesting the computer to resend the packet, thus preventing the error from occurring. In this way, most errors are detected and prevented, protecting your part.

Fast Tip 3: Always use XModem.

With all of the ACKs and NAKs, XModem is slightly slower than XON/XOFF. However, it is still strongly recommended that you use XModem instead of XON/XOFF because of error detection and prevention. Figure it this way: One scrapped part and your time savings are worthless. There are smarter, more reliable ways to improve your DNC.

Sending Only What You Need

There are often alternate ways to program the CNC. Because we're trying to send moves as fast as we can, the shorter the program, the faster we can send it. The rule is that if there is more than one way to program a move, choose the way that uses fewer characters.

Fast Tip 4: Drop all N-words.

N-words usually don't do anything in DNC. They are extra characters being sent over the serial line when machinable codes could be sent instead. If you currently have N-words in your program, you could DNC significantly faster without them.

Fast Tip 5: Remove excessive comments.

Comments, like N-words, don't do anything in DNC. A comment here or there will have no real effect on machining time, but comments on every line will. (Note: Do keep the comments at the beginning and end of your program. They will help you remember what the program is supposed to do.)

Fast Tip 6: Use X5 instead of X0.0005.

Most CNCs accept NC words in two formats: in tenths and in decimal formats. Always use the tenths format. For example, X5 is only two characters whereas X0.0005 is 7 characters, yet to the CNC they are the same move.

Fast Tip 7: Use modal codes.

Modal codes are codes that once you use them in your program, the CNC will stay in that mode until you change it with another modal code from the same group. Examples of modal codes are G0, G1 and F100. Don't include a G1 on every line; that's just extra characters that have to be sent over the serial line.

Preprocessing And Compression

Many CNCs offer the option of preprocessing and compressing your program before sending it over the serial line. Preprocessing means that the computer does part of the processing job that the CNC normally does before the CNC gets the program. This can save your CNC time and speed up DNC. Compressing means that the computer shrinks the program before it sends it over the serial line, and the CNC expands it once it has been received.

Preprocessing, by itself, can actually make your program larger and take longer to send, but it processes faster in the CNC. Compressing, on the other hand, makes your program smaller and takes less time to send, but it processes slower in the CNC. The decision of which to use is ultimately based on how quickly your CNC processes.

In general, most CNCs are buffer-starved. Buffer-starved means that the CNC processes moves so quickly that the moves are processed as soon as they are received. In other words, the CNC is waiting for moves to arrive. Compression is the best option in this case because more moves can be sent. The CNC has to take a little longer with each move in order to decompress it, but the CNC is waiting anyway. The basic rule is that if your CNC is waiting and doing nothing part of the time, give it more to do (compressing); and if your CNC is overloaded and has too much to do, let the computer take some of the burden (preprocessing).

One of the best options is a CNC that preprocesses and compresses the moves. For example, in one of its high-speed modes, Fadal CNCs can DNC up to 1,000 three-axis moves per second. The NC code for an average three-axis move is about 21 characters (X#.####Y#.####Z#.####). Normally, to send 1,000 such moves would require a baud rate of 210,000 (21 characters x ten bits per character x 1,000 moves). Using compression, the Fadal control can send 1,000 three-axis moves per second at a baud rate of 38,400.

Fast Tip 8: Preprocess and/or compress your program.

Your DNC Software

A critical part of achieving faster and better DNC is having good DNC software on your computer. There are at least two questions you should ask yourself when you choose your DNC software: "Is it efficient?" and "Is it easy to use?"

Is It Efficient?

If your DNC software says that it can DNC at 38,400 baud, is it really going 38,400 baud? Here's a way you can measure the effective baud rate, or the baud rate at which your program is really being downloaded. Write an incremental program that has the move:


"X0.0001Y0.0001Z0.0001*COMMENTS SLOW DOWN DNC"

repeated 10,000 times. With a carriage return and linefeed, each move has 46 characters, for a total program size of 460,000 characters. Remember that at 38,400 baud, 3840 characters are sent each second, so it should take about 120 seconds (460,000 divided by 3840) to send this program. This is equivalent to 83 moves per second.

If your CNC takes longer than 150 seconds, then either your CNC cannot machine 83 moves per second or your computer is not running at 38,400 baud. If the Look-Ahead buffer is full, then your CNC is the bottleneck: It doesn't matter how much faster you send the program because the CNC can't process it fast enough. If the Look-Ahead buffer always has only one or two moves in it, then your computer is the bottleneck.

Fast Tip 9: If your computer is too slow, try a faster one.

Don't let a slow computer slow down your DNC. Ideally, the computer should be sending your program as fast or faster than the CNC can receive it. Many times you don't need a whole new computer. Sometimes a faster hard drive or a higher quality serial board can make a significant difference.

You can also slow down your computer by trying to make it do too many things. One of our customers was trying to write a DNC program for Windows that would allow him to DNC to four machines simultaneously using one computer. He also wanted to be able to use his spreadsheet program at the same time. At best, each CNC was receiving less than fifty moves per second. Why would you run your CNC at fifty moves per second when you could run it significantly faster?

Fast Tip 10: Use the computer for DNC only and with only one CNC.

Computers are inexpensive enough that each CNC should have its own computer. Slowing down your DNC just to have the ease of running all of your CNCs from one computer will sacrifice performance. If many CNCs need to access the same programs, then consider setting up a network.

Is The DNC Software Easy To Use?

DNC is not without its problems. Tools break. People trip on cables and disconnect them. The power goes out. These kinds of problems happen often enough to make them a consideration in choosing your DNC software. The basic question is: How easy is it to recover? You've replaced the broken tool. Now you want to continue machining.

Fast Tip 11: Your DNC software must have a Mid-Program Start Option.

Think of all the time you'll be cutting air if you have to start back at the beginning of your program. The DNC software should let you easily find the move from which you want to resume machining.

You should also be able to enter preparatory data. Preparatory data is one or two moves that you can type in to be sent before resuming your program. The purpose of preparatory data is to allow you to set modal codes and feed rates back to what they were when the tool broke. This frees you from having to continue DNC from a move that has these codes, which might be thousands of moves away from where you optimally want to resume machining.

Fast Tip 12: Experiment with your DNC software.

Your DNC software may have features that will make your jobs easier to run. If you don't look for them, you'll never know about them.

High-Tech Alternatives

Recently, options have appeared for CNCs that give them megabytes of memory, allowing CNCs to load up to 16 megabytes of programs. The capacity to run such large programs may one day eliminate the need for DNC. Huge memory options offer greater reliability than serial DNC. They are not vulnerable to people tripping on cables and disconnecting them like DNC is. Recovery after tool breakage is much simpler.

However, huge memory options still have limitations. Being new technology, they are expensive. They also require long download times--it may take an hour to download a program with 1,000,000 moves. It can also be difficult to work with a single program that is so large. Many editors and word processors cannot handle such large files. One possible solution may be to break your program into more manageable pieces.

In general, huge memory options are more suited for production runs than for development or single parts. Imagine taking the time to download a program and then discovering that there is a mathematical error.

This ends Part One. In the next part, we'll address the other two bottlenecks of DNC, processing and machining, and how these affect the quality of your parts.

Comments are reviewed by moderators before they appear to ensure they meet Modern Machine Shop’s submission guidelines.
blog comments powered by Disqus
SmartCAM features New Mill/Turn Sub-Spindle and B-axis Support, Morph Pattern Roughing.
• 2-5 Axis Milling
• Mill/Turn and Multi-Task Machining
• Solid Modeling & High Speed Machining
HSMXpress is full
featured 2 1/2-axis
CAM for SolidWorks.
Best of all, HSMXpress
is absolutely FREE!
iMachining - the
Revolution in
CAM. 70% Time
Savings and More.
Greatly Extended
Tool Life!
MMS ONLINE
Channel Partners
  • Techspex