Virtualization Helps CNC Machines Consolidate Real-time Processing

April 27, 2011
Biesse S.p.A. takes advantage of TenAsys' INtime for Windows to build a CNC machine with RTOS control and a Windows-based interface.

Biesse’s Rover Gantry 512 installed at Simard Cuisine et Salle de Bains in Quebec City

The dual-core processor runs Windows on one core and the INtime RTOS on the other core

Computer numerical control (CNC) machines are some of the most complex systems in the manufacturing world. Even the simplest CNC machines may have four motors driving motion axes that must all move synchronously, at high speed, with very high precision in order to maximize the machine’s productivity and quality of output. The controllers that orchestrate the motion typically must make new decisions on how the motion axes must move and establish a new target position every one or two milliseconds.

The loss of a single control cycle is a mission critical failure. If the machine were to fail to update its target positions correctly for just a millisecond or two, inaccurate cuts could be made and the machine could jam or become unstable. And in order to guarantee that the machine’s outputs are produced on time, the machine’s inputs need to be sampled much faster – typically many times faster than output decisions need to be made, according to control system experts. Controls engineers call the phenomenon of missed control loop times “jitter” because if one were to look at a graph of the motion produced by imprecise control loops, it would have jagged lines or small discontinuities. Jitter is directly responsible for irregular movement of the tooling resulting in poor quality work. To avoid this, many machines are designed to enter a fault state and stop moving if the servo drives that affect the motion don’t receive at each cycle a new control message from the CNC. This causes expensive downtime while the problem is fixed or reset. But more importantly, having this type of fault at all would cause the machine to fail to meet the requirements of the market.

But even a one- or two-millisecond response time is not the fastest response that the system must make. Because of high precision timing and oversampling requirements of some fieldbus (machine network) interfaces (e.g. EtherCAT), the cycle times of control loops that manage these need to be as short as 100 microseconds. A human-directed operating system such as Microsoft Windows can not manage all of these control tasks simultaneously and guarantee that they will be processed with predictable timing (i.e., determinism), so most high-speed machines run their control loop software on real-time operating systems (RTOS).

However, the latest CNC machines do still need to run a full-featured OS such as Windows. Typically, a general-purpose OS such as Windows is used to run human-machine interface (HMI) software with multi-language support and to handle data logging, machine program development, and interfacing to enterprise networks. So the challenge for CNC machine developers is to combine both real-time and human-directed operating environments in the same system. Typically, this has been accomplished by including two separate computers in the machine, one running the RTOS and one running Windows, but cost and system complexity can be reduced if both operating environments can be made to run on a single processor.

The key to combining OS environments is virtualization – the ability for a single computer system to partition its processing to present separate native processing environments and I/O hardware resources for exclusive and directed use to different operating systems that co-reside in the system such that each OS thinks that it has full control of the processor.

Virtualization is in common use today in office server computers to allow individual servers to run multiple applications, thereby reducing the number of server computers that a business needs. Typically in the case of server virtualization, each computer is running multiple instances of the same operating system, such as Windows or Linux. Server virtualization environments such as VMware have no concern with providing determinism, however.

The type of virtualization that embedded systems such as CNC machines need is different. With embedded virtualization, a heterogeneous mix of operating systems, both real-time and human-directed, is typically employed. This is the solution that has been adopted by Biesse S.p.A., of Pesaro, Italy, one of the world’s foremost providers of machinery for wood, glass, and stone processing and fabrication.

In Biesse’s new ROVER G machine (Fig. 1), control cycles, I/O drivers and supervisory PLC logic are executed as real-time processes, while the machine’s HMI functions run as Windows processes and communicate with the real-time software using functions from INtime for Windows’ NTX library.

In the past, the real-time software in Biesse’s CNC machines was hosted on separate CPUs with a UNIX-like native RTOS. Microsoft Windows was used to host the HMI interface. Biesse’s CNC application software is very large, comprising approximately 150 software modules and 2.5 million lines of code. Managing that software environment requires that great care be taken in bug tracking, deployment policy, version control and testing. A single host solution significantly reduces costs and improves reliability and performance.

Virtualization can be used to combine an RTOS and Windows onto a single platform. The solution chosen by Biesse was TenAsys' INtime for Windows. INtime includes its own RTOS running in one partition and Windows running in the other. The system allows a partition to be dedicated to a core in a multicore platform providing deterministic real time support in addition to a standard Windows platform.

INtime allowed Biesse developers to run their HMI, their CAD/CAM system, and many third-party applications that Biesse’s customers typically install, without modification. The real time support was modified to utilize the INtime RTOS. This keeps the machine’s motion control engine, PLC logic (used for supervisory functions) and fieldbus drivers (EtherCAT, CANOpen) under precise control (Fig. 2) while communicating with the Windows-based applications using inter-processor communication mechanisms implemented via shared memory.

Biesse utilized a dual core processor. This configuration allows interrupts to be handled by the appropriate core. In this scenario, real-time interrupt latencies are reduced by an order of magnitude, from 10-30 microseconds down to 1-3 microseconds. Loop cycle times in the 50-200 microsecond range are able to operate with high precision and accuracy. Less-time-critical events such as key presses on the operator touch screen do not interrupt real-time tasks such as controlling the CNC machine’s cutting motors.

With INtime for Windows, only the real-time operating system kernel and low-level device drivers are allowed to run in the processor’s supervisor mode (ring 0, the most protected operating level in an Intel processor’s protection architecture). Windows applications always execute in the processor’s user mode (ring 3). This prevents Windows applications from making modifications (deliberate or unplanned) to the code and data structures belonging to other applications or the kernel. INtime applications also run in protection ring 3 (user mode) so if a process fails it can be safely halted or aborted without stopping the entire system. This provides a high degree of safety and simplifies identifying faulty application software modules.

There is no performance penalty for executing real-time applications in the user mode operating level. Software executes at exactly the same speed in user mode as it does in supervisor mode. The only difference between these two operating levels has to do with the ability to execute special privileged instructions, fault (trap) handling, and memory protection. In fact, INtime’s CPU context does not disable certain privileged instructions (InPort, OutPort, ReadMemory, WriteMemory) as Windows does. This enables the best of both worlds: It provides user mode protection from faults and memory usage, without having to write kernel mode (Ring-0 ) drivers to interface to real-time I/O.

Sponsored Recommendations

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!