×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

From theory to application

From theory to application

From theory to application

(OP)
I'm a ME graduate student with an academic focus in dynamic systems and control theory. At this point in my education, I feel comfortable coming up with the equations of motion of a dynamic system and designing a controller using state-feedback to place the poles of the system. However, if someone asked me to build a controller in order to implement my controller design, I would be lost. In other words, I have a large disconnect in my understanding between theory and application.

Can anyone suggest books or methods to help me close the gap? I'm planning on setting up a home electronics lab for <$1000 in order to work on projects, but I need a place to start. The ballbot project sounds interesting, but I think I need to start with more basic experiments.

Thanks

RE: From theory to application

If you truly have a state feedback design, meaning you're measuring all of the system states without an observer, you simply need to multiply each of your measurements by the appropriate state feedback gain, add them together, multiply by -1 to get negative feedback, and apply the resulting control signal(s) to your actuators. You could do this with operational amplifiers if you want an analog controller, or you could implement the same mathematics in a microprocessor very simply.

If you have an observer, the simplest way I know is to implement a controller is to find the transfer function of the controller (gain matrix plus observer). Once you have that, you can then implement it with analog components if desired. Alternatively, you can discretize the transfer function using your chosen sampling rate (simple to do in MATLAB/Octave), then implement the resulting discrete-time transfer function as a set of difference equations in a microprocessor.

Those are the simple answers. It can become much more complicated when you begin to take into account scaling of signals, quantization from analog-to-digital conversion, saturation, failure modes, anti-windup mechanisms if you have integration occurring, filtering to reduce noise, desire to use velocity-form algorithms over position-form algorithms for your controller, choosing feedback gains or tuning constants based on whether you're solving a tracking or a regulating problem, etc. Oh, and you need to know how to measure system parameters and size actuators, and these need to be specified during a system design phase. Then there's the fact that that you can usually only model simple systems and won't actually know the state space or transfer function models of many systems before the system has been constructed, if at all. There's a lot of problems to solve to be able to control a system. See how fun this can be?

xnuke
"Live and act within the limit of your knowledge and keep expanding it to the limit of your life." Ayn Rand, Atlas Shrugged.
Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.

RE: From theory to application

(OP)
I guess that is where my question lies. Can you recommend some texts to help me understand how to take my state-feedback gain (and possibly an observer) and select the hardware and take the steps required to put them to use?

RE: From theory to application

I'm only going to focus on simple software executions for now, as the complete software and the hardware is not trivial.

A state feedback example is fairly easy to describe. Let's assume you have a plant with two states, e.g., a permanent magnet dc motor (position and velocity are usually chosen), that you'll control by linearly manipulating the applied terminal voltage vt. Assume both states are measured, have voltage values that can be read in to a computer via an ADC, and are stored in variables Position and Velocity. Assume also that you've developed a plant model and a state feedback law u = -Kx, e.g., using pole placement or LQR methods. Using the typical control law for state feedback, you'll simply calculate the variable Voltage, e.g., Voltage = -[K(1)*Position+K(2)*Velocity] and write it to the output port that you are controlling to adjust the terminal voltage. Your sample rate should be around ten times faster than the fastest pole in the closed loop system you are concerned about.

An observer-based controller implementation isn't that much harder if you understand controls pretty well. Now, assume that only the velocity of your motor is available for measurement (e.g., via a tachometer connected to the motor shaft), but the velocity signal is very noisy due to unmodeled dynamics. An observer-based controller can help if the plant is observable. The observer will not only provide you an estimate of the position, but can clean up the noisy velocity signal and provide you with a smooth estimate of the velocity. A controller based on a full-state observer contains both the control law u=-Kx and the estimator, possibly designed via LQR and LQG/LTR methods taking advantage of the separation principle that says you can place the poles of the system and the observer using separate calculations. Note that the observer-based controller receives its input from the output of the plant (Velocity, in this case) and gives Voltage as its output. Once you've designed the controller, find the open-loop transfer function of the controller from Velocity to Voltage. Discretize this transfer function using your sample rate. Write both the numerator and denominator of the discretized controller transfer function in terms of z-x, where x is an integer valued exponent of z.

As an example, I'll assume that your observer is second-order (since your plant is also), so if your controller transfer function denominator was z2+0.5z+0.01 and your numerator was z2+0.4z+0.03 (both completely made up), divide both by z2 to obtain 1z0+0.5z-1+0.01z-2 and 1z0+0.4z-1+0.03z-2, respectively. Note that I've kept the 1z0 terms even though I could have written them as 1; this lets me know these are the present term coefficients.

Recalling that the transfer function is the ratio of the output of the controller Voltage to the input of the controller Velocity in the discrete frequency domain, cross multiplying (using *, but meaning multiplication, not meaning conjugation) gives you: (1z0+0.5z-1+0.01z-2)*Voltage = (1z0+0.4z-1+0.03z-2)*Velocity.

Since a z-x term means that signal is delayed by x samples, you'll need to have memory locations for the present value of Voltage and the two previous values of Voltage, as well as the present value of Velocity and the two previous values of Velocity as a function of sampling.

To implement the controller algorithm I've made up, create a loop in the code that executes at your desired sample rate with the following instructions. Here's some pseudocode:

CODE

While Stop <> 1
Read the present value of Velocity(n) on the appropriate input port

Solve for the present Voltage term: 
Voltage(n) = Velocity(n)+0.4*Velocity(n-1)+0.03*Velocity(n-2)-0.5*Voltage(n-1)-0.01*Voltage(n-2)
where n is the current time step, n-1 is the previous time step, etc.

Write the Voltage(n) term out to the output port. 

Shift the values stored in your memory locations: 
Voltage(n-2) = Voltage(n-1)
Voltage(n-1) = Voltage(n)
Velocity(n-2) = Velocity(n-1)
Velocity(n-1) = Velocity(n)
Return 

Does that help?

xnuke
"Live and act within the limit of your knowledge and keep expanding it to the limit of your life." Ayn Rand, Atlas Shrugged.
Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.

RE: From theory to application

(OP)
Yes, that does help. Thanks for your time. I guess now I'll come up with a simple experiment I can build at home to put this into practice.

RE: From theory to application

I am a few weeks late on this post, but based upon the response by xnuke and that you found it helpful (which it was) tells me that the book Understanding Digital Signal Processing by Richard Lyons would be right up your ally. For me, it was the resource that made that leap between controls theory and actual implementation possible. I would recommend the book without hesitation.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

eBook - 10 Reasons to Choose CATIA on the Cloud
To compete in today’s fast-paced and competitive market, smaller and newer firms need a powerful platform that will enable them to compete with bigger players, without the heavy investments needed in computer hardware, software and personnel. Download Now
White Paper - Smart Manufacturing for Electronics
This white paper describes a transformative approach to electronics manufacturing made possible by the addition of Mentor Graphics to the Siemens family. It describes a completely digitalized strategy that supports both printed circuit board (PCB) and mechanical design and manufacturing, uniting the entire product lifecycle – from idea and production to customers and back. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close