beautypg.com

Inserting functions with the calculation editor – MTS Multipurpose Elite User Manual

Page 215

background image

However, some operators like the Not (!), Ones Complement (~), and Subtraction when used as a Negate
(-), operate on only one argument to the right.

Functions requiring arguments

In general syntax, functions that require arguments are written as a function name followed immediately
by the required arguments enclosed in parenthesis. For example:

cos(number)

where “cos” is the function identifier and “(number)” is the required argument.

Functions with no arguments

There are unique functions available in the Calculation Editor that do not accept arguments:

Function e() represents the natural logarithmic base, e.

Function Pi() represents the mathematical constant, pi.

Function SystemRate() represents the system data rate.

Inserting Functions with the Calculation Editor

The Calculation Editor contains functions that you can insert into the Calculation panel from the Functions
panel. When you insert a function, the function is represented by an identifier followed immediately by a
parenthetical representation of the expected argument or arguments. If multiple arguments are required,
their representatives are separated within the parenthesis using delimiters, such as commas or semicolons,
depending on the local language. The representative arguments are placeholders for an expected type of
data.

Argument types

The types of arguments that can be passed to a function are:

Number

String

Array

Signal or test input

In all cases, the argument type that is shown in the Calculation window must be replaced by a meaningful
value. The meaningful value can be an actual value, a variable that contains a value that is of the correct
type for the argument, or another function that produces a result that is of the correct type for the argument.

For example, if the function cos(number) is added to the Calculation panel, the message, “The variable,
number, was not found” is shown in the Error panel. The argument “number” must be replaced with a
value, a variable of the correct type, or a function that evaluates to the correct type. In this case, the number
30, the variable CycleCount, or the function cos(sin(30)) validates the calculation. The Error panel message
reads, “Equation is OK” when one of these replacements is used.

Argument syntax

When replacing a representative number or string argument type with an actual number value or a string
value, you must use the correct syntax for the value.

MTS TestSuite | 215

Working with Variables