- Removed SCStart/EndBuffering as far as possible and fixed an issue with
the capture command in that it not put resluts into the Tcl interpreter. This broke scriptcontext scripts in complicated situations. - Resolved some issues with the TAS calculation and negative scattering sense. - Fixed a bug which did not reset the state to idle after checking reachability in confvirtualmot.c SKIPPED: psi/autowin.c psi/eigera2.c psi/jvlprot.c psi/makefile_linux psi/sinqhttpopt.c psi/tasscan.c
This commit is contained in:
78
tasub.c
78
tasub.c
@ -21,6 +21,7 @@
|
||||
#include "trigd.h"
|
||||
#include "tasub.h"
|
||||
#include "tasdrive.h"
|
||||
#include "vector.h"
|
||||
/*------------------- motor indexes in motor data structure ---------*/
|
||||
#define A1 0
|
||||
#define A2 1
|
||||
@ -154,6 +155,7 @@ static ptasUB MakeTasUB()
|
||||
pNew->pDes = CreateDescriptor("TAS-UB");
|
||||
pNew->machine.UB = mat_creat(3, 3, UNIT_MATRIX);
|
||||
pNew->machine.planeNormal = mat_creat(3, 1, ZERO_MATRIX);
|
||||
pNew->machine.planeNormal[2][0] = 1.;
|
||||
pNew->reflectionList = LLDcreate(sizeof(tasReflection));
|
||||
if (!pNew->pDes || !pNew->machine.UB || pNew->reflectionList < 0 ||
|
||||
pNew->machine.planeNormal == NULL) {
|
||||
@ -893,7 +895,13 @@ int findReflection(int list, int idx, ptasReflection r)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------*/
|
||||
void setStopFixed(ptasUB self, int val)
|
||||
{
|
||||
if(val == 0 || val ==1) {
|
||||
self->stopFixed = val;
|
||||
}
|
||||
}
|
||||
/*------------------------------------------------------------------*/
|
||||
static void listUB(ptasUB self, SConnection * pCon)
|
||||
{
|
||||
@ -1179,7 +1187,9 @@ static int calcAuxUB(ptasUB self, SConnection * pCon, SicsInterp * pSics,
|
||||
mat_free(self->machine.planeNormal);
|
||||
}
|
||||
self->machine.UB = UB;
|
||||
self->machine.planeNormal = calcPlaneNormal(r1, r2);
|
||||
self->machine.planeNormal = makeVector();
|
||||
self->machine.planeNormal[2][0] = 1.;
|
||||
/* self->machine.planeNormal = calcPlaneNormal(r1, r2); */
|
||||
self->ubValid = 1;
|
||||
SCparChange(pCon);
|
||||
SCSendOK(pCon);
|
||||
@ -1260,7 +1270,9 @@ static int calcUB(ptasUB self, SConnection * pCon, SicsInterp * pSics,
|
||||
mat_free(self->machine.planeNormal);
|
||||
}
|
||||
self->machine.UB = UB;
|
||||
self->machine.planeNormal = calcPlaneNormal(r1, r2);
|
||||
/* self->machine.planeNormal = calcPlaneNormalQ(UB,r1, r2);*/
|
||||
self->machine.planeNormal = makeVector();
|
||||
self->machine.planeNormal[2][0] = 1.;
|
||||
self->r1 = r1;
|
||||
self->r2 = r2;
|
||||
self->ubValid = 1;
|
||||
@ -1321,6 +1333,62 @@ static int calcUBFromCell(ptasUB self, SConnection * pCon)
|
||||
mat_free(B);
|
||||
return 1;
|
||||
}
|
||||
/*-----------------------------------------------------------------*/
|
||||
static int calcTestUBWrap(ptasUB self, SConnection *pCon,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
MATRIX UB;
|
||||
double om, sgu, sgl;
|
||||
tasReflection r1, r2;
|
||||
|
||||
|
||||
if(argc < 5) {
|
||||
SCWrite(pCon,"ERROR: not enough arguments to test UB", eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
om = atof(argv[2]);
|
||||
sgu = atof(argv[3]);
|
||||
sgl = atof(argv[4]);
|
||||
|
||||
UB = calcTestUB(self->cell, om, sgu, sgl);
|
||||
if(UB == NULL){
|
||||
SCWrite(pCon,"ERROR: out of memory or invalid cell in test UB", eError);
|
||||
return 0;
|
||||
}
|
||||
mat_free(self->machine.UB);
|
||||
self->machine.UB = UB;
|
||||
|
||||
/*
|
||||
r1.qe.qh = 1.0;
|
||||
r1.qe.qk = .0;
|
||||
r1.qe.ql = .0;
|
||||
|
||||
r2.qe.qh = .0;
|
||||
r2.qe.qk = 1.0;
|
||||
r2.qe.ql = .0;
|
||||
|
||||
self->machine.planeNormal = calcPlaneNormalQ(UB,r1,r2);
|
||||
self->machine.planeNormal[0][0] = -Sind(sgl);
|
||||
self->machine.planeNormal[1][0] = Cosd(sgl)*Sind(sgu);
|
||||
self->machine.planeNormal[2][0] = Cosd(sgl)*Cosd(sgu);
|
||||
SCPrintf(pCon,eValue,"Normal = %f,%f,%f\n", self->machine.planeNormal[0][0],
|
||||
self->machine.planeNormal[1][0],
|
||||
self->machine.planeNormal[2][0]);
|
||||
|
||||
self->machine.planeNormal = calcTestNormal(sgu,sgl);
|
||||
SCPrintf(pCon,eValue,"Alternative normal = %f,%f,%f\n", self->machine.planeNormal[0][0],
|
||||
self->machine.planeNormal[1][0],
|
||||
self->machine.planeNormal[2][0]);
|
||||
*/
|
||||
self->machine.planeNormal[0][0] = .0;
|
||||
self->machine.planeNormal[1][0] = .0;
|
||||
self->machine.planeNormal[2][0] = 1.0;
|
||||
|
||||
|
||||
SCSendOK(pCon);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
static int calcRefAngles(ptasUB self, SConnection * pCon,
|
||||
@ -1409,7 +1477,7 @@ static int calcRefAngles(ptasUB self, SConnection * pCon,
|
||||
snprintf(pBueffel, 255, " %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f",
|
||||
angles.monochromator_two_theta,
|
||||
angles.a3, angles.sample_two_theta,
|
||||
angles.sgl, angles.sgu, angles.analyzer_two_theta);
|
||||
angles.sgu, angles.sgl, angles.analyzer_two_theta);
|
||||
} else {
|
||||
snprintf(pBueffel, 255, " %8.2f %8.2f %8.2f %8.2f %8.2f",
|
||||
angles.monochromator_two_theta,
|
||||
@ -1941,6 +2009,8 @@ int TasUBWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
return addAuxReflection(self, pCon, pSics, argc, argv);
|
||||
} else if (strcmp(argv[1], "makeubfromcell") == 0) {
|
||||
return calcUBFromCell(self, pCon);
|
||||
} else if (strcmp(argv[1], "maketestub") == 0) {
|
||||
return calcTestUBWrap(self, pCon, argc, argv);
|
||||
} else if (strcmp(argv[1], "calcang") == 0) {
|
||||
return calcRefAngles(self, pCon, pSics, argc, argv);
|
||||
} else if (strcmp(argv[1], "calcqe") == 0) {
|
||||
|
Reference in New Issue
Block a user