| Home | Etherlog 3000 | RDT 3000 | Accessories | Applications | Library | News | Contact us |
| Inputs/outputs | Communications | lucid | Power management |
lucid - the logger control languageThe Etherlog 3000 is programmed using a built-in language called lucid, which can be used to:
An elementary lucid programThe Etherlog 3000 can store any number of lucid tasks, or programs, within its filing system. Selected programs can be kicked off when the logger is powered up, and up to four programs can be executed simultaneously. Each can have a 'window' associated with it, which determines the times of day at which it executes.The following simple lucid program records the value of analogue input number one every ten seconds. Anything after the # character on a line is a comment:
# repeat this task once every ten seconds
repeat 10
begintask
# create a new record in the datafile, write the time,
# and the value of analogue input 1
newline
write time
write ain 1
endtask
When the resulting file is retrieved from the logger the PC software will
automatically detect that it contains data, and translate it into a format
suitable for immediate import into a spreadsheet or other data processing
package.
It really is this simple!
Conditionals and loops in lucidThe lucid language contains facilities which allow sections of a program to be executed conditionally, or repeatedly within a loop. This section of a lucid program shows how the value of one input channel can be used to trigger measurements of other channels, the data from which is routed to a different storage file:
# test to see if analogue input 1 is over 2000 microvolts
if > ain 1 2000
# if so change the destination filename to alarm.dat
logout alarm.dat
# and write a record of the time and values of inputs 2 and 3
newline
write time
write ain 2
write ain 3
endif
These facilities can also be used to carry out signal processing functions.
This code section uses the built in loop function to read a channel ten times and write
the average of the results:
# reset channel 1 average
areset 1
# read channel 1 ten times, incorporating it into accumulator 1
loop 10
accum 1 ain 1
endloop
# write the average of accumulator 1 to data file
write avge 1
Sensor linearisation in lucidThe arithmetic functions available in lucid allow signals from sensors to be compensated using equations, which can even involve the readings of other sensors. This facility may be vital if readings are to be averaged before recording, since they need to be linearised first. The humidity sensor used on the Etherlog met station provides a millivolt output, but it should be temperature compensated using the equation:
The lucid code below reads the humidity sensor output, compensates it, and writes it to the output file: # measure temperature in degrees C and place result in variable 1 setvar 1 fcmt2c ain 1 # generate the temperature compensation denominator in variable 3 setvar 3 fmul 0.00216 var 1 setvar 3 fsub 1.0546 var 3 # now read analogue channel 2 into variable 2 in millivolts setvar 2 fdiv ain 2 1000 # and divide it by the compensation factor setvar 2 fdiv var 2 var 3 # finally, write the result to the output file write var 2A more experienced programmer might take the reading, compensate it and record it with a single line of code: # write temperature compensated value of humidity sensor write fdiv fdiv ain 2 1000 fsub 1.0546 fmul 0.00216 var 1
DocumentationFull documentation of lucid, including the manual and a series of application notes, is available in the Radio Data Logger Company library.
|