Tim Wescott wrote:
...
> If Jerry doesn't understand it, I didn't explain it well.
I just read it wrong. Sorry.
> Take gain = 0.1, input is constant 1, and output starts at 0. Then you
> should get:
>
> step output
> 0 0
> 1 0.1
> 2 0.19
> 3 0.271
> n 1 - 0.9^n
>
>>>> A 20Hz cutoff is pretty high for a sampling rate of 50Hz -- you're
not
>>>> going to get much attenuation of your noise.
>>> The sampling rate is 100Hz. I might lower the cutoff further. But the
>>> previous implementation of this controller, done in the analog world,
>>> used 20 Hz with good results. But that was a third order filter.
> It's still high, even for a 100Hz sampling rate -- but not nearly as
bad.
>
>> To measure entire periods, the sample rate should be 50 Hz. There is no
>> assurance that alternate half cycles have the same duration.
>>
>
> Gin up a filter with a transfer function (z + 1)/(z - d), with d close
to
> 1. That'll let you update at 100Hz while rejecting the noise at 50Hz,
> yet still giving you good response at somewhat lower frequencies.
>
>>>> Keep in mind that as you lower the filter bandwidth you'll have to
>>>> back
>>>> off your pro****tional and integral gains to keep the loop stable.
>>> I know. That's also why I don't want to lower the cutoff frequency too
>>> much.
>>>
>>>> You may also find that you need to use more than 16 bits in the
filter
>>> to
>>>> maintain enough precision
>>> That would be a problem, because in the programming language I'm
using,
>>> I only have 16 bit integers, and no carry bit.
>
> Then get another programming language! If it's C, and it's remotely
ANSI
> C compatible, then 'long' will be 32 bits.
Forth is great for embedded work and does double precision. (At a 100 Hz
sample rate, I can do floating point in Forth on a 68HC11.)
...
>
> You can extend precision in most any programming language if you can
> stand the tedium -- but it's often easier to do things in assembly.
Few HLLs make the carry and overflow bits available. That makes extended
precision a bit difficult (but the DEC Alpha doesn't have a carry bit).
Jerry
--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
** Posted from http://www.teranews.com
**


|