Files
sics/site_ansto/instrument/config/environment/sct_nhq_200.tcl
2014-12-02 10:09:17 +11:00

994 lines
44 KiB
Tcl

# Generated driver for nhq_200
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
#
namespace eval ::scobj::nhq_200 {
set debug_threshold 5
}
proc ::scobj::nhq_200::debug_log {tc_root debug_level debug_string} {
set catch_status [ catch {
set debug_threshold [hgetpropval ${tc_root} debug_threshold]
if {${debug_level} >= ${debug_threshold}} {
set now [clock seconds]
set ts [clock format ${now} -format "%Y%m%d"]
set log_file_name "../log/nhq_200_[basename ${tc_root}]_${ts}.log"
set fd [open "${log_file_name}" "a"]
set ts [clock format ${now} -format "%T"]
puts ${fd} "${ts} ${debug_string}"
close ${fd}
}
} catch_message ]
}
proc ::scobj::nhq_200::sics_log {debug_level debug_string} {
set catch_status [ catch {
set debug_threshold ${::scobj::nhq_200::debug_threshold}
if {${debug_level} >= ${debug_threshold}} {
sicslog "::scobj::nhq_200::${debug_string}"
}
} catch_message ]
}
# checklimits function for driveable interface
proc ::scobj::nhq_200::checklimits {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "checklimits tc_root=${tc_root} sct=[sct] target=[sct target]"
set setpoint [sct target]
if { [hpropexists [sct] lowerlimit] } {
set lolimit [sct lowerlimit]
} else {
# lowerlimit not set, use target
set lolimit [sct target]
}
if { [hpropexists [sct] upperlimit] } {
set hilimit [sct upperlimit]
} else {
# upperlimit not set, use target
set hilimit [sct target]
}
# checklimits hook code goes here
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
sct driving 0
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
}
return OK
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# check function for hset change
proc ::scobj::nhq_200::checkrange {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]"
set setpoint [sct target]
if { [hpropexists [sct] lowerlimit] } {
set lolimit [sct lowerlimit]
} else {
# lowerlimit not set, use target
set lolimit [sct target]
}
if { [hpropexists [sct] upperlimit] } {
set hilimit [sct upperlimit]
} else {
# upperlimit not set, use target
set hilimit [sct target]
}
# checkrange hook code goes here
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
}
return OK
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# checkstatus function for driveable interface
proc ::scobj::nhq_200::checkstatus {tc_root} {
set catch_status [ catch {
# checkstatus hook code goes here
if {[sct driving]} {
set sp "[sct target]"
if {[hpropexists [sct] simulated] && [sct simulated] == "true"} {
set pv "${sp}"
hupdateif ${tc_root}/[sct driveable] ${sp}
} else {
set pv "[hval ${tc_root}/[sct driveable]]"
}
if { abs(${pv} - ${sp}) <= [sct tolerance] } {
if { [hpropexists [sct] settle_time] } {
if { [hpropexists [sct] settle_time_start] } {
if { [sct utime] - [sct settle_time_start] >= [sct settle_time]} {
sct driving 0
return "idle"
}
return "busy"
} else {
sct utime settle_time_start
return "busy"
}
}
sct driving 0
return "idle"
}
if { [hpropexists [sct] settle_time_start] } {
hdelprop [sct] settle_time_start
}
return "busy"
} else {
return "idle"
}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to request the read of a parameter on a device
proc ::scobj::nhq_200::getValue {tc_root nextState cmd_str} {
set catch_status [ catch {
debug_log ${tc_root} 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set cmd "${cmd_str}"
# getValue hook code goes here
debug_log ${tc_root} 1 "getValue sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# halt function for driveable interface
proc ::scobj::nhq_200::halt {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "halt tc_root=${tc_root} sct=[sct] driving=[sct driving]"
### TODO hset [sct] [hval [sct]]
# halt hook code goes here
sct driving 0
return "idle"
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to check the write parameter on a device
proc ::scobj::nhq_200::noResponse {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
# noResponse hook code goes here
return "idle"
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to parse the read of a parameter on a device
proc ::scobj::nhq_200::rdCurrent {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "rdCurrent tc_root=${tc_root} sct=[sct] result=[sct result]"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set data [sct result]
set nextState "idle"
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
# the protocol driver has reported an error
sct geterror "${data}"
error "[sct geterror]"
}
# rdCurrent hook code starts
# rdCurrent hook code ends
if { [hpropexists [sct] geterror] } {
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
error "[sct geterror]"
}
if { ${data} != [sct oldval] } {
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to parse the read of a parameter on a device
proc ::scobj::nhq_200::rdValue {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "rdValue tc_root=${tc_root} sct=[sct] result=[sct result]"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set data [sct result]
set nextState "idle"
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
# the protocol driver has reported an error
sct geterror "${data}"
error "[sct geterror]"
}
# rdValue hook code goes here
if { ${data} != [sct oldval] } {
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to parse the read of a parameter on a device
proc ::scobj::nhq_200::rdVoltage {tc_root} {
set catch_status [ catch {
debug_log ${tc_root} 1 "rdVoltage tc_root=${tc_root} sct=[sct] result=[sct result]"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set data [sct result]
set nextState "idle"
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
# the protocol driver has reported an error
sct geterror "${data}"
error "[sct geterror]"
}
# rdVoltage hook code starts
# Strip the leading sign
set data [expr {abs(${data})}]
# rdVoltage hook code ends
if { [hpropexists [sct] geterror] } {
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
error "[sct geterror]"
}
if { ${data} != [sct oldval] } {
debug_log ${tc_root} 1 "[sct] changed to new:${data}, from old:[sct oldval]"
sct oldval ${data}
sct update ${data}
sct utime readtime
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
# function to write a parameter value on a device
proc ::scobj::nhq_200::setValue {tc_root nextState cmd_str} {
set catch_status [ catch {
debug_log ${tc_root} 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
if { [hpropexists [sct] geterror] } {
hdelprop [sct] geterror
}
set par [sct target]
set cmd "${cmd_str}${par}"
# setValue hook code goes here
if { [hpropexists [sct] driving] } {
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
sct driving 1
}
}
debug_log ${tc_root} 1 "setValue sct send ${cmd}"
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
sct send "${cmd}"
}
return ${nextState}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
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} driver nhq_200
sicslist setatt ${name} klass ${device_class}
sicslist setatt ${name} long_name ${name}
set scobj_hpath /sics/${name}
hfactory ${scobj_hpath}/break plain user int
hsetprop ${scobj_hpath}/break read ${ns}::getValue ${scobj_hpath} rdValue {W}
hsetprop ${scobj_hpath}/break rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/break control true
hsetprop ${scobj_hpath}/break data true
hsetprop ${scobj_hpath}/break mutable true
hsetprop ${scobj_hpath}/break nxsave true
hsetprop ${scobj_hpath}/break oldval 0
hsetprop ${scobj_hpath}/break klass "parameter"
hsetprop ${scobj_hpath}/break sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/break type "part"
hsetprop ${scobj_hpath}/break nxalias "${name}_break"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/break 10
hsetprop ${scobj_hpath}/break simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/break simulated true
}
hfactory ${scobj_hpath}/id plain user text
hsetprop ${scobj_hpath}/id read ${ns}::getValue ${scobj_hpath} rdValue {#}
hsetprop ${scobj_hpath}/id rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/id control true
hsetprop ${scobj_hpath}/id data true
hsetprop ${scobj_hpath}/id mutable true
hsetprop ${scobj_hpath}/id nxsave true
hsetprop ${scobj_hpath}/id oldval UNKNOWN
hsetprop ${scobj_hpath}/id klass "parameter"
hsetprop ${scobj_hpath}/id sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/id type "part"
hsetprop ${scobj_hpath}/id nxalias "${name}_id"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/id 10
hsetprop ${scobj_hpath}/id simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/id simulated true
}
hsetprop ${scobj_hpath} data "true"
hsetprop ${scobj_hpath} klass "@none"
hsetprop ${scobj_hpath} type "part"
hfactory ${scobj_hpath}/ch1 plain spy none
hfactory ${scobj_hpath}/ch1/auto_start plain user int
hsetprop ${scobj_hpath}/ch1/auto_start read ${ns}::getValue ${scobj_hpath} rdValue {A1}
hsetprop ${scobj_hpath}/ch1/auto_start rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/auto_start write ${ns}::setValue ${scobj_hpath} noResponse {A1=}
hsetprop ${scobj_hpath}/ch1/auto_start noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/auto_start check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/auto_start control true
hsetprop ${scobj_hpath}/ch1/auto_start data true
hsetprop ${scobj_hpath}/ch1/auto_start mutable true
hsetprop ${scobj_hpath}/ch1/auto_start nxsave true
hsetprop ${scobj_hpath}/ch1/auto_start oldval 0
hsetprop ${scobj_hpath}/ch1/auto_start klass "parameter"
hsetprop ${scobj_hpath}/ch1/auto_start sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch1/auto_start type "part"
hsetprop ${scobj_hpath}/ch1/auto_start nxalias "${name}_ch1_auto_start"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch1/auto_start 5
${sct_controller} write ${scobj_hpath}/ch1/auto_start
hsetprop ${scobj_hpath}/ch1/auto_start simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch1/auto_start simulated true
}
hfactory ${scobj_hpath}/ch1/current plain user text
hsetprop ${scobj_hpath}/ch1/current read ${ns}::getValue ${scobj_hpath} rdCurrent {I1}
hsetprop ${scobj_hpath}/ch1/current rdCurrent ${ns}::rdCurrent ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/current control true
hsetprop ${scobj_hpath}/ch1/current data true
hsetprop ${scobj_hpath}/ch1/current mutable true
hsetprop ${scobj_hpath}/ch1/current nxsave true
hsetprop ${scobj_hpath}/ch1/current oldval UNKNOWN
hsetprop ${scobj_hpath}/ch1/current klass "parameter"
hsetprop ${scobj_hpath}/ch1/current sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch1/current type "part"
hsetprop ${scobj_hpath}/ch1/current nxalias "${name}_ch1_current"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch1/current 5
hsetprop ${scobj_hpath}/ch1/current simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch1/current simulated true
}
hfactory ${scobj_hpath}/ch1/go plain user int
hsetprop ${scobj_hpath}/ch1/go write ${ns}::setValue ${scobj_hpath} noResponse {G1}
hsetprop ${scobj_hpath}/ch1/go noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/go check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/go control true
hsetprop ${scobj_hpath}/ch1/go data true
hsetprop ${scobj_hpath}/ch1/go mutable true
hsetprop ${scobj_hpath}/ch1/go nxsave true
hsetprop ${scobj_hpath}/ch1/go oldval 0
hsetprop ${scobj_hpath}/ch1/go klass "parameter"
hsetprop ${scobj_hpath}/ch1/go sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch1/go type "part"
hsetprop ${scobj_hpath}/ch1/go nxalias "${name}_ch1_go"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} write ${scobj_hpath}/ch1/go
hsetprop ${scobj_hpath}/ch1/go simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch1/go simulated true
}
hfactory ${scobj_hpath}/ch1/i_lim plain user int
hsetprop ${scobj_hpath}/ch1/i_lim read ${ns}::getValue ${scobj_hpath} rdValue {N1}
hsetprop ${scobj_hpath}/ch1/i_lim rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/i_lim control true
hsetprop ${scobj_hpath}/ch1/i_lim data true
hsetprop ${scobj_hpath}/ch1/i_lim mutable true
hsetprop ${scobj_hpath}/ch1/i_lim nxsave true
hsetprop ${scobj_hpath}/ch1/i_lim oldval 0
hsetprop ${scobj_hpath}/ch1/i_lim klass "parameter"
hsetprop ${scobj_hpath}/ch1/i_lim sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch1/i_lim type "part"
hsetprop ${scobj_hpath}/ch1/i_lim nxalias "${name}_ch1_i_lim"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch1/i_lim 5
hsetprop ${scobj_hpath}/ch1/i_lim simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch1/i_lim simulated true
}
hfactory ${scobj_hpath}/ch1/i_trip plain user int
hsetprop ${scobj_hpath}/ch1/i_trip read ${ns}::getValue ${scobj_hpath} rdValue {L1}
hsetprop ${scobj_hpath}/ch1/i_trip rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/i_trip write ${ns}::setValue ${scobj_hpath} noResponse {L1=}
hsetprop ${scobj_hpath}/ch1/i_trip noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/i_trip check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/i_trip control true
hsetprop ${scobj_hpath}/ch1/i_trip data true
hsetprop ${scobj_hpath}/ch1/i_trip mutable true
hsetprop ${scobj_hpath}/ch1/i_trip nxsave true
hsetprop ${scobj_hpath}/ch1/i_trip oldval 0
hsetprop ${scobj_hpath}/ch1/i_trip klass "parameter"
hsetprop ${scobj_hpath}/ch1/i_trip sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch1/i_trip type "part"
hsetprop ${scobj_hpath}/ch1/i_trip nxalias "${name}_ch1_i_trip"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch1/i_trip 5
${sct_controller} write ${scobj_hpath}/ch1/i_trip
hsetprop ${scobj_hpath}/ch1/i_trip simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch1/i_trip simulated true
}
hfactory ${scobj_hpath}/ch1/module plain user int
hsetprop ${scobj_hpath}/ch1/module read ${ns}::getValue ${scobj_hpath} rdValue {T1}
hsetprop ${scobj_hpath}/ch1/module rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/module control true
hsetprop ${scobj_hpath}/ch1/module data true
hsetprop ${scobj_hpath}/ch1/module mutable true
hsetprop ${scobj_hpath}/ch1/module nxsave true
hsetprop ${scobj_hpath}/ch1/module oldval 0
hsetprop ${scobj_hpath}/ch1/module klass "parameter"
hsetprop ${scobj_hpath}/ch1/module sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch1/module type "part"
hsetprop ${scobj_hpath}/ch1/module nxalias "${name}_ch1_module"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch1/module 5
hsetprop ${scobj_hpath}/ch1/module simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch1/module simulated true
}
hfactory ${scobj_hpath}/ch1/status plain user text
hsetprop ${scobj_hpath}/ch1/status read ${ns}::getValue ${scobj_hpath} rdValue {S1}
hsetprop ${scobj_hpath}/ch1/status rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/status control true
hsetprop ${scobj_hpath}/ch1/status data true
hsetprop ${scobj_hpath}/ch1/status mutable true
hsetprop ${scobj_hpath}/ch1/status nxsave true
hsetprop ${scobj_hpath}/ch1/status oldval UNKNOWN
hsetprop ${scobj_hpath}/ch1/status klass "parameter"
hsetprop ${scobj_hpath}/ch1/status sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch1/status type "part"
hsetprop ${scobj_hpath}/ch1/status nxalias "${name}_ch1_status"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch1/status 5
hsetprop ${scobj_hpath}/ch1/status simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch1/status simulated true
}
hfactory ${scobj_hpath}/ch1/v_lim plain user int
hsetprop ${scobj_hpath}/ch1/v_lim read ${ns}::getValue ${scobj_hpath} rdValue {M1}
hsetprop ${scobj_hpath}/ch1/v_lim rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/v_lim control true
hsetprop ${scobj_hpath}/ch1/v_lim data true
hsetprop ${scobj_hpath}/ch1/v_lim mutable true
hsetprop ${scobj_hpath}/ch1/v_lim nxsave true
hsetprop ${scobj_hpath}/ch1/v_lim oldval 0
hsetprop ${scobj_hpath}/ch1/v_lim klass "parameter"
hsetprop ${scobj_hpath}/ch1/v_lim sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch1/v_lim type "part"
hsetprop ${scobj_hpath}/ch1/v_lim nxalias "${name}_ch1_v_lim"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch1/v_lim 5
hsetprop ${scobj_hpath}/ch1/v_lim simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch1/v_lim simulated true
}
hfactory ${scobj_hpath}/ch1/v_ramp plain user int
hsetprop ${scobj_hpath}/ch1/v_ramp read ${ns}::getValue ${scobj_hpath} rdValue {V1}
hsetprop ${scobj_hpath}/ch1/v_ramp rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/v_ramp write ${ns}::setValue ${scobj_hpath} noResponse {V1=}
hsetprop ${scobj_hpath}/ch1/v_ramp noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/v_ramp check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/v_ramp control true
hsetprop ${scobj_hpath}/ch1/v_ramp data true
hsetprop ${scobj_hpath}/ch1/v_ramp mutable true
hsetprop ${scobj_hpath}/ch1/v_ramp nxsave true
hsetprop ${scobj_hpath}/ch1/v_ramp oldval 0
hsetprop ${scobj_hpath}/ch1/v_ramp klass "parameter"
hsetprop ${scobj_hpath}/ch1/v_ramp sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch1/v_ramp type "part"
hsetprop ${scobj_hpath}/ch1/v_ramp nxalias "${name}_ch1_v_ramp"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch1/v_ramp 5
${sct_controller} write ${scobj_hpath}/ch1/v_ramp
hsetprop ${scobj_hpath}/ch1/v_ramp simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch1/v_ramp simulated true
}
hfactory ${scobj_hpath}/ch1/v_sp plain user int
hsetprop ${scobj_hpath}/ch1/v_sp read ${ns}::getValue ${scobj_hpath} rdValue {D1}
hsetprop ${scobj_hpath}/ch1/v_sp rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/v_sp write ${ns}::setValue ${scobj_hpath} noResponse {D1=}
hsetprop ${scobj_hpath}/ch1/v_sp noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/v_sp check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/v_sp driving 0
hsetprop ${scobj_hpath}/ch1/v_sp checklimits ${ns}::checklimits ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/v_sp checkstatus ${ns}::checkstatus ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/v_sp halt ${ns}::halt ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/v_sp driveable ch1/voltage
hsetprop ${scobj_hpath}/ch1/v_sp control true
hsetprop ${scobj_hpath}/ch1/v_sp data true
hsetprop ${scobj_hpath}/ch1/v_sp mutable true
hsetprop ${scobj_hpath}/ch1/v_sp nxsave true
hsetprop ${scobj_hpath}/ch1/v_sp lowerlimit 0
hsetprop ${scobj_hpath}/ch1/v_sp upperlimit 3000
hsetprop ${scobj_hpath}/ch1/v_sp tolerance 5
hsetprop ${scobj_hpath}/ch1/v_sp oldval 0
hsetprop ${scobj_hpath}/ch1/v_sp klass "parameter"
hsetprop ${scobj_hpath}/ch1/v_sp sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch1/v_sp settle_time "10"
hsetprop ${scobj_hpath}/ch1/v_sp type "drivable"
hsetprop ${scobj_hpath}/ch1/v_sp nxalias "${name}_ch1_v_sp"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch1/v_sp 5
${sct_controller} write ${scobj_hpath}/ch1/v_sp
hsetprop ${scobj_hpath}/ch1/v_sp simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch1/v_sp simulated true
}
hfactory ${scobj_hpath}/ch1/voltage plain user int
hsetprop ${scobj_hpath}/ch1/voltage read ${ns}::getValue ${scobj_hpath} rdVoltage {U1}
hsetprop ${scobj_hpath}/ch1/voltage rdVoltage ${ns}::rdVoltage ${scobj_hpath}
hsetprop ${scobj_hpath}/ch1/voltage control true
hsetprop ${scobj_hpath}/ch1/voltage data true
hsetprop ${scobj_hpath}/ch1/voltage mutable true
hsetprop ${scobj_hpath}/ch1/voltage nxsave true
hsetprop ${scobj_hpath}/ch1/voltage oldval 0
hsetprop ${scobj_hpath}/ch1/voltage klass "parameter"
hsetprop ${scobj_hpath}/ch1/voltage sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch1/voltage type "part"
hsetprop ${scobj_hpath}/ch1/voltage nxalias "${name}_ch1_voltage"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch1/voltage 5
hsetprop ${scobj_hpath}/ch1/voltage simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch1/voltage simulated true
}
hsetprop ${scobj_hpath}/ch1 data "true"
hsetprop ${scobj_hpath}/ch1 klass "@none"
hsetprop ${scobj_hpath}/ch1 type "part"
ansto_makesctdrive ${name}_ch1_v_sp ${scobj_hpath}/ch1/v_sp ${scobj_hpath}/ch1/voltage ${sct_controller}
hfactory ${scobj_hpath}/ch2 plain spy none
hfactory ${scobj_hpath}/ch2/auto_start plain user int
hsetprop ${scobj_hpath}/ch2/auto_start read ${ns}::getValue ${scobj_hpath} rdValue {A2}
hsetprop ${scobj_hpath}/ch2/auto_start rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/auto_start write ${ns}::setValue ${scobj_hpath} noResponse {A2=}
hsetprop ${scobj_hpath}/ch2/auto_start noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/auto_start check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/auto_start control true
hsetprop ${scobj_hpath}/ch2/auto_start data true
hsetprop ${scobj_hpath}/ch2/auto_start mutable true
hsetprop ${scobj_hpath}/ch2/auto_start nxsave true
hsetprop ${scobj_hpath}/ch2/auto_start oldval 0
hsetprop ${scobj_hpath}/ch2/auto_start klass "parameter"
hsetprop ${scobj_hpath}/ch2/auto_start sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch2/auto_start type "part"
hsetprop ${scobj_hpath}/ch2/auto_start nxalias "${name}_ch2_auto_start"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch2/auto_start 5
${sct_controller} write ${scobj_hpath}/ch2/auto_start
hsetprop ${scobj_hpath}/ch2/auto_start simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch2/auto_start simulated true
}
hfactory ${scobj_hpath}/ch2/current plain user text
hsetprop ${scobj_hpath}/ch2/current read ${ns}::getValue ${scobj_hpath} rdCurrent {I2}
hsetprop ${scobj_hpath}/ch2/current rdCurrent ${ns}::rdCurrent ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/current control true
hsetprop ${scobj_hpath}/ch2/current data true
hsetprop ${scobj_hpath}/ch2/current mutable true
hsetprop ${scobj_hpath}/ch2/current nxsave true
hsetprop ${scobj_hpath}/ch2/current oldval UNKNOWN
hsetprop ${scobj_hpath}/ch2/current klass "parameter"
hsetprop ${scobj_hpath}/ch2/current sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch2/current type "part"
hsetprop ${scobj_hpath}/ch2/current nxalias "${name}_ch2_current"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch2/current 5
hsetprop ${scobj_hpath}/ch2/current simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch2/current simulated true
}
hfactory ${scobj_hpath}/ch2/go plain user int
hsetprop ${scobj_hpath}/ch2/go write ${ns}::setValue ${scobj_hpath} noResponse {G2}
hsetprop ${scobj_hpath}/ch2/go noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/go check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/go control true
hsetprop ${scobj_hpath}/ch2/go data true
hsetprop ${scobj_hpath}/ch2/go mutable true
hsetprop ${scobj_hpath}/ch2/go nxsave true
hsetprop ${scobj_hpath}/ch2/go oldval 0
hsetprop ${scobj_hpath}/ch2/go klass "parameter"
hsetprop ${scobj_hpath}/ch2/go sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch2/go type "part"
hsetprop ${scobj_hpath}/ch2/go nxalias "${name}_ch2_go"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} write ${scobj_hpath}/ch2/go
hsetprop ${scobj_hpath}/ch2/go simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch2/go simulated true
}
hfactory ${scobj_hpath}/ch2/i_lim plain user int
hsetprop ${scobj_hpath}/ch2/i_lim read ${ns}::getValue ${scobj_hpath} rdValue {N2}
hsetprop ${scobj_hpath}/ch2/i_lim rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/i_lim control true
hsetprop ${scobj_hpath}/ch2/i_lim data true
hsetprop ${scobj_hpath}/ch2/i_lim mutable true
hsetprop ${scobj_hpath}/ch2/i_lim nxsave true
hsetprop ${scobj_hpath}/ch2/i_lim oldval 0
hsetprop ${scobj_hpath}/ch2/i_lim klass "parameter"
hsetprop ${scobj_hpath}/ch2/i_lim sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch2/i_lim type "part"
hsetprop ${scobj_hpath}/ch2/i_lim nxalias "${name}_ch2_i_lim"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch2/i_lim 5
hsetprop ${scobj_hpath}/ch2/i_lim simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch2/i_lim simulated true
}
hfactory ${scobj_hpath}/ch2/i_trip plain user int
hsetprop ${scobj_hpath}/ch2/i_trip read ${ns}::getValue ${scobj_hpath} rdValue {L2}
hsetprop ${scobj_hpath}/ch2/i_trip rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/i_trip write ${ns}::setValue ${scobj_hpath} noResponse {L2=}
hsetprop ${scobj_hpath}/ch2/i_trip noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/i_trip check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/i_trip control true
hsetprop ${scobj_hpath}/ch2/i_trip data true
hsetprop ${scobj_hpath}/ch2/i_trip mutable true
hsetprop ${scobj_hpath}/ch2/i_trip nxsave true
hsetprop ${scobj_hpath}/ch2/i_trip oldval 0
hsetprop ${scobj_hpath}/ch2/i_trip klass "parameter"
hsetprop ${scobj_hpath}/ch2/i_trip sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch2/i_trip type "part"
hsetprop ${scobj_hpath}/ch2/i_trip nxalias "${name}_ch2_i_trip"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch2/i_trip 5
${sct_controller} write ${scobj_hpath}/ch2/i_trip
hsetprop ${scobj_hpath}/ch2/i_trip simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch2/i_trip simulated true
}
hfactory ${scobj_hpath}/ch2/module plain user int
hsetprop ${scobj_hpath}/ch2/module read ${ns}::getValue ${scobj_hpath} rdValue {T2}
hsetprop ${scobj_hpath}/ch2/module rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/module control true
hsetprop ${scobj_hpath}/ch2/module data true
hsetprop ${scobj_hpath}/ch2/module mutable true
hsetprop ${scobj_hpath}/ch2/module nxsave true
hsetprop ${scobj_hpath}/ch2/module oldval 0
hsetprop ${scobj_hpath}/ch2/module klass "parameter"
hsetprop ${scobj_hpath}/ch2/module sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch2/module type "part"
hsetprop ${scobj_hpath}/ch2/module nxalias "${name}_ch2_module"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch2/module 5
hsetprop ${scobj_hpath}/ch2/module simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch2/module simulated true
}
hfactory ${scobj_hpath}/ch2/status plain user text
hsetprop ${scobj_hpath}/ch2/status read ${ns}::getValue ${scobj_hpath} rdValue {S2}
hsetprop ${scobj_hpath}/ch2/status rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/status control true
hsetprop ${scobj_hpath}/ch2/status data true
hsetprop ${scobj_hpath}/ch2/status mutable true
hsetprop ${scobj_hpath}/ch2/status nxsave true
hsetprop ${scobj_hpath}/ch2/status oldval UNKNOWN
hsetprop ${scobj_hpath}/ch2/status klass "parameter"
hsetprop ${scobj_hpath}/ch2/status sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch2/status type "part"
hsetprop ${scobj_hpath}/ch2/status nxalias "${name}_ch2_status"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch2/status 5
hsetprop ${scobj_hpath}/ch2/status simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch2/status simulated true
}
hfactory ${scobj_hpath}/ch2/v_lim plain user int
hsetprop ${scobj_hpath}/ch2/v_lim read ${ns}::getValue ${scobj_hpath} rdValue {M2}
hsetprop ${scobj_hpath}/ch2/v_lim rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/v_lim control true
hsetprop ${scobj_hpath}/ch2/v_lim data true
hsetprop ${scobj_hpath}/ch2/v_lim mutable true
hsetprop ${scobj_hpath}/ch2/v_lim nxsave true
hsetprop ${scobj_hpath}/ch2/v_lim oldval 0
hsetprop ${scobj_hpath}/ch2/v_lim klass "parameter"
hsetprop ${scobj_hpath}/ch2/v_lim sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch2/v_lim type "part"
hsetprop ${scobj_hpath}/ch2/v_lim nxalias "${name}_ch2_v_lim"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch2/v_lim 5
hsetprop ${scobj_hpath}/ch2/v_lim simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch2/v_lim simulated true
}
hfactory ${scobj_hpath}/ch2/v_ramp plain user int
hsetprop ${scobj_hpath}/ch2/v_ramp read ${ns}::getValue ${scobj_hpath} rdValue {V2}
hsetprop ${scobj_hpath}/ch2/v_ramp rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/v_ramp write ${ns}::setValue ${scobj_hpath} noResponse {V2=}
hsetprop ${scobj_hpath}/ch2/v_ramp noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/v_ramp check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/v_ramp control true
hsetprop ${scobj_hpath}/ch2/v_ramp data true
hsetprop ${scobj_hpath}/ch2/v_ramp mutable true
hsetprop ${scobj_hpath}/ch2/v_ramp nxsave true
hsetprop ${scobj_hpath}/ch2/v_ramp oldval 0
hsetprop ${scobj_hpath}/ch2/v_ramp klass "parameter"
hsetprop ${scobj_hpath}/ch2/v_ramp sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch2/v_ramp type "part"
hsetprop ${scobj_hpath}/ch2/v_ramp nxalias "${name}_ch2_v_ramp"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch2/v_ramp 5
${sct_controller} write ${scobj_hpath}/ch2/v_ramp
hsetprop ${scobj_hpath}/ch2/v_ramp simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch2/v_ramp simulated true
}
hfactory ${scobj_hpath}/ch2/v_sp plain user int
hsetprop ${scobj_hpath}/ch2/v_sp read ${ns}::getValue ${scobj_hpath} rdValue {D2}
hsetprop ${scobj_hpath}/ch2/v_sp rdValue ${ns}::rdValue ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/v_sp write ${ns}::setValue ${scobj_hpath} noResponse {D2=}
hsetprop ${scobj_hpath}/ch2/v_sp noResponse ${ns}::noResponse ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/v_sp check ${ns}::checkrange ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/v_sp driving 0
hsetprop ${scobj_hpath}/ch2/v_sp checklimits ${ns}::checklimits ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/v_sp checkstatus ${ns}::checkstatus ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/v_sp halt ${ns}::halt ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/v_sp driveable ch2/voltage
hsetprop ${scobj_hpath}/ch2/v_sp control true
hsetprop ${scobj_hpath}/ch2/v_sp data true
hsetprop ${scobj_hpath}/ch2/v_sp mutable true
hsetprop ${scobj_hpath}/ch2/v_sp nxsave true
hsetprop ${scobj_hpath}/ch2/v_sp lowerlimit 0
hsetprop ${scobj_hpath}/ch2/v_sp upperlimit 3000
hsetprop ${scobj_hpath}/ch2/v_sp tolerance 5
hsetprop ${scobj_hpath}/ch2/v_sp oldval 0
hsetprop ${scobj_hpath}/ch2/v_sp klass "parameter"
hsetprop ${scobj_hpath}/ch2/v_sp sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch2/v_sp settle_time "10"
hsetprop ${scobj_hpath}/ch2/v_sp type "drivable"
hsetprop ${scobj_hpath}/ch2/v_sp nxalias "${name}_ch2_v_sp"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch2/v_sp 5
${sct_controller} write ${scobj_hpath}/ch2/v_sp
hsetprop ${scobj_hpath}/ch2/v_sp simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch2/v_sp simulated true
}
hfactory ${scobj_hpath}/ch2/voltage plain user int
hsetprop ${scobj_hpath}/ch2/voltage read ${ns}::getValue ${scobj_hpath} rdVoltage {U2}
hsetprop ${scobj_hpath}/ch2/voltage rdVoltage ${ns}::rdVoltage ${scobj_hpath}
hsetprop ${scobj_hpath}/ch2/voltage control true
hsetprop ${scobj_hpath}/ch2/voltage data true
hsetprop ${scobj_hpath}/ch2/voltage mutable true
hsetprop ${scobj_hpath}/ch2/voltage nxsave true
hsetprop ${scobj_hpath}/ch2/voltage oldval 0
hsetprop ${scobj_hpath}/ch2/voltage klass "parameter"
hsetprop ${scobj_hpath}/ch2/voltage sdsinfo "::nexus::scobj::sdsinfo"
hsetprop ${scobj_hpath}/ch2/voltage type "part"
hsetprop ${scobj_hpath}/ch2/voltage nxalias "${name}_ch2_voltage"
if {[string equal -nocase "${simulation_flag}" "false"]} {
${sct_controller} poll ${scobj_hpath}/ch2/voltage 5
hsetprop ${scobj_hpath}/ch2/voltage simulated false
} else {
::scobj::nhq_200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for nhq_200"
hsetprop ${scobj_hpath}/ch2/voltage simulated true
}
hsetprop ${scobj_hpath}/ch2 data "true"
hsetprop ${scobj_hpath}/ch2 klass "@none"
hsetprop ${scobj_hpath}/ch2 type "part"
ansto_makesctdrive ${name}_ch2_v_sp ${scobj_hpath}/ch2/v_sp ${scobj_hpath}/ch2/voltage ${sct_controller}
hsetprop ${scobj_hpath} driver nhq_200
hsetprop ${scobj_hpath} klass ${device_class}
hsetprop ${scobj_hpath} data true
hsetprop ${scobj_hpath} debug_threshold 5
# mkDriver hook code goes here
} catch_message ]
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} => Null sctcontroller for nhq_200"
::scobj::nhq_200::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
}
::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 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"
::scobj::nhq_200::sics_log 9 "file evaluation of sct_nhq_200.tcl"
proc ::scobj::nhq_200::read_config {} {
set catch_status [ catch {
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
}
set enabled [string tolower [dict get $u "enabled"]]
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]) } {
continue
}
set v [dict get $::config_dict $implementation]
if { !([dict exists $v "driver"]) } {
continue
}
if { [string equal -nocase [dict get $v "driver"] "nhq_200"] } {
if { ![string equal -nocase "${simulation_flag}" "false"] } {
set asyncqueue "null"
${ns}::sics_log 9 "simulation_flag=${simulation_flag} => using null asyncqueue"
${ns}::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
makesctcontroller sct_${name} aqadapter NULL
} elseif { [dict exists $v "asyncqueue"] } {
set asyncqueue [dict get $v "asyncqueue"]
if { [string equal -nocase ${asyncqueue} "sct"] } {
set ip_address [dict get $v ip]
set tcp_port [dict get $v port]
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
} else {
makesctcontroller sct_${name} aqadapter ${asyncqueue}
}
} else {
if { [dict exists $v "asyncprotocol"] } {
set asyncprotocol [dict get $v "asyncprotocol"]
} else {
set asyncprotocol ${name}_protocol
MakeAsyncProtocol ${asyncprotocol}
if { [dict exists $v "sendterminator"] } {
${asyncprotocol} sendterminator "[dict get $v "sendterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
}
if { [dict exists $v "replyterminator"] } {
${asyncprotocol} replyterminator "[dict get $v "replyterminator"]"
} elseif { [dict exists $v "terminator"] } {
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
}
}
set asyncqueue ${name}_queue
set ip_address [dict get $v ip]
set tcp_port [dict get $v port]
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${ip_address} ${tcp_port}
if { [dict exists $v "timeout"] } {
${asyncqueue} timeout "[dict get $v "timeout"]"
}
makesctcontroller sct_${name} aqadapter ${asyncqueue}
}
${ns}::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
}
}
}
} catch_message ]
handle_exception ${catch_status} ${catch_message}
}
if { [info exists ::config_dict] } {
::scobj::nhq_200::read_config
} else {
::scobj::nhq_200::sics_log 5 "No config dict"
}