Add vactex.tcl found on wombat (fixed)
This commit is contained in:
108
site_ansto/instrument/hipd/config/commands/vactex.tcl
Normal file
108
site_ansto/instrument/hipd/config/commands/vactex.tcl
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
#vactex
|
||||||
|
|
||||||
|
set currentoct 0
|
||||||
|
|
||||||
|
set somdir 1
|
||||||
|
set somstart 0
|
||||||
|
set somend 0
|
||||||
|
set octrange 0
|
||||||
|
|
||||||
|
proc SetUpVacTex {_somstart _somend} {
|
||||||
|
global currentoct somdir somstart somend octrange
|
||||||
|
|
||||||
|
set somstart $_somstart
|
||||||
|
set somend $_somend
|
||||||
|
# set octrange $_octrange
|
||||||
|
|
||||||
|
set currentrun 0
|
||||||
|
set somdir 1
|
||||||
|
# set currentoct [expr $octrange/2.0]
|
||||||
|
oct accel 2
|
||||||
|
# oct speed 0.5
|
||||||
|
oct decel 2
|
||||||
|
som accel 3
|
||||||
|
som decel 3
|
||||||
|
som speed 3
|
||||||
|
drive som $somstart
|
||||||
|
som speed 3
|
||||||
|
}
|
||||||
|
|
||||||
|
publish SetUpVacTex user
|
||||||
|
|
||||||
|
proc VacTex {somstep} {
|
||||||
|
global currentoct somdir somstart somend octrange
|
||||||
|
|
||||||
|
# set octspeed [expr {$octrange*1.0/$somtime}]
|
||||||
|
# oct speed $octspeed
|
||||||
|
|
||||||
|
set i_bool 0
|
||||||
|
if {$somdir == 1} {
|
||||||
|
set currentsom $somstart
|
||||||
|
set i 0
|
||||||
|
} else {
|
||||||
|
set currentsom $somend
|
||||||
|
set i [expr {int(($somend-$somstart)/$somstep)}]
|
||||||
|
}
|
||||||
|
histmem mode unlimited
|
||||||
|
newfile HISTOGRAM_XY
|
||||||
|
while {$i_bool==0} {
|
||||||
|
|
||||||
|
set currentoct [expr {$currentoct *-1}]
|
||||||
|
drive som $currentsom
|
||||||
|
# run oct $currentoct
|
||||||
|
oct oscillate_count 1
|
||||||
|
oct oscillate start
|
||||||
|
hmm countblock
|
||||||
|
save $i
|
||||||
|
broadcast $i $currentsom $currentoct
|
||||||
|
|
||||||
|
if {($somdir > 0)} {
|
||||||
|
set currentsom [expr {$currentsom + $somstep}]
|
||||||
|
if {$currentsom > $somend} {set i_bool 1}
|
||||||
|
incr i
|
||||||
|
} else {
|
||||||
|
set currentsom [expr {$currentsom - $somstep}]
|
||||||
|
if {$currentsom < $somstart} {set i_bool 1}
|
||||||
|
incr i -1
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
set somdir [expr {(-1*$somdir)}]
|
||||||
|
}
|
||||||
|
publish VacTex user
|
||||||
|
|
||||||
|
proc VacRamp {temp rate somstep} {
|
||||||
|
set tstart [SplitReply [tc1 setpoint]]
|
||||||
|
set tim1 [clock seconds]
|
||||||
|
set tlength [expr abs($tstart-$temp)/($rate/3600.0)]
|
||||||
|
tc1 ramprate $rate
|
||||||
|
tc1 setpoint $temp
|
||||||
|
set bool 0
|
||||||
|
# RadCollOn $oscno
|
||||||
|
while {$bool==0} {
|
||||||
|
VacTex $somstep
|
||||||
|
set tim2 [expr [clock seconds]-$tim1]
|
||||||
|
if {$tim2>$tlength} {set bool 1}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publish VacRamp user
|
||||||
|
|
||||||
|
|
||||||
|
proc VacRun {tmins somstep} {
|
||||||
|
set tim1 [clock seconds]
|
||||||
|
set tlength [expr {$tmins * 60}]
|
||||||
|
set bool 0
|
||||||
|
# RadCollOn $oscno
|
||||||
|
while {$bool==0} {
|
||||||
|
VacTex $somstep
|
||||||
|
set tim2 [expr [clock seconds]-$tim1]
|
||||||
|
if {$tim2>$tlength} {set bool 1}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publish VacRun user
|
||||||
|
|
Reference in New Issue
Block a user