PC-Based Control Goes Real-Time

Personal-computer-based control is one of the fastest growing segments in machine control for monitoring a process and for discrete logic control of processes, such as material handling, machining, grinding, or gaging.Development of Windows NT by Microsoft (Redmond, Wa.) enabled PC-based real-time machine control to become reality.

By Dean J. Petrone and Michael D. Stackhouse, Timken Research April 1, 1998


Software for control

Machine control

Soft logic

IEC 1131

Operating systems

Sidebars: PC-based control integrates multiple applications at Timken Terms Underlying strategies vary for PC-based control

Personal-computer-based control is one of the fastest growing segments in machine control for monitoring a process and for discrete logic control of processes, such as material handling, machining, grinding, or gaging.

Development of Windows NT by Microsoft (Redmond, Wa.) enabled PC-based real-time machine control to become reality. With advances in software and the decreasing prices of industrially hardened PCs, PCs have become a viable alternative to conventional middle to high-end programmable logic controller (PLC) applications.

For Timken Bearing (Canton, O.) integrating motion control, databases, and high-level business systems into one box is the prime benefit of PC-based control. Projected results include reductions of 45% in hardware costs.

Using a PC as the machine control platform also adds capability to control architecture, which is not easily incorporated into a PLC. Some examples are cost-effective networking, integrated control and human-machine interface (HMI) software, intranet access, supervisory control and data acquisition (SCADA), manufacturing execution systems (MES), production reports, and statistical process control (SPC).

Other criteria considered in the review of solutions included:

Hard real-time control using a Windows NT operating system;

Compatibility and openness with legacy software and global vendors through industry standards;

Scalability and modularity for a wide range of applications throughout a global manufacturing process;

Integration into high-level business systems.

Hard real-time control

Reasons for choosing Windows NT as an operating system over other operating systems include the general acceptance of Windows as a business platform. Windows pervasiveness results in wider product selection. Windows-related products comprise 90% of the market share, with OS/2, Unix, others comprising the remaining 10%. With Internet technology, management or project managers can get updates on manufacturing projects from anywhere there’s an Internet connection.

HMI applications require less operator training; using Windows NT has the same look and feel as consumer PCs. The latest Windows NT functionality provides additional support and documentation tools, such as, video conferencing on the plant floor, which PLCs cannot do.

With the Internet or live video illustrating PC faults occurring in the application, PC-based control can save manufacturing firms from troubleshooting on-site.

Windows NT is proving to be a highly reliable platform for development of business and plant-floor applications. The line between business systems and control systems is increasingly fuzzy, with software companies taking advantage of Windows NT through tools like OLE for Process Control (OPC) and Microsoft Visual Basic programming language.

After selecting Windows NT, a review of PC-based control systems helps determine the functionality, openness and portability needed to migrate to a Windows NT control platform. A multitude of vendors offer many options in real-time control, including unaltered Windows NT, a real-time kernel, and real-time threads.

Unaltered Windows NT

Windows NT is a general-purpose operating system not typically considered for deterministic, hard real-time applications. However, Windows NT is designed to be highly responsive and suitable for soft real-time operations. The deterministic response of Windows NT is affected in a number of design issues including response to external events and priorities and scheduling.

Several large PLC manufactures introducing soft logic products have chosen to use an unaltered Windows NT as a platform. Appropriately, Microsoft, according to a 1995 paper, “Real-Time Systems With Microsoft Windows NT,” defines hard real-time as the ability to, without fail, provide a response to some kind of event within a specified time period. This response must be predictable and independent of other activities undertaken by the operating system on behalf of other tasks. Off-the-shelf, Windows NT is incapable of real-time control. What is deterministic enough for a particular application depends on the hardware, software, and application, and is a matter of debate among vendors and end-users.

Windows NT has three types of processing algorithms:

Interrupt Service Routines (ISRs)—An external routine that starts I/O transfers to or from the device and executes other threads while the device completes the transfer.

Deferred Procedure Calls (DPCs)—Driver routines initiated by ISRs used to perform non-time-critical processes. They allow drivers to complete processing after being returned from an interrupt.

Threads—Principal unit recognized by the NT scheduler in application execution. Primarily considered objects within processes that execute program threads.

ISRs and DPCs are triggered by applications running within the NT environment or by an external event. Most applications run through threads at the normal level, while soft logic threads are designed to run in the real-time layer. This is a major concern in the event that a poorly behaved application is running in NT. The poorly behaved application can trigger an ISR and interrupt the execution of the thread executing the control logic, creating an unpredictable system.

Demands of many factory-floor automation applications require that any OS, even Windows NT, work in a deterministic manner and not interfere with performance of a real-time control operation. Such a system also needs to perform safe shutdown and startup operations. These capabilities are unavailable in standard Windows NT without either hard real-time (HRT) extensions or a real-time proprietary operating system. (See related item on operating systems.)

Real-time kernel

A second approach is combining a real-time kernel with Windows NT. In essence, Windows NT becomes a service to the real-time kernel and acts as the lowest interrupt available to the real-time engine. All control and real-time functions have the first opportunity to complete before an NT application can become active.

This provides a deterministic way to achieve real-time control. It addresses the problem of misbehaved applications by providing isolation from the NT engine—NT can crash and the control logic continues to run without fault.

Although this is a good approach, it has several drawbacks. Isolating NT negates the ability to perform real-time updates in any application running under NT. Although this may seem to be a small delay, in motion applications that require timely feedback or correction algorithms (compensation algorithms), speed is important.

Second, half of the CPU clock is surrendered to the second operating system. Essentially, two operating systems are running, sharing the CPU between them.

Third, many large manufactures have developed legacy software that writes directly to hardware. Porting this software over to run as a service of the real-time engine would be a tremendous undertaking.

VenturCom Inc., a principal developer of hard real-time capabilities to Microsoft platforms, is used by several industrials software vendors. Upon review of goals and agendas presented, Timken decided to pursue real-time threads for hard real-time control and a PC-based control software using three of the IEC 1131-3 standard programming languages, along with an interactive HMI/SCADA package.

Real-time threads

Microsoft provided Hardware Abstraction Layer (HAL) source code to VenturCom for development. With this approach, the real-time extensions to the HAL conformed closely in conjunction to the standard interfaces of the host operating system. Operations between real-time objects and normal objects are accessible via a common interface—Windows NT.

The real-time thread manager that provides 128 thread priorities enables the threads to be scheduled by priority and within a priority, in a round-robin sequence. There is no sharing of the processor based on a fixed time slice. With the real-time extensions, all of the Real-time Subsystem (RTSS) threads run before any NT threads.

The thread manager controls the processor in response to interrupts generated by the HAL. Two of these interrupts, the clock and the RTSS software interrupt are fixed interrupt sources. The clock interrupt handler addresses timer expirations. RTSS software interrupt causes the RTSS to examine the queue of messages from NT.

As a result, a number of RTSS threads are prepared to run. When the threads have finished the immediate work, the thread manager reverts to an idle state switching back to the HAL stack and allowing normal NT processing to proceed.

With VenturCom real-time extensions, all interrupt routines are considered to be real-time threads, allowing Windows NT to set priorities for each part of the real-time subsystem and enabling a stable, verifiable hard real-time operation.

Openness and compatibility were essential criteria for choosing a PC-based control system. Many companies are migrating away from proprietary software and systems, but in the interim, newly installed PC-based systems need to integrate with these packages.

Compatibility, openness

Adhering to industry standards, such as IEC 1131-3, adds flexibility and choices. About 90% of Europe is IEC 1131-3 compliant. This standard will likely dominate, with the open architecture, portability, and ability to speak to third-party software required to support plants globally.

A major step in supporting legacy software, as well as proprietary and newly developed software, is the integration of user defined function blocks (UDFBs), which allow custom C routines to be integrated into logic. In addition to UDFBs, many routines are simply too large or inappropriate to integrate into particular control logic, such as an existing executable that performs data acquisition, analysis and displays the results. This would be typical of many gaging applications. In this case, an end-user may want to continue to use existing legacy code, but integrate the machine control with slight modification.

Open architecture systems allow for this integration and provide the hooks necessary. This is primarily accomplished through DDE and DLLs and allows for many proprietary routines to be easily integrated into open architecture systems.

Each application is different. Instead of revamping an entire plant the end-user might examine each system upgrade as it arrives to determine if it is a good application for PC-based control.

For more information, visit www.controleng.com/info

Author Information

Dean Petrone—a development engineer in the Advanced Gauging and Process Control area of Timken Research—worked closely in developing various test and prototype applications with Brian Bricker, Development Analyst. Michael Stackhouse works for Timken as an electrical analyst, manufacturing engineering, and played a key research role. The Timken Co., is a manufacturer of bearings and alloy steels, employs 21,000 worldwide.

PC-based control integrates multiple applications at Timken

Over the past year, Timken Bearing Co. (Canton, O.) has been involved with various PC-based control research projects. Focus has turned recently on developing applications to benefit various plants, including the advanced gaging group.

Among PC-based control systems under development is measurement of various bearing characteristics. Other applications include discrete motion, servo, advanced gaging algorithms, networking, and statistical process control. One of the PC-based control systems Timken using VenturCom’s RTX 4.1 and Microsoft Windows NT is based on the IEC 1131-3 programming standard.

Developing a system on a single platform, Windows NT, has benefits, combining what would be traditionally three subsystems (control, graphic user interface, and gaging) into an integrated system. By doing this, Timken achieves rapid development and a significant cost savings in hardware, as well as develop standard control libraries from which to draw.

Dean Petrone, one of the Timken development engineers involved in researching the PC-based control project, emphasizes that sharing Timken’s selection criteria doesn’t equate to an endorsement of any single PC-based control vendor—other vendors may be more appropriate for other companies and their applications.


The following terms are among those applying to PC-based control.

COM: Component Object Model is a binary component used in several objects (programs) which may be combined to produce desired results. Originated by Microsoft.

Deterministic: when the controller can ensure that processing happens within a fixed range of time. Determinism can be influenced by the process the central processing unit, operating system, bus, memory, interfaces, applications, and other factors.

DCOM: Distributed Component Object Model is a highly optimized protocol, which extends COM to networks (remote objects).

DDE: Dynamic Data Exchange, a standard convention for information exchange among various Windows software packages.

DDL: dynamic data link.

IEC 1131-3: addresses a consistent programming environment by defining five standard languages: sequential function charts (SFC), instruction list (IL), ladder diagram (LD), function block diagram (FBD), and structured text (ST).

HAL: Hardware Abstraction Layer (HAL) source code for development allows real-time extensions to the HAL conformed closely with standard interfaces of the host operating system. Operations between real-time objects and the processor are based on a fixed time slice.

OLE: Object Linking and Embedding, from Microsoft, says how objects may interrelate. Objects can be linked or embedded.

OPC: OLE for Process Control is a communication standard based on OLE concepts.

PC-based control: Control functions performed within IBM or compatible personal computers and related software.

Real-time kernel: makes Windows NT a service to the real-time kernel and acts as the lowest interrupt available to the real-time engine. All control and real-time functions have the first opportunity to complete before an NT application can become active.

RTOS: real-time operating system.

RTSS: real-time subsystem runs all its threads before any NT threads.

UDFBs: user-defined function blocks allow custom C routines to be integrated into logic.

Underlying strategies vary for PC-based control

A number of operating-system level strategies operate at the heart of PC-based control. Some operate alone; others are integrated with or tied to another, at various levels.

Methodologies include unaltered Windows NT from Microsoft Corp. (Redmond, Wa.), NT plus Hyperkernel from Imagination Systems (Virginia Beach, Va.), NT plus INtime from Radisys Corp. (Hillsboro, Ore.), and NT plus RTX from VenturCom (Cambridge, Mass.).

Real-time solutions which can operate independent of Windows NT (but may link to it) include Java from Sun Microsystems (Palo Alto, Calif.), QNX RTOS from QNX (Kanata, Ontario, Canada), Controlware from Rockwell Automation/Allen-Bradley (Milwaukee, Wis.), and Tornado (a microkernel migration from VxWorks 5.2) from Wind River Systems (Alameda, Calif.).

Windows NT

Marcus Schmidt, industry marketing manager for manufacturing in the Microsoft application developer unit, says, “We are seeing the tides turning as manufacturing managers are confident in the ability of Windows NT to handle mission critical process monitoring and production management applications.

“Several ISVs [Independent Software Vendors] have solutions for extending NT into embedded applications like industrial controls.” Key Windows NT end-users include General Motors, Pennzoil, BP Oil, Colgate-Palmolive, and Volvo.”

Hyperkernel from Imagination Systems

Imagination Systems’, Joe Bland, vp Product Marketing, says, “Hyperkernel real-time subsystem for Windows NT provides a real-time execution environment concurrently with Windows NT (3.51 through 4.0). To achieve this deterministic performance, Hyperkernel operates at Ring 0 and employs a switching mechanism to share the CPU. Hyperkernel provides interrupt latencies less than 20 microseconds and provides this performance without modifying the NT Hardware Abstraction Layer (HAL).

“Through the use of MS Visual C/C++ programming tools developers can create multi-tasking and multi-threaded Hyperkernel applications. An integrated Hyperkernel Trace/Debugger is available with version 4.3. To reduce software development, Hyperkernel device drivers have direct access to system hardware for memory and interrupts, thus bypassing the NT dynamic data kernel. Communications to NT applications is via shared memory with support for semaphores and signals. Hyperkernel detects the NT stop condition and can continue to operate. Target markets for Hyperkernel include industrial control/processing, telecommunications, medical product design, product testing, and aerospace.

“Hyperkernel is available as a development system or run-time with support by staff in Virginia Beach and selected worldwide distributors.”

Industrial application include CNC, control engine for IEC-1131-3 programming tools, conveyor control and batch operations, high-speed image processing systems, industrial press controller, PC-based flow chart control, and robotics.

INtime NT extension

INtime software from Radisys Corp., as a real-time Windows NT extension, provide mission-critical determinism and reliability. Equipment manufacturers and control software providers are building power products combining ease-of-use, familiar user interface and connectivity of standard Windows NT with hard real-time performance.

Software is developed using familiar Microsoft developer studio, the same as any other Windows application. No kernel-level (ring 0) development is required. End-users include Alvey Systems, Carl-Ziess, Hyundai Precision Machinery, Komatsu, Mitsubishi, and Reliance Electric.

RTX from VenturCom

Eric Pickett, Internet and marketing coordinator, VenturCom, says VenturCom’s RTX delivers high-speed, deterministic processing capabilities to Windows NT that enable its use in the most demanding time-critical control applications.

RTX provides a real-time environment subsystem for Windows NT. The RTSS provides the core functions and resource management of RTX. The RTSS is tightly integrated with the Windows NT executive and shares a number of fundamental properties with Windows NT, including a common API (application program interface) and use of Windows NT’s object technology.

RTSS differs from traditional (and nonreal-time) Windows NT environment subsystems that enable deterministic performance because the RTSS is implemented as a Windows NT device driver running in kernel mode; and it contains a fixed-priority thread scheduler separate from the Windows NT executive.

These features allow the RTSS to utilize the timer and interrupt management services of the Real-Time HAL necessary for prioritized low-latency interrupt service.

Sun Microsystems’ Java

Chris Holland, manager, manufacturing markets communications, Sun Microsystems, says Java computing is inherently cross-platform compatible and network-aware, and development in the Java environment is more efficient than in any other language. These advantages are what make Java the ideal platform for today’s manufacturing enterprise, where a coherent IT communications structure is becoming the most important factor in maintaining a competitive advantage, according to Mr. Holland. Any machine (and that includes PLCs, for example) that has a Java Virtual Machine installed can run Java applets and applications.

It also means that legacy systems can be tied into the factory sensors, controllers, actuators, and embedded controllers as well as the corporate information network easily. Java’s “Write Once, Run Anywhere” model helps to lower costs by simplifying development, upgrading, and deployment of applications. Development in the Java environment proceeds as much as five times faster than any other platform. Programmers spend about 10% of their time debugging a Java application, vs. 60% with other languages, according to IBM.

QNX Realtime Operating System

With over 16 years of field-tested technology developed exclusively for the x86 market, QNX says its RTOS is the leading realtime OS for PCs. Based on a lean microkernel, this scalable, POSIX-certified RTOS combines hard realtime preformance, fault tolerance, and preemptive multitasking, with complete memory protection. QNX’s built-in networking provides transparent fault-tolerance and load-balancing while handling multiple networks (e.g. Arcnet, Ethernet, Token Ring, FDDI) simultaneously.

QNX also offers the Photon microGUI, a full-featured windowing system that fits (with QNX) into less than 1 MB of ROM or flash. Photon’s breakthrough connectivity allows any Photon application you create to display its GUI in remote PCs running Windows NT, 95, or X.

QNX operates in hundreds of thousands of installations worldwide, including industrial automation and process control partners, integrators, and end-users.

Controlware crosses platforms

Controlware family of products and software modules supports development of determinant, real-time control systems. These 16-bit products from Rockwell Automation/Allen-Bradley are hard real-time OSs with integrated services for machine and process automation. The other products and component modules unbundle the services and use a common application program interface (API).

Using a common API across all platforms—from embedded through Windows NT—helps developers reduce costs and improve time to market, says Jeff Hanna, Controlware business manager. Controlware provides modules for I/O and network services on all platforms (embedded, DOS, Windows NT, Windows CE, QNX, VxWorks) and provides high-performance interprocess communications mechanisms, Mr. Hanna explains.

Wind River Systems’ VxWorks 5.4

Wind River Systems has the VxWorks 5.2 and Tornado development systems, which may be used in VME, embedded, and PC-based applications.

Tornado is a microkernel migration from VxWorks 5.2. VxWorks kernel takes as little as 20 kB, and it can work on Unix or on PC via Windows host platforms. It is a high-performance scalable real-time operating system which executes on a target processor, a set of powerful cross-development tools which are used on a host development system, and a range of communication software options, such as Ethernet or serial line for the target connection to the host.

For more information, visit

Imagination Systems

Microsoft Corp.

Phar Lap Software.


Radisys Corp.

Rockwell Automation/Allen-Bradley

Sun Microsystems


Wind River Systems