Cleaned up ANSTO code to merge with sinqdev.sics

This is our new RELEASE-4_0 branch which was taken from ansto/93d9a7c
Conflicts:
	.gitignore
	SICSmain.c
	asynnet.c
	confvirtualmot.c
	counter.c
	devexec.c
	drive.c
	event.h
	exebuf.c
	exeman.c
	histmem.c
	interface.h
	motor.c
	motorlist.c
	motorsec.c
	multicounter.c
	napi.c
	napi.h
	napi4.c
	network.c
	nwatch.c
	nxscript.c
	nxxml.c
	nxxml.h
	ofac.c
	reflist.c
	scan.c
	sicshipadaba.c
	sicsobj.c
	site_ansto/docs/Copyright.txt
	site_ansto/instrument/lyrebird/config/tasmad/sicscommon/nxsupport.tcl
	site_ansto/instrument/lyrebird/config/tasmad/taspub_sics/tasscript.tcl
	statusfile.c
	tasdrive.c
	tasub.c
	tasub.h
	tasublib.c
	tasublib.h
This commit is contained in:
Ferdi Franceschini
2015-04-23 20:49:26 +10:00
parent c650788a2c
commit 10d29d597c
1336 changed files with 9430 additions and 226646 deletions

View File

@@ -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) {