Get sct_lakeshore_370.tcl saving data to nexus files

This commit is contained in:
Douglas Clowes
2013-08-21 15:26:02 +10:00
parent e6d872aca4
commit f5dd71f4fb

View File

@@ -26,10 +26,7 @@ if { "[lindex [split [info nameofexecutable] "/"] end]" == "tclsh"} {
proc channel {args} { }
proc ns {args} { }
} catch_message ]
if {$catch_status != 0} {
puts "error in main $catch_message"
return -code error "in main $catch_message"
}
handle_exception $catch_status $catch_message "in main"
}
set vendor "lakeshore"
@@ -64,7 +61,7 @@ namespace eval ::scobj::[set vendor]_[set device] {
}
proc channel {arg} {
# strip the trailing digits from the arg and return them as a string
set result 0
set result 1
for { set i 0 } { $i < [string length $arg] } { incr i } {
if { ! [string match {[0-9]} [string index $arg end-$i]] } {
break
@@ -793,14 +790,9 @@ namespace eval ::scobj::[set vendor]_[set device] {
hsetprop $nodeName checklimits ${ns}::check $scobj_hpath
hsetprop $nodeName checkstatus ${ns}::drivestatus $scobj_hpath
hsetprop $nodeName halt ${ns}::halt $scobj_hpath
} else {
hsetprop $nodeName driving 0
}
} catch_message ]
if {$catch_status != 0} {
debug_log 5 "error in [ns]::createNode $catch_message"
return -code error "in [ns]::createNode $catch_message"
}
handle_exception $catch_status $catch_message "in [ns]::createNode"
return OK
}
@@ -824,7 +816,7 @@ namespace eval ::scobj::[set vendor]_[set device] {
hfactory $scobj_hpath/Sensor plain spy none
set deviceCommand {\
Sensor value 1 0 0 float user {RDGK?} {rdValue} {} {} {}\
Sensor value 1 0 0 float user {RDGK? 1} {rdValue} {} {} {}\
{} setpoint 1 1 0 float user {SETP?} {rdValue} {SETP} {setValue} {}\
{} device_state 1 0 0 text user {NULL} {getState.rdState} {} {} {}\
{} alarm_reset 0 1 0 text user {} {} {ALMRST} {setValue} {}\
@@ -885,11 +877,39 @@ namespace eval ::scobj::[set vendor]_[set device] {
hset $scobj_hpath/device_state "STATE_INIT"
hsetprop $scobj_hpath/device_state substate 0
::scobj::hinitprops $name setpoint sensor/value loop1/setpoint chan1/rdgk chan1/rdgpwr
hsetprop $scobj_hpath klass NXenvironment
::scobj::set_required_props $scobj_hpath
set nxProperties "
$scobj_hpath Sensor NXsensor spy
$scobj_hpath Loop1 NXsensor spy
$scobj_hpath Chan1 NXsensor spy
"
foreach {rootpath hpath klasse priv} $nxProperties {
hsetprop $rootpath/$hpath klass $klasse
hsetprop $rootpath/$hpath privilege $priv
hsetprop $rootpath/$hpath control true
hsetprop $rootpath/$hpath data true
hsetprop $rootpath/$hpath nxsave true
hsetprop $rootpath/$hpath type part
}
set nxProperties "
$scobj_hpath Sensor/value sensor user
$scobj_hpath Loop1/setpoint sensor user
$scobj_hpath Chan1/rdgk sensor user
$scobj_hpath Chan1/rdgpwr sensor user
"
foreach {rootpath hpath klasse priv} $nxProperties {
hsetprop $rootpath/$hpath klass $klasse
hsetprop $rootpath/$hpath privilege $priv
hsetprop $rootpath/$hpath control true
hsetprop $rootpath/$hpath data true
hsetprop $rootpath/$hpath nxsave true
hsetprop $rootpath/$hpath mutable true
hsetprop $rootpath/$hpath sdsinfo ::nexus::scobj::sdsinfo
}
} catch_message ]
if {$catch_status != 0} {
debug_log 5 "error in [ns]::mk_sct_driver $catch_message"
return -code error "in [ns]::mk_sct_driver $catch_message"
}
handle_exception $catch_status $catch_message "in [ns]::mk_sct_driver"
}
proc add_[set vendor]_[set device] {name IP port {_tol 5.0}} {