Function to capture the rising edge of a condition by imposing a filter in space or time.
Syntax |
real rise_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 true condition is to be seen stably |
|||||||
Result |
Returns:
|
|||||||
Validity |
Rule, Task |
|||||||
Note |
From the first time the function is executed until the condition holds high 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 rise_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 a filter in space, while providing tfb as a filter variable will result a filter in time (seconds).
Each function of rise_filt() 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 individual function call. (e.g., if we have at step 1000 if(rise_filt(inp(1), tfb, 0.5)) and at step 1100 if(rise_filt(inp(1), tfb, 0.5)), although they refer to the same condition, the evaluation is done separately, each according to the state stored by executing step 1000 and then step 1100).
Example of use:
|