×
Menu
Index

12.9. Formula Functions

The following mathematical functions area available for use in formula profiles:
Function
Description
gt(x,xs,b)
Fuzzy greater than. Proportional band rising linearly from 0 to 1 as x rises from xs-b/2 to xs+b/2. Like a fuzzy version of x > xs with the transition between 0 and 1 occurring over a proportional band specified by b
lt(x,xs,b)
Fuzzy less than. Proportional band falling linearly from 1 to 0 as x rises from xs-b/2 to x+b/2. Like a fuzzy version of x < xs with the transition between 1 and 0 occurring over a proportional band specified by b
ramp(x,x1,y1,x2,y2)
General ramp function. x=sensed variable, x1=sensed value at lower end of x-axis, y1=returned value at lower end of x-axis, x2=sensed value at upper end of x-axis, y2=returned value at upper end of x-axis
int(x)
Integer value of x, rounded towards zero
ceil(x)
Ceiling - nearest integer above x
floor(x)
Floor - nearest integer below x
if(condition, val1, val2)
Fuzzy logical if. If the condition is 1 or more, returns val1; if 0 or less returns val2; else returns a weighted sum of val1 and val2, where val1’s weighting = condition.
min(v1,v2,v3,...)
Minimum of a set of values, v1, v2, v3, ...
max(v1,v2,v3,...)
Maximum of a set of values, v1, v2, v3, ...
log10(x)
Base-10 logarithm of x
log(x)
Natural logarithm of x
exp(x)
ex, where e is the base of natural logarithms
pow(y, x)
Returns x raised to the power of y
sqrt(x)
Square root of x
abs(x)
Absolute value of x
sign(x)
Returns 1 if x is positive or zero, -1 otherwise
sin(x)
Sine of x (NB x must be in degrees)
asin(x)
Arcsine of x (NB returns value in degrees)
cos(x)
Cosine of x (NB x must be in degrees)
acos(x)
Arccosine of x (NB returns value in degrees)
tan(x)
Tangent of x (NB x must be in degrees)
atan(x)
Arctangent of x (NB returns value in degrees. Use atan2() rather than this if you need the angle to be in the correct quadrant)
atan2(y, x)
Arctangent of y/x (NB returns value in degrees. Use this rather than atan() if you need the angle to be in the correct quadrant)
sinh(x)
Hyperbolic sine of x
cosh(x)
Hyperbolic cosine of x
tanh(x)
Hyperbolic tangent of x
rand()
Random value between 0 and 1
rand(min, max)
Random value between min and max
avg(v1,v2,v3,...)
Average of a set of values, v1, v2, v3, ...
sum(v1,v2,v3,...)
Sum of a set of values, v1, v2, v3, ...
 
 
 
In addition, the following functions provide access to the values of room variables in rooms other than that in which the formula applies:
ta(n)
variable ta for room number n
tdr(n)
variable tdr for room number n
tr(n)
variable tr for room number n
rh(n)
variable rh for room number n
g(n)
variable g for room number n
co2(n)
variable co2 for room number n
sol(n)
variable sol for room number n
e1(n)
variable e1 for room number n
 
The following constants can be used in formulae profiles:
Constant
Description
pi
3.14159265359
e
2.71828182846
Function and constant names, like variable names, are case insensitive.