EDN Access

 

August 1, 1997


Electromechanical Simulation: Tackling Control Systems Takes Talent and Tools

DAN STRASSBERG, SENIOR TECHNICAL EDITOR

Designing µP-based electromechanical systems is no job for a lone-wolf developer; one person can't possess all the needed expertise. And with today's demanding schedules, even multidisciplinary teams need powerful software and, often, hardware tools.

Wherever µPs manage moving mechanisms, successful marriages of electromechanical (EM) and electronic components depend on the teamwork of people with varied skills. Whether the product is an implantable intravenous infusion pump, an automobile-engine control, an automatic-braking or flight-control system, or a steel rolling mill, the design team needs broad expertise. Skills in dynamic-systems analysis and modeling, EM design, embedded-hardware design, and real-time software are all essential. Yet, even with all of these talents, the experts require something more to meet today's tight schedules: a powerful array of software and, often, hardware tools.

Central to EM-system developers' tool suites are graphical-modeling tools. (The box "For more information..." lists many such tools.) But don't think that you can draw a picture of a physical system on your workstation or PC screen and have the computer turn out a mathematical model. The software doesn't work that way--at least not yet. To obtain a model that approximates a system of even moderate complexity, you have to understand what models of similar systems look like and why. You should also have a strong mathematical background and some experience in modeling systems without the aid of a computer.

Engineers develop most EM models from first principles (that is, from an understanding of the physics of the system). Usually, suppliers of components, such as motors and actuators, supply device models. Nevertheless, combining the device models into a system model is not a trivial task.

Another way to develop system or subsystem models, however, is a technique known as "system identification." You apply known stimuli to the unit whose characteristics you want to describe mathematically and then measure the unit's responses. You then submit records of the stimuli and responses to the system-identification software, which produces a model.

Although the idea of letting a computer create models in this way seems appealing, the technique has achieved only limited acceptance. The main adherents are engineers who need to keep old systems running--on automated assembly lines, for example. Models created when such systems were new may no longer be sufficiently accurate because of wear in mechanical parts. Wear can introduce deadbands, which produce oscillation and instability that necessitate modification of control algorithms.

Developing and implementing control algorithms are key responsibilities of EM-system designers (see box "Simulating a disk-drive head positioner"). System modeling is important to these engineers for two main reasons: In most cases, control-algorithm design cannot be completed without a mathematical model of the system under control. Moreover, experiments on the real system are usually impractical until you are highly confident of success; failed experiments could cost both money and lives!

Still, exact system models are often unavailable. The thermostat that regulates your household temperature typifies controllers whose designers cannot work from accurate models of the controlled system. The need to produce devices that work in a variety of houses forces thermostat designers to use generalized models. The homeowner or the fuel dealer adjusts the deadband and on/off times by trial and error to empirically tune the "control algorithms." The trial-and-error approach works in this case because the consequences of improper adjustment are minor.

Avoid severe consequences

When the consequences are severe, however, there has to be another way to develop system or subsystem models, optimize control algorithms, and evaluate system performance. In fact, there are several other ways. Some companies lump multiple techniques into one category, called "hardware-in-the-loop (HIL) simulation." Other companies are emphatic that the name "HIL" belongs to only one member of that category. The simulation techniques are:

Rapid prototyping (RP): In RP, you use the real controller to control a computer simulation of the system that the controller is supposed to control. In this context, RP is unrelated to the similarly named technique in which packaging designers use laser and optical technology to turn liquid polymers into lifelike, albeit static, 3-D product models.

HIL: In HIL, you use a computer simulation of the controller to control some or all of the actual hardware that the real controller will ultimately control.

Virtual prototyping: In this technique, both the controller and the system under control exist solely as models running on a computer.

Getting meaningful results

Regardless of which technique you use, getting meaningful results is tricky. The problem is that the systems are dynamic, and the dynamics are absolutely central to the correct design of control algorithms. If you are simulating the controlled hardware and the simulation runs more slowly than the real system, you must insert delays into your controller to compensate. If you are using a simulated controller with real hardware, the problems are equally challenging. The simulated controller has to run at the same speed as the real one.

Designers might choose to build a cost-critical product--say, a subsystem of a mass-market automobile--around an 8-bit microcontroller running hand-optimized code without the benefit of a real-time operating system (RTOS). On the other hand, the prototype controller might use a faster 32-bit processor. But the more powerful processor probably runs compiled ANSI C code under an RTOS. Will the faster, more powerful processor run the much less compact code as fast as the less expensive processor runs the hand-optimized code? You need to know before you can trust the simulation results.

Code size and execution speed are, of course, also important in aspects of system development unrelated to simulation. These factors should be high on your list of criteria for selecting the tools you use to generate your code. Different tools can produce code whose efficiency differs dramatically. This statement is true whether you use memory consumption or execution speed to measure efficiency.

Different criteria

Nevertheless, if your product is large and expensive and you plan to build it in fairly small quantities, you may care little about minimizing the controller's cost, size, or power consumption. Your top priority is probably holding down the development time, which would be the case with such products as locomotives or steel rolling mills. When shortening development time is your top priority, you should give little weight to code efficiency; instead, select tools that emphasize ease of use.

One factor that distinguishes today's control systems from those that were common a decade or more ago is today's emphasis on controllers that implement sequential state machines (see box "Clearly state what you mean"). Though the use of state machines in controllers is no surprise in an age of digital electronics, it has significantly affected simulation- and system-design software. Classical control systems were linear; they treated nonlinear effects by approximating them as linear. This force-fit is no longer appropriate. More and more modern simulation and synthesis tools integrate state-machine design and analysis. Simulators handle systems whose parameters change as they operate.

In an era of state-machine-based control systems, system specifications are more important than ever. Any well-run design project should begin with a specification that explains the system behavior. Only if you clearly communicate your design intent to the design-team members and to the customers or marketers can you hope that your project will succeed.

Historically, a specification has been a document several inches thick, even for a system of only moderate complexity. These documents made great bedtime reading for insomniacs because after a few minutes of reading, most readers' eyes would glaze over. This was great if you were trying to get to sleep, but not so good if you were trying to figure out how the system was supposed to work.

Executable specifications

Within the past few years, software vendors have come to the aid of design teams by introducing a new concept--the executable specification. An executable specification is a relatively compact piece of software that simulates a system's user interface. In many cases, the executable specification also simulates the system's internal behavior, albeit at a macroscopic level. The system's responses appear on a PC's or workstation's screen. Users click a mouse to simulate pressing buttons and turning knobs.

An executable specification need not be photo-realistic; that is, the controls and displays don't have to look like those on the actual hardware. The executable specification need not include such niceties as animated graphics of motors whose rotation you can observe. A simple box labeled "motor" containing smaller boxes labeled "running" and "stopped" may be all you need.

But don't underestimate the importance of photo-realism in an executable specification. Companies such as Altia Design, Emultek, and Virtual Prototypes, whose software creates photo-realistic executable specifications, call such specifications invaluable competitive tools. Suppose two companies compete for a contract. One company's proposal includes a photo-realistic executable specification; the other's includes a written specification. The company that provides the executable specification wins the job every time. And according to Mike Juran, president of Altia Design, creating the executable specification takes less time than creating the written specification.


References

  1. Lewis, Paul H, and Chang Yang, Basic Control Systems Engineering, Prentice-Hall, Upper Saddle River, NJ, 1997.

  2. Lukich, Michael S, "Rapid prototyping of embedded systems: 1997 update," Society of Automotive Engineers 1997 Earthmoving-Industry Conference, Paper no. 97EIC-17.


  • Graphical tools make physical-system modeling easy and intuitive, but you still must understand the system and the underlying physics.

  • In most modern controllers, sequential state machines alter system parameters. Today's software tools integrate state-machine modeling in a variety of ways.

  • "System identification" constructs models of unknown systems from measurements of system responses.

  • In rapid prototyping, the real controller controls a computer simulation of the system that the controller is supposed to control. In hardware-in-the-loop simulation, a simulated controller controls the real physical system. Virtual prototyping simulates both the controller and the physical system.

  • Photo-realistic "executable specifications" require less paperwork than do documents and better illustrate how a system will work.

Simulating a disk-drive head positioner

The task in this example is to design a digital controller that provides accurate positioning of a disk drive's read/write head. The design is tricky because there is always some flexibility in the mechanism. Bad control-law design can lead to poor performance (slow track finding) or even instability, which causes the read/write head to hopelessly flail back and forth.

Using the MatLab Control Toolbox (from The MathWorks, which provided this example), you first enter the mathematical model for the plant. Model the system as a simple second-order plant. The inertia of the head assembly, I, equals 0.01 kg-m2; the viscous damping coefficient, C, equals 0.004 N-m/(rad/sec); the return-spring constant, K, equals 10 N-m/rad; and the motor-torque constant, KI, equals 0.05 N-m/rad.

The plant is a continuous system, and you must first convert it to the equivalent discrete system. Because the plant has a D/A converter with a zero-order hold at its input, use the zoh discretization method of the function C2D. Use sample time TS=0.005 (5 msec). The step-response plot (Figure A) clearly shows that the damping is far too light. The system oscillates quite a bit. To check this oscillation, use the PZMAP command to compute and plot the open-loop eigenvalues (Figure B).

Compensator needed

Note that the poles in Figure C are very lightly damped and near the unit circle. You need to design a compensator that increases the system damping. Try the most basic compensator--a simple gain.

As the pole trajectories in Figure C show, the system quickly becomes unstable. You must introduce lead or a compensator with zeros. Try the compensator D(z)=K(z+a)/(z+b), where a=­0.85, and b=0. Connect the compensator in series with the plant. As the curves inside Figure C's unit circle show, the poles stay within the unit circle for some time. Choosing a gain with reasonable damping results in a suitable design. The + symbol shows the final location of the closed-loop roots.

Figure D shows the disk drive's closed-loop step response. The response looks pretty good and settles in about 14 samples (which is 14·TS, or 0.07 sec). The design is now complete, although you can try to refine it further.

Clearly state what you mean

Using the term "state machine" in connection with control systems may prove confusing to some. A technique that is common in analyzing linear control systems, especially those with multiple inputs and multiple outputs (MIMO systems), is state-variable analysis. Though both state variables and sequential state machines share a connection with control systems, about the only other thing they share is the word "state."

Similar confusion can arise from the use of the acronym EM for electromechanical. Most electromechanical systems use electromagnetic components (motors and solenoids, for example). Vendors that provide electromagnetic-simulation software also use the acronym EM to describe it. In fact, some vendors provide both electromagnetic and electromechanical simulators and use EM to describe both. No wonder potential customers are confused!

For more information...
When contacting these manufacturers directly, please let them know you read about their products on EDN's website. Besides contacting the companies listed here, try visiting www.caltech.edu/extras/Virtual_Library/Control_VL.html. Its "Commercial Organizations" section contains more vendor listings.
Algor Inc
Pittsburgh, PA,
1-412-967-2700,
1-800-482-5467
fax 1-412-967-2781
www.algor.com
Modal-, spectrum-, and vibration- analysis software.
Altia Inc
Colorado Springs, CO
1-719-598-4299
fax 1-719-598-4392
www.altia.com
Software for creating photo-realistic user-interface prototypes and executable specifications.
Analogy
Beaverton, OR,
1-503-626-9700
fax 1-503-643-3361
www.analogy.com
Mixed-signal/simulation software tools with template libraries that include automotive and aerospace components; control systems; and mechanical elements, such as motors, springs, and friction dampers.
Ansoft Corp
Pittsburgh, PA,
1-412-261-3200
fax 1-412-471-9427
www.ansoft.com
System-simulation software for electromechanical and electromagnetic systems; uses desktop computers to predict system performance and interactions among components, such as electrical machines, actuators, sensors, and transformers.
Applied Dynamics
International Inc (ADI)
Ann Arbor, MI,
1-313-973-1300
fax 1-313-668-0012,
www.adi.com
Software and hardware for rapid-prototyping and hardware-in-the-loop simulation; links to other vendors’ electromechanical simulators; system-visualization and executable-specification software; tools for developing embedded software, including software that converts block diagrams into source code in several languages; this code compiles into embeddable object code, which can include embedded diagnostics.
The Boeing Co
Seattle, WA
1-206-865-6695,
1-800-426-1443
fax 1-206-865-2966
www.boeing.com/easy5/
Electromechanical system simulation and analysis software for PCs and workstations; includes a graphical-modeling facility, matrix-algebra tools, hydraulic- and power-component application libraries, and a tool kit for generating real-time code, including code for multiprocessor systems.
Cadence—Alta Group
Sunnyvale, CA
1-408-733-1595,
1-415-574-5800
fax 1-408-523-4601
www.altagroup.com
Signal Processing Worksystem software for system-level design, simulation, and implementation of DSP-based systems; can be used in designing DSP-based motion-control systems; finite state-machine editor; automatic C-code generator; multiprocessor support; cosimulation interface for MatLab.
Cayenne Software Inc
Burlington, MA
1-617-273-9003,
1-800-528-2388
fax 1-617-229-9904
www.cayennesoft.com
Technical groupware for specifying system behavior.
Concurrent Computer Corp
Fort Lauderdale, FL
1-954-974-1700,
1-800-666-4544
fax 1-954-977-5580
www.ccur.com
High-performance real-time computer systems for hardware-in-the-loop simulation and rapid prototyping; systems support electromechanical simulation packages from several software vendors.
dSpace Inc
Northville, MI,
1-248-344-0096
fax 1-248-344-2060
75371.36@compuserve.com
Moderately priced, real-time computing hardware for hardware-in-the-loop simulation and rapid prototyping; used for testing and prototyping embedded control systems for electromechanical applications.
Emultek Inc
Herndon, VA
1-703-478-0595,
1-800-368-5835
fax 1-703-478-0727
www.emultek.com
Software for creating photo-realistic user-interface prototypes and executable specifications; kernel for implementing and embedding compact state machines that you design by using the prototyping software.
Hyperception Inc
Dallas, TX,
1-214-343-8525
fax 1-214-343-2457
www.hyperception.com
Real-time Integrated Design Environment (RIDE) offers visual software development, especially for DSP-based systems, including those that use DSP for motion control; matrix math library; multiprocessor support; integration of hardware and software; exports Common Object-File Format (COFF).
iLogix Inc
Andover, MA,
1-508-682-2100
fax 1-508-682-5995
www.ilogix.com
The Statemate Magnum graphical language uses engineering diagrams to define a system’s structure, behavior, and user interface. A simulator can then animate the system behavior, creating an executable specification with which you can visualize and debug the system operation before constructing an actual unit. A code generator can convert the part of the model that represents software into C or Ada code and the part that represents hardware into Verilog or VHDL code.
Integrated Engineering Software
Winnipeg, MB, Canada
1-204-632-5636
fax 1-204-633-7780
www.virtualmarketplace.com/
LEVEL3/ITEC/INTENGE/INTENGE.HP
Software for 2- and 3-D modeling and analysis of electromagnetic structures.
Integrated Systems Inc
Sunnyvale, CA,
1-408-542-1500
fax 1-408-542-1950
www.isi.com
Graphical block-diagram modeling and simulation software; object-oriented graphical mathematical-analysis package with programmable graphical interface; automatic C and Ada real-time code generator; customizable automatic document generator; outputs in formats of popular word-processing and publishing packages; also produces HTML for Web pages; real-time processing hardware for hardware-in-the-loop simulation and rapid prototyping; tools for linking hardware to code produced by code generator; supports CISC, RISC, and DSP target
µPs; BetterState tool models, simulates, and analyzes sequential state ma-chines.
Knowledge Revolution Inc
San Mateo, CA
1-415-574-7777,
1-800-766-6615
fax 1-415-574-7541
www.krev.com
Working Model 2D V4.0 motion-simulation software for Windows 95 and NT.
The MathWorks Inc
Natick, MA,
1-508-647-7000
fax 1-508-647-7001
www.mathworks.com
Simulink 2, in conjunction with Stateflow and MatLab 5, performs continuous and event-driven simulation of linear and nonlinear systems, including closed-loop systems. (models can incorporate state machines.) Real-Time Workshop is a C- and Ada-code generator for Simulink. Stateflow Coder is a C-code generator for Stateflow. Versions are available for PCs, Macintoshes, and Unix workstations.
MGA Software
Concord, MA,
1-800-647-2275
fax 1-508-369-0013
www.mga.com
Visual-modeling software; code-generation for embedded implementation; two forms of simulation for performance verification and opti- mization: High Performance simulation uses powerful real-time computing hardware and optimized code, and Rapid Development simulation features an easy-to-use graphical interface and provides tools to simplify analyzing results.
Saltire Software
Beaverton, OR
1-503-968-6251,
1-800-659-1874
fax 1-503-968-1282
www.saltire.com
Motion-analysis software; allows engineers to create parametric models and analyze equilibrium forces and kinematics.
Simulation Research
Alphen aan den Rijn, Netherlands
+31 172 49 2353
fax +31 172 49 2353
Software for modeling and simulating electrical drives.
Tesis Wamware GmbH
Munich, Germany
+49 89 74 51 540
fax +49 89 74 51 5490
www.wamware.com
Hardware-in-the-loop simulation of vehicle dynamics.
Viewlogic Inc
Marlborough, MA,
1-508-480-0881
fax 1-508-480-0882
www.viewlogic.com
Electromechanical EDA software; initial release mainly for documentation of cables and wiring harnesses, but forthcoming releases will handle a variety of design problems that involve mechanics and electronics.
Virtual Prototypes
Montreal, PQ, Canada
1-514-341-3874,
1-800-361-6424
fax 1-514-341-8018
http://VirtualPrototypes.ca
Software tools for creating photo-realistic user-interface prototypes and executable specifications. Tools generate ANSI C code. Development requires a Unix workstation, but the prototypes run on PCs under Windows 3.1, 95, or NT. Therefore, you can easily deploy the prototypes as sales tools or use them for operator training.
Visual Solutions
Westford, MA,
1-508-392-0100
fax 1-508-692-3102
www.vissim.com
Visual-modeling tool for Windows provides state-space and pole-zero representations, as well as Bode and Nyquist plots. C-code generator produces customizable ANSI C code from block diagrams. Real-time tool works with PC-based data-acquisition cards for hardware-in-the-loop simulation. DSP tool speeds generation of DSP algorithms.

Dan Strassberg, Senior Technical Editor

You can reach Dan Strassberg at 1-617-558-4205, fax 1-617-928-4205, ednstrassberg@cahners.com.


| EDN Access | Feedback | Table of Contents |


Copyright © 1997 EDN Magazine, EDN Access. EDN is a registered trademark of Reed Properties Inc, used under license. EDN is published by Cahners Publishing Company, a unit of Reed Elsevier Inc.