- Fixed various bugs in evcontroller relating to bad access after

initialization failure.
- Fixed a bug in scan.c which causes scan to go in an endless loop
  when SICS failed to start a motor.
- Fixed a bug in motor.c which caused bad softwarelimits after changes
  to the softzero.
- Started changes in choco* in order incorporate normal parameters and
  an environment driver.
This commit is contained in:
cvs
2000-06-30 14:16:52 +00:00
parent 604c8baf19
commit 006f10741c
12 changed files with 149 additions and 64 deletions

View File

@ -21,6 +21,8 @@
void *pData,
int argc, char *argv[]);
pEVDriver MakeControllerEnvironmentDriver(int argc, char *argv[]);
#ifdef CHADAINTERNAL
@ -34,5 +36,11 @@
char *pParName;
}CHAdapter;
typedef struct __CHEV {
char *pParName;
pCodri pDriv;
}CHev, *pCHev;
#endif
#endif

30
choco.c
View File

@ -111,6 +111,26 @@
}
else
{
if(argc > 2)
{
/* set case */
iRet = self->pDriv->SetPar2(self->pDriv,argv[1],argv[2]);
if(!iRet)
{
self->pDriv->GetError(self->pDriv,&iRet,pValue,79);
sprintf(pMessage,"ERROR: %s",pValue);
SCWrite(pCon,pMessage,eError);
return 0;
}
else
{
SCSendOK(pCon);
return 1;
}
}
else
{
/* get case */
iRet = CHGetParameter(self,argv[1],pValue,79);
if(iRet)
{
@ -124,6 +144,7 @@
SCWrite(pCon,pMessage,eValue);
return iRet;
}
}
return 0;
}
/*----------------------------------------------------------------------*/
@ -166,7 +187,8 @@ extern pCodri MakeDoChoDriver(char *pHost, int iPort, int iChannel);
if(argc < 3)
{
SCWrite(pCon,"ERROR: Insufficient number of arguments to MakeChopper",
SCWrite(pCon,
"ERROR: Insufficient number of arguments to MakeController",
eError);
return 0;
}
@ -210,14 +232,14 @@ extern pCodri MakeDoChoDriver(char *pHost, int iPort, int iChannel);
}
else
{
sprintf(pBueffel,"ERROR: Driver %s NOT supported for MakeChopper",
sprintf(pBueffel,"ERROR: Driver %s NOT supported for MakeController",
argv[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
if( (pNew == NULL) || (pDes == NULL) || (pDriv == NULL) )
{
SCWrite(pCon,"ERROR: No memory left to create chopper",eError);
SCWrite(pCon,"ERROR: No memory left to create controller",eError);
return 0;
}
pNew->pDes = pDes;
@ -236,7 +258,7 @@ extern pCodri MakeDoChoDriver(char *pHost, int iPort, int iChannel);
iRet = AddCommand(pSics, argv[1],ChocoAction,KillChoco,pNew);
if(!iRet)
{
sprintf(pBueffel,"ERROR: duplicate SPS command %s NOT created",
sprintf(pBueffel,"ERROR: duplicate command %s NOT created",
argv[1]);
SCWrite(pCon,pBueffel,eError);
return 0;

View File

@ -1,8 +1,9 @@
\subsection{Chopper Controller}
Yet another way to deal with a controller has beenn devised for
Yet another way to deal with a controller has been devised for
SICS. This uses the concept of a general controller which can have
parameters enquired and set. Furthermore it may have parameters which
may be driven like a motor through a special adapter. This scheme is
may be driven like a motor or environment controller through special
adapters . This scheme is
used for the chopper controller for FOCUS.
\begin{itemize}
\item A driver for a particular controller which allows to set and get
@ -11,6 +12,7 @@ parameters.
\item An adapter object which allows to drive special parameters in a general
controller. Such adapter objects can be configured for each drivable parameter
in a controller.
\item An adapter to an environment controller driver.
\end{itemize}
The test case for this way of doing things is a controller for running
choppers. This is why it gets the name.
@ -85,7 +87,7 @@ fValue. The last is floating point which covers the frequent
occurence of numeric values.
\item[SetPar2] The same as SetPar but uses test string as input for
parameter setting.
\item[GetPar] retrieves the parameter parname formatted as test. The
\item[GetPar] retrieves the parameter parname formatted as text. The
value is put into the buffer pBuffer. iBufLen is the maximum number of
bytes permissable for pBuffer.
\item[CheckPar] When parameters are driven a means is needed to find
@ -180,7 +182,7 @@ $\langle$chocodata {\footnotesize ?}$\rangle\equiv$
It consists just of the standard SICS object descriptor and a pointer
to the driver.
\subsubsection{The Drive Adapter}
\subsubsection{The Drive And Environment Adapters}
Most of the work of the drive adaptor is hidden in the functions
implementing the drivable interface. Thus the interface to the
DriveAdapter is fairly simple:
@ -199,6 +201,8 @@ $\langle$adapter {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ int CHAdapterAction(SConnection *pCon, SicsInterp *pSics, @\\
\mbox{}\verb@ void *pData,@\\
\mbox{}\verb@ int argc, char *argv[]);@\\
\mbox{}\verb@@\\
\mbox{}\verb@ pEVDriver MakeControllerEnvironmentDriver(int argc, char *argv[]);@\\
\mbox{}\verb@ @\\
\mbox{}\verb@@$\diamond$
\end{list}
@ -215,6 +219,8 @@ creating a drive adapter.
\item[CHAdapterAction] is the SICS interpreter function for
representing the object in SICS. Just a single action is supported:
request the value of the parameter.
\item[MakeControllerEnvironmentDriver] creates an environment control
driver for a parameter in a general controller object.
\end{description}
The data structure for the drive adapter is slightly more interesting:
@ -253,8 +259,29 @@ $\langle$adadata {\footnotesize ?}$\rangle\equiv$
this adapter.
\end{description}
This is the data structure for the private part of the environment
controller driver:
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap6}
$\langle$evada {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@ typedef struct __CHEV {@\\
\mbox{}\verb@ char *pParName;@\\
\mbox{}\verb@ pCodri pDriv;@\\
\mbox{}\verb@ }CHev, *pCHev;@\\
\mbox{}\verb@@$\diamond$
\end{list}
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap7}
\verb@"codri.h"@ {\footnotesize ? }$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
@ -281,7 +308,7 @@ this adapter.
\end{minipage}\\[4ex]
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap7}
\begin{minipage}{\linewidth} \label{scrap8}
\verb@"choco.h"@ {\footnotesize ? }$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
@ -308,7 +335,7 @@ this adapter.
\end{minipage}\\[4ex]
\end{flushleft}
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap8}
\begin{minipage}{\linewidth} \label{scrap9}
\verb@"chadapter.h"@ {\footnotesize ? }$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
@ -327,6 +354,7 @@ this adapter.
\mbox{}\verb@@$\langle$adapter {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@#ifdef CHADAINTERNAL@\\
\mbox{}\verb@@$\langle$adadata {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@@$\langle$evada {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@#endif@\\
\mbox{}\verb@#endif@\\
\mbox{}\verb@@$\diamond$

24
choco.w
View File

@ -1,8 +1,9 @@
\subsection{Chopper Controller}
Yet another way to deal with a controller has beenn devised for
Yet another way to deal with a controller has been devised for
SICS. This uses the concept of a general controller which can have
parameters enquired and set. Furthermore it may have parameters which
may be driven like a motor through a special adapter. This scheme is
may be driven like a motor or environment controller through special
adapters . This scheme is
used for the chopper controller for FOCUS.
\begin{itemize}
\item A driver for a particular controller which allows to set and get
@ -11,6 +12,7 @@ parameters.
\item An adapter object which allows to drive special parameters in a general
controller. Such adapter objects can be configured for each drivable parameter
in a controller.
\item An adapter to an environment controller driver.
\end{itemize}
The test case for this way of doing things is a controller for running
choppers. This is why it gets the name.
@ -72,7 +74,7 @@ fValue. The last is floating point which covers the frequent
occurence of numeric values.
\item[SetPar2] The same as SetPar but uses test string as input for
parameter setting.
\item[GetPar] retrieves the parameter parname formatted as test. The
\item[GetPar] retrieves the parameter parname formatted as text. The
value is put into the buffer pBuffer. iBufLen is the maximum number of
bytes permissable for pBuffer.
\item[CheckPar] When parameters are driven a means is needed to find
@ -141,7 +143,7 @@ the internal data structure for a controller object is very simple:
It consists just of the standard SICS object descriptor and a pointer
to the driver.
\subsubsection{The Drive Adapter}
\subsubsection{The Drive And Environment Adapters}
Most of the work of the drive adaptor is hidden in the functions
implementing the drivable interface. Thus the interface to the
DriveAdapter is fairly simple:
@ -156,6 +158,8 @@ DriveAdapter is fairly simple:
void *pData,
int argc, char *argv[]);
pEVDriver MakeControllerEnvironmentDriver(int argc, char *argv[]);
@}
\begin{description}
\item[CHAdapterFactory] is the SICS interpreter factory function for
@ -163,6 +167,8 @@ creating a drive adapter.
\item[CHAdapterAction] is the SICS interpreter function for
representing the object in SICS. Just a single action is supported:
request the value of the parameter.
\item[MakeControllerEnvironmentDriver] creates an environment control
driver for a parameter in a general controller object.
\end{description}
The data structure for the drive adapter is slightly more interesting:
@ -188,6 +194,15 @@ The data structure for the drive adapter is slightly more interesting:
this adapter.
\end{description}
This is the data structure for the private part of the environment
controller driver:
@d evada @{
typedef struct __CHEV {
char *pParName;
pCodri pDriv;
}CHev, *pCHev;
@}
@o codri.h @{
/*-------------------------------------------------------------------------
C o n t r o l l e r D r i v e r
@ -242,6 +257,7 @@ this adapter.
@<adapter@>
#ifdef CHADAINTERNAL
@<adadata@>
@<evada@>
#endif
#endif
@}

View File

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

View File

@ -657,8 +657,8 @@
ObParInit(pRes->pParam, ACCESS, "access", usUser, usMugger);
ObParInit(pRes->pParam, ERRORHANDLER, "errorhandler", 0.0, usUser);
ObParInit(pRes->pParam, INTERRUPT, "interrupt", eContinue, usUser);
ObParInit(pRes->pParam, UPLIMIT, "upperlimit", 2.0, usUser);
ObParInit(pRes->pParam, LOWLIMIT, "lowerlimit", -120., usUser);
ObParInit(pRes->pParam, UPLIMIT, "upperlimit", 300.0, usUser);
ObParInit(pRes->pParam, LOWLIMIT, "lowerlimit", 2., usUser);
ObParInit(pRes->pParam, SAFEVALUE, "safevalue", 0., usUser);
/* local initialisations */
@ -1127,9 +1127,8 @@
pNew = CreateEVController(pDriv,argv[2],&iRet);
if(!pNew)
{
TecsError(pDriv, &iRet, pError, sizeof(pError)-1);
SCWrite(pCon,"ERROR: failed to initialize Tecs",eError);
SCWrite(pCon,"ERROR creating Environment Controller",eError);
DeleteEVDriver(pDriv);
return 0;
}
if(!iRet)
@ -1171,7 +1170,6 @@
if(!pNew)
{
SCWrite(pCon,"ERROR creating Environment Controller",eError);
DeleteEVDriver(pDriv);
return 0;
}
if(!iRet)
@ -1213,7 +1211,6 @@
if(!pNew)
{
SCWrite(pCon,"ERROR creating Environment Controller",eError);
DeleteEVDriver(pDriv);
return 0;
}
if(!iRet)
@ -1256,7 +1253,6 @@
if(!pNew)
{
SCWrite(pCon,"ERROR creating Environment Controller",eError);
DeleteEVDriver(pDriv);
return 0;
}
if(!iRet)
@ -1378,7 +1374,6 @@
if(!pNew)
{
SCWrite(pCon,"ERROR creating Environment Controller",eError);
DeleteEVDriver(pDriv);
return 0;
}
if(!iRet)

View File

@ -33,3 +33,14 @@
/*-------------------- life & death of a driver --------------------------*/
pEVDriver CreateEVDriver(int argc, char *argv[]);
void DeleteEVDriver(pEVDriver pDriv);

4
hkl.c
View File

@ -1102,7 +1102,7 @@ ente:
return 0;
break;
case DEVDONE:
sprintf(pBueffel,"Driving to %3.1f %3.1f %3.1f done",
sprintf(pBueffel,"Driving to %8.4f %8.4f %8.4f done",
fHKL[0], fHKL[1], fHKL[2]);
SCWrite(pCon,pBueffel,eStatus);
break;
@ -1312,7 +1312,7 @@ ente:
/*----------- current */
else if(strcmp(argv[1],"current") == 0)
{
sprintf(pBueffel,"Last HKL: %f %f %f ",
sprintf(pBueffel,"Last HKL: %8.4f %8.4f %8.4f ",
self->fLastHKL[0], self->fLastHKL[1],self->fLastHKL[2]);
SCWrite(pCon,pBueffel,eValue);
return 1;

View File

@ -517,7 +517,7 @@ extern void KillPiPiezo(void *pData);
ObPar *pPar = NULL;
char pBueffel[512];
int iRet;
float fLimit;
float fLimit, fOld, fChange;
assert(self);
assert(pCon);
@ -525,18 +525,21 @@ extern void KillPiPiezo(void *pData);
if(strcmp(name,"softzero") == 0)
{
/* set it first, this also tests the necessary privileges */
fOld = ObVal(self->ParArray,SZERO);
iRet = ObParSet(self->ParArray,self->name,name,fVal,pCon);
if(!iRet)
{
return iRet;
}
/* shift the limits by the difference between old and new */
fChange = fVal - fOld;
/* upper limit */
fLimit = ObVal(self->ParArray,SUPP);
fLimit -= fVal;
fLimit -= fChange;
ObParSet(self->ParArray,self->name,"softupperlim",fLimit,pCon);
/* lower limit */
fLimit = ObVal(self->ParArray,SLOW);
fLimit -= fVal;
fLimit -= fChange;
ObParSet(self->ParArray,self->name,"softlowerlim",fLimit,pCon);
return 1;

3
scan.c
View File

@ -859,6 +859,7 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
sprintf(pBueffel,"ERROR: Failed to start %s",pVar->Name);
SCWrite(self->pCon,pBueffel,eError);
status = 0;
break;
}
}
}
@ -1019,7 +1020,7 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
}
/* wait for finish */
lTask = GetDevexecID(pServ->pExecutor);
if(lTask > 0);
if(lTask > 0)
{
TaskWait(pServ->pTasker,lTask);
}

View File

@ -6,7 +6,7 @@ flightpath setAccess 1
delay 2500.000000
delay setAccess 1
hm CountMode timer
hm preset 2.000000
hm preset 100.000000
hm genbin 120.000000 35.000000 512
hm init
datafile focus-1001848.hdf
@ -22,8 +22,8 @@ th sign 1.000000
th InterruptMode 0.000000
th AccessCode 2.000000
#Crystallographic Settings
hkl lambda 1.178100
hkl setub -0.154751 -0.003824 -0.019538 0.049741 -0.005912 -0.061157 0.003550 -0.083854 0.005203
hkl lambda 0.703790
hkl setub -0.124702 0.001618 -0.041357 -0.104448 -0.001326 0.049388 0.000751 0.084094 0.001574
det1dist 300.
det1dist setAccess 1
det1zeroy 128.
@ -60,8 +60,8 @@ ch InterruptMode 0.000000
ch AccessCode 2.000000
# Motor ph
ph SoftZero 0.000000
ph SoftLowerLim -200.000000
ph SoftUpperLim 100.000000
ph SoftLowerLim 0.000000
ph SoftUpperLim 360.000000
ph Fixed -1.000000
ph sign 1.000000
ph InterruptMode 0.000000
@ -84,8 +84,8 @@ muca InterruptMode 0.000000
muca AccessCode 2.000000
# Motor phi
phi SoftZero 0.000000
phi SoftLowerLim -200.000000
phi SoftUpperLim 100.000000
phi SoftLowerLim 0.000000
phi SoftUpperLim 360.000000
phi Fixed -1.000000
phi sign 1.000000
phi InterruptMode 0.000000
@ -114,13 +114,13 @@ twotheta Fixed -1.000000
twotheta sign 1.000000
twotheta InterruptMode 0.000000
twotheta AccessCode 2.000000
lastscancommand sscan ch 180 190 10 2
lastscancommand UNKNOWN
lastscancommand setAccess 2
banana CountMode timer
banana preset 180.000000
banana preset 100.000000
sample_mur 0.000000
sample_mur setAccess 2
email Uwe.Nurps@nurps.nurpstown.de
email UNKNOWN
email setAccess 2
fax UNKNOWN
fax setAccess 2
@ -129,7 +129,7 @@ phone setAccess 2
adress UNKNOWN
adress setAccess 2
# Counter counter
counter SetPreset 1.000000
counter SetPreset 1000.000000
counter SetMode Timer
# Motor som
som SoftZero 0.000000
@ -276,9 +276,9 @@ monox sign 1.000000
monox InterruptMode 0.000000
monox AccessCode 2.000000
# Motor tasse
tasse SoftZero 10.000000
tasse SoftLowerLim -140.000000
tasse SoftUpperLim 120.000000
tasse SoftZero 0.000000
tasse SoftLowerLim -130.000000
tasse SoftUpperLim 130.000000
tasse Fixed -1.000000
tasse sign 1.000000
tasse InterruptMode 0.000000
@ -316,9 +316,9 @@ mgu sign 1.000000
mgu InterruptMode 0.000000
mgu AccessCode 2.000000
# Motor stu
stu SoftZero 0.000000
stu SoftLowerLim -30.000000
stu SoftUpperLim 30.000000
stu SoftZero -10.000000
stu SoftLowerLim -20.000000
stu SoftUpperLim 40.000000
stu Fixed -1.000000
stu sign 1.000000
stu InterruptMode 0.000000
@ -364,9 +364,9 @@ a5 sign 1.000000
a5 InterruptMode 0.000000
a5 AccessCode 2.000000
# Motor a4
a4 SoftZero 10.000000
a4 SoftLowerLim -140.000000
a4 SoftUpperLim 120.000000
a4 SoftZero 0.000000
a4 SoftLowerLim -130.000000
a4 SoftUpperLim 130.000000
a4 Fixed -1.000000
a4 sign 1.000000
a4 InterruptMode 0.000000
@ -395,11 +395,11 @@ a1 Fixed -1.000000
a1 sign 1.000000
a1 InterruptMode 0.000000
a1 AccessCode 2.000000
user Joseph Stalin
user Daniel_the_Clementine
user setAccess 2
sample EB:12mm
sample shit at 10.000000
sample setAccess 2
title Nasse Fische in Dosen
title TopsiTupsiTapsi
title setAccess 2
starttime 2000-04-14 14:34:41
starttime 2000-06-29 15:01:07
starttime setAccess 2

View File

@ -16,7 +16,7 @@ set shome /data/koenneck/src
# first all the server options are set
ServerOption RedirectFile $shome/sics/stdout
#ServerOption RedirectFile $shome/sics/stdout
ServerOption ReadTimeOut 100
# timeout when checking for commands. In the main loop SICS checks for
@ -40,7 +40,7 @@ ServerOption LogFileBaseName $shome/sics/tmp/server
# the path and base name of the internal server logfile to which all
# activity will be logged.
ServerOption TecsStartCmd "tecs/TecsServer -h lnsp26:4000/0"
ServerOption TecsStartCmd "tecs/bin/TecsServer -h lnsp26:4000/0"
# -h host:port/channel is for serial server
ServerOption TecsBinDir tecs/bin/
ServerOption TecsLogDir /data/koenneck/tmp/
@ -380,7 +380,7 @@ MakeXYTable ixi
source cotop.tcl
Publish co User
source helium.tcl
#source helium.tcl
MakeTRICSNEXUS sicsdatanumber $shome/sics/tmp trics.dic
@ -392,4 +392,5 @@ MakeXYTable omth
Publish info user
MakeLin2Ang a5l a5
source tmp/beam.tcl
#source tmp/beam.tcl
source tcl/wwwpar.tcl