Efficient Data Analysis

23.08.2021

The FlexPro's data analysis is based on the powerful FPScript analysis programming language. In addition to the optimum setting of the FPScript runtime environment and the FlexPro object database, using FPScript correctly plays a decisive role in efficient analysis. Avoiding loops is the most important factor when creating an analysis algorithm using FPScript. To achieve this, the following FPScript features are available:

FPScript offers the ability to calculate complete data sets in simple arithmetic expressions.

For all common analyses, FPScript offers a variety of integrated functions.

The event isolation functions localize events such as extreme values, slopes and level crossings.

The Index operator extracts individual values or ranges of data.

With the above information to help you, you can almost always avoid loops, especially across all values of a data set. If a loop over individual values cannot be avoided in FPScript, then you should use the For Each Value...End statement, which is the fastest of all FPScript loops.

Example

For individual waves from a power signal, the RMS value should be calculated and output as a data series. This task can be solved as follows:

1.With the LevelCrossings function, the positions (indices) of all positive zero crossings in the signal are determined as data series.

2.Using a For loop, run across all values in the data series.

3.For every two neighboring positions with the Index operator, take the range between these two indices from the signal.

4.For each signal segment formed this way, calculate the square mean (RMS).

5.With the Append operator, collect the RMS values calculated this way in a data series.

The example above uses a loop, not across the individual values of the data set, but instead only for the periods that occur therein. The loop is necessary because even if the signal has a constant sampling rate and frequency, the length of the individual data ranges can vary slightly.

1.In the special case that the signal was sampled with phase synchronization, e.g., with 1000 values per period, the calculation can be simplified considerably:

2.With the NextLevelCrossing function, search for the first positive zero crossing and take the part of the signal starting at this position using the index operator to remove the incomplete wave at the beginning.

3.With the Reshape function, transform the data series with the N amplitude values into a data matrix with N / 1000 columns and per 1000 rows. Any incomplete wave that might occur at the end of the signal will then be rejected.

4.For this data matrix, calculate the RMS values column by column using the Mean function.

You can find both examples in the FPScript Example database in the Wave Analysis folder.

See Also

Optimizing FlexPro for Large Volumes of Data

Share article or send as email:

You might be interested in these articles