Add newer generated drivers from merge
This commit is contained in:
547
site_ansto/instrument/config/beamline/he3_polanal_sct.tcl
Normal file
547
site_ansto/instrument/config/beamline/he3_polanal_sct.tcl
Normal file
@ -0,0 +1,547 @@
|
||||
# Generated driver for he3_polanal
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::he3_polanal {
|
||||
set debug_threshold 0
|
||||
}
|
||||
|
||||
proc ::scobj::he3_polanal::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 fd [open "../log/he3_polanal_[basename ${tc_root}].log" "a"]
|
||||
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
|
||||
puts ${fd} "${line}"
|
||||
close ${fd}
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc ::scobj::he3_polanal::sics_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
set debug_threshold ${::scobj::he3_polanal::debug_threshold}
|
||||
if {${debug_level} >= ${debug_threshold}} {
|
||||
sicslog "::scobj::he3_polanal::${debug_string}"
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
# check function for hset change
|
||||
proc ::scobj::he3_polanal::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}
|
||||
}
|
||||
|
||||
# function to check the write parameter on a device
|
||||
proc ::scobj::he3_polanal::chkWrite {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log ${tc_root} 1 "chkWrite tc_root=${tc_root} sct=[sct] resp=[sct result]"
|
||||
# chkWrite hook code starts
|
||||
[namespace current]::rdValue ${tc_root}
|
||||
# chkWrite hook code ends
|
||||
return "idle"
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to request the read of a parameter on a device
|
||||
proc ::scobj::he3_polanal::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}
|
||||
}
|
||||
|
||||
# function to check the write parameter on a device
|
||||
proc ::scobj::he3_polanal::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::he3_polanal::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 starts
|
||||
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]]
|
||||
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]"
|
||||
}
|
||||
# rdValue 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::he3_polanal::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 starts
|
||||
set cmd "${cmd_str}"
|
||||
if {[string equal -nocase [sct target] "refresh"]} {
|
||||
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] "up"]} {
|
||||
set cmd "${cmd_str} +"
|
||||
}
|
||||
if {[sct target] == "+" || [sct target] == 1} {
|
||||
set cmd "${cmd_str} +"
|
||||
}
|
||||
# setValue hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
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::he3_polanal::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port } {
|
||||
::scobj::he3_polanal::sics_log 9 "::scobj::he3_polanal::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 ${device_class}
|
||||
sicslist setatt ${name} long_name ${name}
|
||||
|
||||
set scobj_hpath /sics/${name}
|
||||
|
||||
# Start of named group: analyser
|
||||
hfactory ${scobj_hpath}/analyser plain spy none
|
||||
|
||||
# Start of var: Amplitude
|
||||
hfactory ${scobj_hpath}/analyser/Amplitude plain user text
|
||||
hsetprop ${scobj_hpath}/analyser/Amplitude control true
|
||||
hsetprop ${scobj_hpath}/analyser/Amplitude data true
|
||||
hsetprop ${scobj_hpath}/analyser/Amplitude mutable true
|
||||
hsetprop ${scobj_hpath}/analyser/Amplitude nxsave true
|
||||
hsetprop ${scobj_hpath}/analyser/Amplitude oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/analyser/Amplitude klass "parameter"
|
||||
hsetprop ${scobj_hpath}/analyser/Amplitude sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/analyser/Amplitude type "part"
|
||||
hsetprop ${scobj_hpath}/analyser/Amplitude nxalias "${name}_analyser_Amplitude"
|
||||
|
||||
# Start of var: Field
|
||||
hfactory ${scobj_hpath}/analyser/Field plain user text
|
||||
hsetprop ${scobj_hpath}/analyser/Field control true
|
||||
hsetprop ${scobj_hpath}/analyser/Field data true
|
||||
hsetprop ${scobj_hpath}/analyser/Field mutable true
|
||||
hsetprop ${scobj_hpath}/analyser/Field nxsave true
|
||||
hsetprop ${scobj_hpath}/analyser/Field units Oersted
|
||||
hsetprop ${scobj_hpath}/analyser/Field oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/analyser/Field klass "parameter"
|
||||
hsetprop ${scobj_hpath}/analyser/Field sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/analyser/Field type "part"
|
||||
hsetprop ${scobj_hpath}/analyser/Field nxalias "${name}_analyser_Field"
|
||||
|
||||
# Start of var: Freq
|
||||
hfactory ${scobj_hpath}/analyser/Freq plain user text
|
||||
hsetprop ${scobj_hpath}/analyser/Freq control true
|
||||
hsetprop ${scobj_hpath}/analyser/Freq data true
|
||||
hsetprop ${scobj_hpath}/analyser/Freq mutable true
|
||||
hsetprop ${scobj_hpath}/analyser/Freq nxsave true
|
||||
hsetprop ${scobj_hpath}/analyser/Freq units Hertz
|
||||
hsetprop ${scobj_hpath}/analyser/Freq oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/analyser/Freq klass "parameter"
|
||||
hsetprop ${scobj_hpath}/analyser/Freq sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/analyser/Freq type "part"
|
||||
hsetprop ${scobj_hpath}/analyser/Freq nxalias "${name}_analyser_Freq"
|
||||
|
||||
# Start of var: Phase
|
||||
hfactory ${scobj_hpath}/analyser/Phase plain user text
|
||||
hsetprop ${scobj_hpath}/analyser/Phase control true
|
||||
hsetprop ${scobj_hpath}/analyser/Phase data true
|
||||
hsetprop ${scobj_hpath}/analyser/Phase mutable true
|
||||
hsetprop ${scobj_hpath}/analyser/Phase nxsave true
|
||||
hsetprop ${scobj_hpath}/analyser/Phase units Degree
|
||||
hsetprop ${scobj_hpath}/analyser/Phase oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/analyser/Phase klass "parameter"
|
||||
hsetprop ${scobj_hpath}/analyser/Phase sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/analyser/Phase type "part"
|
||||
hsetprop ${scobj_hpath}/analyser/Phase nxalias "${name}_analyser_Phase"
|
||||
|
||||
# Start of var: Time2
|
||||
hfactory ${scobj_hpath}/analyser/Time2 plain user text
|
||||
hsetprop ${scobj_hpath}/analyser/Time2 control true
|
||||
hsetprop ${scobj_hpath}/analyser/Time2 data true
|
||||
hsetprop ${scobj_hpath}/analyser/Time2 mutable true
|
||||
hsetprop ${scobj_hpath}/analyser/Time2 nxsave true
|
||||
hsetprop ${scobj_hpath}/analyser/Time2 units Second
|
||||
hsetprop ${scobj_hpath}/analyser/Time2 oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/analyser/Time2 klass "parameter"
|
||||
hsetprop ${scobj_hpath}/analyser/Time2 sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/analyser/Time2 type "part"
|
||||
hsetprop ${scobj_hpath}/analyser/Time2 nxalias "${name}_analyser_Time2"
|
||||
|
||||
# Start of var: spin
|
||||
hfactory ${scobj_hpath}/analyser/spin plain user text
|
||||
hsetprop ${scobj_hpath}/analyser/spin read ${ns}::getValue ${scobj_hpath} rdValue {analyser}
|
||||
hsetprop ${scobj_hpath}/analyser/spin rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/analyser/spin write ${ns}::setValue ${scobj_hpath} chkWrite {analyser}
|
||||
hsetprop ${scobj_hpath}/analyser/spin chkWrite ${ns}::chkWrite ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/analyser/spin check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/analyser/spin control true
|
||||
hsetprop ${scobj_hpath}/analyser/spin data true
|
||||
hsetprop ${scobj_hpath}/analyser/spin mutable true
|
||||
hsetprop ${scobj_hpath}/analyser/spin nxsave true
|
||||
hsetprop ${scobj_hpath}/analyser/spin values +,-,0
|
||||
hsetprop ${scobj_hpath}/analyser/spin oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/analyser/spin klass "parameter"
|
||||
hsetprop ${scobj_hpath}/analyser/spin sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/analyser/spin type "part"
|
||||
hsetprop ${scobj_hpath}/analyser/spin nxalias "${name}_analyser_spin"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/analyser/spin 900
|
||||
${sct_controller} write ${scobj_hpath}/analyser/spin
|
||||
hsetprop ${scobj_hpath}/analyser/spin simulated false
|
||||
} else {
|
||||
::scobj::he3_polanal::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for he3_polanal"
|
||||
hsetprop ${scobj_hpath}/analyser/spin simulated true
|
||||
}
|
||||
hsetprop ${scobj_hpath}/analyser data "true"
|
||||
hsetprop ${scobj_hpath}/analyser klass "@none"
|
||||
hsetprop ${scobj_hpath}/analyser type "part"
|
||||
# End of named group: analyser
|
||||
|
||||
# Start of named group: polariser
|
||||
hfactory ${scobj_hpath}/polariser plain spy none
|
||||
|
||||
# Start of var: Amplitude
|
||||
hfactory ${scobj_hpath}/polariser/Amplitude plain user text
|
||||
hsetprop ${scobj_hpath}/polariser/Amplitude control true
|
||||
hsetprop ${scobj_hpath}/polariser/Amplitude data true
|
||||
hsetprop ${scobj_hpath}/polariser/Amplitude mutable true
|
||||
hsetprop ${scobj_hpath}/polariser/Amplitude nxsave true
|
||||
hsetprop ${scobj_hpath}/polariser/Amplitude oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/polariser/Amplitude klass "parameter"
|
||||
hsetprop ${scobj_hpath}/polariser/Amplitude sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/polariser/Amplitude type "part"
|
||||
hsetprop ${scobj_hpath}/polariser/Amplitude nxalias "${name}_polariser_Amplitude"
|
||||
|
||||
# Start of var: Field
|
||||
hfactory ${scobj_hpath}/polariser/Field plain user text
|
||||
hsetprop ${scobj_hpath}/polariser/Field control true
|
||||
hsetprop ${scobj_hpath}/polariser/Field data true
|
||||
hsetprop ${scobj_hpath}/polariser/Field mutable true
|
||||
hsetprop ${scobj_hpath}/polariser/Field nxsave true
|
||||
hsetprop ${scobj_hpath}/polariser/Field units Oersted
|
||||
hsetprop ${scobj_hpath}/polariser/Field oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/polariser/Field klass "parameter"
|
||||
hsetprop ${scobj_hpath}/polariser/Field sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/polariser/Field type "part"
|
||||
hsetprop ${scobj_hpath}/polariser/Field nxalias "${name}_polariser_Field"
|
||||
|
||||
# Start of var: Freq
|
||||
hfactory ${scobj_hpath}/polariser/Freq plain user text
|
||||
hsetprop ${scobj_hpath}/polariser/Freq control true
|
||||
hsetprop ${scobj_hpath}/polariser/Freq data true
|
||||
hsetprop ${scobj_hpath}/polariser/Freq mutable true
|
||||
hsetprop ${scobj_hpath}/polariser/Freq nxsave true
|
||||
hsetprop ${scobj_hpath}/polariser/Freq units Hertz
|
||||
hsetprop ${scobj_hpath}/polariser/Freq oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/polariser/Freq klass "parameter"
|
||||
hsetprop ${scobj_hpath}/polariser/Freq sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/polariser/Freq type "part"
|
||||
hsetprop ${scobj_hpath}/polariser/Freq nxalias "${name}_polariser_Freq"
|
||||
|
||||
# Start of var: Phase
|
||||
hfactory ${scobj_hpath}/polariser/Phase plain user text
|
||||
hsetprop ${scobj_hpath}/polariser/Phase control true
|
||||
hsetprop ${scobj_hpath}/polariser/Phase data true
|
||||
hsetprop ${scobj_hpath}/polariser/Phase mutable true
|
||||
hsetprop ${scobj_hpath}/polariser/Phase nxsave true
|
||||
hsetprop ${scobj_hpath}/polariser/Phase units Degree
|
||||
hsetprop ${scobj_hpath}/polariser/Phase oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/polariser/Phase klass "parameter"
|
||||
hsetprop ${scobj_hpath}/polariser/Phase sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/polariser/Phase type "part"
|
||||
hsetprop ${scobj_hpath}/polariser/Phase nxalias "${name}_polariser_Phase"
|
||||
|
||||
# Start of var: Time2
|
||||
hfactory ${scobj_hpath}/polariser/Time2 plain user text
|
||||
hsetprop ${scobj_hpath}/polariser/Time2 control true
|
||||
hsetprop ${scobj_hpath}/polariser/Time2 data true
|
||||
hsetprop ${scobj_hpath}/polariser/Time2 mutable true
|
||||
hsetprop ${scobj_hpath}/polariser/Time2 nxsave true
|
||||
hsetprop ${scobj_hpath}/polariser/Time2 units Second
|
||||
hsetprop ${scobj_hpath}/polariser/Time2 oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/polariser/Time2 klass "parameter"
|
||||
hsetprop ${scobj_hpath}/polariser/Time2 sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/polariser/Time2 type "part"
|
||||
hsetprop ${scobj_hpath}/polariser/Time2 nxalias "${name}_polariser_Time2"
|
||||
|
||||
# Start of var: spin
|
||||
hfactory ${scobj_hpath}/polariser/spin plain user text
|
||||
hsetprop ${scobj_hpath}/polariser/spin read ${ns}::getValue ${scobj_hpath} rdValue {polariser}
|
||||
hsetprop ${scobj_hpath}/polariser/spin rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/polariser/spin write ${ns}::setValue ${scobj_hpath} chkWrite {polariser}
|
||||
hsetprop ${scobj_hpath}/polariser/spin chkWrite ${ns}::chkWrite ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/polariser/spin check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/polariser/spin control true
|
||||
hsetprop ${scobj_hpath}/polariser/spin data true
|
||||
hsetprop ${scobj_hpath}/polariser/spin mutable true
|
||||
hsetprop ${scobj_hpath}/polariser/spin nxsave true
|
||||
hsetprop ${scobj_hpath}/polariser/spin values +,-,0
|
||||
hsetprop ${scobj_hpath}/polariser/spin oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/polariser/spin klass "parameter"
|
||||
hsetprop ${scobj_hpath}/polariser/spin sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/polariser/spin type "part"
|
||||
hsetprop ${scobj_hpath}/polariser/spin nxalias "${name}_polariser_spin"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/polariser/spin 900
|
||||
${sct_controller} write ${scobj_hpath}/polariser/spin
|
||||
hsetprop ${scobj_hpath}/polariser/spin simulated false
|
||||
} else {
|
||||
::scobj::he3_polanal::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for he3_polanal"
|
||||
hsetprop ${scobj_hpath}/polariser/spin simulated true
|
||||
}
|
||||
hsetprop ${scobj_hpath}/polariser data "true"
|
||||
hsetprop ${scobj_hpath}/polariser klass "@none"
|
||||
hsetprop ${scobj_hpath}/polariser type "part"
|
||||
# End of named group: polariser
|
||||
hsetprop ${scobj_hpath} klass ${device_class}
|
||||
hsetprop ${scobj_hpath} data true
|
||||
hsetprop ${scobj_hpath} debug_threshold 0
|
||||
# mkDriver hook code goes here
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
proc ::scobj::he3_polanal::add_driver {name device_class simulation_flag ip_address tcp_port} {
|
||||
set catch_status [ catch {
|
||||
::scobj::he3_polanal::sics_log 9 "::scobj::he3_polanal::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::he3_polanal::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
|
||||
makesctcontroller sct_${name} aqadapter ${tcp_port}
|
||||
} else {
|
||||
::scobj::he3_polanal::sics_log 9 "makesctcontroller sct_${name} std ${ip_address}:${tcp_port}"
|
||||
makesctcontroller sct_${name} std ${ip_address}:${tcp_port}
|
||||
}
|
||||
} else {
|
||||
::scobj::he3_polanal::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for he3_polanal"
|
||||
::scobj::he3_polanal::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
|
||||
makesctcontroller sct_${name} aqadapter NULL
|
||||
}
|
||||
::scobj::he3_polanal::sics_log 1 "::scobj::he3_polanal::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}"
|
||||
::scobj::he3_polanal::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
namespace eval ::scobj::he3_polanal {
|
||||
namespace export debug_threshold
|
||||
namespace export debug_log
|
||||
namespace export sics_log
|
||||
namespace export mkDriver
|
||||
namespace export add_driver
|
||||
}
|
||||
|
||||
proc add_he3_polanal {name ip_address tcp_port} {
|
||||
set simulation_flag "[string tolower [SplitReply [rfgen_simulation]]]"
|
||||
::scobj::he3_polanal::add_driver ${name} "instrument" ${simulation_flag} ${ip_address} ${tcp_port}
|
||||
}
|
||||
|
||||
clientput "file evaluation of sct_he3_polanal.tcl"
|
||||
::scobj::he3_polanal::sics_log 9 "file evaluation of sct_he3_polanal.tcl"
|
||||
|
||||
proc ::scobj::he3_polanal::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::he3_polanal"
|
||||
dict for {k u} $::config_dict {
|
||||
if { [dict exists $u "implementation"] } {
|
||||
set simulation_flag "[string tolower [SplitReply [rfgen_simulation]]]"
|
||||
set device_class "instrument"
|
||||
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"] "he3_polanal"] } {
|
||||
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} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::he3_polanal::read_config
|
||||
} else {
|
||||
::scobj::he3_polanal::sics_log 5 "No config dict"
|
||||
}
|
@ -0,0 +1,177 @@
|
||||
# Generated driver for bruker
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::bruker {
|
||||
set debug_threshold 5
|
||||
}
|
||||
|
||||
proc ::scobj::bruker::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 fd [open "../log/bruker_[basename ${tc_root}].log" "a"]
|
||||
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
|
||||
puts ${fd} "${line}"
|
||||
close ${fd}
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc ::scobj::bruker::sics_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
set debug_threshold ${::scobj::bruker::debug_threshold}
|
||||
if {${debug_level} >= ${debug_threshold}} {
|
||||
sicslog "::scobj::bruker::${debug_string}"
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc ::scobj::bruker::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype tol } {
|
||||
::scobj::bruker::sics_log 9 "::scobj::bruker::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}"
|
||||
set ns "[namespace current]"
|
||||
set catch_status [ catch {
|
||||
|
||||
# mkWrapper hook code starts
|
||||
add_bruker_BEC1 $name $ip_address $tcp_port $tol
|
||||
# mkWrapper hook code ends
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
proc ::scobj::bruker::add_driver {name device_class simulation_flag ip_address tcp_port id datype {tol 0.1}} {
|
||||
set catch_status [ catch {
|
||||
::scobj::bruker::sics_log 9 "::scobj::bruker::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}"
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
|
||||
::scobj::bruker::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
|
||||
makesctcontroller sct_${name} aqadapter ${tcp_port}
|
||||
} else {
|
||||
::scobj::bruker::sics_log 9 "makesctcontroller sct_${name} astvelsel ${ip_address}:${tcp_port}"
|
||||
makesctcontroller sct_${name} astvelsel ${ip_address}:${tcp_port}
|
||||
}
|
||||
} else {
|
||||
::scobj::bruker::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for bruker"
|
||||
::scobj::bruker::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
|
||||
makesctcontroller sct_${name} aqadapter NULL
|
||||
}
|
||||
::scobj::bruker::sics_log 1 "::scobj::bruker::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}"
|
||||
::scobj::bruker::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
namespace eval ::scobj::bruker {
|
||||
namespace export debug_threshold
|
||||
namespace export debug_log
|
||||
namespace export sics_log
|
||||
namespace export mkDriver
|
||||
namespace export add_driver
|
||||
}
|
||||
|
||||
proc add_bruker {name ip_address tcp_port id datype {tol 0.1}} {
|
||||
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
||||
::scobj::bruker::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${tol}
|
||||
}
|
||||
|
||||
clientput "file evaluation of sct_bruker.tcl"
|
||||
::scobj::bruker::sics_log 9 "file evaluation of sct_bruker.tcl"
|
||||
|
||||
proc ::scobj::bruker::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::bruker"
|
||||
dict for {k u} $::config_dict {
|
||||
if { [dict exists $u "implementation"] } {
|
||||
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
||||
set device_class "environment"
|
||||
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"] "bruker"] } {
|
||||
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} astvelsel ${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}
|
||||
}
|
||||
set arg_list [list]
|
||||
set missing_list [list]
|
||||
foreach arg {id datype tol} {
|
||||
if {[dict exists $u $arg]} {
|
||||
lappend arg_list "[dict get $u $arg]"
|
||||
} elseif {[dict exists $v $arg]} {
|
||||
lappend arg_list "[dict get $v $arg]"
|
||||
} else {
|
||||
${ns}::sics_log 9 "Missing configuration value $arg"
|
||||
lappend missing_list $arg
|
||||
}
|
||||
}
|
||||
if { [llength $missing_list] > 0 } {
|
||||
error "$name is missing configuration values $missing_list"
|
||||
}
|
||||
${ns}::mkDriver sct_${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::bruker::read_config
|
||||
} else {
|
||||
::scobj::bruker::sics_log 5 "No config dict"
|
||||
}
|
126
site_ansto/instrument/config/environment/mvp_valve_sct.tcl
Normal file
126
site_ansto/instrument/config/environment/mvp_valve_sct.tcl
Normal file
@ -0,0 +1,126 @@
|
||||
# Generated driver for mvp_valve
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::mvp_valve {
|
||||
set debug_threshold 5
|
||||
}
|
||||
|
||||
proc ::scobj::mvp_valve::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 fd [open "../log/mvp_valve_[basename ${tc_root}].log" "a"]
|
||||
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
|
||||
puts ${fd} "${line}"
|
||||
close ${fd}
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc ::scobj::mvp_valve::sics_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
set debug_threshold ${::scobj::mvp_valve::debug_threshold}
|
||||
if {${debug_level} >= ${debug_threshold}} {
|
||||
sicslog "::scobj::mvp_valve::${debug_string}"
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc ::scobj::mvp_valve::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype } {
|
||||
::scobj::mvp_valve::sics_log 9 "::scobj::mvp_valve::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}"
|
||||
set ns "[namespace current]"
|
||||
set catch_status [ catch {
|
||||
|
||||
# mkWrapper hook code starts
|
||||
add_mvp $name $ip_address $tcp_port a
|
||||
# mkWrapper hook code ends
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
proc ::scobj::mvp_valve::add_driver {name device_class simulation_flag ip_address tcp_port id datype} {
|
||||
set catch_status [ catch {
|
||||
::scobj::mvp_valve::sics_log 9 "::scobj::mvp_valve::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}"
|
||||
::scobj::mvp_valve::sics_log 9 "No sctcontroller for mvp_valve"
|
||||
::scobj::mvp_valve::sics_log 1 "::scobj::mvp_valve::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}"
|
||||
::scobj::mvp_valve::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
namespace eval ::scobj::mvp_valve {
|
||||
namespace export debug_threshold
|
||||
namespace export debug_log
|
||||
namespace export sics_log
|
||||
namespace export mkDriver
|
||||
namespace export add_driver
|
||||
}
|
||||
|
||||
proc add_mvp_valve {name ip_address tcp_port id datype} {
|
||||
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
||||
::scobj::mvp_valve::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}
|
||||
}
|
||||
|
||||
clientput "file evaluation of sct_mvp_valve.tcl"
|
||||
::scobj::mvp_valve::sics_log 9 "file evaluation of sct_mvp_valve.tcl"
|
||||
|
||||
proc ::scobj::mvp_valve::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::mvp_valve"
|
||||
dict for {k u} $::config_dict {
|
||||
if { [dict exists $u "implementation"] } {
|
||||
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
||||
set device_class "environment"
|
||||
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"] "mvp_valve"] } {
|
||||
::scobj::mvp_valve::sics_log 9 "No sctcontroller for mvp_valve"
|
||||
set arg_list [list]
|
||||
set missing_list [list]
|
||||
foreach arg {id datype} {
|
||||
if {[dict exists $u $arg]} {
|
||||
lappend arg_list "[dict get $u $arg]"
|
||||
} elseif {[dict exists $v $arg]} {
|
||||
lappend arg_list "[dict get $v $arg]"
|
||||
} else {
|
||||
${ns}::sics_log 9 "Missing configuration value $arg"
|
||||
lappend missing_list $arg
|
||||
}
|
||||
}
|
||||
if { [llength $missing_list] > 0 } {
|
||||
error "$name is missing configuration values $missing_list"
|
||||
}
|
||||
${ns}::mkDriver sct_${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::mvp_valve::read_config
|
||||
} else {
|
||||
::scobj::mvp_valve::sics_log 5 "No config dict"
|
||||
}
|
177
site_ansto/instrument/config/environment/syringe_pump_sct.tcl
Normal file
177
site_ansto/instrument/config/environment/syringe_pump_sct.tcl
Normal file
@ -0,0 +1,177 @@
|
||||
# Generated driver for syringe_pump
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::syringe_pump {
|
||||
set debug_threshold 5
|
||||
}
|
||||
|
||||
proc ::scobj::syringe_pump::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 fd [open "../log/syringe_pump_[basename ${tc_root}].log" "a"]
|
||||
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
|
||||
puts ${fd} "${line}"
|
||||
close ${fd}
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc ::scobj::syringe_pump::sics_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
set debug_threshold ${::scobj::syringe_pump::debug_threshold}
|
||||
if {${debug_level} >= ${debug_threshold}} {
|
||||
sicslog "::scobj::syringe_pump::${debug_string}"
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc ::scobj::syringe_pump::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype } {
|
||||
::scobj::syringe_pump::sics_log 9 "::scobj::syringe_pump::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}"
|
||||
set ns "[namespace current]"
|
||||
set catch_status [ catch {
|
||||
|
||||
# mkWrapper hook code starts
|
||||
::scobj::syr::mk_sct_syr $sct_controller environment $name
|
||||
# mkWrapper hook code ends
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
proc ::scobj::syringe_pump::add_driver {name device_class simulation_flag ip_address tcp_port id datype} {
|
||||
set catch_status [ catch {
|
||||
::scobj::syringe_pump::sics_log 9 "::scobj::syringe_pump::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}"
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
|
||||
::scobj::syringe_pump::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
|
||||
makesctcontroller sct_${name} aqadapter ${tcp_port}
|
||||
} else {
|
||||
::scobj::syringe_pump::sics_log 9 "makesctcontroller sct_${name} syringe ${ip_address}:${tcp_port}"
|
||||
makesctcontroller sct_${name} syringe ${ip_address}:${tcp_port}
|
||||
}
|
||||
} else {
|
||||
::scobj::syringe_pump::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for syringe_pump"
|
||||
::scobj::syringe_pump::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
|
||||
makesctcontroller sct_${name} aqadapter NULL
|
||||
}
|
||||
::scobj::syringe_pump::sics_log 1 "::scobj::syringe_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}"
|
||||
::scobj::syringe_pump::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
namespace eval ::scobj::syringe_pump {
|
||||
namespace export debug_threshold
|
||||
namespace export debug_log
|
||||
namespace export sics_log
|
||||
namespace export mkDriver
|
||||
namespace export add_driver
|
||||
}
|
||||
|
||||
proc add_syringe_pump {name ip_address tcp_port id datype} {
|
||||
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
||||
::scobj::syringe_pump::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype}
|
||||
}
|
||||
|
||||
clientput "file evaluation of sct_syringe_pump.tcl"
|
||||
::scobj::syringe_pump::sics_log 9 "file evaluation of sct_syringe_pump.tcl"
|
||||
|
||||
proc ::scobj::syringe_pump::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::syringe_pump"
|
||||
dict for {k u} $::config_dict {
|
||||
if { [dict exists $u "implementation"] } {
|
||||
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
||||
set device_class "environment"
|
||||
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"] "syringe_pump"] } {
|
||||
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} syringe ${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}
|
||||
}
|
||||
set arg_list [list]
|
||||
set missing_list [list]
|
||||
foreach arg {id datype} {
|
||||
if {[dict exists $u $arg]} {
|
||||
lappend arg_list "[dict get $u $arg]"
|
||||
} elseif {[dict exists $v $arg]} {
|
||||
lappend arg_list "[dict get $v $arg]"
|
||||
} else {
|
||||
${ns}::sics_log 9 "Missing configuration value $arg"
|
||||
lappend missing_list $arg
|
||||
}
|
||||
}
|
||||
if { [llength $missing_list] > 0 } {
|
||||
error "$name is missing configuration values $missing_list"
|
||||
}
|
||||
${ns}::mkDriver sct_${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::syringe_pump::read_config
|
||||
} else {
|
||||
::scobj::syringe_pump::sics_log 5 "No config dict"
|
||||
}
|
@ -0,0 +1,727 @@
|
||||
# Generated driver for eurotherm_3200
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::eurotherm_3200 {
|
||||
set debug_threshold 5
|
||||
}
|
||||
|
||||
proc ::scobj::eurotherm_3200::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 fd [open "../log/eurotherm_3200_[basename ${tc_root}].log" "a"]
|
||||
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
|
||||
puts ${fd} "${line}"
|
||||
close ${fd}
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc ::scobj::eurotherm_3200::sics_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
set debug_threshold ${::scobj::eurotherm_3200::debug_threshold}
|
||||
if {${debug_level} >= ${debug_threshold}} {
|
||||
sicslog "::scobj::eurotherm_3200::${debug_string}"
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
# checklimits function for driveable interface
|
||||
proc ::scobj::eurotherm_3200::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::eurotherm_3200::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::eurotherm_3200::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}"
|
||||
hset ${tc_root}/[sct driveable] ${sp}
|
||||
}
|
||||
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::eurotherm_3200::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 starts
|
||||
if { [string equal -nocase [hval ${tc_root}/util/mode] "float"] } {
|
||||
set cmd "[hval ${tc_root}/util/unit]:3:[expr {32768+2*${cmd_str}}]:1:F32"
|
||||
} else {
|
||||
set cmd "[hval ${tc_root}/util/unit]:3:${cmd_str}:1:U16"
|
||||
}
|
||||
# getValue hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
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::eurotherm_3200::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::eurotherm_3200::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::eurotherm_3200::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 write a parameter value on a device
|
||||
proc ::scobj::eurotherm_3200::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 starts
|
||||
if { [string equal -nocase [hval ${tc_root}/util/mode] "float"] } {
|
||||
set cmd "[hval ${tc_root}/util/unit]:16:[expr {32768+2*${cmd_str}}]:1:F32:${par}"
|
||||
} else {
|
||||
set cmd "[hval ${tc_root}/util/unit]:16:${cmd_str}:1:U16:${par}"
|
||||
}
|
||||
# setValue hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log ${tc_root} 9 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
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::eurotherm_3200::mkDriver { sct_controller name device_class simulation_flag ip_address tcp_port id datype dev_id tol } {
|
||||
::scobj::eurotherm_3200::sics_log 9 "::scobj::eurotherm_3200::mkDriver ${sct_controller} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
|
||||
set ns "[namespace current]"
|
||||
set catch_status [ catch {
|
||||
|
||||
MakeSICSObj ${name} SCT_OBJECT
|
||||
|
||||
sicslist setatt ${name} klass ${device_class}
|
||||
sicslist setatt ${name} long_name ${name}
|
||||
|
||||
set scobj_hpath /sics/${name}
|
||||
|
||||
# Start of named group: loop1
|
||||
hfactory ${scobj_hpath}/loop1 plain spy none
|
||||
|
||||
# Start of var: sensor
|
||||
hfactory ${scobj_hpath}/loop1/sensor plain user float
|
||||
hsetprop ${scobj_hpath}/loop1/sensor read ${ns}::getValue ${scobj_hpath} rdValue {1}
|
||||
hsetprop ${scobj_hpath}/loop1/sensor rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1/sensor control true
|
||||
hsetprop ${scobj_hpath}/loop1/sensor data true
|
||||
hsetprop ${scobj_hpath}/loop1/sensor mutable true
|
||||
hsetprop ${scobj_hpath}/loop1/sensor nxsave true
|
||||
hsetprop ${scobj_hpath}/loop1/sensor permlink data_set "T[format "%02d" ${id}]S01"
|
||||
hsetprop ${scobj_hpath}/loop1/sensor @description "T[format "%02d" ${id}]S01"
|
||||
hsetprop ${scobj_hpath}/loop1/sensor oldval 0.0
|
||||
hsetprop ${scobj_hpath}/loop1/sensor klass "parameter"
|
||||
hsetprop ${scobj_hpath}/loop1/sensor sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/loop1/sensor type "part"
|
||||
hsetprop ${scobj_hpath}/loop1/sensor nxalias "${name}_loop1_sensor"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/loop1/sensor 1
|
||||
hsetprop ${scobj_hpath}/loop1/sensor simulated false
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
|
||||
hsetprop ${scobj_hpath}/loop1/sensor simulated true
|
||||
}
|
||||
|
||||
# Start of var: setpoint
|
||||
hfactory ${scobj_hpath}/loop1/setpoint plain user float
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint read ${ns}::getValue ${scobj_hpath} rdValue {2}
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint write ${ns}::setValue ${scobj_hpath} noResponse {2}
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint noResponse ${ns}::noResponse ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint driving 0
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint checklimits ${ns}::checklimits ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint checkstatus ${ns}::checkstatus ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint halt ${ns}::halt ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint driveable loop1/sensor
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint control true
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint data true
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint mutable true
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint nxsave true
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint lowerlimit 0
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint upperlimit 40
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint tolerance ${tol}
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint permlink data_set "T[format "%02d" ${id}]SP01"
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint @description "T[format "%02d" ${id}]SP01"
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint oldval 0.0
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint klass "parameter"
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint type "drivable"
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint nxalias "${name}_loop1_setpoint"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/loop1/setpoint 1
|
||||
${sct_controller} write ${scobj_hpath}/loop1/setpoint
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint simulated false
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
|
||||
hsetprop ${scobj_hpath}/loop1/setpoint simulated true
|
||||
}
|
||||
hsetprop ${scobj_hpath}/loop1 data "true"
|
||||
hsetprop ${scobj_hpath}/loop1 klass "@none"
|
||||
hsetprop ${scobj_hpath}/loop1 type "part"
|
||||
# End of named group: loop1
|
||||
ansto_makesctdrive ${name}_loop1_setpoint ${scobj_hpath}/loop1/setpoint ${scobj_hpath}/loop1/sensor ${sct_controller}
|
||||
|
||||
# Start of named group: loop1_extra
|
||||
hfactory ${scobj_hpath}/loop1_extra plain spy none
|
||||
|
||||
# Start of var: active_setpoint
|
||||
hfactory ${scobj_hpath}/loop1_extra/active_setpoint plain user float
|
||||
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint read ${ns}::getValue ${scobj_hpath} rdValue {15}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint control false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint data false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint mutable false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint nxsave false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint oldval 0.0
|
||||
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint type "part"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint nxalias "${name}_loop1_extra_active_setpoint"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/loop1_extra/active_setpoint 1
|
||||
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint simulated false
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/active_setpoint simulated true
|
||||
}
|
||||
|
||||
# Start of var: alarm1_thresh
|
||||
hfactory ${scobj_hpath}/loop1_extra/alarm1_thresh plain user float
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh read ${ns}::getValue ${scobj_hpath} rdValue {13}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh write ${ns}::setValue ${scobj_hpath} noResponse {13}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh noResponse ${ns}::noResponse ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh control false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh data false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh mutable false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh nxsave false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh oldval 0.0
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh type "part"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh nxalias "${name}_loop1_extra_alarm1_thresh"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/loop1_extra/alarm1_thresh 1
|
||||
${sct_controller} write ${scobj_hpath}/loop1_extra/alarm1_thresh
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh simulated false
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm1_thresh simulated true
|
||||
}
|
||||
|
||||
# Start of var: alarm2_thresh
|
||||
hfactory ${scobj_hpath}/loop1_extra/alarm2_thresh plain user float
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh read ${ns}::getValue ${scobj_hpath} rdValue {14}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh write ${ns}::setValue ${scobj_hpath} noResponse {14}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh noResponse ${ns}::noResponse ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh control false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh data false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh mutable false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh nxsave false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh oldval 0.0
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh type "part"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh nxalias "${name}_loop1_extra_alarm2_thresh"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/loop1_extra/alarm2_thresh 1
|
||||
${sct_controller} write ${scobj_hpath}/loop1_extra/alarm2_thresh
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh simulated false
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/alarm2_thresh simulated true
|
||||
}
|
||||
|
||||
# Start of var: manual_output
|
||||
hfactory ${scobj_hpath}/loop1_extra/manual_output plain user float
|
||||
hsetprop ${scobj_hpath}/loop1_extra/manual_output read ${ns}::getValue ${scobj_hpath} rdValue {3}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/manual_output rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/manual_output control false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/manual_output data false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/manual_output mutable false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/manual_output nxsave false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/manual_output oldval 0.0
|
||||
hsetprop ${scobj_hpath}/loop1_extra/manual_output sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/manual_output type "part"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/manual_output nxalias "${name}_loop1_extra_manual_output"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/loop1_extra/manual_output 1
|
||||
hsetprop ${scobj_hpath}/loop1_extra/manual_output simulated false
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/manual_output simulated true
|
||||
}
|
||||
|
||||
# Start of var: power_limit_high
|
||||
hfactory ${scobj_hpath}/loop1_extra/power_limit_high plain user float
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high read ${ns}::getValue ${scobj_hpath} rdValue {30}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high write ${ns}::setValue ${scobj_hpath} noResponse {30}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high noResponse ${ns}::noResponse ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high control false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high data false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high mutable false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high nxsave false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high oldval 0.0
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high type "part"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high nxalias "${name}_loop1_extra_power_limit_high"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/loop1_extra/power_limit_high 1
|
||||
${sct_controller} write ${scobj_hpath}/loop1_extra/power_limit_high
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high simulated false
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_high simulated true
|
||||
}
|
||||
|
||||
# Start of var: power_limit_low
|
||||
hfactory ${scobj_hpath}/loop1_extra/power_limit_low plain user float
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low read ${ns}::getValue ${scobj_hpath} rdValue {31}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low write ${ns}::setValue ${scobj_hpath} noResponse {31}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low noResponse ${ns}::noResponse ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low control false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low data false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low mutable false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low nxsave false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low oldval 0.0
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low type "part"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low nxalias "${name}_loop1_extra_power_limit_low"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/loop1_extra/power_limit_low 1
|
||||
${sct_controller} write ${scobj_hpath}/loop1_extra/power_limit_low
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low simulated false
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_limit_low simulated true
|
||||
}
|
||||
|
||||
# Start of var: power_slew_rate
|
||||
hfactory ${scobj_hpath}/loop1_extra/power_slew_rate plain user float
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate read ${ns}::getValue ${scobj_hpath} rdValue {37}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate write ${ns}::setValue ${scobj_hpath} noResponse {37}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate noResponse ${ns}::noResponse ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate control false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate data false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate mutable false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate nxsave false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate oldval 0.0
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate type "part"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate nxalias "${name}_loop1_extra_power_slew_rate"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/loop1_extra/power_slew_rate 1
|
||||
${sct_controller} write ${scobj_hpath}/loop1_extra/power_slew_rate
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate simulated false
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/power_slew_rate simulated true
|
||||
}
|
||||
|
||||
# Start of var: setpoint_slew_rate
|
||||
hfactory ${scobj_hpath}/loop1_extra/setpoint_slew_rate plain user float
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate read ${ns}::getValue ${scobj_hpath} rdValue {35}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate write ${ns}::setValue ${scobj_hpath} noResponse {35}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate noResponse ${ns}::noResponse ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate control false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate data false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate mutable false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate nxsave false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate oldval 0.0
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate type "part"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate nxalias "${name}_loop1_extra_setpoint_slew_rate"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/loop1_extra/setpoint_slew_rate 1
|
||||
${sct_controller} write ${scobj_hpath}/loop1_extra/setpoint_slew_rate
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate simulated false
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/setpoint_slew_rate simulated true
|
||||
}
|
||||
|
||||
# Start of var: working_output
|
||||
hfactory ${scobj_hpath}/loop1_extra/working_output plain user float
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_output read ${ns}::getValue ${scobj_hpath} rdValue {4}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_output rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_output control false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_output data false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_output mutable false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_output nxsave false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_output oldval 0.0
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_output sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_output type "part"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_output nxalias "${name}_loop1_extra_working_output"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/loop1_extra/working_output 1
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_output simulated false
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_output simulated true
|
||||
}
|
||||
|
||||
# Start of var: working_setpoint
|
||||
hfactory ${scobj_hpath}/loop1_extra/working_setpoint plain user float
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint read ${ns}::getValue ${scobj_hpath} rdValue {5}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint control false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint data false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint mutable false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint nxsave false
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint oldval 0.0
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint type "part"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint nxalias "${name}_loop1_extra_working_setpoint"
|
||||
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
${sct_controller} poll ${scobj_hpath}/loop1_extra/working_setpoint 1
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint simulated false
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => No poll/write for eurotherm_3200"
|
||||
hsetprop ${scobj_hpath}/loop1_extra/working_setpoint simulated true
|
||||
}
|
||||
hsetprop ${scobj_hpath}/loop1_extra data "false"
|
||||
hsetprop ${scobj_hpath}/loop1_extra klass "@none"
|
||||
hsetprop ${scobj_hpath}/loop1_extra type "part"
|
||||
# End of named group: loop1_extra
|
||||
|
||||
# Start of named group: util
|
||||
hfactory ${scobj_hpath}/util plain spy none
|
||||
|
||||
# Start of var: mode
|
||||
hfactory ${scobj_hpath}/util/mode plain user text
|
||||
hsetprop ${scobj_hpath}/util/mode control false
|
||||
hsetprop ${scobj_hpath}/util/mode data false
|
||||
hsetprop ${scobj_hpath}/util/mode mutable false
|
||||
hsetprop ${scobj_hpath}/util/mode nxsave false
|
||||
hsetprop ${scobj_hpath}/util/mode values int,float
|
||||
hsetprop ${scobj_hpath}/util/mode oldval int
|
||||
hset ${scobj_hpath}/util/mode int
|
||||
hsetprop ${scobj_hpath}/util/mode sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/util/mode type "part"
|
||||
hsetprop ${scobj_hpath}/util/mode nxalias "${name}_util_mode"
|
||||
|
||||
# Start of var: unit
|
||||
hfactory ${scobj_hpath}/util/unit plain user int
|
||||
hsetprop ${scobj_hpath}/util/unit control false
|
||||
hsetprop ${scobj_hpath}/util/unit data false
|
||||
hsetprop ${scobj_hpath}/util/unit mutable false
|
||||
hsetprop ${scobj_hpath}/util/unit nxsave false
|
||||
hsetprop ${scobj_hpath}/util/unit oldval ${dev_id}
|
||||
hset ${scobj_hpath}/util/unit ${dev_id}
|
||||
hsetprop ${scobj_hpath}/util/unit sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/util/unit type "part"
|
||||
hsetprop ${scobj_hpath}/util/unit nxalias "${name}_util_unit"
|
||||
hsetprop ${scobj_hpath}/util data "false"
|
||||
hsetprop ${scobj_hpath}/util klass "@none"
|
||||
hsetprop ${scobj_hpath}/util type "part"
|
||||
# End of named group: util
|
||||
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::eurotherm_3200::add_driver {name device_class simulation_flag ip_address tcp_port id datype dev_id tol} {
|
||||
set catch_status [ catch {
|
||||
::scobj::eurotherm_3200::sics_log 9 "::scobj::eurotherm_3200::add_driver ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
|
||||
if {[string equal -nocase "${simulation_flag}" "false"]} {
|
||||
if {[string equal -nocase "aqadapter" "${ip_address}"]} {
|
||||
::scobj::eurotherm_3200::sics_log 9 "makesctcontroller sct_${name} aqadapter ${tcp_port}"
|
||||
makesctcontroller sct_${name} aqadapter ${tcp_port}
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}"
|
||||
makesctcontroller sct_${name} modbus_ap ${ip_address}:${tcp_port}
|
||||
}
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 9 "simulation_flag=${simulation_flag} => Null sctcontroller for eurotherm_3200"
|
||||
::scobj::eurotherm_3200::sics_log 9 "makesctcontroller sct_${name} aqadapter NULL"
|
||||
makesctcontroller sct_${name} aqadapter NULL
|
||||
}
|
||||
::scobj::eurotherm_3200::sics_log 1 "::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}"
|
||||
::scobj::eurotherm_3200::mkDriver sct_${name} ${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
namespace eval ::scobj::eurotherm_3200 {
|
||||
namespace export debug_threshold
|
||||
namespace export debug_log
|
||||
namespace export sics_log
|
||||
namespace export mkDriver
|
||||
namespace export add_driver
|
||||
}
|
||||
|
||||
proc add_eurotherm_3200 {name ip_address tcp_port id datype dev_id tol} {
|
||||
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
||||
::scobj::eurotherm_3200::add_driver ${name} "environment" ${simulation_flag} ${ip_address} ${tcp_port} ${id} ${datype} ${dev_id} ${tol}
|
||||
}
|
||||
|
||||
clientput "file evaluation of sct_eurotherm_3200.tcl"
|
||||
::scobj::eurotherm_3200::sics_log 9 "file evaluation of sct_eurotherm_3200.tcl"
|
||||
|
||||
proc ::scobj::eurotherm_3200::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::eurotherm_3200"
|
||||
dict for {k u} $::config_dict {
|
||||
if { [dict exists $u "implementation"] } {
|
||||
set simulation_flag "[string tolower [SplitReply [environment_simulation]]]"
|
||||
set device_class "environment"
|
||||
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"] "eurotherm_3200"] } {
|
||||
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} modbus_ap ${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}
|
||||
}
|
||||
set arg_list [list]
|
||||
set missing_list [list]
|
||||
foreach arg {id datype dev_id tol} {
|
||||
if {[dict exists $u $arg]} {
|
||||
lappend arg_list "[dict get $u $arg]"
|
||||
} elseif {[dict exists $v $arg]} {
|
||||
lappend arg_list "[dict get $v $arg]"
|
||||
} else {
|
||||
${ns}::sics_log 9 "Missing configuration value $arg"
|
||||
lappend missing_list $arg
|
||||
}
|
||||
}
|
||||
if { [llength $missing_list] > 0 } {
|
||||
error "$name is missing configuration values $missing_list"
|
||||
}
|
||||
${ns}::mkDriver sct_${name} ${device_class} ${simulation_flag} ${ip_address} ${tcp_port} {*}$arg_list
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::eurotherm_3200::read_config
|
||||
} else {
|
||||
::scobj::eurotherm_3200::sics_log 5 "No config dict"
|
||||
}
|
Reference in New Issue
Block a user