From a0923650d92f336dd7f836f93258380a66f5c46b Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Mon, 24 May 2010 14:24:04 +1000 Subject: [PATCH] sct_flipper.tcl Fixed simulated driver mode. ascon.c Added host and port to ascon error messages. r2937 | ffr | 2010-05-24 14:24:04 +1000 (Mon, 24 May 2010) | 6 lines --- ascon.c | 4 +- .../temperature/sct_lakeshore_3xx.tcl | 8 +- .../sans/config/beamline/sct_flipper.tcl | 74 +++++++++++++------ 3 files changed, 58 insertions(+), 28 deletions(-) diff --git a/ascon.c b/ascon.c index 2b7b9124..0b27bb0e 100644 --- a/ascon.c +++ b/ascon.c @@ -75,9 +75,9 @@ void AsconError(Ascon *a, char *msg, int errorno) { state = stateText[a->state]; } if (errorno != 0) { - a->errList = ErrPutMsg(a->errList, "ASCERR: %s %s (during %s)", msg, strerror(errorno), state); + a->errList = ErrPutMsg(a->errList, "ASCERR: %s %s (during %s on %s)", msg, strerror(errorno), state, a->hostport); } else { - a->errList = ErrPutMsg(a->errList, "ASCERR: %s (during %s)", msg, state); + a->errList = ErrPutMsg(a->errList, "ASCERR: %s (during %s on %s)", msg, state, a->hostport); } a->state |= AsconFailed; } diff --git a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_3xx.tcl b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_3xx.tcl index 31da0252..c91608ed 100755 --- a/site_ansto/instrument/config/environment/temperature/sct_lakeshore_3xx.tcl +++ b/site_ansto/instrument/config/environment/temperature/sct_lakeshore_3xx.tcl @@ -1671,8 +1671,8 @@ proc helpNotes4user {scobj_hpath cmdGroup varName} { # @param allowedValues allowed values for the node data - does not permit other # @param klasse Nexus class name (?) # @return OK -proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable\ - pollEnabled drivable idx ls340 ls336 dataType permission rdCmd rdFunc wrCmd\ +proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable + pollEnabled drivable idx ls340 ls336 dataType permission rdCmd rdFunc wrCmd wrFunc allowedValues klasse lsModel} { #puts "createing node for: $scobj_hpath $cmdGroup $varName $readable $writable $pollEnabled $drivable $idx $dataType $permission $rdCmd $rdFunc $wrCmd $wrFunc" #puts "createNode, lsModel = $lsModel, ls340=$ls340, ls336=$ls336, varName=$varName " @@ -1892,8 +1892,8 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable\ } # The following 2 commands take no parameter - this makes them difficult to implement in a hipadaba structure # because they would be nodes without values... - # input alarmResetAll 0 1 0 0 0 1 1 text user {} {rdValue} {ALMRST} {setValue} {}\ - # other reset_rst 0 1 0 0 0 1 1 text user {} {rdValue} {*RST} {setValue} {}\ + # input alarmResetAll 0 1 0 0 0 1 1 text user {} {rdValue} {ALMRST} {setValue} {} + # other reset_rst 0 1 0 0 0 1 1 text user {} {rdValue} {*RST} {setValue} {} hfactory $scobj_hpath/status plain spy text hsetprop $scobj_hpath/status values busy,idle diff --git a/site_ansto/instrument/sans/config/beamline/sct_flipper.tcl b/site_ansto/instrument/sans/config/beamline/sct_flipper.tcl index ae1a3e5e..2ae5f6ed 100644 --- a/site_ansto/instrument/sans/config/beamline/sct_flipper.tcl +++ b/site_ansto/instrument/sans/config/beamline/sct_flipper.tcl @@ -17,8 +17,21 @@ # } # # NOTE: -# If tuning=1 this will generate flipper/set_current and flipper/set_frequency nodes for the instrument scientists. -# The tuining parameter should be set to 0 for the users. +# If tuning=1 this will generate flipper/set_current and flipper/set_frequency +# nodes for the instrument scientists. +# The tuning parameter should be set to 0 for the users. +# +# The operation_manual_Platypus_polarization_system.doc:Sec 3.1 states the following +# Attention +# a) Do not switch on the RF output with non-zero current setting (the current +# control becomes unstable)! If unsure, rotate the current setting +# potentiometer 10 turns counter-clockwise. +# b) In case of RF vacuum discharge (harmful for the system) +# " the main symptom is that the RF power source turns into CV mode, the +# voltage increases to 34 Vem and the current decreases; +# " switch off the RF output; +# " decrease current setting by rotating the potentiometer 10 turns counter-clockwise; +# " verify the vacuum level in the tank and restart the flipper operation only if it is below 0.01 mbar. namespace eval ::scobj::rfgen { # Control states @@ -127,6 +140,8 @@ proc ::scobj::rfgen::rdStatFunc {} { variable RAMPTOZERO variable RAMPIDLE + set MAXVOLTAGE 34 + set basePath [sct] set currSuperState [sct ramping] @@ -140,6 +155,16 @@ 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}] @@ -302,14 +327,6 @@ proc ::scobj::rfgen::mkFlipper {argList} { hsetprop /sics/$pa(NAME) origTargetCurr 0 hsetprop /sics/$pa(NAME) oldStateRep "" - makesctcontroller sct_rfgen rfamp $pa(IP):$pa(PORT) - mkStatArr stateArr [split [sct_rfgen transact "L:$pa(ADDRESS)"] "|="] - hset /sics/$pa(NAME)/flip_current [expr {$stateArr(curr) / 10.0}] - hset /sics/$pa(NAME)/flip_frequency $stateArr(freq) - hset /sics/$pa(NAME)/flip_voltage $stateArr(voltage) - hset /sics/$pa(NAME)/flip_on $stateArr(O) - hsetprop /sics/$pa(NAME) targetFreq $stateArr(freq) - hsetprop /sics/$pa(NAME) targetCurr [expr {$stateArr(curr) / 10.0}] hsetprop /sics/$pa(NAME) currTol $pa(CURRTOL) hfactory /sics/$pa(NAME)/comp_current plain internal float @@ -325,16 +342,6 @@ proc ::scobj::rfgen::mkFlipper {argList} { hfactory /sics/$pa(NAME)/set_flip_on plain user int hsetprop /sics/$pa(NAME)/set_flip_on write ::scobj::rfgen::set_flip_on /sics/$pa(NAME) # Only create the set current and frequency nodes when commissioning - if {$pa(TUNING)} { - hfactory /sics/$pa(NAME)/set_current plain user float - hfactory /sics/$pa(NAME)/set_frequency plain user int - - hsetprop /sics/$pa(NAME)/set_current write ::scobj::rfgen::set_current /sics/$pa(NAME) - hsetprop /sics/$pa(NAME)/set_frequency write ::scobj::rfgen::set_frequency /sics/$pa(NAME) - - sct_rfgen write /sics/$pa(NAME)/set_current - sct_rfgen write /sics/$pa(NAME)/set_frequency - } # Initialise properties required for generating the API for GumTree and to save data ::scobj::hinitprops $pa(NAME) flip_current flip_frequency flip_voltage flip_on comp_current guide_current thickness @@ -343,7 +350,30 @@ proc ::scobj::rfgen::mkFlipper {argList} { hsetprop /sics/$pa(NAME)/thickness mutable false if {[SplitReply [rfgen_simulation]] == "false"} { - sct_rfgen poll /sics/$pa(NAME) $pa(INTERVAL) - sct_rfgen write /sics/$pa(NAME)/set_flip_on + makesctcontroller sct_rfgen rfamp $pa(IP):$pa(PORT) + mkStatArr stateArr [split [sct_rfgen transact "L:$pa(ADDRESS)"] "|="] + + hset /sics/$pa(NAME)/flip_current [expr {$stateArr(curr) / 10.0}] + hset /sics/$pa(NAME)/flip_frequency $stateArr(freq) + hset /sics/$pa(NAME)/flip_voltage $stateArr(voltage) + hset /sics/$pa(NAME)/flip_on $stateArr(O) + hsetprop /sics/$pa(NAME) targetFreq $stateArr(freq) + hsetprop /sics/$pa(NAME) targetCurr [expr {$stateArr(curr) / 10.0}] + + sct_rfgen poll /sics/$pa(NAME) $pa(INTERVAL) + sct_rfgen write /sics/$pa(NAME)/set_flip_on + } + + if {$pa(TUNING)} { + hfactory /sics/$pa(NAME)/set_current plain user float + hfactory /sics/$pa(NAME)/set_frequency plain user int + + hsetprop /sics/$pa(NAME)/set_current write ::scobj::rfgen::set_current /sics/$pa(NAME) + hsetprop /sics/$pa(NAME)/set_frequency write ::scobj::rfgen::set_frequency /sics/$pa(NAME) + + if {[SplitReply [rfgen_simulation]] == "false"} { + sct_rfgen write /sics/$pa(NAME)/set_current + sct_rfgen write /sics/$pa(NAME)/set_frequency + } } }