20 lines
265 B
C
20 lines
265 B
C
#include "filter_bat2.h"
|
|
|
|
float filterbat(FILTERBAT *b, float InpVarCurr)
|
|
{
|
|
float y;
|
|
|
|
y = (b->k_0 * (InpVarCurr + (b->i_0*2) + b->i_1)) +
|
|
(b->k_1 * b->u_0) + (b->k_2 * b->u_1);
|
|
|
|
b->u_1=b->u_0;
|
|
b->u_0=y;
|
|
b->i_1=b->i_0;
|
|
b->i_0=InpVarCurr;
|
|
|
|
return y;
|
|
}
|
|
|
|
|
|
|