A formula is a special data set where the value is not fixed when stored, but is instead replaced by calculation operations that can calculate the value when required. These formulas are written in FPScript. FlexPro offers you special analysis objects for common analyses so that you do not have to learn how to use FPScript.

Formulas are the main tools for automating the analysis. In the nested network of formulas for a project, the entire "knowledge" is saved so that you can repeat the analysis as often as you like, and the data to be analyzed can be assigned at the click of a button.

You can use formulas wherever data sets are also permitted, such as for a curve in a diagram.

FlexPro compiles the formula into binary code, which guarantees rapid processing. The FlexPro "Smart Update" technology ensures that unnecessary re-calculations are avoided. The result of the last calculation is stored temporarily and re-used for as long as possible.

Note:   With FlexPro View, the analysis options are limited to basic mathematical operations and simple, statistical evaluations.

Formula Elements

Constants: These are constant expressions such as values in the various data types.

Variables: You can use variables in a formula to save interim results. This allows you to save computing time by only performing a calculation once for terms that are used several times. You can also structure your formulas better by first assigning parameters to a variable and then continue on with the formula using the variable.

Data sets: Data sets are used like variables. If a data set name is used in a formula, this name represents the data that is read when the formula is later calculated. This data can also be formulas. The formulas are then first evaluated to obtain the data. You cannot make assignments to formulas and data sets.

Pre-defined constants: Some mathematical constants, such as PI or E, as well as constants, which are used as function parameters, are available as pre-defined constants. You cannot use these names for data set names and/or variables.

Operators: You can use operators to calculate and modify data. FlexPro provides you with a variety of operators with which you can also calculate complete signals.

Statements: Each formula consists of one or more statements, where one line is used for each statement. However, you can also write several statements in a single line, if you separate the statements from each other using a semi-colon ';'. You can also split a statement over several lines. For lines that are to be merged with the lines following, you have to enter a backslash '\' or an underscore character "_" as the final character. In FlexPro formulas you can use different loops and conditional statements, for example, to be able to perform a complex analysis for all of the data series in a signal series.

Functions: FlexPro features a variety of functions that you can use to generate signals and carry out analyses. You can also define custom functions. These are formulas that you provide with arguments and that you can call like a function in other formulas.

Object properties: The various objects in FlexPro provide special functions for accessing their attributes. For example, you can access the comments for a data set.

Comments: These start with "//" and then extend to the end of the line.

Examples of Formulas

The project database FPScript is located on your hard drive and contains various FPScript programming examples.

The path to the project database is usually C:\Users\Public\Documents\Weisang\FlexPro\2021\Examples\FPScript.fpd or C:>Users>Public>Public Documents>Weisang>FlexPro>2021>Examples>FPScript.fpd.

See Also

Debugging Formulas


Custom FPScript Functions Tutorial

Working with Formulas

Creating a Formula

Editing a Formula

Inserting Code Elements into a Formula

Search and Replace in a Formula

Applying Formulas to Data Sets

Converting Formulas, Analysis Objects or Data Link Objects into Data Sets

Share article or send as email:

You might be interested in these articles