From 964d218a20cd04996ab8f0d61f189153e6893367 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Mon, 3 Feb 2014 10:57:41 +1100 Subject: [PATCH] Start of sct generator description file for Julabo LH45 --- .../environment/temperature/julabo_lh45.sct | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 site_ansto/instrument/config/environment/temperature/julabo_lh45.sct diff --git a/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct b/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct new file mode 100644 index 00000000..9b3bdfe3 --- /dev/null +++ b/site_ansto/instrument/config/environment/temperature/julabo_lh45.sct @@ -0,0 +1,112 @@ +# +# Simple driver generator for the Julabo LH45 +# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent +# +driver julabo_lh45_gen = { + usecreatenode = false + vendor = julabo; device = lh45; protocol = std; + class = environment + simulation_group = environment_simulation + add_args = '{sensor "bath"} {tol 5.0}'; + make_args = 'sensor tol'; + protocol_args = '"\r"'; +# +# Unnamed group has variables at device level +# + group = { + priv = user + type = float + var setpoint = { + driveable = sensor/'value' + readable = 1 + read_command = 'in_sp_00' + write_function = setPoint + write_command = 'out_sp_00' + lowerlimit = 10 + upperlimit = 90 + tolerance = 2 + } + var overtemp_warnlimit = { + readable = 1 + read_command = 'in_sp_03' + #write_command = 'out_sp_03' + } + var subtemp_warnlimit = { + readable = 1 + read_command = 'in_sp_04' + #write_command = 'out_sp_04' + } + var heating_power_percent = { + readable = 1 + read_command = 'in_pv_01'; + }; + var power = { + readable = 1 + read_command = 'in_mode_05'; + writeable = 1; + write_command = 'out_mode_05'; + }; + var lh45_state = { + readable = 1 + read_command = 'status'; + fetch_function = getState + read_function = rdState + } + var lh45_lasterror = { type = text; } + var remote_ctrl = { type = text; priv = spy; } + } +# +# The named group is at the device level, variables below that +# + group sensor = { + type = float; + priv = internal; + readable = 1; + var 'value' = { read_command = 'in_pv_00'; units = 'C' }; + var bathtemp = { read_command = 'in_pv_00'; units = 'C' }; + }; + +# +# Code lines start with '@' which is stripped before being emitted into generated driver +# The code is emitted at the appropriate place in the given function +# + code read_function rdValue = { + } + code Write_function setPoint = { + } +# +# This code is after database creation +# + code mkDriver = { + @# TODO use the ${sensor} and ${tol} arguments + } + + code read_function rdState = { + @ if {${data} != [sct oldval]} { + @ debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]" + @ sct oldval ${data} + @ sct update ${data} + @ sct utime readtime + @ switch -- [lindex ${data} 0] { + @ "00" { + @ hset ${tc_root}/remote_ctrl False + @ } + @ "01" { + @ hset ${tc_root}/remote_ctrl False + @ } + @ "02" { + @ hset ${tc_root}/remote_ctrl True + @ } + @ "03" { + @ hset ${tc_root}/remote_ctrl True + @ } + @ default { + @ hset ${tc_root}/remote_ctrl UNKNOWN + @ hset ${tc_root}/lh45_lasterror ${data} + @ sct geterror ${data} + @ } + @ } + @ } + } + +};