diff --git a/Makefile b/Makefile index 3757225c..566dff71 100644 --- a/Makefile +++ b/Makefile @@ -9,9 +9,9 @@ #------- comment or uncomment this if a fortified version is required. # Note: A -DFORTIFY needs to be added to the CFLAGS as well. # -FORTIFYOBJ = fortify.o strdup.o +#FORTIFYOBJ = fortify.o strdup.o #---- -#FORTIFYOBJ = +FORTIFYOBJ = #--------------------------------------------------------------------------- #========================================================================== @@ -76,14 +76,14 @@ BINTARGET = bin HDFROOT=/data/lnslib CC=cc EXTRA= -#CFLAGS = -I$(HDFROOT)/include -Ihardsup -DHDF4 -DHDF5 -I. -std1 \ -# -g -warnprotos -c -CFLAGS = -I$(HDFROOT)/include -DFORTIFY -DHDF4 -DHDF5 -Ihardsup -g \ - -std1 -warnprotos -c +CFLAGS = -I$(HDFROOT)/include -Ihardsup -DHDF4 -DHDF5 -I. -std1 \ + -check_bounds -g -warnprotos -c +#CFLAGS = -I$(HDFROOT)/include -DFORTIFY -DHDF4 -DHDF5 -Ihardsup -g \ +# -std1 -warnprotos -c LIBS = -L$(HDFROOT)/lib -Lhardsup -lhlib -Lmatrix -lmatrix -Ltecs \ -ltecsl -ltcl8.0 -lfor $(HDFROOT)/lib/libhdf5.a \ - $(HDFROOT)/lib/libmfhdf.a $(HDFROOT)/lib/libdf.a \ - $(HDFROOT)/lib/libjpeg.a -lz -lm -ll -lc + $(HDFROOT)/lib/libLNSmfhdf.a $(HDFROOT)/lib/libLNSdf.a \ + $(HDFROOT)/lib/libLNSjpeg.a -lLNSz -lm -ll -lc #------- for cygnus #HDFROOT=../HDF411 diff --git a/SCinter.c b/SCinter.c index 9308bd3f..2fab2c72 100644 --- a/SCinter.c +++ b/SCinter.c @@ -378,7 +378,7 @@ extern char *SkipSpace(char *pPtr); CommandList *pTemp; Tcl_Interp *pTcl = NULL; int i; - + assert(self); self->iDeleting = 1; @@ -392,6 +392,7 @@ extern char *SkipSpace(char *pPtr); } if(pCurrent->pName) { + printf("Deleting %s\n",pCurrent->pName); free(pCurrent->pName); } pTemp = pCurrent->pNext; diff --git a/amor.dic b/amor.dic index 7f31282e..2867117f 100644 --- a/amor.dic +++ b/amor.dic @@ -180,12 +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)} \ - $(chunk) -attr {signal,1} + -LZW $(chunk) -attr {signal,1} +#spinup=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS spinup \ +# -type DFNT_INT32 -rank 3 -dim {$(detxsize),$(detysize),$(timebin)} \ +# $(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 \ diff --git a/amortest.tcl b/amortest.tcl index 6905ff7c..49cbc0de 100644 --- a/amortest.tcl +++ b/amortest.tcl @@ -190,11 +190,11 @@ MakeHM hm SIM hm configure OverFlowMode Ceil hm configure HistMode PSD hm configure Rank 2 -hm configure dim0 256 +hm configure dim0 128 hm configure dim1 256 hm configure xfac 10 hm configure yfac 10 -hm configure xoff 128 +hm configure xoff 64 hm configure yoff 128 hm configure BinWidth 4 hm preset 100. diff --git a/danu.dat b/danu.dat index 0636addb..37e17219 100644 --- a/danu.dat +++ b/danu.dat @@ -1,3 +1,3 @@ - 257 + 275 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/hardsup/Makefile b/hardsup/Makefile index 887d6a69..018b381c 100644 --- a/hardsup/Makefile +++ b/hardsup/Makefile @@ -11,15 +11,15 @@ OBJ= el734_utility.o asynsrv_utility.o stredit.o \ makeprint.o StrMatch.o #---------- for Redhat linux -CC= gcc -CFLAGS= -I$SINQDIR/linux/include -I. -I../ -DLINUX -g -c +#CC= gcc +#CFLAGS= -I$SINQDIR/linux/include -I. -I../ -DLINUX -g -c #------------ for DigitalUnix -#CC=cc -#CFLAGS= -I. -I../ -std1 -g -c +CC=cc +CFLAGS= -I. -I../ -std1 -g -c #CFLAGS= -I/data/koenneck/include -I. -I../ -std1 -g -c #------------ for DigitalUnix with Fortify -## CC=cc -## CFLAGS= -DFORTIFY -I. -I../ -std1 -g -c +#CC=cc +#CFLAGS= -DFORTIFY -I. -I../ -std1 -g -c #------------ for CYGNUS toolchain on Win32 ## CC=gcc diff --git a/hardsup/el755_utility.c b/hardsup/el755_utility.c index 30ed26d1..57cb0212 100644 --- a/hardsup/el755_utility.c +++ b/hardsup/el755_utility.c @@ -685,7 +685,7 @@ float *ist) { int iret; - char cmnd[16]; + char cmnd[32]; struct EL755info *info_ptr; /*---------------------------------------------- */ @@ -1310,7 +1310,7 @@ int i, iret; float my_soll, my_ist; - char cmnd[16], cmnd0[16], buff[132], buff1[132]; + char cmnd[32], cmnd0[32], buff[132], buff1[132]; struct EL755info *info_ptr; /*---------------------------------------------- */ diff --git a/hardsup/makefile_alpha b/hardsup/makefile_alpha index b082b911..7cd80b92 100644 --- a/hardsup/makefile_alpha +++ b/hardsup/makefile_alpha @@ -6,7 +6,7 @@ # Markus Zolliker, March 2003 #-------------------------------------------------------------------------- # the following line only for fortified version -DFORTIFY=-DFORTIFY +#DFORTIFY=-DFORTIFY #========================================================================== CC = cc diff --git a/histsim.c b/histsim.c index 5acacba1..c2846244 100644 --- a/histsim.c +++ b/histsim.c @@ -180,14 +180,14 @@ #else if(iSet == 1) { - for(ii = iStart; ii < iStart + iEnd; ii++) + for(ii = iStart; ii < iEnd; ii++) { lData[ii-iStart] = iSetVal; } } else { - for(ii = iStart; ii < iStart + iEnd; ii++) + for(ii = iStart; ii < iEnd; ii++) { lData[ii-iStart] = random(); } diff --git a/hmdata.c b/hmdata.c index a6089a48..89683bd6 100644 --- a/hmdata.c +++ b/hmdata.c @@ -92,6 +92,15 @@ int configureHMdata(pHMdata self, pStringDict pOpt, } else { self->updateIntervall = (int)rint(fVal); } + + /* + invalidate buffer + */ + if(self->localBuffer != NULL){ + free(self->localBuffer); + self->localBuffer = NULL; + } + /* note: remove update request in histmem.c */ diff --git a/make_gen b/make_gen index 75bfd430..bdaa8e08 100644 --- a/make_gen +++ b/make_gen @@ -28,7 +28,7 @@ SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \ hmcontrol.o userscan.o slsmagnet.o rs232controller.o lomax.o \ polterwrite.o fourlib.o motreg.o motreglist.o anticollider.o \ s_rnge.o sig_die.o gpibcontroller.o $(NIOBJ) ecb.o ecbdriv.o \ - ecbcounter.o hmdata.o tdchm.o nxscript.o A1931.o + ecbcounter.o hmdata.o tdchm.o nxscript.o A1931.o frame.o MOTOROBJ = motor.o el734driv.o simdriv.o el734dc.o pipiezo.o pimotor.o COUNTEROBJ = countdriv.o simcter.o counter.o diff --git a/makefile_alpha b/makefile_alpha index f44cda6c..9fe4012c 100644 --- a/makefile_alpha +++ b/makefile_alpha @@ -6,8 +6,8 @@ # Markus Zolliker, March 2003 #========================================================================== # the following lines only for fortified version -DFORTIFY=-DFORTIFY -FORTIFYOBJ=strdup.o fortify.o +#DFORTIFY=-DFORTIFY +#FORTIFYOBJ=strdup.o fortify.o #========================================================================== # assign if the National Instrument GPIB driver is available #NI= -DHAVENI diff --git a/mumo.c b/mumo.c index 3615aa0f..f5d9cb93 100644 --- a/mumo.c +++ b/mumo.c @@ -190,6 +190,7 @@ static int SaveMumo(void *pData, char *name, FILE *fd) #define LIST 13 #define DEFPOS 14 #define RECOVERNAMPOS 15 +#define GETPOS 16 /*-------------------------------------------------------------------------*/ static int GetNextToken(psParser self, pMulMot pDings) { @@ -317,6 +318,11 @@ static int SaveMumo(void *pData, char *name, FILE *fd) self->iCurrentToken = DEFPOS; return DEFPOS; } + else if(strcmp(self->Token,"getpos") ==0) + { + self->iCurrentToken = GETPOS; + return GETPOS; + } else if(strcmp(self->Token,"recovernampos") ==0) { self->iCurrentToken = RECOVERNAMPOS; @@ -736,6 +742,7 @@ static void RecoverNamPos(pMulMot self, int argc, char *argv[]) decrement, increment and simple values. DingsBums pos name - makes the current position a named position with name name. + DingsBums getpos - gets the current named position DingsBums drop name - deletes the current named position name. DingsBums drop all - drops all named positions (except back) @@ -830,6 +837,18 @@ static void RecoverNamPos(pMulMot self, int argc, char *argv[]) return 0; } break; + case GETPOS: + pPtr = FindNamPos(self,pCon); + if(pPtr != NULL) + { + sprintf(pBueffel,"%s.nampos = %s",argv[0], pPtr); + } + else + { + sprintf(pBueffel,"%s.nampos = undefined",argv[0]); + } + SCWrite(pCon,pBueffel,eValue); + return 1; case DEFPOS: SCparChange(pCon); return ParseDefPos(pSics,&MyParser,self,pCon); diff --git a/napi45.c b/napi45.c index 8061dd9e..b06cf8a0 100644 --- a/napi45.c +++ b/napi45.c @@ -104,7 +104,7 @@ NXstatus CALLING_STYLE NXsetcache(long newVal) NXIReportError (NXpData,"ERROR: no memory to create Function structure"); return NX_ERROR; } - if (am==NXACC_CREATE) { + if (am==NXACC_CREATE || am == NXACC_CREATE4) { /* HDF4 will be used ! */ hdf_type=1; } else if (am==NXACC_CREATE5) { diff --git a/nextrics.c b/nextrics.c index 0b025340..6aa9bc22 100644 --- a/nextrics.c +++ b/nextrics.c @@ -362,7 +362,7 @@ name of hkl object holding crystallographic information eMode = GetHistCountMode(self->pHistogram3); fVal = GetHistPreset(self->pHistogram3); lVal = GetHistMonitor(self->pHistogram3,1,pCon); - lBeam = GetHistMonitor(self->pHistogram2,4,pCon); + lBeam = GetHistMonitor(self->pHistogram3,4,pCon); } if(self->pCount != NULL) { diff --git a/nxamor.c b/nxamor.c index c258b31f..0b74a64b 100644 --- a/nxamor.c +++ b/nxamor.c @@ -354,10 +354,13 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim, NXhandle hfil, NXdict hdict, SConnection *pCon) { - int iLength, nChunk, chunkSize, iChunk[3], i, iStart[3]; + int iLength, nChunk, chunkSize, iChunk[3], i, iStart[3], nTime; HistInt *lData = NULL; char pBueffel[132]; + const float *fTime; + fTime = GetHistTimeBin(pHM,&nTime); + iDim[2] = nTime; iLength = iDim[0]*iDim[1]*iDim[2]; if( (iLength*4) < TOFBLOCK) { diff --git a/nxscript.c b/nxscript.c index cb1cd50e..41354a0d 100644 --- a/nxscript.c +++ b/nxscript.c @@ -234,14 +234,19 @@ static void putCounter(SConnection *pCon, SicsInterp *pSics, pNXScript self, return; } -/*----------------------------------------------------------------------*/ +/*---------------------------------------------------------------------- + The sequence of things is important in here: The code for updating + the dimensions variables also applies the time binning to the length. + Thus subsets can only be checked for after that. And then we can allocate + memory. + -------------------------------------------------------------------------*/ static void putHistogramMemory(SConnection *pCon, SicsInterp *pSics, pNXScript self, int argc, char *argv[]){ pHistMem mem = NULL; int status, start, length, iDim[MAXDIM], rank, i, subset = 0; HistInt *iData = NULL; - char buffer[256], defString[512], dummy[40]; + char buffer[256], dummy[40], value[20]; const float *timeBin; int timeLength; @@ -266,7 +271,29 @@ static void putHistogramMemory(SConnection *pCon, SicsInterp *pSics, */ start = 0; length = GetHistLength(mem); - + + /* + update the dimension variables in the dictionary + */ + GetHistDim(mem,iDim,&rank); + for(i = 0; i < rank; i++){ + sprintf(dummy,"dim%1.1d", i); + sprintf(value,"%d",iDim[i]); + status = NXDupdate(self->dictHandle,dummy,value); + if(status == 0) { + NXDadd(self->dictHandle,dummy,value); + } + } + timeBin = GetHistTimeBin(mem,&timeLength); + if(timeLength > 2){ + length *= timeLength; + sprintf(dummy,"%d",timeLength); + status = NXDupdate(self->dictHandle,"timedim",dummy); + if(status == 0) { + NXDadd(self->dictHandle,"timedim",dummy); + } + } + /* check for further arguments specifying a subset */ @@ -298,39 +325,7 @@ static void putHistogramMemory(SConnection *pCon, SicsInterp *pSics, return; } - /* - build the definition string - */ - status = NXDget(self->dictHandle,argv[2],buffer,254); - if(!status){ - sprintf(buffer,"ERROR: alias %s for histogram memory not found", - argv[2]); - SCWrite(pCon,buffer,eError); - free(iData); - return; - } - if(subset){ - strcpy(defString,buffer); - timeBin = GetHistTimeBin(mem,&timeLength); - if(timeLength > 2){ - sprintf(dummy,"%d",timeLength); - NXDupdate(self->dictHandle,"timedim",dummy); - } - } else { - strcpy(defString,buffer); - GetHistDim(mem,iDim,&rank); - sprintf(dummy," -rank %d", rank); - strcat(defString,dummy); - strcat(defString," -dim { "); - sprintf(dummy,"%d",iDim[0]); - strcat(defString,dummy); - for(i = 1; i < rank; i++){ - sprintf(dummy,", %d",iDim[i]); - strcat(defString,dummy); - } - strcat(defString," } "); - } - + /* read HM */ @@ -350,7 +345,7 @@ static void putHistogramMemory(SConnection *pCon, SicsInterp *pSics, /* finally: write */ - status = NXDputdef(self->fileHandle, self->dictHandle,defString,iData); + status = NXDputalias(self->fileHandle, self->dictHandle,argv[2],iData); if(status != NX_OK){ sprintf(buffer,"ERROR: failed to write histogram memory data"); SCWrite(pCon,buffer,eError); @@ -606,7 +601,7 @@ static int handlePut(SConnection *pCon, SicsInterp *pSics, pNXScript self, } else { SCWrite(pCon,"ERROR: put command not recognised",eError); } - return 0; + return 1; } /*----------------------------------------------------------------------*/ static void makeLink(SConnection *pCon, SicsInterp *pSics, diff --git a/o2t.c b/o2t.c index 1f744da7..16ac975d 100644 --- a/o2t.c +++ b/o2t.c @@ -222,7 +222,14 @@ self->pOmega = pDum; } pCom = FindCommand(pSics,theta); - pDum = pCom->pData; + if(pCom != NULL) + { + pDum = pCom->pData; + } + else + { + pDum = NULL; + } if(GetDrivableInterface(pDum) != NULL){ self->pTheta = pDum; } diff --git a/sicsstatus.tcl b/sicsstatus.tcl index 178234f7..de9ddd57 100644 --- a/sicsstatus.tcl +++ b/sicsstatus.tcl @@ -1,32 +1,77 @@ -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 -dbfile UNKNOWN -dbfile setAccess 2 -# Motor th -th sign 1.000000 -th SoftZero 0.000000 -th SoftLowerLim 4.000000 -th SoftUpperLim 113.000000 -th Fixed -1.000000 -th InterruptMode 0.000000 -th AccessCode 2.000000 +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 timer +hm2 preset 10.000000 +banana CountMode timer +banana preset 2.000000 +hm1 CountMode timer +hm1 preset 2.000000 #Crystallographic Settings hkl lambda 1.179000 hkl setub -0.017880 -0.074923 0.028280 -0.007008 -0.036800 -0.057747 0.160912 -0.009928 0.000627 hkl hm 0 -det1dist 300.000000 -det1dist setAccess 1 +detdist3 0.000000 +detdist3 setAccess 1 +det3zeroy 128.000000 +det3zeroy setAccess 1 +det3zerox 128.000000 +det3zerox setAccess 1 +detdist2 0.000000 +detdist2 setAccess 1 +det2zeroy 128.000000 +det2zeroy setAccess 1 +det2zerox 128.000000 +det2zerox setAccess 1 +detdist1 0.000000 +detdist1 setAccess 1 det1zeroy 128.000000 det1zeroy setAccess 1 det1zerox 128.000000 @@ -67,6 +112,22 @@ ph SoftUpperLim 360.000000 ph Fixed -1.000000 ph InterruptMode 0.000000 ph AccessCode 2.000000 +# Motor dg3 +dg3 sign 1.000000 +dg3 SoftZero 0.000000 +dg3 SoftLowerLim -10.000000 +dg3 SoftUpperLim 40.000000 +dg3 Fixed -1.000000 +dg3 InterruptMode 0.000000 +dg3 AccessCode 2.000000 +# Motor dg2 +dg2 sign 1.000000 +dg2 SoftZero 0.000000 +dg2 SoftLowerLim -10.000000 +dg2 SoftUpperLim 40.000000 +dg2 Fixed -1.000000 +dg2 InterruptMode 0.000000 +dg2 AccessCode 2.000000 # Motor dg1 dg1 sign 1.000000 dg1 SoftZero 0.000000 @@ -117,8 +178,6 @@ twotheta InterruptMode 0.000000 twotheta AccessCode 2.000000 lastscancommand cscan a4 10. .1 10 5 lastscancommand setAccess 2 -banana CountMode timer -banana preset 2.000000 sample_mur 0.000000 sample_mur setAccess 2 email UNKNOWN @@ -129,6 +188,25 @@ phone UNKNOWN phone setAccess 2 adress UNKNOWN adress setAccess 2 +# Counter counter +counter SetPreset 1000.000000 +counter SetMode Timer +# Motor som +som sign 1.000000 +som SoftZero 0.000000 +som SoftLowerLim -360.000000 +som SoftUpperLim 360.000000 +som Fixed -1.000000 +som InterruptMode 0.000000 +som AccessCode 2.000000 +# Motor sax +sax sign 1.000000 +sax SoftZero 0.000000 +sax SoftLowerLim -30.000000 +sax SoftUpperLim 30.000000 +sax Fixed -1.000000 +sax InterruptMode 0.000000 +sax AccessCode 2.000000 # Motor tilt tilt sign 1.000000 tilt SoftZero 0.000000 @@ -137,6 +215,10 @@ tilt SoftUpperLim 15.000000 tilt Fixed -1.000000 tilt InterruptMode 0.000000 tilt AccessCode 0.000000 +#----- MultiMotor st +st recovernampos henry d1r 5. d1l -5. d1t 0. +#----- MultiMotor sampletable +sampletable recovernampos henry d1r 5. d1l -5. d1t 0. # Motor detectorrotation detectorrotation sign 1.000000 detectorrotation SoftZero 0.000000 @@ -225,6 +307,46 @@ d1r SoftUpperLim 20.000000 d1r Fixed -1.000000 d1r InterruptMode 0.000000 d1r AccessCode 2.000000 +# Motor monochi +monochi sign 1.000000 +monochi SoftZero 0.000000 +monochi SoftLowerLim -30.000000 +monochi SoftUpperLim 30.000000 +monochi Fixed -1.000000 +monochi InterruptMode 0.000000 +monochi AccessCode 2.000000 +# Motor monophi +monophi sign 1.000000 +monophi SoftZero 0.000000 +monophi SoftLowerLim -30.000000 +monophi SoftUpperLim 30.000000 +monophi Fixed -1.000000 +monophi InterruptMode 0.000000 +monophi AccessCode 2.000000 +# Motor monoy +monoy sign 1.000000 +monoy SoftZero 0.000000 +monoy SoftLowerLim -30.000000 +monoy SoftUpperLim 30.000000 +monoy Fixed -1.000000 +monoy InterruptMode 0.000000 +monoy AccessCode 2.000000 +# Motor monox +monox sign 1.000000 +monox SoftZero 0.000000 +monox SoftLowerLim -30.000000 +monox SoftUpperLim 30.000000 +monox Fixed -1.000000 +monox InterruptMode 0.000000 +monox AccessCode 2.000000 +# Motor tasse +tasse sign 1.000000 +tasse SoftZero 0.000000 +tasse SoftLowerLim -130.000000 +tasse SoftUpperLim 130.000000 +tasse Fixed -1.000000 +tasse InterruptMode 0.000000 +tasse AccessCode 2.000000 # Motor sdm sdm sign 1.000000 sdm SoftZero 0.000000 diff --git a/sinqhmdriv.c b/sinqhmdriv.c index 5ffb2a4a..4cf454a9 100644 --- a/sinqhmdriv.c +++ b/sinqhmdriv.c @@ -139,6 +139,7 @@ int iInit = 0, i, iRet; int xOff, xFac, yOff, yFac; int iPort, iLength; + int extraDetectors, noDet; assert(self); assert(self->pPriv); @@ -208,6 +209,20 @@ } pInternal->iBinWidth = (int)fVal; + /* + extra detectors + */ + iRet = StringDictGet(pOpt,"extradetector",pValue,79); + if(iRet) + { + extraDetectors = atoi(pValue); + } + else + { + extraDetectors = 0; + } + + /* check BinWidth */ if( (pInternal->iBinWidth != 1) && (pInternal->iBinWidth != 2) @@ -338,28 +353,20 @@ pCon); iMode = SQHM__HM_DIG; break; case eHTOF: + case eSANSTOF: iMode = SQHM__TOF; /* recalculate some parameters */ - iLength = 1; + noDet = 1; for(i = 0; i < self->data->rank; i++) { - iLength *= self->data->iDim[i]; + noDet *= self->data->iDim[i]; } - iLength *= self->data->nTimeChan; - SINQHMDefineBank(pInternal->pMaster,0,0,self->data->iDim[0], + noDet += extraDetectors; + iLength = noDet*self->data->nTimeChan; + SINQHMDefineBank(pInternal->pMaster,0,0,noDet, self->data->timeBinning, self->data->nTimeChan); break; - case eSANSTOF: - iMode = SQHM__TOF; - iLength = self->data->iDim[0]*self->data->iDim[1]; - iLength *= self->data->nTimeChan; - SINQHMDefineBank(pInternal->pMaster,0,0, - (self->data->iDim[0]*self->data->iDim[1]) - + 3, - self->data->timeBinning, - self->data->nTimeChan); - break; case eHStrobo: iMode = SQHM__HM_PSD | SQHM__STROBO; break; @@ -396,7 +403,8 @@ pCon); status = SINQHMConfigure(pInternal->pMaster, iMode, self->data->rank, - getHMDataLength(self->data), + getHMDataLength(self->data) + + extraDetectors*self->data->nTimeChan , pInternal->iBinWidth, 0,0); } @@ -507,7 +515,7 @@ pCon); status = SINQHMZero(pInternal->pMaster,-1,-1,-1); }else{ status = SINQHMZero(pInternal->pMaster,-1,0, - self->data->rank*getHMDataLength(self->data)); + getHMDataLength(self->data)); } /* status = SINQHMZero(pInternal->pMaster,-1,-1,-1); diff --git a/sinqhmdriv.i b/sinqhmdriv.i index 045f7d7d..b3943434 100644 --- a/sinqhmdriv.i +++ b/sinqhmdriv.i @@ -1,5 +1,5 @@ -#line 63 "sinqhmdriv.w" +#line 64 "sinqhmdriv.w" /*-------------------------------------------------------------------------- S I N Q H M @@ -24,18 +24,19 @@ HistMode eHistMode; int iBinWidth; OverFlowMode eFlow; + int extraDetector; } SinqHMDriv; -#line 76 "sinqhmdriv.w" +#line 77 "sinqhmdriv.w" /*-------------------------------------------------------------------------*/ -#line 58 "sinqhmdriv.w" +#line 59 "sinqhmdriv.w" pHistDriver CreateSINQDriver(pStringDict pOption); int isSINQHMDriv(pHistDriver test); -#line 78 "sinqhmdriv.w" +#line 79 "sinqhmdriv.w" #endif diff --git a/sinqhmdriv.tex b/sinqhmdriv.tex index 79ecc1dc..3a4467a7 100644 --- a/sinqhmdriv.tex +++ b/sinqhmdriv.tex @@ -33,6 +33,7 @@ $\langle$SQType {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ HistMode eHistMode;@\\ \mbox{}\verb@ int iBinWidth;@\\ \mbox{}\verb@ OverFlowMode eFlow;@\\ +\mbox{}\verb@ int extraDetector;@\\ \mbox{}\verb@ } SinqHMDriv;@\\ \mbox{}\verb@@$\diamond$ \end{list} diff --git a/t_conv.c b/t_conv.c index 14ce9ad0..6e6c5802 100644 --- a/t_conv.c +++ b/t_conv.c @@ -65,7 +65,7 @@ static doublereal c_b12 = 360.; real *f, integer *ifx, integer *iss, integer *ism, integer *isa, real *t_a__, real *t_rm__, real *t_alm__, real *t_ra__, real *qm, logical * ldra, logical *ldr_rm__, logical *ldr_alm__, logical *ldr_ra__, real * - p_ih__, real *c_ih__, integer *ier) + p_ih__, real *c_ih__, doublereal *a4, integer *ier) { /* System generated locals */ doublereal d__1; @@ -87,7 +87,7 @@ static doublereal c_b12 = 360.; extern /* Subroutine */ int flip_case__(integer *, integer *, real *, real *, real *, real *, real *, real *, real *, integer *); static logical lmoan[2]; - static doublereal a1, a2, a3, a4, a5, a6; + static doublereal a1, a2, a3, a5, a6; static integer id; static doublereal ra; extern /* Subroutine */ int rl2spv_(doublereal *, doublereal *, @@ -324,10 +324,10 @@ static doublereal c_b12 = 360.; if (*ier != 0) { goto L999; } - sam_case__(dqt, &dqm, &dqs, &daki, &dakf, &a3, &a4, iss, ier); + sam_case__(dqt, &dqm, &dqs, &daki, &dakf, &a3, a4, iss, ier); if (*ier == 0) { t_a__[3] = a3; - t_a__[4] = a4; + t_a__[4] = *a4; ldra[3] = TRUE_; ldra[4] = TRUE_; *qm = dqm; @@ -345,8 +345,8 @@ static doublereal c_b12 = 360.; ier); } if (*ldh) { - helm_case__(hx, hy, hz, &p_ih__[1], &c_ih__[1], aki, akf, &a4, qm, - helm, ier); + helm_case__(hx, hy, hz, &p_ih__[1], &c_ih__[1], aki, akf, a4, qm, + helm, ier); } } /* ----------------------------------------------------------------------- */ diff --git a/t_conv.f b/t_conv.f index 6109842e..ba39ef37 100755 --- a/t_conv.f +++ b/t_conv.f @@ -50,7 +50,7 @@ c ================= + IFX, ISS, ISM, ISA, + T_A, T_RM, T_ALM, T_RA, QM, + LDRA, LDR_RM, LDR_ALM, LDR_RA, - + P_IH, C_IH, + + P_IH, C_IH, A4, + IER) c cdec$ ident 'V01D' diff --git a/tas.h b/tas.h index 5551cbd1..551b13de 100644 --- a/tas.h +++ b/tas.h @@ -149,7 +149,9 @@ #define MAXPAR 130 #define MAXADD 20 #define MAXEVAR 12 - + +#define SROMOT 7 /* number of the SRO motor */ +#define A4MOT 3 /* index of a4 motor */ /* --------------------- data structure -------------------------------*/ typedef struct { @@ -167,6 +169,7 @@ typedef struct { int iFileNO; int iFast; char scanVar[80]; + float oldSRO; }TASdata, *pTASdata; diff --git a/tas.w b/tas.w index ece6f1ed..f00b5aa6 100644 --- a/tas.w +++ b/tas.w @@ -49,6 +49,7 @@ typedef struct { int iFileNO; int iFast; char scanVar[80]; + float oldSRO; }TASdata, *pTASdata; @} \begin{description} @@ -70,6 +71,10 @@ variables. This can be 0 for simple variables or 1 for a motor. no wait for the motors to finish driving. \item[scanVar] memorizes the first scan variable with a step of greater zero. +\item[oldSRO] keeps the old value of the motor SRO. This because the +helmholtz angle stored in the variable helm has to be corrected when +SRO has been driven. This value is initialised in tasdrive and +TasScanDrive. The actual correction is done in TASUpdate. \end{description} The constants for the parameters are defined in the header file. @@ -237,8 +242,10 @@ These are mainly the interpreter interface functions: #define MAXPAR 130 #define MAXADD 20 -#define MAXEVAR 10 - +#define MAXEVAR 12 + +#define SROMOT 7 /* number of the SRO motor */ +#define A4MOT 3 /* index of a4 motor */ /* --------------------- data structure -------------------------------*/ @ diff --git a/tascom.tcl b/tascom.tcl index b30ee0dc..b783a02a 100644 --- a/tascom.tcl +++ b/tascom.tcl @@ -27,9 +27,9 @@ if { [info exists tasinit] == 0 } { Publish pr Spy Publish se User Publish lz Spy + Publish ll Spy Publish lm Spy Publish ls Spy - SicsAlias lz ll Spy Publish le Spy Publish lt Spy Publish li Spy @@ -45,7 +45,7 @@ if { [info exists tasinit] == 0 } { # 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 agl} + sgu agl atl} #------------------------------------------------------------------------- # some MAD variables can be directly mapped to internal SICS variables. # Some others require special functions to be called for them to be set. @@ -88,6 +88,9 @@ proc circlify {val} { while {$p > 360.0} { set p [expr $p - 360.] } + while {$p < -360.0} { + set p [expr $p + 360.] + } return $p } #------------------------------------------------------------------------- @@ -199,11 +202,13 @@ proc scatSense {par {val -1000} } { set newupper [expr $oldupper - 90.] } elseif { $val == 1 && $oldsa == -1} { set newzero [expr $oldzero + 180. ] - set newlower [expr -($oldlower - 180.) ] + set newlower [expr $oldlower + 180 ] set newupper [expr $oldupper + 180. ] + set newlower [circlify $newlower] + set newupper [circlify $newupper] } elseif {$val == -1 && $oldsa == 1} { set newzero [expr $oldzero - 180. ] - set newlower [expr -($oldlower - 180.) ] + set newlower [expr $oldlower - 180. ] set newupper [expr $oldupper - 180. ] } else { error "Unknown SA setting combination" @@ -640,7 +645,11 @@ proc se args { } #--------------------------------------------------------------------------- -# lz list limits and zeros +# lz list limits and zeros, ll is the same + +proc ll args { + return lz $args +} proc lz args { global tasmap @@ -1016,6 +1025,12 @@ proc polsw args { } off { lpa 0 + set ret [catch {run i1 0} msg] + set ret [catch {run i2 0} msg] + set ret [catch {run i3 0} msg] + set ret [catch {run i4 0} msg] + set ret [catch {run i5 0} msg] + set ret [catch {run i6 0} msg] return "Polarisation mode disabled" } flip { diff --git a/tasdrive.c b/tasdrive.c index e8b0e532..603b0ee1 100644 --- a/tasdrive.c +++ b/tasdrive.c @@ -106,6 +106,9 @@ int TASDrive(SConnection *pCon, SicsInterp *pSics, void *pData, tasTargets[i+10] = .0; oldEnergy[i] = .0; } + tasMask[10] = 0; + tasMask[11] = 0; + for(i = 0; i < MAXMOT; i++) { motorMask[i] = 0; @@ -189,6 +192,12 @@ int TASDrive(SConnection *pCon, SicsInterp *pSics, void *pData, if(rStatus != 1) return rStatus; + /* + store SRO motor value + */ + getSRO(pCon,&self->oldSRO); + + /* having done this, we can start the motors */ for(i = 0; i < MAXMOT; i++) { diff --git a/tasinit.c b/tasinit.c index c9731dad..542eed9f 100644 --- a/tasinit.c +++ b/tasinit.c @@ -25,6 +25,8 @@ #include "scan.i" #include "tas.h" +extern int getSRO(SConnection *pCon, float *fVal); /* tasutil.c */ + /* As variables may be accessed in storage order, it is necessary to know the order of the motors @@ -344,6 +346,11 @@ int TASFactory(SConnection *pCon, SicsInterp *pSics, void *pData, { RegisterCallback(pVar->pCall,VALUECHANGE,TimerCallback,pNew,NULL); } + + /* + initialize SRO value + */ + getSRO(pCon,&pNew->oldSRO); /* install TAS commands */ iError = AddCommand(pSics,"dr",TASDrive,TASKill,pNew); diff --git a/tasscan.c b/tasscan.c index 5d19a40a..e6ec73d5 100644 --- a/tasscan.c +++ b/tasscan.c @@ -252,37 +252,22 @@ static int TASHeader(pScanData self) } /* - write motors + write motors and currents */ fprintf(self->fd,"VARIA: "); iCount = 0; for(i = 0; i < MAXMOT-8;i++) { - pMot = FindMotor(self->pSics, tasMotorOrder[i]); - if(pMot) - { - status = MotorGetSoftPosition(pMot,self->pCon,&fVal); - if(!status) - { - fVal = -9999.77; - } - if(iCount == 3) - { - iCount = 0; - fprintf(self->fd,"\nVARIA: "); - } - strcpy(pWork2,tasMotorOrder[i]); - strtoupper(pWork2); - fprintf(self->fd,"%-8s=%8.4f, ",pWork2,fVal); - iCount++; - } - else - { - sprintf(pBueffel,"WARNING: motor %s NOT found, %s", - tasMotorOrder[i], - " possible data file corruption"); - SCWrite(self->pCon,pBueffel,eWarning); - } + fVal = readDrivable(tasMotorOrder[i],self->pCon); + if(iCount == 3) + { + iCount = 0; + fprintf(self->fd,"\nVARIA: "); + } + strcpy(pWork2,tasMotorOrder[i]); + strtoupper(pWork2); + fprintf(self->fd,"%-8s=%8.4f, ",pWork2,fVal); + iCount++; } fprintf(self->fd,"\n"); @@ -291,7 +276,7 @@ static int TASHeader(pScanData self) */ fprintf(self->fd,"ZEROS: "); iCount = 0; - for(i = 0; i < MAXMOT-8;i++) + for(i = 0; i < CURMOT -1;i++) { pMot = FindMotor(self->pSics, tasMotorOrder[i]); if(pMot) @@ -580,7 +565,13 @@ static int TASScanDrive(pScanData self, int iPoint) tasTargets[i] = .0; tasTargets[i+10] = .0; } + tasMask[10] = 0; + tasMask[11] = 0; + /* + store SRO motor value + */ + getSRO(self->pCon,&pTAS->oldSRO); /* loop through all the scan variables @@ -609,7 +600,7 @@ static int TASScanDrive(pScanData self, int iPoint) StartMotor(pServ->pExecutor,self->pSics, self->pCon, pVar->Name, pVar->fStart + iPoint * pVar->fStep); /* - Ignore errors. TAS scans continue when a motor runs into + Ignore errors. TAS scans continues when a motor runs into a limit. */ } diff --git a/tasu.h b/tasu.h index 0a35b7c5..e9e1c236 100644 --- a/tasu.h +++ b/tasu.h @@ -34,6 +34,7 @@ int isTASCurrent(char *val); int isTASVar(char *val); int isTASEnergy(char *val); void prepare2Parse(char *line); +int getSRO(SConnection *pCon, float *sroVal); int tasNumeric(char *pText); float readDrivable(char *val, SConnection *pCon); void startCurrent(char *val, SConnection *pCon, float fVal); diff --git a/tasutil.c b/tasutil.c index 9ad9dac0..5bcf2d3c 100644 --- a/tasutil.c +++ b/tasutil.c @@ -210,6 +210,30 @@ static int printError(int ier, SConnection *pCon) break; } } +/*--------------------------------------------------------------------- + getSRO reads the SRO motor. This motor is for the rotation of the + magnet. The value has to be subtracted from the helm value during + calculations + -----------------------------------------------------------------------*/ +int getSRO(SConnection *pCon, float *sroVal) +{ + pMotor pMot = NULL; + int status; + + pMot = FindMotor(pServ->pSics,"sro"); + if(!pMot) + { + SCWrite(pCon,"ERROR: internal: motor sro not found!",eError); + return 0; + } + status = MotorGetSoftPosition(pMot,pCon,sroVal); + if(status != 1) + { + SCWrite(pCon,"ERROR: failed to read motor sro",eError); + return 0; + } + return 1; +} /*---------------------------------------------------------------------- TASCalc does the triple axis spectrometer calculations. This function is invoked whenever energy or Q needs to be driven. The parameters: @@ -242,7 +266,7 @@ extern int t_conv__(real *ei, real *aki, real *ef, real *akf, real * real *f, integer *ifx, integer *iss, integer *ism, integer *isa, real *t_a__, real *t_rm__, real *t_alm__, real *t_ra__, real *qm, logical * ldra, logical *ldr_rm__, logical *ldr_alm__, logical *ldr_ra__, real * - p_ih__, real *c_ih__, integer *ier); + p_ih__, real *c_ih__, doublereal *a4, integer *ier); extern int inicurve_(integer *midx, real *mrx1, real *mrx2, integer *aidx, real *arx1, real *arx2, real *mmin, real *mmax, real *amin, @@ -259,14 +283,16 @@ int TASCalc(pTASdata self, SConnection *pCon, integer ier; /* for t_conv */ real ei, aki, ef, akf, qhkl[3], en, hx, hy, hz, dm, da, helm, f1h, f1v, - f2h, f2v, f, angles[6], tRM, tRA, tALM, qm, currents[8], helmconv[4]; + f2h, f2v, f, angles[6], tRM, tRA, tALM, qm, currents[8], + helmconv[4]; + doublereal a4; integer if1, if2, ifx, iss, ism, isa; logical ldk[8], ldh, ldf, lpa, ldra[6], l_RM, l_RA, l_ALM; /* for inicurve */ real mrx1, mrx2, arx1, arx2, mmin, mmax, amin, amax; integer im, ia; pMotor pMot; - float fVal; + float fVal, fSRO; /* else */ int i; @@ -402,6 +428,12 @@ int TASCalc(pTASdata self, SConnection *pCon, } readConversionFactors(self,helmconv); + /* + read a4 in order to make magnet calculations work + */ + a4 = .0; + a4 = readDrivable(tasMotorOrder[A4MOT],pCon); + /* initalise the motorMasks to 0. */ @@ -422,7 +454,7 @@ int TASCalc(pTASdata self, SConnection *pCon, &da, &helm, &f1h, &f1v, &f2h, &f2v, &f, &ifx, &iss, &ism, &isa, angles, &tRM, &tALM, &tRA, &qm, ldra, - &l_RM, &l_ALM,&l_RA, currents,helmconv, + &l_RM, &l_ALM,&l_RA, currents,helmconv,&a4, &ier); if(ier != 0) @@ -470,6 +502,7 @@ int TASCalc(pTASdata self, SConnection *pCon, self->tasPar[TKF]->fVal = (float)akf; self->tasPar[TEN]->fVal = (float)en; self->tasPar[QM]->fVal = (float)qm; + self->tasPar[TQM]->fVal = (float)qm; return 1; } @@ -555,7 +588,7 @@ int TASUpdate(pTASdata self, SConnection *pCon) integer isa, if1, if2, ier, ifx; pMotor pMot; char pBueffel[132]; - float fMot, diff; + float fMot, diff, fSRO; int i, status; assert(self); @@ -596,6 +629,22 @@ int TASUpdate(pTASdata self, SConnection *pCon) break; } + /* + correct helmholtz angle for SRO rotation + */ + if(getSRO(pCon,&fSRO)) { + fSRO = self->oldSRO - fSRO; + fSRO = self->tasPar[HELM]->fVal - fSRO; + if(fSRO > 360){ + fSRO -= 360.; + } + if(fSRO < -360){ + fSRO += 360.; + } + getSRO(pCon,&self->oldSRO); + self->tasPar[HELM]->fVal = fSRO; + } + /* get the motor angles A1-A6 */ diff --git a/tecs/makefile_alpha b/tecs/makefile_alpha index 583f1947..5fcac823 100644 --- a/tecs/makefile_alpha +++ b/tecs/makefile_alpha @@ -5,8 +5,8 @@ # Markus Zolliker, March 2003 #-------------------------------------------------------------------------- # the following lines only for fortified version -DFORTIFY=-DFORTIFY -I$(SRC).. -FORTIFYOBJ=../strdup.o ../fortify.o +#DFORTIFY=-DFORTIFY -I$(SRC).. +#FORTIFYOBJ=../strdup.o ../fortify.o #========================================================================== diff --git a/utils/check/sanscheck b/utils/check/sanscheck index 0a70ccf7..0b12c906 100755 --- a/utils/check/sanscheck +++ b/utils/check/sanscheck @@ -46,6 +46,10 @@ sicsSyntaxMap sampletable mumoSyntax set sicsPar(sampletable.alias) [list omega x y z posi] set sicsPar(sampletable.nampos) [list back] +sicsSyntaxMap st mumoSyntax +set sicsPar(st.alias) [list omega x y z posi] +set sicsPar(st.nampos) [list back] + sicsSyntaxMap detector mumoSyntax set sicsPar(detector.alias) [list x y phi] set sicsPar(detector.nampos) [list back] @@ -100,6 +104,24 @@ sicsSyntaxMap qrange syntaxNumPar sicsSyntaxMap bsin syntaxDummy sicsSyntaxMap bsout syntaxDummy +#------------- SANS xy-tables +sicsSyntaxMap xydata0 syntaxXY +sicsSyntaxMap xydata1 syntaxXY +sicsSyntaxMap xydata2 syntaxXY +sicsSyntaxMap xydata3 syntaxXY +sicsSyntaxMap xydata4 syntaxXY +sicsSyntaxMap xydata5 syntaxXY +sicsSyntaxMap xydata6 syntaxXY +sicsSyntaxMap xydata7 syntaxXY +sicsSyntaxMap xydata8 syntaxXY +sicsSyntaxMap xydata9 syntaxXY +sicsSyntaxMap xydata syntaxXY + +#--------- do we need this? +sicsSyntaxMap save syntaxDummy +sicsSyntaxMap SplitReply syntaxDummy +sicsSyntaxMap Publish syntaxDummy + #--------- Main checking stuff if { $argc < 1} { @@ -116,3 +138,7 @@ exit 1 + + + + diff --git a/utils/check/sicssyntaxlib.tcl b/utils/check/sicssyntaxlib.tcl index 05f91cd8..1cf09be0 100644 --- a/utils/check/sicssyntaxlib.tcl +++ b/utils/check/sicssyntaxlib.tcl @@ -549,7 +549,8 @@ proc count { {mode NULL } { preset NULL } } { if { [string compare $m null] == 0} { return } else { - if { [syntaxCounterMode $m] != 1 } { + set c [string index $mode 0] + if { [regexp \[mc\] $c] != 1 } { error "ERROR: invalid counter mode $m specified for count" } } @@ -579,7 +580,8 @@ proc repeat { num {mode NULL} {preset NULL} } { if { [string compare $m null] == 0} { return } else { - if { [syntaxCounterMode $m] != 1 } { + set c [string index $mode 0] + if { [regexp \[mc\] $c] != 1 } { error "ERROR: invalid counter mode $m specified for count" } } @@ -1036,6 +1038,41 @@ proc syntaxHKL {name args} { } } #--------------------------------------------------------------------------- +# syntax for xytables as used at SANS +#--------------------------------------------------------------------------- +proc syntaxXY {name args} { + set args [syntaxListify $args] + if { [llength $args] < 1} { + error "ERROR: expected argument to $name" + } + set subcommand [string tolower [string trim [lindex $args 0]]] + switch $subcommand { + clear - + list - + uuget {return} + write { + if { [llength $args] < 2} { + error "ERROR: missing file name for $name write" + } + return + } + add { + if { [llength $args] < 3} { + error "ERROR: missing values for $name add" + } + for { set i 1} { $i < 3} {incr i} { + set val [string trim [lindex $args $i]] + if { [syntaxNumeric $val] != 1} { + error "ERROR: expected numeric arg to $name add, got $val" + } + } + } + default { + error "ERROR: subcommand $subcommand to $name not recognized" + } + } +} +#--------------------------------------------------------------------------- # Mappings for some common SICS commands and variables #--------------------------------------------------------------------------- sicsSyntaxMap clientput syntaxDummy