embedded software boot camp

Reality Bites

Wednesday, April 24th, 2002 by Michael Barr

The analog world is a messier place than most engineers like to admit. When we work exclusively on the digital, either in hardware or software, it’s possible to forget that the analog never quite behaves the same way twice. I was reminded of this the hard way when trying to model the behavior of a mechanical brake for a piece of precision physical therapy equipment.

A brake is nothing more than a couple of slabs of metal connected to a shaft: one fixed slab presses on the other, thus limiting the movement of the other (and thereby the shaft). The amount of force applied during braking can be controlled fairly precisely in such a system via an electrical signal (e.g., PWM). However, the resulting torque on the shaft is very difficult to accurately predict. In the real world, friction and other physical effects count for a lot: individual brakes have large frictional differences; they also heat up as they are used, which changes their surface characteristics; and the surfaces wear with use as well.

Trying to build a software model for all this such that we could always control the amount of torque required to “slip” any brake to within the required +/- 0.5 lb-in turned out to be an elusive goal. Even if you have all the variables at your disposal, it’s unlikely the analog world will cooperate to produce a consistent result time after time. (Even when we controlled all the variables in our system, we still found variations in the slip torque up to ten times greater than our required precision.) The development of a closed loop control algorithm for the electrical signal driving the brake, based on the torque applied by the user and the shaft’s velocity at each instant, was in the end a far more rational use of engineering time.

The digital is merely a model for the analog; and models are never perfect.

Keeping these crucial lessons in mind, we learn to solve such difficult problems by designing the software to adapt to the real world as it changes. Then all the designers need know at the outset is the range of permissible values and what decision to make at each.

Artificial intelligence takes this approach to its extreme. Far from enabling robots to laugh and cry, artificial intelligence is simply a system for making dynamic decisions. The system is provided a database of known facts; it learns other facts as it operates. By the application of a priori rules, decisions can be made based on the current environment.

We should also recognize that when we simulate a complex system, imperfections in the model are accepted as a tradeoff. Some systems, like airplanes or helicopters, are simply too expensive or dangerous to be used during the early stages of software development. The purpose of the model, then, is to get designers through those early stages, until the software is “safe” to test on the real hardware. Such a model, therefore, need not always be 100% correct.

We can deal with differences between the digital and the analog world best by staying aware of the differences. If we close our eyes to these differences, our systems may fail to adapt correctly to the real world around them.

Tags:

Leave a Reply