Zibb
Subscribe to Control Engineering
FirstLight
Ask Charlie   


Recent Posts

Recent Comments

Most Commented On

Archives

Blog

Link This | Email this | Blog This | Comments (2)


How do I ensure timing in a microprocessor-based control system?
July 30, 2007

We are indebted to Carl Thompson, who is senior supervising engineer at PB Americas, Inc. for this question, the full text of which reads:

“When replacing a relay based control system with a microprocessor system, what must be taken into account to ensure that remote I/O will not pose a timing problem to the system?”

There are a couple of issues I want to bring up that you should cover before even thinking about timing. These are the sort of package you want for your system and the inputs you want to use.

Microprocessor-based systems come in a variety of form factors, such as PC-104, packaged embedded computers of various sizes and shapes, and raw motherboards (also of various sizes and shapes). What you choose depends on the space you have available and the computing power you need.

The fact that the original control system was based on relays indicates that your control algorithm relies on digital inputs. This is the time to reanalyze your control algorithm to see whether you want to bring analog values in, or whether the digital inputs the relays accept are enough.

Now, we’re ready to look at timing issues. Analog input and output channels operate on the basis of samples, and the number of samples through the channel per second determines the maximum timing error you expect. Many systems, however, multiplex one analog-to-digital convertor (ADC) to cover several analog input channels.

These are the timing issues arising from using remote I/O and a microprocessor-based system. With contemporary technology, however, you should be able to find reasonably priced equipment that will easily outpace your legacy relay system.

If you simply replace the relays with a computer, then things are even better. Digital I/O for microprocessors is blindingly fast. Even high-speed relays are slow by comparison.

To get digital data in and out of the microprocessor, you will need to configure at least two digital ports, one for input and one for output. Start by counting the number of digital inputs and the number of digital outputs. Let’s say you have 5 digital inputs and 2 digital outputs. Suppose your computer board is designed to allow configuring channels in groups of 4. You might configure the first 2 groups into one 8-bit digital input port, which gives you a single-precision (8-bit) integer. Configure the second group as digital output.

There will be 32 possible input patterns corresponding to the binary numbers 00000 through 11111, which correspond to the decimal numbers 0-31. There will be four possible output patterns corresponding to the binary numbers 00 through 11, which are 0-3 in decimal notation. The extra bits making up the single-precision words would simply be padded with zeros.

The control program would then consist of a lookup table with one column and 32 rows. The row number corresponds to the input value. The value loaded into that location corresponds to the output value. The program (in C) consists of one line:

while (flag == 1); {output = table(input);}

There will, of course, be other lines of code to define the array and set up the program’s structure, but this is the only line that will execute repeatedly.

The variable "input" refers to a buffer location carrying the current bit pattern from the digital input port, and "flag" refers to a similar buffer that signals whether the control system is running or stopped. The variable "output" refers to a buffer connected to the digital output port.

The executing statement looks at the table location pointed to by the value in input, and loads the value table(input) into the variable output. As long as the value loaded into the variable flag is 1, the statement in braces keeps executing at every program step.

All of this happens faster than any relay system could ever hope to react. There will be no timing issues as long as you are running under a real time operating system (RTOS), such as VxWorks from Wind River Systems or Windows Embedded from Microsoft. For open source fans, both Wind River and Montavista provide real-time versions of Linux.

Posted by Charlie Masi on July 30, 2007 | Comments (2)


August 29, 2007
In response to: How do I ensure timing in a microprocessor-based control system?
Deterministic Control commented:

Certainly to ensure timing for control systems you must isolate the processing from anything that causes uncertainty to the processing. An embedded RTOS is one way, another is to use a control device or system that is itself, independant from the PC that it communicates with. A system like ADwin which offloads all the control, I/O and signal processing to a stand-alone system does just this. ADwin localizes the I/O, signal processing and control functions in close proximity to the process itself. It provides communication back to a PC for visulaization, set-point manipulation or data storage (all the things that a PC is designed for) but isolates processing of the control algorithm from the sporadic system interrupts within Windows. The best way to ensure timing in any real-time process is to use a system that provides complete DETERMINISM.




October 2, 2007
In response to: How do I ensure timing in a microprocessor-based control system?
Paul Pan commented:

Could you recommend some handheld instruments that can easily measure and indicate room air pressure (positive or negative, and how much)?





POST A COMMENT
Display Name or Registered Users Login Here.

Before submitting this form, please type the characters displayed above:


Advertisement



Advertisements



About Us   |   Advertising Info   |   Site Map   |   Contact Us   |   Useful Sites   |   FREE Subscription   |   RSS
© 2008 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy
Please visit these other Reed Business sites