Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ E3D Design

Numeric (Real) Functions

  • Last UpdatedMar 28, 2023
  • 7 minute read

The numeric functions available are:

Function

Comments

ABS ( number1 )

Gives the absolute value of a number

ACOS ( number1 )

Gives the arc cosine of a number, in degrees.

ASIN ( number1 )

Gives the arc sine of a number, in degrees.

ATAN ( number1 )

Gives the arc tangent of a number, in degrees.

ATANT ( number1, number2 )

Gives the arc tangent of number1/number2, in degrees, with the appropriate sign.

ALOG ( number1 )

Gives the exponential function (natural anti-log) of a number.

ARRAY(pos or dir or ori)

Converts a position, direction or orientation value or attribute into three numbers.

ARRAYSIZE ( variable-name )

Gives the size of an array variable.

ARRAYWIDTH( variable-name )

Gives the largest display width of any string in array variable-name.

COMPONENT dir OF pos2

Gives the magnitude of a vector drawn from E0 N0 U0 to pos2, projected in the direction dir1.

INT ( number1 )

Gives the truncated integer value of a number.

SIN ( number1 )

Gives the sine, cosine or tangent value of a number (considered to be in degrees).

COS ( number1 )

Gives the sine, cosine or tangent value of a number (considered to be in degrees).

TAN ( number1 )

Gives the sine, cosine or tangent value of a number (considered to be in degrees).

LENGTH ( text1 )

Gives the length of text1.

LOG ( number1 )

Gives the natural logarithm of a number.

MATCH ( text1, text2 )

Gives the position of the beginning of the leftmost occurrence of text2 in text1. If text2 does not occur in text1, 0 is returned.

MAX ( number1, number2[ , number3 [. . .]]) )

Gives the maximum value of the arguments.

MIN ( number1, number2[ , number3 [. . .]]) )

Gives the minimum value of the arguments.

NEGATE

Multiply a number by -1.0.

NINT ( number1 )

Gives the nearest integer to a real.

NINT(N+0.5) is equal to N+1 if N is positive or equal to zero, to N if N is negative.

OCCUR ( text1, text2 )

Gives the number of times string text2 occurs in string text1.

REAL ( text1 )

Try to read a number at the beginning of text1.

POWER ( number1, number2 )

Gives the value of number1 raised to the power number2.

SQRT ( number1 )

Gives the square root of a number.

VVALUE ( variable-name )

Used for late evaluation of variables. Gives a real value.

ABS

Synopsis

ABS ( number1 )

-> number

Description

Returns the absolute value of a real.

Side Effects

None.

Example

ABS ( -3.2 ) -> 3.2

Errors

None.

ACOS, ASIN, ATAN and ATANT

Synopsis

ASIN ( number1 )

-> number

ACOS ( number1 )

-> number

ATAN ( number1 )

-> number

ATANT ( number1, number2 )

-> number

Description

Return the arc-cosine, arc-sine or arc-tangent of a number, in degrees.

ATANT returns the arc-tangent of number1/number2 with the appropriate sign. ATANT is useful where the second value is near or equal to zero.

For example, (6 0 ATANT) will give the correct result of 90 degrees, but (6 0 D ATAN) will indicate an error when trying to divide by zero.

Side Effects

None.

Example

ACOS ( 0.8660254 ) -> 30

Errors

Argument of ACOS or ASIN out of range [-1.0,+1.0]

ATANT (0.0,0.0) is undefined.

ALOG

Synopsis

ALOG ( number1 )

-> number

Description

Return the exponential function (natural anti-log) of a number.

Side Effects

Numeric underflow causes the result to be set to zero.

Example

ALOG( -0.7 ) -> 0.4965853

Errors

Floating point overflow.

ARRAY

Synopsis

ARRAY(pos or dir or ori)

-> number

Description

Converts a position, direction or orientation value or attribute into three numbers.

Side Effects

None

Example

ARRAY(e100 ) -> 100 0 0

Errors

None.

ARRAYSIZE

Synopsis

ARRAYSize ( variable-name )

-> number

Description

Give the size of an array variable.

Side Effects

If the array variable does not exist, the result is undefined.

Example

ARRAYSIZE(!array) -> 2.0

Errors

The variable is a scalar variable and not an array variable.

The variable is an array variable element and not an array variable.

ARRAYWIDTH

Synopsis

ARRAYWIDTH ( variable-name )

-> number

Description

Give the largest display with of any string in array variable_name.

Side Effects

None.

Example

If an array contains the following values:

!ARRAY[1] ’Bread’

!ARRAY[2] ’is’

!ARRAY[3] ’for’

!ARRAY[4] ’life,’

!ARRAY[5] ’not’

!ARRAY[6] ’just’

!ARRAY[7] ’for’

!ARRAY[8] ’breakfast’

Then

ARRAYWIDTH(!ARRAY -> 9

as in, the length of ’breakfast’.

Errors

The variable is a scalar variable and not an array variable.

The variable is an array variable element and not an array variable.

COMPONENT ... OF ...

Synopsis

COMPonent dir1 OF pos2

-> text

Description

Returns the magnitude of a vector drawn from E0 N0 U0 to pos2, projected in the direction dir1.

Side Effects

None.

Example

COMP E 45 N of N 0 E 100 U 50 -> 70.710

Errors

None.

SINE, COSINE and TANGENT

Synopsis

SINe ( number1 )

-> number

COSine ( number1 )

-> number

TANgent ( number1 )

-> number

Description

Return the sine, cosine or tangent value of a number (considered to be in degrees).

Side Effects

None.

Example

COS ( 0.0 ) -> 1.0

TAN ( 45.0 ) -> 1.0

Errors

Division by zero for TAN if the SINe is (nearly) equal to zero.

INT

Synopsis

INT ( number1 )

-> number

Description

Return the truncated integer value of a number.

Side Effects

None.

Example

INT ( 1.6 ) -> 1.0

INT ( -23.7 ) -> -23.0

Errors

Integer overflow.

LENGTH

Synopsis

LENgth ( text1 )

-> number

Description

Return the length of text1.

Side Effects

None.

Example

LENGTH ( ’abcdef’ ) -> 6.0

LENGTH ( ’’ ) -> 0.0

Errors

None.

ALOG

Synopsis

LOG ( number1 )

-> number

Description

Return the natural logarithm of a number.

Side Effects

None.

Example

LOG( 3 ) -> 1 0986123

Errors

Negative arguments.

MATCH

Synopsis

MATch ( text1 , text2)

-> number

Description

Return the position of the beginning of the leftmost occurrence of text2 in text1. If text2 does not occur in text1, 0 is returned.

Side Effects

None.

Example

MATCH ( ’abcdef’ , ’cd’ ) -> 3.0

MATCH ( ’abcdef’ , ’x’ ) -> 0.0

MATCH ( ’abcdef’ , ’’ ) -> 1.0

Errors

None.

MAX and MIN

Synopsis

MAX ( number1 ,
number2 [ , number3
[ ... ] ] )

-> number

MIN ( number1 ,
number2 [ , number3
[ ... ] ] )

-> number

Description

Return the maximum or minimum value of the arguments.

Side Effects

None.

Example

MAX ( 1 , 3.4 ) -> 3.4

MIN ( 7.6 , -12.33 , 2.3 ) -> -12.33

Errors

None.

NEGATE

Synopsis

NEGate ( number1 )

-> number

Description

Multiply a real by -1.0.

Side Effects

None.

Example

NEG ( 1 ) -> -1.0

Errors

None.

NINT

Synopsis

NINT ( number1 )

-> number

Description

Return the nearest integer to a real.

NINT(N+0.5) is equal to N+1 if N is positive or equal to zero, to N if N is negative.

Side Effects

None.

Example

NINT ( 1.1 ) -> 1.0

NINT ( -23.7 ) -> -24.0

NINT ( 1.5 ) -> 2.0

NINT ( -11.5 ) -> -12.0

Errors

Integer overflow.

OCCUR

Synopsis

OCCUR(text1, text2)

-> integer

Description

Counts the number of times string text2 occurs in string text1.

Side Effects

None.

Example

OCCUR (’ABBACCBBBBBAB’, ’BB’) -> 3

OCCUR(’ZZZZZZZZZZZ’, ’A’) -> 0

Errors

None.

REAL

Synopsis

REAL ( text1 )

-> number

Description

Try to read a real number at the beginning of text1.

Note that if text is in the form of an exponent, (-12E-1 in the third example), there must be no spaces in it.

Note:
This function was formerly called NUMBER.

Side Effects

Numeric underflow causes the result to be set to zero.

Example

REAL ( ’12.34’) -> 12.34

REAL ( ’ 7.23 E 3 meters’ ) -> 7.23

REAL ( ’ -12E-1 meters ’ ) -> -1.2

Errors

Unable to convert the text into a real number.

POWER

Synopsis

POWer ( number1 , number2 )

-> real

Description

Return the value of number1 raised to the power number2.

Side Effects

Units are consolidated across POWER. The dimension of the result of the function is determined from the input quantities.

Example

POWER (2inch, 3) = 8cubic inch or 8in3

Errors

Floating point overflow.

Zero first argument and non-positive second argument (effectively divide by zero).

Negative first argument and non-integer second argument.

SQRT

Synopsis

SQrt ( number1 )

-> number

Description

Return the square root of a real.

Side Effects

Units are consolidated across SQRT. The dimension of the result of the function is determined from the input quantities.

Example

SQRT (16METRE2) = 4Metre

Errors

Negative argument.

VVALUE

REAL(string) and VVAL(!stringvar) functions:

These will return the value of the number in the string IGNORING any unit qualifier.

The unit qualifier must still be a valid unit qualifier. This is done so that output from '$!' and 'VAR !' combinations of commands can still be accepted by the REAL function and other functions with or without unit qualifiers appended

VVALUE is used for the late evaluation of variables.

Synopsis

VVALue( variable_name )

-> number

VVALue( variable_name , number )

-> number

Description

With one argument, returns value of the scalar variable or value of the array variable element as a number.

With two arguments, returns value of the element corresponding to the index number as a number.

See also VLOGICAL, used for late evaluation when a logical result is required, and VTEXT, used for late evaluation when a text result is required.

Side Effects

If the scalar variable, the array variable or the array variable element does not exist, the result is undefined.

Example

VVAL ( !array[1] ) -> 1.0

VVAL ( !array , 2 ) -> 0.0

Errors

Scalar variable may not be indexed. For example, VTEXT (!var[1]) ) will return an error.

Array variable must have an index. For example, VTEXT ( !array ) ) will return an error.

The string can not be converted to a number.

TitleResults for “How to create a CRG?”Also Available in