VistaPro User Guide Custom Variable Expressions

IES Virtual Environment

Copyright © 2015 Integrated Environmental Solutions Limited. All rights reserved.

No part of the manual is to be copied or reproduced in any form without the express agreement of Integrated Environmental Solutions Limited.

Contents

1 Expressions ...... 2 1.1 Operators ...... 2 1.1.1 Arithmetic ...... 2 1.1.2 Relational ...... 2 1.2 Functions ...... 3 1.2.1 Numerical / Mathematical ...... 3 1.2.2 Logical ...... 4 1.3 Constants ...... 4 1.3.1 Model Related ...... 4 1.3.2 General ...... 5

VE 2015 VistaPro: Custom Variable Expressions 1

1 Expressions Custom variables in VistaPro can be defined by combining several variables together using a formula or in other words an expression. Below describes all the operators, functions and constants available for use in your own expressions. The expression syntax is Excel like in nature so should be easy to pick up and understand.

1.1 Operators

1.1.1 Arithmetic

The usual arithmetic operators are supported for addition +, subtraction -, division /, multiplication *, modulo %, exponentiation ^, and negation -.

Parentheses (, ) can be used to change the precedence of the operators.

For example: (A + B + C) / 3 computes the average of the sum of A, B and C. All operators work in the usual way and can be used with variables, constants, or numbers.

For example: X^(-0.5) computes the inverse of the square root of X. Modulo is defined as the remainder of a division that rounds the quotient towards minus infinity.

That is: A % B == A - FLOOR(A/B)*B.

1.1.2 Relational Relational operators are also supported; the result of such an operation is either true or false (i.e., a boolean value).

Available operators are: equal to ==, not equal to !=, less than <, greater than >, less than or equal to <=, and greater than or equal to >=. These can be used with the logical functions described here. All operators can be used with variables, constants, or numbers.

VE 2015 VistaPro: Custom Variable Expressions 2

1.2 Functions As well as operators, expressions support a standard set of functions that can be used to transform values. A complete list of all the functions available for you to use is below.

The syntax describes how to use the function in your expressions. Note: square brackets ‘[ ]’ denote the argument is optional; while ellipsis ‘...’ denote additional arguments can be specified.

1.2.1 Numerical / Mathematical Name Syntax Description

ABS ABS( value ) Returns the absolute value of a number. ACOS ACOS( value ) Returns the arccosine (in radians) of a number. ASIN ASIN( value ) Returns the arcsine (in radians) of a number. ATAN ATAN( value ) Returns the arctangent (in radians) of a number. ATAN2 ATAN2( x-value, y-value ) Returns the arctangent (in radians) of (x,y) coordinates. AVG AVG( value ) Returns the average (arithmetic mean) of the variable. CEIL CEIL( value ) Returns a number rounded up. CLAMP CLAMP( value, min, max ) Returns a number within the specified range. COS COS( value ) Returns the cosine of an angle. COSH COSH( value ) Returns the hyperbolic cosine of a number. DEGREES DEGREES( value ) Converts radians into degrees. EXP EXP( value ) Returns mathematical constant 푒 raised to the nth power. FLOOR FLOOR( value ) Returns a number rounded down. INRANGE INRANGE( value, min, max ) Returns true if the number is within the specified range or false if it is outside the range. LOG LOG( value, base ) Returns the logarithm of a number to the specified base. LOG10 LOG10( value ) Returns the base-10 logarithm of a number. LN LN( value ) Returns the of a number. MAX MAX( value1, [value2] ) Returns the largest value(s) for the specified variable(s). MIN MIN( value1, [value2] ) Returns the smallest value(s) for the specified variable(s). MOD MOD( value, divisor ) Returns the remainder after a value is divided by a divisor. NEG NEG( value ) Returns true if the value is less than zero, otherwise false. NUM NUM( value ) Converts a true or false value to one or zero respectively. POS POS( value ) Returns true if the value is greater than zero, otherwise false. POW POW( value, power ) Returns the result of a number raised to a given power. RADIANS RADIANS( value ) Converts degrees to radians.

VE 2015 VistaPro: Custom Variable Expressions 3

SIGN SIGN( value ) Returns 1 if the value is greater than zero, -1 if the value is less than zero, 0 otherwise. SIN SIN( value ) Returns the sine of an angle. SINH SINH( value ) Returns the hyperbolic sine of a number. SQRT SQRT( value ) Returns the square root of a number. SUM SUM( value ) Returns the total (summation) of a variable. TAN TAN( value ) Returns the tangent of an angle. TANH TANH( value ) Returns the hyperbolic tangent of a number.

TRUNCATE TRUNCATE( value, min, max ) Returns the number if it is within the specified range or 푁푎푁 if it is outside the range.

1.2.2 Logical Name Syntax Description

IF IF( condition, true-value, false-value ) Returns one value if a specified condition evaluates to true, or another value if it evaluates to false. AND AND( condition1, condition2, ... ) Returns true if all conditions are true, otherwise false. OR OR( condition1, condition2, ... ) Returns true if any conditions are true, otherwise false. NOT NOT( condition ) Returns the reversed logical value.

1.3 Constants A list of common and model related constants is also available to use as well. A constant is just a numerical value represented with a name. These are defined below.

1.3.1 Model Related Name Description

1 RA Room Floor Area. 1 RV Room Volume. 2 SA Net Surface Area. 3 OA Gross Opening Area. 4 SFA Apache System Floor Area. 4 SFAMV Apache System Auxiliary Mechanical Ventilation Floor Area. 4 SATD Apache System Supply Air Temperature Difference. 1 2 - only available for use with Room, Surface and Opening level variables - only available for use with Surface and Opening level variables 3 4 - only available for use with Opening level variables - only available for use with Apache System level variables

VE 2015 VistaPro: Custom Variable Expressions 4

1.3.2 General Name Description 휋 DEG ⁄180 The value representing 1 degree in radians, with an approximate value of 0.01745329251. INF ∞ The representation of positive infinity.

LN10 ln 10 The natural logarithm of 10, with an approximate value of 2.302585092994046.

LN2 ln 2 The natural logarithm of 2, with an approximate value of 0.6931471805599453. The base-10 logarithm of the mathematical constant 푒, with an approximate value of LOG10E log10 푒 0.4342944819032518. The base-2 logarithm of the mathematical constant 푒, with an approximate value of LOG2E log2 푒 1.442695040888963387.

NAN 푁푎푁 Not a Number, which represents an undefined or unrepresentable value. The ratio of a circle's circumference to its diameter, with an approximate value of 휋 3.141592653589793. 180 RAD ⁄휋 The value representing 1 radian in degrees, with an approximate value of 57.2957795131.

SQRT2 √2 The , with an approximate value of 1.41421356237.

SQRT3 √3 The , with an approximate value of 1.73205080757.

TRUE 푡푟푢푒 Logical value representing true for use in conditional expressions.

FALSE 푓푎푙푠푒 Logical value representing false for use in conditional expressions.

VE 2015 VistaPro: Custom Variable Expressions 5