Merge branch 'RELEASE-3_0' of ics2-dev.nbi.ansto.gov.au:/opt/sicsdev_git into RELEASE-3_0
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -15,3 +15,5 @@ CVSPSI
|
||||
*.d
|
||||
*.out
|
||||
*.sqlite
|
||||
parser.out
|
||||
parsetab.py
|
||||
|
@ -45,7 +45,7 @@
|
||||
#define MAXCONNECTIONS 1024
|
||||
#define RBUFFERSIZE 262144 /* 256kb */
|
||||
#define WBUFFERSIZE 20*262144
|
||||
/* #define WBUFFERSIZE 100*262144 /*
|
||||
/* #define WBUFFERSIZE 100*262144 */
|
||||
/*--------------------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
int socket;
|
||||
|
@ -536,7 +536,7 @@ int CommandLog(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
if (iCompact > 0)
|
||||
iIntervall = 0;
|
||||
}
|
||||
SCPrintf(pCon, eValue, "%s.compact [sec] = %d", argv[0], iCompact);
|
||||
SCPrintf(pCon, eValue, "%s.compact [sec] = %d", argv[0], (int)iCompact);
|
||||
return 1;
|
||||
} else if (strcmp(argv[1], "close") == 0) { /* close command */
|
||||
fclose(fd);
|
||||
|
59
conman.c
59
conman.c
@ -770,6 +770,61 @@ static int testAndWriteSocket(SConnection * pCon, char *buffer, int iOut)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static int isOK(const char *buffer)
|
||||
{
|
||||
if ((buffer[0] == 'O' && buffer[1] == 'K')
|
||||
&& (buffer[2] == '\0' || buffer[2] == '\r' || buffer[2] == '\n'))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
static void testAndWriteSICSLog(SConnection * self, char *buffer, int iOut)
|
||||
{
|
||||
char *tp;
|
||||
/* We don't want to log the "OK" messages */
|
||||
if (isOK(buffer))
|
||||
return;
|
||||
|
||||
if (SCinMacro(self)) {
|
||||
tp = "M";
|
||||
if (sicsdebug())
|
||||
tp = "D";
|
||||
} else
|
||||
tp = "N";
|
||||
switch (iOut) {
|
||||
case eStatus:
|
||||
case eStart:
|
||||
case eFinish:
|
||||
case eEvent:
|
||||
case eHdbValue:
|
||||
case eHdbEvent:
|
||||
case eLog:
|
||||
case eLogError:
|
||||
case eError:
|
||||
case eWarning:
|
||||
/* Log it */
|
||||
SICSLogPrintf(iOut, "%s:%s", tp, buffer);
|
||||
return;
|
||||
case eValue:
|
||||
if (sicsdebug() || !SCinMacro(self)) {
|
||||
/* Log it */
|
||||
SICSLogPrintf(iOut, "%s:%s", tp, buffer);
|
||||
return;
|
||||
} else {
|
||||
/* Suppressed */
|
||||
/* SICSLogPrintf(iOut, "%s!:%s", tp, buffer); */
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("Unrecognized ouput code %d in testAndWriteSICSLog: FIXME!!!\n", iOut);
|
||||
SICSLogPrintf(iOut, "%s:%s", tp, buffer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int SCNormalWrite(SConnection * self, char *buffer, int iOut)
|
||||
{
|
||||
@ -784,10 +839,14 @@ int SCNormalWrite(SConnection * self, char *buffer, int iOut)
|
||||
}
|
||||
|
||||
/* log it for any case */
|
||||
#if 0
|
||||
if ( (sicsdebug() || !SCinMacro(self)) && !(iOut == eInternal
|
||||
|| (buffer[0] == 'O' && buffer[1] == 'K'
|
||||
&& (buffer[2] == '\0' || buffer[2] == '\r' || buffer[2] == '\n'))))
|
||||
SICSLogWrite(buffer, iOut);
|
||||
#else
|
||||
testAndWriteSICSLog(self, buffer, iOut);
|
||||
#endif
|
||||
|
||||
testAndWriteCommandLog(self, buffer, iOut);
|
||||
|
||||
|
9
conman.h
9
conman.h
@ -91,7 +91,14 @@ void SCSignalFunction(void *pCon, int iSignal, void *pSigData);
|
||||
/* ***************************** I/O ************************************** */
|
||||
void SCSetOutputClass(SConnection * self, int iClass);
|
||||
int SCWrite(SConnection * self, char *pBuffer, int iOut);
|
||||
int SCPrintf(SConnection * self, int iOut, char *fmt, ...);
|
||||
#if __GNUC__ > 2
|
||||
#define G_GNUC_PRINTF( format_idx, arg_idx ) \
|
||||
__attribute__((__format__ (__printf__, format_idx, arg_idx)))
|
||||
#else
|
||||
#define G_GNUC_PRINTF( format_idx, arg_idx )
|
||||
#endif
|
||||
int SCPrintf(SConnection * self, int iOut, char *fmt, ...) G_GNUC_PRINTF (3, 4);
|
||||
#undef G_GNUC_PRINTF
|
||||
int SCRead(SConnection * self, char *pBuffer, int iBufLen);
|
||||
int SCPrompt(SConnection * pCon, char *pPrompt, char *pResult, int iLen);
|
||||
int SCSendOK(SConnection * self);
|
||||
|
@ -1142,7 +1142,7 @@ int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
iRet = self->pDriv->Get(self->pDriv, PaRes.Arg[0].text,
|
||||
PaRes.Arg[1].iVal, &fVal);
|
||||
if (iRet == 1) {
|
||||
snprintf(pBueffel,255, "%s.%s %d = %f", argv[0], PaRes.Arg[0].text,
|
||||
snprintf(pBueffel,255, "%s.%s %s = %f", argv[0], PaRes.Arg[0].text,
|
||||
PaRes.Arg[1].text, fVal);
|
||||
SCWrite(pCon, pBueffel, eValue);
|
||||
return 1;
|
||||
|
26
diffscan.c
26
diffscan.c
@ -376,7 +376,7 @@ static int DiffScanTask(void *pData)
|
||||
status = GetDrivablePosition(pVar->pObject, self->scanObject->pCon,
|
||||
&fPos);
|
||||
if (status == 0) {
|
||||
ReleaseCountLock(pCount->pCountInt);
|
||||
ReleaseCountLock(pCount->pCountInt);
|
||||
return finish;
|
||||
}
|
||||
AppendScanVar(pVar, fPos);
|
||||
@ -396,21 +396,21 @@ static int DiffScanTask(void *pData)
|
||||
rawCount = data->lCount;
|
||||
rawMon = data->Monitors[self->scaleMonitor - 1];
|
||||
if(rawMon > 100){
|
||||
self->normalizationScale = rawMon;
|
||||
traceSys("diffscan","START:normalizing on %d, scale monitor is %d",
|
||||
self->normalizationScale, self->scaleMonitor);
|
||||
self->normalizationScale = rawMon;
|
||||
traceSys("diffscan","START:normalizing on %d, scale monitor is %d",
|
||||
self->normalizationScale, self->scaleMonitor);
|
||||
} else {
|
||||
traceSys("diffscan","START:normalization count %d, on scale monitor is %d and is to low",
|
||||
rawMon, self->scaleMonitor);
|
||||
SCWrite(self->scanObject->pCon,"WARNING: Skipping first point because of low count rate", eWarning);
|
||||
return finish;
|
||||
traceSys("diffscan","START:normalization count %ld, on scale monitor is %d and is to low",
|
||||
rawMon, self->scaleMonitor);
|
||||
SCWrite(self->scanObject->pCon,"WARNING: Skipping first point because of low count rate", eWarning);
|
||||
return finish;
|
||||
}
|
||||
} else {
|
||||
if (data->Monitors[self->scaleMonitor - 1] -
|
||||
self->last.Monitors[self->scaleMonitor - 1] < 5) {
|
||||
SCWrite(self->scanObject->pCon, "WARNING: low count rate", eLog);
|
||||
traceSys("diffscan","RUN:low monitor difference from %d to %d",data->Monitors[self->scaleMonitor-1],
|
||||
self->last.Monitors[self->scaleMonitor -1]);
|
||||
traceSys("diffscan","RUN:low monitor difference from %ld to %ld",data->Monitors[self->scaleMonitor-1],
|
||||
self->last.Monitors[self->scaleMonitor -1]);
|
||||
}
|
||||
rawCount = data->lCount;
|
||||
rawMon = data->Monitors[self->scaleMonitor - 1];
|
||||
@ -441,8 +441,8 @@ static int DiffScanTask(void *pData)
|
||||
ReleaseHdbValue(&v);
|
||||
}
|
||||
InvokeCallBack(self->scanObject->pCall, SCANPOINT, self->scanObject);
|
||||
traceSys("diffscan","RUN: pos, count, rawcount, rawmon: %f, %d, %d, %d",
|
||||
fPos, countValue, rawCount, rawMon);
|
||||
traceSys("diffscan","RUN: pos, count, rawcount, rawmon: %f, %f, %ld, %ld",
|
||||
fPos, countValue, rawCount, rawMon);
|
||||
|
||||
/*
|
||||
check for interrupt
|
||||
@ -455,7 +455,7 @@ static int DiffScanTask(void *pData)
|
||||
}
|
||||
|
||||
if(finish == 0) {
|
||||
ReleaseCountLock(pCount->pCountInt);
|
||||
ReleaseCountLock(pCount->pCountInt);
|
||||
}
|
||||
|
||||
return finish;
|
||||
|
@ -35,7 +35,14 @@ typedef struct {
|
||||
* \return the new error message list head
|
||||
*/
|
||||
|
||||
void ErrPutMsg(ErrList *list, char *fmt, ...);
|
||||
#if __GNUC__ > 2
|
||||
#define G_GNUC_PRINTF( format_idx, arg_idx ) \
|
||||
__attribute__((__format__ (__printf__, format_idx, arg_idx)))
|
||||
#else
|
||||
#define G_GNUC_PRINTF( format_idx, arg_idx )
|
||||
#endif
|
||||
void ErrPutMsg(ErrList *list, char *fmt, ...) G_GNUC_PRINTF (2, 3);
|
||||
#undef G_GNUC_PRINTF
|
||||
|
||||
/** \brief Get the most recent error message
|
||||
* \param list the error list
|
||||
|
@ -48,7 +48,7 @@ extern void StopExit(void); /* in SICSmain.c */
|
||||
|
||||
extern int openDevexecLog(); /* in devexec.c */
|
||||
|
||||
extern void NetWatchInit(void); /* in nwatch.c */
|
||||
extern int NetWatchTask(void *pData); /* in nwatch.c */
|
||||
/* ========================= Less dreadful file statics =================== */
|
||||
|
||||
#define DEFAULTINIFILE "servo.tcl"
|
||||
@ -120,7 +120,7 @@ int InitServer(char *file, pServer * pServ)
|
||||
pSICSOptions = IFAddOption(pSICSOptions, "ConMask", "0");
|
||||
|
||||
/* initialize the network watcher */
|
||||
NetWatchInit();
|
||||
TaskRegister(self->pTasker, NetWatchTask, NULL, NULL, NULL, 1);
|
||||
|
||||
/* initialise the server from script */
|
||||
SetWriteHistory(0);
|
||||
|
25
nwatch.c
25
nwatch.c
@ -36,27 +36,24 @@ typedef struct __netwatcher_s {
|
||||
/* Singleton pattern */
|
||||
static pNetWatch instance = NULL;
|
||||
|
||||
static int NetWatchTask(void *pData);
|
||||
|
||||
/**
|
||||
* \brief Initialises the Net Watcher singleton and starts the task
|
||||
*
|
||||
* \return 1=success, 0=failure
|
||||
*/
|
||||
int NetWatchInit(void)
|
||||
static pNetWatch NetWatchGetInstance(void)
|
||||
{
|
||||
/*
|
||||
* If the singleton has not yet been created, do so now
|
||||
*/
|
||||
if (instance == NULL) {
|
||||
instance = (pNetWatch) malloc(sizeof(NetWatch));
|
||||
if (instance == NULL)
|
||||
return 0;
|
||||
memset(instance, 0, sizeof(NetWatch));
|
||||
instance->lMagic = NWMAGIC;
|
||||
TaskRegister(pServ->pTasker, NetWatchTask, NULL, NULL, NULL, 1);
|
||||
if (instance != NULL) {
|
||||
memset(instance, 0, sizeof(NetWatch));
|
||||
instance->lMagic = NWMAGIC;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return instance;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -162,7 +159,7 @@ int NetWatchRegisterTimer(pNWTimer * handle, int mSec,
|
||||
pNWCallback callback, void *context)
|
||||
{
|
||||
assert(callback);
|
||||
pNetWatch self = instance;
|
||||
pNetWatch self = NetWatchGetInstance();
|
||||
if (!self || self->lMagic != NWMAGIC)
|
||||
return 0;
|
||||
pNWTimer pNew = (pNWTimer) malloc(sizeof(NWTimer));
|
||||
@ -238,7 +235,7 @@ int NetWatchSetTimerPeriod(pNWTimer handle, int mSecPeriod)
|
||||
|
||||
int NetWatchRemoveTimer(pNWTimer handle)
|
||||
{
|
||||
pNetWatch self = instance;
|
||||
pNetWatch self = NetWatchGetInstance();
|
||||
if (!self || self->lMagic != NWMAGIC)
|
||||
return 0;
|
||||
if (handle == NULL || handle->vrfy != NWMAGIC)
|
||||
@ -317,7 +314,7 @@ int NetWatchRegisterCallback(pNWContext * handle, int iSocket,
|
||||
{
|
||||
assert(callback);
|
||||
pNWContext pNew = NULL;
|
||||
pNetWatch self = instance;
|
||||
pNetWatch self = NetWatchGetInstance();
|
||||
if (!self || self->lMagic != NWMAGIC)
|
||||
return 0;
|
||||
if (iSocket < 0 || iSocket > 65535)
|
||||
@ -337,7 +334,7 @@ int NetWatchRegisterCallback(pNWContext * handle, int iSocket,
|
||||
|
||||
int NetWatchRemoveCallback(pNWContext handle)
|
||||
{
|
||||
pNetWatch self = instance;
|
||||
pNetWatch self = NetWatchGetInstance();
|
||||
if (handle == NULL || handle->vrfy != NWMAGIC)
|
||||
return 0;
|
||||
if (!self || self->lMagic != NWMAGIC)
|
||||
@ -379,7 +376,7 @@ int NetWatchTask(void *pData)
|
||||
int iCount;
|
||||
|
||||
/* Check the singleton */
|
||||
self = (pNetWatch) instance;
|
||||
self = NetWatchGetInstance();
|
||||
if (!self || self->lMagic != NWMAGIC)
|
||||
return 0;
|
||||
|
||||
|
120
nxdict.c
120
nxdict.c
@ -1475,6 +1475,126 @@ NXstatus NXDinfoalias(NXhandle hFil, NXdict dict, char *pAlias, int *rank,
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
NXstatus NXDdefnamedlink(NXhandle hFil, NXdict dict,
|
||||
char *pTarget, char *pVictim, char *newname)
|
||||
{
|
||||
NXdict pDict;
|
||||
ParDat pParseT, pParseV;
|
||||
int iRet, i, iStat;
|
||||
NXlink sLink;
|
||||
|
||||
pDict = NXDIAssert(dict);
|
||||
|
||||
|
||||
#ifdef DEFDEBUG
|
||||
printf("Linking: %s\n", pVictim);
|
||||
printf("To: %s\n", pTarget);
|
||||
#endif
|
||||
|
||||
|
||||
/* parse Victim */
|
||||
pParseV.iMayCreate = 0;
|
||||
pParseV.pPtr = pVictim;
|
||||
pParseV.iDepth = 0;
|
||||
iRet = NXDIDefParse(hFil, pDict, &pParseV);
|
||||
if (iRet == NX_ERROR) {
|
||||
/* unwind and throw up */
|
||||
NXDIUnwind(hFil, pParseV.iDepth);
|
||||
return NX_ERROR;
|
||||
}
|
||||
/* get link data */
|
||||
if (pParseV.iTerminal == TERMSDS) {
|
||||
NXgetdataID(hFil, &sLink);
|
||||
iRet = NXclosedata(hFil);
|
||||
if (iRet != NX_OK) {
|
||||
/* unwind and throw up */
|
||||
NXDIUnwind(hFil, pParseV.iDepth);
|
||||
return NX_ERROR;
|
||||
}
|
||||
} else if (pParseV.iTerminal == TERMVG) {
|
||||
NXgetgroupID(hFil, &sLink);
|
||||
} else {
|
||||
assert(0); /* serious programming error */
|
||||
}
|
||||
/* Unwind */
|
||||
iRet = NXDIUnwind(hFil, pParseV.iDepth);
|
||||
if (iRet != NX_OK) {
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
/* parse Target */
|
||||
pParseT.iMayCreate = 1;
|
||||
pParseT.pPtr = pTarget;
|
||||
pParseT.iDepth = 0;
|
||||
iRet = NXDIDefParse(hFil, pDict, &pParseT);
|
||||
if (iRet == NX_ERROR) {
|
||||
/* unwind and throw up */
|
||||
NXDIUnwind(hFil, pParseT.iDepth);
|
||||
return NX_ERROR;
|
||||
}
|
||||
/* check it being a vGroup! */
|
||||
if (pParseT.iTerminal != TERMVG) {
|
||||
NXReportError("ERROR: can link only into a vGroup");
|
||||
NXDIUnwind(hFil, pParseT.iDepth);
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
/* link, finally */
|
||||
iRet = NXmakenamedlink(hFil, newname, &sLink);
|
||||
/* Unwind anyway */
|
||||
iStat = NXDIUnwind(hFil, pParseT.iDepth);
|
||||
if (iStat != NX_OK) {
|
||||
return NX_ERROR;
|
||||
}
|
||||
return iStat;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
NXstatus NXDaliasnamedlink(NXhandle hFil, NXdict dict,
|
||||
char *pTarget, char *pVictim, char *newname)
|
||||
{
|
||||
char pTargetDef[2048], pVictimDef[2048];
|
||||
int iRet;
|
||||
NXdict pDict;
|
||||
pDynString pRep1 = NULL, pRep2 = NULL;
|
||||
|
||||
pDict = NXDIAssert(dict);
|
||||
|
||||
/* get Target Definition String */
|
||||
iRet = NXDget(pDict, pTarget, pTargetDef, 2047);
|
||||
if (iRet != NX_OK) {
|
||||
sprintf(pTargetDef, "ERROR: alias %s not recognized", pTarget);
|
||||
NXReportError(pTargetDef);
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
/* get Victim definition string */
|
||||
iRet = NXDget(pDict, pVictim, pVictimDef, 2047);
|
||||
if (iRet != NX_OK) {
|
||||
sprintf(pTargetDef, "ERROR: alias %s not recognized", pTarget);
|
||||
NXReportError(pTargetDef);
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
/* do replacements */
|
||||
pRep1 = NXDItextreplace(dict, pTargetDef);
|
||||
pRep2 = NXDItextreplace(dict, pVictimDef);
|
||||
if ((!pRep1) || (!pRep2)) {
|
||||
if (pRep1)
|
||||
DeleteDynString(pRep1);
|
||||
if (pRep2)
|
||||
DeleteDynString(pRep2);
|
||||
return NX_ERROR;
|
||||
}
|
||||
|
||||
/* call NXdeflin */
|
||||
iRet = NXDdefnamedlink(hFil, pDict, GetCharArray(pRep1), GetCharArray(pRep2), newname);
|
||||
DeleteDynString(pRep1);
|
||||
DeleteDynString(pRep2);
|
||||
return iRet;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
NXstatus NXDdeflink(NXhandle hFil, NXdict dict,
|
||||
char *pTarget, char *pVictim)
|
||||
|
29
nxscript.c
29
nxscript.c
@ -1589,6 +1589,31 @@ static void makeLink(SConnection * pCon, SicsInterp * pSics,
|
||||
SCSendOK(pCon);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void makeNamedLink(SConnection * pCon, SicsInterp * pSics,
|
||||
pNXScript self, int argc, char *argv[])
|
||||
{
|
||||
int status;
|
||||
char pBueffel[256];
|
||||
|
||||
if (argc < 5) {
|
||||
SCWrite(pCon, "ERROR: insufficient number of arguments to makenamedlink",
|
||||
eLogError);
|
||||
return;
|
||||
}
|
||||
|
||||
status = NXDaliasnamedlink(self->fileHandle, self->dictHandle,
|
||||
argv[2], argv[3], argv[4]);
|
||||
if (status != NX_OK) {
|
||||
snprintf(pBueffel, 255, "ERROR: linking %s against %s as %s failed",
|
||||
argv[2], argv[3], argv[4]);
|
||||
SCWrite(pCon, pBueffel, eLogError);
|
||||
return;
|
||||
}
|
||||
|
||||
SCSendOK(pCon);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
static void updateDictVar(SConnection * pCon, pNXScript self, int argc,
|
||||
char *argv[])
|
||||
@ -1698,6 +1723,10 @@ int NXScriptAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
makeLink(pCon, pSics, self, argc, argv);
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(argv[1], "makenamedlink") == 0) {
|
||||
makeNamedLink(pCon, pSics, self, argc, argv);
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
8
nxxml.c
8
nxxml.c
@ -779,7 +779,7 @@ NXstatus NXXputdatatable (NXhandle fid, const void *data){
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
NXstatus NXXputdata (NXhandle fid, void *data){
|
||||
NXstatus NXXputdata (NXhandle fid, const void *data){
|
||||
pXMLNexus xmlHandle = NULL;
|
||||
mxml_node_t *userData = NULL;
|
||||
mxml_node_t *current = NULL;
|
||||
@ -1074,8 +1074,8 @@ NXstatus NXXputslabtable (NXhandle fid, const void *data,
|
||||
return NX_OK;
|
||||
}
|
||||
/*----------------------------------------------------------------------*/
|
||||
NXstatus NXXputslab64 (NXhandle fid, void *data,
|
||||
int64_t iStart[], int64_t iSize[]){
|
||||
NXstatus NXXputslab64 (NXhandle fid, const void *data,
|
||||
const int64_t iStart[], const int64_t iSize[]){
|
||||
|
||||
pXMLNexus xmlHandle = NULL;
|
||||
mxml_node_t *userData = NULL;
|
||||
@ -1295,7 +1295,7 @@ static char *formatAttributeData(const void *data, int datalen, int iType){
|
||||
return number;
|
||||
}
|
||||
/*---------------------------------------------------------------------*/
|
||||
NXstatus NXXputattr (NXhandle fid, CONSTCHAR *name, void *data,
|
||||
NXstatus NXXputattr (NXhandle fid, CONSTCHAR *name, const void *data,
|
||||
int datalen, int iType){
|
||||
char buffer[256];
|
||||
pXMLNexus xmlHandle = NULL;
|
||||
|
8
nxxml.h
8
nxxml.h
@ -44,15 +44,15 @@ NXstatus NXXmakedata64 (NXhandle fid,
|
||||
int rank, int64_t dimensions[]);
|
||||
NXstatus NXXopendata (NXhandle fid, CONSTCHAR *name);
|
||||
NXstatus NXXclosedata (NXhandle fid);
|
||||
NXstatus NXXputdata (NXhandle fid, void *data);
|
||||
NXstatus NXXputdata (NXhandle fid, const void *data);
|
||||
NXstatus NXXgetdata (NXhandle fid, void *data);
|
||||
NXstatus NXXgetinfo64 (NXhandle fid, int *rank,
|
||||
int64_t dimension[], int *iType);
|
||||
NXstatus NXXputslab64 (NXhandle fid, void *data,
|
||||
int64_t iStart[], int64_t iSize[]);
|
||||
NXstatus NXXputslab64 (NXhandle fid, const void *data,
|
||||
const int64_t iStart[], const int64_t iSize[]);
|
||||
NXstatus NXXgetslab64 (NXhandle fid, void *data,
|
||||
const int64_t iStart[], const int64_t iSize[]);
|
||||
NXstatus NXXputattr (NXhandle fid, CONSTCHAR *name, void *data,
|
||||
NXstatus NXXputattr (NXhandle fid, CONSTCHAR *name, const void *data,
|
||||
int datalen, int iType);
|
||||
NXstatus NXXgetattr (NXhandle fid, char *name,
|
||||
void *data, int* datalen, int* iType);
|
||||
|
@ -172,7 +172,7 @@ static int ContextDo(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
|
||||
comCon = SCCopyConnection(pCon);
|
||||
if (comCon == NULL) {
|
||||
SCWrite(pCon, "EROOR: out of memory in contextdo", eError);
|
||||
SCWrite(pCon, "ERROR: out of memory in contextdo", eError);
|
||||
return 0;
|
||||
}
|
||||
status = Tcl_GetInt(pSics->pTcl, argv[1], &comCon->transID);
|
||||
|
2
sansbc.c
2
sansbc.c
@ -204,7 +204,7 @@ static int StatCmd(pSICSOBJ self, SConnection *pCon, pHdb commandNode,
|
||||
}
|
||||
average = (double)sum/(double)length;
|
||||
|
||||
SCPrintf(pCon,eValue,"Stat:sum,max,min,av = %d,%d,%d,%f", sum,max,min,average);
|
||||
SCPrintf(pCon,eValue,"Stat:sum,max,min,av = %ld,%ld,%ld,%f", sum,max,min,average);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -402,6 +402,7 @@ static char *SctActionHandler(void *actionData, char *lastReply,
|
||||
char *errorScript = NULL;
|
||||
char *send = NULL;
|
||||
int i;
|
||||
int j;
|
||||
SConnection *con;
|
||||
char eprop[80];
|
||||
char msg[1024];
|
||||
@ -516,6 +517,21 @@ static char *SctActionHandler(void *actionData, char *lastReply,
|
||||
if (strcasecmp(data->name, "read") == 0) {
|
||||
SetHdbProperty(node, "geterror", result);
|
||||
}
|
||||
/* Sanitize the text to reduce TCL problems with unbalanced and substituted items */
|
||||
for (j = 0; msg[j]; ++j) {
|
||||
switch (msg[j]) {
|
||||
case '{':
|
||||
case '}':
|
||||
case '[':
|
||||
case ']':
|
||||
case '<':
|
||||
case '>':
|
||||
case '\'':
|
||||
case '"':
|
||||
case '$':
|
||||
msg[j] = '_';
|
||||
}
|
||||
}
|
||||
SetHdbProperty(node, eprop, msg);
|
||||
blank = strchr(origScript, ' ');
|
||||
if (blank != NULL) {
|
||||
@ -531,6 +547,21 @@ static char *SctActionHandler(void *actionData, char *lastReply,
|
||||
}
|
||||
cnt++;
|
||||
snprintf(msg, sizeof msg, "%dx {%s}: %s", cnt, origScript, result);
|
||||
/* Sanitize the text to reduce TCL problems with unbalanced and substituted items */
|
||||
for (j = 0; msg[j]; ++j) {
|
||||
switch (msg[j]) {
|
||||
case '{':
|
||||
case '}':
|
||||
case '[':
|
||||
case ']':
|
||||
case '<':
|
||||
case '>':
|
||||
case '\'':
|
||||
case '"':
|
||||
case '$':
|
||||
msg[j] = '_';
|
||||
}
|
||||
}
|
||||
SetHdbProperty(node, eprop, msg);
|
||||
send = NULL;
|
||||
free(script);
|
||||
|
54
servlog.c
54
servlog.c
@ -82,6 +82,28 @@ typedef struct __LogLog {
|
||||
static pCaptureEntry pCapture = NULL;
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
static char* OutCodeToTxt(OutCode eOut)
|
||||
{
|
||||
switch (eOut) {
|
||||
case eInternal: return "Int"; /* internal */
|
||||
case eCommand: return "Cmd"; /* reserved, not used */
|
||||
case eHWError: return "ErH"; /* reserved, used only for SICSLog */
|
||||
case eInError: return "ErI"; /* reserved, used as a mark in the handling of output codes */
|
||||
case eStatus: return "Sta"; /* reserved, deprecated */
|
||||
case eValue: return "Val"; /* value reponse: copied into Tcl */
|
||||
case eStart: return "Beg"; /* start message */
|
||||
case eFinish: return "End"; /* finish message */
|
||||
case eEvent: return "Evt"; /* some callback messages */
|
||||
case eWarning: return "Wrn"; /* warnings */
|
||||
case eError: return "Err"; /* error: copied into Tcl */
|
||||
case eHdbValue: return "HVa"; /* hipadaba value chnage */
|
||||
case eHdbEvent: return "HEv"; /* Hipadaba event */
|
||||
case eLog: return "Log"; /* log message: is always written to client */
|
||||
case eLogError: return "ErL"; /* error message to log: is always written to client */
|
||||
}
|
||||
return "???";
|
||||
}
|
||||
|
||||
int KillCapture(SConnection * pCon)
|
||||
{
|
||||
pCaptureEntry pCurrent, pTemp;
|
||||
@ -325,7 +347,7 @@ static void SICSLogWriteFile(char *pText, OutCode eOut, struct timeval *tp)
|
||||
|
||||
if (iLineCount == 0)
|
||||
fprintf(fLogFile, "%s: <<<open logfile>>>\n", timestamp(NULL));
|
||||
fprintf(fLogFile, "%s: ", timestamp(tp));
|
||||
fprintf(fLogFile, "%s:%s:", timestamp(tp), OutCodeToTxt(eOut));
|
||||
fprintf(fLogFile, "%s", pText);
|
||||
if (text_len < 1 || pText[text_len - 1] != '\n')
|
||||
fprintf(fLogFile, "\n");
|
||||
@ -351,6 +373,8 @@ void SICSLogWriteTime(char *pText, OutCode eOut, struct timeval *tp)
|
||||
buf[idx++] = '\0';
|
||||
SICSLogWriteFile(buf, eOut, tp);
|
||||
idx = 0;
|
||||
buf[idx++] = '*';
|
||||
buf[idx++] = ':';
|
||||
} else if (*cp == '\r') {
|
||||
buf[idx++] = '\\';
|
||||
buf[idx++] = 'r';
|
||||
@ -372,6 +396,8 @@ void SICSLogWriteTime(char *pText, OutCode eOut, struct timeval *tp)
|
||||
buf[idx++] = '\0';
|
||||
SICSLogWriteFile(buf, eOut, tp);
|
||||
idx = 0;
|
||||
buf[idx++] = '*';
|
||||
buf[idx++] = ':';
|
||||
}
|
||||
}
|
||||
if (idx > 0) {
|
||||
@ -521,29 +547,3 @@ void SICSLogPrintf(OutCode eOut, const char *fmt, ...)
|
||||
SICSLogWrite(buf, eOut);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Test of the logging facilities */
|
||||
int testLogCmd(SConnection *pCon, SicsInterp *pInter, void *pData,
|
||||
int argc, char *argv[]) {
|
||||
char lbuf[2048];
|
||||
char sbuf[1000];
|
||||
int i;
|
||||
SICSLogWrite("Multiline:\nLine 1\r\nLine 2\r\nLine 3\r\n", eStatus);
|
||||
memset(lbuf, 0, sizeof(lbuf));
|
||||
memset(sbuf, ' ', sizeof(sbuf));
|
||||
SICSLogPrintf(eStatus, "Hexlog %d all zero bytes", sizeof(lbuf));
|
||||
SICSLogWriteHex(lbuf, sizeof(lbuf), eStatus);
|
||||
for (i = 0; i <= 128; ++i)
|
||||
sbuf[i] = sbuf[sizeof(sbuf) - 1 - i] = i;
|
||||
sbuf[sizeof(sbuf) / 2] = '!';
|
||||
SICSLogPrintf(eStatus, "Hexlog %d mid space bytes", sizeof(sbuf));
|
||||
SICSLogWriteHex(sbuf, sizeof(sbuf), eStatus);
|
||||
for (i = 0; i < 1000; ++i)
|
||||
sbuf[i] = ' ' + (i % 96);
|
||||
sbuf[sizeof(sbuf) - 1] = '\0';
|
||||
SICSLogWrite("Very long line 1000 bytes", eStatus);
|
||||
SICSLogWrite(sbuf, eStatus);
|
||||
SCSendOK(pCon);
|
||||
return OKOK;
|
||||
}
|
||||
|
||||
|
11
servlog.h
11
servlog.h
@ -20,9 +20,16 @@ void SICSLogWriteTime(char *ptext, OutCode eOut, struct timeval *tp);
|
||||
void SICSLogWriteHex(const char *text, int count, OutCode eOut);
|
||||
void SICSLogWriteHexTime(const char *text, int count, OutCode eOut,
|
||||
struct timeval *tp);
|
||||
void SICSLogPrintf(OutCode eOut, const char *fmt, ...);
|
||||
#if __GNUC__ > 2
|
||||
#define G_GNUC_PRINTF( format_idx, arg_idx ) \
|
||||
__attribute__((__format__ (__printf__, format_idx, arg_idx)))
|
||||
#else
|
||||
#define G_GNUC_PRINTF( format_idx, arg_idx )
|
||||
#endif
|
||||
void SICSLogPrintf(OutCode eOut, const char *fmt, ...) G_GNUC_PRINTF (2, 3);
|
||||
void SICSLogTimePrintf(OutCode eOut, struct timeval *tp, const char *fmt,
|
||||
...);
|
||||
...) G_GNUC_PRINTF (3, 4);
|
||||
#undef G_GNUC_PRINTF
|
||||
void SICSLogEnable(int flag);
|
||||
int KillCapture(SConnection * pCon);
|
||||
|
||||
|
1
simidx.h
1
simidx.h
@ -85,6 +85,7 @@ int SimIdxRun();
|
||||
* \param errCode pointer to an integer error code
|
||||
* \param error A text buffer to hold a description of the error
|
||||
* \param errLen The length of error
|
||||
*/
|
||||
void SimIdxGetError(int *errCode, char *error, int errLen);
|
||||
|
||||
/**
|
||||
|
@ -163,6 +163,8 @@ kookaburra: all
|
||||
make -C instrument/kookaburra
|
||||
dingo: all
|
||||
make -C instrument/dingo
|
||||
bilby: all
|
||||
emu: all
|
||||
|
||||
libansto.a: $(OBJ)
|
||||
rm -f libansto.a
|
||||
@ -170,10 +172,10 @@ libansto.a: $(OBJ)
|
||||
ranlib libansto.a
|
||||
|
||||
libhardsup:
|
||||
$(MAKE) -C hardsup/ INC_TCL8="$(INC_TCL8)"
|
||||
$(MAKE) -C hardsup/ INC_TCL8="$(INC_TCL8)" "CC=${CC}"
|
||||
|
||||
libsics:
|
||||
$(MAKE) -C .. -f site_ansto/Makefile_SICS INC_TCL8="$(INC_TCL8)" INC_HDF5="$(INC_HDF5)" all
|
||||
$(MAKE) -C .. -f site_ansto/Makefile_SICS INC_TCL8="$(INC_TCL8)" INC_HDF5="$(INC_HDF5)" "CC=${CC}" all
|
||||
|
||||
anstohm.o : anstohm.cpp
|
||||
$(CXX) -c anstohm.cpp $(CFLAGS) $(CXXFLAGS) -Wno-all
|
||||
|
@ -1,18 +1,18 @@
|
||||
/**
|
||||
* This is an adapter to a node under the control of the new
|
||||
* scriptcontext generic device model. This is a wrapper around
|
||||
* This is an adapter to a node under the control of the new
|
||||
* scriptcontext generic device model. This is a wrapper around
|
||||
* such a node which implements the drivable interface.
|
||||
*
|
||||
*
|
||||
* Some cooperation from the node is required: It has to provide
|
||||
* certain properties the value of which define scripts which
|
||||
* certain properties the value of which define scripts which
|
||||
* have to be called at various stages. These are:
|
||||
*
|
||||
*
|
||||
* checklimits, for limits checking
|
||||
* checkstatus, for evaluating progress
|
||||
* halt , for halting things
|
||||
*
|
||||
*
|
||||
* copyright: see file COPYRIGHT
|
||||
*
|
||||
*
|
||||
* Mark Koennecke, June 2008
|
||||
* --------------------------------------------------------------*/
|
||||
#include <sics.h>
|
||||
@ -24,16 +24,16 @@
|
||||
#include "scriptcontext.h"
|
||||
/*---------------------------------------------------------------*/
|
||||
typedef struct {
|
||||
pObjectDescriptor pDes;
|
||||
pIDrivable pDriv;
|
||||
pHdb write_node;
|
||||
pHdb read_node;
|
||||
SctController *c;
|
||||
pObjectDescriptor pDes;
|
||||
pIDrivable pDriv;
|
||||
pHdb write_node;
|
||||
pHdb read_node;
|
||||
SctController *c;
|
||||
}SctDrive, *pSctDrive;
|
||||
/*---------------------------------------------------------------*/
|
||||
static void *SCTDRIVGetInterface(void *data, int iD){
|
||||
pSctDrive self = NULL;
|
||||
|
||||
pSctDrive self = NULL;
|
||||
|
||||
self = (pSctDrive)data;
|
||||
if(self != NULL && iD == DRIVEID){
|
||||
if (self->write_node == NULL) return NULL;
|
||||
@ -48,51 +48,51 @@ static void *SCTDRIVGetInterface(void *data, int iD){
|
||||
go wrong. However, the return value of Halt is usually ignored!
|
||||
------------------------------------------------------------------*/
|
||||
static int SCTDRIVHalt(void *data) {
|
||||
pSctDrive self = NULL;
|
||||
pSctDrive self = NULL;
|
||||
char dummy[16];
|
||||
|
||||
|
||||
self = (pSctDrive)data;
|
||||
if (GetHdbProperty(self->write_node,"halt", dummy, sizeof dummy)) {
|
||||
SctQueueNode(self->c, self->write_node, HaltPRIO, "halt", NULL);
|
||||
} else if (GetHdbProperty(self->write_node, "status", dummy, sizeof dummy)) {
|
||||
SetHdbProperty(self->write_node, "status", "idle");
|
||||
}
|
||||
return OKOK;
|
||||
return OKOK;
|
||||
}
|
||||
/*----------------------------------------------------------------
|
||||
This routine can return either 1 or 0. 1 means the position can
|
||||
This routine can return either 1 or 0. 1 means the position can
|
||||
be reached, 0 NOT
|
||||
If 0, error shall contain up to errlen characters of information
|
||||
about which limit was violated
|
||||
------------------------------------------------------------------*/
|
||||
static int SCTDRIVCheckLimits(void *data, float val,
|
||||
char *error, int errlen){
|
||||
pSctDrive self = NULL;
|
||||
pSctDrive self = NULL;
|
||||
char script[1024];
|
||||
int status;
|
||||
Tcl_Interp *pTcl = NULL;
|
||||
char *result;
|
||||
|
||||
|
||||
self = (pSctDrive)data;
|
||||
snprintf(script,1024,"%f", val);
|
||||
SetHdbProperty(self->write_node,"target", script);
|
||||
if(GetHdbProperty(self->write_node,"checklimits",script,1024)){
|
||||
status = SctCallInContext(pServ->dummyCon, script,
|
||||
self->write_node, self->c, &result);
|
||||
if(SctVerbose(self->c)){
|
||||
SCPrintf(pServ->dummyCon, eWarning, "script %s called with result %s\n ",
|
||||
script, result);
|
||||
}
|
||||
if(status == 0){
|
||||
strncpy(error,result,errlen);
|
||||
return 0;
|
||||
}
|
||||
status = SctCallInContext(pServ->dummyCon, script,
|
||||
self->write_node, self->c, &result);
|
||||
if(SctVerbose(self->c)){
|
||||
SCPrintf(pServ->dummyCon, eWarning, "script %s called with result %s\n ",
|
||||
script, result);
|
||||
}
|
||||
if(status == 0){
|
||||
strncpy(error,result,errlen);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*----------------------------------------------------------------
|
||||
This routine can return 0 when a limit problem occurred
|
||||
OKOK when the motor was successfully started
|
||||
This routine can return 0 when a limit problem occurred
|
||||
OKOK when the motor was successfully started
|
||||
HWFault when a problem occured starting the device
|
||||
Possible errors shall be printed to pCon
|
||||
For real motors, this is supposed to try at least three times
|
||||
@ -100,19 +100,19 @@ static int SCTDRIVCheckLimits(void *data, float val,
|
||||
val is the value to drive the motor too
|
||||
------------------------------------------------------------------*/
|
||||
static long SCTDRIVSetValue(void *data, SConnection *pCon, float val){
|
||||
pSctDrive self = NULL;
|
||||
pSctDrive self = NULL;
|
||||
int status;
|
||||
hdbValue v;
|
||||
|
||||
|
||||
self = (pSctDrive)data;
|
||||
v.dataType = HIPFLOAT;
|
||||
v.v.doubleValue = (double)val;
|
||||
SetHdbProperty(self->write_node,"writestatus", "start");
|
||||
status = SetHipadabaPar(self->write_node, v, pCon);
|
||||
if(status == 1){
|
||||
return OKOK;
|
||||
return OKOK;
|
||||
} else {
|
||||
return HWFault;
|
||||
return HWFault;
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------
|
||||
@ -122,28 +122,28 @@ static long SCTDRIVSetValue(void *data, SConnection *pCon, float val){
|
||||
HWFault when a hardware problem ocurred
|
||||
HWPosFault when the hardware cannot reach a position
|
||||
Errors are duly to be printed to pCon
|
||||
For real motors CheckStatus again shall try hard to fix any
|
||||
issues with the motor
|
||||
For real motors CheckStatus again shall try hard to fix any
|
||||
issues with the motor
|
||||
------------------------------------------------------------------*/
|
||||
static int SCTDRIVCheckStatus(void *data, SConnection *pCon){
|
||||
pSctDrive self = NULL;
|
||||
pSctDrive self = NULL;
|
||||
char script[1024];
|
||||
int status;
|
||||
Tcl_Interp *pTcl = NULL;
|
||||
char *result;
|
||||
SConnection *con;
|
||||
|
||||
|
||||
self = (pSctDrive)data;
|
||||
|
||||
|
||||
/*
|
||||
* check if the write command has gone through
|
||||
*/
|
||||
if(GetHdbProperty(self->write_node,"writestatus", script,1024)){
|
||||
if(strcmp(script,"start") == 0){
|
||||
return HWBusy;
|
||||
}
|
||||
if(strcmp(script,"start") == 0){
|
||||
return HWBusy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* run the checkstatus script
|
||||
*/
|
||||
@ -155,16 +155,16 @@ static int SCTDRIVCheckStatus(void *data, SConnection *pCon){
|
||||
}
|
||||
result = script;
|
||||
} else {
|
||||
status = SctCallInContext(pCon,script, self->write_node,
|
||||
status = SctCallInContext(pCon,script, self->write_node,
|
||||
self->c, &result);
|
||||
if (status == 0) {
|
||||
SCPrintf(pCon,eError," script %s returned %s",
|
||||
script, result);
|
||||
SCPrintf(pCon,eError," script %s returned %s",
|
||||
script, result);
|
||||
return HWFault;
|
||||
}
|
||||
if(SctVerbose(self->c)){
|
||||
SCPrintf(pCon,eError," script %s returned %s",
|
||||
script, result);
|
||||
SCPrintf(pCon,eError," script %s returned %s",
|
||||
script, result);
|
||||
}
|
||||
}
|
||||
if(strstr(result,"busy") != NULL){
|
||||
@ -188,16 +188,16 @@ static int SCTDRIVCheckStatus(void *data, SConnection *pCon){
|
||||
On errors, -99999999.99 is returned and messages printed to pCon
|
||||
------------------------------------------------------------------*/
|
||||
static float SCTDRIVGetValue(void *data, SConnection *pCon){
|
||||
pSctDrive self = NULL;
|
||||
pSctDrive self = NULL;
|
||||
float val = -99999999.99;
|
||||
int status;
|
||||
char error[256];
|
||||
hdbValue v;
|
||||
|
||||
|
||||
self = (pSctDrive)data;
|
||||
if(GetHdbProperty(self->read_node,"geterror", error, 256)){
|
||||
SCWrite(pCon,error, eError);
|
||||
return val;
|
||||
SCWrite(pCon,error, eError);
|
||||
return val;
|
||||
}
|
||||
return (float)self->read_node->value.v.doubleValue;
|
||||
}
|
||||
@ -205,19 +205,19 @@ static float SCTDRIVGetValue(void *data, SConnection *pCon){
|
||||
returns NULL on failure, a new datastructure else
|
||||
------------------------------------------------------------------*/
|
||||
static pSctDrive SCTDRIVMakeObject(){
|
||||
pSctDrive self = NULL;
|
||||
pSctDrive self = NULL;
|
||||
|
||||
self = calloc(sizeof(SctDrive),1);
|
||||
if(self == NULL){
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
self->pDes = CreateDescriptor("SctDriveAdapter");
|
||||
self->pDriv = CreateDrivableInterface();
|
||||
if(self->pDes == NULL || self->pDriv == NULL){
|
||||
free(self);
|
||||
return NULL;
|
||||
free(self);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
self->pDes->GetInterface = SCTDRIVGetInterface;
|
||||
self->pDriv->Halt = SCTDRIVHalt;
|
||||
self->pDriv->CheckLimits = SCTDRIVCheckLimits;
|
||||
@ -230,36 +230,36 @@ static pSctDrive SCTDRIVMakeObject(){
|
||||
/*-----------------------------------------------------------------*/
|
||||
static int SctDriveCommand(SConnection *pCon, SicsInterp *sics, void *object,
|
||||
int argc, char *argv[]) {
|
||||
pSctDrive self = (pSctDrive)object;
|
||||
float val;
|
||||
|
||||
assert(self != NULL);
|
||||
|
||||
if (self->write_node == NULL) {
|
||||
SCWrite(pCon, "ERROR: defunct object", eError);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* only action: print value
|
||||
*/
|
||||
val = self->pDriv->GetValue(self,pCon);
|
||||
SCPrintf(pCon,eValue,"%s = %f", argv[0], val);
|
||||
return 1;
|
||||
pSctDrive self = (pSctDrive)object;
|
||||
float val;
|
||||
|
||||
assert(self != NULL);
|
||||
|
||||
if (self->write_node == NULL) {
|
||||
SCWrite(pCon, "ERROR: defunct object", eError);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* only action: print value
|
||||
*/
|
||||
val = self->pDriv->GetValue(self,pCon);
|
||||
SCPrintf(pCon,eValue,"%s = %f", argv[0], val);
|
||||
return 1;
|
||||
}
|
||||
/*----------------------------------------------------------------*/
|
||||
static void SctDriveKill(void *data){
|
||||
pSctDrive self = (pSctDrive)data;
|
||||
|
||||
if(self == NULL){
|
||||
return;
|
||||
}
|
||||
if(self->pDriv != NULL){
|
||||
free(self->pDriv);
|
||||
}
|
||||
if(self->pDes != NULL){
|
||||
DeleteDescriptor(self->pDes);
|
||||
}
|
||||
free(self);
|
||||
pSctDrive self = (pSctDrive)data;
|
||||
|
||||
if(self == NULL){
|
||||
return;
|
||||
}
|
||||
if(self->pDriv != NULL){
|
||||
free(self->pDriv);
|
||||
}
|
||||
if(self->pDes != NULL){
|
||||
DeleteDescriptor(self->pDes);
|
||||
}
|
||||
free(self);
|
||||
}
|
||||
/*----------------------------------------------------------------*/
|
||||
static hdbCallbackReturn SctDummyCallback(Hdb *node, void *userData,
|
||||
@ -274,44 +274,44 @@ static void SctDriveDeleteNode(void *data) {
|
||||
/*---------------------------------------------------------------*/
|
||||
int ANSTO_SctMakeDriveAdapter(SConnection *pCon, SicsInterp *pSics, void *object,
|
||||
int argc, char *argv[]) {
|
||||
pSctDrive pNew = NULL;
|
||||
pSICSOBJ obj = NULL;
|
||||
pSctDrive pNew = NULL;
|
||||
pSICSOBJ obj = NULL;
|
||||
hdbCallback *cb;
|
||||
|
||||
pNew = SCTDRIVMakeObject();
|
||||
if(pNew == NULL){
|
||||
SCWrite(pCon,"ERROR: out of memory in ANSTO_SctMakeDriveAdapter",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(argc < 4){
|
||||
SCWrite(pCon,"ERROR: not enough arguments for ANSTO_SctMakeDriveAdapter", eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pNew->write_node = FindHdbNode(NULL,argv[2], pCon);
|
||||
pNew->read_node = FindHdbNode(NULL,argv[3], pCon);
|
||||
obj = FindCommandData(pSics,argv[4], "SctController");
|
||||
if(pNew->write_node == NULL || obj == NULL){
|
||||
SCWrite(pCon,"ERROR: node or controller not found", eError);
|
||||
SctDriveKill(pNew);
|
||||
return 0;
|
||||
}
|
||||
pNew->c =(SctController *)obj->pPrivate;
|
||||
|
||||
|
||||
if(argc < 4){
|
||||
SCWrite(pCon,"ERROR: not enough arguments for ANSTO_SctMakeDriveAdapter", eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pNew = SCTDRIVMakeObject();
|
||||
if(pNew == NULL){
|
||||
SCWrite(pCon,"ERROR: out of memory in ANSTO_SctMakeDriveAdapter",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
pNew->write_node = FindHdbNode(NULL,argv[2], pCon);
|
||||
pNew->read_node = FindHdbNode(NULL,argv[3], pCon);
|
||||
obj = FindCommandData(pSics,argv[4], "SctController");
|
||||
if(pNew->write_node == NULL || obj == NULL){
|
||||
SCWrite(pCon,"ERROR: node or controller not found", eError);
|
||||
SctDriveKill(pNew);
|
||||
return 0;
|
||||
}
|
||||
pNew->c =(SctController *)obj->pPrivate;
|
||||
|
||||
if (strcasecmp(argv[0],"dynsctdrive") == 0) {
|
||||
/* make object dynamic by defining a descriptor command */
|
||||
SetDescriptorKey(pNew->pDes, "creationCommand", "0");
|
||||
}
|
||||
AddCommand(pSics, argv[1], SctDriveCommand, SctDriveKill, pNew);
|
||||
SetHdbProperty(pNew->write_node,"sicsdev",argv[1]);
|
||||
|
||||
AddCommand(pSics, argv[1], SctDriveCommand, SctDriveKill, pNew);
|
||||
SetHdbProperty(pNew->write_node,"sicsdev",argv[1]);
|
||||
|
||||
cb = MakeHipadabaCallback(SctDummyCallback, pNew, SctDriveDeleteNode);
|
||||
assert(cb);
|
||||
AppendHipadabaCallback(pNew->write_node, cb);
|
||||
|
||||
return 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------*/
|
||||
|
||||
|
@ -397,27 +397,29 @@ static int TclSetPar(void *self, SConnection * pCon, char *name,
|
||||
if (result == NULL) {
|
||||
pDriv->errorCode = NOTCLRESULT;
|
||||
free(tclCommand);
|
||||
free(tclCommandPara);;
|
||||
free(tclCommandPara);
|
||||
return HWFault;
|
||||
}
|
||||
if (status != TCL_OK) {
|
||||
pDriv->errorCode = TCLERROR;
|
||||
strncpy(pDriv->tclError, result, 1023);
|
||||
free(tclCommand);
|
||||
free(tclCommandPara);;
|
||||
free(tclCommandPara);
|
||||
return HWFault;
|
||||
} else {
|
||||
snprintf(pBuffer, 511, "%s.%s = %s", pDriv->motName, name, result);
|
||||
SCWrite(pCon, pBuffer, eValue);
|
||||
}
|
||||
free(tclCommand);
|
||||
free(tclCommandPara);;
|
||||
free(tclCommandPara);
|
||||
return OKOK;
|
||||
} else {
|
||||
pDriv->errorCode = PARANOTFOUND;
|
||||
free(tclCommand);
|
||||
return 0;
|
||||
}
|
||||
|
||||
free(tclCommand);
|
||||
return OKOK;
|
||||
}
|
||||
}
|
||||
|
@ -422,6 +422,7 @@ void sock_accept(int n)
|
||||
fdv[num_fds].device = fdv[n].device;
|
||||
fdv[num_fds].line_len = 0;
|
||||
fdv[num_fds].state = 0;
|
||||
fdv[num_fds].match = 0;
|
||||
fds[num_fds].fd = sock_n;
|
||||
fds[num_fds].events = POLLIN;
|
||||
++num_fds;
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*--------------------------------------------------------------
|
||||
This is a driver for the newer Astrium == Dornier chopper
|
||||
This is a driver for the newer Astrium == Dornier chopper
|
||||
systems which use a TCP/IP server for communication.
|
||||
This driver has to take care of some ugliness:
|
||||
- As of december 2005, the communication is in unicode!
|
||||
To go from ASCII to unicode and back one has to
|
||||
To go from ASCII to unicode and back one has to
|
||||
add a 0x00 before each character or to remove it.
|
||||
- The controller is slow in responding and the controller
|
||||
must be watched in the environment monitor. This is taken
|
||||
@ -22,7 +22,7 @@
|
||||
#include <rs232controller.h>
|
||||
#include <codri.h>
|
||||
#include <stptok.h>
|
||||
#include <commandlog.h>
|
||||
#include <commandlog.h>
|
||||
#include <errno.h>
|
||||
/*========================================================================
|
||||
Our private data structure
|
||||
@ -62,7 +62,7 @@ Error codes:
|
||||
#define BADVALUE -8310
|
||||
|
||||
extern char *trim(char *str);
|
||||
#define ABS(x) (x < 0 ? -(x) : (x))
|
||||
#define ABS(x) (x < 0 ? -(x) : (x))
|
||||
|
||||
#define SPEEDTOL 2
|
||||
#define PHASETOL 0.2
|
||||
@ -76,15 +76,15 @@ static int asciiToUnicode(char *input, char **output){
|
||||
len = strlen(input);
|
||||
result = (char *)malloc(2*len*sizeof(char));
|
||||
if(result == NULL){
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
memset(result,0,2*len*sizeof(char));
|
||||
for(i = 0; i < len; i++){
|
||||
result[i*2] = input[i];
|
||||
result[i*2] = input[i];
|
||||
}
|
||||
*output = result;
|
||||
*output = result;
|
||||
return 2*len;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*-------------------------------------------------------------------*/
|
||||
#if 0
|
||||
@ -96,11 +96,11 @@ static int unicodeToAscii(char *input, int len, char **output){
|
||||
|
||||
result = (char *)malloc((alen+1)*sizeof(char));
|
||||
if(result == NULL){
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
memset(result,0,(alen+1)*sizeof(char));
|
||||
for(i = 0; i < alen; i++){
|
||||
result[i] = input[i*2];
|
||||
result[i] = input[i*2];
|
||||
}
|
||||
*output = result;
|
||||
return alen;
|
||||
@ -108,7 +108,7 @@ static int unicodeToAscii(char *input, int len, char **output){
|
||||
#endif
|
||||
/*----------------------------------------------------------------*/
|
||||
static int tcpDoChoSend(pTcpDoCho self, char *command, int choNum,
|
||||
char *value){
|
||||
char *value){
|
||||
char buffer[1024];
|
||||
int sendlen, status;
|
||||
|
||||
@ -117,22 +117,22 @@ static int tcpDoChoSend(pTcpDoCho self, char *command, int choNum,
|
||||
*/
|
||||
self->lastError = 0;
|
||||
if(choNum < 0){
|
||||
snprintf(buffer,1023,"#SOS#%s \r\n",command);
|
||||
snprintf(buffer,1023,"#SOS#%s \r\n",command);
|
||||
} else if(value != NULL){
|
||||
snprintf(buffer,1023,"#SOS#%s%1.1d: %s\r\n",command, choNum,
|
||||
value);
|
||||
snprintf(buffer,1023,"#SOS#%s%1.1d: %s\r\n",command, choNum,
|
||||
value);
|
||||
} else {
|
||||
snprintf(buffer,1023,"#SOS#%s%1.1d:\r\n",command, choNum);
|
||||
snprintf(buffer,1023,"#SOS#%s%1.1d:\r\n",command, choNum);
|
||||
}
|
||||
sendlen = strlen(buffer);
|
||||
if(sendlen == 0){
|
||||
self->lastError = BADCONVERSION;
|
||||
return 0;
|
||||
self->lastError = BADCONVERSION;
|
||||
return 0;
|
||||
}
|
||||
status = send(self->controller->pSock->sockid,buffer,sendlen,0);
|
||||
if(status < 0){
|
||||
self->lastError = BADWRITE;
|
||||
return 0;
|
||||
self->lastError = BADWRITE;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -147,14 +147,14 @@ static int statusComplete(char *statusMessage){
|
||||
*/
|
||||
pPtr = strstr(statusMessage,"TIME");
|
||||
if(pPtr != NULL){
|
||||
pPtr = strstr(pPtr+6,"#");
|
||||
if(pPtr != NULL){
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
pPtr = strstr(pPtr+6,"#");
|
||||
if(pPtr != NULL){
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------*/
|
||||
@ -164,7 +164,7 @@ static int readChopperNum(char *entry){
|
||||
|
||||
pPtr = strstr(entry,"CH");
|
||||
if(pPtr == NULL){
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
sscanf(pPtr+3,"%d",&num);
|
||||
return num;
|
||||
@ -194,27 +194,27 @@ static void addEntry(pTcpDoCho self, int choNum, char *entry){
|
||||
StringDictAddPair(self->parameters,name,trim(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------*/
|
||||
static int parseStatus(pTcpDoCho self, char *statusMessage){
|
||||
int choNum;
|
||||
char entry[80], *pPtr;
|
||||
|
||||
|
||||
pPtr = statusMessage;
|
||||
|
||||
/* skip over SOS */
|
||||
pPtr = stptok(pPtr,entry,79,"#");
|
||||
pPtr = stptok(pPtr,entry,79,"#");
|
||||
pPtr = stptok(pPtr,entry,79,"#");
|
||||
|
||||
|
||||
choNum = readChopperNum(entry);
|
||||
if(choNum < 0){
|
||||
self->lastError = BADRESPONSE;
|
||||
return 0;
|
||||
self->lastError = BADRESPONSE;
|
||||
return 0;
|
||||
}
|
||||
while((pPtr = stptok(pPtr,entry,79,"#")) != NULL){
|
||||
addEntry(self,choNum,entry);
|
||||
memset(entry,0,80);
|
||||
addEntry(self,choNum,entry);
|
||||
memset(entry,0,80);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -229,51 +229,51 @@ static int tcpDoChoReceive(pTcpDoCho self){
|
||||
bytesRead = 0;
|
||||
memset(buffer,0,1024*sizeof(char));
|
||||
while(time(NULL) < endTime){
|
||||
if(availableRS232(self->controller)){
|
||||
bytesRead += recv(self->controller->pSock->sockid,buffer+bufferStart,
|
||||
1024 - bytesRead,0);
|
||||
if(bytesRead < 0){
|
||||
self->lastError = BADREAD;
|
||||
return 0;
|
||||
}
|
||||
if(availableRS232(self->controller)){
|
||||
bytesRead += recv(self->controller->pSock->sockid,buffer+bufferStart,
|
||||
1024 - bytesRead,0);
|
||||
if(bytesRead < 0){
|
||||
self->lastError = BADREAD;
|
||||
return 0;
|
||||
}
|
||||
if(strstr(buffer,"State") != NULL){
|
||||
if(statusComplete(buffer) == 0) {
|
||||
continue;
|
||||
} else {
|
||||
status = parseStatus(self,buffer);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
if(strstr(buffer,"ACCEPT") != NULL){
|
||||
return 1;
|
||||
if(statusComplete(buffer) == 0) {
|
||||
continue;
|
||||
} else {
|
||||
status = parseStatus(self,buffer);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
if(strstr(buffer,"ACCEPT") != NULL){
|
||||
return 1;
|
||||
} else if(strstr(buffer,"NCCEPT") != NULL){
|
||||
self->lastError = FAILEDCOMMAND;
|
||||
return 0;
|
||||
self->lastError = FAILEDCOMMAND;
|
||||
return 0;
|
||||
} else {
|
||||
self->lastError = BADRESPONSE;
|
||||
return 0;
|
||||
}
|
||||
self->lastError = BADRESPONSE;
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
SicsWait(1);
|
||||
}
|
||||
SicsWait(1);
|
||||
}
|
||||
}
|
||||
self->lastError = TIMEOUT;
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------*/
|
||||
static int tcpDoChoCommand(pTcpDoCho self, char *command, int choNum,
|
||||
char *value){
|
||||
char *value){
|
||||
int status;
|
||||
|
||||
|
||||
status = tcpDoChoSend(self,command,choNum,value);
|
||||
if(status == 0){
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
return tcpDoChoReceive(self);
|
||||
}
|
||||
/*---------------------------------------------------------------*/
|
||||
/* TODO Check for response on authentication
|
||||
* authentication succeeded: #SES#Hello
|
||||
* authentication succeeded: #SES#Hello
|
||||
* authentication failed: #SES#You are not a valid user, try again!
|
||||
* Make sure that ch2,3,4 are set to MW on init
|
||||
*/
|
||||
@ -283,8 +283,8 @@ static int TcpDoChoConnect(pTcpDoCho self){
|
||||
|
||||
status = initRS232(self->controller);
|
||||
if(status != 1){
|
||||
self->lastError = status;
|
||||
return 0;
|
||||
self->lastError = status;
|
||||
return 0;
|
||||
}
|
||||
setRS232Timeout(self->controller,5);
|
||||
|
||||
@ -297,36 +297,36 @@ static int TcpDoChoConnect(pTcpDoCho self){
|
||||
snprintf(buffer,255,"user:%s\r\n",self->user);
|
||||
sendLen = strlen(buffer);
|
||||
if(sendLen == 0){
|
||||
self->lastError = BADCONVERSION;
|
||||
self->lastError = BADCONVERSION;
|
||||
return 0;
|
||||
}
|
||||
status = send(self->controller->pSock->sockid,buffer,sendLen,0);
|
||||
if(status < 0){
|
||||
self->lastError = BADSEND;
|
||||
return 0;
|
||||
}
|
||||
readLen = 255;
|
||||
readRS232(self->controller,(void *)buffer,&readLen);
|
||||
|
||||
/*
|
||||
password
|
||||
*/
|
||||
snprintf(buffer,255,"password:%s\r\n",self->pword);
|
||||
sendLen = strlen(buffer);
|
||||
if(sendLen == 0){
|
||||
self->lastError = BADCONVERSION;
|
||||
self->lastError = BADSEND;
|
||||
return 0;
|
||||
}
|
||||
status = send(self->controller->pSock->sockid,buffer,sendLen,0);
|
||||
if(status < 0){
|
||||
self->lastError = BADSEND;
|
||||
return 0;
|
||||
}
|
||||
readLen = 255;
|
||||
readRS232(self->controller,(void *)buffer,&readLen);
|
||||
|
||||
/*
|
||||
TODO: responses should be checked to test for a valid login.
|
||||
password
|
||||
*/
|
||||
snprintf(buffer,255,"password:%s\r\n",self->pword);
|
||||
sendLen = strlen(buffer);
|
||||
if(sendLen == 0){
|
||||
self->lastError = BADCONVERSION;
|
||||
return 0;
|
||||
}
|
||||
status = send(self->controller->pSock->sockid,buffer,sendLen,0);
|
||||
if(status < 0){
|
||||
self->lastError = BADSEND;
|
||||
return 0;
|
||||
}
|
||||
readLen = 255;
|
||||
readRS232(self->controller,(void *)buffer,&readLen);
|
||||
|
||||
/*
|
||||
TODO: responses should be checked to test for a valid login.
|
||||
I do not know at this time how the controller reacts upon a
|
||||
bad login.
|
||||
*/
|
||||
@ -348,32 +348,32 @@ static int TcpChopperTask(void *pData){
|
||||
assert(pPriv);
|
||||
|
||||
if(pPriv->stop == 1){
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if(time(NULL) > pPriv->nextRefresh){
|
||||
if(pPriv->lastError != 0){
|
||||
self->GetError(self,&code,buffer,79);
|
||||
snprintf(error,511,"WARNING: chopper tries to fix: %s",buffer);
|
||||
WriteToCommandLog("Chopper-task:>>", error);
|
||||
if(pPriv->lastError != 0){
|
||||
self->GetError(self,&code,buffer,79);
|
||||
snprintf(error,511,"WARNING: chopper tries to fix: %s",buffer);
|
||||
WriteToCommandLog("Chopper-task:>>", error);
|
||||
status = self->TryFixIt(self,code);
|
||||
if(status == CHFAIL){
|
||||
pPriv->nextRefresh = time(NULL) + pPriv->iRefreshIntervall;
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
pPriv->busy = 1;
|
||||
for(i = 0; i < pPriv->numChoppers; i++){
|
||||
status = tcpDoChoCommand(pPriv,"STATE ", i+1,NULL);
|
||||
if(status != 1){
|
||||
/*
|
||||
force error correction
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
if(status == CHFAIL){
|
||||
pPriv->nextRefresh = time(NULL) + pPriv->iRefreshIntervall;
|
||||
return 1;
|
||||
}
|
||||
pPriv->nextRefresh = time(NULL) + pPriv->iRefreshIntervall;
|
||||
pPriv->busy = 0;
|
||||
} else {
|
||||
pPriv->busy = 1;
|
||||
for(i = 0; i < pPriv->numChoppers; i++){
|
||||
status = tcpDoChoCommand(pPriv,"STATE ", i+1,NULL);
|
||||
if(status != 1){
|
||||
/*
|
||||
force error correction
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
pPriv->nextRefresh = time(NULL) + pPriv->iRefreshIntervall;
|
||||
pPriv->busy = 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
@ -388,13 +388,13 @@ static int TcpDoChoKill(pCodri self){
|
||||
return 1;
|
||||
|
||||
if(pPriv->controller != NULL){
|
||||
KillRS232(pPriv->controller);
|
||||
KillRS232(pPriv->controller);
|
||||
}
|
||||
if(pPriv->parameters != NULL){
|
||||
DeleteStringDict(pPriv->parameters);
|
||||
DeleteStringDict(pPriv->parameters);
|
||||
}
|
||||
if(pPriv->config != NULL){
|
||||
free(pPriv->config);
|
||||
free(pPriv->config);
|
||||
}
|
||||
free(pPriv);
|
||||
return 1;
|
||||
@ -411,11 +411,11 @@ static int TcpDoChoConfigure(pCodri pDriv){
|
||||
assert(self != NULL);
|
||||
|
||||
if(self->config != NULL){
|
||||
pPtr = self->config;
|
||||
while( (pPtr = stptok(pPtr,command,79,"\n")) != NULL){
|
||||
status = tcpDoChoCommand(self,command,-1,NULL);
|
||||
if(status != 1){
|
||||
return 0;
|
||||
pPtr = self->config;
|
||||
while( (pPtr = stptok(pPtr,command,79,"\n")) != NULL){
|
||||
status = tcpDoChoCommand(self,command,-1,NULL);
|
||||
if(status != 1){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -429,32 +429,32 @@ static int TcpDoChoInit(pCodri pDriv){
|
||||
assert(pDriv != NULL);
|
||||
self = (pTcpDoCho)pDriv->pPrivate;
|
||||
assert(self != NULL);
|
||||
|
||||
|
||||
self->lastError = 0;
|
||||
self->stop = 0;
|
||||
self->nextRefresh = 0;
|
||||
|
||||
|
||||
status = TcpDoChoConnect(self);
|
||||
if(status != 1){
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
status = TcpDoChoConfigure(pDriv);
|
||||
if(status != 1){
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
#if 0
|
||||
/* start the update task */
|
||||
if(self->lTask == 0){
|
||||
self->lTask = TaskRegister(pServ->pTasker,
|
||||
TcpChopperTask,
|
||||
NULL,
|
||||
NULL,
|
||||
pDriv,
|
||||
1);
|
||||
self->lTask = TaskRegister(pServ->pTasker,
|
||||
TcpChopperTask,
|
||||
NULL,
|
||||
NULL,
|
||||
pDriv,
|
||||
1);
|
||||
}
|
||||
#endif
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
/*-------------------------------------------------------------------*/
|
||||
static void waitForBusy(pTcpDoCho self){
|
||||
@ -462,11 +462,11 @@ static void waitForBusy(pTcpDoCho self){
|
||||
|
||||
endTime = time(NULL) + 10 *60; /* max 10 min */
|
||||
while(time(NULL) < endTime){
|
||||
if(self->busy == 1){
|
||||
SicsWait(3);
|
||||
if(self->busy == 1){
|
||||
SicsWait(3);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
WriteToCommandLog("Chopper-task>> ","WARNING: timeout on busy flag, flag forced");
|
||||
self->busy = 0;
|
||||
@ -481,8 +481,8 @@ static int TcpDoChoClose(pCodri pDriv){
|
||||
|
||||
self->stop = 1;
|
||||
if(self->controller != NULL){
|
||||
KillRS232(self->controller);
|
||||
self->controller = NULL;
|
||||
KillRS232(self->controller);
|
||||
self->controller = NULL;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -492,20 +492,20 @@ static int dissectName(char *name, char par[80], int *num){
|
||||
|
||||
pPtr = strrchr(name,(int)'_');
|
||||
if(pPtr == NULL){
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
memset(par,0,80*sizeof(char));
|
||||
strncpy(par,name,pPtr - name);
|
||||
if(sscanf(pPtr+1,"%d",num) != 1){
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/* Use this to coerce speed and phase for choppers 2 and 3
|
||||
* into the same coordinate convention as chopper 1.
|
||||
* into the same coordinate convention as chopper 1.
|
||||
* errno = 0 if successful
|
||||
* on failure errorcode is set in lastError
|
||||
*/
|
||||
*/
|
||||
#if 0
|
||||
static int fixDirection(pTcpDoCho self, int choNum, char *value, int value_len) {
|
||||
double dValue;
|
||||
@ -523,52 +523,52 @@ static int fixDirection(pTcpDoCho self, int choNum, char *value, int value_len)
|
||||
#endif
|
||||
/*----------------------------------------------------------------------*/
|
||||
static int TcpDoChoSetPar2(pCodri pDriv, char *parname, char *value){
|
||||
|
||||
|
||||
pTcpDoCho self = NULL;
|
||||
int status, choNum;
|
||||
char par[80], buffer[80], state[80];
|
||||
char par[80], buffer[80], state[80];
|
||||
|
||||
assert(pDriv != NULL);
|
||||
self = (pTcpDoCho)pDriv->pPrivate;
|
||||
assert(self != NULL);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
force status requests right after setting something in order
|
||||
to make the stored status represent the new target values
|
||||
*/
|
||||
if(dissectName(parname,par,&choNum)){
|
||||
/*
|
||||
check for emergency stop
|
||||
*/
|
||||
snprintf(buffer,79,"State_%1.1d",choNum);
|
||||
memset(state,0,80*sizeof(char));
|
||||
StringDictGet(self->parameters,buffer,state,79);
|
||||
if(strstr(state,"E-Stop") != NULL){
|
||||
self->lastError = ESTOP;
|
||||
return 0;
|
||||
/*
|
||||
check for emergency stop
|
||||
*/
|
||||
snprintf(buffer,79,"State_%1.1d",choNum);
|
||||
memset(state,0,80*sizeof(char));
|
||||
StringDictGet(self->parameters,buffer,state,79);
|
||||
if(strstr(state,"E-Stop") != NULL){
|
||||
self->lastError = ESTOP;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(strcmp(par,"speed") == 0){
|
||||
waitForBusy(self);
|
||||
status = tcpDoChoCommand(self,"SPEED ",choNum,trim(value));
|
||||
tcpDoChoCommand(self,"STATE ",choNum,NULL);
|
||||
if(status != 1){
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
} else if(strcmp(par,"phase") == 0){
|
||||
waitForBusy(self);
|
||||
if(strcmp(par,"speed") == 0){
|
||||
waitForBusy(self);
|
||||
status = tcpDoChoCommand(self,"SPEED ",choNum,trim(value));
|
||||
tcpDoChoCommand(self,"STATE ",choNum,NULL);
|
||||
if(status != 1){
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
} else if(strcmp(par,"phase") == 0){
|
||||
waitForBusy(self);
|
||||
if (errno != 0)
|
||||
return 0;
|
||||
status = tcpDoChoCommand(self,"PHASE ",choNum,trim(value));
|
||||
tcpDoChoCommand(self,"STATE ",choNum,NULL);
|
||||
if(status != 1){
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
status = tcpDoChoCommand(self,"PHASE ",choNum,trim(value));
|
||||
tcpDoChoCommand(self,"STATE ",choNum,NULL);
|
||||
if(status != 1){
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
self->lastError = UNDRIVABLE;
|
||||
@ -576,7 +576,7 @@ static int TcpDoChoSetPar2(pCodri pDriv, char *parname, char *value){
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static int TcpDoChoHalt(pCodri pDriv){
|
||||
|
||||
|
||||
pTcpDoCho self = NULL;
|
||||
|
||||
assert(pDriv != NULL);
|
||||
@ -589,7 +589,7 @@ static int TcpDoChoHalt(pCodri pDriv){
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static int TcpDoChoSetPar(pCodri pDriv, char *parname, float fValue){
|
||||
|
||||
|
||||
pTcpDoCho self = NULL;
|
||||
int choNum;
|
||||
char value[80];
|
||||
@ -601,26 +601,26 @@ static int TcpDoChoSetPar(pCodri pDriv, char *parname, float fValue){
|
||||
assert(self != NULL);
|
||||
|
||||
if(dissectName(parname,par,&choNum)){
|
||||
if(strcmp(par,"speed") == 0){
|
||||
snprintf(value,79,"%5.1f", fValue);
|
||||
return TcpDoChoSetPar2(pDriv,parname,value);
|
||||
} else if(strcmp(par,"phase") == 0){
|
||||
snprintf(value,79,"%6.2f",fValue);
|
||||
return TcpDoChoSetPar2(pDriv,parname,value);
|
||||
if(strcmp(par,"speed") == 0){
|
||||
snprintf(value,79,"%5.1f", fValue);
|
||||
return TcpDoChoSetPar2(pDriv,parname,value);
|
||||
} else if(strcmp(par,"phase") == 0){
|
||||
snprintf(value,79,"%6.2f",fValue);
|
||||
return TcpDoChoSetPar2(pDriv,parname,value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(strcmp(parname,"updateintervall") == 0){
|
||||
sprintf(value,"%d",(int)fValue);
|
||||
StringDictUpdate(self->parameters,"updateintervall",value);
|
||||
self->iRefreshIntervall = (int)fValue;
|
||||
return 1;
|
||||
} else {
|
||||
snprintf(value,79,"%f",fValue);
|
||||
return TcpDoChoSetPar2(pDriv,parname,value);
|
||||
snprintf(value,79,"%f",fValue);
|
||||
return TcpDoChoSetPar2(pDriv,parname,value);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------*/
|
||||
static int TcpDoChoGetPar(pCodri pDriv, char *parname,
|
||||
static int TcpDoChoGetPar(pCodri pDriv, char *parname,
|
||||
char *pBuffer, int iBuflen){
|
||||
pTcpDoCho self = NULL;
|
||||
int status = 0, choNum, i, j, ready;
|
||||
@ -744,12 +744,12 @@ static int TcpDoChoCheckPar(pCodri pDriv, char *parname){
|
||||
check for flags first
|
||||
*/
|
||||
if(self->busy){
|
||||
return HWBusy;
|
||||
return HWBusy;
|
||||
}
|
||||
if(self->lastError != 0) {
|
||||
return HWFault;
|
||||
return HWFault;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
updateintervall is always Idle
|
||||
*/
|
||||
@ -764,38 +764,38 @@ static int TcpDoChoCheckPar(pCodri pDriv, char *parname){
|
||||
memset(state,0,80*sizeof(char));
|
||||
StringDictGet(self->parameters,buffer,state,79);
|
||||
if(strstr(state,"E-Stop") != NULL){
|
||||
self->lastError = HWFault;
|
||||
return 0;
|
||||
self->lastError = HWFault;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
memset(par,0,80);
|
||||
dissectName(parname,par,&choNum);
|
||||
if(strcmp(par,"speed") == 0){
|
||||
snprintf(buffer,79,"RSPEED_%1.1d", choNum);
|
||||
StringDictGet(self->parameters,buffer,csoll,79);
|
||||
sscanf(csoll,"%f",&soll);
|
||||
StringDictGet(self->parameters,buffer,csoll,79);
|
||||
sscanf(csoll,"%f",&soll);
|
||||
snprintf(buffer,79,"ASPEED_%1.1d", choNum);
|
||||
StringDictGet(self->parameters,buffer,value,79);
|
||||
sscanf(value,"%f",&val);
|
||||
delta = ABS(soll - val);
|
||||
if(delta > SPEEDTOL){
|
||||
return HWBusy;
|
||||
} else {
|
||||
return HWIdle;
|
||||
}
|
||||
StringDictGet(self->parameters,buffer,value,79);
|
||||
sscanf(value,"%f",&val);
|
||||
delta = ABS(soll - val);
|
||||
if(delta > SPEEDTOL){
|
||||
return HWBusy;
|
||||
} else {
|
||||
return HWIdle;
|
||||
}
|
||||
} else if(strcmp(par,"phase") == 0){
|
||||
snprintf(buffer,79,"RPHASE_%1.1d", choNum);
|
||||
StringDictGet(self->parameters,buffer,csoll,79);
|
||||
sscanf(value,"%f",&soll);
|
||||
StringDictGet(self->parameters,buffer,csoll,79);
|
||||
sscanf(value,"%f",&soll);
|
||||
snprintf(buffer,79,"APHASE_%1.1d", choNum);
|
||||
StringDictGet(self->parameters,buffer,value,79);
|
||||
sscanf(value,"%f",&val);
|
||||
delta = ABS(soll - val);
|
||||
if(delta > PHASETOL){
|
||||
return HWBusy;
|
||||
} else {
|
||||
return HWIdle;
|
||||
}
|
||||
StringDictGet(self->parameters,buffer,value,79);
|
||||
sscanf(value,"%f",&val);
|
||||
delta = ABS(soll - val);
|
||||
if(delta > PHASETOL){
|
||||
return HWBusy;
|
||||
} else {
|
||||
return HWIdle;
|
||||
}
|
||||
}
|
||||
self->lastError = BADPAR;
|
||||
return HWFault;
|
||||
@ -810,36 +810,36 @@ static int TcpDoChoError(pCodri pDriv, int *iCode, char *pError, int iLen){
|
||||
|
||||
*iCode = self->lastError;
|
||||
switch(self->lastError){
|
||||
case WRONGMODE:
|
||||
strncpy(pError,"Chopper in wrong mode",iLen);
|
||||
break;
|
||||
case WRONGMODE:
|
||||
strncpy(pError,"Chopper in wrong mode",iLen);
|
||||
break;
|
||||
case BADCONVERSION:
|
||||
strncpy(pError,"Bad ASCII to unicode conversion",iLen);
|
||||
strncpy(pError,"Bad ASCII to unicode conversion",iLen);
|
||||
break;
|
||||
case FAILEDCOMMAND:
|
||||
strncpy(pError,"Command not accepted",iLen);
|
||||
strncpy(pError,"Command not accepted",iLen);
|
||||
break;
|
||||
case BADWRITE:
|
||||
strncpy(pError,"Failed to write to chopper controller",iLen);
|
||||
strncpy(pError,"Failed to write to chopper controller",iLen);
|
||||
break;
|
||||
case BADRESPONSE:
|
||||
strncpy(pError,"Chopper controller send invalid command",iLen);
|
||||
strncpy(pError,"Chopper controller send invalid command",iLen);
|
||||
break;
|
||||
case UNDRIVABLE:
|
||||
strncpy(pError,"Parameter cannot be changed",iLen);
|
||||
strncpy(pError,"Parameter cannot be changed",iLen);
|
||||
break;
|
||||
case BADPAR:
|
||||
strncpy(pError,"No such parameter",iLen);
|
||||
strncpy(pError,"No such parameter",iLen);
|
||||
break;
|
||||
case BADVALUE:
|
||||
strncpy(pError,"Invalid parameter value",iLen);
|
||||
break;
|
||||
case ESTOP:
|
||||
strncpy(pError,"Emergency stop is engaged",iLen);
|
||||
case ESTOP:
|
||||
strncpy(pError,"Emergency stop is engaged",iLen);
|
||||
break;
|
||||
default:
|
||||
getRS232Error(self->lastError,pError,iLen);
|
||||
break;
|
||||
default:
|
||||
getRS232Error(self->lastError,pError,iLen);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -847,8 +847,8 @@ static int TcpDoChoError(pCodri pDriv, int *iCode, char *pError, int iLen){
|
||||
static int TcpDoChoFix(pCodri pDriv, int iCode){
|
||||
pTcpDoCho self = NULL;
|
||||
int status = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
assert(pDriv != NULL);
|
||||
self = (pTcpDoCho)pDriv->pPrivate;
|
||||
@ -856,26 +856,26 @@ static int TcpDoChoFix(pCodri pDriv, int iCode){
|
||||
|
||||
self->lastError = 0;
|
||||
switch(iCode){
|
||||
case BADCONVERSION:
|
||||
case BADCONVERSION:
|
||||
case BADRESPONSE:
|
||||
return CHREDO;
|
||||
break;
|
||||
return CHREDO;
|
||||
break;
|
||||
case WRONGMODE:
|
||||
case FAILEDCOMMAND:
|
||||
case UNDRIVABLE:
|
||||
case BADPAR:
|
||||
case ESTOP:
|
||||
return CHFAIL;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
closeRS232(self->controller);
|
||||
status = TcpDoChoConnect(self);
|
||||
if(status == 1){
|
||||
return CHREDO;
|
||||
closeRS232(self->controller);
|
||||
status = TcpDoChoConnect(self);
|
||||
if(status == 1){
|
||||
return CHREDO;
|
||||
} else {
|
||||
return CHFAIL;
|
||||
}
|
||||
break;
|
||||
return CHFAIL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return CHFAIL;
|
||||
}
|
||||
@ -888,50 +888,54 @@ pCodri MakeTcpDoChoDriver(char *tclArray, SConnection *pCon){
|
||||
int port, i, count;
|
||||
Tcl_DString pars;
|
||||
char *parnames[] = {"State",
|
||||
"ASPEED",
|
||||
"RSPEED",
|
||||
"APHASE",
|
||||
"RPHASE",
|
||||
"AVETO",
|
||||
"DIR",
|
||||
"MONIT",
|
||||
"FLOWR",
|
||||
"WTEMP",
|
||||
"MTEMP",
|
||||
"MVIBR",
|
||||
"MVACU",
|
||||
"speed",
|
||||
"phase",
|
||||
NULL,
|
||||
"ASPEED",
|
||||
"RSPEED",
|
||||
"APHASE",
|
||||
"RPHASE",
|
||||
"AVETO",
|
||||
"DIR",
|
||||
"MONIT",
|
||||
"FLOWR",
|
||||
"WTEMP",
|
||||
"MTEMP",
|
||||
"MVIBR",
|
||||
"MVACU",
|
||||
"speed",
|
||||
"phase",
|
||||
NULL,
|
||||
};
|
||||
|
||||
/*
|
||||
allocate memory
|
||||
*/
|
||||
pNew = (pCodri)malloc(sizeof(Codri));
|
||||
if(!pNew){
|
||||
return NULL;
|
||||
}
|
||||
self = (pTcpDoCho)malloc(sizeof(TcpDoCho));
|
||||
if(!pNew || !self){
|
||||
if(!self){
|
||||
free(pNew);
|
||||
return NULL;
|
||||
}
|
||||
memset(pNew,0,sizeof(Codri));
|
||||
memset(self,0,sizeof(TcpDoCho));
|
||||
|
||||
|
||||
/* port and host name */
|
||||
pPtr = Tcl_GetVar2(pServ->pSics->pTcl,tclArray,"port",TCL_GLOBAL_ONLY);
|
||||
if(!pPtr){
|
||||
SCWrite(pCon,"ERROR: port not found in configuration array for TCP Dornier Chopper",
|
||||
eError);
|
||||
SCWrite(pCon,"ERROR: port not found in configuration array for TCP Dornier Chopper",
|
||||
eError);
|
||||
free(pNew);
|
||||
free(self);
|
||||
free(self);
|
||||
return NULL;
|
||||
}
|
||||
sscanf(pPtr,"%d",&port);
|
||||
pPtr = Tcl_GetVar2(pServ->pSics->pTcl,tclArray,"host",TCL_GLOBAL_ONLY);
|
||||
if(!pPtr){
|
||||
SCWrite(pCon,"ERROR: host not found in configuration array for TCP Dornier Chopper",
|
||||
eError);
|
||||
SCWrite(pCon,"ERROR: host not found in configuration array for TCP Dornier Chopper",
|
||||
eError);
|
||||
free(pNew);
|
||||
free(self);
|
||||
free(self);
|
||||
return NULL;
|
||||
}
|
||||
memset(buffer,0,132);
|
||||
@ -941,27 +945,28 @@ pCodri MakeTcpDoChoDriver(char *tclArray, SConnection *pCon){
|
||||
/* number of choppers */
|
||||
pPtr = Tcl_GetVar2(pServ->pSics->pTcl,tclArray,"nchopper",TCL_GLOBAL_ONLY);
|
||||
if(!pPtr){
|
||||
SCWrite(pCon,"ERROR: nchopper not found in configuration array for TCP Dornier Chopper",
|
||||
eError);
|
||||
SCWrite(pCon,"ERROR: nchopper not found in configuration array for TCP Dornier Chopper",
|
||||
eError);
|
||||
free(pNew);
|
||||
free(self);
|
||||
free(self);
|
||||
return NULL;
|
||||
}
|
||||
sscanf(pPtr,"%d",&port);
|
||||
if(port < 0 || port > 8){
|
||||
SCWrite(pCon,"ERROR: number of choppers not in range 1 - 8",eError);
|
||||
SCWrite(pCon,"ERROR: number of choppers not in range 1 - 8",eError);
|
||||
free(pNew);
|
||||
free(self);
|
||||
free(self);
|
||||
return NULL;
|
||||
}
|
||||
self->numChoppers = port;
|
||||
|
||||
/* timeout */
|
||||
pPtr = Tcl_GetVar2(pServ->pSics->pTcl,tclArray,"timeout",TCL_GLOBAL_ONLY);
|
||||
if(!pPtr){
|
||||
SCWrite(pCon,"ERROR: timeout not found in configuration array for TCP Dornier Chopper",
|
||||
eError);
|
||||
SCWrite(pCon,"ERROR: timeout not found in configuration array for TCP Dornier Chopper",
|
||||
eError);
|
||||
free(pNew);
|
||||
free(self);
|
||||
free(self);
|
||||
return NULL;
|
||||
}
|
||||
sscanf(pPtr,"%d",&port);
|
||||
@ -970,19 +975,19 @@ pCodri MakeTcpDoChoDriver(char *tclArray, SConnection *pCon){
|
||||
/* username and password */
|
||||
pPtr = Tcl_GetVar2(pServ->pSics->pTcl,tclArray,"user",TCL_GLOBAL_ONLY);
|
||||
if(!pPtr){
|
||||
SCWrite(pCon,"ERROR: user not found in configuration array for TCP Dornier Chopper",
|
||||
eError);
|
||||
SCWrite(pCon,"ERROR: user not found in configuration array for TCP Dornier Chopper",
|
||||
eError);
|
||||
free(pNew);
|
||||
free(self);
|
||||
free(self);
|
||||
return NULL;
|
||||
}
|
||||
strncpy(self->user,pPtr, 131);
|
||||
pPtr = Tcl_GetVar2(pServ->pSics->pTcl,tclArray,"password",TCL_GLOBAL_ONLY);
|
||||
if(!pPtr){
|
||||
SCWrite(pCon,"ERROR: password not found in configuration array for TCP Dornier Chopper",
|
||||
eError);
|
||||
SCWrite(pCon,"ERROR: password not found in configuration array for TCP Dornier Chopper",
|
||||
eError);
|
||||
free(pNew);
|
||||
free(self);
|
||||
free(self);
|
||||
return NULL;
|
||||
}
|
||||
strncpy(self->pword,pPtr, 131);
|
||||
@ -992,16 +997,16 @@ pCodri MakeTcpDoChoDriver(char *tclArray, SConnection *pCon){
|
||||
*/
|
||||
pPtr = Tcl_GetVar2(pServ->pSics->pTcl,tclArray,"config",TCL_GLOBAL_ONLY);
|
||||
if(pPtr != NULL){
|
||||
self->config = strdup(pPtr);
|
||||
self->config = strdup(pPtr);
|
||||
}
|
||||
|
||||
|
||||
/* initialize some more */
|
||||
self->parameters = CreateStringDict();
|
||||
if(self->parameters == NULL || self->controller == NULL){
|
||||
SCWrite(pCon,"ERROR: out of memory in MakeTcpDoCho",eError);
|
||||
SCWrite(pCon,"ERROR: out of memory in MakeTcpDoCho",eError);
|
||||
free(pNew);
|
||||
free(self);
|
||||
free(self);
|
||||
return NULL;
|
||||
}
|
||||
self->iRefreshIntervall = 60;
|
||||
@ -1025,11 +1030,11 @@ pCodri MakeTcpDoChoDriver(char *tclArray, SConnection *pCon){
|
||||
count = 0;
|
||||
Tcl_DStringAppend(&pars,"updateintervall",15);
|
||||
while(parnames[count] != NULL){
|
||||
for(i = 0; i < self->numChoppers; i++){
|
||||
snprintf(buffer,131,",%s_%1.1d", parnames[count], i + 1);
|
||||
Tcl_DStringAppend(&pars,buffer,strlen(buffer));
|
||||
for(i = 0; i < self->numChoppers; i++){
|
||||
snprintf(buffer,131,",%s_%1.1d", parnames[count], i + 1);
|
||||
Tcl_DStringAppend(&pars,buffer,strlen(buffer));
|
||||
}
|
||||
count++;
|
||||
count++;
|
||||
}
|
||||
pNew->pParList = strdup(Tcl_DStringValue(&pars));
|
||||
Tcl_DStringFree(&pars);
|
||||
|
@ -191,7 +191,11 @@ static int scaqaProtHandler(Ascon *a)
|
||||
return 0;
|
||||
}
|
||||
if (pp->txn.transWait < 0) {
|
||||
a->state = AsconTimeout;
|
||||
if (GetDynStringLength(a->rdBuffer) == 0) {
|
||||
a->state = AsconTimeout;
|
||||
} else {
|
||||
a->state = AsconReadDone;
|
||||
}
|
||||
} else if (pp->txn.transWait == 0) {
|
||||
a->state = AsconReadDone;
|
||||
}
|
||||
|
@ -203,19 +203,21 @@ static int HttpProtInit(Ascon *a, SConnection *con,
|
||||
int argc, char *argv[]){
|
||||
pHttpProt pHttp = NULL;
|
||||
|
||||
if(argc < 3){
|
||||
SCWrite(con,"ERROR: too few arguments in HttpProtInit", eError);
|
||||
return 0;
|
||||
}
|
||||
pHttp = calloc(sizeof(HttpProt), 1);
|
||||
if(pHttp == NULL){
|
||||
SCWrite(con,"ERROR: out of memory in HttpProtInit", eError);
|
||||
return 0;
|
||||
}
|
||||
if(argc < 3){
|
||||
return 0;
|
||||
}
|
||||
a->hostport = strdup(argv[1]);
|
||||
pHttp->binData = (pSICSData)FindCommandData(pServ->pSics,
|
||||
argv[2], "SICSData");
|
||||
if(pHttp->binData == NULL){
|
||||
SCWrite(con,"ERROR: SICSData objct not found", eError);
|
||||
SCWrite(con,"ERROR: SICSData object not found", eError);
|
||||
free(pHttp);
|
||||
return 0;
|
||||
}
|
||||
if(argc > 3){
|
||||
|
@ -346,7 +346,7 @@
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int WEST4100_Query(pWEST4100 *pData, int parAddress, int *parValue)
|
||||
{
|
||||
unsigned char pCommand[20], pReply[132], pAddress[1];
|
||||
unsigned char pCommand[20], pReply[132], pAddress[2];
|
||||
int iRet;
|
||||
pWEST4100 self;
|
||||
|
||||
@ -374,7 +374,7 @@
|
||||
/*-------------------------------------------------------------------------*/
|
||||
int WEST4100_Write(pWEST4100 *pData, int parAddress, int parValue)
|
||||
{
|
||||
unsigned char displaytext[20];
|
||||
unsigned char displaytext[40];
|
||||
int iRet;
|
||||
pWEST4100 self;
|
||||
|
||||
|
@ -77,8 +77,9 @@ class MyScreen(Screen):
|
||||
|
||||
def main(**kwargs):
|
||||
global screen, devices, factories
|
||||
parser = argparse.ArgumentParser( description="Generates fake Galil controllers for testing SICS" )
|
||||
parser.add_argument("instrument", help="The instrument name")
|
||||
parser = argparse.ArgumentParser( description='Generates fake Galil controllers for testing SICS' )
|
||||
parser.add_argument('instrument', help='The instrument name')
|
||||
parser.add_argument('-w', '--window', help='Create a display window', action='store_true', default=False)
|
||||
args = parser.parse_args()
|
||||
|
||||
basePort = {
|
||||
@ -89,7 +90,7 @@ def main(**kwargs):
|
||||
log.startLogging(open(("/tmp/Fake_Galil_%d.log" % basePort[args.instrument]), "w"))
|
||||
devices = {}
|
||||
factories = {}
|
||||
for dev in range(0, 6):
|
||||
for dev in range(0, 8):
|
||||
port = basePort[args.instrument] + dev
|
||||
controllerName = "mc%d" % (dev + 1)
|
||||
factory = GalilFactory(port)
|
||||
@ -97,9 +98,10 @@ def main(**kwargs):
|
||||
factories[controllerName] = factory
|
||||
reactor.listenTCP(port, factory)
|
||||
|
||||
stdscr = curses.initscr()
|
||||
screen = MyScreen(stdscr)
|
||||
reactor.addReader(screen)
|
||||
if (args.window):
|
||||
stdscr = curses.initscr()
|
||||
screen = MyScreen(stdscr)
|
||||
reactor.addReader(screen)
|
||||
|
||||
#lc = LoopingCall(device_iterator)
|
||||
#lc.start(0.5)
|
||||
|
1
site_ansto/instrument/TEST_SICS/fakeRFGen/SIM_RFGen.tcl
Normal file → Executable file
1
site_ansto/instrument/TEST_SICS/fakeRFGen/SIM_RFGen.tcl
Normal file → Executable file
@ -1,3 +1,4 @@
|
||||
#!/usr//bin/env tclsh
|
||||
# $Revision: 1.1.2.5 $
|
||||
# $Date: 2010-05-20 00:51:15 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
|
6
site_ansto/instrument/bilby/MANIFEST.TXT
Normal file
6
site_ansto/instrument/bilby/MANIFEST.TXT
Normal file
@ -0,0 +1,6 @@
|
||||
runsics_def.py
|
||||
bilby_configuration.tcl
|
||||
config
|
||||
util
|
||||
hostport_config.tcl
|
||||
hostport_config_test.tcl
|
63
site_ansto/instrument/bilby/bilby_configuration.tcl
Normal file
63
site_ansto/instrument/bilby/bilby_configuration.tcl
Normal file
@ -0,0 +1,63 @@
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
|
||||
# Required by server_config.tcl
|
||||
VarMake Instrument Text Internal
|
||||
Instrument bilby
|
||||
Instrument lock
|
||||
|
||||
#START SERVER CONFIGURATION SECTION
|
||||
source util/dmc2280/dmc2280_util.tcl
|
||||
source server_config.tcl
|
||||
MakeDrive
|
||||
#END SERVER CONFIGURATION SECTION
|
||||
|
||||
########################################
|
||||
# INSTRUMENT SPECIFIC CONFIGURATION
|
||||
|
||||
fileeval $cfPath(motors)/motor_configuration.tcl
|
||||
|
||||
|
||||
fileeval $cfPath(source)/source.tcl
|
||||
source $cfPath(hipadaba)/hipadaba_configuration.tcl
|
||||
fileeval $cfPath(motors)/positmotor_configuration.tcl
|
||||
fileeval $cfPath(velsel)/velsel.tcl
|
||||
fileeval $cfPath(parameters)/parameters.tcl
|
||||
fileeval $cfPath(plc)/plc.tcl
|
||||
fileeval $cfPath(chopper)/chopper.tcl
|
||||
fileeval $cfPath(optics)/optics.tcl
|
||||
fileeval $cfPath(counter)/counter.tcl
|
||||
fileeval $cfPath(environment)/temperature/sct_lakeshore_340.tcl
|
||||
fileeval $cfPath(environment)/temperature/sct_lakeshore_336.tcl
|
||||
fileeval $cfPath(hmm)/hmm_configuration.tcl
|
||||
fileeval $cfPath(nexus)/nxscripts.tcl
|
||||
fileeval $cfPath(hmm)/detector.tcl
|
||||
fileeval $cfPath(scan)/scan.tcl
|
||||
fileeval $cfPath(commands)/commands.tcl
|
||||
fileeval $cfPath(anticollider)/anticollider.tcl
|
||||
fileeval $cfPath(environment)/temperature/sct_julabo_lh45.tcl
|
||||
fileeval $cfPath(environment)/temperature/sct_qlink.tcl
|
||||
fileeval $cfPath(environment)/temperature/sct_watlow_st4.tcl
|
||||
fileeval $cfPath(environment)/temperature/sct_watlow_rm.tcl
|
||||
fileeval $cfPath(environment)/temperature/sct_rvasm2.tcl
|
||||
fileeval $cfPath(environment)/temperature/sct_oxford_itc.tcl
|
||||
fileeval $cfPath(environment)/magneticField/oxford_labview.tcl
|
||||
fileeval $cfPath(environment)/magneticField/sct_bruker_BEC1.tcl
|
||||
fileeval $cfPath(environment)/environment.tcl
|
||||
fileeval $cfPath(environment)/sct_rheometer.tcl
|
||||
fileeval $cfPath(environment)/sct_protek_common.tcl
|
||||
fileeval $cfPath(beamline)/spin_flipper.tcl
|
||||
fileeval $cfPath(commands)/pulser.tcl
|
||||
fileeval $cfPath(commands)/hvcommands.tcl
|
||||
|
||||
source gumxml.tcl
|
||||
|
||||
::utility::mkVar ::anticollider::protect_detector text manager protect_detector false detector true false
|
||||
::anticollider::protect_detector "true"
|
||||
|
||||
server_init
|
||||
###########################################
|
||||
# WARNING: Do not add any code below server_init, if you do SICS may fail to initialise properly.
|
||||
|
||||
# You can add extra-configuration code in ../extraconfig.tcl
|
||||
sicspoll intervall /instrument/detector/max_binrate 1
|
||||
sicspoll intervall /instrument/detector/total_maprate 1
|
32
site_ansto/instrument/bilby/config/INSTCFCOMMON.TXT
Normal file
32
site_ansto/instrument/bilby/config/INSTCFCOMMON.TXT
Normal file
@ -0,0 +1,32 @@
|
||||
config/source/sct_reactor_status.tcl
|
||||
config/source/source.tcl
|
||||
config/anticollider/anticollider_common.tcl
|
||||
config/plc/plc_common_1.tcl
|
||||
config/counter/counter_common_1.tcl
|
||||
config/hipadaba/hipadaba_configuration_common.tcl
|
||||
config/hipadaba/common_instrument_dictionary.tcl
|
||||
config/hipadaba/instdict_specification.tcl
|
||||
config/hmm/hmm_configuration_common_1.tcl
|
||||
config/hmm/hmm_object.tcl
|
||||
config/hmm/anstohm_linked.xml
|
||||
config/hmm/sct_orhvps_common.tcl
|
||||
config/scan/scan_common_1.hdd
|
||||
config/scan/scan_common_1.tcl
|
||||
config/nexus/nxscripts_common_1.tcl
|
||||
config/commands/commands_common.tcl
|
||||
config/commands/pulser.tcl
|
||||
config/commands/hvcommands.tcl
|
||||
config/motors/sct_positmotor_common.tcl
|
||||
config/environment/sct_protek_common.tcl
|
||||
config/environment/temperature/sct_julabo_lh45.tcl
|
||||
config/environment/temperature/sct_lakeshore_340.tcl
|
||||
config/environment/temperature/sct_lakeshore_336.tcl
|
||||
config/environment/temperature/sct_qlink.tcl
|
||||
config/environment/temperature/sct_watlow_st4.tcl
|
||||
config/environment/temperature/sct_rvasm2.tcl
|
||||
config/environment/temperature/sct_oxford_itc.tcl
|
||||
config/environment/magneticField/sct_bruker_BEC1.tcl
|
||||
config/environment/magneticField/sct_oxford_ips.tcl
|
||||
config/environment/magneticField/sct_oxford_labview.tcl
|
||||
|
||||
config/motors/sct_jogmotor_common.tcl
|
128
site_ansto/instrument/bilby/config/anticollider/anticollider.tcl
Normal file
128
site_ansto/instrument/bilby/config/anticollider/anticollider.tcl
Normal file
@ -0,0 +1,128 @@
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
|
||||
fileeval $cfPath(anticollider)/anticollider_common.tcl
|
||||
|
||||
namespace eval ::anticollider {
|
||||
set guide_posit 1
|
||||
set aperture_posit 2
|
||||
set apD10_posit 1
|
||||
set coltol 0.5
|
||||
set aptol 0.1
|
||||
|
||||
for {set n 1} {$n < 8} {incr n} {
|
||||
foreach {col ap} "col$n ap$n" {
|
||||
set col_limit [expr [SplitReply [$col posit2unit $aperture_posit]] - $coltol]
|
||||
set ap_limit [expr [SplitReply [$ap posit2unit $apD10_posit]] - $aptol]
|
||||
set acrule [subst {forbid {-inf inf} for $ap when $col in {-inf $col_limit} }]
|
||||
lappend ::anticollider::veto_rules $acrule
|
||||
set acrule [subst {forbid {-inf inf} for $col when $ap in {$ap_limit inf} }]
|
||||
lappend ::anticollider::veto_rules $acrule
|
||||
anticollision register $col
|
||||
anticollision register $ap
|
||||
}
|
||||
}
|
||||
|
||||
proc ::anticollider::load_acrules {} {
|
||||
variable proximity_rules
|
||||
# Proximity rules have the following form,
|
||||
# m1 m2 mdist
|
||||
# This means that the position of m2 is always >= m1 and that a drive or
|
||||
# run command which tries to drive them closer than mdist will be rejected.
|
||||
# TODO Abort driving motors registered with the anticollider if one of them
|
||||
# fails during the drive.
|
||||
# TESTING WITH SLITS, uncomment this block and the foreach block to test with slits
|
||||
# set proximity_rules {
|
||||
# ss1l ss1r 10
|
||||
# }
|
||||
# TODO UNCOMMENT FOLLOWING TO ENABLE ANTICOLLISION FOR DETECTOR CARRIAGES
|
||||
# # Detector carriage proximity rules.
|
||||
# # det1 = curtain detector
|
||||
# # det2 = main detector which is at higher y-pos then det1
|
||||
# set proximity_rules {
|
||||
# det1 det2 2000
|
||||
# }
|
||||
# foreach {m1 m2 minsep} $proximity_rules {
|
||||
# anticollision register $m1
|
||||
# anticollision register $m2
|
||||
# clientput "::anticollider::proximity_rule: $m1 $m2 minsep = $minsep"
|
||||
# }
|
||||
}
|
||||
|
||||
# @brief Don't allow two axes to get closer than a minimum separation given in the 'proximity_rules' list.
|
||||
# Assumes that both objects are on the same open track
|
||||
# Both axes are required to move at the same speed with the same accel and decel values.
|
||||
# NOTE: Doesn't check that the speeds and accel set by the Galil match what is requested.
|
||||
# If axes are within the minimum distance then you can only drive them
|
||||
# apart when the targets are greater than the minimum allowed separation.
|
||||
proc proximity_script {args} {
|
||||
set catch_status [ catch {
|
||||
variable proximity_rules
|
||||
|
||||
if {[info exists proximity_rules] == 0} {
|
||||
return
|
||||
} elseif {[len $proximity_rules] == 0} {
|
||||
return
|
||||
}
|
||||
foreach {m1 m2 mdist} $proximity_rules {
|
||||
set final($m1) [SplitReply [$m1]]
|
||||
set final($m2) [SplitReply [$m2]]
|
||||
}
|
||||
foreach {mot val} $args {
|
||||
set final($mot) $val
|
||||
}
|
||||
foreach {mot val} $args {
|
||||
set rulenum 1
|
||||
foreach {m1 m2 mdist} $proximity_rules {
|
||||
if {$m1 != $mot && $m2 != $mot} {
|
||||
continue
|
||||
}
|
||||
if {$mdist <=0} {
|
||||
error "Minimum separation for $m1 and $m2 must be > 0 in proximity_rule $rulenum"
|
||||
}
|
||||
set speed($m1) [SplitReply [$m1 speed]]
|
||||
set accel($m1) [SplitReply [$m1 accel]]
|
||||
set decel($m1) [SplitReply [$m1 decel]]
|
||||
set pos($m1) [SplitReply [$m1]]
|
||||
|
||||
set speed($m2) [SplitReply [$m2 speed]]
|
||||
set accel($m2) [SplitReply [$m2 accel]]
|
||||
set decel($m2) [SplitReply [$m2 decel]]
|
||||
set pos($m2) [SplitReply [$m2]]
|
||||
# NOTE Speed and accel tests assume that the Galil actually sets the
|
||||
# speeds and accelerations to the same expected steps after taking gear
|
||||
# ratios, transmission, (something else?) into account on both axes
|
||||
# when we drive the motors.
|
||||
if {$speed($m1) != $speed($m2)} {
|
||||
error "$m1 and $m2 speeds must be equal to ensure they won't collide"
|
||||
}
|
||||
if {$accel($m1) != $accel($m2)} {
|
||||
error "$m1 and $m2 accelerations must be equal to ensure they won't collide"
|
||||
}
|
||||
if {$decel($m1) != $decel($m2)} {
|
||||
error "$m1 and $m2 decelerations must be equal to ensure they won't collide"
|
||||
}
|
||||
if {$pos($m2) - $pos($m1) < 0} {
|
||||
error "Rule($rulenum): $m1 $m2 $mdist seems to be invalid. It assumes that $m2 pos is always >= $m1 pos but $m1 is at $pos($m1) and $m2 is at $pos($m2)"
|
||||
}
|
||||
if {$final($m2) - $final($m1) < $mdist} {
|
||||
error "$m1 and $m2 will violate rule:$rulenum, the minimum allowed separation is positive $mdist"
|
||||
}
|
||||
incr rulenum
|
||||
}
|
||||
}
|
||||
} message ]
|
||||
handle_exception $catch_status $message
|
||||
}
|
||||
lappend ::anticollider::scripts ::anticollider::proximity_script
|
||||
}
|
||||
|
||||
# NOTE: This is called with a list of motorname target pairs
|
||||
proc ::anticollider::enable {args} {
|
||||
if {[SplitReply [::anticollider::protect_detector]] == "false"} {
|
||||
return "false"
|
||||
} else {
|
||||
return "true"
|
||||
}
|
||||
}
|
||||
|
||||
::anticollider::loadscript acscript.txt
|
34
site_ansto/instrument/bilby/config/chopper/chopper.tcl
Normal file
34
site_ansto/instrument/bilby/config/chopper/chopper.tcl
Normal file
@ -0,0 +1,34 @@
|
||||
|
||||
namespace eval chopper {
|
||||
variable sim_mode [SplitReply [chopper_simulation]]
|
||||
set master_chopper_id_simvar 1
|
||||
}
|
||||
|
||||
if {$sim_mode == false} {
|
||||
MakeAsyncProtocol std
|
||||
MakeAsyncQueue chopsel std chopsel1-bilby 30000
|
||||
}
|
||||
::utility::macro::getset int master_chopper_id {args} {
|
||||
variable sim_mode [SplitReply [chopper_simulation]]
|
||||
|
||||
if {$sim_mode == false} {
|
||||
if {$args == ""} {
|
||||
chopsel send {get master chopper}
|
||||
return "master_chopper_id = [SplitReply [chopsel send {get master chopper}]]"
|
||||
} else {
|
||||
chopsel send "get master chopper"
|
||||
chopsel send "enable chopper selection"
|
||||
chopsel send "set master chopper=$args"
|
||||
chopsel send "disable chopper selection"
|
||||
}
|
||||
} else {
|
||||
if {$args == ""} {
|
||||
return master_chopper_id = $::chopper::master_chopper_id_simvar
|
||||
} else {
|
||||
set ::chopper::master_chopper_id_simvar $args
|
||||
}
|
||||
}
|
||||
}
|
||||
sicslist setatt master_chopper_id klass NXdisk_chopper
|
||||
sicslist setatt master_chopper_id long_name master_chopper_id
|
||||
sicslist setatt master_chopper_id mutable false
|
216
site_ansto/instrument/bilby/config/commands/commands.tcl
Normal file
216
site_ansto/instrument/bilby/config/commands/commands.tcl
Normal file
@ -0,0 +1,216 @@
|
||||
source $cfPath(commands)/commands_common.tcl
|
||||
|
||||
namespace eval motor {
|
||||
# is_homing_list = comma separated list of motors which are safe to send "home"
|
||||
variable is_homing_list ""
|
||||
}
|
||||
|
||||
#namespace eval sample {
|
||||
# command select {int=0:8 sampid} {
|
||||
# SampleNum $sampid
|
||||
# }
|
||||
#}
|
||||
|
||||
##
|
||||
# @brief Beamstop select command
|
||||
# @param bs beamstop, 1,2,3,4,5 or 6
|
||||
# @param bx beam position in detector coordinates
|
||||
# @param bz beam position in detector coordinates
|
||||
# Given
|
||||
# (Xbf,Zbf) = beam pos in frame coords
|
||||
# (Xbd,Zbd) = beam pos in detector coords
|
||||
# (Xbbs, Zbbs) = beam pos in beamstop coords
|
||||
# (Xdf,Zdf) = detector pos in frame coords
|
||||
# (Xbsf,Zbsf) = beamstop pos in frame coords
|
||||
#
|
||||
# (Xbf,Zbf) = (Xdf+Xbd, Zdf+Zbd) = (Xbsf+Xbbs, Zbsf+Zbbs)
|
||||
# Origin of detector coords = frame origin
|
||||
#
|
||||
# Detector and beamstop motor readings with beamstop disk centers
|
||||
# overlapping over detector center mark.
|
||||
# Xdf = 264.542 (7283813) Zdf = 0
|
||||
# Xbbs = 296.291 (8054270)
|
||||
# Zbbs = 259.641 (13488244)
|
||||
# Xbd = dethw, Zbd = (dethh)
|
||||
#
|
||||
# 264.542+dethw = Xbsf+296.291
|
||||
# 0+dethh = Zbsf+259.641
|
||||
#
|
||||
# Xbsf = -31.749 + dethw, Zbsf = -259.641 + dethh
|
||||
proc selbs {bs {bx "UNDEF"} {bz "UNDEF"}} {
|
||||
set bsdriving false
|
||||
set dethw [expr {[SplitReply [detector_active_height_mm]]/2.0}]
|
||||
set dethh [expr {[SplitReply [detector_active_width_mm]]/2.0}]
|
||||
set Xbsf [expr -31.749 + $dethw]
|
||||
set Zbsf [expr -259.641 + $dethh]
|
||||
array set bsl [subst {
|
||||
1 [SplitReply [bs1 softlowerlim]]
|
||||
2 [SplitReply [bs2 softlowerlim]]
|
||||
3 [SplitReply [bs3 softlowerlim]]
|
||||
4 [SplitReply [bs4 softlowerlim]]
|
||||
5 [SplitReply [bs5 softlowerlim]]
|
||||
6 [SplitReply [bs6 softlowerlim]]
|
||||
}]
|
||||
if [ catch {
|
||||
switch $bs {
|
||||
"1" {
|
||||
set bsmot "bs1"
|
||||
set bs_target 93.20
|
||||
set bs_diameter 110
|
||||
set bsdownCmd "drive bs2 $bsl(2) bs3 $bsl(3) bs4 $bsl(4) bs5 $bsl(5) bs6 $bsl(6)"
|
||||
}
|
||||
"2" {
|
||||
set bsmot "bs2"
|
||||
set bs_target 86.84
|
||||
set bs_diameter 88
|
||||
set bsdownCmd "drive bs1 $bsl(1) bs3 $bsl(3) bs4 $bsl(4) bs5 $bsl(5) bs6 $bsl(6)"
|
||||
}
|
||||
"3" {
|
||||
set bsmot "bs3"
|
||||
set bs_target 93.35
|
||||
set bs_diameter 66
|
||||
set bsdownCmd "drive bs2 $bsl(2) bs1 $bsl(1) bs4 $bsl(4) bs5 $bsl(5) bs6 $bsl(6)"
|
||||
}
|
||||
"4" {
|
||||
set bsmot "bs4"
|
||||
set bs_target 86.85
|
||||
set bs_diameter 44
|
||||
set bsdownCmd "drive bs2 $bsl(2) bs3 $bsl(3) bs1 $bsl(1) bs5 $bsl(5) bs6 $bsl(6)"
|
||||
}
|
||||
"5" {
|
||||
set bsmot "bs5"
|
||||
set bs_target 93.27
|
||||
set bs_diameter 22
|
||||
set bsdownCmd "drive bs2 $bsl(2) bs3 $bsl(3) bs4 $bsl(4) bs1 $bsl(1) bs6 $bsl(6)"
|
||||
}
|
||||
"6" {
|
||||
set bsmot "bs6"
|
||||
set bs_target 86.98
|
||||
set bs_diameter 11
|
||||
set bsdownCmd "drive bs2 $bsl(2) bs3 $bsl(3) bs4 $bsl(4) bs5 $bsl(5) bs1 $bsl(1)"
|
||||
}
|
||||
default {
|
||||
error "beamstop selection must be an integer from 1 to 6"
|
||||
}
|
||||
}
|
||||
|
||||
set detoff_val [SplitReply [detoff]]
|
||||
|
||||
if {$bx == "UNDEF" || $bz == "UNDEF"} {
|
||||
statemon start selbs
|
||||
if {[info level] > 1} {statemon start [lindex [info level -1] 0]}
|
||||
set bsdriving true
|
||||
BeamStop -1
|
||||
BSdiam -1
|
||||
drive $bsmot $bs_target
|
||||
eval $bsdownCmd
|
||||
BeamStop $bs
|
||||
BSdiam $bs_diameter
|
||||
set bsdriving false
|
||||
statemon stop selbs
|
||||
if {[info level] > 1} {statemon stop [lindex [info level -1] 0]}
|
||||
} else {
|
||||
if { [string is double $bx] == false } {
|
||||
if { [string is double $bz] == false } {
|
||||
error "beam coordinates must be floats"
|
||||
}
|
||||
}
|
||||
set bsx_target [expr {$bx-$Xbsf+$detoff_val}]
|
||||
set bsz_target [expr {$bz-$Zbsf}]
|
||||
|
||||
statemon start selbs
|
||||
if {[info level] > 1} {statemon start [lindex [info level -1] 0]}
|
||||
set bsdriving true
|
||||
BeamStop -1
|
||||
BSdiam -1
|
||||
drive $bsmot $bs_target bsx $bsx_target bsz $bsz_target
|
||||
eval $bsdownCmd
|
||||
BeamStop $bs
|
||||
BSdiam $bs_diameter
|
||||
set bsdriving false
|
||||
statemon stop selbs
|
||||
if {[info level] > 1} {statemon stop [lindex [info level -1] 0]}
|
||||
}
|
||||
} msg ] {
|
||||
if {$bsdriving} {
|
||||
statemon stop selbs
|
||||
if {[info level] > 1} {statemon stop [lindex [info level -1] 0]}
|
||||
}
|
||||
return -code error $msg
|
||||
}
|
||||
}
|
||||
publish selbs user
|
||||
namespace eval beamstops {
|
||||
command selbsn {int=1,2,3,4,5,6 bs} {
|
||||
selbs $bs "UNDEF" "UNDEF"
|
||||
}
|
||||
command selbsxz {int=1,2,3,4,5,6 bs float bx float bz} {
|
||||
selbs $bs $bx $bz
|
||||
}
|
||||
}
|
||||
|
||||
namespace eval optics {
|
||||
VarMake ::optics::select::section text user
|
||||
VarMake ::optics::polarizer::in text user
|
||||
VarMake ::optics::lens::selection text user
|
||||
|
||||
command rotary_attenuator {int=0,15,45,90,180 angle} {
|
||||
drive att $angle
|
||||
}
|
||||
|
||||
command entrance_aperture {
|
||||
int=0,45,90,135,180,270 angle
|
||||
} {
|
||||
drive srce $angle
|
||||
}
|
||||
|
||||
# TODO Do we need this
|
||||
# command sample_aperture {
|
||||
# int=25,50 size
|
||||
# text=circ,squ,open,rect shape
|
||||
# } {
|
||||
# SApXmm $size
|
||||
# SApZmm $size
|
||||
# SApShape $shape
|
||||
# }
|
||||
|
||||
##############################
|
||||
##
|
||||
# @brief The "guide" command uses a lookup table to setup the collimation system
|
||||
# @param row, selects a row from the guide configuration table
|
||||
#
|
||||
# eg\n
|
||||
# guide ga
|
||||
command guide "
|
||||
text=[join [array names ::optics::guide_configuration] , ] configuration
|
||||
" {
|
||||
|
||||
variable guide_configuration
|
||||
variable guide_configuration_columns
|
||||
|
||||
if [ catch {
|
||||
|
||||
foreach {compselection position} $guide_configuration($configuration) {
|
||||
foreach el $compselection guide $guide_configuration_columns {
|
||||
lappend to_config $guide
|
||||
lappend to_config [set ::optics::${guide}_map($el)]
|
||||
}
|
||||
::optics::guide -set feedback status BUSY
|
||||
set msg [eval "drive $to_config"]
|
||||
EApPosY $position
|
||||
}
|
||||
GuideConfig $configuration
|
||||
} message ] {
|
||||
::optics::guide -set feedback status IDLE
|
||||
if {$::errorCode=="NONE"} {return $message}
|
||||
return -code error $message
|
||||
}
|
||||
::optics::guide -set feedback status IDLE
|
||||
}
|
||||
::optics::guide -addfb text status
|
||||
::optics::guide -set feedback status IDLE
|
||||
}
|
||||
|
||||
proc ::commands::isc_initialize {} {
|
||||
::commands::ic_initialize
|
||||
}
|
32
site_ansto/instrument/bilby/config/counter/counter.tcl
Normal file
32
site_ansto/instrument/bilby/config/counter/counter.tcl
Normal file
@ -0,0 +1,32 @@
|
||||
source $cfPath(counter)/counter_common_1.tcl
|
||||
|
||||
## TODO Put all the counter macros in the counter namespace
|
||||
namespace eval counter {
|
||||
variable isc_numchannels
|
||||
variable isc_monitor_address
|
||||
variable isc_portlist
|
||||
variable isc_beam_monitor_list
|
||||
proc set_sobj_attributes {} {
|
||||
}
|
||||
}
|
||||
|
||||
proc ::counter::isc_initialize {} {
|
||||
if [catch {
|
||||
variable isc_numchannels
|
||||
variable isc_monitor_address
|
||||
variable isc_portlist
|
||||
|
||||
dict for {k v} $::MONITOR_HOSTPORT {
|
||||
lappend monlist $k
|
||||
lappend hostlist [dict get $v HOST]
|
||||
lappend isc_portlist [dict get $v PORT]
|
||||
}
|
||||
variable isc_beam_monitor_list $monlist
|
||||
set isc_monitor_address [lindex $hostlist 0]
|
||||
set isc_numchannels [llength $isc_beam_monitor_list]
|
||||
::counter::ic_initialize
|
||||
} message ] {
|
||||
if {$::errorCode=="NONE"} {return $message}
|
||||
return -code error "$message"
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
source $cfPath(hipadaba)/hipadaba_configuration_common.tcl
|
70
site_ansto/instrument/bilby/config/hmm/hmm_configuration.tcl
Normal file
70
site_ansto/instrument/bilby/config/hmm/hmm_configuration.tcl
Normal file
@ -0,0 +1,70 @@
|
||||
|
||||
fileeval $cfPath(hmm)/hmm_configuration_common_1.tcl
|
||||
set sim_mode [SplitReply [hmm_simulation]]
|
||||
|
||||
proc ::histogram_memory::init_OAT_TABLE {} {
|
||||
if [ catch {
|
||||
# We don't need a MAX_CHAN parameter for time because the time channel
|
||||
# is scaled by calling the ::histogram_memory::clock_scale function
|
||||
OAT_TABLE X -setdata MAX_CHAN 240
|
||||
OAT_TABLE Y -setdata MAX_CHAN 256
|
||||
OAT_TABLE X -setdata BMIN -0.5
|
||||
OAT_TABLE X -setdata BMAX 239.5
|
||||
OAT_TABLE Y -setdata BMIN -0.5
|
||||
OAT_TABLE Y -setdata BMAX 255.5
|
||||
|
||||
set clock_scale 1000
|
||||
set freq 50
|
||||
hmm configure fat_clock_scale $clock_scale
|
||||
hmm configure fat_frame_frequency $freq
|
||||
hmm configure fat_frame_source INTERNAL
|
||||
|
||||
OAT_TABLE -set X { 239.5 238.5 } NXC 240 Y { -0.5 0.5 } NYC 256 T { 0 20000 } NTC 1
|
||||
} message ] {
|
||||
return -code error $message
|
||||
}
|
||||
}
|
||||
proc ::histogram_memory::pre_count {} {}
|
||||
proc ::histogram_memory::post_count {} {}
|
||||
proc ::histogram_memory::isc_initialize {} {
|
||||
# Instrument specific X and Y dimension names
|
||||
variable INST_NXC "oat_nxc_eff"
|
||||
variable INST_NYC "oat_nyc_eff"
|
||||
|
||||
if [ catch {
|
||||
::histogram_memory::init_hmm_objs
|
||||
if {$::sim_mode == "true"} {
|
||||
hmm configure oat_ntc_eff 1
|
||||
hmm configure $INST_NYC 256
|
||||
hmm configure $INST_NXC 240
|
||||
}
|
||||
BAT_TABLE -init
|
||||
CAT_TABLE -init
|
||||
SAT_TABLE -init
|
||||
OAT_TABLE -init
|
||||
FAT_TABLE -init
|
||||
::histogram_memory::ic_initialize
|
||||
|
||||
detector_active_height_mm [expr 5.08 * 256]
|
||||
detector_active_width_mm [expr 5.08 * 240]
|
||||
detector_active_height_mm lock
|
||||
detector_active_width_mm lock
|
||||
|
||||
# hmm configure FAT_SIMULATED_EVENT_Y0 $y_bb0
|
||||
# hmm configure FAT_SIMULATED_EVENT_Y1 $ybbmax
|
||||
# hmm configure FAT_SIMULATED_EVENT_X0 $x_bb0
|
||||
# hmm configure FAT_SIMULATED_EVENT_X1 $xbbmax
|
||||
::histogram_memory::init_OAT_TABLE
|
||||
::histogram_memory::upload_config Filler_defaults
|
||||
|
||||
set ::histogram_memory::histmem_axes(HOR) /instrument/detector/x_pixel_offset
|
||||
set ::histogram_memory::histmem_axes(VER) /instrument/detector/y_pixel_offset
|
||||
} message ] {
|
||||
return -code error $message
|
||||
}
|
||||
}
|
||||
|
||||
proc histmem {cmd args} {
|
||||
eval "_histmem $cmd $args"
|
||||
}
|
||||
publish histmem user
|
@ -0,0 +1,464 @@
|
||||
ap1_100X40,110608
|
||||
ap1_40X40,102604
|
||||
ap1_axis,A
|
||||
ap1_axis_number,1
|
||||
ap1_cnts_per_x,364.088888888889
|
||||
ap1_D10,86208
|
||||
ap1_D20,91680
|
||||
ap1_D40,97116
|
||||
ap1_description,Aperture Selector (Collimator SEG 1 Start)
|
||||
ap1_dflt_accel_steps,50000
|
||||
ap1_dflt_decel_steps,50000
|
||||
ap1_dflt_speed_steps,50000
|
||||
ap1_fwd_enc_lim,112188
|
||||
ap1_maxaccel,2.8125
|
||||
ap1_maxdecel,2.8125
|
||||
ap1_maxspeed,2.8125
|
||||
ap1_mc,mc1
|
||||
ap1_rev_enc_lim,73952
|
||||
ap1_steps_per_x,35555.5555555556
|
||||
ap2_100X40,93637
|
||||
ap2_40X40,85637
|
||||
ap2_axis,B
|
||||
ap2_axis_number,2
|
||||
ap2_cnts_per_x,364.088888888889
|
||||
ap2_D10,69193
|
||||
ap2_D20,74677
|
||||
ap2_D40,80149
|
||||
ap2_description,Aperture Selector (COLLIMATION SEG 2)
|
||||
ap2_dflt_accel_steps,50000
|
||||
ap2_dflt_decel_steps,50000
|
||||
ap2_dflt_speed_steps,50000
|
||||
ap2_fwd_enc_lim,95461
|
||||
ap2_maxaccel,2.8125
|
||||
ap2_maxdecel,2.8125
|
||||
ap2_maxspeed,2.8125
|
||||
ap2_mc,mc1
|
||||
ap2_rev_enc_lim,54293
|
||||
ap2_steps_per_x,35555.5555555556
|
||||
ap3_100X40,49584
|
||||
ap3_40X40,41532
|
||||
ap3_axis,C
|
||||
ap3_axis_number,3
|
||||
ap3_cnts_per_x,364.088888888889
|
||||
ap3_D10,25168
|
||||
ap3_D20,30656
|
||||
ap3_D40,36080
|
||||
ap3_description,Aperture Selector (COLLIMATION SEG 3)
|
||||
ap3_dflt_accel_steps,50000
|
||||
ap3_dflt_decel_steps,50000
|
||||
ap3_dflt_speed_steps,50000
|
||||
ap3_fwd_enc_lim,51616
|
||||
ap3_maxaccel,2.8125
|
||||
ap3_maxdecel,2.8125
|
||||
ap3_maxspeed,2.8125
|
||||
ap3_mc,mc1
|
||||
ap3_rev_enc_lim,13644
|
||||
ap3_steps_per_x,35555.5555555556
|
||||
ap4_100X40,43506
|
||||
ap4_40X40,35490
|
||||
ap4_axis,D
|
||||
ap4_axis_number,4
|
||||
ap4_cnts_per_x,364.088888888889
|
||||
ap4_D10,19118
|
||||
ap4_D20,24578
|
||||
ap4_D40,30038
|
||||
ap4_description,Aperture Selector (COLLIMATION SEG 4)
|
||||
ap4_dflt_accel_steps,50000
|
||||
ap4_dflt_decel_steps,50000
|
||||
ap4_dflt_speed_steps,50000
|
||||
ap4_fwd_enc_lim,45234
|
||||
ap4_maxaccel,2.8125
|
||||
ap4_maxdecel,2.8125
|
||||
ap4_maxspeed,2.8125
|
||||
ap4_mc,mc1
|
||||
ap4_rev_enc_lim,5666
|
||||
ap4_steps_per_x,35555.5555555556
|
||||
ap5_100X40,109480
|
||||
ap5_40X40,101476
|
||||
ap5_axis,E
|
||||
ap5_axis_number,5
|
||||
ap5_cnts_per_x,364.088888888889
|
||||
ap5_D10,85076
|
||||
ap5_D20,90552
|
||||
ap5_D40,96008
|
||||
ap5_description,Aperture Selector (COLLIMATION SEG 5)
|
||||
ap5_dflt_accel_steps,50000
|
||||
ap5_dflt_decel_steps,50000
|
||||
ap5_dflt_speed_steps,50000
|
||||
ap5_fwd_enc_lim,110696
|
||||
ap5_maxaccel,2.8125
|
||||
ap5_maxdecel,2.8125
|
||||
ap5_maxspeed,2.8125
|
||||
ap5_mc,mc1
|
||||
ap5_rev_enc_lim,72824
|
||||
ap5_steps_per_x,35555.5555555556
|
||||
ap6_100X40,110499
|
||||
ap6_40X40,102419
|
||||
ap6_axis,F
|
||||
ap6_axis_number,6
|
||||
ap6_cnts_per_x,364.088888888889
|
||||
ap6_D10,86097
|
||||
ap6_D20,91587
|
||||
ap6_D40,97011
|
||||
ap6_description,Aperture Selector (COLLIMATION SEG 6)
|
||||
ap6_dflt_accel_steps,50000
|
||||
ap6_dflt_decel_steps,50000
|
||||
ap6_dflt_speed_steps,50000
|
||||
ap6_fwd_enc_lim,112435
|
||||
ap6_maxaccel,2.8125
|
||||
ap6_maxdecel,2.8125
|
||||
ap6_maxspeed,2.8125
|
||||
ap6_mc,mc1
|
||||
ap6_rev_enc_lim,72115
|
||||
ap6_steps_per_x,35555.5555555556
|
||||
ap7_100X40,110371
|
||||
ap7_40X40,102343
|
||||
ap7_axis,G
|
||||
ap7_axis_number,7
|
||||
ap7_cnts_per_x,364.088888888889
|
||||
ap7_D10,85929
|
||||
ap7_D20,91399
|
||||
ap7_D40,96871
|
||||
ap7_description,Aperture Selector (COLLIMATION SEG 7)
|
||||
ap7_dflt_accel_steps,50000
|
||||
ap7_dflt_decel_steps,50000
|
||||
ap7_dflt_speed_steps,50000
|
||||
ap7_fwd_enc_lim,112391
|
||||
ap7_maxaccel,2.8125
|
||||
ap7_maxdecel,2.8125
|
||||
ap7_maxspeed,2.8125
|
||||
ap7_mc,mc1
|
||||
ap7_rev_enc_lim,74299
|
||||
ap7_steps_per_x,35555.5555555556
|
||||
ap8_100X40,46069
|
||||
ap8_40X40,38027
|
||||
ap8_axis,H
|
||||
ap8_axis_number,8
|
||||
ap8_cnts_per_x,364.088888888889
|
||||
ap8_D10,21657
|
||||
ap8_D20,27115
|
||||
ap8_D40,32629
|
||||
ap8_description,Aperture Selector (Collimator SEG 8 End)
|
||||
ap8_dflt_accel_steps,50000
|
||||
ap8_dflt_decel_steps,50000
|
||||
ap8_dflt_speed_steps,50000
|
||||
ap8_fwd_enc_lim,47639
|
||||
ap8_maxaccel,2.8125
|
||||
ap8_maxdecel,2.8125
|
||||
ap8_maxspeed,2.8125
|
||||
ap8_mc,mc1
|
||||
ap8_rev_enc_lim,6791
|
||||
ap8_steps_per_x,35555.5555555556
|
||||
att_axis,A
|
||||
att_axis_number,25
|
||||
att_cnts_per_x,-1365.33333333333
|
||||
att_description,4 Position linear Attenuator
|
||||
att_dflt_accel_steps,15000
|
||||
att_dflt_decel_steps,15000
|
||||
att_dflt_speed_steps,15000
|
||||
att_fwd_enc_lim,33394989
|
||||
att_maxaccel,3.6
|
||||
att_maxdecel,3.6
|
||||
att_maxspeed,3.6
|
||||
att_mc,mc4
|
||||
att_pos1,33373433
|
||||
att_pos2,33291514
|
||||
att_pos3,33209595
|
||||
att_pos4,33127674
|
||||
att_pos5,33045750
|
||||
att_rev_enc_lim,33021197
|
||||
att_steps_per_x,-4166.66666666667
|
||||
bs3_axis,C
|
||||
bs3_axis_number,43
|
||||
bs3_cnts_per_x,728.177777777778
|
||||
bs3_description,beam stop 3
|
||||
bs3_dflt_accel_steps,12500
|
||||
bs3_dflt_decel_steps,12500
|
||||
bs3_dflt_speed_steps,12500
|
||||
bs3_fwd_enc_lim,300855
|
||||
bs3_maxaccel,5.625
|
||||
bs3_maxdecel,5.625
|
||||
bs3_maxspeed,5.625
|
||||
bs3_mc,mc6
|
||||
bs3_rev_enc_lim,351548
|
||||
bs3_steps_per_x,2222.22222222222
|
||||
cdd_axis,F
|
||||
cdd_axis_number,62
|
||||
cdd_cnts_per_x,32768
|
||||
cdd_description,CURTAIN DETECTOR BOTTOM TRANSLATION
|
||||
cdd_dflt_accel_steps,25000
|
||||
cdd_dflt_decel_steps,25000
|
||||
cdd_dflt_speed_steps,150000
|
||||
cdd_fwd_enc_lim,15618875
|
||||
cdd_maxaccel,8
|
||||
cdd_maxdecel,8
|
||||
cdd_maxspeed,8
|
||||
cdd_mc,mc8
|
||||
cdd_rev_enc_lim,4159255
|
||||
cdd_steps_per_x,100000
|
||||
cdl_axis,C
|
||||
cdl_axis_number,59
|
||||
cdl_cnts_per_x,32768
|
||||
cdl_description,CURTAIN DETECTOR WEST TRANSLATION
|
||||
cdl_dflt_accel_steps,25000
|
||||
cdl_dflt_decel_steps,25000
|
||||
cdl_dflt_speed_steps,150000
|
||||
cdl_fwd_enc_lim,17466632
|
||||
cdl_maxaccel,8
|
||||
cdl_maxdecel,8
|
||||
cdl_maxspeed,8
|
||||
cdl_mc,mc8
|
||||
cdl_rev_enc_lim,5769621
|
||||
cdl_steps_per_x,100000
|
||||
cdr_axis,D
|
||||
cdr_axis_number,60
|
||||
cdr_cnts_per_x,32768
|
||||
cdr_description,CURTAIN DETECTOR EAST TRANSLATION
|
||||
cdr_dflt_accel_steps,25000
|
||||
cdr_dflt_decel_steps,25000
|
||||
cdr_dflt_speed_steps,150000
|
||||
cdr_fwd_enc_lim,16104612
|
||||
cdr_maxaccel,8
|
||||
cdr_maxdecel,8
|
||||
cdr_maxspeed,8
|
||||
cdr_mc,mc8
|
||||
cdr_rev_enc_lim,4371043
|
||||
cdr_steps_per_x,100000
|
||||
cdu_axis,E
|
||||
cdu_axis_number,61
|
||||
cdu_cnts_per_x,32768
|
||||
cdu_description,CURTAIN DETECTOR TOP TRANSLATION
|
||||
cdu_dflt_accel_steps,25000
|
||||
cdu_dflt_decel_steps,25000
|
||||
cdu_dflt_speed_steps,150000
|
||||
cdu_fwd_enc_lim,33499670
|
||||
cdu_maxaccel,8
|
||||
cdu_maxdecel,8
|
||||
cdu_maxspeed,8
|
||||
cdu_mc,mc8
|
||||
cdu_rev_enc_lim,21804679
|
||||
cdu_steps_per_x,100000
|
||||
col1_axis,A
|
||||
col1_axis_number,9
|
||||
col1_cnts_per_x,2048
|
||||
col1_description,Collimator Trans (Col SEG 1) VH
|
||||
col1_dflt_accel_steps,50000
|
||||
col1_dflt_decel_steps,50000
|
||||
col1_dflt_speed_steps,100000
|
||||
col1_empty,541261
|
||||
col1_fwd_enc_lim,557470
|
||||
col1_guide,262369
|
||||
col1_maxaccel,0.833333333333333
|
||||
col1_maxdecel,0.833333333333333
|
||||
col1_maxspeed,0.833333333333333
|
||||
col1_mc,mc2
|
||||
col1_rev_enc_lim,3902
|
||||
col1_steps_per_x,150000
|
||||
col2_axis,B
|
||||
col2_axis_number,10
|
||||
col2_cnts_per_x,2048
|
||||
col2_description,Collimator Trans (Col SEG 2) VH
|
||||
col2_dflt_accel_steps,50000
|
||||
col2_dflt_decel_steps,50000
|
||||
col2_dflt_speed_steps,100000
|
||||
col2_empty,546816
|
||||
col2_fwd_enc_lim,564598
|
||||
col2_guide,273591
|
||||
col2_maxaccel,0.833333333333333
|
||||
col2_maxdecel,0.833333333333333
|
||||
col2_maxspeed,0.833333333333333
|
||||
col2_mc,mc2
|
||||
col2_rev_enc_lim,9598
|
||||
col2_steps_per_x,150000
|
||||
col3_axis,C
|
||||
col3_axis_number,11
|
||||
col3_cnts_per_x,2048
|
||||
col3_description,Collimator Trans (Col SEG 3) VH
|
||||
col3_dflt_accel_steps,50000
|
||||
col3_dflt_decel_steps,50000
|
||||
col3_dflt_speed_steps,100000
|
||||
col3_empty,558462
|
||||
col3_fwd_enc_lim,578556
|
||||
col3_guide,287471
|
||||
col3_maxaccel,0.833333333333333
|
||||
col3_maxdecel,0.833333333333333
|
||||
col3_maxspeed,0.833333333333333
|
||||
col3_mc,mc2
|
||||
col3_rev_enc_lim,29466
|
||||
col3_steps_per_x,150000
|
||||
col4_axis,D
|
||||
col4_axis_number,12
|
||||
col4_cnts_per_x,4096
|
||||
col4_description,Collimator Trans (Col SEG 4) VH
|
||||
col4_dflt_accel_steps,50000
|
||||
col4_dflt_decel_steps,50000
|
||||
col4_dflt_speed_steps,100000
|
||||
col4_empty,1062105
|
||||
col4_fwd_enc_lim,1116447
|
||||
col4_guide,539261
|
||||
col4_maxaccel,0.833333333333333
|
||||
col4_maxdecel,0.833333333333333
|
||||
col4_maxspeed,0.833333333333333
|
||||
col4_mc,mc2
|
||||
col4_rev_enc_lim,12861
|
||||
col4_steps_per_x,150000
|
||||
col5_axis,E
|
||||
col5_axis_number,13
|
||||
col5_cnts_per_x,2048
|
||||
col5_description,Collimator Trans (Col SEG 5) VH
|
||||
col5_dflt_accel_steps,50000
|
||||
col5_dflt_decel_steps,50000
|
||||
col5_dflt_speed_steps,100000
|
||||
col5_empty,904072
|
||||
col5_fwd_enc_lim,928235
|
||||
col5_guide,644380
|
||||
col5_maxaccel,0.833333333333333
|
||||
col5_maxdecel,0.833333333333333
|
||||
col5_maxspeed,0.833333333333333
|
||||
col5_mc,mc2
|
||||
col5_rev_enc_lim,377801
|
||||
col5_steps_per_x,150000
|
||||
col6_axis,F
|
||||
col6_axis_number,14
|
||||
col6_cnts_per_x,2048
|
||||
col6_description,Collimator Trans (Col SEG 6) VH
|
||||
col6_dflt_accel_steps,50000
|
||||
col6_dflt_decel_steps,50000
|
||||
col6_dflt_speed_steps,100000
|
||||
col6_empty,721132
|
||||
col6_fwd_enc_lim,747130
|
||||
col6_guide,457285
|
||||
col6_maxaccel,0.833333333333333
|
||||
col6_maxdecel,0.833333333333333
|
||||
col6_maxspeed,0.833333333333333
|
||||
col6_mc,mc2
|
||||
col6_rev_enc_lim,191508
|
||||
col6_steps_per_x,150000
|
||||
col7_axis,G
|
||||
col7_axis_number,15
|
||||
col7_cnts_per_x,2048
|
||||
col7_description,Collimator Trans (Col SEG 7) VH
|
||||
col7_dflt_accel_steps,50000
|
||||
col7_dflt_decel_steps,50000
|
||||
col7_dflt_speed_steps,100000
|
||||
col7_empty,555984
|
||||
col7_fwd_enc_lim,577633
|
||||
col7_guide,288216
|
||||
col7_maxaccel,0.833333333333333
|
||||
col7_maxdecel,0.833333333333333
|
||||
col7_maxspeed,0.833333333333333
|
||||
col7_mc,mc2
|
||||
col7_rev_enc_lim,24810
|
||||
col7_steps_per_x,150000
|
||||
col8_axis,H
|
||||
col8_axis_number,16
|
||||
col8_cnts_per_x,2048
|
||||
col8_description,Collimator Trans (Col SEG 8) VH
|
||||
col8_dflt_accel_steps,50000
|
||||
col8_dflt_decel_steps,50000
|
||||
col8_dflt_speed_steps,100000
|
||||
col8_empty,538544
|
||||
col8_fwd_enc_lim,561091
|
||||
col8_guide,273474
|
||||
col8_maxaccel,0.833333333333333
|
||||
col8_maxdecel,0.833333333333333
|
||||
col8_maxspeed,0.833333333333333
|
||||
col8_mc,mc2
|
||||
col8_rev_enc_lim,12893
|
||||
col8_steps_per_x,150000
|
||||
det_axis,B
|
||||
det_axis_number,58
|
||||
det_cnts_per_x,524.288
|
||||
det_description,CURTAIN DETECTOR CARRIAGE Y TRANS
|
||||
det_dflt_accel_steps,25000
|
||||
det_dflt_decel_steps,25000
|
||||
det_dflt_speed_steps,100000
|
||||
det_fwd_enc_lim,0
|
||||
det_maxaccel,25
|
||||
det_maxdecel,25
|
||||
det_maxspeed,25
|
||||
det_mc,mc8
|
||||
det_rev_enc_lim,0
|
||||
det_steps_per_x,3900
|
||||
sdh_5a_in,1535698
|
||||
sdh_5b_in,3747542
|
||||
sdh_axis,B
|
||||
sdh_axis_number,26
|
||||
sdh_cnts_per_x,-12288
|
||||
sdh_description,SDH Box
|
||||
sdh_fwd_enc_lim,1189505
|
||||
sdh_mc,mc4
|
||||
sdh_rev_enc_lim,4166803
|
||||
sdh_steps_per_x,37500
|
||||
ss1d_axis,D
|
||||
ss1d_axis_number,20
|
||||
ss1d_cnts_per_x,-16384
|
||||
ss1d_description,Slit System 1 - Z DOWN
|
||||
ss1d_dflt_accel_steps,25000
|
||||
ss1d_dflt_decel_steps,25000
|
||||
ss1d_dflt_speed_steps,25000
|
||||
ss1d_fwd_enc_lim,31525131
|
||||
ss1d_maxaccel,1
|
||||
ss1d_maxdecel,1
|
||||
ss1d_maxspeed,1
|
||||
ss1d_mc,mc3
|
||||
ss1d_rev_enc_lim,33398312
|
||||
ss1d_steps_per_x,50000
|
||||
ss1l_axis,A
|
||||
ss1l_axis_number,17
|
||||
ss1l_cnts_per_x,16384
|
||||
ss1l_description,Slit System 1 - X WEST
|
||||
ss1l_dflt_accel_steps,25000
|
||||
ss1l_dflt_decel_steps,25000
|
||||
ss1l_dflt_speed_steps,25000
|
||||
ss1l_fwd_enc_lim,31524107
|
||||
ss1l_maxaccel,1
|
||||
ss1l_maxdecel,1
|
||||
ss1l_maxspeed,1
|
||||
ss1l_mc,mc3
|
||||
ss1l_rev_enc_lim,32637740
|
||||
ss1l_steps_per_x,-50000
|
||||
ss1r_axis,C
|
||||
ss1r_axis_number,19
|
||||
ss1r_cnts_per_x,16384
|
||||
ss1r_description,Slit System 1 - X EAST
|
||||
ss1r_dflt_accel_steps,25000
|
||||
ss1r_dflt_decel_steps,25000
|
||||
ss1r_dflt_speed_steps,25000
|
||||
ss1r_fwd_enc_lim,32248545
|
||||
ss1r_maxaccel,1
|
||||
ss1r_maxdecel,1
|
||||
ss1r_maxspeed,1
|
||||
ss1r_mc,mc3
|
||||
ss1r_rev_enc_lim,33421848
|
||||
ss1r_steps_per_x,-50000
|
||||
ss1u_axis,B
|
||||
ss1u_axis_number,18
|
||||
ss1u_cnts_per_x,-16384
|
||||
ss1u_description,Slit System 1 - Z UP
|
||||
ss1u_dflt_accel_steps,25000
|
||||
ss1u_dflt_decel_steps,25000
|
||||
ss1u_dflt_speed_steps,25000
|
||||
ss1u_fwd_enc_lim,31434607
|
||||
ss1u_maxaccel,1
|
||||
ss1u_maxdecel,1
|
||||
ss1u_maxspeed,1
|
||||
ss1u_mc,mc3
|
||||
ss1u_rev_enc_lim,33297987
|
||||
ss1u_steps_per_x,50000
|
||||
vs_axis,D
|
||||
vs_axis_number,28
|
||||
vs_cnts_per_x,-12288
|
||||
vs_description,Velocity Selector Trans
|
||||
vs_dflt_accel_steps,15000
|
||||
vs_dflt_decel_steps,50000
|
||||
vs_dflt_speed_steps,50000
|
||||
vs_fwd_enc_lim,406690
|
||||
vs_glass_in,741128
|
||||
vs_maxaccel,1.33333333333333
|
||||
vs_maxdecel,1.33333333333333
|
||||
vs_maxspeed,1.33333333333333
|
||||
vs_mc,mc4
|
||||
vs_rev_enc_lim,3789130
|
||||
vs_steps_per_x,37500
|
|
6
site_ansto/instrument/bilby/config/motors/README.TXT
Normal file
6
site_ansto/instrument/bilby/config/motors/README.TXT
Normal file
@ -0,0 +1,6 @@
|
||||
The generated_motor_configuration.tcl file was generated from the following CSV files,
|
||||
|
||||
Bilby_motion_control_commissioning_checklist.csv: Extracted from spreadsheet of the same name
|
||||
hdb_info.csv: Some parameters for hipadaba tree. Hand written.
|
||||
sicsmot_attlist.csv: Extra parameters generated by the genmotconf.tcl script to complete the motor configurations.
|
||||
userdef_attlist.csv: Parameters which were originally in sicsmot_attlist.csv but whose values have been changed from the defaults.
|
@ -0,0 +1,863 @@
|
||||
#### SICS motor driver configuration ####
|
||||
# Generated by: ../../../util/genmotconf.tcl Bilby_motion_control_commissioning_checklist.csv hdb_info.csv sicsmot_attlist.csv userdef_attlist.csv
|
||||
# Generated from the following files,
|
||||
# file1: Bilby_motion_control_commissioning_checklist.csv
|
||||
# file2: hdb_info.csv
|
||||
# file3: sicsmot_attlist.csv
|
||||
# file4: userdef_attlist.csv
|
||||
|
||||
# Load motor driver configuration parameters
|
||||
set flist [list\
|
||||
{Bilby_motion_control_commissioning_checklist.csv}\
|
||||
{hdb_info.csv}\
|
||||
{sicsmot_attlist.csv}\
|
||||
{userdef_attlist.csv}\
|
||||
]
|
||||
|
||||
foreach fattfile $flist {
|
||||
if [catch {
|
||||
set fattpath config/motors/$fattfile
|
||||
set fh [open $fattpath RDONLY]
|
||||
while {[gets $fh line] >= 0} {
|
||||
eval "set [split $line {,}]"
|
||||
}
|
||||
close $fh
|
||||
} msg] {
|
||||
clientput ERROR: $msg
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
set sim_mode [SplitReply [motor_simulation]]
|
||||
|
||||
if {$sim_mode == true} {
|
||||
set motor_driver_type asim
|
||||
} else {
|
||||
set motor_driver_type DMC2280
|
||||
}
|
||||
|
||||
if {$sim_mode == false} {
|
||||
MakeAsyncQueue mc1 DMC2280 [dict get $::MOTOR_HOSTPORT MC1 HOST] [dict get $::MOTOR_HOSTPORT MC1 PORT]
|
||||
MakeAsyncQueue mc2 DMC2280 [dict get $::MOTOR_HOSTPORT MC2 HOST] [dict get $::MOTOR_HOSTPORT MC2 PORT]
|
||||
MakeAsyncQueue mc3 DMC2280 [dict get $::MOTOR_HOSTPORT MC3 HOST] [dict get $::MOTOR_HOSTPORT MC3 PORT]
|
||||
MakeAsyncQueue mc4 DMC2280 [dict get $::MOTOR_HOSTPORT MC4 HOST] [dict get $::MOTOR_HOSTPORT MC4 PORT]
|
||||
MakeAsyncQueue mc6 DMC2280 [dict get $::MOTOR_HOSTPORT MC6 HOST] [dict get $::MOTOR_HOSTPORT MC6 PORT]
|
||||
MakeAsyncQueue mc8 DMC2280 [dict get $::MOTOR_HOSTPORT MC8 HOST] [dict get $::MOTOR_HOSTPORT MC8 PORT]
|
||||
}
|
||||
|
||||
# ap1 configuration
|
||||
# Aperture Selector (Collimator SEG 1 Start)
|
||||
# Axis number 1
|
||||
Motor ap1 $motor_driver_type [params\
|
||||
asyncqueue mc1\
|
||||
axis A\
|
||||
units $ap1_units\
|
||||
hardlowerlim $ap1_rev_lim\
|
||||
hardupperlim $ap1_fwd_lim\
|
||||
maxSpeed $ap1_maxspeed\
|
||||
maxAccel $ap1_maxaccel\
|
||||
maxDecel $ap1_maxdecel\
|
||||
stepsPerX $ap1_steps_per_x\
|
||||
posit_count 5\
|
||||
posit_1 $ap1_D10\
|
||||
posit_2 $ap1_D20\
|
||||
posit_3 $ap1_D40\
|
||||
posit_4 $ap1_40X40\
|
||||
posit_5 $ap1_100X40\
|
||||
absEnc 1\
|
||||
absEncHome $ap1_absenchome\
|
||||
cntsPerX $ap1_cnts_per_x]
|
||||
ap1 softlowerlim $ap1_rev_lim
|
||||
ap1 softupperlim $ap1_fwd_lim
|
||||
ap1 home $ap1_home
|
||||
ap1 part $ap1_part
|
||||
ap1 long_name ap1
|
||||
ap1 speed $ap1_speed
|
||||
ap1 accel $ap1_accel
|
||||
ap1 decel $ap1_decel
|
||||
|
||||
# ap2 configuration
|
||||
# Aperture Selector (COLLIMATION SEG 2)
|
||||
# Axis number 2
|
||||
Motor ap2 $motor_driver_type [params\
|
||||
asyncqueue mc1\
|
||||
axis B\
|
||||
units $ap2_units\
|
||||
hardlowerlim $ap2_rev_lim\
|
||||
hardupperlim $ap2_fwd_lim\
|
||||
maxSpeed $ap2_maxspeed\
|
||||
maxAccel $ap2_maxaccel\
|
||||
maxDecel $ap2_maxdecel\
|
||||
stepsPerX $ap2_steps_per_x\
|
||||
posit_count 5\
|
||||
posit_1 $ap2_D10\
|
||||
posit_2 $ap2_D20\
|
||||
posit_3 $ap2_D40\
|
||||
posit_4 $ap2_40X40\
|
||||
posit_5 $ap2_100X40\
|
||||
absEnc 1\
|
||||
absEncHome $ap2_absenchome\
|
||||
cntsPerX $ap2_cnts_per_x]
|
||||
ap2 softlowerlim $ap2_rev_lim
|
||||
ap2 softupperlim $ap2_fwd_lim
|
||||
ap2 home $ap2_home
|
||||
ap2 part $ap2_part
|
||||
ap2 long_name ap2
|
||||
ap2 speed $ap2_speed
|
||||
ap2 accel $ap2_accel
|
||||
ap2 decel $ap2_decel
|
||||
|
||||
# ap3 configuration
|
||||
# Aperture Selector (COLLIMATION SEG 3)
|
||||
# Axis number 3
|
||||
Motor ap3 $motor_driver_type [params\
|
||||
asyncqueue mc1\
|
||||
axis C\
|
||||
units $ap3_units\
|
||||
hardlowerlim $ap3_rev_lim\
|
||||
hardupperlim $ap3_fwd_lim\
|
||||
maxSpeed $ap3_maxspeed\
|
||||
maxAccel $ap3_maxaccel\
|
||||
maxDecel $ap3_maxdecel\
|
||||
stepsPerX $ap3_steps_per_x\
|
||||
posit_count 5\
|
||||
posit_1 $ap3_D10\
|
||||
posit_2 $ap3_D20\
|
||||
posit_3 $ap3_D40\
|
||||
posit_4 $ap3_40X40\
|
||||
posit_5 $ap3_100X40\
|
||||
absEnc 1\
|
||||
absEncHome $ap3_absenchome\
|
||||
cntsPerX $ap3_cnts_per_x]
|
||||
ap3 softlowerlim $ap3_rev_lim
|
||||
ap3 softupperlim $ap3_fwd_lim
|
||||
ap3 home $ap3_home
|
||||
ap3 part $ap3_part
|
||||
ap3 long_name ap3
|
||||
ap3 speed $ap3_speed
|
||||
ap3 accel $ap3_accel
|
||||
ap3 decel $ap3_decel
|
||||
|
||||
# ap4 configuration
|
||||
# Aperture Selector (COLLIMATION SEG 4)
|
||||
# Axis number 4
|
||||
Motor ap4 $motor_driver_type [params\
|
||||
asyncqueue mc1\
|
||||
axis D\
|
||||
units $ap4_units\
|
||||
hardlowerlim $ap4_rev_lim\
|
||||
hardupperlim $ap4_fwd_lim\
|
||||
maxSpeed $ap4_maxspeed\
|
||||
maxAccel $ap4_maxaccel\
|
||||
maxDecel $ap4_maxdecel\
|
||||
stepsPerX $ap4_steps_per_x\
|
||||
posit_count 5\
|
||||
posit_1 $ap4_D10\
|
||||
posit_2 $ap4_D20\
|
||||
posit_3 $ap4_D40\
|
||||
posit_4 $ap4_40X40\
|
||||
posit_5 $ap4_100X40\
|
||||
absEnc 1\
|
||||
absEncHome $ap4_absenchome\
|
||||
cntsPerX $ap4_cnts_per_x]
|
||||
ap4 softlowerlim $ap4_rev_lim
|
||||
ap4 softupperlim $ap4_fwd_lim
|
||||
ap4 home $ap4_home
|
||||
ap4 part $ap4_part
|
||||
ap4 long_name ap4
|
||||
ap4 speed $ap4_speed
|
||||
ap4 accel $ap4_accel
|
||||
ap4 decel $ap4_decel
|
||||
|
||||
# ap5 configuration
|
||||
# Aperture Selector (COLLIMATION SEG 5)
|
||||
# Axis number 5
|
||||
Motor ap5 $motor_driver_type [params\
|
||||
asyncqueue mc1\
|
||||
axis E\
|
||||
units $ap5_units\
|
||||
hardlowerlim $ap5_rev_lim\
|
||||
hardupperlim $ap5_fwd_lim\
|
||||
maxSpeed $ap5_maxspeed\
|
||||
maxAccel $ap5_maxaccel\
|
||||
maxDecel $ap5_maxdecel\
|
||||
stepsPerX $ap5_steps_per_x\
|
||||
posit_count 5\
|
||||
posit_1 $ap5_D10\
|
||||
posit_2 $ap5_D20\
|
||||
posit_3 $ap5_D40\
|
||||
posit_4 $ap5_40X40\
|
||||
posit_5 $ap5_100X40\
|
||||
absEnc 1\
|
||||
absEncHome $ap5_absenchome\
|
||||
cntsPerX $ap5_cnts_per_x]
|
||||
ap5 softlowerlim $ap5_rev_lim
|
||||
ap5 softupperlim $ap5_fwd_lim
|
||||
ap5 home $ap5_home
|
||||
ap5 part $ap5_part
|
||||
ap5 long_name ap5
|
||||
ap5 speed $ap5_speed
|
||||
ap5 accel $ap5_accel
|
||||
ap5 decel $ap5_decel
|
||||
|
||||
# ap6 configuration
|
||||
# Aperture Selector (COLLIMATION SEG 6)
|
||||
# Axis number 6
|
||||
Motor ap6 $motor_driver_type [params\
|
||||
asyncqueue mc1\
|
||||
axis F\
|
||||
units $ap6_units\
|
||||
hardlowerlim $ap6_rev_lim\
|
||||
hardupperlim $ap6_fwd_lim\
|
||||
maxSpeed $ap6_maxspeed\
|
||||
maxAccel $ap6_maxaccel\
|
||||
maxDecel $ap6_maxdecel\
|
||||
stepsPerX $ap6_steps_per_x\
|
||||
posit_count 5\
|
||||
posit_1 $ap6_D10\
|
||||
posit_2 $ap6_D20\
|
||||
posit_3 $ap6_D40\
|
||||
posit_4 $ap6_40X40\
|
||||
posit_5 $ap6_100X40\
|
||||
absEnc 1\
|
||||
absEncHome $ap6_absenchome\
|
||||
cntsPerX $ap6_cnts_per_x]
|
||||
ap6 softlowerlim $ap6_rev_lim
|
||||
ap6 softupperlim $ap6_fwd_lim
|
||||
ap6 home $ap6_home
|
||||
ap6 part $ap6_part
|
||||
ap6 long_name ap6
|
||||
ap6 speed $ap6_speed
|
||||
ap6 accel $ap6_accel
|
||||
ap6 decel $ap6_decel
|
||||
|
||||
# ap7 configuration
|
||||
# Aperture Selector (COLLIMATION SEG 7)
|
||||
# Axis number 7
|
||||
Motor ap7 $motor_driver_type [params\
|
||||
asyncqueue mc1\
|
||||
axis G\
|
||||
units $ap7_units\
|
||||
hardlowerlim $ap7_rev_lim\
|
||||
hardupperlim $ap7_fwd_lim\
|
||||
maxSpeed $ap7_maxspeed\
|
||||
maxAccel $ap7_maxaccel\
|
||||
maxDecel $ap7_maxdecel\
|
||||
stepsPerX $ap7_steps_per_x\
|
||||
posit_count 5\
|
||||
posit_1 $ap7_D10\
|
||||
posit_2 $ap7_D20\
|
||||
posit_3 $ap7_D40\
|
||||
posit_4 $ap7_40X40\
|
||||
posit_5 $ap7_100X40\
|
||||
absEnc 1\
|
||||
absEncHome $ap7_absenchome\
|
||||
cntsPerX $ap7_cnts_per_x]
|
||||
ap7 softlowerlim $ap7_rev_lim
|
||||
ap7 softupperlim $ap7_fwd_lim
|
||||
ap7 home $ap7_home
|
||||
ap7 part $ap7_part
|
||||
ap7 long_name ap7
|
||||
ap7 speed $ap7_speed
|
||||
ap7 accel $ap7_accel
|
||||
ap7 decel $ap7_decel
|
||||
|
||||
# ap8 configuration
|
||||
# Aperture Selector (Collimator SEG 8 End)
|
||||
# Axis number 8
|
||||
Motor ap8 $motor_driver_type [params\
|
||||
asyncqueue mc1\
|
||||
axis H\
|
||||
units $ap8_units\
|
||||
hardlowerlim $ap8_rev_lim\
|
||||
hardupperlim $ap8_fwd_lim\
|
||||
maxSpeed $ap8_maxspeed\
|
||||
maxAccel $ap8_maxaccel\
|
||||
maxDecel $ap8_maxdecel\
|
||||
stepsPerX $ap8_steps_per_x\
|
||||
posit_count 5\
|
||||
posit_1 $ap8_D10\
|
||||
posit_2 $ap8_D20\
|
||||
posit_3 $ap8_D40\
|
||||
posit_4 $ap8_40X40\
|
||||
posit_5 $ap8_100X40\
|
||||
absEnc 1\
|
||||
absEncHome $ap8_absenchome\
|
||||
cntsPerX $ap8_cnts_per_x]
|
||||
ap8 softlowerlim $ap8_rev_lim
|
||||
ap8 softupperlim $ap8_fwd_lim
|
||||
ap8 home $ap8_home
|
||||
ap8 part $ap8_part
|
||||
ap8 long_name ap8
|
||||
ap8 speed $ap8_speed
|
||||
ap8 accel $ap8_accel
|
||||
ap8 decel $ap8_decel
|
||||
|
||||
# att configuration
|
||||
# 4 Position linear Attenuator
|
||||
# Axis number 25
|
||||
Motor att $motor_driver_type [params\
|
||||
asyncqueue mc4\
|
||||
axis A\
|
||||
units $att_units\
|
||||
hardlowerlim $att_rev_lim\
|
||||
hardupperlim $att_fwd_lim\
|
||||
maxSpeed $att_maxspeed\
|
||||
maxAccel $att_maxaccel\
|
||||
maxDecel $att_maxdecel\
|
||||
stepsPerX $att_steps_per_x\
|
||||
posit_count 5\
|
||||
posit_1 $att_pos1\
|
||||
posit_2 $att_pos2\
|
||||
posit_3 $att_pos3\
|
||||
posit_4 $att_pos4\
|
||||
posit_5 $att_pos5\
|
||||
absEnc 1\
|
||||
absEncHome $att_absenchome\
|
||||
cntsPerX $att_cnts_per_x]
|
||||
att softlowerlim $att_rev_lim
|
||||
att softupperlim $att_fwd_lim
|
||||
att home $att_home
|
||||
att part $att_part
|
||||
att long_name att
|
||||
att speed $att_speed
|
||||
att accel $att_accel
|
||||
att decel $att_decel
|
||||
|
||||
# bs3 configuration
|
||||
# beam stop 3
|
||||
# Axis number 43
|
||||
Motor bs3 $motor_driver_type [params\
|
||||
asyncqueue mc6\
|
||||
axis C\
|
||||
units $bs3_units\
|
||||
hardlowerlim $bs3_rev_lim\
|
||||
hardupperlim $bs3_fwd_lim\
|
||||
maxSpeed $bs3_maxspeed\
|
||||
maxAccel $bs3_maxaccel\
|
||||
maxDecel $bs3_maxdecel\
|
||||
stepsPerX $bs3_steps_per_x\
|
||||
posit_count 0\
|
||||
absEnc 1\
|
||||
absEncHome $bs3_absenchome\
|
||||
cntsPerX $bs3_cnts_per_x]
|
||||
bs3 softlowerlim $bs3_rev_lim
|
||||
bs3 softupperlim $bs3_fwd_lim
|
||||
bs3 home $bs3_home
|
||||
bs3 part $bs3_part
|
||||
bs3 long_name bs3
|
||||
bs3 speed $bs3_speed
|
||||
bs3 accel $bs3_accel
|
||||
bs3 decel $bs3_decel
|
||||
|
||||
# cdd configuration
|
||||
# CURTAIN DETECTOR BOTTOM TRANSLATION
|
||||
# Axis number 62
|
||||
Motor cdd $motor_driver_type [params\
|
||||
asyncqueue mc8\
|
||||
axis F\
|
||||
units $cdd_units\
|
||||
hardlowerlim $cdd_rev_lim\
|
||||
hardupperlim $cdd_fwd_lim\
|
||||
maxSpeed $cdd_maxspeed\
|
||||
maxAccel $cdd_maxaccel\
|
||||
maxDecel $cdd_maxdecel\
|
||||
stepsPerX $cdd_steps_per_x\
|
||||
posit_count 0\
|
||||
absEnc 1\
|
||||
absEncHome $cdd_absenchome\
|
||||
cntsPerX $cdd_cnts_per_x]
|
||||
cdd softlowerlim $cdd_rev_lim
|
||||
cdd softupperlim $cdd_fwd_lim
|
||||
cdd home $cdd_home
|
||||
cdd part $cdd_part
|
||||
cdd long_name cdd
|
||||
cdd speed $cdd_speed
|
||||
cdd accel $cdd_accel
|
||||
cdd decel $cdd_decel
|
||||
|
||||
# cdl configuration
|
||||
# CURTAIN DETECTOR WEST TRANSLATION
|
||||
# Axis number 59
|
||||
Motor cdl $motor_driver_type [params\
|
||||
asyncqueue mc8\
|
||||
axis C\
|
||||
units $cdl_units\
|
||||
hardlowerlim $cdl_rev_lim\
|
||||
hardupperlim $cdl_fwd_lim\
|
||||
maxSpeed $cdl_maxspeed\
|
||||
maxAccel $cdl_maxaccel\
|
||||
maxDecel $cdl_maxdecel\
|
||||
stepsPerX $cdl_steps_per_x\
|
||||
posit_count 0\
|
||||
absEnc 1\
|
||||
absEncHome $cdl_absenchome\
|
||||
cntsPerX $cdl_cnts_per_x]
|
||||
cdl softlowerlim $cdl_rev_lim
|
||||
cdl softupperlim $cdl_fwd_lim
|
||||
cdl home $cdl_home
|
||||
cdl part $cdl_part
|
||||
cdl long_name cdl
|
||||
cdl speed $cdl_speed
|
||||
cdl accel $cdl_accel
|
||||
cdl decel $cdl_decel
|
||||
|
||||
# cdr configuration
|
||||
# CURTAIN DETECTOR EAST TRANSLATION
|
||||
# Axis number 60
|
||||
Motor cdr $motor_driver_type [params\
|
||||
asyncqueue mc8\
|
||||
axis D\
|
||||
units $cdr_units\
|
||||
hardlowerlim $cdr_rev_lim\
|
||||
hardupperlim $cdr_fwd_lim\
|
||||
maxSpeed $cdr_maxspeed\
|
||||
maxAccel $cdr_maxaccel\
|
||||
maxDecel $cdr_maxdecel\
|
||||
stepsPerX $cdr_steps_per_x\
|
||||
posit_count 0\
|
||||
absEnc 1\
|
||||
absEncHome $cdr_absenchome\
|
||||
cntsPerX $cdr_cnts_per_x]
|
||||
cdr softlowerlim $cdr_rev_lim
|
||||
cdr softupperlim $cdr_fwd_lim
|
||||
cdr home $cdr_home
|
||||
cdr part $cdr_part
|
||||
cdr long_name cdr
|
||||
cdr speed $cdr_speed
|
||||
cdr accel $cdr_accel
|
||||
cdr decel $cdr_decel
|
||||
|
||||
# cdu configuration
|
||||
# CURTAIN DETECTOR TOP TRANSLATION
|
||||
# Axis number 61
|
||||
Motor cdu $motor_driver_type [params\
|
||||
asyncqueue mc8\
|
||||
axis E\
|
||||
units $cdu_units\
|
||||
hardlowerlim $cdu_rev_lim\
|
||||
hardupperlim $cdu_fwd_lim\
|
||||
maxSpeed $cdu_maxspeed\
|
||||
maxAccel $cdu_maxaccel\
|
||||
maxDecel $cdu_maxdecel\
|
||||
stepsPerX $cdu_steps_per_x\
|
||||
posit_count 0\
|
||||
absEnc 1\
|
||||
absEncHome $cdu_absenchome\
|
||||
cntsPerX $cdu_cnts_per_x]
|
||||
cdu softlowerlim $cdu_rev_lim
|
||||
cdu softupperlim $cdu_fwd_lim
|
||||
cdu home $cdu_home
|
||||
cdu part $cdu_part
|
||||
cdu long_name cdu
|
||||
cdu speed $cdu_speed
|
||||
cdu accel $cdu_accel
|
||||
cdu decel $cdu_decel
|
||||
|
||||
# col1 configuration
|
||||
# Collimator Trans (Col SEG 1) VH
|
||||
# Axis number 9
|
||||
Motor col1 $motor_driver_type [params\
|
||||
asyncqueue mc2\
|
||||
axis A\
|
||||
units $col1_units\
|
||||
hardlowerlim $col1_rev_lim\
|
||||
hardupperlim $col1_fwd_lim\
|
||||
maxSpeed $col1_maxspeed\
|
||||
maxAccel $col1_maxaccel\
|
||||
maxDecel $col1_maxdecel\
|
||||
stepsPerX $col1_steps_per_x\
|
||||
posit_count 2\
|
||||
posit_1 $col1_guide\
|
||||
posit_2 $col1_empty\
|
||||
absEnc 1\
|
||||
absEncHome $col1_absenchome\
|
||||
cntsPerX $col1_cnts_per_x]
|
||||
col1 softlowerlim $col1_rev_lim
|
||||
col1 softupperlim $col1_fwd_lim
|
||||
col1 home $col1_home
|
||||
col1 part $col1_part
|
||||
col1 long_name col1
|
||||
col1 speed $col1_speed
|
||||
col1 accel $col1_accel
|
||||
col1 decel $col1_decel
|
||||
|
||||
# col2 configuration
|
||||
# Collimator Trans (Col SEG 2) VH
|
||||
# Axis number 10
|
||||
Motor col2 $motor_driver_type [params\
|
||||
asyncqueue mc2\
|
||||
axis B\
|
||||
units $col2_units\
|
||||
hardlowerlim $col2_rev_lim\
|
||||
hardupperlim $col2_fwd_lim\
|
||||
maxSpeed $col2_maxspeed\
|
||||
maxAccel $col2_maxaccel\
|
||||
maxDecel $col2_maxdecel\
|
||||
stepsPerX $col2_steps_per_x\
|
||||
posit_count 2\
|
||||
posit_1 $col2_guide\
|
||||
posit_2 $col2_empty\
|
||||
absEnc 1\
|
||||
absEncHome $col2_absenchome\
|
||||
cntsPerX $col2_cnts_per_x]
|
||||
col2 softlowerlim $col2_rev_lim
|
||||
col2 softupperlim $col2_fwd_lim
|
||||
col2 home $col2_home
|
||||
col2 part $col2_part
|
||||
col2 long_name col2
|
||||
col2 speed $col2_speed
|
||||
col2 accel $col2_accel
|
||||
col2 decel $col2_decel
|
||||
|
||||
# col3 configuration
|
||||
# Collimator Trans (Col SEG 3) VH
|
||||
# Axis number 11
|
||||
Motor col3 $motor_driver_type [params\
|
||||
asyncqueue mc2\
|
||||
axis C\
|
||||
units $col3_units\
|
||||
hardlowerlim $col3_rev_lim\
|
||||
hardupperlim $col3_fwd_lim\
|
||||
maxSpeed $col3_maxspeed\
|
||||
maxAccel $col3_maxaccel\
|
||||
maxDecel $col3_maxdecel\
|
||||
stepsPerX $col3_steps_per_x\
|
||||
posit_count 2\
|
||||
posit_1 $col3_guide\
|
||||
posit_2 $col3_empty\
|
||||
absEnc 1\
|
||||
absEncHome $col3_absenchome\
|
||||
cntsPerX $col3_cnts_per_x]
|
||||
col3 softlowerlim $col3_rev_lim
|
||||
col3 softupperlim $col3_fwd_lim
|
||||
col3 home $col3_home
|
||||
col3 part $col3_part
|
||||
col3 long_name col3
|
||||
col3 speed $col3_speed
|
||||
col3 accel $col3_accel
|
||||
col3 decel $col3_decel
|
||||
|
||||
# col4 configuration
|
||||
# Collimator Trans (Col SEG 4) VH
|
||||
# Axis number 12
|
||||
Motor col4 $motor_driver_type [params\
|
||||
asyncqueue mc2\
|
||||
axis D\
|
||||
units $col4_units\
|
||||
hardlowerlim $col4_rev_lim\
|
||||
hardupperlim $col4_fwd_lim\
|
||||
maxSpeed $col4_maxspeed\
|
||||
maxAccel $col4_maxaccel\
|
||||
maxDecel $col4_maxdecel\
|
||||
stepsPerX $col4_steps_per_x\
|
||||
posit_count 2\
|
||||
posit_1 $col4_guide\
|
||||
posit_2 $col4_empty\
|
||||
absEnc 1\
|
||||
absEncHome $col4_absenchome\
|
||||
cntsPerX $col4_cnts_per_x]
|
||||
col4 softlowerlim $col4_rev_lim
|
||||
col4 softupperlim $col4_fwd_lim
|
||||
col4 home $col4_home
|
||||
col4 part $col4_part
|
||||
col4 long_name col4
|
||||
col4 speed $col4_speed
|
||||
col4 accel $col4_accel
|
||||
col4 decel $col4_decel
|
||||
|
||||
# col5 configuration
|
||||
# Collimator Trans (Col SEG 5) VH
|
||||
# Axis number 13
|
||||
Motor col5 $motor_driver_type [params\
|
||||
asyncqueue mc2\
|
||||
axis E\
|
||||
units $col5_units\
|
||||
hardlowerlim $col5_rev_lim\
|
||||
hardupperlim $col5_fwd_lim\
|
||||
maxSpeed $col5_maxspeed\
|
||||
maxAccel $col5_maxaccel\
|
||||
maxDecel $col5_maxdecel\
|
||||
stepsPerX $col5_steps_per_x\
|
||||
posit_count 2\
|
||||
posit_1 $col5_guide\
|
||||
posit_2 $col5_empty\
|
||||
absEnc 1\
|
||||
absEncHome $col5_absenchome\
|
||||
cntsPerX $col5_cnts_per_x]
|
||||
col5 softlowerlim $col5_rev_lim
|
||||
col5 softupperlim $col5_fwd_lim
|
||||
col5 home $col5_home
|
||||
col5 part $col5_part
|
||||
col5 long_name col5
|
||||
col5 speed $col5_speed
|
||||
col5 accel $col5_accel
|
||||
col5 decel $col5_decel
|
||||
|
||||
# col6 configuration
|
||||
# Collimator Trans (Col SEG 6) VH
|
||||
# Axis number 14
|
||||
Motor col6 $motor_driver_type [params\
|
||||
asyncqueue mc2\
|
||||
axis F\
|
||||
units $col6_units\
|
||||
hardlowerlim $col6_rev_lim\
|
||||
hardupperlim $col6_fwd_lim\
|
||||
maxSpeed $col6_maxspeed\
|
||||
maxAccel $col6_maxaccel\
|
||||
maxDecel $col6_maxdecel\
|
||||
stepsPerX $col6_steps_per_x\
|
||||
posit_count 2\
|
||||
posit_1 $col6_guide\
|
||||
posit_2 $col6_empty\
|
||||
absEnc 1\
|
||||
absEncHome $col6_absenchome\
|
||||
cntsPerX $col6_cnts_per_x]
|
||||
col6 softlowerlim $col6_rev_lim
|
||||
col6 softupperlim $col6_fwd_lim
|
||||
col6 home $col6_home
|
||||
col6 part $col6_part
|
||||
col6 long_name col6
|
||||
col6 speed $col6_speed
|
||||
col6 accel $col6_accel
|
||||
col6 decel $col6_decel
|
||||
|
||||
# col7 configuration
|
||||
# Collimator Trans (Col SEG 7) VH
|
||||
# Axis number 15
|
||||
Motor col7 $motor_driver_type [params\
|
||||
asyncqueue mc2\
|
||||
axis G\
|
||||
units $col7_units\
|
||||
hardlowerlim $col7_rev_lim\
|
||||
hardupperlim $col7_fwd_lim\
|
||||
maxSpeed $col7_maxspeed\
|
||||
maxAccel $col7_maxaccel\
|
||||
maxDecel $col7_maxdecel\
|
||||
stepsPerX $col7_steps_per_x\
|
||||
posit_count 2\
|
||||
posit_1 $col7_guide\
|
||||
posit_2 $col7_empty\
|
||||
absEnc 1\
|
||||
absEncHome $col7_absenchome\
|
||||
cntsPerX $col7_cnts_per_x]
|
||||
col7 softlowerlim $col7_rev_lim
|
||||
col7 softupperlim $col7_fwd_lim
|
||||
col7 home $col7_home
|
||||
col7 part $col7_part
|
||||
col7 long_name col7
|
||||
col7 speed $col7_speed
|
||||
col7 accel $col7_accel
|
||||
col7 decel $col7_decel
|
||||
|
||||
# col8 configuration
|
||||
# Collimator Trans (Col SEG 8) VH
|
||||
# Axis number 16
|
||||
Motor col8 $motor_driver_type [params\
|
||||
asyncqueue mc2\
|
||||
axis H\
|
||||
units $col8_units\
|
||||
hardlowerlim $col8_rev_lim\
|
||||
hardupperlim $col8_fwd_lim\
|
||||
maxSpeed $col8_maxspeed\
|
||||
maxAccel $col8_maxaccel\
|
||||
maxDecel $col8_maxdecel\
|
||||
stepsPerX $col8_steps_per_x\
|
||||
posit_count 2\
|
||||
posit_1 $col8_guide\
|
||||
posit_2 $col8_empty\
|
||||
absEnc 1\
|
||||
absEncHome $col8_absenchome\
|
||||
cntsPerX $col8_cnts_per_x]
|
||||
col8 softlowerlim $col8_rev_lim
|
||||
col8 softupperlim $col8_fwd_lim
|
||||
col8 home $col8_home
|
||||
col8 part $col8_part
|
||||
col8 long_name col8
|
||||
col8 speed $col8_speed
|
||||
col8 accel $col8_accel
|
||||
col8 decel $col8_decel
|
||||
|
||||
# det configuration
|
||||
# CURTAIN DETECTOR CARRIAGE Y TRANS
|
||||
# Axis number 58
|
||||
Motor det $motor_driver_type [params\
|
||||
asyncqueue mc8\
|
||||
axis B\
|
||||
units $det_units\
|
||||
hardlowerlim $det_rev_lim\
|
||||
hardupperlim $det_fwd_lim\
|
||||
maxSpeed $det_maxspeed\
|
||||
maxAccel $det_maxaccel\
|
||||
maxDecel $det_maxdecel\
|
||||
stepsPerX $det_steps_per_x\
|
||||
posit_count 0\
|
||||
absEnc 1\
|
||||
absEncHome $det_absenchome\
|
||||
cntsPerX $det_cnts_per_x]
|
||||
det softlowerlim $det_rev_lim
|
||||
det softupperlim $det_fwd_lim
|
||||
det home $det_home
|
||||
det part $det_part
|
||||
det long_name det
|
||||
det speed $det_speed
|
||||
det accel $det_accel
|
||||
det decel $det_decel
|
||||
|
||||
# sdh configuration
|
||||
# SDH Box
|
||||
# Axis number 26
|
||||
Motor sdh $motor_driver_type [params\
|
||||
asyncqueue mc4\
|
||||
axis B\
|
||||
units $sdh_units\
|
||||
hardlowerlim $sdh_rev_lim\
|
||||
hardupperlim $sdh_fwd_lim\
|
||||
maxSpeed $sdh_maxspeed\
|
||||
maxAccel $sdh_maxaccel\
|
||||
maxDecel $sdh_maxdecel\
|
||||
stepsPerX $sdh_steps_per_x\
|
||||
posit_count 2\
|
||||
posit_1 $sdh_5b_in\
|
||||
posit_2 $sdh_5a_in\
|
||||
absEnc 1\
|
||||
absEncHome $sdh_absenchome\
|
||||
cntsPerX $sdh_cnts_per_x]
|
||||
sdh softlowerlim $sdh_rev_lim
|
||||
sdh softupperlim $sdh_fwd_lim
|
||||
sdh home $sdh_home
|
||||
sdh part $sdh_part
|
||||
sdh long_name sdh
|
||||
|
||||
# ss1d configuration
|
||||
# Slit System 1 - Z DOWN
|
||||
# Axis number 20
|
||||
Motor ss1d $motor_driver_type [params\
|
||||
asyncqueue mc3\
|
||||
axis D\
|
||||
units $ss1d_units\
|
||||
hardlowerlim $ss1d_rev_lim\
|
||||
hardupperlim $ss1d_fwd_lim\
|
||||
maxSpeed $ss1d_maxspeed\
|
||||
maxAccel $ss1d_maxaccel\
|
||||
maxDecel $ss1d_maxdecel\
|
||||
stepsPerX $ss1d_steps_per_x\
|
||||
posit_count 0\
|
||||
absEnc 1\
|
||||
absEncHome $ss1d_absenchome\
|
||||
cntsPerX $ss1d_cnts_per_x]
|
||||
ss1d softlowerlim $ss1d_rev_lim
|
||||
ss1d softupperlim $ss1d_fwd_lim
|
||||
ss1d home $ss1d_home
|
||||
ss1d part $ss1d_part
|
||||
ss1d long_name ss1d
|
||||
ss1d speed $ss1d_speed
|
||||
ss1d accel $ss1d_accel
|
||||
ss1d decel $ss1d_decel
|
||||
|
||||
# ss1l configuration
|
||||
# Slit System 1 - X WEST
|
||||
# Axis number 17
|
||||
Motor ss1l $motor_driver_type [params\
|
||||
asyncqueue mc3\
|
||||
axis A\
|
||||
units $ss1l_units\
|
||||
hardlowerlim $ss1l_rev_lim\
|
||||
hardupperlim $ss1l_fwd_lim\
|
||||
maxSpeed $ss1l_maxspeed\
|
||||
maxAccel $ss1l_maxaccel\
|
||||
maxDecel $ss1l_maxdecel\
|
||||
stepsPerX $ss1l_steps_per_x\
|
||||
posit_count 0\
|
||||
absEnc 1\
|
||||
absEncHome $ss1l_absenchome\
|
||||
cntsPerX $ss1l_cnts_per_x]
|
||||
ss1l softlowerlim $ss1l_rev_lim
|
||||
ss1l softupperlim $ss1l_fwd_lim
|
||||
ss1l home $ss1l_home
|
||||
ss1l part $ss1l_part
|
||||
ss1l long_name ss1l
|
||||
ss1l speed $ss1l_speed
|
||||
ss1l accel $ss1l_accel
|
||||
ss1l decel $ss1l_decel
|
||||
|
||||
# ss1r configuration
|
||||
# Slit System 1 - X EAST
|
||||
# Axis number 19
|
||||
Motor ss1r $motor_driver_type [params\
|
||||
asyncqueue mc3\
|
||||
axis C\
|
||||
units $ss1r_units\
|
||||
hardlowerlim $ss1r_rev_lim\
|
||||
hardupperlim $ss1r_fwd_lim\
|
||||
maxSpeed $ss1r_maxspeed\
|
||||
maxAccel $ss1r_maxaccel\
|
||||
maxDecel $ss1r_maxdecel\
|
||||
stepsPerX $ss1r_steps_per_x\
|
||||
posit_count 0\
|
||||
absEnc 1\
|
||||
absEncHome $ss1r_absenchome\
|
||||
cntsPerX $ss1r_cnts_per_x]
|
||||
ss1r softlowerlim $ss1r_rev_lim
|
||||
ss1r softupperlim $ss1r_fwd_lim
|
||||
ss1r home $ss1r_home
|
||||
ss1r part $ss1r_part
|
||||
ss1r long_name ss1r
|
||||
ss1r speed $ss1r_speed
|
||||
ss1r accel $ss1r_accel
|
||||
ss1r decel $ss1r_decel
|
||||
|
||||
# ss1u configuration
|
||||
# Slit System 1 - Z UP
|
||||
# Axis number 18
|
||||
Motor ss1u $motor_driver_type [params\
|
||||
asyncqueue mc3\
|
||||
axis B\
|
||||
units $ss1u_units\
|
||||
hardlowerlim $ss1u_rev_lim\
|
||||
hardupperlim $ss1u_fwd_lim\
|
||||
maxSpeed $ss1u_maxspeed\
|
||||
maxAccel $ss1u_maxaccel\
|
||||
maxDecel $ss1u_maxdecel\
|
||||
stepsPerX $ss1u_steps_per_x\
|
||||
posit_count 0\
|
||||
absEnc 1\
|
||||
absEncHome $ss1u_absenchome\
|
||||
cntsPerX $ss1u_cnts_per_x]
|
||||
ss1u softlowerlim $ss1u_rev_lim
|
||||
ss1u softupperlim $ss1u_fwd_lim
|
||||
ss1u home $ss1u_home
|
||||
ss1u part $ss1u_part
|
||||
ss1u long_name ss1u
|
||||
ss1u speed $ss1u_speed
|
||||
ss1u accel $ss1u_accel
|
||||
ss1u decel $ss1u_decel
|
||||
|
||||
# vs configuration
|
||||
# Velocity Selector Trans
|
||||
# Axis number 28
|
||||
Motor vs $motor_driver_type [params\
|
||||
asyncqueue mc4\
|
||||
axis D\
|
||||
units $vs_units\
|
||||
hardlowerlim $vs_rev_lim\
|
||||
hardupperlim $vs_fwd_lim\
|
||||
maxSpeed $vs_maxspeed\
|
||||
maxAccel $vs_maxaccel\
|
||||
maxDecel $vs_maxdecel\
|
||||
stepsPerX $vs_steps_per_x\
|
||||
posit_count 1\
|
||||
posit_1 $vs_glass_in\
|
||||
absEnc 1\
|
||||
absEncHome $vs_absenchome\
|
||||
cntsPerX $vs_cnts_per_x]
|
||||
vs softlowerlim $vs_rev_lim
|
||||
vs softupperlim $vs_fwd_lim
|
||||
vs home $vs_home
|
||||
vs part $vs_part
|
||||
vs long_name vs
|
||||
vs speed $vs_speed
|
||||
vs accel $vs_accel
|
||||
vs decel $vs_decel
|
||||
|
||||
proc motor_set_sobj_attributes {} {}
|
88
site_ansto/instrument/bilby/config/motors/hdb_info.csv
Normal file
88
site_ansto/instrument/bilby/config/motors/hdb_info.csv
Normal file
@ -0,0 +1,88 @@
|
||||
ap1_part,collimator
|
||||
ap1_units,degrees
|
||||
ap2_part,collimator
|
||||
ap2_units,degrees
|
||||
ap3_part,collimator
|
||||
ap3_units,degrees
|
||||
ap4_part,collimator
|
||||
ap4_units,degrees
|
||||
ap5_part,collimator
|
||||
ap5_units,degrees
|
||||
ap6_part,collimator
|
||||
ap6_units,degrees
|
||||
ap7_part,collimator
|
||||
ap7_units,degrees
|
||||
ap8_part,collimator
|
||||
ap8_units,degrees
|
||||
att_part,instrument
|
||||
att_units,mm
|
||||
bs1_part,detector
|
||||
bs1_units,degrees
|
||||
bs2_part,detector
|
||||
bs2_units,degrees
|
||||
bs3_part,detector
|
||||
bs3_units,degrees
|
||||
cdd_part,detector
|
||||
cdd_units,mm
|
||||
cdl_part,detector
|
||||
cdl_units,mm
|
||||
cdr_part,detector
|
||||
cdr_units,mm
|
||||
cdu_part,detector
|
||||
cdu_units,mm
|
||||
col1_part,collimator
|
||||
col1_units,mm
|
||||
col2_part,collimator
|
||||
col2_units,mm
|
||||
col3_part,collimator
|
||||
col3_units,mm
|
||||
col4_part,collimator
|
||||
col4_units,mm
|
||||
col5_part,collimator
|
||||
col5_units,mm
|
||||
col6_part,collimator
|
||||
col6_units,mm
|
||||
col7_part,collimator
|
||||
col7_units,mm
|
||||
col8_part,collimator
|
||||
col8_units,mm
|
||||
det_part,detector
|
||||
det_units,mm
|
||||
mdy_part,detector
|
||||
mdy_units,mm
|
||||
mirr1_part,disk_chopper
|
||||
mirr1_units,xxx
|
||||
mirr2_part,disk_chopper
|
||||
mirr2_units,xxx
|
||||
sap_part,sample
|
||||
sap_units,mm
|
||||
schi_part,sample
|
||||
schi_units,degrees
|
||||
sdh_part,instrument
|
||||
sdh_units,mm
|
||||
som_part,sample
|
||||
som_units,degrees
|
||||
sphi_part,sample
|
||||
sphi_units,degrees
|
||||
ss1d_part,collimator
|
||||
ss1d_units,mm
|
||||
ss1l_part,collimator
|
||||
ss1l_units,mm
|
||||
ss1r_part,collimator
|
||||
ss1r_units,mm
|
||||
ss1u_part,collimator
|
||||
ss1u_units,mm
|
||||
ss2d_part,collimator
|
||||
ss2d_units,mm
|
||||
ss2l_part,collimator
|
||||
ss2l_units,mm
|
||||
ss2r_part,collimator
|
||||
ss2r_units,mm
|
||||
ss2u_part,collimator
|
||||
ss2u_units,mm
|
||||
sx_part,sample
|
||||
sx_units,mm
|
||||
sy_part,sample
|
||||
sy_units,mm
|
||||
vs_part,instrument
|
||||
vs_units,mm
|
|
@ -0,0 +1,23 @@
|
||||
# @file Loads the generated_motor_configuration.tcl file which is created by util/genmotconf.tcl from CSV files.
|
||||
fileeval config/motors/generated_motor_configuration.tcl
|
||||
fileeval config/motors/sct_shutters.tcl
|
||||
fileeval config/motors/sct_tank.tcl
|
||||
add_shutters shutters aqadapter mc4
|
||||
add_tank tank aqadapter mc8
|
||||
# Motors which should not be driven should be set as "fixed" here.
|
||||
# Configurable virtual motors can be defined here.
|
||||
# Eg, mot fixed 1
|
||||
# Define "proc motor_set_sobj_attributes {}" if we need to define extra sicslist attributes for some motors.
|
||||
|
||||
for {set n 1} {$n <= 8} {incr n} {
|
||||
make_coll_motor_1 c$n c$n col$n count
|
||||
make_coll_motor_1 a$n a$n ap$n count
|
||||
}
|
||||
|
||||
# Make a position-motor for the attenuator
|
||||
make_coll_motor_1 att_pos att_pos att count
|
||||
sicslist setatt att_pos klass instrument
|
||||
|
||||
# make gap/offset motors for the slits
|
||||
make_gap_motors ss1hg gap ss1ho offset ss1r ss1l mm first/horizontal
|
||||
make_gap_motors ss1vg gap ss1vo offset ss1u ss1d mm first/vertical
|
317
site_ansto/instrument/bilby/config/motors/sct_shutters.tcl
Normal file
317
site_ansto/instrument/bilby/config/motors/sct_shutters.tcl
Normal file
@ -0,0 +1,317 @@
|
||||
# Generated driver for shutters
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::shutters {
|
||||
set debug_threshold 0
|
||||
}
|
||||
|
||||
proc ::scobj::shutters::debug_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
if {${debug_level} >= ${::scobj::shutters::debug_threshold}} {
|
||||
set fd [open "/tmp/shutters.log" "a"]
|
||||
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
|
||||
puts ${fd} "${line}"
|
||||
close ${fd}
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
# check function for hset change
|
||||
proc ::scobj::shutters::checkrange {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]"
|
||||
set setpoint [sct target]
|
||||
if { [hpropexists [sct] lowerlimit] } {
|
||||
set lolimit [sct lowerlimit]
|
||||
} else {
|
||||
# lowerlimit not set, use target
|
||||
set lolimit [sct target]
|
||||
}
|
||||
if { [hpropexists [sct] upperlimit] } {
|
||||
set hilimit [sct upperlimit]
|
||||
} else {
|
||||
# upperlimit not set, use target
|
||||
set hilimit [sct target]
|
||||
}
|
||||
# hook code goes here
|
||||
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
|
||||
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
|
||||
}
|
||||
return OK
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to request the read of a parameter on a device
|
||||
proc ::scobj::shutters::getValue {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set cmd "${cmd_str}"
|
||||
# hook code goes here
|
||||
debug_log 1 "getValue sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to check the write parameter on a device
|
||||
proc ::scobj::shutters::noResponse {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
|
||||
# hook code goes here
|
||||
return "idle"
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to parse the read of a parameter on a device
|
||||
proc ::scobj::shutters::read_switch_pair {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "read_switch_pair tc_root=${tc_root} sct=[sct] result=[sct result]"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set data [sct result]
|
||||
set nextState "idle"
|
||||
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
|
||||
# the protocol driver has reported an error
|
||||
sct geterror "${data}"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
# hook code starts
|
||||
if { [string equal -nocase -length 1 "${data}" "?"] } {
|
||||
sct geterror "Galil error in: '${data}'"
|
||||
} else {
|
||||
set data_list [split [string trim "${data}"]]
|
||||
if { [llength ${data_list}] > 2 && [lindex ${data_list} end] == ":" } {
|
||||
set data_list [lrange ${data_list} 0 1]
|
||||
}
|
||||
if { [llength ${data_list}] == 2 } {
|
||||
set left [expr [lindex ${data_list} 0]]
|
||||
set right [expr [lindex ${data_list} 1]]
|
||||
if { ${left} == 1 && ${right} == 0 } { # open
|
||||
set data "out"
|
||||
} elseif { ${left} == 0 && ${right} == 1 } { # closed
|
||||
set data "in"
|
||||
} else { # indeterminate
|
||||
set data "moving"
|
||||
}
|
||||
} else {
|
||||
sct geterror "Syntax error in: '${data}'=>'${data_list}'"
|
||||
}
|
||||
}
|
||||
# hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log 1 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
if { ${data} != [sct oldval] } {
|
||||
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to write a parameter value on a device
|
||||
proc ::scobj::shutters::setValue {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set par [sct target]
|
||||
set cmd "${cmd_str}${par}"
|
||||
# hook code goes here
|
||||
if { [hpropexists [sct] driving] } {
|
||||
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
|
||||
sct driving 1
|
||||
}
|
||||
}
|
||||
debug_log 1 "setValue sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to write a parameter value on a device
|
||||
proc ::scobj::shutters::write_switch {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "write_switch tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set par [sct target]
|
||||
set cmd "${cmd_str}${par}"
|
||||
# hook code starts
|
||||
if { [string equal -nocase -length 2 "${par}" "in"] } {
|
||||
set cmd "SB${cmd_str}"
|
||||
} elseif { [string equal -nocase -length 2 "${par}" "out"] } {
|
||||
set cmd "CB${cmd_str}"
|
||||
} else {
|
||||
sct geterror "Value error: '${par}' not in ('in', 'out')"
|
||||
}
|
||||
# hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log 1 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
if { [hpropexists [sct] driving] } {
|
||||
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
|
||||
sct driving 1
|
||||
}
|
||||
}
|
||||
debug_log 1 "write_switch sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
proc ::scobj::shutters::mk_sct_shutters { sct_controller name } {
|
||||
debug_log 1 "mk_sct_shutters for ${name}"
|
||||
set ns "[namespace current]"
|
||||
set catch_status [ catch {
|
||||
|
||||
MakeSICSObj ${name} SCT_OBJECT
|
||||
|
||||
sicslist setatt ${name} klass instrument
|
||||
sicslist setatt ${name} long_name ${name}
|
||||
|
||||
set scobj_hpath /sics/${name}
|
||||
|
||||
hfactory ${scobj_hpath}/fast_shutter plain user text
|
||||
hsetprop ${scobj_hpath}/fast_shutter read ${ns}::getValue ${scobj_hpath} read_switch_pair {MG @IN[5], @IN[6]}
|
||||
hsetprop ${scobj_hpath}/fast_shutter read_switch_pair ${ns}::read_switch_pair ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/fast_shutter control true
|
||||
hsetprop ${scobj_hpath}/fast_shutter data true
|
||||
hsetprop ${scobj_hpath}/fast_shutter mutable false
|
||||
hsetprop ${scobj_hpath}/fast_shutter nxsave true
|
||||
hsetprop ${scobj_hpath}/fast_shutter oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/fast_shutter klass "collimator"
|
||||
hsetprop ${scobj_hpath}/fast_shutter nxalias "fast_shutter"
|
||||
hsetprop ${scobj_hpath}/fast_shutter sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/fast_shutter type "part"
|
||||
|
||||
hfactory ${scobj_hpath}/rough_100 plain user text
|
||||
hsetprop ${scobj_hpath}/rough_100 read ${ns}::getValue ${scobj_hpath} read_switch_pair {MG @IN[15], @IN[16]}
|
||||
hsetprop ${scobj_hpath}/rough_100 read_switch_pair ${ns}::read_switch_pair ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/rough_100 write ${ns}::write_switch ${scobj_hpath} noResponse {11}
|
||||
hsetprop ${scobj_hpath}/rough_100 noResponse ${ns}::noResponse ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/rough_100 check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/rough_100 control true
|
||||
hsetprop ${scobj_hpath}/rough_100 data true
|
||||
hsetprop ${scobj_hpath}/rough_100 mutable false
|
||||
hsetprop ${scobj_hpath}/rough_100 nxsave true
|
||||
hsetprop ${scobj_hpath}/rough_100 values in,out
|
||||
hsetprop ${scobj_hpath}/rough_100 oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/rough_100 klass "collimator"
|
||||
hsetprop ${scobj_hpath}/rough_100 nxalias "rough_100"
|
||||
hsetprop ${scobj_hpath}/rough_100 sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/rough_100 type "part"
|
||||
|
||||
hfactory ${scobj_hpath}/rough_40 plain user text
|
||||
hsetprop ${scobj_hpath}/rough_40 read ${ns}::getValue ${scobj_hpath} read_switch_pair {MG @IN[13], @IN[14]}
|
||||
hsetprop ${scobj_hpath}/rough_40 read_switch_pair ${ns}::read_switch_pair ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/rough_40 write ${ns}::write_switch ${scobj_hpath} noResponse {10}
|
||||
hsetprop ${scobj_hpath}/rough_40 noResponse ${ns}::noResponse ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/rough_40 check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/rough_40 control true
|
||||
hsetprop ${scobj_hpath}/rough_40 data true
|
||||
hsetprop ${scobj_hpath}/rough_40 mutable false
|
||||
hsetprop ${scobj_hpath}/rough_40 nxsave true
|
||||
hsetprop ${scobj_hpath}/rough_40 values in,out
|
||||
hsetprop ${scobj_hpath}/rough_40 oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/rough_40 klass "collimator"
|
||||
hsetprop ${scobj_hpath}/rough_40 nxalias "rough_40"
|
||||
hsetprop ${scobj_hpath}/rough_40 sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/rough_40 type "part"
|
||||
|
||||
hsetprop ${scobj_hpath} data "true"
|
||||
hsetprop ${scobj_hpath} nxsave "true"
|
||||
|
||||
if {[SplitReply [motor_simulation]]=="false"} {
|
||||
${sct_controller} poll ${scobj_hpath}/fast_shutter 1
|
||||
${sct_controller} poll ${scobj_hpath}/rough_100 1
|
||||
${sct_controller} poll ${scobj_hpath}/rough_40 1
|
||||
${sct_controller} write ${scobj_hpath}/rough_100
|
||||
${sct_controller} write ${scobj_hpath}/rough_40
|
||||
}
|
||||
hsetprop ${scobj_hpath} klass instrument
|
||||
# hook code starts
|
||||
# hook code ends
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
namespace eval ::scobj::shutters {
|
||||
namespace export debug_log
|
||||
namespace export mk_sct_shutters
|
||||
}
|
||||
|
||||
proc add_shutters {name IP port} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::shutters"
|
||||
${ns}::debug_log 1 "add_shutters ${name} ${IP} ${port}"
|
||||
if {[SplitReply [motor_simulation]]=="false"} {
|
||||
if {[string equal -nocase "aqadapter" "${IP}"]} {
|
||||
${ns}::debug_log 1 "makesctcontroller sct_${name} aqadapter ${port}"
|
||||
makesctcontroller sct_${name} aqadapter ${port}
|
||||
} else {
|
||||
${ns}::debug_log 1 "makesctcontroller sct_${name} dmc2280 ${IP}:${port}"
|
||||
makesctcontroller sct_${name} dmc2280 ${IP}:${port}
|
||||
}
|
||||
}
|
||||
${ns}::debug_log 1 "mk_sct_shutters sct_${name} ${name}"
|
||||
${ns}::mk_sct_shutters sct_${name} ${name}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
puts stdout "file evaluation of sct_shutters.tcl"
|
||||
::scobj::shutters::debug_log 1 "file evaluation of sct_shutters.tcl"
|
||||
|
||||
proc ::scobj::shutters::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::shutters"
|
||||
${ns}::debug_log 1 "Processing Config"
|
||||
dict for {k v} $::config_dict {
|
||||
${ns}::debug_log 1 "Inspecting $k:$v"
|
||||
if { [dict exists $v "driver"] } {
|
||||
${ns}::debug_log 1 "Has driver [dict get $v driver]"
|
||||
if { [dict get $v "driver"] == "shutters" } {
|
||||
${ns}::debug_log 1 "Correct driver, enabled = [dict get $v enabled]"
|
||||
if { [dict get $v enabled] } {
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
set name [dict get $v name]
|
||||
MakeAsyncProtocol ${name}_protocol
|
||||
MakeAsyncQueue ${name}_queue ${name}_protocol ${IP} ${PORT}
|
||||
add_shutters ${name} "aqadapter" ${name}_queue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::shutters::read_config
|
||||
} else {
|
||||
::scobj::shutters:debug_log 1 "No config dict"
|
||||
}
|
282
site_ansto/instrument/bilby/config/motors/sct_tank.tcl
Normal file
282
site_ansto/instrument/bilby/config/motors/sct_tank.tcl
Normal file
@ -0,0 +1,282 @@
|
||||
# Generated driver for tank
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::tank {
|
||||
set debug_threshold 0
|
||||
}
|
||||
|
||||
proc ::scobj::tank::debug_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
if {${debug_level} >= ${::scobj::tank::debug_threshold}} {
|
||||
set fd [open "/tmp/tank.log" "a"]
|
||||
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
|
||||
puts ${fd} "${line}"
|
||||
close ${fd}
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
# check function for hset change
|
||||
proc ::scobj::tank::checkrange {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]"
|
||||
set setpoint [sct target]
|
||||
if { [hpropexists [sct] lowerlimit] } {
|
||||
set lolimit [sct lowerlimit]
|
||||
} else {
|
||||
# lowerlimit not set, use target
|
||||
set lolimit [sct target]
|
||||
}
|
||||
if { [hpropexists [sct] upperlimit] } {
|
||||
set hilimit [sct upperlimit]
|
||||
} else {
|
||||
# upperlimit not set, use target
|
||||
set hilimit [sct target]
|
||||
}
|
||||
# hook code goes here
|
||||
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
|
||||
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
|
||||
}
|
||||
return OK
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to request the read of a parameter on a device
|
||||
proc ::scobj::tank::getValue {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set cmd "${cmd_str}"
|
||||
# hook code goes here
|
||||
debug_log 1 "getValue sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to check the write parameter on a device
|
||||
proc ::scobj::tank::noResponse {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
|
||||
# hook code goes here
|
||||
return "idle"
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to parse the read of a parameter on a device
|
||||
proc ::scobj::tank::read_switch {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "read_switch tc_root=${tc_root} sct=[sct] result=[sct result]"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set data [sct result]
|
||||
set nextState "idle"
|
||||
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
|
||||
# the protocol driver has reported an error
|
||||
sct geterror "${data}"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
# hook code starts
|
||||
if { [string equal -nocase -length 1 "${data}" "?"] } {
|
||||
sct geterror "Galil error in: '${data}'"
|
||||
} else {
|
||||
set data_list [split [string trim "${data}"]]
|
||||
if { [llength ${data_list}] > 1 && [lindex ${data_list} end] == ":" } {
|
||||
set data_list [lrange ${data_list} 0 0]
|
||||
}
|
||||
if { [llength ${data_list}] == 1 } {
|
||||
set left [expr [lindex ${data_list} 0]]
|
||||
if { ${left} == 1 } { # open
|
||||
set data "open"
|
||||
} else { # closed
|
||||
set data "closed"
|
||||
}
|
||||
} else {
|
||||
sct geterror "Syntax error in: '${data}'=>'${data_list}'"
|
||||
}
|
||||
}
|
||||
# hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log 1 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
if { ${data} != [sct oldval] } {
|
||||
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to write a parameter value on a device
|
||||
proc ::scobj::tank::setValue {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set par [sct target]
|
||||
set cmd "${cmd_str}${par}"
|
||||
# hook code goes here
|
||||
if { [hpropexists [sct] driving] } {
|
||||
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
|
||||
sct driving 1
|
||||
}
|
||||
}
|
||||
debug_log 1 "setValue sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
proc ::scobj::tank::mk_sct_tank { sct_controller name } {
|
||||
debug_log 1 "mk_sct_tank for ${name}"
|
||||
set ns "[namespace current]"
|
||||
set catch_status [ catch {
|
||||
|
||||
MakeSICSObj ${name} SCT_OBJECT
|
||||
|
||||
sicslist setatt ${name} klass instrument
|
||||
sicslist setatt ${name} long_name ${name}
|
||||
|
||||
set scobj_hpath /sics/${name}
|
||||
|
||||
hfactory ${scobj_hpath}/limits plain spy none
|
||||
|
||||
hfactory ${scobj_hpath}/limits/forward plain user text
|
||||
hsetprop ${scobj_hpath}/limits/forward read ${ns}::getValue ${scobj_hpath} read_switch {MG _LFH}
|
||||
hsetprop ${scobj_hpath}/limits/forward read_switch ${ns}::read_switch ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/limits/forward control true
|
||||
hsetprop ${scobj_hpath}/limits/forward data true
|
||||
hsetprop ${scobj_hpath}/limits/forward mutable false
|
||||
hsetprop ${scobj_hpath}/limits/forward nxsave true
|
||||
hsetprop ${scobj_hpath}/limits/forward oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/limits/forward sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/limits/forward type "part"
|
||||
hsetprop ${scobj_hpath}/limits/forward nxalias "${name}_limits_forward"
|
||||
|
||||
hfactory ${scobj_hpath}/limits/reverse plain user text
|
||||
hsetprop ${scobj_hpath}/limits/reverse read ${ns}::getValue ${scobj_hpath} read_switch {MG _LRH}
|
||||
hsetprop ${scobj_hpath}/limits/reverse read_switch ${ns}::read_switch ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/limits/reverse control true
|
||||
hsetprop ${scobj_hpath}/limits/reverse data true
|
||||
hsetprop ${scobj_hpath}/limits/reverse mutable false
|
||||
hsetprop ${scobj_hpath}/limits/reverse nxsave true
|
||||
hsetprop ${scobj_hpath}/limits/reverse oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/limits/reverse sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/limits/reverse type "part"
|
||||
hsetprop ${scobj_hpath}/limits/reverse nxalias "${name}_limits_reverse"
|
||||
|
||||
if {[SplitReply [motor_simulation]]=="false"} {
|
||||
${sct_controller} poll ${scobj_hpath}/limits/forward 1
|
||||
${sct_controller} poll ${scobj_hpath}/limits/reverse 1
|
||||
}
|
||||
|
||||
hfactory ${scobj_hpath}/switches plain spy none
|
||||
|
||||
hfactory ${scobj_hpath}/switches/forward plain user text
|
||||
hsetprop ${scobj_hpath}/switches/forward read ${ns}::getValue ${scobj_hpath} read_switch {MG @IN[5]}
|
||||
hsetprop ${scobj_hpath}/switches/forward read_switch ${ns}::read_switch ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/switches/forward control true
|
||||
hsetprop ${scobj_hpath}/switches/forward data true
|
||||
hsetprop ${scobj_hpath}/switches/forward mutable false
|
||||
hsetprop ${scobj_hpath}/switches/forward nxsave true
|
||||
hsetprop ${scobj_hpath}/switches/forward oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/switches/forward sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/switches/forward type "part"
|
||||
hsetprop ${scobj_hpath}/switches/forward nxalias "${name}_switches_forward"
|
||||
|
||||
hfactory ${scobj_hpath}/switches/reverse plain user text
|
||||
hsetprop ${scobj_hpath}/switches/reverse read ${ns}::getValue ${scobj_hpath} read_switch {MG @IN[6]}
|
||||
hsetprop ${scobj_hpath}/switches/reverse read_switch ${ns}::read_switch ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/switches/reverse control true
|
||||
hsetprop ${scobj_hpath}/switches/reverse data true
|
||||
hsetprop ${scobj_hpath}/switches/reverse mutable false
|
||||
hsetprop ${scobj_hpath}/switches/reverse nxsave true
|
||||
hsetprop ${scobj_hpath}/switches/reverse oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/switches/reverse sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/switches/reverse type "part"
|
||||
hsetprop ${scobj_hpath}/switches/reverse nxalias "${name}_switches_reverse"
|
||||
|
||||
if {[SplitReply [motor_simulation]]=="false"} {
|
||||
${sct_controller} poll ${scobj_hpath}/switches/forward 1
|
||||
${sct_controller} poll ${scobj_hpath}/switches/reverse 1
|
||||
}
|
||||
hsetprop ${scobj_hpath} klass instrument
|
||||
# hook code starts
|
||||
# hook code ends
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
namespace eval ::scobj::tank {
|
||||
namespace export debug_log
|
||||
namespace export mk_sct_tank
|
||||
}
|
||||
|
||||
proc add_tank {name IP port} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::tank"
|
||||
${ns}::debug_log 1 "add_tank ${name} ${IP} ${port}"
|
||||
if {[SplitReply [motor_simulation]]=="false"} {
|
||||
if {[string equal -nocase "aqadapter" "${IP}"]} {
|
||||
${ns}::debug_log 1 "makesctcontroller sct_${name} aqadapter ${port}"
|
||||
makesctcontroller sct_${name} aqadapter ${port}
|
||||
} else {
|
||||
${ns}::debug_log 1 "makesctcontroller sct_${name} dmc2280 ${IP}:${port}"
|
||||
makesctcontroller sct_${name} dmc2280 ${IP}:${port}
|
||||
}
|
||||
}
|
||||
${ns}::debug_log 1 "mk_sct_tank sct_${name} ${name}"
|
||||
${ns}::mk_sct_tank sct_${name} ${name}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
puts stdout "file evaluation of sct_tank.tcl"
|
||||
::scobj::tank::debug_log 1 "file evaluation of sct_tank.tcl"
|
||||
|
||||
proc ::scobj::tank::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::tank"
|
||||
${ns}::debug_log 1 "Processing Config"
|
||||
dict for {k v} $::config_dict {
|
||||
${ns}::debug_log 1 "Inspecting $k:$v"
|
||||
if { [dict exists $v "driver"] } {
|
||||
${ns}::debug_log 1 "Has driver [dict get $v driver]"
|
||||
if { [dict get $v "driver"] == "tank" } {
|
||||
${ns}::debug_log 1 "Correct driver, enabled = [dict get $v enabled]"
|
||||
if { [dict get $v enabled] } {
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
set name [dict get $v name]
|
||||
MakeAsyncProtocol ${name}_protocol
|
||||
MakeAsyncQueue ${name}_queue ${name}_protocol ${IP} ${PORT}
|
||||
add_tank ${name} "aqadapter" ${name}_queue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::tank::read_config
|
||||
} else {
|
||||
::scobj::tank:debug_log 1 "No config dict"
|
||||
}
|
92
site_ansto/instrument/bilby/config/motors/shutters.sct
Normal file
92
site_ansto/instrument/bilby/config/motors/shutters.sct
Normal file
@ -0,0 +1,92 @@
|
||||
#
|
||||
# Simple driver generator for the non-motor galil controls on mc4
|
||||
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent
|
||||
#
|
||||
driver shutters = {
|
||||
vendor = galil; device = mc4; protocol = dmc2280;
|
||||
class = instrument
|
||||
simulation_group = motor_simulation
|
||||
#
|
||||
# Unnamed group has variables at device level
|
||||
#
|
||||
#
|
||||
# The named group is at the device level, variables below that
|
||||
#
|
||||
group = {
|
||||
type = text
|
||||
priv = user
|
||||
group_property 'data' = 'true'
|
||||
group_property 'nxsave' = 'true'
|
||||
property 'type' = 'part'
|
||||
property 'klass' = 'collimator'
|
||||
property 'sdsinfo' = '::nexus::scobj::sdsinfo'
|
||||
var fast_shutter = {
|
||||
readable = 1
|
||||
read_command = 'MG @IN[5], @IN[6]'
|
||||
read_function = read_switch_pair
|
||||
property 'nxalias' = 'fast_shutter'
|
||||
}
|
||||
var rough_40 = {
|
||||
readable = 1;
|
||||
read_function = read_switch_pair;
|
||||
read_command = 'MG @IN[13], @IN[14]'
|
||||
writeable = 1
|
||||
write_function = write_switch;
|
||||
write_command = '10'
|
||||
allowed = 'in,out'
|
||||
property 'nxalias' = 'rough_40'
|
||||
}
|
||||
var rough_100 = {
|
||||
readable = 1;
|
||||
read_function = read_switch_pair;
|
||||
read_command = 'MG @IN[15], @IN[16]'
|
||||
writeable = 1
|
||||
write_function = write_switch;
|
||||
write_command = '11'
|
||||
allowed = 'in,out'
|
||||
property 'nxalias' = 'rough_100'
|
||||
}
|
||||
};
|
||||
|
||||
#
|
||||
# Code lines start with '@' which is stripped before being emitted
|
||||
# The code is emitted at the appropriate place in the given function
|
||||
#
|
||||
code read_function read_switch_pair = {
|
||||
@ if { [string equal -nocase -length 1 "${data}" "?"] } {
|
||||
@ sct geterror "Galil error in: '${data}'"
|
||||
@ } else {
|
||||
@ set data_list [split [string trim "${data}"]]
|
||||
@ if { [llength ${data_list}] > 2 && [lindex ${data_list} end] == ":" } {
|
||||
@ set data_list [lrange ${data_list} 0 1]
|
||||
@ }
|
||||
@ if { [llength ${data_list}] == 2 } {
|
||||
@ set left [expr [lindex ${data_list} 0]]
|
||||
@ set right [expr [lindex ${data_list} 1]]
|
||||
@ if { ${left} == 1 && ${right} == 0 } { # open
|
||||
@ set data "out"
|
||||
@ } elseif { ${left} == 0 && ${right} == 1 } { # closed
|
||||
@ set data "in"
|
||||
@ } else { # indeterminate
|
||||
@ set data "moving"
|
||||
@ }
|
||||
@ } else {
|
||||
@ sct geterror "Syntax error in: '${data}'=>'${data_list}'"
|
||||
@ }
|
||||
@ }
|
||||
}
|
||||
code write_function write_switch = {
|
||||
@ if { [string equal -nocase -length 2 "${par}" "in"] } {
|
||||
@ set cmd "SB${cmd_str}"
|
||||
@ } elseif { [string equal -nocase -length 2 "${par}" "out"] } {
|
||||
@ set cmd "CB${cmd_str}"
|
||||
@ } else {
|
||||
@ sct geterror "Value error: '${par}' not in ('in', 'out')"
|
||||
@ }
|
||||
}
|
||||
#
|
||||
# This code is after database creation
|
||||
#
|
||||
code mkDriver = {
|
||||
}
|
||||
};
|
203
site_ansto/instrument/bilby/config/motors/sicsmot_attlist.csv
Normal file
203
site_ansto/instrument/bilby/config/motors/sicsmot_attlist.csv
Normal file
@ -0,0 +1,203 @@
|
||||
ap1_absenchome,73952.0000
|
||||
ap1_accel,1.4062
|
||||
ap1_decel,1.4062
|
||||
ap1_fwd_lim,105.0183
|
||||
ap1_home,0.0000
|
||||
ap1_rev_lim,0.0000
|
||||
ap1_speed,1.4062
|
||||
ap2_absenchome,54293.0000
|
||||
ap2_accel,1.4062
|
||||
ap2_decel,1.4062
|
||||
ap2_fwd_lim,113.0713
|
||||
ap2_home,0.0000
|
||||
ap2_rev_lim,0.0000
|
||||
ap2_speed,1.4062
|
||||
ap3_absenchome,13644.0000
|
||||
ap3_accel,1.4062
|
||||
ap3_decel,1.4062
|
||||
ap3_fwd_lim,104.2932
|
||||
ap3_home,0.0000
|
||||
ap3_rev_lim,0.0000
|
||||
ap3_speed,1.4062
|
||||
ap4_absenchome,5666.0000
|
||||
ap4_accel,1.4062
|
||||
ap4_decel,1.4062
|
||||
ap4_fwd_lim,108.6768
|
||||
ap4_home,0.0000
|
||||
ap4_rev_lim,0.0000
|
||||
ap4_speed,1.4062
|
||||
ap5_absenchome,72824.0000
|
||||
ap5_accel,1.4062
|
||||
ap5_decel,1.4062
|
||||
ap5_fwd_lim,104.0186
|
||||
ap5_home,0.0000
|
||||
ap5_rev_lim,0.0000
|
||||
ap5_speed,1.4062
|
||||
ap6_absenchome,72115.0000
|
||||
ap6_accel,1.4062
|
||||
ap6_decel,1.4062
|
||||
ap6_fwd_lim,110.7422
|
||||
ap6_home,0.0000
|
||||
ap6_rev_lim,0.0000
|
||||
ap6_speed,1.4062
|
||||
ap7_absenchome,74299.0000
|
||||
ap7_accel,1.4062
|
||||
ap7_decel,1.4062
|
||||
ap7_fwd_lim,104.6228
|
||||
ap7_home,0.0000
|
||||
ap7_rev_lim,0.0000
|
||||
ap7_speed,1.4062
|
||||
ap8_absenchome,6791.0000
|
||||
ap8_accel,1.4062
|
||||
ap8_decel,1.4062
|
||||
ap8_fwd_lim,112.1924
|
||||
ap8_home,0.0000
|
||||
ap8_rev_lim,0.0000
|
||||
ap8_speed,1.4062
|
||||
att_absenchome,33394989.0000
|
||||
att_accel,3.6000
|
||||
att_decel,3.6000
|
||||
att_fwd_lim,273.7734
|
||||
att_home,0.0000
|
||||
att_rev_lim,0.0000
|
||||
att_speed,3.6000
|
||||
bs3_absenchome,351548.0000
|
||||
bs3_accel,5.6250
|
||||
bs3_decel,5.6250
|
||||
bs3_fwd_lim,-69.6162
|
||||
bs3_home,0.0000
|
||||
bs3_rev_lim,0.0000
|
||||
bs3_speed,5.6250
|
||||
cdd_absenchome,4159255.0000
|
||||
cdd_accel,0.2500
|
||||
cdd_decel,0.2500
|
||||
cdd_fwd_lim,349.7198
|
||||
cdd_home,0.0000
|
||||
cdd_rev_lim,0.0000
|
||||
cdd_speed,1.5000
|
||||
cdl_absenchome,5769621.0000
|
||||
cdl_accel,0.2500
|
||||
cdl_decel,0.2500
|
||||
cdl_fwd_lim,356.9644
|
||||
cdl_home,0.0000
|
||||
cdl_rev_lim,0.0000
|
||||
cdl_speed,1.5000
|
||||
cdr_absenchome,4371043.0000
|
||||
cdr_accel,0.2500
|
||||
cdr_decel,0.2500
|
||||
cdr_fwd_lim,358.0801
|
||||
cdr_home,0.0000
|
||||
cdr_rev_lim,0.0000
|
||||
cdr_speed,1.5000
|
||||
cdu_absenchome,21804679.0000
|
||||
cdu_accel,0.2500
|
||||
cdu_decel,0.2500
|
||||
cdu_fwd_lim,356.9028
|
||||
cdu_home,0.0000
|
||||
cdu_rev_lim,0.0000
|
||||
cdu_speed,1.5000
|
||||
col1_absenchome,3902.0000
|
||||
col1_accel,0.3333
|
||||
col1_decel,0.3333
|
||||
col1_fwd_lim,270.2969
|
||||
col1_home,0.0000
|
||||
col1_rev_lim,0.0000
|
||||
col1_speed,0.6667
|
||||
col2_absenchome,9598.0000
|
||||
col2_accel,0.3333
|
||||
col2_decel,0.3333
|
||||
col2_fwd_lim,270.9961
|
||||
col2_home,0.0000
|
||||
col2_rev_lim,0.0000
|
||||
col2_speed,0.6667
|
||||
col3_absenchome,29466.0000
|
||||
col3_accel,0.3333
|
||||
col3_decel,0.3333
|
||||
col3_fwd_lim,268.1104
|
||||
col3_home,0.0000
|
||||
col3_rev_lim,0.0000
|
||||
col3_speed,0.6667
|
||||
col4_absenchome,12861.0000
|
||||
col4_accel,0.3333
|
||||
col4_decel,0.3333
|
||||
col4_fwd_lim,269.4302
|
||||
col4_home,0.0000
|
||||
col4_rev_lim,0.0000
|
||||
col4_speed,0.6667
|
||||
col5_absenchome,377801.0000
|
||||
col5_accel,0.3333
|
||||
col5_decel,0.3333
|
||||
col5_fwd_lim,268.7666
|
||||
col5_home,0.0000
|
||||
col5_rev_lim,0.0000
|
||||
col5_speed,0.6667
|
||||
col6_absenchome,191508.0000
|
||||
col6_accel,0.3333
|
||||
col6_decel,0.3333
|
||||
col6_fwd_lim,271.2998
|
||||
col6_home,0.0000
|
||||
col6_rev_lim,0.0000
|
||||
col6_speed,0.6667
|
||||
col7_absenchome,24810.0000
|
||||
col7_accel,0.3333
|
||||
col7_decel,0.3333
|
||||
col7_fwd_lim,269.9331
|
||||
col7_home,0.0000
|
||||
col7_rev_lim,0.0000
|
||||
col7_speed,0.6667
|
||||
col8_absenchome,12893.0000
|
||||
col8_accel,0.3333
|
||||
col8_decel,0.3333
|
||||
col8_fwd_lim,267.6748
|
||||
col8_home,0.0000
|
||||
col8_rev_lim,0.0000
|
||||
col8_speed,0.6667
|
||||
det_absenchome,0.0000
|
||||
det_accel,6.4103
|
||||
det_decel,6.4103
|
||||
det_fwd_lim,0.0000
|
||||
det_home,0.0000
|
||||
det_rev_lim,0.0000
|
||||
det_speed,25.6410
|
||||
sdh_absenchome,4166803.0000
|
||||
sdh_fwd_lim,242.2931
|
||||
sdh_home,0.0000
|
||||
sdh_maxaccel,1.0000
|
||||
sdh_maxdecel,1.0000
|
||||
sdh_maxspeed,1.0000
|
||||
sdh_rev_lim,0.0000
|
||||
ss1d_absenchome,33398312.0000
|
||||
ss1d_accel,0.5000
|
||||
ss1d_decel,0.5000
|
||||
ss1d_fwd_lim,114.3299
|
||||
ss1d_home,0.0000
|
||||
ss1d_rev_lim,0.0000
|
||||
ss1d_speed,0.5000
|
||||
ss1l_absenchome,31524107.0000
|
||||
ss1l_accel,0.5000
|
||||
ss1l_decel,0.5000
|
||||
ss1l_fwd_lim,67.9708
|
||||
ss1l_home,0.0000
|
||||
ss1l_rev_lim,0.0000
|
||||
ss1l_speed,0.5000
|
||||
ss1r_absenchome,32248545.0000
|
||||
ss1r_accel,0.5000
|
||||
ss1r_decel,0.5000
|
||||
ss1r_fwd_lim,71.6127
|
||||
ss1r_home,0.0000
|
||||
ss1r_rev_lim,0.0000
|
||||
ss1r_speed,0.5000
|
||||
ss1u_absenchome,33297987.0000
|
||||
ss1u_accel,0.5000
|
||||
ss1u_decel,0.5000
|
||||
ss1u_fwd_lim,113.7317
|
||||
ss1u_home,0.0000
|
||||
ss1u_rev_lim,0.0000
|
||||
ss1u_speed,0.5000
|
||||
vs_absenchome,3789130.0000
|
||||
vs_accel,0.4000
|
||||
vs_decel,1.3333
|
||||
vs_fwd_lim,275.2637
|
||||
vs_home,0.0000
|
||||
vs_rev_lim,0.0000
|
||||
vs_speed,1.3333
|
|
69
site_ansto/instrument/bilby/config/motors/tank.sct
Normal file
69
site_ansto/instrument/bilby/config/motors/tank.sct
Normal file
@ -0,0 +1,69 @@
|
||||
#
|
||||
# Simple driver generator for the non-motor galil controls on mc8
|
||||
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent
|
||||
#
|
||||
driver tank = {
|
||||
vendor = galil; device = mc8; protocol = dmc2280;
|
||||
class = instrument
|
||||
simulation_group = motor_simulation
|
||||
#
|
||||
# Unnamed group has variables at device level
|
||||
#
|
||||
#
|
||||
# The named group is at the device level, variables below that
|
||||
#
|
||||
group switches = {
|
||||
type = text;
|
||||
priv = user;
|
||||
readable = 1;
|
||||
read_function = read_switch;
|
||||
var forward = {
|
||||
read_command = 'MG @IN[5]'
|
||||
}
|
||||
var reverse = {
|
||||
read_command = 'MG @IN[6]'
|
||||
}
|
||||
};
|
||||
group limits = {
|
||||
type = text;
|
||||
priv = user;
|
||||
readable = 1;
|
||||
read_function = read_switch;
|
||||
var forward = {
|
||||
read_command = 'MG _LFH'
|
||||
}
|
||||
var reverse = {
|
||||
read_command = 'MG _LRH'
|
||||
}
|
||||
};
|
||||
|
||||
#
|
||||
# Code lines start with '@' which is stripped before being emitted
|
||||
# The code is emitted at the appropriate place in the given function
|
||||
#
|
||||
code read_function read_switch = {
|
||||
@ if { [string equal -nocase -length 1 "${data}" "?"] } {
|
||||
@ sct geterror "Galil error in: '${data}'"
|
||||
@ } else {
|
||||
@ set data_list [split [string trim "${data}"]]
|
||||
@ if { [llength ${data_list}] > 1 && [lindex ${data_list} end] == ":" } {
|
||||
@ set data_list [lrange ${data_list} 0 0]
|
||||
@ }
|
||||
@ if { [llength ${data_list}] == 1 } {
|
||||
@ set left [expr [lindex ${data_list} 0]]
|
||||
@ if { ${left} == 1 } { # open
|
||||
@ set data "open"
|
||||
@ } else { # closed
|
||||
@ set data "closed"
|
||||
@ }
|
||||
@ } else {
|
||||
@ sct geterror "Syntax error in: '${data}'=>'${data_list}'"
|
||||
@ }
|
||||
@ }
|
||||
}
|
||||
#
|
||||
# This code is after database creation
|
||||
#
|
||||
code mkDriver = {
|
||||
}
|
||||
};
|
@ -0,0 +1,24 @@
|
||||
col1_maxaccel,0.75
|
||||
col1_maxdecel,0.75
|
||||
col1_maxspeed,0.75
|
||||
col2_maxaccel,0.75
|
||||
col2_maxdecel,0.75
|
||||
col2_maxspeed,0.75
|
||||
col3_maxaccel,0.75
|
||||
col3_maxdecel,0.75
|
||||
col3_maxspeed,0.75
|
||||
col4_maxaccel,0.75
|
||||
col4_maxdecel,0.75
|
||||
col4_maxspeed,0.75
|
||||
col5_maxaccel,0.75
|
||||
col5_maxdecel,0.75
|
||||
col5_maxspeed,0.75
|
||||
col6_maxaccel,0.75
|
||||
col6_maxdecel,0.75
|
||||
col6_maxspeed,0.75
|
||||
col7_maxaccel,0.75
|
||||
col7_maxdecel,0.75
|
||||
col7_maxspeed,0.75
|
||||
col8_maxaccel,0.75
|
||||
col8_maxdecel,0.75
|
||||
col8_maxspeed,0.75
|
|
4
site_ansto/instrument/bilby/config/nexus/nxscripts.tcl
Normal file
4
site_ansto/instrument/bilby/config/nexus/nxscripts.tcl
Normal file
@ -0,0 +1,4 @@
|
||||
source $cfPath(nexus)/nxscripts_common_1.tcl
|
||||
proc ::nexus::isc_initialize {} {
|
||||
::nexus::ic_initialize
|
||||
}
|
1
site_ansto/instrument/bilby/config/optics/README.TXT
Normal file
1
site_ansto/instrument/bilby/config/optics/README.TXT
Normal file
@ -0,0 +1 @@
|
||||
Optical Components: Neutron Guides, Apertures, Polariser, Focussing Lenses and Prisms
|
@ -0,0 +1,94 @@
|
||||
namespace eval optics {
|
||||
array set AttRotLookupTable {
|
||||
0 { 0.0 1 }
|
||||
30 { 1.3 0.498782 }
|
||||
60 { 3.3 0.176433 }
|
||||
90 { 4.9 0.0761367 }
|
||||
120 { 6.4 0.0353985 }
|
||||
150 { 8.3 0.0137137 }
|
||||
180 { 9.6 0.00614167 }
|
||||
210 {11.2 0.00264554 }
|
||||
240 {13.1 0.000994504 }
|
||||
270 {15.0 0.000358897 }
|
||||
300 {18.0 7.2845e-05 }
|
||||
330 {25.0 1.67827e-06 }
|
||||
}
|
||||
|
||||
array set EApLookupTable {
|
||||
0 { 5 circ}
|
||||
30 {10 circ}
|
||||
60 {20 circ}
|
||||
90 {30 circ}
|
||||
120 {40 circ}
|
||||
150 {50 circ}
|
||||
180 {50 squ }
|
||||
210 {open open}
|
||||
240 {open open}
|
||||
270 {open open}
|
||||
300 {open open}
|
||||
330 {open open}
|
||||
}
|
||||
}
|
||||
|
||||
proc ::optics::AttRotLookup {angle column tol} {
|
||||
variable AttRotLookupTable
|
||||
|
||||
set catch_status [ catch {
|
||||
set foundit false
|
||||
foreach vangle [array names AttRotLookupTable] {
|
||||
if {$vangle >= [expr {$angle-$tol}] && $vangle <= [expr {$angle+$tol}]} {
|
||||
set foundit true
|
||||
break
|
||||
}
|
||||
}
|
||||
if {$foundit == true} {
|
||||
switch $column {
|
||||
"plex" { set index 0 }
|
||||
"attfactor" { set index 1 }
|
||||
default { error "$column is unknown, allowed values are plex or attfactor" }
|
||||
}
|
||||
return [lindex $AttRotLookupTable($vangle) $index]
|
||||
} else {
|
||||
return -1
|
||||
}
|
||||
} message ]
|
||||
handle_exception $catch_status $message
|
||||
}
|
||||
|
||||
proc ::optics::EApLookUp {angle param tol} {
|
||||
variable EApLookupTable
|
||||
|
||||
set foundit false
|
||||
if [ catch {
|
||||
if {$param == "size"} {
|
||||
set cgf [SplitReply [GuideConfig]]
|
||||
if {[string first $cgf "g1 g2 g3 g4 g5 g6 g7 g8 g9 p1 p2 p3 p4 p5 p6 p7 p8 p9"] != -1} {
|
||||
return 50
|
||||
}
|
||||
}
|
||||
switch $param {
|
||||
"size" {set index 0}
|
||||
"shape" {set index 1}
|
||||
default {
|
||||
error "ERROR: Invalid lookup parameter $param"
|
||||
}
|
||||
}
|
||||
foreach vangle [array names EApLookupTable] {
|
||||
if {$vangle >= [expr {$angle-$tol}] && $vangle <= [expr {$angle+$tol}]} {
|
||||
set foundit true
|
||||
break
|
||||
}
|
||||
}
|
||||
if {$foundit == true} {
|
||||
return [lindex $EApLookupTable($vangle) $index]
|
||||
} else {
|
||||
switch $param {
|
||||
"size" {return 0}
|
||||
"shape" {return "UNKNOWN"}
|
||||
}
|
||||
}
|
||||
} message ] {
|
||||
if {$::errorCode == "NONE"} {return $message}
|
||||
return -code error "$message"
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
##
|
||||
# @file
|
||||
# A guide configuration table where each line describes the setup
|
||||
# for a mode of operation.
|
||||
# The table will have a corresponding interpretation list which provides
|
||||
# commands to setup the instrument.
|
||||
|
||||
namespace eval optics {
|
||||
##
|
||||
# @brief These arrays map the component identifiers (G, MT, etc) to the
|
||||
# position index for each guide motor (c1, c2 ... c9)
|
||||
array set c1_map {G 1 MT 2 P 3}
|
||||
array set c2_map {MT 1 G 2 A 3}
|
||||
array set c3_map {MT 1 G 2 A 3}
|
||||
array set c4_map {MT 1 G 2 A 3}
|
||||
array set c5_map {MT 1 G 2 A 3}
|
||||
array set c6_map {MT 1 G 2 A 3}
|
||||
array set c7_map {MT 1 G 2 A 3}
|
||||
array set c8_map {MT 1 G 2 A 3}
|
||||
array set c9_map {L 1 MT 2 G 3 A 4 LP 5}
|
||||
|
||||
# The guide configuration table is indexed by a configuration
|
||||
# identifier (ga, mt, lp, etc). Each row has two elements,
|
||||
# 1. A list of components selected for each guide (MT A ... etc)
|
||||
# 2. The entrance aperature position in mm
|
||||
# Eg $guide_configuration(p2) returns the following list
|
||||
# {{P G A A A A A A A } 6934}
|
||||
array set guide_configuration {
|
||||
ga {{MT A A A A A A A A } 675}
|
||||
mt {{MT MT MT MT MT MT MT MT MT} 675}
|
||||
lp {{MT MT MT MT MT MT MT MT LP} 675}
|
||||
lens {{MT A A A A A A A L } 675}
|
||||
p1 {{P A MT MT MT MT MT MT MT} 4621}
|
||||
p1lp {{P A MT MT MT MT MT MT LP} 4621}
|
||||
p1lens {{P A MT MT MT MT MT MT L } 4621}
|
||||
g1 {{G A A A A A A A A } 4929}
|
||||
p2 {{P G A A A A A A A } 6934}
|
||||
g2 {{G G A A A A A A A } 6934}
|
||||
p3 {{P G G A A A A A A } 8949}
|
||||
g3 {{G G G A A A A A A } 8949}
|
||||
p4 {{P G G G A A A A A } 10955}
|
||||
g4 {{G G G G A A A A A } 10955}
|
||||
p5 {{P G G G G A A A A } 12943}
|
||||
g5 {{G G G G G A A A A } 12943}
|
||||
p6 {{P G G G G G A A A } 14970}
|
||||
g6 {{G G G G G G A A A } 14970}
|
||||
p7 {{P G G G G G G A A } 16971}
|
||||
g7 {{G G G G G G G A A } 16971}
|
||||
p8 {{P G G G G G G G A } 18937}
|
||||
g8 {{G G G G G G G G A } 18937}
|
||||
p9 {{P G G G G G G G G } 19925}
|
||||
g9 {{G G G G G G G G G } 19925}
|
||||
}
|
||||
|
||||
# This list maps the motor names to columns of the
|
||||
# guide_configuration table.
|
||||
set guide_configuration_columns {
|
||||
c1 c2 c3 c4 c5 c6 c7 c8 c9
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace eval optics {
|
||||
variable guide_configuration
|
||||
variable guide_configuration_columns
|
||||
}
|
2
site_ansto/instrument/bilby/config/optics/optics.tcl
Normal file
2
site_ansto/instrument/bilby/config/optics/optics.tcl
Normal file
@ -0,0 +1,2 @@
|
||||
fileeval $cfPath(optics)/guide_configuration.tcl
|
||||
fileeval $cfPath(optics)/aperture_configuration.tcl
|
7
site_ansto/instrument/bilby/config/plc/plc.tcl
Normal file
7
site_ansto/instrument/bilby/config/plc/plc.tcl
Normal file
@ -0,0 +1,7 @@
|
||||
set sim_mode [SplitReply [plc_simulation]]
|
||||
if {$sim_mode == "false"} {
|
||||
MakeAsyncQueue plc_chan SafetyPLC [dict get $::PLC_HOSTPORT HOST] [dict get $::PLC_HOSTPORT PORT]
|
||||
MakeSafetyPLC plc plc_chan 0
|
||||
}
|
||||
source $cfPath(plc)/plc_common_1.tcl
|
||||
|
6
site_ansto/instrument/bilby/config/scan/scan.tcl
Normal file
6
site_ansto/instrument/bilby/config/scan/scan.tcl
Normal file
@ -0,0 +1,6 @@
|
||||
source $cfPath(scan)/scan_common_1.tcl
|
||||
proc ::scan::pre_hmm_scan_prepare {} {}
|
||||
|
||||
proc ::scan::isc_initialize {} {
|
||||
::scan::ic_initialize
|
||||
}
|
52
site_ansto/instrument/bilby/hostport_config.tcl
Normal file
52
site_ansto/instrument/bilby/hostport_config.tcl
Normal file
@ -0,0 +1,52 @@
|
||||
# MOTOR HOST AND PORT
|
||||
foreach {mc host port} {
|
||||
MC1 mc1-bilby 1034
|
||||
MC2 mc2-bilby 1034
|
||||
MC3 mc3-bilby 1034
|
||||
MC4 mc4-bilby 1034
|
||||
MC5 mc5-bilby 1034
|
||||
MC6 mc6-bilby 1034
|
||||
MC7 mc7-bilby 1034
|
||||
MC8 mc8-bilby 1034
|
||||
} {
|
||||
dict set MOTOR_HOSTPORT $mc HOST $host
|
||||
dict set MOTOR_HOSTPORT $mc PORT $port
|
||||
}
|
||||
|
||||
# BEAM MONITOR HOST AND PORT
|
||||
foreach {bm host port} {
|
||||
MONITOR_1 das1-bilby 30000
|
||||
} {
|
||||
dict set MONITOR_HOSTPORT $bm HOST $host
|
||||
dict set MONITOR_HOSTPORT $bm PORT $port
|
||||
}
|
||||
|
||||
# HISTOGRAM SERVER HOST AND PORT
|
||||
# TODO HV control
|
||||
foreach {key host port} {
|
||||
HMM das1-bilby.nbi.ansto.gov.au 8080
|
||||
HMSTAT das1-bilby.nbi.ansto.gov.au 8081
|
||||
ORDELA 137.157.202.71 4001
|
||||
NHQ200 ca1-bilby 4002
|
||||
} {
|
||||
dict set HISTMEM_HOSTPORT $key HOST $host
|
||||
dict set HISTMEM_HOSTPORT $key PORT $port
|
||||
}
|
||||
|
||||
# VELOCITY SELECTOR HOST AND PORT
|
||||
# TODO
|
||||
foreach {key host port} {
|
||||
NVS IP 10000
|
||||
} {
|
||||
dict set VELSEL_HOSTPORT $key HOST $host
|
||||
dict set VELSEL_HOSTPORT $key PORT $port
|
||||
}
|
||||
|
||||
# Safety Interlock System
|
||||
# TODO
|
||||
foreach {host port} {
|
||||
IP PORT
|
||||
} {
|
||||
dict set PLC_HOSTPORT HOST $host
|
||||
dict set PLC_HOSTPORT PORT $port
|
||||
}
|
52
site_ansto/instrument/bilby/hostport_config_test.tcl
Normal file
52
site_ansto/instrument/bilby/hostport_config_test.tcl
Normal file
@ -0,0 +1,52 @@
|
||||
# Specify NONE for HOST and PORT if there is no fake device to talk to.
|
||||
|
||||
# TEST MOTOR HOST AND PORT
|
||||
foreach {key host port} {
|
||||
MC1 localhost 63030
|
||||
MC2 localhost 63031
|
||||
MC3 localhost 63032
|
||||
MC4 localhost 63033
|
||||
MC5 localhost 63034
|
||||
MC6 localhost 63035
|
||||
MC7 localhost 63036
|
||||
MC8 localhost 63037
|
||||
} {
|
||||
dict set MOTOR_HOSTPORT $key HOST $host
|
||||
dict set MOTOR_HOSTPORT $key PORT $port
|
||||
}
|
||||
|
||||
# TEST BEAM MONITOR HOST AND PORT
|
||||
foreach {key host port} {
|
||||
MONITOR_1 localhost 30000
|
||||
} {
|
||||
dict set MONITOR_HOSTPORT $key HOST $host
|
||||
dict set MONITOR_HOSTPORT $key PORT $port
|
||||
}
|
||||
|
||||
# TEST HISTOGRAM SERVER HOST AND PORT
|
||||
foreach {key host port} {
|
||||
HMM das1-test.nbi.ansto.gov.au 8080
|
||||
HMSTAT das1-test.nbi.ansto.gov.au 8081
|
||||
ORDELA localhost 4001
|
||||
NHQ200 localhost 4002
|
||||
} {
|
||||
dict set HISTMEM_HOSTPORT $key HOST $host
|
||||
dict set HISTMEM_HOSTPORT $key PORT $port
|
||||
}
|
||||
|
||||
# VELOCITY SELECTOR HOST AND PORT
|
||||
foreach {key host port} {
|
||||
NVS localhost 10000
|
||||
} {
|
||||
dict set VELSEL_HOSTPORT $key HOST $host
|
||||
dict set VELSEL_HOSTPORT $key PORT $port
|
||||
}
|
||||
|
||||
# Safety Interlock System
|
||||
# TODO
|
||||
foreach {host port} {
|
||||
NONE NONE
|
||||
} {
|
||||
dict set PLC_HOSTPORT HOST $host
|
||||
dict set PLC_HOSTPORT PORT $port
|
||||
}
|
3
site_ansto/instrument/bilby/runsics_def.py
Normal file
3
site_ansto/instrument/bilby/runsics_def.py
Normal file
@ -0,0 +1,3 @@
|
||||
inst_user = 'bilby_sics'
|
||||
inst_name = 'bilby'
|
||||
inst_config = 'bilby_configuration.tcl'
|
@ -1,10 +1,6 @@
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
|
||||
# TODO Handle sequencing when simultaneously moving multiple axes
|
||||
# TODO Handle functional dependencies (just write your own tcl script)
|
||||
# or get the generic acscript to call a user proc
|
||||
# FIXME The anticollider module does not report the error messages from the
|
||||
# anticollision script, we currently get around this by using broadcast.
|
||||
|
||||
AntiCollisionInstall
|
||||
namespace eval anticollider {
|
||||
@ -13,11 +9,41 @@ namespace eval anticollider {
|
||||
array unset ::anticollider::veto_region
|
||||
array set ::anticollider::veto_region ""
|
||||
|
||||
# Don't show 'acscript' call on error. This is done by the anticollider
|
||||
# module.
|
||||
proc handle_acscript_exception {status message args} {
|
||||
switch $status {
|
||||
0 {
|
||||
# TCL_OK, This is raised when you just drop out of the
|
||||
# bottom of a 'catch' command.
|
||||
return -code ok
|
||||
}
|
||||
1 {
|
||||
# TCL_ERROR
|
||||
return -code error "$message: $args"
|
||||
}
|
||||
2 {
|
||||
# TCL_RETURN
|
||||
return -code return "$message"
|
||||
}
|
||||
3 {
|
||||
# TCL_BREAK
|
||||
return -code break
|
||||
}
|
||||
4 {
|
||||
# TCL_CONTINUE
|
||||
return -code continue
|
||||
}
|
||||
default {
|
||||
# Propogate user defined return codes with message
|
||||
return -code $status "$message"
|
||||
}
|
||||
}
|
||||
}
|
||||
##
|
||||
# @brief Load an anticollider script
|
||||
proc ::anticollider::loadscript {args} {
|
||||
variable prog
|
||||
set prog ""
|
||||
variable veto_rules
|
||||
|
||||
set fh [open $::cfPath(anticollider)/[lindex $args 0] RDONLY ]
|
||||
while {[gets $fh line] >= 0} {
|
||||
@ -25,7 +51,7 @@ proc ::anticollider::loadscript {args} {
|
||||
if [regexp {^\s*$|^ *#} $line] {
|
||||
continue
|
||||
}
|
||||
lappend prog $line
|
||||
lappend veto_rules $line
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +59,7 @@ proc ::anticollider::loadscript {args} {
|
||||
# @brief Compile compile an anticollider declaration into a veto region table
|
||||
# for the anticollider script.
|
||||
#
|
||||
# @param vprog, an anticollider declaration as a list of quote enclosed lines.
|
||||
# @param veto_rules, an anticollider declaration as a list of quote enclosed lines.
|
||||
# @return Generates the ::anticollider::veto_region lookup table.
|
||||
#
|
||||
# Example\n
|
||||
@ -44,14 +70,16 @@ proc ::anticollider::loadscript {args} {
|
||||
# for sphi forbid { {0 5} {10 15} } when schi in { {5 10} {15 20} }\n
|
||||
# forbid {-inf 5} when mtth in {0 10} for sphi\n
|
||||
# forbid {0 10} for samx whenall { samrot in {0 5} samy in {0 15} }\n
|
||||
proc ::anticollider::genveto {vprog} {
|
||||
proc ::anticollider::genveto {veto_rules} {
|
||||
variable veto_region
|
||||
array unset veto_region
|
||||
set lnum 1
|
||||
|
||||
foreach line $vprog {
|
||||
foreach line $veto_rules {
|
||||
array unset vp
|
||||
array set vp $line
|
||||
clientput "::anticollider::veto_rule: $line"
|
||||
|
||||
if [info exists vp(whenall)] {
|
||||
foreach {mot in range} $vp(whenall) {
|
||||
# if {[llength [join $range]] != 2} {
|
||||
@ -88,16 +116,14 @@ proc ::anticollider::enable {args} {
|
||||
#
|
||||
# The ::anticollider::veto_region is a hash indexed by the names of the motors
|
||||
# which have been registered with the anticollision module.
|
||||
proc ::anticollider::acscript {args} {
|
||||
proc ::anticollider::veto_region_acscript {args} {
|
||||
variable veto_region
|
||||
|
||||
if {[::anticollider::enable $args] == "false"} {
|
||||
foreach {regmot target} $args {
|
||||
anticollision add 0 $regmot $target
|
||||
}
|
||||
return
|
||||
}
|
||||
set catch_status [ catch {
|
||||
foreach {regmot target} $args {
|
||||
if { ! [info exists veto_region($regmot)] } {
|
||||
continue
|
||||
}
|
||||
foreach row $veto_region($regmot) {
|
||||
if { [lindex $row 1] == "@and"} {
|
||||
set forbid [lindex $row 0]
|
||||
@ -116,7 +142,6 @@ proc ::anticollider::acscript {args} {
|
||||
} else {
|
||||
foreach {min max} $forbid {}
|
||||
if {$min <= $target && $target <= $max} {
|
||||
broadcast "ERROR:The range ($forbid) is forbidden for $regmot when [lindex $row 2]"
|
||||
error "ERROR:The range ($forbid) is forbidden for $regmot when [lindex $row 2]"
|
||||
}
|
||||
}
|
||||
@ -126,17 +151,14 @@ proc ::anticollider::acscript {args} {
|
||||
if {$obstrange == "@all"} {
|
||||
foreach {min max} [join $forbidden_range] {
|
||||
if {$min <= $target && $target <= $max} {
|
||||
broadcast "ERROR: $regmot target ($target) is in the forbidden region ($forbidden_range)"
|
||||
error "ERROR: $regmot target ($target) is in the forbidden region ($forbidden_range)"
|
||||
}
|
||||
}
|
||||
} else {
|
||||
broadcast "ERROR: veto table must use @all with @any"
|
||||
error "ERROR: veto table must use @all with @any"
|
||||
}
|
||||
} else {
|
||||
if {$obstrange == "@all"} {
|
||||
broadcast "ERROR: veto table must use @any with @all"
|
||||
error "ERROR: veto table must use @any with @all"
|
||||
} else {
|
||||
foreach {lower upper} [join $obstrange] {
|
||||
@ -144,7 +166,6 @@ proc ::anticollider::acscript {args} {
|
||||
if {$lower <= $pos && $pos <= $upper} {
|
||||
foreach {min max} [join $forbidden_range] {
|
||||
if {$min <= $target && $target <= $max} {
|
||||
broadcast "ERROR:The range $min to $max is forbidden for $regmot when $obstmot is in this region ($obstrange)"
|
||||
error "ERROR:The range $min to $max is forbidden for $regmot when $obstmot is in this region ($obstrange)"
|
||||
|
||||
}
|
||||
@ -156,8 +177,9 @@ proc ::anticollider::acscript {args} {
|
||||
}
|
||||
}
|
||||
}
|
||||
anticollision add 0 $regmot $target
|
||||
}
|
||||
} message ]
|
||||
handle_exception $catch_status $message
|
||||
}
|
||||
|
||||
##
|
||||
@ -166,16 +188,37 @@ proc ::anticollider::init {} {
|
||||
variable evp
|
||||
variable veto_region
|
||||
|
||||
if [ catch {
|
||||
::anticollider::genveto $::anticollider::prog
|
||||
set catch_status [ catch {
|
||||
if { ![info exists ::anticollider::veto_rules] } {
|
||||
return
|
||||
}
|
||||
clientput Load anticollider rules:
|
||||
if { [info procs ::anticollider::load_acrules] == "::anticollider::load_acrules" } {
|
||||
::anticollider::load_acrules
|
||||
}
|
||||
::anticollider::genveto $::anticollider::veto_rules
|
||||
foreach motor [array names veto_region] {
|
||||
anticollision register $motor
|
||||
}
|
||||
} message ] {
|
||||
clientput [info level 0] ERROR: $message
|
||||
if {$::errorCode=="NONE"} {return $message}
|
||||
return -code error $message
|
||||
}
|
||||
} message ]
|
||||
handle_exception $catch_status $message
|
||||
}
|
||||
|
||||
lappend ::anticollider::scripts ::anticollider::veto_region_acscript
|
||||
proc ::anticollider::acscript {args} {
|
||||
set catch_status [ catch {
|
||||
if {[::anticollider::enable $args] == "false"} {
|
||||
return
|
||||
} else {
|
||||
foreach {regmot target} $args {
|
||||
anticollision add 0 $regmot $target
|
||||
}
|
||||
}
|
||||
foreach script $::anticollider::scripts {
|
||||
$script {*}$args
|
||||
}
|
||||
} message ]
|
||||
handle_acscript_exception $catch_status $message
|
||||
}
|
||||
|
||||
publish ::anticollider::acscript user
|
||||
|
@ -60,6 +60,7 @@ proc ::counter::ic_initialize {} {
|
||||
|
||||
|
||||
::utility::macro::getset float monitor_counts {} {
|
||||
bm status
|
||||
return "monitor_counts = [SplitReply [bm getcounts]]"
|
||||
}
|
||||
sicslist setatt monitor_counts klass monitor
|
||||
@ -67,6 +68,7 @@ proc ::counter::ic_initialize {} {
|
||||
sicslist setatt monitor_counts mutable true
|
||||
|
||||
::utility::macro::getset float monitor_time {} {
|
||||
bm status
|
||||
return "monitor_time = [SplitReply [bm gettime]]"
|
||||
}
|
||||
sicslist setatt monitor_time klass monitor
|
||||
@ -77,6 +79,7 @@ proc ::counter::ic_initialize {} {
|
||||
set bm_counts bm${bm_num}_counts
|
||||
set bmon bm${bm_num}
|
||||
::utility::macro::getset int $bm_counts {} [subst -nocommands {
|
||||
$bmon status
|
||||
return "[$bmon getcounts]"
|
||||
}]
|
||||
sicslist setatt $bm_counts klass monitor
|
||||
@ -86,6 +89,7 @@ proc ::counter::ic_initialize {} {
|
||||
set bm_time bm${bm_num}_time
|
||||
set bmon bm${bm_num}
|
||||
::utility::macro::getset float $bm_time {} [subst -nocommands {
|
||||
$bmon status
|
||||
return "[$bmon gettime]"
|
||||
}]
|
||||
sicslist setatt $bm_time klass monitor
|
||||
|
302
site_ansto/instrument/config/environment/hiden_xcs.sct
Normal file
302
site_ansto/instrument/config/environment/hiden_xcs.sct
Normal file
@ -0,0 +1,302 @@
|
||||
#
|
||||
# Simple driver generator for the Hiden Isochema XCS vapour delivery system
|
||||
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent
|
||||
#
|
||||
driver hiden_xcs = {
|
||||
# driver_property douglas = clowes
|
||||
vendor = hiden; device = xcs; protocol = std;
|
||||
class = environment
|
||||
simulation_group = environment_simulation
|
||||
add_args = 'terminator {tol 0.5}';
|
||||
make_args = 'tol';
|
||||
protocol_args = '${terminator}';
|
||||
#
|
||||
# Unnamed group has variables at device level
|
||||
#
|
||||
group = {
|
||||
# group_property douglas = clowes
|
||||
type = float
|
||||
priv = user
|
||||
group_property 'data' = 'true'
|
||||
group_property 'nxsave' = 'true'
|
||||
property 'klass' = 'environment'
|
||||
property 'sdsinfo' = '::nexus::scobj::sdsinfo'
|
||||
var enabled = {
|
||||
type = int;
|
||||
priv = user;
|
||||
readable = 10;
|
||||
writeable = 1;
|
||||
read_function = read_digital;
|
||||
write_Function = write_digital;
|
||||
read_command = '?DOUT,2';
|
||||
write_command = '!DOUT,2,';
|
||||
allowed = '0,1';
|
||||
readable = 10;
|
||||
# property junk = junk;
|
||||
}
|
||||
var flow = {
|
||||
driveable = flow
|
||||
mutable = true
|
||||
readable = 1
|
||||
read_command = 'None'
|
||||
fetch_function = fetch_flow
|
||||
read_function = read_flow
|
||||
write_function = write_flow
|
||||
lowerlimit = 0
|
||||
upperlimit = 500
|
||||
tolerance = 1
|
||||
pid_function = pid_flow
|
||||
property pid_error = 0
|
||||
property pid_deriv = 0
|
||||
property pid_integ = 0
|
||||
property pid_pvalue = 0.2
|
||||
property pid_ivalue = 0.1
|
||||
property pid_dvalue = 0.0
|
||||
property pid_imax = 30
|
||||
}
|
||||
var humidity = {
|
||||
driveable = humidity
|
||||
mutable = true
|
||||
readable = 1
|
||||
read_command = '?ALL DATA'
|
||||
read_function = read_all_data
|
||||
write_function = write_humidity
|
||||
checkrange_function = chkrange_function
|
||||
value = 50
|
||||
lowerlimit = 10
|
||||
upperlimit = 90
|
||||
tolerance = 1
|
||||
pid_function = pid_humidity
|
||||
property pid_error = 0
|
||||
property pid_deriv = 0
|
||||
property pid_integ = 0
|
||||
property pid_pvalue = 0.2
|
||||
property pid_ivalue = 0.1
|
||||
property pid_dvalue = 0.0
|
||||
property pid_imax = 30
|
||||
property settle_time = 5.250
|
||||
}
|
||||
var gas_factor = { value = 1.0; }
|
||||
control = false
|
||||
data = false
|
||||
nxsave = false
|
||||
var temperature
|
||||
var flow1
|
||||
var flow2
|
||||
var flow3
|
||||
}
|
||||
#
|
||||
# The named group is at the device level, variables below that
|
||||
#
|
||||
group analog = {
|
||||
# group_property 'data' = true
|
||||
type = float;
|
||||
priv = user;
|
||||
control = false
|
||||
data = false
|
||||
nxsave = false
|
||||
readable = 5;
|
||||
read_function = read_sixteen;
|
||||
property base = 0; # applies to all following vars
|
||||
var pv1 = { read_command = '?AIN,0'; property span = 500; }; # ain0
|
||||
var pv2 = { read_command = '?AIN,1'; property span = 500; }; # ain1
|
||||
var pv3 = { read_command = '?AIN,2'; property span = 500; }; # ain2
|
||||
var rhtemp = { read_command = '?AIN,8'; property span = 100; }; # ain8
|
||||
var rhsense = { read_command = '?AIN,9'; property span = 100; }; # ain9
|
||||
var ansto_temp = { read_command = '?AIN,12'; property span = 100; }; # ain12
|
||||
writeable = 1;
|
||||
read_function = read_twelve;
|
||||
write_function = write_twelve;
|
||||
var sp1 = { read_command = '?AOUT,0'; write_command = '!AOUT,0,'; property span = 500; } # aout0
|
||||
var sp2 = { read_command = '?AOUT,1'; write_command = '!AOUT,1,'; property span = 500; } # aout1
|
||||
var sp3 = { read_command = '?AOUT,2'; write_command = '!AOUT,2,'; property span = 500; } # aout2
|
||||
};
|
||||
|
||||
#
|
||||
# Code lines start with '@' which is stripped before being emitted into generated driver
|
||||
# The code is emitted at the appropriate place in the given function
|
||||
#
|
||||
code read_function read_digital = {
|
||||
@ if { [string equal -nocase -length 5 "${data}" "DOUT ="] } {
|
||||
@ set result [scan "${data}" "DOUT = %d OK" val]
|
||||
@ if { ${result} == 1 } {
|
||||
@ set data ${val}
|
||||
@ } else {
|
||||
@ sct geterror "Syntax error (Result=${result}) in: '${data}'"
|
||||
@ }
|
||||
@ } else {
|
||||
@ sct geterror "Syntax error in: '${data}'"
|
||||
@ }
|
||||
}
|
||||
code read_function read_twelve = {
|
||||
@ if { [string equal -nocase -length 5 "${data}" "AOUT ="] } {
|
||||
@ set result [scan "${data}" "AOUT = %d OK" val]
|
||||
@ if { ${result} == 1 } {
|
||||
@ if { [hpropexists [sct] base] } {
|
||||
@ set base [sct base]
|
||||
@ } else {
|
||||
@ set base 0.0
|
||||
@ }
|
||||
@ if { [hpropexists [sct] span] } {
|
||||
@ set span [sct span]
|
||||
@ } else {
|
||||
@ set span 500.0
|
||||
@ }
|
||||
@ set data [expr (${span} * (${val} - ${base})) / 4095.0]
|
||||
@ } else {
|
||||
@ sct geterror "Syntax (Result=${result}) error in: '${data}'"
|
||||
@ }
|
||||
@ } else {
|
||||
@ sct geterror "Syntax error in: '${data}'"
|
||||
@ }
|
||||
}
|
||||
code read_function read_sixteen = {
|
||||
@ if { [string equal -nocase -length 5 "${data}" "AIN ="] } {
|
||||
@ set result [scan "${data}" "AIN = %d OK" val]
|
||||
@ if { ${result} == 1 } {
|
||||
@ if { [hpropexists [sct] base] } {
|
||||
@ set base [sct base]
|
||||
@ } else {
|
||||
@ set base 0.0
|
||||
@ }
|
||||
@ if { [hpropexists [sct] span] } {
|
||||
@ set span [sct span]
|
||||
@ } else {
|
||||
@ set span 500.0
|
||||
@ }
|
||||
@ set data [expr (${span} * (${val} - ${base})) / 65535.0]
|
||||
@ } else {
|
||||
@ sct geterror "Syntax error (Result=${result}) in: '${data}'"
|
||||
@ }
|
||||
@ } else {
|
||||
@ sct geterror "Syntax error in: '${data}'"
|
||||
@ }
|
||||
}
|
||||
code read_function read_all_data = {
|
||||
@ if { [string equal -nocase -length 2 "${data}" "A "] } {
|
||||
@ set data_list [split [string range "${data}" 2 end-3] ',']
|
||||
@ if { [llength ${data_list}] == 8 } {
|
||||
@ set data [expr [lindex ${data_list} 0]]
|
||||
@ hupdate ${tc_root}/temperature [expr [lindex ${data_list} 1]]
|
||||
@ hupdate ${tc_root}/flow1 [expr [lindex ${data_list} 3] / [hval ${tc_root}/gas_factor]]
|
||||
@ hupdate ${tc_root}/flow2 [expr [lindex ${data_list} 4] / [hval ${tc_root}/gas_factor]]
|
||||
@ hupdate ${tc_root}/flow3 [expr [lindex ${data_list} 5] / [hval ${tc_root}/gas_factor]]
|
||||
@ } else {
|
||||
@ sct geterror "Syntax error (Result=${result}) in: '${data}'"
|
||||
@ }
|
||||
@ } else {
|
||||
@ sct geterror "Syntax error for read_all_data in: '${data}'"
|
||||
@ }
|
||||
@ if { [hpropexists [sct] target] } {
|
||||
@ set pid [pid_humidity ${tc_root} [sct target] ${data}]
|
||||
@ }
|
||||
}
|
||||
code pid_function pid_humidity = {
|
||||
@ set path [pathname [sct]]
|
||||
@ set sign 1
|
||||
@ foreach node [list analog/sp1 analog/sp2] {
|
||||
@ set sign [expr -${sign}]
|
||||
@ set signed_pid [expr ${sign} * ${pid}]
|
||||
@ hsetprop ${path}/${node} bias_humidity ${signed_pid}
|
||||
@ if { [hpropexists ${path}/${node} target] } {
|
||||
@ hset ${path}/${node} [hgetpropval ${path}/${node} target]
|
||||
@ } else {
|
||||
@ hset ${path}/${node} [hval ${path}/${node}]
|
||||
@ }
|
||||
@ }
|
||||
@ }
|
||||
}
|
||||
code fetch_function fetch_flow = {
|
||||
@ set data 0.0
|
||||
@ set targets 0.0
|
||||
@ set path [pathname [sct]]
|
||||
@ foreach node [list flow1 flow2] {
|
||||
@ set data [expr ${data} + [hval ${path}/${node}]]
|
||||
@ }
|
||||
@ sct result ${data}
|
||||
@ foreach node [list analog/sp1 analog/sp2] {
|
||||
@ set targets [expr ${targets} + [hval ${path}/${node}]]
|
||||
@ }
|
||||
@ sct targets ${targets}
|
||||
@ if { [hpropexists [sct] target] } {
|
||||
@ set pid [pid_flow ${tc_root} [sct target] ${data}]
|
||||
@ }
|
||||
@# cut this function short
|
||||
@ return ${nextState}
|
||||
}
|
||||
code pid_function pid_flow = {
|
||||
@ set path [pathname [sct]]
|
||||
@ foreach node [list analog/sp1 analog/sp2] {
|
||||
@ hsetprop ${path}/${node} bias_flow ${pid}
|
||||
@ if { [hpropexists ${path}/${node} target] } {
|
||||
@ hset ${path}/${node} [hgetpropval ${path}/${node} target]
|
||||
@ } else {
|
||||
@ hset ${path}/${node} [hval ${path}/${node}]
|
||||
@ }
|
||||
@ }
|
||||
@ }
|
||||
}
|
||||
code write_function write_digital = {
|
||||
}
|
||||
code write_function write_twelve = {
|
||||
@ if { [hpropexists [sct] base] } {
|
||||
@ set base [sct base]
|
||||
@ } else {
|
||||
@ set base 0.0
|
||||
@ }
|
||||
@ if { [hpropexists [sct] span] } {
|
||||
@ set span [sct span]
|
||||
@ } else {
|
||||
@ set span 500.0
|
||||
@ }
|
||||
@ if { [hpropexists [sct] bias_humidity] } {
|
||||
@ set par [expr ${par} + [sct bias_humidity]]
|
||||
@ }
|
||||
@ if { [hpropexists [sct] bias_flow] } {
|
||||
@ set par [expr ${par} + [sct bias_flow]]
|
||||
@ }
|
||||
@ if { ${par} < 0.0 } {
|
||||
@ set par 0.0
|
||||
@ }
|
||||
@ if { ${par} > ${span} } {
|
||||
@ set par ${span}
|
||||
@ }
|
||||
@ set par [expr int(${base} + (4095.0 * ${par} / ${span}))]
|
||||
@ set cmd "${cmd_str}${par}"
|
||||
}
|
||||
code write_function write_flow = {
|
||||
@ if { [hpropexists ${tc_root}/humidity target] } {
|
||||
@ set humidity_target [hgetpropval ${tc_root}/humidity target]
|
||||
@ } else {
|
||||
@ set humidity_target [hval ${tc_root}/humidity]
|
||||
@ }
|
||||
@ set flow1_target [expr (0.01 * (100.0 - ${humidity_target})) * [sct target]]
|
||||
@ set flow2_target [expr (0.01 * ( ${humidity_target})) * [sct target]]
|
||||
@ hset ${tc_root}/analog/sp1 ${flow1_target}
|
||||
@ hset ${tc_root}/analog/sp2 ${flow2_target}
|
||||
@ set cmd "@@NOSEND@@"
|
||||
}
|
||||
code write_function write_humidity = {
|
||||
@ if { [hpropexists ${tc_root}/flow target] } {
|
||||
@ set flow_target [hgetpropval ${tc_root}/flow target]
|
||||
@ } else {
|
||||
@ set flow_target [hval ${tc_root}/flow]
|
||||
@ }
|
||||
@ set flow1_target [expr (0.01 * (100.0 - [sct target])) * ${flow_target}]
|
||||
@ set flow2_target [expr (0.01 * ( [sct target])) * ${flow_target}]
|
||||
@ hset ${tc_root}/analog/sp1 ${flow1_target}
|
||||
@ hset ${tc_root}/analog/sp2 ${flow2_target}
|
||||
@ set cmd "@@NOSEND@@"
|
||||
}
|
||||
code write_function no_op = {
|
||||
@ set cmd "@@NOSEND@@"
|
||||
}
|
||||
#
|
||||
# This code is after database creation
|
||||
#
|
||||
code mkDriver = {
|
||||
}
|
||||
code chkrange_function = {
|
||||
@ # hooked
|
||||
}
|
||||
};
|
57
site_ansto/instrument/config/environment/isotech_ps.sct
Normal file
57
site_ansto/instrument/config/environment/isotech_ps.sct
Normal file
@ -0,0 +1,57 @@
|
||||
# Simple driver generator for the ISOTECH Power Supply
|
||||
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent
|
||||
#
|
||||
driver isotech_ps = {
|
||||
vendor = isotech; device = ps; protocol = std;
|
||||
class = environment;
|
||||
simulation_group = environment_simulation;
|
||||
protocol_args = '"\r"';
|
||||
group = {
|
||||
readable = 5
|
||||
mutable = true
|
||||
var relay = {
|
||||
type = int;
|
||||
read_command = 'F';
|
||||
read_function = read_relay;
|
||||
writeable = 1
|
||||
write_command = 'KO';
|
||||
write_function = write_relay;
|
||||
}
|
||||
var amps = {
|
||||
type = float;
|
||||
read_command = 'A';
|
||||
units = 'A'
|
||||
}
|
||||
var volts = {
|
||||
type = float;
|
||||
read_command = 'V';
|
||||
writeable = 1;
|
||||
write_command = 'SV';
|
||||
write_function = write_voltage;
|
||||
units = 'V'
|
||||
}
|
||||
}
|
||||
code read_function rdValue = {
|
||||
@ set data [string range [sct result] 1 end]
|
||||
}
|
||||
code read_function read_relay = {
|
||||
@ if { [string equal -nocase -length 2 "F1" "${data}"] } {
|
||||
@ set data 1
|
||||
@ } elseif { [string equal -nocase -length 2 "F0" "${data}"] } {
|
||||
@ set data 0
|
||||
@ } else {
|
||||
@ sct geterror "Unexpected response '${data}' not 'F1' nor 'F0'"
|
||||
@ }
|
||||
}
|
||||
code write_function write_relay = {
|
||||
@ if { ${par} == 0 } {
|
||||
@ set cmd "KOD"
|
||||
@ } else {
|
||||
@ set cmd "KOE"
|
||||
@ }
|
||||
}
|
||||
code write_function write_voltage = {
|
||||
@ set par "[format "%05.2f" [sct target]]"
|
||||
@ set cmd "SV ${par}"
|
||||
}
|
||||
}
|
@ -1125,7 +1125,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
|
||||
if {$drivable == 1} {
|
||||
hsetprop $nodeName check ${ns}::check $scobj_hpath 1
|
||||
hsetprop $nodeName driving 0
|
||||
hsetprop $nodeName checklimits ${ns}::check $scobj_hpath
|
||||
hsetprop $nodeName checklimits ${ns}::check $scobj_hpath 1
|
||||
hsetprop $nodeName checkstatus ${ns}::drivestatus $scobj_hpath
|
||||
hsetprop $nodeName halt ${ns}::halt $scobj_hpath
|
||||
}
|
||||
@ -1322,6 +1322,7 @@ proc mk_sct_bruker_BEC1 {sct_controller klasse tempobj tol} {
|
||||
# Changed ffr 20100625: do not call hinitprops to avoid a conflict with a change in SICServer vers. 2_5
|
||||
#::scobj::hinitprops $tempobj/sensor nominal_outp_current
|
||||
hsetprop $scobj_hpath/pwrctrl/statusByte control false
|
||||
hsetprop $scobj_hpath/sensor/desired_current type drivable
|
||||
|
||||
ansto_makesctdrive ${tempobj}_driveable $scobj_hpath/sensor/desired_current $scobj_hpath/sensor/nominal_outp_current $sct_controller
|
||||
|
||||
|
@ -16,26 +16,6 @@ namespace eval ::scobj::cybaman {
|
||||
close $fd
|
||||
}
|
||||
|
||||
proc basename {node} {
|
||||
set point [string last "/" $node]
|
||||
if { $point < 0 } {
|
||||
return $node
|
||||
} else {
|
||||
incr point
|
||||
return "[string range $node $point end]"
|
||||
}
|
||||
}
|
||||
proc pathname {node} {
|
||||
set point [string last "/" $node]
|
||||
if { $point < 0 } {
|
||||
return ""
|
||||
} else {
|
||||
incr point -1
|
||||
return "[string range $node 0 $point]"
|
||||
}
|
||||
return "[join [lrange [split $node '/'] 0 end-1] '/']"
|
||||
}
|
||||
|
||||
proc splitxml {str} {
|
||||
set my_list [list]
|
||||
set idx 0
|
||||
|
1126
site_ansto/instrument/config/environment/sct_hiden_xcs.tcl
Normal file
1126
site_ansto/instrument/config/environment/sct_hiden_xcs.tcl
Normal file
File diff suppressed because it is too large
Load Diff
357
site_ansto/instrument/config/environment/sct_isotech_ps.tcl
Normal file
357
site_ansto/instrument/config/environment/sct_isotech_ps.tcl
Normal file
@ -0,0 +1,357 @@
|
||||
# Generated driver for isotech_ps
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::isotech_ps {
|
||||
set debug_threshold 0
|
||||
}
|
||||
|
||||
proc ::scobj::isotech_ps::debug_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
if {${debug_level} >= ${::scobj::isotech_ps::debug_threshold}} {
|
||||
set fd [open "/tmp/isotech_ps.log" "a"]
|
||||
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
|
||||
puts ${fd} "${line}"
|
||||
close ${fd}
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
# check function for hset change
|
||||
proc ::scobj::isotech_ps::checkrange {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]"
|
||||
set setpoint [sct target]
|
||||
if { [hpropexists [sct] lowerlimit] } {
|
||||
set lolimit [sct lowerlimit]
|
||||
} else {
|
||||
# lowerlimit not set, use target
|
||||
set lolimit [sct target]
|
||||
}
|
||||
if { [hpropexists [sct] upperlimit] } {
|
||||
set hilimit [sct upperlimit]
|
||||
} else {
|
||||
# upperlimit not set, use target
|
||||
set hilimit [sct target]
|
||||
}
|
||||
# hook code goes here
|
||||
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
|
||||
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
|
||||
}
|
||||
return OK
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to request the read of a parameter on a device
|
||||
proc ::scobj::isotech_ps::getValue {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set cmd "${cmd_str}"
|
||||
# hook code goes here
|
||||
debug_log 1 "getValue sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to check the write parameter on a device
|
||||
proc ::scobj::isotech_ps::noResponse {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
|
||||
# hook code goes here
|
||||
return "idle"
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to parse the read of a parameter on a device
|
||||
proc ::scobj::isotech_ps::rdValue {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "rdValue tc_root=${tc_root} sct=[sct] result=[sct result]"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set data [sct result]
|
||||
set nextState "idle"
|
||||
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
|
||||
# the protocol driver has reported an error
|
||||
sct geterror "${data}"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
# hook code starts
|
||||
set data [string range [sct result] 1 end]
|
||||
# hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log 1 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
if { ${data} != [sct oldval] } {
|
||||
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to parse the read of a parameter on a device
|
||||
proc ::scobj::isotech_ps::read_relay {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "read_relay tc_root=${tc_root} sct=[sct] result=[sct result]"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set data [sct result]
|
||||
set nextState "idle"
|
||||
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
|
||||
# the protocol driver has reported an error
|
||||
sct geterror "${data}"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
# hook code starts
|
||||
if { [string equal -nocase -length 2 "F1" "${data}"] } {
|
||||
set data 1
|
||||
} elseif { [string equal -nocase -length 2 "F0" "${data}"] } {
|
||||
set data 0
|
||||
} else {
|
||||
sct geterror "Unexpected response '${data}' not 'F1' nor 'F0'"
|
||||
}
|
||||
# hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log 1 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
if { ${data} != [sct oldval] } {
|
||||
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to write a parameter value on a device
|
||||
proc ::scobj::isotech_ps::setValue {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set par [sct target]
|
||||
set cmd "${cmd_str}${par}"
|
||||
# hook code goes here
|
||||
if { [hpropexists [sct] driving] } {
|
||||
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
|
||||
sct driving 1
|
||||
}
|
||||
}
|
||||
debug_log 1 "setValue sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to write a parameter value on a device
|
||||
proc ::scobj::isotech_ps::write_relay {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "write_relay tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set par [sct target]
|
||||
set cmd "${cmd_str}${par}"
|
||||
# hook code starts
|
||||
if { ${par} == 0 } {
|
||||
set cmd "KOD"
|
||||
} else {
|
||||
set cmd "KOE"
|
||||
}
|
||||
# hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log 1 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
if { [hpropexists [sct] driving] } {
|
||||
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
|
||||
sct driving 1
|
||||
}
|
||||
}
|
||||
debug_log 1 "write_relay sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to write a parameter value on a device
|
||||
proc ::scobj::isotech_ps::write_voltage {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "write_voltage tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set par [sct target]
|
||||
set cmd "${cmd_str}${par}"
|
||||
# hook code starts
|
||||
set par "[format "%05.2f" [sct target]]"
|
||||
set cmd "SV ${par}"
|
||||
# hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log 1 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
if { [hpropexists [sct] driving] } {
|
||||
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
|
||||
sct driving 1
|
||||
}
|
||||
}
|
||||
debug_log 1 "write_voltage sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
proc ::scobj::isotech_ps::mk_sct_isotech_ps { sct_controller name } {
|
||||
debug_log 1 "mk_sct_isotech_ps for ${name}"
|
||||
set ns "[namespace current]"
|
||||
set catch_status [ catch {
|
||||
|
||||
MakeSICSObj ${name} SCT_OBJECT
|
||||
|
||||
sicslist setatt ${name} klass environment
|
||||
sicslist setatt ${name} long_name ${name}
|
||||
|
||||
set scobj_hpath /sics/${name}
|
||||
|
||||
hfactory ${scobj_hpath}/amps plain user float
|
||||
hsetprop ${scobj_hpath}/amps read ${ns}::getValue ${scobj_hpath} rdValue {A}
|
||||
hsetprop ${scobj_hpath}/amps rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/amps control true
|
||||
hsetprop ${scobj_hpath}/amps data true
|
||||
hsetprop ${scobj_hpath}/amps mutable true
|
||||
hsetprop ${scobj_hpath}/amps nxsave true
|
||||
hsetprop ${scobj_hpath}/amps units A
|
||||
hsetprop ${scobj_hpath}/amps oldval 0.0
|
||||
hsetprop ${scobj_hpath}/amps sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/amps type "part"
|
||||
hsetprop ${scobj_hpath}/amps nxalias "${name}_amps"
|
||||
|
||||
hfactory ${scobj_hpath}/relay plain user int
|
||||
hsetprop ${scobj_hpath}/relay read ${ns}::getValue ${scobj_hpath} read_relay {F}
|
||||
hsetprop ${scobj_hpath}/relay read_relay ${ns}::read_relay ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/relay write ${ns}::write_relay ${scobj_hpath} noResponse {KO}
|
||||
hsetprop ${scobj_hpath}/relay noResponse ${ns}::noResponse ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/relay check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/relay control true
|
||||
hsetprop ${scobj_hpath}/relay data true
|
||||
hsetprop ${scobj_hpath}/relay mutable true
|
||||
hsetprop ${scobj_hpath}/relay nxsave true
|
||||
hsetprop ${scobj_hpath}/relay oldval 0
|
||||
hsetprop ${scobj_hpath}/relay sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/relay type "part"
|
||||
hsetprop ${scobj_hpath}/relay nxalias "${name}_relay"
|
||||
|
||||
hfactory ${scobj_hpath}/volts plain user float
|
||||
hsetprop ${scobj_hpath}/volts read ${ns}::getValue ${scobj_hpath} rdValue {V}
|
||||
hsetprop ${scobj_hpath}/volts rdValue ${ns}::rdValue ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/volts write ${ns}::write_voltage ${scobj_hpath} noResponse {SV}
|
||||
hsetprop ${scobj_hpath}/volts noResponse ${ns}::noResponse ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/volts check ${ns}::checkrange ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/volts control true
|
||||
hsetprop ${scobj_hpath}/volts data true
|
||||
hsetprop ${scobj_hpath}/volts mutable true
|
||||
hsetprop ${scobj_hpath}/volts nxsave true
|
||||
hsetprop ${scobj_hpath}/volts units V
|
||||
hsetprop ${scobj_hpath}/volts oldval 0.0
|
||||
hsetprop ${scobj_hpath}/volts sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/volts type "part"
|
||||
hsetprop ${scobj_hpath}/volts nxalias "${name}_volts"
|
||||
|
||||
if {[SplitReply [environment_simulation]]=="false"} {
|
||||
${sct_controller} poll ${scobj_hpath}/amps 5
|
||||
${sct_controller} poll ${scobj_hpath}/relay 5
|
||||
${sct_controller} poll ${scobj_hpath}/volts 5
|
||||
${sct_controller} write ${scobj_hpath}/relay
|
||||
${sct_controller} write ${scobj_hpath}/volts
|
||||
}
|
||||
hsetprop ${scobj_hpath} klass environment
|
||||
# hook code goes here
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
namespace eval ::scobj::isotech_ps {
|
||||
namespace export debug_log
|
||||
namespace export mk_sct_isotech_ps
|
||||
}
|
||||
|
||||
proc add_isotech_ps {name IP port} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::isotech_ps"
|
||||
${ns}::debug_log 1 "add_isotech_ps ${name} ${IP} ${port}"
|
||||
if {[SplitReply [environment_simulation]]=="false"} {
|
||||
if {[string equal -nocase "aqadapter" "${IP}"]} {
|
||||
${ns}::debug_log 1 "makesctcontroller sct_${name} aqadapter ${port}"
|
||||
makesctcontroller sct_${name} aqadapter ${port}
|
||||
} else {
|
||||
${ns}::debug_log 1 "makesctcontroller sct_${name} std ${IP}:${port} \"\\r\""
|
||||
makesctcontroller sct_${name} std ${IP}:${port} "\r"
|
||||
}
|
||||
}
|
||||
${ns}::debug_log 1 "mk_sct_isotech_ps sct_${name} ${name}"
|
||||
${ns}::mk_sct_isotech_ps sct_${name} ${name}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
puts stdout "file evaluation of sct_isotech_ps.tcl"
|
||||
::scobj::isotech_ps::debug_log 1 "file evaluation of sct_isotech_ps.tcl"
|
||||
|
||||
proc ::scobj::isotech_ps::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::isotech_ps"
|
||||
${ns}::debug_log 1 "Processing Config"
|
||||
dict for {k v} $::config_dict {
|
||||
${ns}::debug_log 1 "Inspecting $k:$v"
|
||||
if { [dict exists $v "driver"] } {
|
||||
${ns}::debug_log 1 "Has driver [dict get $v driver]"
|
||||
if { [dict get $v "driver"] == "isotech_ps" } {
|
||||
${ns}::debug_log 1 "Correct driver, enabled = [dict get $v enabled]"
|
||||
if { [dict get $v enabled] } {
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
set name [dict get $v name]
|
||||
MakeAsyncProtocol ${name}_protocol
|
||||
MakeAsyncQueue ${name}_queue ${name}_protocol ${IP} ${PORT}
|
||||
add_isotech_ps ${name} "aqadapter" ${name}_queue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::isotech_ps::read_config
|
||||
} else {
|
||||
::scobj::isotech_ps:debug_log 1 "No config dict"
|
||||
}
|
@ -468,7 +468,7 @@ sct print "halt $tc_root"
|
||||
proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable nexus gumtree\
|
||||
drivable dataType permission rdCmd rdFunc wrCmd\
|
||||
wrFunc allowedValues klass} {
|
||||
|
||||
debug_log "createNode cmdGroup = $cmdGroup"
|
||||
set catch_status [ catch {
|
||||
set ns "[namespace current]"
|
||||
set nodeName "$scobj_hpath/$cmdGroup/$varName"
|
||||
@ -568,11 +568,11 @@ debug_log "Registering node $nodeName for write callback"
|
||||
}
|
||||
|
||||
set num_pumps 2
|
||||
for {set i 0} { i < $num_pumps } { incr i } {
|
||||
for {set i 0} { $i < $num_pumps } { incr i } {
|
||||
set cmdGroup "Pump[set i]"
|
||||
hfactory $scobj_hpath/[set cmdGroup] plain spy none
|
||||
foreach {cmdGroup varName readable writable nexus gumtree drivable dataType permission rdCmd rdFunc wrCmd wrFunc allowedValues} $deviceCommand {
|
||||
createNode $scobj_hpath $sct_controller $cmdGroup $varName $readable $writable $nexus $gumtree $drivable $dataType $permission $rdCmd $rdFunc $wrCmd $wrFunc $allowedValues $klass
|
||||
createNode $scobj_hpath $sct_controller ${cmdGroup}$i $varName $readable $writable $nexus $gumtree $drivable $dataType $permission $rdCmd $rdFunc $wrCmd $wrFunc $allowedValues $klass
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,111 @@
|
||||
#
|
||||
# Simple driver generator for the Julabo LH45
|
||||
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent
|
||||
#
|
||||
driver julabo_lh45_gen = {
|
||||
vendor = julabo; device = lh45; protocol = std;
|
||||
class = environment
|
||||
simulation_group = environment_simulation
|
||||
add_args = '{sensor "bath"} {tol 5.0}';
|
||||
make_args = 'sensor tol';
|
||||
protocol_args = '"\r"';
|
||||
#
|
||||
# Unnamed group has variables at device level
|
||||
#
|
||||
group = {
|
||||
priv = user
|
||||
type = float
|
||||
var setpoint = {
|
||||
driveable = sensor/'value'
|
||||
readable = 1
|
||||
read_command = 'in_sp_00'
|
||||
write_function = setPoint
|
||||
write_command = 'out_sp_00'
|
||||
lowerlimit = 10
|
||||
upperlimit = 90
|
||||
tolerance = 2
|
||||
}
|
||||
var overtemp_warnlimit = {
|
||||
readable = 1
|
||||
read_command = 'in_sp_03'
|
||||
#write_command = 'out_sp_03'
|
||||
}
|
||||
var subtemp_warnlimit = {
|
||||
readable = 1
|
||||
read_command = 'in_sp_04'
|
||||
#write_command = 'out_sp_04'
|
||||
}
|
||||
var heating_power_percent = {
|
||||
readable = 1
|
||||
read_command = 'in_pv_01';
|
||||
};
|
||||
var power = {
|
||||
readable = 1
|
||||
read_command = 'in_mode_05';
|
||||
writeable = 1;
|
||||
write_command = 'out_mode_05';
|
||||
};
|
||||
var lh45_state = {
|
||||
readable = 1
|
||||
read_command = 'status';
|
||||
fetch_function = getState
|
||||
read_function = rdState
|
||||
}
|
||||
var lh45_lasterror = { type = text; }
|
||||
var remote_ctrl = { type = text; priv = spy; }
|
||||
}
|
||||
#
|
||||
# The named group is at the device level, variables below that
|
||||
#
|
||||
group sensor = {
|
||||
type = float;
|
||||
priv = internal;
|
||||
readable = 1;
|
||||
var 'value' = { read_command = 'in_pv_00'; units = 'C' };
|
||||
var bathtemp = { read_command = 'in_pv_00'; units = 'C' };
|
||||
};
|
||||
|
||||
#
|
||||
# Code lines start with '@' which is stripped before being emitted into generated driver
|
||||
# The code is emitted at the appropriate place in the given function
|
||||
#
|
||||
code read_function rdValue = {
|
||||
}
|
||||
code Write_function setPoint = {
|
||||
}
|
||||
#
|
||||
# This code is after database creation
|
||||
#
|
||||
code mkDriver = {
|
||||
@# TODO use the ${sensor} and ${tol} arguments
|
||||
}
|
||||
|
||||
code read_function rdState = {
|
||||
@ if {${data} != [sct oldval]} {
|
||||
@ debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
||||
@ sct oldval ${data}
|
||||
@ sct update ${data}
|
||||
@ sct utime readtime
|
||||
@ switch -- [lindex ${data} 0] {
|
||||
@ "00" {
|
||||
@ hset ${tc_root}/remote_ctrl False
|
||||
@ }
|
||||
@ "01" {
|
||||
@ hset ${tc_root}/remote_ctrl False
|
||||
@ }
|
||||
@ "02" {
|
||||
@ hset ${tc_root}/remote_ctrl True
|
||||
@ }
|
||||
@ "03" {
|
||||
@ hset ${tc_root}/remote_ctrl True
|
||||
@ }
|
||||
@ default {
|
||||
@ hset ${tc_root}/remote_ctrl UNKNOWN
|
||||
@ hset ${tc_root}/lh45_lasterror ${data}
|
||||
@ sct geterror ${data}
|
||||
@ }
|
||||
@ }
|
||||
@ }
|
||||
}
|
||||
|
||||
};
|
@ -78,11 +78,9 @@ proc ::scobj::ls218::rdValue {nodeName varName idx} {
|
||||
set replyData [string trimright [sct result] " \r\n"]
|
||||
|
||||
if {[string first "ASCERR" $replyData] != -1} {
|
||||
#broadcast "Error in LS218 Response: ASCERR:"
|
||||
sct geterror $replyData
|
||||
return -code error "Error in LS218 Response: $replyData"
|
||||
} elseif {[string length $replyData] < 1} {
|
||||
#broadcast "Error in LS218 Response: no message returned from device"
|
||||
return -code error "Error in LS218: no message returned from device"
|
||||
} else {
|
||||
set fields [split $replyData ,]
|
||||
@ -119,7 +117,6 @@ proc ::scobj::ls218::rdValue {nodeName varName idx} {
|
||||
}
|
||||
}
|
||||
"Celsius" { hset $nodeName [lindex $fields 0]
|
||||
#append $logString " Celsius - $fields;"
|
||||
set curValue [lindex $fields 0]
|
||||
}
|
||||
"CurveHd" { hset $nodeName/curve [lindex $fields 0]
|
||||
@ -193,33 +190,34 @@ proc ::scobj::ls218::rdValue {nodeName varName idx} {
|
||||
}
|
||||
}
|
||||
"mnmxValue" { hset $nodeName "[lindex $fields 0] , [lindex $fields 1]"}
|
||||
"status" { hset $nodeName ""
|
||||
"status" {
|
||||
# RDGST? chID Reads input status returns an integer with the following meaning
|
||||
# Bit Weighting StatusIndicator
|
||||
# 4 16 temp underrange
|
||||
# 5 32 temp overrange
|
||||
# 6 64 units under range
|
||||
# 7 128 untis over range
|
||||
set curValue $fields
|
||||
set field [string trimleft $fields 0]
|
||||
if {[string length $field] == 0} {
|
||||
set field 0
|
||||
}
|
||||
set stateString ""
|
||||
set i [format %x $field]
|
||||
}
|
||||
|
||||
set str ""
|
||||
set i [format %x $field]
|
||||
set i [expr 0x$i >> 4]
|
||||
set bitValue [expr 0x$i & 0x01]
|
||||
if {$bitValue == 1} { append $stateString "temp underrange; " }
|
||||
if {$bitValue == 1} { append str "temp underrange, " }
|
||||
set i [expr 0x$i >> 1]
|
||||
set bitValue [expr 0x$i & 0x01]
|
||||
if {$bitValue == 1} { append $stateString "temp overrange; " }
|
||||
if {$bitValue == 1} { append str "temp overrange, " }
|
||||
set i [expr 0x$i >> 1]
|
||||
set bitValue [expr 0x$i & 0x01]
|
||||
if {$bitValue == 1} { append $stateString "units under range; " }
|
||||
if {$bitValue == 1} { append str "units under range, " }
|
||||
set i [expr 0x$i >> 1]
|
||||
set bitValue [expr 0x$i & 0x01]
|
||||
if {$bitValue == 1} { append $stateString "untis over range; " }
|
||||
hset $nodeName $stateString
|
||||
if {$bitValue == 1} { append str "untis over range" }
|
||||
|
||||
hset $nodeName $str
|
||||
}
|
||||
"SensorUnitValue" { hset $nodeName $fields
|
||||
#append $logString " SensorUnitValue - $fields;"
|
||||
@ -350,7 +348,7 @@ proc createNode {scobj_hpath idx sct_controller cmdGroup varName readable pollEn
|
||||
if {$pollEnabled == 1} {
|
||||
if {[SplitReply [environment_simulation]]=="false"} {
|
||||
# puts "enabling polling for $nodeName"
|
||||
$sct_controller poll $nodeName
|
||||
$sct_controller poll $nodeName 3
|
||||
}
|
||||
}
|
||||
} message ]} {
|
||||
@ -622,14 +620,16 @@ proc ::scobj::ls218::mkLS218 {argList} {
|
||||
# @internal time internal in polling the nodes
|
||||
# @return nothing (well, the sct object)
|
||||
|
||||
MakeAsyncProtocol std
|
||||
MakeAsyncQueue ls218 std 137.157.202.214 4002
|
||||
::scobj::ls218::mkLS218 {
|
||||
name ls218
|
||||
IP 137.157.202.214
|
||||
PORT 4002
|
||||
IP aqadapter
|
||||
PORT ls218
|
||||
tuning 1
|
||||
interval 5
|
||||
inputChan {1 2}
|
||||
outputChan {}
|
||||
relayChan {}
|
||||
inputChan {1 2 3 4 5 6 7 8}
|
||||
outputChan {1 2}
|
||||
relayChan {1 2 3 4 5 6 7 8}
|
||||
}
|
||||
|
||||
|
@ -1579,7 +1579,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
|
||||
# @param tempobj short name for the temperature controller scriptcontext object (typ. tc1 or tc2)
|
||||
# @param tol temperature tolerance in Kelvin (typ. 1)
|
||||
# @return nothing (well, the sct object)
|
||||
proc mk_sct_lakeshore_336 {sct_controller klasse tempobj tol1 tol2 verbose} {
|
||||
proc mk_sct_lakeshore_336 {sct_controller klasse tempobj CID CTYPE tol1 tol2 verbose} {
|
||||
if {[ catch {
|
||||
MakeSICSObj $tempobj SCT_OBJECT
|
||||
sicslist setatt $tempobj klass $klasse
|
||||
@ -1846,7 +1846,22 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
|
||||
# Problem: Does not write non-numbers to the hdf file unless told differently - but how?
|
||||
# How can I make it write the NAME (or any character/string variable) to the hdf file?
|
||||
# ::scobj::hinitprops $tempobj/sensor sampleSensor
|
||||
hsetprop $scobj_hpath/sensor/setpoint1 permlink data_set ${CTYPE}${CID}SP1
|
||||
hsetprop $scobj_hpath/sensor/setpoint1 @description ${CTYPE}${CID}SP1
|
||||
hsetprop $scobj_hpath/sensor/setpoint2 permlink data_set ${CTYPE}${CID}SP2
|
||||
hsetprop $scobj_hpath/sensor/setpoint2 @description ${CTYPE}${CID}SP2
|
||||
|
||||
hsetprop $scobj_hpath/sensor/sensorValueA permlink data_set ${CTYPE}${CID}S1
|
||||
hsetprop $scobj_hpath/sensor/sensorValueA @description ${CTYPE}${CID}S1
|
||||
hsetprop $scobj_hpath/sensor/sensorValueB permlink data_set ${CTYPE}${CID}S2
|
||||
hsetprop $scobj_hpath/sensor/sensorValueB @description ${CTYPE}${CID}S2
|
||||
hsetprop $scobj_hpath/sensor/sensorValueC permlink data_set ${CTYPE}${CID}S3
|
||||
hsetprop $scobj_hpath/sensor/sensorValueC @description ${CTYPE}${CID}S3
|
||||
hsetprop $scobj_hpath/sensor/sensorValueD permlink data_set ${CTYPE}${CID}S4
|
||||
hsetprop $scobj_hpath/sensor/sensorValueD @description ${CTYPE}${CID}S4
|
||||
|
||||
hsetprop $scobj_hpath/sensor/setpoint1 type drivable
|
||||
hsetprop $scobj_hpath/sensor/setpoint2 type drivable
|
||||
ansto_makesctdrive ${tempobj}_driveable $scobj_hpath/sensor/setpoint1 $scobj_hpath/sensor/ctrlLp1_value $sct_controller
|
||||
ansto_makesctdrive ${tempobj}_driveable2 $scobj_hpath/sensor/setpoint2 $scobj_hpath/sensor/ctrlLp2_value $sct_controller
|
||||
|
||||
@ -1871,7 +1886,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
|
||||
# @param port port number on the moxabox (typ. 4001, 4002, 4003, or 4004)
|
||||
# @param tol temperature tolerance in Kelvin (typ. 1)
|
||||
# @return nothing (well, the sct object)
|
||||
proc add_sct_ls336 {name IP port terminator {_tol1 1.0} {_tol2 1.0} {_verbose 0} } {
|
||||
proc add_sct_ls336 {name IP port terminator {_tol1 1.0} {_tol2 1.0} {CID 1} {CTYPE T} {_verbose 0} } {
|
||||
# ffr 2009-11-09, Don't create a temperature controller for the script validator, this causes the
|
||||
# lakeshore to lock up.
|
||||
# NOTE: I put this outside the catch block because "return" raises an exception
|
||||
@ -1885,9 +1900,9 @@ proc add_sct_ls336 {name IP port terminator {_tol1 1.0} {_tol2 1.0} {_verbose 0}
|
||||
makesctcontroller sct_ls336_$name aqadapter ${port}
|
||||
} else {
|
||||
puts "\nadd_ls336: makesctcontroller sct_ls336_$name std ${IP}:$port $terminator for Lakeshore model 336"
|
||||
makesctcontroller sct_ls336_$name std ${IP}:$port $terminator
|
||||
makesctcontroller sct_ls336_$name std ${IP}:$port {*}$terminator
|
||||
}
|
||||
mk_sct_lakeshore_336 sct_ls336_$name environment $name $_tol1 $_tol2 $_verbose
|
||||
::scobj::ls336::mk_sct_lakeshore_336 sct_ls336_$name environment $name $CID $CTYPE $_tol1 $_tol2 $_verbose
|
||||
makesctemon $name /sics/$name/emon/monMode_Lp1 /sics/$name/emon/isInTolerance_Lp1 /sics/$name/emon/errhandler
|
||||
# set m2 "_2"
|
||||
# makesctemon $name$m2 /sics/$name/emon/monMode_Lp2 /sics/$name/emon/isInTolerance_Lp2 /sics/$name/emon/errhandler
|
||||
@ -1896,4 +1911,34 @@ proc add_sct_ls336 {name IP port terminator {_tol1 1.0} {_tol2 1.0} {_verbose 0}
|
||||
}
|
||||
}
|
||||
|
||||
if {[ catch {
|
||||
if { [ info exists ::config_dict ] } {
|
||||
if { [ dict get $::config_dict ls336_1 enabled ] } {
|
||||
set IP [dict get $::config_dict ls336_1 ip]
|
||||
set PORT [dict get $::config_dict ls336_1 port]
|
||||
set name [dict get $::config_dict ls336_1 name]
|
||||
set ctype [dict get $::config_dict ls336_1 type]
|
||||
set cid [dict get $::config_dict ls336_1 id]
|
||||
set term [dict get $::config_dict ls336_1 terminator]
|
||||
set tol1 [dict get $::config_dict ls336_1 tol1]
|
||||
set tol2 [dict get $::config_dict ls336_1 tol2]
|
||||
|
||||
add_sct_ls336 $name $IP $PORT $term $tol1 $tol2 $cid $ctype
|
||||
}
|
||||
if { [ dict get $::config_dict ls336_2 enabled ] } {
|
||||
set IP [dict get $::config_dict ls336_2 ip]
|
||||
set PORT [dict get $::config_dict ls336_2 port]
|
||||
set name [dict get $::config_dict ls336_2 name]
|
||||
set ctype [dict get $::config_dict ls336_2 type]
|
||||
set cid [dict get $::config_dict ls336_2 id]
|
||||
set term [dict get $::config_dict ls336_2 terminator]
|
||||
set tol1 [dict get $::config_dict ls336_2 tol1]
|
||||
set tol2 [dict get $::config_dict ls336_2 tol2]
|
||||
|
||||
add_sct_ls336 $name $IP $PORT $term $tol1 $tol2 $cid $ctype
|
||||
}
|
||||
}
|
||||
} message ]} {
|
||||
puts "ERROR: $message"
|
||||
}
|
||||
namespace import ::scobj::ls336::*
|
||||
|
@ -1755,7 +1755,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
|
||||
# @param tempobj short name for the temperature controller scriptcontext object (typ. tc1 or tc2)
|
||||
# @param tol temperature tolerance in Kelvin (typ. 1)
|
||||
# @return nothing (well, the sct object)
|
||||
proc mk_sct_lakeshore_340 {sct_controller klasse tempobj LSmodel tol1 tol2 verbose} {
|
||||
proc mk_sct_lakeshore_340 {sct_controller klasse tempobj CID CTYPE LSmodel tol1 tol2 verbose} {
|
||||
if {[ catch {
|
||||
set ::scobj::ls340::ls340_driveTolerance1 $tol1
|
||||
set ::scobj::ls340::ls340_driveTolerance2 $tol2
|
||||
@ -2050,6 +2050,19 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
|
||||
# Problem: Does not write non-numbers to the hdf file unless told differently - but how?
|
||||
# How can I make it write the NAME (or any character/string variable) to the hdf file?
|
||||
# ::scobj::hinitprops $tempobj/sensor sampleSensor
|
||||
hsetprop $scobj_hpath/sensor/setpoint1 permlink data_set ${CTYPE}${CID}SP1
|
||||
hsetprop $scobj_hpath/sensor/setpoint1 @description ${CTYPE}${CID}SP1
|
||||
hsetprop $scobj_hpath/sensor/setpoint2 permlink data_set ${CTYPE}${CID}SP2
|
||||
hsetprop $scobj_hpath/sensor/setpoint2 @description ${CTYPE}${CID}SP2
|
||||
|
||||
hsetprop $scobj_hpath/sensor/sensorValueA permlink data_set ${CTYPE}${CID}S1
|
||||
hsetprop $scobj_hpath/sensor/sensorValueA @description ${CTYPE}${CID}S1
|
||||
hsetprop $scobj_hpath/sensor/sensorValueB permlink data_set ${CTYPE}${CID}S2
|
||||
hsetprop $scobj_hpath/sensor/sensorValueB @description ${CTYPE}${CID}S2
|
||||
hsetprop $scobj_hpath/sensor/sensorValueC permlink data_set ${CTYPE}${CID}S3
|
||||
hsetprop $scobj_hpath/sensor/sensorValueC @description ${CTYPE}${CID}S3
|
||||
hsetprop $scobj_hpath/sensor/sensorValueD permlink data_set ${CTYPE}${CID}S4
|
||||
hsetprop $scobj_hpath/sensor/sensorValueD @description ${CTYPE}${CID}S4
|
||||
|
||||
hsetprop $scobj_hpath/sensor/setpoint1 type drivable
|
||||
hsetprop $scobj_hpath/sensor/setpoint2 type drivable
|
||||
@ -2077,7 +2090,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable p
|
||||
# @param port port number on the moxabox (typ. 4001, 4002, 4003, or 4004)
|
||||
# @param tol temperature tolerance in Kelvin (typ. 1)
|
||||
# @return nothing (well, the sct object)
|
||||
proc add_sct_ls340 {name IP port terminator {_tol1 1.0} {_tol2 1.0} {_verbose 0} } {
|
||||
proc add_sct_ls340 {name IP port terminator {_tol1 1.0} {_tol2 1.0} {CID 1} {CTYPE T} {_verbose 0} } {
|
||||
# ffr 2009-11-09, Don't create a temperature controller for the script validator, this causes the
|
||||
# lakeshore to lock up.
|
||||
# NOTE: I put this outside the catch block because "return" raises an exception
|
||||
@ -2091,9 +2104,9 @@ proc add_sct_ls340 {name IP port terminator {_tol1 1.0} {_tol2 1.0} {_verbose 0}
|
||||
makesctcontroller sct_ls340_$name aqadapter ${port}
|
||||
} else {
|
||||
puts "\nadd_ls340: makesctcontroller sct_ls340_$name std ${IP}:$port $terminator for Lakeshore model 340"
|
||||
makesctcontroller sct_ls340_$name std ${IP}:$port $terminator
|
||||
makesctcontroller sct_ls340_$name std ${IP}:$port {*}$terminator
|
||||
}
|
||||
mk_sct_lakeshore_340 sct_ls340_$name environment $name $_ls340_LSmodel $_tol1 $_tol2 $_verbose
|
||||
::scobj::ls340::mk_sct_lakeshore_340 sct_ls340_$name environment $name $CID $CTYPE $_ls340_LSmodel $_tol1 $_tol2 $_verbose
|
||||
makesctemon $name /sics/$name/emon/monMode_Lp1 /sics/$name/emon/isInTolerance_Lp1 /sics/$name/emon/errhandler
|
||||
# set m2 "_2"
|
||||
# makesctemon $name$m2 /sics/$name/emon/monMode_Lp2 /sics/$name/emon/isInTolerance_Lp2 /sics/$name/emon/errhandler
|
||||
@ -2102,16 +2115,34 @@ proc add_sct_ls340 {name IP port terminator {_tol1 1.0} {_tol2 1.0} {_verbose 0}
|
||||
}
|
||||
}
|
||||
|
||||
if {[ catch {
|
||||
if { [ info exists ::config_dict ] } {
|
||||
if { [ dict get $::config_dict ls340_1 enabled ] } {
|
||||
set IP [dict get $::config_dict ls340_1 ip]
|
||||
set PORT [dict get $::config_dict ls340_1 port]
|
||||
set name [dict get $::config_dict ls340_1 name]
|
||||
set term [dict get $::config_dict ls340_1 terminator]
|
||||
set tol1 [dict get $::config_dict ls340_1 tol1]
|
||||
set tol2 [dict get $::config_dict ls340_1 tol2]
|
||||
set IP [dict get $::config_dict ls340_1 ip]
|
||||
set PORT [dict get $::config_dict ls340_1 port]
|
||||
set name [dict get $::config_dict ls340_1 name]
|
||||
set ctype [dict get $::config_dict ls340_1 type]
|
||||
set cid [dict get $::config_dict ls340_1 id]
|
||||
set term [dict get $::config_dict ls340_1 terminator]
|
||||
set tol1 [dict get $::config_dict ls340_1 tol1]
|
||||
set tol2 [dict get $::config_dict ls340_1 tol2]
|
||||
|
||||
add_sct_ls340 $name $IP $PORT $term $tol1 $tol2
|
||||
add_sct_ls340 $name $IP $PORT $term $tol1 $tol2 $cid $ctype
|
||||
}
|
||||
if { [ dict get $::config_dict ls340_2 enabled ] } {
|
||||
set IP [dict get $::config_dict ls340_2 ip]
|
||||
set PORT [dict get $::config_dict ls340_2 port]
|
||||
set name [dict get $::config_dict ls340_2 name]
|
||||
set ctype [dict get $::config_dict ls340_2 type]
|
||||
set cid [dict get $::config_dict ls340_2 id]
|
||||
set term [dict get $::config_dict ls340_2 terminator]
|
||||
set tol1 [dict get $::config_dict ls340_2 tol1]
|
||||
set tol2 [dict get $::config_dict ls340_2 tol2]
|
||||
|
||||
add_sct_ls340 $name $IP $PORT $term $tol1 $tol2 $cid $ctype
|
||||
}
|
||||
}
|
||||
} message ]} {
|
||||
puts "ERROR: $message"
|
||||
}
|
||||
namespace import ::scobj::ls340::*
|
||||
|
@ -74,25 +74,6 @@ namespace eval ::scobj::[set vendor]_[set device] {
|
||||
debug_log 1 "Extract channel $result from argument $arg"
|
||||
return $result
|
||||
}
|
||||
proc basename {node} {
|
||||
set point [string last "/" $node]
|
||||
if { $point < 0 } {
|
||||
return $node
|
||||
} else {
|
||||
incr point
|
||||
return "[string range $node $point end]"
|
||||
}
|
||||
}
|
||||
proc pathname {node} {
|
||||
set point [string last "/" $node]
|
||||
if { $point < 0 } {
|
||||
return ""
|
||||
} else {
|
||||
incr point -1
|
||||
return "[string range $node 0 $point]"
|
||||
}
|
||||
return "[join [lrange [split $node '/'] 0 end-1] '/']"
|
||||
}
|
||||
|
||||
proc setValue {tc_root nextState cmd} {
|
||||
# send a command to set a value
|
||||
@ -948,13 +929,13 @@ namespace import ::scobj::[set vendor]_[set device]::*
|
||||
# add_lakeshore_370 "tc371" 127.0.0.1 7371 2.0
|
||||
|
||||
|
||||
if { [ info exists ::config_dict ] && [ dict get $::config_dict ls370_2 enabled ] } {
|
||||
if { [ info exists ::config_dict ] && [ dict get $::config_dict ls370 enabled ] } {
|
||||
puts "ADD LAKESHORE 370"
|
||||
set IP [dict get $::config_dict ls370_2 ip]
|
||||
set PORT [dict get $::config_dict ls370_2 port]
|
||||
set NAME [dict get $::config_dict ls370_2 name]
|
||||
set TOL [dict get $::config_dict ls370_2 tol]
|
||||
set TERM [dict get $::config_dict ls370_2 terminator]
|
||||
set IP [dict get $::config_dict ls370 ip]
|
||||
set PORT [dict get $::config_dict ls370 port]
|
||||
set NAME [dict get $::config_dict ls370 name]
|
||||
set TOL [dict get $::config_dict ls370 tol]
|
||||
set TERM [dict get $::config_dict ls370 terminator]
|
||||
add_lakeshore_370 $NAME $IP $PORT $TOL
|
||||
}
|
||||
|
||||
|
@ -80,25 +80,6 @@ namespace eval ::scobj::[set vendor]_[set device] {
|
||||
debug_log 1 "Extract channel $result from argument $arg"
|
||||
return $result
|
||||
}
|
||||
proc basename {node} {
|
||||
set point [string last "/" $node]
|
||||
if { $point < 0 } {
|
||||
return $node
|
||||
} else {
|
||||
incr point
|
||||
return "[string range $node $point end]"
|
||||
}
|
||||
}
|
||||
proc pathname {node} {
|
||||
set point [string last "/" $node]
|
||||
if { $point < 0 } {
|
||||
return ""
|
||||
} else {
|
||||
incr point -1
|
||||
return "[string range $node 0 $point]"
|
||||
}
|
||||
return "[join [lrange [split $node '/'] 0 end-1] '/']"
|
||||
}
|
||||
|
||||
proc setPoint {tc_root nextState cmd} {
|
||||
# send a command to set a value
|
||||
@ -703,8 +684,8 @@ namespace eval ::scobj::[set vendor]_[set device] {
|
||||
return OK
|
||||
}
|
||||
|
||||
proc mk_sct_driver {sct_controller the_klass the_name tol} {
|
||||
debug_log 1 "mk_sct_driver $sct_controller $the_klass $the_name $tol"
|
||||
proc mk_sct_driver {sct_controller the_klass the_name tol CID CTYPE} {
|
||||
debug_log 1 "mk_sct_driver $sct_controller $the_klass $the_name $tol $CID $CTYPE"
|
||||
set catch_status [ catch {
|
||||
|
||||
MakeSICSObj $the_name SCT_OBJECT
|
||||
@ -845,7 +826,31 @@ if {0} {
|
||||
debug_log 5 "error in [ns]::mk_sct_driver($point) $catch_message_2"
|
||||
return -code error "in [ns]::mk_sct_driver($point) $catch_message_2"
|
||||
}
|
||||
hsetprop $scobj_hpath/Loop1/setpoint permlink data_set ${CTYPE}${CID}SP1
|
||||
hsetprop $scobj_hpath/Loop1/setpoint @description ${CTYPE}${CID}SP1
|
||||
hsetprop $scobj_hpath/Loop1/setpoint permlink data_set ${CTYPE}${CID}SP1
|
||||
hsetprop $scobj_hpath/Loop1/setpoint @description ${CTYPE}${CID}SP1
|
||||
hsetprop $scobj_hpath/Loop2/setpoint permlink data_set ${CTYPE}${CID}SP2
|
||||
hsetprop $scobj_hpath/Loop2/setpoint @description ${CTYPE}${CID}SP2
|
||||
hsetprop $scobj_hpath/Loop3/setpoint permlink data_set ${CTYPE}${CID}SP3
|
||||
hsetprop $scobj_hpath/Loop3/setpoint @description ${CTYPE}${CID}SP3
|
||||
hsetprop $scobj_hpath/Loop4/setpoint permlink data_set ${CTYPE}${CID}SP4
|
||||
hsetprop $scobj_hpath/Loop4/setpoint @description ${CTYPE}${CID}SP4
|
||||
|
||||
hsetprop $scobj_hpath/Loop1/sensor permlink data_set ${CTYPE}${CID}S1
|
||||
hsetprop $scobj_hpath/Loop1/sensor @description ${CTYPE}${CID}S1
|
||||
hsetprop $scobj_hpath/Loop2/sensor permlink data_set ${CTYPE}${CID}S2
|
||||
hsetprop $scobj_hpath/Loop2/sensor @description ${CTYPE}${CID}S2
|
||||
hsetprop $scobj_hpath/Loop3/sensor permlink data_set ${CTYPE}${CID}S3
|
||||
hsetprop $scobj_hpath/Loop3/sensor @description ${CTYPE}${CID}S3
|
||||
hsetprop $scobj_hpath/Loop4/sensor permlink data_set ${CTYPE}${CID}S4
|
||||
hsetprop $scobj_hpath/Loop4/sensor @description ${CTYPE}${CID}S4
|
||||
|
||||
if {[SplitReply [environment_simulation]]=="false"} {
|
||||
hsetprop $scobj_hpath/Loop1/setpoint type drivable
|
||||
hsetprop $scobj_hpath/Loop2/setpoint type drivable
|
||||
hsetprop $scobj_hpath/Loop3/setpoint type drivable
|
||||
hsetprop $scobj_hpath/Loop4/setpoint type drivable
|
||||
ansto_makesctdrive ${the_name}_loop1 $scobj_hpath/Loop1/setpoint $scobj_hpath/Loop1/sensor $sct_controller
|
||||
ansto_makesctdrive ${the_name}_loop2 $scobj_hpath/Loop2/setpoint $scobj_hpath/Loop2/sensor $sct_controller
|
||||
ansto_makesctdrive ${the_name}_loop3 $scobj_hpath/Loop3/setpoint $scobj_hpath/Loop3/sensor $sct_controller
|
||||
@ -858,9 +863,9 @@ if {0} {
|
||||
}
|
||||
}
|
||||
|
||||
proc add_[set vendor]_[set device] {the_name IP port {_tol 5.0}} {
|
||||
proc add_[set vendor]_[set device] {the_name IP port CID CTYPE terminator {_tol 5.0}} {
|
||||
set [ns]::log_file "/tmp/[set [ns]::ven_dev]_[set the_name].log"
|
||||
set fd [open [ns]::log_file "w"]
|
||||
set fd [open [set [ns]::log_file] "w"]
|
||||
close $fd
|
||||
debug_log 1 "add_[set [ns]::vendor]_[set [ns]::device] ${the_name} ${IP} ${port} ${_tol}"
|
||||
puts "Namespace: [namespace current]"
|
||||
@ -872,10 +877,10 @@ if {0} {
|
||||
puts "[namespace current]::log_file [set [namespace current]::log_file]"
|
||||
if {[SplitReply [environment_simulation]]=="false"} {
|
||||
debug_log 1 "makesctcontroller sct_${the_name} std ${IP}:${port}"
|
||||
makesctcontroller sct_${the_name} std ${IP}:${port} "\r\n"
|
||||
makesctcontroller sct_${the_name} std ${IP}:${port} {*}$terminator
|
||||
}
|
||||
debug_log 1 "mk_sct_driver sct_${the_name} environment ${the_name} ${_tol}"
|
||||
mk_sct_driver sct_${the_name} environment ${the_name} ${_tol}
|
||||
debug_log 1 "::scobj::oxford_mercury::mk_sct_driver sct_${the_name} environment ${the_name} ${_tol} $CID $CTYPE"
|
||||
::scobj::oxford_mercury::mk_sct_driver sct_${the_name} environment ${the_name} ${_tol} $CID $CTYPE
|
||||
}
|
||||
|
||||
|
||||
@ -890,8 +895,11 @@ if { [ info exists ::config_dict ] && [ dict get $::config_dict mercury_scipi en
|
||||
puts "ADD MERCURY SCIPI MODE"
|
||||
set IP [dict get $::config_dict mercury_scipi ip]
|
||||
set PORT [dict get $::config_dict mercury_scipi port]
|
||||
set NAME [dict get $::config_dict mercury_scipi name]
|
||||
set TOL [dict get $::config_dict mercury_scipi tol]
|
||||
add_oxford_mercury $NAME $IP $PORT 2.0 "\r"
|
||||
set name [dict get $::config_dict mercury_scipi name]
|
||||
set ctype [dict get $::config_dict mercury_scipi type]
|
||||
set cid [dict get $::config_dict mercury_scipi id]
|
||||
set tol [dict get $::config_dict mercury_scipi tol]
|
||||
set term [dict get $::config_dict mercury_scipi terminator]
|
||||
add_oxford_mercury $name $IP $PORT $cid $ctype {*}$term $tol
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ debug_log "rdValue [sct] [sct result]"
|
||||
hsetprop $tc_root/setpoint driving 1
|
||||
}
|
||||
# ANSTO special temperature
|
||||
set temp [expr {10.0 * [sct target]}]
|
||||
set temp [expr {20.0 * [sct target]}]
|
||||
set cmd "STT[format %04X [expr {int($temp)}]]"
|
||||
debug_log "sct send $cmd"
|
||||
sct send "$cmd"
|
||||
@ -103,7 +103,7 @@ debug_log "rdValue [sct] [sct result]"
|
||||
debug_log "scan [string range $data 3 6] %4x data"
|
||||
set rslt [scan [string range $data 3 6] %4x data]
|
||||
# ANSTO special temp
|
||||
set data [format "%.1f" [expr {0.1 * $data}]]
|
||||
set data [format "%.1f" [expr {$data / 20.0}]]
|
||||
debug_log "scan result rslt=$rslt, data=$data, oldval=[sct oldval]"
|
||||
if {"$data" ne "[sct oldval]"} {
|
||||
debug_log "$data != [sct oldval] => [expr {"$data" != "[sct oldval]"}]"
|
||||
@ -436,7 +436,7 @@ debug_log "rdVisc [sct] [sct result]"
|
||||
close $f
|
||||
set f [open "[sct datafile].csv" "a"]
|
||||
set my_time [expr {[sct test_time] + int($the_t / 45.0)}]
|
||||
set my_temp [expr {0.1 * $the_c}]
|
||||
set my_temp [expr {$the_c / 20.0}]
|
||||
if {$the_v > 0x7FFFFF} {
|
||||
set my_visc [expr {$the_v - 0x1000000}]
|
||||
} else {
|
||||
@ -547,12 +547,12 @@ debug_log "setPoint $cmd $par"
|
||||
set the_valu [lindex $parts 2]
|
||||
set the_ramp [lindex $parts 3]
|
||||
if {$the_type == "I"} {
|
||||
set the_valu [expr {round($the_valu * 10.0)}]
|
||||
set the_ramp [expr {round($the_ramp * 10.0)}]
|
||||
set the_valu [expr {round($the_valu * 20.0)}]
|
||||
set the_ramp [expr {round($the_ramp * 20.0)}]
|
||||
} elseif {$the_type == "S"} {
|
||||
} elseif {$the_type == "T"} {
|
||||
set the_valu [expr {round($the_valu * 10.0)}]
|
||||
set the_ramp [expr {round($the_ramp * 10.0 /45 * 32768)}]
|
||||
set the_valu [expr {round($the_valu * 20.0)}]
|
||||
set the_ramp [expr {round($the_ramp * 20.0 /45 * 32768)}]
|
||||
} else {
|
||||
sct geterror "Profile error: $line"
|
||||
sct print "Profile error: $line"
|
||||
@ -580,7 +580,7 @@ debug_log "setPoint $cmd $par"
|
||||
}
|
||||
set rslt [scan $line "LT%2x%1s%6x%4x%4x" the_line the_type the_time the_valu the_ramp]
|
||||
if {"$the_type" == "I"} {
|
||||
set dec_temp [format "%.1f" [expr {0.1 * $the_valu}]]
|
||||
set dec_temp [format "%.1f" [expr {$the_valu / 20.0}]]
|
||||
}
|
||||
set dec_time [expr {$the_time / 45.0}]
|
||||
lappend lines $line
|
||||
|
@ -179,6 +179,7 @@ debug_log "setValue $dev:16:$cmd $par"
|
||||
if {[string first "ASCERR:" $data] >=0} {
|
||||
sct geterror $data
|
||||
} elseif {$data != [sct oldval]} {
|
||||
hdelprop [sct] geterror
|
||||
sct oldval $data
|
||||
sct update $data
|
||||
sct utime readtime
|
||||
@ -221,6 +222,13 @@ debug_log "setValue $dev:16:$cmd $par"
|
||||
|
||||
proc setSP {tc_root nextState cmd} {
|
||||
debug_log "setSP $tc_root $nextState $cmd [sct]=[sct target] [hget [sct]]"
|
||||
debug_log "setSP sct = [sct], sct writestatus = [sct writestatus]"
|
||||
if {[sct writestatus] == "start"} {
|
||||
# Called by drive adapter
|
||||
hset $tc_root/status "busy"
|
||||
debug_log "setSP hsetprop $tc_root/setpoint driving 1"
|
||||
hsetprop $tc_root/setpoint driving 1
|
||||
}
|
||||
hset $tc_root/Loop1/setpoint [sct target]
|
||||
return idle
|
||||
}
|
||||
@ -502,7 +510,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable\
|
||||
}
|
||||
|
||||
::scobj::hinitprops $tempobj
|
||||
hsetprop $scobj_hpath klass NXenvironment
|
||||
hsetprop $scobj_hpath klass environment
|
||||
::scobj::set_required_props $scobj_hpath
|
||||
foreach {rootpath hpath klass priv} "
|
||||
$scobj_hpath sensor NXsensor spy
|
||||
@ -523,6 +531,7 @@ proc createNode {scobj_hpath sct_controller cmdGroup varName readable writable\
|
||||
hsetprop $scobj_hpath privilege spy
|
||||
::scobj::hinitprops $tempobj setpoint
|
||||
hsetprop $scobj_hpath/setpoint data true
|
||||
hsetprop $scobj_hpath/setpoint type drivable
|
||||
if {[SplitReply [environment_simulation]]=="false"} {
|
||||
ansto_makesctdrive ${tempobj}_driveable $scobj_hpath/setpoint $scobj_hpath/sensor/value $sct_controller
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ set instrument_dictionary [subst {
|
||||
property {data true control true nxsave false klass @none type graphset}
|
||||
}
|
||||
instrument {
|
||||
sobj {@any instrument @any NXvelocity_selector @any NXaperture @any NXcollimator @any NXdetector @any NXdisk_chopper @any NXfermi_chopper}
|
||||
sobj {@any instrument @any NXvelocity_selector @any NXaperture @any NXcollimator @any NXdetector @any NXdisk_chopper @any NXfermi_chopper @any NXsource}
|
||||
privilege spy
|
||||
datatype @none
|
||||
property {data true control true nxsave false klass NXinstrument type instrument}
|
||||
@ -211,6 +211,12 @@ set instrument_dictionary [subst {
|
||||
datatype @none
|
||||
property {data true control true nxsave false klass @none type part}
|
||||
}
|
||||
control {
|
||||
privilege spy
|
||||
sobj {@any control}
|
||||
datatype @none
|
||||
property {data false control true nxsave false klass @none type nxvgroup}
|
||||
}
|
||||
data {
|
||||
privilege spy
|
||||
sobj {@any data}
|
||||
|
@ -888,6 +888,16 @@ proc ::hdb::prune {instdict} {
|
||||
return
|
||||
}
|
||||
|
||||
proc ::hdb::alias {parent linkpath NXtarget name } {
|
||||
set catch_status [ catch {
|
||||
if {$NXtarget != "data_set"} {
|
||||
return -code error "Unhandled target alias $NXtarget"
|
||||
}
|
||||
hfactory $parent/$name alias $linkpath
|
||||
} message ]
|
||||
handle_exception $catch_status $message
|
||||
}
|
||||
|
||||
##
|
||||
# @brief Traverse the instrument dictionary and construct the hipadaba database.
|
||||
#
|
||||
@ -913,6 +923,13 @@ upvar #0 $instDict dictionary
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach node [hmatchprop / permlink *] {
|
||||
set plink [hgetpropval $node permlink]
|
||||
set target [lindex $plink 0]
|
||||
if {$target == "data_set" && [hgetpropval $node control]} {
|
||||
::hdb::alias "/control" $node {*}$plink
|
||||
}
|
||||
}
|
||||
} message ]
|
||||
handle_exception $catch_status $message
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ set boolean {true false}
|
||||
#}
|
||||
|
||||
# SICS OBJECTS MUST PROVIDE THE FOLLOWING INFORMATION
|
||||
set sobj_klass_list {@none aperture attenuator collimator command crystal data detector disk_chopper entry environment experiment fermi_chopper graphics instrument slits monitor monochromator parameter plc reduce sample scan sensor source user}
|
||||
set sobj_klass_list {@none aperture attenuator collimator command control crystal data detector disk_chopper entry environment experiment fermi_chopper graphics instrument slits monitor monochromator parameter plc reduce sample scan sensor source user}
|
||||
set sobj_sicstype_list {chopperadapter environment_controller sicsvariable macro motor configurablevirtualmotor tasmot singlecounter histmem nxscript sicsdata scanobject sct_object}
|
||||
# Different kinds of things are added to the hdb in different ways.
|
||||
# command: This is something a client can run with hset /a/b/c start, it may have parameters and feedback.
|
||||
|
@ -36,7 +36,7 @@ namespace eval histogram_memory {
|
||||
|
||||
if [ catch {
|
||||
set ic_fsrce_values [ list INTERNAL EXTERNAL ]
|
||||
set ic_count_methods [concat [list time unlimited period count frame] $::counter::isc_beam_monitor_list ]
|
||||
set ic_count_methods [concat [list time unlimited period count frame count_roi] $::counter::isc_beam_monitor_list ]
|
||||
if {$histmem_simulation == "true"} {
|
||||
MakeHM hmm SIM
|
||||
hmm configure daq Stopped
|
||||
@ -50,7 +50,7 @@ namespace eval histogram_memory {
|
||||
hmm configure ratemap_xy_total 321
|
||||
hmm configure maximum_period 0
|
||||
hmm configure fat_frame_frequency 50
|
||||
hmm configure fat_clock_scale 1000
|
||||
hmm configure fat_clock_scale 1000
|
||||
foreach bm $::counter::isc_beam_monitor_list {
|
||||
set bm_num [string index $bm end]
|
||||
if [string is integer $bm_num] {
|
||||
@ -67,19 +67,21 @@ namespace eval histogram_memory {
|
||||
|
||||
# Frame source for each instrument if freq = 0, this can happen when automatically
|
||||
# setting frequencies from choppers.
|
||||
array set default_frame_source_when_there_is_no_frame_signal {
|
||||
echidna INTERNAL
|
||||
koala INTERNAL
|
||||
kowari EXTERNAL
|
||||
pelican INTERNAL
|
||||
platypus EXTERNAL
|
||||
quokka INTERNAL
|
||||
taipan INTERNAL
|
||||
wombat INTERNAL
|
||||
lyrebird INTERNAL
|
||||
kookaburra INTERNAL
|
||||
dingo INTERNAL
|
||||
}
|
||||
array set default_frame_source_when_there_is_no_frame_signal {
|
||||
echidna INTERNAL
|
||||
koala INTERNAL
|
||||
kowari EXTERNAL
|
||||
pelican INTERNAL
|
||||
platypus EXTERNAL
|
||||
quokka INTERNAL
|
||||
taipan INTERNAL
|
||||
wombat INTERNAL
|
||||
lyrebird INTERNAL
|
||||
kookaburra INTERNAL
|
||||
dingo INTERNAL
|
||||
bilby INTERNAL
|
||||
emu INTERNAL
|
||||
}
|
||||
|
||||
array set default_frame_source_always_internal {
|
||||
echidna "true"
|
||||
@ -93,6 +95,8 @@ namespace eval histogram_memory {
|
||||
lyrebird "false"
|
||||
kookaburra "false"
|
||||
dingo "false"
|
||||
bilby "false"
|
||||
emu "false"
|
||||
}
|
||||
|
||||
::utility::mkVar detector_active_height_mm Float user active_height true detector true true
|
||||
@ -834,7 +838,7 @@ proc CAT_TABLE {args} {
|
||||
#
|
||||
proc FAT_TABLE {args} {
|
||||
if [ catch {
|
||||
set attributes { FRAME_FREQUENCY FRAME_BUFFER FRAME_DUTYCYCLE SIZE_PERIOD NOS_PERIODS COUNT_METHOD COUNT_SIZE READ_DATA_TYPE VIEW_MAG_X VIEW_MAG_Y HISTO_STREAMING P7888_PLL_FREQ_CARD_X P7888_PLL_FREQ_CARD_Y P7888_CARD_MODE_X P7888_CARD_MODE_Y RAW_HISTO_XMIN RAW_HISTO_XMAX RAW_HISTO_YMIN RAW_HISTO_YMAX TEST_HISTO_1D_SIZES TEST_HISTO_2D_SIZES P7888_PLL_SYNC_METHOD }
|
||||
set attributes { FRAME_FREQUENCY FRAME_BUFFER FRAME_DUTYCYCLE SIZE_PERIOD NOS_PERIODS COUNT_METHOD COUNT_SIZE READ_DATA_TYPE VIEW_MAG_X VIEW_MAG_Y HISTO_STREAMING P7888_PLL_FREQ_CARD_X P7888_PLL_FREQ_CARD_Y P7888_CARD_MODE_X P7888_CARD_MODE_Y RAW_HISTO_XMIN RAW_HISTO_XMAX RAW_HISTO_YMIN RAW_HISTO_YMAX TEST_HISTO_1D_SIZES TEST_HISTO_2D_SIZES P7888_PLL_SYNC_METHOD COUNT_ROI_XMIN COUNT_ROI_XMAX COUNT_ROI_YMIN COUNT_ROI_YMAX COUNT_ROI_TMIN COUNT_ROI_TMAX COUNT_ROI_TYPE COUNT_ROI_REGION COUNT_ROI_K1 }
|
||||
|
||||
set elements {{ }}
|
||||
|
||||
|
@ -35,26 +35,6 @@ namespace eval ::scobj::[set vendor]_[set device] {
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
proc basename {node} {
|
||||
set point [string last "/" $node]
|
||||
if { $point < 0 } {
|
||||
return $node
|
||||
} else {
|
||||
incr point
|
||||
return "[string range $node $point end]"
|
||||
}
|
||||
}
|
||||
proc pathname {node} {
|
||||
set point [string last "/" $node]
|
||||
if { $point < 0 } {
|
||||
return ""
|
||||
} else {
|
||||
incr point -1
|
||||
return "[string range $node 0 $point]"
|
||||
}
|
||||
return "[join [lrange [split $node '/'] 0 end-1] '/']"
|
||||
}
|
||||
|
||||
proc ns {} {
|
||||
return "[namespace current]"
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ namespace eval nexus {
|
||||
"taipan" "simple"
|
||||
"kookaburra" "simple"
|
||||
"dingo" "simple"
|
||||
"bilby" "simple"
|
||||
"emu" "simple"
|
||||
}
|
||||
}
|
||||
namespace eval ::nexus::histmem {}
|
||||
@ -120,7 +122,7 @@ proc ::nexus::datapath {} {
|
||||
# @param postfix This is the filename suffix, must be one of: nx.hdf, hdf, h5, nx5, xml
|
||||
proc newFileName {idNum postfix} {
|
||||
if [ catch {
|
||||
array set inst_mnem {quokka QKK wombat WBT echidna ECH kowari KWR koala KOL taipan TPN platypus PLP pelican PLN lyrebird LBD kookaburra KKB dingo DNG}
|
||||
array set inst_mnem {quokka QKK wombat WBT echidna ECH kowari KWR koala KOL taipan TPN platypus PLP pelican PLN lyrebird LBD kookaburra KKB dingo DNG bilby BBY emu EMU}
|
||||
# set prefix [SplitReply [sicsdataprefix]]
|
||||
set date_time_arr [split [sicstime] " "]
|
||||
set isodate [lindex $date_time_arr 0]
|
||||
@ -132,22 +134,47 @@ proc newFileName {idNum postfix} {
|
||||
return $fmtStr
|
||||
}
|
||||
|
||||
##
|
||||
# @brief Make a link in the nexus file
|
||||
# With two arguments the target name = the link name
|
||||
# With three arguments you can give the target a new name.
|
||||
# two args: arg0 = target, arg1 = link
|
||||
# three args: arg0 = target, arg1 = new name, arg2 = link
|
||||
proc ::nexus::link {args} {
|
||||
set nargs [llength $args]
|
||||
switch $nargs {
|
||||
2 { nxscript makelink [lindex $args 0] [lindex $args 1] }
|
||||
3 { nxscript makenamedlink [lindex $args 0] [lindex $args 2] [lindex $args 1] }
|
||||
}
|
||||
}
|
||||
proc ::nexus::process_filetype_policy {filetype} {
|
||||
if [ catch {
|
||||
if {$filetype == "BEAM_MONITOR"} {
|
||||
::hdb::set_save / true
|
||||
::hdb::set_save $::histogram_memory::HP_HMM false
|
||||
set ::counter::HP_BM [getatt monitor_counts hdb_path]
|
||||
hsetprop $::counter::HP_BM link data_set
|
||||
if [sicslist exists monitor_counts linkname] {
|
||||
hsetprop $::counter::HP_BM link data_set [getatt monitor_counts linkname]
|
||||
} else {
|
||||
hsetprop $::counter::HP_BM link data_set
|
||||
}
|
||||
hsetprop $::counter::HP_BM @signal 1
|
||||
set nvars [SplitReply [bmonscan noscanvar]]
|
||||
if {$nvars == 0} {
|
||||
set axes "run_number"
|
||||
} else {
|
||||
for { set i 0 } { $i < $nvars } { incr i } {
|
||||
set axis_name [lindex [split [lindex [split [bmonscan getvarpar $i]] 0] "."] 1]
|
||||
set node_name [SplitReply [sicslist $axis_name hdb_path]]
|
||||
hsetprop $node_name link data_set
|
||||
if [sicslist exists $axis_name linkname] {
|
||||
hsetprop $node_name link data_set [getatt $axis_name linkname]
|
||||
} else {
|
||||
hsetprop $node_name link data_set
|
||||
}
|
||||
lappend axes_list $axis_name
|
||||
}
|
||||
set axes [join $axes_list ":"]
|
||||
}
|
||||
hsetprop $::counter::HP_BM @axes $axes
|
||||
} else {
|
||||
::hdb::set_save / true
|
||||
@ -156,10 +183,18 @@ proc newFileName {idNum postfix} {
|
||||
::histogram_memory::set_axes $filetype
|
||||
}
|
||||
foreach sobj [sicslist link data_set] {
|
||||
hsetprop [getatt $sobj hdb_path] link data_set
|
||||
if [sicslist exists $sobj linkname] {
|
||||
hsetprop [getatt $sobj hdb_path] link data_set [getatt $sobj linkname]
|
||||
} else {
|
||||
hsetprop [getatt $sobj hdb_path] link data_set
|
||||
}
|
||||
}
|
||||
foreach sobj [sicslist link parameters_group] {
|
||||
hsetprop [getatt $sobj hdb_path] link parameters_group
|
||||
if [sicslist exists $sobj linkname] {
|
||||
hsetprop [getatt $sobj hdb_path] link parameters_group [getatt $sobj linkname]
|
||||
} else {
|
||||
hsetprop [getatt $sobj hdb_path] link parameters_group
|
||||
}
|
||||
}
|
||||
} message ] {
|
||||
return -code error "([info level 0]) $message"
|
||||
@ -629,10 +664,10 @@ proc ::nexus::savetree {hpath pt filestatus} {
|
||||
}
|
||||
if {$filestatus == "newfile"} {
|
||||
if {[info exists p_arr(link)] && ($p_arr(link) != "@none")} {
|
||||
nxscript makelink $p_arr(link) $p_arr(nxalias)
|
||||
::nexus::link {*}$p_arr(link) $p_arr(nxalias)
|
||||
}
|
||||
if {[info exists p_arr(permlink)] && ($p_arr(permlink) != "@none")} {
|
||||
nxscript makelink $p_arr(permlink) $p_arr(nxalias)
|
||||
::nexus::link {*}$p_arr(permlink) $p_arr(nxalias)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -884,7 +919,7 @@ proc ::nexus::histmem::save {hm nxalias hpath data_type filestatus args} {
|
||||
if {$filestatus == "newfile"} {
|
||||
if [hpropexists $hpath link] {
|
||||
set link [hgetpropval $hpath link]
|
||||
nxscript makelink $link $nxalias
|
||||
::nexus::link {*}$link $nxalias
|
||||
}
|
||||
nxscript putattribute $nxalias axes $axes
|
||||
nxscript putattribute $nxalias signal $signal
|
||||
@ -919,7 +954,7 @@ proc ::nexus::motor::save {motor nxalias hpath data_type filestatus args} {
|
||||
if {$filestatus == "newfile"} {
|
||||
if [hpropexists $hpath link] {
|
||||
set link [hgetpropval $hpath link]
|
||||
nxscript makelink $link $nxalias
|
||||
::nexus::link {*}$link $nxalias
|
||||
}
|
||||
foreach {propName propValue} [hfindprop $hpath @*] {
|
||||
set attName [string range $propName 1 end]
|
||||
@ -980,7 +1015,7 @@ proc ::nexus::macro::getset_save {sobj nxalias hpath data_type filestatus args}
|
||||
if {$filestatus == "newfile"} {
|
||||
if [hpropexists $hpath link] {
|
||||
set link [hgetpropval $hpath link]
|
||||
nxscript makelink $link $nxalias
|
||||
::nexus::link {*}$link $nxalias
|
||||
}
|
||||
foreach {propName propValue} [hfindprop $hpath @*] {
|
||||
set attName [string range $propName 1 end]
|
||||
@ -1029,7 +1064,7 @@ proc ::nexus::environment_controller::save {evc nxalias hpath data_type filestat
|
||||
if {$filestatus == "newfile"} {
|
||||
if [hpropexists $hpath link] {
|
||||
set link [hgetpropval $hpath link]
|
||||
nxscript makelink $link $nxalias
|
||||
::nexus::link {*}$link $nxalias
|
||||
}
|
||||
foreach {propName propValue} [hfindprop $hpath @*] {
|
||||
set attName [string range $propName 1 end]
|
||||
@ -1088,7 +1123,7 @@ proc ::nexus::sicsvariable::save {svar nxalias hpath data_type filestatus args}
|
||||
if {$filestatus == "newfile"} {
|
||||
if [hpropexists $hpath link] {
|
||||
set link [hgetpropval $hpath link]
|
||||
nxscript makelink $link $nxalias
|
||||
::nexus::link {*}$link $nxalias
|
||||
}
|
||||
foreach {propName propValue} [hfindprop $hpath @*] {
|
||||
set attName [string range $propName 1 end]
|
||||
@ -1176,7 +1211,7 @@ proc ::nexus::chopperadapter::save {sobj nxalias hpath data_type filestatus args
|
||||
if {$filestatus == "newfile"} {
|
||||
if [hpropexists $hpath link] {
|
||||
set link [hgetpropval $hpath link]
|
||||
nxscript makelink $link $nxalias
|
||||
::nexus::link {*}$link $nxalias
|
||||
}
|
||||
foreach {propName propValue} [hfindprop $hpath @*] {
|
||||
set attName [string range $propName 1 end]
|
||||
@ -1244,7 +1279,7 @@ proc ::nexus::script::save {script nxalias hpath data_type filestatus args} {
|
||||
if {$filestatus == "newfile"} {
|
||||
if [hpropexists $hpath link] {
|
||||
set link [hgetpropval $hpath link]
|
||||
nxscript makelink $link $nxalias
|
||||
::nexus::link {*}$link $nxalias
|
||||
}
|
||||
foreach {propName propValue} [hfindprop $hpath @*] {
|
||||
set attName [string range $propName 1 end]
|
||||
|
@ -192,7 +192,7 @@ proc ::scan::check_scanvar {sobj uobj} {
|
||||
return -code error "ERROR: Can't drive scan variable, $scan_variable position is set to 'fixed'"
|
||||
} else {
|
||||
set mtype [getatt $scan_variable mtype]
|
||||
if {$mtype != "tlcmot" && $check_thread0 && [SplitReply [$scan_variable thread0]] == -1} {
|
||||
if {$mtype != "tclmot" && $check_thread0 && [SplitReply [$scan_variable thread0]] == -1} {
|
||||
return -code error "ERROR: Can't scan ${scan_variable}. Thread zero has stopped running on the motion controller"
|
||||
}
|
||||
}
|
||||
|
50
site_ansto/instrument/config/source/reactor_status.sct
Normal file
50
site_ansto/instrument/config/source/reactor_status.sct
Normal file
@ -0,0 +1,50 @@
|
||||
# vim: ts=8 sts=2 sw=2 expandtab autoindent smartindent nocindent
|
||||
# http://neutron.ansto.gov.au/Bragg/proposal/reactor.jsp?type=ALL
|
||||
# Power: 19.198232; CNS Out: 29.26; TG123: 1; CG123: 1; TG4: 3
|
||||
driver reactor_status = {
|
||||
protocol = std;
|
||||
class = NXsource;
|
||||
simulation_group = opal_simulation;
|
||||
|
||||
group = {
|
||||
group_property 'data' = 'true';
|
||||
group_property 'control' = 'true';
|
||||
var status = {
|
||||
type = text;
|
||||
priv = spy;
|
||||
readable = 10;
|
||||
read_command = 'GET /Bragg/proposal/reactor.jsp?type=ALL HTTP/1.0';
|
||||
read_function = rdAll;
|
||||
fetch_function = getState;
|
||||
data = false;
|
||||
control = false;
|
||||
}
|
||||
var power = { type = float; priv = spy; mutable = true; property klass = source;}
|
||||
var cns_out = { type = float; priv = spy; mutable = true; property klass = source;}
|
||||
var tg123 = { type = float; priv = spy; mutable = true; property klass = source;}
|
||||
var cg123 = { type = float; priv = spy; mutable = true; property klass = source;}
|
||||
var tg4 = { type = float; priv = spy; mutable = true; property klass = source;}
|
||||
}
|
||||
|
||||
code read_function rdValue = {
|
||||
}
|
||||
code Write_function setPoint = {
|
||||
}
|
||||
code mkDriver = {
|
||||
}
|
||||
|
||||
code read_function rdAll = {
|
||||
@ set data [lindex [split [string trim ${data}] "\r\n"] end]
|
||||
@ if {${data} != [sct oldval]} {
|
||||
@ foreach {n v} [regexp -all -inline {[A-Z][A-Za-z0-9 ]+|[0-9][0-9.]*} ${data}] {
|
||||
@ switch $n {
|
||||
@ "Power" { hset ${tc_root}/power $v }
|
||||
@ "CNS Out" { hset ${tc_root}/cns_out $v }
|
||||
@ "TG123" { hset ${tc_root}/tg123 $v }
|
||||
@ "CG123" { hset ${tc_root}/cg123 $v }
|
||||
@ "TG4" { hset ${tc_root}/tg4 $v }
|
||||
@ }
|
||||
@ }
|
||||
@ }
|
||||
}
|
||||
}
|
356
site_ansto/instrument/config/source/sct_reactor_status.tcl
Normal file
356
site_ansto/instrument/config/source/sct_reactor_status.tcl
Normal file
@ -0,0 +1,356 @@
|
||||
# Generated driver for reactor_status
|
||||
# vim: ft=tcl tabstop=8 softtabstop=2 shiftwidth=2 nocindent smartindent
|
||||
#
|
||||
|
||||
namespace eval ::scobj::reactor_status {
|
||||
set debug_threshold 0
|
||||
}
|
||||
|
||||
proc ::scobj::reactor_status::debug_log {debug_level debug_string} {
|
||||
set catch_status [ catch {
|
||||
if {${debug_level} >= ${::scobj::reactor_status::debug_threshold}} {
|
||||
set fd [open "/tmp/reactor_status.log" "a"]
|
||||
set line "[clock format [clock seconds] -format "%T"] ${debug_string}"
|
||||
puts ${fd} "${line}"
|
||||
close ${fd}
|
||||
}
|
||||
} catch_message ]
|
||||
}
|
||||
|
||||
# check function for hset change
|
||||
proc ::scobj::reactor_status::checkrange {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "checkrange tc_root=${tc_root} sct=[sct] target=[sct target]"
|
||||
set setpoint [sct target]
|
||||
if { [hpropexists [sct] lowerlimit] } {
|
||||
set lolimit [sct lowerlimit]
|
||||
} else {
|
||||
# lowerlimit not set, use target
|
||||
set lolimit [sct target]
|
||||
}
|
||||
if { [hpropexists [sct] upperlimit] } {
|
||||
set hilimit [sct upperlimit]
|
||||
} else {
|
||||
# upperlimit not set, use target
|
||||
set hilimit [sct target]
|
||||
}
|
||||
# hook code goes here
|
||||
if { ${setpoint} < ${lolimit} || ${setpoint} > ${hilimit} } {
|
||||
error "setpoint ${setpoint} violates limits (${lolimit}..${hilimit}) on [sct]"
|
||||
}
|
||||
return OK
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to request the read of a parameter on a device
|
||||
proc ::scobj::reactor_status::getState {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "getState tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set cmd "${cmd_str}"
|
||||
# hook code goes here
|
||||
debug_log 1 "getState sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to request the read of a parameter on a device
|
||||
proc ::scobj::reactor_status::getValue {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "getValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set cmd "${cmd_str}"
|
||||
# hook code goes here
|
||||
debug_log 1 "getValue sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to check the write parameter on a device
|
||||
proc ::scobj::reactor_status::noResponse {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "noResponse tc_root=${tc_root} sct=[sct] resp=[sct result]"
|
||||
# hook code goes here
|
||||
return "idle"
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to parse the read of a parameter on a device
|
||||
proc ::scobj::reactor_status::rdAll {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "rdAll tc_root=${tc_root} sct=[sct] result=[sct result]"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set data [sct result]
|
||||
set nextState "idle"
|
||||
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
|
||||
# the protocol driver has reported an error
|
||||
sct geterror "${data}"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
# hook code starts
|
||||
set data [lindex [split [string trim ${data}] "\r\n"] end]
|
||||
if {${data} != [sct oldval]} {
|
||||
foreach {n v} [regexp -all -inline {[A-Z][A-Za-z0-9 ]+|[0-9][0-9.]*} ${data}] {
|
||||
switch $n {
|
||||
"Power" { hset ${tc_root}/power $v }
|
||||
"CNS Out" { hset ${tc_root}/cns_out $v }
|
||||
"TG123" { hset ${tc_root}/tg123 $v }
|
||||
"CG123" { hset ${tc_root}/cg123 $v }
|
||||
"TG4" { hset ${tc_root}/tg4 $v }
|
||||
}
|
||||
}
|
||||
}
|
||||
# hook code ends
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
debug_log 1 "[sct] error: [sct geterror]"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
if { ${data} != [sct oldval] } {
|
||||
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to parse the read of a parameter on a device
|
||||
proc ::scobj::reactor_status::rdValue {tc_root} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "rdValue tc_root=${tc_root} sct=[sct] result=[sct result]"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set data [sct result]
|
||||
set nextState "idle"
|
||||
if {[string equal -nocase -length 7 ${data} "ASCERR:"]} {
|
||||
# the protocol driver has reported an error
|
||||
sct geterror "${data}"
|
||||
error "[sct geterror]"
|
||||
}
|
||||
# hook code goes here
|
||||
if { ${data} != [sct oldval] } {
|
||||
debug_log 1 "[sct] changed to new:${data}, from old:[sct oldval]"
|
||||
sct oldval ${data}
|
||||
sct update ${data}
|
||||
sct utime readtime
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to write a parameter value on a device
|
||||
proc ::scobj::reactor_status::setPoint {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "setPoint tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set par [sct target]
|
||||
set cmd "${cmd_str}${par}"
|
||||
# hook code goes here
|
||||
if { [hpropexists [sct] driving] } {
|
||||
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
|
||||
sct driving 1
|
||||
}
|
||||
}
|
||||
debug_log 1 "setPoint sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
# function to write a parameter value on a device
|
||||
proc ::scobj::reactor_status::setValue {tc_root nextState cmd_str} {
|
||||
set catch_status [ catch {
|
||||
debug_log 1 "setValue tc_root=${tc_root} sct=[sct] cmd=${cmd_str}"
|
||||
if { [hpropexists [sct] geterror] } {
|
||||
hdelprop [sct] geterror
|
||||
}
|
||||
set par [sct target]
|
||||
set cmd "${cmd_str}${par}"
|
||||
# hook code goes here
|
||||
if { [hpropexists [sct] driving] } {
|
||||
if { [hpropexists [sct] writestatus] && [sct writestatus] == "start" } {
|
||||
sct driving 1
|
||||
}
|
||||
}
|
||||
debug_log 1 "setValue sct send ${cmd}"
|
||||
if {![string equal -nocase -length 10 ${cmd} "@@NOSEND@@"]} {
|
||||
sct send "${cmd}"
|
||||
}
|
||||
return ${nextState}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
proc ::scobj::reactor_status::mk_sct_reactor_status { sct_controller name } {
|
||||
debug_log 1 "mk_sct_reactor_status for ${name}"
|
||||
set ns "[namespace current]"
|
||||
set catch_status [ catch {
|
||||
|
||||
MakeSICSObj ${name} SCT_OBJECT
|
||||
|
||||
sicslist setatt ${name} klass NXsource
|
||||
sicslist setatt ${name} long_name ${name}
|
||||
|
||||
set scobj_hpath /sics/${name}
|
||||
|
||||
hfactory ${scobj_hpath}/cg123 plain spy float
|
||||
hsetprop ${scobj_hpath}/cg123 control true
|
||||
hsetprop ${scobj_hpath}/cg123 data true
|
||||
hsetprop ${scobj_hpath}/cg123 mutable true
|
||||
hsetprop ${scobj_hpath}/cg123 nxsave true
|
||||
hsetprop ${scobj_hpath}/cg123 oldval 0.0
|
||||
hsetprop ${scobj_hpath}/cg123 klass "source"
|
||||
hsetprop ${scobj_hpath}/cg123 sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/cg123 type "part"
|
||||
hsetprop ${scobj_hpath}/cg123 nxalias "${name}_cg123"
|
||||
|
||||
hfactory ${scobj_hpath}/cns_out plain spy float
|
||||
hsetprop ${scobj_hpath}/cns_out control true
|
||||
hsetprop ${scobj_hpath}/cns_out data true
|
||||
hsetprop ${scobj_hpath}/cns_out mutable true
|
||||
hsetprop ${scobj_hpath}/cns_out nxsave true
|
||||
hsetprop ${scobj_hpath}/cns_out oldval 0.0
|
||||
hsetprop ${scobj_hpath}/cns_out klass "source"
|
||||
hsetprop ${scobj_hpath}/cns_out sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/cns_out type "part"
|
||||
hsetprop ${scobj_hpath}/cns_out nxalias "${name}_cns_out"
|
||||
|
||||
hfactory ${scobj_hpath}/power plain spy float
|
||||
hsetprop ${scobj_hpath}/power control true
|
||||
hsetprop ${scobj_hpath}/power data true
|
||||
hsetprop ${scobj_hpath}/power mutable true
|
||||
hsetprop ${scobj_hpath}/power nxsave true
|
||||
hsetprop ${scobj_hpath}/power oldval 0.0
|
||||
hsetprop ${scobj_hpath}/power klass "source"
|
||||
hsetprop ${scobj_hpath}/power sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/power type "part"
|
||||
hsetprop ${scobj_hpath}/power nxalias "${name}_power"
|
||||
|
||||
hfactory ${scobj_hpath}/status plain spy text
|
||||
hsetprop ${scobj_hpath}/status read ${ns}::getState ${scobj_hpath} rdAll {GET /Bragg/proposal/reactor.jsp?type=ALL HTTP/1.0}
|
||||
hsetprop ${scobj_hpath}/status rdAll ${ns}::rdAll ${scobj_hpath}
|
||||
hsetprop ${scobj_hpath}/status control false
|
||||
hsetprop ${scobj_hpath}/status data false
|
||||
hsetprop ${scobj_hpath}/status mutable false
|
||||
hsetprop ${scobj_hpath}/status nxsave true
|
||||
hsetprop ${scobj_hpath}/status oldval UNKNOWN
|
||||
hsetprop ${scobj_hpath}/status sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/status type "part"
|
||||
hsetprop ${scobj_hpath}/status nxalias "${name}_status"
|
||||
|
||||
hfactory ${scobj_hpath}/tg123 plain spy float
|
||||
hsetprop ${scobj_hpath}/tg123 control true
|
||||
hsetprop ${scobj_hpath}/tg123 data true
|
||||
hsetprop ${scobj_hpath}/tg123 mutable true
|
||||
hsetprop ${scobj_hpath}/tg123 nxsave true
|
||||
hsetprop ${scobj_hpath}/tg123 oldval 0.0
|
||||
hsetprop ${scobj_hpath}/tg123 klass "source"
|
||||
hsetprop ${scobj_hpath}/tg123 sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/tg123 type "part"
|
||||
hsetprop ${scobj_hpath}/tg123 nxalias "${name}_tg123"
|
||||
|
||||
hfactory ${scobj_hpath}/tg4 plain spy float
|
||||
hsetprop ${scobj_hpath}/tg4 control true
|
||||
hsetprop ${scobj_hpath}/tg4 data true
|
||||
hsetprop ${scobj_hpath}/tg4 mutable true
|
||||
hsetprop ${scobj_hpath}/tg4 nxsave true
|
||||
hsetprop ${scobj_hpath}/tg4 oldval 0.0
|
||||
hsetprop ${scobj_hpath}/tg4 klass "source"
|
||||
hsetprop ${scobj_hpath}/tg4 sdsinfo "::nexus::scobj::sdsinfo"
|
||||
hsetprop ${scobj_hpath}/tg4 type "part"
|
||||
hsetprop ${scobj_hpath}/tg4 nxalias "${name}_tg4"
|
||||
|
||||
hsetprop ${scobj_hpath} control "true"
|
||||
hsetprop ${scobj_hpath} data "true"
|
||||
|
||||
if {[SplitReply [opal_simulation]]=="false"} {
|
||||
${sct_controller} poll ${scobj_hpath}/status 10
|
||||
}
|
||||
hsetprop ${scobj_hpath} klass NXsource
|
||||
# hook code starts
|
||||
# hook code ends
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
namespace eval ::scobj::reactor_status {
|
||||
namespace export debug_log
|
||||
namespace export mk_sct_reactor_status
|
||||
}
|
||||
|
||||
proc add_reactor_status {name IP port} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::reactor_status"
|
||||
${ns}::debug_log 1 "add_reactor_status ${name} ${IP} ${port}"
|
||||
if {[SplitReply [opal_simulation]]=="false"} {
|
||||
if {[string equal -nocase "aqadapter" "${IP}"]} {
|
||||
${ns}::debug_log 1 "makesctcontroller sct_${name} aqadapter ${port}"
|
||||
makesctcontroller sct_${name} aqadapter ${port}
|
||||
} else {
|
||||
${ns}::debug_log 1 "makesctcontroller sct_${name} std ${IP}:${port}"
|
||||
makesctcontroller sct_${name} std ${IP}:${port}
|
||||
}
|
||||
}
|
||||
${ns}::debug_log 1 "mk_sct_reactor_status sct_${name} ${name}"
|
||||
${ns}::mk_sct_reactor_status sct_${name} ${name}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
|
||||
puts stdout "file evaluation of sct_reactor_status.tcl"
|
||||
::scobj::reactor_status::debug_log 1 "file evaluation of sct_reactor_status.tcl"
|
||||
|
||||
proc ::scobj::reactor_status::read_config {} {
|
||||
set catch_status [ catch {
|
||||
set ns "::scobj::reactor_status"
|
||||
${ns}::debug_log 1 "Processing Config"
|
||||
dict for {k v} $::config_dict {
|
||||
${ns}::debug_log 1 "Inspecting $k:$v"
|
||||
if { [dict exists $v "driver"] } {
|
||||
${ns}::debug_log 1 "Has driver [dict get $v driver]"
|
||||
if { [dict get $v "driver"] == "reactor_status" } {
|
||||
${ns}::debug_log 1 "Correct driver, enabled = [dict get $v enabled]"
|
||||
if { [dict get $v enabled] } {
|
||||
set IP [dict get $v ip]
|
||||
set PORT [dict get $v port]
|
||||
set name [dict get $v name]
|
||||
MakeAsyncProtocol ${name}_protocol
|
||||
MakeAsyncQueue ${name}_queue ${name}_protocol ${IP} ${PORT}
|
||||
add_reactor_status ${name} "aqadapter" ${name}_queue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch_message ]
|
||||
handle_exception ${catch_status} ${catch_message}
|
||||
}
|
||||
if { [info exists ::config_dict] } {
|
||||
::scobj::reactor_status::read_config
|
||||
} else {
|
||||
::scobj::reactor_status:debug_log 1 "No config dict"
|
||||
}
|
16
site_ansto/instrument/config/source/source.tcl
Normal file
16
site_ansto/instrument/config/source/source.tcl
Normal file
@ -0,0 +1,16 @@
|
||||
fileeval $cfPath(source)/sct_reactor_status.tcl
|
||||
|
||||
if {[SplitReply [opal_simulation]]=="false"} {
|
||||
MakeAsyncProtocol std
|
||||
std sendterminator \r\n\r\n
|
||||
std replyterminator 0x03
|
||||
MakeAsyncQueue aqreactor std portal.nbi.ansto.gov.au 80
|
||||
aqreactor timeout 2000
|
||||
}
|
||||
add_reactor_status source aqadapter aqreactor
|
||||
|
||||
namespace eval ::source {
|
||||
proc isc_initialize {} {
|
||||
}
|
||||
}
|
||||
|
@ -152,6 +152,14 @@ dingo|dingo)
|
||||
INSTRUMENT=dingo
|
||||
DESTHOST=${2:-ics1-dingo.nbi.ansto.gov.au}
|
||||
INSTSRC=$SRCDIR/dingo;;
|
||||
bilby|bilby)
|
||||
INSTRUMENT=bilby
|
||||
DESTHOST=${2:-ics1-bilby.nbi.ansto.gov.au}
|
||||
INSTSRC=$SRCDIR/bilby;;
|
||||
emu|emu)
|
||||
INSTRUMENT=emu
|
||||
DESTHOST=${2:-ics1-emu.nbi.ansto.gov.au}
|
||||
INSTSRC=$SRCDIR/emu;;
|
||||
esac
|
||||
INSTCFDIR=$INSTSRC/config
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
config/source/source_common.tcl
|
||||
config/source/sct_reactor_status.tcl
|
||||
config/source/source.tcl
|
||||
config/anticollider/anticollider_common.tcl
|
||||
config/plc/plc_common_1.tcl
|
||||
config/counter/counter_common_1.tcl
|
||||
|
@ -1,8 +0,0 @@
|
||||
# Author Jing Chen (jgn@ansto.gov.au)
|
||||
|
||||
source $cfPath(source)/source_common.tcl
|
||||
|
||||
proc ::source::isc_initialize {} {
|
||||
::source::ic_initialize "thermal"
|
||||
}
|
||||
|
@ -2,13 +2,25 @@ proc getdataType {path} {
|
||||
return [lindex [split [hinfo $path] ,] 0]
|
||||
}
|
||||
|
||||
proc encode {str} {
|
||||
set result [string map -nocase {
|
||||
{"} {"}
|
||||
{'} {'}
|
||||
{<} {<}
|
||||
{>} {>}
|
||||
{&} {&}
|
||||
} $str]
|
||||
return $result
|
||||
}
|
||||
|
||||
proc make_nodes {path result indent} {
|
||||
set nodename [file tail $path];
|
||||
set type [getdataType $path]
|
||||
set prefix [string repeat " " $indent]
|
||||
set newIndent [expr $indent + 2]
|
||||
set control "true"
|
||||
foreach {key value} [string map {= " "} [hlistprop $path tcl]] {
|
||||
foreach {key rvalue} [string map {= " "} [hlistprop $path tcl]] {
|
||||
set value [encode $rvalue]
|
||||
if {[string compare -nocase $key "control"] == 0} {
|
||||
if {[string compare -nocase $value "false"] == 0} {
|
||||
set control "false"
|
||||
@ -30,7 +42,8 @@ set control "true"
|
||||
|
||||
proc property_elements {path indent} {
|
||||
set prefix [string repeat " " $indent]
|
||||
foreach {key value} [string map {= " "} [hlistprop $path tcl]] {
|
||||
foreach {key rvalue} [string map {= " "} [hlistprop $path tcl]] {
|
||||
set value [encode $rvalue]
|
||||
if {[string compare -nocase $key "control"] == 0} {continue}
|
||||
lappend proplist "$prefix<property id=\"$key\">\n"
|
||||
if {[string compare -nocase $key "help"] == 0} {
|
||||
|
@ -1,4 +1,5 @@
|
||||
config/source/source_common.tcl
|
||||
config/source/sct_reactor_status.tcl
|
||||
config/source/source.tcl
|
||||
config/anticollider/anticollider_common.tcl
|
||||
config/plc/plc_common_1.tcl
|
||||
config/counter/counter_common_1.tcl
|
||||
|
@ -1,7 +1,8 @@
|
||||
# This must be loaded by motor_configuration.tcl
|
||||
|
||||
set ephi_Home 6647698
|
||||
set echi_Home 8919294
|
||||
set ephi_Home 26575217
|
||||
set echi_Home 24224381
|
||||
#set echi_Home 8919294
|
||||
set eom_Home 23165482
|
||||
|
||||
# Sample Tilt 1, euler omega stage
|
||||
@ -11,9 +12,9 @@ Motor eom $motor_driver_type [params \
|
||||
units degrees\
|
||||
hardlowerlim -45\
|
||||
hardupperlim 80\
|
||||
maxSpeed 1\
|
||||
maxAccel 1\
|
||||
maxDecel 1\
|
||||
maxSpeed 2\
|
||||
maxAccel 2\
|
||||
maxDecel 2\
|
||||
stepsPerX 25000\
|
||||
absEnc 1\
|
||||
absEncHome $eom_Home\
|
||||
@ -30,18 +31,18 @@ Motor echi $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis B\
|
||||
units degrees\
|
||||
hardlowerlim -32\
|
||||
hardupperlim 97\
|
||||
maxSpeed 1\
|
||||
maxAccel 1\
|
||||
maxDecel 1\
|
||||
hardlowerlim -45\
|
||||
hardupperlim 100\
|
||||
maxSpeed 2\
|
||||
maxAccel 2\
|
||||
maxDecel 2\
|
||||
stepsPerX -25000\
|
||||
absEnc 1\
|
||||
absEncHome $echi_Home\
|
||||
cntsPerX 8192]
|
||||
setHomeandRange -motor echi -home 0 -lowrange 10 -uprange 95
|
||||
echi softlowerlim -10
|
||||
echi softupperlim 90
|
||||
echi softupperlim 99
|
||||
echi home 0
|
||||
echi speed 1
|
||||
echi movecount $move_count
|
||||
@ -52,7 +53,7 @@ echi long_name euler_chi
|
||||
# Sample Trans 1, upper, y
|
||||
Motor ephi $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis C\
|
||||
axis D\
|
||||
units degrees\
|
||||
hardlowerlim -185\
|
||||
hardupperlim 185\
|
||||
@ -72,3 +73,96 @@ ephi movecount $move_count
|
||||
ephi precision 0.01
|
||||
ephi part sample
|
||||
ephi long_name euler_phi
|
||||
|
||||
# dummy motors for UB
|
||||
|
||||
Motor fake_eom asim [params \
|
||||
asyncqueue mc2\
|
||||
axis A\
|
||||
units degrees\
|
||||
hardlowerlim -370\
|
||||
hardupperlim 370\
|
||||
maxSpeed 2\
|
||||
maxAccel 2\
|
||||
maxDecel 2\
|
||||
stepsPerX 25000\
|
||||
absEnc 1\
|
||||
absEncHome $eom_Home\
|
||||
cntsPerX -8192]
|
||||
setHomeandRange -motor fake_eom -home 0 -lowrange -370 -uprange 370
|
||||
fake_eom softlowerlim -370
|
||||
fake_eom softupperlim 370
|
||||
fake_eom speed 1
|
||||
fake_eom movecount $move_count
|
||||
fake_eom precision 0.01
|
||||
fake_eom part sample
|
||||
fake_eom long_name fake_euler_omega
|
||||
|
||||
Motor fake_ephi asim [params \
|
||||
asyncqueue mc2\
|
||||
axis A\
|
||||
units degrees\
|
||||
hardlowerlim -370\
|
||||
hardupperlim 370\
|
||||
maxSpeed 2\
|
||||
maxAccel 2\
|
||||
maxDecel 2\
|
||||
stepsPerX 25000\
|
||||
absEnc 1\
|
||||
absEncHome $eom_Home\
|
||||
cntsPerX -8192]
|
||||
setHomeandRange -motor fake_ephi -home 0 -lowrange -370 -uprange 370
|
||||
fake_ephi softlowerlim -370
|
||||
fake_ephi softupperlim 370
|
||||
fake_ephi speed 1
|
||||
fake_ephi movecount $move_count
|
||||
fake_ephi precision 0.01
|
||||
fake_ephi part sample
|
||||
fake_ephi long_name fake_euler_phi
|
||||
|
||||
Motor fake_twotheta asim [params \
|
||||
asyncqueue mc2\
|
||||
axis A\
|
||||
units degrees\
|
||||
hardlowerlim -370\
|
||||
hardupperlim 370\
|
||||
maxSpeed 2\
|
||||
maxAccel 2\
|
||||
maxDecel 2\
|
||||
stepsPerX 25000\
|
||||
absEnc 1\
|
||||
absEncHome $eom_Home\
|
||||
cntsPerX -8192]
|
||||
setHomeandRange -motor fake_twotheta -home 0 -lowrange -370 -uprange 370
|
||||
fake_twotheta softlowerlim -370
|
||||
fake_twotheta softupperlim 370
|
||||
fake_twotheta speed 1
|
||||
fake_twotheta movecount $move_count
|
||||
fake_twotheta precision 0.01
|
||||
fake_twotheta part sample
|
||||
fake_twotheta long_name fake_euler_twotheta
|
||||
|
||||
Motor fake_echi asim [params \
|
||||
asyncqueue mc2\
|
||||
axis A\
|
||||
units degrees\
|
||||
hardlowerlim -370\
|
||||
hardupperlim 370\
|
||||
maxSpeed 2\
|
||||
maxAccel 2\
|
||||
maxDecel 2\
|
||||
stepsPerX 25000\
|
||||
absEnc 1\
|
||||
absEncHome $eom_Home\
|
||||
cntsPerX -8192]
|
||||
setHomeandRange -motor fake_echi -home 0 -lowrange -370 -uprange 370
|
||||
fake_echi softlowerlim -370
|
||||
fake_echi softupperlim 370
|
||||
fake_echi speed 1
|
||||
fake_echi movecount $move_count
|
||||
fake_echi precision 0.01
|
||||
fake_echi part sample
|
||||
fake_echi long_name fake_euler_echi
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,168 @@
|
||||
# This must be loaded by motor_configuration.tcl
|
||||
|
||||
set ephi_Home 31706258
|
||||
set echi_Home 24224381
|
||||
#set echi_Home 8919294
|
||||
set eom_Home 23165482
|
||||
|
||||
# Sample Tilt 1, euler omega stage
|
||||
Motor eom $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis A\
|
||||
units degrees\
|
||||
hardlowerlim -45\
|
||||
hardupperlim 80\
|
||||
maxSpeed 2\
|
||||
maxAccel 2\
|
||||
maxDecel 2\
|
||||
stepsPerX 25000\
|
||||
absEnc 1\
|
||||
absEncHome $eom_Home\
|
||||
cntsPerX -8192]
|
||||
setHomeandRange -motor eom -home 0 -lowrange 35 -uprange 80
|
||||
eom speed 1
|
||||
eom movecount $move_count
|
||||
eom precision 0.01
|
||||
eom part sample
|
||||
eom long_name euler_omega
|
||||
|
||||
# Sample Tilt 2, euler chi stage
|
||||
Motor echi $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis B\
|
||||
units degrees\
|
||||
hardlowerlim -32\
|
||||
hardupperlim 97\
|
||||
maxSpeed 2\
|
||||
maxAccel 2\
|
||||
maxDecel 2\
|
||||
stepsPerX -25000\
|
||||
absEnc 1\
|
||||
absEncHome $echi_Home\
|
||||
cntsPerX 8192]
|
||||
setHomeandRange -motor echi -home 0 -lowrange 10 -uprange 95
|
||||
echi softlowerlim -10
|
||||
echi softupperlim 90
|
||||
echi home 0
|
||||
echi speed 1
|
||||
echi movecount $move_count
|
||||
echi precision 0.01
|
||||
echi part sample
|
||||
echi long_name euler_chi
|
||||
|
||||
# Sample Trans 1, upper, y
|
||||
Motor ephi $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis C\
|
||||
units degrees\
|
||||
hardlowerlim -360000\
|
||||
hardupperlim 360000\
|
||||
maxSpeed 5\
|
||||
maxAccel 5\
|
||||
maxDecel 1\
|
||||
stepsPerX -12500\
|
||||
absEnc 1\
|
||||
absEncHome $ephi_Home\
|
||||
cntsPerX -4096]
|
||||
setHomeandRange -motor ephi -home 0 -lowrange 180 -uprange 180
|
||||
ephi softlowerlim -360000
|
||||
ephi softupperlim 360000
|
||||
ephi home 0
|
||||
ephi speed 1
|
||||
ephi movecount $move_count
|
||||
ephi precision 0.01
|
||||
ephi part sample
|
||||
ephi long_name euler_phi
|
||||
|
||||
# dummy motors for UB
|
||||
|
||||
Motor fake_eom asim [params \
|
||||
asyncqueue mc2\
|
||||
axis A\
|
||||
units degrees\
|
||||
hardlowerlim -370\
|
||||
hardupperlim 370\
|
||||
maxSpeed 2\
|
||||
maxAccel 2\
|
||||
maxDecel 2\
|
||||
stepsPerX 25000\
|
||||
absEnc 1\
|
||||
absEncHome $eom_Home\
|
||||
cntsPerX -8192]
|
||||
setHomeandRange -motor fake_eom -home 0 -lowrange -370 -uprange 370
|
||||
fake_eom softlowerlim -370
|
||||
fake_eom softupperlim 370
|
||||
fake_eom speed 1
|
||||
fake_eom movecount $move_count
|
||||
fake_eom precision 0.01
|
||||
fake_eom part sample
|
||||
fake_eom long_name fake_euler_omega
|
||||
|
||||
Motor fake_ephi asim [params \
|
||||
asyncqueue mc2\
|
||||
axis A\
|
||||
units degrees\
|
||||
hardlowerlim -370\
|
||||
hardupperlim 370\
|
||||
maxSpeed 2\
|
||||
maxAccel 2\
|
||||
maxDecel 2\
|
||||
stepsPerX 25000\
|
||||
absEnc 1\
|
||||
absEncHome $eom_Home\
|
||||
cntsPerX -8192]
|
||||
setHomeandRange -motor fake_ephi -home 0 -lowrange -370 -uprange 370
|
||||
fake_ephi softlowerlim -370
|
||||
fake_ephi softupperlim 370
|
||||
fake_ephi speed 1
|
||||
fake_ephi movecount $move_count
|
||||
fake_ephi precision 0.01
|
||||
fake_ephi part sample
|
||||
fake_ephi long_name fake_euler_phi
|
||||
|
||||
Motor fake_twotheta asim [params \
|
||||
asyncqueue mc2\
|
||||
axis A\
|
||||
units degrees\
|
||||
hardlowerlim -370\
|
||||
hardupperlim 370\
|
||||
maxSpeed 2\
|
||||
maxAccel 2\
|
||||
maxDecel 2\
|
||||
stepsPerX 25000\
|
||||
absEnc 1\
|
||||
absEncHome $eom_Home\
|
||||
cntsPerX -8192]
|
||||
setHomeandRange -motor fake_twotheta -home 0 -lowrange -370 -uprange 370
|
||||
fake_twotheta softlowerlim -370
|
||||
fake_twotheta softupperlim 370
|
||||
fake_twotheta speed 1
|
||||
fake_twotheta movecount $move_count
|
||||
fake_twotheta precision 0.01
|
||||
fake_twotheta part sample
|
||||
fake_twotheta long_name fake_euler_twotheta
|
||||
|
||||
Motor fake_echi asim [params \
|
||||
asyncqueue mc2\
|
||||
axis A\
|
||||
units degrees\
|
||||
hardlowerlim -370\
|
||||
hardupperlim 370\
|
||||
maxSpeed 2\
|
||||
maxAccel 2\
|
||||
maxDecel 2\
|
||||
stepsPerX 25000\
|
||||
absEnc 1\
|
||||
absEncHome $eom_Home\
|
||||
cntsPerX -8192]
|
||||
setHomeandRange -motor fake_echi -home 0 -lowrange -370 -uprange 370
|
||||
fake_echi softlowerlim -370
|
||||
fake_echi softupperlim 370
|
||||
fake_echi speed 1
|
||||
fake_echi movecount $move_count
|
||||
fake_echi precision 0.01
|
||||
fake_echi part sample
|
||||
fake_echi long_name fake_euler_echi
|
||||
|
||||
|
||||
|
@ -0,0 +1,19 @@
|
||||
set magmot "som"
|
||||
Motor $magmot $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis D\
|
||||
units degrees\
|
||||
hardlowerlim -1440\
|
||||
hardupperlim 1440\
|
||||
maxSpeed 1\
|
||||
maxAccel 1\
|
||||
maxDecel 1\
|
||||
stepsPerX [expr 67.0 * 25000 / 360]\
|
||||
absEnc 1\
|
||||
absEncHome 31275743\
|
||||
cntsPerX [expr 67.0 * 8192 / 360]]
|
||||
$magmot part sample
|
||||
$magmot long_name $magmot
|
||||
$magmot softlowerlim -180
|
||||
$magmot softupperlim 180
|
||||
$magmot home 0
|
@ -24,7 +24,8 @@ if {$sim_mode == "true"} {
|
||||
#set mx_Home 23263535
|
||||
set mx_Home 8390583
|
||||
#set mom_Home 9274794
|
||||
set mom_Home 8391038
|
||||
#set mom_Home 8391038
|
||||
set mom_Home 8147038
|
||||
set mtth_Home 19927837
|
||||
#set mphi_Home 7613516
|
||||
#set mphi_Home 27847793
|
||||
@ -35,7 +36,8 @@ set mchi_Home 8389526
|
||||
#set my_Home 6767221
|
||||
set my_Home 8378212
|
||||
set som_Home 17214054
|
||||
set stth_Home 2896180
|
||||
set stth_Home 1036498
|
||||
#set stth_Home 32855991
|
||||
set oct_Home 7743768
|
||||
|
||||
#Measured or computed slit motor steps per millimetre
|
||||
@ -97,11 +99,46 @@ set move_count 10
|
||||
|
||||
|
||||
# CHOOSE HERE for sample stage configuration
|
||||
##########################################
|
||||
# Set axis_config as follows to use different axis configurations
|
||||
# 0: tilt stage configuration
|
||||
# 1: eulerian cradle
|
||||
# 2: small omega
|
||||
# 3: Oxford magnet sample stick
|
||||
set axis_config 0
|
||||
|
||||
switch $axis_config {
|
||||
0 {
|
||||
set sample_stage_rotate "som"
|
||||
fileeval $cfPath(motors)/tilt_configuration.tcl
|
||||
}
|
||||
1 {
|
||||
set sample_stage_rotate "som"
|
||||
fileeval $cfPath(motors)/euler_configuration.tcl
|
||||
}
|
||||
2 {
|
||||
set sample_stage_rotate "som"
|
||||
fileeval $cfPath(motors)/small_omega_config.tcl
|
||||
}
|
||||
3 {
|
||||
# Rename the sample stage som to somss because
|
||||
# som now controls the magnet sample stick
|
||||
set sample_stage_rotate "somss"
|
||||
fileeval $cfPath(motors)/magnet_configuration.tcl
|
||||
}
|
||||
}
|
||||
|
||||
#fileeval $cfPath(motors)/tilt_configuration.tcl
|
||||
fileeval $cfPath(motors)/euler_configuration.tcl
|
||||
#fileeval $cfPath(motors)/euler_configuration.tcl
|
||||
#fileeval $cfPath(motors)/small_omega_config.tcl
|
||||
|
||||
#use this next one ONLY if you have NO fridge on the euler
|
||||
#cradle and you know what you're doing. This is a fudge that
|
||||
#allows ephi to do lots of rotations
|
||||
|
||||
#fileeval $cfPath(motors)/eulinf_configuration.tcl
|
||||
|
||||
|
||||
|
||||
############################
|
||||
# Motor Controller 1
|
||||
@ -201,8 +238,8 @@ Motor mx $motor_driver_type [params \
|
||||
asyncqueue mc1\
|
||||
axis D\
|
||||
units mm\
|
||||
hardlowerlim -10\
|
||||
hardupperlim 10\
|
||||
hardlowerlim -15\
|
||||
hardupperlim 15\
|
||||
maxSpeed 1\
|
||||
maxAccel 1\
|
||||
maxDecel 1\
|
||||
@ -223,7 +260,7 @@ Motor mom $motor_driver_type [params \
|
||||
axis E\
|
||||
units degrees\
|
||||
hardlowerlim -5\
|
||||
hardupperlim 103\
|
||||
hardupperlim 173\
|
||||
maxSpeed 1\
|
||||
maxAccel 1\
|
||||
maxDecel 1\
|
||||
@ -231,7 +268,8 @@ Motor mom $motor_driver_type [params \
|
||||
absEnc 1\
|
||||
absEncHome $mom_Home\
|
||||
cntsPerX -2048]
|
||||
setHomeandRange -motor mom -home 0 -lowrange 5 -uprange 95
|
||||
setHomeandRange -motor mom -home 0 -lowrange 5 -uprange 165
|
||||
#setHomeandRange -motor mom -home 60.08 -lowrange 5 -uprange 165
|
||||
mom speed 1
|
||||
mom movecount $move_count
|
||||
mom precision 0.01
|
||||
@ -277,12 +315,12 @@ mtth long_name takeoff_angle
|
||||
# Motor Controller 2
|
||||
############################
|
||||
# Sample Omega, rotate
|
||||
Motor som $motor_driver_type [params \
|
||||
Motor $sample_stage_rotate $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis E\
|
||||
units degrees\
|
||||
hardlowerlim -110\
|
||||
hardupperlim 160\
|
||||
hardlowerlim -71\
|
||||
hardupperlim 111\
|
||||
maxSpeed 5\
|
||||
maxAccel 1\
|
||||
maxDecel 1\
|
||||
@ -290,29 +328,33 @@ Motor som $motor_driver_type [params \
|
||||
absEnc 1\
|
||||
absEncHome $som_Home\
|
||||
cntsPerX 4096]
|
||||
setHomeandRange -motor som -home 0 -lowrange -71 -uprange 111
|
||||
som speed 1
|
||||
som precision 0.02
|
||||
som part sample
|
||||
som long_name rotate
|
||||
setHomeandRange -motor $sample_stage_rotate -home 0 -lowrange -70 -uprange 110
|
||||
$sample_stage_rotate speed 1
|
||||
$sample_stage_rotate precision 0.02
|
||||
$sample_stage_rotate part sample
|
||||
$sample_stage_rotate long_name rotate
|
||||
|
||||
# Sample two-theta, detector rotate
|
||||
Motor stth $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis F\
|
||||
units degrees\
|
||||
hardlowerlim -0.3\
|
||||
hardupperlim 30\
|
||||
hardlowerlim 15.8\
|
||||
hardupperlim 29.7\
|
||||
maxSpeed 0.5\
|
||||
maxAccel 0.1\
|
||||
maxDecel 0.1\
|
||||
stepsPerX 125000\
|
||||
absEnc 1\
|
||||
absEncHome $stth_Home\
|
||||
bias_bits 25\
|
||||
bias_bias 932070\
|
||||
cntsPerX -93207]
|
||||
stth softlowerlim -0.3
|
||||
stth softupperlim 30
|
||||
stth home 0
|
||||
stth softlowerlim 15.9
|
||||
stth softupperlim 29.6
|
||||
stth home 28.481113
|
||||
#stth home 18.981113
|
||||
#stth home 32
|
||||
stth speed 0.5
|
||||
stth movecount $move_count
|
||||
stth precision 0.01
|
||||
@ -324,20 +366,20 @@ Motor oct $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis G\
|
||||
units degrees\
|
||||
hardlowerlim -2\
|
||||
hardupperlim 4.2\
|
||||
hardlowerlim -1.5\
|
||||
hardupperlim 2.5\
|
||||
maxSpeed 2.0\
|
||||
maxAccel 5.0\
|
||||
maxDecel 5.0\
|
||||
stepsPerX 56762\
|
||||
stepsPerX 58762\
|
||||
absEnc 1\
|
||||
absEncHome $oct_Home\
|
||||
cntsPerX -465]
|
||||
oct softlowerlim -2
|
||||
oct softupperlim 4
|
||||
oct softlowerlim -1.4
|
||||
oct softupperlim 2.4
|
||||
oct home 0
|
||||
oct speed 0.5
|
||||
oct precision 0.01
|
||||
oct precision 0.02
|
||||
oct part collimator
|
||||
oct long_name oct
|
||||
|
||||
@ -370,6 +412,14 @@ oct long_name oct
|
||||
#mf1 long_name mf1
|
||||
|
||||
# Monochromator Focusing (Ge)
|
||||
## ffr 31/7/2012
|
||||
## absEncHome was found to be 16777217 on 31/7/2012 when the
|
||||
## encoder clocked over to 114 counts to give a posn
|
||||
## reading of 4793.458008
|
||||
## The encoder has a 12bit resolution (ie 12bits/turn 4096)
|
||||
## and has a 24bit range (ie max cnt=16777216)
|
||||
## I set a bias of 10000 counts with absenchome = 10000
|
||||
## so that SICS can drive the axis to the allowed limits.
|
||||
Motor mf2 $motor_driver_type [params \
|
||||
asyncqueue mc3\
|
||||
axis A\
|
||||
@ -381,7 +431,9 @@ Motor mf2 $motor_driver_type [params \
|
||||
maxDecel 0.1\
|
||||
stepsPerX 22000\
|
||||
absEnc 1\
|
||||
absEncHome 8384341\
|
||||
absEncHome 42768\
|
||||
bias_bits 24\
|
||||
bias_bias 10000\
|
||||
cntsPerX -3500]
|
||||
setHomeandRange -motor mf2 -home 0 -lowrange 0 -uprange 2
|
||||
mf2 speed 0.02
|
||||
|
@ -0,0 +1,91 @@
|
||||
# This must be loaded by motor_configuration.tcl
|
||||
|
||||
set sphi_Home 7937974
|
||||
set schi_Home 7585956
|
||||
set sy_Home 7557524
|
||||
set sx_Home 7557304
|
||||
|
||||
# Sample Tilt 1, upper, phi
|
||||
Motor sphi $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis A\
|
||||
units degrees\
|
||||
hardlowerlim -360\
|
||||
hardupperlim 360\
|
||||
maxSpeed 3\
|
||||
maxAccel 2\
|
||||
maxDecel 2\
|
||||
stepsPerX 25000\
|
||||
absEnc 0\
|
||||
absEncHome $sphi_Home\
|
||||
cntsPerX -8192]
|
||||
setHomeandRange -motor sphi -home 0 -lowrange -360 -uprange 360
|
||||
sphi speed 2
|
||||
sphi movecount $move_count
|
||||
sphi precision 0.02
|
||||
sphi part sample
|
||||
sphi long_name phi
|
||||
|
||||
# Sample Tilt 2, lower, chi
|
||||
Motor schi $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis B\
|
||||
units degrees\
|
||||
hardlowerlim 75\
|
||||
hardupperlim 105\
|
||||
maxSpeed 1\
|
||||
maxAccel 1\
|
||||
maxDecel 1\
|
||||
stepsPerX 25000\
|
||||
absEnc 1\
|
||||
absEncHome $schi_Home\
|
||||
cntsPerX 8192]
|
||||
setHomeandRange -motor schi -home 90 -lowrange 15 -uprange 15
|
||||
schi speed 1
|
||||
schi movecount $move_count
|
||||
schi precision 0.01
|
||||
schi part sample
|
||||
schi long_name chi
|
||||
|
||||
# Sample Trans 1, upper, y
|
||||
Motor sy $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis C\
|
||||
units mm\
|
||||
hardlowerlim -20\
|
||||
hardupperlim 20\
|
||||
maxSpeed 1\
|
||||
maxAccel 1\
|
||||
maxDecel 1\
|
||||
stepsPerX 25000\
|
||||
absEnc 1\
|
||||
absEncHome $sy_Home\
|
||||
cntsPerX 8192]
|
||||
setHomeandRange -motor sy -home 0 -lowrange 20 -uprange 20
|
||||
sy speed 1
|
||||
sy movecount $move_count
|
||||
sy precision 0.01
|
||||
sy part sample
|
||||
sy long_name translate_y
|
||||
|
||||
# Sample Trans2, lower, x
|
||||
Motor sx $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis D\
|
||||
units mm\
|
||||
hardlowerlim -20\
|
||||
hardupperlim 20\
|
||||
maxSpeed 1\
|
||||
maxAccel 1\
|
||||
maxDecel 1\
|
||||
stepsPerX -25000\
|
||||
absEnc 1\
|
||||
absEncHome $sx_Home\
|
||||
cntsPerX -8192]
|
||||
setHomeandRange -motor sx -home 0 -lowrange 20 -uprange 20
|
||||
sx speed 1
|
||||
sx movecount $move_count
|
||||
sx precision 0.01
|
||||
sx part sample
|
||||
sx long_name translate_x
|
||||
|
@ -10,8 +10,8 @@ Motor sphi $motor_driver_type [params \
|
||||
asyncqueue mc2\
|
||||
axis A\
|
||||
units degrees\
|
||||
hardlowerlim -360\
|
||||
hardupperlim 360\
|
||||
hardlowerlim -15\
|
||||
hardupperlim 15\
|
||||
maxSpeed 1\
|
||||
maxAccel 1\
|
||||
maxDecel 1\
|
||||
|
@ -1,5 +0,0 @@
|
||||
source $cfPath(source)/source_common.tcl
|
||||
|
||||
proc ::source::isc_initialize {} {
|
||||
::source::ic_initialize "thermal"
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user