PulseFreq('Expression','Omega'=0,'EdgeType'=2,'MinFreq'=0.05)
Arguments
|
'Expression' |
Pulse counter signal |
|
|
'Omega' |
Filter frequency |
|
|
'EdgeType' |
Edge type to be counted |
|
|
'EdgeType' = -1 |
Falling edges only |
|
|
'EdgeType' = 0 |
Rising and falling edges |
|
|
'EdgeType' = 1 |
Rising edges only |
|
|
'EdgeType' = 2 |
'Expression' is a pulse counter |
|
|
'MinFreq' |
Smallest frequency that is shown |
|
Description
This function computes the frequency of a pulse counter 'Expression'. The unit of the result is pulses/sec or Hz.
A low-pass filter with filter frequency 'Omega' is applied to the result. If 'Omega' is 0, then the low-pass filter is deactivated. 'EdgeType' determines which edges of pulses to count. If no pulse occurs in 1000 samples, the function returns 0 as the calculated frequency.
The frequency is only output as soon as the second edge occurs. The value is based on the distance between the first and second edge, with the calculation only taking place at the time of the second edge.
This function was especially designed for using the WAGO incremental encoder 750-631. You can use the function to calculate the speed based on the pulse counter signal from the encoder. The pulse counter value is differentiated while accounting for possible overflow. Because the result of the differentiation may include interfering frequencies or noise, a low-pass filter is subsequently applied. The filter frequency is ideally set slightly above the maximum pulse frequency.
