UM-0085-B09
DT80 Range User Manual
Page 70
RG
Options
A reference channel is a channel in its own right so, like any other channel, it can have its own channel options.
However, because a reference channel does not physically measure anything, sampling options will not be applicable. It
can have reporting options, e.g.
RA1S 1V("Voltage12") &Voltage12(Y1,"Pressure12~kPa")
In the above example a voltage based pressure sensor is sampled. Both the raw voltage and the pressure (calculated by
applying polynomial Y1) are returned.
Reference channels inherit their data type (integer or floating point) and default units from the source channel. For
example:
1C &1C
1C 210 Counts
&1C 210 Counts
The reference channel's units can of course be overridden:
1C &1C("~Woozles")
1C 210 Counts
&1C 210 Woozles
Sampling
For a reference channel that is included in a schedule, the source channel must be defined somewhere in the job. The
source channel does not need to occur before the reference to it, but it must be somewhere between the
BEGIN
and
END
.
If a source channel is defined in the immediate schedule, then references to it can only be included in the immediate
schedule (not any other schedule), and they must occur later on the same command line. If the source channel has not
been sampled at the time that the reference channel is sampled then the reference channel's value will be
NotYetSet
.
Note:
that references are read-only; an expression can not be included, e.g.
&1CV=1 'error
Expressions
References can be included in expressions. For example:
1CV=(&1TK+&2TK)/2
will calculate the mean of two previously sampled temperatures.
Examples
Some of the applications of reference channels are listed below. Many of these could also be done using channel
variables, but using references is generally clearer and more efficient.
Same reading scaled two ways
The following will log the same reading in both degrees Celsius and Fahrenheit
S1=32,212,0,100"degF" 1TK(FF2) &1TK(S1,FF2)
Multiple statistics from the same raw data
The following will calculate two different averages from the same raw data
RS1S RA10S 1TK(W)(AV,"10s_ave") RB1M &1TK(AV,"1min_ave")
Testing one reading in multiple alarms
In this example a temperature is sampled once but then tested in three different alarm conditions.
1TK("indoor")
IF(&indoor<19)"too cold^M^J"
IF(&indoor><19,27)"nice^M^J"
IF(&indoor>27)"too hot^M^J"
Manually Poll Most Recent Sample
References allow you to make an ad hoc query for the most recent value of a channel that is being regularly sampled.
BEGIN"zoo" RA1M 1TK END
&1TK
Expressions
The DT80 has a powerful expression evaluation capability, allowing measured values to be manipulated using a variety
of mathematical and logical operations.
An
expressio
n consists of one or more
operands
which are manipulated using
operators
to produce a numeric
result
.
The result of an expression can be assigned to any of the channel types identified as "writable" in the table of
. Expressions cannot contain any spaces.