- Introduced a state filed into first generation objects
- Fixed some issues with error returns not being properly handled in devexec - Fixed a bug in motorlist which caused limit checks to fail - Fixed an issue with the TDCHM not properly updating the counter values on finish - Readded getHipadabaPar in ChainCallback as this caused a problem in ei - Made tasdrive ignore sgu, sgl when out of plane not allowed SKIPPED: psi/eigermono.c psi/sinqhttp.c psi/tdchm.c
This commit is contained in:
@ -4,6 +4,10 @@
|
||||
copyright: see file COPYRIGHT
|
||||
|
||||
Mark Koennecke, September 2006
|
||||
|
||||
Added generating a gaussian for scan testing
|
||||
|
||||
Mark Koennecke, April 2013
|
||||
----------------------------------------------------------------------------*/
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
@ -20,16 +24,22 @@
|
||||
#define PAUSEFAIL 3
|
||||
#define CONTFAIL 4
|
||||
#define READFAIL 5
|
||||
#define GAUSS 6
|
||||
|
||||
#define STATEIDLE 0
|
||||
#define STATERUN 1
|
||||
#define STATEPAU 2
|
||||
/*---------------------------- for generating a gaussian -------------------*/
|
||||
#define FWHM 2.5
|
||||
#define POS 6.
|
||||
#define HEIGHT 100.
|
||||
/*--------------------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
int errType;
|
||||
int recover;
|
||||
int state;
|
||||
time_t endTime;
|
||||
int startCount;
|
||||
} RegressSt;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int RegressGetStatus(struct __COUNTER *self, float *fControl)
|
||||
@ -83,6 +93,7 @@ static int RegressStart(struct __COUNTER *self)
|
||||
} else {
|
||||
pSim->endTime = time(NULL) + 7;
|
||||
}
|
||||
pSim->startCount++;
|
||||
|
||||
return OKOK;
|
||||
}
|
||||
@ -144,6 +155,7 @@ static int RegressReadValues(struct __COUNTER *self)
|
||||
{
|
||||
RegressSt *pSim = NULL;
|
||||
int i;
|
||||
float stddev, tmp, y;
|
||||
|
||||
assert(self);
|
||||
pSim = (RegressSt *) self->pData;
|
||||
@ -156,6 +168,12 @@ static int RegressReadValues(struct __COUNTER *self)
|
||||
for (i = 0; i < MAXCOUNT; i++) {
|
||||
self->lCounts[i] = i * 10 + 5;
|
||||
}
|
||||
if(pSim->errType == GAUSS){
|
||||
stddev = FWHM/2.254;
|
||||
tmp = ((float)pSim->startCount - POS)/stddev;
|
||||
y = HEIGHT*exp(-.5*tmp*tmp);
|
||||
self->lCounts[0] = (long)y + 10;
|
||||
}
|
||||
self->lCounts[1] = self->fPreset;
|
||||
self->fTime = self->fPreset;
|
||||
return OKOK;
|
||||
@ -199,6 +217,9 @@ static int RegressSet(struct __COUNTER *self, char *name, int iCter,
|
||||
|
||||
if (strcmp(name, "errortype") == 0) {
|
||||
pSim->errType = (int) FVal;
|
||||
if(pSim->errType == GAUSS){
|
||||
pSim->startCount = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(name, "recover") == 0) {
|
||||
|
Reference in New Issue
Block a user