- Improvements to Hipadaba

- New chopper driver for MARS Juelich chopper system
- New docbook based SANS manual
This commit is contained in:
koennecke
2006-07-07 15:05:33 +00:00
parent 37e18effc6
commit dbc6be71ec
10 changed files with 1310 additions and 8 deletions

View File

@ -79,8 +79,8 @@ static int calcAmorSettings(pamorSet self,SConnection *pCon){
/*
* soz
*/
dist = ABS(calcCompPosition(&self->S) - calcCompPosition(&self->M));
soz = dist*Tand(-self->targetm2t);
dist = ABS(calcCompPosition(&self->S) - calcCompPosition(&self->M));
soz = dist*Tand(-self->targetm2t);
addMotorToList(self->driveList,"soz",soz);
/*
@ -357,8 +357,10 @@ static int amorSetSave(void *data, char *name,FILE *fd){
return 0;
}
fprintf(fd,"%s dspar %f\n", name, self->dspar);
fprintf(fd,"%s detectoroffset %f\n", name, self->detectoroffset);
fprintf(fd,"%s verbose %d\n", name, self->verbose);
saveAmorComp(fd,name,"mono",&self->M);
saveAmorComp(fd,name,"chopper",&self->chopper);
saveAmorComp(fd,name,"mono",&self->M);
saveAmorComp(fd,name,"ds",&self->DS);
saveAmorComp(fd,name,"slit2",&self->D2);
saveAmorComp(fd,name,"slit3",&self->D3);
@ -519,6 +521,8 @@ static pamorComp locateComponent(pamorSet self, char *name){
return &self->D;
}else if(strcmp(name,"ana") == 0){
return &self->A;
} else if(strcmp(name,"chopper") == 0){
return &self->chopper;
} else {
return NULL;
}
@ -527,6 +531,7 @@ static pamorComp locateComponent(pamorSet self, char *name){
static double calcCD(pamorSet self){
double soz, cmh, smh, sdh, cd, dist;
dist = ABS(calcCompPosition(&self->S) - calcCompPosition(&self->M));
soz = dist*Cotd(self->targetm2t);
cmh = calcCompPosition(&self->M);
smh = calcCompPosition(&self->S) - calcCompPosition(&self->M);
@ -535,6 +540,20 @@ static double calcCD(pamorSet self){
return cd;
}
/*-----------------------------------------------------------------------*/
static double calcChopperDetectorDistance(pamorSet self){
double dist, diff, soz;
dist = ABS(calcCompPosition(&self->S) - calcCompPosition(&self->M));
soz = dist*Tand(-self->targetm2t);
dist = ABS(calcCompPosition(&self->M) - calcCompPosition(&self->chopper));
diff = calcCompPosition(&self->M) - calcCompPosition(&self->S);
dist += sqrt(diff*diff + soz*soz);
dist += ABS(calcCompPosition(&self->S) - calcCompPosition(&self->D));
dist += self->detectoroffset;
return dist;
}
/*-----------------------------------------------------------------------*/
int AmorSetAction(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]){
pamorSet self = NULL;
@ -587,12 +606,33 @@ int AmorSetAction(SConnection *pCon, SicsInterp *pSics, void *pData,
SCWrite(pCon,pBueffel,eValue);
return 1;
}
}else if(strcmp(argv[1],"detectoroffset") == 0){
if(argc > 2){
if(!SCMatchRights(pCon,usUser)){
return 0;
}
self->detectoroffset = atof(argv[2]);
SCSendOK(pCon);
return 1;
} else {
snprintf(pBueffel,131,"%s detectoroffset = %f", argv[0],
self->detectoroffset);
SCWrite(pCon,pBueffel,eValue);
return 1;
}
} else if(strcmp(argv[1],"cd") == 0){
snprintf(pBueffel,131,"%s cd = %f", argv[0], calcCD(self));
SCWrite(pCon,pBueffel,eValue);
return 1;
} else if(strcmp(argv[1],"cdd") == 0){
snprintf(pBueffel,131,"%s cdd = %f", argv[0],
calcChopperDetectorDistance(self));
SCWrite(pCon,pBueffel,eValue);
return 1;
} else {
SCWrite(pCon,"ERROR: unknown subcommand to amorset",eError);
snprintf(pBueffel,131,"ERROR: unknown subcommand %s to amorset",
argv[1]);
SCWrite(pCon,pBueffel,eError);
return 0;
}