Exact match. Not showing close matches.
PICList
Thread
'[PIC] Proportional (of PID) vs. hardware filterin'
2005\05\12@123610
by
PicDude

Finally got around to implementing/trying some proportional filtering [
N=N+(NL)*K ] in one of my pieces of PIC code (which is essentially a
frequency counter). This thing is sweet! I've experimented with K=1/4, 1/2,
and 3/4. For my app, 3/4 works well (but I still have a bit of averaging in
there still, since I'm experimenting with combinations of averaging and
proportional filtering).
BTW, I chose these constants since they made for some simple assembly code.
Curious about one thing though  anyone have a correlation or calculation to
compare software proportional filtering to an RC filter? Or asked another
way  how do I determine the equivalent hardware filter timeconstant for a
proportional software filter? I'm sure the update rate of the calculations
will be a factor here.
I don't really need this for anything specific, just think it will be an
interesting tidbit of info.
Cheers,
Neil.
2005\05\12@125036
by
Padu
From: "PicDude"
> Finally got around to implementing/trying some proportional filtering [
> N=N+(NL)*K ] in one of my pieces of PIC code (which is essentially a
> frequency counter). This thing is sweet! I've experimented with K=1/4,
1/2,
> and 3/4. For my app, 3/4 works well (but I still have a bit of averaging
in
> there still, since I'm experimenting with combinations of averaging and
> proportional filtering).
>
<snip>
Out of curiosity... if you have a PID, wouldn't you have three constants
(Kp, Ki, Kd)?
2005\05\12@131135
by
JanErik Soderholm
PID != "Proportional control".
PID = "Proportional, Integrating and Derivating control"
What method are you using ?
JanErik.
2005\05\12@131424
by
PicDude
On Thursday 12 May 2005 11:48 am, Padu scribbled:
> <snip>
>
> Out of curiosity... if you have a PID, wouldn't you have three constants
> (Kp, Ki, Kd)?
That's when you're doing PID *control*  I've just implemented filtering
using the proportional part of the equation for display output.
Cheers,
Neil.
2005\05\12@131745
by
Spehro Pefhany

At 11:35 AM 5/12/2005 0500, you wrote:
{Quote hidden}>Finally got around to implementing/trying some proportional filtering [
>N=N+(NL)*K ] in one of my pieces of PIC code (which is essentially a
>frequency counter). This thing is sweet! I've experimented with K=1/4, 1/2,
>and 3/4. For my app, 3/4 works well (but I still have a bit of averaging in
>there still, since I'm experimenting with combinations of averaging and
>proportional filtering).
>
>BTW, I chose these constants since they made for some simple assembly code.
>
>Curious about one thing though  anyone have a correlation or calculation to
>compare software proportional filtering to an RC filter? Or asked another
>way  how do I determine the equivalent hardware filter timeconstant for a
>proportional software filter? I'm sure the update rate of the calculations
>will be a factor here.
>
>I don't really need this for anything specific, just think it will be an
>interesting tidbit of info.
>
>Cheers,
>Neil.
This simulates a singlepole RC low pass filter with time constant
tau = Ts * (1/K  1) (where Ts is sample period)
So, if you want tau = 0.5 seconds and you are sampling 20 times a second
(Ts = 0.05) then you'd use K = 1/9 .
The output never quite reaches the input (with infinite precision math), so
it's an IIR filter. With a step change the error after t time is
% error = 100% * exp(t/tau)). So with 0.5 second tau, after 5 tau (2.5
seconds)
you'd have an error of about 0.7%.
Best regards,
Spehro Pefhany "it's the network..." "The Journey is the reward"
spam_OUTspeffTakeThisOuTinterlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
Inexpensive test equipment & parts http://search.ebay.com/_W0QQsassZspeff
2005\05\12@134825
by
PicDude

Hey cool  some concrete math. I've been calculating to 4 bits to the right
of the b.p. (binary point, which is my terminology for binary equivalent of a
decimal point), and so far it's been quite accurate. I did some experiments
with coming *up* to a certain value and going *down* to that value and it
seems to settle back to the same point quite well (meaning the error is
unnoticeable). I'm doing a bit of rounding as well.
Cheers,
Neil.
On Thursday 12 May 2005 12:22 pm, Spehro Pefhany scribbled:
{Quote hidden}> This simulates a singlepole RC low pass filter with time constant
> tau = Ts * (1/K  1) (where Ts is sample period)
>
> So, if you want tau = 0.5 seconds and you are sampling 20 times a second
> (Ts = 0.05) then you'd use K = 1/9 .
>
> The output never quite reaches the input (with infinite precision math), so
> it's an IIR filter. With a step change the error after t time is
>
> % error = 100% * exp(t/tau)). So with 0.5 second tau, after 5 tau (2.5
> seconds)
> you'd have an error of about 0.7%.
>
>
>
> Best regards,
>
> Spehro Pefhany "it's the network..." "The Journey is the
> reward"
.....speffKILLspam@spam@interlog.com Info for manufacturers:
>
http://www.trexon.com Embedded software/hardware/analog Info for
> designers:
http://www.speff.com Inexpensive test equipment & parts
>
http://search.ebay.com/_W0QQsassZspeff
2005\05\12@140103
by
olin_piclist
part 1 996 bytes contenttype:text/plain; (decoded 7bit)
PicDude wrote:
> Finally got around to implementing/trying some proportional filtering
> [ N=N+(NL)*K ]
Huh? This is an exponential runaway, not a filter, for positive values of
K.
> Curious about one thing though  anyone have a correlation or
> calculation to compare software proportional filtering to an RC filter?
I use my FILTBITS program followed by CSVPLOT to show the step response of a
filter. You type in the bit shift amount for each filter pole, and it makes
a plot. For example, the attached plot is of a 3 pole filter with 4 bits of
shift (FF = 1/16 in my filter equation, FF may be what you intended K to be)
per pole.
My MPASM preprocessor also has built in functions for computing filter
fraction values given the iteration frequency and either the 3dB rolloff
frequency or the 1/2 step response time. See the FFTC2 and FFFREQ built in
functions. The preprocessor, PREPIC, is described at
http://www.embedinc.com/pic.
part 2 7832 bytes contenttype:image/gif; (decode)
part 3 35 bytes contenttype:text/plain; charset="usascii"
(decoded 7bit)
2005\05\12@140348
by
olin_piclist
Padu wrote:
>> Finally got around to implementing/trying some proportional filtering [
>> N=N+(NL)*K ]
>
> Out of curiosity... if you have a PID, wouldn't you have three constants
> (Kp, Ki, Kd)?
If he had a PID, maybe he would. Nothing in his post had anything to do
with PID, however.
*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 7429014, http://www.embedinc.com
2005\05\13@142557
by
Peter
On Thu, 12 May 2005, Padu wrote:
> Out of curiosity... if you have a PID, wouldn't you have three constants
> (Kp, Ki, Kd)?
When you do PID in assembly and a 24 bit floating point math code just
so happens not to be handy or affordable space and timewise, then it is
extremely useful to constrain Kp, Ki and Kd to fractions of small
numbers (preferrably binary numbers). 3/4 is easily done in assembly,
and so are most other numbers that end in 0.25 and whose integer parts
are divisible by 2. 0.7886544 is slightly harder so most people avoid
such multipliers.
Peter
More... (looser matching)
 Last day of these posts
 In 2005
, 2006 only
 Today
 New search...