- Updated the managers documentation a little

- The  crystal settings calculation in hkl now tried to put omega into
  the limts by calculating a delta omega.
- TRICS data files now include HKL and the UB
- The scan module has been expanded to support user defined scans which
  run a script at any scan point.
- A small fix to the PSD code in SinqHM_srv_filler
This commit is contained in:
cvs
2001-07-20 08:05:25 +00:00
parent 8f84d45dd6
commit 0fac95ea9b
25 changed files with 741 additions and 522 deletions

170
hkl.c
View File

@ -652,154 +652,13 @@
return 1;
}
}
/*-------------------------------------------------------------------------*/
/* This may become dead code if the looping show does not work */
int CulculuteSettings(pHKL self, float fHKL[3], float fPsi, int iHamil,
float fSet[4], SConnection *pCon)
{
int iRet, iSuccess = 0, iRes = 1, iRetry = 1;
int iQuad = 0;
int iTest;
float fDelom = 0.;
char pError[132];
char pBueffel[512];
float fHard;
float fVal;
/* catch shitty input */
if( (fHKL[0] == 0.) && (fHKL[1] == 0.) && (fHKL[2] == 0.))
{
SCWrite(pCon,"ERROR: I will not calculate angles for HKL = (0,0,0) ",
eError);
return 0;
}
/* no retries if normal beam calculation or specific Hamilton requested */
if( (self->iNOR) || (iHamil != 0) )
{
iRetry = 0;
}
/* loop till success */
while(!iSuccess)
{
/* just try it*/
iRet = ICAL(self,fHKL, fPsi, iHamil, self->iQuad,fSet,fDelom);
if(iRet < 0 ) /* could not do it */
{
sprintf(pBueffel,"ERROR: cannot calculate %4.1f %4.1f %4.1f",
fHKL[0], fHKL[1], fHKL[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
/* check two theta */
iTest = MotorCheckBoundary(self->pTheta,fSet[0], &fHard,pError,131);
if(!iTest)
{
/* this cannot be fixed */
sprintf(pBueffel,
"ERROR: %4.1f, %4.1f, %4.1f, %5.2f violates two theta limits",
fSet[0], fHKL[0], fHKL[1],fHKL[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
/* check omega */
iTest = MotorCheckBoundary(self->pOmega,fSet[1], &fHard,pError,131);
if(!iTest)
{
if((iRetry) && (ABS(fPsi) <= 0.) )
{
/* try tweaking omega a bit */
MotorGetPar(self->pOmega,"softupperlim",&fVal);
if(fSet[1] > fVal) /* upper limit violated */
{
fDelom = -(fSet[1] - fVal - .5);
iRetry = 0; /* do not try a second time */
}
MotorGetPar(self->pOmega,"softlowerlim",&fVal);
if(fSet[1] < fVal)
{
fDelom = (fVal +.5) -fSet[1];
iRetry = 0;
}
continue;
}
else
{
/* this cannot be fixed */
sprintf(pBueffel,
"ERROR: %4.1f, %4.1f, %4.1f, %5.2f violates omega limits",
fSet[1], fHKL[0], fHKL[1],fHKL[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
}
/* check nu if normal beam */
if(self->iNOR)
{
iTest = MotorCheckBoundary(self->pNu,fSet[2], &fHard,pError,131);
if(!iTest)
{
sprintf(pBueffel,
"ERROR: %4.1f, %4.1f, %4.1f, %5.2f %5.2f %5.2f violates nu limits",
fHKL[0], fHKL[1],fHKL[2],fSet[0], fSet[1],fSet[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
else
{
return 1;
}
}
/* check chi and phi, but first put into 0-360 degrees */
if(fSet[2] < 0.0)
{
fSet[2] = 360.0 + fSet[2];
}
if(fSet[3] < 0.0)
{
fSet[3] = 360.0 + fSet[3];
}
iTest = MotorCheckBoundary(self->pChi,fSet[2], &fHard,pError,131);
iTest += MotorCheckBoundary(self->pPhi,fSet[4], &fHard,pError,131);
if(iTest < 2) /* one of them burns */
{
if(iRetry)
{
/* try other quadrant */
if(self->iQuad == 1)
{
iQuad = 0;
}
else
{
iQuad = 1;
}
iRetry = 0;
continue;
}
else
{
sprintf(pBueffel,
"ERROR: %4.1f, %4.1f, %4.1f, %5.2f %5.2f %5.2f %5.2f violates chi, phi limits",
fHKL[0], fHKL[1],fHKL[2],fSet[0], fSet[1],fSet[2],fSet[3]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
}
iSuccess = 1; /* end loop, we got valid data */
}
return 1;
}
/*-------------------------------------------------------------------------
calculates the four circle settings. If the position can not be reached
because of a limit violation, then psi is rotated in 10 degree steps
until either the loop ends or we finally succed.
until either the loop ends or we finally succeed. If there is a omega
violation we first try to calculate a delta omega which puts omega
into the right range. This is a fix because the omega movement is quite
often restricted due to the crygenic garbage around the sample.
*/
int CalculateSettings(pHKL self, float fHKL[3], float fPsi, int iHamil,
float fSet[4], SConnection *pCon)
@ -810,8 +669,7 @@
float fDelom = 0.;
char pError[132];
char pBueffel[512];
float fHard;
float fVal;
float fHard, fVal, fUpper, fLower;
float myPsi = fPsi;
/* catch shitty input */
@ -844,6 +702,7 @@
iRetry = 35;
}
/* loop till success */
for(i = 0, myPsi = fPsi; i < iRetry; i++, myPsi += 10.)
{
@ -902,6 +761,23 @@
}
*/
iTest = MotorCheckBoundary(self->pOmega,fSet[1], &fHard,pError,131);
if(iTest == 0 && i == 0)
{
/*
calculate a delta omega to put omega into center of range
*/
MotorGetPar(self->pOmega,"softupperlim",&fUpper);
MotorGetPar(self->pOmega,"softlowerlim",&fLower);
if(fSet[1] > fUpper)
{
fVal = fUpper - 5.; /* 5 degree safety for scanning */
}
else if (fSet[1] < fLower)
{
fVal = fLower + 5.; /* same */
}
fDelom = fSet[1] - fVal;
}
iTest += MotorCheckBoundary(self->pChi,fSet[2], &fHard,pError,131);
iTest += MotorCheckBoundary(self->pPhi,fSet[3], &fHard,pError,131);
if(iTest == 3) /* none of them burns */