diff --git a/A1931.c b/A1931.c index b58c4824..a0ec221a 100644 --- a/A1931.c +++ b/A1931.c @@ -20,7 +20,6 @@ #include "evdriver.i" #include "gpibcontroller.h" #include "A1931.h" - /*========================== private data structure ====================*/ typedef struct { int sensor; /* the control sensor */ diff --git a/SCinter.c b/SCinter.c index 2fab2c72..2625f31b 100644 --- a/SCinter.c +++ b/SCinter.c @@ -392,7 +392,7 @@ extern char *SkipSpace(char *pPtr); } if(pCurrent->pName) { - printf("Deleting %s\n",pCurrent->pName); + /* printf("Deleting %s\n",pCurrent->pName); */ free(pCurrent->pName); } pTemp = pCurrent->pNext; diff --git a/anticollider.c b/anticollider.c index b4f51aad..3ccc82a8 100644 --- a/anticollider.c +++ b/anticollider.c @@ -303,7 +303,7 @@ int AntiColliderAction(SConnection *pCon, SicsInterp *pSics, if(argc > 1){ if(strcmp(argv[1],"clear") == 0){ - if(!SCMatchRights(pCon,usMugger)){ + if(!SCMatchRights(pCon,usUser)){ return 0; } LLDdelete(self->sequenceList); diff --git a/doc/user/samenv.htm b/doc/user/samenv.htm index e4c7cca0..04bba803 100644 --- a/doc/user/samenv.htm +++ b/doc/user/samenv.htm @@ -24,6 +24,7 @@ controllers. controller.
  • Eurotherm Temperature Controller.
  • Bruker Magnet Controller. +
  • The Risoe A1931 Temperature Controller.
  • The PSI-EL755 Magnet Controller.
  • The PSI-DSP Magnet Controller, also known as SLS controller. @@ -629,6 +630,35 @@ to be configured manually. For details see the manual coming with the machine. environment controller could not be implemented.

    +

    The Risoe A1931 Temperature Controller

    +

    +This is a temperature controller of unknown origin (probably built at +Risoe) which is coming with the Risoe instruments. This temperature +controller is connected to the computer systems through a GPIB bus and +controller. A A1931 temperature controller is configured into SICS +through the command: +

    +evfactory new temperature-name a1931 gpib-controller-name +
    +This creates a new command temperature-name. gpib-controller-name is +the name of a GPIB controller within SICS. A GPIB controller is +configured into SICS with the command MakeGPIB as described in the +SICS managers documentation. +

    +

    +A A1931 temperature device understands a couple of additional commands +on top of the standard set: +

    +
    temperature sensor val +
    The A1931 can switch control to various sensors. This command +allows to query the control sensor (command without parameter) or set +the control sensoe (command with parameter). +
    temperature file filename +
    The A1931 can be configured through files containing calibration +commands. Sich file can be loaded into the A1931 through the file +subcommand. The full path of filename must be given. +
    +

    The PSI-EL755 Magnet Controller

    This is magnet controller developed by the electronics group at @@ -691,3 +721,4 @@ other environment device. + diff --git a/histmem.c b/histmem.c index cd7e7a2b..7e61162a 100644 --- a/histmem.c +++ b/histmem.c @@ -1137,6 +1137,7 @@ static int checkHMEnd(pHistMem self, char *text){ if(iRet) { self->iInit = 1; + SCSendOK(pCon); } else { diff --git a/motor.c b/motor.c index 3d3bec05..6c581b9b 100644 --- a/motor.c +++ b/motor.c @@ -969,6 +969,8 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray); SCWrite(pCon,pBueffel,eError); return 0; } + pNew->ParArray[HLOW].iCode = usUser; + pNew->ParArray[HUPP].iCode = usUser; } else if (strcmp(argv[2],"pipiezo") == 0) { diff --git a/simdriv.c b/simdriv.c index 23e28ae8..f7342bd1 100644 --- a/simdriv.c +++ b/simdriv.c @@ -2,10 +2,15 @@ SINQ suffers from a severe lack of hardware. In order to do something inspite of this, there is the Simulated motor for testing software and - perhaps later on as a simulation engine for testing baqtch-files. + perhaps later on as a simulation engine for testing batch-files. Mark Koennecke, November 1996 + Prepared for simulation mode by providing for zero failure operation + Mark Koennecke, October 2001 + + Allowed for changing hardware limits: Mark Koennecke, April 2003 + Copyright: Labor fuer Neutronenstreuung @@ -63,9 +68,7 @@ } return 0; } - /*----------------------------------------------------------------------------*/ - static int GetSimPos(void *self, float *fPos) { SIMDriv *pDriv; @@ -232,6 +235,26 @@ return HWBusy; } } +/*-----------------------------------------------------------------------*/ +static int SimSetPar(void *self, SConnection *pCon, char *name, float newValue) +{ + SIMDriv *pDriv = (SIMDriv *) self; + + assert(self); + assert(pCon); + + if(strcmp(name,"hardupperlim") == 0) + { + pDriv->fUpper = newValue; + return 1; + } + if(strcmp(name,"hardlowerlim") == 0) + { + pDriv->fLower = newValue; + return 1; + } + return 0; +} /*--------------------------------------------------------------------------*/ MotorDriver *CreateSIM(SConnection *pCon, int argc, char *argv[]) { @@ -329,6 +352,7 @@ pDriv->GetStatus = SimStat; pDriv->GetError = SimError; pDriv->TryAndFixIt = SimFix; + /* pDriv->SetDriverPar = SimSetPar; */ pDriv->Halt = SimHalt; pDriv->fSpeed = .01; pDriv->iTime = 0; @@ -357,3 +381,12 @@ free(pDriv); } + + + + + + + + + diff --git a/synchronize.c b/synchronize.c index 0515559a..270e8095 100644 --- a/synchronize.c +++ b/synchronize.c @@ -19,7 +19,7 @@ /*----------------------------------------------------------------------- Some file statics which hold the connection parameters ------------------------------------------------------------------------*/ -static char *hostname, *looser, *password; +static char *hostname, *looser, *password, *syncFile; static int port; static mkChannel *connection = NULL; /*-----------------------------------------------------------------------*/ @@ -95,6 +95,8 @@ static void killSync(void *pData) free(looser); if(password) free(password); + if(syncFile) + free(syncFile); } /*----------------------------------------------------------------------*/ int MakeSync(SConnection *pCon, SicsInterp *pSics, void *pData, @@ -120,6 +122,14 @@ int MakeSync(SConnection *pCon, SicsInterp *pSics, void *pData, port = atof(argv[2]); looser = strdup(argv[3]); password = strdup(argv[4]); + if(argc > 5) + { + syncFile = strdup(argv[5]); + } + else + { + syncFile = NULL; + } pServ->simMode = 1; /* @@ -164,7 +174,14 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData, first tell the remote server to backup */ SetStatusFixed(eBatch); - strcpy(pBueffel,"transact backup\n"); + strcpy(pBueffel,"transact backup"); + if(syncFile != NULL) + { + strcat(pBueffel," "); + strcat(pBueffel,syncFile); + } + strcat(pBueffel,"\n"); + test = NETWrite(connection,pBueffel,strlen(pBueffel)); if(test != 1) { @@ -177,11 +194,15 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData, return 0; } /* - wait 10 seconds for correct message + wait 60 seconds for correct message */ + pServ->simMode = 0; /* bug fix: SicsWait returns right away if this would be + left at normal. Reset after loop + */ pBueffel[0] = '\0'; - for(i = 0; i < 10; i++) + for(i = 0; i < 60; i++) { + pRead[0] = '\0'; test = NETRead(connection,pRead,75,20*1000); if(test < 0) { @@ -192,13 +213,17 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData, SCWrite(pCon, "Try again in order to reconnect before giving up",eWarning); ClearFixedStatus(eEager); + pServ->simMode = 1; return 0; } else { - strcat(pBueffel,pRead); + if(test > 0) + { + strcat(pBueffel,pRead); + } } - if(strstr(pBueffel,"TRANSACTIONFINISHED") == NULL) + if(strstr(pBueffel,"TRANSACTIONFINISHED") != NULL) { test = 1; break; @@ -209,6 +234,7 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData, } SicsWait(1); } + pServ->simMode = 1; if(!test) { SCWrite(pCon,"WARNING: sync server may not have exectued backup", @@ -227,7 +253,15 @@ int Synchronize(SConnection *pCon, SicsInterp *pSics, void *pData, return 0; } - test = InterpExecute(pSics,internalCon,"restore"); + if(syncFile != NULL) + { + sprintf(pBueffel,"restore %s",syncFile); + } + else + { + strcpy(pBueffel,"restore"); + } + test = InterpExecute(pSics,internalCon,pBueffel); SCDeleteConnection(internalCon); ClearFixedStatus(eEager); if(test != 1) diff --git a/tasinit.c b/tasinit.c index 542eed9f..d5b15be7 100644 --- a/tasinit.c +++ b/tasinit.c @@ -201,6 +201,43 @@ extern char *tasVariableOrder[] = { "hconv4", "polfile", NULL}; +/*------------------------------------------------------------------- + Normally SICS does not store motor hardware limits into status files as + they are read from the motor controller. However, in order to better + synchronize simulation and instrument this has to be done for TASP. + TasSave does just that: saving hard limits in order for the simulation to + be able to read them. + ------------------------------------------------------------------------*/ +static int TasSaveStatus(void *self, char *name, FILE *fd) +{ + int i = 0; + pMotor pMot; + float value; + SConnection *pCon = NULL; + + pCon = SCCreateDummyConnection(pServ->pSics); + if(!pCon) + { + return 0; + } + while(tasMotorOrder[i] != NULL) + { + pMot = FindMotor(pServ->pSics,tasMotorOrder[i]); + if(pMot) + { + MotorGetPar(pMot,"hardupperlim",&value); + fprintf(fd,"%s hardupperlim %f\n",tasMotorOrder[i], value); + MotorGetPar(pMot,"hardlowerlim",&value); + fprintf(fd,"%s hardlowerlim %f\n",tasMotorOrder[i], value); + MotorGetSoftPosition(pMot,pCon,&value); + fprintf(fd,"run %s %f\n",tasMotorOrder[i], value); + } + i++; + } + SCDeleteConnection(pCon); + fprintf(fd,"success\n"); + return 1; +} /*--------------------------------------------------------------------- There is a special feauture in MAD where the count mode is determined which variable, MN for monitor od TI for time has been set as the last @@ -300,6 +337,7 @@ int TASFactory(SConnection *pCon, SicsInterp *pSics, void *pData, return 0; } pNew->iPOL = -1; + pNew->pDes->SaveStatus = TasSaveStatus; /* connect to all the variables */ iPtr = 0; iError = 0;