- Removed old code
- Extended tasker to support task groups - Added task functions for motors and counters - Modifed devexec to use the new task functions - Modified TAS to treat the monochromator separatly - Coded a EIGER monochromator module to reflect even more new requirements - Added EPICS counters and motors - Modified multicounter to be better performing SKIPPED: psi/eigermono.c psi/make_gen psi/makefile_linux psi/psi.c psi/sinqhttp.c
This commit is contained in:
164
tasdrive.c
164
tasdrive.c
@ -227,7 +227,16 @@ static int TASHalt(void *pData)
|
||||
if (self->math->tasMode == ELASTIC) {
|
||||
length = 8;
|
||||
}
|
||||
for (i = 0; i < length; i++) {
|
||||
|
||||
/*
|
||||
stop monochromator
|
||||
*/
|
||||
self->math->mono->Halt(self->math->monoData);
|
||||
|
||||
/*
|
||||
stop rest
|
||||
*/
|
||||
for (i = 4; i < length; i++) {
|
||||
if (self->math->motors[i] != NULL) {
|
||||
pDriv = GetDrivableInterface(self->math->motors[i]);
|
||||
pDriv->Halt(self->math->motors[i]);
|
||||
@ -295,8 +304,8 @@ static int startTASMotor(pMotor mot, SConnection * pCon, char *name,
|
||||
to force updates on targets
|
||||
*/
|
||||
InvokeNewTarget(pServ->pExecutor, name, target);
|
||||
writeMotPos(pCon, silent, name, val, target);
|
||||
}
|
||||
writeMotPos(pCon, silent, name, val, target);
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -313,39 +322,43 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
/*
|
||||
monochromator
|
||||
*/
|
||||
status = startTASMotor(self->math->motors[A1], pCon, "a1",
|
||||
angles.monochromator_two_theta / 2., silent, stopFixed);
|
||||
if (status != OKOK) {
|
||||
/* status = startTASMotor(self->math->motors[A1], pCon, "a1", */
|
||||
/* angles.monochromator_two_theta / 2., silent, stopFixed); */
|
||||
/* if (status != OKOK) { */
|
||||
/* return status; */
|
||||
/* } */
|
||||
/* status = startTASMotor(self->math->motors[A2], pCon, "a2", */
|
||||
/* angles.monochromator_two_theta, silent,stopFixed); */
|
||||
/* if (status != OKOK) { */
|
||||
/* return status; */
|
||||
/* } */
|
||||
|
||||
/* if (self->math->motors[MCV] != NULL) { */
|
||||
/* curve = maCalcVerticalCurvature(self->math->machine.monochromator, */
|
||||
/* angles.monochromator_two_theta); */
|
||||
/* status = startTASMotor(self->math->motors[MCV], pCon, "mcv", */
|
||||
/* curve, silent,stopFixed); */
|
||||
/* if (status != OKOK) { */
|
||||
/* SCWrite(pCon,"WARNING: monochromator vertical curvature motor failed to start", eLog); */
|
||||
/* SCSetInterrupt(pCon,eContinue); */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* if (self->math->motors[MCH] != NULL) { */
|
||||
/* curve = maCalcHorizontalCurvature(self->math->machine.monochromator, */
|
||||
/* angles.monochromator_two_theta); */
|
||||
/* status = startTASMotor(self->math->motors[MCH], pCon, "mch", */
|
||||
/* curve, silent,stopFixed); */
|
||||
/* if (status != OKOK) { */
|
||||
/* SCWrite(pCon,"WARNING: monochromator horizontal curvature motor failed to start", eLog); */
|
||||
/* SCSetInterrupt(pCon,eContinue); */
|
||||
/* } */
|
||||
/* } */
|
||||
status = self->math->mono->SetValue(self->math->monoData,
|
||||
pCon,angles.monochromator_two_theta);
|
||||
if(status != OKOK){
|
||||
return status;
|
||||
}
|
||||
status = startTASMotor(self->math->motors[A2], pCon, "a2",
|
||||
angles.monochromator_two_theta, silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
if (self->math->motors[MCV] != NULL) {
|
||||
curve = maCalcVerticalCurvature(self->math->machine.monochromator,
|
||||
angles.monochromator_two_theta);
|
||||
status = startTASMotor(self->math->motors[MCV], pCon, "mcv",
|
||||
curve, silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
SCWrite(pCon,"WARNING: monochromator vertical curvature motor failed to start", eLog);
|
||||
SCSetInterrupt(pCon,eContinue);
|
||||
}
|
||||
}
|
||||
|
||||
if (self->math->motors[MCH] != NULL) {
|
||||
curve = maCalcHorizontalCurvature(self->math->machine.monochromator,
|
||||
angles.monochromator_two_theta);
|
||||
status = startTASMotor(self->math->motors[MCH], pCon, "mch",
|
||||
curve, silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
SCWrite(pCon,"WARNING: monochromator horizontal curvature motor failed to start", eLog);
|
||||
SCSetInterrupt(pCon,eContinue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
analyzer
|
||||
@ -491,24 +504,24 @@ static int calculateAndDrive(ptasMot self, SConnection * pCon)
|
||||
|
||||
switch (status) {
|
||||
case ENERGYTOBIG:
|
||||
SCWrite(pCon, "ERROR: desired energy to big", eError);
|
||||
SCWrite(pCon, "ERROR: desired energy to big", eLogError);
|
||||
return HWFault;
|
||||
break;
|
||||
case UBNOMEMORY:
|
||||
SCWrite(pCon, "ERROR: out of memory calculating angles", eError);
|
||||
SCWrite(pCon, "ERROR: out of memory calculating angles", eLogError);
|
||||
driveQ = 0;
|
||||
break;
|
||||
case BADRMATRIX:
|
||||
SCWrite(pCon, "ERROR: bad crystallographic parameters or bad UB",
|
||||
eError);
|
||||
eLogError);
|
||||
driveQ = 0;
|
||||
break;
|
||||
case BADUBORQ:
|
||||
SCWrite(pCon, "ERROR: bad UB matrix or bad Q-vector", eError);
|
||||
SCWrite(pCon, "ERROR: bad UB matrix or bad Q-vector", eLogError);
|
||||
driveQ = 0;
|
||||
break;
|
||||
case TRIANGLENOTCLOSED:
|
||||
SCWrite(pCon, "ERROR: cannot close scattering triangle", eError);
|
||||
SCWrite(pCon, "ERROR: cannot close scattering triangle", eLogError);
|
||||
driveQ = 0;
|
||||
break;
|
||||
}
|
||||
@ -546,7 +559,7 @@ static int calculateAndDrive(ptasMot self, SConnection * pCon)
|
||||
|
||||
if (driveQ == 0 && self->math->mustDriveQ == 1) {
|
||||
SCWrite(pCon, "WARNING: NOT driving Q-vector because of errors",
|
||||
eError);
|
||||
eLogError);
|
||||
}
|
||||
/*
|
||||
* reset the Q flag
|
||||
@ -577,7 +590,20 @@ static int checkMotors(ptasMot self, SConnection * pCon)
|
||||
mask[SGL] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
/*
|
||||
check monochromator
|
||||
*/
|
||||
status = self->math->mono->CheckStatus(self->math->monoData,pCon);
|
||||
if(status == HWIdle){
|
||||
for(i = 0; i < 4; i++){
|
||||
busy[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
check the rest
|
||||
*/
|
||||
for (i = 4; i < 12; i++) {
|
||||
if(self->math->motors[i] == NULL){
|
||||
busy[i] = 0;
|
||||
} else {
|
||||
@ -635,35 +661,39 @@ static int startQMMotors(ptasMot self, tasAngles angles,
|
||||
/*
|
||||
monochromator
|
||||
*/
|
||||
status = startTASMotor(self->math->motors[A1], pCon, "a1",
|
||||
angles.monochromator_two_theta / 2., silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
}
|
||||
status = startTASMotor(self->math->motors[A2], pCon, "a2",
|
||||
angles.monochromator_two_theta, silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
}
|
||||
/* status = startTASMotor(self->math->motors[A1], pCon, "a1", */
|
||||
/* angles.monochromator_two_theta / 2., silent,stopFixed); */
|
||||
/* if (status != OKOK) { */
|
||||
/* return status; */
|
||||
/* } */
|
||||
/* status = startTASMotor(self->math->motors[A2], pCon, "a2", */
|
||||
/* angles.monochromator_two_theta, silent,stopFixed); */
|
||||
/* if (status != OKOK) { */
|
||||
/* return status; */
|
||||
/* } */
|
||||
|
||||
if (self->math->motors[MCV] != NULL) {
|
||||
curve = maCalcVerticalCurvature(self->math->machine.monochromator,
|
||||
angles.monochromator_two_theta);
|
||||
status = startTASMotor(self->math->motors[MCV], pCon, "mcv",
|
||||
curve, silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
/* if (self->math->motors[MCV] != NULL) { */
|
||||
/* curve = maCalcVerticalCurvature(self->math->machine.monochromator, */
|
||||
/* angles.monochromator_two_theta); */
|
||||
/* status = startTASMotor(self->math->motors[MCV], pCon, "mcv", */
|
||||
/* curve, silent,stopFixed); */
|
||||
/* if (status != OKOK) { */
|
||||
/* return status; */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
if (self->math->motors[MCH] != NULL) {
|
||||
curve = maCalcHorizontalCurvature(self->math->machine.monochromator,
|
||||
angles.monochromator_two_theta);
|
||||
status = startTASMotor(self->math->motors[MCH], pCon, "mch",
|
||||
curve, silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
}
|
||||
/* if (self->math->motors[MCH] != NULL) { */
|
||||
/* curve = maCalcHorizontalCurvature(self->math->machine.monochromator, */
|
||||
/* angles.monochromator_two_theta); */
|
||||
/* status = startTASMotor(self->math->motors[MCH], pCon, "mch", */
|
||||
/* curve, silent,stopFixed); */
|
||||
/* if (status != OKOK) { */
|
||||
/* return status; */
|
||||
/* } */
|
||||
/* } */
|
||||
status = self->math->mono->SetValue(self->math->monoData,pCon,angles.analyzer_two_theta);
|
||||
if(status != OKOK){
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user