Implements a discrete filter. More...
#include <IIRFilter.hpp>
Public Member Functions | |
IIRFilter (std::vector< double > &inputCoeff, std::vector< double > &outputCoef) | |
One input constructor. | |
IIRFilter (std::vector< std::vector< double > > &inputCoeff, std::vector< double > &outputCoef) | |
Multi input constructor. | |
IIRFilter (IIRLowPass dummyType, double wn, double csi, double ts) | |
Low Pass Filter with sample time ts : wn^2/(s^2 + 2*csi*wn*s + wn^2) | |
IIRFilter (IIRFiltDeriv dummyType, double wn, double csi, double ts) | |
Filtered Derivative with sample time ts : (wn^2*s)/(s^2 + 2*csi*wn*s + wn^2) | |
IIRFilter (IIRLowPassButtW dummyType, double wn, double ts) | |
4-th order Butterworth Low Pass Filter with sample time ts : | |
IIRFilter (IIRFiltDerivButtW dummyType, double wn, double ts) | |
Filtered Derivative with sample time ts and 4-th order Butterworth Low Pass Filter: | |
IIRFilter (const IIRFilter &t) | |
Copy constructor. | |
IIRFilter & | operator= (const IIRFilter &t) |
Assigment operator =. | |
void | step (double in, double &out) |
Executes a step of the recursive filter. | |
void | step (const std::vector< double > &in, double &out) |
Executes a step of the recursive filter, in case of multiple inputs. | |
~IIRFilter () | |
Private Member Functions | |
void | _kernelConstructor (std::vector< std::vector< double > > &inputCoeff, std::vector< double > &outputCoeff) |
Private Attributes | |
std::vector< std::vector < double > > | _inCoeff |
int | _inNum |
int | _order |
std::vector< double > | _outCoeff |
std::vector< std::list< double > > | _pastIns |
std::list< double > | _pastOuts |
int | iCo |
int | iIn |
std::list< double >::iterator | inIt |
std::list< double >::iterator | outIt |
Implements a discrete filter.
Definition at line 69 of file IIRFilter.hpp.
TELEKYB_NAMESPACE::IIRFilter::IIRFilter | ( | std::vector< double > & | inputCoeff, |
std::vector< double > & | outputCoef | ||
) |
One input constructor.
[in] | inputCoeff | Coefficients of the denominator of the Zeta transform. Ex. If you want b0 + b1*z + b2*z^2 +z^3 you have to set: inputCoeff[0] = b0, inputCoeff[1] = b1, inputCoeff[2] = b2 Note that the last coefficient is not involved since it is always considered as 1. |
[in] | outputCoeff | Coefficients of the numerator of the Zeta transform. Ex. If you want a0 + a1*z + a2*z^2 + a3*z^3 you have to set: outputCoeff[0] = a0, outputCoeff[1] = a1, outputCoeff[2] = a2, outputCoeff[3] = a3 Note that if outputCoeff.size() > inputCoeff.size() + 1 then outputCoeff is cut at the entry outputCoeff[inputCoeff.size()] (included). This is needed to have a causal filter. |
Definition at line 51 of file IIRFilter.cpp.
TELEKYB_NAMESPACE::IIRFilter::IIRFilter | ( | std::vector< std::vector< double > > & | inputCoeff, |
std::vector< double > & | outputCoef | ||
) |
Multi input constructor.
[in] | inputCoeff | Vector of Coefficients of the denominators of the Zeta transform for each different input. Ex. If you want b0 + b1*z + b2*z^2 +z^3 you have to set: inputCoeff[0] = b0, inputCoeff[1] = b1, inputCoeff[2] = b2 Note that the last coefficient is not involved since it is always considered as 1. |
[in] | outputCoeff | Coefficients of the numerator of the Zeta transform. Ex. If you want a0 + a1*z + a2*z^2 + a3*z^3 you have to set: outputCoeff[0] = a0, outputCoeff[1] = a1, outputCoeff[2] = a2, outputCoeff[3] = a3 Note that if outputCoeff.size() > inputCoeff.size() + 1 then outputCoeff is cut at the entry outputCoeff[inputCoeff.size()] (included). This is needed to have a causal filter. |
Definition at line 56 of file IIRFilter.cpp.
TELEKYB_NAMESPACE::IIRFilter::IIRFilter | ( | IIRLowPass | dummyType, |
double | wn, | ||
double | csi, | ||
double | ts | ||
) |
Low Pass Filter with sample time ts : wn^2/(s^2 + 2*csi*wn*s + wn^2)
[in] | dummyType | It indicates the type of filter. |
[in] | wn | Natural frequency [rad/s]. |
[in] | csi | Damping ratio. |
[in] | ts | Sampling time [s]. |
Definition at line 81 of file IIRFilter.cpp.
TELEKYB_NAMESPACE::IIRFilter::IIRFilter | ( | IIRFiltDeriv | dummyType, |
double | wn, | ||
double | csi, | ||
double | ts | ||
) |
Filtered Derivative with sample time ts : (wn^2*s)/(s^2 + 2*csi*wn*s + wn^2)
[in] | dummyType | It indicates the type of filter. |
[in] | wn | Natural frequency [rad/s]. |
[in] | csi | Damping ratio. |
[in] | ts | Sampling time [s]. |
Definition at line 98 of file IIRFilter.cpp.
TELEKYB_NAMESPACE::IIRFilter::IIRFilter | ( | IIRLowPassButtW | dummyType, |
double | wn, | ||
double | ts | ||
) |
4-th order Butterworth Low Pass Filter with sample time ts :
[in] | dummyType | It indicates the type of filter. |
[in] | wn | Natural frequency [rad/s]. |
[in] | csi | Damping ratio. |
[in] | ts | Sampling time [s]. |
Definition at line 119 of file IIRFilter.cpp.
TELEKYB_NAMESPACE::IIRFilter::IIRFilter | ( | IIRFiltDerivButtW | dummyType, |
double | wn, | ||
double | ts | ||
) |
Filtered Derivative with sample time ts and 4-th order Butterworth Low Pass Filter:
[in] | dummyType | It indicates the type of filter. |
[in] | wn | Natural frequency [rad/s]. |
[in] | csi | Damping ratio. |
[in] | ts | Sampling time [s]. |
Definition at line 179 of file IIRFilter.cpp.
Definition at line 249 of file IIRFilter.cpp.
TELEKYB_NAMESPACE::IIRFilter::IIRFilter | ( | const IIRFilter & | t | ) |
Copy constructor.
Definition at line 60 of file IIRFilter.cpp.
void TELEKYB_NAMESPACE::IIRFilter::_kernelConstructor | ( | std::vector< std::vector< double > > & | inputCoeff, |
std::vector< double > & | outputCoeff | ||
) | [private] |
Definition at line 34 of file IIRFilter.cpp.
Assigment operator =.
Definition at line 69 of file IIRFilter.cpp.
void TELEKYB_NAMESPACE::IIRFilter::step | ( | double | in, |
double & | out | ||
) |
Executes a step of the recursive filter.
[in] | in | Input value. |
[out] | out | Output value. |
Definition at line 253 of file IIRFilter.cpp.
void TELEKYB_NAMESPACE::IIRFilter::step | ( | const std::vector< double > & | in, |
double & | out | ||
) |
Executes a step of the recursive filter, in case of multiple inputs.
[in] | in | Input values. |
[out] | out | Output value. |
Definition at line 259 of file IIRFilter.cpp.
std::vector< std::vector<double> > TELEKYB_NAMESPACE::IIRFilter::_inCoeff [private] |
Definition at line 71 of file IIRFilter.hpp.
int TELEKYB_NAMESPACE::IIRFilter::_inNum [private] |
Definition at line 76 of file IIRFilter.hpp.
int TELEKYB_NAMESPACE::IIRFilter::_order [private] |
Definition at line 75 of file IIRFilter.hpp.
std::vector<double> TELEKYB_NAMESPACE::IIRFilter::_outCoeff [private] |
Definition at line 72 of file IIRFilter.hpp.
std::vector< std::list<double> > TELEKYB_NAMESPACE::IIRFilter::_pastIns [private] |
Definition at line 73 of file IIRFilter.hpp.
std::list<double> TELEKYB_NAMESPACE::IIRFilter::_pastOuts [private] |
Definition at line 74 of file IIRFilter.hpp.
int TELEKYB_NAMESPACE::IIRFilter::iCo [private] |
Definition at line 78 of file IIRFilter.hpp.
int TELEKYB_NAMESPACE::IIRFilter::iIn [private] |
Definition at line 78 of file IIRFilter.hpp.
std::list<double>::iterator TELEKYB_NAMESPACE::IIRFilter::inIt [private] |
Definition at line 77 of file IIRFilter.hpp.
std::list<double>::iterator TELEKYB_NAMESPACE::IIRFilter::outIt [private] |
Definition at line 77 of file IIRFilter.hpp.