Added HV pulser commands from Wombat. Made some bug fixes and modified
commands to provide feedback when setting a parameter because the sctcontroller expects feedback from all commands. r3352 | ffr | 2012-01-27 13:57:19 +1100 (Fri, 27 Jan 2012) | 4 lines
This commit is contained in:
committed by
Douglas Clowes
parent
dd12f15603
commit
2c862d24c6
399
site_ansto/instrument/config/commands/hvcommands.tcl
Normal file
399
site_ansto/instrument/config/commands/hvcommands.tcl
Normal file
@@ -0,0 +1,399 @@
|
|||||||
|
|
||||||
|
set scaleval 1000.0
|
||||||
|
|
||||||
|
proc SetVoltScale {newscaleval} {
|
||||||
|
global scaleval
|
||||||
|
set scaleval $newscaleval
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VoltScale {involt} {
|
||||||
|
global scaleval
|
||||||
|
return [expr {($involt*1.0)/$scaleval}]
|
||||||
|
}
|
||||||
|
|
||||||
|
proc SetVolt {volt} {
|
||||||
|
if {$volt== 0} {
|
||||||
|
PulserOff
|
||||||
|
} else {
|
||||||
|
set pulservolt [VoltScale $volt]
|
||||||
|
pulser send "VOLT:OFFS $pulservolt; OFFS?"
|
||||||
|
PulserDC $pulservolt
|
||||||
|
PulserOn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc GetVolt {} {
|
||||||
|
pulser send VOLT:OFFS?
|
||||||
|
}
|
||||||
|
|
||||||
|
proc SingleVolt {volt oscno} {
|
||||||
|
histmem mode unlimited
|
||||||
|
newfile HISTOGRAM_XY
|
||||||
|
if {$volt== 0} {
|
||||||
|
PulserOff
|
||||||
|
} else {
|
||||||
|
set pulservolt [VoltScale $volt]
|
||||||
|
pulser send "VOLT:OFFS $pulservolt; OFFS?"
|
||||||
|
pulserDC $pulservolt
|
||||||
|
PulserOn
|
||||||
|
}
|
||||||
|
oscmd start $oscno
|
||||||
|
hmm countblock
|
||||||
|
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 [pulser send "BURS:STAT OFF;:FUNC DC;:VOLT:OFFS 0; OFFS?"]
|
||||||
|
pulseron
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VoltRamp {start step fin oscno} {
|
||||||
|
histmem mode unlimited
|
||||||
|
|
||||||
|
newfile HISTOGRAM_XY
|
||||||
|
set loopvar 1
|
||||||
|
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
|
||||||
|
}
|
||||||
|
oscmd start $oscno
|
||||||
|
hmm countblock
|
||||||
|
save $i
|
||||||
|
incr i
|
||||||
|
}
|
||||||
|
oscmd stop
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VoltTextureRamp {start step fin mot tstart tstep tfin oscno} {
|
||||||
|
histmem mode unlimited
|
||||||
|
|
||||||
|
|
||||||
|
set loopvar 1
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc SquarePulseTexture {motor start step numsteps volt freq bins oscno} {
|
||||||
|
histmem mode unlimited
|
||||||
|
newfile HISTOGRAM_XYT
|
||||||
|
histmem_period_strobo $freq $bins
|
||||||
|
wait 3
|
||||||
|
set pulservolt [VoltScale $volt]
|
||||||
|
PulserSquare $freq $pulservolt
|
||||||
|
PulserOn
|
||||||
|
|
||||||
|
for {set i 0} {$i < $numsteps} {incr i} {
|
||||||
|
drive $motor [expr $i*$step+$start]
|
||||||
|
oscmd start $oscno
|
||||||
|
hmm countblock
|
||||||
|
save $i
|
||||||
|
}
|
||||||
|
|
||||||
|
oscmd stop
|
||||||
|
}
|
||||||
|
|
||||||
|
proc UniPulseTexture {motor start step numsteps volt freq bins oscno} {
|
||||||
|
histmem mode unlimited
|
||||||
|
newfile HISTOGRAM_XYT
|
||||||
|
histmem_period_strobo $freq $bins
|
||||||
|
wait 3
|
||||||
|
set pulservolt [VoltScale [expr ($volt*1.0/2)]]
|
||||||
|
PulserSquareOffs $freq $pulservolt $pulservolt
|
||||||
|
PulserOn
|
||||||
|
|
||||||
|
for {set i 0} {$i < $numsteps} {incr i} {
|
||||||
|
drive $motor [expr $i*$step+$start]
|
||||||
|
oscmd start $oscno
|
||||||
|
hmm countblock
|
||||||
|
save $i
|
||||||
|
}
|
||||||
|
|
||||||
|
oscmd stop
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc BehlkePulseTexture {motor start step numsteps freq bins oscno} {
|
||||||
|
histmem mode unlimited
|
||||||
|
newfile HISTOGRAM_XYT
|
||||||
|
histmem_period_strobo $freq $bins
|
||||||
|
wait 3
|
||||||
|
PulserSquareOffs $freq 2.5 2.5
|
||||||
|
PulserOn
|
||||||
|
for {set i 0} {$i < $numsteps} {incr i} {
|
||||||
|
drive $motor [expr $i*$step+$start]
|
||||||
|
oscmd start $oscno
|
||||||
|
hmm countblock
|
||||||
|
save $i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
proc SquarePulseVolt {start step fin freq bins oscno} {
|
||||||
|
histmem mode unlimited
|
||||||
|
newfile HISTOGRAM_XYT
|
||||||
|
histmem_period_strobo $freq $bins
|
||||||
|
wait 3
|
||||||
|
set loopvar 1
|
||||||
|
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]
|
||||||
|
PulserSquare $freq $pulservolt
|
||||||
|
PulserOn
|
||||||
|
# pulser send "APPL:SQU $freq,$pulservolt,0"
|
||||||
|
}
|
||||||
|
oscmd start $oscno
|
||||||
|
hmm countblock
|
||||||
|
save $i
|
||||||
|
incr i
|
||||||
|
}
|
||||||
|
oscmd stop
|
||||||
|
}
|
||||||
|
|
||||||
|
proc SquarePulseFreq {volt freqlist bins oscno} {
|
||||||
|
histmem mode unlimited
|
||||||
|
newfile HISTOGRAM_XYT
|
||||||
|
set loopvar 1
|
||||||
|
set i 0
|
||||||
|
foreach freq $freqlist {
|
||||||
|
set pulservolt [VoltScale $volt]
|
||||||
|
histmem_period_strobo $freq $bins
|
||||||
|
wait 3
|
||||||
|
PulserSquare $freq $pulservolt
|
||||||
|
PulserOn
|
||||||
|
# pulser send "APPL:SQU $freq,$pulservolt,0"
|
||||||
|
oscmd start $oscno
|
||||||
|
hmm countblock
|
||||||
|
save $i
|
||||||
|
incr i
|
||||||
|
}
|
||||||
|
oscmd stop
|
||||||
|
}
|
||||||
|
|
||||||
|
proc BehlkePulseFreq {freqlist bins oscno} {
|
||||||
|
histmem mode unlimited
|
||||||
|
newfile HISTOGRAM_XYT
|
||||||
|
set loopvar 1
|
||||||
|
set i 0
|
||||||
|
foreach freq $freqlist {
|
||||||
|
histmem_period_strobo $freq $bins
|
||||||
|
wait 3
|
||||||
|
PulserSquareOffs $freq 2.5 2.5
|
||||||
|
PulserOn
|
||||||
|
oscmd start $oscno
|
||||||
|
hmm countblock
|
||||||
|
save $i
|
||||||
|
incr i
|
||||||
|
}
|
||||||
|
oscmd stop
|
||||||
|
}
|
||||||
|
|
||||||
|
proc SinePulseFreq {volt freqlist bins oscno} {
|
||||||
|
histmem mode unlimited
|
||||||
|
newfile HISTOGRAM_XYT
|
||||||
|
set loopvar 1
|
||||||
|
set i 0
|
||||||
|
foreach freq $freqlist {
|
||||||
|
set pulservolt [VoltScale $volt]
|
||||||
|
histmem_period_strobo $freq $bins
|
||||||
|
wait 3
|
||||||
|
PulserSin $freq $pulservolt
|
||||||
|
PulserOn
|
||||||
|
oscmd start $oscno
|
||||||
|
hmm countblock
|
||||||
|
save $i
|
||||||
|
incr i
|
||||||
|
}
|
||||||
|
oscmd stop
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
proc UniPulseFreq {volt freqlist bins oscno} {
|
||||||
|
histmem mode unlimited
|
||||||
|
newfile HISTOGRAM_XYT
|
||||||
|
set loopvar 1
|
||||||
|
set i 0
|
||||||
|
foreach freq $freqlist {
|
||||||
|
set pulservolt [VoltScale [expr ($volt*1.0/2)]]
|
||||||
|
histmem_period_strobo $freq $bins
|
||||||
|
wait 3
|
||||||
|
# PulserSquareOffs $freq $pulservolt [expr {$pulservolt/2}]
|
||||||
|
PulserSquareOffs $freq $pulservolt $pulservolt
|
||||||
|
PulserOn
|
||||||
|
# pulser send "APPL:SQU $freq,$pulservolt,[expr {$pulservolt/2}]"
|
||||||
|
oscmd start $oscno
|
||||||
|
hmm countblock
|
||||||
|
save $i
|
||||||
|
incr i
|
||||||
|
}
|
||||||
|
oscmd stop
|
||||||
|
}
|
||||||
|
|
||||||
|
proc UniPulseFatigue {volt freq bins oscno reps runs} {
|
||||||
|
histmem mode unlimited
|
||||||
|
set pulservolt [VoltScale $volt]
|
||||||
|
set halfvolt [expr {$pulservolt/2.0}]
|
||||||
|
histmem_period_strobo $freq $bins
|
||||||
|
wait 3
|
||||||
|
PulserSquareOffs $freq $halfvolt $halfvolt
|
||||||
|
PulserOn
|
||||||
|
for {set i 0} {$i<$runs} {incr i} {
|
||||||
|
newfile HISTOGRAM_XYT
|
||||||
|
for {set j 0} {$j<$reps} {incr j} {
|
||||||
|
oscmd start $oscno
|
||||||
|
hmm countblock
|
||||||
|
save $j
|
||||||
|
}
|
||||||
|
oscmd stop
|
||||||
|
}
|
||||||
|
PulserOff
|
||||||
|
Histmem_strobo_off
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
proc PulserBurst {} {
|
||||||
|
pulser send "BURS:MODE TRIG; MODE?"
|
||||||
|
pulser send "TRIG:SOUR BUS; SOUR?"
|
||||||
|
pulser send "BURS:STAT ON; STAT?"
|
||||||
|
PulserOn
|
||||||
|
pulser send "*TRG;:BURS:NCYC?"
|
||||||
|
while {1} {
|
||||||
|
set sval [pulser send *OPC?]
|
||||||
|
if {[string first 1 $sval] >-1} {break}
|
||||||
|
}
|
||||||
|
PulserOff
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc VoltPulseRun {vlo vhi freq cycl} {
|
||||||
|
PulserOff
|
||||||
|
|
||||||
|
pulser send "VOLT:LOW [VoltScale $vlo]; LOW?"
|
||||||
|
pulser send "VOLT:HIGH [VoltScale $vhi]; HIGH?"
|
||||||
|
pulser send "FREQ $freq;:FREQ?"
|
||||||
|
pulser send "BURS:PHAS [expr {90.0 - ($vhi*180.0)/(($vhi-$vlo)*1.0)}]; PHAS?"
|
||||||
|
pulser send "BURS:MODE TRIG; MODE?"
|
||||||
|
set ploop [expr {int($cycl/50000)}]
|
||||||
|
set prem [expr {$cycl % 50000}]
|
||||||
|
if {$ploop >0} {
|
||||||
|
for {set i 0} {$i< $ploop} {incr i} {
|
||||||
|
Pulser send "BURS:NCYC 50000; NCYC?"
|
||||||
|
PulserBurst
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pulser send "BURS:NCYC $prem; NCYC?"
|
||||||
|
PulserBurst
|
||||||
|
PulserOff
|
||||||
|
pulser send "BURS:STAT OFF; STAT?"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc VoltPulses {vlo vhi freq cycl} {
|
||||||
|
PulserOff
|
||||||
|
pulser send "FUNC SQU;:FUNC?"
|
||||||
|
VoltPulseRun $vlo $vhi $freq $cycl
|
||||||
|
}
|
||||||
|
|
||||||
|
proc VoltTriPulses {vlo vhi freq cycl} {
|
||||||
|
PulserOff
|
||||||
|
pulser send "FUNC RAMP;:FUNC?"
|
||||||
|
pulser send "FUNC:RAMP:SYMM 50;:FUNC:RAMP:SYMM?"
|
||||||
|
VoltPulseRun $vlo $vhi $freq $cycl
|
||||||
|
}
|
||||||
|
|
||||||
|
proc OneTri {volt period} {
|
||||||
|
PulserOff
|
||||||
|
if {$volt > 0} {
|
||||||
|
pulser send "VOLT:LOW 0; LOW?"
|
||||||
|
pulser send "VOLT:HIGH [VoltScale $volt]; HIGH?"
|
||||||
|
pulser send "BURS:PHAS -90; PHAS?"
|
||||||
|
} else {
|
||||||
|
pulser send "VOLT:LOW [VoltScale $volt]; LOW?"
|
||||||
|
pulser send "VOLT:HIGH 0; HIGH?"
|
||||||
|
pulser send "BURS:PHAS 90; PHAS?"
|
||||||
|
}
|
||||||
|
pulser send "FUNC RAMP;:FUNC?"
|
||||||
|
pulser send "FUNC:RAMP:SYMM 50;:FUNC:RAMP:SYMM?"
|
||||||
|
pulser send "FREQ [expr {1.0/$period}];:FREQ?"
|
||||||
|
|
||||||
|
pulser send "BURS:MODE TRIG; MODE?"
|
||||||
|
|
||||||
|
pulser send "BURS:NCYC 1; NCYC?"
|
||||||
|
PulserBurst
|
||||||
|
PulserOff
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
publish GetVolt user
|
||||||
|
publish SetDC user
|
||||||
|
publish SetVolt user
|
||||||
|
publish SingleVolt user
|
||||||
|
publish VoltRamp user
|
||||||
|
publish SquarePulseVolt user
|
||||||
|
publish SquarePulseFreq user
|
||||||
|
publish UniPulseFreq user
|
||||||
|
publish VoltTextureRamp user
|
||||||
|
publish VoltPulses user
|
||||||
|
publish VoltTriPulses user
|
||||||
|
publish OneTri user
|
||||||
|
publish UniPulseFatigue user
|
||||||
|
publish SetVoltScale user
|
||||||
|
publish SquarePulseTexture user
|
||||||
|
publish BehlkePulseTexture user
|
||||||
|
publish BehlkePulseFreq user
|
||||||
|
publish UniPulseTexture user
|
||||||
|
|
||||||
|
|
||||||
70
site_ansto/instrument/config/commands/pulser.tcl
Normal file
70
site_ansto/instrument/config/commands/pulser.tcl
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
proc PulserOn {} {
|
||||||
|
pulser send "OUTP ON;:OUTP?"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
proc PulserOff {} {
|
||||||
|
pulser send "OUTP OFF;:OUTP?"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
proc PulserTTLOn {} {
|
||||||
|
#NOTE: Setting FUNC DC generates a remote ctrl error if the
|
||||||
|
# burst mode happens to be on
|
||||||
|
pulser send "BURS:STAT OFF;:FUNC DC;:VOLT:OFFS 5; OFFS?"
|
||||||
|
PulserOn
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc PulserSin {Freq Volt} {
|
||||||
|
set resp [pulser send FUNC?]
|
||||||
|
if {[string first "SIN" $resp ] == -1 } {
|
||||||
|
pulser send "FUNC SIN;:FUNC?"
|
||||||
|
}
|
||||||
|
pulser send "VOLT $Volt;:VOLT?"
|
||||||
|
pulser send "FREQ $Freq;:FREQ?"
|
||||||
|
pulser send "VOLT:OFFS 0; OFFS?"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
proc PulserSquare {Freq Volt} {
|
||||||
|
set resp [pulser send FUNC?]
|
||||||
|
if {[string first "SQU" $resp ] == -1 } {
|
||||||
|
pulser send "FUNC SQU;:FUNC?"
|
||||||
|
}
|
||||||
|
pulser send "VOLT $Volt;:VOLT?"
|
||||||
|
pulser send "FREQ $Freq;:FREQ?"
|
||||||
|
pulser send "VOLT:OFFS 0; OFFS?"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
proc PulserSquareOffs {Freq Volt Offs} {
|
||||||
|
set resp [pulser send FUNC?]
|
||||||
|
if {[string first "SQU" $resp ] == -1 } {
|
||||||
|
pulser send "FUNC SQU;:FUNC?"
|
||||||
|
}
|
||||||
|
pulser send "VOLT $Volt;:VOLT?"
|
||||||
|
pulser send "FREQ $Freq;:FREQ?"
|
||||||
|
pulser send "VOLT:OFFS $Offs; OFFS?"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc PulserDC {Volt} {
|
||||||
|
#NOTE: Setting FUNC DC generates a remote ctrl error if the
|
||||||
|
# burst mode happens to be on
|
||||||
|
set resp [pulser send "BURS:STAT OFF;:FUNC DC;:VOLT:OFFS $Volt; OFFS?"]
|
||||||
|
broadcast $resp
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
publish PulserOn user
|
||||||
|
publish PulserOff user
|
||||||
|
publish PulserSin user
|
||||||
|
publish PulserSquare user
|
||||||
|
publish PulserDC user
|
||||||
|
publish PulserSquareOffs user
|
||||||
|
publish PulserTTLOn user
|
||||||
Reference in New Issue
Block a user