Cheetah Software  1.0
digital_lp_filter< T > Class Template Reference

#include <filters.h>

+ Inheritance diagram for digital_lp_filter< T >:
+ Collaboration diagram for digital_lp_filter< T >:

Public Member Functions

 digital_lp_filter (T w_c, T t_s)
 
virtual ~digital_lp_filter (void)
 
virtual void input (T input_value)
 
virtual T output (void)
 
virtual void clear (void)
 
- Public Member Functions inherited from filter< T >
 filter (void)
 
virtual ~filter (void)
 

Private Attributes

Lpf_in_prev [2]
 
Lpf_out_prev [2]
 
Lpf_in1
 
Lpf_in2
 
Lpf_in3
 
Lpf_out1
 
Lpf_out2
 
lpf_out
 

Detailed Description

template<typename T>
class digital_lp_filter< T >

Definition at line 33 of file filters.h.

Constructor & Destructor Documentation

template<typename T >
digital_lp_filter< T >::digital_lp_filter ( w_c,
t_s 
)

Definition at line 101 of file filters.cpp.

101  {
102  Lpf_in_prev[0] = Lpf_in_prev[1] = 0;
103  Lpf_out_prev[0] = Lpf_out_prev[1] = 0;
104  Lpf_in1 = 0, Lpf_in2 = 0, Lpf_in3 = 0, Lpf_out1 = 0, Lpf_out2 = 0;
105  float den = 2500 * t_s * t_s * w_c * w_c + 7071 * t_s * w_c + 10000;
106 
107  Lpf_in1 = 2500 * t_s * t_s * w_c * w_c / den;
108  Lpf_in2 = 5000 * t_s * t_s * w_c * w_c / den;
109  Lpf_in3 = 2500 * t_s * t_s * w_c * w_c / den;
110  Lpf_out1 = -(5000 * t_s * t_s * w_c * w_c - 20000) / den;
111  Lpf_out2 = -(2500 * t_s * t_s * w_c * w_c - 7071 * t_s * w_c + 10000) / den;
112 }
T Lpf_out_prev[2]
Definition: filters.h:43
T Lpf_in_prev[2]
Definition: filters.h:42
template<typename T >
digital_lp_filter< T >::~digital_lp_filter ( void  )
virtual

Definition at line 115 of file filters.cpp.

115 {}

Member Function Documentation

template<typename T >
void digital_lp_filter< T >::clear ( void  )
virtual

Implements filter< T >.

Definition at line 135 of file filters.cpp.

135  {
136  Lpf_in_prev[1] = 0;
137  Lpf_in_prev[0] = 0;
138  Lpf_out_prev[1] = 0;
139  Lpf_out_prev[0] = 0;
140 }
T Lpf_out_prev[2]
Definition: filters.h:43
T Lpf_in_prev[2]
Definition: filters.h:42
template<typename T >
void digital_lp_filter< T >::input ( input_value)
virtual

Implements filter< T >.

Definition at line 118 of file filters.cpp.

118  {
119  lpf_out = Lpf_in1 * lpf_in + Lpf_in2 * Lpf_in_prev[0] +
120  Lpf_in3 * Lpf_in_prev[1] + // input component
121  Lpf_out1 * Lpf_out_prev[0] +
122  Lpf_out2 * Lpf_out_prev[1]; // output component
123  Lpf_in_prev[1] = Lpf_in_prev[0];
124  Lpf_in_prev[0] = lpf_in;
125  Lpf_out_prev[1] = Lpf_out_prev[0];
126  Lpf_out_prev[0] = lpf_out;
127 }
T Lpf_out_prev[2]
Definition: filters.h:43
T Lpf_in_prev[2]
Definition: filters.h:42
template<typename T >
T digital_lp_filter< T >::output ( void  )
virtual

Implements filter< T >.

Definition at line 130 of file filters.cpp.

130  {
131  return lpf_out;
132 }

Member Data Documentation

template<typename T >
T digital_lp_filter< T >::Lpf_in1
private

Definition at line 44 of file filters.h.

template<typename T >
T digital_lp_filter< T >::Lpf_in2
private

Definition at line 44 of file filters.h.

template<typename T >
T digital_lp_filter< T >::Lpf_in3
private

Definition at line 44 of file filters.h.

template<typename T >
T digital_lp_filter< T >::Lpf_in_prev[2]
private

Definition at line 42 of file filters.h.

template<typename T >
T digital_lp_filter< T >::lpf_out
private

Definition at line 45 of file filters.h.

template<typename T >
T digital_lp_filter< T >::Lpf_out1
private

Definition at line 44 of file filters.h.

template<typename T >
T digital_lp_filter< T >::Lpf_out2
private

Definition at line 44 of file filters.h.

template<typename T >
T digital_lp_filter< T >::Lpf_out_prev[2]
private

Definition at line 43 of file filters.h.


The documentation for this class was generated from the following files: