- Fixes to hkl code
- Fixes to make RITA work - tasub extended to calculate UB from cell alone, support for elastic mode - New MultiCounter as abstraction for counting on HM's - regression test driver for counters
This commit is contained in:
44
tasdrive.c
44
tasdrive.c
@@ -34,6 +34,11 @@ static long TASSetValue(void *pData, SConnection *pCon,
|
||||
ptasMot self = (ptasMot)pData;
|
||||
assert(self);
|
||||
|
||||
if(self->code > 5 && self->math->tasMode == ELASTIC){
|
||||
SCWrite(pCon,"ERROR: cannot drive this motor in elastic mode",
|
||||
eError);
|
||||
return HWFault;
|
||||
}
|
||||
setTasPar(&self->math->target,self->math->tasMode,self->code,value);
|
||||
self->math->mustDrive = 1;
|
||||
return OKOK;
|
||||
@@ -132,6 +137,10 @@ static float TASGetValue(void *pData, SConnection *pCon){
|
||||
self->math->mustRecalculate = 0;
|
||||
}
|
||||
val = getTasPar(self->math->current,self->code);
|
||||
if(self->code > 5 && self->math->tasMode == ELASTIC){
|
||||
SCWrite(pCon,"WARNING: value for this motor is meaningless in elastic mode",
|
||||
eWarning);
|
||||
}
|
||||
return (float)val;
|
||||
}
|
||||
/*-----------------------------------------------------------------*/
|
||||
@@ -202,6 +211,13 @@ static void writeMotPos(SConnection *pCon, int silent, char *name,
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
}
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static float getMotorValue(pMotor mot, SConnection *pCon){
|
||||
float val;
|
||||
|
||||
MotorGetSoftPosition(mot,pCon,&val);
|
||||
return val;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int startMotors(ptasMot self, tasAngles angles,
|
||||
SConnection *pCon, int driveQ, int driveTilt){
|
||||
@@ -213,7 +229,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
/*
|
||||
monochromator
|
||||
*/
|
||||
val = self->math->motors[A1]->pDrivInt->GetValue(self->math->motors[A1],pCon);
|
||||
val = getMotorValue(self->math->motors[A1],pCon);
|
||||
if(ABS(val - angles.monochromator_two_theta/2.) > MOTPREC){
|
||||
status = self->math->motors[A1]->pDrivInt->SetValue(self->math->motors[A1],
|
||||
pCon,
|
||||
@@ -224,7 +240,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
}
|
||||
writeMotPos(pCon,silent,"a1",val, angles.monochromator_two_theta/2.);
|
||||
|
||||
val = self->math->motors[A2]->pDrivInt->GetValue(self->math->motors[A2],pCon);
|
||||
val = getMotorValue(self->math->motors[A2],pCon);
|
||||
if(ABS(val - angles.monochromator_two_theta) > MOTPREC){
|
||||
status = self->math->motors[A2]->pDrivInt->SetValue(self->math->motors[A2],
|
||||
pCon,
|
||||
@@ -238,7 +254,8 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
if(self->math->motors[MCV] != NULL){
|
||||
curve = maCalcVerticalCurvature(self->math->machine.monochromator,
|
||||
angles.monochromator_two_theta);
|
||||
val = self->math->motors[MCV]->pDrivInt->GetValue(self->math->motors[MCV],pCon);
|
||||
|
||||
val = getMotorValue(self->math->motors[MCV],pCon);
|
||||
if(ABS(val - curve) > MOTPREC){
|
||||
status = self->math->motors[MCV]->pDrivInt->SetValue(self->math->motors[MCV],
|
||||
pCon,
|
||||
@@ -253,7 +270,8 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
if(self->math->motors[MCH] != NULL){
|
||||
curve = maCalcHorizontalCurvature(self->math->machine.monochromator,
|
||||
angles.monochromator_two_theta);
|
||||
val = self->math->motors[MCH]->pDrivInt->GetValue(self->math->motors[MCH],pCon);
|
||||
|
||||
val = getMotorValue(self->math->motors[MCH],pCon);
|
||||
if(ABS(val - curve) > MOTPREC){
|
||||
status = self->math->motors[MCH]->pDrivInt->SetValue(self->math->motors[MCH],
|
||||
pCon,
|
||||
@@ -269,8 +287,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
analyzer
|
||||
*/
|
||||
if(self->math->tasMode != ELASTIC){
|
||||
val = self->math->motors[A5]->pDrivInt->GetValue(self->math->motors[A5],
|
||||
pCon);
|
||||
val = getMotorValue(self->math->motors[A5],pCon);
|
||||
if(ABS(val - angles.analyzer_two_theta/2.) > MOTPREC){
|
||||
status = self->math->motors[A5]->pDrivInt->SetValue(self->math->motors[A5],
|
||||
pCon,
|
||||
@@ -282,7 +299,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
writeMotPos(pCon,silent,self->math->motors[A5]->name,
|
||||
val, angles.analyzer_two_theta/2.);
|
||||
|
||||
val = self->math->motors[A6]->pDrivInt->GetValue(self->math->motors[A6],pCon);
|
||||
val = getMotorValue(self->math->motors[A6],pCon);
|
||||
if(ABS(val - angles.analyzer_two_theta) > MOTPREC){
|
||||
status = self->math->motors[A6]->pDrivInt->SetValue(self->math->motors[A6],
|
||||
pCon,
|
||||
@@ -296,7 +313,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
if(self->math->motors[ACV] != NULL){
|
||||
curve = maCalcVerticalCurvature(self->math->machine.analyzer,
|
||||
angles.analyzer_two_theta);
|
||||
val = self->math->motors[ACV]->pDrivInt->GetValue(self->math->motors[ACV],pCon);
|
||||
val = getMotorValue(self->math->motors[ACV],pCon);
|
||||
if(ABS(val - curve) > MOTPREC){
|
||||
status = self->math->motors[ACV]->pDrivInt->SetValue(self->math->motors[ACV],
|
||||
pCon,
|
||||
@@ -310,8 +327,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
if(self->math->motors[ACH] != NULL){
|
||||
curve = maCalcHorizontalCurvature(self->math->machine.analyzer,
|
||||
angles.analyzer_two_theta);
|
||||
val = self->math->motors[ACH]->pDrivInt->GetValue(self->math->motors[ACH],
|
||||
pCon);
|
||||
val = getMotorValue(self->math->motors[ACH],pCon);
|
||||
if(ABS(val - curve) > MOTPREC){
|
||||
status = self->math->motors[ACH]->pDrivInt->SetValue(self->math->motors[ACH],
|
||||
pCon,
|
||||
@@ -331,7 +347,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
/*
|
||||
crystal
|
||||
*/
|
||||
val = self->math->motors[A3]->pDrivInt->GetValue(self->math->motors[A3],pCon);
|
||||
val = getMotorValue(self->math->motors[A3],pCon);
|
||||
if(ABS(val - angles.a3) > MOTPREC){
|
||||
status = self->math->motors[A3]->pDrivInt->SetValue(self->math->motors[A3],
|
||||
pCon,
|
||||
@@ -342,7 +358,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
}
|
||||
writeMotPos(pCon,silent,"a3",val, angles.a3);
|
||||
|
||||
val = self->math->motors[A4]->pDrivInt->GetValue(self->math->motors[A4],pCon);
|
||||
val = getMotorValue(self->math->motors[A4],pCon);
|
||||
if(ABS(val - angles.sample_two_theta) > MOTPREC){
|
||||
status = self->math->motors[A4]->pDrivInt->SetValue(self->math->motors[A4],
|
||||
pCon,
|
||||
@@ -354,7 +370,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
writeMotPos(pCon,silent,"a4",val, angles.sample_two_theta);
|
||||
|
||||
if(driveTilt == 1){
|
||||
val = self->math->motors[SGL]->pDrivInt->GetValue(self->math->motors[SGL],pCon);
|
||||
val = getMotorValue(self->math->motors[SGL],pCon);
|
||||
if(ABS(val - angles.sgl) > MOTPREC){
|
||||
status = self->math->motors[SGL]->pDrivInt->SetValue(self->math->motors[SGL],
|
||||
pCon,
|
||||
@@ -365,7 +381,7 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
}
|
||||
writeMotPos(pCon,silent,"sgl",val, angles.sgl);
|
||||
|
||||
val = self->math->motors[SGU]->pDrivInt->GetValue(self->math->motors[SGU],pCon);
|
||||
val = getMotorValue(self->math->motors[SGU],pCon);
|
||||
if(ABS(val - angles.sgu) > MOTPREC){
|
||||
status = self->math->motors[SGU]->pDrivInt->SetValue(self->math->motors[SGU],
|
||||
pCon,
|
||||
|
||||
Reference in New Issue
Block a user