Function to capture the falling edge of a condition by setting a filter in space or time.
Syntax |
real fall_filt (bool cond, real varFilt, real thrFilt) |
||||||||
---|---|---|---|---|---|---|---|---|---|
cond |
Condition to be examined for the front search |
||||||||
varFilt |
Evolving unit (typically time(tfb) or space ip(n)) |
||||||||
thrFilt |
Quantity of varFilt in which the false condition is to be stably seen |
||||||||
Result |
Returns:
|
||||||||
Validity |
Rule, Task |
||||||||
Note |
From the first time the function is executed until the condition remains low and the threshold is exceeded the value returned is 0. Past that threshold the value returned is the first supplied value of varFilt. In case fall_filt() is used in a user R3 function, it should be avoided that the parameters of the function itself are involved in the 'condition' expression. The result would not be as hoped because of the overlap in memory of the state of several variables |
Providing ip(n) as a filter variable, for example, will result in a filter in space, while providing tfb as a filter variable will result in a filter in time (units seconds).
Each fall_filt() function has its own memory of the "condition" state. The front evaluation is done between the current state of the condition and the memory related to the single function call. (e.g., if we have at step 1000 if(fall_filt(inp(1), tfb, 0.5)) and at step 1100 if(fall(inp(1), tfb, 0.5)), although they refer to the same condition, the evaluation is done separately, each according to the state stored by running step 1000 and then step 1100).
Example of use:
|