- Fixed a bug in conman.c which could cause a core dump when terminating
a connection during an active run. - Added an additional output mode for the connection in order to support the batch run editor. - Made clientput send everything with eWarning mode in order to support the batch run editor. - Added a better NetReadTillTerm - Fixed a problem in synchronize.c - Fixed an issue with reading empty line on normal connection sockets. - Added a psi scan mode to mesure.c for TRICS - Made motor print warnings when trying to reposition. - Fixed abug in hkl.c which cause wrong signs. SKIPPED: psi/el734driv.c psi/el734hp.c psi/el737driv.c psi/el737hpdriv.c psi/nextrics.c psi/nxamor.c psi/psi.c psi/slsmagnet.c psi/swmotor2.c psi/tasscan.c psi/tasutil.c
This commit is contained in:
84
mesure.c
84
mesure.c
@@ -11,6 +11,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <tcl.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
#include "fortify.h"
|
||||
#include "sics.h"
|
||||
@@ -24,6 +25,7 @@
|
||||
#include "sicsvar.h"
|
||||
#include "evcontroller.h"
|
||||
#include "mesure.h"
|
||||
#include "nxscript.h"
|
||||
|
||||
extern void SNXFormatTime(char *pBueffel, int iLen);
|
||||
#define ANGERR 0.2
|
||||
@@ -68,6 +70,7 @@
|
||||
long *lCounts; /* array to store counting values */
|
||||
float fPosition[4]; /* the real positions after driving */
|
||||
int iCompact; /* true if compact scan ouput. */
|
||||
int psiMode; /* 1 for psi scan mode, 0 else */
|
||||
} Mesure;
|
||||
/*--------------------------------------------------------------------------*/
|
||||
pMesure CreateMesure(pHKL pCryst, pScanData pScanner, pMotor pOmega,
|
||||
@@ -112,7 +115,8 @@
|
||||
pNew->fStep = 0.05;
|
||||
pNew->fPreset = 2;
|
||||
pNew->iMode = 0;
|
||||
pNew->iCompact = 1;
|
||||
pNew->iCompact = 1;
|
||||
pNew->psiMode = 0;
|
||||
#ifdef MESSDEBUG
|
||||
pNew->lCounts = (long *)malloc(90*sizeof(long));
|
||||
#endif
|
||||
@@ -269,7 +273,7 @@
|
||||
pNew = CreateMesure(pCryst,pScan,pMot,argv[4],argv[5],argv[6],pDanu);
|
||||
if(!pNew)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: no meory in MesureFactory",eError);
|
||||
SCWrite(pCon,"ERROR: no memory in MesureFactory",eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -348,7 +352,8 @@
|
||||
return 1;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int MesureReflection(pMesure self, float fHKL[3], SConnection *pCon)
|
||||
int MesureReflection(pMesure self, float fHKL[3], float fPsi,
|
||||
SConnection *pCon)
|
||||
{
|
||||
int iRet, i;
|
||||
float fStart;
|
||||
@@ -358,7 +363,7 @@
|
||||
assert(self);
|
||||
|
||||
/* drive to reflection */
|
||||
iRet = DriveHKL(self->pCryst,fHKL,0.,0,pCon);
|
||||
iRet = DriveHKL(self->pCryst,fHKL,fPsi,0,pCon);
|
||||
if(!iRet)
|
||||
{
|
||||
return iRet;
|
||||
@@ -375,7 +380,7 @@
|
||||
check if we are really there. All this only because Jurg
|
||||
does not fix his rotten cradle.
|
||||
*/
|
||||
CalculateSettings(self->pCryst,fHKL,0.,0,fSet,pCon);
|
||||
CalculateSettings(self->pCryst,fHKL,fPsi,0,fSet,pCon);
|
||||
for(i = 0; i < 4; i++)
|
||||
{
|
||||
fDelta = fSet[i] - self->fPosition[i];
|
||||
@@ -506,9 +511,11 @@
|
||||
char pFilename[512], pRoot[512];
|
||||
char pBueffel[1024];
|
||||
char pBuff[132];
|
||||
int iYear, iNum;
|
||||
int iYear, iNum, iTaus;
|
||||
float fVal, fUB[9];
|
||||
pSicsVariable pVar = NULL;
|
||||
char *pFile = NULL, *pPtr;
|
||||
|
||||
|
||||
assert(self);
|
||||
assert(pCon);
|
||||
@@ -520,9 +527,17 @@
|
||||
}
|
||||
|
||||
/* create filename root */
|
||||
iNum = IncrementDataNumber(self->pDanu,&iYear);
|
||||
sprintf(pRoot,"%s/trics%5.5d%4.4d.",self->pFileRoot,iNum,iYear);
|
||||
self->pCurrentFile = strdup(pRoot);
|
||||
pFile = makeFilename(pServ->pSics,pCon);
|
||||
if(!pFile)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
pPtr = strrchr(pFile,(int)'.');
|
||||
pPtr++;
|
||||
*pPtr = '\0';
|
||||
self->pCurrentFile = strdup(pFile);
|
||||
free(pFile);
|
||||
strncpy(pRoot,self->pCurrentFile,511);
|
||||
|
||||
/* do the logfile */
|
||||
strcpy(pFilename,pRoot);
|
||||
@@ -825,9 +840,9 @@
|
||||
int MesureFile(pMesure self, char *pFile, int iSkip, SConnection *pCon)
|
||||
{
|
||||
FILE *fd = NULL;
|
||||
char pBueffel[512], pTime[132];
|
||||
char pBueffel[512], pTime[132], pError[256];
|
||||
int i, iRet;
|
||||
float fHKL[3];
|
||||
float fHKL[3], fPsi = .0;
|
||||
|
||||
assert(self);
|
||||
assert(pCon);
|
||||
@@ -859,15 +874,33 @@
|
||||
}
|
||||
self->iCount = iSkip;
|
||||
|
||||
if(self->psiMode > 0){
|
||||
SCWrite(pCon,"WARNING: measuring in psi mode",eWarning);
|
||||
}
|
||||
|
||||
/* loop through space and measure! */
|
||||
while(fgets(pBueffel,510,fd) != NULL)
|
||||
{
|
||||
for(i = 0; i < 3;i++)
|
||||
fHKL[i] = 0.;
|
||||
iRet = sscanf(pBueffel,"%f%f%f",&fHKL[0],&fHKL[1],&fHKL[2]);
|
||||
if(self->psiMode > 0){
|
||||
iRet = sscanf(pBueffel,"%f%f%f%f",
|
||||
&fHKL[0],&fHKL[1],&fHKL[2],&fPsi);
|
||||
if(iRet != 4){
|
||||
snprintf(pError,255,"WARNING: skipping bad line %s",pBueffel);
|
||||
SCWrite(pCon,pError,eWarning);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
iRet = sscanf(pBueffel,"%f%f%f",&fHKL[0],&fHKL[1],&fHKL[2]);
|
||||
if(iRet != 3){
|
||||
snprintf(pError,255,"WARNING: skipping bad line %s",pBueffel);
|
||||
SCWrite(pCon,pError,eWarning);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
self->iCount++;
|
||||
iRet = MesureReflection(self,fHKL,pCon);
|
||||
iRet = MesureReflection(self,fHKL,fPsi,pCon);
|
||||
if(iRet == 0)
|
||||
{
|
||||
if(SCGetInterrupt(pCon) >= eAbortBatch)
|
||||
@@ -1034,6 +1067,18 @@
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else if(strcmp(name,"psimode") == 0)
|
||||
{
|
||||
if(fVal >= 1.)
|
||||
{
|
||||
self->psiMode = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->psiMode = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
@@ -1079,6 +1124,11 @@
|
||||
*fVal = self->iCompact;
|
||||
return 1;
|
||||
}
|
||||
else if(strcmp(name,"psimode") == 0)
|
||||
{
|
||||
*fVal = self->psiMode;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
@@ -1388,3 +1438,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user