Sedona XPRESSion Evaluator Reference Guide

Integrating User VIs into the XPRESSion Evaluator

In addition to the user-defined functions, the XPRESSion Evaluator provides a method for seamlessly integrating user-supplied VIs into expressions and using them as if they were built-in functions. This brings a very high degree of extensibility to the XPRESSion Evaluator and offers the possibility of building powerful libraries of VI functions that broaden the range of applications the XPRESSion Evaluator can serve. There are only a few simple requirements to make user-written VIs available for use in expressions.

User-written VIs are made available to the XPRESSion Evaluator by placing them in the VI Functions subdirectory of the XPRESSion Evaluator root directory. Any hierarchy of subdirectories and VIs may be created below the VI Functions directory so that large libraries of VI functions may be conveniently organized. The XPRESSion Evaluator automatically scans these directories the first time it is run after being loaded into memory. It then uses the VI names to link the VIs to functions appearing in user expressions. For example, if the user had placed a VI named MyFunc.vi into a subdirectory of the VI Functions directory, then the XPRESSion Evaluator would dynamically call this VI whenever a function with the name MyFunc appeared in an expression. The syntax for VI functions are the same as those for built-in and user-defined functions:

FuncName(arg1, arg2, .... argN)

where arg<n> can be any arbitrary expression.

The above structure instructs the XPRESSion Evaluator to search the VI Functions directory (and all of its subdirectories) for a VI named FuncName.vi and to execute this VI, passing to it the values arg1...argN. As with any valid XPRESSion Evaluator function name, the VI function name must be a single word containing no whitespace characters.

The XPRESSion Evaluator passes data into and out of VI functions through two typedef controls that must be present and wired to the connector pane of each VI function. These two controls carry the value and type (scalar or array) of each argument passed into the function and the value and type of the result produced by the VI function:

The connector pane of a VI function must have the above dynamic function input control wired as its only input and the dynamic function output indicator wired as its only output. Each VI function, thus, should have a connector pane that looks like that of the ExampleFunc.vi shown below:

The dynamic function input control is an array of clusters where each cluster represents the value of an argument of the function. The 0th element of the array represents arg1, the 1st element represents arg2, and so on. Each cluster contains a Type field which indicates to the user’s VI function whether the argument is an array or scalar, based on previous XPRESSion Evaluator calculations. The user’s VI function should interrogate this field first and then, based on its value, utilize either the Scalar field or the Array field of the cluster to retrieve the arguments numerical value(s).

Once the VI function has performed the desired operation on the data supplied by the dynamic function input control, it must set the Type field of the dynamic function output indicator to properly indicate to the XPRESSion Evaluator whether the result of the VI function is a scalar or an array. The VI function must also fill either the Scalar or Array fields of the output indicator with the resulting numerical value(s) of the operations performed.

The Examples subdirectory of the VI Functions directory contains several example VI functions that demonstrate how VI functions should be created.