- Fixes to HM code for AMOR TOF

- A couple of TAS fixes
- o2t was fixed to work with any drivable
- FOCUS was mended to include beam monitor in data file
This commit is contained in:
cvs
2002-07-19 15:09:21 +00:00
parent e0c5afcf6d
commit bde19bb973
38 changed files with 604 additions and 249 deletions

View File

@ -72,7 +72,8 @@ CFLAGS = -I$(HDFROOT)/include -Ihardsup -DHDF4 -DHDF5 -I. -std1 \
# -std1 -warnprotos -c # -std1 -warnprotos -c
LIBS = -L$(HDFROOT)/lib -Lhardsup -lhlib -Lmatrix -lmatrix -Ltecs \ LIBS = -L$(HDFROOT)/lib -Lhardsup -lhlib -Lmatrix -lmatrix -Ltecs \
-ltecsl -ltcl8.0 -lfor $(HDFROOT)/lib/libhdf5.a \ -ltecsl -ltcl8.0 -lfor $(HDFROOT)/lib/libhdf5.a \
-lmfhdf -ldf $(HDFROOT)/lib/libjpeg.a -lz -lm -ll -lc $(HDFROOT)/lib/libmfhdf.a $(HDFROOT)/lib/libdf.a \
$(HDFROOT)/lib/libjpeg.a -lz -lm -ll -lc
#------- for cygnus #------- for cygnus
#HDFROOT=../HDF411 #HDFROOT=../HDF411

View File

@ -61,7 +61,7 @@
iTime[0] = htonl(iLength); iTime[0] = htonl(iLength);
for(i = 0 ; i < iLength; i++) for(i = 0 ; i < iLength; i++)
{ {
iTime[i+1] = htonl((int)(fTime[i]*65536.)); iTime[i+1] = htonl((int)((fTime[i]/10.)*65536.));
} }
/* send new time binning to all clients */ /* send new time binning to all clients */
SCWrite(pCon,"TOFClear",eError); SCWrite(pCon,"TOFClear",eError);
@ -499,6 +499,7 @@
int *iImage = NULL, *iPtr; int *iImage = NULL, *iPtr;
pSINQHM pHist; pSINQHM pHist;
SinqHMDriv *pTata; SinqHMDriv *pTata;
int iMax = -999999;
/* get size of our problem */ /* get size of our problem */
GetHistDim(self->pHM,iDim,&i3); GetHistDim(self->pHM,iDim,&i3);
@ -537,8 +538,16 @@
*/ */
for(i = 2; i < length; i++) for(i = 2; i < length; i++)
{ {
/*
if(iImage[i] > iMax){
iMax = iImage[i];
}
*/
iImage[i] = htonl(iImage[i]); iImage[i] = htonl(iImage[i]);
} }
/*
printf("Collpased maximum: %d\n",iMax);
*/
if(status != 1) if(status != 1)
{ {
SCWrite(pCon,"ERROR: histogram memory refused to Collapse",eError); SCWrite(pCon,"ERROR: histogram memory refused to Collapse",eError);
@ -562,10 +571,74 @@
/* send image */ /* send image */
SCWriteUUencoded(pCon,"arrow_image",iImage, SCWriteUUencoded(pCon,"arrow_image",iImage,
(iDim[0]*iDim[1]+2)*sizeof(int)); ((iDim[0]*iDim[1])+2)*sizeof(int));
free(iImage); free(iImage);
return 1; return 1;
} }
/*-----------------------------------------------------------------
SendSingleTOF sends single detector data for TOF mode
*/
static int SendSingleTOF(pAmorStat self, SConnection *pCon)
{
HistInt *lData = NULL;
int i, i2, i3, iDim[MAXDIM], iIdx, iSum, status, length;
pSINQHM pHist;
SinqHMDriv *pTata;
int iMax = -999999;
const float *timebin;
HistInt *iData = NULL;
/* get size of our problem */
GetHistDim(self->pHM,iDim,&i3);
assert(i3 == 3);
/* allocate some data */
timebin = GetHistTimeBin(self->pHM, &i3);
length = 1 + 2*i3;
iData = (HistInt *)malloc(length*sizeof(HistInt));
if(iData == NULL){
SCWrite(pCon,"ERROR: failed to allocate memory in SendSingleTOF",
eError);
return 0;
}
memset(iData,0,length*sizeof(int));
/* first number is the length of each single histogram */
iData[0] = htonl(i3);
if(isSINQHMDriv(self->pHM->pDriv))
{
GetHistogramDirect(self->pHM,pCon,0,iDim[0]*iDim[1]*iDim[2],
2*iDim[2],&iData[1],2*iDim[2]*sizeof(HistInt));
for(i = 1; i < length; i++)
{
iData[i] = htonl(iData[i]);
}
}
else
{
/*
we are in simulation and just create some random numbers
*/
for(i = 1; i < length; i++)
{
iData[i] = htonl(random());
}
}
/*
send, with a little trick to do two histograms.
*/
SCWriteUUencoded(pCon,"SING1",iData,
(iDim[2]+1)*sizeof(int));
iData[iDim[2]] = htonl(iDim[2]);
SCWriteUUencoded(pCon,"SING2",&iData[iDim[2]],
(iDim[2]+1)*sizeof(int));
free(iData);
return 1;
}
/*------------------------------------------------------------------- /*-------------------------------------------------------------------
SubSample sums histogram data in the area defined by the rectangle SubSample sums histogram data in the area defined by the rectangle
x1,y1 x2, y2. Summing is along the time axis. x1,y1 x2, y2. Summing is along the time axis.
@ -585,10 +658,16 @@
assert(i3 == 3); assert(i3 == 3);
/* check limits */ /* check limits */
if(x2 < x1) if(x2 < x1){
x2 = x1 + 1; i = x1;
if(y2 < y1) x1 = x2;
y2 = y1 + 1; x2 = i +1;
}
if(y2 < y1){
i = y1;
y1 = y2;
y2 = i + 1;
}
iLimit = 0; iLimit = 0;
if( x1 > iDim[0]) if( x1 > iDim[0])
@ -797,6 +876,10 @@
SCSendOK(pCon); SCSendOK(pCon);
return iRet; return iRet;
} }
else if(strcmp(argv[1],"singletof") == 0)
{
return SendSingleTOF(self,pCon);
}
else if(strcmp(argv[1],"sendloaded") == 0) else if(strcmp(argv[1],"sendloaded") == 0)
{ {
SendLoadedData(self,pCon); SendLoadedData(self,pCon);

View File

@ -1,3 +1,4 @@
#
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Initialization script for a simulated AMOR instrument # Initialization script for a simulated AMOR instrument
# #
@ -187,16 +188,16 @@ ClientPut "Motors initialized"
#======================== histogram memory #======================== histogram memory
#MakeHM hm SinqHM #MakeHM hm SinqHM
MakeHM hm SIM MakeHM hm SIM
hm configure HistMode PSD
hm configure OverFlowMode Ceil hm configure OverFlowMode Ceil
hm configure HistMode PSD
hm configure Rank 1 hm configure Rank 1
hm configure dim0 256 hm configure dim0 256
hm configure dim1 128 hm configure dim1 256
hm configure xfac 16 hm configure xfac 10
hm configure yfac 16 hm configure yfac 10
hm configure xoff 128 hm configure xoff 128
hm configure yoff 64 hm configure yoff 128
hm configure Length 32768 hm configure Length 65536
hm configure BinWidth 4 hm configure BinWidth 4
hm preset 100. hm preset 100.
hm CountMode Timer hm CountMode Timer
@ -204,7 +205,7 @@ hm configure HMComputer psds03.psi.ch
hm configure HMPort 2400 hm configure HMPort 2400
hm configure Counter counter hm configure Counter counter
hm configure init 0 hm configure init 0
hm genbin 0. 33 512 hm genbin 0. 33 5
hm init hm init
ClientPut "Histogram Memory Initialized" ClientPut "Histogram Memory Initialized"

View File

@ -273,7 +273,7 @@
} }
else else
{ {
sprintf(pBueffel,"%s SetMode Preset\n",name); sprintf(pBueffel,"%s SetMode Monitor\n",name);
} }
fputs(pBueffel,fd); fputs(pBueffel,fd);

View File

@ -1,3 +1,3 @@
212 226
NEVER, EVER modify or delete this file NEVER, EVER modify or delete this file
You'll risk eternal damnation and a reincarnation as a cockroach!|n You'll risk eternal damnation and a reincarnation as a cockroach!|n

View File

@ -73,6 +73,8 @@ cnmon1=/entry1,NXentry/FOCUS,NXinstrument/counter,NXmonitor/SDS monitor \
-type DFNT_INT32 -attr {units,counts} -type DFNT_INT32 -attr {units,counts}
cnmon2=/entry1,NXentry/FOCUS,NXinstrument/counter,NXmonitor/SDS beam_monitor \ cnmon2=/entry1,NXentry/FOCUS,NXinstrument/counter,NXmonitor/SDS beam_monitor \
-type DFNT_INT32 -attr {units,counts} -type DFNT_INT32 -attr {units,counts}
cnmon3=/entry1,NXentry/FOCUS,NXinstrument/counter,NXmonitor/SDS proton_beam_monitor \
-type DFNT_INT32 -attr {units,counts}
#-------------- detector bank #-------------- detector bank
dname=/entry1,NXentry/FOCUS,NXinstrument/$(bank),NXdetector/SDS type \ dname=/entry1,NXentry/FOCUS,NXinstrument/$(bank),NXdetector/SDS type \
-type DFNT_CHAR -rank 1 -dim {132} -type DFNT_CHAR -rank 1 -dim {132}
@ -81,7 +83,7 @@ dtheta=/entry1,NXentry/FOCUS,NXinstrument/$(bank),NXdetector/SDS theta \
dtime=/entry1,NXentry/FOCUS,NXinstrument/$(bank),NXdetector/SDS time_binning \ dtime=/entry1,NXentry/FOCUS,NXinstrument/$(bank),NXdetector/SDS time_binning \
-rank 1 -dim {$(timebin)} -attr {axis,2} -attr {units,us} -rank 1 -dim {$(timebin)} -attr {axis,2} -attr {units,us}
dcounts=/entry1,NXentry/FOCUS,NXinstrument/$(bank),NXdetector/SDS counts \ dcounts=/entry1,NXentry/FOCUS,NXinstrument/$(bank),NXdetector/SDS counts \
-type DFNT_INT32 -rank 2 -LZW -dim {$(noofdetectors),$(timebin)} \ -type DFNT_INT32 -LZW -rank 2 -dim {$(noofdetectors),$(timebin)} \
-attr {signal,1} -attr {signal,1}
dsums=/entry1,NXentry/FOCUS,NXinstrument/$(bank),NXdetector/SDS summed_counts \ dsums=/entry1,NXentry/FOCUS,NXinstrument/$(bank),NXdetector/SDS summed_counts \
-rank 1 -dim {$(noofdetectors)} -type DFNT_INT32 -rank 1 -dim {$(noofdetectors)} -type DFNT_INT32

View File

@ -423,6 +423,8 @@
NXDputalias(pFile,pDict,"cnmon1",&lVal); NXDputalias(pFile,pDict,"cnmon1",&lVal);
lVal = GetHistMonitor(self->pHist,0,pCon); lVal = GetHistMonitor(self->pHist,0,pCon);
NXDputalias(pFile,pDict,"cnmon2",&lVal); NXDputalias(pFile,pDict,"cnmon2",&lVal);
lVal = GetHistMonitor(self->pHist,4,pCon);
NXDputalias(pFile,pDict,"cnmon3",&lVal);
/* histogram with three detector banks */ /* histogram with three detector banks */

View File

@ -1462,7 +1462,8 @@
/* check user rights */ /* check user rights */
if(!SCMatchRights(pCon,self->iAccess)) if(!SCMatchRights(pCon,self->iAccess))
{ {
SCWrite(pCon,"ERROR: you are not priviledged for attempted operation",eError); SCWrite(pCon,
"ERROR: you are not priviledged for attempted operation",eError);
return 0; return 0;
} }

93
hkl.c
View File

@ -13,6 +13,11 @@
Updated to use fourlib. Updated to use fourlib.
Mark Koennecke, December 2001 Mark Koennecke, December 2001
Introduced HM mode in order to cope with with the fact that TRICS has
three detectors.
Mark Koennecke, May 2002
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
#include <math.h> #include <math.h>
#include <ctype.h> #include <ctype.h>
@ -47,6 +52,7 @@
name, name,
self->fUB[0], self->fUB[1], self->fUB[2], self->fUB[3], self->fUB[4], self->fUB[0], self->fUB[1], self->fUB[2], self->fUB[3], self->fUB[4],
self->fUB[5], self->fUB[6], self->fUB[7], self->fUB[8]); self->fUB[5], self->fUB[6], self->fUB[7], self->fUB[8]);
fprintf(fd,"%s hm %d\n",name, self->iHM);
return 1; return 1;
} }
@ -86,6 +92,7 @@
pNew->fLambda = 1.38; pNew->fLambda = 1.38;
pNew->iManual = 1; pNew->iManual = 1;
pNew->iQuad = 1; pNew->iQuad = 1;
pNew->iHM = 0;
pNew->fUB[0] = 1.; pNew->fUB[0] = 1.;
pNew->fUB[4] = 1.; pNew->fUB[4] = 1.;
pNew->fUB[8] = 1.; pNew->fUB[8] = 1.;
@ -369,19 +376,49 @@
return 1; return 1;
} }
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
static int checkTheta(pHKL self, double *stt){
char pError[132];
int iTest;
float fHard;
iTest = MotorCheckBoundary(self->pTheta,(float)*stt, &fHard,pError,131);
if(!iTest)
{
/*
check if it is on the other detectors
*/
if(self->iHM){
iTest = MotorCheckBoundary(self->pTheta,(float)*stt-45.,
&fHard,pError,131);
if(iTest){
*stt -= 45.;
} else {
iTest = MotorCheckBoundary(self->pTheta,(float)*stt-90.,
&fHard,pError,131);
if(iTest) {
*stt -= 90.;
}
}
}
if(!iTest){
return -1;
}
}
return 1;
}
/*-----------------------------------------------------------------------*/
static int checkBisecting(pHKL self, static int checkBisecting(pHKL self,
double stt, double om, double chi, double phi) double *stt, double om, double chi, double phi)
{ {
int iTest; int iTest;
float fHard, fLimit; float fHard, fLimit;
char pError[132]; char pError[132];
/* check two theta */ /* check two theta */
iTest = MotorCheckBoundary(self->pTheta,(float)stt, &fHard,pError,131); iTest = checkTheta(self, stt);
if(!iTest) if(!iTest){
{
return -1; return -1;
} }
/* for omega check against the limits +- SCANBORDER in order to allow for /* for omega check against the limits +- SCANBORDER in order to allow for
a omega scan a omega scan
@ -409,7 +446,7 @@ static int checkBisecting(pHKL self,
return 0; return 0;
} }
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
static int checkNormalBeam(double om, double gamma, double nu, static int checkNormalBeam(double om, double *gamma, double nu,
float fSet[4], SConnection *pCon, pHKL self) float fSet[4], SConnection *pCon, pHKL self)
{ {
int iTest; int iTest;
@ -418,11 +455,11 @@ static int checkNormalBeam(double om, double gamma, double nu,
/* check omega, gamma and nu */ /* check omega, gamma and nu */
iTest = MotorCheckBoundary(self->pOmega,(float)om, &fHard,pError,131); iTest = MotorCheckBoundary(self->pOmega,(float)om, &fHard,pError,131);
iTest += MotorCheckBoundary(self->pTheta,(float)gamma, &fHard,pError,131); iTest += checkTheta(self,gamma);
iTest += MotorCheckBoundary(self->pNu,(float)nu, &fHard,pError,131); iTest += MotorCheckBoundary(self->pNu,(float)nu, &fHard,pError,131);
if(iTest == 3) /* none of them burns */ if(iTest == 3) /* none of them burns */
{ {
fSet[0] = (float)gamma; fSet[0] = (float)*gamma;
fSet[1] = (float)om; fSet[1] = (float)om;
fSet[2] = (float)nu; fSet[2] = (float)nu;
return 1; return 1;
@ -433,7 +470,7 @@ static int checkNormalBeam(double om, double gamma, double nu,
tryOmegaTweak tries to calculate a psi angle in order to put an tryOmegaTweak tries to calculate a psi angle in order to put an
offending omega back into range. offending omega back into range.
-----------------------------------------------------------------------*/ -----------------------------------------------------------------------*/
static int tryOmegaTweak(pHKL self, MATRIX z1, double stt, double *om, static int tryOmegaTweak(pHKL self, MATRIX z1, double *stt, double *om,
double *chi, double *phi){ double *chi, double *phi){
int status; int status;
float fLower, fUpper, omTarget, omOffset; float fLower, fUpper, omTarget, omOffset;
@ -478,7 +515,7 @@ static int tryOmegaTweak(pHKL self, MATRIX z1, double stt, double *om,
return 0; return 0;
} }
if(checkBisecting(self,dumstt,offom,offchi,offphi)){ if(checkBisecting(self,&dumstt,offom,offchi,offphi)){
*om = offom; *om = offom;
*chi = offchi; *chi = offchi;
*phi = offphi; *phi = offphi;
@ -529,7 +566,7 @@ static int calculateBisecting(MATRIX z1, pHKL self, SConnection *pCon,
phi = circlify(phi); phi = circlify(phi);
if(iRetry > 1) if(iRetry > 1)
{ {
if(tryOmegaTweak(self,z1,stt,&om,&chi,&phi)){ if(tryOmegaTweak(self,z1,&stt,&om,&chi,&phi)){
fSet[0] = (float)stt; fSet[0] = (float)stt;
fSet[1] = (float)om; fSet[1] = (float)om;
fSet[2] = (float)circlify(chi); fSet[2] = (float)circlify(chi);
@ -554,7 +591,7 @@ static int calculateBisecting(MATRIX z1, pHKL self, SConnection *pCon,
rotatePsi(om,chi,phi,psi,&ompsi,&chipsi,&phipsi); rotatePsi(om,chi,phi,psi,&ompsi,&chipsi,&phipsi);
chipsi = circlify(chipsi); chipsi = circlify(chipsi);
phipsi = circlify(phipsi); phipsi = circlify(phipsi);
test = checkBisecting(self,stt,ompsi,chipsi,phipsi); test = checkBisecting(self,&stt,ompsi,chipsi,phipsi);
if(test == 1) if(test == 1)
{ {
fSet[0] = (float)stt; fSet[0] = (float)stt;
@ -643,7 +680,7 @@ static int calculateNormalBeam(MATRIX z1, pHKL self, SConnection *pCon,
if(bisToNormalBeam(stt,ompsi,chipsi,phipsi, if(bisToNormalBeam(stt,ompsi,chipsi,phipsi,
&om, &gamma, &nu)) &om, &gamma, &nu))
{ {
if(checkNormalBeam(om, gamma, nu,fSet,pCon,self)) if(checkNormalBeam(om, &gamma, nu,fSet,pCon,self))
{ {
return 1; return 1;
} }
@ -708,7 +745,7 @@ static int calculateNormalBeamOmega(MATRIX z1, pHKL self,
if(bisToNormalBeam(stt,ompsi,chi,phi, if(bisToNormalBeam(stt,ompsi,chi,phi,
&om, &gamma, &nu)) &om, &gamma, &nu))
{ {
if(checkNormalBeam(om, gamma, nu,fSet,pCon,self)) if(checkNormalBeam(om, &gamma, nu,fSet,pCon,self))
{ {
return 1; return 1;
} }
@ -1212,8 +1249,9 @@ ente:
strtolower(argv[1]); strtolower(argv[1]);
if(strcmp(argv[1],"list") == 0 ) if(strcmp(argv[1],"list") == 0 )
{ {
sprintf(pBueffel,"lambda = %f Normal Beam = %d Quadrant = %d", sprintf(pBueffel,
self->fLambda, self->iNOR, self->iQuad); "lambda = %f Normal Beam = %d Quadrant = %d HM = %d",
self->fLambda, self->iNOR, self->iQuad,self->iHM);
SCWrite(pCon,pBueffel,eValue); SCWrite(pCon,pBueffel,eValue);
sprintf(pBueffel,"UB = { %f %f %f", sprintf(pBueffel,"UB = { %f %f %f",
self->fUB[0], self->fUB[1],self->fUB[2]); self->fUB[0], self->fUB[1],self->fUB[2]);
@ -1356,6 +1394,29 @@ ente:
SCSendOK(pCon); SCSendOK(pCon);
return 1; return 1;
} }
/*------------- HM mode */
else if(strcmp(argv[1],"hm") == 0)
{
if(argc < 3)
{
sprintf(pBueffel,"%s.hm = %d", argv[0],self->iHM);
SCWrite(pCon,pBueffel,eValue);
return 1;
}
if(!SCMatchRights(pCon,usUser))
{
return 0;
}
if(!isNumeric(argv[2]))
{
sprintf(pBueffel,"ERROR: %s was not recognized as a number", argv[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
self->iHM = atoi(argv[2]);
SCSendOK(pCon);
return 1;
}
/*------------- normal beam */ /*------------- normal beam */
else if(strcmp(argv[1],"nb") == 0) else if(strcmp(argv[1],"nb") == 0)
{ {

1
hkl.i
View File

@ -16,6 +16,7 @@
double fLastHKL[5]; double fLastHKL[5];
int iNOR; int iNOR;
int iQuad; int iQuad;
int iHM;
pMotor pTheta; pMotor pTheta;
pMotor pOmega; pMotor pOmega;
pMotor pChi; pMotor pChi;

View File

@ -24,6 +24,7 @@ $\langle$hkldat {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ double fLastHKL[5];@\\ \mbox{}\verb@ double fLastHKL[5];@\\
\mbox{}\verb@ int iNOR;@\\ \mbox{}\verb@ int iNOR;@\\
\mbox{}\verb@ int iQuad;@\\ \mbox{}\verb@ int iQuad;@\\
\mbox{}\verb@ int iHM;@\\
\mbox{}\verb@ pMotor pTheta;@\\ \mbox{}\verb@ pMotor pTheta;@\\
\mbox{}\verb@ pMotor pOmega;@\\ \mbox{}\verb@ pMotor pOmega;@\\
\mbox{}\verb@ pMotor pChi;@\\ \mbox{}\verb@ pMotor pChi;@\\
@ -51,6 +52,8 @@ The fields are more or less self explaining:
or is updated automatically from a wavelength variable. or is updated automatically from a wavelength variable.
\item[fLastHKL] the HKL of the last reflection calculated. \item[fLastHKL] the HKL of the last reflection calculated.
\item[iNor] a flag for normal beam calculation mode. \item[iNor] a flag for normal beam calculation mode.
\item[iHM] a flag for histogram memory mode. In this mode two theta
limits are checked alos for detector 2 and 3.
\item[pTheta] The two theta motor. All motor are needed for boundary \item[pTheta] The two theta motor. All motor are needed for boundary
checking. checking.
\item[pOmega] The omega axis motor. \item[pOmega] The omega axis motor.

3
hkl.w
View File

@ -19,6 +19,7 @@ The object uses the following object data structure:
double fLastHKL[5]; double fLastHKL[5];
int iNOR; int iNOR;
int iQuad; int iQuad;
int iHM;
pMotor pTheta; pMotor pTheta;
pMotor pOmega; pMotor pOmega;
pMotor pChi; pMotor pChi;
@ -39,6 +40,8 @@ The fields are more or less self explaining:
or is updated automatically from a wavelength variable. or is updated automatically from a wavelength variable.
\item[fLastHKL] the HKL of the last reflection calculated. \item[fLastHKL] the HKL of the last reflection calculated.
\item[iNor] a flag for normal beam calculation mode. \item[iNor] a flag for normal beam calculation mode.
\item[iHM] a flag for histogram memory mode. In this mode two theta
limits are checked alos for detector 2 and 3.
\item[pTheta] The two theta motor. All motor are needed for boundary \item[pTheta] The two theta motor. All motor are needed for boundary
checking. checking.
\item[pOmega] The omega axis motor. \item[pOmega] The omega axis motor.

16
macro.c
View File

@ -182,10 +182,17 @@ extern Tcl_Interp *InterpGetTcl(SicsInterp *pSics);
SCsetMacro(pCon,1); SCsetMacro(pCon,1);
iRet = pCommand->OFunc(pCon,pSinter,pCommand->pData,margc, myarg); iRet = pCommand->OFunc(pCon,pSinter,pCommand->pData,margc, myarg);
SCsetMacro(pCon,iMacro); SCsetMacro(pCon,iMacro);
free(pSics->lastUnknown[pSics->iStack]); /*
pSics->lastUnknown[pSics->iStack] = NULL; lastUnkown gets deeply stacked with each SICS command exec'd.
This is not reflected in code. However, lastUnknown has already
done its job here, so it is safe to do it the way it is done
*/
if(pSics->lastUnknown[pSics->iStack] != NULL)
{
free(pSics->lastUnknown[pSics->iStack]);
pSics->lastUnknown[pSics->iStack] = NULL;
}
/* finish */ /* finish */
if(iRet) if(iRet)
@ -375,6 +382,7 @@ extern Tcl_Interp *InterpGetTcl(SicsInterp *pSics);
{ {
sprintf(pBueffel," Failed to open file -> %s <- ",argv[1]); sprintf(pBueffel," Failed to open file -> %s <- ",argv[1]);
SCWrite(pCon,pBueffel,eError); SCWrite(pCon,pBueffel,eError);
/* SCSetInterrupt(pCon,eAbortBatch); */
return 0; return 0;
} }

View File

@ -159,6 +159,8 @@
self= (pMotor)pData; self= (pMotor)pData;
fprintf(fd,"# Motor %s\n",name); fprintf(fd,"# Motor %s\n",name);
sprintf(pBueffel,"%s sign %f\n",name,ObVal(self->ParArray,SIGN));
fputs(pBueffel,fd);
sprintf(pBueffel,"%s SoftZero %f\n",name,ObVal(self->ParArray,SZERO)); sprintf(pBueffel,"%s SoftZero %f\n",name,ObVal(self->ParArray,SZERO));
fputs(pBueffel,fd); fputs(pBueffel,fd);
sprintf(pBueffel,"%s SoftLowerLim %f\n",name,ObVal(self->ParArray,SLOW)); sprintf(pBueffel,"%s SoftLowerLim %f\n",name,ObVal(self->ParArray,SLOW));
@ -167,8 +169,6 @@
fputs(pBueffel,fd); fputs(pBueffel,fd);
sprintf(pBueffel,"%s Fixed %f\n",name,ObVal(self->ParArray,FIX)); sprintf(pBueffel,"%s Fixed %f\n",name,ObVal(self->ParArray,FIX));
fputs(pBueffel,fd); fputs(pBueffel,fd);
sprintf(pBueffel,"%s sign %f\n",name,ObVal(self->ParArray,SIGN));
fputs(pBueffel,fd);
sprintf(pBueffel,"%s InterruptMode %f\n",name,ObVal(self->ParArray,INT)); sprintf(pBueffel,"%s InterruptMode %f\n",name,ObVal(self->ParArray,INT));
fputs(pBueffel,fd); fputs(pBueffel,fd);
sprintf(pBueffel,"%s AccessCode %f\n",name,ObVal(self->ParArray,USRIGHTS)); sprintf(pBueffel,"%s AccessCode %f\n",name,ObVal(self->ParArray,USRIGHTS));

View File

@ -361,6 +361,10 @@ CreateSocketAdress(
if(iRet != lLen) if(iRet != lLen)
{ {
printf("Incomplete send: %d to %d\n ",iRet,lLen); printf("Incomplete send: %d to %d\n ",iRet,lLen);
if(iRet < 0)
{
printf("System error: %s\n",strerror(errno));
}
return 0; return 0;
} }
else else

View File

@ -457,6 +457,11 @@
return 0; return 0;
} }
if(pServ->simMode)
{
return 1;
}
eOld = GetStatus(); eOld = GetStatus();
SetStatus(eUserWait); SetStatus(eUserWait);
tNow = time(NULL); tNow = time(NULL);
@ -481,7 +486,12 @@
pTaskMan pTasker = NULL; pTaskMan pTasker = NULL;
time_t tNow; time_t tNow;
long lID; long lID;
if(pServ->simMode)
{
return 1;
}
pTasker = GetTasker(); pTasker = GetTasker();
tNow = time(NULL); tNow = time(NULL);
sWait.tFinish = tNow + lTime; sWait.tFinish = tNow + lTime;

View File

@ -48,6 +48,13 @@
*/ */
pAmor2T pAmor = NULL; pAmor2T pAmor = NULL;
/*
if to save psd data in TOF mode or not. This is in order to save time
when measureing TOF with a single detector only.
*/
static int psdSave = 1;
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
static void WriteDiaphragm(NXhandle hfil, NXdict hdict, int i, static void WriteDiaphragm(NXhandle hfil, NXdict hdict, int i,
SConnection *pCon) SConnection *pCon)
@ -611,8 +618,11 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim,
} }
else else
{ {
WriteTOFDetector("spinup",pHM, iDim,hfil,hdict,pCon); if(psdSave){
WriteTOFDetector("spinup",pHM, iDim,hfil,hdict,pCon);
} else {
SCWrite(pCon,"PSD writing supressed!",eWarning);
}
/* /*
now get and write single detectors now get and write single detectors
*/ */
@ -651,8 +661,27 @@ static int WriteTOFDetector(char *name, pHistMem pHM, int *iDim,
int argc, char *argv[]) int argc, char *argv[])
{ {
char pBueffel[512], *pFile = NULL; char pBueffel[512], *pFile = NULL;
int iRet; int iRet, iFlag;
/*
if arguments, check for psdsave
*/
if(argc > 1){
strtolower(argv[1]);
if(strcmp(argv[1],"psdsave") == 0){
if(argc > 2){
psdSave = atof(argv[2]);
SCSendOK(pCon);
return 1;
} else {
sprintf(pBueffel,"storeamor.psdSave = %d",psdSave);
SCWrite(pCon,pBueffel,eValue);
return 1;
}
}
}
pFile = SNXMakeFileName(pSics,pCon); pFile = SNXMakeFileName(pSics,pCon);
sprintf(pBueffel,"Writing file %s .....",pFile); sprintf(pBueffel,"Writing file %s .....",pFile);
SCWrite(pCon,pBueffel,eWarning); SCWrite(pCon,pBueffel,eWarning);

View File

@ -195,7 +195,7 @@
if(pVar) if(pVar)
{ {
iStat = NXputattr(pFile,"instrument",pVar->text, iStat = NXputattr(pFile,"instrument",pVar->text,
strlen(pVar->text)+1,DFNT_INT8); strlen(pVar->text)+1,NX_CHAR);
if(iStat == NX_ERROR) if(iStat == NX_ERROR)
{ {
SCWrite(pCon,"ERROR: writing instrument attribute to Nexus file",eError); SCWrite(pCon,"ERROR: writing instrument attribute to Nexus file",eError);
@ -444,7 +444,7 @@
SCWrite(pCon,pBueffel,eError); SCWrite(pCon,pBueffel,eError);
return 0; return 0;
} }
return SNputdata1att(hfil,dataname, DFNT_FLOAT32,1,&fVal,"Units",units); return SNputdata1att(hfil,dataname, NX_FLOAT32,1,&fVal,"Units",units);
} }
#ifdef NONINTF #ifdef NONINTF
extern float nintf(float f); extern float nintf(float f);
@ -518,14 +518,14 @@
if(pMot) if(pMot)
{ {
iStat = MotorGetSoftPosition(pMot,pCon,&fStart); iStat = MotorGetSoftPosition(pMot,pCon,&fStart);
iStat = SNputdata1att(Nfil,"kollimator1",DFNT_FLOAT32,1, iStat = SNputdata1att(Nfil,"kollimator1",NX_FLOAT32,1,
&fStart,"Units","degrees"); &fStart,"Units","degrees");
} }
pMot = FindMotor(pSics,"CEX2"); pMot = FindMotor(pSics,"CEX2");
if(pMot) if(pMot)
{ {
iStat = MotorGetSoftPosition(pMot,pCon,&fStart); iStat = MotorGetSoftPosition(pMot,pCon,&fStart);
iStat = SNputdata1att(Nfil,"kollimator2",DFNT_FLOAT32,1, iStat = SNputdata1att(Nfil,"kollimator2",NX_FLOAT32,1,
&fStart,"Units","degrees"); &fStart,"Units","degrees");
} }
NXclosegroup(Nfil); /* leave kollimator */ NXclosegroup(Nfil); /* leave kollimator */
@ -543,7 +543,7 @@
if(pVar) if(pVar)
{ {
VarGetFloat(pVar,&fVal); VarGetFloat(pVar,&fVal);
SNputdata1att(Nfil,"lambda",DFNT_FLOAT32,1,&fVal, SNputdata1att(Nfil,"lambda",NX_FLOAT32,1,&fVal,
"Units","Angstroem"); "Units","Angstroem");
NXopendata(Nfil,"lambda"); NXopendata(Nfil,"lambda");
NXgetdataID(Nfil,&lWave); NXgetdataID(Nfil,&lWave);
@ -600,7 +600,7 @@
pPell = (pSelVar)pCom->pData; pPell = (pSelVar)pCom->pData;
assert(iHasType(pPell,"SicsSelVar")); assert(iHasType(pPell,"SicsSelVar"));
fVal = GetSelValue(pPell,pCon); fVal = GetSelValue(pPell,pCon);
iStat = SNputdata1(Nfil,"lambda",DFNT_FLOAT32,1,&fVal); iStat = SNputdata1(Nfil,"lambda",NX_FLOAT32,1,&fVal);
if(!iStat) if(!iStat)
{ {
return 0; return 0;
@ -613,11 +613,11 @@
if(iStat) if(iStat)
/* skip if not readable, error has been reported lower down */ /* skip if not readable, error has been reported lower down */
{ {
SNputdata1att(Nfil,"theta",DFNT_FLOAT32,1,&fTh, SNputdata1att(Nfil,"theta",NX_FLOAT32,1,&fTh,
"Units","degrees"); "Units","degrees");
SNputdata1att(Nfil,"two_theta",DFNT_FLOAT32, 1,&f2Th, SNputdata1att(Nfil,"two_theta",NX_FLOAT32, 1,&f2Th,
"Units","degrees"); "Units","degrees");
SNputdata1att(Nfil,"curvature",DFNT_FLOAT32, 1,&fB1, SNputdata1att(Nfil,"curvature",NX_FLOAT32, 1,&fB1,
"Units","mm"); "Units","mm");
} }
/* more monochromatic motors */ /* more monochromatic motors */
@ -667,12 +667,12 @@
fVal = GetHistPreset(pHist); fVal = GetHistPreset(pHist);
if(eCount == eTimer) if(eCount == eTimer)
{ {
iStat = SNputdata1(Nfil,"Preset",DFNT_FLOAT32,1, &fVal); iStat = SNputdata1(Nfil,"Preset",NX_FLOAT32,1, &fVal);
} }
else else
{ {
fVal = nintf(fVal); fVal = nintf(fVal);
iStat = SNputdata1(Nfil,"Preset",DFNT_FLOAT32,1, &fVal); iStat = SNputdata1(Nfil,"Preset",NX_FLOAT32,1, &fVal);
} }
if(!iStat) if(!iStat)
{ {
@ -690,11 +690,11 @@
{ {
return 0; return 0;
} }
iStat = SNputdata1(Nfil,"Monitor",DFNT_INT32,1, &iVal); iStat = SNputdata1(Nfil,"Monitor",NX_INT32,1, &iVal);
iVal = GetHistMonitor(pHist, 0, pCon); iVal = GetHistMonitor(pHist, 0, pCon);
SNputdata1(Nfil,"beam_monitor",DFNT_INT32,1, &iVal); SNputdata1(Nfil,"beam_monitor",NX_INT32,1, &iVal);
iVal = GetHistMonitor(pHist, 4, pCon); iVal = GetHistMonitor(pHist, 4, pCon);
SNputdata1(Nfil,"proton_monitor",DFNT_INT32,1, &iVal); SNputdata1(Nfil,"proton_monitor",NX_INT32,1, &iVal);
NXopendata(Nfil,"Monitor"); NXopendata(Nfil,"Monitor");
NXgetdataID(Nfil,&lMoni); NXgetdataID(Nfil,&lMoni);
NXclosedata(Nfil); NXclosedata(Nfil);
@ -707,7 +707,7 @@
return 0; return 0;
} }
fVal = pVar->fVal; fVal = pVar->fVal;
iStat = SNputdata1(Nfil,"Step",DFNT_FLOAT32,1, &fVal); iStat = SNputdata1(Nfil,"Step",NX_FLOAT32,1, &fVal);
if(!iStat) if(!iStat)
{ {
return 0; return 0;
@ -727,7 +727,7 @@
{ {
return 0; return 0;
} }
iStat = SNputdata1(Nfil,"no_of_steps",DFNT_INT32,1, &iVal); iStat = SNputdata1(Nfil,"no_of_steps",NX_INT32,1, &iVal);
if(iStat < 1) if(iStat < 1)
{ {
return 0; return 0;
@ -747,7 +747,7 @@
{ {
return 0; return 0;
} }
iStat = SNputdata1(Nfil,"Counts",DFNT_INT32,iVal, lData); iStat = SNputdata1(Nfil,"Counts",NX_INT32,iVal, lData);
if(!iStat) if(!iStat)
{ {
return 0; return 0;
@ -763,7 +763,7 @@
pMot = FindMotor(pSics,"a4"); pMot = FindMotor(pSics,"a4");
assert(pMot); assert(pMot);
iStat = MotorGetSoftPosition(pMot,pCon,&fStart); iStat = MotorGetSoftPosition(pMot,pCon,&fStart);
iStat = SNputdata1att(Nfil,"two_theta_start",DFNT_FLOAT32,1, iStat = SNputdata1att(Nfil,"two_theta_start",NX_FLOAT32,1,
&fStart,"Units","degrees"); &fStart,"Units","degrees");
if(!iStat) if(!iStat)
{ {
@ -772,7 +772,7 @@
/* create 2Theta array and store it */ /* create 2Theta array and store it */
fTheta = NULL; fTheta = NULL;
fTheta = (float32 *)malloc(iVal*sizeof(DFNT_FLOAT32)); fTheta = (float *)malloc(iVal*sizeof(NX_FLOAT32));
if(!fTheta) if(!fTheta)
{ {
return 0; return 0;
@ -781,7 +781,7 @@
{ {
fTheta[i] = fStart + i*fVal; fTheta[i] = fStart + i*fVal;
} }
iStat = SNputdata1att(Nfil,"two_theta",DFNT_FLOAT32,iVal, iStat = SNputdata1att(Nfil,"two_theta",NX_FLOAT32,iVal,
fTheta,"Units","degrees"); fTheta,"Units","degrees");
if(!iStat) if(!iStat)
{ {
@ -819,7 +819,7 @@
pVar = FindVariable(pSics,"sample_mur"); pVar = FindVariable(pSics,"sample_mur");
if(pVar) if(pVar)
{ {
SNputdata1att(Nfil,"sample_mur",DFNT_FLOAT32, 1,&pVar->fVal, SNputdata1att(Nfil,"sample_mur",NX_FLOAT32, 1,&pVar->fVal,
"Units","???"); "Units","???");
} }
/* write sample environment here */ /* write sample environment here */
@ -834,9 +834,9 @@
if(pLog) if(pLog)
{ {
VarlogGetMean(pLog,&fMean,&fStdDev); VarlogGetMean(pLog,&fMean,&fStdDev);
SNputdata1att(Nfil,"temperature_mean",DFNT_FLOAT32, 1,&fMean, SNputdata1att(Nfil,"temperature_mean",NX_FLOAT32, 1,&fMean,
"Units","K"); "Units","K");
SNputdata1att(Nfil,"temperature_stddev",DFNT_FLOAT32, 1, SNputdata1att(Nfil,"temperature_stddev",NX_FLOAT32, 1,
&fStdDev,"Units","K"); &fStdDev,"Units","K");
} }
fVal = pDrive->GetValue(pCom->pData,pCon); fVal = pDrive->GetValue(pCom->pData,pCon);
@ -845,7 +845,7 @@
{ {
VarGetFloat((pSicsVariable)pDum,&fVal); VarGetFloat((pSicsVariable)pDum,&fVal);
} }
SNputdata1att(Nfil,"sample_temperature",DFNT_FLOAT32, 1,&fVal, SNputdata1att(Nfil,"sample_temperature",NX_FLOAT32, 1,&fVal,
"Units","K"); "Units","K");
} }
NXclosegroup(Nfil); /* sample Vgroup */ NXclosegroup(Nfil); /* sample Vgroup */

24
o2t.c
View File

@ -8,6 +8,8 @@
Mark Koennecke, February 1997 Mark Koennecke, February 1997
revised: Mark Koennecke, June 1997 revised: Mark Koennecke, June 1997
revised to work with all drivables: Mark Koennecke, July 2002
Copyright: Copyright:
@ -45,14 +47,13 @@
#include "fortify.h" #include "fortify.h"
#include "sics.h" #include "sics.h"
#include "fupa.h" #include "fupa.h"
#include "motor.h"
#include "o2t.h" #include "o2t.h"
typedef struct __SicsO2T { typedef struct __SicsO2T {
pObjectDescriptor pDes; pObjectDescriptor pDes;
pIDrivable pDrivInt; pIDrivable pDrivInt;
pMotor pOmega; pDummy pOmega;
pMotor pTheta; pDummy pTheta;
} SicsO2T; } SicsO2T;
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
@ -191,6 +192,9 @@
pSicsO2T MakeO2T(char *omega, char *theta, SicsInterp *pSics) pSicsO2T MakeO2T(char *omega, char *theta, SicsInterp *pSics)
{ {
pSicsO2T self = NULL; pSicsO2T self = NULL;
CommandList *pCom = NULL;
pIDrivable pDriv = NULL;
pDummy pDum = NULL;
/* allocate memory */ /* allocate memory */
self = (pSicsO2T)malloc(sizeof(SicsO2T)); self = (pSicsO2T)malloc(sizeof(SicsO2T));
@ -205,9 +209,17 @@
return NULL; return NULL;
} }
/* get motors */ /* get and check drivabels */
self->pOmega = FindMotor(pSics,omega); pCom = FindCommand(pSics,omega);
self->pTheta = FindMotor(pSics,theta); pDum = pCom->pData;
if(GetDrivableInterface(pDum) != NULL){
self->pOmega = pDum;
}
pCom = FindCommand(pSics,theta);
pDum = pCom->pData;
if(GetDrivableInterface(pDum) != NULL){
self->pTheta = pDum;
}
if( (self->pOmega == NULL) || (self->pTheta == NULL) ) if( (self->pOmega == NULL) || (self->pTheta == NULL) )
{ {
DeleteDescriptor(self->pDes); DeleteDescriptor(self->pDes);

View File

@ -1,74 +1,48 @@
yfactor 1.420000 a5l.length 80.000000
yfactor setAccess 1 flightpathlength 0.000000
xfactor 0.715000 flightpathlength setAccess 1
xfactor setAccess 1 flightpath 0.000000
ps.listfile peaksearch.dat flightpath setAccess 1
ps.listfile setAccess 2 delay 2500.000000
ps.scansteps 24 delay setAccess 1
ps.scansteps setAccess 2 hm CountMode timer
ps.scanpreset 1000000.000000 hm preset 100.000000
ps.scanpreset setAccess 2 hm genbin 120.000000 35.000000 512
ps.preset 1000.000000 hm init
ps.preset setAccess 2 datafile focus-1001848.hdf
ps.countmode monitor datafile setAccess 3
ps.countmode setAccess 2
ps.cogcontour 0.200000
ps.cogcontour setAccess 2
ps.cogwindow 60
ps.cogwindow setAccess 2
ps.window 7
ps.window setAccess 2
ps.steepness 3
ps.steepness setAccess 2
ps.threshold 30
ps.threshold setAccess 2
ps.sttstep 3.000000
ps.sttstep setAccess 2
ps.sttend 70.000000
ps.sttend setAccess 2
ps.sttstart 5.000000
ps.sttstart setAccess 2
ps.omstep 3.000000
ps.omstep setAccess 2
ps.omend 30.000000
ps.omend setAccess 2
ps.omstart 0.000000
ps.omstart setAccess 2
ps.chistep 12.000000
ps.chistep setAccess 2
ps.chiend 180.000000
ps.chiend setAccess 2
ps.chistart 0.000000
ps.chistart setAccess 2
ps.phistep 3.000000
ps.phistep setAccess 2
ps.phiend 180.000000
ps.phiend setAccess 2
ps.phistart 0.000000
ps.phistart setAccess 2
hm3 CountMode timer
hm3 preset 3600.000000
hm2 CountMode timer hm2 CountMode timer
hm2 preset 3600.000000 hm2 preset 3600.000000
hm1 CountMode timer hm1 CountMode timer
hm1 preset 3600.000000 hm1 preset 3600.000000
dbfile UNKNOWN
dbfile setAccess 2
# Motor th
th sign 1.000000
th SoftZero 0.000000
th SoftLowerLim 4.000000
th SoftUpperLim 113.000000
th Fixed -1.000000
th InterruptMode 0.000000
th AccessCode 2.000000
#Crystallographic Settings #Crystallographic Settings
hkl lambda 1.179000 hkl lambda 1.179000
hkl setub -0.017880 -0.074923 0.028280 -0.007008 -0.036800 -0.057747 0.160912 -0.009928 0.000627 hkl setub -0.017880 -0.074923 0.028280 -0.007008 -0.036800 -0.057747 0.160912 -0.009928 0.000627
detdist3 0.000000 hkl hm 0
detdist3 setAccess 1 det3dist 300.000000
det3dist setAccess 1
det3zeroy 128.000000 det3zeroy 128.000000
det3zeroy setAccess 1 det3zeroy setAccess 1
det3zerox 128.000000 det3zerox 128.000000
det3zerox setAccess 1 det3zerox setAccess 1
detdist2 0.000000 det2dist 300.000000
detdist2 setAccess 1 det2dist setAccess 1
det2zeroy 128.000000 det2zeroy 128.000000
det2zeroy setAccess 1 det2zeroy setAccess 1
det2zerox 128.000000 det2zerox 128.000000
det2zerox setAccess 1 det2zerox setAccess 1
detdist1 0.000000 det1dist 300.000000
detdist1 setAccess 1 det1dist setAccess 1
det1zeroy 128.000000 det1zeroy 128.000000
det1zeroy setAccess 1 det1zeroy setAccess 1
det1zerox 128.000000 det1zerox 128.000000
@ -78,103 +52,105 @@ mono2theta setAccess 1
monodescription unknownit crystal monodescription unknownit crystal
monodescription setAccess 1 monodescription setAccess 1
# Motor om # Motor om
om sign 1.000000
om SoftZero 0.000000 om SoftZero 0.000000
om SoftLowerLim -73.000000 om SoftLowerLim -73.000000
om SoftUpperLim 134.000000 om SoftUpperLim 134.000000
om Fixed -1.000000 om Fixed -1.000000
om sign 1.000000
om InterruptMode 0.000000 om InterruptMode 0.000000
om AccessCode 2.000000 om AccessCode 2.000000
# Motor stt # Motor stt
stt sign 1.000000
stt SoftZero 0.000000 stt SoftZero 0.000000
stt SoftLowerLim 4.000000 stt SoftLowerLim 4.000000
stt SoftUpperLim 113.000000 stt SoftUpperLim 113.000000
stt Fixed -1.000000 stt Fixed -1.000000
stt sign 1.000000
stt InterruptMode 0.000000 stt InterruptMode 0.000000
stt AccessCode 2.000000 stt AccessCode 2.000000
# Motor ch # Motor ch
ch sign 1.000000
ch SoftZero 0.000000 ch SoftZero 0.000000
ch SoftLowerLim 0.000000 ch SoftLowerLim 0.000000
ch SoftUpperLim 212.000000 ch SoftUpperLim 212.000000
ch Fixed -1.000000 ch Fixed -1.000000
ch sign 1.000000
ch InterruptMode 0.000000 ch InterruptMode 0.000000
ch AccessCode 1.000000 ch AccessCode 1.000000
# Motor ph # Motor ph
ph sign 1.000000
ph SoftZero 0.000000 ph SoftZero 0.000000
ph SoftLowerLim -360.000000 ph SoftLowerLim -360.000000
ph SoftUpperLim 360.000000 ph SoftUpperLim 360.000000
ph Fixed -1.000000 ph Fixed -1.000000
ph sign 1.000000
ph InterruptMode 0.000000 ph InterruptMode 0.000000
ph AccessCode 2.000000 ph AccessCode 2.000000
# Motor dg3 # Motor dg3
dg3 sign 1.000000
dg3 SoftZero 0.000000 dg3 SoftZero 0.000000
dg3 SoftLowerLim -10.000000 dg3 SoftLowerLim -10.000000
dg3 SoftUpperLim 40.000000 dg3 SoftUpperLim 40.000000
dg3 Fixed -1.000000 dg3 Fixed -1.000000
dg3 sign 1.000000
dg3 InterruptMode 0.000000 dg3 InterruptMode 0.000000
dg3 AccessCode 2.000000 dg3 AccessCode 2.000000
# Motor dg2 # Motor dg2
dg2 sign 1.000000
dg2 SoftZero 0.000000 dg2 SoftZero 0.000000
dg2 SoftLowerLim -10.000000 dg2 SoftLowerLim -10.000000
dg2 SoftUpperLim 40.000000 dg2 SoftUpperLim 40.000000
dg2 Fixed -1.000000 dg2 Fixed -1.000000
dg2 sign 1.000000
dg2 InterruptMode 0.000000 dg2 InterruptMode 0.000000
dg2 AccessCode 2.000000 dg2 AccessCode 2.000000
# Motor dg1 # Motor dg1
dg1 sign 1.000000
dg1 SoftZero 0.000000 dg1 SoftZero 0.000000
dg1 SoftLowerLim -10.000000 dg1 SoftLowerLim -10.000000
dg1 SoftUpperLim 40.000000 dg1 SoftUpperLim 40.000000
dg1 Fixed -1.000000 dg1 Fixed -1.000000
dg1 sign 1.000000
dg1 InterruptMode 0.000000 dg1 InterruptMode 0.000000
dg1 AccessCode 2.000000 dg1 AccessCode 2.000000
# Motor muca # Motor muca
muca sign 1.000000
muca SoftZero 0.000000 muca SoftZero 0.000000
muca SoftLowerLim 30.000000 muca SoftLowerLim 30.000000
muca SoftUpperLim 36.000000 muca SoftUpperLim 36.000000
muca Fixed -1.000000 muca Fixed -1.000000
muca sign 1.000000
muca InterruptMode 0.000000 muca InterruptMode 0.000000
muca AccessCode 2.000000 muca AccessCode 2.000000
# Motor phi # Motor phi
phi sign 1.000000
phi SoftZero 0.000000 phi SoftZero 0.000000
phi SoftLowerLim -360.000000 phi SoftLowerLim -360.000000
phi SoftUpperLim 360.000000 phi SoftUpperLim 360.000000
phi Fixed -1.000000 phi Fixed -1.000000
phi sign 1.000000
phi InterruptMode 0.000000 phi InterruptMode 0.000000
phi AccessCode 2.000000 phi AccessCode 2.000000
# Motor chi # Motor chi
chi sign 1.000000
chi SoftZero 0.000000 chi SoftZero 0.000000
chi SoftLowerLim 0.000000 chi SoftLowerLim 0.000000
chi SoftUpperLim 212.000000 chi SoftUpperLim 212.000000
chi Fixed -1.000000 chi Fixed -1.000000
chi sign 1.000000
chi InterruptMode 0.000000 chi InterruptMode 0.000000
chi AccessCode 1.000000 chi AccessCode 1.000000
# Motor omega # Motor omega
omega sign 1.000000
omega SoftZero 0.000000 omega SoftZero 0.000000
omega SoftLowerLim -73.000000 omega SoftLowerLim -73.000000
omega SoftUpperLim 134.000000 omega SoftUpperLim 134.000000
omega Fixed -1.000000 omega Fixed -1.000000
omega sign 1.000000
omega InterruptMode 0.000000 omega InterruptMode 0.000000
omega AccessCode 2.000000 omega AccessCode 2.000000
# Motor twotheta # Motor twotheta
twotheta sign 1.000000
twotheta SoftZero 0.000000 twotheta SoftZero 0.000000
twotheta SoftLowerLim 4.000000 twotheta SoftLowerLim 4.000000
twotheta SoftUpperLim 113.000000 twotheta SoftUpperLim 113.000000
twotheta Fixed -1.000000 twotheta Fixed -1.000000
twotheta sign 1.000000
twotheta InterruptMode 0.000000 twotheta InterruptMode 0.000000
twotheta AccessCode 2.000000 twotheta AccessCode 2.000000
lastscancommand cscan a4 10. .1 10 5 lastscancommand cscan a4 10. .1 10 5
lastscancommand setAccess 2 lastscancommand setAccess 2
banana CountMode timer
banana preset 100.000000
sample_mur 0.000000 sample_mur 0.000000
sample_mur setAccess 2 sample_mur setAccess 2
email UNKNOWN email UNKNOWN
@ -189,274 +165,276 @@ adress setAccess 2
counter SetPreset 1.000000 counter SetPreset 1.000000
counter SetMode Timer counter SetMode Timer
# Motor som # Motor som
som sign 1.000000
som SoftZero 0.000000 som SoftZero 0.000000
som SoftLowerLim -360.000000 som SoftLowerLim -360.000000
som SoftUpperLim 360.000000 som SoftUpperLim 360.000000
som Fixed -1.000000 som Fixed -1.000000
som sign 1.000000
som InterruptMode 0.000000 som InterruptMode 0.000000
som AccessCode 0.000000 som AccessCode 2.000000
# Motor sax # Motor sax
sax sign 1.000000
sax SoftZero 0.000000 sax SoftZero 0.000000
sax SoftLowerLim -30.000000 sax SoftLowerLim -30.000000
sax SoftUpperLim 30.000000 sax SoftUpperLim 30.000000
sax Fixed -1.000000 sax Fixed -1.000000
sax sign 1.000000
sax InterruptMode 0.000000 sax InterruptMode 0.000000
sax AccessCode 2.000000 sax AccessCode 2.000000
# Motor tilt # Motor tilt
tilt sign 1.000000
tilt SoftZero 0.000000 tilt SoftZero 0.000000
tilt SoftLowerLim -15.000000 tilt SoftLowerLim -15.000000
tilt SoftUpperLim 15.000000 tilt SoftUpperLim 15.000000
tilt Fixed -1.000000 tilt Fixed -1.000000
tilt sign 1.000000
tilt InterruptMode 0.000000 tilt InterruptMode 0.000000
tilt AccessCode 0.000000 tilt AccessCode 0.000000
# Motor detectorrotation # Motor detectorrotation
detectorrotation sign 1.000000
detectorrotation SoftZero 0.000000 detectorrotation SoftZero 0.000000
detectorrotation SoftLowerLim -20.000000 detectorrotation SoftLowerLim -20.000000
detectorrotation SoftUpperLim 20.000000 detectorrotation SoftUpperLim 20.000000
detectorrotation Fixed -1.000000 detectorrotation Fixed -1.000000
detectorrotation sign 1.000000
detectorrotation InterruptMode 0.000000 detectorrotation InterruptMode 0.000000
detectorrotation AccessCode 2.000000 detectorrotation AccessCode 2.000000
# Motor detectory # Motor detectory
detectory sign 1.000000
detectory SoftZero 0.000000 detectory SoftZero 0.000000
detectory SoftLowerLim -20.000000 detectory SoftLowerLim -20.000000
detectory SoftUpperLim 20.000000 detectory SoftUpperLim 20.000000
detectory Fixed -1.000000 detectory Fixed -1.000000
detectory sign 1.000000
detectory InterruptMode 0.000000 detectory InterruptMode 0.000000
detectory AccessCode 2.000000 detectory AccessCode 2.000000
# Motor detectorx # Motor detectorx
detectorx sign 1.000000
detectorx SoftZero 0.000000 detectorx SoftZero 0.000000
detectorx SoftLowerLim -20.000000 detectorx SoftLowerLim -20.000000
detectorx SoftUpperLim 20.000000 detectorx SoftUpperLim 20.000000
detectorx Fixed -1.000000 detectorx Fixed -1.000000
detectorx sign 1.000000
detectorx InterruptMode 0.000000 detectorx InterruptMode 0.000000
detectorx AccessCode 2.000000 detectorx AccessCode 2.000000
# Motor beamstopy # Motor beamstopy
beamstopy sign 1.000000
beamstopy SoftZero 0.000000 beamstopy SoftZero 0.000000
beamstopy SoftLowerLim -20.000000 beamstopy SoftLowerLim -20.000000
beamstopy SoftUpperLim 20.000000 beamstopy SoftUpperLim 20.000000
beamstopy Fixed -1.000000 beamstopy Fixed -1.000000
beamstopy sign 1.000000
beamstopy InterruptMode 0.000000 beamstopy InterruptMode 0.000000
beamstopy AccessCode 2.000000 beamstopy AccessCode 2.000000
# Motor beamstopx # Motor beamstopx
beamstopx sign 1.000000
beamstopx SoftZero 0.000000 beamstopx SoftZero 0.000000
beamstopx SoftLowerLim -20.000000 beamstopx SoftLowerLim -20.000000
beamstopx SoftUpperLim 20.000000 beamstopx SoftUpperLim 20.000000
beamstopx Fixed -1.000000 beamstopx Fixed -1.000000
beamstopx sign 1.000000
beamstopx InterruptMode 0.000000 beamstopx InterruptMode 0.000000
beamstopx AccessCode 2.000000 beamstopx AccessCode 2.000000
# Motor d2t # Motor d2t
d2t sign 1.000000
d2t SoftZero 0.000000 d2t SoftZero 0.000000
d2t SoftLowerLim -20.000000 d2t SoftLowerLim -20.000000
d2t SoftUpperLim 20.000000 d2t SoftUpperLim 20.000000
d2t Fixed -1.000000 d2t Fixed -1.000000
d2t sign 1.000000
d2t InterruptMode 0.000000 d2t InterruptMode 0.000000
d2t AccessCode 2.000000 d2t AccessCode 2.000000
# Motor d2l # Motor d2l
d2l sign 1.000000
d2l SoftZero 0.000000 d2l SoftZero 0.000000
d2l SoftLowerLim -20.000000 d2l SoftLowerLim -20.000000
d2l SoftUpperLim 20.000000 d2l SoftUpperLim 20.000000
d2l Fixed -1.000000 d2l Fixed -1.000000
d2l sign 1.000000
d2l InterruptMode 0.000000 d2l InterruptMode 0.000000
d2l AccessCode 2.000000 d2l AccessCode 2.000000
# Motor d2r # Motor d2r
d2r sign 1.000000
d2r SoftZero 0.000000 d2r SoftZero 0.000000
d2r SoftLowerLim -20.000000 d2r SoftLowerLim -20.000000
d2r SoftUpperLim 20.000000 d2r SoftUpperLim 20.000000
d2r Fixed -1.000000 d2r Fixed -1.000000
d2r sign 1.000000
d2r InterruptMode 0.000000 d2r InterruptMode 0.000000
d2r AccessCode 2.000000 d2r AccessCode 2.000000
# Motor d1t # Motor d1t
d1t sign 1.000000
d1t SoftZero 0.000000 d1t SoftZero 0.000000
d1t SoftLowerLim -20.000000 d1t SoftLowerLim -20.000000
d1t SoftUpperLim 20.000000 d1t SoftUpperLim 20.000000
d1t Fixed -1.000000 d1t Fixed -1.000000
d1t sign 1.000000
d1t InterruptMode 0.000000 d1t InterruptMode 0.000000
d1t AccessCode 2.000000 d1t AccessCode 2.000000
# Motor d1l # Motor d1l
d1l sign 1.000000
d1l SoftZero 0.000000 d1l SoftZero 0.000000
d1l SoftLowerLim -20.000000 d1l SoftLowerLim -20.000000
d1l SoftUpperLim 20.000000 d1l SoftUpperLim 20.000000
d1l Fixed -1.000000 d1l Fixed -1.000000
d1l sign 1.000000
d1l InterruptMode 0.000000 d1l InterruptMode 0.000000
d1l AccessCode 2.000000 d1l AccessCode 2.000000
# Motor d1r # Motor d1r
d1r sign 1.000000
d1r SoftZero 0.000000 d1r SoftZero 0.000000
d1r SoftLowerLim -20.000000 d1r SoftLowerLim -20.000000
d1r SoftUpperLim 20.000000 d1r SoftUpperLim 20.000000
d1r Fixed -1.000000 d1r Fixed -1.000000
d1r sign 1.000000
d1r InterruptMode 0.000000 d1r InterruptMode 0.000000
d1r AccessCode 2.000000 d1r AccessCode 2.000000
# Motor monochi # Motor monochi
monochi sign 1.000000
monochi SoftZero 0.000000 monochi SoftZero 0.000000
monochi SoftLowerLim -30.000000 monochi SoftLowerLim -30.000000
monochi SoftUpperLim 30.000000 monochi SoftUpperLim 30.000000
monochi Fixed -1.000000 monochi Fixed -1.000000
monochi sign 1.000000
monochi InterruptMode 0.000000 monochi InterruptMode 0.000000
monochi AccessCode 2.000000 monochi AccessCode 2.000000
# Motor monophi # Motor monophi
monophi sign 1.000000
monophi SoftZero 0.000000 monophi SoftZero 0.000000
monophi SoftLowerLim -30.000000 monophi SoftLowerLim -30.000000
monophi SoftUpperLim 30.000000 monophi SoftUpperLim 30.000000
monophi Fixed -1.000000 monophi Fixed -1.000000
monophi sign 1.000000
monophi InterruptMode 0.000000 monophi InterruptMode 0.000000
monophi AccessCode 2.000000 monophi AccessCode 2.000000
# Motor monoy # Motor monoy
monoy sign 1.000000
monoy SoftZero 0.000000 monoy SoftZero 0.000000
monoy SoftLowerLim -30.000000 monoy SoftLowerLim -30.000000
monoy SoftUpperLim 30.000000 monoy SoftUpperLim 30.000000
monoy Fixed -1.000000 monoy Fixed -1.000000
monoy sign 1.000000
monoy InterruptMode 0.000000 monoy InterruptMode 0.000000
monoy AccessCode 2.000000 monoy AccessCode 2.000000
# Motor monox # Motor monox
monox sign 1.000000
monox SoftZero 0.000000 monox SoftZero 0.000000
monox SoftLowerLim -30.000000 monox SoftLowerLim -30.000000
monox SoftUpperLim 30.000000 monox SoftUpperLim 30.000000
monox Fixed -1.000000 monox Fixed -1.000000
monox sign 1.000000
monox InterruptMode 0.000000 monox InterruptMode 0.000000
monox AccessCode 2.000000 monox AccessCode 2.000000
# Motor tasse # Motor tasse
tasse sign 1.000000
tasse SoftZero 0.000000 tasse SoftZero 0.000000
tasse SoftLowerLim -130.000000 tasse SoftLowerLim -130.000000
tasse SoftUpperLim 130.000000 tasse SoftUpperLim 130.000000
tasse Fixed -1.000000 tasse Fixed -1.000000
tasse sign 1.000000
tasse InterruptMode 0.000000 tasse InterruptMode 0.000000
tasse AccessCode 2.000000 tasse AccessCode 2.000000
# Motor sdm # Motor sdm
sdm sign 1.000000
sdm SoftZero 0.000000 sdm SoftZero 0.000000
sdm SoftLowerLim -5.000000 sdm SoftLowerLim -5.000000
sdm SoftUpperLim 50.000000 sdm SoftUpperLim 50.000000
sdm Fixed -1.000000 sdm Fixed -1.000000
sdm sign 1.000000
sdm InterruptMode 0.000000 sdm InterruptMode 0.000000
sdm AccessCode 2.000000 sdm AccessCode 2.000000
# Motor sgu # Motor sgu
sgu sign 1.000000
sgu SoftZero 0.000000 sgu SoftZero 0.000000
sgu SoftLowerLim -20.000000 sgu SoftLowerLim -20.000000
sgu SoftUpperLim 20.000000 sgu SoftUpperLim 20.000000
sgu Fixed -1.000000 sgu Fixed -1.000000
sgu sign 1.000000
sgu InterruptMode 0.000000 sgu InterruptMode 0.000000
sgu AccessCode 2.000000 sgu AccessCode 2.000000
# Motor sgl # Motor sgl
sgl sign 1.000000
sgl SoftZero 0.000000 sgl SoftZero 0.000000
sgl SoftLowerLim -20.000000 sgl SoftLowerLim -20.000000
sgl SoftUpperLim 20.000000 sgl SoftUpperLim 20.000000
sgl Fixed -1.000000 sgl Fixed -1.000000
sgl sign 1.000000
sgl InterruptMode 0.000000 sgl InterruptMode 0.000000
sgl AccessCode 2.000000 sgl AccessCode 2.000000
# Motor mgu # Motor mgu
mgu sign 1.000000
mgu SoftZero 0.000000 mgu SoftZero 0.000000
mgu SoftLowerLim -50.000000 mgu SoftLowerLim -50.000000
mgu SoftUpperLim 50.000000 mgu SoftUpperLim 50.000000
mgu Fixed -1.000000 mgu Fixed -1.000000
mgu sign 1.000000
mgu InterruptMode 0.000000 mgu InterruptMode 0.000000
mgu AccessCode 2.000000 mgu AccessCode 2.000000
# Motor stu # Motor stu
stu sign 1.000000
stu SoftZero 0.000000 stu SoftZero 0.000000
stu SoftLowerLim -30.000000 stu SoftLowerLim -30.000000
stu SoftUpperLim 30.000000 stu SoftUpperLim 30.000000
stu Fixed -1.000000 stu Fixed -1.000000
stu sign 1.000000
stu InterruptMode 0.000000 stu InterruptMode 0.000000
stu AccessCode 2.000000 stu AccessCode 2.000000
# Motor stl # Motor stl
stl sign 1.000000
stl SoftZero 0.000000 stl SoftZero 0.000000
stl SoftLowerLim -30.000000 stl SoftLowerLim -30.000000
stl SoftUpperLim 30.000000 stl SoftUpperLim 30.000000
stl Fixed -1.000000 stl Fixed -1.000000
stl sign 1.000000
stl InterruptMode 0.000000 stl InterruptMode 0.000000
stl AccessCode 2.000000 stl AccessCode 2.000000
# Motor mtu # Motor mtu
mtu sign 1.000000
mtu SoftZero 0.000000 mtu SoftZero 0.000000
mtu SoftLowerLim -30.000000 mtu SoftLowerLim -30.000000
mtu SoftUpperLim 30.000000 mtu SoftUpperLim 30.000000
mtu Fixed -1.000000 mtu Fixed -1.000000
mtu sign 1.000000
mtu InterruptMode 0.000000 mtu InterruptMode 0.000000
mtu AccessCode 2.000000 mtu AccessCode 2.000000
# Motor mtl # Motor mtl
mtl sign 1.000000
mtl SoftZero 0.000000 mtl SoftZero 0.000000
mtl SoftLowerLim -30.000000 mtl SoftLowerLim -30.000000
mtl SoftUpperLim 30.000000 mtl SoftUpperLim 30.000000
mtl Fixed -1.000000 mtl Fixed -1.000000
mtl sign 1.000000
mtl InterruptMode 0.000000 mtl InterruptMode 0.000000
mtl AccessCode 2.000000 mtl AccessCode 2.000000
# Motor a6 # Motor a6
a6 sign 1.000000
a6 SoftZero 0.000000 a6 SoftZero 0.000000
a6 SoftLowerLim -30.000000 a6 SoftLowerLim -30.000000
a6 SoftUpperLim 30.000000 a6 SoftUpperLim 30.000000
a6 Fixed -1.000000 a6 Fixed -1.000000
a6 sign 1.000000
a6 InterruptMode 0.000000 a6 InterruptMode 0.000000
a6 AccessCode 2.000000 a6 AccessCode 2.000000
# Motor a5 # Motor a5
a5 sign 1.000000
a5 SoftZero 0.000000 a5 SoftZero 0.000000
a5 SoftLowerLim -30.000000 a5 SoftLowerLim -30.000000
a5 SoftUpperLim 30.000000 a5 SoftUpperLim 30.000000
a5 Fixed -1.000000 a5 Fixed -1.000000
a5 sign 1.000000
a5 InterruptMode 0.000000 a5 InterruptMode 0.000000
a5 AccessCode 2.000000 a5 AccessCode 2.000000
# Motor a4 # Motor a4
a4 sign 1.000000
a4 SoftZero 0.000000 a4 SoftZero 0.000000
a4 SoftLowerLim -130.000000 a4 SoftLowerLim -130.000000
a4 SoftUpperLim 130.000000 a4 SoftUpperLim 130.000000
a4 Fixed -1.000000 a4 Fixed -1.000000
a4 sign 1.000000
a4 InterruptMode 0.000000 a4 InterruptMode 0.000000
a4 AccessCode 2.000000 a4 AccessCode 2.000000
# Motor a3 # Motor a3
a3 sign 1.000000
a3 SoftZero 0.000000 a3 SoftZero 0.000000
a3 SoftLowerLim -360.000000 a3 SoftLowerLim -360.000000
a3 SoftUpperLim 360.000000 a3 SoftUpperLim 360.000000
a3 Fixed -1.000000 a3 Fixed -1.000000
a3 sign 1.000000
a3 InterruptMode 0.000000 a3 InterruptMode 0.000000
a3 AccessCode 0.000000 a3 AccessCode 2.000000
# Motor a2 # Motor a2
a2 sign 1.000000
a2 SoftZero 0.000000 a2 SoftZero 0.000000
a2 SoftLowerLim -73.000000 a2 SoftLowerLim -73.000000
a2 SoftUpperLim 137.000000 a2 SoftUpperLim 137.000000
a2 Fixed -1.000000 a2 Fixed -1.000000
a2 sign 1.000000
a2 InterruptMode 0.000000 a2 InterruptMode 0.000000
a2 AccessCode 2.000000 a2 AccessCode 2.000000
# Motor a1 # Motor a1
a1 sign 1.000000
a1 SoftZero 0.000000 a1 SoftZero 0.000000
a1 SoftLowerLim 15.000000 a1 SoftLowerLim 15.000000
a1 SoftUpperLim 120.000000 a1 SoftUpperLim 120.000000
a1 Fixed -1.000000 a1 Fixed -1.000000
a1 sign 1.000000
a1 InterruptMode 0.000000 a1 InterruptMode 0.000000
a1 AccessCode 2.000000 a1 AccessCode 2.000000
batchroot /data/koenneck/src/sics
batchroot setAccess 2
user Uwe Filges user Uwe Filges
user setAccess 2 user setAccess 2
sample D20 30K SNP Okt 2001 GS sample D20 30K SNP Okt 2001 GS
sample setAccess 2 sample setAccess 2
title snp gs apd 30K title snp gs apd 30K
title setAccess 2 title setAccess 2
starttime 2002-04-23 10:49:18 starttime 2002-04-23 10:49:18
starttime setAccess 2 starttime setAccess 2

View File

@ -14,7 +14,8 @@
** **
** Author . . . . . . . . . . : D. Maden ** Author . . . . . . . . . . : D. Maden
** Date of creation . . . . . . : Mar 2000 ** Date of creation . . . . . . : Mar 2000
** ** Well, start a motor. But not a3 in powder mode in order to
** Updates: ** Updates:
** 1A01 7-Mar-2000 DM Initial version. ** 1A01 7-Mar-2000 DM Initial version.
**--------------------------------------------------------------------------- **---------------------------------------------------------------------------
@ -101,8 +102,11 @@
#include "SinqHM_def.h" #include "SinqHM_def.h"
#include "FOCUS_gbl.h" #include "FOCUS_gbl.h"
#define READBUFSIZE 66560
extern char *vxWorksVersion; /* Version string of vxWorks */ extern char *vxWorksVersion; /* Version string of vxWorks */
extern char *creationDate; /* Creation Date string of vxWorks */ extern char *creationDate; /* Creation Date string of vxWorks */
static uchar readBuffer[READBUFSIZE];
/* /*
**============================================================================= **=============================================================================
** Local routines. ** Local routines.
@ -1593,7 +1597,7 @@
uint bins_to_go, lastbin; uint bins_to_go, lastbin;
struct req_buff_struct my_rqst; struct req_buff_struct my_rqst;
struct rply_buff_struct my_rply; struct rply_buff_struct my_rply;
uchar *buff_pntr, *last_byte, *nxt; uchar *buff_pntr, *last_byte, *nxt;
uchar buff[pkt_size]; uchar buff[pkt_size];
register union { register union {
@ -1661,23 +1665,12 @@
/***************************************************************/ /***************************************************************/
/* /*
** The args are OK. ** The args are OK.
** Reserve some space for buffering the histogram data. ** Set up fixed buffer to do transfer
*/ */
my_pntr.base = NULL; my_pntr.base = NULL;
i = memFindMax (); /* Get size of biggest free memory block */ my_pntr.base = readBuffer;
if (i > (my_nbins * FS_bpb)) { /* If there's room to hold everything, bins_in_buff = READBUFSIZE/FS_bpb;
** try to get it */
bins_in_buff = my_nbins;
my_pntr.base = malloc (bins_in_buff * FS_bpb);
if (my_pntr.base == NULL) {
bins_in_buff = my_nbins/2; /* A fall-back position! */
my_pntr.base = malloc (bins_in_buff * FS_bpb);
}
}else {
i = (i * 3)/4; /* there's not room to hold everything, so get less! */
bins_in_buff = (i + FS_bpb - 1)/FS_bpb;
my_pntr.base = malloc (bins_in_buff * FS_bpb);
}
if (my_pntr.base == NULL ) { if (my_pntr.base == NULL ) {
if (FS_dbg_lev0) printf ( if (FS_dbg_lev0) printf (
"\n%s -- SQHM_READ: no buffer space available!\n", "\n%s -- SQHM_READ: no buffer space available!\n",
@ -1708,6 +1701,7 @@
nbins_to_send = my_nbins; nbins_to_send = my_nbins;
bytes_in_buff = 0; bytes_in_buff = 0;
nxt = (char *) my_pntr.base; nxt = (char *) my_pntr.base;
while (nbins_to_send > 0) { while (nbins_to_send > 0) {
/* Read some histogram data into buffer */ /* Read some histogram data into buffer */
lastbin = nxtbin_to_send + bins_in_buff; lastbin = nxtbin_to_send + bins_in_buff;
@ -1743,7 +1737,7 @@
nxtbin_to_send += bins_to_go; nxtbin_to_send += bins_to_go;
nbins_to_send -= bins_to_go; nbins_to_send -= bins_to_go;
} }
free (my_pntr.base);
/* /*
** Read-out complete so let DAQ continue. ** Read-out complete so let DAQ continue.
*/ */

View File

@ -950,8 +950,10 @@
} }
/* /*
We have a valid single detector packet. We have a valid single detector packet.
Subtract one form the number because Urs Greuter starts
counting at 1, and ANSI-C at 0
*/ */
edNum = edData.ui2[1]; edNum = edData.ui2[1] - 1;
if(edNum < 0 || edNum >= MAX_PSD_ED){ if(edNum < 0 || edNum >= MAX_PSD_ED){
printf("Got invalid detector number %d\n",edNum); printf("Got invalid detector number %d\n",edNum);
continue; continue;
@ -999,7 +1001,13 @@
/* /*
calculate histogram position to update calculate histogram position to update
*/ */
dataPos = (psdYSize*psdXSize + edNum)*Tof_edges[0]->n_bins + middl; dataPos = (psdYSize*psdXSize)*Tof_edges[0]->n_bins
+ edNum*Tof_edges[0]->n_bins + middl - 1;
if(Dbg_lev1){
printf("dataPos = %d\n", dataPos);
}
/* UD must come but the UD bit is not defined...... /* UD must come but the UD bit is not defined......
if ((Hm_mode_UD != 0) && if ((Hm_mode_UD != 0) &&
@ -1358,3 +1366,6 @@
exit (KER__SUCCESS); exit (KER__SUCCESS);
} }
/*======================================= End of SinqHM_srv_filler.c ========*/ /*======================================= End of SinqHM_srv_filler.c ========*/

View File

@ -151,7 +151,7 @@
Dbg_mask = 0; Dbg_mask = 0;
Dbg_lev0 = 0; Dbg_lev0 = 0;
Dbg_lev1 = 0; Dbg_lev1 = 1;
Dbg_lev2 = 0; Dbg_lev2 = 0;
Dbg_lev3 = 0; Dbg_lev3 = 0;
Cfgn_done = 0; /* Force a configuration before we can do anything. */ Cfgn_done = 0; /* Force a configuration before we can do anything. */

View File

@ -1322,6 +1322,7 @@
psdYSize = ntohs(my_rqst->u.cnfg.u.psd.ySize); psdYSize = ntohs(my_rqst->u.cnfg.u.psd.ySize);
printf("\txSize = %4d, ySize = %4d\n", printf("\txSize = %4d, ySize = %4d\n",
psdXSize, psdYSize); psdXSize, psdYSize);
N_hists = psdXSize*psdYSize+MAX_PSD_ED;
Tof_dts_soll = ntohl (my_rqst->u.cnfg.u.psd.preset_delay); /* The Tof_dts_soll = ntohl (my_rqst->u.cnfg.u.psd.preset_delay); /* The
** required "Delay-Time-to-Start" */ ** required "Delay-Time-to-Start" */
@ -1368,6 +1369,7 @@
edge_arr_pntr = &my_rqst->u.cnfg.u.psd.edge_0; edge_arr_pntr = &my_rqst->u.cnfg.u.psd.edge_0;
for (i = 0; i < N_tof_edges; i++) { for (i = 0; i < N_tof_edges; i++) {
n_bins = ntohl (edge_arr_pntr->n_bins); n_bins = ntohl (edge_arr_pntr->n_bins);
N_bins = n_bins;
flag = ntohl (edge_arr_pntr->flag); flag = ntohl (edge_arr_pntr->flag);
edge_0 = ntohl (edge_arr_pntr->edges[0]); edge_0 = ntohl (edge_arr_pntr->edges[0]);
edge_1 = ntohl (edge_arr_pntr->edges[1]); edge_1 = ntohl (edge_arr_pntr->edges[1]);
@ -1567,7 +1569,8 @@
Total_bytes += ((n_cntrs + MAX_PSD_ED) * n_bins * bytes_per_bin); Total_bytes += ((n_cntrs + MAX_PSD_ED) * n_bins * bytes_per_bin);
if (i == 0) { /* Use the first counter bank to define some .. */ if (i == 0) { /* Use the first counter bank to define some .. */
N_hists = n_cntrs; /* .. globals since we expect there usually to .. */ N_hists = n_cntrs+MAX_PSD_ED;
/* .. globals since we expect there usually to .. */
/* .. be only 1 counter bank. */ /* .. be only 1 counter bank. */
N_bins = n_bins; N_bins = n_bins;
Lo_cntr = first; Lo_cntr = first;
@ -1591,6 +1594,7 @@
}else { }else {
Hist_base_addr = NULL; Hist_base_addr = NULL;
} }
printf("Successfully allocated %d bytes\n", Total_bytes);
if (Hist_base_addr == NULL) { if (Hist_base_addr == NULL) {
printf ("\007do_SQHM__PSD_alloc:\n" printf ("\007do_SQHM__PSD_alloc:\n"
" Unable to reserve %d bytes of memory!\n" " Unable to reserve %d bytes of memory!\n"

View File

@ -82,6 +82,7 @@
mv bld bld.save mv bld bld.save
rcp -p "${src}bld" ./bld rcp -p "${src}bld" ./bld
rcp -p "${src}bld2" ./bld2 rcp -p "${src}bld2" ./bld2
rcp -p "${src}bld604" ./bld604
exit exit
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
startup: startup:

View File

@ -353,7 +353,7 @@
{ {
SinqHMDriv *pInternal; SinqHMDriv *pInternal;
pICountable pCountInt = NULL; pICountable pCountInt = NULL;
int status, iMode; int status, iMode, nHist;
char pError[132]; char pError[132];
assert(self); assert(self);
@ -369,9 +369,20 @@
pInternal->pCounter->pDriv->fPreset = self->fCountPreset; pInternal->pCounter->pDriv->fPreset = self->fCountPreset;
} }
/* first zero the HM */ /* first zero the HM */
status = SINQHMZero(pInternal->pMaster,-1,0,self->iRank*self->iLength); if(self->eHistMode == ePSD && self->iTimeChan > 2){
/*
this is special for AMOR and should be replaced by -1, -1, -1
logic ASAP
*/
nHist = (self->iDims[0]*self->iDims[1] + 2) *self->iTimeChan;
status = SINQHMZero(pInternal->pMaster,-1,-1,-1);
}else{
status = SINQHMZero(pInternal->pMaster,-1,0,self->iRank*self->iLength);
}
/*
status = SINQHMZero(pInternal->pMaster,-1,-1,-1);
*/
if(status < 0) if(status < 0)
{ {
pInternal->iLastHMError = status; pInternal->iLastHMError = status;
@ -897,7 +908,7 @@
SinqHMDriv *pInternal; SinqHMDriv *pInternal;
char pError[132]; char pError[132];
HistInt *plData = NULL; HistInt *plData = NULL;
int i, status; int i, status, nHist;
assert(self); assert(self);
assert(self->pPriv); assert(self->pPriv);
@ -905,7 +916,12 @@
pInternal = self->pPriv; pInternal = self->pPriv;
/* get memory */ /* get memory */
plData = (HistInt *)malloc(self->iRank*self->iLength*sizeof(HistInt)); if(self->eHistMode == ePSD && self->iTimeChan > 2){
nHist = self->iDims[0]*self->iDims[1]*self->iTimeChan;
} else {
nHist = self->iRank*self->iLength;
}
plData = (HistInt *)malloc(nHist*sizeof(HistInt));
if(!plData) if(!plData)
{ {
PrintHMError("Out of memory in SinqHMDriv",pCon); PrintHMError("Out of memory in SinqHMDriv",pCon);
@ -913,12 +929,12 @@
} }
/* initialise */ /* initialise */
for(i = 0; i < self->iRank*self->iLength; i++) for(i = 0; i < nHist; i++)
{ {
plData[i] = iVal; plData[i] = iVal;
} }
status = SQSetHistogram(self,pCon, -1,0,self->iRank*self->iLength, plData); status = SQSetHistogram(self,pCon, -1,0,nHist, plData);
free(plData); free(plData);
return status; return status;
} }

View File

@ -81,6 +81,7 @@
NULL }; NULL };
static pICallBack pCall = NULL; static pICallBack pCall = NULL;
static int fixed = 0;
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
void KillStatus(void *pData) void KillStatus(void *pData)
{ {
@ -89,15 +90,40 @@
DeleteCallBackInterface(pCall); DeleteCallBackInterface(pCall);
} }
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
void SetStatus(Status eNew) void SetStatus(Status eNew)
{ {
if(eCode == eNew) if(!fixed)
{ {
return; if(eCode == eNew)
{
return;
}
eCode = eNew;
InvokeCallBack(pCall,VALUECHANGE,NULL);
} }
eCode = eNew; }
InvokeCallBack(pCall,VALUECHANGE,NULL); /*----------------------------------------------------------------------*/
void SetStatusFixed(Status eNew)
{
if(eCode == eNew)
{
return;
}
eCode = eNew;
InvokeCallBack(pCall,VALUECHANGE,NULL);
fixed = 1;
}
/*----------------------------------------------------------------------*/
void ClearFixedStatus(Status eNew)
{
if(eCode == eNew)
{
return;
}
eCode = eNew;
InvokeCallBack(pCall,VALUECHANGE,NULL);
fixed = 0;
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
Status GetStatus(void) Status GetStatus(void)

View File

@ -27,9 +27,20 @@
void SetStatus(Status eNew); void SetStatus(Status eNew);
int SetStatusFromText(char *text); int SetStatusFromText(char *text);
void KillStatus(void *pData); void KillStatus(void *pData);
/**
* set a status and disallow any further changes to the status. This serves
* in order to prevent massive message flows to the client from status
* changes while processing synchronisation files
*/
void SetStatusFixed(Status eNew);
/**
* clear a fixed status again, status will be updated again.
*/
void ClearFixedStatus(Status eNew);
Status GetStatus(void); Status GetStatus(void);
void GetStatusText(char *buf, int iBufLen); void GetStatusText(char *buf, int iBufLen);
int UserStatus(SConnection *pCon, SicsInterp *pSics, void *pData, int UserStatus(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[]); int argc, char *argv[]);
int ResetStatus(SConnection *pCon, SicsInterp *pSics, void *pData, int ResetStatus(SConnection *pCon, SicsInterp *pSics, void *pData,

View File

@ -5,11 +5,17 @@
SICS server. SICS server.
Mark Koennecke, March 2001 Mark Koennecke, March 2001
Use internal connection.
Mark Koennecke, July 2002
*/ */
#include "sics.h" #include "sics.h"
#include "network.h" #include "network.h"
#include "status.h"
#include "synchronize.h" #include "synchronize.h"
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
Some file statics which hold the connection parameters Some file statics which hold the connection parameters
------------------------------------------------------------------------*/ ------------------------------------------------------------------------*/
@ -137,6 +143,7 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData,
char pBueffel[1024]; char pBueffel[1024];
char pRead[80]; char pRead[80];
int test,i; int test,i;
SConnection *internalCon = NULL;
/* /*
check for connection check for connection
@ -156,6 +163,7 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData,
/* /*
first tell the remote server to backup first tell the remote server to backup
*/ */
SetStatusFixed(eBatch);
strcpy(pBueffel,"transact backup\n"); strcpy(pBueffel,"transact backup\n");
test = NETWrite(connection,pBueffel,strlen(pBueffel)); test = NETWrite(connection,pBueffel,strlen(pBueffel));
if(test != 1) if(test != 1)
@ -165,6 +173,7 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData,
connection = NULL; connection = NULL;
SCWrite(pCon,"ERROR: Failed to contact sync server",eError); SCWrite(pCon,"ERROR: Failed to contact sync server",eError);
SCWrite(pCon,"Try again in order to reconnect before giving up",eWarning); SCWrite(pCon,"Try again in order to reconnect before giving up",eWarning);
ClearFixedStatus(eEager);
return 0; return 0;
} }
/* /*
@ -182,6 +191,7 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData,
SCWrite(pCon,"ERROR: Failed to contact sync server",eError); SCWrite(pCon,"ERROR: Failed to contact sync server",eError);
SCWrite(pCon, SCWrite(pCon,
"Try again in order to reconnect before giving up",eWarning); "Try again in order to reconnect before giving up",eWarning);
ClearFixedStatus(eEager);
return 0; return 0;
} }
else else
@ -208,7 +218,18 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData,
/* /*
now read the backup file and we are done now read the backup file and we are done
*/ */
test = InterpExecute(pSics,pCon,"restore"); internalCon = SCCreateDummyConnection(pSics);
if(internalCon == NULL)
{
SCWrite(pCon,"ERROR: out of memory in sync",
eError);
ClearFixedStatus(eEager);
return 0;
}
test = InterpExecute(pSics,internalCon,"restore");
SCDeleteConnection(internalCon);
ClearFixedStatus(eEager);
if(test != 1) if(test != 1)
{ {
SCWrite(pCon,"ERROR: Failed to read sync information",eError); SCWrite(pCon,"ERROR: Failed to read sync information",eError);

View File

@ -77,6 +77,15 @@ proc tasSplit {text} {
return [lindex $list 1] return [lindex $list 1]
} }
#----------------------------------------------------------------------
# put an angle into 360
proc circlify {val} {
set p $val
while {$p > 360.0} {
set p [expr $p - 360.]
}
return $p
}
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# motor zero points are handled differently in SICS and MAD: # motor zero points are handled differently in SICS and MAD:
# - MAD zero's are of opposite sign to SICS # - MAD zero's are of opposite sign to SICS
@ -102,8 +111,8 @@ proc madZero args {
set high [tasSplit [$mot softupperlim]] set high [tasSplit [$mot softupperlim]]
set displacement [expr $val - $zero] set displacement [expr $val - $zero]
$mot softzero $val $mot softzero $val
$mot softupperlim [expr $high + $displacement] $mot softupperlim [expr $high - $displacement]
$mot softlowerlim [expr $low + $displacement] $mot softlowerlim [expr $low - $displacement]
} }
} }
@ -574,7 +583,7 @@ proc fz args {
} }
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# pr (int) values of variables # pr(int) values of variables
proc pr args { proc pr args {
global tasmap global tasmap
@ -582,7 +591,8 @@ proc pr args {
set line [string tolower $line] set line [string tolower $line]
set pos 0 set pos 0
set token [varToken $line $pos] set token [varToken $line $pos]
while { [string compare $token END] != 0 } { while { [string compare $token END] != 0 && \
[string compare $token end] != 0 } {
#-------- check for mapped values first #-------- check for mapped values first
if { [info exists tasmap($token)] == 1 } { if { [info exists tasmap($token)] == 1 } {
set val [tasSplit [eval $tasmap($token)]] set val [tasSplit [eval $tasmap($token)]]
@ -907,10 +917,10 @@ proc sz args {
set mot [varToken $line $pos] set mot [varToken $line $pos]
set val [varToken $line $pos] set val [varToken $line $pos]
if { [lsearch $tasmot $mot] < 0 } { if { [lsearch $tasmot $mot] < 0 } {
error [format "ERROR: %s is no motor %s" $mot $usage] error [format "ERROR: %s is no motor\n %s" $mot $usage]
} }
if { [string compare [SICStype $val] NUM ] != 0 } { if { [string compare [SICStype $val] NUM ] != 0 } {
error [format "ERROR: expected number, got %s %s" $val $usage] error [format "ERROR: expected number, got %s \n%s" $val $usage]
} }
#-------- output, output, output......... #-------- output, output, output.........
append output [format "Values : Lo(hard) Lo(soft) Posn%s" \ append output [format "Values : Lo(hard) Lo(soft) Posn%s" \
@ -945,7 +955,6 @@ proc sz args {
$loh $los $pos $targ $his $hih $zero] $loh $los $pos $targ $his $hih $zero]
return $output return $output
} }
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# switches and the sw command # switches and the sw command

View File

@ -266,7 +266,7 @@ int TASDrive(SConnection *pCon, SicsInterp *pSics, void *pData,
{ {
if(tasTargetMask[9+i]) if(tasTargetMask[9+i])
{ {
oldPos = readCurrent(tasMotorOrder[CURMOT+i], pCon); oldPos = readDrivable(tasMotorOrder[CURMOT+i], pCon);
sprintf(pBueffel,"Driving %s from %f to %f",tasMotorOrder[CURMOT+i], sprintf(pBueffel,"Driving %s from %f to %f",tasMotorOrder[CURMOT+i],
oldPos, tasTargets[9+i]); oldPos, tasTargets[9+i]);
SCWrite(pCon,pBueffel,eWarning); SCWrite(pCon,pBueffel,eWarning);

View File

@ -20,6 +20,7 @@
#include <assert.h> #include <assert.h>
#include <time.h> #include <time.h>
#include <ctype.h> #include <ctype.h>
#include <tcl.h>
#include "fortify.h" #include "fortify.h"
#include "sics.h" #include "sics.h"
#include "sicsvar.h" #include "sicsvar.h"
@ -241,7 +242,7 @@ static int TASHeader(pScanData self)
iCount = 0; iCount = 0;
for(i = MAXMOT-8; i < MAXMOT;i++) for(i = MAXMOT-8; i < MAXMOT;i++)
{ {
fVal = readCurrent(tasMotorOrder[i],self->pCon); fVal = readDrivable(tasMotorOrder[i],self->pCon);
strcpy(pWork2,tasMotorOrder[i]); strcpy(pWork2,tasMotorOrder[i]);
strtoupper(pWork2); strtoupper(pWork2);
fprintf(self->fd,"%-8s=%8.4f, ",pWork2,fVal); fprintf(self->fd,"%-8s=%8.4f, ",pWork2,fVal);
@ -429,7 +430,7 @@ static int TASScanPoint(pScanData self, int iPoint)
float fVal; float fVal;
pMotor pMot = NULL; pMotor pMot = NULL;
long m1, m2, m3, cnts; long m1, m2, m3, cnts;
char pBueffel[1024], pWork[80]; char pBueffel[1024], pWork[80], pError[132];
/* /*
after polarisation analysis, this has to be ignored as it is called after polarisation analysis, this has to be ignored as it is called
@ -507,14 +508,14 @@ static int TASScanPoint(pScanData self, int iPoint)
*/ */
for(i = 0; i < pTAS->addCount; i++) for(i = 0; i < pTAS->addCount; i++)
{ {
fVal = -999.99;
if(pTAS->addType[i] == 1) /* motor */ if(pTAS->addType[i] == 1) /* motor */
{ {
pMot = FindMotor(self->pSics,tasMotorOrder[pTAS->addOutput[i]]); fVal = readDrivable(tasMotorOrder[pTAS->addOutput[i]],self->pCon);
if(pMot) if(fVal < -990.){
{ sprintf(pError,"WARNING: problem reading %s",
status = MotorGetSoftPosition(pMot,self->pCon,&fVal); tasMotorOrder[pTAS->addOutput[i]]);
if(!status) SCWrite(self->pCon, pError,eWarning);
fVal = -9999.77;
} }
} }
else else
@ -539,6 +540,20 @@ static int TASScanPoint(pScanData self, int iPoint)
return 1; return 1;
} }
/*-----------------------------------------------------------------------
disables a3 driving in powder mode. In powder mode a3 is fixed. This
supresses the error message issued otherwise.
------------------------------------------------------------------------*/
static void fixPowder(unsigned char tasTargetMask[20]){
char *pPtr = NULL;
pPtr = Tcl_GetVar(pServ->pSics->pTcl,"powder",TCL_GLOBAL_ONLY);
if(pPtr){
if(strstr(pPtr,"1") != NULL){
tasTargetMask[2] = 0;
}
}
}
/*------------------------------------------------------------------------ /*------------------------------------------------------------------------
TASScanDrive starts all the motors necessary to drive to a new scan TASScanDrive starts all the motors necessary to drive to a new scan
position. It thereby takes care of the TAS calculation if necessary. position. It thereby takes care of the TAS calculation if necessary.
@ -588,7 +603,9 @@ static int TASScanDrive(pScanData self, int iPoint)
} }
else else
{ {
/* here there is a motor */ /*
This is a motor, start it.
*/
StartMotor(pServ->pExecutor,self->pSics, self->pCon, pVar->Name, StartMotor(pServ->pExecutor,self->pSics, self->pCon, pVar->Name,
pVar->fStart + iPoint * pVar->fStep); pVar->fStart + iPoint * pVar->fStep);
/* /*
@ -614,6 +631,7 @@ static int TASScanDrive(pScanData self, int iPoint)
ignored here on purpose. There is a slight chance that ignored here on purpose. There is a slight chance that
other points in the scan fit the bill. other points in the scan fit the bill.
*/ */
fixPowder(tasTargetMask);
TASStart(pTAS,self->pCon, TASStart(pTAS,self->pCon,
self->pSics,tasTargets,tasTargetMask); self->pSics,tasTargets,tasTargetMask);
} }
@ -1434,12 +1452,12 @@ int TASScan(SConnection *pCon, SicsInterp *pSics, void *pData,
pTAS->tasPar[TIT]->text, pTAS->tasPar[TIT]->text,
pTAS->tasPar[USR]->text, pTAS->tasPar[USR]->text,
pTAS->tasPar[QH]->fVal - (pTAS->pScan->iNP/2)*pTAS->tasPar[DQH]->fVal, pTAS->tasPar[QH]->fVal - (pTAS->pScan->iNP/2)*pTAS->tasPar[DQH]->fVal,
pTAS->tasPar[QL]->fVal - (pTAS->pScan->iNP/2)*pTAS->tasPar[DQL]->fVal, pTAS->tasPar[QK]->fVal - (pTAS->pScan->iNP/2)*pTAS->tasPar[DQL]->fVal,
pTAS->tasPar[QK]->fVal - (pTAS->pScan->iNP/2)*pTAS->tasPar[DQK]->fVal, pTAS->tasPar[QL]->fVal - (pTAS->pScan->iNP/2)*pTAS->tasPar[DQK]->fVal,
pTAS->tasPar[EN]->fVal - (pTAS->pScan->iNP/2)*pTAS->tasPar[DEN]->fVal, pTAS->tasPar[EN]->fVal - (pTAS->pScan->iNP/2)*pTAS->tasPar[DEN]->fVal,
pTAS->tasPar[DQH]->fVal, pTAS->tasPar[DQH]->fVal,
pTAS->tasPar[DQL]->fVal,
pTAS->tasPar[DQK]->fVal, pTAS->tasPar[DQK]->fVal,
pTAS->tasPar[DQL]->fVal,
pTAS->tasPar[DEN]->fVal); pTAS->tasPar[DEN]->fVal);
SCWrite(pCon,pLine,eWarning); SCWrite(pCon,pLine,eWarning);
if(iTas > 0) if(iTas > 0)

2
tasu.h
View File

@ -35,7 +35,7 @@ int isTASVar(char *val);
int isTASEnergy(char *val); int isTASEnergy(char *val);
void prepare2Parse(char *line); void prepare2Parse(char *line);
int tasNumeric(char *pText); int tasNumeric(char *pText);
float readCurrent(char *val, SConnection *pCon); float readDrivable(char *val, SConnection *pCon);
void startCurrent(char *val, SConnection *pCon, float fVal); void startCurrent(char *val, SConnection *pCon, float fVal);
void readConversionFactors(pTASdata self,float convH[4]); void readConversionFactors(pTASdata self,float convH[4]);

View File

@ -397,8 +397,8 @@ int TASCalc(pTASdata self, SConnection *pCon,
for(i = 0; i < 4; i++) for(i = 0; i < 4; i++)
{ {
helmconv[i] = .0; helmconv[i] = .0;
currents[i] = readCurrent(tasMotorOrder[CURMOT+i],pCon); currents[i] = readDrivable(tasMotorOrder[CURMOT+i],pCon);
currents[i+4] = readCurrent(tasMotorOrder[CURMOT + i + 4],pCon); currents[i+4] = readDrivable(tasMotorOrder[CURMOT + i + 4],pCon);
} }
readConversionFactors(self,helmconv); readConversionFactors(self,helmconv);
@ -626,8 +626,8 @@ int TASUpdate(pTASdata self, SConnection *pCon)
for(i = 0; i < 4; i++) for(i = 0; i < 4; i++)
{ {
convH[i] = .0; convH[i] = .0;
helmCurrent[i] = readCurrent(tasMotorOrder[CURMOT+i],pCon); helmCurrent[i] = readDrivable(tasMotorOrder[CURMOT+i],pCon);
helmCurrent[4+i] = readCurrent(tasMotorOrder[CURMOT+i+4],pCon); helmCurrent[4+i] = readDrivable(tasMotorOrder[CURMOT+i+4],pCon);
} }
readConversionFactors(self,convH); readConversionFactors(self,convH);
@ -729,15 +729,29 @@ int TASUpdate(pTASdata self, SConnection *pCon)
return 1; return 1;
} }
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
readCurrent tries to read the value of one of the magnet currents. readDrivable tries to read the value of one of the magnet currents.
All errors are ignored because most of the time currents will not be All errors are ignored because most of the time currents will not be
present in the system. present in the system.
-----------------------------------------------------------------------*/ -----------------------------------------------------------------------*/
float readCurrent(char *val, SConnection *pCon){ float readDrivable(char *val, SConnection *pCon){
pIDrivable pDriv; pIDrivable pDriv;
CommandList *pCom; CommandList *pCom;
pDummy pDum; pDummy pDum;
pMotor pMot = NULL;
float fVal;
/*
if motor: read motor
*/
pMot = FindMotor(pServ->pSics,val);
if(pMot != NULL){
MotorGetSoftPosition(pMot,pCon,&fVal);
return fVal;
}
/*
else: read general drivable
*/
pCom = FindCommand(pServ->pSics,val); pCom = FindCommand(pServ->pSics,val);
if(pCom != NULL){ if(pCom != NULL){
pDriv = GetDrivableInterface(pCom->pData); pDriv = GetDrivableInterface(pCom->pData);
@ -745,7 +759,7 @@ float readCurrent(char *val, SConnection *pCon){
return pDriv->GetValue(pCom->pData,pCon); return pDriv->GetValue(pCom->pData,pCon);
} }
} }
return .0; return -999.99;
} }
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
startCurrent starts driving a current to a new value startCurrent starts driving a current to a new value
@ -767,3 +781,7 @@ void readConversionFactors(pTASdata self,float convH[4]){
convH[2] = self->tasPar[HCONV3]->fVal; convH[2] = self->tasPar[HCONV3]->fVal;
convH[3] = self->tasPar[HCONV4]->fVal; convH[3] = self->tasPar[HCONV4]->fVal;
} }

View File

@ -312,7 +312,7 @@ object_class ScanCommand {
#********************** initialisation of module commands to SICS ********** #********************** initialisation of module commands to SICS **********
set ret [catch {scan list} msg] set ret [catch {scan list} msg]
if {$ret != 0} { #if {$ret != 0} {
object_new ScanCommand scan object_new ScanCommand scan
Publish scan Spy Publish scan Spy
VarMake lastscancommand Text User VarMake lastscancommand Text User
@ -323,7 +323,7 @@ if {$ret != 0} {
Publish sftime Spy Publish sftime Spy
Publish scaninfo Spy Publish scaninfo Spy
Publish wwwsics Spy Publish wwwsics Spy
} #}
#************************************************************************* #*************************************************************************

View File

@ -531,7 +531,7 @@ int PrepInput(char *label) {
sensD.alarm=0; sensD.alarm=0;
} }
loop=1; loop=1;
resist=10; resist=25;
str_copy(heUnits, "%"); str_copy(heUnits, "%");
i=sscanf(t, "%12s%n", nam, &l); i=sscanf(t, "%12s%n", nam, &l);
@ -1108,6 +1108,9 @@ void CalcMaxPower(void) {
} }
} }
#define ABS(x) (x < 0 ? -(x) : (x))
int SetMaxPower(void) { int SetMaxPower(void) {
int i, j; int i, j;
float pa, pr, pw, dif, p; float pa, pr, pw, dif, p;
@ -1121,13 +1124,17 @@ int SetMaxPower(void) {
CalcMaxPower(); CalcMaxPower();
} }
logfileOut(LOG_MAIN, "maxPower changed from %g to %g\n", p0, maxPower); logfileOut(LOG_MAIN, "maxPower changed from %g to %g\n", p0, maxPower);
ERR_P(LscCmd(ser, "CDISP 1:[loop],[resist],1;MOUT [loop]:0;CMODE [loop]:1")); ERR_P(LscCmd(ser, "CDISP 1:[loop],25000,1;MOUT [loop]:0;CMODE [loop]:1"));
if (slope<0) slope=-slope; if (slope<0) slope=-slope;
if (slope!=0 && slope<0.1) slope=0.1; if (slope!=0 && slope<0.1) slope=0.1;
fbuf=tLimit/CtlScale(); fbuf=tLimit/CtlScale();
if (loop==1) { if (loop==1) {
prop=sqrt(p0/scalPower)*prop; if(ABS(p0) > .0 && ABS(scalPower) > .0){
ERR_P(LscCmd(ser, "CLIMIT 1:[fbuf],[slope],0,[iAmp],[iRange];PID [loop],[prop]")); prop=sqrt(p0/scalPower)*prop;
} else {
prop = 10.;
}
ERR_P(LscCmd(ser, "CLIMIT 1:[fbuf],[slope],0,2.0,[iRange];PID [loop],[prop]"));
} else { } else {
ERR_P(LscCmd(ser, "CLIMIT 2:[fbuf],[slope],0")); ERR_P(LscCmd(ser, "CLIMIT 2:[fbuf],[slope],0"));
} }

View File

@ -106,6 +106,8 @@ VarMake sampledist Float Mugger
sampledist 496. sampledist 496.
sampledist lock sampledist lock
VarMake batchroot Text User
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# D E V I C E S : M O T O R S # D E V I C E S : M O T O R S
@ -474,5 +476,23 @@ MakeLin2Ang a5l a5
source tcl/wwwpar.tcl source tcl/wwwpar.tcl
source bef.tcl source bef.tcl
source batch.tcl
Publish batchrun User
#------- test of RS232Controller #------- test of RS232Controller
#MakeRS232Controller hugo psts213 3004 #MakeRS232Controller hugo psts213 3004
#-------------------------- batch run issue
VarMake BatchRoot Text User
BatchRoot /data/koenneck/src/sics
Publish batchrun User
proc SplitReply { text } {
set l [split $text =]
return [lindex $l 1]
}
proc batchrun file {
fileeval [string trim [SplitReply [BatchRoot]]/$file]
}

View File

@ -5,7 +5,7 @@
This is the header file for the SICS token management This is the header file for the SICS token management
functions. It implements the token command. functions. It implements the token command.
Mark Koenencke, January 1998 Mark Koennecke, January 1998
copyright: see copyright.h copyright: see copyright.h