Xl™ series – Xylem XL Series H-522 - Plus User Manual
Page 244

22-10 Functions
XL™ Series
Now normally function 01 would be called before function 02 so that both values are updated but
when function 02 is called it will not evaluate the expression but just return the value already
stored. In this case the expression for function 02 can be a note describing what is happening and
the system allows it.
This is especially handy when using an XL-BASIC program that needs to return several values.
$ Functions:
Functions that start with the ‘$’ character will not be evaluated but are used for text strings. This
is normally only used to place a label in a data file. If this function is used as the source in the
logging options, then the text following the ‘$’ character will be placed in the data file. The text
is limited to 8 characters. This type of function will always equate to a value of -1357.2468.
Math Function Example 1 (Temperature Conversion):
An SDI-12 temperature probe reports the temperature in degrees F, but the desired units are
degrees C. The probe has an SDI-12 address of 5 with one value returned for temperature. Enter
an equation that will convert the temperature from degrees F to degrees C.
Fnt01 = (sdi51!32)/9*5
Fnt01 can now be used as a data source in the log report and the reported value will be
temperature in degrees C.
Math Function Example 2 (Rating Curve):
Most rating curves are developed by taking several discharge measurements versus stage for a
variety of stage readings. A typical rating curve will take on the form as follows:
Q = p(h!e)^b
Where
Q
=
discharge
h
=
gauge height
e
=
gauge height of zero flow
p
=
constant which is numerically equal to the discharge when h!e = 1
(This is 1 foot of gauge height over the zero flow point)
b
=
slope of the rating curve
After several discharge measurements, p is calculated to be 45.24 and b is calculated to be 0.6667
or 2/3. The zero flow point is the gauge level at zero flow, and for this example could be 3.75.
With this information we can enter the function into the system as follows.
Fnt02 = 45.24*(stage !3.75)^(2/3)
As the stage value varies up and down so will the calculated discharge value.