- Added a multiple histogram memory control module. This required a

tiny change in the countable interface which in turn required updating
  of header file includes in a lot of files.
- Some small fixes to TRICS writing as well.
This commit is contained in:
cvs
2001-06-08 15:18:35 +00:00
parent 2d16479717
commit 8f84d45dd6
48 changed files with 671 additions and 157 deletions

View File

@ -47,7 +47,8 @@ SOBJ = network.o ifile.o conman.o SCinter.o splitter.o passwd.o \
hklscan.o xytable.o amor2t.o nxamor.o amorscan.o amorstat.o \
circular.o el755driv.o maximize.o sicscron.o tecsdriv.o sanscook.o \
tasinit.o tasutil.o t_rlp.o t_conv.o d_sign.o d_mod.o \
tasdrive.o tasscan.o synchronize.o definealias.o swmotor.o t_update.o
tasdrive.o tasscan.o synchronize.o definealias.o swmotor.o t_update.o \
hmcontrol.o
MOTOROBJ = motor.o el734driv.o simdriv.o el734dc.o pipiezo.o pimotor.o
COUNTEROBJ = countdriv.o simcter.o counter.o

View File

@ -42,8 +42,7 @@
#include <assert.h>
#include "fortify.h"
#include "lld.h"
#include "conman.h"
#include "interface.h"
#include "sics.h"
#define CALLBACK 17777

View File

@ -34,17 +34,13 @@
#include <tcl.h>
#include <time.h>
#include "lld.h"
#include "conman.h"
#include "sics.h"
#include "passwd.h"
#include "SCinter.h"
#include "Scommon.h"
#include "splitter.h"
#include "macro.h"
#include "servlog.h"
#include "status.h"
#include "interrupt.h"
#include "interface.h"
#include "event.h"
#include "ifile.h"
#include "token.h"
#include "uubuffer.h"
@ -826,7 +822,7 @@ extern pServer pServ;
#define ZIPBUF 8192
int SCWriteZipped(SConnection *self, char *pName, void *pData, int iDataLen)
{
char outBuf[65546], *pBuf = NULL, noutBuf[ZIPBUF];
char outBuf[65546], *pBuf = NULL, noutBuf[ZIPBUF], *pHeader = NULL;
int compressedLength, iRet, iRet2, iCount;
z_stream compStream;
@ -895,7 +891,12 @@ extern pServer pServ;
/* write header line */
memset(outBuf,0,65536);
sprintf(outBuf,"SICSBIN ZIP %s %d\r\n",pName,compressedLength);
SCWrite(self,outBuf,eValue);
pHeader = strdup(outBuf);
if(pHeader == NULL)
{
SCWrite(self,"ERROR: out of memory in SCWriteZipped",eError);
return 0;
}
/* now reset the deflater and do the same with writing data */
compStream.zalloc = (alloc_func)NULL;
@ -924,12 +925,13 @@ extern pServer pServ;
compStream.avail_in = iDataLen;
compStream.avail_out = iDataLen + iDataLen/10 + 50;
iRet = deflate(&compStream,Z_FINISH);
if(iRet != Z_STREAM_END && iRet != Z_OK)
if(iRet != Z_STREAM_END)
{
sprintf(outBuf,"ERROR: zlib error: %d",iRet);
SCWrite(self,outBuf,eError);
return 0;
}
iRet = NETWrite(self->pSock,pHeader,strlen(pHeader));
iRet = NETWrite(self->pSock,pBuf,compStream.total_out);
if(iRet != 1)
{
@ -938,6 +940,8 @@ extern pServer pServ;
return 0;
}
deflateEnd(&compStream);
free(pHeader);
free(pBuf);
/*

View File

@ -41,7 +41,7 @@
#include <math.h>
#include "fortify.h"
#include <string.h>
#include "Scommon.h"
#include "sics.h"
#include "countdriv.h"
#include "hardsup/sinq_prototypes.h"
#include "hardsup/el737_def.h"

View File

@ -24,10 +24,6 @@
#define MAXCOUNT 9 /* No of monitors + actual counter */
typedef enum {
eTimer,
ePreset
}CounterMode;
/* Parameter codes for the Set/Get pair of routines */
/*-------- threshold */

View File

@ -70,6 +70,17 @@
return self->pDriv->Halt(self->pDriv);
}
/*--------------------------------------------------------------------------*/
static void SetCountParameters(void *pData, float fPreset, CounterMode eMode)
{
pCounter self = NULL;
assert(pData);
self = (pCounter)pData;
self->pDriv->fPreset = fPreset;
self->pDriv->eMode = eMode;
}
/*-----------------------------------------------------------------------*/
static int StartCount(void *pData, SConnection *pCon)
{
@ -355,6 +366,7 @@
free(pRes);
return NULL;
}
pRes->pCountInt->SetCountParameters = SetCountParameters;
pRes->pCountInt->StartCount = StartCount;
pRes->pCountInt->CheckCountStatus = CheckCountStatus;
pRes->pCountInt->TransferData = TransferData;

View File

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

View File

@ -42,18 +42,14 @@
#include <assert.h>
#include <string.h>
#include "fortify.h"
#include "conman.h"
#include "Scommon.h"
#include "interface.h"
#include "sics.h"
#include "nserver.h"
#include "motor.h"
#include "countdriv.h"
#include "counter.h"
#include "task.h"
#include "devexec.h"
#include "status.h"
#include "lld.h"
#include "event.h"
/*
#define DEBUG 1

View File

@ -41,11 +41,8 @@
#include <assert.h>
#include <string.h>
#include "fortify.h"
#include "sics.h"
#include "drive.h"
#include "obdes.h"
#include "interface.h"
#include "SCinter.h"
#include "conman.h"
#include "nserver.h" /* for SicsWait */
#include "drive.h"
#include "splitter.h"

5
emon.c
View File

@ -42,10 +42,7 @@
#include <tcl.h> /* for DString */
#include "fortify.h"
#include "lld.h"
#include "conman.h"
#include "SCinter.h"
#include "obdes.h"
#include "interface.h"
#include "sics.h"
#include "emon.i"
#include "emon.h"
#include "event.h"

View File

@ -41,9 +41,7 @@
#include <assert.h>
#include <math.h>
#include "fortify.h"
#include "conman.h"
#include "obdes.h"
#include "interface.h"
#include "sics.h"
#include "countdriv.h"
#include "counter.h"
#include "splitter.h"

View File

@ -134,6 +134,17 @@
}
return NULL;
}
/*------------------------------------------------------------------------*/
static void HistSetParameter(void *pData, float fPreset, CounterMode eMode)
{
pHistMem self = NULL;
self = (pHistMem)pData;
assert(self);
self->pDriv->eCount = eMode;
self->pDriv->fCountPreset = fPreset;
}
/*-------------------------------------------------------------------------*/
static int HistStartCount(void *pData, SConnection *pCon)
{
@ -409,6 +420,7 @@
free(pNew);
return NULL;
}
pNew->pCountInt->SetCountParameters = HistSetParameter;
pNew->pCountInt->StartCount = HistStartCount;
pNew->pCountInt->CheckCountStatus = HistCountStatus;
pNew->pCountInt->TransferData = HistTransfer;

View File

@ -41,9 +41,7 @@
#include <assert.h>
#include <math.h>
#include "fortify.h"
#include "conman.h"
#include "obdes.h"
#include "interface.h"
#include "sics.h"
#include "countdriv.h"
#include "counter.h"
#include "stringdict.h"
@ -65,7 +63,9 @@
static int SimConfig(pHistDriver self, SConnection *pCon,
pStringDict pOption, SicsInterp *pSics)
{
int i, iLength = 1;
int i, iLength = 1, status;
char pData[132];
float fFail;
if(self->eHistMode == eHTOF)
{
@ -76,6 +76,18 @@
iLength *= self->iTimeChan;
self->iLength = iLength;
}
/*
deal with failrate
*/
status = StringDictGet(pOption,"failrate",pData,131);
if(status)
{
fFail = atof(pData);
free(self->pPriv);
self->pPriv = NewSIMCounter("HistoSim",fFail);
}
return 1;
}
/*-------------------------------------------------------------------------*/
@ -265,6 +277,7 @@
pNew->FreePrivate = SimFreePrivate;
pNew->Pause = SimPause;
pNew->Continue = SimContinue;
StringDictAddPair(pOpt,"failrate","-1");
return pNew;
}

349
hmcontrol.c Normal file
View File

@ -0,0 +1,349 @@
/*------------------------------------------------------------------------
H M C O N T R O L
A module for coordinating several counters and histogram
memories. One of the counters is the master counter and the rest are
slaves which have to be kept in sync with the master in their
operations.
copyright: see copyright.h
Mark Koennecke, June 2001
-------------------------------------------------------------------------*/
#include <stdlib.h>
#include <assert.h>
#include <tcl.h>
#include "fortify.h"
#include "hmcontrol.h"
#include "devexec.h"
/*-------------------------------------------------------------------------*/
static void *HMCGetInterface(void *pData, int ID)
{
pHMcontrol self = NULL;
self = (pHMcontrol)pData;
assert(self);
if(ID == COUNTID)
return self->pCount;
else
return NULL;
}
/*------------------------------------------------------------------------*/
static int HMCHalt(void *pData)
{
int i, retVal = OKOK, status;
pHMcontrol self = NULL;
self = (pHMcontrol)pData;
assert(self);
for(i = 0; i < self->nSlaves; i++)
{
status = self->slaves[i]->Halt(self->slaveData[i]);
if(status != OKOK)
retVal = status;
}
return retVal;
}
/*-----------------------------------------------------------------------*/
static int HMCStart(void *pData, SConnection *pCon)
{
int i, status;
pHMcontrol self = NULL;
self = (pHMcontrol)pData;
assert(self);
for(i = 0; i < self->nSlaves; i++)
{
status = self->slaves[i]->StartCount(self->slaveData[i],pCon);
if(status != OKOK)
{
HMCHalt(self);
return status;
}
}
return OKOK;
}
/*----------------------------------------------------------------------*/
static int HMCStatus(void *pData, SConnection *pCon)
{
int status;
pHMcontrol self = NULL;
self = (pHMcontrol)pData;
assert(self);
status = self->slaves[0]->CheckCountStatus(self->slaveData[0],pCon);
if(status == HWIdle || status == HWFault)
{
/*
stop counting on slaves when finished or when an error
occurred.
*/
HMCHalt(self);
}
return status;
}
/*-------------------------------------------------------------------------*/
static int HMCPause(void *pData, SConnection *pCon)
{
int i, status;
pHMcontrol self = NULL;
self = (pHMcontrol)pData;
assert(self);
for(i = 0; i < self->nSlaves; i++)
{
status = self->slaves[i]->Pause(self->slaveData[i],pCon);
if(status != OKOK)
{
HMCHalt(self);
return status;
}
}
return OKOK;
}
/*------------------------------------------------------------------------*/
static int HMCContinue(void *pData, SConnection *pCon)
{
int i, status;
pHMcontrol self = NULL;
self = (pHMcontrol)pData;
assert(self);
for(i = 0; i < self->nSlaves; i++)
{
status = self->slaves[i]->Continue(self->slaveData[i],pCon);
if(status != OKOK)
{
HMCHalt(self);
return status;
}
}
return OKOK;
}
/*----------------------------------------------------------------------*/
static int HMCTransfer(void *pData, SConnection *pCon)
{
int i, retVal = OKOK, status;
pHMcontrol self = NULL;
char pBueffel[132];
self = (pHMcontrol)pData;
assert(self);
for(i = 0; i < self->nSlaves; i++)
{
status = self->slaves[i]->TransferData(self->slaveData[i], pCon);
if(status != OKOK)
{
retVal = status;
sprintf(pBueffel,"WARNING: slave histogram %d failed to transfer data",
i);
SCWrite(pCon,pBueffel,eWarning);
}
}
return retVal;
}
/*-----------------------------------------------------------------------*/
static void HMCParameter(void *pData, float fPreset, CounterMode eMode )
{
int i;
pHMcontrol self = NULL;
self = (pHMcontrol)pData;
assert(self);
for(i = 0; i < self->nSlaves; i++)
{
self->slaves[i]->SetCountParameters(self->slaveData[i], fPreset,
eMode);
}
}
/*----------------------------------------------------------------------*/
static void KillHMcontrol(void *pData)
{
pHMcontrol self;
self = (pHMcontrol)pData;
if(!self)
return;
if(self->pDes)
DeleteDescriptor(self->pDes);
if(self->pCount)
free(self->pCount);
free(self);
}
/*-----------------------------------------------------------------------*/
int MakeHMControl(SConnection *pCon, SicsInterp *pSics,
void *pData, int argc, char *argv[])
{
int i, status;
pHMcontrol pNew = NULL;
char pBueffel[132];
CommandList *pCom;
pICountable pCount;
/*
need at least two parameters
*/
if(argc < 3)
{
SCWrite(pCon,"ERROR: insufficient number of arguments to MakeHMControl",
eError);
return 0;
}
/*
allocate our data structure
*/
pNew = (pHMcontrol)malloc(sizeof(HMcontrol));
if(!pNew)
{
SCWrite(pCon,"ERROR: out of memory in MakeHMControl",eError);
return 0;
}
memset(pNew,0,sizeof(HMcontrol));
pNew->pDes = CreateDescriptor("HMcontrol");
pNew->pCount = CreateCountableInterface();
if(!pNew->pDes || ! pNew->pCount)
{
SCWrite(pCon,"ERROR: out of memory in MakeHMControl",eError);
KillHMcontrol(pNew);
return 0;
}
/*
assign interface functions
*/
pNew->pDes->GetInterface = HMCGetInterface;
pNew->pCount->Halt = HMCHalt;
pNew->pCount->StartCount = HMCStart;
pNew->pCount->CheckCountStatus = HMCStatus;
pNew->pCount->Pause = HMCPause;
pNew->pCount->Continue = HMCContinue;
pNew->pCount->TransferData = HMCTransfer;
pNew->pCount->SetCountParameters = HMCParameter;
/*
now loop through the remaining arguments, thereby entering them into
the slave list.
*/
for(i = 2; i < argc; i++)
{
pCom = FindCommand(pSics,argv[i]);
if(!pCom)
{
sprintf(pBueffel,"ERROR: object %s not found in MakeHMcontrol",
argv[i]);
SCWrite(pCon,pBueffel,eError);
continue;
}
pCount = GetCountableInterface(pCom->pData);
if(!pCount)
{
sprintf(pBueffel,"ERROR: object %s is NOT countable",
argv[i]);
SCWrite(pCon,pBueffel,eError);
continue;
}
pNew->slaves[pNew->nSlaves] = pCount;
pNew->slaveData[pNew->nSlaves] = pCom->pData;
pNew->nSlaves++;
}
/*
now install our action command and we are done
*/
status = AddCommand(pSics,argv[1],HMControlAction,KillHMcontrol,
pNew);
if(!status)
{
sprintf(pBueffel,"ERROR: duplicate command %s not created",argv[1]);
SCWrite(pCon,pBueffel,eError);
KillHMcontrol(pNew);
return 0;
}
return 1;
}
/*-----------------------------------------------------------------------
Syntax: whatever start preset mode
------------------------------------------------------------------------*/
int HMControlAction(SConnection *pCon, SicsInterp *pSics,
void *pData, int argc, char *argv[])
{
pHMcontrol self;
char pBueffel[132];
double dPreset;
CounterMode eMode;
int status;
/*
checks
*/
self = (pHMcontrol)pData;
assert(self);
if(argc < 4)
{
sprintf("ERROR: Usage %s start preset mode", argv[0]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
strtolower(argv[1]);
if(strcmp(argv[1],"start") == 0)
{
/*
interpret count parameters
*/
status = Tcl_GetDouble(pSics->pTcl,argv[2],&dPreset);
if(status != TCL_OK)
{
sprintf(pBueffel,"ERROR: failed to convert %s to number",
argv[2]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
strtolower(argv[3]);
if(strcmp(argv[3],"timer") == 0)
eMode = eTimer;
else if(strcmp(argv[3],"monitor") == 0)
eMode = ePreset;
else
{
sprintf(pBueffel,"ERROR: %s is no recognized count mode",argv[3]);
SCWrite(pCon,pBueffel,eError);
return 0;
}
/*
set count parameters and go
*/
self->pCount->SetCountParameters(self,(float)dPreset,eMode);
status = StartDevice(pServ->pExecutor,"hmcontrol",self->pDes,
self,pCon,99);
if(!status)
{
SCWrite(pCon,"ERROR: failed to start counting",eError);
return 0;
}
SCSendOK(pCon);
}
else
{
SCWrite(pCon,"ERROR: subcommand not recognized",eError);
return 0;
}
return 1;
}

45
hmcontrol.h Normal file
View File

@ -0,0 +1,45 @@
/*------------------------------------------------------------------------
H M C O N T R O L
A module for coordinating several counters and histogram
memories. One of the counters is the master counter and the rest are
slaves which have to be kept in sync with the master in their
operations.
copyright: see copyright.h
Mark Koennecke, June 2001
-------------------------------------------------------------------------*/
#ifndef HMCONTROL
#define HMCONTROL
/*
the maximum number of slaves
*/
#include "sics.h"
#include "counter.h"
#define MAXSLAVE 5
typedef struct {
pObjectDescriptor pDes;
pICountable pCount;
pICountable slaves[MAXSLAVE];
void *slaveData[MAXSLAVE];
int nSlaves;
float fPreset;
CounterMode eMode;
} HMcontrol, *pHMcontrol;
int MakeHMControl(SConnection *pCon, SicsInterp *pSics,
void *pData, int argc, char *argv[]);
int HMControlAction(SConnection *pCon, SicsInterp *pSics,
void *pData, int argc, char *argv[]);
#endif

73
hmcontrol.w Normal file
View File

@ -0,0 +1,73 @@
\subsection{HM control}
At TRICS (and possibly at other instruments) it it necessary to coordinate the
operation of the counter and one to many histogram memories. The
neutron counter will act as the actual controlling instance and the
histogram memories will act as slaves. This is implemented in this
module.
The modules data structure:
@d hmcontroldata @{
typedef struct {
pObjectDescriptor pDes;
pICountable pCount;
pICountable slaves[MAXSLAVE];
void *slaveData[MAXSLAVE];
int nSlaves;
float fPreset;
CounterMode eMode;
} HMcontrol, *pHMcontrol;
@}
The fields are:
\begin{description}
\item[pDes] The standard SICS object descriptor.
\item[pCount] The countable interface of this module.
\item[slaves] The slave counters or histogram memories.
\item[slaveData] is the data structure for the slave. The first slave
is always the neutron counter.
\item[nSlaves] The number of active slaves.
\item[fPreset] The counting preset.
\item[eMode] The counting mode.
\end{description}
Most of this modules functionality is built into the countable
interface functions. Just an interface to the interpreter is needed:
@d hmcontrolint @{
int MakeHMControl(SConnection *pCon, SicsInterp *pSics,
void *pData, int argc, char *argv[]);
int HMControlAction(SConnection *pCon, SicsInterp *pSics,
void *pData, int argc, char *argv[]);
@}
@o hmcontrol.h @{
/*------------------------------------------------------------------------
H M C O N T R O L
A module for coordinating several counters and histogram
memories. One of the counters is the master counter and the rest are
slaves which have to be kept in sync with the master in their
operations.
copyright: see copyright.h
Mark Koennecke, June 2001
-------------------------------------------------------------------------*/
#ifndef HMCONTROL
#define HMCONTROL
/*
the maximum number of slaves
*/
#include "sics.h"
#include "counter.h"
#define MAXSLAVE 5
@<hmcontroldata@>
@<hmcontrolint@>
#endif
@}

View File

@ -40,9 +40,8 @@
#include <stdlib.h>
#include <assert.h>
#include "fortify.h"
#include "conman.h"
#include "obdes.h"
#include "interface.h"
#include "sics.h"
/*-------------------------------------------------------------------------*/
pIDrivable CreateDrivableInterface(void)

View File

@ -1,5 +1,5 @@
#line 343 "interface.w"
#line 345 "interface.w"
/*---------------------------------------------------------------------------
I N T E R F A C E S
@ -44,7 +44,7 @@
pIDrivable GetDrivableInterface(void *pObject);
#line 368 "interface.w"
#line 370 "interface.w"
pIDrivable CreateDrivableInterface(void);
@ -56,6 +56,8 @@
typedef struct {
int ID;
int (*Halt)(void *self);
void (*SetCountParameters)(void *self, float fPreset,
CounterMode eMode);\
int (*StartCount)(void *self, SConnection *pCon);
int (*CheckCountStatus)(void *self, SConnection *pCon);
int (*Pause)(void *self, SConnection *pCon);
@ -66,23 +68,23 @@
pICountable GetCountableInterface(void *pObject);
#line 373 "interface.w"
#line 375 "interface.w"
pICountable CreateCountableInterface(void);
/* ------------------------- The CallBack Interface --------------------*/
#line 227 "interface.w"
#line 229 "interface.w"
typedef void (*KillFuncIT)(void *pData);
typedef int (*SICSCallBack)(int iEvent, void *pEventData,
void *pUserData);
#line 378 "interface.w"
#line 380 "interface.w"
#line 249 "interface.w"
#line 251 "interface.w"
typedef struct __ICallBack *pICallBack;
@ -97,11 +99,11 @@
int RemoveCallback(pICallBack pInterface, long iID);
int RemoveCallback2(pICallBack pInterface, void *pUserData);
#line 379 "interface.w"
#line 381 "interface.w"
/*---------------------- The Environment Interface --------------------*/
#line 307 "interface.w"
#line 309 "interface.w"
typedef enum { EVIdle, EVDrive, EVMonitor, EVError } EVMode;
typedef struct {
@ -111,13 +113,13 @@
int (*HandleError)(void *self);
} EVInterface, *pEVInterface;
#line 381 "interface.w"
#line 383 "interface.w"
#line 333 "interface.w"
#line 335 "interface.w"
pEVInterface CreateEVInterface(void);
#line 382 "interface.w"
#line 384 "interface.w"
#endif

View File

@ -207,6 +207,8 @@ $\langle$count {\footnotesize ?}$\rangle\equiv$
\mbox{}\verb@ typedef struct {@\\
\mbox{}\verb@ int ID;@\\
\mbox{}\verb@ int (*Halt)(void *self);@\\
\mbox{}\verb@ void (*SetCountParameters)(void *self, float fPreset,@\\
\mbox{}\verb@ CounterMode eMode);\@\\
\mbox{}\verb@ int (*StartCount)(void *self, SConnection *pCon);@\\
\mbox{}\verb@ int (*CheckCountStatus)(void *self, SConnection *pCon);@\\
\mbox{}\verb@ int (*Pause)(void *self, SConnection *pCon);@\\

View File

@ -177,6 +177,8 @@ This is an interface for interacting with anything which counts.
typedef struct {
int ID;
int (*Halt)(void *self);
void (*SetCountParameters)(void *self, float fPreset,
CounterMode eMode);\
int (*StartCount)(void *self, SConnection *pCon);
int (*CheckCountStatus)(void *self, SConnection *pCon);
int (*Pause)(void *self, SConnection *pCon);

4
itc4.c
View File

@ -41,10 +41,8 @@
#include <assert.h>
#include <tcl.h>
#include "fortify.h"
#include "conman.h"
#include "sics.h"
#include "splitter.h"
#include "obdes.h"
#include "interface.h"
#include "obpar.h"
#include "devexec.h"
#include "nserver.h"

View File

@ -47,15 +47,12 @@
#include <math.h>
#include <tcl.h>
#include "fortify.h"
#include "conman.h"
#include "SCinter.h"
#include "sics.h"
#include "devexec.h"
#include "motor.h"
#include "splitter.h"
#include "Scommon.h"
#include "status.h"
#include "servlog.h"
#include "event.h"
/*-------------------------------------------------------------------------
some lokal defines

View File

@ -50,10 +50,9 @@
#include <string.h>
#include <ctype.h>
#include "fortify.h"
#include "conman.h"
#include "sics.h"
#include "devexec.h"
#include "motor.h"
#include "obdes.h"
#include "splitter.h"
#include "stringdict.h"
#include "mumo.h"

41
napi.c
View File

@ -35,7 +35,7 @@
----------------------------------------------------------------------------*/
static const char* rscid = "$Id: napi.c,v 1.3 2000/09/11 09:17:44 cvs Exp $"; /* Revision interted by CVS */
static const char* rscid = "$Id: napi.c,v 1.4 2001/06/08 15:18:37 cvs Exp $"; /* Revision interted by CVS */
#include <stdlib.h>
#include <assert.h>
@ -507,7 +507,7 @@ static const char* rscid = "$Id: napi.c,v 1.3 2000/09/11 09:17:44 cvs Exp $"; /*
}
/* start Vgroup API */
pNew->iVID = Hopen (filename, am, 100);
pNew->iVID = Hopen (filename, am, 5000);
if (pNew->iVID <= 0) {
sprintf (pBuffer, "ERROR: cannot open file: %s", filename);
NXIReportError (NXpData, pBuffer);
@ -1050,6 +1050,43 @@ static const char* rscid = "$Id: napi.c,v 1.3 2000/09/11 09:17:44 cvs Exp $"; /*
return NX_OK;
}
NXstatus
NXsetdimname(NXhandle fid, int iDim, CONSTCHAR *name)
{
pNexusFile pFile;
int32 dim_id, iRet;
pFile = NXIassert (fid);
/* check if there is an SDS open */
if (pFile->iCurrentSDS == 0) {
NXIReportError (NXpData, "ERROR: no SDS open");
return NX_ERROR;
}
/*
get dimension ID
*/
dim_id = SDgetdimid(pFile->iCurrentSDS,iDim);
if(dim_id < 0){
NXIReportError(NXpData,
"ERROR: trying to set dimension name for non existent dimension");
return NX_ERROR;
}
/*
set name
*/
iRet = SDsetdimname(dim_id,name);
if(iRet < 0){
NXIReportError(NXpData,
"ERROR: failed to set dimension name");
return NX_ERROR;
}
return NX_OK;
}
NXstatus
NXputdata (NXhandle fid, void *data)

4
napi.h
View File

@ -33,7 +33,7 @@
For further information, see <http://www.neutron.anl.gov/NeXus/>
$Id: napi.h,v 1.2 2000/02/21 08:11:15 cvs Exp $
$Id: napi.h,v 1.3 2001/06/08 15:18:37 cvs Exp $
----------------------------------------------------------------------------*/
@ -241,6 +241,8 @@ extern "C" {
NXstatus NXclosegroup(NXhandle handle);
NXstatus NXmakedata (NXhandle handle, CONSTCHAR* label, int datatype, int rank, int dim[]);
NXstatus NXsetdimname(NXhandle handle, int iDim, CONSTCHAR *name);
NXstatus NXopendata (NXhandle handle, CONSTCHAR* label);
NXstatus NXcompress (NXhandle handle, int compr_type);
NXstatus NXclosedata(NXhandle handle);

View File

@ -320,7 +320,15 @@
"frametilt","DG1");
GetHistogram(self->pHistogram1,pCon,0,0,DET1X*DET1Y,lData,
DET1X*DET1Y*sizeof(HistInt));
/*
NXDputalias(hfil,self->pDict,"framecounts",lData);
*/
NXDopenalias(hfil,self->pDict,"framecounts");
NXputdata(hfil,lData);
NXsetdimname(hfil,0,"frame_x");
NXsetdimname(hfil,1,"frame_y");
NXclosedata(hfil);
fVal = fTTheta;
NXDputalias(hfil,self->pDict,"frame2theta",&fVal);
@ -340,7 +348,15 @@
"frametilt","DG2");
GetHistogram(self->pHistogram2,pCon,0,0,DET2X*DET2Y,lData,
DET2X*DET2Y*sizeof(HistInt));
/*
NXDputalias(hfil,self->pDict,"framecounts",lData);
*/
NXDopenalias(hfil,self->pDict,"framecounts");
NXputdata(hfil,lData);
NXsetdimname(hfil,0,"frame_x");
NXsetdimname(hfil,1,"frame_y");
NXclosedata(hfil);
fVal = fTTheta + self->hm2Off;
NXDputalias(hfil,self->pDict,"frame2theta",&fVal);
@ -360,7 +376,16 @@
"frametilt","DG3");
GetHistogram(self->pHistogram2,pCon,0,0,DET3X*DET3Y,lData,
DET3X*DET3Y*sizeof(HistInt));
/*
NXDputalias(hfil,self->pDict,"framecounts",lData);
*/
NXDopenalias(hfil,self->pDict,"framecounts");
NXputdata(hfil,lData);
NXsetdimname(hfil,0,"frame_x");
NXsetdimname(hfil,1,"frame_y");
NXclosedata(hfil);
fVal = fTTheta + self->hm3Off;
NXDputalias(hfil,self->pDict,"frame2theta",&fVal);
@ -1095,7 +1120,7 @@
if(self->pCurrentFile)
free(self->pCurrentFile);
iRet = IncrementDataNumber(self->pDanu,&iYear);
sprintf(pBueffel,"%s/trics%4.4d%4.4d.hdf",self->pFileRoot,iRet, iYear);
sprintf(pBueffel,"%s/trics%5.5d%4.4d.hdf",self->pFileRoot,iRet, iYear);
self->pCurrentFile = strdup(pBueffel);
iRet = NXopen(self->pCurrentFile,NXACC_CREATE,&hfil);
if(iRet != NX_OK)

View File

@ -21,20 +21,17 @@
#include <sys/types.h>
#include <unistd.h>
#include <time.h>
#include "conman.h"
#include "SCinter.h"
#include "sics.h"
#include "network.h"
#include "ifile.h"
#include "status.h"
#include "devexec.h"
#include "ofac.h"
#include "passwd.h"
#include "lld.h"
#include "macro.h"
#include "interface.h"
#include "perfmon.h"
#include "nread.h"
#include "event.h"
#include "ofac.h"
#include "telnet.h"
#include "nserver.h"

View File

@ -44,9 +44,7 @@
#include <math.h>
#include <time.h>
#include "fortify.h"
#include "conman.h"
#include "obdes.h"
#include "interface.h"
#include "sics.h"
#include "sicsvar.h"
#include "nxdict.h"
#include "modriv.h"

View File

@ -1167,6 +1167,14 @@
LLDdelete(iList);
return iRet;
}
/*
stop creation of superfluous dimension scales for single
numbers
*/
if(iRank == 1 && iDim[0] == 1)
{
NXsetdimname(hfil,0,"singleDim");
}
/* deal with compression, if appropriate */
if(iCompress != 0)
{

View File

@ -44,9 +44,7 @@
#include <assert.h>
#include <time.h>
#include "fortify.h"
#include "conman.h"
#include "obdes.h"
#include "interface.h"
#include "sics.h"
#include "sicsvar.h"
#include "napi.h"
#include "nxdict.h"

4
o2t.c
View File

@ -43,9 +43,7 @@
#include <stdlib.h>
#include <assert.h>
#include "fortify.h"
#include "conman.h"
#include "obdes.h"
#include "interface.h"
#include "sics.h"
#include "fupa.h"
#include "motor.h"
#include "o2t.h"

View File

@ -1,5 +1,5 @@
#line 339 "interface.w"
#line 341 "interface.w"
#line 29 "interface.w"
@ -51,5 +51,5 @@ typedef struct {
#endif
#line 340 "interface.w"
#line 342 "interface.w"

8
ofac.c
View File

@ -41,15 +41,12 @@
#include <stdlib.h>
#include <assert.h>
#include "fortify.h"
#include "sics.h"
#include "ifile.h"
#include "sicsexit.h"
#include "obdes.h"
#include "interface.h"
#include "passwd.h"
#include "conman.h"
#include "macro.h"
#include "splitter.h"
#include "SCinter.h"
#include "sicsvar.h"
#include "drive.h"
#include "motor.h"
@ -106,6 +103,7 @@
#include "synchronize.h"
#include "definealias.h"
#include "swmotor.h"
#include "hmcontrol.h"
/*----------------------- Server options creation -------------------------*/
static int IFServerOption(SConnection *pCon, SicsInterp *pSics, void *pData,
int argc, char *argv[])
@ -284,6 +282,7 @@
AddCommand(pInter,"MakeTAS",TASFactory,NULL,NULL);
AddCommand(pInter,"MakeSync",MakeSync,NULL,NULL);
AddCommand(pInter,"MakeSWMotor",MakeSWMotor,NULL,NULL);
AddCommand(pInter,"MakeHMControl",MakeHMControl,NULL,NULL);
}
/*---------------------------------------------------------------------------*/
static void KillIniCommands(SicsInterp *pSics)
@ -339,6 +338,7 @@
RemoveCommand(pSics,"MakeTAS");
RemoveCommand(pSics,"MakeSync");
RemoveCommand(pSics,"MakeSWMotor");
RemoveCommand(pSics,"MakeHMControl");
}

View File

@ -40,11 +40,7 @@
#include <assert.h>
#include <time.h>
#include "fortify.h"
#include "conman.h"
#include "SCinter.h"
#include "obdes.h"
#include "interface.h"
#include "event.h"
#include "sics.h"
#include "servlog.h"
#include "perfmon.h"
#include "perfmon.i"

4
scan.c
View File

@ -371,7 +371,7 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
strcat(pInfo,pItem);
}
}
strcat(pLine,"Counts ");
strcat(pLine," Counts ");
strcat(pLine,"Monitor1 ");
strcat(pLine,"Monitor2 ");
strcat(pLine,"Monitor3 ");
@ -411,7 +411,7 @@ extern void SNXFormatTime(char *pBuffer, int iLen);
pData = (pCountEntry)pPtr;
if(pData)
{
sprintf(pItem,"%-12ld",pData->lCount);
sprintf(pItem," %-12ld",pData->lCount);
strcat(pLine,pItem);
sprintf(pItem,"%-12ld",pData->Monitors[0]);
strcat(pLine,pItem);

View File

@ -45,8 +45,7 @@
#include <math.h>
#include <tcl.h>
#include "fortify.h"
#include "conman.h"
#include "obdes.h"
#include "sics.h"
#include "fupa.h"
#include "motor.h"
#include "countdriv.h"

View File

@ -44,11 +44,7 @@
#include <string.h>
#include <math.h>
#include "fortify.h"
#include "conman.h"
#include "SCinter.h"
#include "Scommon.h"
#include "obdes.h"
#include "interface.h"
#include "sics.h"
#include "motor.h"
#include "splitter.h"
#include "devexec.h"

View File

@ -44,17 +44,12 @@
#include <tcl.h>
#include <math.h>
#include "fortify.h"
#include "conman.h"
#include "SCinter.h"
#include "Scommon.h"
#include "obdes.h"
#include "sics.h"
#include "motor.h"
#include "splitter.h"
#include "devexec.h"
#include "selector.h"
#include "selvar.h"
#include "interface.h"
#include "event.h"
#define DRIVE "drive"
#include "selvar.i"

7
sics.h
View File

@ -9,6 +9,12 @@
-----------------------------------------------------------------------------*/
#ifndef SICSSICS
#define SICSSICS
typedef enum {
eTimer,
ePreset
}CounterMode;
#include <stdlib.h>
#include <string.h>
#include <assert.h>
@ -25,5 +31,6 @@
#include "servlog.h"
extern pServer pServ;
#endif

View File

@ -1,30 +1,9 @@
a5l.length 80.000000
flightpathlength 0.000000
flightpathlength setAccess 1
flightpath 0.000000
flightpath setAccess 1
delay 2500.000000
delay setAccess 1
hm CountMode timer
hm preset 100.000000
hm genbin 120.000000 35.000000 512
hm init
datafile focus-1001848.hdf
datafile setAccess 3
hm3 CountMode timer
hm3 preset 50.000000
hm2 CountMode timer
hm2 preset 100.000000
hm2 preset 50.000000
hm1 CountMode timer
hm1 preset 100.000000
dbfile UNKNOWN
dbfile setAccess 2
# Motor th
th SoftZero 0.000000
th SoftLowerLim -120.000000
th SoftUpperLim 120.000000
th Fixed -1.000000
th sign 1.000000
th InterruptMode 0.000000
th AccessCode 2.000000
hm1 preset 50.000000
#Crystallographic Settings
hkl lambda 0.703790
hkl setub -0.124702 0.001618 -0.041357 -0.104448 -0.001326 0.049388 0.000751 0.084094 0.001574
@ -148,8 +127,6 @@ twotheta InterruptMode 0.000000
twotheta AccessCode 2.000000
lastscancommand UNKNOWN
lastscancommand setAccess 2
banana CountMode timer
banana preset 2.000000
sample_mur 0.000000
sample_mur setAccess 2
email UNKNOWN
@ -161,7 +138,7 @@ phone setAccess 2
adress UNKNOWN
adress setAccess 2
# Counter counter
counter SetPreset 10.000000
counter SetPreset 50.000000
counter SetMode Timer
# Motor som
som SoftZero 0.000000
@ -433,5 +410,5 @@ sample DanielOxid
sample setAccess 2
title TopsiTupsiTapsi
title setAccess 2
starttime 2001-03-12 14:55:05
starttime 2001-06-06 14:23:05
starttime setAccess 2

View File

@ -39,14 +39,10 @@
#include "fortify.h"
#include <stdlib.h>
#include <assert.h>
#include "Scommon.h"
#include "sics.h"
#include <string.h>
#include "SCinter.h"
#include "conman.h"
#include "splitter.h"
#include "status.h"
#include "interface.h"
#include "event.h"
#include "sicsvar.h"
/*-------------------------------------------------------------------------*/

View File

@ -44,7 +44,7 @@
#include <time.h>
#include "fortify.h"
#include <string.h>
#include "Scommon.h"
#include "sics.h"
#include "countdriv.h"
/*---------------------------------------------------------------------------
A SIMCOUNTER HAS a BUILT IN FAILURE RATE OF 10% FOR TESTING ERROR HANDLING

View File

@ -23,7 +23,7 @@
#define MAX_CLIENTS 8 /* The maximum number of active clients */
#define MAX_TOF_CNTR 1024 /* The maximum number of individual counters ..
** which can be handled in TOF mode */
#define MAX_PSD_CNTR 65536 /* maximum number of PSD elements */
#define MAX_PSD_CNTR 1048576 /* maximum number of PSD elements */
#define MAX_TOF_NBINS 32768 /* The maximum number of bins in a TOF histog */
#define MAX_TOF_EDGE 16 /* The maximum number of TOF edge arrays */
#define VMIO_BASE_ADDR 0x1900 /* VME address of a (possible) VMIO10 module */

View File

@ -169,6 +169,7 @@
}else if ((lwl_hdr.ui4 & LWL_HDR_TYPE_MASK) == LWL_HM_NC_C1) {
VmioBase[VMIO_PORT_A] = 0xff; /* Set timer level (if present) */
for (i=0; i<1000000; i++) {
lwl_data.ui4 = *Lwl_fifo; /* Get the 16 bits of data */
if (lwl_data.ui4 != LWL_FIFO_EMPTY) {
@ -255,7 +256,6 @@
*/
}else { /* Anything else gets flushed */
lwl_Packet_Read (lwl_hdr.ui4, my_buff);
}
/* if (FillTimer_expired) { */
@ -809,8 +809,8 @@
if(yPos >= 32767)
yPos -= 65536;
xPos = (xPos + psdXOffset)/psdXFactor;
yPos = (yPos + psdYOffset)/psdYFactor;
xPos = xPos/psdXFactor + psdXOffset;
yPos = yPos/psdYFactor + psdYOffset;
if(xPos < 0 || xPos > psdXSize)
{
printf("X position out of range: %d, alllowed 0 - %d\n",

View File

@ -44,10 +44,7 @@
#include <assert.h>
#include <math.h>
#include "fortify.h"
#include "conman.h"
#include "SCinter.h"
#include "obdes.h"
#include "interface.h"
#include "sics.h"
#include "countdriv.h"
#include "counter.h"
#include "HistMem.h"

View File

@ -41,11 +41,10 @@
#include <assert.h>
#include "fortify.h"
#include <string.h>
#include "conman.h"
#include "sics.h"
#include "status.h"
#include "interrupt.h"
#include "devexec.h"
#include "interface.h"
#define VALUECHANGE 2
static Status eCode = eEager;

View File

@ -43,10 +43,8 @@
#include <sys/time.h>
#include <tcl.h>
#include "fortify.h"
#include "conman.h"
#include "sics.h"
#include "splitter.h"
#include "obdes.h"
#include "interface.h"
#include "obpar.h"
#include "devexec.h"
#include "nserver.h"

View File

@ -72,7 +72,7 @@ frametilt = /$(framename),NXentry/TRICS,NXinstrument/$(dnumber),NXdetector/SDS
-attr {units,degrees}
framecounts = /$(framename),NXentry/TRICS,NXinstrument/$(dnumber),NXdetector/SDS counts \
-attr {signal,1} -attr {units,counts} -type DFNT_INT32 \
-LZW -rank 2 -dim {$(framedim1),$(framedim2)}
-rank 2 -dim {$(framedim1),$(framedim2)}
detzerox = \
/frame0000,NXentry/TRICS,NXinstrument/$(dnumber),NXdetector/SDS x_zero_point \
-attr {units,pixel}