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 and allow you to split and extract sections in lists.
•The Index operator extracts individual values or ranges of data.
•Operators and functions are automatically applied to all elements of a list.
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. It is simpler and more efficient to use event isolation with subsequent quadratic averaging:
1.The Event Isolation analysis object with splitting into segments without borders can deliver the individual periods as elements of a list with the search for positive level crossings.
2.The Statistical Quantity analysis object for calculating the root mean square value then converts the list of periods into a list of the individual RMS values.
3.A small FPScript formula using the LevelCrossings function generates a data series from this.
You can find both examples in the FPScript Example database in the Wave Analysis folder.