new features for evcontroller Nov.2002 M.Z.

This commit is contained in:
cvs
2002-11-13 07:21:26 +00:00
parent 55eedb640b
commit 3ace74d9d7
12 changed files with 200 additions and 201 deletions

View File

@ -39,6 +39,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h> #include <assert.h>
#include <time.h>
#include <tcl.h> #include <tcl.h>
#include "fortify.h" #include "fortify.h"
#include "splitter.h" #include "splitter.h"
@ -83,6 +84,9 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
self->fTarget = fVal; self->fTarget = fVal;
self->eMode = EVDrive; self->eMode = EVDrive;
self->iStop = 0; self->iStop = 0;
self->start = time(NULL);
self->lastt = 0;
self->iWarned = 0;
/* try at least three times to do it */ /* try at least three times to do it */
for(i = 0; i < 3; i++) for(i = 0; i < 3; i++)
@ -178,8 +182,8 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
float fPos, fDelta; float fPos, fDelta;
int iRet, iCode, iFix; int iRet, iCode, iFix;
char pBueffel[256], pError[132]; char pBueffel[256], pError[132];
static int iCount; static int callCount, iCount=0;
static int callCount; time_t now, tmo;
self = (pEVControl)pData; self = (pEVControl)pData;
assert(self); assert(self);
@ -193,7 +197,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
/* get the current position */ /* get the current position */
iRet = self->pDriv->GetValue(self->pDriv,&fPos); iRet = self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
if(iRet == 0) if(iRet == 0)
{ {
@ -229,8 +233,6 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
return HWFault; return HWFault;
} }
/* calculate difference to target */
fDelta = self->fTarget - fPos;
if(fDelta < 0.) if(fDelta < 0.)
{ {
fDelta = - fDelta; fDelta = - fDelta;
@ -240,32 +242,62 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
callCount++; callCount++;
if(callCount >= 10) if(callCount >= 10)
{ {
sprintf(pBueffel,"%s = %f", self->pName, fPos); sprintf(pBueffel,"%s = %g", self->pName, fPos);
InvokeCallBack(self->pCall, VALUECHANGE,pBueffel); InvokeCallBack(self->pCall, VALUECHANGE,pBueffel);
callCount = 0; callCount = 0;
} }
now = time(NULL);
tmo = (int)(ObVal(self->pParam, MAXWAIT) * 60);
/* based on this: logic ! */ /* 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 */ if(fDelta <= ObVal(self->pParam, TOLERANCE)) /* done */
{
if (iCount < 3)
{ {
iCount++; iCount++;
if(iCount > 3) 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; self->eMode = EVMonitor;
return HWIdle; return HWIdle;
} }
else
{
return HWBusy; return HWBusy;
} }
}
else 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; return HWBusy;
} }
self->eMode = EVIdle;
return HWFault;
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
static int EVILimits(void *pData, float fVal, char *pError, int iErrLen) static int EVILimits(void *pData, float fVal, char *pError, int iErrLen)
@ -279,7 +311,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
/* lower limit */ /* lower limit */
if( fVal < ObVal(self->pParam, LOWLIMIT)) 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); strncpy(pError,pBueffel,iErrLen);
return 0; return 0;
} }
@ -287,7 +319,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
/* upper limit */ /* upper limit */
if( fVal > ObVal(self->pParam, UPLIMIT)) 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); strncpy(pError,pBueffel,iErrLen);
return 0; return 0;
} }
@ -317,16 +349,15 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
pEVControl self = NULL; pEVControl self = NULL;
pExeList pExe; pExeList pExe;
SConnection *pCon = NULL; SConnection *pCon = NULL;
float fPos; float fPos, fDelta;
char pBueffel[256]; char pBueffel[256];
self = (pEVControl)pData; self = (pEVControl)pData;
assert(self); assert(self);
self->pDriv->GetValue(self->pDriv,&fPos); self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
sprintf(pBueffel,"WARNING: %s is out of range by %f",self->pName, sprintf(pBueffel,"WARNING: %s is out of range by %g",self->pName,fDelta);
self->fTarget - fPos);
pExe = GetExecutor(); pExe = GetExecutor();
pCon = GetExeOwner(pExe); pCon = GetExeOwner(pExe);
if(!self->iWarned) if(!self->iWarned)
@ -349,16 +380,15 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
pEVControl self = NULL; pEVControl self = NULL;
pExeList pExe; pExeList pExe;
SConnection *pCon = NULL; SConnection *pCon = NULL;
float fPos; float fPos, fDelta;
char pBueffel[256]; char pBueffel[256];
int iRet; int iRet;
self = (pEVControl)pData; self = (pEVControl)pData;
assert(self); assert(self);
self->pDriv->GetValue(self->pDriv,&fPos); self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
sprintf(pBueffel,"WARNING: %s is out of range by %f",self->pName, sprintf(pBueffel,"WARNING: %s is out of range by %g",self->pName,fDelta);
self->fTarget - fPos);
pExe = GetExecutor(); pExe = GetExecutor();
pCon = GetExeOwner(pExe); pCon = GetExeOwner(pExe);
@ -402,7 +432,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
pEVControl self = NULL; pEVControl self = NULL;
pExeList pExe; pExeList pExe;
SConnection *pCon = NULL; SConnection *pCon = NULL;
float fPos; float fPos,fDelta;
char pBueffel[256]; char pBueffel[256];
int iRet; int iRet;
@ -410,9 +440,8 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
assert(self); assert(self);
/* report problem */ /* report problem */
self->pDriv->GetValue(self->pDriv,&fPos); self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
sprintf(pBueffel,"WARNING: %s is out of range by %f",self->pName, sprintf(pBueffel,"WARNING: %s is out of range by %g",self->pName,fDelta);
self->fTarget - fPos);
pExe = GetExecutor(); pExe = GetExecutor();
pCon = GetExeOwner(pExe); pCon = GetExeOwner(pExe);
if(!self->iWarned) if(!self->iWarned)
@ -438,7 +467,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
pEVControl self = NULL; pEVControl self = NULL;
pExeList pExe; pExeList pExe;
SConnection *pCon = NULL; SConnection *pCon = NULL;
float fPos; float fPos, fDelta;
char pBueffel[256]; char pBueffel[256];
int iRet; int iRet;
@ -446,9 +475,8 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
assert(self); assert(self);
/* report problem */ /* report problem */
self->pDriv->GetValue(self->pDriv,&fPos); self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
sprintf(pBueffel,"WARNING: %s is out of range by %f",self->pName, sprintf(pBueffel,"WARNING: %s is out of range by %g",self->pName,fDelta);
self->fTarget - fPos);
pExe = GetExecutor(); pExe = GetExecutor();
pCon = GetExeOwner(pExe); pCon = GetExeOwner(pExe);
if(pCon) if(pCon)
@ -527,14 +555,13 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
assert(self); assert(self);
iRet = self->pDriv->GetValue(self->pDriv, &fPos); iRet = self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
if( iRet == 1 ) if( iRet == 1 )
{ {
if(self->iLog) if(self->iLog)
{ {
VarlogAdd(self->pLog, fPos); VarlogAdd(self->pLog, fPos);
} }
fDelta = self->fTarget - fPos;
if(fDelta < 0.) if(fDelta < 0.)
{ {
fDelta = -fDelta; fDelta = -fDelta;
@ -568,7 +595,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
self->callCount++; self->callCount++;
if(self->callCount >= 20) if(self->callCount >= 20)
{ {
sprintf(pBueffel,"%s = %F", self->pName, fPos); sprintf(pBueffel,"%s = %g", self->pName, fPos);
InvokeCallBack(self->pCall,VALUECHANGE, pBueffel); InvokeCallBack(self->pCall,VALUECHANGE, pBueffel);
self->callCount = 0; self->callCount = 0;
} }
@ -614,6 +641,22 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
} }
return NULL; 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 ---------*/ /*-------- All this done, we can actually implement the controller ---------*/
pEVControl CreateEVController(pEVDriver pDriv, char *pName, int *iErr) pEVControl CreateEVController(pEVDriver pDriv, char *pName, int *iErr)
{ {
@ -679,7 +722,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
} }
/* new parameter space */ /* new parameter space */
pRes->pParam = ObParCreate(7); pRes->pParam = ObParCreate(9);
if(!pRes->pParam) if(!pRes->pParam)
{ {
free(pRes->pDrivInt); 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, UPLIMIT, "upperlimit", 300.0, usUser);
ObParInit(pRes->pParam, LOWLIMIT, "lowerlimit", 2., usUser); ObParInit(pRes->pParam, LOWLIMIT, "lowerlimit", 2., usUser);
ObParInit(pRes->pParam, SAFEVALUE, "safevalue", 0., usUser); ObParInit(pRes->pParam, SAFEVALUE, "safevalue", 0., usUser);
ObParInit(pRes->pParam, MAXWAIT, "maxwait", 0., usUser);
ObParInit(pRes->pParam, SETTLE, "settle", 0., usUser);
/* local initialisations */ /* local initialisations */
pRes->pDriv = pDriv; pRes->pDriv = pDriv;
if (pDriv->GetValues==NULL) /* if GetValues is undefined, set to default */
{
pDriv->GetValues=StdGetValues;
}
iRet = pDriv->Init(pDriv); iRet = pDriv->Init(pDriv);
if(iRet >= 0) if(iRet >= 0)
{ {
@ -901,32 +950,38 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
sprintf(pBueffel,"Parameter listing for %s",self->pName); sprintf(pBueffel,"Parameter listing for %s",self->pName);
SCWrite(pCon,pBueffel,eValue); SCWrite(pCon,pBueffel,eValue);
sprintf(pBueffel,"%s.%s = %f ",self->pName, "tolerance", sprintf(pBueffel,"%s.%s = %g ",self->pName, "tolerance",
ObVal(self->pParam,TOLERANCE)); ObVal(self->pParam,TOLERANCE));
SCWrite(pCon,pBueffel, eValue); SCWrite(pCon,pBueffel, eValue);
sprintf(pBueffel,"%s.%s = %f",self->pName, "access", sprintf(pBueffel,"%s.%s = %g",self->pName, "access",
ObVal(self->pParam,ACCESS)); ObVal(self->pParam,ACCESS));
SCWrite(pCon,pBueffel, eValue); SCWrite(pCon,pBueffel, eValue);
sprintf(pBueffel,"%s.%s = %f",self->pName, "ErrorHandler", sprintf(pBueffel,"%s.%s = %g",self->pName, "ErrorHandler",
ObVal(self->pParam,ERRORHANDLER)); ObVal(self->pParam,ERRORHANDLER));
SCWrite(pCon,pBueffel, eValue); SCWrite(pCon,pBueffel, eValue);
sprintf(pBueffel,"%s.%s = %f",self->pName, "interrupt", sprintf(pBueffel,"%s.%s = %g",self->pName, "interrupt",
ObVal(self->pParam,INTERRUPT)); ObVal(self->pParam,INTERRUPT));
SCWrite(pCon,pBueffel, eValue); SCWrite(pCon,pBueffel, eValue);
sprintf(pBueffel,"%s.%s = %f",self->pName, "UpperLimit", sprintf(pBueffel,"%s.%s = %g",self->pName, "UpperLimit",
ObVal(self->pParam,UPLIMIT)); ObVal(self->pParam,UPLIMIT));
SCWrite(pCon,pBueffel, eValue); SCWrite(pCon,pBueffel, eValue);
sprintf(pBueffel,"%s.%s = %f",self->pName, "LowerLimit", sprintf(pBueffel,"%s.%s = %g",self->pName, "LowerLimit",
ObVal(self->pParam,LOWLIMIT)); ObVal(self->pParam,LOWLIMIT));
SCWrite(pCon,pBueffel, eValue); SCWrite(pCon,pBueffel, eValue);
sprintf(pBueffel,"%s.%s = %f",self->pName, "SafeValue", sprintf(pBueffel,"%s.%s = %g",self->pName, "SafeValue",
ObVal(self->pParam,SAFEVALUE)); ObVal(self->pParam,SAFEVALUE));
SCWrite(pCon,pBueffel, eValue); 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); EVCGetPos(self,pCon,&fPos);
sprintf(pBueffel,"%s.%s = %f",self->pName, "CurrentValue", sprintf(pBueffel,"%s.%s = %g",self->pName, "CurrentValue",
fPos); fPos);
SCWrite(pCon,pBueffel, eValue); SCWrite(pCon,pBueffel, eValue);
sprintf(pBueffel,"%s.%s = %f",self->pName, "TargetValue", sprintf(pBueffel,"%s.%s = %g",self->pName, "TargetValue",
self->fTarget); self->fTarget);
SCWrite(pCon,pBueffel, eValue); SCWrite(pCon,pBueffel, eValue);
@ -977,7 +1032,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
iRet = EVCGetPos(self,pCon,&fPos); iRet = EVCGetPos(self,pCon,&fPos);
if(iRet) if(iRet)
{ {
sprintf(pBueffel,"%s.%s = %f",self->pName,"CurrentValue", fPos); sprintf(pBueffel,"%s.%s = %g",self->pName,"CurrentValue", fPos);
SCWrite(pCon,pBueffel,eValue); SCWrite(pCon,pBueffel,eValue);
return 1; return 1;
} }
@ -1076,7 +1131,7 @@ extern pEVDriver CreateSLSDriv(int argc, char *argv[]);
} }
else 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); SCWrite(pCon,pBueffel,eValue);
return 1; return 1;
} }

View File

@ -15,7 +15,8 @@
#define UPLIMIT 4 #define UPLIMIT 4
#define LOWLIMIT 5 #define LOWLIMIT 5
#define SAFEVALUE 6 #define SAFEVALUE 6
#define MAXWAIT 7
#define SETTLE 8
#line 29 "evcontroller.w" #line 29 "evcontroller.w"
@ -28,6 +29,8 @@
pEVDriver pDriv; pEVDriver pDriv;
EVMode eMode; EVMode eMode;
float fTarget; float fTarget;
time_t start;
time_t lastt;
char *pName; char *pName;
ObPar *pParam; ObPar *pParam;
int iLog; int iLog;

View File

@ -55,7 +55,7 @@
return NULL; return NULL;
} }
memset(pNew,0,sizeof(EVDriver)); memset(pNew,0,sizeof(EVDriver));
pNew->GetValues=NULL; /* method will be replaced by default when NULL */
return pNew; return pNew;
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/

View File

@ -17,6 +17,8 @@
typedef struct __EVDriver { typedef struct __EVDriver {
int (*SetValue)(pEVDriver self, float fNew); int (*SetValue)(pEVDriver self, float fNew);
int (*GetValue)(pEVDriver self, float *fPos); int (*GetValue)(pEVDriver self, float *fPos);
int (*GetValues)(pEVDriver self, float *fTarget,
float *fPos, float *fDelta);
int (*Send)(pEVDriver self, char *pCommand, int (*Send)(pEVDriver self, char *pCommand,
char *pReplyBuffer, int iReplBufLen); char *pReplyBuffer, int iReplBufLen);
int (*GetError)(pEVDriver self, int *iCode, int (*GetError)(pEVDriver self, int *iCode,

View File

@ -1,77 +1,32 @@
yfactor 1.420000 a5l.length 80.000000
yfactor setAccess 1 flightpathlength 0.000000
xfactor 0.715000 flightpathlength setAccess 1
xfactor setAccess 1 flightpath 0.000000
ps.listfile peaksearch.dat flightpath setAccess 1
ps.listfile setAccess 2 delay 2500.000000
ps.scansteps 24 delay setAccess 1
ps.scansteps setAccess 2 hm CountMode timer
ps.scanpreset 1000000.000000 hm preset 100.000000
ps.scanpreset setAccess 2 hm genbin 120.000000 35.000000 512
ps.preset 1000.000000 hm init
ps.preset setAccess 2 datafile focus-1001848.hdf
ps.countmode monitor datafile setAccess 3
ps.countmode setAccess 2 dbfile UNKNOWN
ps.cogcontour 0.200000 dbfile setAccess 2
ps.cogcontour setAccess 2 # Motor th
ps.cogwindow 60 th sign 1.000000
ps.cogwindow setAccess 2 th SoftZero 0.000000
ps.window 7 th SoftLowerLim 4.000000
ps.window setAccess 2 th SoftUpperLim 113.000000
ps.steepness 3 th Fixed -1.000000
ps.steepness setAccess 2 th InterruptMode 0.000000
ps.threshold 30 th AccessCode 2.000000
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
#Crystallographic Settings #Crystallographic Settings
hkl lambda 1.179000 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 setub -0.017880 -0.074923 0.028280 -0.007008 -0.036800 -0.057747 0.160912 -0.009928 0.000627
hkl hm 0 hkl hm 0
detdist3 0.000000 det1dist 300.000000
detdist3 setAccess 1 det1dist 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
det1zeroy 128.000000 det1zeroy 128.000000
det1zeroy setAccess 1 det1zeroy setAccess 1
det1zerox 128.000000 det1zerox 128.000000
@ -112,22 +67,6 @@ ph SoftUpperLim 360.000000
ph Fixed -1.000000 ph Fixed -1.000000
ph InterruptMode 0.000000 ph InterruptMode 0.000000
ph AccessCode 2.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 # Motor dg1
dg1 sign 1.000000 dg1 sign 1.000000
dg1 SoftZero 0.000000 dg1 SoftZero 0.000000
@ -178,6 +117,8 @@ twotheta InterruptMode 0.000000
twotheta AccessCode 2.000000 twotheta AccessCode 2.000000
lastscancommand cscan a4 10. .1 10 5 lastscancommand cscan a4 10. .1 10 5
lastscancommand setAccess 2 lastscancommand setAccess 2
banana CountMode timer
banana preset 2.000000
sample_mur 0.000000 sample_mur 0.000000
sample_mur setAccess 2 sample_mur setAccess 2
email UNKNOWN email UNKNOWN
@ -188,25 +129,6 @@ phone UNKNOWN
phone setAccess 2 phone setAccess 2
adress UNKNOWN adress UNKNOWN
adress setAccess 2 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 # Motor tilt
tilt sign 1.000000 tilt sign 1.000000
tilt SoftZero 0.000000 tilt SoftZero 0.000000
@ -303,46 +225,6 @@ d1r SoftUpperLim 20.000000
d1r Fixed -1.000000 d1r Fixed -1.000000
d1r InterruptMode 0.000000 d1r InterruptMode 0.000000
d1r AccessCode 2.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 # Motor sdm
sdm sign 1.000000 sdm sign 1.000000
sdm SoftZero 0.000000 sdm SoftZero 0.000000

View File

@ -184,7 +184,7 @@ typedef enum _CharType {eSpace, eNum,eeText,eQuote} CharType;
if(strchr(pBueffel,'.')== NULL) if(strchr(pBueffel,'.')== NULL)
{ {
pCurrent->Type = eInt; pCurrent->Type = eInt;
sscanf(pBueffel,"%d",&(pCurrent->iVal)); sscanf(pBueffel,"%ld",&(pCurrent->iVal));
} }
else else
{ {

View File

@ -104,6 +104,7 @@ static float
maxShift=2, /* maximal shift in when controlMode=2 */ maxShift=2, /* maximal shift in when controlMode=2 */
tm=DATA_UNDEF, /* main temperature */ tm=DATA_UNDEF, /* main temperature */
ts=DATA_UNDEF, /* sample temperature */ ts=DATA_UNDEF, /* sample temperature */
tx=DATA_UNDEF, /* controlled temperature */
tr=DATA_UNDEF, /* set temperature (read back) */ tr=DATA_UNDEF, /* set temperature (read back) */
te=DATA_UNDEF, /* test temperature */ te=DATA_UNDEF, /* test temperature */
he=DATA_UNDEF, /* helium level value */ he=DATA_UNDEF, /* helium level value */
@ -929,6 +930,11 @@ int ReadTemp(void) {
tm=(rdTim % 3600) * 1.0e-4; tm=(rdTim % 3600) * 1.0e-4;
ts=(rdTim % 60) * 60.0e-4+0.5; ts=(rdTim % 60) * 60.0e-4+0.5;
} }
if (controlMode==0) {
tx=tm;
} else {
tx=ts;
}
if (auxSens != NULL) { if (auxSens != NULL) {
aux=auxSens->t * auxSens->scale; aux=auxSens->t * auxSens->scale;
} else { } else {
@ -1133,7 +1139,6 @@ int PutFloat(StrBuf *buf, int prec, float f) {
int PidSumHdl(int mode, void *base, int fd) { int PidSumHdl(int mode, void *base, int fd) {
StrBuf buf; StrBuf buf;
readTemp=1;
StrLink(&buf, pid); StrLink(&buf, pid);
StrClear(&buf); StrClear(&buf);
ERR_I(PutFloat(&buf, 5, prop)); ERR_I(PutFloat(&buf, 5, prop));
@ -2300,6 +2305,7 @@ int main(int argc, char *argv[]) {
CocDefFlt(tm, RD); CocDefFlt(tm, RD);
CocDefFlt(ts, RD); CocDefFlt(ts, RD);
CocDefFlt(tr, RD); CocDefFlt(tr, RD);
CocDefFlt(tx, RD);
CocDefFlt(te, RD); CocDefFlt(te, RD);
CocDefFlt(aux, RD); CocDefFlt(aux, RD);
CocDefFlt(he, RD); CocDefFlt(he, RD);

View File

@ -84,6 +84,23 @@ int TeccGet(pTecsClient conn, float *temp) {
OnError: return(-1); 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 TeccSet(pTecsClient conn, float temp) {
int iret; int iret;

View File

@ -17,6 +17,9 @@ pTecsClient TeccInit(char *server, int port);
int TeccGet(pTecsClient conn, float *temp); int TeccGet(pTecsClient conn, float *temp);
/* get temperature */ /* 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); int TeccGet3(pTecsClient conn, float *tSet, float *tExch, float *tSamp);
/* get temperatures */ /* get temperatures */

View File

@ -148,7 +148,7 @@
} }
return EVControlWrapper(pCon,pSics,pData,argc,argv); return EVControlWrapper(pCon,pSics,pData,argc,argv);
} else if (NULL!=strstr( } 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)) { , pBueffel)) {
/* forward to standard handler */ /* forward to standard handler */
return EVControlWrapper(pCon,pSics,pData,argc,argv); return EVControlWrapper(pCon,pSics,pData,argc,argv);
@ -207,6 +207,35 @@
return 1; 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) static int TecsRun(pEVDriver self, float fVal)
{ {
pTecsDriv pMe = NULL; pTecsDriv pMe = NULL;
@ -384,6 +413,7 @@
pNew->TryFixIt = TecsFix; pNew->TryFixIt = TecsFix;
pNew->Init = TecsInit; pNew->Init = TecsInit;
pNew->Close = TecsClose; pNew->Close = TecsClose;
pNew->GetValues= TecsGetX;
return pNew; return pNew;
} }

View File

@ -77,6 +77,7 @@ SicsUser Mugger Diethelm 1
SicsUser User Rosy 2 SicsUser User Rosy 2
SicsUser Spy 007 1 SicsUser Spy 007 1
SicsUser me me 1 SicsUser me me 1
SicsUser testuser 01lns1 3
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# S I M P L E V A R I A B L E S # S I M P L E V A R I A B L E S

View File

@ -297,7 +297,7 @@
{ {
if(sub2) if(sub2)
{ {
iRet = sscanf(sub2,"%d",&lNew); iRet = sscanf(sub2,"%ld",&lNew);
} }
else else
{ {