Merge branch 'Wombat' into temp

Conflicts:
	sics/site_ansto/instrument/config/environment/temperature/sct_oxford_mercury.tcl
	sics/site_ansto/instrument/hipd/config/commands/commands.tcl
	sics/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl
	sics/site_ansto/instrument/hipd/util/sics_config.ini
This commit is contained in:
Douglas Clowes
2015-02-19 15:26:13 +11:00
8 changed files with 240 additions and 149 deletions

View File

@@ -1,5 +1,9 @@
set scaleval 1000.0
set scaleval 2000.0
set rampstep 100
set rampdelay 3
set motdir 1
set pulserstate 0
proc SetVoltScale {newscaleval} {
global scaleval
@@ -11,17 +15,58 @@ proc VoltScale {involt} {
return [expr {($involt*1.0)/$scaleval}]
}
proc SetRampParms {_rampstep _rampdelay} {
global rampstep rampdelay
set rampstep $_rampstep
set rampdelay $_rampdelay
}
proc SetVolt {volt} {
global pulserstate
if {$volt== 0} {
PulserOff
set pulserstate 0
} else {
set pulservolt [VoltScale $volt]
sct_pulser send "VOLT:OFFS $pulservolt; OFFS?"
PulserDC $pulservolt
PulserOn
# sct_pulser send "VOLT:OFFS $pulservolt; OFFS?"
# PulserDC $pulservolt
if {$pulserstate==0} {
PulserDC $pulservolt
PulserOn
set pulserstate 1
} else {
sct_pulser send "VOLT:OFFS $pulservolt; OFFS?"
PulserOn
}
}
}
proc VoltSetStep {start step fin delay} {
set i [expr {$start*1.0}]
set loopvar 1
SetVolt $i
if {($start == $fin) || ($step == 0)} {break}
while {$loopvar} {
wait $delay
if {($start < $fin)} {
set i [expr {$i + abs($step)}]
if {$i >= $fin} {
set i $fin
set loopvar 0
}
}
if {($start > $fin)} {
set i [expr {$i - abs($step)}]
if {$i <= $fin} {
set i $fin
set loopvar 0
}
}
SetVolt $i
}
}
proc GetVolt {} {
sct_pulser transact VOLT:OFFS?
}
@@ -29,25 +74,18 @@ proc GetVolt {} {
proc SingleVolt {volt oscno} {
histmem mode unlimited
newfile HISTOGRAM_XY
if {$volt== 0} {
PulserOff
} else {
set pulservolt [VoltScale $volt]
sct_pulser send "VOLT:OFFS $pulservolt; OFFS?"
pulserDC $pulservolt
PulserOn
}
oscmd start $oscno
hmm countblock
SetVolt $volt
oct oscillate_count $oscno
oct oscillate start
save 0
oscmd stop
}
proc SetDC {} {
pulseroff
#NOTE: Setting FUNC DC generates a remote ctrl error if the
# burst mode happens to be on
set resp [sct_pulser transact "BURS:STAT OFF;:FUNC DC;:VOLT:OFFS 0; OFFS?"]
set resp [sct_pulser send "BURS:STAT OFF;:FUNC DC;:VOLT:OFFS 0; OFFS?"]
pulseron
}
@@ -61,55 +99,58 @@ proc VoltRamp {start step fin oscno} {
set j [expr {$i*$step+$start}]
if {$j> $fin && $step > 0} {break}
if {$j< $fin && $step < 0} {break}
if {$j== 0} {
PulserOff
} else {
set pulservolt [VoltScale $j]
pulserDC $pulservolt
PulserOn
}
oscmd start $oscno
hmm countblock
SetVolt $j
oct oscillate_count $oscno
oct oscillate start
save $i
incr i
}
oscmd stop
}
proc VoltTextureRamp {start step fin mot tstart tstep tfin oscno} {
histmem mode unlimited
set loopvar 1
proc SingleVTexScan {mot tstart tstep tfin oscno} {
global motdir
broadcast in singlevtexscan
set loopvar 1
set i_bool 0
histmem mode unlimited
if {$motdir == 1} {
set currentmot $tstart
set i 0
while {$loopvar} {
set j [expr {$i*$step+$start}]
if {$j> $fin && $step > 0} {break}
if {$j< $fin && $step < 0} {break}
if {$j== 0} {
PulserOff
} else {
set pulservolt [VoltScale $j]
pulserDC $pulservolt
PulserOn
}
sampledescription voltage $j
broadcast voltage $j
newfile HISTOGRAM_XY
set m 0
while {1} {
set n [expr {$m*$tstep+$tstart}]
if {$n> $tfin && $tstep > 0} {break}
if {$n< $tfin && $tstep < 0} {break}
drive $mot $n
oscmd start $oscno
hmm countblock
save $m
incr m
}
oscmd stop
incr i
}
} else {
set currentmot $tfin
set i [expr {int(($tfin-$tstart)/$tstep)}]
}
newfile HISTOGRAM_XY
while {$i_bool==0} {
drive $mot $currentmot
oct oscillate_count $oscno
oct oscillate start
hmm countblock
save $i
if {($motdir > 0)} {
set currentmot [expr {$currentmot + $tstep}]
if {$currentmot > $tfin} {set i_bool 1}
incr i
} else {
set currentmot [expr {$currentmot - $tstep}]
if {$currentmot < $tstart} {set i_bool 1}
incr i -1
}
}
set motdir [expr {(-1*$motdir)}]
}
proc VListTexScan {voltlist mot tstart tstep tfin oscno} {
global rampstep rampdelay
set curvolt [lindex $voltlist 0]
broadcast $curvolt
SetVolt $curvolt
foreach volt $voltlist {
broadcast $volt
VoltSetStep $curvolt $rampstep $volt $rampdelay
SingleVTexScan $mot $tstart $tstep $tfin $oscno
}
}
@@ -124,12 +165,10 @@ proc SquarePulseTexture {motor start step numsteps volt freq bins oscno} {
for {set i 0} {$i < $numsteps} {incr i} {
drive $motor [expr $i*$step+$start]
oscmd start $oscno
hmm countblock
oct oscillate_count $oscno
oct oscillate start
save $i
}
oscmd stop
}
proc UniPulseTexture {motor start step numsteps volt freq bins oscno} {
@@ -144,12 +183,10 @@ proc UniPulseTexture {motor start step numsteps volt freq bins oscno} {
for {set i 0} {$i < $numsteps} {incr i} {
drive $motor [expr $i*$step+$start]
oscmd start $oscno
hmm countblock
oct oscillate_count $oscno
oct oscillate start
save $i
}
oscmd stop
}
@@ -162,8 +199,8 @@ proc BehlkePulseTexture {motor start step numsteps freq bins oscno} {
PulserOn
for {set i 0} {$i < $numsteps} {incr i} {
drive $motor [expr $i*$step+$start]
oscmd start $oscno
hmm countblock
oct oscillate_count $oscno
oct oscillate start
save $i
}
}
@@ -189,12 +226,11 @@ proc SquarePulseVolt {start step fin freq bins oscno} {
PulserOn
# sct_pulser send "APPL:SQU $freq,$pulservolt,0"
}
oscmd start $oscno
hmm countblock
oct oscillate_count $oscno
oct oscillate start
save $i
incr i
}
oscmd stop
}
proc SquarePulseFreq {volt freqlist bins oscno} {
@@ -209,12 +245,11 @@ proc SquarePulseFreq {volt freqlist bins oscno} {
PulserSquare $freq $pulservolt
PulserOn
# sct_pulser send "APPL:SQU $freq,$pulservolt,0"
oscmd start $oscno
hmm countblock
oct oscillate_count $oscno
oct oscillate start
save $i
incr i
}
oscmd stop
}
proc BehlkePulseFreq {freqlist bins oscno} {
@@ -227,12 +262,11 @@ proc BehlkePulseFreq {freqlist bins oscno} {
wait 3
PulserSquareOffs $freq 2.5 2.5
PulserOn
oscmd start $oscno
hmm countblock
oct oscillate_count $oscno
oct oscillate start
save $i
incr i
}
oscmd stop
}
proc SinePulseFreq {volt freqlist bins oscno} {
@@ -246,12 +280,11 @@ proc SinePulseFreq {volt freqlist bins oscno} {
wait 3
PulserSin $freq $pulservolt
PulserOn
oscmd start $oscno
hmm countblock
oct oscillate_count $oscno
oct oscillate start
save $i
incr i
}
oscmd stop
}
@@ -271,12 +304,11 @@ proc UniPulseFreq {volt freqlist bins oscno} {
PulserSquareOffs $freq $pulservolt $pulseroffs
PulserOn
# sct_pulser send "APPL:SQU $freq,$pulservolt,[expr {$pulservolt/2}]"
oscmd start $oscno
hmm countblock
oct oscillate_count $oscno
oct oscillate start
save $i
incr i
}
oscmd stop
}
proc UniPulseFatigue {volt freq bins oscno reps runs} {
@@ -290,13 +322,14 @@ proc UniPulseFatigue {volt freq bins oscno reps runs} {
for {set i 0} {$i<$runs} {incr i} {
newfile HISTOGRAM_XYT
for {set j 0} {$j<$reps} {incr j} {
oscmd start $oscno
hmm countblock
oct oscillate_count $oscno
oct oscillate start
save $j
}
oscmd stop
}
PulserOff
set pulserstate 0
Histmem_strobo_off
}
@@ -315,6 +348,7 @@ proc PulserBurst {} {
if {[string first 1 $sval] >-1} {break}
}
PulserOff
set pulserstate 0
}
@@ -338,6 +372,7 @@ proc VoltPulseRun {vlo vhi freq cycl} {
sct_pulser send "BURS:NCYC $prem; NCYC?"
PulserBurst
PulserOff
set pulserstate 0
sct_pulser send "BURS:STAT OFF; STAT?"
}
@@ -376,6 +411,7 @@ proc OneTri {volt period} {
sct_pulser send "BURS:NCYC 1; NCYC?"
PulserBurst
PulserOff
set pulserstat 0
}
@@ -384,6 +420,9 @@ publish GetVolt user
publish SetDC user
publish SetVolt user
publish SetVoltScale user
publish SingleVTexScan user
publish VListTexScan user
publish SetRampParms user
publish SingleVolt user
publish VoltRamp user
publish SquarePulseVolt user
@@ -399,5 +438,6 @@ publish SquarePulseTexture user
publish BehlkePulseTexture user
publish BehlkePulseFreq user
publish UniPulseTexture user
publish VoltSetStep user

View File

@@ -54,7 +54,7 @@ proc PulserSquareOffs {Freq Volt Offs} {
proc PulserDC {Volt} {
#NOTE: Setting FUNC DC generates a remote ctrl error if the
# burst mode happens to be on
set resp [sct_pulser transact "BURS:STAT OFF;:FUNC DC;:VOLT:OFFS $Volt; OFFS?"]
set resp [sct_pulser send "BURS:STAT OFF;:FUNC DC;:VOLT:OFFS $Volt; OFFS?"]
broadcast $resp
}