Engineering Documents - Tormach Machine Controller
Tormach Machine Controller Whitepaper
Recent developments in CPU technology, operating systems, and desktop computers have created problems with the use of Mach3 control software for CNC applications. This document reviews the causes of those problems, the effect they have on machine performance, and the route that Tormach has taken to eliminate the problems and ensure optimum machine performance.
The Problem with Windows & Mach3
Mach3 operates as a real time controller for complex multiple axis motion control. Motion control is dominated by differential equations that involve position, velocity, acceleration, and time. Time is the central theme in motion equations and the primary problem of real-time control. Errors in the timing of signals between controller and machine introduce machine vibration and waste motor torque. In extreme cases timing errors will overheat servo motors or create step loss in stepper motors. Whether using servos or steppers, the net result is the same: a failure to deliver accurate motion.
Computers complete much of their work through a system of interrupts. Imagine a computer CPU in the midst of a conversation with someone. Suddenly, the conversation is interrupted by a cell phone call to the CPU. The CPU notes that it's an important caller so it answers and has a quick discussion, and then hangs up and goes back to the original conversation. This is essentially how the motion control works in Mach3 - a series of short interrupts where Mach3 grabs the attention of the CPU for a short time, interrupting whatever the CPU was occupied with at the time. One of the differences from the cell phone analogy is that the calls can come in at a frequency of 45,000 calls per second and the conversations usually last less than 0.00001 seconds.
The delivery of smooth motion control requires very consistent timing, which can be delivered only if the CPU responds to the interrupts on a timely manner. Consider the cell phone analogy again, except this time imagine that someone else is calling the CPU at the same time as the first caller- someone who claims to be more important than that first caller. The answer to the original caller will be delayed until the CPU can get off the phone with the second caller. For a Mach3 controlled system (the original caller), this creates a delay in the motion command generation and an upset in the smoothness of motion.
The Mach3 manual has always included a section on computer optimization. While there are a number of optimization recommendations, both simple and complex, they can all be summed up in the context of the analogies above. It comes down to configuring the computer so 1) interrupts that aren’t associated with Mach3 are reduced to as few occurrences as possible and 2) Mach3 is treated as the most important interrupt. In the past this had been pretty simple. However, we began noticing performance issues that could not be resolved in the normal ways beginning in mid 2008.
Recently both Intel and AMD have shifted toward advanced CPU architectures with complex threading algorithms. Intel Hyperthreading was an early threading algorithm, but there have been many new schemes developed since then. In some cases, the routing of computational tasks within a multicore processor is the root of the problem. In other cases, the unwanted interrupts may be generated by device drivers, such as the software programs that control keyboards, Ethernet ports, or hard disk drives. Many of the issues are related to the continuing efforts for energy efficiency, where the computer seeks to slow down, or even turn off when activity is low. In extreme cases the Mach3 authors recommend the user configure the computer for Standard PC mode, as opposed ACPI (Advanced Configuration and Power Interface mode). Recently, however, Microsoft Vista and individual device drivers have abandoned support for Standard PC mode. The result of these developments has been a new generation of computers which are difficult or often impossible to configure as a proper Mach3 platform. Our own experience is indicative of the issue. Tormach had been using Dell brand computers. In early 2008 there were several models that worked well. In late 2008 there were only a couple of models we found suitable. By March of 2009 we have found that not one of the Dell models (Optiplex, Vostro, Inspiron, et cetera) would work. We tried multiple HP models and none worked. There was one model from Lenovo that could be configured properly. The problem was getting serious.
How Does This Affect Machine Performance?
First, let's acknowledge that while the solution to the problem can be difficult, identification of the problem is easy. Mach3 includes a diagnostic tool called DRIVERTEST.EXE. This program clearly identifies variations in interrupt timing, both though graphic display and accumulated statistics. In our experience, the diagnostic is an effective and accurate tool. When we hook up a high bandwidth oscilloscope to the control signals the numbers are confirmed. If you run the diagnostic program and get a flat line on the graphic display, your computer is capable of acting as an effective machine control platform. If not, you have a problem with timing variations.
To understand the effect of timing variation, let's look at a typical example. A computer running at an interrupt frequency of 35 kHz has about 29 uS between interrupts and a basic time resolution of 15 uS, or 0.000015 seconds (1/2 the period). If a machine using that computer has a typical electromechanical configuration of 10,000 signal pulses per inch of motion, then running at 90 IPM requires a stream of signal pulses with 100 uS between signals, essentially a pulse about every 3 interrupts. Now let's add in the additional variation created by unwanted interrupts. If the DRIVERTEST.EXE diagnostic has recognized that the largest time variation is 27 uS between interrupts, then the variation can be +/- 27 uS in addition to the +/- 15 uS, potentially as much as 42 uS in timing error. From the human perspective this may not seem like much, it's less that a thirty thousandth's of a second. From the perspective of the motor, this is a disaster. While the basic variation of 15 uS represents a 15% variation in step timing, the additional variation more than doubles the error, at 42% timing variation.
What this means in physics is a useless waste of torque. The time between motion step commands is consistent with velocity. Consistent timing means a constant velocity. Variation in timing means a variation in velocity, in other words, acceleration. When one step is delayed, but the following step is on schedule you end up with a very large deceleration occurring over a very short time period, followed by a very large acceleration. From Newton's laws of motion (force = mass x acceleration) the result is a pointless consumption of torque, torque which would otherwise be available to run the machine.
Empirical results match the theory. In recent tests a stepper driven machine would fail on upward Z motion, lifting a spindle head, when operating in excess of 185 inches per minute when controlled by a Dell Optiplex 330 with a 2.2Ghz Pentium Dual E2160. The Dell model exhibited an interrupt variation of 14 uS. 14 uS was a typical observed number. Substituting for a computer which exhibited 2 uS variation allowed the same machine to lift the Z head at a speed in excess of 245 inches per minute. The difference between the 185 IPM and 245 IPM performance limit was entirely attributed to the change in computers. One computer showed timing variations and the other did not. The computer with better results was a much slower computer, an older Celeron model with a slower processor. A variety of tests of this nature consistently confirmed that raw computing power has no effect on machine performance, but the consistency of interrupt frequency has a dramatic effect on performance.
Resolving the Issue: MachOS The Tormach Machine Controller
Fundamentally, this is not an issue that can be wholly attributed to Windows, Intel processors, or any particular brand of computer. The heart of the issue is the fact that a consumer electronic, in the form of a desktop computer, is being used for an industrial machine controller. Like all consumer electronics, branded computers are in a constant flux and subject to the criteria of standards, such as those that the Energy Star 5.0 Specification 1 imposes. These standards guide the design of the desktop computers in a far different direction than that which is needed for real-time control of an industrial machine tool.
Desktop PCs are general purpose computers. The combination of a dedicated purpose computer and associated hardware, as in the case of a dedicated CNC controller, is known as an embedded system. Microsoft supports the development of embedded systems using Windows technology through their Embedded Systems Group and products like the Windows Embedded Standard operating system.
Windows Embedded Standard is derived from Windows XP Pro. Microsoft has divided the Windows XP Pro operating system into more than 12,000 individual components. Developers qualifying for the Windows Embedded Partner program can use a database driven build system to create customized operating systems, each designed to a specific purpose. The task is not trivial, since the correct components must be selected and configured properly. Applications are integrated through the creation of additional components. While each product created with this system is based on the same database, each product is unique and built to a specific task.
Tormach has used this system to create a version of the Windows operating system that is designed specifically to support Mach3. We call it MachOS. We worked closely with the authors of Mach3 in its development. The system has been tested by Artsoft, developer of Mach3, and is approved by them for use withMach3.
One of the more important differences between Windows operating systems like XP or Vista and embedded systems like Windows Embedded Standard is the life cycle expectations. There are no guarantees with desktop computers. Vista seems like the new kid on the block, pushing out XP, but Windows 7 is already waiting in the wings to replace Vista. Microsoft does not make guarantees on that class of operating system. It's an entirely different story with embedded systems. Microsoft has guaranteed support for Windows Embedded Standard for at least 10 years.
Of course, an operating system is not an embedded system. It needs hardware to complete the appliance. In our case the appliance is the Tormach Machine Controller. The CPU is from the new Atom series by Intel. The motherboard for the controller is designed to support both new and old CNC equipment. It supports older mice and keyboards with PS/2 style connectors, and also offers 6 USB ports, a serial port, Ethernet, and the necessary parallel port. It includes one PCI slot for expansion. This allows compatibility with standard Mach3 printer port applications, while also supporting extensions such as serial driven Modbus I/O or Smooth Stepper via USB. The result is an embedded system, built with low cost conventional hardware, yet without the problems associated with consumer electronics. It's a system that can be delivered today and supported years into the future without risk of obsolescence. The Tormach Machine Controller provides a platform which allows Mach3 to perform its tasks without interference and ensure repeatable and dependable motion control for CNC applications.
Application Recommendations: Do you need the Tormach Machine Controller?
Every CNC machine has a variety of factors that combine to create the general performance envelope. With the machinery we design and test, we have no doubt that signal timing issues can reduce performance in terms of ultimate axis speed. If you have an earlier Tormach CNC machine running with a Tormach supplied computer, we would not expect the Machine Controller to increase your performance. If you have a computer from any other source we recommend running DRIVERTEST.EXE and reviewing the results. If the pulse timing variation is less than 5 uS, then it is unlikely that replacing your computer will alter the effective performance. If your pulse timing variation exceeds 5 uS then it is likely that pulse timing variation is a critical factor in ultimate machine performance. Given the problems with the newer desktop computers, Tormach does not guarantee PCNC machine performance unless the machine is used with the Tormach Machine Controller.Last Updated Jun 17, 2009
- Download ED10436: Mach3 Controllers Whitepaper