- A few fixes to the hsitogram memory codes
- Many fixes for the triple axis code
This commit is contained in:
59
tasutil.c
59
tasutil.c
@@ -210,6 +210,30 @@ static int printError(int ier, SConnection *pCon)
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------
|
||||
getSRO reads the SRO motor. This motor is for the rotation of the
|
||||
magnet. The value has to be subtracted from the helm value during
|
||||
calculations
|
||||
-----------------------------------------------------------------------*/
|
||||
int getSRO(SConnection *pCon, float *sroVal)
|
||||
{
|
||||
pMotor pMot = NULL;
|
||||
int status;
|
||||
|
||||
pMot = FindMotor(pServ->pSics,"sro");
|
||||
if(!pMot)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: internal: motor sro not found!",eError);
|
||||
return 0;
|
||||
}
|
||||
status = MotorGetSoftPosition(pMot,pCon,sroVal);
|
||||
if(status != 1)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: failed to read motor sro",eError);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*----------------------------------------------------------------------
|
||||
TASCalc does the triple axis spectrometer calculations. This function is
|
||||
invoked whenever energy or Q needs to be driven. The parameters:
|
||||
@@ -242,7 +266,7 @@ extern int t_conv__(real *ei, real *aki, real *ef, real *akf, real *
|
||||
real *f, integer *ifx, integer *iss, integer *ism, integer *isa, real
|
||||
*t_a__, real *t_rm__, real *t_alm__, real *t_ra__, real *qm, logical *
|
||||
ldra, logical *ldr_rm__, logical *ldr_alm__, logical *ldr_ra__, real *
|
||||
p_ih__, real *c_ih__, integer *ier);
|
||||
p_ih__, real *c_ih__, doublereal *a4, integer *ier);
|
||||
|
||||
extern int inicurve_(integer *midx, real *mrx1, real *mrx2, integer
|
||||
*aidx, real *arx1, real *arx2, real *mmin, real *mmax, real *amin,
|
||||
@@ -259,14 +283,16 @@ int TASCalc(pTASdata self, SConnection *pCon,
|
||||
integer ier;
|
||||
/* for t_conv */
|
||||
real ei, aki, ef, akf, qhkl[3], en, hx, hy, hz, dm, da, helm, f1h, f1v,
|
||||
f2h, f2v, f, angles[6], tRM, tRA, tALM, qm, currents[8], helmconv[4];
|
||||
f2h, f2v, f, angles[6], tRM, tRA, tALM, qm, currents[8],
|
||||
helmconv[4];
|
||||
doublereal a4;
|
||||
integer if1, if2, ifx, iss, ism, isa;
|
||||
logical ldk[8], ldh, ldf, lpa, ldra[6], l_RM, l_RA, l_ALM;
|
||||
/* for inicurve */
|
||||
real mrx1, mrx2, arx1, arx2, mmin, mmax, amin, amax;
|
||||
integer im, ia;
|
||||
pMotor pMot;
|
||||
float fVal;
|
||||
float fVal, fSRO;
|
||||
/* else */
|
||||
int i;
|
||||
|
||||
@@ -402,6 +428,12 @@ int TASCalc(pTASdata self, SConnection *pCon,
|
||||
}
|
||||
readConversionFactors(self,helmconv);
|
||||
|
||||
/*
|
||||
read a4 in order to make magnet calculations work
|
||||
*/
|
||||
a4 = .0;
|
||||
a4 = readDrivable(tasMotorOrder[A4MOT],pCon);
|
||||
|
||||
/*
|
||||
initalise the motorMasks to 0.
|
||||
*/
|
||||
@@ -422,7 +454,7 @@ int TASCalc(pTASdata self, SConnection *pCon,
|
||||
&da, &helm, &f1h, &f1v, &f2h, &f2v,
|
||||
&f, &ifx, &iss, &ism, &isa,
|
||||
angles, &tRM, &tALM, &tRA, &qm, ldra,
|
||||
&l_RM, &l_ALM,&l_RA, currents,helmconv,
|
||||
&l_RM, &l_ALM,&l_RA, currents,helmconv,&a4,
|
||||
&ier);
|
||||
|
||||
if(ier != 0)
|
||||
@@ -470,6 +502,7 @@ int TASCalc(pTASdata self, SConnection *pCon,
|
||||
self->tasPar[TKF]->fVal = (float)akf;
|
||||
self->tasPar[TEN]->fVal = (float)en;
|
||||
self->tasPar[QM]->fVal = (float)qm;
|
||||
self->tasPar[TQM]->fVal = (float)qm;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -555,7 +588,7 @@ int TASUpdate(pTASdata self, SConnection *pCon)
|
||||
integer isa, if1, if2, ier, ifx;
|
||||
pMotor pMot;
|
||||
char pBueffel[132];
|
||||
float fMot, diff;
|
||||
float fMot, diff, fSRO;
|
||||
int i, status;
|
||||
|
||||
assert(self);
|
||||
@@ -596,6 +629,22 @@ int TASUpdate(pTASdata self, SConnection *pCon)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
correct helmholtz angle for SRO rotation
|
||||
*/
|
||||
if(getSRO(pCon,&fSRO)) {
|
||||
fSRO = self->oldSRO - fSRO;
|
||||
fSRO = self->tasPar[HELM]->fVal - fSRO;
|
||||
if(fSRO > 360){
|
||||
fSRO -= 360.;
|
||||
}
|
||||
if(fSRO < -360){
|
||||
fSRO += 360.;
|
||||
}
|
||||
getSRO(pCon,&self->oldSRO);
|
||||
self->tasPar[HELM]->fVal = fSRO;
|
||||
}
|
||||
|
||||
/*
|
||||
get the motor angles A1-A6
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user