Function to capture both the rising edge of a condition and the falling edge of a condition by setting filters in space or time.
When the rising edge of the condition is detected, the value of the corresponding filter variable(varFilt) is stored.
As long as the difference between the current value of the filter variable and the stored value is less than the specified threshold(thrTrue) the function returns FALSE, while when the difference becomes greater than the specified threshold the function returns TRUE.
Only when the function is returning TRUE, at detection of the falling edge of the condition, the value of the corresponding filter variable(varFilt) is stored.
As long as the difference between the current value of the filter variable and the stored value is less than the specified threshold(thrFalse) the function continues to return TRUE, while when the difference becomes greater than the specified threshold the function returns FALSE.
|
|
bool onoff_filt (bool cond, real varFilt, real thrTrue [, real thrFalse=thrTrue])
|
|
Condition to be examined for front search
|
|
Evolving quantity (typically time(tfb) or space ip(n))
|
|
Quantity of varFilt in which to stably see the true condition
|
|
Quantity of varFilt in which to stably see the false condition (optional, default thrTrue)
|
|
Return:
|
|
FALSE
|
At startup if cond = FALSE
|
cond = FALSE and you have exceeded the threshold thrFalse
|
cond = TRUE but the threshold thrTrue was not exceeded
|
TRUE
|
cond = TRUE and you have exceeded the threshold thrTrue
|
cond = FALSE but the thrFalse threshold was not exceeded
|
|
|
Rule, Task
|
|
|
Providing ip(n) as a filter variable, for example, will result a filter in space, while providing tfb as a filter variable will result a filter in time (seconds).
Example of use:
bool reso = false
bool reso2 = false
reso = onoff_filt(rEnaFilt, tfb, 0.5, 1)
reso2 = onoff_filt(rEnaFilt, tfb, 1.5)
|
|