Making Analog Data Digital

Understand how to create digital representations of analog systems for control system applications.

03/01/2010


LINKS

www.ventimar.com

Read related articles from Vance VanDoren at www.controleng.com/archive :

Relay method automates PID loop tuning, Sept. 2009

Time proportional control: More from an on/off switch, May 2009

Sorting out PID controller differences, Feb. 2009

The basics of numerical filtering, Oct. 2008.

Process controllers predict the future, March 2008.

Editors note: Last November, we published an article , Designing Your Own Control System, that offered a link to a more detailed work on the design concepts of industrial control systems. We warned that it tackled some issues that might make you dust off your math textbooks from engineering school. The full-length version of article was heavily downloaded, which suggests that you readers are not afraid of a challenge.

This month we have another offering in the same vein, a discussion of how analog data taken from process and discrete field devices and sensors is converted into a digital representation for use in a control system. The article shows how a digital controller can be created from an analog (or continuous) model, which is especially useful when a processor is used to control an analog system. While there are many methods available to convert between analog and digital systems, the author concentrates on Tustin’s method and hold equivalence as two that work especially well. These particular methods are evaluated to show how they compare with an analog system, and how they can be used as an introduction to the subject or applied to advanced systems.

Digital Representations of Analog systems for Control System Applications is a condensed (12-page) tutorial that should help expand your understanding of critical concepts that underlie most process and discrete control systems.

The author, Peter Way, is president of VentiMar, LLC, a consulting group that helps companies develop and market high-tech products. He also consults in control system projects. Reach him at peterw@ventimar.com . The following is an excerpt from the tutorial.

Discrete representation takes sampling and output reconstructor into account.

Discrete representation takes sampling and output reconstructor into account.

An excerpt from the introduction:

This tutorial shows how digital controllers can be created from an analog (or continuous) model. This is especially useful when a processor is used to control an analog system. Note that this process works equally well for converting filters or compensators from analog to digital form.

Many methods are available to convert between analog and digital systems. I have tried several others and selected two approaches that model the analog system well: Tustin’s Method and Hold Equivalence . These are evaluated to show how they compare with an analog system. These methods were tedious to implement in the past, and are now easily managed by tools for doing algebra symbolically, or solving the equations in matrix form. This makes the job much easier and more accurate.

Just a modest amount of theory is presented to help with understanding the methods. If you want to see the full details and derivations of formulas, consult a digital control textbook. This application note is somewhat introductory, but the techniques can also be applied for advanced solutions.

Processors sample analog (continuous) system signals and convert the values to numbers they can work with. Typically an Analog to Digital converter (ADC) takes a reading of the signal at each time T (the sample time). A series of these values are held in the processor.

Another common input device is a rotary or linear encoder. In this case pulses are counted as the encoder moves. At each time T, the present count is added/subtracted to get a new position depending on direction of rotation. Velocity is proportional to the number of counts received during each time T. Once the desired calculations are made in the processor, the numbers are reconstructed into a signal that the rest of the system can use.

If an analog output is desired, the simplest solution is to output the current value through a Digital to Analog converter (DAC) and hold it until a new one arrives. This implies a Zero Order Hold (ZOH) and is the most common reconstructor. Another popular way to reconstruct the signal is through a Pulse Width Modulator (PWM). This modulator makes a constant frequency square wave and varies the width of the pulse. The benefit of a PWM is that it can efficiently drive power transistors to move motors or actuators. Many processors have built-in PWM and DAC outputs and ADC converters. SimApp4 is a simulation program that was used to make all the models in this paper.

There are two main options for designing a digital controller:

Method 1 : Start by designing an analog controller. Then convert it to digital form including the effects of sampling the analog plant and holding the output at the DAC. This approach is most intuitive for the designer since you are working in the familiar s-domain (Laplace domain). The key is to make a digital equivalent of the controller that really represents the analog controller well.

Method 2 : Start by converting the plant, DAC/ZOH, and ADC to an effective digital form. Then design a digital controller that makes this system perform as desired. This method may have some advantages when the plant contains a delay element since this is naturally modeled in digital form. This model is not as intuitive since the dynamic specifications for the system need to be defined in the discrete domain (z-domain). This usually begins with the s-domain specifications and then the poles/zeros of the solution are mapped to the z-domain.

We will assume Method 1 in this application note. You may have done a compensator design, either as a PID or a more sophisticated one. Since compensators are essentially filters, the discussion will show how to convert an example analog filter to a digital one. Then the whole system can be simulated to ensure the right results are achieved.

Discrete equivalents—the Z transform is simpler than it would seem

The job of the processor is to read in inputs (at the ADC) at each sample time T: u 0 , u 1u n -1 , u n , and then to convert them to outputs over time (to the DAC): y 0 , y 1y n -1 , y n . The subscript n represents the current time and n -1, n -2, etc. others happen earlier at time intervals T. The processor only keeps the last few values required to make the calculation of the output.

In the processor we may want to make an output from the inputs by a difference equation like this, where a and b values are constants:

y n = a 1 y n -1 + a 2 y n -2 + a 3 y n -3 …+ b 0 u n + b 1 u n -1 + b 2 u n -2

This is a general form for a digital filter with a single input/output. It is in the form of an equation that can be easily implemented in a processor. Note that if we make the a values 0, and b n = b n -1 = b n -2 = 1/3, the result is a moving average of three values ( a very simple digital filter).

Two important points for implementation:

1. The difference equation is assumed to be calculated instantly when the timer goes off and u n is measured. The output y n goes immediately to the DAC. Naturally the calculations take some time. You can precalculate items that depend on past values during the last time sample and then just add the new information b 0 u n once the timer interrupt occurs. If the calculation delay T d between measurement and output is significant, you can model an extra small delay e - sTd delay into the model of the analog plant being controlled.

2. Many of the calculations involved in digital control should be done with floating point. While integer or byte-level math can be done, it can take a lot of effort to implement the equations for numerical accuracy. Why not use a faster processor if possible?

Understanding the Z transform

If you remember the basics of Laplace transforms (frequency domain), a delay of time T is represented by multiplication with e - sT . Please review a control system text if you are interested in knowing how this works. So, a way of dealing with the inputs and outputs above and providing the correct relationship between them is a number of fixed time T delays. Note that u 0 is T earlier than u 1 and so on to higher subscripts. A general way to say it: u n - k is kT earlier than u n ,. If the current time is u n the delay from a previous time is written in the frequency domain is: e -skT . This is the same as ( e -sT ) k . Now to simplify this notation, we will use: z -1= e -sT . (Who wants to write that exponential all the time?) e -skT is then equal to z -k . You will also see z = e sT in books since this is mathematically correct (but would require you to have time machine to travel to the future). So the equations always have to be rearranged so that the exponents are negative or 0 before implementation.

View this article online at www.controleng.com/file/10409-Digital_Representation_of_Analog_Systems.pdf

 





No comments
The Top Plant program honors outstanding manufacturing facilities in North America. View the 2013 Top Plant.
The Product of the Year program recognizes products newly released in the manufacturing industries.
The Leaders Under 40 program features outstanding young people who are making a difference in manufacturing. View the 2013 Leaders here.
The new control room: It's got all the bells and whistles - and alarms, too; Remote maintenance; Specifying VFDs
2014 forecast issue: To serve and to manufacture - Veterans will bring skill and discipline to the plant floor if we can find a way to get them there.
2013 Top Plant: Lincoln Electric Company, Cleveland, Ohio
Case Study Database

Case Study Database

Get more exposure for your case study by uploading it to the Plant Engineering case study database, where end-users can identify relevant solutions and explore what the experts are doing to effectively implement a variety of technology and productivity related projects.

These case studies provide examples of how knowledgeable solution providers have used technology, processes and people to create effective and successful implementations in real-world situations. Case studies can be completed by filling out a simple online form where you can outline the project title, abstract, and full story in 1500 words or less; upload photos, videos and a logo.

Click here to visit the Case Study Database and upload your case study.

Bring focus to PLC programming: 5 things to avoid in putting your system together; Managing the DCS upgrade; PLM upgrade: a step-by-step approach
Balancing the bagging triangle; PID tuning improves process efficiency; Standardizing control room HMIs
Commissioning electrical systems in mission critical facilities; Anticipating the Smart Grid; Mitigating arc flash hazards in medium-voltage switchgear; Comparing generator sizing software

Annual Salary Survey

Participate in the 2013 Salary Survey

In a year when manufacturing continued to lead the economic rebound, it makes sense that plant manager bonuses rebounded. Plant Engineering’s annual Salary Survey shows both wages and bonuses rose in 2012 after a retreat the year before.

Average salary across all job titles for plant floor management rose 3.5% to $95,446, and bonus compensation jumped to $15,162, a 4.2% increase from the 2010 level and double the 2011 total, which showed a sharp drop in bonus.

2012 Salary Survey Analysis

2012 Salary Survey Results

Maintenance and reliability tips and best practices from the maintenance and reliability coaches at Allied Reliability Group.
The One Voice for Manufacturing blog reports on federal public policy issues impacting the manufacturing sector. One Voice is a joint effort by the National Tooling and Machining...
The Society for Maintenance and Reliability Professionals an organization devoted...
Join this ongoing discussion of machine guarding topics, including solutions assessments, regulatory compliance, gap analysis...
IMS Research, recently acquired by IHS Inc., is a leading independent supplier of market research and consultancy to the global electronics industry.
Maintenance is not optional in manufacturing. It’s a profit center, driving productivity and uptime while reducing overall repair costs.
The Lachance on CMMS blog is about current maintenance topics. Blogger Paul Lachance is president and chief technology officer for Smartware Group.