From a974be9c863d86ef84fa1b0a4fe3bfcaac96b8a0 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Mon, 19 Jan 2015 16:08:07 +1100 Subject: [PATCH 1/7] SICS-844 Add eulerian cradle configuration to Taipan --- .../tas/config/motors/euler_configuration.tcl | 76 ++++++++++ .../instrument/tas/util/sics_config.ini | 131 +++++++++++++++++- 2 files changed, 202 insertions(+), 5 deletions(-) create mode 100644 site_ansto/instrument/tas/config/motors/euler_configuration.tcl diff --git a/site_ansto/instrument/tas/config/motors/euler_configuration.tcl b/site_ansto/instrument/tas/config/motors/euler_configuration.tcl new file mode 100644 index 00000000..ceda6d7a --- /dev/null +++ b/site_ansto/instrument/tas/config/motors/euler_configuration.tcl @@ -0,0 +1,76 @@ +# This must be loaded by motor_configuration.tcl + +set ephi_Home 26575217 +#set echi_Home 24224381 +#set echi_Home 8919294 +set echi_Home 24207159 +set eom_Home 23165482 + +# Sample Lower Tilt sgl -> Euler Chi +Motor echi $motor_driver_type [params \ + asyncqueue mc2\ + axis B\ + units degrees\ + hardlowerlim -45\ + hardupperlim 120\ + maxSpeed 2\ + maxAccel 2\ + maxDecel 2\ + stepsPerX -25000\ + absEnc 1\ + absEncHome $echi_Home\ + cntsPerX 8192] +setHomeandRange -motor echi -home 0 -lowrange 10 -uprange 95 +echi softlowerlim -10 +echi softupperlim 120 +echi home 0 +echi speed 1 +echi movecount $move_count +echi precision 0.01 +echi part sample +echi long_name euler_chi + +# Sample Upper Tilt sgu -> Euler Phi +Motor ephi $motor_driver_type [params \ + asyncqueue mc2\ + axis A\ + units degrees\ + hardlowerlim -365\ + hardupperlim 365\ + maxSpeed 5\ + maxAccel 5\ + maxDecel 5\ + stepsPerX -12500\ + absEnc 1\ + absEncHome $ephi_Home\ + cntsPerX -4096] +setHomeandRange -motor ephi -home 0 -lowrange -360 -uprange 360 +ephi softlowerlim -360 +ephi softupperlim 360 +ephi home 0 +ephi speed 3 +ephi movecount $move_count +ephi precision 0.01 +ephi part sample +ephi long_name euler_phi + +# Sample Upper Translation stu -> euler omega stage +Motor eom $motor_driver_type [params \ + asyncqueue mc2\ + axis C\ + units degrees\ + hardlowerlim -45\ + hardupperlim 80\ + maxSpeed 2\ + maxAccel 2\ + maxDecel 2\ + stepsPerX 25000\ + absEnc 1\ + absEncHome $eom_Home\ + cntsPerX -8192] +setHomeandRange -motor eom -home 0 -lowrange 35 -uprange 80 +eom speed 1 +eom movecount $move_count +eom precision 0.01 +eom part sample +eom long_name euler_omega diff --git a/site_ansto/instrument/tas/util/sics_config.ini b/site_ansto/instrument/tas/util/sics_config.ini index 42de7fd6..f34a4d35 100644 --- a/site_ansto/instrument/tas/util/sics_config.ini +++ b/site_ansto/instrument/tas/util/sics_config.ini @@ -1,15 +1,24 @@ [12tmagnet_setup] -cascade = B1:12tmagnet_oxford,sample_stage:12tmagnet_sample_insert,T1:mercury_scpi_01 +cascade = B1:12tmagnet_oxford,sample_stage:12tmagnet_sample_insert,m2s2:normal_m2s2,T1:mercury_01 +enabled = False +[3He_setup] +cascade = HE3:he3_both,sample_stage:normal_sample_stage,m2s2:extended_m2s2 enabled = False [CF1] -cascade = T1:CF1_ls340,sample_stage:normal_sample_stage +cascade = T1:CF1_ls340,sample_stage:normal_sample_stage,m2s2:normal_m2s2 enabled = False [CF4] -cascade = T1:CF4_ls340,sample_stage:normal_sample_stage +cascade = T1:CF4_ls340,sample_stage:normal_sample_stage,m2s2:normal_m2s2 +enabled = False +[CF7] +cascade = T1:ls336_08,T2:ls336_05,sample_stage:normal_sample_stage enabled = False [Default] -cascade = sample_stage:normal_sample_stage +cascade = sample_stage:normal_sample_stage,m2s2:normal_m2s2 enabled = True +[OC1] +cascade = T1:OC1_ls340,sample_stage:normal_sample_stage,m2s2:normal_m2s2 +enabled = False [B1] datype = B enabled = False @@ -24,6 +33,13 @@ id = 1 implementation = none name = pulser optype = function_generator +[HE3] +datype = X +enabled = False +id = 1 +implementation = none +name = he3 +optype = polariser [I1] datype = I enabled = False @@ -38,6 +54,13 @@ id = 2 implementation = none name = curr2 optype = multimeter +[P1] +datype = P +enabled = False +id = 1 +implementation = none +name = pressure1 +optype = pressure [T1] datype = T enabled = False @@ -80,6 +103,11 @@ id = 2 implementation = none name = volts2 optype = multimeter +[m2s2] +enabled = Always +implementation = normal_m2s2 +name = m2s2 +optype = m2s2_axes [sample_stage] enabled = Always implementation = normal_sample_stage @@ -118,14 +146,84 @@ terminator = \r\n tol1 = 1.0 tol2 = 1.0 +[OC1_ls340] +desc = "cf1: Orange Cryostat" +driver = "ls340" +imptype = temperature +ip = 10.157.205.41 +port = 4001 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + [agilent_33220A] asyncqueue = sct desc = "Function Generator" driver = agilent_33220A imptype = function_generator ip = 10.157.205.16 +name = pulser port = 5025 +[anv_west6100] +asyncprotocol = modbus_ap +desc = "Needle valve West 6100 temperature controller" +dev_id = 1 +driver = "west_6100" +imptype = pressure +ip = 10.157.205.56 +port = 502 +timeout = 2000 + +[e3200_01] +asyncprotocol = modbus_ap +datype = T +desc = "Eurotherm 3200 (modbus/sct)" +dev_id = 21 +driver = "eurotherm_3200" +imptype = temperature +ip = 10.157.205.58 +port = 502 +tol = 5 + +[eulerian_cradle] +desc = "Load the Eulerian cradle configuration" +imptype = motion_axis + +[extended_m2s2] +desc = "This sets lower speeds and accelerations when the m2 and s2 axes are extended" +imptype = m2s2_axes + +[he3_analyser] +desc = "3He Analyser" +driver = "he3_polanal" +has_anal = true +has_pol = false +imptype = polariser +ip = 10.157.205.2 +port = 55013 +terminator = \r\n + +[he3_both] +desc = "3He Pol+Anal" +driver = "he3_polanal" +has_anal = true +has_pol = true +imptype = polariser +ip = 10.157.205.2 +port = 55013 +terminator = \r\n + +[he3_polariser] +desc = "3He Polariser" +driver = "he3_polanal" +has_anal = false +has_pol = true +imptype = polariser +ip = 10.157.205.2 +port = 55013 +terminator = \r\n + [ls336_01] asyncqueue = sct desc = "Lakeshore 336 temperature controller" @@ -164,7 +262,7 @@ asyncqueue = sct desc = "Lakeshore 336 temperature controller" driver = "ls336" imptype = temperature -ip = 137.157.201.21 +ip = 10.157.205.54 port = 7777 terminator = \r\n tol1 = 1.0 @@ -181,6 +279,17 @@ terminator = \r\n tol1 = 1.0 tol2 = 1.0 +[ls336_08] +asyncqueue = sct +desc = "Lakeshore 336 temperature controller" +driver = "ls336" +imptype = temperature +ip = 10.157.205.55 +port = 7777 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + [ls336_11] desc = "Lakeshore 336 temperature controller" driver = "ls336" @@ -234,6 +343,14 @@ terminator = \r\n tol1 = 1.0 tol2 = 1.0 +[ls370_1] +desc = "Lakeshore 370 Resistance Bridge" +driver = "lakeshore_m370" +imptype = temperature +ip = 10.157.205.42 +port = 4001 +tol = 1.0 + [mercury_01] assoc = 00000124 cards = HHHVLTTP @@ -273,6 +390,10 @@ terminator = \n ttol = 1.0 vtol = 5 +[normal_m2s2] +desc = "This sets speed and acceleration for the default extension of the m2 and s2 axes" +imptype = m2s2_axes + [normal_sample_stage] desc = "This is the default sample stage configuration" imptype = motion_axis From 445a8c2fce0f9fc16a9655121b596d1cb9b99739 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Mon, 19 Jan 2015 16:13:08 +1100 Subject: [PATCH 2/7] Fix eulerian spelling. --- .../instrument/hipd/config/motors/motor_configuration.tcl | 2 +- site_ansto/instrument/hipd/util/sics_config.ini | 2 +- .../instrument/hrpd/config/motors/motor_configuration.tcl | 2 +- site_ansto/instrument/hrpd/util/sics_config.ini | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl b/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl index 067cc0f8..8c11242a 100644 --- a/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl @@ -117,7 +117,7 @@ if { [ info exists ::config_dict ] } { set implementation [ dict get $::config_dict sample_stage implementation ] if {$implementation == "normal_sample_stage"} { set axis_config 0 - } elseif {$implementation == "eularian_cradle"} { + } elseif {$implementation == "eulerian_cradle"} { set axis_config 1 } elseif {$implementation == "small_omega"} { set axis_config 2 diff --git a/site_ansto/instrument/hipd/util/sics_config.ini b/site_ansto/instrument/hipd/util/sics_config.ini index 8a98ddc4..45f527e7 100644 --- a/site_ansto/instrument/hipd/util/sics_config.ini +++ b/site_ansto/instrument/hipd/util/sics_config.ini @@ -133,7 +133,7 @@ imptype = function_generator ip = 10.157.205.16 port = 5025 -[eularian_cradle] +[eulerian_cradle] desc = "Load the Eulerian cradle configuration" imptype = motion_axis diff --git a/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl b/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl index 81c78da7..e7ff2726 100644 --- a/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/hrpd/config/motors/motor_configuration.tcl @@ -109,7 +109,7 @@ if { [ info exists ::config_dict ] } { set implementation [ dict get $::config_dict sample_stage implementation ] if {$implementation == "normal_sample_stage"} { set axis_config 0 - } elseif {$implementation == "eularian_cradle"} { + } elseif {$implementation == "eulerian_cradle"} { set axis_config 1 } elseif {$implementation == "small_omega"} { set axis_config 2 diff --git a/site_ansto/instrument/hrpd/util/sics_config.ini b/site_ansto/instrument/hrpd/util/sics_config.ini index 2f652325..4d58af41 100644 --- a/site_ansto/instrument/hrpd/util/sics_config.ini +++ b/site_ansto/instrument/hrpd/util/sics_config.ini @@ -134,7 +134,7 @@ imptype = function_generator ip = 10.157.205.16 port = 5025 -[eularian_cradle] +[eulerian_cradle] desc = "Load the Eulerian cradle configuration" imptype = motion_axis From e7e2e87b83b7ee74349d1afb93084429ce597fca Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Fri, 13 Mar 2015 11:54:50 +1100 Subject: [PATCH 3/7] Copy changes from ics1-wombat --- .../instrument/config/commands/hvcommands.tcl | 29 +-- .../hipd/config/commands/cfcommands.tcl | 166 ++++++++++++++++++ .../hipd/config/commands/hvsteps.tcl | 109 ++++++++++++ .../hipd/config/hmm/hmm_configuration.tcl | 2 +- .../config/motors/motor_configuration.tcl | 4 +- .../instrument/hipd/wombat_configuration.tcl | 3 +- 6 files changed, 299 insertions(+), 14 deletions(-) create mode 100644 site_ansto/instrument/hipd/config/commands/cfcommands.tcl create mode 100644 site_ansto/instrument/hipd/config/commands/hvsteps.tcl diff --git a/site_ansto/instrument/config/commands/hvcommands.tcl b/site_ansto/instrument/config/commands/hvcommands.tcl index 6af48388..971f6afa 100644 --- a/site_ansto/instrument/config/commands/hvcommands.tcl +++ b/site_ansto/instrument/config/commands/hvcommands.tcl @@ -45,7 +45,7 @@ proc VoltSetStep {start step fin delay} { set i [expr {$start*1.0}] set loopvar 1 SetVolt $i - if {($start == $fin) || ($step == 0)} {break} + if {($start == $fin) || ($step == 0)} {break} while {$loopvar} { wait $delay if {($start < $fin)} { @@ -56,7 +56,7 @@ proc VoltSetStep {start step fin delay} { } } if {($start > $fin)} { - set i [expr {$i - abs($step)}] + set i [expr {$i - abs($step)}] if {$i <= $fin} { set i $fin set loopvar 0 @@ -65,7 +65,7 @@ proc VoltSetStep {start step fin delay} { SetVolt $i } } - + proc GetVolt {} { sct_pulser transact VOLT:OFFS? @@ -102,6 +102,7 @@ proc VoltRamp {start step fin oscno} { SetVolt $j oct oscillate_count $oscno oct oscillate start + hmm countblock save $i incr i } @@ -112,14 +113,14 @@ proc SingleVTexScan {mot tstart tstep tfin oscno} { broadcast in singlevtexscan set loopvar 1 set i_bool 0 - histmem mode unlimited + histmem mode unlimited if {$motdir == 1} { set currentmot $tstart set i 0 } else { set currentmot $tfin set i [expr {int(($tfin-$tstart)/$tstep)}] - } + } newfile HISTOGRAM_XY while {$i_bool==0} { drive $mot $currentmot @@ -140,9 +141,9 @@ proc SingleVTexScan {mot tstart tstep tfin oscno} { } set motdir [expr {(-1*$motdir)}] } - + proc VListTexScan {voltlist mot tstart tstep tfin oscno} { - global rampstep rampdelay + global rampstep rampdelay set curvolt [lindex $voltlist 0] broadcast $curvolt SetVolt $curvolt @@ -167,6 +168,7 @@ proc SquarePulseTexture {motor start step numsteps volt freq bins oscno} { drive $motor [expr $i*$step+$start] oct oscillate_count $oscno oct oscillate start + hmm countblock save $i } } @@ -185,7 +187,8 @@ proc UniPulseTexture {motor start step numsteps volt freq bins oscno} { drive $motor [expr $i*$step+$start] oct oscillate_count $oscno oct oscillate start - save $i + hmm countblock + save $i } } @@ -201,6 +204,7 @@ proc BehlkePulseTexture {motor start step numsteps freq bins oscno} { drive $motor [expr $i*$step+$start] oct oscillate_count $oscno oct oscillate start + hmm countblock save $i } } @@ -228,6 +232,7 @@ proc SquarePulseVolt {start step fin freq bins oscno} { } oct oscillate_count $oscno oct oscillate start + hmm countblock save $i incr i } @@ -247,6 +252,7 @@ proc SquarePulseFreq {volt freqlist bins oscno} { # sct_pulser send "APPL:SQU $freq,$pulservolt,0" oct oscillate_count $oscno oct oscillate start + hmm countblock save $i incr i } @@ -264,6 +270,7 @@ proc BehlkePulseFreq {freqlist bins oscno} { PulserOn oct oscillate_count $oscno oct oscillate start + hmm countblock save $i incr i } @@ -282,6 +289,7 @@ proc SinePulseFreq {volt freqlist bins oscno} { PulserOn oct oscillate_count $oscno oct oscillate start + hmm countblock save $i incr i } @@ -306,6 +314,7 @@ proc UniPulseFreq {volt freqlist bins oscno} { # sct_pulser send "APPL:SQU $freq,$pulservolt,[expr {$pulservolt/2}]" oct oscillate_count $oscno oct oscillate start + hmm countblock save $i incr i } @@ -324,9 +333,9 @@ proc UniPulseFatigue {volt freq bins oscno reps runs} { for {set j 0} {$j<$reps} {incr j} { oct oscillate_count $oscno oct oscillate start + hmm countblock save $j } - oscmd stop } PulserOff set pulserstate 0 @@ -439,5 +448,5 @@ publish BehlkePulseTexture user publish BehlkePulseFreq user publish UniPulseTexture user publish VoltSetStep user - + diff --git a/site_ansto/instrument/hipd/config/commands/cfcommands.tcl b/site_ansto/instrument/hipd/config/commands/cfcommands.tcl new file mode 100644 index 00000000..067db49d --- /dev/null +++ b/site_ansto/instrument/hipd/config/commands/cfcommands.tcl @@ -0,0 +1,166 @@ +# cf commands for driving sample environment +# ajs feb 2015 + +# cf namespace +# assumes tc1 and tc2 are the cf8 336 and 340 lakeshores for now + +namespace eval cf { + variable wall_lag 10 + variable wall_max 300 + variable sample_tolerance 5 + variable wall_tolerance 5 + variable wall_set true + variable base_set true + variable base_control true + variable wall_control true + + proc UseWall {_wall_set _wall_control} { + variable wall_set + variable wall_control + if {$_wall_set == false} {set wall_set false} else {set wall_set true} + if {$_wall_control == false} {set wall_control false} else {set wall_control true} + } + + proc UseBase {_base_set _base_control} { + variable base_set + variable base_control + if {$_base_set == false} {set base_set false} else {set base_set true} + if {$_base_control == false} {set base_control false} else {set base_control true} + } + + + proc WallParams {_wall_lag _wall_max _wall_tolerance} { + variable wall_lag + variable wall_max + variable wall_tolerance + set wall_lag $_wall_lag + set wall_max $_wall_max + set wall_tolerance $_wall_tolerance + hset /sample/tc2/control/tolerance1 $wall_tolerance + } + + proc TempSet {temp} { + variable wall_lag + variable wall_max + variable base_set + variable wall_set + set tempc [expr {$temp - $wall_lag}] + if {$tempc < 4} {set tempc 4} + if {$tempc > $wall_max} {set tempc $wall_max} + hset /sample/tc1/sensor/setpoint1 $temp + if {$base_set} {hset /sample/tc1/sensor/setpoint2 $tempc} + if {$wall_set} {hset /sample/tc2/sensor/setpoint1 $tempc} + } + + proc TempDrive {temp} { + variable wall_lag + variable wall_max + variable base_control + variable wall_control + TempSet $temp + set tempc [expr {$temp - $wall_lag}] + if {$tempc < 4} {set tempc 4} + if {$tempc > $wall_max} {set tempc $wall_max} + set drstr "drive tc1_driveable \$temp" + if {$base_control} {append drstr " tc1_driveable2 \$tempc"} + if {$wall_control} {append drstr " tc2_driveable \$tempc"} + eval $drstr + } + + proc Tolerance {sample} { + hset /sample/tc1/control/tolerance1 $sample + hset /sample/tc1/control/tolerance2 $sample + } + + proc MakeCold {} { + variable sample_tolerance + variable wall_tolerance + Tolerance 20 + hset /sample/tc2/control/tolerance1 20 + hset /sample/tc2/sensor/setpoint1 4 + TempDrive 4 + Tolerance $sample_tolerance + hset /sample/tc2/control/tolerance1 $wall_tolerance + wait 300 + } + + + proc TempRun {temp delay numsteps oscno} { + TempDrive $temp + wait $delay + newfile HISTOGRAM_XY + for {set i 0} {$i < $numsteps} {incr i} { + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + } + } + + proc RampRun {start step fin oscno delay} { + 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} + TempSet $j + wait $delay + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + incr i + } + } + + proc StepRun {start step fin oscno delay} { + 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} + TempDrive $j + wait $delay + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + incr i + } + } + + proc HeaterOn {} { + variable base_set + variable wall_set + + hset /sample/tc1/heater/heaterRange_1 4 + if {$base_set} {hset /sample/tc1/heater/heaterRange_2 4} + if {$wall_set} {hset /sample/tc2/heater/heaterRange 5} + } + + proc GetTemp {} { + variable base_set + set t1top [hget /sample/tc1/sensor/sensorValueA] + broadcast "sample top : $t1top" + if {$base_set} { + set t1base [hget /sample/tc1/sensor/sensorValueB] + broadcast "sample base: $t1base" + } + set t1wall [hget /sample/tc2/sensor/sensorValueA] + broadcast "sample wall: $t1wall" + } + + + + namespace export * + namespace ensemble create +} + +publish cf user + diff --git a/site_ansto/instrument/hipd/config/commands/hvsteps.tcl b/site_ansto/instrument/hipd/config/commands/hvsteps.tcl new file mode 100644 index 00000000..e3a7c8a8 --- /dev/null +++ b/site_ansto/instrument/hipd/config/commands/hvsteps.tcl @@ -0,0 +1,109 @@ + +proc SetVoltPosStep {steps} { + +# set llen 16384 +# set steplen [expr{int($llen/(2*$steps))}] +# set phaselen + + set l {} + for {set i 0} {$i < $steps} {incr i} { + lappend l [expr {($i*2.0/$steps)-1.0}] + } + for {set i $steps} {$i > 0} {incr i -1} { + lappend l [expr {($i*2.0/$steps)-1.0}] + } + set s "DATA VOLATILE, " + for {set i 0} {$i < [expr {[llength $l] -1}]} {incr i} { + append s [format "%1.3f" [lindex $l $i]] "," + } + append s [format "%1.3f" [lindex $l [expr {[llength $l] -1}]]] + sct_pulser send $s + broadcast $s + +} + +proc SetVoltBiStep {steps} { + set l {} + for {set i 0} {$i < $steps} {incr i} { + lappend l [expr {$i*1.0/$steps}] + } + for {set i $steps} {$i > [expr {$steps * -1}]} {incr i -1} { + lappend l [expr {$i*1.0/$steps}] + } + for {set i [expr {$steps * -1}]} {$i < 0} {incr i} { + lappend l [expr {$i*1.0/$steps}] + } + + set s "DATA VOLATILE, " + for {set i 0} {$i < [expr {[llength $l] -1}]} {incr i} { + append s [format "%1.3f" [lindex $l $i]] "," + } + append s [format "%1.3f" [lindex $l [expr {[llength $l] -1}]]] + sct_pulser send $s + broadcast $s + + +} + +proc VoltPosStep {volt freq voltsteps} { + PulserOff + newfile HISTOGRAM_XYT + + SetVoltPosStep $voltsteps + sct_pulser send "VOLT:LOW [VoltScale 0.0]; LOW?" + sct_pulser send "VOLT:HIGH [VoltScale [expr {$volt*1.0}]]; HIGH?" + sct_pulser send "FREQ $freq;:FREQ?" + sct_pulser send "FUNC: USER VOLATILE" + sct_pulser send "FUNC USER" + +} + + +proc UniZigTexture {motor mstart mstep mnum volt freq vstep binmult oscno} { + histmem mode unlimited + newfile HISTOGRAM_XYT + set bins [expr {$vstep * 2 * $binmult}] + histmem_period_strobo $freq $bins + wait 3 +# set pulservolt [VoltScale [expr {$volt*1.0}]] +# set pulseroffs [VoltScale [expr {$volt*0.5}]] + VoltPosStep $volt $freq $vstep + + PulserOn + + for {set i 0} {$i < $mnum} {incr i} { + drive $motor [expr $i*$mstep+$mstart] + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + } + PulserOff +} + + +proc VoltBiStep {volt freq steps} { + PulserOff + newfile HISTOGRAM_XYT + + SetVoltBiStep $steps + sct_pulser send "VOLT:LOW [VoltScale [expr {$volt*-1.0}]; LOW?" + sct_pulser send "VOLT:HIGH [VoltScale [expr {$volt*1.0}]; HIGH?" + sct_pulser send "FREQ $freq;:FREQ?" + sct_pulser send "FUNC: USER VOLATILE" + sct_pulser send "FUNC USER" + set bins [expr {$steps * 4}] + histmem_period_strobo $freq $bins + wait 3 + + PulserOn + oct oscillate_count $oscno + oct oscillate start + save 0 +} + +publish SetVoltPosStep user +publish SetVoltBiStep user +publish UniZigTexture user +publish VoltPosStep user +publish VoltBiStep user diff --git a/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl b/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl index 58300baa..45c94986 100644 --- a/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl +++ b/site_ansto/instrument/hipd/config/hmm/hmm_configuration.tcl @@ -28,7 +28,7 @@ proc ::histogram_memory::init_OAT_TABLE {args} { hmm configure fat_frame_source INTERNAL -# set resolution "double_x" + set resolution "double_x" switch $resolution { "hires" { diff --git a/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl b/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl index 8c11242a..0e9b3283 100644 --- a/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/hipd/config/motors/motor_configuration.tcl @@ -293,7 +293,7 @@ Motor mom $motor_driver_type [params \ absEnc 1\ absEncHome $mom_Home\ cntsPerX -2048] -setHomeandRange -motor mom -home 59.5066 -lowrange 5 -uprange 165 +setHomeandRange -motor mom -home 0 -lowrange 5 -uprange 165 #setHomeandRange -motor mom -home 60.08 -lowrange 5 -uprange 165 mom speed 1 mom movecount $move_count @@ -417,7 +417,7 @@ oct long_name oct ############################ # -set mf_config 1 +set mf_config 2 switch $mf_config { diff --git a/site_ansto/instrument/hipd/wombat_configuration.tcl b/site_ansto/instrument/hipd/wombat_configuration.tcl index 9e1c1460..b61a68aa 100644 --- a/site_ansto/instrument/hipd/wombat_configuration.tcl +++ b/site_ansto/instrument/hipd/wombat_configuration.tcl @@ -64,13 +64,14 @@ fileeval $cfPath(commands)/hvcommands.tcl fileeval $cfPath(commands)/vactex.tcl fileeval $cfPath(commands)/eulerscan.tcl fileeval $cfPath(commands)/cfcommands.tcl +fileeval $cfPath(commands)/hvsteps.tcl fileeval $cfPath(anticollider)/anticollider.tcl fileeval $cfPath(beamline)/sct_he3_polanal.tcl fileeval $cfPath(hmm)/hmm_rapid.tcl source gumxml.tcl # Wombat only change to hvcommands' scaleval variable -SetVoltScale 2000.0 +SetVoltScale 1000.0 # The Alice Thing From 88c1f007fa45e5c4e379c958e14e8dc152838947 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Fri, 13 Mar 2015 11:57:56 +1100 Subject: [PATCH 4/7] Fix up whitespace. --- .../instrument/config/commands/hvcommands.tcl | 632 +++++++++--------- .../hipd/config/commands/cfcommands.tcl | 274 ++++---- .../hipd/config/commands/hvsteps.tcl | 168 ++--- 3 files changed, 537 insertions(+), 537 deletions(-) diff --git a/site_ansto/instrument/config/commands/hvcommands.tcl b/site_ansto/instrument/config/commands/hvcommands.tcl index 971f6afa..1c9c4e40 100644 --- a/site_ansto/instrument/config/commands/hvcommands.tcl +++ b/site_ansto/instrument/config/commands/hvcommands.tcl @@ -6,340 +6,340 @@ set motdir 1 set pulserstate 0 proc SetVoltScale {newscaleval} { - global scaleval - set scaleval $newscaleval + global scaleval + set scaleval $newscaleval } proc VoltScale {involt} { - global scaleval - return [expr {($involt*1.0)/$scaleval}] + global scaleval + return [expr {($involt*1.0)/$scaleval}] } proc SetRampParms {_rampstep _rampdelay} { - global rampstep rampdelay - set rampstep $_rampstep - set rampdelay $_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 - if {$pulserstate==0} { - PulserDC $pulservolt - PulserOn - set pulserstate 1 - } else { - sct_pulser send "VOLT:OFFS $pulservolt; OFFS?" - PulserOn - } - } + global pulserstate + if {$volt== 0} { + PulserOff + set pulserstate 0 + } else { + set pulservolt [VoltScale $volt] + # 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 - } + 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? + sct_pulser transact VOLT:OFFS? } proc SingleVolt {volt oscno} { - histmem mode unlimited - newfile HISTOGRAM_XY - SetVolt $volt - oct oscillate_count $oscno - oct oscillate start - save 0 + histmem mode unlimited + newfile HISTOGRAM_XY + SetVolt $volt + oct oscillate_count $oscno + oct oscillate start + save 0 } proc SetDC {} { - pulseroff + pulseroff #NOTE: Setting FUNC DC generates a remote ctrl error if the # burst mode happens to be on - set resp [sct_pulser send "BURS:STAT OFF;:FUNC DC;:VOLT:OFFS 0; OFFS?"] - pulseron + set resp [sct_pulser send "BURS:STAT OFF;:FUNC DC;:VOLT:OFFS 0; OFFS?"] + pulseron } proc VoltRamp {start step fin oscno} { - histmem mode unlimited + 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} - SetVolt $j - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $i - incr i - } + 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} + SetVolt $j + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + incr i + } } 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 - } 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)} { + global motdir + broadcast in singlevtexscan + set loopvar 1 + set i_bool 0 + histmem mode unlimited + if {$motdir == 1} { + set currentmot $tstart + set i 0 + } 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)}] + 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 + 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 - } + broadcast $volt + VoltSetStep $curvolt $rampstep $volt $rampdelay + SingleVTexScan $mot $tstart $tstep $tfin $oscno + } } 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 + 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] - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $i - } + for {set i 0} {$i < $numsteps} {incr i} { + drive $motor [expr $i*$step+$start] + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + } } 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}]] - set pulseroffs [VoltScale [expr {$volt*0.5}]] - PulserSquareOffs $freq $pulservolt $pulseroffs - PulserOn + histmem mode unlimited + newfile HISTOGRAM_XYT + histmem_period_strobo $freq $bins + wait 3 + set pulservolt [VoltScale [expr {$volt*1.0}]] + set pulseroffs [VoltScale [expr {$volt*0.5}]] + PulserSquareOffs $freq $pulservolt $pulseroffs + PulserOn - for {set i 0} {$i < $numsteps} {incr i} { - drive $motor [expr $i*$step+$start] - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $i - } + for {set i 0} {$i < $numsteps} {incr i} { + drive $motor [expr $i*$step+$start] + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + } } 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] - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $i - } + 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] + oct oscillate_count $oscno + oct oscillate start + 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 -# sct_pulser send "APPL:SQU $freq,$pulservolt,0" - } - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $i - incr i - } + 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 + # sct_pulser send "APPL:SQU $freq,$pulservolt,0" + } + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + incr i + } } 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 -# sct_pulser send "APPL:SQU $freq,$pulservolt,0" - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $i - incr i - } + 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 + # sct_pulser send "APPL:SQU $freq,$pulservolt,0" + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + incr i + } } 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 - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $i - incr i - } + 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 + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + incr i + } } 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 - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $i - incr i - } + 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 + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + incr i + } } proc UniPulseFreq {volt freqlist bins oscno} { - histmem mode unlimited - newfile HISTOGRAM_XYT - set loopvar 1 - set i 0 - foreach freq $freqlist { + histmem mode unlimited + newfile HISTOGRAM_XYT + set loopvar 1 + set i 0 + foreach freq $freqlist { - histmem_period_strobo $freq $bins - wait 3 -# PulserSquareOffs $freq $pulservolt [expr {$pulservolt/2}] - set pulservolt [VoltScale [expr {$volt*1.0}]] - set pulseroffs [VoltScale [expr {$volt*0.5}]] - PulserSquareOffs $freq $pulservolt $pulseroffs - PulserOn -# sct_pulser send "APPL:SQU $freq,$pulservolt,[expr {$pulservolt/2}]" - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $i - incr i - } + histmem_period_strobo $freq $bins + wait 3 + # PulserSquareOffs $freq $pulservolt [expr {$pulservolt/2}] + set pulservolt [VoltScale [expr {$volt*1.0}]] + set pulseroffs [VoltScale [expr {$volt*0.5}]] + PulserSquareOffs $freq $pulservolt $pulseroffs + PulserOn + # sct_pulser send "APPL:SQU $freq,$pulservolt,[expr {$pulservolt/2}]" + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + incr i + } } 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} { - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $j - } - } - PulserOff - set pulserstate 0 - Histmem_strobo_off + 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} { + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $j + } + } + PulserOff + set pulserstate 0 + Histmem_strobo_off } @@ -347,80 +347,80 @@ proc UniPulseFatigue {volt freq bins oscno reps runs} { proc PulserBurst {} { - sct_pulser send "BURS:MODE TRIG; MODE?" - sct_pulser send "TRIG:SOUR BUS; SOUR?" - sct_pulser send "BURS:STAT ON; STAT?" - PulserOn - sct_pulser send "*TRG;:BURS:NCYC?" - while {1} { - set sval [sct_pulser transact *OPC?] - if {[string first 1 $sval] >-1} {break} - } - PulserOff - set pulserstate 0 + sct_pulser send "BURS:MODE TRIG; MODE?" + sct_pulser send "TRIG:SOUR BUS; SOUR?" + sct_pulser send "BURS:STAT ON; STAT?" + PulserOn + sct_pulser send "*TRG;:BURS:NCYC?" + while {1} { + set sval [sct_pulser transact *OPC?] + if {[string first 1 $sval] >-1} {break} + } + PulserOff + set pulserstate 0 } proc VoltPulseRun {vlo vhi freq cycl} { - PulserOff + PulserOff - sct_pulser send "VOLT:LOW [VoltScale $vlo]; LOW?" - sct_pulser send "VOLT:HIGH [VoltScale $vhi]; HIGH?" - sct_pulser send "FREQ $freq;:FREQ?" - sct_pulser send "BURS:PHAS [expr {90.0 - ($vhi*180.0)/(($vhi-$vlo)*1.0)}]; PHAS?" - sct_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 - } - } - sct_pulser send "BURS:NCYC $prem; NCYC?" - PulserBurst - PulserOff - set pulserstate 0 - sct_pulser send "BURS:STAT OFF; STAT?" + sct_pulser send "VOLT:LOW [VoltScale $vlo]; LOW?" + sct_pulser send "VOLT:HIGH [VoltScale $vhi]; HIGH?" + sct_pulser send "FREQ $freq;:FREQ?" + sct_pulser send "BURS:PHAS [expr {90.0 - ($vhi*180.0)/(($vhi-$vlo)*1.0)}]; PHAS?" + sct_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 + } + } + sct_pulser send "BURS:NCYC $prem; NCYC?" + PulserBurst + PulserOff + set pulserstate 0 + sct_pulser send "BURS:STAT OFF; STAT?" } proc VoltPulses {vlo vhi freq cycl} { - PulserOff - sct_pulser send "FUNC SQU;:FUNC?" - VoltPulseRun $vlo $vhi $freq $cycl + PulserOff + sct_pulser send "FUNC SQU;:FUNC?" + VoltPulseRun $vlo $vhi $freq $cycl } proc VoltTriPulses {vlo vhi freq cycl} { - PulserOff - sct_pulser send "FUNC RAMP;:FUNC?" - sct_pulser send "FUNC:RAMP:SYMM 50;:FUNC:RAMP:SYMM?" - VoltPulseRun $vlo $vhi $freq $cycl + PulserOff + sct_pulser send "FUNC RAMP;:FUNC?" + sct_pulser send "FUNC:RAMP:SYMM 50;:FUNC:RAMP:SYMM?" + VoltPulseRun $vlo $vhi $freq $cycl } proc OneTri {volt period} { - PulserOff - if {$volt > 0} { - sct_pulser send "VOLT:LOW 0; LOW?" - sct_pulser send "VOLT:HIGH [VoltScale $volt]; HIGH?" - sct_pulser send "BURS:PHAS -90; PHAS?" - } else { - sct_pulser send "VOLT:LOW [VoltScale $volt]; LOW?" - sct_pulser send "VOLT:HIGH 0; HIGH?" - sct_pulser send "BURS:PHAS 90; PHAS?" - } - sct_pulser send "FUNC RAMP;:FUNC?" - sct_pulser send "FUNC:RAMP:SYMM 50;:FUNC:RAMP:SYMM?" - sct_pulser send "FREQ [expr {1.0/$period}];:FREQ?" + PulserOff + if {$volt > 0} { + sct_pulser send "VOLT:LOW 0; LOW?" + sct_pulser send "VOLT:HIGH [VoltScale $volt]; HIGH?" + sct_pulser send "BURS:PHAS -90; PHAS?" + } else { + sct_pulser send "VOLT:LOW [VoltScale $volt]; LOW?" + sct_pulser send "VOLT:HIGH 0; HIGH?" + sct_pulser send "BURS:PHAS 90; PHAS?" + } + sct_pulser send "FUNC RAMP;:FUNC?" + sct_pulser send "FUNC:RAMP:SYMM 50;:FUNC:RAMP:SYMM?" + sct_pulser send "FREQ [expr {1.0/$period}];:FREQ?" - sct_pulser send "BURS:MODE TRIG; MODE?" + sct_pulser send "BURS:MODE TRIG; MODE?" - sct_pulser send "BURS:NCYC 1; NCYC?" - PulserBurst - PulserOff - set pulserstat 0 + sct_pulser send "BURS:NCYC 1; NCYC?" + PulserBurst + PulserOff + set pulserstat 0 } @@ -448,5 +448,5 @@ publish BehlkePulseTexture user publish BehlkePulseFreq user publish UniPulseTexture user publish VoltSetStep user - + diff --git a/site_ansto/instrument/hipd/config/commands/cfcommands.tcl b/site_ansto/instrument/hipd/config/commands/cfcommands.tcl index 067db49d..d2980113 100644 --- a/site_ansto/instrument/hipd/config/commands/cfcommands.tcl +++ b/site_ansto/instrument/hipd/config/commands/cfcommands.tcl @@ -5,161 +5,161 @@ # assumes tc1 and tc2 are the cf8 336 and 340 lakeshores for now namespace eval cf { - variable wall_lag 10 - variable wall_max 300 - variable sample_tolerance 5 - variable wall_tolerance 5 - variable wall_set true - variable base_set true - variable base_control true - variable wall_control true + variable wall_lag 10 + variable wall_max 300 + variable sample_tolerance 5 + variable wall_tolerance 5 + variable wall_set true + variable base_set true + variable base_control true + variable wall_control true - proc UseWall {_wall_set _wall_control} { - variable wall_set - variable wall_control - if {$_wall_set == false} {set wall_set false} else {set wall_set true} - if {$_wall_control == false} {set wall_control false} else {set wall_control true} - } + proc UseWall {_wall_set _wall_control} { + variable wall_set + variable wall_control + if {$_wall_set == false} {set wall_set false} else {set wall_set true} + if {$_wall_control == false} {set wall_control false} else {set wall_control true} + } - proc UseBase {_base_set _base_control} { - variable base_set - variable base_control - if {$_base_set == false} {set base_set false} else {set base_set true} - if {$_base_control == false} {set base_control false} else {set base_control true} - } + proc UseBase {_base_set _base_control} { + variable base_set + variable base_control + if {$_base_set == false} {set base_set false} else {set base_set true} + if {$_base_control == false} {set base_control false} else {set base_control true} + } - proc WallParams {_wall_lag _wall_max _wall_tolerance} { - variable wall_lag - variable wall_max - variable wall_tolerance - set wall_lag $_wall_lag - set wall_max $_wall_max - set wall_tolerance $_wall_tolerance - hset /sample/tc2/control/tolerance1 $wall_tolerance - } + proc WallParams {_wall_lag _wall_max _wall_tolerance} { + variable wall_lag + variable wall_max + variable wall_tolerance + set wall_lag $_wall_lag + set wall_max $_wall_max + set wall_tolerance $_wall_tolerance + hset /sample/tc2/control/tolerance1 $wall_tolerance + } - proc TempSet {temp} { - variable wall_lag - variable wall_max - variable base_set - variable wall_set - set tempc [expr {$temp - $wall_lag}] - if {$tempc < 4} {set tempc 4} - if {$tempc > $wall_max} {set tempc $wall_max} - hset /sample/tc1/sensor/setpoint1 $temp - if {$base_set} {hset /sample/tc1/sensor/setpoint2 $tempc} - if {$wall_set} {hset /sample/tc2/sensor/setpoint1 $tempc} - } + proc TempSet {temp} { + variable wall_lag + variable wall_max + variable base_set + variable wall_set + set tempc [expr {$temp - $wall_lag}] + if {$tempc < 4} {set tempc 4} + if {$tempc > $wall_max} {set tempc $wall_max} + hset /sample/tc1/sensor/setpoint1 $temp + if {$base_set} {hset /sample/tc1/sensor/setpoint2 $tempc} + if {$wall_set} {hset /sample/tc2/sensor/setpoint1 $tempc} + } - proc TempDrive {temp} { - variable wall_lag - variable wall_max - variable base_control - variable wall_control - TempSet $temp - set tempc [expr {$temp - $wall_lag}] - if {$tempc < 4} {set tempc 4} - if {$tempc > $wall_max} {set tempc $wall_max} - set drstr "drive tc1_driveable \$temp" - if {$base_control} {append drstr " tc1_driveable2 \$tempc"} - if {$wall_control} {append drstr " tc2_driveable \$tempc"} - eval $drstr - } + proc TempDrive {temp} { + variable wall_lag + variable wall_max + variable base_control + variable wall_control + TempSet $temp + set tempc [expr {$temp - $wall_lag}] + if {$tempc < 4} {set tempc 4} + if {$tempc > $wall_max} {set tempc $wall_max} + set drstr "drive tc1_driveable \$temp" + if {$base_control} {append drstr " tc1_driveable2 \$tempc"} + if {$wall_control} {append drstr " tc2_driveable \$tempc"} + eval $drstr + } - proc Tolerance {sample} { - hset /sample/tc1/control/tolerance1 $sample - hset /sample/tc1/control/tolerance2 $sample - } + proc Tolerance {sample} { + hset /sample/tc1/control/tolerance1 $sample + hset /sample/tc1/control/tolerance2 $sample + } - proc MakeCold {} { - variable sample_tolerance - variable wall_tolerance - Tolerance 20 - hset /sample/tc2/control/tolerance1 20 - hset /sample/tc2/sensor/setpoint1 4 - TempDrive 4 - Tolerance $sample_tolerance - hset /sample/tc2/control/tolerance1 $wall_tolerance - wait 300 - } + proc MakeCold {} { + variable sample_tolerance + variable wall_tolerance + Tolerance 20 + hset /sample/tc2/control/tolerance1 20 + hset /sample/tc2/sensor/setpoint1 4 + TempDrive 4 + Tolerance $sample_tolerance + hset /sample/tc2/control/tolerance1 $wall_tolerance + wait 300 + } - proc TempRun {temp delay numsteps oscno} { - TempDrive $temp - wait $delay - newfile HISTOGRAM_XY - for {set i 0} {$i < $numsteps} {incr i} { - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $i - } - } + proc TempRun {temp delay numsteps oscno} { + TempDrive $temp + wait $delay + newfile HISTOGRAM_XY + for {set i 0} {$i < $numsteps} {incr i} { + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + } + } - proc RampRun {start step fin oscno delay} { - 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} - TempSet $j - wait $delay - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $i - incr i - } - } + proc RampRun {start step fin oscno delay} { + 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} + TempSet $j + wait $delay + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + incr i + } + } - proc StepRun {start step fin oscno delay} { - 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} - TempDrive $j - wait $delay - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $i - incr i - } - } + proc StepRun {start step fin oscno delay} { + 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} + TempDrive $j + wait $delay + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + incr i + } + } - proc HeaterOn {} { - variable base_set - variable wall_set + proc HeaterOn {} { + variable base_set + variable wall_set - hset /sample/tc1/heater/heaterRange_1 4 - if {$base_set} {hset /sample/tc1/heater/heaterRange_2 4} - if {$wall_set} {hset /sample/tc2/heater/heaterRange 5} - } + hset /sample/tc1/heater/heaterRange_1 4 + if {$base_set} {hset /sample/tc1/heater/heaterRange_2 4} + if {$wall_set} {hset /sample/tc2/heater/heaterRange 5} + } - proc GetTemp {} { - variable base_set - set t1top [hget /sample/tc1/sensor/sensorValueA] - broadcast "sample top : $t1top" - if {$base_set} { - set t1base [hget /sample/tc1/sensor/sensorValueB] - broadcast "sample base: $t1base" - } - set t1wall [hget /sample/tc2/sensor/sensorValueA] - broadcast "sample wall: $t1wall" - } + proc GetTemp {} { + variable base_set + set t1top [hget /sample/tc1/sensor/sensorValueA] + broadcast "sample top : $t1top" + if {$base_set} { + set t1base [hget /sample/tc1/sensor/sensorValueB] + broadcast "sample base: $t1base" + } + set t1wall [hget /sample/tc2/sensor/sensorValueA] + broadcast "sample wall: $t1wall" + } - namespace export * - namespace ensemble create + namespace export * + namespace ensemble create } publish cf user diff --git a/site_ansto/instrument/hipd/config/commands/hvsteps.tcl b/site_ansto/instrument/hipd/config/commands/hvsteps.tcl index e3a7c8a8..827aedd1 100644 --- a/site_ansto/instrument/hipd/config/commands/hvsteps.tcl +++ b/site_ansto/instrument/hipd/config/commands/hvsteps.tcl @@ -1,109 +1,109 @@ proc SetVoltPosStep {steps} { - + # set llen 16384 # set steplen [expr{int($llen/(2*$steps))}] # set phaselen - - set l {} - for {set i 0} {$i < $steps} {incr i} { - lappend l [expr {($i*2.0/$steps)-1.0}] - } - for {set i $steps} {$i > 0} {incr i -1} { - lappend l [expr {($i*2.0/$steps)-1.0}] - } - set s "DATA VOLATILE, " - for {set i 0} {$i < [expr {[llength $l] -1}]} {incr i} { - append s [format "%1.3f" [lindex $l $i]] "," - } - append s [format "%1.3f" [lindex $l [expr {[llength $l] -1}]]] - sct_pulser send $s - broadcast $s - + + set l {} + for {set i 0} {$i < $steps} {incr i} { + lappend l [expr {($i*2.0/$steps)-1.0}] + } + for {set i $steps} {$i > 0} {incr i -1} { + lappend l [expr {($i*2.0/$steps)-1.0}] + } + set s "DATA VOLATILE, " + for {set i 0} {$i < [expr {[llength $l] -1}]} {incr i} { + append s [format "%1.3f" [lindex $l $i]] "," + } + append s [format "%1.3f" [lindex $l [expr {[llength $l] -1}]]] + sct_pulser send $s + broadcast $s + } proc SetVoltBiStep {steps} { - set l {} - for {set i 0} {$i < $steps} {incr i} { - lappend l [expr {$i*1.0/$steps}] - } - for {set i $steps} {$i > [expr {$steps * -1}]} {incr i -1} { - lappend l [expr {$i*1.0/$steps}] - } - for {set i [expr {$steps * -1}]} {$i < 0} {incr i} { - lappend l [expr {$i*1.0/$steps}] - } - - set s "DATA VOLATILE, " - for {set i 0} {$i < [expr {[llength $l] -1}]} {incr i} { - append s [format "%1.3f" [lindex $l $i]] "," - } - append s [format "%1.3f" [lindex $l [expr {[llength $l] -1}]]] - sct_pulser send $s - broadcast $s - - + set l {} + for {set i 0} {$i < $steps} {incr i} { + lappend l [expr {$i*1.0/$steps}] + } + for {set i $steps} {$i > [expr {$steps * -1}]} {incr i -1} { + lappend l [expr {$i*1.0/$steps}] + } + for {set i [expr {$steps * -1}]} {$i < 0} {incr i} { + lappend l [expr {$i*1.0/$steps}] + } + + set s "DATA VOLATILE, " + for {set i 0} {$i < [expr {[llength $l] -1}]} {incr i} { + append s [format "%1.3f" [lindex $l $i]] "," + } + append s [format "%1.3f" [lindex $l [expr {[llength $l] -1}]]] + sct_pulser send $s + broadcast $s + + } proc VoltPosStep {volt freq voltsteps} { - PulserOff - newfile HISTOGRAM_XYT - - SetVoltPosStep $voltsteps - sct_pulser send "VOLT:LOW [VoltScale 0.0]; LOW?" - sct_pulser send "VOLT:HIGH [VoltScale [expr {$volt*1.0}]]; HIGH?" - sct_pulser send "FREQ $freq;:FREQ?" - sct_pulser send "FUNC: USER VOLATILE" - sct_pulser send "FUNC USER" - + PulserOff + newfile HISTOGRAM_XYT + + SetVoltPosStep $voltsteps + sct_pulser send "VOLT:LOW [VoltScale 0.0]; LOW?" + sct_pulser send "VOLT:HIGH [VoltScale [expr {$volt*1.0}]]; HIGH?" + sct_pulser send "FREQ $freq;:FREQ?" + sct_pulser send "FUNC: USER VOLATILE" + sct_pulser send "FUNC USER" + } proc UniZigTexture {motor mstart mstep mnum volt freq vstep binmult oscno} { - histmem mode unlimited - newfile HISTOGRAM_XYT - set bins [expr {$vstep * 2 * $binmult}] - histmem_period_strobo $freq $bins - wait 3 -# set pulservolt [VoltScale [expr {$volt*1.0}]] -# set pulseroffs [VoltScale [expr {$volt*0.5}]] - VoltPosStep $volt $freq $vstep + histmem mode unlimited + newfile HISTOGRAM_XYT + set bins [expr {$vstep * 2 * $binmult}] + histmem_period_strobo $freq $bins + wait 3 + # set pulservolt [VoltScale [expr {$volt*1.0}]] + # set pulseroffs [VoltScale [expr {$volt*0.5}]] + VoltPosStep $volt $freq $vstep - PulserOn + PulserOn - for {set i 0} {$i < $mnum} {incr i} { - drive $motor [expr $i*$mstep+$mstart] - oct oscillate_count $oscno - oct oscillate start - hmm countblock - save $i - } - PulserOff + for {set i 0} {$i < $mnum} {incr i} { + drive $motor [expr $i*$mstep+$mstart] + oct oscillate_count $oscno + oct oscillate start + hmm countblock + save $i + } + PulserOff } - + proc VoltBiStep {volt freq steps} { - PulserOff - newfile HISTOGRAM_XYT - - SetVoltBiStep $steps - sct_pulser send "VOLT:LOW [VoltScale [expr {$volt*-1.0}]; LOW?" - sct_pulser send "VOLT:HIGH [VoltScale [expr {$volt*1.0}]; HIGH?" - sct_pulser send "FREQ $freq;:FREQ?" - sct_pulser send "FUNC: USER VOLATILE" - sct_pulser send "FUNC USER" - set bins [expr {$steps * 4}] - histmem_period_strobo $freq $bins - wait 3 - - PulserOn - oct oscillate_count $oscno - oct oscillate start - save 0 + PulserOff + newfile HISTOGRAM_XYT + + SetVoltBiStep $steps + sct_pulser send "VOLT:LOW [VoltScale [expr {$volt*-1.0}]; LOW?" + sct_pulser send "VOLT:HIGH [VoltScale [expr {$volt*1.0}]; HIGH?" + sct_pulser send "FREQ $freq;:FREQ?" + sct_pulser send "FUNC: USER VOLATILE" + sct_pulser send "FUNC USER" + set bins [expr {$steps * 4}] + histmem_period_strobo $freq $bins + wait 3 + + PulserOn + oct oscillate_count $oscno + oct oscillate start + save 0 } - + publish SetVoltPosStep user publish SetVoltBiStep user publish UniZigTexture user publish VoltPosStep user -publish VoltBiStep user +publish VoltBiStep user From 25d73eb17a9446ffa15c319f5cf07477850a980f Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Fri, 13 Mar 2015 13:09:15 +1100 Subject: [PATCH 5/7] Bring config INI files up to date with new drivers and fix some errors. --- .../instrument/dingo/dingo_configuration.tcl | 8 +- .../instrument/dingo/util/sics_config.ini | 48 +++++++--- .../instrument/hipd/util/sics_config.ini | 88 +++++++++++++++++-- .../instrument/hipd/wombat_configuration.tcl | 1 - .../instrument/hrpd/util/sics_config.ini | 66 ++++++++++++-- .../kookaburra/kookaburra_configuration.tcl | 7 +- .../kookaburra/util/sics_config.ini | 48 +++++++--- .../instrument/pelican/util/sics_config.ini | 25 ++++-- .../reflectometer/platypus_configuration.tcl | 1 + .../reflectometer/util/sics_config.ini | 48 +++++++--- .../instrument/sans/quokka_configuration.tcl | 3 +- .../instrument/sans/util/sics_config.ini | 70 ++++++++++----- .../instrument/tas/util/sics_config.ini | 23 +---- 13 files changed, 322 insertions(+), 114 deletions(-) diff --git a/site_ansto/instrument/dingo/dingo_configuration.tcl b/site_ansto/instrument/dingo/dingo_configuration.tcl index 144390ee..dee39632 100644 --- a/site_ansto/instrument/dingo/dingo_configuration.tcl +++ b/site_ansto/instrument/dingo/dingo_configuration.tcl @@ -33,16 +33,12 @@ fileeval $cfPath(environment)/temperature/sct_lakeshore_336.tcl fileeval $cfPath(environment)/temperature/sct_ls336.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_340.tcl fileeval $cfPath(environment)/temperature/sct_ls340.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_base.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_level.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_pres.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_scpi.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_temp.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_valve.tcl fileeval $cfPath(environment)/sct_protek_common.tcl +fileeval $cfPath(environment)/temperature/sct_oxford_mercury.tcl fileeval $cfPath(environment)/sct_protekmm.tcl fileeval $cfPath(environment)/temperature/west400.tcl fileeval $cfPath(environment)/temperature/sct_west4100.tcl +fileeval $cfPath(environment)/temperature/sct_west_6100.tcl fileeval $cfPath(nexus)/nxscripts.tcl fileeval $cfPath(scan)/scan.tcl fileeval $cfPath(commands)/commands.tcl diff --git a/site_ansto/instrument/dingo/util/sics_config.ini b/site_ansto/instrument/dingo/util/sics_config.ini index 1cd45e2d..c20c920f 100644 --- a/site_ansto/instrument/dingo/util/sics_config.ini +++ b/site_ansto/instrument/dingo/util/sics_config.ini @@ -145,27 +145,47 @@ terminator = \r\n tol1 = 1.0 tol2 = 1.0 -[mercury_scpi_01] -desc = "Oxford Mercury temperature controller with three temperature loops." -driver = "mercury_base" +[mercury_01] +assoc = 00000124 +cards = HHHVLTTP +desc = "Oxford Mercury temperature controller (12T)" +driver = "oxford_mercury" imptype = temperature ip = 10.157.205.5 -permlink = LT port = 7020 -terminator = \r\n -tol = 1.0 -valve_tol = 2 +ptol = 5 +terminator = \n +timeout = 2000 +ttol = 1.0 +vtol = 5 -[mercury_scpi_02] -desc = "Oxford Mercury temperature controller with four temperature loops and needle valve control" -driver = "mercury_scpi" +[mercury_02] +assoc = 00000124 +cards = HHTVTTTP +desc = "Oxford Mercury temperature controller (CF10)" +driver = "oxford_mercury" +imptype = temperature +ip = 10.157.205.46 +port = 7020 +ptol = 5 +terminator = \n +timeout = 2000 +ttol = 1.0 +vtol = 5 + +[mercury_03] +assoc = 00000123 +cards = HHHNNTTT +desc = "Oxford Mercury temperature controller ()" +driver = "oxford_mercury" imptype = temperature ip = 10.157.205.47 -permlink = LT port = 7020 -terminator = \r\n -tol = 1.0 -valve_tol = 2 +ptol = 5 +terminator = \n +timeout = 2000 +ttol = 1.0 +vtol = 5 [normal_sample_stage] desc = "This is the default sample stage configuration" diff --git a/site_ansto/instrument/hipd/util/sics_config.ini b/site_ansto/instrument/hipd/util/sics_config.ini index 45f527e7..e657666b 100644 --- a/site_ansto/instrument/hipd/util/sics_config.ini +++ b/site_ansto/instrument/hipd/util/sics_config.ini @@ -1,5 +1,5 @@ [12tmagnet_setup] -cascade = B1:12tmagnet_oxford,sample_stage:12tmagnet_sample_insert,T1:mercury_scpi_01 +cascade = B1:12tmagnet_oxford,sample_stage:12tmagnet_sample_insert,T1:mercury_01 enabled = False [Autolab_setup] cascade = sample_stage:normal_sample_stage,I1:protek_01,V1:protek_02 @@ -7,12 +7,18 @@ enabled = False [CF1] cascade = T1:CF1_ls340,sample_stage:normal_sample_stage enabled = False +[CF7] +cascade = T1:ls336_08,T2:ls336_05,sample_stage:normal_sample_stage +enabled = False [CF8] cascade = T1:ls336_01,T2:ls340_11,sample_stage:normal_sample_stage enabled = False [Default] cascade = sample_stage:normal_sample_stage enabled = True +[F5 Low Temperature Vacuum Furnace] +cascade = T1:eurotherm,sample_stage:normal_sample_stage +enabled = False [B1] datype = B enabled = False @@ -27,6 +33,13 @@ id = 1 implementation = none name = pulser optype = function_generator +[HE3] +datype = X +enabled = False +id = 1 +implementation = none +name = he3 +optype = polariser [I1] datype = I enabled = False @@ -131,12 +144,53 @@ desc = "Function Generator" driver = agilent_33220A imptype = function_generator ip = 10.157.205.16 +name = pulser port = 5025 [eulerian_cradle] desc = "Load the Eulerian cradle configuration" imptype = motion_axis +[eurotherm] +asyncprotocol = "modbus_ap" +desc = "Eurotherm temperature controller" +dev_id = 1 +driver = "eurotherm_3200" +imptype = temperature +ip = 10.157.205.19 +port = 502 +tol = 1.0 + +[he3_analyser] +desc = "3He Analyser" +driver = "he3_polanal" +has_anal = true +has_pol = false +imptype = polariser +ip = 10.157.205.2 +port = 55013 +terminator = \r\n + +[he3_both] +desc = "3He Pol+Anal" +driver = "he3_polanal" +has_anal = true +has_pol = true +imptype = polariser +ip = 10.157.205.2 +port = 55013 +terminator = \r\n + +[he3_polariser] +desc = "3He Polariser" +driver = "he3_polanal" +has_anal = false +has_pol = true +imptype = polariser +ip = 10.157.205.2 +port = 55013 +terminator = \r\n + [ls336_01] asyncqueue = sct desc = "Lakeshore 336 temperature controller" @@ -175,7 +229,7 @@ asyncqueue = sct desc = "Lakeshore 336 temperature controller" driver = "ls336" imptype = temperature -ip = 137.157.201.21 +ip = 10.157.205.54 port = 7777 terminator = \r\n tol1 = 1.0 @@ -186,7 +240,28 @@ asyncqueue = sct desc = "Lakeshore 336 temperature controller" driver = "ls336" imptype = temperature -ip = 10.157.205.30 +ip = 10.157.205.61 +port = 7777 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + +[ls336_08] +asyncqueue = sct +desc = "Lakeshore 336 temperature controller" +driver = "ls336" +imptype = temperature +ip = 10.157.205.55 +port = 7777 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + +[ls336_10] +desc = "Lakeshore 336 temperature controller" +driver = "ls336" +imptype = temperature +ip = 10.157.205.26 port = 7777 terminator = \r\n tol1 = 1.0 @@ -263,6 +338,7 @@ ip = 10.157.205.5 port = 7020 ptol = 5 terminator = \n +timeout = 2000 ttol = 1.0 vtol = 5 @@ -276,6 +352,7 @@ ip = 10.157.205.46 port = 7020 ptol = 5 terminator = \n +timeout = 2000 ttol = 1.0 vtol = 5 @@ -289,6 +366,7 @@ ip = 10.157.205.47 port = 7020 ptol = 5 terminator = \n +timeout = 2000 ttol = 1.0 vtol = 5 @@ -316,7 +394,7 @@ port = 4001 desc = "Load the small omega configuration" imptype = motion_axis -[vf1_west4100] +[vf1_west6100] asyncprotocol = modbus_ap desc = "VF1 Blue furnace temperature controller" dev_id = 1 @@ -325,7 +403,7 @@ imptype = temperature ip = 10.157.205.24 port = 502 -[vf2_west4100] +[vf2_west6100] asyncprotocol = modbus_ap desc = "VF2 Blue furnace temperature controller" dev_id = 1 diff --git a/site_ansto/instrument/hipd/wombat_configuration.tcl b/site_ansto/instrument/hipd/wombat_configuration.tcl index b61a68aa..49d8c3a4 100644 --- a/site_ansto/instrument/hipd/wombat_configuration.tcl +++ b/site_ansto/instrument/hipd/wombat_configuration.tcl @@ -42,7 +42,6 @@ fileeval $cfPath(environment)/temperature/sct_ls340.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_370.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_m370.tcl fileeval $cfPath(environment)/temperature/sct_oxford_mercury.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_valve.tcl fileeval $cfPath(environment)/sct_protek_common.tcl fileeval $cfPath(environment)/sct_protekmm.tcl fileeval $cfPath(environment)/temperature/sct_julabo_lh45_gen.tcl diff --git a/site_ansto/instrument/hrpd/util/sics_config.ini b/site_ansto/instrument/hrpd/util/sics_config.ini index 4d58af41..043dad67 100644 --- a/site_ansto/instrument/hrpd/util/sics_config.ini +++ b/site_ansto/instrument/hrpd/util/sics_config.ini @@ -1,12 +1,15 @@ [12tmagnet_setup] -cascade = B1:12tmagnet_oxford,sample_stage:12tmagnet_sample_insert,T1:mercury_scpi_01 +cascade = B1:12tmagnet_oxford,sample_stage:12tmagnet_sample_insert,T1:mercury_01 enabled = False [CF1] cascade = T1:CF1_ls340,sample_stage:normal_sample_stage enabled = False -[CF8] +[CF7] cascade = T1:ls336_08,T2:ls336_05,sample_stage:normal_sample_stage enabled = False +[CF8] +cascade = T1:ls336_01,T2:ls340_11,sample_stage:normal_sample_stage +enabled = False [Default] cascade = sample_stage:normal_sample_stage enabled = True @@ -107,8 +110,9 @@ optype = motion_axis [12tmagnet_oxford] asyncqueue = sct desc = "12 Tesla Oxford Magnet" -driver = "oxford_labview" +driver = "oxford12tlv" imptype = magnetic_field +interval = 5 ip = 10.157.205.3 port = 55001 @@ -187,7 +191,7 @@ asyncqueue = sct desc = "Lakeshore 336 temperature controller" driver = "ls336" imptype = temperature -ip = 137.157.201.21 +ip = 10.157.205.61 port = 7777 terminator = \r\n tol1 = 1.0 @@ -225,6 +229,38 @@ terminator = \r\n tol1 = 1.0 tol2 = 1.0 +[ls340_01] +asyncqueue = sct +desc = "Lakeshore 340 temperature controller" +driver = "ls340" +imptype = temperature +ip = 137.157.201.86 +port = 4001 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + +[ls340_02] +asyncqueue = sct +desc = "Lakeshore 340 temperature controller" +driver = "ls340" +imptype = temperature +ip = 137.157.201.86 +port = 4002 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + +[ls340_11] +desc = "Lakeshore 340 temperature controller" +driver = "ls340" +imptype = temperature +ip = 137.157.201.86 +port = 4001 +terminator = \r\n +tol1 = 1.0 +tol2 = 1.0 + [ls370_1] desc = "Lakeshore 370 Resistance Bridge" driver = "lakeshore_m370" @@ -243,6 +279,7 @@ ip = 10.157.205.5 port = 7020 ptol = 5 terminator = \n +timeout = 2000 ttol = 1.0 vtol = 5 @@ -256,6 +293,7 @@ ip = 10.157.205.46 port = 7020 ptol = 5 terminator = \n +timeout = 2000 ttol = 1.0 vtol = 5 @@ -269,6 +307,7 @@ ip = 10.157.205.47 port = 7020 ptol = 5 terminator = \n +timeout = 2000 ttol = 1.0 vtol = 5 @@ -314,10 +353,21 @@ robot_name = rosie desc = "Load the small omega configuration" imptype = motion_axis -[west4100] -desc = "Blue furnace temperature controller" +[vf1_west6100] +asyncprotocol = modbus_ap +desc = "VF1 Blue furnace temperature controller" dev_id = 1 -driver = "west4100" +driver = "west_6100" imptype = temperature -ip = 10.157.205.19 +ip = 10.157.205.24 +port = 502 + +[vf2_west6100] +asyncprotocol = modbus_ap +desc = "VF2 Blue furnace temperature controller" +dev_id = 1 +driver = "west_6100" +imptype = temperature +ip = 10.157.205.25 +port = 502 diff --git a/site_ansto/instrument/kookaburra/kookaburra_configuration.tcl b/site_ansto/instrument/kookaburra/kookaburra_configuration.tcl index f1f984cc..f3de8d2d 100644 --- a/site_ansto/instrument/kookaburra/kookaburra_configuration.tcl +++ b/site_ansto/instrument/kookaburra/kookaburra_configuration.tcl @@ -36,13 +36,8 @@ fileeval $cfPath(environment)/temperature/sct_lakeshore_340.tcl fileeval $cfPath(environment)/temperature/sct_ls340.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_370.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_m370.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_base.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_level.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_pres.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_scpi.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_temp.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_valve.tcl fileeval $cfPath(environment)/sct_protek_common.tcl +fileeval $cfPath(environment)/temperature/sct_oxford_mercury.tcl fileeval $cfPath(environment)/sct_protekmm.tcl fileeval $cfPath(environment)/temperature/sct_julabo_lh45_gen.tcl fileeval $cfPath(environment)/sct_rheometer.tcl diff --git a/site_ansto/instrument/kookaburra/util/sics_config.ini b/site_ansto/instrument/kookaburra/util/sics_config.ini index 8d16baf6..0f07fc30 100644 --- a/site_ansto/instrument/kookaburra/util/sics_config.ini +++ b/site_ansto/instrument/kookaburra/util/sics_config.ini @@ -173,27 +173,47 @@ terminator = \r\n tol1 = 1.0 tol2 = 1.0 -[mercury_scpi_01] -desc = "Oxford Mercury temperature controller in Mercury mode" -driver = "mercury_scpi" +[mercury_01] +assoc = 00000124 +cards = HHHVLTTP +desc = "Oxford Mercury temperature controller (12T)" +driver = "oxford_mercury" imptype = temperature ip = 10.157.205.5 -permlink = LT port = 7020 -terminator = \r\n -tol = 1.0 -valve_tol = 2 +ptol = 5 +terminator = \n +timeout = 2000 +ttol = 1.0 +vtol = 5 -[mercury_scpi_02] -desc = "Oxford Mercury temperature controller in Mercury mode" -driver = "mercury_scpi" +[mercury_02] +assoc = 00000124 +cards = HHTVTTTP +desc = "Oxford Mercury temperature controller (CF10)" +driver = "oxford_mercury" +imptype = temperature +ip = 10.157.205.46 +port = 7020 +ptol = 5 +terminator = \n +timeout = 2000 +ttol = 1.0 +vtol = 5 + +[mercury_03] +assoc = 00000123 +cards = HHHNNTTT +desc = "Oxford Mercury temperature controller ()" +driver = "oxford_mercury" imptype = temperature ip = 10.157.205.47 -permlink = LT port = 7020 -terminator = \r\n -tol = 1.0 -valve_tol = 2 +ptol = 5 +terminator = \n +timeout = 2000 +ttol = 1.0 +vtol = 5 [normal_sample_stage] desc = "This is the default sample stage configuration xyz translation omega rotation but no tilt axes" diff --git a/site_ansto/instrument/pelican/util/sics_config.ini b/site_ansto/instrument/pelican/util/sics_config.ini index accb4617..7d156665 100644 --- a/site_ansto/instrument/pelican/util/sics_config.ini +++ b/site_ansto/instrument/pelican/util/sics_config.ini @@ -1,5 +1,5 @@ [12tmagnet_setup] -cascade = B1:12tmagnet_oxford,sample_stage:12tmagnet_sample_insert,T1:mercury_scpi_01 +cascade = B1:12tmagnet_oxford,sample_stage:12tmagnet_sample_insert,T1:mercury_01 enabled = False [CF3] cascade = T1:ls340_pelican,sample_stage:normal_sample_stage @@ -181,7 +181,7 @@ asyncqueue = sct desc = "Lakeshore 336 temperature controller" driver = "ls336" imptype = temperature -ip = 137.157.201.21 +ip = 10.157.205.61 port = 7777 terminator = \r\n tol1 = 1.0 @@ -262,6 +262,7 @@ ptol = 5 terminator = \n ttol = 1.0 vtol = 5 +timeout = 2000 [mercury_02] assoc = 00000124 @@ -275,6 +276,7 @@ ptol = 5 terminator = \n ttol = 1.0 vtol = 5 +timeout = 2000 [mercury_03] assoc = 00000123 @@ -288,6 +290,7 @@ ptol = 5 terminator = \n ttol = 1.0 vtol = 5 +timeout = 2000 [normal_sample_stage] desc = "This is the default sample stage configuration" @@ -309,10 +312,20 @@ imptype = multimeter ip = 10.157.205.37 port = 4001 -[west4100] -desc = "Blue furnace temperature controller" +[vf1_west6100] +asyncprotocol = modbus_ap +desc = "VF1 Blue furnace temperature controller" dev_id = 1 -driver = "west4100" +driver = "west_6100" imptype = temperature -ip = 10.157.205.19 +ip = 10.157.205.24 +port = 502 +[vf2_west6100] +asyncprotocol = modbus_ap +desc = "VF2 Blue furnace temperature controller" +dev_id = 1 +driver = "west_6100" +imptype = temperature +ip = 10.157.205.25 +port = 502 diff --git a/site_ansto/instrument/reflectometer/platypus_configuration.tcl b/site_ansto/instrument/reflectometer/platypus_configuration.tcl index 7cefb18d..fb1d6d1c 100644 --- a/site_ansto/instrument/reflectometer/platypus_configuration.tcl +++ b/site_ansto/instrument/reflectometer/platypus_configuration.tcl @@ -41,6 +41,7 @@ fileeval $cfPath(environment)/temperature/sct_ls336.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_340.tcl fileeval $cfPath(environment)/temperature/sct_ls340.tcl fileeval $cfPath(environment)/temperature/sct_julabo_lh45_gen.tcl +fileeval $cfPath(environment)/temperature/sct_oxford_mercury.tcl fileeval $cfPath(hmm)/hmm_configuration.tcl fileeval $cfPath(nexus)/nxscripts.tcl fileeval $cfPath(hmm)/detector.tcl diff --git a/site_ansto/instrument/reflectometer/util/sics_config.ini b/site_ansto/instrument/reflectometer/util/sics_config.ini index 7ac26977..7c6bd412 100644 --- a/site_ansto/instrument/reflectometer/util/sics_config.ini +++ b/site_ansto/instrument/reflectometer/util/sics_config.ini @@ -235,27 +235,47 @@ terminator = \r\n tol1 = 1.0 tol2 = 1.0 -[mercury_scpi_01] -desc = "Oxford Mercury temperature controller in Mercury mode" -driver = "mercury_scpi" +[mercury_01] +assoc = 00000124 +cards = HHHVLTTP +desc = "Oxford Mercury temperature controller (12T)" +driver = "oxford_mercury" imptype = temperature ip = 10.157.205.5 -permlink = LT port = 7020 -terminator = \r\n -tol = 1.0 -valve_tol = 2 +ptol = 5 +terminator = \n +timeout = 2000 +ttol = 1.0 +vtol = 5 -[mercury_scpi_02] -desc = "Oxford Mercury temperature controller in Mercury mode" -driver = "mercury_scpi" +[mercury_02] +assoc = 00000124 +cards = HHTVTTTP +desc = "Oxford Mercury temperature controller (CF10)" +driver = "oxford_mercury" +imptype = temperature +ip = 10.157.205.46 +port = 7020 +ptol = 5 +terminator = \n +timeout = 2000 +ttol = 1.0 +vtol = 5 + +[mercury_03] +assoc = 00000123 +cards = HHHNNTTT +desc = "Oxford Mercury temperature controller ()" +driver = "oxford_mercury" imptype = temperature ip = 10.157.205.47 -permlink = LT port = 7020 -terminator = \r\n -tol = 1.0 -valve_tol = 2 +ptol = 5 +terminator = \n +timeout = 2000 +ttol = 1.0 +vtol = 5 [mvp] desc = "Valve controller" diff --git a/site_ansto/instrument/sans/quokka_configuration.tcl b/site_ansto/instrument/sans/quokka_configuration.tcl index ed6cfcb2..d54eab3b 100644 --- a/site_ansto/instrument/sans/quokka_configuration.tcl +++ b/site_ansto/instrument/sans/quokka_configuration.tcl @@ -41,7 +41,7 @@ fileeval $cfPath(environment)/temperature/sct_lakeshore_340.tcl fileeval $cfPath(environment)/temperature/sct_ls340.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_370.tcl fileeval $cfPath(environment)/temperature/sct_lakeshore_m370.tcl -fileeval $cfPath(environment)/temperature/sct_mercury_scpi.tcl +fileeval $cfPath(environment)/temperature/sct_oxford_mercury.tcl fileeval $cfPath(environment)/sct_nhq_200.tcl fileeval $cfPath(environment)/sct_omron_hldc.tcl fileeval $cfPath(environment)/temperature/sct_pfeiffer_hg.tcl @@ -55,6 +55,7 @@ fileeval $cfPath(environment)/temperature/sct_watlow_rm.tcl fileeval $cfPath(environment)/temperature/sct_watlow_mrm.tcl fileeval $cfPath(environment)/temperature/sct_watlow_st4.tcl fileeval $cfPath(environment)/temperature/sct_watlow_mst4.tcl +fileeval $cfPath(environment)/temperature/sct_west_6100.tcl fileeval $cfPath(hmm)/hmm_configuration.tcl fileeval $cfPath(nexus)/nxscripts.tcl fileeval $cfPath(hmm)/detector.tcl diff --git a/site_ansto/instrument/sans/util/sics_config.ini b/site_ansto/instrument/sans/util/sics_config.ini index da595975..9b7e2104 100644 --- a/site_ansto/instrument/sans/util/sics_config.ini +++ b/site_ansto/instrument/sans/util/sics_config.ini @@ -2,7 +2,7 @@ cascade = T1:watlow_rm,sample_stage:10_pos_sample_stage enabled = False [12Tmagnet_setup] -cascade = B1:12tmagnet_oxford,sample_stage:Oxford_12tmagnet_sample_insert,T1:mercury_scpi_01 +cascade = B1:12tmagnet_oxford,sample_stage:Oxford_12tmagnet_sample_insert,T1:mercury_01 enabled = False [20_position_pulser] cascade = T1:julabo_lh45,Function_Generator:agilent_33220A,High_Voltage:protek_02,sample_stage:20_pos_sample_stage @@ -315,7 +315,7 @@ asyncqueue = sct desc = "Lakeshore 336 temperature controller" driver = "ls336" imptype = temperature -ip = 137.157.201.21 +ip = 10.157.205.61 port = 7777 terminator = \r\n tol1 = 1.0 @@ -374,27 +374,47 @@ terminator = \r\n tol1 = 1.0 tol2 = 1.0 -[mercury_scpi_01] -desc = "Oxford Mercury temperature controller in Mercury mode" -driver = "mercury_scpi" +[mercury_01] +assoc = 00000124 +cards = HHHVLTTP +desc = "Oxford Mercury temperature controller (12T)" +driver = "oxford_mercury" imptype = temperature ip = 10.157.205.5 -permlink = LT port = 7020 -terminator = \r\n -tol = 1.0 -valve_tol = 2 +ptol = 5 +terminator = \n +timeout = 2000 +ttol = 1.0 +vtol = 5 -[mercury_scpi_02] -desc = "Oxford Mercury temperature controller in Mercury mode" -driver = "mercury_scpi" +[mercury_02] +assoc = 00000124 +cards = HHTVTTTP +desc = "Oxford Mercury temperature controller (CF10)" +driver = "oxford_mercury" +imptype = temperature +ip = 10.157.205.46 +port = 7020 +ptol = 5 +terminator = \n +timeout = 2000 +ttol = 1.0 +vtol = 5 + +[mercury_03] +assoc = 00000123 +cards = HHHNNTTT +desc = "Oxford Mercury temperature controller ()" +driver = "oxford_mercury" imptype = temperature ip = 10.157.205.47 -permlink = LT port = 7020 -terminator = \r\n -tol = 1.0 -valve_tol = 2 +ptol = 5 +terminator = \n +timeout = 2000 +ttol = 1.0 +vtol = 5 [newport_rva] desc = "Newport Rapid Visco-Analyser" @@ -433,10 +453,20 @@ terminator = \r\n tol = 0.5 type = T -[west4100] -desc = "Blue furnace temperature controller" +[vf1_west6100] +asyncprotocol = modbus_ap +desc = "VF1 Blue furnace temperature controller" dev_id = 1 -driver = "west4100" +driver = "west_6100" imptype = temperature -ip = 10.157.205.19 +ip = 10.157.205.24 +port = 502 +[vf2_west6100] +asyncprotocol = modbus_ap +desc = "VF2 Blue furnace temperature controller" +dev_id = 1 +driver = "west_6100" +imptype = temperature +ip = 10.157.205.25 +port = 502 diff --git a/site_ansto/instrument/tas/util/sics_config.ini b/site_ansto/instrument/tas/util/sics_config.ini index f34a4d35..489c912f 100644 --- a/site_ansto/instrument/tas/util/sics_config.ini +++ b/site_ansto/instrument/tas/util/sics_config.ini @@ -273,7 +273,7 @@ asyncqueue = sct desc = "Lakeshore 336 temperature controller" driver = "ls336" imptype = temperature -ip = 10.157.205.30 +ip = 10.157.205.61 port = 7777 terminator = \r\n tol1 = 1.0 @@ -363,6 +363,7 @@ ptol = 5 terminator = \n ttol = 1.0 vtol = 5 +timeout = 2000 [mercury_02] assoc = 00000124 @@ -376,6 +377,7 @@ ptol = 5 terminator = \n ttol = 1.0 vtol = 5 +timeout = 2000 [mercury_03] assoc = 00000123 @@ -389,6 +391,7 @@ ptol = 5 terminator = \n ttol = 1.0 vtol = 5 +timeout = 2000 [normal_m2s2] desc = "This sets speed and acceleration for the default extension of the m2 and s2 axes" @@ -414,15 +417,6 @@ imptype = multimeter ip = 10.157.205.37 port = 4001 -[vf1_west4100] -asyncqueue = sct -desc = "VF1 Blue furnace temperature controller" -dev_id = 1 -driver = "west4100" -imptype = temperature -ip = 10.157.205.24 -port = 502 - [vf1_west6100] asyncprotocol = modbus_ap desc = "VF1 Blue furnace 6100 temperature controller" @@ -433,15 +427,6 @@ ip = 10.157.205.24 port = 502 timeout = 2000 -[vf2_west4100] -asyncqueue = sct -desc = "VF2 Blue furnace temperature controller" -dev_id = 1 -driver = "west4100" -imptype = temperature -ip = 10.157.205.25 -port = 502 - [vf2_west6100] asyncprotocol = modbus_ap desc = "VF2 Blue furnace 6100 temperature controller" From 125ebc9f6deb160d1dd0db2eb419e3d36455d447 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 13 Mar 2015 15:23:32 +1100 Subject: [PATCH 6/7] Make getlog commands less flakey getlog {kill,none} getlog what getlog list getlog err,wrn[,...] --- conman.c | 40 +++++++++++++++++++++++++++++++++++++++- servlog.c | 35 +++++++++++++++++++++++++++++------ servlog.h | 1 + 3 files changed, 69 insertions(+), 7 deletions(-) diff --git a/conman.c b/conman.c index e069cc51..5a7e6974 100644 --- a/conman.c +++ b/conman.c @@ -2176,14 +2176,51 @@ int LogCapture(SConnection * pCon, SicsInterp * pSics, void *pData, argtolower(argc, argv); /* Branch according to argv[1] */ - if (strcmp(argv[1], "kill") == 0) { + if (strcmp(argv[1], "kill") == 0 || strcmp(argv[1], "none") == 0) { + SCPrintf(pCon, eLog, "getlog %s", argv[1]); KillCapture(pConMaster); return 1; + } else if (strcmp(argv[1], "what") == 0) { + unsigned int code_bits = 0; + pDynString buffer; + code_bits = (1 << iNoCodes) - 1; + buffer = CreateDynString(100, 100); + for (i = 0; i < iNoCodes; ++i) { + if (code_bits & (1 << i)) { + if (GetDynStringLength(buffer) > 0) + DynStringConcatChar(buffer, ','); + DynStringConcat(buffer, OutCodeToTxt(i)); + } + } + SCPrintf(pCon, eLog, "getlog %s", GetCharArray(buffer)); + DeleteDynString(buffer); + return 1; + } else if (strcmp(argv[1], "list") == 0) { + unsigned int code_bits = 0; + pDynString buffer; + code_bits = GetSICSLogHook(pConMaster); + if (code_bits == 0) { + SCPrintf(pCon, eLog, "getlog none"); + return 1; + } + buffer = CreateDynString(100, 100); + for (i = 0; i < iNoCodes; ++i) { + if (code_bits & (1 << i)) { + if (GetDynStringLength(buffer) > 0) + DynStringConcatChar(buffer, ','); + DynStringConcat(buffer, OutCodeToTxt(i)); + } + } + SCPrintf(pCon, eLog, "getlog %s", GetCharArray(buffer)); + DeleteDynString(buffer); + return 1; } else if (strcmp(argv[1], "all") == 0) { + SCPrintf(pCon, eLog, "getlog all"); AddSICSLogHook(hookFunc, "all", pConMaster); return 1; } else if (argc == 2) { /* must be outcode, try find it */ + SCPrintf(pCon, eLog, "getlog %s", argv[1]); AddSICSLogHook(hookFunc, argv[1], pConMaster); return 1; } else { @@ -2207,6 +2244,7 @@ int LogCapture(SConnection * pCon, SicsInterp * pSics, void *pData, strcpy(&pBuff[len], argv[i]); len += strlen(argv[i]); } + SCPrintf(pCon, eLog, "getlog %s", pBuff); AddSICSLogHook(hookFunc, pBuff, pConMaster); if (pBuff != pBueffel) free(pBuff); diff --git a/servlog.c b/servlog.c index da51c839..90ab59a8 100644 --- a/servlog.c +++ b/servlog.c @@ -140,14 +140,20 @@ int OutCodeFromText(const char *text, OutCode *outcode) } static unsigned int find_code_bits(const char *p1, const char *p2) { - /* must be outcode, try find it */ + /* may be outcode, try find it */ int i; + const char *pShort; + const char *pLong; size_t len = p2 - p1; - if (len == 3 && strncasecmp(p1, "all", 3)) - return ~0; + if (len == 3 && strncasecmp(p1, "all", 3) == 0) + return (1 << iNoCodes) - 1; for (i = 0; i < iNoCodes; ++i) { - if (pCode[i] != NULL && strlen(pCode[i]) == len) { - if (strncasecmp(p1, pCode[i], len) == 0) { + pShort = OutCodeToTxt(i); + if (pShort && strncasecmp(p1, pShort, len) == 0) + return 1 << i; + pLong = OutCodeToText(i); + if (pLong && strlen(pLong) == len) { + if (strncasecmp(p1, pLong, len) == 0) { return 1 << i; } } @@ -159,7 +165,7 @@ char *AddSICSLogHook(pSICSLogHook func, const char *pCodes, void *pData) { unsigned int code_bits = 0; if (strcasecmp("all", pCodes) == 0) - code_bits = ~0; + code_bits = (1 << iNoCodes) - 1; else { const char *p1, *p2; p1 = pCodes; @@ -221,6 +227,23 @@ char *RemSICSLogHook(void *pData) return NULL; } +/* Return bitmask of any and all hooks with this pData */ +unsigned int GetSICSLogHook(void *pData) +{ + pCaptureEntry pCurrent, pTemp; + unsigned int code_bits = 0; + + /* find first */ + pCurrent = pCapture; + while (pCurrent != NULL) { + if (pData == pCurrent->pData) { + code_bits |= pCurrent->code_bits; + } + pCurrent = pCurrent->pNext; + } + return code_bits; +} + /*--------------------------------------------------------------------------*/ static int HasLineFeed(char *pText) diff --git a/servlog.h b/servlog.h index ce5af4fb..99fafc0a 100644 --- a/servlog.h +++ b/servlog.h @@ -36,4 +36,5 @@ void SICSLogEnable(int flag); typedef void (*pSICSLogHook)(const char *pText, OutCode eOut, void *pData); char *AddSICSLogHook(pSICSLogHook func, const char *pCodes, void *pData); char *RemSICSLogHook(void *pData); +unsigned int GetSICSLogHook(void *pData); #endif From 6ef97197ee49f65e1e9768659d249a25f8adb2cc Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Fri, 13 Mar 2015 15:30:16 +1100 Subject: [PATCH 7/7] Handle nested GROUP and VAR constructs in gen_sct.py --- site_ansto/instrument/util/gen_sct.py | 108 ++++++++++++++++++++------ 1 file changed, 86 insertions(+), 22 deletions(-) diff --git a/site_ansto/instrument/util/gen_sct.py b/site_ansto/instrument/util/gen_sct.py index 52bda187..e87665a6 100755 --- a/site_ansto/instrument/util/gen_sct.py +++ b/site_ansto/instrument/util/gen_sct.py @@ -371,14 +371,26 @@ def p_driver_assignment(p): # def p_group(p): ''' - group : GROUP group_id EQUALS LBRACE group_statement_list RBRACE + group : named_group + | unnamed_group + ''' + p[0] = p[1] + +def p_named_group(p): + ''' + named_group : GROUP group_id EQUALS LBRACE group_statement_list RBRACE ''' p[0] = { 'Group' : [{'name': p[2]}] + p[5] } +def p_unnamed_group(p): + ''' + unnamed_group : GROUP EQUALS LBRACE group_statement_list RBRACE + ''' + p[0] = { 'Group' : [{'name': None}] + p[4] } + def p_group_id(p): ''' group_id : id_or_str - | empty ''' p[0] = p[1] @@ -433,6 +445,8 @@ def p_variable_statement(p): '''variable_statement : var_typ_ass | var_val_ass | property + | variable + | group ''' p[0] = p[1] @@ -629,11 +643,11 @@ def p_error(t): # # Utility functions # -def make_path(MyVar): +def make_path(MyVar, ch = '_'): path = MyVar['path'] if len(path) > 0: - path = path.replace('/', '_') - path += '_' + path = path.replace('/', ch) + path += ch path += MyVar['name'] return path @@ -745,6 +759,8 @@ def build_variable(MyDriver, p): print 'Variable:', p MyVar = {} MyVar['Property'] = {} + MyVar['Group'] = {} + MyVar['Variable'] = {} # Copy items for this variable for item in p: if Verbose: @@ -752,6 +768,10 @@ def build_variable(MyDriver, p): for key in item.keys(): if key == 'Property': MyVar['Property'][item[key][0]] = item[key][1] + elif key == 'Group': + pass # process nested groups at the bottom + elif key == 'Variable': + pass # process nested variables at the bottom else: MyVar[key] = item[key] # copy the defaults for missing items @@ -804,6 +824,30 @@ def build_variable(MyDriver, p): if node_type not in MyDriver['Permlink']: MyDriver['Permlink'][node_type] = [] MyDriver['Permlink'][node_type] += [make_path(MyVar)] + # Process the nested groups + for item in p: + for key in item.keys(): + if key == 'Group': + if Verbose: + print "SubGroup Item:", item[key] + push_context() + if len(ContextStack[ContextIndex]['path']) > 0: + ContextStack[ContextIndex]['path'] += '/' + ContextStack[ContextIndex]['path'] += MyVar['name'] + MyVar['Group'][item[key][0]['name']] = build_group(MyDriver, item[key]) + pop_context() + # Process the nested variables + for item in p: + for key in item.keys(): + if key == 'Variable': + if Verbose: + print "SubVariable Item:", item[key] + push_context() + if len(ContextStack[ContextIndex]['path']) > 0: + ContextStack[ContextIndex]['path'] += '/' + ContextStack[ContextIndex]['path'] += MyVar['name'] + MyVar['Variable'][item[key][0]['name']] = build_variable(MyDriver, item[key]) + pop_context() if Verbose: print '==>>MyVar:', MyVar return MyVar @@ -983,21 +1027,24 @@ def dump_driver_vars(vars, indent): global FunctionTypes global DriveableFunctionTypes for item in sorted(vars): - print indent + ' VAR %s = {' % item + print indent + 'VAR %s = {' % item Comments = ['name', 'path'] - Deferred = ['Property'] + Comments + FunctionTypes + DriveableFunctionTypes + Deferred = ['Property', 'Variable', 'Group'] + Comments + FunctionTypes + DriveableFunctionTypes for Comment in sorted(Comments): if Comment in vars[item]: - print indent + ' # %s = \'%s\'' % (Comment, vars[item][Comment]) + print indent + ' # %s = \'%s\'' % (Comment, vars[item][Comment]) for subitem in sorted([i for i in vars[item] if i not in Deferred]): - print indent + ' %s = \'%s\'' % (subitem, vars[item][subitem]) + print indent + ' %s = \'%s\'' % (subitem, vars[item][subitem]) for subitem in sorted([i for i in vars[item] if i in FunctionTypes]): - print indent + ' %s = \'%s\'' % (subitem, vars[item][subitem]) + print indent + ' %s = \'%s\'' % (subitem, vars[item][subitem]) for subitem in sorted([i for i in vars[item] if i in DriveableFunctionTypes]): - print indent + ' %s = \'%s\'' % (subitem, vars[item][subitem]) + print indent + ' %s = \'%s\'' % (subitem, vars[item][subitem]) for subitem in sorted([i for i in vars[item]['Property']]): - print indent + ' Property \'%s\' = \'%s\'' % (subitem, vars[item]['Property'][subitem]) - print indent + ' }' + print indent + ' Property \'%s\' = \'%s\'' % (subitem, vars[item]['Property'][subitem]) + # Dump the nested groups and vars + dump_driver_groups(vars[item]['Group'], indent + ' ') + dump_driver_vars(vars[item]['Variable'], indent + ' ') + print indent + '}' def dump_driver_groups(groups, indent): for item in sorted(groups): @@ -1015,7 +1062,7 @@ def dump_driver_groups(groups, indent): if 'GroupProperty' in groups[item]: for subitem in groups[item]['GroupProperty']: print indent + ' GroupProperty', subitem, '= \'%s\'' % groups[item]['GroupProperty'][subitem] - dump_driver_vars(groups[item]['Vars'], indent) + dump_driver_vars(groups[item]['Vars'], indent + ' ') dump_driver_groups(groups[item]['Groups'], indent + ' ') print indent + '}' @@ -1401,10 +1448,11 @@ def put_var(MyDriver, MyGroup, MyVar): readable_or_writeable = False txt = [] postfix = [] - if MyGroup['name']: - nodename = MyGroup['path'] + '/' + MyVar['name'] - else: - nodename = MyVar['name'] + nodename = make_path(MyVar, '/') + + # Debugging + #txt += ['# path = ' + MyVar['path']] + #txt += ['# name = ' + nodename] # Check driveable attributes are present if required if 'driveable' in MyVar and MyVar['driveable']: @@ -1536,6 +1584,20 @@ def put_var(MyDriver, MyGroup, MyVar): txt += [' hsetprop ${scobj_hpath}/%s simulated true' % nodename] txt += [' }'] + # Process nested groups + for grp in sorted(MyVar['Group']): + txt += [''] + infix = put_group(MyDriver, MyVar['Group'][grp]) + txt += infix + + # Process nested variables + for var in sorted(MyVar['Variable']): + txt += [''] + MySubVar = MyVar['Variable'][var] + infix, dfr = put_var(MyDriver, MyGroup, MySubVar) + txt += infix + postfix += dfr + if 'conditional' in MyVar: for idx, line in enumerate(txt): if len(line) > 0: @@ -1553,7 +1615,7 @@ def put_var(MyDriver, MyGroup, MyVar): def put_group(MyDriver, MyGroup): txt = [] - dfr = [] + postfix = [] if MyGroup['name']: txt += [''] txt += [' hfactory ${scobj_hpath}/%s plain spy none' % MyGroup['path']] @@ -1563,14 +1625,16 @@ def put_group(MyDriver, MyGroup): for var in sorted(MyGroup['Vars']): txt += [''] MyVar = MyGroup['Vars'][var] - infix, postfix = put_var(MyDriver, MyGroup, MyVar) + infix, dfr = put_var(MyDriver, MyGroup, MyVar) txt += infix - dfr += postfix + postfix += dfr if MyGroup['name']: if 'GroupProperty' in MyGroup: for key in sorted(MyGroup['GroupProperty']): txt += [' hsetprop ${scobj_hpath}/%s %s "%s"' % (MyGroup['path'], key, MyGroup['GroupProperty'][key])] + elif len(MyGroup['path']) > 0: + pass else: if 'GroupProperty' in MyGroup: txt += [''] @@ -1580,7 +1644,7 @@ def put_group(MyDriver, MyGroup): for grp in sorted(MyGroup['Groups']): txt += put_group(MyDriver, MyGroup['Groups'][grp]) - txt += dfr + txt += postfix if 'conditional' in MyGroup: for idx, line in enumerate(txt):