
UM-0085-B09
DT80 Range User Manual
Page 90
RG
Trap – Don't Use DELAY Between Commands
The
DELAY=
ms
function is a channel, not a command. It therefore cannot be used to insert a delay between two
commands. For example, if you wanted to light the
Attn
LED for 5 seconds to indicate that a measurement was about to
be taken, you might try
RA20M DO{SATTN; DELAY=5000; CATTN; XB} RBX 1V
'does not work!
but this is no good because the
DELAY
, being a channel, is executed first, then
SATTN;CATTN;XB
in quick
succession.
The
PAUSE
ms command does the same thing as
DELAY
except that it is a command, so you can use:
RA20M DO{SATTN; PAUSE 5000; CATTN; XB} RBX 1V 'OK
(The semicolons between commands are optional in most cases. They are included in the above example because they
make the program a little more readable, especially when commands with space-separated parameters are used.)
Note:
also that a simpler way to implement the above functionality would be to not use commands at all, e.g.:
RA20M 1WARN=1 DELAY=5000 1WARN=0 1V
or, even better:
RA20M 1WARN(5000,R)=1 1V
Examples
Controlling a System
Alarm action processes can be used to control a system or process. This is often preferable to the method used in the
example in
Alarm Digital Action Channels (P85)
because it allows some hysteresis to be included.
For example,
RA1S
ALARM(1TK<74.75)"Heater ON"{1DSO(W)=0}
ALARM(1TK>75.25)"Heater OFF"{1DSO(W)=1}
is a simple heater control for a water bath. The two alarms work to hold the temperature at 75°C ± 0.25°C.
Adaptive Scheduling
Adaptive scheduling is the dynamic adjustment of the acquisition of data about a system or process as the system or
process changes. As the examples below show, adaptive scheduling can reduce total data volume while giving greater
time resolution when required.
The schedule:
RA15M
1V("Wind speed",S1)
ALARM(&1V>5.25){RA2M}
ALARM(&1V<4.75){RA15M}
measures wind speed
•
every 2 minutes if wind speed is greater than 5m/s, or
•
every 15 minutes if wind speed is less that 5m/s
Note:
the deliberate 0.5m/s hysteresis to prevent oscillation around the switchover point. If the measured wind speed exceeds 5.25m/s,
schedule A's trigger is re-defined to run every 2 minutes. When it drops below 4.75m/s it is reset back to every 15 minutes.
The following job:
RC30M 1TK("Oven Temp")
RD1M ALARM(5TK>120){GC} ALARM(5TK<110){HC}
LOGONC HC
continuously monitors the temperature of an oven and logs the temperature whenever it exceeds 120°C.
Initially the logging schedule (C) is halted (
HC
). Schedule D checks the temperature every minute, and when it exceeds
120°C schedule C is started (
GC
), and it is stopped again once it goes below 110°C.
Using an Alarm to Poll a Schedule
As mentioned above, if any channels are included in an action process list then they cannot be logged, returned or
displayed. This limits the types of channels that can usefully be included in an action process list to:
•
output channels (e.g.
2DSO=0
)
•
calculations (e.g.
1CV=1CV+1
)
•
channels that assign to a CV (e.g.
2*V(=2CV)
)
If you need to conditionally take measurements and log/return them, you will need to set up a separate schedule and
then use the alarm to poll it.