diff --git a/danu.dat b/danu.dat index 07cc6631..4db577fa 100644 --- a/danu.dat +++ b/danu.dat @@ -1,3 +1,3 @@ - 7459 + 7476 NEVER, EVER modify or delete this file You'll risk eternal damnation and a reincarnation as a cockroach!|n \ No newline at end of file diff --git a/fitcenter.c b/fitcenter.c index 5139ce7a..9f5c21eb 100644 --- a/fitcenter.c +++ b/fitcenter.c @@ -447,6 +447,21 @@ return 0; break; } + + /* + This is a little feature to get the peak without rubbish for + the TAS routines + */ + if(argc > 1) + { + strtolower(argv[1]); + if(strcmp(argv[1],"value") == 0) + { + sprintf(pBueffel,"%f", self->fCenter); + SCWrite(pCon,pBueffel,eValue); + return 1; + } + } /* print results */ sprintf(pBueffel,"Estimated Peak Center: %f, StdDev: %f \n", diff --git a/sicsstat.tcl b/sicsstat.tcl index 240bed34..64dc8b7b 100644 --- a/sicsstat.tcl +++ b/sicsstat.tcl @@ -70,7 +70,7 @@ da6 0.000000 da6 setAccess 2 da5 0.000000 da5 setAccess 2 -da4 0.500000 +da4 0.100000 da4 setAccess 2 da3 0.000000 da3 setAccess 2 @@ -90,15 +90,15 @@ alf4 0.000000 alf4 setAccess 2 alf3 0.000000 alf3 setAccess 2 -alf2 0.000000 +alf2 3.000000 alf2 setAccess 2 -alf1 0.000000 +alf1 11.000000 alf1 setAccess 2 local Berty Chimney local setAccess 2 output a1,a2,a3,a4 output setAccess 2 -lastcommand sc qh 0 0 2 3 dqh 0.01 0.0 0.01 .1 +lastcommand sc a4 10 da4 .1 np 7 ti 8 lastcommand setAccess 2 user Billy Looser user setAccess 2 @@ -124,11 +124,11 @@ if2v 0.000000 if2v setAccess 2 if1v 0.000000 if1v setAccess 2 -mn 0 +mn 2000 mn setAccess 2 -ti 2.000000 +ti 8.000000 ti setAccess 2 -np 9 +np 7 np setAccess 2 fx 2 fx setAccess 2 @@ -183,7 +183,7 @@ bs setAccess 2 as 5.000000 as setAccess 2 # Counter counter -counter SetPreset 2.000000 +counter SetPreset 8.000000 counter SetMode Timer # Motor agl agl SoftZero -0.490000 diff --git a/sicsstatus.tcl b/sicsstatus.tcl index ee55cf18..28dfae3e 100644 --- a/sicsstatus.tcl +++ b/sicsstatus.tcl @@ -28,8 +28,8 @@ th sign 1.000000 th InterruptMode 0.000000 th AccessCode 2.000000 #Crystallographic Settings -hkl lambda 1.179000 -hkl setub 0.087418 -0.158308 0.006979 0.158247 0.087630 0.005560 -0.008243 0.003417 0.180755 +hkl lambda 0.703790 +hkl setub -0.124702 0.001618 -0.041357 -0.104448 -0.001326 0.049388 0.000751 0.084094 0.001574 det1dist 300. det1dist setAccess 1 det1zeroy 128. @@ -38,7 +38,7 @@ det1zerox 128. det1zerox setAccess 1 mono2theta 36.77 mono2theta setAccess 1 -monodescription unknownit crystal +monodescription unknownit crystal monodescription setAccess 1 # Motor om om SoftZero 0.000000 @@ -135,7 +135,7 @@ phone setAccess 2 adress UNKNOWN adress setAccess 2 # Counter counter -counter SetPreset 1.000000 +counter SetPreset 1000.000000 counter SetMode Timer # Motor som som SoftZero 0.000000 diff --git a/sinqhm/SinqHM_srv_filler.c b/sinqhm/SinqHM_srv_filler.c index bc574b4a..ac3358ab 100755 --- a/sinqhm/SinqHM_srv_filler.c +++ b/sinqhm/SinqHM_srv_filler.c @@ -675,7 +675,6 @@ } if (FillTimer_expired) { - /* if (Print_hdr) printf ("\nTaking data in TOF Mode\n" " #-Events #-Skip #-TSI Delay-Time Sync-Status\n"); Print_hdr = False; @@ -697,7 +696,6 @@ if (is != 0) { printf ("%s -- failed to set timer\n", Filler_name); } - */ } } /* Our flag has been set. There should be .. diff --git a/tascom.tcl b/tascom.tcl index ce50073e..8a1df256 100644 --- a/tascom.tcl +++ b/tascom.tcl @@ -18,24 +18,44 @@ if { [info exists tasinit] == 0 } { Publish ou User Publish fi User Publish cl User + Publish co User + Publish fm User + Publish fz User + Publish pr Spy + Publish se User + Publish lz Spy + Publish lm Spy + Publish ls Spy } #-------------------------------------------------------------------------- # a list of motors, needed at various stages in this set tasmot { a1 a2 a3 a4 a5 a6 mcv sro ach mtl mtu stl stu atu mgl sgl \ - sgu agu agl} + sgu agl} #------------------------------------------------------------------------- -# some MAD variables can be directly mapped to internal SICS variables -# This mapping is done here through a mapping array +# some MAD variables can be directly mapped to internal SICS variables. +# Some others require special functions to be called for them to be set. +# These mappings are defined here through in a mapping array for {set i 0} {$i < [llength $tasmot]} { incr i } { set mot [lindex $tasmot $i] set tasmap(l$mot) [format "%s softlowerlim " $mot] + set tasmap(z$mot) [format "madZero %s " $mot] set tasmap(u$mot) [format "%s softupperlim " $mot] } +set tasmap(ss) "scatSense ss " +set tasmap(sa) "scatSense sa " +set tasmap(sm) "scatSense sm " +set tasmap(fx) "fxi " +#---------------------------------------------------------------------- +# mapping array output for debugging +#set l [array names tasmap] +#foreach e $l { +# clientput [format " %s = %s" $e $tasmap($e)] +#} #------------------------------------------------------------------------ # quite often we need to split a SICS answer of the form x = y and # extract the y. This is done here. @@ -60,7 +80,7 @@ proc madZero args { if {$length == 1 } { #inquiry case set zero [tasSplit [$mot softzero]] - return [expr -$zero] + return [format "madZero = %f " [expr -$zero]] } else { # a new value has been given. set val [lindex $args 1] @@ -91,7 +111,7 @@ proc fxi {val} { # motors softzero as well: it is rotated by 180 degree. This is done # by this function -proc scatSense {par val} { +proc scatSense {par {val -1000} } { switch $par { ss { set mot a3 @@ -104,11 +124,16 @@ proc scatSense {par val} { } default { error "ERROR: unknown scattering sense $par" - } + } + } +#-------- inquiry case + if { $val == -1000 } { + return [eval $par] + } if {$val != 1 && $val != -1 } { error "ERROR: invalid scattering sense $val" } - set oldzero [madZero $mot] + set oldzero [tasSplit [madZero $mot]] madZero $mot [expr 180 + $oldzero] $par $val } @@ -170,14 +195,19 @@ proc typeATokenizer {text pos} { proc cl args { global tasmot - if {llength $args] == 0} { + if {[llength $args] == 0} { #------ clear all fixed motors foreach m $tasmot { - if { [tasSplit [$m fixed]] > 0 } { + set ret [catch {tasSplit [$m fixed]} x] + if {$ret != 0 } { + continue + } + if { $x > 0 } { clientput [format "%s unfixed" $m] $m fixed -1 } } + return } #------ trying to clear individual fixed motors set command [join $args] @@ -185,7 +215,6 @@ proc cl args { set pos 0 set token [typeATokenizer $command $pos] while {[string compare $token END] != 0 } { - set last $token if {$token == "-" } { set l [llength $tasmot] #------ handle a range, first find start @@ -208,20 +237,22 @@ proc cl args { if {$ret != 0} { error [format "ERROR: %s is no motor" $e] } else { - clientput [format "$s unfixed" $e] + clientput [format "%s unfixed" $e] } if {[string compare $e $stop] == 0 } { - return + break } } - } + } else { #------ should be a single motor here - set ret [catch {$token fixed -1} msg] - if {$ret != 0} { - error [format "ERROR: %s is no motor" $token] - } else { - clientput [format "$s unfixed" $token] - } + set last $token + set ret [catch {$token fixed -1} msg] + if {$ret != 0} { + error [format "ERROR: %s is no motor" $token] + } else { + clientput [format "%s unfixed" $token] + } + } #------- do not forget to proceed set token [typeATokenizer $command $pos] } @@ -232,13 +263,18 @@ proc cl args { proc fi args { global tasmot - if {llength $args] == 0} { + if {[llength $args] <= 0} { #------ list all fixed motors foreach m $tasmot { - if { [tasSplit [$m fixed]] > 0 } { + set ret [catch {tasSplit [$m fixed ] } x] + if {$ret != 0 } { + continue + } + if { $x > 0 } { clientput [format "%s fixed" $m] } } + return } #------ parse motors to fix set command [join $args] @@ -246,7 +282,6 @@ proc fi args { set pos 0 set token [typeATokenizer $command $pos] while {[string compare $token END] != 0 } { - set last $token if {$token == "-" } { set l [llength $tasmot] #------ handle a range, first find start @@ -269,21 +304,370 @@ proc fi args { if {$ret != 0} { error [format "ERROR: %s is no motor" $e] } else { - clientput [format "$s fixed" $e] + clientput [format "%s fixed" $e] } if {[string compare $e $stop] == 0 } { - return + break } } - } -#------ should be a single motor here - set ret [catch {$token fixed 1} msg] - if {$ret != 0} { - error [format "ERROR: %s is no motor" $token] } else { - clientput [format "$s fixed" $token] - } +#------ should be a single motor here + set last $token + set ret [catch {$token fixed 1} msg] + if {$ret != 0} { + error [format "ERROR: %s is no motor" $token] + } else { + clientput [format "%s fixed" $token] + } + } #------- do not forget to proceed set token [typeATokenizer $command $pos] } } +#-------------------------------------------------------------------------- +# varToken returns the next token in a variable setting string. +# handles pos as in type A syntax above. + +proc varToken {text pos} { + upvar pos p + set l [string length $text] +#------- check for end + if {$p >= $l} { + return END + } +#-------- skip spaces + for {} {$p < $l} {incr p} { + set c [string index $text $p] + if { $c != " " && $c != "," && $c != "=" } { + break + } + } + if {$p >= $l} { + return END + } +#---- extract token + set start $p +#---- proceed to next terminator + for {} {$p < $l} {incr p} { + set c [string index $text $p] + if { $c == " " || $c == "," || $c == "=" } { + break + } + } + set stop [expr $p - 1] + return [string range $text $start $stop] +} + +#--------------------------------------------------------------------------- +# varSet parses a string containing MAD variable statements and sets the +# variables. Thereby it has to take care of mappings and special variables +# which have to be set by special functions. The only format allowed here +# are name value pairs. + +proc varSet { command } { + global tasmap + set pos 0 + set token [varToken $command $pos] + set value [varToken $command $pos] + while { [string compare $token END] != 0} { +#----- first check for special things like user, local, title etc + if { [string compare $token title] == 0 || \ + [string compare $token user] == 0 || \ + [string compare $token local] == 0 } { + eval $command + return + } +#----- now check for a numeric argument + set t [SICSType $value] + if { [string compare $t NUM] != 0 } { + error [format "ERROR: expected number for %s, got %s" \ + $token $value] + } +#------ now check for mapped variables + if { [info exists tasmap($token)] == 1} { + set ret [catch {eval $tasmap($token) $value} msg] + if { $ret != 0} { + error [format "ERROR: error %s while setting %s" $msg $token] + } else { + clientput [format " %s = %s" $token $value] + } + + } else { + set ret [catch {eval $token $value} msg] + if { $ret != 0 } { + error [format "ERROR: error %s while setting %s" $msg $token] + } else { + clientput [format " %s = %s" $token $value] + } + } + set token [varToken $command $pos] + set value [varToken $command $pos] + } +} + +#-------------------------------------------------------------------------- +# co for count is the funny MAD count procedure. Please note, that the +# count mode is automatically set through the last MN or TI variable. + +proc co args { +#------ set variables if present at command line + if { [llength $args] > 0 } { + set com [join $args] + varSet $com + } +#---- done this, now count + set f [tasSplit [counter getpreset]] + set ret [catch {eval counter count $f } msg] + if {$ret != 0} { + error $msg + } +#----- format output + set cts [tasSplit [counter getcounts]] + set m1 [tasSplit [counter getmonitor 1]] + set m3 [tasSplit [counter getmonitor 2]] + return [format " Counts = %8d, M1 = %8d, M3 = %8d" $cts $m1 $m3] +} + +#---------------------------------------------------------------------------- +# fm or FindMaximum: does a scan, then proceeds to find the maximum +# of the peak and drives the first scan variable to the maximum. + +proc fm args { +#------ do the scan first + append com "sc " [ join $args] + set ret [catch {eval $com} msg] + if { $ret != 0 } { + error $msg + } +# iscan simscan 15 .3 1000 +#----- calculate the center + set ret [catch {eval peak value} msg] + if { $ret != 0 } { + error $msg + } + if { [string first "WARN" $msg ] >= 0 } { + error [format "ERROR: failed to find peak: %s" $msg] + } + set val $msg +#------ find variable and drive to center + set temp [iscan getvardata 0] + set start [string first "." $temp] + incr start + set stop [string first "=" $temp] + incr stop -1 + set var [string range $temp $start $stop] + set ret [catch {eval dr $var $val} msg] + if { $ret != 0 } { + error $msg + } +} + +#------------------------------------------------------------------------ +# fz does almost the same as fm, but also sets the current position to be +# the zeropoint after driving + +proc fz args { +#------ do the scan first + append com "sc " [ join $args] + set ret [catch {eval $com} msg] + if { $ret != 0 } { + error $msg + } + iscan simscan 15 .3 1000 +#----- calculate the center + set ret [catch {eval peak value} msg] + if { $ret != 0 } { + error $msg + } + if { [string first "WARN" $msg ] >= 0 } { + error [format "ERROR: failed to find peak: %s" $msg] + } + set val $msg +#------ find variable and drive to center + set temp [iscan getvardata 0] + set start [string first "." $temp] + incr start + set stop [string first "=" $temp] + incr stop -1 + set var [string range $temp $start $stop] + set ret [catch {eval dr $var $val} msg] + if { $ret != 0 } { + error $msg + } +#------- now do zero point + set temp [eval $var hardposition] + set newZero [tasSplit $temp] + madZero [string trim $var] [expr -$newZero] +} + +#-------------------------------------------------------------------------- +# pr (int) values of variables + +proc pr args { + global tasmap + set line [join $args] + set line [string tolower $line] + set pos 0 + set token [varToken $line $pos] + while { [string compare $token END] != 0 } { +#-------- check for mapped values first + if { [info exists tasmap($token)] == 1 } { + set val [tasSplit [eval $tasmap($token)]] + clientput [format " %s = %s" $token $val] + } else { +#------ simple variables go here + set val [tasSplit [$token] ] + clientput [format " %s = %s" $token $val] + } + set token [varToken $line $pos] + } +} + +#------------------------------------------------------------------------- +# se(t) variables + +proc se args { +#------- is it the only command line case? + if {[llength $args] > 0 } { + set line [join $args] + return [varSet $line] + } else { +#------- we are prompting + while { 1== 1} { +#-------- check for error + set line [sicsprompt "SET> "] + if { [string first ERROR $line] >= 0} { + error $line + } +#-------- check for end + if { [string length $line] < 4 } { + return + } +#------- OK, evaluate the line + set ret [catch {varSet $line} msg] + if {$ret != 0} { + clientput $msg + } + } + } +} + +#--------------------------------------------------------------------------- +# lz list limits and zeros + +proc lz args { + global tasmap + global tasmot +#--------- do header + append outPut [format " Limits & Zeros\n"] + append outPut [format " ===============\n"] + append outPut [format " Lo(hard) Lo(soft) Posn%s" \ + " Hi(soft) Hi(hard) Zero\n"] +#--------- do motors + set count 0 + foreach mot $tasmot { + set zero [tasSplit [madZero $mot]] + set loh [tasSplit [eval $mot hardlowerlim]] + set loh [expr $loh + $zero] + set los [tasSplit [eval $mot softlowerlim]] + set pos [tasSplit [eval $mot]] + set his [tasSplit [eval $mot softupperlim]] + set hih [tasSplit [eval $mot hardupperlim]] + set hih [expr $hih + $zero] + append outPut [format "%-10s %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f\n" \ + $mot $loh $los $pos $his $hih $zero] + incr count + if { $count == 6 } { + append outPut " \n" + } + } + return $outPut +} + +#-------------------------------------------------------------------------- +# lm list machine parameters + +proc lm args { + append output " Machine Parameters\n" + append output " ==================\n" +#----------- first line + append output [format " DM DA SM SS%s\n" \ + " SA ALF1 ALF2 ALF3 ALF4"] + set v1 [tasSplit [eval DM]] + set v2 [tasSplit [eval DA]] + set v3 [tasSplit [eval SM]] + set v4 [tasSplit [eval SS]] + set v5 [tasSplit [eval SA]] + set v6 [tasSplit [eval ALF1]] + set v7 [tasSplit [eval ALF2]] + set v8 [tasSplit [eval ALF3]] + set v9 [tasSplit [eval ALF4]] + append output [format \ + " %8.4f %8.4f %9d %9d %9d %8.3f %8.3f %8.3f %8.3f\n"\ + $v1 $v2 $v3 $v4 $v5 $v6 $v7 $v8 $v9] +#--------- second line + append output [format " BET1 BET2 BET3 BET4%s\n" \ + " ETAM ETAA FX NP TI"] + set v1 [tasSplit [eval BET1]] + set v2 [tasSplit [eval BET2]] + set v3 [tasSplit [eval BET3]] + set v4 [tasSplit [eval BET4]] + set v5 [tasSplit [eval ETAM]] + set v6 [tasSplit [eval ETAA]] + set v7 [tasSplit [eval FX]] + set v8 [tasSplit [eval NP]] + set v9 [tasSplit [eval TI]] + append output [format \ + " %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %9f %9f %8.0f\n"\ + $v1 $v2 $v3 $v4 $v5 $v6 $v7 $v8 $v9] +#---------- third line + append output [format " MN IF1V IF2H HELM\n"] + set v1 [tasSplit [eval MN]] + set v2 [tasSplit [eval IF1V]] + set v3 [tasSplit [eval IF2H]] + set v4 [tasSplit [eval HELM]] + append output [format \ + " %8.0f %8.4f %8.4f %8.4f\n"\ + $v1 $v2 $v3 $v4] + return $output +} + +#--------------------------------------------------------------------------- +# ls list sample parameters +proc ls args { + append output " Sample Parameters\n" + append output " =================\n" +#----------- first line + append output [format " AS BS CS AA%s\n" \ + " BB CC ETAS"] + set v1 [tasSplit [eval AS]] + set v2 [tasSplit [eval BS]] + set v3 [tasSplit [eval CS]] + set v4 [tasSplit [eval AA]] + set v5 [tasSplit [eval BB]] + set v6 [tasSplit [eval CC]] + set v7 [tasSplit [eval ETAS]] + append output [format \ + " %8.4f %8.4f %8.4f %8.3f %8.3f %8.3f %8.3f\n"\ + $v1 $v2 $v3 $v4 $v5 $v6 $v7] +#--------- second line + append output [format " AX AY AZ BX%s\n" \ + " BY BZ"] + set v1 [tasSplit [eval AX]] + set v2 [tasSplit [eval AY]] + set v3 [tasSplit [eval AZ]] + set v4 [tasSplit [eval BX]] + set v5 [tasSplit [eval BY]] + set v6 [tasSplit [eval BZ]] + append output [format \ + " %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f\n"\ + $v1 $v2 $v3 $v4 $v5 $v6] + + return $output +} + + + + + + diff --git a/tasinit.c b/tasinit.c index 4efb83f9..b6f8df66 100644 --- a/tasinit.c +++ b/tasinit.c @@ -242,8 +242,6 @@ int TASFactory(SConnection *pCon, SicsInterp *pSics, void *pData, SCWrite(pCon,pBueffel,eError); iError++; } - sprintf(pBueffel,"Initialised var %d", iPtr); - SCWrite(pCon,pBueffel,eError); iPtr++; } if(iError != 0)