pulser and hvcommands are available in the common config/commands path
r3355 | ffr | 2012-01-27 14:25:14 +1100 (Fri, 27 Jan 2012) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
4ef2f989ba
commit
0a800bbffc
@@ -1,398 +0,0 @@
|
|||||||
|
|
||||||
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
|
|
||||||
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
|
|
||||||
pulserDC $pulservolt
|
|
||||||
PulserOn
|
|
||||||
}
|
|
||||||
oscmd start $oscno
|
|
||||||
hmm countblock
|
|
||||||
save 0
|
|
||||||
oscmd stop
|
|
||||||
}
|
|
||||||
|
|
||||||
proc SetDC {} {
|
|
||||||
pulseroff
|
|
||||||
pulser send FUNC DC
|
|
||||||
pulser send VOLT:OFFS 0
|
|
||||||
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
|
|
||||||
pulser send TRIG:SOUR BUS
|
|
||||||
pulser send BURS:STAT ON
|
|
||||||
PulserOn
|
|
||||||
pulser send *TRG
|
|
||||||
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]
|
|
||||||
pulser send VOLT:HIGH [VoltScale $vhi]
|
|
||||||
pulser send FREQ $freq
|
|
||||||
pulser send BURS:PHAS [expr {90.0 - ($vhi*180.0)/(($vhi-$vlo)*1.0)}]
|
|
||||||
pulser send BURS:MODE TRIG
|
|
||||||
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
|
|
||||||
PulserBurst
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pulser send BURS:NCYC $prem
|
|
||||||
PulserBurst
|
|
||||||
PulserOff
|
|
||||||
pulser send BURS:STAT OFF
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
proc VoltPulses {vlo vhi freq cycl} {
|
|
||||||
PulserOff
|
|
||||||
pulser send FUNC SQU
|
|
||||||
VoltPulseRun $vlo $vhi $freq $cycl
|
|
||||||
}
|
|
||||||
|
|
||||||
proc VoltTriPulses {vlo vhi freq cycl} {
|
|
||||||
PulserOff
|
|
||||||
pulser send FUNC RAMP
|
|
||||||
pulser send FUNC:RAMP:SYMM 50
|
|
||||||
VoltPulseRun $vlo $vhi $freq $cycl
|
|
||||||
}
|
|
||||||
|
|
||||||
proc OneTri {volt period} {
|
|
||||||
PulserOff
|
|
||||||
if {$volt > 0} {
|
|
||||||
pulser send VOLT:LOW 0
|
|
||||||
pulser send VOLT:HIGH [VoltScale $volt]
|
|
||||||
pulser send BURS:PHAS -90
|
|
||||||
} else {
|
|
||||||
pulser send VOLT:LOW [VoltScale $volt]
|
|
||||||
pulser send VOLT:HIGH 0
|
|
||||||
pulser send BURS:PHAS 90
|
|
||||||
}
|
|
||||||
pulser send FUNC RAMP
|
|
||||||
pulser send FUNC:RAMP:SYMM 50
|
|
||||||
pulser send FREQ [expr {1.0/$period}]
|
|
||||||
|
|
||||||
pulser send BURS:MODE TRIG
|
|
||||||
|
|
||||||
pulser send BURS:NCYC 1
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
proc PulserOn {} {
|
|
||||||
pulser send "OUTP ON"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
proc PulserOff {} {
|
|
||||||
pulser send "OUTP OFF"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
proc PulserTTLOn {} {
|
|
||||||
set resp [pulser send FUNC?]
|
|
||||||
if {[string first "DC" $resp ] == -1 } {
|
|
||||||
pulser send FUNC DC
|
|
||||||
}
|
|
||||||
pulser send VOLT:OFFS 5
|
|
||||||
PulserOn
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
proc PulserSin {Freq Volt} {
|
|
||||||
set resp [pulser send FUNC?]
|
|
||||||
if {[string first "SIN" $resp ] == -1 } {
|
|
||||||
pulser send FUNC SIN
|
|
||||||
}
|
|
||||||
pulser send VOLT $Volt
|
|
||||||
pulser send FREQ $Freq
|
|
||||||
pulser send VOLT:OFFS 0
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
proc PulserSquare {Freq Volt} {
|
|
||||||
set resp [pulser send FUNC?]
|
|
||||||
if {[string first "SQU" $resp ] == -1 } {
|
|
||||||
pulser send FUNC SQU
|
|
||||||
}
|
|
||||||
pulser send VOLT $Volt
|
|
||||||
pulser send FREQ $Freq
|
|
||||||
pulser send VOLT:OFFS 0
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
proc PulserSquareOffs {Freq Volt Offs} {
|
|
||||||
set resp [pulser send FUNC?]
|
|
||||||
if {[string first "SQU" $resp ] == -1 } {
|
|
||||||
pulser send FUNC SQU
|
|
||||||
}
|
|
||||||
pulser send VOLT $Volt
|
|
||||||
pulser send FREQ $Freq
|
|
||||||
pulser send VOLT:OFFS $Offs
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
proc PulserDC {Volt} {
|
|
||||||
set resp [pulser send FUNC?]
|
|
||||||
if {[string first "DC" $resp ] == -1 } {
|
|
||||||
pulser send FUNC DC
|
|
||||||
}
|
|
||||||
pulser send VOLT:OFFS $Volt
|
|
||||||
set resp [pulser send FUNC?]
|
|
||||||
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