NextTimePeriod (FPScript)
Searches a data set with calendar time values for the next value that lies in a periodic time segment.
Syntax
NextTimePeriod(DataSet, Criterion, [ Position ], LowerBound, UpperBound [ , Direction = EVENT_RIGHT ])
The syntax of the NextTimePeriod function consists of the following parts:
Part |
Description |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DataSet |
The data set with calendar time values in which to search for periods. Permitted data structures are data series, signal und signal series. All numeric data types are permitted. If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
||||||||||||||||||
Criterion |
Specifies which date element the search is to be based on. The argument Criterion can have the following values:
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. |
||||||||||||||||||
Position |
If you are searching in a signal, this is the X value where the search is to start. The value itself is not included in the search. If you are searching a data series, this is the index of the value where the search is to start. The index itself is not included in the search. 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. |
||||||||||||||||||
LowerBound |
Specifies the lower limit of the time segment. If you specify a value with a unit, this unit must match the selected date element. Permitted data structures are scalar value. All real data types are permitted. If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
||||||||||||||||||
UpperBound |
Specifies the upper limit of the time segment. If you specify a value with a unit, this unit must match the selected date element. Permitted data structures are scalar value. All real data types are permitted. If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
||||||||||||||||||
Direction |
Sets the search direction of the function. The argument Direction can have the following values:
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 type calendar time.
In the case of signals and signal series, the X component is searched.
In the event that LowerBound is less than or equal to UpperBound, a value is in the interval if it is greater than or equal to LowerBoundand less than or equal to UpperBound. If LowerBound is specified as greater than UpperBound, then a value is in the interval if it is greater than or equal to LowerBoundor less than or equal to UpperBound. This is approximately equivalent to a complementation.
For the date elements SECOND, MINUTE and HOUR you can specify the interval limits as floating point values.
Available in
FlexPro Basic, Professional, Developer Suite
Examples
NextTimePeriod(TimeSignal, SECOND, , 3.5, 12.3) |
Returns the index of the first value of the signal 'TimeSignal', which is in the interval [3.5, 12.3] seconds in each minute. |
TimeSignal[[NextTimePeriod(TimeSignal, SECOND, 5.5 s, 200 ms, 600 ms, EVENT_LEFT)]] |
Searches in the signal 'TimeSignal' from the position X = 5.5 s to the left for the next value that lies in the interval [0.2, 0.6] seconds in each minute. The result is the Y value of the found position. |