new features for evcontroller Nov.2002 M.Z.
This commit is contained in:
151
evcontroller.c
151
evcontroller.c
@ -39,6 +39,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
#include <tcl.h>
|
||||
#include "fortify.h"
|
||||
#include "splitter.h"
|
||||
@ -83,6 +84,9 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
self->fTarget = fVal;
|
||||
self->eMode = EVDrive;
|
||||
self->iStop = 0;
|
||||
self->start = time(NULL);
|
||||
self->lastt = 0;
|
||||
self->iWarned = 0;
|
||||
|
||||
/* try at least three times to do it */
|
||||
for(i = 0; i < 3; i++)
|
||||
@ -178,8 +182,8 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
float fPos, fDelta;
|
||||
int iRet, iCode, iFix;
|
||||
char pBueffel[256], pError[132];
|
||||
static int iCount;
|
||||
static int callCount;
|
||||
static int callCount, iCount=0;
|
||||
time_t now, tmo;
|
||||
|
||||
self = (pEVControl)pData;
|
||||
assert(self);
|
||||
@ -193,7 +197,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
|
||||
/* get the current position */
|
||||
|
||||
iRet = self->pDriv->GetValue(self->pDriv,&fPos);
|
||||
iRet = self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
|
||||
|
||||
if(iRet == 0)
|
||||
{
|
||||
@ -229,8 +233,6 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
return HWFault;
|
||||
}
|
||||
|
||||
/* calculate difference to target */
|
||||
fDelta = self->fTarget - fPos;
|
||||
if(fDelta < 0.)
|
||||
{
|
||||
fDelta = - fDelta;
|
||||
@ -240,32 +242,62 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
callCount++;
|
||||
if(callCount >= 10)
|
||||
{
|
||||
sprintf(pBueffel,"%s = %f", self->pName, fPos);
|
||||
sprintf(pBueffel,"%s = %g", self->pName, fPos);
|
||||
InvokeCallBack(self->pCall, VALUECHANGE,pBueffel);
|
||||
callCount = 0;
|
||||
}
|
||||
|
||||
now = time(NULL);
|
||||
tmo = (int)(ObVal(self->pParam, MAXWAIT) * 60);
|
||||
/* based on this: logic ! */
|
||||
if (tmo>0 && now > self->start+tmo ) /* time out */
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: wait time limit reached on %s",
|
||||
self->pName);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
self->eMode = EVMonitor;
|
||||
return HWIdle;
|
||||
}
|
||||
if(fDelta <= ObVal(self->pParam, TOLERANCE)) /* done */
|
||||
{
|
||||
iCount++;
|
||||
if(iCount > 3)
|
||||
if (iCount < 3)
|
||||
{
|
||||
iCount++;
|
||||
return HWBusy;
|
||||
}
|
||||
tmo = (int)(ObVal(self->pParam, SETTLE) * 60);
|
||||
if (self->lastt <= 0) /* lastt negative: -seconds already waited */
|
||||
{
|
||||
self->lastt += now;
|
||||
if (tmo>0)
|
||||
{
|
||||
sprintf(pBueffel,"%s inside tolerance, wait %.2f min. to settle",
|
||||
self->pName, (self->lastt + tmo - now)/60.0);
|
||||
SCWrite(pCon,pBueffel,eStatus);
|
||||
}
|
||||
return HWBusy;
|
||||
}
|
||||
if (now > self->lastt + tmo)
|
||||
{
|
||||
self->eMode = EVMonitor;
|
||||
return HWIdle;
|
||||
}
|
||||
else
|
||||
{
|
||||
return HWBusy;
|
||||
}
|
||||
return HWBusy;
|
||||
}
|
||||
else
|
||||
{
|
||||
iCount = 0;
|
||||
if (iCount > 0) {
|
||||
iCount--;
|
||||
return HWBusy;
|
||||
}
|
||||
if (self->lastt > 0) { /* save time already waited */
|
||||
sprintf(pBueffel,"%s outside tolerance, settling time suspended",
|
||||
self->pName);
|
||||
SCWrite(pCon,pBueffel,eStatus);
|
||||
self->lastt -= now;
|
||||
}
|
||||
return HWBusy;
|
||||
}
|
||||
self->eMode = EVIdle;
|
||||
return HWFault;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static int EVILimits(void *pData, float fVal, char *pError, int iErrLen)
|
||||
@ -279,7 +311,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
/* lower limit */
|
||||
if( fVal < ObVal(self->pParam, LOWLIMIT))
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: %f violates lower limit of device",fVal);
|
||||
sprintf(pBueffel,"ERROR: %g violates lower limit of device",fVal);
|
||||
strncpy(pError,pBueffel,iErrLen);
|
||||
return 0;
|
||||
}
|
||||
@ -287,7 +319,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
/* upper limit */
|
||||
if( fVal > ObVal(self->pParam, UPLIMIT))
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: %f violates upper limit of device",fVal);
|
||||
sprintf(pBueffel,"ERROR: %g violates upper limit of device",fVal);
|
||||
strncpy(pError,pBueffel,iErrLen);
|
||||
return 0;
|
||||
}
|
||||
@ -317,16 +349,15 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
pEVControl self = NULL;
|
||||
pExeList pExe;
|
||||
SConnection *pCon = NULL;
|
||||
float fPos;
|
||||
float fPos, fDelta;
|
||||
char pBueffel[256];
|
||||
|
||||
self = (pEVControl)pData;
|
||||
assert(self);
|
||||
|
||||
|
||||
self->pDriv->GetValue(self->pDriv,&fPos);
|
||||
sprintf(pBueffel,"WARNING: %s is out of range by %f",self->pName,
|
||||
self->fTarget - fPos);
|
||||
self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
|
||||
sprintf(pBueffel,"WARNING: %s is out of range by %g",self->pName,fDelta);
|
||||
pExe = GetExecutor();
|
||||
pCon = GetExeOwner(pExe);
|
||||
if(!self->iWarned)
|
||||
@ -349,16 +380,15 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
pEVControl self = NULL;
|
||||
pExeList pExe;
|
||||
SConnection *pCon = NULL;
|
||||
float fPos;
|
||||
float fPos, fDelta;
|
||||
char pBueffel[256];
|
||||
int iRet;
|
||||
|
||||
self = (pEVControl)pData;
|
||||
assert(self);
|
||||
|
||||
self->pDriv->GetValue(self->pDriv,&fPos);
|
||||
sprintf(pBueffel,"WARNING: %s is out of range by %f",self->pName,
|
||||
self->fTarget - fPos);
|
||||
self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
|
||||
sprintf(pBueffel,"WARNING: %s is out of range by %g",self->pName,fDelta);
|
||||
pExe = GetExecutor();
|
||||
pCon = GetExeOwner(pExe);
|
||||
|
||||
@ -402,7 +432,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
pEVControl self = NULL;
|
||||
pExeList pExe;
|
||||
SConnection *pCon = NULL;
|
||||
float fPos;
|
||||
float fPos,fDelta;
|
||||
char pBueffel[256];
|
||||
int iRet;
|
||||
|
||||
@ -410,9 +440,8 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
assert(self);
|
||||
|
||||
/* report problem */
|
||||
self->pDriv->GetValue(self->pDriv,&fPos);
|
||||
sprintf(pBueffel,"WARNING: %s is out of range by %f",self->pName,
|
||||
self->fTarget - fPos);
|
||||
self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
|
||||
sprintf(pBueffel,"WARNING: %s is out of range by %g",self->pName,fDelta);
|
||||
pExe = GetExecutor();
|
||||
pCon = GetExeOwner(pExe);
|
||||
if(!self->iWarned)
|
||||
@ -438,7 +467,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
pEVControl self = NULL;
|
||||
pExeList pExe;
|
||||
SConnection *pCon = NULL;
|
||||
float fPos;
|
||||
float fPos, fDelta;
|
||||
char pBueffel[256];
|
||||
int iRet;
|
||||
|
||||
@ -446,9 +475,8 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
assert(self);
|
||||
|
||||
/* report problem */
|
||||
self->pDriv->GetValue(self->pDriv,&fPos);
|
||||
sprintf(pBueffel,"WARNING: %s is out of range by %f",self->pName,
|
||||
self->fTarget - fPos);
|
||||
self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
|
||||
sprintf(pBueffel,"WARNING: %s is out of range by %g",self->pName,fDelta);
|
||||
pExe = GetExecutor();
|
||||
pCon = GetExeOwner(pExe);
|
||||
if(pCon)
|
||||
@ -527,14 +555,13 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
assert(self);
|
||||
|
||||
|
||||
iRet = self->pDriv->GetValue(self->pDriv, &fPos);
|
||||
iRet = self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
|
||||
if( iRet == 1 )
|
||||
{
|
||||
if(self->iLog)
|
||||
{
|
||||
VarlogAdd(self->pLog, fPos);
|
||||
}
|
||||
fDelta = self->fTarget - fPos;
|
||||
if(fDelta < 0.)
|
||||
{
|
||||
fDelta = -fDelta;
|
||||
@ -568,7 +595,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
self->callCount++;
|
||||
if(self->callCount >= 20)
|
||||
{
|
||||
sprintf(pBueffel,"%s = %F", self->pName, fPos);
|
||||
sprintf(pBueffel,"%s = %g", self->pName, fPos);
|
||||
InvokeCallBack(self->pCall,VALUECHANGE, pBueffel);
|
||||
self->callCount = 0;
|
||||
}
|
||||
@ -614,6 +641,22 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
/* this routine is the standard method of pEVDriver for GetValues.
|
||||
* it may be replaced by a device specific routine, for the case that
|
||||
* the target value differs systematically from the target value
|
||||
* (i.e.control not on sample sensor)
|
||||
* Oct. 2002 M.Zolliker
|
||||
*/
|
||||
static int StdGetValues(pEVDriver self, float *fTarget, float *fPos, float *fDelta)
|
||||
{
|
||||
int iRet;
|
||||
|
||||
assert(self);
|
||||
iRet=self->GetValue(self, fPos);
|
||||
if (iRet>0) *fDelta = *fTarget - *fPos;
|
||||
return iRet;
|
||||
}
|
||||
/*-------- All this done, we can actually implement the controller ---------*/
|
||||
pEVControl CreateEVController(pEVDriver pDriv, char *pName, int *iErr)
|
||||
{
|
||||
@ -679,7 +722,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
}
|
||||
|
||||
/* new parameter space */
|
||||
pRes->pParam = ObParCreate(7);
|
||||
pRes->pParam = ObParCreate(9);
|
||||
if(!pRes->pParam)
|
||||
{
|
||||
free(pRes->pDrivInt);
|
||||
@ -695,9 +738,15 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
ObParInit(pRes->pParam, UPLIMIT, "upperlimit", 300.0, usUser);
|
||||
ObParInit(pRes->pParam, LOWLIMIT, "lowerlimit", 2., usUser);
|
||||
ObParInit(pRes->pParam, SAFEVALUE, "safevalue", 0., usUser);
|
||||
ObParInit(pRes->pParam, MAXWAIT, "maxwait", 0., usUser);
|
||||
ObParInit(pRes->pParam, SETTLE, "settle", 0., usUser);
|
||||
|
||||
/* local initialisations */
|
||||
pRes->pDriv = pDriv;
|
||||
if (pDriv->GetValues==NULL) /* if GetValues is undefined, set to default */
|
||||
{
|
||||
pDriv->GetValues=StdGetValues;
|
||||
}
|
||||
iRet = pDriv->Init(pDriv);
|
||||
if(iRet >= 0)
|
||||
{
|
||||
@ -901,32 +950,38 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
sprintf(pBueffel,"Parameter listing for %s",self->pName);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
|
||||
sprintf(pBueffel,"%s.%s = %f ",self->pName, "tolerance",
|
||||
sprintf(pBueffel,"%s.%s = %g ",self->pName, "tolerance",
|
||||
ObVal(self->pParam,TOLERANCE));
|
||||
SCWrite(pCon,pBueffel, eValue);
|
||||
sprintf(pBueffel,"%s.%s = %f",self->pName, "access",
|
||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "access",
|
||||
ObVal(self->pParam,ACCESS));
|
||||
SCWrite(pCon,pBueffel, eValue);
|
||||
sprintf(pBueffel,"%s.%s = %f",self->pName, "ErrorHandler",
|
||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "ErrorHandler",
|
||||
ObVal(self->pParam,ERRORHANDLER));
|
||||
SCWrite(pCon,pBueffel, eValue);
|
||||
sprintf(pBueffel,"%s.%s = %f",self->pName, "interrupt",
|
||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "interrupt",
|
||||
ObVal(self->pParam,INTERRUPT));
|
||||
SCWrite(pCon,pBueffel, eValue);
|
||||
sprintf(pBueffel,"%s.%s = %f",self->pName, "UpperLimit",
|
||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "UpperLimit",
|
||||
ObVal(self->pParam,UPLIMIT));
|
||||
SCWrite(pCon,pBueffel, eValue);
|
||||
sprintf(pBueffel,"%s.%s = %f",self->pName, "LowerLimit",
|
||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "LowerLimit",
|
||||
ObVal(self->pParam,LOWLIMIT));
|
||||
SCWrite(pCon,pBueffel, eValue);
|
||||
sprintf(pBueffel,"%s.%s = %f",self->pName, "SafeValue",
|
||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "SafeValue",
|
||||
ObVal(self->pParam,SAFEVALUE));
|
||||
SCWrite(pCon,pBueffel, eValue);
|
||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "MaxWait",
|
||||
ObVal(self->pParam,MAXWAIT));
|
||||
SCWrite(pCon,pBueffel, eValue);
|
||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "Settle",
|
||||
ObVal(self->pParam,SETTLE));
|
||||
SCWrite(pCon,pBueffel, eValue);
|
||||
EVCGetPos(self,pCon,&fPos);
|
||||
sprintf(pBueffel,"%s.%s = %f",self->pName, "CurrentValue",
|
||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "CurrentValue",
|
||||
fPos);
|
||||
SCWrite(pCon,pBueffel, eValue);
|
||||
sprintf(pBueffel,"%s.%s = %f",self->pName, "TargetValue",
|
||||
sprintf(pBueffel,"%s.%s = %g",self->pName, "TargetValue",
|
||||
self->fTarget);
|
||||
SCWrite(pCon,pBueffel, eValue);
|
||||
|
||||
@ -977,7 +1032,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
iRet = EVCGetPos(self,pCon,&fPos);
|
||||
if(iRet)
|
||||
{
|
||||
sprintf(pBueffel,"%s.%s = %f",self->pName,"CurrentValue", fPos);
|
||||
sprintf(pBueffel,"%s.%s = %g",self->pName,"CurrentValue", fPos);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
}
|
||||
@ -1076,7 +1131,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(pBueffel,"%s.%s = %f",self->pName,argv[1],fPos);
|
||||
sprintf(pBueffel,"%s.%s = %g",self->pName,argv[1],fPos);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
}
|
||||
|
@ -15,7 +15,8 @@
|
||||
#define UPLIMIT 4
|
||||
#define LOWLIMIT 5
|
||||
#define SAFEVALUE 6
|
||||
|
||||
#define MAXWAIT 7
|
||||
#define SETTLE 8
|
||||
|
||||
#line 29 "evcontroller.w"
|
||||
|
||||
@ -28,6 +29,8 @@
|
||||
pEVDriver pDriv;
|
||||
EVMode eMode;
|
||||
float fTarget;
|
||||
time_t start;
|
||||
time_t lastt;
|
||||
char *pName;
|
||||
ObPar *pParam;
|
||||
int iLog;
|
||||
|
@ -55,7 +55,7 @@
|
||||
return NULL;
|
||||
}
|
||||
memset(pNew,0,sizeof(EVDriver));
|
||||
|
||||
pNew->GetValues=NULL; /* method will be replaced by default when NULL */
|
||||
return pNew;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
@ -17,6 +17,8 @@
|
||||
typedef struct __EVDriver {
|
||||
int (*SetValue)(pEVDriver self, float fNew);
|
||||
int (*GetValue)(pEVDriver self, float *fPos);
|
||||
int (*GetValues)(pEVDriver self, float *fTarget,
|
||||
float *fPos, float *fDelta);
|
||||
int (*Send)(pEVDriver self, char *pCommand,
|
||||
char *pReplyBuffer, int iReplBufLen);
|
||||
int (*GetError)(pEVDriver self, int *iCode,
|
||||
|
172
sicsstatus.tcl
172
sicsstatus.tcl
@ -1,77 +1,32 @@
|
||||
yfactor 1.420000
|
||||
yfactor setAccess 1
|
||||
xfactor 0.715000
|
||||
xfactor setAccess 1
|
||||
ps.listfile peaksearch.dat
|
||||
ps.listfile setAccess 2
|
||||
ps.scansteps 24
|
||||
ps.scansteps setAccess 2
|
||||
ps.scanpreset 1000000.000000
|
||||
ps.scanpreset setAccess 2
|
||||
ps.preset 1000.000000
|
||||
ps.preset setAccess 2
|
||||
ps.countmode monitor
|
||||
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 10.000000
|
||||
hm2 CountMode timer
|
||||
hm2 preset 10.000000
|
||||
banana CountMode timer
|
||||
banana preset 10.000000
|
||||
hm1 CountMode timer
|
||||
hm1 preset 10.000000
|
||||
a5l.length 80.000000
|
||||
flightpathlength 0.000000
|
||||
flightpathlength setAccess 1
|
||||
flightpath 0.000000
|
||||
flightpath setAccess 1
|
||||
delay 2500.000000
|
||||
delay setAccess 1
|
||||
hm CountMode timer
|
||||
hm preset 100.000000
|
||||
hm genbin 120.000000 35.000000 512
|
||||
hm init
|
||||
datafile focus-1001848.hdf
|
||||
datafile setAccess 3
|
||||
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
|
||||
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 hm 0
|
||||
detdist3 0.000000
|
||||
detdist3 setAccess 1
|
||||
det3zeroy 128.000000
|
||||
det3zeroy setAccess 1
|
||||
det3zerox 128.000000
|
||||
det3zerox setAccess 1
|
||||
detdist2 0.000000
|
||||
detdist2 setAccess 1
|
||||
det2zeroy 128.000000
|
||||
det2zeroy setAccess 1
|
||||
det2zerox 128.000000
|
||||
det2zerox setAccess 1
|
||||
detdist1 0.000000
|
||||
detdist1 setAccess 1
|
||||
det1dist 300.000000
|
||||
det1dist setAccess 1
|
||||
det1zeroy 128.000000
|
||||
det1zeroy setAccess 1
|
||||
det1zerox 128.000000
|
||||
@ -112,22 +67,6 @@ ph SoftUpperLim 360.000000
|
||||
ph Fixed -1.000000
|
||||
ph InterruptMode 0.000000
|
||||
ph AccessCode 2.000000
|
||||
# Motor dg3
|
||||
dg3 sign 1.000000
|
||||
dg3 SoftZero 0.000000
|
||||
dg3 SoftLowerLim -10.000000
|
||||
dg3 SoftUpperLim 40.000000
|
||||
dg3 Fixed -1.000000
|
||||
dg3 InterruptMode 0.000000
|
||||
dg3 AccessCode 2.000000
|
||||
# Motor dg2
|
||||
dg2 sign 1.000000
|
||||
dg2 SoftZero 0.000000
|
||||
dg2 SoftLowerLim -10.000000
|
||||
dg2 SoftUpperLim 40.000000
|
||||
dg2 Fixed -1.000000
|
||||
dg2 InterruptMode 0.000000
|
||||
dg2 AccessCode 2.000000
|
||||
# Motor dg1
|
||||
dg1 sign 1.000000
|
||||
dg1 SoftZero 0.000000
|
||||
@ -178,6 +117,8 @@ twotheta InterruptMode 0.000000
|
||||
twotheta AccessCode 2.000000
|
||||
lastscancommand cscan a4 10. .1 10 5
|
||||
lastscancommand setAccess 2
|
||||
banana CountMode timer
|
||||
banana preset 2.000000
|
||||
sample_mur 0.000000
|
||||
sample_mur setAccess 2
|
||||
email UNKNOWN
|
||||
@ -188,25 +129,6 @@ phone UNKNOWN
|
||||
phone setAccess 2
|
||||
adress UNKNOWN
|
||||
adress setAccess 2
|
||||
# Counter counter
|
||||
counter SetPreset 20.000000
|
||||
counter SetMode Timer
|
||||
# Motor som
|
||||
som sign 1.000000
|
||||
som SoftZero 0.000000
|
||||
som SoftLowerLim -360.000000
|
||||
som SoftUpperLim 360.000000
|
||||
som Fixed -1.000000
|
||||
som InterruptMode 0.000000
|
||||
som AccessCode 2.000000
|
||||
# Motor sax
|
||||
sax sign 1.000000
|
||||
sax SoftZero 0.000000
|
||||
sax SoftLowerLim -30.000000
|
||||
sax SoftUpperLim 30.000000
|
||||
sax Fixed -1.000000
|
||||
sax InterruptMode 0.000000
|
||||
sax AccessCode 2.000000
|
||||
# Motor tilt
|
||||
tilt sign 1.000000
|
||||
tilt SoftZero 0.000000
|
||||
@ -303,46 +225,6 @@ d1r SoftUpperLim 20.000000
|
||||
d1r Fixed -1.000000
|
||||
d1r InterruptMode 0.000000
|
||||
d1r AccessCode 2.000000
|
||||
# Motor monochi
|
||||
monochi sign 1.000000
|
||||
monochi SoftZero 0.000000
|
||||
monochi SoftLowerLim -30.000000
|
||||
monochi SoftUpperLim 30.000000
|
||||
monochi Fixed -1.000000
|
||||
monochi InterruptMode 0.000000
|
||||
monochi AccessCode 2.000000
|
||||
# Motor monophi
|
||||
monophi sign 1.000000
|
||||
monophi SoftZero 0.000000
|
||||
monophi SoftLowerLim -30.000000
|
||||
monophi SoftUpperLim 30.000000
|
||||
monophi Fixed -1.000000
|
||||
monophi InterruptMode 0.000000
|
||||
monophi AccessCode 2.000000
|
||||
# Motor monoy
|
||||
monoy sign 1.000000
|
||||
monoy SoftZero 0.000000
|
||||
monoy SoftLowerLim -30.000000
|
||||
monoy SoftUpperLim 30.000000
|
||||
monoy Fixed -1.000000
|
||||
monoy InterruptMode 0.000000
|
||||
monoy AccessCode 2.000000
|
||||
# Motor monox
|
||||
monox sign 1.000000
|
||||
monox SoftZero 0.000000
|
||||
monox SoftLowerLim -30.000000
|
||||
monox SoftUpperLim 30.000000
|
||||
monox Fixed -1.000000
|
||||
monox InterruptMode 0.000000
|
||||
monox AccessCode 2.000000
|
||||
# Motor tasse
|
||||
tasse sign 1.000000
|
||||
tasse SoftZero 0.000000
|
||||
tasse SoftLowerLim -130.000000
|
||||
tasse SoftUpperLim 130.000000
|
||||
tasse Fixed -1.000000
|
||||
tasse InterruptMode 0.000000
|
||||
tasse AccessCode 2.000000
|
||||
# Motor sdm
|
||||
sdm sign 1.000000
|
||||
sdm SoftZero 0.000000
|
||||
|
@ -184,7 +184,7 @@ typedef enum _CharType {eSpace, eNum,eeText,eQuote} CharType;
|
||||
if(strchr(pBueffel,'.')== NULL)
|
||||
{
|
||||
pCurrent->Type = eInt;
|
||||
sscanf(pBueffel,"%d",&(pCurrent->iVal));
|
||||
sscanf(pBueffel,"%ld",&(pCurrent->iVal));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -104,6 +104,7 @@ static float
|
||||
maxShift=2, /* maximal shift in when controlMode=2 */
|
||||
tm=DATA_UNDEF, /* main temperature */
|
||||
ts=DATA_UNDEF, /* sample temperature */
|
||||
tx=DATA_UNDEF, /* controlled temperature */
|
||||
tr=DATA_UNDEF, /* set temperature (read back) */
|
||||
te=DATA_UNDEF, /* test temperature */
|
||||
he=DATA_UNDEF, /* helium level value */
|
||||
@ -929,6 +930,11 @@ int ReadTemp(void) {
|
||||
tm=(rdTim % 3600) * 1.0e-4;
|
||||
ts=(rdTim % 60) * 60.0e-4+0.5;
|
||||
}
|
||||
if (controlMode==0) {
|
||||
tx=tm;
|
||||
} else {
|
||||
tx=ts;
|
||||
}
|
||||
if (auxSens != NULL) {
|
||||
aux=auxSens->t * auxSens->scale;
|
||||
} else {
|
||||
@ -1133,7 +1139,6 @@ int PutFloat(StrBuf *buf, int prec, float f) {
|
||||
int PidSumHdl(int mode, void *base, int fd) {
|
||||
StrBuf buf;
|
||||
|
||||
readTemp=1;
|
||||
StrLink(&buf, pid);
|
||||
StrClear(&buf);
|
||||
ERR_I(PutFloat(&buf, 5, prop));
|
||||
@ -2300,6 +2305,7 @@ int main(int argc, char *argv[]) {
|
||||
CocDefFlt(tm, RD);
|
||||
CocDefFlt(ts, RD);
|
||||
CocDefFlt(tr, RD);
|
||||
CocDefFlt(tx, RD);
|
||||
CocDefFlt(te, RD);
|
||||
CocDefFlt(aux, RD);
|
||||
CocDefFlt(he, RD);
|
||||
|
@ -84,6 +84,23 @@ int TeccGet(pTecsClient conn, float *temp) {
|
||||
OnError: return(-1);
|
||||
}
|
||||
|
||||
int TeccGetX(pTecsClient conn, float *tC, float *tP, float *tDif) {
|
||||
int iret;
|
||||
float tx;
|
||||
|
||||
CocReset(conn);
|
||||
CocReset(conn);
|
||||
ERR_I(CocGetFloat(conn, "set", tC));
|
||||
ERR_I(CocGetFloat(conn, "tx", &tx));
|
||||
ERR_I(CocGetFloat(conn, "tempP", tP));
|
||||
ERR_I(CocPutInt(conn, "readTemp", 1));
|
||||
ERR_I(iret=CocDoIt(conn, response, sizeof(response)));
|
||||
*tDif = *tC - tx;
|
||||
if (iret) ERR_MSG(response);
|
||||
return 0;
|
||||
OnError: return(-1);
|
||||
}
|
||||
|
||||
int TeccSet(pTecsClient conn, float temp) {
|
||||
int iret;
|
||||
|
||||
|
@ -17,6 +17,9 @@ pTecsClient TeccInit(char *server, int port);
|
||||
int TeccGet(pTecsClient conn, float *temp);
|
||||
/* get temperature */
|
||||
|
||||
int TeccGetX(pTecsClient conn, float *tC, float *tP, float *tDif);
|
||||
/* get controlled temperature */
|
||||
|
||||
int TeccGet3(pTecsClient conn, float *tSet, float *tExch, float *tSamp);
|
||||
/* get temperatures */
|
||||
|
||||
|
32
tecsdriv.c
32
tecsdriv.c
@ -148,7 +148,7 @@
|
||||
}
|
||||
return EVControlWrapper(pCon,pSics,pData,argc,argv);
|
||||
} else if (NULL!=strstr(
|
||||
" log send tolerance access errorhandler interrupt interest safevalue currentvalue "
|
||||
" log send tolerance access errorhandler interrupt interest safevalue currentvalue maxwait settle "
|
||||
, pBueffel)) {
|
||||
/* forward to standard handler */
|
||||
return EVControlWrapper(pCon,pSics,pData,argc,argv);
|
||||
@ -207,6 +207,35 @@
|
||||
return 1;
|
||||
}
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
static int TecsGetX(pEVDriver self, float *fTarget, float *fPos, float *fDelta)
|
||||
{
|
||||
pTecsDriv pMe = NULL;
|
||||
int iRet;
|
||||
time_t now;
|
||||
|
||||
assert(self);
|
||||
pMe = (pTecsDriv)self->pPrivate;
|
||||
assert(pMe);
|
||||
|
||||
time(&now);
|
||||
if (now!=pMe->lastGet) { /* TecsGet was not yet called within this second */
|
||||
pMe->lastGet=now;
|
||||
} else {
|
||||
CocDelay(200); /* wait 0.2 sec. (seems that SICS has nothing else to do then reading temperatures) */
|
||||
}
|
||||
|
||||
/* get temperature */
|
||||
iRet = TeccGetX(pMe->pData, fTarget, fPos, fDelta);
|
||||
if(iRet < 0) {
|
||||
pMe->lastError = ErrMessage;
|
||||
pMe->iLastError=1; /* severe */
|
||||
return 0;
|
||||
}
|
||||
pMe->iLastError=0;
|
||||
return 1;
|
||||
}
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static int TecsRun(pEVDriver self, float fVal)
|
||||
{
|
||||
pTecsDriv pMe = NULL;
|
||||
@ -384,6 +413,7 @@
|
||||
pNew->TryFixIt = TecsFix;
|
||||
pNew->Init = TecsInit;
|
||||
pNew->Close = TecsClose;
|
||||
pNew->GetValues= TecsGetX;
|
||||
|
||||
return pNew;
|
||||
}
|
||||
|
1
test.tcl
1
test.tcl
@ -77,6 +77,7 @@ SicsUser Mugger Diethelm 1
|
||||
SicsUser User Rosy 2
|
||||
SicsUser Spy 007 1
|
||||
SicsUser me me 1
|
||||
SicsUser testuser 01lns1 3
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# S I M P L E V A R I A B L E S
|
||||
|
Reference in New Issue
Block a user