NextLevelCrossing (FPScript)

21.09.2021

Searches for the next level crossing from a given position onwards.

Syntax

NextLevelCrossing(DataSet, [ Position ], Level, Hysteresis, [ Orientation = EVENT_BOTH ] [ , Direction = EVENT_RIGHT ])

 

The syntax of the NextLevelCrossing function consists of the following parts:

Part

Description

DataSet

The data set to be searched.

Permitted data structures are data series und signal. All numeric data types are permitted.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Position

If you are searching in a signal, this is the X value where the search is to start. If you are searching a data series, this is the index of the value where the search is to start. Here, a negative index determines a position relative to the end of the data set. If you omit the argument or pass the value Empty, the search starts at the beginning or end of the data set, depending on the direction of the search. The first or last value of the data set is only taken into account if you omit the argument or pass the Empty value.

Permitted data structures are scalar value. All numeric data types are permitted. The unit has to be compatible with that of parameter DataSet.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Level

The level for which a crossing is to be found.

Permitted data structures are scalar value. All numeric data types are permitted. The unit has to be compatible with that of parameter DataSet.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Hysteresis

The hysteresis forms a symmetrical band [level - hysteresis, level + hysteresis] around the specified level. A level crossing is then only accepted if the course of the curve enters the band from one side and then exits from the other side.

Permitted data structures are scalar value. All numeric data types are permitted. The unit has to be compatible with that of parameter DataSet.

For complex data types the absolute value is formed.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Orientation

Specifies whether falling, rising or both types of level crossings are to be searched for.

The argument Orientation can have the following values:

Constant

Meaning

EVENT_POSITIVE

Search for a rising level crossing only.

EVENT_NEGATIVE

Search for a falling level crossing only.

EVENT_BOTH

Search for both types of level crossings.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value EVENT_BOTH.

Direction

Specifies the direction of the search in the function.

The argument Direction can have the following values:

Constant

Meaning

EVENT_RIGHT

Search to the right.

EVENT_LEFT

Search to the left.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value EVENT_RIGHT.

Remarks

The result always has the data structure scalar value.

Hysteresis prevents level crossings from being detected several times in noisy signals. If DataSet is a data series, the result is the index of the level crossing found. If the course of the curve oscillates multiple times around the level before leaving the hysteresis band, then the mean value of the first and last crossing is passed through the level as an index. If DataSet is a signal, the result is the X value with the index found. If no level crossing could be found, the value Empty is output as the result.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

NextLevelCrossing(Signal, , 0.8 V, 0.1 V, EVENT_POSITIVE, EVENT_LEFT)

Searches in a signal for the next rising level crossing through 0.8 V, starting at the end of the signal and heading to the left. The hysteresis is 0.1 V. The result is the X value of the level crossing found.

Signal[[NextLevelCrossing(Signal, 4.5 s, 0.6 V, 0.1 V)]]

Searches in a signal for the next rising or falling level crossing through 0.6 V, starting at the position X = 4.5 s and heading to the right. The hysteresis is 0.1 V. The result is the Y value of the level crossing found.

See Also

LevelCrossings Function

Intersections Function

Event Isolation Analysis Object

Share article or send as email:

You might be interested in these articles