- Changes to SLS magnet controller

- Added nxscript putsicsdata to nxscript
This commit is contained in:
koennecke
2005-10-20 12:40:58 +00:00
parent cfb098aebb
commit 39877fc11a
10 changed files with 283 additions and 223 deletions

Binary file not shown.

Binary file not shown.

View File

@ -24,6 +24,7 @@ CH--5232 Villigen--PSI\\
Switzerland\\ Switzerland\\
\end{center} \end{center}
\clearpage \clearpage
\clearpage
\tableofcontents \tableofcontents
\clearpage \clearpage
@ -1035,10 +1036,10 @@ Currently these drivers are supported:
\item[tdc ] for the Risoe histogram memory. \item[tdc ] for the Risoe histogram memory.
\item[mcstas ] for the integration with the McStas (cf.\ Section~\ref{f8}) simulation. \item[mcstas ] for the integration with the McStas (cf.\ Section~\ref{f8}) simulation.
\end{description} \end{description}
Please care to note, that the SINQHM
requires a EL737 counter box for count control. This counter must have been
defined before creating the HM object.
\end{description} \end{description}
Please care to note, that the SINQHM
requires a counter box for count control. This counter must have been
defined before creating the HM object.
As an example the configuration of a SINQHM HM with the name banana will be As an example the configuration of a SINQHM HM with the name banana will be
shown: shown:
\begin{verbatim} \begin{verbatim}

View File

@ -66,6 +66,7 @@
#include "chadapter.h" #include "chadapter.h"
#include "status.h" #include "status.h"
#include "site.h" #include "site.h"
#include "commandlog.h"
/*--------------------- Functions needed to implement interfaces -----------*/ /*--------------------- Functions needed to implement interfaces -----------*/
static long EVIDrive(void *pData, SConnection *pCon, float fVal) static long EVIDrive(void *pData, SConnection *pCon, float fVal)
{ {
@ -176,7 +177,7 @@
static int EVIStatus(void *pData, SConnection *pCon) static int EVIStatus(void *pData, SConnection *pCon)
{ {
pEVControl self = NULL; pEVControl self = NULL;
float fPos, fDelta; float fPos, fDelta = .0;
int iRet, iCode, iFix; int iRet, iCode, iFix;
char pBueffel[256], pError[132]; char pBueffel[256], pError[132];
static int callCount; static int callCount;
@ -196,7 +197,6 @@
/* get the current position */ /* get the current position */
iRet = self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta); iRet = self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
if(iRet == 0) if(iRet == 0)
{ {
self->pDriv->GetError(self->pDriv,&iCode, pError,131); self->pDriv->GetError(self->pDriv,&iCode, pError,131);
@ -241,7 +241,7 @@
if(callCount >= 10) if(callCount >= 10)
{ {
sprintf(pBueffel,"%s = %g", self->pName, fPos); sprintf(pBueffel,"%s = %g", self->pName, fPos);
InvokeCallBack(self->pCall, VALUECHANGE,pBueffel); InvokeCallBack(self->pCall, VALUECHANGE,pBueffel);
callCount = 0; callCount = 0;
} }
@ -362,7 +362,7 @@ static void ErrWrite(char *txt, SCStore *conn)
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
static void ErrReport(pEVControl self) static void ErrReport(pEVControl self)
{ {
float fPos, fDelta; float fPos =.0, fDelta =.0;
char pBueffel[256]; char pBueffel[256];
self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta); self->pDriv->GetValues(self->pDriv,&self->fTarget,&fPos,&fDelta);
@ -550,7 +550,7 @@ static void ErrReport(pEVControl self)
pEVControl self = NULL; pEVControl self = NULL;
float fPos, fDelta; float fPos, fDelta;
int iRet, iCode, iStat; int iRet, iCode, iStat;
char pError[10], pBueffel[512]; char pError[132], pBueffel[512];
pExeList pExe = NULL; pExeList pExe = NULL;
SConnection *pCon = NULL; SConnection *pCon = NULL;
float tol; float tol;
@ -607,7 +607,9 @@ static void ErrReport(pEVControl self)
/* break down of connection to a environment device has to be /* break down of connection to a environment device has to be
considered a problem as well considered a problem as well
*/ */
self->pDriv->GetError(self->pDriv, &iCode,pError,9); memset(pError,0,132*sizeof(char));
self->pDriv->GetError(self->pDriv, &iCode,pError,131);
WriteToCommandLog("emon>> ",pError);
iStat = self->pDriv->TryFixIt(self->pDriv, iCode); iStat = self->pDriv->TryFixIt(self->pDriv, iCode);
if( (iStat == DEVOK) || (iStat == DEVREDO) ) if( (iStat == DEVOK) || (iStat == DEVREDO) )
{ {

View File

@ -320,6 +320,9 @@ static long SumRow(HistInt *iData, int iDataLength, int iStart, int iEnd){
for(i = iStart; i < iEnd; i++){ for(i = iStart; i < iEnd; i++){
lSum += iData[i]; lSum += iData[i];
} }
if(lSum < 0){
lSum = -lSum;
}
return lSum; return lSum;
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
@ -329,7 +332,7 @@ long sumHMDataRectangle(pHistMem hist, SConnection *pCon,
pHMdata self = hist->pDriv->data; pHMdata self = hist->pDriv->data;
int i, iHistLength, status, iIndex; int i, iHistLength, status, iIndex;
char pBueffel[256]; char pBueffel[256];
long lSum; unsigned long lSum;
assert(self); assert(self);
@ -386,8 +389,11 @@ long sumHMDataRectangle(pHistMem hist, SConnection *pCon,
"ERROR: summing in %d dimensions not yet implemented", "ERROR: summing in %d dimensions not yet implemented",
self->rank); self->rank);
SCWrite(pCon,pBueffel,eError); SCWrite(pCon,pBueffel,eError);
lSum = -1; return -1;
break; break;
} }
if(lSum < 0){
lSum = -lSum;
}
return lSum; return lSum;
} }

View File

@ -46,7 +46,7 @@ full: purge all
SICServer: $(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) \ SICServer: $(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) \
$(VELOOBJ) $(DIFIL) $(EXTRA) \ $(VELOOBJ) $(DIFIL) $(EXTRA) \
$(SUBLIBS) $(SUBLIBS)
$(CC) -pg -o SICServer \ $(CC) -g -o SICServer \
$(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) \ $(SOBJ) $(MOTOROBJ) $(COUNTEROBJ) \
$(VELOOBJ) $(DIFOBJ) $(EXTRA) $(LIBS) $(VELOOBJ) $(DIFOBJ) $(EXTRA) $(LIBS)

View File

@ -1,3 +1,3 @@
98 106
NEVER, EVER modify or delete this file NEVER, EVER modify or delete this file
You'll risk eternal damnation and a reincarnation as a cockroach!|n You'll risk eternal damnation and a reincarnation as a cockroach!|n

View File

@ -1,210 +1,3 @@
exe batchpath ./
exe syspath ./
sample_mur 0.000000
sample_mur setAccess 2
email UNKNOWN
email setAccess 2
fax UNKNOWN
fax setAccess 2
phone UNKNOWN
phone setAccess 2
adress UNKNOWN
adress setAccess 2
sicsdatapostfix .hdf
sicsdatapostfix setAccess 0
sicsdataprefix powder
sicsdataprefix setAccess 0
starttime 2005-08-16 16:46:50
starttime setAccess 2
comment3 UNKNOWN
comment3 setAccess 2
comment2 UNKNOWN
comment2 setAccess 2
comment1 UNKNOWN
comment1 setAccess 2
sampleintern na2ca3al2f14
sampleintern setAccess 2
collimation UNKNOWN
collimation setAccess 2
user UNKNOWN
user setAccess 2
title UNKNOWN
title setAccess 2
# Motor a9
a9 sign 1.000000
a9 SoftZero 0.000000
a9 SoftLowerLim 0.000000
a9 SoftUpperLim 20.000000
a9 Fixed -1.000000
a9 InterruptMode 0.000000
a9 precision 0.010000
a9 AccessCode 2.000000
a9 movecount 10.000000
# Motor a8
a8 sign 1.000000
a8 SoftZero 0.000000
a8 SoftLowerLim -30.000000
a8 SoftUpperLim 30.000000
a8 Fixed -1.000000
a8 InterruptMode 0.000000
a8 precision 0.010000
a8 AccessCode 2.000000
a8 movecount 10.000000
# Motor a7
a7 sign 1.000000
a7 SoftZero 0.000000
a7 SoftLowerLim -30.000000
a7 SoftUpperLim 30.000000
a7 Fixed -1.000000
a7 InterruptMode 0.000000
a7 precision 0.010000
a7 AccessCode 2.000000
a7 movecount 10.000000
# Motor a6
a6 sign 1.000000
a6 SoftZero 0.000000
a6 SoftLowerLim -30.000000
a6 SoftUpperLim 30.000000
a6 Fixed -1.000000
a6 InterruptMode 0.000000
a6 precision 0.010000
a6 AccessCode 2.000000
a6 movecount 10.000000
# Motor a5
a5 sign 1.000000
a5 SoftZero 0.000000
a5 SoftLowerLim -30.000000
a5 SoftUpperLim 30.000000
a5 Fixed -1.000000
a5 InterruptMode 0.000000
a5 precision 0.010000
a5 AccessCode 2.000000
a5 movecount 10.000000
# Motor a4
a4 sign 1.000000
a4 SoftZero 0.000000
a4 SoftLowerLim -10.000000
a4 SoftUpperLim 120.000000
a4 Fixed -1.000000
a4 InterruptMode 0.000000
a4 precision 0.010000
a4 AccessCode 2.000000
a4 movecount 10.000000
# Motor a3
a3 sign 1.000000
a3 SoftZero 0.000000
a3 SoftLowerLim -180.000000
a3 SoftUpperLim 360.000000
a3 Fixed -1.000000
a3 InterruptMode 0.000000
a3 precision 0.010000
a3 AccessCode 2.000000
a3 movecount 10.000000
# Motor a2
a2 sign 1.000000
a2 SoftZero 0.000000
a2 SoftLowerLim 30.000000
a2 SoftUpperLim 100.000000
a2 Fixed -1.000000
a2 InterruptMode 0.000000
a2 precision 0.010000
a2 AccessCode 2.000000
a2 movecount 10.000000
# Motor a1
a1 sign 1.000000
a1 SoftZero 0.000000
a1 SoftLowerLim 0.000000
a1 SoftUpperLim 120.000000
a1 Fixed -1.000000
a1 InterruptMode 0.000000
a1 precision 0.010000
a1 AccessCode 2.000000
a1 movecount 10.000000
banana CountMode monitor
banana preset 60.000000
# Counter counter
counter SetPreset 60000.000000
counter SetMode Monitor
# Motor twothetad
twothetad sign 1.000000
twothetad SoftZero 0.000000
twothetad SoftLowerLim -10.000000
twothetad SoftUpperLim 120.000000
twothetad Fixed -1.000000
twothetad InterruptMode 0.000000
twothetad precision 0.010000
twothetad AccessCode 2.000000
twothetad movecount 10.000000
# Motor table
table sign 1.000000
table SoftZero 0.000000
table SoftLowerLim -180.000000
table SoftUpperLim 360.000000
table Fixed -1.000000
table InterruptMode 0.000000
table precision 0.010000
table AccessCode 2.000000
table movecount 10.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 precision 0.010000
monochi AccessCode 2.000000
monochi movecount 10.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 precision 0.010000
monophi AccessCode 2.000000
monophi movecount 10.000000
# Motor curvem
curvem sign 1.000000
curvem SoftZero 0.000000
curvem SoftLowerLim 0.000000
curvem SoftUpperLim 20.000000
curvem Fixed -1.000000
curvem InterruptMode 0.000000
curvem precision 0.010000
curvem AccessCode 2.000000
curvem movecount 10.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 precision 0.010000
monoy AccessCode 2.000000
monoy movecount 10.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 precision 0.010000
monox AccessCode 2.000000
monox movecount 10.000000
# Motor twothetam
twothetam sign 1.000000
twothetam SoftZero 0.000000
twothetam SoftLowerLim 30.000000
twothetam SoftUpperLim 100.000000
twothetam Fixed -1.000000
twothetam InterruptMode 0.000000
twothetam precision 0.010000
twothetam AccessCode 2.000000
twothetam movecount 10.000000
# Motor omegam # Motor omegam
omegam sign 1.000000 omegam sign 1.000000
omegam SoftZero 0.000000 omegam SoftZero 0.000000
@ -213,5 +6,226 @@ omegam SoftUpperLim 120.000000
omegam Fixed -1.000000 omegam Fixed -1.000000
omegam InterruptMode 0.000000 omegam InterruptMode 0.000000
omegam precision 0.010000 omegam precision 0.010000
omegam ignorefault 0.000000
omegam AccessCode 2.000000 omegam AccessCode 2.000000
omegam movecount 10.000000 omegam movecount 10.000000
# Motor twothetam
twothetam sign 1.000000
twothetam SoftZero 0.000000
twothetam SoftLowerLim 30.000000
twothetam SoftUpperLim 100.000000
twothetam Fixed -1.000000
twothetam InterruptMode 0.000000
twothetam precision 0.010000
twothetam ignorefault 0.000000
twothetam AccessCode 2.000000
twothetam movecount 10.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 precision 0.010000
monox ignorefault 0.000000
monox AccessCode 2.000000
monox movecount 10.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 precision 0.010000
monoy ignorefault 0.000000
monoy AccessCode 2.000000
monoy movecount 10.000000
# Motor curvem
curvem sign 1.000000
curvem SoftZero 0.000000
curvem SoftLowerLim 0.000000
curvem SoftUpperLim 20.000000
curvem Fixed -1.000000
curvem InterruptMode 0.000000
curvem precision 0.010000
curvem ignorefault 0.000000
curvem AccessCode 2.000000
curvem movecount 10.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 precision 0.010000
monophi ignorefault 0.000000
monophi AccessCode 2.000000
monophi movecount 10.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 precision 0.010000
monochi ignorefault 0.000000
monochi AccessCode 2.000000
monochi movecount 10.000000
# Motor table
table sign 1.000000
table SoftZero 0.000000
table SoftLowerLim -180.000000
table SoftUpperLim 360.000000
table Fixed -1.000000
table InterruptMode 0.000000
table precision 0.010000
table ignorefault 0.000000
table AccessCode 2.000000
table movecount 10.000000
# Motor twothetad
twothetad sign 1.000000
twothetad SoftZero 0.000000
twothetad SoftLowerLim -10.000000
twothetad SoftUpperLim 120.000000
twothetad Fixed -1.000000
twothetad InterruptMode 0.000000
twothetad precision 0.010000
twothetad ignorefault 0.000000
twothetad AccessCode 2.000000
twothetad movecount 10.000000
# Counter counter
counter SetPreset 60000.000000
counter SetMode Monitor
banana CountMode monitor
banana preset 60.000000
# Motor a1
a1 sign 1.000000
a1 SoftZero 0.000000
a1 SoftLowerLim 0.000000
a1 SoftUpperLim 120.000000
a1 Fixed -1.000000
a1 InterruptMode 0.000000
a1 precision 0.010000
a1 ignorefault 0.000000
a1 AccessCode 2.000000
a1 movecount 10.000000
# Motor a2
a2 sign 1.000000
a2 SoftZero 0.000000
a2 SoftLowerLim 30.000000
a2 SoftUpperLim 100.000000
a2 Fixed -1.000000
a2 InterruptMode 0.000000
a2 precision 0.010000
a2 ignorefault 0.000000
a2 AccessCode 2.000000
a2 movecount 10.000000
# Motor a3
a3 sign 1.000000
a3 SoftZero 0.000000
a3 SoftLowerLim -180.000000
a3 SoftUpperLim 360.000000
a3 Fixed -1.000000
a3 InterruptMode 0.000000
a3 precision 0.010000
a3 ignorefault 0.000000
a3 AccessCode 2.000000
a3 movecount 10.000000
# Motor a4
a4 sign 1.000000
a4 SoftZero 0.000000
a4 SoftLowerLim -10.000000
a4 SoftUpperLim 120.000000
a4 Fixed -1.000000
a4 InterruptMode 0.000000
a4 precision 0.010000
a4 ignorefault 0.000000
a4 AccessCode 2.000000
a4 movecount 10.000000
# Motor a5
a5 sign 1.000000
a5 SoftZero 0.000000
a5 SoftLowerLim -30.000000
a5 SoftUpperLim 30.000000
a5 Fixed -1.000000
a5 InterruptMode 0.000000
a5 precision 0.010000
a5 ignorefault 0.000000
a5 AccessCode 2.000000
a5 movecount 10.000000
# Motor a6
a6 sign 1.000000
a6 SoftZero 0.000000
a6 SoftLowerLim -30.000000
a6 SoftUpperLim 30.000000
a6 Fixed -1.000000
a6 InterruptMode 0.000000
a6 precision 0.010000
a6 ignorefault 0.000000
a6 AccessCode 2.000000
a6 movecount 10.000000
# Motor a7
a7 sign 1.000000
a7 SoftZero 0.000000
a7 SoftLowerLim -30.000000
a7 SoftUpperLim 30.000000
a7 Fixed -1.000000
a7 InterruptMode 0.000000
a7 precision 0.010000
a7 ignorefault 0.000000
a7 AccessCode 2.000000
a7 movecount 10.000000
# Motor a8
a8 sign 1.000000
a8 SoftZero 0.000000
a8 SoftLowerLim -30.000000
a8 SoftUpperLim 30.000000
a8 Fixed -1.000000
a8 InterruptMode 0.000000
a8 precision 0.010000
a8 ignorefault 0.000000
a8 AccessCode 2.000000
a8 movecount 10.000000
# Motor a9
a9 sign 1.000000
a9 SoftZero 0.000000
a9 SoftLowerLim 0.000000
a9 SoftUpperLim 20.000000
a9 Fixed -1.000000
a9 InterruptMode 0.000000
a9 precision 0.010000
a9 ignorefault 0.000000
a9 AccessCode 2.000000
a9 movecount 10.000000
title UNKNOWN
title setAccess 2
user UNKNOWN
user setAccess 2
collimation UNKNOWN
collimation setAccess 2
sampleintern na2ca3al2f14
sampleintern setAccess 2
comment1 UNKNOWN
comment1 setAccess 2
comment2 UNKNOWN
comment2 setAccess 2
comment3 UNKNOWN
comment3 setAccess 2
starttime 2005-10-19 11:11:44
starttime setAccess 2
adress UNKNOWN
adress setAccess 2
phone UNKNOWN
phone setAccess 2
fax UNKNOWN
fax setAccess 2
email UNKNOWN
email setAccess 2
sample_mur 0.000000
sample_mur setAccess 2
exe batchpath ./
exe syspath ./

View File

@ -29,6 +29,7 @@
#include "udpquieck.h" #include "udpquieck.h"
#include "nxdict.h" #include "nxdict.h"
#include "nxscript.h" #include "nxscript.h"
#include "sicsdata.h"
extern char *trim(char *str); extern char *trim(char *str);
@ -342,6 +343,36 @@ static void putCounter(SConnection *pCon, SicsInterp *pSics, pNXScript self,
return; return;
} }
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
static void putSicsData(SConnection *pCon, SicsInterp *pSics,
pNXScript self, int argc, char *argv[]){
pSICSData data = NULL;
int status;
char buffer[256];
if(argc < 4){
SCWrite(pCon,"ERROR: insufficient number of arguments to putSicsData",
eError);
return;
}
/*
find data
*/
data = (pSICSData)FindCommandData(pSics,argv[3],"SICSData");
if(data == NULL){
snprintf(buffer,255,"ERROR: sicsdata %s not found!", argv[3]);
SCWrite(pCon,buffer,eError);
return;
}
status = NXDputalias(self->fileHandle,self->dictHandle,argv[2],data->data);
if(status != NX_OK){
sprintf(buffer,"ERROR: failed to write sicsdata to %s", argv[2]);
SCWrite(pCon,buffer,eError);
}
}
/*----------------------------------------------------------------------*/
static void updateHMDim(NXScript *self, pHistMem mem){ static void updateHMDim(NXScript *self, pHistMem mem){
int iDim[MAXDIM]; int iDim[MAXDIM];
int i, rank, timeLength, status; int i, rank, timeLength, status;
@ -944,6 +975,9 @@ static int handlePut(SConnection *pCon, SicsInterp *pSics, pNXScript self,
}else if(strcmp(argv[1],"putglobal") == 0){ }else if(strcmp(argv[1],"putglobal") == 0){
/*===============*/ /*===============*/
putGlobal(pCon,pSics,self,argc,argv); putGlobal(pCon,pSics,self,argc,argv);
}else if(strcmp(argv[1],"putsicsdata") == 0){
/*===============*/
putSicsData(pCon,pSics,self,argc,argv);
} else { } else {
SCWrite(pCon,"ERROR: put command not recognised",eError); SCWrite(pCon,"ERROR: put command not recognised",eError);
} }

View File

@ -889,9 +889,12 @@ static void ParseOutput(pTASdata pTAS, SConnection *pCon)
} }
else else
{ {
sprintf(pWarn,"WARNING: ignored invalid token > %s < in output", strtolower(pToken);
pToken); if(strcmp(pToken,"unknown") != 0) {
SCWrite(pCon,pWarn,eWarning); sprintf(pWarn,"WARNING: ignored invalid token > %s < in output",
pToken);
SCWrite(pCon,pWarn,eWarning);
}
} }
} }
free(pText); free(pText);