# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent driver he3_polanal = { debug_threshold = 0; protocol = std; class = instrument; simulation_group = rfgen_simulation; make_args = '{has_pol true} {has_anal true}'; group polariser = { conditional = '[string equal -nocase ${has_pol} "true"]'; type = text; var spin = { readable = 900; read_command = 'polariser'; read_function = rdValue; writeable = 1; write_command = 'polariser'; check_function = chkWrite; allowed = "+,-,Refresh" } var amplitude = { } var freq = { units = 'Hertz'; } var phase = { units = 'Degree'; } var time2 = { units = 'Second'; } var field = { units = 'Oersted'; } var timestamp = { } } group polariser_start = { conditional = '[string equal -nocase ${has_pol} "true"]'; type = text; var spin = { } var amplitude = { } var freq = { units = 'Hertz'; } var phase = { units = 'Degree'; } var time2 = { units = 'Second'; } var field = { units = 'Oersted'; } var timestamp = { } } group analyser = { conditional = '[string equal -nocase ${has_anal} "true"]'; type = text; var spin = { readable = 900; read_command = 'analyser'; read_function = rdValue; writeable = 1; write_command = 'analyser'; check_function = chkWrite; allowed = "+,-,Refresh" } var amplitude = { } var freq = { units = 'Hertz'; } var phase = { units = 'Degree'; } var time2 = { units = 'Second'; } var field = { units = 'Oersted'; } var timestamp = { } } group analyser_start = { conditional = '[string equal -nocase ${has_anal} "true"]'; type = text; var spin = { } var amplitude = { } var freq = { units = 'Hertz'; } var phase = { units = 'Degree'; } var time2 = { units = 'Second'; } var field = { units = 'Oersted'; } var timestamp = { } } code chkWrite = {%% [namespace current]::rdValue ${tc_root} clientput [sct result] %%} code rdValue = {%% set dlist [split [string trim ${data}]] if {[llength ${dlist}] < 2} { sct geterror "Syntax Error: '${data}'" error "[sct geterror]" } set my_name [basename [pathname [sct]]] if {![string equal -nocase "[lindex ${dlist} 0]" "${my_name}"]} { error "[lindex ${dlist} 0] is not my name (${my_name})" } if {[string match "*Not Active*" "${data}"]} { set data 0 } elseif {[string match -nocase "*Error:*" "${data}"]} { sct geterror "${data}" error "[sct geterror]" } else { set data [lindex ${dlist} 1] } set path [pathname [sct]] set timestamp [clock format [clock seconds] -format "%T"] if {[llength ${dlist}] > 2} { set new_value [lindex ${dlist} 2] if { "${new_value}" == "NaN" } { set new_value 0 } hupdateif ${path}/amplitude "${new_value}" } if {[llength ${dlist}] > 3} { hupdateif ${path}/freq "[lindex ${dlist} 3]" } if {[llength ${dlist}] > 4} { hupdateif ${path}/phase "[lindex ${dlist} 4]" } if {[llength ${dlist}] > 5} { hupdateif ${path}/time2 "[lindex ${dlist} 5]" } if {[llength ${dlist}] > 6} { hupdateif ${path}/field "[lindex ${dlist} 6]" } hupdateif ${path}/timestamp "${timestamp}" %%} code setValue = {%% set cmd "${cmd_str}" if {[string equal -nocase [sct target] "refresh"]} { set cmd "${cmd_str}" } if {[string equal -nocase [sct target] "minus"]} { set cmd "${cmd_str} -" } if {[string equal -nocase [sct target] "dn"]} { set cmd "${cmd_str} -" } if {[string equal -nocase [sct target] "down"]} { set cmd "${cmd_str} -" } if {[sct target] == "-" || [sct target] == -1} { set cmd "${cmd_str} -" } if {[string equal -nocase [sct target] "plus"]} { set cmd "${cmd_str} +" } if {[string equal -nocase [sct target] "up"]} { set cmd "${cmd_str} +" } if {[sct target] == "+" || [sct target] == 1} { set cmd "${cmd_str} +" } %%} code postamble = { @TCL proc stash {node} { foreach arg {spin amplitude freq phase time2 field timestamp} { hupdateif ${node}_start/${arg} [hval ${node}/${arg}] } } @END } }