Re: Controller design



On Mon, 20 Aug 2007 09:30:09 +0000, Marco Trapanese wrote:

Tim Wescott wrote:

Take your input, complete with units (DAC counts? Volts?) and your
output, complete with units (ADC counts, I bet), and divide them. You
should get something like 600 inches/volt, or 600 RPM/volt, or 600 (input
counts)/(output counts), etc.

Well, of course the input and output are DAC and ADC counts (the former
@ 8 bit the latter @ 12 bit). However, the actual units should be °/s
(angular velocity).
For example if I take an input of 255 the ADC will read 3800 (2048 is
the relative zero) so the output will be 3800-2048 = 1752. If I divide
them I get 0.145... But does it have sense? May I compare two values on
different scales (8 bit DAC and 12 bit ADC) ?

I'm sorry but I'm still confused about this :(

It can, indeed, be confusing -- even to the experienced.

Your 0.145 ADC count/DAC count does, indeed make sense. You'd have to
rescale it if you changed to a 12-count DAC, but as you've stated it it
makes sense.

It also makes sense to find the constant after the DAC and before the ADC
-- in this case I think it's degrees/sec/volt, although you haven't
mentioned volts so I can't be sure.

If you have the luxury of using floating point you can convert your ADC
reading to degrees/second, compute a "voltage" from your controller and
convert that to DAC counts as you write to the DAC. Usually one doesn't
want to be so extravagant in one's choice of processor, so usually
floating point is too dang slow. If it isn't, you can leverage it to make
the code much easier to understand.

Given the continuous step response in 's' domain -> transform it in
the time domain -> sample (@ 5 ms, the ADC sampling time) and convert
to 'z' domain -> P(z) is found dividing by z/(z-1). Can I?

If P(z) is your z-domain translation of P(s), then your transfer
function can be found with

z - 1
H(z) = P(z) -----
z

I think this is what you mean...

Yes.

Yes, as long as you keep in mind that your step response measurement
may have inaccuracies

Yes I know. But for my application I guess I can have some inaccuracies
without a lot of problems.

Usually I write a scilab function to calculate the closed-loop transfer
function, and use that.

Are you saying to write the transfer function of both controller and
plant as polynomials (i.e. C = 1 / (z - 1) ) calulate the closed-loop
t.f. (i.e. H = C*P / (1 + C*P) ) and finally create the system through
syslin?


Scilab treats ratios of polynomials as transfer functions automatically,
and builds the variables 's' and 'z' into the system automatically too.
So to make a z domain transfer function you just need to write

C = 1 / (%z - 1); C.dt = (your sampling interval);

Note that it even keeps track of your sampling interval, which is cool.
You can use these transfer functions nearly anywhere that you would use a
linear system (which is kept in state-space form). The only drawback is
that for complex systems you run into problems with numerical precision;
it is more accurate to use the line:

C = 1 / (%z - 1); C.dt = (your sampling interval); C = tf2ss(C);

You can still cascade systems by 'multiplication', so C * H will generate
the system of C cascaded with H. For feedback you use the './' operator:

H_ol = C * H; H_cl = (C * H) ./ 1; // apply unity feedback

I'm going to be adding information on my website on using Scilab with the
book's material, so feel free to keep an eye on it.

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
.



Relevant Pages

  • Re: 256-fold (or even more) increase in speed on copper wire possible IMHO
    ... ie. 8 DC voltage levels much like done with a DAC and ADC. ... There's the loss inherent in the wires, just as a start - You *MIGHT* ... Then there's environmental noise that the wires are going to pick up (I ...
    (comp.arch.embedded)
  • Re: 256-fold (or even more) increase in speed on copper wire possible IMHO
    ... ie. 8 DC voltage levels much like done with a DAC and ADC. ... If the wire run is short (e.g. ... The problem is that what comes out of the cable is quite different than what you put into the cable, especially at high signaling rates. ...
    (comp.arch.embedded)
  • Re: Tube DACs??
    ... Figure 4.3 says that the total power usage was 500 watts. ... If enough accuracy and stability were possible, the SAR DAC technology would ... But what we need is a DAC, not a successive approximation ADC. ...
    (rec.audio.tubes)
  • Re: Roland DD6 effects pedal
    ... Are you still seeing the sine wave at a pin on the ADC? ... I ask because the symptoms you describe sound like something in the ADC ... input chain is losing the signal & supplying noise instead. ... the main chippery has a regulated 5V including the ADC and DAC. ...
    (sci.electronics.repair)
  • Re: 256-fold (or even more) increase in speed on copper wire possible IMHO
    ... ie. 8 DC voltage levels much like done with a DAC and ADC. ... If the wire run is short (e.g. ... For example 1 Gbps means 125 MB/s. ...
    (comp.arch.embedded)