From d416695b4baf4026a0492d436a57883b3fe31ab4 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Fri, 23 Sep 2011 14:21:09 +1000 Subject: [PATCH] Merged in-situ changes from Echidna r3252 | ffr | 2011-09-23 14:21:09 +1000 (Fri, 23 Sep 2011) | 2 lines --- .../instrument/hrpd/config/INSTCFCOMMON.TXT | 1 + .../hrpd/config/commands/hvcommands.tcl | 302 ++++++++++++++++++ .../hrpd/config/commands/pulser.tcl | 60 ++++ .../hrpd/config/counter/counter.tcl | 2 +- .../config/motors/motor_configuration.tcl | 1 + .../instrument/hrpd/echidna_configuration.tcl | 8 +- 6 files changed, 371 insertions(+), 3 deletions(-) create mode 100644 site_ansto/instrument/hrpd/config/commands/hvcommands.tcl create mode 100644 site_ansto/instrument/hrpd/config/commands/pulser.tcl diff --git a/site_ansto/instrument/hrpd/config/INSTCFCOMMON.TXT b/site_ansto/instrument/hrpd/config/INSTCFCOMMON.TXT index 5dae9123..96d9ae99 100644 --- a/site_ansto/instrument/hrpd/config/INSTCFCOMMON.TXT +++ b/site_ansto/instrument/hrpd/config/INSTCFCOMMON.TXT @@ -2,6 +2,7 @@ config/source/source_common.tcl config/anticollider/anticollider_common.tcl config/plc/plc_common_1.tcl config/counter/counter_common_1.tcl +config/environment/sct_keithley_2700.tcl config/environment/temperature/sct_lakeshore_340.tcl config/environment/temperature/sct_lakeshore_336.tcl config/environment/temperature/west400.tcl diff --git a/site_ansto/instrument/hrpd/config/commands/hvcommands.tcl b/site_ansto/instrument/hrpd/config/commands/hvcommands.tcl new file mode 100644 index 00000000..f8948a63 --- /dev/null +++ b/site_ansto/instrument/hrpd/config/commands/hvcommands.tcl @@ -0,0 +1,302 @@ +proc SetVolt {volt} { + if {$volt== 0} { + PulserOff + } else { + set pulservolt [expr {($volt*1.0)/1000.0}] + 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 [expr {($volt*1.0)/1000.0}] + 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 [expr {($j*1.0)/1000.0}] + 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 [expr {($j*1.0)/1000.0}] + 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 SquarePulseVolt {start step fin freq oscno} { + histmem mode unlimited + newfile HISTOGRAM_XYT + 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 [expr {($j*1.0)/1000.0}] + 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 [expr {($volt*1.0)/1000.0}] + 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 SinePulseFreq {volt freqlist bins oscno} { + histmem mode unlimited + newfile HISTOGRAM_XYT + set loopvar 1 + set i 0 + foreach freq $freqlist { + set pulservolt [expr {($volt*1.0)/1000.0}] + 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 [expr {($volt*1.0)/2000.0}] + 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 [expr {($volt*1.0)/1000}] + 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 [expr {$vlo/1000.0}] + pulser send VOLT:HIGH [expr {$vhi/1000.0}] + 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 [expr {$volt/1000.0}] + pulser send BURS:PHAS -90 + } else { + pulser send VOLT:LOW [expr {$volt/1000.0}] + 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 diff --git a/site_ansto/instrument/hrpd/config/commands/pulser.tcl b/site_ansto/instrument/hrpd/config/commands/pulser.tcl new file mode 100644 index 00000000..9782b376 --- /dev/null +++ b/site_ansto/instrument/hrpd/config/commands/pulser.tcl @@ -0,0 +1,60 @@ +proc PulserOn {} { + pulser send "OUTP ON" + +} + +proc PulserOff {} { + pulser send "OUTP OFF" + +} + +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?] + broadcast $resp + if {[string first "DC" $resp ] == -1 } { + pulser send FUNC DC + } + pulser send VOLT:OFFS $Volt + +} + +publish PulserOn user +publish PulserOff user +publish PulserSin user +publish PulserSquare user +publish PulserDC user +publish PulserSquareOffs user + diff --git a/site_ansto/instrument/hrpd/config/counter/counter.tcl b/site_ansto/instrument/hrpd/config/counter/counter.tcl index 22419975..3ae86d84 100644 --- a/site_ansto/instrument/hrpd/config/counter/counter.tcl +++ b/site_ansto/instrument/hrpd/config/counter/counter.tcl @@ -15,7 +15,7 @@ proc ::counter::isc_initialize {} { variable isc_numchannels variable isc_monitor_address variable isc_portlist - variable isc_beam_monitor_list {MONITOR_1 MONITOR_2} + variable isc_beam_monitor_list {MONITOR_1 MONITOR_2 MONITOR_3} set isc_monitor_address "das1-[SplitReply [instrument]]" set isc_portlist [list 30000 30001 30002 30003 30004 30005 30006 30007] diff --git a/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl b/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl index 737038ba..019caf31 100644 --- a/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl @@ -108,6 +108,7 @@ set slit2HGroup second/horizontal set move_count 10 fileeval $cfPath(motors)/tilt_configuration.tcl +#fileeval $cfPath(motors)/small_omega.tcl #fileeval $cfPath(motors)/euler_configuration.tcl ############################ # Motor Controller 1 diff --git a/site_ansto/instrument/hrpd/echidna_configuration.tcl b/site_ansto/instrument/hrpd/echidna_configuration.tcl index 039fa5ea..48c8c838 100644 --- a/site_ansto/instrument/hrpd/echidna_configuration.tcl +++ b/site_ansto/instrument/hrpd/echidna_configuration.tcl @@ -25,12 +25,15 @@ fileeval $cfPath(motors)/positmotor_configuration.tcl fileeval $cfPath(plc)/plc.tcl fileeval $cfPath(counter)/counter.tcl #TODO Provide method for choosing environment controller +fileeval $cfPath(environment)/sct_keithley_2700.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_336.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_340.tcl fileeval $cfPath(environment)/temperature/west400.tcl fileeval $cfPath(hmm)/hmm_configuration.tcl fileeval $cfPath(nexus)/nxscripts.tcl fileeval $cfPath(scan)/scan.tcl +fileeval $cfPath(commands)/pulser.tcl +fileeval $cfPath(commands)/hvcommands.tcl fileeval $cfPath(commands)/commands.tcl fileeval $cfPath(anticollider)/anticollider.tcl #fileeval $cfPath(environment)/robby_configuration.tcl @@ -42,8 +45,9 @@ source gumxml.tcl # Current driver for Lakeshore temperature controllers # ########################################################## # driverName shortName IP-address port LineTerminator Tolerance1 Tolerance2 optional_Verbose -#add_sct_ls336 tc1 137.157.201.23 7777 "\r\n" 5.0 5.0 -#add_sct_ls340 tc2 ca5-[instname] 4001 "\r" 0.5 1.0 + add_sct_ls340 tc2 ca5-[instname] 4002 "\r" 0.5 1.0 +# add_sct_ls336 tc3 137.157.201.24 7777 "\r\n" 5.0 5.0 + add_sct_ls336 tc1 137.157.201.23 7777 "\r\n" 5.0 5.0 #::environment::temperature::add_west400 137.157.201.14 #::robot::add_robby