Regenerated drivers

This commit is contained in:
Douglas Clowes
2014-09-11 13:29:52 +10:00
parent 65b50f3fcc
commit 0cb3f4f91c
36 changed files with 1387 additions and 883 deletions

View File

@@ -269,14 +269,14 @@ proc ::scobj::nhq_200::setValue {tc_root nextState cmd_str} {
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } {
::scobj::nhq_200::sics_log 9 "::scobj::nhq_200::mkDriver ${sct_controller} ${name} ${ip_address} ${tcp_port}"
proc ::scobj::nhq_200::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
::scobj::nhq_200::sics_log 9 "::scobj::nhq_200::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
set ns "[namespace current]"
set catch_status [ catch {
MakeSICSObj ${name} SCT_OBJECT
sicslist setatt ${name} klass NXdetector
sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name}
@@ -311,11 +311,11 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } {
hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part"
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} {
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/break 10
${sct_controller} poll ${scobj_hpath}/id 10
} else {
::scobj::nhq_200::sics_log 9 "[detector_simulation] => No poll/write for nhq_200"
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
}
hfactory ${scobj_hpath}/ch1 plain spy none
@@ -488,7 +488,7 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } {
hsetprop ${scobj_hpath}/ch1/voltage type "part"
hsetprop ${scobj_hpath}/ch1/voltage nxalias "${name}_ch1_voltage"
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} {
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch1/auto_start 5
${sct_controller} poll ${scobj_hpath}/ch1/current 5
${sct_controller} poll ${scobj_hpath}/ch1/i_lim 5
@@ -505,7 +505,7 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } {
${sct_controller} write ${scobj_hpath}/ch1/v_ramp
${sct_controller} write ${scobj_hpath}/ch1/v_sp
} else {
::scobj::nhq_200::sics_log 9 "[detector_simulation] => No poll/write for nhq_200"
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
}
hfactory ${scobj_hpath}/ch2 plain spy none
@@ -678,7 +678,7 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } {
hsetprop ${scobj_hpath}/ch2/voltage type "part"
hsetprop ${scobj_hpath}/ch2/voltage nxalias "${name}_ch2_voltage"
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} {
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch2/auto_start 5
${sct_controller} poll ${scobj_hpath}/ch2/current 5
${sct_controller} poll ${scobj_hpath}/ch2/i_lim 5
@@ -695,12 +695,12 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } {
${sct_controller} write ${scobj_hpath}/ch2/v_ramp
${sct_controller} write ${scobj_hpath}/ch2/v_sp
} else {
::scobj::nhq_200::sics_log 9 "[detector_simulation] => No poll/write for nhq_200"
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
}
hsetprop ${scobj_hpath} klass NXdetector
hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} {
if {[string equal -nocase "${simulation_flag}" "false"]} {
ansto_makesctdrive ${name}_ch1_v_sp ${scobj_hpath}/ch1/v_sp ${scobj_hpath}/ch1/voltage ${sct_controller}
ansto_makesctdrive ${name}_ch2_v_sp ${scobj_hpath}/ch2/v_sp ${scobj_hpath}/ch2/voltage ${sct_controller}
}
@@ -709,31 +709,37 @@ proc ::scobj::nhq_200::mkDriver { sct_controller name ip_address tcp_port } {
handle_exception ${catch_status} ${catch_message}
}
proc ::scobj::nhq_200::add_driver {name device_class simulation_flag ip_address tcp_port} {
set catch_status [ catch {
::scobj::nhq_200::sics_log 9 "::scobj::nhq_200::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
if {[string equal -nocase "${simulation_flag}" "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::nhq_200::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::nhq_200::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag={simulation_flag} => No sctcontroller for nhq_200"
}
::scobj::nhq_200::sics_log 1 "::scobj::nhq_200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
::scobj::nhq_200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
namespace eval ::scobj::nhq_200 {
namespace export debug_threshold
namespace export debug_log
namespace export sics_log
namespace export mkDriver
namespace export add_driver
}
proc add_nhq_200 {name ip_address tcp_port} {
set catch_status [ catch {
::scobj::nhq_200::sics_log 9 "add_nhq_200 ${name} ${ip_address} ${tcp_port}"
if {[string equal -nocase [SplitReply [detector_simulation]] "false"]} {
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
::scobj::nhq_200::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
makesctcontroller sct_${name} aqadapter ${tcp_port}
} else {
::scobj::nhq_200::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
}
} else {
::scobj::nhq_200::sics_log 9 "[detector_simulation] => No sctcontroller for nhq_200"
}
::scobj::nhq_200::sics_log 1 "::scobj::nhq_200::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}"
::scobj::nhq_200::mkDriver sct_${name} ${name} ${ip_address} ${tcp_port}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
set simulation_flag "[string tolower [SplitReply [detector_simulation]]]"
::scobj::nhq_200::add_driver ${name} "NXdetector" "${simulation_flag}" ${ip_address} ${tcp_port}
}
clientput "file evaluation of sct_nhq_200.tcl"
@@ -744,6 +750,8 @@ proc ::scobj::nhq_200::read_config {} {
set ns "::scobj::nhq_200"
dict for {k u} $::config_dict {
if { [dict exists $u "implementation"] } {
set simulation_flag "[string tolower [SplitReply [detector_simulation]]]"
set device_class "NXdetector"
if { !([dict exists $u "name"] && [dict exists $u "enabled"]) } {
continue
}
@@ -751,6 +759,12 @@ proc ::scobj::nhq_200::read_config {} {
if { ! ([string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"]) } {
continue
}
if { [dict exists $u "simulation_group"] } {
set simulation_flag [SplitReply [[string tolower [dict get $u "simulation_group"]]]]
}
if { [dict exists $u "device_class"] } {
set device_class "[dict get $u "device_class"]"
}
set name [dict get $u name]
set implementation [dict get $u "implementation"]
if { !([dict exists $::config_dict $implementation]) } {
@@ -761,9 +775,9 @@ proc ::scobj::nhq_200::read_config {} {
continue
}
if { [string equal -nocase [dict get $v "driver"] "nhq_200"] } {
if { ![string equal -nocase [SplitReply [detector_simulation]] "false"] } {
if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "[detector_simulation] => using null asyncqueue"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
@@ -790,9 +804,9 @@ proc ::scobj::nhq_200::read_config {} {
}
}
if { [string equal -nocase ${asyncqueue} "sct"] } {
add_nhq_200 ${name} ${ip_address} ${tcp_port}
${ns}::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
} else {
add_nhq_200 ${name} "aqadapter" ${asyncqueue}
${ns}::add_driver ${name} ${device_class} ${simulation_flag} "aqadapter" ${asyncqueue}
}
}
}