- Added tabledrive: table driven path for MARS

- Initial MARS development
- Upgraded Manager Manual


SKIPPED:
	psi/make_gen
	psi/psi.c
	psi/tabledrive.c
	psi/tabledrive.h
	psi/tabledrive.w
	psi/utils/SerPortServer.c
This commit is contained in:
koennecke
2005-07-22 14:56:18 +00:00
parent d96fb7377d
commit 76abbe1042
39 changed files with 1822 additions and 672 deletions

View File

@ -64,20 +64,23 @@ static int readTASMotAngles(ptasUB self, SConnection *pCon,
/*
Analyzer
*/
status = MotorGetSoftPosition(self->motors[A5],pCon,&val);
if(status == 0){
return status;
if(self->tasMode != ELASTIC){
status = MotorGetSoftPosition(self->motors[A5],pCon,&val);
if(status == 0){
return status;
}
theta = val;
status = MotorGetSoftPosition(self->motors[A6],pCon,&val);
if(status == 0){
return status;
}
ang->analyzer_two_theta = val;
if(ABS(val/2. - theta) > .1){
SCWrite(pCon,"WARNING: theta analyzer not half of two theta",eWarning);
}
} else {
ang->analyzer_two_theta = ang->monochromator_two_theta;
}
theta = val;
status = MotorGetSoftPosition(self->motors[A6],pCon,&val);
if(status == 0){
return status;
}
ang->analyzer_two_theta = val;
if(ABS(val/2. - theta) > .1){
SCWrite(pCon,"WARNING: theta analyzer not half of two theta",eWarning);
}
/*
crystal
@ -123,6 +126,9 @@ static float TASGetValue(void *pData, SConnection *pCon){
SCWrite(pCon,"ERROR: out of memory calculating Q-E variables",eError);
return -999.99;
}
if(self->math->tasMode == ELASTIC){
self->math->current.kf = self->math->current.ki;
}
self->math->mustRecalculate = 0;
}
val = getTasPar(self->math->current,self->code);
@ -148,6 +154,9 @@ static float TASQMGetValue(void *pData, SConnection *pCon){
SCWrite(pCon,"ERROR: out of memory calculating Q-E variables",eError);
return -999.99;
}
if(self->math->tasMode == ELASTIC){
self->math->current.kf = self->math->current.ki;
}
self->math->mustRecalculate = 0;
}
val = getTasPar(self->math->current,self->code);
@ -165,10 +174,16 @@ static int TASCheckLimits(void *pData, float fVal, char *error, int iErrLen){
/*---------------------------------------------------------------------------------*/
static int TASHalt(void *pData){
ptasMot self = (ptasMot)pData;
int i;
int i, length = 12;
assert(self);
for(i = 0; i < 12; i++){
/**
* disregard non existing analyzer motors
*/
if(self->math->tasMode == ELASTIC){
length = 8;
}
for(i = 0; i < length; i++){
if(self->math->motors[i] != NULL){
self->math->motors[i]->pDrivInt->Halt(self->math->motors[i]);
}
@ -233,50 +248,55 @@ static int startMotors(ptasMot self, tasAngles angles,
/*
analyzer
*/
val = self->math->motors[A5]->pDrivInt->GetValue(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,
angles.analyzer_two_theta/2.);
if(status != OKOK){
return status;
}
}
val = self->math->motors[A6]->pDrivInt->GetValue(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,
angles.analyzer_two_theta);
if(status != OKOK){
return status;
}
}
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);
if(ABS(val - curve) > MOTPREC){
status = self->math->motors[ACV]->pDrivInt->SetValue(self->math->motors[ACV],
pCon,
curve);
if(status != OKOK){
return status;
}
}
}
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);
if(ABS(val - curve) > MOTPREC){
status = self->math->motors[ACH]->pDrivInt->SetValue(self->math->motors[ACH],
pCon,
curve);
if(status != OKOK){
return status;
}
}
if(self->math->tasMode != ELASTIC){
val = self->math->motors[A5]->pDrivInt->GetValue(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,
angles.analyzer_two_theta/2.);
if(status != OKOK){
return status;
}
}
val = self->math->motors[A6]->pDrivInt->GetValue(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,
angles.analyzer_two_theta);
if(status != OKOK){
return status;
}
}
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);
if(ABS(val - curve) > MOTPREC){
status = self->math->motors[ACV]->pDrivInt->SetValue(self->math->motors[ACV],
pCon,
curve);
if(status != OKOK){
return status;
}
}
}
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);
if(ABS(val - curve) > MOTPREC){
status = self->math->motors[ACH]->pDrivInt->SetValue(self->math->motors[ACH],
pCon,
curve);
if(status != OKOK){
return status;
}
}
}
}
if(driveQ == 0){
return OKOK;
}
@ -415,12 +435,16 @@ static int calculateAndDrive(ptasMot self, SConnection *pCon){
}
/*-----------------------------------------------------------------------------*/
static int checkMotors(ptasMot self, SConnection *pCon){
int i, status;
int i, status, length = 12;
self->math->mustRecalculate = 1;
if(self->math->tasMode == ELASTIC){
length = 8;
}
for(i = 0; i < 12; i++){
if(self->math->motors[i] != NULL){
status = self->math->motors[i]->pDrivInt->CheckStatus(self->math->motors[i],pCon);
status = self->math->motors[i]->pDrivInt->CheckStatus(self->math->motors[i],
pCon);
if(status != HWIdle && status != OKOK){
return status;
}