Merge branch 'RELEASE-3_1' into RELEASE-3_2
This commit is contained in:
@ -3,7 +3,6 @@ driver agilent_33220A = {
|
||||
protocol = std
|
||||
class = environment
|
||||
simulation_group = environment_simulation
|
||||
code mkDriver = {%%
|
||||
makesctcontroller $name $ip $port
|
||||
code mkWrapper = {%%
|
||||
%%}
|
||||
}
|
||||
|
@ -32,18 +32,8 @@ proc ::scobj::agilent_33220A::mkDriver { sct_controller name } {
|
||||
set ns "[namespace current]"
|
||||
set catch_status [ catch {
|
||||
|
||||
MakeSICSObj ${name} SCT_OBJECT
|
||||
|
||||
sicslist setatt ${name} klass environment
|
||||
sicslist setatt ${name} long_name ${name}
|
||||
|
||||
set scobj_hpath /sics/${name}
|
||||
hsetprop ${scobj_hpath} klass environment
|
||||
hsetprop ${scobj_hpath} data true
|
||||
hsetprop ${scobj_hpath} debug_threshold 5
|
||||
# mkDriver hook code starts
|
||||
makesctcontroller $name $ip $port
|
||||
# mkDriver hook code ends
|
||||
# mkWrapper hook code starts
|
||||
# mkWrapper hook code ends
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent
|
||||
driver green_magnet_labview = {
|
||||
wrapper_property nosctcontroller = true;
|
||||
protocol = std
|
||||
class = environment
|
||||
simulation_group = environment_simulation
|
||||
code mkWrapper = {
|
||||
@TCL
|
||||
# TCL code
|
||||
::scobj::green::mkGreen {
|
||||
name "green_magnet"
|
||||
IP 137.157.201.88
|
||||
PORT 5001
|
||||
tuning 1
|
||||
interval 3
|
||||
}
|
||||
@END
|
||||
}
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
# Generated driver for green_magnet_labview
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::green_magnet_labview {
|
||||
set debug_threshold 5
|
||||
}
|
||||
|
||||
proc ::scobj::green_magnet_labview::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/green_magnet_labview_[basename ${tc_root}].log" "a"]
|
||||
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
|
||||
puts ${fd} "${line}"
|
||||
close ${fd}
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc ::scobj::green_magnet_labview::sics_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
set debug_threshold ${::scobj::green_magnet_labview::debug_threshold}
|
||||
if {${debug_level} >= ${debug_threshold}} {
|
||||
sicslog "::scobj::green_magnet_labview::${debug_string}"
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc ::scobj::green_magnet_labview::mkDriver { sct_controller name } {
|
||||
::scobj::green_magnet_labview::sics_log 9 "::scobj::green_magnet_labview::mkDriver for ${name}"
|
||||
set ns "[namespace current]"
|
||||
set catch_status [ catch {
|
||||
|
||||
# mkWrapper hook code starts
|
||||
# TCL code
|
||||
::scobj::green::mkGreen {
|
||||
name "green_magnet"
|
||||
IP 137.157.201.88
|
||||
PORT 5001
|
||||
tuning 1
|
||||
interval 3
|
||||
}
|
||||
# mkWrapper hook code ends
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
namespace eval ::scobj::green_magnet_labview {
|
||||
namespace export debug_threshold
|
||||
namespace export debug_log
|
||||
namespace export sics_log
|
||||
namespace export mkDriver
|
||||
}
|
||||
|
||||
proc add_green_magnet_labview {name IP port} {
|
||||
set catch_status [ catch {
|
||||
::scobj::green_magnet_labview::sics_log 9 "add_green_magnet_labview ${name} ${IP} ${port}"
|
||||
::scobj::green_magnet_labview::sics_log 9 "No sctcontroller for green_magnet_labview"
|
||||
::scobj::green_magnet_labview::sics_log 1 "::scobj::green_magnet_labview::mkDriver sct_${name} ${name}"
|
||||
::scobj::green_magnet_labview::mkDriver sct_${name} ${name}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
clientput "file evaluation of green_magnet_labview_sct.tcl"
|
||||
::scobj::green_magnet_labview::sics_log 9 "file evaluation of green_magnet_labview_sct.tcl"
|
||||
|
||||
proc ::scobj::green_magnet_labview::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::green_magnet_labview"
|
||||
dict for {k u} $::config_dict {
|
||||
if { [dict exists $u "implementation"] } {
|
||||
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
|
||||
}
|
||||
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"] "green_magnet_labview"] } {
|
||||
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
|
||||
set asyncqueue "null"
|
||||
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
|
||||
} elseif { [dict exists $v "asyncqueue"] } {
|
||||
set asyncqueue [dict get $v "asyncqueue"]
|
||||
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
}
|
||||
} else {
|
||||
if { [dict exists $v "asyncprotocol"] } {
|
||||
set asyncprotocol [dict get $v "asyncprotocol"]
|
||||
} else {
|
||||
set asyncprotocol ${name}_protocol
|
||||
MakeAsyncProtocol ${asyncprotocol}
|
||||
if { [dict exists $v "terminator"] } {
|
||||
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
|
||||
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
|
||||
}
|
||||
}
|
||||
set asyncqueue ${name}_queue
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
|
||||
if { [dict exists $v "timeout"] } {
|
||||
${asyncqueue} timeout "[dict get $v "timeout"]"
|
||||
}
|
||||
}
|
||||
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
||||
add_green_magnet_labview ${name} ${IP} ${PORT}
|
||||
} else {
|
||||
add_green_magnet_labview ${name} "aqadapter" ${asyncqueue}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::green_magnet_labview::read_config
|
||||
} else {
|
||||
::scobj::green_magnet_labview::sics_log 5 "No config dict"
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent
|
||||
driver oxford12tlv = {
|
||||
protocol = std
|
||||
class = environment
|
||||
simulation_group = environment_simulation
|
||||
add_args = 'id datype interval'
|
||||
make_args = 'id datype interval'
|
||||
code mkDriver = {%%
|
||||
::scobj::magnetic::mkMagnetic [subst {
|
||||
NAME $name
|
||||
SCTCONTROLLER $sct_controller
|
||||
TUNING 1
|
||||
INTERVAL $interval
|
||||
}]
|
||||
%%}
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
# Generated driver for oxford12tlv
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::oxford12tlv {
|
||||
set debug_threshold 5
|
||||
}
|
||||
|
||||
proc ::scobj::oxford12tlv::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/oxford12tlv_[basename ${tc_root}].log" "a"]
|
||||
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
|
||||
puts ${fd} "${line}"
|
||||
close ${fd}
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc ::scobj::oxford12tlv::sics_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
set debug_threshold ${::scobj::oxford12tlv::debug_threshold}
|
||||
if {${debug_level} >= ${debug_threshold}} {
|
||||
sicslog "::scobj::oxford12tlv::${debug_string}"
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc ::scobj::oxford12tlv::mkDriver { sct_controller name id datype interval } {
|
||||
::scobj::oxford12tlv::sics_log 9 "::scobj::oxford12tlv::mkDriver ${sct_controller} ${name} ${id} ${datype} ${interval}"
|
||||
set ns "[namespace current]"
|
||||
set catch_status [ catch {
|
||||
|
||||
MakeSICSObj ${name} SCT_OBJECT
|
||||
|
||||
sicslist setatt ${name} klass environment
|
||||
sicslist setatt ${name} long_name ${name}
|
||||
|
||||
set scobj_hpath /sics/${name}
|
||||
hsetprop ${scobj_hpath} klass environment
|
||||
hsetprop ${scobj_hpath} data true
|
||||
hsetprop ${scobj_hpath} debug_threshold 5
|
||||
# mkDriver hook code starts
|
||||
::scobj::magnetic::mkMagnetic [subst {
|
||||
NAME $name
|
||||
SCTCONTROLLER $sct_controller
|
||||
TUNING 1
|
||||
INTERVAL $interval
|
||||
}]
|
||||
# mkDriver hook code ends
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
namespace eval ::scobj::oxford12tlv {
|
||||
namespace export debug_threshold
|
||||
namespace export debug_log
|
||||
namespace export sics_log
|
||||
namespace export mkDriver
|
||||
}
|
||||
|
||||
proc add_oxford12tlv {name IP port id datype interval} {
|
||||
set catch_status [ catch {
|
||||
::scobj::oxford12tlv::sics_log 9 "add_oxford12tlv ${name} ${IP} ${port} ${id} ${datype} ${interval}"
|
||||
if {[string equal -nocase [SplitReply [environment_simulation]] "false"]} {
|
||||
if {[string equal -nocase "aqadapter" "${IP}"]} {
|
||||
::scobj::oxford12tlv::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"
|
||||
makesctcontroller sct_${name} aqadapter ${port}
|
||||
} else {
|
||||
::scobj::oxford12tlv::sics_log 9 "makesctcontroller sct_${name} std ${IP}:${port}"
|
||||
makesctcontroller sct_${name} std ${IP}:${port}
|
||||
}
|
||||
} else {
|
||||
::scobj::oxford12tlv::sics_log 9 "[environment_simulation] => No sctcontroller for oxford12tlv"
|
||||
}
|
||||
::scobj::oxford12tlv::sics_log 1 "::scobj::oxford12tlv::mkDriver sct_${name} ${name} ${id} ${datype} ${interval}"
|
||||
::scobj::oxford12tlv::mkDriver sct_${name} ${name} ${id} ${datype} ${interval}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
clientput "file evaluation of oxford12tlv_sct.tcl"
|
||||
::scobj::oxford12tlv::sics_log 9 "file evaluation of oxford12tlv_sct.tcl"
|
||||
|
||||
proc ::scobj::oxford12tlv::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::oxford12tlv"
|
||||
dict for {k u} $::config_dict {
|
||||
if { [dict exists $u "implementation"] } {
|
||||
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
|
||||
}
|
||||
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"] "oxford12tlv"] } {
|
||||
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
|
||||
set asyncqueue "null"
|
||||
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
|
||||
} elseif { [dict exists $v "asyncqueue"] } {
|
||||
set asyncqueue [dict get $v "asyncqueue"]
|
||||
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
}
|
||||
} else {
|
||||
if { [dict exists $v "asyncprotocol"] } {
|
||||
set asyncprotocol [dict get $v "asyncprotocol"]
|
||||
} else {
|
||||
set asyncprotocol ${name}_protocol
|
||||
MakeAsyncProtocol ${asyncprotocol}
|
||||
if { [dict exists $v "terminator"] } {
|
||||
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
|
||||
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
|
||||
}
|
||||
}
|
||||
set asyncqueue ${name}_queue
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
|
||||
if { [dict exists $v "timeout"] } {
|
||||
${asyncqueue} timeout "[dict get $v "timeout"]"
|
||||
}
|
||||
}
|
||||
set arg_list [list]
|
||||
set missing_list [list]
|
||||
foreach arg {id datype interval} {
|
||||
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"
|
||||
}
|
||||
if { [string equal -nocase ${asyncqueue} "sct"] } {
|
||||
add_oxford12tlv ${name} ${IP} ${PORT} {*}$arg_list
|
||||
} else {
|
||||
add_oxford12tlv ${name} "aqadapter" ${asyncqueue} {*}$arg_list
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::oxford12tlv::read_config
|
||||
} else {
|
||||
::scobj::oxford12tlv::sics_log 5 "No config dict"
|
||||
}
|
@ -181,7 +181,7 @@ proc ::scobj::magnetic::rdTempStateFunc {basePath field} {
|
||||
array set paraArr $s2
|
||||
hset $basePath/Temp_s1 $paraArr(T1)
|
||||
hset $basePath/Temp_s2 $paraArr(T2)
|
||||
hset $basePath/Temp_s3 $paraArr(T3)
|
||||
hset $basePath/Pressure_s3 $paraArr(T3)
|
||||
|
||||
set logText "Displayed Temp : $paraArr(T1) $paraArr(T2) $paraArr(T3)"
|
||||
}
|
||||
@ -239,7 +239,6 @@ proc ::scobj::magnetic::mkMagnetic {argList} {
|
||||
set pa($KEY) $v
|
||||
}
|
||||
|
||||
MakeSICSObj $pa(NAME) SCT_OBJECT
|
||||
sicslist setatt $pa(NAME) klass environment
|
||||
sicslist setatt $pa(NAME) long_name $pa(NAME)
|
||||
|
||||
@ -255,7 +254,7 @@ proc ::scobj::magnetic::mkMagnetic {argList} {
|
||||
hfactory $hPath/Temp plain user text
|
||||
hfactory $hPath/Temp_s1 plain user float
|
||||
hfactory $hPath/Temp_s2 plain user float
|
||||
hfactory $hPath/Temp_s3 plain user float
|
||||
hfactory $hPath/Pressure_s3 plain user float
|
||||
#hfactory $hPath/Set_Sensor_Temp user float
|
||||
#hfactory $hPath/Set_Sensor_Channel user int
|
||||
|
||||
@ -306,7 +305,7 @@ proc ::scobj::magnetic::mkMagnetic {argList} {
|
||||
foreach {hdbPath klass control data nxsave mutable priv alias} [subst {
|
||||
/sics/$pa(NAME)/Temp_s1 NXsensor true true true true user magnetic_T1
|
||||
/sics/$pa(NAME)/Temp_s2 NXsensor true true true true user magnetic_T2
|
||||
/sics/$pa(NAME)/Temp_s3 NXsensor true true true true user magnetic_T3
|
||||
/sics/$pa(NAME)/Pressure_s3 NXsensor true true true true user magnetic_P3
|
||||
/sics/$pa(NAME)/magneticFieldCurrent NXsensor true true true true user magnetic_Field_Current
|
||||
/sics/$pa(NAME)/magneticFieldTesla NXsensor true true true true user magnetic_Field_Tesla
|
||||
/sics/$pa(NAME)/fieldSetPoint NXsensor true true true true user fieldSetPoint
|
||||
@ -331,7 +330,7 @@ proc ::scobj::magnetic::mkMagnetic {argList} {
|
||||
|
||||
# hset /sics/$fPath/start_temperature_s1 [hval /sics/$fPath/Temp_s1]
|
||||
# hset /sics/$fPath/start_temperature_s2 [hval /sics/$fPath/Temp_s2]
|
||||
# hset /sics/$fPath/start_temperature_s3 [hval /sics/$fPath/Temp_s3]
|
||||
# hset /sics/$fPath/start_temperature_s3 [hval /sics/$fPath/Pressure_s3]
|
||||
# }
|
||||
|
||||
# proc ::histogram_memory::post_count "{fPath $pa(NAME)}" {
|
||||
@ -339,10 +338,11 @@ proc ::scobj::magnetic::mkMagnetic {argList} {
|
||||
|
||||
# hset /sics/$fPath/end_temperature_s1 [hval /sics/$fPath/Temp_s1]
|
||||
# hset /sics/$fPath/end_temperature_s2 [hval /sics/$fPath/Temp_s2]
|
||||
# hset /sics/$fPath/end_temperature_s3 [hval /sics/$fPath/Temp_s3]
|
||||
# hset /sics/$fPath/end_temperature_s3 [hval /sics/$fPath/Pressure_s3]
|
||||
# }
|
||||
|
||||
makesctcontroller sct_magnetic std $pa(IP):$pa(PORT)
|
||||
set ::scobj::magnetic::sct_name $pa(SCTCONTROLLER)
|
||||
set ::scobj::magnetic::magname $pa(NAME)
|
||||
|
||||
hsetprop $hPath/field read ::scobj::magnetic::rqFieldFunc
|
||||
hsetprop $hPath/field rdFieldState ::scobj::magnetic::rdFieldStateFunc $hPath
|
||||
@ -357,10 +357,10 @@ proc ::scobj::magnetic::mkMagnetic {argList} {
|
||||
hsetprop $hPath/DilutTempReading rdTempState ::scobj::magnetic::rdTempStateFunc $hPath "Dilut"
|
||||
|
||||
if {[SplitReply [environment_simulation]]=="false"} {
|
||||
sct_magnetic poll $hPath/field $pa(INTERVAL)
|
||||
sct_magnetic poll $hPath/Temp $pa(INTERVAL)
|
||||
sct_magnetic poll $hPath/HelioxTempReading $pa(INTERVAL)
|
||||
sct_magnetic poll $hPath/DilutTempReading $pa(INTERVAL)
|
||||
$pa(SCTCONTROLLER) poll $hPath/field $pa(INTERVAL)
|
||||
$pa(SCTCONTROLLER) poll $hPath/Temp $pa(INTERVAL)
|
||||
$pa(SCTCONTROLLER) poll $hPath/HelioxTempReading $pa(INTERVAL)
|
||||
$pa(SCTCONTROLLER) poll $hPath/DilutTempReading $pa(INTERVAL)
|
||||
}
|
||||
|
||||
hsetprop $hPath tuning $pa(TUNING)
|
||||
@ -381,11 +381,11 @@ proc ::scobj::magnetic::mkMagnetic {argList} {
|
||||
hsetprop $hPath/set_magneticField checkReply ::scobj::magnetic::checkReplyFunc $hPath
|
||||
|
||||
if {[SplitReply [environment_simulation]]=="false"} {
|
||||
sct_magnetic write $hPath/set_rate
|
||||
sct_magnetic write $hPath/set_magneticField
|
||||
sct_magnetic write $hPath/set_DiluxTemp
|
||||
sct_magnetic write $hPath/set_HelioxTemp
|
||||
sct_magnetic write $hPath/set_HeaterSwitch
|
||||
$pa(SCTCONTROLLER) write $hPath/set_rate
|
||||
$pa(SCTCONTROLLER) write $hPath/set_magneticField
|
||||
$pa(SCTCONTROLLER) write $hPath/set_DiluxTemp
|
||||
$pa(SCTCONTROLLER) write $hPath/set_HelioxTemp
|
||||
$pa(SCTCONTROLLER) write $hPath/set_HeaterSwitch
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -394,7 +394,7 @@ proc ::scobj::magnetic::mkMagnetic {argList} {
|
||||
# command is : OxfordSetField fieldValue P ; where "P" is an optinal parameter and if set will change
|
||||
# to posistent mode after changig the magnetic field
|
||||
proc OxfordSetField {{setPoint ""} {mode ""} args} {
|
||||
set NAME "magnetic"
|
||||
set NAME $::scobj::magnetic::magname
|
||||
if {$setPoint == ""} {
|
||||
if {$mode == ""} {
|
||||
broadcast "[hget /sample/$NAME/fieldSetPoint]"
|
||||
@ -406,10 +406,10 @@ proc OxfordSetField {{setPoint ""} {mode ""} args} {
|
||||
|
||||
if {$mode == ""} {
|
||||
set comm "setF $setPoint\r\n"
|
||||
sct_magnetic send $comm
|
||||
$::scobj::magnetic::sct_name send $comm
|
||||
} elseif {$mode == "P"} {
|
||||
set comm "setF $setPoint Pers\r\n"
|
||||
sct_magnetic send $comm
|
||||
$::scobj::magnetic::sct_name send $comm
|
||||
} else {
|
||||
broadcast "Wrong parameters being provided, check!"
|
||||
return
|
||||
@ -429,27 +429,27 @@ proc OxfordSetField {{setPoint ""} {mode ""} args} {
|
||||
# Assign the rate of the changing magnetic field;
|
||||
# This needs only to be set once unless required
|
||||
proc OxfordSetRate {{setRate ""} args} {
|
||||
set NAME "magnetic"
|
||||
set NAME $::scobj::magnetic::magname
|
||||
if {$setRate == ""} {
|
||||
broadcast "[hget /sample/$NAME/fieldSetRate]"
|
||||
} else {
|
||||
hset /sample/$NAME/fieldSetRate $setRate
|
||||
|
||||
set comm "setR $setRate\r\n"
|
||||
sct_magnetic send $comm
|
||||
$::scobj::magnetic::sct_name send $comm
|
||||
}
|
||||
}
|
||||
|
||||
# Querying/Setting the Heliox sample temperature
|
||||
proc OxfordSetHTemp {{temp ""} args} {
|
||||
set NAME "magnetic"
|
||||
set NAME $::scobj::magnetic::magname
|
||||
if {$temp == ""} {
|
||||
broadcast "[hget /sample/$NAME/HelioxTempSetPoint]"
|
||||
} else {
|
||||
#hset /sample/$NAME/HelioxTempSetPoint $temp
|
||||
|
||||
set comm "setHelioxTemp $temp\r\n"
|
||||
sct_magnetic send $comm
|
||||
$::scobj::magnetic::sct_name send $comm
|
||||
|
||||
#set num 0
|
||||
#while { $num <= 40 && [expr abs([hval /sample/$NAME/HelioxTempSetPoint] - [hval /sample/$NAME/HelioxTempReading]) ] >= 0.001 } {
|
||||
@ -463,14 +463,14 @@ proc OxfordSetHTemp {{temp ""} args} {
|
||||
|
||||
# Querying/Setting the Diluxtion Sample temperature
|
||||
proc OxfordSetDTemp {{temp ""} args} {
|
||||
set NAME "magnetic"
|
||||
set NAME $::scobj::magnetic::magname
|
||||
if {$temp == ""} {
|
||||
broadcast "[hget /sample/$NAME/DilutTempSetPoint]"
|
||||
} else {
|
||||
hset /sample/$NAME/DilutTempSetPoint $temp
|
||||
|
||||
set comm "setDilutTemp $temp\r\n"
|
||||
sct_magnetic send $comm
|
||||
$::scobj::magnetic::sct_name send $comm
|
||||
}
|
||||
}
|
||||
|
||||
@ -485,7 +485,7 @@ proc OxfordSetHS {mode} {
|
||||
}
|
||||
|
||||
set comm "setHS [string toupper $mode]\r\n"
|
||||
sct_magnetic send $comm
|
||||
$::scobj::magnetic::sct_name send $comm
|
||||
broadcast "Wait 60 seconds for the operation to complete before reset the mode"
|
||||
}
|
||||
|
||||
@ -494,101 +494,3 @@ publish OxfordSetRate user
|
||||
publish OxfordSetHTemp user
|
||||
publish OxfordSetDTemp user
|
||||
publish OxfordSetHS user
|
||||
|
||||
proc add_oxford_labview { name IP PORT {interval 5} } {
|
||||
::scobj::magnetic::mkMagnetic [subst {
|
||||
name $name
|
||||
IP $IP
|
||||
PORT $PORT
|
||||
tuning 1
|
||||
interval $interval
|
||||
}]
|
||||
}
|
||||
|
||||
namespace eval ::scobj::oxford_labview {
|
||||
set debug_threshold 5
|
||||
}
|
||||
proc ::scobj::oxford_labview::sics_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
set debug_threshold ${::scobj::oxford_labview::debug_threshold}
|
||||
if {${debug_level} >= ${debug_threshold}} {
|
||||
sicslog "::scobj::oxford_labview::${debug_string}"
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
clientput "file evaluation of sct_oxford_labview.tcl"
|
||||
::scobj::oxford_labview::sics_log 9 "file evaluation of sct_oxford_labview.tcl"
|
||||
|
||||
proc ::scobj::oxford_labview::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::oxford_labview"
|
||||
dict for {k v} $::config_dict {
|
||||
if { [dict exists $v "implementation"] } {
|
||||
if { !([dict exists $v "name"] && [dict exists $v "enabled"]) } {
|
||||
continue
|
||||
}
|
||||
set name [dict get $v name]
|
||||
set enabled [string tolower [dict get $v "enabled"]]
|
||||
set implementation [dict get $v "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"] "oxford_labview"] } {
|
||||
set driver [dict get $v driver]
|
||||
${ns}::sics_log 9 "Found ${name}: $driver"
|
||||
if { [string equal -nocase $enabled "true" ] || [string equal -nocase $enabled "always"] } {
|
||||
if { ![string equal -nocase [SplitReply [environment_simulation]] "false"] } {
|
||||
set asyncqueue "null"
|
||||
${ns}::sics_log 9 "[environment_simulation] => using null asyncqueue"
|
||||
} elseif { [dict exists $v "asyncqueue"] } {
|
||||
set asyncqueue [dict get $v "asyncqueue"]
|
||||
} else {
|
||||
if { [dict exists $v "asyncprotocol"] } {
|
||||
set asyncprotocol [dict get $v "asyncprotocol"]
|
||||
} else {
|
||||
set asyncprotocol ${name}_protocol
|
||||
${ns}::sics_log 9 "${name}:${driver}: MakeAsyncProtocol ${asyncprotocol}"
|
||||
MakeAsyncProtocol ${asyncprotocol}
|
||||
if { [dict exists $v "terminator"] } {
|
||||
${asyncprotocol} sendterminator "[dict get $v "terminator"]"
|
||||
${asyncprotocol} replyterminator "[dict get $v "terminator"]"
|
||||
}
|
||||
}
|
||||
set asyncqueue ${name}_queue
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
${ns}::sics_log 9 "${name}:${driver}: MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}"
|
||||
MakeAsyncQueue ${asyncqueue} ${asyncprotocol} ${IP} ${PORT}
|
||||
if { [dict exists $v "timeout"] } {
|
||||
${asyncqueue} timeout "[dict get $v "timeout"]"
|
||||
}
|
||||
}
|
||||
set arg_list [list]
|
||||
# foreach arg {interval} {
|
||||
# if {[dict exists $v $arg]} {
|
||||
# lappend arg_list "[dict get $v $arg]"
|
||||
# } else {
|
||||
# ${ns}::sics_log 9 "Missing configuration value $arg"
|
||||
# error "Missing configuration value $arg"
|
||||
# }
|
||||
# }
|
||||
${ns}::sics_log 9 "add_oxford_labview ${name} aqadapter ${asyncqueue} {*}$arg_list"
|
||||
add_oxford_labview ${name} "aqadapter" ${asyncqueue} {*}$arg_list
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::oxford_labview::read_config
|
||||
} else {
|
||||
::scobj::oxford_labview::sics_log 5 "No config dict"
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ implementation = normal_sample_stage
|
||||
name = sample_stage
|
||||
optype = motion_axis
|
||||
[12tmagnet_oxford]
|
||||
asyncqueue = sct
|
||||
desc = "12 Tesla Oxford Magnet"
|
||||
driver = "oxford_labview"
|
||||
imptype = magnetic_field
|
||||
|
@ -53,6 +53,7 @@ fileeval $cfPath(environment)/temperature/sct_qlink.tcl
|
||||
fileeval $cfPath(environment)/temperature/west400.tcl
|
||||
fileeval $cfPath(environment)/temperature/west4100_sct.tcl
|
||||
fileeval $cfPath(environment)/magneticField/sct_oxford_labview.tcl
|
||||
fileeval $cfPath(environment)/magneticField/oxford12tlv_sct.tcl
|
||||
fileeval $cfPath(environment)/he3/sct_he3.tcl
|
||||
fileeval $cfPath(environment)/magneticField/sct_green_magnet.tcl
|
||||
fileeval $cfPath(hmm)/hmm_configuration.tcl
|
||||
|
@ -30,6 +30,7 @@ fileeval $cfPath(environment)/temperature/sct_eurotherm_2000.tcl
|
||||
fileeval $cfPath(environment)/sct_keithley_2700.tcl
|
||||
fileeval $cfPath(environment)/magneticField/sct_green_magnet.tcl
|
||||
fileeval $cfPath(environment)/magneticField/sct_oxford_labview.tcl
|
||||
fileeval $cfPath(environment)/magneticField/oxford12tlv_sct.tcl
|
||||
fileeval $cfPath(environment)/sct_keithley_2700.tcl
|
||||
fileeval $cfPath(environment)/temperature/sct_lakeshore_336.tcl
|
||||
fileeval $cfPath(environment)/temperature/sct_lakeshore_340.tcl
|
||||
|
@ -100,6 +100,7 @@ implementation = normal_sample_stage
|
||||
name = sample_stage
|
||||
optype = motion_axis
|
||||
[12tmagnet_oxford]
|
||||
asyncqueue = sct
|
||||
desc = "12 Tesla Oxford Magnet"
|
||||
driver = "oxford_labview"
|
||||
imptype = magnetic_field
|
||||
|
@ -56,6 +56,7 @@ fileeval $cfPath(environment)/temperature/sct_qlink.tcl
|
||||
fileeval $cfPath(environment)/temperature/west400.tcl
|
||||
fileeval $cfPath(environment)/temperature/west4100_sct.tcl
|
||||
fileeval $cfPath(environment)/magneticField/sct_oxford_labview.tcl
|
||||
fileeval $cfPath(environment)/magneticField/oxford12tlv_sct.tcl
|
||||
fileeval $cfPath(environment)/he3/sct_he3.tcl
|
||||
fileeval $cfPath(environment)/magneticField/sct_green_magnet.tcl
|
||||
fileeval $cfPath(hmm)/hmm_configuration.tcl
|
||||
|
@ -89,9 +89,11 @@ implementation = normal_sample_stage
|
||||
name = sample_stage
|
||||
optype = motion_axis
|
||||
[12tmagnet_oxford]
|
||||
asyncqueue = sct
|
||||
desc = "12 Tesla Oxford Magnet"
|
||||
driver = "oxford_labview"
|
||||
driver = "oxford12tlv"
|
||||
imptype = magnetic_field
|
||||
interval = 5
|
||||
ip = 10.157.205.3
|
||||
port = 55001
|
||||
|
||||
|
@ -29,9 +29,8 @@ fileeval $cfPath(environment)/temperature/sct_lakeshore_336.tcl
|
||||
fileeval $cfPath(environment)/temperature/sct_lakeshore_340.tcl
|
||||
fileeval $cfPath(environment)/temperature/sct_eurotherm_2000.tcl
|
||||
fileeval $cfPath(environment)/sct_protek_common.tcl
|
||||
fileeval $cfPath(environment)/temperature/sct_oxford_itc.tcl
|
||||
fileeval $cfPath(environment)/magneticField/sct_oxford_ips.tcl
|
||||
fileeval $cfPath(environment)/magneticField/sct_oxford_labview.tcl
|
||||
fileeval $cfPath(environment)/magneticField/oxford12tlv_sct.tcl
|
||||
fileeval $cfPath(hmm)/hmm_configuration.tcl
|
||||
fileeval $cfPath(nexus)/nxscripts.tcl
|
||||
fileeval $cfPath(scan)/scan.tcl
|
||||
|
@ -156,6 +156,7 @@ desc = "Load the ten position sample changer configuration"
|
||||
imptype = motion_axis
|
||||
|
||||
[12tmagnet_oxford]
|
||||
asyncqueue = sct
|
||||
desc = "12 Tesla Oxford Magnet"
|
||||
driver = "oxford_labview"
|
||||
imptype = magnetic_field
|
||||
|
@ -80,6 +80,7 @@ reserved = {
|
||||
'DEVICE' : 'DEVICE',
|
||||
'PROTOCOL' : 'PROTOCOL',
|
||||
'DRIVER_PROPERTY' : 'DRIVER_PROPERTY',
|
||||
'WRAPPER_PROPERTY' : 'WRAPPER_PROPERTY',
|
||||
'CLASS' : 'CLASS',
|
||||
'SIMULATION_GROUP' : 'SIMULATION_GROUP',
|
||||
'DEBUG_THRESHOLD' : 'DEBUG_THRESHOLD',
|
||||
@ -155,6 +156,8 @@ tokens = [
|
||||
'ID',
|
||||
'TCL_BEG',
|
||||
'TCL_END',
|
||||
'AT_TCL',
|
||||
'AT_END',
|
||||
] + list(reserved.values())
|
||||
|
||||
#
|
||||
@ -166,6 +169,20 @@ t_LBRACE = r'{'
|
||||
t_RBRACE = r'}'
|
||||
t_SLASH = r'/'
|
||||
|
||||
def t_AT_TCL(t):
|
||||
r'@TCL'
|
||||
if Verbose:
|
||||
print 'AT_TCL'
|
||||
t.lexer.begin('tcl')
|
||||
#return t
|
||||
|
||||
def t_tcl_AT_END(t):
|
||||
r'[ \t]*@END'
|
||||
if Verbose:
|
||||
print 'AT_END'
|
||||
t.lexer.begin('INITIAL')
|
||||
#return t
|
||||
|
||||
def t_TCL_BEG(t):
|
||||
r'{%%'
|
||||
if Verbose:
|
||||
@ -303,6 +320,7 @@ def p_driver_statement(p):
|
||||
| group
|
||||
| code
|
||||
| driver_property
|
||||
| wrapper_property
|
||||
'''
|
||||
p[0] = p[1]
|
||||
|
||||
@ -446,6 +464,12 @@ def p_driver_property(p):
|
||||
'''
|
||||
p[0] = { 'DriverProperty' : ( p[2], p[4] ) }
|
||||
|
||||
def p_wrapper_property(p):
|
||||
'''
|
||||
wrapper_property : WRAPPER_PROPERTY id_or_str EQUALS value
|
||||
'''
|
||||
p[0] = { 'WrapperProperty' : ( p[2], p[4] ) }
|
||||
|
||||
def p_group_property(p):
|
||||
'''
|
||||
group_property : GROUP_PROPERTY id_or_str EQUALS value
|
||||
@ -505,6 +529,7 @@ def p_true_false(p):
|
||||
def p_code(p):
|
||||
'''
|
||||
code : CODE code_type id_or_str EQUALS LBRACE code_block RBRACE
|
||||
| CODE code_type id_or_str EQUALS LBRACE tcl_code_block RBRACE
|
||||
| CODE code_type id_or_str EQUALS TCL_BEG code_block TCL_END
|
||||
'''
|
||||
p[0] = { 'Code' : { 'name' : p[3], 'type' : p[2], 'text' : p[6] }}
|
||||
@ -524,6 +549,12 @@ def p_code_type(p):
|
||||
'''
|
||||
p[0] = p[1]
|
||||
|
||||
def p_tcl_code_block(p):
|
||||
'''
|
||||
tcl_code_block : AT_TCL code_block AT_END
|
||||
'''
|
||||
p[0] = p[2]
|
||||
|
||||
def p_code_block(p):
|
||||
'''code_block : empty
|
||||
| code_block CODE_STRING
|
||||
@ -794,6 +825,11 @@ def build_driver(MyDriver, TheTree):
|
||||
MyDriver['DriverProperty'] = {}
|
||||
MyDriver['DriverProperty'][item['DriverProperty'][0]] = item['DriverProperty'][1]
|
||||
continue
|
||||
if 'WrapperProperty' in item:
|
||||
if 'WrapperProperty' not in MyDriver:
|
||||
MyDriver['WrapperProperty'] = {}
|
||||
MyDriver['WrapperProperty'][item['WrapperProperty'][0]] = item['WrapperProperty'][1]
|
||||
continue
|
||||
for key in item:
|
||||
MyDriver[key] = item[key]
|
||||
for item in MyDriver['Permlink']:
|
||||
@ -1368,6 +1404,12 @@ def put_mkDriver(MyDriver):
|
||||
txt += [' set ns "[namespace current]"']
|
||||
txt += [' set catch_status [ catch {']
|
||||
txt += ['']
|
||||
func = 'mkWrapper'
|
||||
if func in MyDriver['Funcs']:
|
||||
txt += ['# %s hook code starts' % func]
|
||||
txt += MyDriver['Funcs'][func]['text']
|
||||
txt += ['# %s hook code ends' % func]
|
||||
else:
|
||||
if len(MyDriver['Permlink']) > 0:
|
||||
if 'make_args' in MyDriver and 'id' in MyDriver['make_args'].split():
|
||||
pass
|
||||
@ -1432,6 +1474,9 @@ def put_postamble(MyDriver):
|
||||
txt += [' %s::sics_log 9 "add_%s ${name} ${IP} ${port} %s"' % (MyDriver['namespace'], MyDriver['name'], make_args)]
|
||||
else:
|
||||
txt += [' %s::sics_log 9 "add_%s ${name} ${IP} ${port}"' % (MyDriver['namespace'], MyDriver['name'])]
|
||||
if ('WrapperProperty' in MyDriver) and ('nosctcontroller' in MyDriver['WrapperProperty']):
|
||||
txt += [' %s::sics_log 9 "No sctcontroller for %s"' % (MyDriver['namespace'], MyDriver['name'])]
|
||||
else:
|
||||
txt += [' if {[string equal -nocase [SplitReply [%s]] "false"]} {' % MyDriver['simulation_group']]
|
||||
txt += [' if {[string equal -nocase "aqadapter" "${IP}"]} {']
|
||||
txt += [' %s::sics_log 9 "makesctcontroller sct_${name} aqadapter ${port}"' % MyDriver['namespace']]
|
||||
|
Reference in New Issue
Block a user