- Added polarisation support for TAS
This commit is contained in:
7
amor.dic
7
amor.dic
@ -13,7 +13,7 @@
|
||||
# these things
|
||||
timebin=512
|
||||
detxsize=255
|
||||
detysize=255
|
||||
detysize=128
|
||||
scanlength = 10
|
||||
chunk =
|
||||
#---------- NXentry level
|
||||
@ -180,9 +180,12 @@ detbase=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS \
|
||||
dettime=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS time_binning \
|
||||
-type DFNT_FLOAT32 -rank 1 -dim {$(timebin)} -attr {axis,3} \
|
||||
-attr {units,ms}
|
||||
#spinup=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS spinup \
|
||||
# -type DFNT_INT32 -rank 3 -dim {$(detxsize),$(detysize),$(timebin)} \
|
||||
# -LZW $(chunk) -attr {signal,1}
|
||||
spinup=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS spinup \
|
||||
-type DFNT_INT32 -rank 3 -dim {$(detxsize),$(detysize),$(timebin)} \
|
||||
-LZW $(chunk) -attr {signal,1}
|
||||
$(chunk) -attr {signal,1}
|
||||
detchunk=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS \
|
||||
chunksize -type DFNT_INT32 -rank 1 -dim {3}
|
||||
spinup2d=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS spinup \
|
||||
|
16
amortest.tcl
16
amortest.tcl
@ -185,18 +185,18 @@ Motor COX SIM -100. 100. .1 2. # counter x
|
||||
ClientPut "Motors initialized"
|
||||
|
||||
#======================== histogram memory
|
||||
#MakeHM hm SinqHM
|
||||
MakeHM hm SIM
|
||||
MakeHM hm SinqHM
|
||||
#MakeHM hm SIM
|
||||
hm configure HistMode PSD
|
||||
hm configure OverFlowMode Ceil
|
||||
hm configure Rank 1
|
||||
hm configure dim0 256
|
||||
hm configure dim1 256
|
||||
hm configure xfac 10
|
||||
hm configure yfac 10
|
||||
hm configure dim1 128
|
||||
hm configure xfac 16
|
||||
hm configure yfac 16
|
||||
hm configure xoff 128
|
||||
hm configure yoff 128
|
||||
hm configure Length 65536
|
||||
hm configure yoff 64
|
||||
hm configure Length 32768
|
||||
hm configure BinWidth 4
|
||||
hm preset 100.
|
||||
hm CountMode Timer
|
||||
@ -204,7 +204,7 @@ hm configure HMComputer psds03.psi.ch
|
||||
hm configure HMPort 2400
|
||||
hm configure Counter counter
|
||||
hm configure init 0
|
||||
hm genbin 0. 33 1024
|
||||
hm genbin 0. 33 512
|
||||
hm init
|
||||
|
||||
ClientPut "Histogram Memory Initialized"
|
||||
|
2
danu.dat
2
danu.dat
@ -1,3 +1,3 @@
|
||||
174
|
||||
189
|
||||
NEVER, EVER modify or delete this file
|
||||
You'll risk eternal damnation and a reincarnation as a cockroach!|n
|
@ -246,7 +246,7 @@
|
||||
int StartMotor(pExeList self, SicsInterp *pSics, SConnection *pCon,
|
||||
char *name, float fVal)
|
||||
{
|
||||
pMotor pMot = NULL;
|
||||
pDummy pMot = NULL;
|
||||
CommandList *pCom = NULL;
|
||||
char pBueffel[256];
|
||||
|
||||
@ -261,7 +261,7 @@
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
pMot = (pMotor)pCom->pData;
|
||||
pMot = (pDummy)pCom->pData;
|
||||
if(!pMot)
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: %s is no motor ",name);
|
||||
|
@ -1,47 +1,74 @@
|
||||
a5l.length 80.000000
|
||||
flightpathlength 0.000000
|
||||
flightpathlength setAccess 1
|
||||
flightpath 0.000000
|
||||
flightpath setAccess 1
|
||||
delay 2500.000000
|
||||
delay setAccess 1
|
||||
hm CountMode timer
|
||||
hm preset 100.000000
|
||||
hm genbin 120.000000 35.000000 512
|
||||
hm init
|
||||
datafile focus-1001848.hdf
|
||||
datafile setAccess 3
|
||||
yfactor 1.420000
|
||||
yfactor setAccess 1
|
||||
xfactor 0.715000
|
||||
xfactor setAccess 1
|
||||
ps.listfile peaksearch.dat
|
||||
ps.listfile setAccess 2
|
||||
ps.scansteps 24
|
||||
ps.scansteps setAccess 2
|
||||
ps.scanpreset 1000000.000000
|
||||
ps.scanpreset setAccess 2
|
||||
ps.preset 1000.000000
|
||||
ps.preset setAccess 2
|
||||
ps.countmode monitor
|
||||
ps.countmode setAccess 2
|
||||
ps.cogcontour 0.200000
|
||||
ps.cogcontour setAccess 2
|
||||
ps.cogwindow 60
|
||||
ps.cogwindow setAccess 2
|
||||
ps.window 7
|
||||
ps.window setAccess 2
|
||||
ps.steepness 3
|
||||
ps.steepness setAccess 2
|
||||
ps.threshold 30
|
||||
ps.threshold setAccess 2
|
||||
ps.sttstep 3.000000
|
||||
ps.sttstep setAccess 2
|
||||
ps.sttend 70.000000
|
||||
ps.sttend setAccess 2
|
||||
ps.sttstart 5.000000
|
||||
ps.sttstart setAccess 2
|
||||
ps.omstep 3.000000
|
||||
ps.omstep setAccess 2
|
||||
ps.omend 30.000000
|
||||
ps.omend setAccess 2
|
||||
ps.omstart 0.000000
|
||||
ps.omstart setAccess 2
|
||||
ps.chistep 12.000000
|
||||
ps.chistep setAccess 2
|
||||
ps.chiend 180.000000
|
||||
ps.chiend setAccess 2
|
||||
ps.chistart 0.000000
|
||||
ps.chistart setAccess 2
|
||||
ps.phistep 3.000000
|
||||
ps.phistep setAccess 2
|
||||
ps.phiend 180.000000
|
||||
ps.phiend setAccess 2
|
||||
ps.phistart 0.000000
|
||||
ps.phistart setAccess 2
|
||||
hm3 CountMode timer
|
||||
hm3 preset 10.000000
|
||||
hm2 CountMode monitor
|
||||
hm2 preset 2.000000
|
||||
hm1 CountMode monitor
|
||||
hm1 preset 2.000000
|
||||
dbfile UNKNOWN
|
||||
dbfile setAccess 2
|
||||
# Motor th
|
||||
th SoftZero 0.000000
|
||||
th SoftLowerLim 4.000000
|
||||
th SoftUpperLim 113.000000
|
||||
th Fixed -1.000000
|
||||
th sign 1.000000
|
||||
th InterruptMode 0.000000
|
||||
th AccessCode 2.000000
|
||||
#Crystallographic Settings
|
||||
hkl lambda 1.179000
|
||||
hkl setub 0.004076 -0.080526 -0.018163 -0.008113 -0.023908 0.061299 -0.161515 -0.000831 -0.003537
|
||||
det3dist 300.000000
|
||||
det3dist setAccess 1
|
||||
hkl setub -0.017880 -0.074923 0.028280 -0.007008 -0.036800 -0.057747 0.160912 -0.009928 0.000627
|
||||
detdist3 0.000000
|
||||
detdist3 setAccess 1
|
||||
det3zeroy 128.000000
|
||||
det3zeroy setAccess 1
|
||||
det3zerox 128.000000
|
||||
det3zerox setAccess 1
|
||||
det2dist 300.000000
|
||||
det2dist setAccess 1
|
||||
detdist2 0.000000
|
||||
detdist2 setAccess 1
|
||||
det2zeroy 128.000000
|
||||
det2zeroy setAccess 1
|
||||
det2zerox 128.000000
|
||||
det2zerox setAccess 1
|
||||
det1dist 300.000000
|
||||
det1dist setAccess 1
|
||||
detdist1 0.000000
|
||||
detdist1 setAccess 1
|
||||
det1zeroy 128.000000
|
||||
det1zeroy setAccess 1
|
||||
det1zerox 128.000000
|
||||
@ -68,7 +95,7 @@ stt InterruptMode 0.000000
|
||||
stt AccessCode 2.000000
|
||||
# Motor ch
|
||||
ch SoftZero 0.000000
|
||||
ch SoftLowerLim 80.000000
|
||||
ch SoftLowerLim 0.000000
|
||||
ch SoftUpperLim 212.000000
|
||||
ch Fixed -1.000000
|
||||
ch sign 1.000000
|
||||
@ -79,7 +106,7 @@ ph SoftZero 0.000000
|
||||
ph SoftLowerLim -360.000000
|
||||
ph SoftUpperLim 360.000000
|
||||
ph Fixed -1.000000
|
||||
ph sign -1.000000
|
||||
ph sign 1.000000
|
||||
ph InterruptMode 0.000000
|
||||
ph AccessCode 2.000000
|
||||
# Motor dg3
|
||||
@ -119,12 +146,12 @@ phi SoftZero 0.000000
|
||||
phi SoftLowerLim -360.000000
|
||||
phi SoftUpperLim 360.000000
|
||||
phi Fixed -1.000000
|
||||
phi sign -1.000000
|
||||
phi sign 1.000000
|
||||
phi InterruptMode 0.000000
|
||||
phi AccessCode 2.000000
|
||||
# Motor chi
|
||||
chi SoftZero 0.000000
|
||||
chi SoftLowerLim 80.000000
|
||||
chi SoftLowerLim 0.000000
|
||||
chi SoftUpperLim 212.000000
|
||||
chi Fixed -1.000000
|
||||
chi sign 1.000000
|
||||
@ -148,8 +175,6 @@ twotheta InterruptMode 0.000000
|
||||
twotheta AccessCode 2.000000
|
||||
lastscancommand cscan a4 10. .1 10 5
|
||||
lastscancommand setAccess 2
|
||||
banana CountMode timer
|
||||
banana preset 100.000000
|
||||
sample_mur 0.000000
|
||||
sample_mur setAccess 2
|
||||
email UNKNOWN
|
||||
|
10
simev.c
10
simev.c
@ -76,6 +76,10 @@
|
||||
pMe = (pSimST)self->pPrivate;
|
||||
assert(pMe);
|
||||
|
||||
if(pMe->fFailure < .0){
|
||||
return 1;
|
||||
}
|
||||
|
||||
if((int)time(&tD) > pMe->tFinish)
|
||||
{
|
||||
return 1;
|
||||
@ -101,8 +105,12 @@
|
||||
|
||||
if(RunComplete(self))
|
||||
{
|
||||
if(pMe->fFailure < .0){
|
||||
*fPos = pMe->fTarget;
|
||||
} else {
|
||||
*fPos = pMe->fTarget + SimRandom();
|
||||
}
|
||||
}
|
||||
else /* simulate a mispositioned motor */
|
||||
{
|
||||
*fPos = pMe->fTarget - 10.;
|
||||
@ -126,6 +134,7 @@
|
||||
if(fDiff < .0) fDiff = -fDiff;
|
||||
pMe->tFinish = (int)time(&tD) + (int)(fDiff/pMe->fSpeed);
|
||||
|
||||
pMe->fTarget = fVal;
|
||||
|
||||
/* in a fifth the failures, simply die, else simply do not find pos */
|
||||
if(SimRandom() < (pMe->fFailure/5))
|
||||
@ -133,7 +142,6 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
pMe->fTarget = fVal;
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
@ -151,7 +151,7 @@
|
||||
|
||||
Dbg_mask = 0;
|
||||
Dbg_lev0 = 0;
|
||||
Dbg_lev1 = 0;
|
||||
Dbg_lev1 = 1;
|
||||
Dbg_lev2 = 0;
|
||||
Dbg_lev3 = 0;
|
||||
Cfgn_done = 0; /* Force a configuration before we can do anything. */
|
||||
|
36
tas.h
36
tas.h
@ -44,6 +44,7 @@
|
||||
#define QL 31
|
||||
#define EN 32
|
||||
#define QM 33
|
||||
|
||||
#define HX 34
|
||||
#define HY 35
|
||||
#define HZ 36
|
||||
@ -116,12 +117,36 @@
|
||||
#define TQL 100
|
||||
#define TEN 101
|
||||
#define TQM 102
|
||||
#define HX 34
|
||||
#define HY 35
|
||||
#define HZ 36
|
||||
#define THX 103
|
||||
#define THY 104
|
||||
#define THZ 105
|
||||
|
||||
#define TI1 106
|
||||
#define TI2 107
|
||||
#define TI3 108
|
||||
#define TI4 109
|
||||
#define TI5 110
|
||||
#define TI6 111
|
||||
#define TI7 112
|
||||
#define TI8 113
|
||||
#define DI1 114
|
||||
#define DI2 115
|
||||
#define DI3 116
|
||||
#define DI4 117
|
||||
#define DI5 118
|
||||
#define DI6 119
|
||||
#define DI7 120
|
||||
#define DI8 121
|
||||
#define DHX 122
|
||||
#define DHY 123
|
||||
#define DHZ 124
|
||||
#define HCONV1 125
|
||||
#define HCONV2 126
|
||||
#define HCONV3 127
|
||||
#define HCONV4 128
|
||||
#define POLFIL 129
|
||||
|
||||
#define MAXPAR 103
|
||||
#define MAXPAR 130
|
||||
#define MAXADD 20
|
||||
#define MAXEVAR 10
|
||||
|
||||
@ -133,6 +158,9 @@ typedef struct {
|
||||
pCounter counter;
|
||||
pScanData pScan;
|
||||
int iPOL;
|
||||
int iIgnore; /* in order to ignore writing scan points again
|
||||
in polarisation mode;
|
||||
*/
|
||||
int addOutput[MAXADD];
|
||||
int addType[MAXADD];
|
||||
int addCount;
|
||||
|
44
tas.w
44
tas.w
@ -40,6 +40,9 @@ typedef struct {
|
||||
pCounter counter;
|
||||
pScanData pScan;
|
||||
int iPOL;
|
||||
int iIgnore; /* in order to ignore writing scan points again
|
||||
in polarisation mode;
|
||||
*/
|
||||
int addOutput[MAXADD];
|
||||
int addType[MAXADD];
|
||||
int addCount;
|
||||
@ -130,6 +133,7 @@ These are mainly the interpreter interface functions:
|
||||
#define QL 31
|
||||
#define EN 32
|
||||
#define QM 33
|
||||
|
||||
#define HX 34
|
||||
#define HY 35
|
||||
#define HZ 36
|
||||
@ -193,9 +197,47 @@ These are mainly the interpreter interface functions:
|
||||
#define LOC 91
|
||||
#define SWUNIT 92
|
||||
#define SINFO 93
|
||||
#define TEI 94
|
||||
#define TKI 95
|
||||
#define TEF 96
|
||||
#define TKF 97
|
||||
#define TQH 98
|
||||
#define TQK 99
|
||||
#define TQL 100
|
||||
#define TEN 101
|
||||
#define TQM 102
|
||||
#define THX 103
|
||||
#define THY 104
|
||||
#define THZ 105
|
||||
|
||||
#define MAXPAR 94
|
||||
#define TI1 106
|
||||
#define TI2 107
|
||||
#define TI3 108
|
||||
#define TI4 109
|
||||
#define TI5 110
|
||||
#define TI6 111
|
||||
#define TI7 112
|
||||
#define TI8 113
|
||||
#define DI1 114
|
||||
#define DI2 115
|
||||
#define DI3 116
|
||||
#define DI4 117
|
||||
#define DI5 118
|
||||
#define DI6 119
|
||||
#define DI7 120
|
||||
#define DI8 121
|
||||
#define DHX 122
|
||||
#define DHY 123
|
||||
#define DHZ 124
|
||||
#define HCONV1 125
|
||||
#define HCONV2 126
|
||||
#define HCONV3 127
|
||||
#define HCONV4 128
|
||||
#define POLFIL 129
|
||||
|
||||
#define MAXPAR 130
|
||||
#define MAXADD 20
|
||||
#define MAXEVAR 10
|
||||
|
||||
/* --------------------- data structure -------------------------------*/
|
||||
@<tasdata@>
|
||||
|
95
tascom.tcl
95
tascom.tcl
@ -5,7 +5,7 @@
|
||||
# This file contains the procedures and command definitions for this syntax
|
||||
# adaption from SICS to MAD.
|
||||
#
|
||||
# Mark Koennecke, December 2000, March 2001
|
||||
# Mark Koennecke, December 2000, March 2001, April 2002
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -36,6 +36,9 @@ if { [info exists tasinit] == 0 } {
|
||||
Publish log User
|
||||
Publish sz User
|
||||
Publish sw User
|
||||
Publish pa User
|
||||
Publish on User
|
||||
Publish off User
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
@ -988,10 +991,44 @@ proc powdersw args {
|
||||
}
|
||||
}
|
||||
}
|
||||
#----------------------------------------------------------------------
|
||||
# switch polarisation
|
||||
proc polsw args {
|
||||
if { [llength $args] > 0 } {
|
||||
switch [lindex $args 0] {
|
||||
on {
|
||||
lpa 1
|
||||
return "Polarisation mode enabled"
|
||||
}
|
||||
off {
|
||||
lpa 0
|
||||
return "Polarisation mode disabled"
|
||||
}
|
||||
flip {
|
||||
if {[tasSplit [lpa]] == 1 } {
|
||||
return [polsw off]
|
||||
} else {
|
||||
return [polsw on]
|
||||
}
|
||||
}
|
||||
default {
|
||||
error "ERROR: syntax error, only on, off, flip allowed"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if { [tasSplit [lpa]] == 1} {
|
||||
return [format " %-30s : %-5s" "Polarisation Mode" "on"]
|
||||
} else {
|
||||
return [format " %-30s : %-5s" "Polarisation Mode" "off"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# mapping switches to procedures handling them
|
||||
|
||||
set switches(powder) powdersw
|
||||
set switches(pol) polsw
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# prsw prints switches
|
||||
@ -999,7 +1036,7 @@ proc prsw args {
|
||||
global switches
|
||||
set l [array names switches]
|
||||
foreach e $l {
|
||||
append output [eval $switches($e)]
|
||||
append output [eval $switches($e)] "\n"
|
||||
}
|
||||
return $output
|
||||
}
|
||||
@ -1055,3 +1092,57 @@ proc sw args {
|
||||
clientput [prsw]
|
||||
}
|
||||
}
|
||||
#---------------------------------------------------------------------------
|
||||
# pa : set polarization analysis file
|
||||
#--------------------------------------------------------------------------
|
||||
proc pa args {
|
||||
if {[llength $args] < 1} {
|
||||
error "Usage: pa polarisation analysis file"
|
||||
}
|
||||
set fil [lindex $args 0]
|
||||
if {[string first "." $fil] < 0} {
|
||||
set fil $fil.pal
|
||||
}
|
||||
polfile $fil
|
||||
}
|
||||
#--------------------------------------------------------------------------
|
||||
# on and off for switching spin flippers
|
||||
#-------------------------------------------------------------------------
|
||||
proc checkarg args {
|
||||
if {[llength $args] < 1} {
|
||||
error "No flipper to set given"
|
||||
}
|
||||
set flipper [string trim [string tolower [lindex $args 0]]]
|
||||
if { [string compare $flipper f1] == 0 || \
|
||||
[string compare $flipper f2] == 0} {
|
||||
return $flipper
|
||||
} else {
|
||||
error [format "%s not a recognized flipper" $flipper]
|
||||
}
|
||||
}
|
||||
#------------------------------------------------------------------------
|
||||
proc on args {
|
||||
set flip [checkarg $args]
|
||||
if { [string compare $flip f1] == 0 } {
|
||||
f1 1
|
||||
set i1val [expr [tasSplit [tki]] * [tasSplit [if1h]]]
|
||||
set i2val [tasSplit [if1v]]
|
||||
return [dr i1 $i1val i2 $i2val]
|
||||
} else {
|
||||
f2 1
|
||||
set i3val [expr [tasSplit [tkf]] * [tasSplit [if2h]]]
|
||||
set i4val [tasSplit [if2v]]
|
||||
return [dr i3 $i3val i4 $i4val]
|
||||
}
|
||||
}
|
||||
#-------------------------------------------------------------------------
|
||||
proc off args {
|
||||
set flip [checkarg $args]
|
||||
if { [string compare $flip f1] == 0 } {
|
||||
f1 0
|
||||
return [dr i1 .0 i2 .0]
|
||||
} else {
|
||||
f2 0
|
||||
return [dr i3 .0 i4 .0]
|
||||
}
|
||||
}
|
||||
|
19
tasdrive.c
19
tasdrive.c
@ -13,6 +13,10 @@
|
||||
This file implements the MAD dr command for driving.
|
||||
|
||||
Mark Koennecke, November 2000
|
||||
|
||||
Polarisation support added.
|
||||
|
||||
Mark Koennecke, April 2002
|
||||
---------------------------------------------------------------------------*/
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
@ -224,7 +228,7 @@ int TASDrive(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
/*
|
||||
do output, first Q-E variables
|
||||
*/
|
||||
for(i = 0; i < 10; i++)
|
||||
for(i = 0; i < 12; i++)
|
||||
{
|
||||
if(tasMask[i])
|
||||
{
|
||||
@ -256,8 +260,19 @@ int TASDrive(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
}
|
||||
}
|
||||
/*
|
||||
missing: output for helmholtz currents
|
||||
output for magnet currents
|
||||
*/
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
if(tasTargetMask[9+i])
|
||||
{
|
||||
oldPos = readCurrent(tasMotorOrder[CURMOT+i], pCon);
|
||||
sprintf(pBueffel,"Driving %s from %f to %f",tasMotorOrder[CURMOT+i],
|
||||
oldPos, tasTargets[9+i]);
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
}
|
||||
}
|
||||
|
||||
status = TASStart(self,pCon,pSics,tasTargets,tasTargetMask);
|
||||
if(status == 0)
|
||||
{
|
||||
|
35
tasinit.c
35
tasinit.c
@ -48,6 +48,14 @@ extern char *tasMotorOrder[] = { "a1",
|
||||
"sgl",
|
||||
"sgu",
|
||||
"agl",
|
||||
"i1" ,
|
||||
"i2",
|
||||
"i3",
|
||||
"i4",
|
||||
"i5",
|
||||
"i6",
|
||||
"i7",
|
||||
"i8",
|
||||
NULL };
|
||||
/*
|
||||
In order to initialise the variable array in the TAS data structure we
|
||||
@ -159,6 +167,33 @@ extern char *tasVariableOrder[] = {
|
||||
"tql",
|
||||
"ten",
|
||||
"tqm",
|
||||
"ti1",
|
||||
"ti2",
|
||||
"ti3",
|
||||
"ti4",
|
||||
"ti5",
|
||||
"ti6",
|
||||
"ti7",
|
||||
"ti8",
|
||||
"di1",
|
||||
"di2",
|
||||
"di3",
|
||||
"di4",
|
||||
"di5",
|
||||
"di6",
|
||||
"di7",
|
||||
"di8",
|
||||
"dhx",
|
||||
"dhy",
|
||||
"dhz",
|
||||
"thx",
|
||||
"thy",
|
||||
"thz",
|
||||
"hconv1",
|
||||
"hconv2",
|
||||
"hconv3",
|
||||
"hconv4",
|
||||
"polfile",
|
||||
NULL};
|
||||
/*---------------------------------------------------------------------
|
||||
There is a special feauture in MAD where the count mode is determined
|
||||
|
80
tasscan.c
80
tasscan.c
@ -233,12 +233,29 @@ static int TASHeader(pScanData self)
|
||||
pTAS->tasPar[BY]->fVal,
|
||||
pTAS->tasPar[BZ]->fVal);
|
||||
|
||||
/*
|
||||
write currents if in polarisation mode
|
||||
*/
|
||||
if(pTAS->iPOL >= 0){
|
||||
fprintf(self->fd,"VARIA: ");
|
||||
iCount = 0;
|
||||
for(i = MAXMOT-8; i < MAXMOT;i++)
|
||||
{
|
||||
fVal = readCurrent(tasMotorOrder[i],self->pCon);
|
||||
strcpy(pWork2,tasMotorOrder[i]);
|
||||
strtoupper(pWork2);
|
||||
fprintf(self->fd,"%-8s=%8.4f, ",pWork2,fVal);
|
||||
iCount++;
|
||||
}
|
||||
fprintf(self->fd,"\n");
|
||||
}
|
||||
|
||||
/*
|
||||
write motors
|
||||
*/
|
||||
fprintf(self->fd,"VARIA: ");
|
||||
iCount = 0;
|
||||
for(i = 0; i < MAXMOT;i++)
|
||||
for(i = 0; i < MAXMOT-8;i++)
|
||||
{
|
||||
pMot = FindMotor(self->pSics, tasMotorOrder[i]);
|
||||
if(pMot)
|
||||
@ -273,7 +290,7 @@ static int TASHeader(pScanData self)
|
||||
*/
|
||||
fprintf(self->fd,"ZEROS: ");
|
||||
iCount = 0;
|
||||
for(i = 0; i < MAXMOT;i++)
|
||||
for(i = 0; i < MAXMOT-8;i++)
|
||||
{
|
||||
pMot = FindMotor(self->pSics, tasMotorOrder[i]);
|
||||
if(pMot)
|
||||
@ -338,8 +355,13 @@ static int TASHeader(pScanData self)
|
||||
build both the format and the data header line,
|
||||
start with the scan variables
|
||||
*/
|
||||
if(pTAS->iPOL >=0 ){
|
||||
strcpy(pBueffel,"FORMT: (I4,I4,");
|
||||
strcpy(pHeader," PNT PAL");
|
||||
} else {
|
||||
strcpy(pBueffel,"FORMT: (I4,1X,");
|
||||
strcpy(pHeader," PNT");
|
||||
}
|
||||
for(i = 0; i < self->iScanVar; i++)
|
||||
{
|
||||
DynarGet(self->pScanVar,i,&pPtr);
|
||||
@ -409,6 +431,14 @@ static int TASScanPoint(pScanData self, int iPoint)
|
||||
long m1, m2, m3, cnts;
|
||||
char pBueffel[1024], pWork[80];
|
||||
|
||||
/*
|
||||
after polarisation analysis, this has to be ignored as it is called
|
||||
another time from the ScanLoop
|
||||
*/
|
||||
if(pTAS->iIgnore){
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
reopen file for appending
|
||||
*/
|
||||
@ -424,7 +454,7 @@ static int TASScanPoint(pScanData self, int iPoint)
|
||||
*/
|
||||
if(pTAS->iPOL > 0)
|
||||
{
|
||||
sprintf(pBueffel,"%3d.%1d",iPoint+1,pTAS->iPOL);
|
||||
sprintf(pBueffel,"%3d %3d",iPoint+1,pTAS->iPOL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -610,9 +640,40 @@ static int TASScanDrive(pScanData self, int iPoint)
|
||||
------------------------------------------------------------------------*/
|
||||
static int RunPolScan(pScanData self, int iPoint)
|
||||
{
|
||||
SCWrite(self->pCon,"ERROR: polarized scans not yet implemented",eError);
|
||||
FILE *fd = NULL;
|
||||
char buffer[132];
|
||||
pTASdata pTAS = (pTASdata)self->pSpecial;
|
||||
|
||||
fd = fopen(pTAS->tasPar[POLFIL]->text,"r");
|
||||
if(!fd){
|
||||
SCWrite(self->pCon,"ERROR: failed to open polarisation analysis file",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
pTAS->iPOL = 0;
|
||||
while(fgets(buffer,131,fd) != NULL){
|
||||
/*
|
||||
ignore all errors here
|
||||
*/
|
||||
InterpExecute(self->pSics,self->pCon,buffer);
|
||||
strtolower(buffer);
|
||||
if(strstr(buffer,"co") != NULL){
|
||||
pTAS->iPOL++;
|
||||
self->WriteScanPoints(self,iPoint);
|
||||
}
|
||||
/*
|
||||
but allow for interrupts
|
||||
*/
|
||||
if(SCGetInterrupt(self->pCon) != eContinue){
|
||||
break;
|
||||
}
|
||||
}
|
||||
pTAS->iIgnore = 1;
|
||||
fclose(fd);
|
||||
pTAS->iPOL = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------
|
||||
TASScanCount starts the counter for a TAS scan or runs the polarization
|
||||
analysis.
|
||||
@ -624,6 +685,7 @@ static int TASScanCount(pScanData self, int iPoint)
|
||||
int status, iRet;
|
||||
Status eOld;
|
||||
|
||||
pTAS->iIgnore = 0;
|
||||
/*
|
||||
call the polarisation scan function if necessary
|
||||
*/
|
||||
@ -1291,6 +1353,7 @@ int TASScan(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
ClearScanVar(pTAS->pScan);
|
||||
pTAS->scanVar[0] = '\0';
|
||||
|
||||
|
||||
/*
|
||||
at this stage all simple variables have been set. Now we get the values
|
||||
of some important inital values which we need for entering the scan
|
||||
@ -1302,6 +1365,15 @@ int TASScan(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
pTAS->pScan->pCon = pCon;
|
||||
pTAS->pScan->pSics = pSics;
|
||||
|
||||
/*
|
||||
check for polarisation
|
||||
*/
|
||||
if(pTAS->tasPar[LPA]->iVal == 1){
|
||||
pTAS->iPOL = 1;
|
||||
} else {
|
||||
pTAS->iPOL = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
now parse the scan variables
|
||||
*/
|
||||
|
@ -217,6 +217,15 @@ VarMake QM Float User
|
||||
VarMake DQM Float User
|
||||
VarMake DT Float User
|
||||
VarMake LPA Int User
|
||||
VarMake DI1 Float User
|
||||
VarMake DI2 Float User
|
||||
VarMake DI3 Float User
|
||||
VarMake DI4 Float User
|
||||
VarMake DI5 Float User
|
||||
VarMake DI6 Float User
|
||||
VarMake DI7 Float User
|
||||
VarMake DI8 Float User
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# Curvature variables
|
||||
VarMake MRX1 Float Mugger
|
||||
|
48
tastest.tcl
48
tastest.tcl
@ -166,6 +166,10 @@ VarMake IF1V Float User
|
||||
VarMake IF2V Float User
|
||||
VarMake IF1H Float User
|
||||
VarMake IF2H Float User
|
||||
IF1V 1.0
|
||||
IF1H 1.0
|
||||
IF2V 1.0
|
||||
IF2H 1.0
|
||||
VarMake HELM Float User
|
||||
VarMake HX Float User
|
||||
VarMake HY Float User
|
||||
@ -231,6 +235,35 @@ VarMake QM Float User
|
||||
VarMake DQM Float User
|
||||
VarMake DT Float User
|
||||
VarMake LPA Int User
|
||||
|
||||
#----------- Current increments
|
||||
VarMake DI1 Float User
|
||||
VarMake DI2 Float User
|
||||
VarMake DI3 Float User
|
||||
VarMake DI4 Float User
|
||||
VarMake DI5 Float User
|
||||
VarMake DI6 Float User
|
||||
VarMake DI7 Float User
|
||||
VarMake DI8 Float User
|
||||
VarMake DHX Float User
|
||||
VarMake DHY Float User
|
||||
VarMake DHZ Float User
|
||||
|
||||
|
||||
#----------- Current Targets
|
||||
VarMake TI1 Float User
|
||||
VarMake TI2 Float User
|
||||
VarMake TI3 Float User
|
||||
VarMake TI4 Float User
|
||||
VarMake TI5 Float User
|
||||
VarMake TI6 Float User
|
||||
VarMake TI7 Float User
|
||||
VarMake TI8 Float User
|
||||
VarMake THX Float User
|
||||
VarMake THY Float User
|
||||
VarMake THZ Float User
|
||||
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# Curvature variables
|
||||
VarMake MRX1 Float Mugger
|
||||
@ -238,6 +271,21 @@ VarMake MRX2 Float Mugger
|
||||
VarMake ARX1 Float Mugger
|
||||
VarMake ARX2 Float Mugger
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Conversion factors from gauss to ampere for Helmholtz calculations
|
||||
VarMake HCONV1 Float Mugger
|
||||
VarMake HCONV2 Float Mugger
|
||||
VarMake HCONV3 Float Mugger
|
||||
VarMake HCONV4 Float Mugger
|
||||
HCONV1 1.0
|
||||
HCONV2 1.0
|
||||
HCONV3 1.0
|
||||
HCONV4 1.0
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# Polarisation file
|
||||
VarMake polfile Text User
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Datafile generation variables
|
||||
VarMake SicsDataPath Text Mugger
|
||||
|
9
tasu.h
9
tasu.h
@ -15,7 +15,9 @@ extern char *tasMotorOrder[];
|
||||
extern char *tasVariableOrder[];
|
||||
|
||||
/* maximum number of motors in the list */
|
||||
#define MAXMOT 19
|
||||
#define MAXMOT 27
|
||||
/* offset to the currents, if available */
|
||||
#define CURMOT (MAXMOT - 8)
|
||||
|
||||
|
||||
/*
|
||||
@ -28,10 +30,15 @@ extern char *tasVariableOrder[];
|
||||
#define ETARGET 94
|
||||
|
||||
int isTASMotor(char *val);
|
||||
int isTASCurrent(char *val);
|
||||
int isTASVar(char *val);
|
||||
int isTASEnergy(char *val);
|
||||
void prepare2Parse(char *line);
|
||||
int tasNumeric(char *pText);
|
||||
float readCurrent(char *val, SConnection *pCon);
|
||||
void startCurrent(char *val, SConnection *pCon, float fVal);
|
||||
void readConversionFactors(pTASdata self,float convH[4]);
|
||||
|
||||
int TASCalc(pTASdata self, SConnection *pCon,
|
||||
unsigned char tasMask[10],
|
||||
float motorTargets[20],
|
||||
|
121
tasutil.c
121
tasutil.c
@ -15,6 +15,10 @@
|
||||
TAS settings..
|
||||
|
||||
Mark Koennecke, November 2000
|
||||
|
||||
Polarisation support added.
|
||||
|
||||
Mark Koennecke, April 2002
|
||||
---------------------------------------------------------------------------*/
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
@ -50,6 +54,21 @@ int isTASMotor(char *val)
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/*------------------------------------------------------------------------
|
||||
return number if val is a current variable, else -1
|
||||
-----------------------------------------------------------------------*/
|
||||
int isTASCurrent(char *val){
|
||||
int test;
|
||||
test = isTASMotor(val);
|
||||
if(test < 0){
|
||||
return test;
|
||||
}
|
||||
if(test > 18){
|
||||
return test;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------------------------------
|
||||
isTASVar finds out if the given string is a TAS variable and returns its
|
||||
index if this is the case. Else -1 will be returned.
|
||||
@ -333,9 +352,9 @@ int TASCalc(pTASdata self, SConnection *pCon,
|
||||
qhkl[1] = (real)self->tasPar[TQK]->fVal;
|
||||
qhkl[2] = (real)self->tasPar[TQL]->fVal;
|
||||
en = (real)self->tasPar[TEN]->fVal;
|
||||
hx = (real)self->tasPar[HX]->fVal;
|
||||
hy = (real)self->tasPar[HY]->fVal;
|
||||
hz = (real)self->tasPar[HZ]->fVal;
|
||||
hx = (real)self->tasPar[THX]->fVal;
|
||||
hy = (real)self->tasPar[THY]->fVal;
|
||||
hz = (real)self->tasPar[THZ]->fVal;
|
||||
f = (real)2.072; /* energy unit meV */
|
||||
if1 = (integer)self->tasPar[F1]->iVal;
|
||||
if2 = (integer)self->tasPar[F2]->iVal;
|
||||
@ -343,8 +362,17 @@ int TASCalc(pTASdata self, SConnection *pCon,
|
||||
{
|
||||
ldk[i] = (logical)tasMask[i];
|
||||
}
|
||||
ldh = (logical)tasMask[8];
|
||||
ldf = (logical)tasMask[9];
|
||||
if(if1 > 0 || if2 > 0){
|
||||
ldf = 1;
|
||||
} else {
|
||||
ldf = 0;
|
||||
}
|
||||
if(tasMask[9] || tasMask[10] || tasMask[11] ) {
|
||||
ldh = 1;
|
||||
} else {
|
||||
ldh = 0;
|
||||
}
|
||||
|
||||
if(self->tasPar[LPA]->iVal > 0)
|
||||
lpa = (logical)1;
|
||||
else
|
||||
@ -364,15 +392,15 @@ int TASCalc(pTASdata self, SConnection *pCon,
|
||||
isa = (integer)self->tasPar[SA]->iVal;
|
||||
|
||||
/*
|
||||
initialize the helmholts currents. This needs work when
|
||||
polarisation analysis is really supported.
|
||||
initialize the magnet currents.
|
||||
*/
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
helmconv[i] = .0;
|
||||
currents[i] = .0;
|
||||
currents[i+4] = .0;
|
||||
currents[i] = readCurrent(tasMotorOrder[CURMOT+i],pCon);
|
||||
currents[i+4] = readCurrent(tasMotorOrder[CURMOT + i + 4],pCon);
|
||||
}
|
||||
readConversionFactors(self,helmconv);
|
||||
|
||||
/*
|
||||
initalise the motorMasks to 0.
|
||||
@ -412,6 +440,9 @@ int TASCalc(pTASdata self, SConnection *pCon,
|
||||
motorTargets[i] = angles[i];
|
||||
motorMask[i] = ldra[i];
|
||||
}
|
||||
/*
|
||||
these additional motors are the curvature motors
|
||||
*/
|
||||
motorMask[6] = l_RM;
|
||||
motorTargets[6] = tRM;
|
||||
motorMask[8] = l_RA;
|
||||
@ -420,10 +451,19 @@ int TASCalc(pTASdata self, SConnection *pCon,
|
||||
{
|
||||
motorTargets[9+i] = currents[i];
|
||||
}
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
motorTargets[17+i] = helmconv[i];
|
||||
if(ldh){
|
||||
/* currents must be driven */
|
||||
for( i = 0; i < 4; i++){
|
||||
motorMask[13+i] = 1;
|
||||
}
|
||||
}
|
||||
if(ldf){
|
||||
/* currents must be driven */
|
||||
for( i = 0; i < 4; i++){
|
||||
motorMask[9+i] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
self->tasPar[TEI]->fVal = (float)ei;
|
||||
self->tasPar[TKI]->fVal = (float)aki;
|
||||
self->tasPar[TEF]->fVal = (float)ef;
|
||||
@ -485,9 +525,13 @@ int TASStart(pTASdata self, SConnection *pCon, SicsInterp *pSics,
|
||||
}
|
||||
|
||||
/*
|
||||
missing: set the magnet currents. In order to do this, I need more
|
||||
info about the magnets involved and how to address them.
|
||||
start magnet currents.
|
||||
*/
|
||||
for(i = 0; i < 8; i++){
|
||||
if(motorMask[9+i] == 1){
|
||||
startCurrent(tasMotorOrder[CURMOT+i],pCon,motorTargets[9+i]);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -577,15 +621,15 @@ int TASUpdate(pTASdata self, SConnection *pCon)
|
||||
}
|
||||
|
||||
/*
|
||||
initialize magnet things to harmless. TODO: update to read properly
|
||||
when installed.
|
||||
read magnet currents.
|
||||
*/
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
helmCurrent[i] = .0;
|
||||
helmCurrent[4+i] = .0;
|
||||
convH[i] = .0;
|
||||
helmCurrent[i] = readCurrent(tasMotorOrder[CURMOT+i],pCon);
|
||||
helmCurrent[4+i] = readCurrent(tasMotorOrder[CURMOT+i+4],pCon);
|
||||
}
|
||||
readConversionFactors(self,convH);
|
||||
|
||||
/*
|
||||
collect all the other machine parameters needed for a call to
|
||||
@ -650,6 +694,9 @@ int TASUpdate(pTASdata self, SConnection *pCon)
|
||||
self->tasPar[HY]->fVal = hy;
|
||||
self->tasPar[HZ]->fVal = hz;
|
||||
self->tasPar[QM]->fVal = qm;
|
||||
self->tasPar[HX]->fVal = hx;
|
||||
self->tasPar[HY]->fVal = hy;
|
||||
self->tasPar[HZ]->fVal = hz;
|
||||
|
||||
/*
|
||||
now check the analyzer or monochromator angles
|
||||
@ -678,7 +725,45 @@ int TASUpdate(pTASdata self, SConnection *pCon)
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*-----------------------------------------------------------------------
|
||||
readCurrent tries to read the value of one of the magnet currents.
|
||||
All errors are ignored because most of the time currents will not be
|
||||
present in the system.
|
||||
-----------------------------------------------------------------------*/
|
||||
float readCurrent(char *val, SConnection *pCon){
|
||||
pIDrivable pDriv;
|
||||
CommandList *pCom;
|
||||
pDummy pDum;
|
||||
|
||||
pCom = FindCommand(pServ->pSics,val);
|
||||
if(pCom != NULL){
|
||||
pDriv = GetDrivableInterface(pCom->pData);
|
||||
if(pDriv != NULL){
|
||||
return pDriv->GetValue(pCom->pData,pCon);
|
||||
}
|
||||
}
|
||||
return .0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------
|
||||
startCurrent starts driving a current to a new value
|
||||
All errors are ignored because most of the time currents will not be
|
||||
present in the system.
|
||||
-----------------------------------------------------------------------*/
|
||||
void startCurrent(char *val, SConnection *pCon, float fVal){
|
||||
StartMotor(pServ->pExecutor,pServ->pSics,pCon,
|
||||
val,fVal);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
readConversionFactors updates the array given as a parameter with the
|
||||
values of the Gauss->Ampere conversion factors
|
||||
-------------------------------------------------------------------------*/
|
||||
void readConversionFactors(pTASdata self,float convH[4]){
|
||||
convH[0] = self->tasPar[HCONV1]->fVal;
|
||||
convH[1] = self->tasPar[HCONV2]->fVal;
|
||||
convH[2] = self->tasPar[HCONV3]->fVal;
|
||||
convH[3] = self->tasPar[HCONV4]->fVal;
|
||||
}
|
||||
|
Reference in New Issue
Block a user