API for the qRMS Recursive Root Mean Square calculator.
More...
|
int | qRMS_Setup (qRMS_t *const q, float *const window, const size_t wsize) |
| Initialize the RMS instance by setting the default optimal parameters.
|
|
float | qRMS_Update (qRMS_t *const q, const float x) |
| Computes the moving root mean square (RMS) of the input signal. The object uses both the exponential weighting method and the sliding window method to compute the moving RMS.
|
|
int | qRMS_SetParams (qRMS_t *const q, const float lambda, const float alpha) |
| Change the recursive parameters for the moving RMS estimator.
|
|
API for the qRMS Recursive Root Mean Square calculator.
For a brief description of this module, please read Recursive Root Mean Square estimator
◆ qRMS_SetParams()
int qRMS_SetParams |
( |
qRMS_t *const | q, |
|
|
const float | lambda, |
|
|
const float | alpha ) |
Change the recursive parameters for the moving RMS estimator.
- Parameters
-
[in] | q | A pointer to the RMS instance. |
[in] | lambda | Exponential weighting factor, specified as a positive real scalar in the range [0,1]. A forgetting factor of 0.9 gives more weight to the older data than does a forgetting factor of 0.1. A forgetting factor of 1.0 indicates infinite memory. All the past samples are given an equal weight. |
[in] | alpha | A parameter to tune the 2nd stage filter. Should be a value between [ 0 < alpha < 1 ]. A higher value will result in a smoother output but also increasing the convergence time. |
- Returns
- 1 on success, otherwise returns 0.
◆ qRMS_Setup()
int qRMS_Setup |
( |
qRMS_t *const | q, |
|
|
float *const | window, |
|
|
const size_t | wsize ) |
Initialize the RMS instance by setting the default optimal parameters.
- Parameters
-
[in] | q | A pointer to the RMS instance. |
[in] | window | A pointer to the window storage, an array of wsize elements. |
[in] | wsize | The window size. |
- Returns
- 1 on success, otherwise returns 0.
◆ qRMS_Update()
float qRMS_Update |
( |
qRMS_t *const | q, |
|
|
const float | x ) |
Computes the moving root mean square (RMS) of the input signal. The object uses both the exponential weighting method and the sliding window method to compute the moving RMS.
- Note
- For a 50-60Hz sine waveform leave default parameters, use a window of 8 samples and make sure you call the qRMS_Update() at a rate of 1mS. In this configuration you will obtain an optimal estimate that converges in a cycle of the wave
- Parameters
-
[in] | q | A pointer to the RMS instance. |
[in] | x | The raw signal. |
- Returns
- A recursive estimation of the RMS for the incoming signal x.