- DMC McStas simulation working
This commit is contained in:
@ -755,7 +755,6 @@
|
|||||||
fTime = GetHistTimeBin(self->pHM,&nTime);
|
fTime = GetHistTimeBin(self->pHM,&nTime);
|
||||||
iDim[i3] = nTime;
|
iDim[i3] = nTime;
|
||||||
i3++;
|
i3++;
|
||||||
assert(i3 == 3);
|
|
||||||
|
|
||||||
/* check limits */
|
/* check limits */
|
||||||
if(x2 < x1){
|
if(x2 < x1){
|
||||||
|
6
nxamor.c
6
nxamor.c
@ -90,17 +90,19 @@ static int psdSave = 1;
|
|||||||
iRet = NXopen(file,NXACC_CREATE5,&hfil);
|
iRet = NXopen(file,NXACC_CREATE5,&hfil);
|
||||||
if(iRet != NX_OK)
|
if(iRet != NX_OK)
|
||||||
{
|
{
|
||||||
sprintf(pBueffel,"ERROR: cannot open file %s for writing",file);
|
snprintf(pBueffel,511,"ERROR: cannot open file %s for writing",file);
|
||||||
SCWrite(pCon,pBueffel,eError);
|
SCWrite(pCon,pBueffel,eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
iRet = NXDinitfromfile(AMORDICT,&hdict);
|
iRet = NXDinitfromfile(AMORDICT,&hdict);
|
||||||
if(iRet != NX_OK)
|
if(iRet != NX_OK)
|
||||||
{
|
{
|
||||||
sprintf(pBueffel,"ERROR: cannot open dictionary file %s",AMORDICT);
|
snprintf(pBueffel,511,"ERROR: cannot open dictionary file %s",AMORDICT);
|
||||||
SCWrite(pCon,pBueffel,eError);
|
SCWrite(pCon,pBueffel,eError);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
snprintf(pBueffel,511,"Writing to: %s", file);
|
||||||
|
SCWrite(pCon,pBueffel,eWarning);
|
||||||
|
|
||||||
/* put some global information */
|
/* put some global information */
|
||||||
SNXSPutGlobals(hfil,file,"AMOR",pCon);
|
SNXSPutGlobals(hfil,file,"AMOR",pCon);
|
||||||
|
14
pimotor.c
14
pimotor.c
@ -310,7 +310,7 @@
|
|||||||
memset(pNew,0,sizeof(C804Driv));
|
memset(pNew,0,sizeof(C804Driv));
|
||||||
|
|
||||||
/* connection parameters */
|
/* connection parameters */
|
||||||
pPar = Tcl_GetVar2(pTcl,pArray,"Computer",TCL_GLOBAL_ONLY);
|
pPar = Tcl_GetVar2(pTcl,pArray,"Computer",TCL_LEAVE_ERR_MSG);
|
||||||
if(!pPar)
|
if(!pPar)
|
||||||
{
|
{
|
||||||
Tcl_SetResult(pTcl,"Failed to find serial port server host name",NULL);
|
Tcl_SetResult(pTcl,"Failed to find serial port server host name",NULL);
|
||||||
@ -320,7 +320,7 @@
|
|||||||
pNew->hostname = strdup(pPar);
|
pNew->hostname = strdup(pPar);
|
||||||
|
|
||||||
pPar = NULL;
|
pPar = NULL;
|
||||||
pPar = Tcl_GetVar2(pTcl,pArray,"port",TCL_GLOBAL_ONLY);
|
pPar = Tcl_GetVar2(pTcl,pArray,"port",TCL_LEAVE_ERR_MSG);
|
||||||
if(!pPar)
|
if(!pPar)
|
||||||
{
|
{
|
||||||
Tcl_SetResult(pTcl,"Failed to find serial port server port adress",NULL);
|
Tcl_SetResult(pTcl,"Failed to find serial port server port adress",NULL);
|
||||||
@ -337,7 +337,7 @@
|
|||||||
pNew->iPort = iVal;
|
pNew->iPort = iVal;
|
||||||
|
|
||||||
pPar = NULL;
|
pPar = NULL;
|
||||||
pPar = Tcl_GetVar2(pTcl,pArray,"channel",TCL_GLOBAL_ONLY);
|
pPar = Tcl_GetVar2(pTcl,pArray,"channel",TCL_LEAVE_ERR_MSG);
|
||||||
if(!pPar)
|
if(!pPar)
|
||||||
{
|
{
|
||||||
Tcl_SetResult(pTcl,"Failed to find serial port server channel adress",NULL);
|
Tcl_SetResult(pTcl,"Failed to find serial port server channel adress",NULL);
|
||||||
@ -354,7 +354,7 @@
|
|||||||
pNew->iChannel = iVal;
|
pNew->iChannel = iVal;
|
||||||
pPar = NULL;
|
pPar = NULL;
|
||||||
|
|
||||||
pPar = Tcl_GetVar2(pTcl,pArray,"motor",TCL_GLOBAL_ONLY);
|
pPar = Tcl_GetVar2(pTcl,pArray,"motor",TCL_LEAVE_ERR_MSG);
|
||||||
if(!pPar)
|
if(!pPar)
|
||||||
{
|
{
|
||||||
Tcl_SetResult(pTcl,"Failed to find motor number",NULL);
|
Tcl_SetResult(pTcl,"Failed to find motor number",NULL);
|
||||||
@ -372,7 +372,7 @@
|
|||||||
|
|
||||||
/* limits */
|
/* limits */
|
||||||
pPar = NULL;
|
pPar = NULL;
|
||||||
pPar = Tcl_GetVar2(pTcl,pArray,"lowerlimit",TCL_GLOBAL_ONLY);
|
pPar = Tcl_GetVar2(pTcl,pArray,"lowerlimit",TCL_LEAVE_ERR_MSG);
|
||||||
if(!pPar)
|
if(!pPar)
|
||||||
{
|
{
|
||||||
Tcl_SetResult(pTcl,"Failed to find lower motor limit",NULL);
|
Tcl_SetResult(pTcl,"Failed to find lower motor limit",NULL);
|
||||||
@ -389,7 +389,7 @@
|
|||||||
pNew->fLower = dVal;
|
pNew->fLower = dVal;
|
||||||
|
|
||||||
pPar = NULL;
|
pPar = NULL;
|
||||||
pPar = Tcl_GetVar2(pTcl,pArray,"upperlimit",TCL_GLOBAL_ONLY);
|
pPar = Tcl_GetVar2(pTcl,pArray,"upperlimit",TCL_LEAVE_ERR_MSG);
|
||||||
if(!pPar)
|
if(!pPar)
|
||||||
{
|
{
|
||||||
Tcl_SetResult(pTcl,"Failed to find upper motor limit",NULL);
|
Tcl_SetResult(pTcl,"Failed to find upper motor limit",NULL);
|
||||||
@ -423,7 +423,7 @@
|
|||||||
SerialConfig(&pNew->pSerial,0);
|
SerialConfig(&pNew->pSerial,0);
|
||||||
sprintf(pCommand,"%1.1dMN\r",pNew->iMotor);
|
sprintf(pCommand,"%1.1dMN\r",pNew->iMotor);
|
||||||
SerialWriteRead(&pNew->pSerial,pCommand,pReply,39);
|
SerialWriteRead(&pNew->pSerial,pCommand,pReply,39);
|
||||||
SerialConfig(&pNew->pSerial,iTmo);
|
SerialConfig(&pNew->pSerial,iTmo+5000);
|
||||||
|
|
||||||
/* configure the connection */
|
/* configure the connection */
|
||||||
SerialATerm(&pNew->pSerial,"1\x03");
|
SerialATerm(&pNew->pSerial,"1\x03");
|
||||||
|
Reference in New Issue
Block a user