From 9926044c35df2c27b10218acd43406cccd3ab12f Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Wed, 26 May 2010 13:32:42 +1000 Subject: [PATCH] Switch off spin flipper if voltage exceeds 34V in voltage control mode r2939 | ffr | 2010-05-26 13:32:42 +1000 (Wed, 26 May 2010) | 2 lines --- .../sans/config/beamline/sct_flipper.tcl | 37 ++++++++++++------- .../sans/config/beamline/spin_flipper.tcl | 2 +- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/site_ansto/instrument/sans/config/beamline/sct_flipper.tcl b/site_ansto/instrument/sans/config/beamline/sct_flipper.tcl index 2ae5f6ed..51f433a3 100644 --- a/site_ansto/instrument/sans/config/beamline/sct_flipper.tcl +++ b/site_ansto/instrument/sans/config/beamline/sct_flipper.tcl @@ -40,6 +40,8 @@ namespace eval ::scobj::rfgen { variable RAMPSTART 2 variable RAMPBUSY 3 variable RAMPTOZERO 4 + variable FLIPOFF 5 + variable MAXVOLTAGE 34 } ## @@ -139,8 +141,8 @@ proc ::scobj::rfgen::rdStatFunc {} { variable RAMPSTART variable RAMPTOZERO variable RAMPIDLE - - set MAXVOLTAGE 34 + variable FLIPOFF + variable MAXVOLTAGE set basePath [sct] @@ -155,17 +157,6 @@ proc ::scobj::rfgen::rdStatFunc {} { set statList [split $statStr "|="] mkStatArr stateArr $statList - if {$stateArr(CV)} { - broadcast "WARNING: spin flipper has switched to voltage control" - if {$stateArr(voltage) >= $MAXVOLTAGE} { - set errMsg "ERROR: Spin flipper switched off voltage exceeds $MAXVOLTAGE in voltage control state, check vacuum" - sct geterror $errMsg - broadcast $errMsg - sct ramping $RAMPSTOP - return stateChange - } - } - if {$statList != [sct oldStateRep]} { hset $basePath/flip_current [expr {$stateArr(curr) / 10.0}] hset $basePath/flip_frequency $stateArr(freq) @@ -176,6 +167,13 @@ proc ::scobj::rfgen::rdStatFunc {} { sct utime readtime sct oldStateRep $statList } + if {$currSuperState != $FLIPOFF && $stateArr(curr) > [sct currTol] && $stateArr(O) && $stateArr(CV)} { + broadcast "WARNING: spin flipper has switched to voltage control, voltage = $stateArr(voltage)" + if {$stateArr(voltage) >= $MAXVOLTAGE} { + sct ramping $FLIPOFF + } + } + return stateChange } @@ -187,6 +185,8 @@ proc ::scobj::rfgen::stateFunc {} { variable RAMPSTART variable RAMPBUSY variable RAMPTOZERO + variable FLIPOFF + variable MAXVOLTAGE set basePath [sct] @@ -233,6 +233,17 @@ proc ::scobj::rfgen::stateFunc {} { } return ramp } + $FLIPOFF { + sct targetCurr 0 + sct OutputState 0 + if { $stateArr(curr) <= [sct currTol] } { + sct ramping $RAMPSTOP + broadcast "ERROR: Spin flipper switched off voltage exceeds $MAXVOLTAGE in voltage control state, check vacuum" + return idle + } else { + return ramp + } + } $RAMPSTOP { # broadcast RAMPSTOP if [string match $currControlStatus "BUSY"] { diff --git a/site_ansto/instrument/sans/config/beamline/spin_flipper.tcl b/site_ansto/instrument/sans/config/beamline/spin_flipper.tcl index a273a29f..fb354404 100644 --- a/site_ansto/instrument/sans/config/beamline/spin_flipper.tcl +++ b/site_ansto/instrument/sans/config/beamline/spin_flipper.tcl @@ -9,7 +9,7 @@ fileeval $cfPath(beamline)/sct_flipper.tcl IP 137.157.202.86 PORT 4001 tuning 1 - interval 5 + interval 2 currtol 1 compCurr 1 guideCurr 1