Fixed drive bugs in lakeshore drivers. r3071 | ffr | 2011-02-25 18:27:31 +1100 (Fri, 25 Feb 2011) | 2 lines
82 lines
2.4 KiB
Tcl
82 lines
2.4 KiB
Tcl
## RHEOMETER CONTROL
|
|
|
|
proc rhCallBack {rootPath} {
|
|
# if rhSpeed >= trigger then start histmem and pop trigger and time
|
|
if {[hval $rootPath/runexp] != 1} {
|
|
return idle
|
|
}
|
|
set trigList [hval $rootPath/triggerList]
|
|
if {$trigList == "EMPTY"} {
|
|
hset $rootPath/acqTime "EMPTY"
|
|
hset $rootPath/runexp 0
|
|
return idle
|
|
}
|
|
set acqTime [hval /sics/rhSpeed/acqTime]
|
|
if {$acqTime == "EMPTY"} {
|
|
broadcast "You must set acquisition time"
|
|
return idle
|
|
}
|
|
set rhSpeed [hval $rootPath]
|
|
set trigLevel [lindex $trigList 0]
|
|
if {$rhSpeed >= $trigLevel } {
|
|
set listLen [llength $trigList]
|
|
if {$listLen > 1} {
|
|
# If the rhSpeed has jumped over a number of trigger values then skip over those elements in the list
|
|
for {set tlIndex 1} {$tlIndex < $listLen} {incr tlIndex} {
|
|
set trigLevel [lindex $trigList $tlIndex]
|
|
if {$rhSpeed < $trigLevel } {
|
|
break
|
|
}
|
|
}
|
|
}
|
|
histmem pause
|
|
broadcast [info level 0] [hval $rootPath] trigger a [lindex $acqTime 0] second acquisition, sicstime [sicstime]
|
|
histmem mode time
|
|
histmem preset [lindex $acqTime 0]
|
|
histmem start
|
|
if {$listLen > 1} {
|
|
# Pop trigger
|
|
hset $rootPath/triggerList [lrange $trigList $tlIndex end]
|
|
} else {
|
|
hset $rootPath/triggerList "EMPTY"
|
|
hset $rootPath/acqTime "EMPTY"
|
|
hset $rootPath/runexp 0
|
|
}
|
|
if { $acqTime != "EMPTY" && [llength $acqTime] > 1} {
|
|
hset $rootPath/acqTime [lrange $acqTime 1 end]
|
|
}
|
|
}
|
|
return idle
|
|
}
|
|
|
|
##
|
|
# @brief Pop trigger and acquisition time
|
|
proc rheometer_savehmmdata {rootPath} {
|
|
set si [hval $rootPath/saveIndex]
|
|
broadcast [info level 0]: save data index = $si, sicstime [sicstime]
|
|
save $si
|
|
if {[hval $rootPath/runexp] == 0} {
|
|
hset $rootPath/saveIndex 0
|
|
newfile clear
|
|
} else {
|
|
incr si
|
|
hset $rootPath/saveIndex $si
|
|
}
|
|
}
|
|
publish rheometer_savehmmdata user
|
|
|
|
|
|
proc add_rheo {IP} {
|
|
MakeProtek rhTorque $IP 4002
|
|
MakeProtek rhSpeed $IP 4001 1.0 0.0 0.5 "rhCallBack /sics/rhSpeed"
|
|
hfactory /sics/rhSpeed/saveIndex plain user int
|
|
hset /sics/rhSpeed/saveIndex 0
|
|
hfactory /sics/rhSpeed/triggerList plain user text
|
|
hset /sics/rhSpeed/triggerList "EMPTY"
|
|
hfactory /sics/rhSpeed/acqTime plain user text
|
|
hset /sics/rhSpeed/acqTime "EMPTY"
|
|
hfactory /sics/rhSpeed/runexp plain user float
|
|
hset /sics/rhSpeed/runexp 0
|
|
scriptcallback connect hmm COUNTEND "rheometer_savehmmdata /sics/rhSpeed"
|
|
}
|