Sedona XPRESSion Evaluator Reference Guide
Performance of the XPRESSion Evaluator
The XPRESSion Evaluator operates in two stages to provide maximum run-time performance. In the first stage, a LabVIEW string containing a user expression in BNF (also know as infix) form is tokenized, "compiled", and converted to its equivalent postfix representation. The postfix form of the expression is optimized for speedy run-time calculations. It is completely unambiguous without parentheses. It also eliminates inefficient strings by resolving variable references to simple numeric indices. This compilation stage need only be performed when the actual form of the user expression changes or when a new expression is given. In most situations, the expression itself changes infrequently compared to the real-time values of the user-variables referenced in the expression. This is the prime motivation for separating the expression evaluation into two stages.
In the second stage, the XPRESSion Evaluators real-time "evaluation engine" applies the real-time values of any user-variables to the postfix expression and computes a single-valued result. In most applications, this stage is executed repeatedly with different values for the user-variables appearing in the original user-expression. The evaluation engine is optimized for excellent run-time performance. Run-time memory allocation is minimal and all array operations occur "in-place", resulting in total computation times in the microseconds range.
Most of the VIs provided in the XPRESSion Evaluator suite simply provide different mechanisms for obtaining and storing user expressions, functions, and variables. Other VIs provide a define/undefine method for manipulating the XPRESSion Evaluators internal database of user functions, variables, and physical units.
Most simple applications need only use two simple, but powerful VIs, Compile Expr VI and Evaluate Expr VI. These two LabVIEW VIs are all that is needed to evaluate arbitrarily complex algebraic expressions. More sophisticated applications, like configuration management and process control, may require more functionality in defining, manipulating, and validating expressions. To serve these users, the XPRESSion Evaluator includes the Expr Eval Config Utility for interactively storing/retrieving user-defined functions and physical units. Several simple VIs found in the low-level API provide a programmatic method for manipulating user-defined functions, variables, and physical units. The example VIs described later in the manual utilize these API VIs to implement the demonstration programs. Many will find that the example VIs may be used as-is for their own applications. Others may study the LabVIEW diagrams of the example VIs as a tutorial on how to use the XPRESSion Evaluator API.