Re: Compensation Issue



I did design a PID controller initially. This was the approac I took.
First, I did identified the model of the car in s-domain and then
designed a controller via Root Loci and simulated in the results (in
s-domain). The results were satisfactory. But when I went and
implemented the PID controller in Type C, the car was unstable. Then,
I converted the PID controller in z-domain and the result was an
unstable system. So then I tried to design a digital controller and
then converted calculated the difference equation and obtained somewhat
satisfactory results.

Is there a special way of implementing a PID controller (digitally)? Do
I need an actual integrator of the error? Can I just design the PID
controller in the s-domain and then converted it to z-domain, a certain
Ts, and implemented according to the difference equation of the
transfer in z-domain?



Tim Wescott wrote:
bxa132203 wrote:

I applied a square wave to my system as the input and the output.

From 0 to 10 the car reaches a steady state value as well as when it
goes from 10 to 20. But 20 to 10 , there is a huge error (20%). But
when it goes from 10 to 20, a steady state value is reached, and back
from 20 to 10, 20% error is observed.

If you could post a picture to the web someplace, and include a link, it
would be helpful. Be sure to include your command that you want to follow.

The compensator that was design for the car is

5.3291 (z-0.41) (z-0.05564)

Gc(z) = // -----------------------------------------------

(z-0.9884) (z+0.997)



The actual implementation is



Kz = .263171; (notice the gain is lower than that of the design)

z1 = -.41 ; z2 = -.05564 ; p1 = -.9884; p2 =.997 ;

uk = (p1+p2)*uk_1 -1.0*(p1*p2)*uk_2 +Kz*(ek + (
z1+z2)*ek_1 + z1*z2*ek_2)



Any ideas, why the discrepancy?

First some nitpicking:

Your have a discrepancy in your notation. If the 'zn' is supposed to be
zeros and the 'pn' is supposed to be poles then

z1 = 0.41, z2 = 0.05564,
p1 = 0.9884, p2 = -0.997.

There is also a discrepancy between your transfer function and your
difference equation. If your transfer function is

z^2 - 0.4656z + 0.02281
Gc(z) = Kz * -----------------------
z^2 + 0.0086z - 0.98543

then your difference equation should be

u_k = -0.0086 * u_{k-1} + 0.98543 * u_{k-2} +
Kz * (e_k - 0.4656 * e_{k-1} + 0.02281 * e_{k-2}).

You have the sign of at least one term reversed in your transfer function.

Actually, you should cascade two 1st-order filters in your difference
equation. My paper "Z Transforms for the Embedded System Engineer" at
http://www.wescottdesign.com/articles/zTransform/z-transforms.html
explains why, as does my book.

Now to answer your question:

That controller has no poles at z = 1. As a consequence, if your system
has any disturbances with DC content, or if your plant is not
integrating you will never achieve zero steady-state error. Instead,
your error will build up to the point where the controller output can
cancel the DC content of the disturbance. This is probably what is
happening.

See if you can design a plain old PID controller for the thing, and if
not try a PID controller with a lead-lag thrown in for some more speed.
I'd get it going with a PID at first, then get more fancy after I'd
done some measurements.

Now some more nitpicking:

You have a controller pole at -0.997? What are you thinking! I believe
that you have done your design using pole placement techniques. Pole
placement can be a valuable technique (I've used it myself), but only if
you know exactly how tractable your plant is, and define your target
pole locations so you're not asking too much of it. What pole placement
doesn't do is introduce any sensibility about the fact that plant models
can be inaccurate, and will design controllers that are completely
unreasonable -- either just plain unstable, or ones that excite plant
nonlinearities -- at the drop of a hat.

You should not start out using pole placement. You should either use a
robust design technique like H^2 or H-infinity, or you should use the
1950's robust design technique of doing it all on a Bode plot and a
Nyquist chart (this is in my book, too). Using a Bode plot is the
quickest way I know for getting a known-good system with the best robust
performance.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Posting from Google? See http://cfaj.freeshell.org/google/

"Applied Control Theory for Embedded Systems" came out in April.
See details at http://www.wescottdesign.com/actfes/actfes.html

.



Relevant Pages

  • Re: Determining Plant Bandwidth
    ... to use pole placement, and the least squares identification technique ... Control system design would be much easier if the parts of the system had a better understanding of what they're supposed to do. ... I suspect that you'll have system stability problems long before you get an unstable controller, so I wouldn't bother going there. ...
    (sci.engr.control)
  • Review my resume. Please.
    ... communication, interpersonal, and problem solving skills. ... MOST and CAN (Controller ... network devices for automotive industry based on MOST (Media Oriented ... the Open Systems Interconnect reference model; design focused ...
    (comp.arch.embedded)
  • Re: Compensation Issue
    ... should I implement that in that in my controller? ... then converted calculated the difference equation and obtained somewhat ... Can I just design the PID ... that you have done your design using pole placement techniques. ...
    (sci.engr.control)
  • Re: Simple multi-channel serial ADC (8-ch)?
    ... dump data via SBW into the device without the design suite open. ... Problem is that most micro makers are protecting their programming ... Just like a vendor who refused to disclose the schematic of a laser controller, a schematic I only needed to find out what the plant parameters would be. ...
    (sci.electronics.design)
  • Re: Data Acquisition - More details
    ... understand I will have to start from "zero" to design the final hardware. ... be fed to the controller. ... PCB input modules together with the controller PCB will be developed. ...
    (comp.dsp)