Please enable JavaScript to view this site.

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:

Value

Condition

0

cond = FALSE

cond = TRUE but the threshold thrFilt was not exceeded

<> 0 (the value of varFilt recorded on the rising edge of cond is returned)

cond = TRUE and you have exceeded thrFilt (reference variable value stored on transition)

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).

 

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Contents: ALT+c
Search: ALT+s
Exit Menu/Up: ESC