- Many fixes to accomodate a nitty picky TRICS wishlist

- Added a log facility to scan which includes a variable which is logged but
  not driven during a scan.
- Fixed normal beam operation
This commit is contained in:
koennecke
2006-01-27 11:33:06 +00:00
parent 45fd50265f
commit b737b4d936
17 changed files with 367 additions and 182 deletions

73
hkl.c
View File

@ -474,15 +474,16 @@ static int checkNormalBeam(double om, double *gamma, double nu,
char pError[132];
float fHard;
fSet[0] = (float)*gamma;
fSet[1] = (float)om;
fSet[2] = (float)nu;
/* check omega, gamma and nu */
iTest = MotorCheckBoundary(self->pOmega,(float)om, &fHard,pError,131);
iTest += checkTheta(self,gamma);
iTest += MotorCheckBoundary(self->pNu,(float)nu, &fHard,pError,131);
if(iTest == 3) /* none of them burns */
{
fSet[0] = (float)*gamma;
fSet[1] = (float)om;
fSet[2] = (float)nu;
return 1;
}
return 0;
@ -677,7 +678,7 @@ static int calculateBisecting(MATRIX z1, pHKL self, SConnection *pCon,
static int calculateNormalBeam(MATRIX z1, pHKL self, SConnection *pCon,
float fSet[4], double myPsi, int iRetry)
{
int i, iTest;
int i, iTest, status;
double stt, om, chi, phi, gamma, nu, psi, omnb;
float currentPhi, currentChi;
double ompsi, chipsi, phipsi;
@ -699,7 +700,6 @@ static int calculateNormalBeam(MATRIX z1, pHKL self, SConnection *pCon,
{
return 0;
}
/*
phim = mat_creat(3,3,ZERO_MATRIX);
phimat(phim,(double)currentPhi);
z4 = mat_mul(phim,z1);
@ -709,9 +709,13 @@ static int calculateNormalBeam(MATRIX z1, pHKL self, SConnection *pCon,
mat_free(phim);
mat_free(chim);
mat_free(z4);
*/
if(!z1mToNormalBeam(self->fLambda, z1, &gamma, &omnb, &nu)){
status = z1mToNormalBeam(self->fLambda, z3, &gamma, &omnb, &nu);
omnb += 180.;
mat_free(z3);
if(status != 1)
{
return 0;
}
if(checkNormalBeam(omnb, &gamma, nu,fSet,pCon,self)){
@ -719,61 +723,6 @@ static int calculateNormalBeam(MATRIX z1, pHKL self, SConnection *pCon,
} else {
return 0;
}
if(!z1mToBisecting(self->fLambda,z1,&stt,&om,&chi,&phi))
{
return 0;
}
if(bisToNormalBeam(stt,om,chi,phi,
&omnb, &gamma, &nu))
{
/* om = -om + 180.; */
if(checkNormalBeam(omnb, &gamma, nu,fSet,pCon,self))
{
return 1;
}
}
return 0;
/*
do the bisecting angles first
*/
if(!z1mToBisecting(self->fLambda,z3,&stt,&om,&chi,&phi))
{
return 0;
}
if(ABS(chi -90.) < .001 && ABS(phi-180.) < .001)
{
chi = .0;
phi = .0;
}
/*
in order to cope with all those limitations: rotate through psi
*/
for(i = 0; i < iRetry; i++)
{
if(iRetry > 1)
{
psi = i*.5;
}
else
{
psi = myPsi;
}
rotatePsi(om,chi,phi,psi,&ompsi,&chipsi,&phipsi);
if(bisToNormalBeam(stt,ompsi,chipsi,phipsi,
&om, &gamma, &nu))
{
if(checkNormalBeam(om, &gamma, nu,fSet,pCon,self))
{
return 1;
}
}
}
return 0;
}
/*---------------------------------------------------------------------*/
static int calculateNormalBeamOmega(MATRIX z1, pHKL self,