Rework the he3_polanal.sct driver

This commit is contained in:
Douglas Clowes
2014-11-06 18:17:02 +11:00
parent c488733bcd
commit 3602f56352

View File

@ -4,42 +4,73 @@ driver he3_polanal = {
protocol = std;
class = instrument;
simulation_group = rfgen_simulation;
make_args = '{has_pol true} {has_anal true}';
group polariser = {
var spin = {
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 = "+,-,0"
allowed = "+,-,Refresh"
}
var Amplitude = { type = text; }
var Freq = { type = text; units = 'Hertz'; }
var Phase = { type = text; units = 'Degree'; }
var Time2 = { type = text; units = 'Second'; }
var Field = { type = text; units = 'Oersted'; }
var Amplitude = { }
var Freq = { units = 'Hertz'; }
var Phase = { units = 'Degree'; }
var Time2 = { units = 'Second'; }
var Field = { units = 'Oersted'; }
var Timestamp = { }
}
group analyser = {
var spin = {
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 = "+,-,0"
allowed = "+,-,Refresh"
}
var Amplitude = { type = text; }
var Freq = { type = text; units = 'Hertz'; }
var Phase = { type = text; units = 'Degree'; }
var Time2 = { type = text; units = 'Second'; }
var Field = { type = text; units = 'Oersted'; }
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 = {%%
@ -61,6 +92,7 @@ driver he3_polanal = {
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" } {
@ -80,6 +112,7 @@ driver he3_polanal = {
if {[llength ${dlist}] > 6} {
hupdateif ${path}/Field "[lindex ${dlist} 6]"
}
hupdateif ${path}/Timestamp "${timestamp}"
%%}
code setValue = {%%
@ -87,6 +120,9 @@ driver he3_polanal = {
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} -"
}
@ -96,6 +132,9 @@ driver he3_polanal = {
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} +"
}