- Improved centering in DIFRAC
- Fixed a bug in UserWait - Improved scan message in scancom - Added zero point correction in lin2ang - fixed an issue with uuencoded messages
This commit is contained in:
10
conman.c
10
conman.c
@ -776,12 +776,14 @@ extern pServer pServ;
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
int SCWriteUUencoded(SConnection *pCon, char *pName, void *pData, int iDataLen)
|
int SCWriteUUencoded(SConnection *pCon, char *pName, void *pData,
|
||||||
|
int iDataLen)
|
||||||
{
|
{
|
||||||
void *pPtr = NULL;
|
void *pPtr = NULL;
|
||||||
int iLength = 0;
|
int iLength = 0;
|
||||||
int iRet;
|
int iRet = 1;
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
|
char *pTest;
|
||||||
|
|
||||||
iRet = UUencodeBuffer(pData,iDataLen,pName, &pPtr, &iLength);
|
iRet = UUencodeBuffer(pData,iDataLen,pName, &pPtr, &iLength);
|
||||||
if(iRet != 1)
|
if(iRet != 1)
|
||||||
@ -789,12 +791,12 @@ extern pServer pServ;
|
|||||||
SCWrite(pCon,"ERROR: no memory for uuencoder",eError);
|
SCWrite(pCon,"ERROR: no memory for uuencoder",eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
pTest = (char *)pPtr;
|
||||||
|
|
||||||
/* the uuencoder ensures proper telnet <cr><lf> */
|
/* the uuencoder ensures proper telnet <cr><lf> */
|
||||||
if(pCon->iTelnet)
|
if(pCon->iTelnet)
|
||||||
{
|
{
|
||||||
NETWrite(pCon->pSock,pPtr,iLength);
|
NETWrite(pCon->pSock,pPtr,iLength);
|
||||||
/* printf("Writing %d uuencoded characters\n",iLength); */
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -808,7 +810,7 @@ extern pServer pServ;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
free(pPtr);
|
free(pPtr);
|
||||||
return 1;
|
return iRet;
|
||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
int SCSendOK(SConnection *self)
|
int SCSendOK(SConnection *self)
|
||||||
|
2
danu.dat
2
danu.dat
@ -1,3 +1,3 @@
|
|||||||
5424
|
5437
|
||||||
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
|
@ -15,7 +15,7 @@
|
|||||||
$ BGRD2,NATT,AS,BS,CS,PA,PM,QTIME,TMAX,AFRAC,
|
$ BGRD2,NATT,AS,BS,CS,PA,PM,QTIME,TMAX,AFRAC,
|
||||||
$ ATTEN(6)
|
$ ATTEN(6)
|
||||||
COMMON /PROFL/ ACOUNT(10*NSIZE),D12,ILOW,IHIGH,IDEL,IWARN,SUM,
|
COMMON /PROFL/ ACOUNT(10*NSIZE),D12,ILOW,IHIGH,IDEL,IWARN,SUM,
|
||||||
$ FRAC1,IPRFLG,IAUTO,STEPOF,FRAC,PJUNK(9)
|
$ FRAC1,IPRFLG,IAUTO,STEPOF,FRAC,PJUNK(9),NPK
|
||||||
COMMON /CUTOFF/ ISYS,SINABS(6),ILN,DELAY,STEP,IUPDWN,ISTOP,
|
COMMON /CUTOFF/ ISYS,SINABS(6),ILN,DELAY,STEP,IUPDWN,ISTOP,
|
||||||
$ CJUNK(8)
|
$ CJUNK(8)
|
||||||
COMMON /CELL/ SR(3,3),SSG(3,3),GI(3,3),AP(3),APS(3),SANGS(3),
|
COMMON /CELL/ SR(3,3),SSG(3,3),GI(3,3),AP(3),APS(3),SANGS(3),
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
C This subroutine reads the info necessary to start the data collection
|
C This subroutine reads the info necessary to start the data collection
|
||||||
C at the start of data collection and at each new segment
|
C at the start of data collection and at each new segment
|
||||||
C Modofied to give output to ITP-->SICS, MK
|
C Modified to give output to ITP-->SICS, MK
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
SUBROUTINE BEGIN
|
SUBROUTINE BEGIN
|
||||||
INCLUDE 'COMDIF'
|
INCLUDE 'COMDIF'
|
||||||
|
@ -2,14 +2,23 @@ C-----------------------------------------------------------------------
|
|||||||
C Routine to align one circle by accumulating a distribution
|
C Routine to align one circle by accumulating a distribution
|
||||||
C of intensity values against degrees & then
|
C of intensity values against degrees & then
|
||||||
C finding the median of the distribution.
|
C finding the median of the distribution.
|
||||||
|
C
|
||||||
|
C Modifications: Mark Koennecke, April 2000
|
||||||
|
C Added code for doing PH optimizations as well.
|
||||||
|
C Added code for monitoring the centering process as well.
|
||||||
|
C When a peak is not found, drive back to start and give an FP error
|
||||||
|
C code instead of an FF. Then the alignement of another circle
|
||||||
|
C might resolve the issue.
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
SUBROUTINE CENTRE (DX,ANG,ISLIT)
|
SUBROUTINE CENTRE (DX,ANG,ISLIT)
|
||||||
INCLUDE 'COMDIF'
|
INCLUDE 'COMDIF'
|
||||||
DIMENSION XA(100),YA(100),AN(4),ST(4),ANG(4)
|
DIMENSION XA(100),YA(100),AN(4),ST(4),ANG(4)
|
||||||
CHARACTER ANGLE(3)*6
|
CHARACTER ANGLE(4)*6
|
||||||
DATA ANGLE/'2theta','Omega','Chi'/
|
DATA ANGLE/'2theta','Omega','Chi','PH'/
|
||||||
INTEGER IRUPT
|
INTEGER IRUPT
|
||||||
NATT = 0
|
NATT = 0
|
||||||
|
C------- a debug flag! Set to 0 for no debug output
|
||||||
|
IDEBUG = 1
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
C If CAD-4 call the scan fitting version of the routine
|
C If CAD-4 call the scan fitting version of the routine
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
@ -30,6 +39,7 @@ C-----------------------------------------------------------------------
|
|||||||
IF (KI .EQ. 'ST') N = 1
|
IF (KI .EQ. 'ST') N = 1
|
||||||
IF (KI .EQ. 'SO') N = 2
|
IF (KI .EQ. 'SO') N = 2
|
||||||
IF (KI .EQ. 'SC') N = 3
|
IF (KI .EQ. 'SC') N = 3
|
||||||
|
IF (KI .EQ. 'SP') N = 4
|
||||||
ICHI = 0
|
ICHI = 0
|
||||||
IF (ST(3) .GE. 350.0 .OR. ST(3) .LE. 10.0) ICHI = 1
|
IF (ST(3) .GE. 350.0 .OR. ST(3) .LE. 10.0) ICHI = 1
|
||||||
IPHI = 0
|
IPHI = 0
|
||||||
@ -67,6 +77,11 @@ C-----------------------------------------------------------------------
|
|||||||
RETURN
|
RETURN
|
||||||
ENDIF
|
ENDIF
|
||||||
CALL CCTIME (PRESET,COUNT)
|
CALL CCTIME (PRESET,COUNT)
|
||||||
|
IF(IDEBUG .EQ. 1)THEN
|
||||||
|
WRITE(COUT,20000),AN(1),AN(2),AN(3),AN(4),COUNT
|
||||||
|
20000 FORMAT('TH = ',F8.2,' OM = ',F8.2,' CH = ',F8.2,' PH = ' F8.2,
|
||||||
|
& ' CTS = ', F8.2)
|
||||||
|
ENDIF
|
||||||
CALL KORQ(IRUPT)
|
CALL KORQ(IRUPT)
|
||||||
IF(IRUPT .NE. 1) THEN
|
IF(IRUPT .NE. 1) THEN
|
||||||
WRITE (COUT,10000)
|
WRITE (COUT,10000)
|
||||||
@ -154,11 +169,18 @@ C-----------------------------------------------------------------------
|
|||||||
IF (IMAX .EQ. 100 .AND. AFRAC*MAX .GT. MIN) GO TO 100
|
IF (IMAX .EQ. 100 .AND. AFRAC*MAX .GT. MIN) GO TO 100
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
C Case 2. There is no significant peak.
|
C Case 2. There is no significant peak.
|
||||||
|
C
|
||||||
|
C Modified: Drive back to start positions. So that other circle centering
|
||||||
|
C will not fail.
|
||||||
|
C Modified error code to give an FP in order to decide between
|
||||||
|
C interrupt and bad peak.
|
||||||
|
C Mark Koennecke, April 2000
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
IF (ILOW .LT. 1 .OR. IHIGH .GT. 100) THEN
|
IF (ILOW .LT. 1 .OR. IHIGH .GT. 100) THEN
|
||||||
WRITE (COUT,11000) ANGLE(N),ILOW,IHIGH
|
WRITE (COUT,11000) ANGLE(N),ILOW,IHIGH
|
||||||
CALL GWRITE (ITP,' ')
|
CALL GWRITE (ITP,' ')
|
||||||
KI = 'FF'
|
KI = 'FP'
|
||||||
|
CALL ANGSET(ST(1),ST(2),ST(3),ST(4),IA,IC)
|
||||||
RETURN
|
RETURN
|
||||||
ENDIF
|
ENDIF
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
|
@ -240,7 +240,7 @@ C-----------------------------------------------------------------------
|
|||||||
$ RTHETA,ROMEGA,RCHI,RPHI/4*0.0/, IH,IK,IL/1,2,3/
|
$ RTHETA,ROMEGA,RCHI,RPHI/4*0.0/, IH,IK,IL/1,2,3/
|
||||||
DATA IDH/72*0/, IBSECT,ISCAN/2*0/, FRAC/0.1/, IPRFLG/0/,
|
DATA IDH/72*0/, IBSECT,ISCAN/2*0/, FRAC/0.1/, IPRFLG/0/,
|
||||||
$ ISYS/1/, SINABS/3*0.00503135,3*0.0/, ILN/0/, DELAY/100/
|
$ ISYS/1/, SINABS/3*0.00503135,3*0.0/, ILN/0/, DELAY/100/
|
||||||
DATA COUT/20*' '/,IWNCUR/0/,ISREG/1,1,1,7*0/
|
DATA COUT/20*' '/,IWNCUR/0/,ISREG/1,1,1,0,0,0,0,0,1,0/
|
||||||
DATA STEP/0.02/,PRESET/15000./DPHI/0./
|
DATA STEP/0.02/,PRESET/15000./DPHI/0./
|
||||||
RETURN
|
RETURN
|
||||||
END
|
END
|
||||||
|
@ -20,7 +20,7 @@ C----------------------------------------------------------------------
|
|||||||
C Disabling some unsupported commands for TRICS
|
C Disabling some unsupported commands for TRICS
|
||||||
C----------------------------------------------------------------------
|
C----------------------------------------------------------------------
|
||||||
IF(KI .EQ. 'AD' .OR. KI .EQ. 'LT' .OR. KI .EQ. 'SH' .OR.
|
IF(KI .EQ. 'AD' .OR. KI .EQ. 'LT' .OR. KI .EQ. 'SH' .OR.
|
||||||
$ KI .EQ. 'IN' .OR. KI .EQ. 'NR' .OR. KI .EQ. 'SW' .OR.
|
$ KI .EQ. 'IN' .OR. KI .EQ. 'NR' .OR.
|
||||||
$ KI .EQ. 'EK' .OR. KI .EQ. 'FI' .OR. KI .EQ. 'KE' .OR.
|
$ KI .EQ. 'EK' .OR. KI .EQ. 'FI' .OR. KI .EQ. 'KE' .OR.
|
||||||
$ KI .EQ. 'MR' .OR. KI .EQ. 'MS')THEN
|
$ KI .EQ. 'MR' .OR. KI .EQ. 'MS')THEN
|
||||||
WRITE(COUT,23000)
|
WRITE(COUT,23000)
|
||||||
|
@ -387,7 +387,7 @@ C-----------------------------------------------------------------------
|
|||||||
ATT = ATTEN(NATT+1)
|
ATT = ATTEN(NATT+1)
|
||||||
IF (IPRFLG .EQ. 0) THEN
|
IF (IPRFLG .EQ. 0) THEN
|
||||||
if(FRAC1 .GT. 0.01) THEN
|
if(FRAC1 .GT. 0.01) THEN
|
||||||
PEAK = ATT*(SUM - 0.5*(BGRD1 + BGRD2)/FRAC1)
|
PEAK = ATT*(SUM - (0.5*(BGRD1 + BGRD2)/FRAC1)*NPK)
|
||||||
ELSE
|
ELSE
|
||||||
PEAK = 0.
|
PEAK = 0.
|
||||||
END IF
|
END IF
|
||||||
|
@ -257,9 +257,6 @@ C-----------------------------------------------------------------------
|
|||||||
DO 220 I = 1,ILOW-1
|
DO 220 I = 1,ILOW-1
|
||||||
B1 = B1 + ACOUNT(I)
|
B1 = B1 + ACOUNT(I)
|
||||||
220 CONTINUE
|
220 CONTINUE
|
||||||
C---mk
|
|
||||||
B1 = B1/ILOW
|
|
||||||
C---
|
|
||||||
ENDIF
|
ENDIF
|
||||||
FRAC1 = (FRAC*NP + ILOW - 1)/NPK
|
FRAC1 = (FRAC*NP + ILOW - 1)/NPK
|
||||||
PEAK = 0.0
|
PEAK = 0.0
|
||||||
@ -271,12 +268,9 @@ C---
|
|||||||
DO 230 I = IHIGH+1,NP
|
DO 230 I = IHIGH+1,NP
|
||||||
B2 = B2 + ACOUNT(I)
|
B2 = B2 + ACOUNT(I)
|
||||||
230 CONTINUE
|
230 CONTINUE
|
||||||
IDIV = NP - IHIGH
|
|
||||||
IF(IDIV .LE. 0)IDIV =1
|
|
||||||
B2 = B2/IDIV
|
|
||||||
ENDIF
|
ENDIF
|
||||||
FRAC2 = (FRAC*NP + NP - IHIGH)/NPK
|
FRAC2 = (FRAC*NP + NP - IHIGH)/NPK
|
||||||
BTOT = 0.5*(B1/FRAC1 + B2/FRAC2)*NP
|
BTOT = 0.5*(B1/FRAC1 + B2/FRAC2)
|
||||||
TOP1 = PEAK - BTOT
|
TOP1 = PEAK - BTOT
|
||||||
BOT1 = SQRT(PEAK + 0.25*(B1/(FRAC1*FRAC1) + B2/(FRAC2*FRAC2)))
|
BOT1 = SQRT(PEAK + 0.25*(B1/(FRAC1*FRAC1) + B2/(FRAC2*FRAC2)))
|
||||||
FRAC1 = 0.5*(FRAC1 + FRAC2)
|
FRAC1 = 0.5*(FRAC1 + FRAC2)
|
||||||
@ -306,7 +300,9 @@ C-----------------------------------------------------------------------
|
|||||||
CALL GWRITE (ITP,' ')
|
CALL GWRITE (ITP,' ')
|
||||||
ENDIF
|
ENDIF
|
||||||
240 CALL RSW(9,JSW)
|
240 CALL RSW(9,JSW)
|
||||||
IF (JSW .NE. 0 .and. istan .ne. 0) CALL PRFWRT (NP)
|
C------- always write profile at TRICS!
|
||||||
|
C IF (JSW .NE. 0 .and. istan .ne. 0) CALL PRFWRT (NP)
|
||||||
|
CALL PRFWRT (NP)
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
C Prepare the profile for display on the c.r.t. if wanted
|
C Prepare the profile for display on the c.r.t. if wanted
|
||||||
C Code below here is not needed for profile analysis
|
C Code below here is not needed for profile analysis
|
||||||
|
@ -113,3 +113,4 @@ C-----------------------------------------------------------------------
|
|||||||
210 CONTINUE
|
210 CONTINUE
|
||||||
RETURN
|
RETURN
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -145,6 +145,7 @@ C RSW Read the switch register
|
|||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
SUBROUTINE RSW (N,IVALUE)
|
SUBROUTINE RSW (N,IVALUE)
|
||||||
INCLUDE 'COMDIF'
|
INCLUDE 'COMDIF'
|
||||||
|
IVALUE = ISREG(N)
|
||||||
RETURN
|
RETURN
|
||||||
END
|
END
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
|
@ -9,6 +9,12 @@ C-----------------------------------------------------------------------
|
|||||||
INCLUDE 'COMDIF'
|
INCLUDE 'COMDIF'
|
||||||
DIMENSION ANG(4)
|
DIMENSION ANG(4)
|
||||||
CALL SHUTTR (99)
|
CALL SHUTTR (99)
|
||||||
|
C----- a fixed value for PHI alignement, MK
|
||||||
|
DP = .1
|
||||||
|
C----- debug message: MK
|
||||||
|
WRITE(COUT,22)DT, DO, DC
|
||||||
|
22 FORMAT('STEP OM: ',F8.2,' Step TH: ',F8.2,' Step CH: ',F8.2)
|
||||||
|
CALL GWRITE(ITP,' ')
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
C For the CAD-4 centering is as follows :--
|
C For the CAD-4 centering is as follows :--
|
||||||
C 1. an omega/2theta scan with the 4mm variable slit,
|
C 1. an omega/2theta scan with the 4mm variable slit,
|
||||||
@ -43,17 +49,25 @@ C-----------------------------------------------------------------------
|
|||||||
CALL CENTRE (DC,ANG,0)
|
CALL CENTRE (DC,ANG,0)
|
||||||
IF (KI .EQ. 'FF') GO TO 100
|
IF (KI .EQ. 'FF') GO TO 100
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
|
C Align Phi
|
||||||
|
C----------------------------------------------------------------------
|
||||||
|
KI = 'SP'
|
||||||
|
CALL CENTRE(DP,ANG,0)
|
||||||
|
IF (KI .EQ. 'FF') GO TO 100
|
||||||
|
C-----------------------------------------------------------------------
|
||||||
C Omega again
|
C Omega again
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
KI = 'SO'
|
KI = 'SO'
|
||||||
CALL CENTRE (DO,ANG,0)
|
CALL CENTRE (DO,ANG,0)
|
||||||
IF (KI .EQ. 'FF') GO TO 100
|
IF (KI .EQ. 'FF') GO TO 100
|
||||||
|
IF (KI .EQ. 'FP') GO TO 100
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
C Align 2Theta
|
C Align 2Theta
|
||||||
C----------------------------------------------------------------------
|
C----------------------------------------------------------------------
|
||||||
KI = 'ST'
|
KI = 'ST'
|
||||||
CALL CENTRE (DT,ANG,0)
|
CALL CENTRE (DT,ANG,0)
|
||||||
IF (KI .EQ. 'FF') GO TO 100
|
IF (KI .EQ. 'FF') GO TO 100
|
||||||
|
IF (KI .EQ. 'FP') GO TO 100
|
||||||
ENDIF
|
ENDIF
|
||||||
C-----------------------------------------------------------------------
|
C-----------------------------------------------------------------------
|
||||||
C The answers are passed in BPSI in COMMON
|
C The answers are passed in BPSI in COMMON
|
||||||
|
@ -185,6 +185,9 @@
|
|||||||
/* get the current position */
|
/* get the current position */
|
||||||
|
|
||||||
iRet = self->pDriv->GetValue(self->pDriv,&fPos);
|
iRet = self->pDriv->GetValue(self->pDriv,&fPos);
|
||||||
|
|
||||||
|
printf("Return: %d Value: %f\n",iRet,fPos);
|
||||||
|
|
||||||
if(iRet == 0)
|
if(iRet == 0)
|
||||||
{
|
{
|
||||||
self->pDriv->GetError(self->pDriv,&iCode, pError,131);
|
self->pDriv->GetError(self->pDriv,&iCode, pError,131);
|
||||||
|
119
hkl.c
119
hkl.c
@ -443,6 +443,7 @@
|
|||||||
self->fUB[ii+2]*fHKL[2];
|
self->fUB[ii+2]*fHKL[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* bissecting calculation! */
|
||||||
if(!self->iNOR)
|
if(!self->iNOR)
|
||||||
{
|
{
|
||||||
/* four circle calculation */
|
/* four circle calculation */
|
||||||
@ -590,7 +591,7 @@
|
|||||||
} /* end four circle */
|
} /* end four circle */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* start normal beam calculation */
|
/* start normal bissecting calculation */
|
||||||
/* ignore psi values */
|
/* ignore psi values */
|
||||||
d2 = 0.;
|
d2 = 0.;
|
||||||
for(i = 0; i < 3; i++)
|
for(i = 0; i < 3; i++)
|
||||||
@ -634,7 +635,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
int CalculateSettings(pHKL self, float fHKL[3], float fPsi, int iHamil,
|
/* This may become dead code if the looping show does not work */
|
||||||
|
int CulculuteSettings(pHKL self, float fHKL[3], float fPsi, int iHamil,
|
||||||
float fSet[4], SConnection *pCon)
|
float fSet[4], SConnection *pCon)
|
||||||
{
|
{
|
||||||
int iRet, iSuccess = 0, iRes = 1, iRetry = 1;
|
int iRet, iSuccess = 0, iRes = 1, iRetry = 1;
|
||||||
@ -678,7 +680,8 @@
|
|||||||
if(!iTest)
|
if(!iTest)
|
||||||
{
|
{
|
||||||
/* this cannot be fixed */
|
/* this cannot be fixed */
|
||||||
sprintf(pBueffel,"ERROR: %4.1f, %4.1f, %4.1f, %5.2f violates two theta limits",
|
sprintf(pBueffel,
|
||||||
|
"ERROR: %4.1f, %4.1f, %4.1f, %5.2f violates two theta limits",
|
||||||
fSet[0], fHKL[0], fHKL[1],fHKL[2]);
|
fSet[0], fHKL[0], fHKL[1],fHKL[2]);
|
||||||
SCWrite(pCon,pBueffel,eError);
|
SCWrite(pCon,pBueffel,eError);
|
||||||
return 0;
|
return 0;
|
||||||
@ -708,7 +711,8 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* this cannot be fixed */
|
/* this cannot be fixed */
|
||||||
sprintf(pBueffel,"ERROR: %4.1f, %4.1f, %4.1f, %5.2f violates omega limits",
|
sprintf(pBueffel,
|
||||||
|
"ERROR: %4.1f, %4.1f, %4.1f, %5.2f violates omega limits",
|
||||||
fSet[1], fHKL[0], fHKL[1],fHKL[2]);
|
fSet[1], fHKL[0], fHKL[1],fHKL[2]);
|
||||||
SCWrite(pCon,pBueffel,eError);
|
SCWrite(pCon,pBueffel,eError);
|
||||||
return 0;
|
return 0;
|
||||||
@ -774,6 +778,113 @@
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
/*-------------------------------------------------------------------------
|
||||||
|
calculates the four circle settings. If the position can not be reached
|
||||||
|
because of a limit violation, then psi is rotated in 10 degree steps
|
||||||
|
until either the loop ends or we finally succed.
|
||||||
|
*/
|
||||||
|
int CalculateSettings(pHKL self, float fHKL[3], float fPsi, int iHamil,
|
||||||
|
float fSet[4], SConnection *pCon)
|
||||||
|
{
|
||||||
|
int iRet,iRetry, i;
|
||||||
|
int iQuad = 0;
|
||||||
|
int iTest;
|
||||||
|
float fDelom = 0.;
|
||||||
|
char pError[132];
|
||||||
|
char pBueffel[512];
|
||||||
|
float fHard;
|
||||||
|
float fVal;
|
||||||
|
float myPsi = fPsi;
|
||||||
|
|
||||||
|
/* catch shitty input */
|
||||||
|
if( (fHKL[0] == 0.) && (fHKL[1] == 0.) && (fHKL[2] == 0.))
|
||||||
|
{
|
||||||
|
SCWrite(pCon,"ERROR: I will not calculate angles for HKL = (0,0,0) ",
|
||||||
|
eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* no retries if normal beam calculation
|
||||||
|
or specific Hamilton or specific
|
||||||
|
psi requested */
|
||||||
|
if( (self->iNOR) || (iHamil != 0) || (myPsi > 0.1) )
|
||||||
|
{
|
||||||
|
iRetry = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iRetry = 35;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* loop till success */
|
||||||
|
for(i = 0, myPsi = 0.; i < iRetry; i++, myPsi += 10.);
|
||||||
|
{
|
||||||
|
/* just try it*/
|
||||||
|
iRet = ICAL(self,fHKL, myPsi, iHamil, self->iQuad,fSet,fDelom);
|
||||||
|
if(iRet < 0 ) /* could not do it */
|
||||||
|
{
|
||||||
|
sprintf(pBueffel,"ERROR: cannot calculate %4.1f %4.1f %4.1f",
|
||||||
|
fHKL[0], fHKL[1], fHKL[2]);
|
||||||
|
SCWrite(pCon,pBueffel,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check two theta */
|
||||||
|
iTest = MotorCheckBoundary(self->pTheta,fSet[0], &fHard,pError,131);
|
||||||
|
if(!iTest)
|
||||||
|
{
|
||||||
|
/* this cannot be fixed */
|
||||||
|
sprintf(pBueffel,
|
||||||
|
"ERROR: %4.1f, %4.1f, %4.1f, %5.2f violates two theta limits",
|
||||||
|
fSet[0], fHKL[0], fHKL[1],fHKL[2]);
|
||||||
|
SCWrite(pCon,pBueffel,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check nu and omega if normal beam */
|
||||||
|
if(self->iNOR)
|
||||||
|
{
|
||||||
|
/* check omega */
|
||||||
|
iTest = MotorCheckBoundary(self->pOmega,fSet[1], &fHard,pError,131);
|
||||||
|
iTest += MotorCheckBoundary(self->pNu,fSet[2], &fHard,pError,131);
|
||||||
|
if(iTest != 2)
|
||||||
|
{
|
||||||
|
sprintf(pBueffel,
|
||||||
|
"ERROR: %4.1f, %4.1f, %4.1f, %5.2f %5.2f %5.2f violates nu limits",
|
||||||
|
fHKL[0], fHKL[1],fHKL[2],fSet[0], fSet[1],fSet[2]);
|
||||||
|
SCWrite(pCon,pBueffel,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* check chi and phi and omega, but first put into 0-360 degrees */
|
||||||
|
if(fSet[2] < 0.0)
|
||||||
|
{
|
||||||
|
fSet[2] = 360.0 + fSet[2];
|
||||||
|
}
|
||||||
|
if(fSet[3] < 0.0)
|
||||||
|
{
|
||||||
|
fSet[3] = 360.0 + fSet[3];
|
||||||
|
}
|
||||||
|
iTest = MotorCheckBoundary(self->pOmega,fSet[1], &fHard,pError,131);
|
||||||
|
iTest += MotorCheckBoundary(self->pChi,fSet[2], &fHard,pError,131);
|
||||||
|
iTest += MotorCheckBoundary(self->pPhi,fSet[4], &fHard,pError,131);
|
||||||
|
if(iTest == 3) /* none of them burns */
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sprintf(pBueffel,
|
||||||
|
"ERROR: failed to find a possible setting for %4.1f %4.1f %4.1f %s",
|
||||||
|
fHKL[0], fHKL[1], fHKL[2], "\n Even tried 36 psi settings");
|
||||||
|
SCWrite(pCon,pBueffel,eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
/*-------------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------------*/
|
||||||
int RunHKL(pHKL self, float fHKL[3],
|
int RunHKL(pHKL self, float fHKL[3],
|
||||||
float fPsi, int iHamil, SConnection *pCon)
|
float fPsi, int iHamil, SConnection *pCon)
|
||||||
|
@ -94,12 +94,14 @@
|
|||||||
/*-----------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------*/
|
||||||
static float L2AGetValue(void *pData, SConnection *pCon)
|
static float L2AGetValue(void *pData, SConnection *pCon)
|
||||||
{
|
{
|
||||||
float fX;
|
float fX, zero = 0.;
|
||||||
pLin2Ang self = NULL;
|
pLin2Ang self = NULL;
|
||||||
|
|
||||||
self = (pLin2Ang)pData;
|
self = (pLin2Ang)pData;
|
||||||
assert(self);
|
assert(self);
|
||||||
fX = self->lin->pDrivInt->GetValue(self->lin,pCon);
|
fX = self->lin->pDrivInt->GetValue(self->lin,pCon);
|
||||||
|
MotorGetPar(self->lin,"softzero",&zero);
|
||||||
|
fX -= zero;
|
||||||
return x2ang(self,fX);
|
return x2ang(self,fX);
|
||||||
}
|
}
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
1
macro.c
1
macro.c
@ -839,6 +839,7 @@ extern Tcl_Interp *InterpGetTcl(SicsInterp *pSics);
|
|||||||
|
|
||||||
Arg2Text(argc-1,&argv[1],pCommand,1023);
|
Arg2Text(argc-1,&argv[1],pCommand,1023);
|
||||||
iRet = InterpExecute(pSics,pCon,pCommand);
|
iRet = InterpExecute(pSics,pCon,pCommand);
|
||||||
|
SicsWait(1);
|
||||||
SCWrite(pCon,"TRANSACTIONFINISHED",eError);
|
SCWrite(pCon,"TRANSACTIONFINISHED",eError);
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
@ -359,7 +359,7 @@ CreateSocketAdress(
|
|||||||
iRet = send(self->sockid,buffer,lLen,0);
|
iRet = send(self->sockid,buffer,lLen,0);
|
||||||
if(iRet != lLen)
|
if(iRet != lLen)
|
||||||
{
|
{
|
||||||
/* puts("Incomplete send "); */
|
printf("Incomplete send: %d to %d\n ",iRet,lLen);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -427,7 +427,14 @@
|
|||||||
lID = TaskRegister(pTask,WaitTask,WaitSignal,NULL,&sWait,1);
|
lID = TaskRegister(pTask,WaitTask,WaitSignal,NULL,&sWait,1);
|
||||||
TaskWait(pTask,lID);
|
TaskWait(pTask,lID);
|
||||||
SetStatus(eOld);
|
SetStatus(eOld);
|
||||||
return i;
|
if(SCGetInterrupt(pCon) != eContinue)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
int SicsWait(long lTime)
|
int SicsWait(long lTime)
|
||||||
|
@ -129,7 +129,7 @@ phone setAccess 2
|
|||||||
adress UNKNOWN
|
adress UNKNOWN
|
||||||
adress setAccess 2
|
adress setAccess 2
|
||||||
# Counter counter
|
# Counter counter
|
||||||
counter SetPreset 120.000000
|
counter SetPreset 1.000000
|
||||||
counter SetMode Timer
|
counter SetMode Timer
|
||||||
# Motor som
|
# Motor som
|
||||||
som SoftZero 0.000000
|
som SoftZero 0.000000
|
||||||
@ -365,7 +365,7 @@ a1 InterruptMode 0.000000
|
|||||||
a1 AccessCode 2.000000
|
a1 AccessCode 2.000000
|
||||||
user Joseph Stalin
|
user Joseph Stalin
|
||||||
user setAccess 2
|
user setAccess 2
|
||||||
sample Fischdosen
|
sample Wuergehals = doof, bloed und dumm
|
||||||
sample setAccess 2
|
sample setAccess 2
|
||||||
title Nasse Fische in Dosen
|
title Nasse Fische in Dosen
|
||||||
title setAccess 2
|
title setAccess 2
|
||||||
|
@ -352,8 +352,15 @@ proc sftime {} {
|
|||||||
proc scaninfo {} {
|
proc scaninfo {} {
|
||||||
set result [scan info]
|
set result [scan info]
|
||||||
set r1 [sample]
|
set r1 [sample]
|
||||||
set l1 [split $r1 "="]
|
set inf [string first = $r1]
|
||||||
append result "," [lindex $l1 1]
|
if {$inf > 0} {
|
||||||
|
incr inf
|
||||||
|
set sa [string range $r1 $inf end]
|
||||||
|
} else {
|
||||||
|
set sa Unknown
|
||||||
|
}
|
||||||
|
regsub -all , $sa " " sam
|
||||||
|
append result "," $sam
|
||||||
append result "," [sicstime]
|
append result "," [sicstime]
|
||||||
set r1 [lastscancommand]
|
set r1 [lastscancommand]
|
||||||
set l1 [split $r1 "="]
|
set l1 [split $r1 "="]
|
||||||
|
@ -9,7 +9,7 @@ OBJ= tecs_cli.o coc_client.o coc_util.o err_handling.o \
|
|||||||
|
|
||||||
#------------ for DigitalUnix
|
#------------ for DigitalUnix
|
||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS= -std1 -g -c -warnprotos -I. -I../hardsup
|
CFLAGS= -std1 -g -c -warnprotos -I../ -I. -I../hardsup
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) $(CFLAGS) $*.c
|
$(CC) $(CFLAGS) $*.c
|
||||||
@ -19,7 +19,7 @@ tecs: $(OBJ)
|
|||||||
ar cr libtecsl.a $(OBJ)
|
ar cr libtecsl.a $(OBJ)
|
||||||
ranlib libtecsl.a
|
ranlib libtecsl.a
|
||||||
- rm TecsServer
|
- rm TecsServer
|
||||||
cc -o TecsServer -g tecs.c -lm -L. -ltecsl -L../hardsup -lhlib
|
cc -o TecsServer -g -I../ tecs.c -lm -L. -ltecsl -L../hardsup -lhlib
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm *.o
|
rm *.o
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <fortify.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <fortify.h>
|
||||||
#include "coc_logfile.h"
|
#include "coc_logfile.h"
|
||||||
#include "err_handling.h"
|
#include "err_handling.h"
|
||||||
#include "str_util.h"
|
#include "str_util.h"
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "coc_logfile.h"
|
#include "coc_logfile.h"
|
||||||
#include "coc_server.h"
|
#include "coc_server.h"
|
||||||
#include "str_util.h"
|
#include "str_util.h"
|
||||||
|
#include <fortify.h>
|
||||||
|
|
||||||
static Str_Buf *buf, *bufo;
|
static Str_Buf *buf, *bufo;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <fortify.h>
|
||||||
#include "err_handling.h"
|
#include "err_handling.h"
|
||||||
#include "str_util.h"
|
#include "str_util.h"
|
||||||
#include "coc_util.h"
|
#include "coc_util.h"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <fortify.h>
|
||||||
#include "err_handling.h"
|
#include "err_handling.h"
|
||||||
|
|
||||||
#define SLEN 64
|
#define SLEN 64
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <fortify.h>
|
||||||
#include "err_handling.h"
|
#include "err_handling.h"
|
||||||
#include "str_util.h"
|
#include "str_util.h"
|
||||||
#include "str_buf.h"
|
#include "str_buf.h"
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <fortify.h>
|
||||||
#include "err_handling.h"
|
#include "err_handling.h"
|
||||||
#include "str_util.h"
|
#include "str_util.h"
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <fortify.h>
|
||||||
#include "err_handling.h"
|
#include "err_handling.h"
|
||||||
#include "coc_server.h"
|
#include "coc_server.h"
|
||||||
#include "coc_logfile.h"
|
#include "coc_logfile.h"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <fortify.h>
|
||||||
#include "err_handling.h"
|
#include "err_handling.h"
|
||||||
#include "str_util.h"
|
#include "str_util.h"
|
||||||
#include "tecs_cli.h"
|
#include "tecs_cli.h"
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <fortify.h>
|
||||||
#include "err_handling.h"
|
#include "err_handling.h"
|
||||||
#include "str_util.h"
|
#include "str_util.h"
|
||||||
#include "tecs_dlog.h"
|
#include "tecs_dlog.h"
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <fortify.h>
|
||||||
#include "err_handling.h"
|
#include "err_handling.h"
|
||||||
#include "coc_logfile.h"
|
#include "coc_logfile.h"
|
||||||
#include "coc_util.h"
|
#include "coc_util.h"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <fortify.h>
|
||||||
#include "rs232c_def.h"
|
#include "rs232c_def.h"
|
||||||
#include "asynsrv_def.h"
|
#include "asynsrv_def.h"
|
||||||
#include "sinq_prototypes.h"
|
#include "sinq_prototypes.h"
|
||||||
|
12
test.tcl
12
test.tcl
@ -34,10 +34,10 @@ ServerOption LogFileBaseName $shome/sics/tmp/server
|
|||||||
# the path and base name of the internal server logfile to which all
|
# the path and base name of the internal server logfile to which all
|
||||||
# activity will be logged.
|
# activity will be logged.
|
||||||
|
|
||||||
ServerOption TecsStartCmd "/data/zolliker/cvs/sics/tecs/TecsServer -h lnsp26:4000/0"
|
ServerOption TecsStartCmd "tecs/TecsServer -h lnsp21:4000/7"
|
||||||
# -h host:port/channel is for serial server
|
# -h host:port/channel is for serial server
|
||||||
ServerOption TecsBinDir /data/zolliker/cvs/sics/tecs/bin/
|
ServerOption TecsBinDir tecs/bin/
|
||||||
ServerOption TecsLogDir /data/zolliker/cvs/sics/tecs/log/
|
ServerOption TecsLogDir /data/koenneck/tmp/
|
||||||
ServerOption TecsPort 9753
|
ServerOption TecsPort 9753
|
||||||
|
|
||||||
ServerOption statusfile sicsstatus.tcl
|
ServerOption statusfile sicsstatus.tcl
|
||||||
@ -295,8 +295,8 @@ MakeDifrac twotheta omega chi phi counter
|
|||||||
ClientPut "Installed 4-circle stuff"
|
ClientPut "Installed 4-circle stuff"
|
||||||
|
|
||||||
|
|
||||||
source transact.tcl
|
#source transact.tcl
|
||||||
Publish transact Spy
|
#Publish transact Spy
|
||||||
#MakeSPS suff lnsp26.psi.ch 4000 7
|
#MakeSPS suff lnsp26.psi.ch 4000 7
|
||||||
|
|
||||||
#source beamdt.tcl
|
#source beamdt.tcl
|
||||||
@ -378,3 +378,5 @@ MakeXYTable omth
|
|||||||
|
|
||||||
Publish info user
|
Publish info user
|
||||||
MakeLin2Ang a5l a5
|
MakeLin2Ang a5l a5
|
||||||
|
|
||||||
|
source tmp/beam.tcl
|
||||||
|
@ -135,7 +135,7 @@
|
|||||||
/* do the header */
|
/* do the header */
|
||||||
ReadWrite(&sWrite,"begin 622 ");
|
ReadWrite(&sWrite,"begin 622 ");
|
||||||
ReadWrite(&sWrite,pName);
|
ReadWrite(&sWrite,pName);
|
||||||
ReadWrite(&sWrite,"\r\n");
|
ReadWrite(&sWrite," \r\n");
|
||||||
|
|
||||||
/* well, do it */
|
/* well, do it */
|
||||||
for( ; ;)
|
for( ; ;)
|
||||||
@ -158,7 +158,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* finish the game */
|
/* finish the game */
|
||||||
ReadWrite(&sWrite,"end\r\n");
|
ReadWrite(&sWrite,"end \r\n");
|
||||||
*pEncoded = sWrite.pPtr;
|
*pEncoded = sWrite.pPtr;
|
||||||
*iLength = sWrite.iBufPtr;
|
*iLength = sWrite.iBufPtr;
|
||||||
return 1;
|
return 1;
|
||||||
|
Reference in New Issue
Block a user