TimePeriods (FPScript)

21.09.2021

Searches a data set with calendar time values for periodic time segments.

Syntax

TimePeriods(DataSet, Criterion, LowerBound, UpperBound [ , Operation = EVENT_DEFAULT ])

 

The syntax of the TimePeriods 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, data matrix, signal, signal series und signal series with two-dimensional X-component. 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.

Criterion

Specifies which date element the search is to be based on.

The argument Criterion can have the following values:

Constant

Meaning

SECOND

Second in the minute (0.0 to 59.9999)

MINUTE

Minute in the hour 0.0 to 59.9999)

HOUR

Hour of the day (0.0 to 23.9999)

DAY

Day of the month (1 to 31)

WEEKDAY

Day of the week (0 for Sunday to 6 for Saturday, instead of numerical values you can also use the constants SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY and SATURDAY ).

MONTH

Month of the year (1 to 12)

YEAR

Year (1970 to 3000)

DAYOFYEAR

Day of year (1 to 366)

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.

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.

Operation

Specifies the mode of operation of the function.

The argument Operation can have the following values:

Constant

Meaning

EVENT_INDEX

The indices of the values or points meeting the condition are placed in the result data set.

EVENT_EXTRACT

Only the points or values meeting the condition are transferred into the result data set.

EVENT_SETVOID

The points or values that do not meet the condition are also included in the result data set, but there they are marked as void.

EVENT_DEFAULT

Corresponds to EVENT_SETVOID if a data matrix or signal series is present, and otherwise EVENT_INDEX.

+ EVENT_COMPLEMENT

This constant can be optionally added and then reverses the selected operation. Then, for example, for EVENT_EXTRACT, the points that do not meet the condition are copied.

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

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 is 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

TimePeriods(TimeSignal, SECOND, 3.5, 12.3)

Returns the indices of the values of the signal 'TimeSignal', which are in the interval [3.5, 12.3] seconds in each minute.

TimePeriods(TimeSignal, SECOND, 200 ms, 600 ms)

Returns the indices of the values of the signal 'TimeSignal', which are in the interval [0.2, 0.6] seconds in each minute.

TimePeriods(SignalSeries, WEEKDAY, MONDAY, FRIDAY, EVENT_SETVOID)

Returns the signal series where all Y values occurring on a weekend have been set to void.

IndexAnd(TimePeriods(TimeSignal, WEEKDAY, MONDAY, FRIDAY), TimePeriods(TimeSignal, HOUR, 9.0, 17.5))

Returns the indices of the 'TimeSignal' signal values that fall on a weekday and are between the hours of 9:00 and 17:30.

See Also

NextTimePeriod Function

PositivePeaks Function

NegativePeaks Function

LevelCrossings Function

ValuesAboveLevel Function

ValuesBelowLevel Function

ValuesInInterval Function

Event Isolation Analysis Object

Share article or send as email:

You might be interested in these articles