LibDriver NTC
Loading...
Searching...
No Matches
ntc filter driver function

ntc filter driver modules More...

Collaboration diagram for ntc filter driver function:

Functions

uint8_t ntc_set_filter (ntc_handle_t *handle, ntc_filter_t filter)
 set filter
uint8_t ntc_get_filter (ntc_handle_t *handle, ntc_filter_t *filter)
 get filter
uint8_t ntc_reset_filter (ntc_handle_t *handle)
 reset the filter
uint8_t ntc_set_filter_first_order_lag (ntc_handle_t *handle, float alpha)
 set filter first order lag
uint8_t ntc_set_filter_median_length (ntc_handle_t *handle, uint16_t length)
 set filter median length
uint8_t ntc_set_filter_anti_spike_average_length (ntc_handle_t *handle, uint16_t length)
 set filter anti spike average length
uint8_t ntc_set_filter_moving_average_length (ntc_handle_t *handle, uint16_t length)
 set filter moving average length
uint8_t ntc_set_filter_weighted_moving_average_length (ntc_handle_t *handle, float *weight, uint16_t length)
 set filter weighted moving average length
uint8_t ntc_set_filter_limiting (ntc_handle_t *handle, float degrees_celsius)
 set filter limiting
uint8_t ntc_set_filter_kalman (ntc_handle_t *handle, float q_process_noise_covariance, float r_measurement_noise_covariance, float p_estimation_error_covariance, float x_estimated_value)
 set filter kalman

Detailed Description

ntc filter driver modules

Function Documentation

◆ ntc_get_filter()

uint8_t ntc_get_filter ( ntc_handle_t * handle,
ntc_filter_t * filter )

get filter

Parameters
[in]*handlepointer to a ntc handle structure
[out]*filterpointer to a ntc filter buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 976 of file driver_ntc.c.

◆ ntc_reset_filter()

uint8_t ntc_reset_filter ( ntc_handle_t * handle)

reset the filter

Parameters
[in]*handlepointer to a ntc handle structure
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1255 of file driver_ntc.c.

◆ ntc_set_filter()

uint8_t ntc_set_filter ( ntc_handle_t * handle,
ntc_filter_t filter )

set filter

Parameters
[in]*handlepointer to a ntc handle structure
[in]filterntc filter
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 950 of file driver_ntc.c.

◆ ntc_set_filter_anti_spike_average_length()

uint8_t ntc_set_filter_anti_spike_average_length ( ntc_handle_t * handle,
uint16_t length )

set filter anti spike average length

Parameters
[in]*handlepointer to a ntc handle structure
[in]lengthanti spike average length
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 NTC_FILTER_BUFFER_SIZE < length
  • 5 length < 3
Note
\( y = \frac{1}{n-2} \left ( \sum\limits_{i = 1}^{n} {{{x}_{i}} - ({{x}_{(1)}} + {{x}_{(n)}})} \right ) \)

Definition at line 1073 of file driver_ntc.c.

◆ ntc_set_filter_first_order_lag()

uint8_t ntc_set_filter_first_order_lag ( ntc_handle_t * handle,
float alpha )

set filter first order lag

Parameters
[in]*handlepointer to a ntc handle structure
[in]alphainput alpha
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 NTC_FILTER_BUFFER_SIZE < 2
  • 5 alpha < 0.0f
  • 6 alpha > 1.0f
Note
\( y(n) = \alpha \cdot x(n) + (1 - \alpha) \cdot y(n - 1) \)

Definition at line 995 of file driver_ntc.c.

◆ ntc_set_filter_kalman()

uint8_t ntc_set_filter_kalman ( ntc_handle_t * handle,
float q_process_noise_covariance,
float r_measurement_noise_covariance,
float p_estimation_error_covariance,
float x_estimated_value )

set filter kalman

Parameters
[in]*handlepointer to a ntc handle structure
[in]q_process_noise_covarianceprocess noise covariance
[in]r_measurement_noise_covariancemeasurement noise covariance
[in]p_estimation_error_covarianceestimation error covariance
[in]x_estimated_valuex estimated value
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 NTC_FILTER_BUFFER_SIZE < 3
  • 5 adc read failed
Note
\( \hat{x}_{k \vert{} k-1} = \hat{x}_{k-1 \vert{} k-1} \\ P_{k \vert{} k-1} = P_{k-1 \vert{} k-1} + Q \\ K_k = \frac{P_{k \vert{} k-1}}{P_{k \vert{} k-1} + R} \\ \hat{x}_{k \vert{} k} = \hat{x}_{k \vert{} k-1} + K_k(z_k - \hat{x}_{k \vert{} k-1}) \\ P_{k \vert{} k} = (1 - K_k)P_{k \vert{} k-1} \)

Definition at line 1202 of file driver_ntc.c.

◆ ntc_set_filter_limiting()

uint8_t ntc_set_filter_limiting ( ntc_handle_t * handle,
float degrees_celsius )

set filter limiting

Parameters
[in]*handlepointer to a ntc handle structure
[in]degrees_celsiusdegrees celsius
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 NTC_FILTER_BUFFER_SIZE < 2
Note
\( y(n) = \begin{cases} x(n) & |x(n) - y(n-1)| \le \Delta \\ y(n-1) & |x(n) - y(n-1)| > \Delta \end{cases} \)

Definition at line 1175 of file driver_ntc.c.

◆ ntc_set_filter_median_length()

uint8_t ntc_set_filter_median_length ( ntc_handle_t * handle,
uint16_t length )

set filter median length

Parameters
[in]*handlepointer to a ntc handle structure
[in]lengthmedian length
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 NTC_FILTER_BUFFER_SIZE < length
  • 5 median filter length must be odd number
  • 6 length < 3
Note
\( y(n) = med \{ x(n-k), ..., x(n), ..., x(n+k) \} \)

Definition at line 1035 of file driver_ntc.c.

◆ ntc_set_filter_moving_average_length()

uint8_t ntc_set_filter_moving_average_length ( ntc_handle_t * handle,
uint16_t length )

set filter moving average length

Parameters
[in]*handlepointer to a ntc handle structure
[in]lengthmoving average length
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 NTC_FILTER_BUFFER_SIZE < length
  • 5 length is 0
Note
\( y(n) = \frac{1}{N} \sum \limits_{i = 0}^{N-1}{x(n-i)} \)

Definition at line 1105 of file driver_ntc.c.

◆ ntc_set_filter_weighted_moving_average_length()

uint8_t ntc_set_filter_weighted_moving_average_length ( ntc_handle_t * handle,
float * weight,
uint16_t length )

set filter weighted moving average length

Parameters
[in]*handlepointer to a ntc handle structure
[in]*weightpointer to a weight buffer
[in]lengthweighted moving average length
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 NTC_FILTER_BUFFER_SIZE < length
  • 5 length is 0
Note
\( y(n) = \frac {\sum \nolimits_{i = 0}^{N-1} {{{w}_{i}} \cdot x(n-i)}} {\sum \nolimits_{i = 0}^{N-1} {{{w}_{i}}}} \)

Definition at line 1137 of file driver_ntc.c.