- New batch file management module

- New oscillator module
- Bug fixes


SKIPPED:
	psi/buffer.c
	psi/el734hp.c
	psi/el737hpdriv.c
	psi/make_gen
	psi/nextrics.c
	psi/nxamor.c
	psi/pimotor.c
	psi/polterwrite.c
	psi/psi.c
	psi/swmotor2.c
	psi/tasscan.c
	psi/tricssupport.c
	psi/tricssupport.h
	psi/tecs/make_gen
	psi/utils/ecb_load_new/ecb_load.c
	psi/utils/ecb_load_new/ecb_load.h
	psi/utils/ecb_load_new/ecbdriv_els.c
	psi/utils/ecb_load_new/gpib_els.c
	psi/utils/ecb_load_new/makefile
	psi/utils/ecb_load_new/makefile_EGPIB
	psi/utils/ecb_load_new/makefile_GPIB
This commit is contained in:
cvs
2004-11-17 10:50:15 +00:00
parent f7c8ae30c6
commit 0f4e959e22
46 changed files with 3675 additions and 834 deletions

131
mesure.c
View File

@@ -26,14 +26,11 @@
#include "evcontroller.h"
#include "mesure.h"
#include "nxscript.h"
#include "lld.h"
extern void SNXFormatTime(char *pBueffel, int iLen);
#define ANGERR 0.2
/* nxutil.h
*/
/*
#define MESSDEBUG 1
@@ -71,7 +68,16 @@
float fPosition[4]; /* the real positions after driving */
int iCompact; /* true if compact scan ouput. */
int psiMode; /* 1 for psi scan mode, 0 else */
int stepList; /* a list of stepwidth ranges */
} Mesure;
/*---------------------------------------------------------------------
Entries for the stepwidth range list
----------------------------------------------------------------------*/
typedef struct {
float start;
float end;
float stepWidth;
}StepEntry;
/*--------------------------------------------------------------------------*/
pMesure CreateMesure(pHKL pCryst, pScanData pScanner, pMotor pOmega,
char *pOm, char *po2t, char *pFileRoot,
@@ -121,6 +127,7 @@
pNew->lCounts = (long *)malloc(90*sizeof(long));
#endif
pNew->lCounts = (long *)malloc(50*sizeof(long));
pNew->stepList = LLDcreate(sizeof(StepEntry));
return pNew;
}
/*------------------------------------------------------------------------*/
@@ -150,6 +157,7 @@
MesureClose(self);
if(self->lCounts)
free(self->lCounts);
LLDdelete(self->stepList);
free(self);
}
/*------------------------------------------------------------------------*/
@@ -351,12 +359,46 @@
return 1;
}
/*------------------------------------------------------------------------*/
static void addStepRange(pMesure self, float start, float end, float step)
{
StepEntry se;
assert(self != NULL);
se.start = start;
se.end = end;
se.stepWidth = step;
LLDnodeAppendFrom(self->stepList,&se);
}
/*------------------------------------------------------------------------*/
static float determineStepWidth(pMesure self, float two_theta)
{
float stepWidth;
StepEntry se;
int iRet;
assert(self != NULL);
stepWidth = self->fStep;
iRet = LLDnodePtr2First(self->stepList);
while(iRet != 0)
{
LLDnodeDataTo(self->stepList,&se);
if(two_theta > se.start && two_theta < se.end)
{
stepWidth = se.stepWidth;
break;
}
iRet = LLDnodePtr2Next(self->stepList);
}
return stepWidth;
}
/*--------------------------------------------------------------------------*/
int MesureReflection(pMesure self, float fHKL[3], float fPsi,
SConnection *pCon)
{
int iRet, i;
float fStart;
float fStart, stepWidth;
float fDelta, fSet[4];
char pBueffel[132];
@@ -402,19 +444,25 @@
{
return iRet;
}
fStart -= (self->np/2)*self->fStep;
stepWidth = determineStepWidth(self,self->fPosition[0]);
if(stepWidth != self->fStep)
{
snprintf(pBueffel,130,"Using stepwidth %f",stepWidth);
SCWrite(pCon,pBueffel,eWarning);
}
fStart -= (self->np/2)*stepWidth;
/* set the scan up */
ClearScanVar(self->pScanner);
if(self->iMode == 0)
{
AddScanVar(self->pScanner, pServ->pSics,pCon,self->pCOmega,
fStart, self->fStep);
fStart, stepWidth);
}
else
{
AddScanVar(self->pScanner, pServ->pSics,pCon,self->pO2T,
fStart, self->fStep);
fStart, stepWidth);
}
/* do the scan */
@@ -435,7 +483,7 @@
{
int iRet, i;
float fStart, fDelta;
float fStart, fDelta, stepWidth;
char pBueffel[132];
assert(self);
@@ -479,19 +527,25 @@
{
return iRet;
}
fStart -= (self->np/2)*self->fStep;
stepWidth = determineStepWidth(self,self->fPosition[0]);
if(stepWidth != self->fStep)
{
snprintf(pBueffel,130,"Using stepwidth %f",stepWidth);
SCWrite(pCon,pBueffel,eWarning);
}
fStart -= (self->np/2)*stepWidth;
/* set the scan up */
ClearScanVar(self->pScanner);
if(self->iMode == 0)
{
AddScanVar(self->pScanner, pServ->pSics,pCon,self->pCOmega,
fStart, self->fStep);
fStart, stepWidth);
}
else
{
AddScanVar(self->pScanner, pServ->pSics,pCon,self->pO2T,
fStart, self->fStep);
fStart, stepWidth);
}
/* do the scan */
@@ -1142,7 +1196,7 @@
char pBueffel[1024];
pMesure self = NULL;
double d;
float fVal, fHKL[3];
float fVal, fHKL[3], start, end, step;
self = (pMesure)pData;
assert(self);
@@ -1389,6 +1443,55 @@
return 1;
}
}
else if(strcmp(argv[1],"addrange") == 0)
{
if(argc < 5)
{
SCWrite(pCon,"ERROR: not enough arguments to addrange",eError);
return 0;
}
if(!SCMatchRights(pCon,usUser))
{
return 0;
}
iRet = Tcl_GetDouble(pSics->pTcl,argv[2],&d);
if(iRet != TCL_OK)
{
snprintf(pBueffel,131,
"ERROR: expected numeric value but got %s",argv[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
start = (float)d;
iRet = Tcl_GetDouble(pSics->pTcl,argv[3],&d);
if(iRet != TCL_OK)
{
snprintf(pBueffel,131,
"ERROR: expected numeric value but got %s",argv[3]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
end = (float)d;
iRet = Tcl_GetDouble(pSics->pTcl,argv[4],&d);
if(iRet != TCL_OK)
{
snprintf(pBueffel,131,
"ERROR: expected numeric value but got %s",argv[4]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
step = (float)d;
addStepRange(self,start,end,step);
SCSendOK(pCon);
return 1;
}
else if(strcmp(argv[1],"clearrange") == 0)
{
LLDdelete(self->stepList);
self->stepList = LLDcreate(sizeof(StepEntry));
SCSendOK(pCon);
return 1;
}
/*------ can be other pars */
else
{