# Simple driver generator for the Huber Pilot ONE Temperature Controller # vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent # driver huber_pilot = { debug_threshold = 1; vendor = Huber; device = 'Pilot ONE'; protocol = std; class = environment; simulation_group = environment_simulation; group Loop1 = { priv = user; type = float; readable = 1; mutable = true; var sensor = { read_command = '01'; permlink = 'T.S01'; } var setpoint = { read_command = '00'; writeable = 1; write_command = '00'; driveable = Loop1/sensor; lowerlimit = 5.0; upperlimit = 30.0; tolerance = 0.5; property settle_time = 10; permlink = 'T.SP01'; } } code getValue = {%% set cmd "\{M${cmd_str}****" %%} code rdValue = {%% if {[string length ${data}] < 8} { sct geterror "rdValue short response ${data}" } elseif { ![string equal -nocase [string range ${data} 1 2] "S0"] } { sct geterror "rdValue syntax error ${data}" } else { set resp [scan [string range ${data} 4 end] "%x" val] if { ${resp} < 1 } { sct geterror "rdValue scan error ${data}" } else { if { ${val} >= 0x8000 } { set val [expr ${val} - 0x10000] } set data [expr 0.01 * ${val}] if { ${data} <= -151.00 } { sct geterror "rdValue value error ${data}" } } } %%} code setValue = {%% set param [expr { round(100.0 * [sct target]) }] set param [string range [format "%04X" ${param}] end-3 end] set cmd "\{M${cmd_str}${param}" %%} }