source $cfPath(commands)/commands_common.tcl namespace eval motor { # is_homing_list = comma separated list of motors which are safe to send "home" variable is_homing_list "" } namespace eval ajscmds { namespace export SetRadColl SimpleRun SimpleScan RadCollRun RadCollTimed RadCollScan # SetRadColl command SetRadColl { float time float range } { catch { set spd [expr 2.0*$range / $time] oct softlowerlim [expr -abs($range/2.0) - 0.5] oct softupperlim [expr abs($range/2.0) + 0.5] oct maxretry 5 oct accel 0.25 oct speed 0.25 oct decel 0.25 drive oct [expr abs($range/2.0)] oct speed $spd oct accel [expr $spd*5] oct decel [expr $spd*5] oct maxretry 0 } msg clientput $msg } # SimpleRun command SimpleRun { float=0:inf steptime int=1:inf numsteps } { # RadCollOff histmem mode time histmem preset $steptime newfile HISTOGRAM_XY for {set i 0} {$i < $numsteps} {incr i} { hmm countblock save $i } } # SimpleScan command SimpleScan { text=drivable motor float start float step int=1:inf numsteps float=0:inf steptime } { # RadCollOff histmem mode time histmem preset $steptime newfile HISTOGRAM_XY for {set i 0} {$i < $numsteps} {incr i} { drive $motor [expr $i*$step+$start] hmm countblock save $i } } # RadCollRun command RadCollRun { int=1:inf oscno int=1:inf reps } { # RadCollOn $oscno histmem mode unlimited newfile HISTOGRAM_XY for {set i 0} {$i < $reps} {incr i} { oscmd start $oscno hmm countblock save $i } oscmd stop # RadCollOff } # RadCollTimed command RadCollTimed { int=1:inf oscno float=0:inf time } { RadCollOn $oscno set tim1 [clock seconds] histmem mode unlimited newfile HISTOGRAM_XY set bool 0 set i 0 set timsecs [expr $time*60] while {$bool == 0} { histmem start block save $i incr i set tim2 [expr [clock seconds] - $tim1] if {$tim2 > $timsecs} {set bool 1} } RadCollOff } # RadCollScan command RadCollScan { text=drivable motor float start float step int=1:inf numsteps int=1:inf oscno } { # RadCollOn $oscno histmem mode unlimited newfile HISTOGRAM_XY for {set i 0} {$i < $numsteps} {incr i} { drive $motor [expr $i*$step+$start] oscmd start $oscno hmm countblock save $i } # RadCollOff oscmd stop } } namespace import ::ajscmds::* publish SetRadColl user publish SimpleRun user publish SimpleScan user publish RadCollRun user publish RadCollTimed user publish RadCollScan user proc ::commands::isc_initialize {} { ::commands::ic_initialize }