Cleaned up ANSTO code to merge with sinqdev.sics
This is our new RELEASE-4_0 branch which was taken from ansto/93d9a7c Conflicts: .gitignore SICSmain.c asynnet.c confvirtualmot.c counter.c devexec.c drive.c event.h exebuf.c exeman.c histmem.c interface.h motor.c motorlist.c motorsec.c multicounter.c napi.c napi.h napi4.c network.c nwatch.c nxscript.c nxxml.c nxxml.h ofac.c reflist.c scan.c sicshipadaba.c sicsobj.c site_ansto/docs/Copyright.txt site_ansto/instrument/lyrebird/config/tasmad/sicscommon/nxsupport.tcl site_ansto/instrument/lyrebird/config/tasmad/taspub_sics/tasscript.tcl statusfile.c tasdrive.c tasub.c tasub.h tasublib.c tasublib.h
This commit is contained in:
327
tasdrive.c
327
tasdrive.c
@@ -5,12 +5,14 @@
|
||||
|
||||
Mark Koennecke, May 2005
|
||||
|
||||
In the long run it might be useful to switch all this to the more
|
||||
general motor list driving code.
|
||||
|
||||
Modified to rather use drivables then motors
|
||||
|
||||
Mark Koennecke, September 2011
|
||||
|
||||
Modified to use drive tasks
|
||||
|
||||
Mark Koennecke, January 2014
|
||||
--------------------------------------------------------------------*/
|
||||
#include <assert.h>
|
||||
#include "sics.h"
|
||||
@@ -39,9 +41,9 @@
|
||||
static long TASSetValue(void *pData, SConnection * pCon, float value)
|
||||
{
|
||||
ptasMot self = (ptasMot) pData;
|
||||
assert(self);
|
||||
int qcodes[] = {3,4,5,8}; /* qh,qk,ql, en */
|
||||
int i;
|
||||
assert(self);
|
||||
|
||||
if (self->code > 5 && self->math->tasMode == ELASTIC) {
|
||||
SCWrite(pCon, "ERROR: cannot drive this motor in elastic mode",
|
||||
@@ -59,7 +61,7 @@ static long TASSetValue(void *pData, SConnection * pCon, float value)
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
static int readTASMotAngles(ptasUB self, SConnection * pCon,
|
||||
int readTASMotAngles(ptasUB self, SConnection * pCon,
|
||||
ptasAngles ang)
|
||||
{
|
||||
int status;
|
||||
@@ -72,7 +74,12 @@ static int readTASMotAngles(ptasUB self, SConnection * pCon,
|
||||
if (status == 0) {
|
||||
return status;
|
||||
}
|
||||
theta = val;
|
||||
theta = val;/* $Id: tasdrive.c,v 1.39 2014/02/18 13:25:32 koennecke Exp $ */
|
||||
|
||||
#ifndef lint
|
||||
static char vcid[] = "$Id: tasdrive.c,v 1.39 2014/02/18 13:25:32 koennecke Exp $";
|
||||
#endif /* lint */
|
||||
|
||||
status = GetDrivablePosition(self->motors[A2], pCon, &val);
|
||||
if (status == 0) {
|
||||
return status;
|
||||
@@ -130,6 +137,10 @@ static int readTASMotAngles(ptasUB self, SConnection * pCon,
|
||||
return status;
|
||||
}
|
||||
ang->sgl = val;
|
||||
if(!self->outOfPlaneAllowed){
|
||||
ang->sgu = .0;
|
||||
ang->sgl = .0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -227,7 +238,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]);
|
||||
@@ -259,10 +279,9 @@ static float getMotorValue(pMotor mot, SConnection * pCon)
|
||||
}
|
||||
/*--------------------- In devexec.c --------------------------------------*/
|
||||
void InvokeNewTarget(pExeList self, char *name, float target);
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static int startTASMotor(pMotor mot, SConnection * pCon, char *name,
|
||||
double target, int silent, int stopFixed)
|
||||
double target, int silent, int stopFixed, long groupID)
|
||||
{
|
||||
float val, fixed, precision = MOTPREC;
|
||||
int status = OKOK;
|
||||
@@ -270,6 +289,7 @@ static int startTASMotor(pMotor mot, SConnection * pCon, char *name,
|
||||
pIDrivable pDriv = NULL;
|
||||
pDummy dum = NULL;
|
||||
pDynString mes = NULL;
|
||||
long taskID;
|
||||
|
||||
dum = (pDummy)mot;
|
||||
val = getMotorValue(mot, pCon);
|
||||
@@ -286,116 +306,117 @@ static int startTASMotor(pMotor mot, SConnection * pCon, char *name,
|
||||
}
|
||||
mot->stopped = 0;
|
||||
if (ABS(val - target) > precision) {
|
||||
pDriv = GetDrivableInterface(mot);
|
||||
status = pDriv->SetValue(mot, pCon, (float) target);
|
||||
if(status != OKOK){
|
||||
taskID = StartDriveTask(mot,pCon,name,target);
|
||||
if(taskID < 0){
|
||||
SCPrintf(pCon,eLog,"ERROR: failed to drive %s to %f", name, target);
|
||||
} else {
|
||||
AddTaskToGroup(pServ->pTasker,taskID, groupID);
|
||||
}
|
||||
/*
|
||||
to force updates on targets
|
||||
*/
|
||||
InvokeNewTarget(pServ->pExecutor, name, target);
|
||||
writeMotPos(pCon, silent, name, val, target);
|
||||
}
|
||||
writeMotPos(pCon, silent, name, val, target);
|
||||
return status;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
static int StartTASA3(pMotor mot, SConnection *pCon, char *name,
|
||||
double target, int silent, int stopFixed,
|
||||
long groupID)
|
||||
{
|
||||
float val;
|
||||
int status;
|
||||
char buffer[80];
|
||||
|
||||
val = getMotorValue(mot,pCon);
|
||||
if(ABS(target-val) > 190) {
|
||||
SCPrintf(pCon,eLog,"WARNING: driving a3 more then 190 degree: %f, please confirm with y",
|
||||
ABS(target-val));
|
||||
status = SCPromptTMO(pCon,NULL,buffer,sizeof(buffer),120);
|
||||
if(status == 1){
|
||||
if(buffer[0] == 'y'){
|
||||
return startTASMotor(mot,pCon,name,target,silent,stopFixed,groupID);
|
||||
}
|
||||
}
|
||||
SCWrite(pCon,"ERROR: no or wrong reply, aborting scan",eLogError);
|
||||
SCSetInterrupt(pCon,eAbortScan);
|
||||
return HWFault;
|
||||
} else {
|
||||
return startTASMotor(mot,pCon,name,target,silent,stopFixed,groupID);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int startMotors(ptasMot self, tasAngles angles,
|
||||
SConnection * pCon, int driveQ, int driveTilt)
|
||||
{
|
||||
double curve;
|
||||
int status, silent, stopFixed;
|
||||
long monoID;
|
||||
|
||||
silent = self->math->silent;
|
||||
stopFixed = self->math->stopFixed;
|
||||
self->math->mustRecalculate = 1;
|
||||
|
||||
self->math->groupID = GetTaskGroupID(pServ->pTasker);
|
||||
|
||||
/*
|
||||
monochromator
|
||||
*/
|
||||
status = startTASMotor(self->math->motors[A1], pCon, self->math->motname[A1],
|
||||
angles.monochromator_two_theta / 2., silent, stopFixed);
|
||||
if (status != OKOK) {
|
||||
status = self->math->mono->SetValue(self->math->monoData,
|
||||
pCon,angles.monochromator_two_theta);
|
||||
/*
|
||||
The call to CheckStatus is necessary because the eiger monochromator may not
|
||||
start until then. Deferred until all parameters are known.
|
||||
*/
|
||||
self->math->mono->CheckStatus(self->math->monoData,pCon);
|
||||
if(status != OKOK){
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[A1] = 1;
|
||||
AddTaskToGroup(pServ->pTasker, self->math->monoTaskID, self->math->groupID);
|
||||
}
|
||||
status = startTASMotor(self->math->motors[A2], pCon, self->math->motname[A2],
|
||||
angles.monochromator_two_theta, silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[A2] = 1;
|
||||
}
|
||||
|
||||
if (self->math->motors[MCV] != NULL && self->math->autofocus) {
|
||||
curve = maCalcVerticalCurvature(self->math->machine.monochromator,
|
||||
angles.monochromator_two_theta, getTasPar(self->math->target, EI), self->math->focusfn);
|
||||
status = startTASMotor(self->math->motors[MCV], pCon, self->math->motname[MCV],
|
||||
curve, silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
SCWrite(pCon,"WARNING: monochromator vertical curvature motor failed to start", eLog);
|
||||
SCSetInterrupt(pCon,eContinue);
|
||||
} else {
|
||||
self->math->busy[MCV] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (self->math->motors[MCH] != NULL && self->math->autofocus) {
|
||||
curve = maCalcHorizontalCurvature(self->math->machine.monochromator,
|
||||
angles.monochromator_two_theta, getTasPar(self->math->target, EI), self->math->focusfn);
|
||||
status = startTASMotor(self->math->motors[MCH], pCon, self->math->motname[MCH],
|
||||
curve, silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
SCWrite(pCon,"WARNING: monochromator horizontal curvature motor failed to start", eLog);
|
||||
SCSetInterrupt(pCon,eContinue);
|
||||
} else {
|
||||
self->math->busy[MCH] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* monoID = StartDriveTask(self->math->monoData, pCon,"mono", */
|
||||
/* angles.monochromator_two_theta); */
|
||||
/* self->math->mono->CheckStatus(self->math->monoData,pCon); */
|
||||
/* if(monoID < 0){ */
|
||||
/* SCWrite(pCon,"ERROR: failed to start monochromator",eLogError); */
|
||||
/* } else { */
|
||||
/* AddTaskToGroup(pServ->pTasker,monoID, self->math->groupID); */
|
||||
/* } */
|
||||
|
||||
/*
|
||||
analyzer
|
||||
*/
|
||||
if (self->math->tasMode != ELASTIC) {
|
||||
status = startTASMotor(self->math->motors[A5], pCon, self->math->motname[A5],
|
||||
angles.analyzer_two_theta / 2.0, silent,stopFixed);
|
||||
status = startTASMotor(self->math->motors[A5], pCon, "a5",
|
||||
angles.analyzer_two_theta / 2.0, silent,stopFixed,self->math->groupID);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[A5] = 1;
|
||||
}
|
||||
status = startTASMotor(self->math->motors[A6], pCon, self->math->motname[A6],
|
||||
angles.analyzer_two_theta, silent,stopFixed);
|
||||
status = startTASMotor(self->math->motors[A6], pCon, "a6",
|
||||
angles.analyzer_two_theta, silent,stopFixed,self->math->groupID);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[A6] = 1;
|
||||
}
|
||||
|
||||
if (self->math->motors[ACV] != NULL && self->math->autofocus) {
|
||||
if (self->math->motors[ACV] != NULL) {
|
||||
curve = maCalcVerticalCurvature(self->math->machine.analyzer,
|
||||
angles.analyzer_two_theta, getTasPar(self->math->target, EF), self->math->focusfn);
|
||||
status = startTASMotor(self->math->motors[ACV], pCon, self->math->motname[ACV],
|
||||
curve, silent,stopFixed);
|
||||
angles.analyzer_two_theta);
|
||||
status = startTASMotor(self->math->motors[ACV], pCon, "acv",
|
||||
curve, silent,stopFixed,self->math->groupID);
|
||||
if (status != OKOK) {
|
||||
SCWrite(pCon,"WARNING: analyzer vertical curvature motor failed to start", eLog);
|
||||
SCSetInterrupt(pCon,eContinue);
|
||||
} else {
|
||||
self->math->busy[ACV] = 1;
|
||||
}
|
||||
}
|
||||
if (self->math->motors[ACH] != NULL && self->math->autofocus) {
|
||||
if (self->math->motors[ACH] != NULL) {
|
||||
curve = maCalcHorizontalCurvature(self->math->machine.analyzer,
|
||||
angles.analyzer_two_theta, getTasPar(self->math->target, EF), self->math->focusfn);
|
||||
status = startTASMotor(self->math->motors[ACH], pCon, self->math->motname[ACH],
|
||||
curve, silent,stopFixed);
|
||||
angles.analyzer_two_theta);
|
||||
status = startTASMotor(self->math->motors[ACH], pCon, "ach",
|
||||
curve, silent,stopFixed,self->math->groupID);
|
||||
if (status != OKOK) {
|
||||
SCWrite(pCon,"WARNING: analyzer horizontal curvature motor failed to start", eLog);
|
||||
SCSetInterrupt(pCon,eContinue);
|
||||
} else {
|
||||
self->math->busy[ACH] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -407,35 +428,27 @@ static int startMotors(ptasMot self, tasAngles angles,
|
||||
/*
|
||||
crystal
|
||||
*/
|
||||
status = startTASMotor(self->math->motors[A3], pCon, self->math->motname[A3],
|
||||
angles.a3, silent,stopFixed);
|
||||
status = StartTASA3(self->math->motors[A3], pCon, "a3",
|
||||
angles.a3, silent,stopFixed,self->math->groupID);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[A3] = 1;
|
||||
}
|
||||
status = startTASMotor(self->math->motors[A4], pCon, self->math->motname[A4],
|
||||
angles.sample_two_theta, silent,stopFixed);
|
||||
status = startTASMotor(self->math->motors[A4], pCon, "a4",
|
||||
angles.sample_two_theta, silent,stopFixed,self->math->groupID);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[A4] = 1;
|
||||
}
|
||||
|
||||
if (driveTilt == 1) {
|
||||
status = startTASMotor(self->math->motors[SGL], pCon, self->math->motname[SGL],
|
||||
angles.sgl, silent,stopFixed);
|
||||
status = startTASMotor(self->math->motors[SGL], pCon, "sgl",
|
||||
angles.sgl, silent,stopFixed, self->math->groupID);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[SGL] = 1;
|
||||
}
|
||||
status = startTASMotor(self->math->motors[SGU], pCon, self->math->motname[SGU],
|
||||
angles.sgu, silent,stopFixed);
|
||||
status = startTASMotor(self->math->motors[SGU], pCon, "sgu",
|
||||
angles.sgu, silent,stopFixed,self->math->groupID);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[SGU] = 1;
|
||||
}
|
||||
}
|
||||
self->math->mustDrive = 0;
|
||||
@@ -459,7 +472,7 @@ static int checkQMotorLimits(ptasMot self, SConnection * pCon,
|
||||
angles.a3, error,131);
|
||||
if (status != 1) {
|
||||
retVal = 0;
|
||||
snprintf(pBueffel, 256, "ERROR: limit violation an %s: %s", self->math->motname[A3], error);
|
||||
snprintf(pBueffel, 256, "ERROR: limit violation an a3: %s", error);
|
||||
SCWrite(pCon, pBueffel, eLogError);
|
||||
}
|
||||
}
|
||||
@@ -471,7 +484,7 @@ static int checkQMotorLimits(ptasMot self, SConnection * pCon,
|
||||
error, 131);
|
||||
if (status != 1) {
|
||||
retVal = 0;
|
||||
snprintf(pBueffel, 256, "ERROR: limit violation an %s: %s", self->math->motname[A4], error);
|
||||
snprintf(pBueffel, 256, "ERROR: limit violation an a4: %s", error);
|
||||
SCWrite(pCon, pBueffel, eLogError);
|
||||
}
|
||||
|
||||
@@ -482,7 +495,7 @@ static int checkQMotorLimits(ptasMot self, SConnection * pCon,
|
||||
131);
|
||||
if (status != 1) {
|
||||
retVal = 0;
|
||||
snprintf(pBueffel, 256, "ERROR: limit violation an %s: %s", self->math->motname[SGU], error);
|
||||
snprintf(pBueffel, 256, "ERROR: limit violation an SGU: %s", error);
|
||||
SCWrite(pCon, pBueffel, eLogError);
|
||||
}
|
||||
|
||||
@@ -492,7 +505,7 @@ static int checkQMotorLimits(ptasMot self, SConnection * pCon,
|
||||
131);
|
||||
if (status != 1) {
|
||||
retVal = 0;
|
||||
snprintf(pBueffel, 256, "ERROR: limit violation an %s: %s", self->math->motname[SGU], error);
|
||||
snprintf(pBueffel, 256, "ERROR: limit violation an SGL: %s", error);
|
||||
SCWrite(pCon, pBueffel, eLogError);
|
||||
}
|
||||
}
|
||||
@@ -515,24 +528,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;
|
||||
}
|
||||
@@ -570,7 +583,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
|
||||
@@ -582,39 +595,13 @@ static int calculateAndDrive(ptasMot self, SConnection * pCon)
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
static int checkMotors(ptasMot self, SConnection * pCon)
|
||||
{
|
||||
int i, status, length = 12, count;
|
||||
int mask[12];
|
||||
pIDrivable pDrivInt = NULL;
|
||||
|
||||
self->math->mustRecalculate = 1;
|
||||
if (self->math->tasMode == ELASTIC) {
|
||||
length = 8;
|
||||
}
|
||||
memset(mask, 0, 12 * sizeof(int));
|
||||
for (i = 0; i < length; i++) {
|
||||
mask[i] = 1;
|
||||
}
|
||||
if (self->math->outOfPlaneAllowed == 0) {
|
||||
mask[SGU] = 0;
|
||||
mask[SGL] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 12; i++) {
|
||||
if(mask[i] != 0 && self->math->busy[i] != 0) {
|
||||
pDrivInt = GetDrivableInterface(self->math->motors[i]);
|
||||
status = pDrivInt->CheckStatus(self->math->motors[i], pCon);
|
||||
if(status == HWIdle || status == OKOK || status == HWFault || status == HWPosFault){
|
||||
self->math->busy[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i = 0, count = 0; i < 12; i++){
|
||||
count += self->math->busy[i];
|
||||
}
|
||||
if(count == 0) {
|
||||
return HWIdle;
|
||||
} else {
|
||||
if(isTaskGroupRunning(pServ->pTasker,self->math->groupID) ||
|
||||
isTaskGroupRunning(pServ->pTasker,self->math->monoTaskID)){
|
||||
return HWBusy;
|
||||
} else {
|
||||
return HWIdle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -648,99 +635,61 @@ static int startQMMotors(ptasMot self, tasAngles angles,
|
||||
|
||||
silent = self->math->silent;
|
||||
stopFixed = self->math->stopFixed;
|
||||
|
||||
self->math->groupID = GetTaskGroupID(pServ->pTasker);
|
||||
|
||||
/*
|
||||
monochromator
|
||||
*/
|
||||
status = startTASMotor(self->math->motors[A1], pCon, self->math->motname[A1],
|
||||
angles.monochromator_two_theta / 2., silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
monochromator
|
||||
*/
|
||||
status = self->math->mono->SetValue(self->math->monoData,
|
||||
pCon,angles.monochromator_two_theta);
|
||||
if(status != OKOK){
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[A1] = 1;
|
||||
}
|
||||
status = startTASMotor(self->math->motors[A2], pCon, self->math->motname[A2],
|
||||
angles.monochromator_two_theta, silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[A2] = 1;
|
||||
}
|
||||
|
||||
if (self->math->motors[MCV] != NULL && self->math->autofocus) {
|
||||
curve = maCalcVerticalCurvature(self->math->machine.monochromator,
|
||||
angles.monochromator_two_theta, getTasPar(self->math->target, EI), self->math->focusfn);
|
||||
status = startTASMotor(self->math->motors[MCV], pCon, self->math->motname[MCV],
|
||||
curve, silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[MCV] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (self->math->motors[MCH] != NULL && self->math->autofocus) {
|
||||
curve = maCalcHorizontalCurvature(self->math->machine.monochromator,
|
||||
angles.monochromator_two_theta, getTasPar(self->math->target, EI), self->math->focusfn);
|
||||
status = startTASMotor(self->math->motors[MCH], pCon, self->math->motname[MCH],
|
||||
curve, silent,stopFixed);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[MCH] = 1;
|
||||
}
|
||||
AddTaskToGroup(pServ->pTasker, self->math->monoTaskID, self->math->groupID);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
analyzer
|
||||
*/
|
||||
status = startTASMotor(self->math->motors[A5], pCon, self->math->motname[A5],
|
||||
angles.analyzer_two_theta / 2.0, silent,stopFixed);
|
||||
status = startTASMotor(self->math->motors[A5], pCon, "a5",
|
||||
angles.analyzer_two_theta / 2.0, silent,stopFixed,self->math->groupID);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[A5] = 1;
|
||||
}
|
||||
status = startTASMotor(self->math->motors[A6], pCon, self->math->motname[A6],
|
||||
angles.analyzer_two_theta, silent,stopFixed);
|
||||
status = startTASMotor(self->math->motors[A6], pCon, "a6",
|
||||
angles.analyzer_two_theta, silent,stopFixed,self->math->groupID);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[A6] = 1;
|
||||
}
|
||||
|
||||
if (self->math->motors[ACV] != NULL && self->math->autofocus) {
|
||||
if (self->math->motors[ACV] != NULL) {
|
||||
curve = maCalcVerticalCurvature(self->math->machine.analyzer,
|
||||
angles.analyzer_two_theta, getTasPar(self->math->target, EF), self->math->focusfn);
|
||||
status = startTASMotor(self->math->motors[ACV], pCon, self->math->motname[ACV],
|
||||
curve, silent,stopFixed);
|
||||
angles.analyzer_two_theta);
|
||||
status = startTASMotor(self->math->motors[ACV], pCon, "acv",
|
||||
curve, silent,stopFixed,self->math->groupID);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[ACV] = 1;
|
||||
}
|
||||
}
|
||||
if (self->math->motors[ACH] != NULL && self->math->autofocus) {
|
||||
if (self->math->motors[ACH] != NULL) {
|
||||
curve = maCalcHorizontalCurvature(self->math->machine.analyzer,
|
||||
angles.analyzer_two_theta, getTasPar(self->math->target, EF), self->math->focusfn);
|
||||
status = startTASMotor(self->math->motors[ACH], pCon, self->math->motname[ACH],
|
||||
curve, silent,stopFixed);
|
||||
angles.analyzer_two_theta);
|
||||
status = startTASMotor(self->math->motors[ACH], pCon, "ach",
|
||||
curve, silent,stopFixed,self->math->groupID);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[ACH] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
crystal
|
||||
*/
|
||||
status = startTASMotor(self->math->motors[A4], pCon, self->math->motname[A4],
|
||||
angles.sample_two_theta, silent,stopFixed);
|
||||
status = startTASMotor(self->math->motors[A4], pCon, "a4",
|
||||
angles.sample_two_theta, silent,stopFixed,self->math->groupID);
|
||||
if (status != OKOK) {
|
||||
return status;
|
||||
} else {
|
||||
self->math->busy[A4] = 1;
|
||||
}
|
||||
|
||||
self->math->mustDrive = 0;
|
||||
@@ -757,11 +706,11 @@ static int calculateQMAndDrive(ptasMot self, SConnection * pCon)
|
||||
&angles);
|
||||
switch (status) {
|
||||
case ENERGYTOBIG:
|
||||
SCWrite(pCon, "ERROR: desired energy to big", eError);
|
||||
SCWrite(pCon, "ERROR: desired energy to big", eLogError);
|
||||
return HWFault;
|
||||
break;
|
||||
case TRIANGLENOTCLOSED:
|
||||
SCWrite(pCon, "ERROR: cannot close scattering triangle", eError);
|
||||
SCWrite(pCon, "ERROR: cannot close scattering triangle", eLogError);
|
||||
return HWFault;
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user