- Enhanced and debugged histogram memory for AMOR
* added PROJECT both in HM and driver code * added single detector support. - Removed several bugs in the AMOR data bit. - Updated documentation
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
|
||||
#line 469 "histogram.w"
|
||||
#line 477 "histogram.w"
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
H I S T D R I V
|
||||
@ -77,7 +77,7 @@
|
||||
void *pPriv;
|
||||
} HistDriver;
|
||||
|
||||
#line 481 "histogram.w"
|
||||
#line 489 "histogram.w"
|
||||
|
||||
|
||||
#line 239 "histogram.w"
|
||||
@ -87,7 +87,7 @@
|
||||
int HistDriverConfig(pHistDriver self, pStringDict pOpt,
|
||||
SConnection *pCon);
|
||||
|
||||
#line 482 "histogram.w"
|
||||
#line 490 "histogram.w"
|
||||
|
||||
|
||||
#endif
|
||||
|
11
HistMem.h
11
HistMem.h
@ -1,5 +1,5 @@
|
||||
|
||||
#line 442 "histogram.w"
|
||||
#line 450 "histogram.w"
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
H I S T M E M
|
||||
@ -41,7 +41,7 @@
|
||||
eReflect
|
||||
} OverFlowMode;
|
||||
|
||||
#line 462 "histogram.w"
|
||||
#line 470 "histogram.w"
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
@ -78,9 +78,12 @@
|
||||
int GetHistogram(pHistMem self, SConnection *pCon,
|
||||
int i,int iStart, int iEnd, HistInt *lData, int iDataLen);
|
||||
HistInt *GetHistogramPointer(pHistMem self,SConnection *pCon);
|
||||
int GetHistogramDirect(pHistMem self, SConnection *pCon,
|
||||
int i, int iStart, int iEnd,
|
||||
HistInt *lData, int iDataLen);
|
||||
int PresetHistogram(pHistMem self, SConnection *pCon, HistInt lVal);
|
||||
|
||||
#line 411 "histogram.w"
|
||||
#line 419 "histogram.w"
|
||||
|
||||
int MakeHistMemory(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[]);
|
||||
@ -89,7 +92,7 @@
|
||||
int argc, char *argv[]);
|
||||
|
||||
|
||||
#line 464 "histogram.w"
|
||||
#line 472 "histogram.w"
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#line 487 "histogram.w"
|
||||
#line 495 "histogram.w"
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
H I S T M E M -- Internal
|
||||
@ -29,7 +29,7 @@
|
||||
int iUpdateIntervall;
|
||||
} HistMem;
|
||||
|
||||
#line 497 "histogram.w"
|
||||
#line 505 "histogram.w"
|
||||
|
||||
|
||||
#endif
|
||||
|
34
SCinter.c
34
SCinter.c
@ -37,6 +37,8 @@
|
||||
MODIFICATIONS.
|
||||
|
||||
M. Zolliker, Sept 2000, introduced formal aliases, modifications marked M.Z
|
||||
Mark Koennecke, August 2001, modified SicsWriteStatus to write motor
|
||||
positions on demand.
|
||||
---------------------------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -45,12 +47,8 @@
|
||||
#include <string.h>
|
||||
#include <tcl.h>
|
||||
#include "fortify.h"
|
||||
#include "conman.h"
|
||||
#include "sics.h"
|
||||
#include "splitter.h"
|
||||
#include "Scommon.h"
|
||||
#include "SCinter.h"
|
||||
#include "obdes.h"
|
||||
#include "devexec.h"
|
||||
#include "servlog.h"
|
||||
#include "macro.h"
|
||||
/* M.Z. */
|
||||
@ -311,11 +309,14 @@ extern char *SkipSpace(char *pPtr);
|
||||
return NULL;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
int WriteSicsStatus(SicsInterp *self, char *file)
|
||||
int WriteSicsStatus(SicsInterp *self, char *file, int iMot)
|
||||
{
|
||||
CommandList *pCurrent = NULL;
|
||||
FILE *fd = NULL;
|
||||
Dummy *pDum = NULL;
|
||||
float fVal;
|
||||
pIDrivable pDriv = NULL;
|
||||
void *pTest = NULL;
|
||||
|
||||
assert(self);
|
||||
assert(file);
|
||||
@ -346,9 +347,30 @@ extern char *SkipSpace(char *pPtr);
|
||||
if(pDum)
|
||||
{
|
||||
pDum->pDescriptor->SaveStatus(pCurrent->pData,pCurrent->pName,fd);
|
||||
if(iMot)
|
||||
{
|
||||
/*
|
||||
save values of motors but not of environment devices as they
|
||||
may not be present the next time round
|
||||
*/
|
||||
pDriv = pDum->pDescriptor->GetInterface(pDum,DRIVEID);
|
||||
pTest = pDum->pDescriptor->GetInterface(pDum,ENVIRINTERFACE);
|
||||
if(pDriv && !pTest)
|
||||
{
|
||||
fVal = pDriv->GetValue(pDum,pServ->dummyCon);
|
||||
if(fVal > -990.)
|
||||
{
|
||||
fprintf(fd,"run %s %f\n",pCurrent->pName, fVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pCurrent = pCurrent->pNext;
|
||||
}
|
||||
if(iMot)
|
||||
{
|
||||
fprintf(fd,"Success \n");
|
||||
}
|
||||
fclose(fd);
|
||||
return 1;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ typedef struct __SINTER
|
||||
with name. Returns ist datastructure if found, NULL else
|
||||
*/
|
||||
/*-------------------------------------------------------------------------*/
|
||||
int WriteSicsStatus(SicsInterp *pSics,char *file);
|
||||
int WriteSicsStatus(SicsInterp *pSics,char *file, int iMot);
|
||||
/*
|
||||
SICS needs a way to save the status of each object into a file.
|
||||
This is done by invoking for each object the object descriptor
|
||||
@ -95,6 +95,7 @@ typedef struct __SINTER
|
||||
Parameters:
|
||||
pSics : the interpreter to use.
|
||||
file : the file to write the information to.
|
||||
iMot : flag if motor position shall be saved or not
|
||||
Returns: 1 on success, 0 on failure.
|
||||
---------------------------------------------------------------------------*/
|
||||
int InterpWrite(SicsInterp *pSics, char *buffer);
|
||||
|
55
amor.dic
55
amor.dic
@ -11,8 +11,9 @@
|
||||
# AMOR may have variable time binning. In order
|
||||
# to cope with that, we use NXDICT's text replacement feature and define
|
||||
# these things
|
||||
timebin = 512
|
||||
detsize = 255
|
||||
timebin=512
|
||||
detxsize=255
|
||||
detysize=255
|
||||
scanlength = 10
|
||||
#---------- NXentry level
|
||||
etitle=/entry1,NXentry/SDS title -type DFNT_CHAR -rank 1 -dim {132}
|
||||
@ -89,6 +90,8 @@ d3dist=/entry1,NXentry/reflectometer,NXinstrument/diaphragm3,NXfilter/SDS distan
|
||||
#---------------- sample table
|
||||
saname=/entry1,NXentry/sample,NXsample/SDS name \
|
||||
-type DFNT_CHAR -rank 1 -dim {132}
|
||||
baseheight=/entry1,NXentry/sample,NXsample/SDS base_height \
|
||||
-attr {units,mm}
|
||||
somheight=/entry1,NXentry/sample,NXsample/SDS omega_height \
|
||||
-attr {units,mm}
|
||||
schi=/entry1,NXentry/sample,NXsample/SDS chi \
|
||||
@ -108,13 +111,19 @@ d4t=/entry1,NXentry/reflectometer,NXinstrument/diaphragm4,NXfilter/SDS top \
|
||||
-attr {units,mm}
|
||||
d4b=/entry1,NXentry/reflectometer,NXinstrument/diaphragm4,NXfilter/SDS bottom \
|
||||
-attr {units,mm}
|
||||
d4dist=/entry1,NXentry/reflectometer,NXinstrument/diaphragm4,NXfilter/SDS distance \
|
||||
-attr {units,mm}
|
||||
d4dist=/entry1,NXentry/reflectometer,NXinstrument/diaphragm4,NXfilter/SDS \
|
||||
distance_to_sample -attr {units,mm}
|
||||
d4base =/entry1,NXentry/reflectometer,NXinstrument/diaphragm4,NXfilter/SDS \
|
||||
base_height -attr {units,mm}
|
||||
#------------ analyzer
|
||||
anname=/entry1,NXentry/reflectometer,NXinstrument/polarizer,NXfilter/SDS name \
|
||||
-type DFNT_CHAR -rank 1 -dim {132}
|
||||
anoz=/entry1,NXentry/reflectometer,NXinstrument/analyzer,NXfilter/SDS omega_height \
|
||||
-attr {units,mm}
|
||||
abase=/entry1,NXentry/reflectometer,NXinstrument/analyzer,NXfilter/SDS base_height \
|
||||
-attr {units,mm}
|
||||
adis=/entry1,NXentry/reflectometer,NXinstrument/analyzer,NXfilter/SDS \
|
||||
distance_to_sample -attr {units,mm}
|
||||
anom=/entry1,NXentry/reflectometer,NXinstrument/analyzer,NXfilter/SDS omega \
|
||||
-attr {units,degree}
|
||||
antz=/entry1,NXentry/reflectometer,NXinstrument/analyzer,NXfilter/SDS height \
|
||||
@ -130,8 +139,10 @@ d5t=/entry1,NXentry/reflectometer,NXinstrument/diaphragm5,NXfilter/SDS top \
|
||||
-attr {units,mm}
|
||||
d5b=/entry1,NXentry/reflectometer,NXinstrument/diaphragm5,NXfilter/SDS bottom \
|
||||
-attr {units,mm}
|
||||
d5dist=/entry1,NXentry/reflectometer,NXinstrument/diaphragm5,NXfilter/SDS distance \
|
||||
-attr {units,mm}
|
||||
d5dist=/entry1,NXentry/reflectometer,NXinstrument/diaphragm5,NXfilter/SDS \
|
||||
distance_to_sample -attr {units,mm}
|
||||
d5base =/entry1,NXentry/reflectometer,NXinstrument/diaphragm5,NXfilter/SDS \
|
||||
base_height -attr {units,mm}
|
||||
#---------- count control
|
||||
cnmode=/entry1,NXentry/reflectometer,NXinstrument/counter,NXmonitor/SDS count_mode \
|
||||
-type DFNT_CHAR -rank 1 -dim {30}
|
||||
@ -147,13 +158,13 @@ cnmon2=/entry1,NXentry/reflectometer,NXinstrument/counter,NXmonitor/SDS monitor2
|
||||
dettype=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS type \
|
||||
-type DFNT_CHAR -rank 1 -dim {132}
|
||||
dety=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS y_detector \
|
||||
-type DFNT_FLOAT32 -rank 1 -dim {$(detsize)} -attr {axis,1} \
|
||||
-type DFNT_FLOAT32 -rank 1 -dim {$(detysize)} -attr {axis,1} \
|
||||
-attr {units,mm}
|
||||
detxx=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS x_detector \
|
||||
-type DFNT_FLOAT32 -rank 1 -dim {$(detsize)} -attr {axis,2} \
|
||||
-type DFNT_FLOAT32 -rank 1 -dim {$(detxsize)} -attr {axis,2} \
|
||||
-attr {units,mm}
|
||||
detz=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS z \
|
||||
-type DFNT_FLOAT32 -rank 1 -dim {$(detsize)} -attr {axis,2} \
|
||||
-type DFNT_FLOAT32 -rank 1 -dim {$(detxsize)} -attr {axis,2} \
|
||||
-attr {units,mm}
|
||||
detx=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS x \
|
||||
-type DFNT_FLOAT32 -attr {units,mm}
|
||||
@ -161,17 +172,32 @@ detom=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS omega \
|
||||
-type DFNT_FLOAT32 -attr {units,degree}
|
||||
detheight=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS height \
|
||||
-type DFNT_FLOAT32 -attr {units,mm}
|
||||
detdist=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS distance \
|
||||
-type DFNT_FLOAT32 -attr {units,mm}
|
||||
detdist=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS \
|
||||
distance_to_sample -type DFNT_FLOAT32 -attr {units,mm}
|
||||
detbase=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS \
|
||||
base_height -type DFNT_FLOAT32 -attr {units,mm}
|
||||
dettime=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS time_binning \
|
||||
-type DFNT_FLOAT32 -rank 1 -dim {$(timebin)} -attr {axis,3} \
|
||||
-attr {units,ms}
|
||||
spinup=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS spinup \
|
||||
-type DFNT_INT32 -rank 3 -dim {$(detsize),$(detsize),$(timebin)} \
|
||||
-attr {signal,1}
|
||||
-type DFNT_INT32 -rank 3 -dim {$(detxsize),$(detysize),$(timebin)} \
|
||||
-LZW -attr {signal,1}
|
||||
spinup2d=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS spinup \
|
||||
-type DFNT_INT32 -rank 2 -dim {$(detxsize),$(detysize)} \
|
||||
-LZW -attr {signal,1}
|
||||
spindown=/entry1,NXentry/reflectometer,NXinstrument/TOF,NXdetector/SDS spindown \
|
||||
-type DFNT_INT32 -rank 3 -dim {$(detsize),$(detsize),$(timebin)} \
|
||||
-type DFNT_INT32 -rank 3 -dim {$(detxsize),$(detysize),$(timebin)} \
|
||||
-LZW -attr {signal,1}
|
||||
#------------ single detectors TOF -------------------------------------
|
||||
singleup=/entry1,NXentry/reflectometer,NXinstrument/single,NXdetector/SDS \
|
||||
spinup -type DFNT_INT32 -rank 2 -dim {2, $(timebin)} -LZW \
|
||||
-attr {signal,1}
|
||||
singledown=/entry1,NXentry/reflectometer,NXinstrument/single,NXdetector/SDS \
|
||||
spinup -type DFNT_INT32 -rank 2 -dim {2, $(timebin)} -LZW \
|
||||
-attr {signal,1}
|
||||
singletime=/entry1,NXentry/reflectometer,NXinstrument/single,NXdetector/SDS \
|
||||
time_binning -type DFNT_FLOAT32 -rank 1 -dim {$(timebin)} \
|
||||
-attr {axis,2}
|
||||
#------------ detector: scan mode
|
||||
scanroot=/entry1,NXentry/reflectometer,NXinstrument/scan,NXdetector/SDS
|
||||
sdetx=/entry1,NXentry/reflectometer,NXinstrument/scan,NXdetector/SDS x \
|
||||
@ -206,5 +232,6 @@ sdetdist=/entry1,NXentry/reflectometer,NXinstrument/scan,NXdetector/SDS distance
|
||||
-type DFNT_FLOAT32 -attr {units,mm}
|
||||
#------------------- data vGroup
|
||||
dana=/entry1,NXentry/TOF,NXdata/NXVGROUP
|
||||
singledana=/entry1,NXentry/single,NXdata/NXVGROUP
|
||||
sdana=/entry1,NXentry/scan,NXdata/NXVGROUP
|
||||
|
||||
|
26
amor2t.c
26
amor2t.c
@ -67,32 +67,6 @@
|
||||
/* detector 2 movement */
|
||||
#define MOTC3Z 11
|
||||
|
||||
/* distance detector sample */
|
||||
#define PARDS 0
|
||||
/* constant height of sample: height = PARDH + MOTSOZ + MOTSTZ */
|
||||
#define PARDH 1
|
||||
/* distance diaphragm 4 - sample */
|
||||
#define PARDD4 2
|
||||
/* distance to diaphragm 5 */
|
||||
#define PARDD5 3
|
||||
/* interrupt to issue when a motor fails on this */
|
||||
#define PARINT 4
|
||||
/* base height of counter station */
|
||||
#define PARDDH 5
|
||||
/* height of D4 */
|
||||
#define PARD4H 6
|
||||
/* height of D5 */
|
||||
#define PARD5H 7
|
||||
/* base height of analyzer */
|
||||
#define PARANA 8
|
||||
/* distance of analyzer from sample */
|
||||
#define PARADIS 9
|
||||
/* flag analyzer calculation on/off */
|
||||
#define ANAFLAG 10
|
||||
/* constant for second detector */
|
||||
#define PARDDD 11
|
||||
/* constant part of AOM */
|
||||
#define PARAOM 12
|
||||
|
||||
/*======================================================================
|
||||
The core of it all: The calculation of the settings for the various
|
||||
|
28
amor2t.i
28
amor2t.i
@ -7,6 +7,34 @@
|
||||
Mark Koennecke, September 1999
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/* distance detector sample */
|
||||
#define PARDS 0
|
||||
/* constant height of sample: height = PARDH + MOTSOZ + MOTSTZ */
|
||||
#define PARDH 1
|
||||
/* distance diaphragm 4 - sample */
|
||||
#define PARDD4 2
|
||||
/* distance to diaphragm 5 */
|
||||
#define PARDD5 3
|
||||
/* interrupt to issue when a motor fails on this */
|
||||
#define PARINT 4
|
||||
/* base height of counter station */
|
||||
#define PARDDH 5
|
||||
/* height of D4 */
|
||||
#define PARD4H 6
|
||||
/* height of D5 */
|
||||
#define PARD5H 7
|
||||
/* base height of analyzer */
|
||||
#define PARANA 8
|
||||
/* distance of analyzer from sample */
|
||||
#define PARADIS 9
|
||||
/* flag analyzer calculation on/off */
|
||||
#define ANAFLAG 10
|
||||
/* constant for second detector */
|
||||
#define PARDDD 11
|
||||
/* constant part of AOM */
|
||||
#define PARAOM 12
|
||||
|
||||
|
||||
typedef struct {
|
||||
pMotor pMot;
|
||||
char pName[80];
|
||||
|
32
amor2t.tex
32
amor2t.tex
@ -10,7 +10,7 @@ This object implements this complex movement as a virtual motor.
|
||||
|
||||
The following formulas are used for the necessary calculations:
|
||||
\begin{eqnarray}
|
||||
delta height & = & h_{s} - R \sin \alpha \\
|
||||
delta height & = & h_{s} - \sin \alpha \\
|
||||
delta x & = & |x_{c} - x_{s}| - R \cos \alpha \\
|
||||
omega & = & -2 MOM + 2 SOM \\
|
||||
\end{eqnarray}
|
||||
@ -18,7 +18,7 @@ with
|
||||
\begin{eqnarray}
|
||||
h_{s} & = & \tan(2MOM)|x_{c} - x_{s}| \\
|
||||
R & = & \sqrt{hs^{2} - |x_{c} - x_{s}|^{2}} \\
|
||||
\alpha & = & 180 -90 - \beta - 2SOM \\
|
||||
\alpha & = & ATT - 2SOM \\
|
||||
\beta & = & 180 - 90 - 2MOM \\
|
||||
MOM & = & polarizer \omega \\
|
||||
SOM & = & sample \omega \\
|
||||
@ -141,6 +141,34 @@ $\langle$amorinterface {\footnotesize ?}$\rangle\equiv$
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@ Mark Koennecke, September 1999@\\
|
||||
\mbox{}\verb@----------------------------------------------------------------------------*/@\\
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@/* distance detector sample */@\\
|
||||
\mbox{}\verb@#define PARDS 0@\\
|
||||
\mbox{}\verb@/* constant height of sample: height = PARDH + MOTSOZ + MOTSTZ */@\\
|
||||
\mbox{}\verb@#define PARDH 1@\\
|
||||
\mbox{}\verb@/* distance diaphragm 4 - sample */@\\
|
||||
\mbox{}\verb@#define PARDD4 2@\\
|
||||
\mbox{}\verb@/* distance to diaphragm 5 */@\\
|
||||
\mbox{}\verb@#define PARDD5 3@\\
|
||||
\mbox{}\verb@/* interrupt to issue when a motor fails on this */@\\
|
||||
\mbox{}\verb@#define PARINT 4@\\
|
||||
\mbox{}\verb@/* base height of counter station */@\\
|
||||
\mbox{}\verb@#define PARDDH 5@\\
|
||||
\mbox{}\verb@/* height of D4 */@\\
|
||||
\mbox{}\verb@#define PARD4H 6@\\
|
||||
\mbox{}\verb@/* height of D5 */@\\
|
||||
\mbox{}\verb@#define PARD5H 7@\\
|
||||
\mbox{}\verb@/* base height of analyzer */@\\
|
||||
\mbox{}\verb@#define PARANA 8@\\
|
||||
\mbox{}\verb@/* distance of analyzer from sample */@\\
|
||||
\mbox{}\verb@#define PARADIS 9@\\
|
||||
\mbox{}\verb@/* flag analyzer calculation on/off */@\\
|
||||
\mbox{}\verb@#define ANAFLAG 10@\\
|
||||
\mbox{}\verb@/* constant for second detector */@\\
|
||||
\mbox{}\verb@#define PARDDD 11@\\
|
||||
\mbox{}\verb@/* constant part of AOM */@\\
|
||||
\mbox{}\verb@#define PARAOM 12@\\
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@@$\langle$putput {\footnotesize ?}$\rangle$\verb@@\\
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@@$\langle$amoredata {\footnotesize ?}$\rangle$\verb@@\\
|
||||
|
28
amor2t.w
28
amor2t.w
@ -98,6 +98,34 @@ functions for interacting with the interpreter.
|
||||
|
||||
Mark Koennecke, September 1999
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
/* distance detector sample */
|
||||
#define PARDS 0
|
||||
/* constant height of sample: height = PARDH + MOTSOZ + MOTSTZ */
|
||||
#define PARDH 1
|
||||
/* distance diaphragm 4 - sample */
|
||||
#define PARDD4 2
|
||||
/* distance to diaphragm 5 */
|
||||
#define PARDD5 3
|
||||
/* interrupt to issue when a motor fails on this */
|
||||
#define PARINT 4
|
||||
/* base height of counter station */
|
||||
#define PARDDH 5
|
||||
/* height of D4 */
|
||||
#define PARD4H 6
|
||||
/* height of D5 */
|
||||
#define PARD5H 7
|
||||
/* base height of analyzer */
|
||||
#define PARANA 8
|
||||
/* distance of analyzer from sample */
|
||||
#define PARADIS 9
|
||||
/* flag analyzer calculation on/off */
|
||||
#define ANAFLAG 10
|
||||
/* constant for second detector */
|
||||
#define PARDDD 11
|
||||
/* constant part of AOM */
|
||||
#define PARAOM 12
|
||||
|
||||
@<putput@>
|
||||
|
||||
@<amoredata@>
|
||||
|
132
amorstat.c
132
amorstat.c
@ -8,6 +8,13 @@
|
||||
copyright: see copyright.h
|
||||
|
||||
Mark Koennecke, September 1999
|
||||
|
||||
As AMOR's histogram memory becomes too big in tof mode to transfer it
|
||||
for status information the collapse and subsample functionalities have
|
||||
been moved to the histogram memory. This code had to be modified to
|
||||
call SINQHMProject directly.
|
||||
|
||||
Mark Koennecke, August 2001
|
||||
--------------------------------------------------------------------------*/
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
@ -16,7 +23,12 @@
|
||||
#include "fortify.h"
|
||||
#include "sics.h"
|
||||
#include "counter.h"
|
||||
#include "stringdict.h"
|
||||
#include "HistMem.h"
|
||||
#include "HistMem.i"
|
||||
#include "HistDriv.i"
|
||||
#include "hardsup/sinqhm.h"
|
||||
#include "sinqhmdriv.i"
|
||||
#include "scan.h"
|
||||
#include "lld.h"
|
||||
#include "amorstat.i"
|
||||
@ -483,22 +495,18 @@
|
||||
static int Collapse(pAmorStat self, SConnection *pCon)
|
||||
{
|
||||
HistInt *lData = NULL;
|
||||
int i, i2, i3, iDim[MAXDIM], iIdx, iSum;
|
||||
int i, i2, i3, iDim[MAXDIM], iIdx, iSum, status, length;
|
||||
int *iImage = NULL, *iPtr;
|
||||
pSINQHM pHist;
|
||||
SinqHMDriv *pTata;
|
||||
|
||||
/* get size of our problem */
|
||||
GetHistDim(self->pHM,iDim,&i3);
|
||||
assert(i3 == 3);
|
||||
|
||||
/* get data */
|
||||
lData = GetHistogramPointer(self->pHM,pCon);
|
||||
if(!lData)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* allocate some data */
|
||||
iImage = (int *)malloc((2 + iDim[0]*iDim[1])*sizeof(int));
|
||||
length = 2 + iDim[0]*iDim[1];
|
||||
iImage = (int *)malloc(length*sizeof(int));
|
||||
if(iImage == NULL)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: failed to allocate memory in Collapse",eError);
|
||||
@ -510,19 +518,45 @@
|
||||
iImage[0] = htonl(iDim[0]);
|
||||
iImage[1] = htonl(iDim[1]);
|
||||
|
||||
/* loop the loop */
|
||||
|
||||
if(isSINQHMDriv(self->pHM->pDriv))
|
||||
{
|
||||
/*
|
||||
send a Project request to the histogram memory
|
||||
*/
|
||||
pTata = (SinqHMDriv *)self->pHM->pDriv->pPriv;
|
||||
pHist = (pSINQHM)pTata->pMaster;
|
||||
/*
|
||||
The 3 in the following call has to be identical to
|
||||
PROJECT__COLL in sinqhm_def.h
|
||||
*/
|
||||
status = SINQHMProject(pHist, 3, 0, iDim[0],
|
||||
0, iDim[1], iImage+2, (length-2)*sizeof(int));
|
||||
/*
|
||||
Byte swapping
|
||||
*/
|
||||
for(i = 2; i < length; i++)
|
||||
{
|
||||
iImage[i] = htonl(iImage[i]);
|
||||
}
|
||||
if(status != 1)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: histogram memory refused to Collapse",eError);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
we are in simulation and justcreate some random numbers
|
||||
*/
|
||||
for(i = 0; i < iDim[0]; i++)
|
||||
{
|
||||
for(i2 = 0; i2 < iDim[1]; i2++)
|
||||
{
|
||||
iPtr = lData + i*iDim[1]*iDim[2] +
|
||||
i2*iDim[2];
|
||||
iIdx = i*iDim[1] + i2;
|
||||
for(i3 = 0, iSum = 0; i3 < iDim[2]; i3++)
|
||||
{
|
||||
iSum += iPtr[i3];
|
||||
iImage[iIdx+2] = htonl(random());
|
||||
}
|
||||
iImage[iIdx+2] = htonl(iSum);
|
||||
}
|
||||
}
|
||||
|
||||
@ -541,17 +575,14 @@
|
||||
{
|
||||
int iDim[MAXDIM], i, i2, i3, *iSum = NULL, iLang, *iPtr;
|
||||
HistInt *lData = NULL;
|
||||
int iLimit;
|
||||
int iLimit, status;
|
||||
char pBueffel[132];
|
||||
pSINQHM pHist;
|
||||
SinqHMDriv *pTata;
|
||||
|
||||
/* get histogram data */
|
||||
/* get histogram dimensions */
|
||||
GetHistDim(self->pHM,iDim,&i3);
|
||||
assert(i3 == 3);
|
||||
lData = GetHistogramPointer(self->pHM,pCon);
|
||||
if(!lData)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* check limits */
|
||||
if(x2 < x1)
|
||||
@ -629,26 +660,37 @@
|
||||
}
|
||||
memset(iSum,0,(iDim[2]+1)*sizeof(int));
|
||||
|
||||
/* do it! */
|
||||
iSum[0] = iDim[2];
|
||||
for(i = x1; i < x2; i++)
|
||||
iSum[0] = htonl(iDim[2]);
|
||||
if(isSINQHMDriv(self->pHM->pDriv))
|
||||
{
|
||||
for(i2 = x1; i2 < y2; i2++)
|
||||
{
|
||||
iPtr = lData + i*iDim[1]*iDim[2] +
|
||||
i2*iDim[2];
|
||||
for(i3 = 0; i3 < iDim[2]; i3++)
|
||||
{
|
||||
iSum[i3+1] += iPtr[i3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* network byte order */
|
||||
for(i = 0; i < iDim[2]+1; i++)
|
||||
/*
|
||||
send project message to histogram memory
|
||||
*/
|
||||
pTata = (SinqHMDriv *)self->pHM->pDriv->pPriv;
|
||||
pHist = (pSINQHM)pTata->pMaster;
|
||||
status = SINQHMProject(pHist, 4, x1, x2-x1,
|
||||
y1, y2-y1, iSum+1, iDim[2]*sizeof(int));
|
||||
/*
|
||||
convert to network byte order
|
||||
*/
|
||||
for(i = 1; i < iDim[2]+1; i++)
|
||||
{
|
||||
iSum[i] = htonl(iSum[i]);
|
||||
}
|
||||
if(status != 1)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: histogram memory refused to SubSample",eError);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* do acouple of random numbers! */
|
||||
for(i = 1; i < iDim[2]+1; i++)
|
||||
{
|
||||
iSum[i] = htonl(random());
|
||||
}
|
||||
}
|
||||
|
||||
/* send */
|
||||
sprintf(pBueffel,"arrowsum_%s",name);
|
||||
@ -766,6 +808,18 @@
|
||||
InvokeCallBack(self->pCall, FILELOADED,self);
|
||||
SCSendOK(pCon);
|
||||
}
|
||||
else if(strcmp(argv[1],"tofmode") == 0)
|
||||
{
|
||||
HMCountStartCallback(COUNTSTART,NULL,pCon);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: %s nor recognized as subcommand to %s",
|
||||
argv[1], argv[2]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
23
amortest.tcl
23
amortest.tcl
@ -177,7 +177,7 @@ Motor D5B SIM 0. 1000. .1 2. # bottom
|
||||
#======================== counter
|
||||
VarMake detectordist Float Mugger
|
||||
detectordist 200.
|
||||
MakeCounter counter SIM
|
||||
MakeCounter counter SIM .0001
|
||||
Motor COZ SIM 0. 1000. .1 2. # counter table height
|
||||
Motor C3Z SIM 0. 300. .1 2. # counter height
|
||||
Motor COM SIM -30. 30. .1 2. # counter omega
|
||||
@ -185,19 +185,25 @@ Motor COX SIM -100. 100. .1 2. # counter x
|
||||
ClientPut "Motors initialized"
|
||||
|
||||
#======================== histogram memory
|
||||
MakeHM hm SIM
|
||||
hm configure HistMode TOF
|
||||
MakeHM hm SinqHM
|
||||
hm configure HistMode PSD
|
||||
hm configure OverFlowMode Ceil
|
||||
hm configure Rank 1
|
||||
hm configure dim0 128
|
||||
hm configure dim1 128
|
||||
hm configure Length 16384
|
||||
hm configure dim0 256
|
||||
hm configure dim1 256
|
||||
hm configure xfac 10
|
||||
hm configure yfac 10
|
||||
hm configure xoff 128
|
||||
hm configure yoff 128
|
||||
hm configure Length 65536
|
||||
hm configure BinWidth 4
|
||||
hm preset 100.
|
||||
hm CountMode Timer
|
||||
hm configure HMComputer psds03.psi.ch
|
||||
hm configure HMPort 2400
|
||||
hm configure Counter counter
|
||||
hm configure init 0
|
||||
hm genbin 0. 35. 100
|
||||
hm genbin 0. 33 5
|
||||
hm init
|
||||
|
||||
ClientPut "Histogram Memory Initialized"
|
||||
@ -216,7 +222,6 @@ SicsDataPostFix lock
|
||||
|
||||
MakeDataNumber SicsDataNumber $home/danu.dat
|
||||
|
||||
MakeStoreAmor hm
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# C o m m a n d I n i t i a l i z a t i o n
|
||||
@ -253,6 +258,8 @@ set a2t(aoz) aoz
|
||||
set a2t(c3z) c3z
|
||||
MakeAmor2T a2t a2t aom2t
|
||||
|
||||
MakeStoreAmor hm a2t
|
||||
|
||||
#=========== Status Display Support
|
||||
MakeAmorStatus amorstatus xxxscan hm
|
||||
source amorpar.tcl
|
||||
|
536
crysconv.c
Normal file
536
crysconv.c
Normal file
@ -0,0 +1,536 @@
|
||||
/* crysconv.f -- translated by f2c (version 20000817).
|
||||
You must link the resulting object file with the libraries:
|
||||
-lf2c -lm (in that order)
|
||||
*/
|
||||
|
||||
#include "f2c.h"
|
||||
|
||||
/* Common Block Declarations */
|
||||
|
||||
struct {
|
||||
doublereal s[16] /* was [4][4] */, sinv[16] /* was [4][4] */;
|
||||
integer iok;
|
||||
} osolem_;
|
||||
|
||||
#define osolem_1 osolem_
|
||||
|
||||
/* ================ */
|
||||
|
||||
/* dec$ Ident 'V01A' */
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Updates: */
|
||||
/* V01A 7-May-1996 DM. Put error output to IOLUN, use IMPLICIT NONE and */
|
||||
/* get the code indented so that it is readable! */
|
||||
/* made F77 compliant. Mark Koennecke July 1996 */
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Routines to deal with the reciprocical lattice PB */
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Entry points in this file: */
|
||||
|
||||
/* SETRLP : CALCULATION OF S AND INVS , ORIENTATION MATRIX */
|
||||
/* RL2SPV : TRANSFO FROM RECIP LAT TO SCAT PLANE */
|
||||
/* SP2RLV : TRANSFO FROM SCAT PLANE TO RECIP LAT */
|
||||
/* INVS : INVERT MATRIX S, GENERATED BY SETRLP. */
|
||||
/* ERRESO : DEAL ITH ERROR MESSAGES FOR ALL MODULES */
|
||||
|
||||
/* SUBROUTINE SETRLP(SAM,IER) */
|
||||
/* SUBROUTINE RL2SPV(QHKL,QT,QM,QS,IER) */
|
||||
/* SUBROUTINE SP2RLV(QHKL,QT,QM,QS,IER) */
|
||||
/* SUBROUTINE INVS(S,SINV,IER) */
|
||||
/* SUBROUTINE ERRESO(MODULE,IER) */
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Subroutine */ int setrlp_(doublereal *sam, integer *ier)
|
||||
{
|
||||
/* System generated locals */
|
||||
doublereal d__1;
|
||||
|
||||
/* Builtin functions */
|
||||
double cos(doublereal), sin(doublereal), sqrt(doublereal), atan(
|
||||
doublereal);
|
||||
|
||||
/* Local variables */
|
||||
static doublereal alfa[3], cosa[3], cosb[3];
|
||||
static integer imod;
|
||||
static doublereal sina[3], sinb[3], aspv[6] /* was [3][2] */;
|
||||
extern /* Subroutine */ int invs_(doublereal *, doublereal *, integer *);
|
||||
static doublereal a[3], b[3], c__[3], bb[9] /* was [3][3] */, cc;
|
||||
static integer id, ie, jd, je, jf, kg, lf, lh, md, me, ne;
|
||||
static doublereal zp, vv[9] /* was [3][3] */;
|
||||
extern /* Subroutine */ int erreso_(integer *, integer *);
|
||||
static doublereal rlb[6] /* was [3][2] */;
|
||||
|
||||
/* ============================ */
|
||||
|
||||
/* SETRLP: Computation of matrix S which transforms (QH,QK,QL) to */
|
||||
/* vector (Q1,Q2) in scattering plane (defined by vectors A1,A2) */
|
||||
/* and SINV matrix for the inverse transformation */
|
||||
|
||||
/* INPUT SAM SAMPLE CHARACTERISTICS */
|
||||
/* SAM(1)=AS LATTICE PARAMETERS */
|
||||
/* SAM(2)=BS ------------------ */
|
||||
/* SAM(3)=CS ------------------ */
|
||||
/* SAM(4)=AA LATTICE ANGLES */
|
||||
/* SAM(5)=BB -------------- */
|
||||
/* SAM(6)=CC -------------- */
|
||||
/* SAM(7)=AX VECTOR A IN SCATTERING PLANE */
|
||||
/* SAM(8)=AY ---------------------------- */
|
||||
/* SAM(9)=AZ ---------------------------- */
|
||||
/* SAM(10)=BX VECTOR B IN SCATTERING PLANE */
|
||||
/* SAM(11)=BY ---------------------------- */
|
||||
/* SAM(12)=BZ ---------------------------- */
|
||||
/* OUTPUT IER ERROR RETURN TO BE TREATED BY ERRESO */
|
||||
/* IER=1 ERROR ON LATTICE PARAMETERS */
|
||||
/* IER=2 ERROR ON LATTICE ANGLES */
|
||||
/* IER=3 ERROR ON VECTORS A1, A2 */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Define the dummy arguments */
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* DO NOT EXPORT THE FOLLOWING COMMON ! */
|
||||
/* IT IS JUST FOR PERMANENT STORAGE USE */
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* SOME TESTS AND INIT OF CALCUALTION */
|
||||
|
||||
/* Parameter adjustments */
|
||||
--sam;
|
||||
|
||||
/* Function Body */
|
||||
*ier = 0;
|
||||
imod = 1;
|
||||
zp = 6.2831853071795862;
|
||||
osolem_1.iok = 0;
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
a[id - 1] = sam[id];
|
||||
alfa[id - 1] = sam[id + 3];
|
||||
aspv[id - 1] = sam[id + 6];
|
||||
aspv[id + 2] = sam[id + 9];
|
||||
/* L10: */
|
||||
}
|
||||
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
*ier = 1;
|
||||
if ((d__1 = a[id - 1], abs(d__1)) <= 1e-8) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 0;
|
||||
/* L20: */
|
||||
}
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
a[id - 1] /= zp;
|
||||
alfa[id - 1] /= 57.29577951308232087679815481410517;
|
||||
cosa[id - 1] = cos(alfa[id - 1]);
|
||||
sina[id - 1] = sin(alfa[id - 1]);
|
||||
/* L30: */
|
||||
}
|
||||
cc = cosa[0] * cosa[0] + cosa[1] * cosa[1] + cosa[2] * cosa[2];
|
||||
cc = cosa[0] * 2. * cosa[1] * cosa[2] + 1. - cc;
|
||||
*ier = 2;
|
||||
if (cc <= .1) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 0;
|
||||
cc = sqrt(cc);
|
||||
je = 2;
|
||||
kg = 3;
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
b[id - 1] = sina[id - 1] / (a[id - 1] * cc);
|
||||
cosb[id - 1] = (cosa[je - 1] * cosa[kg - 1] - cosa[id - 1]) / (sina[
|
||||
je - 1] * sina[kg - 1]);
|
||||
sinb[id - 1] = sqrt(1. - cosb[id - 1] * cosb[id - 1]);
|
||||
rlb[id + 2] = (d__1 = atan(sinb[id - 1] / cosb[id - 1]), abs(d__1)) *
|
||||
57.29577951308232087679815481410517;
|
||||
je = kg;
|
||||
kg = id;
|
||||
/* L40: */
|
||||
}
|
||||
bb[0] = b[0];
|
||||
bb[1] = 0.;
|
||||
bb[2] = 0.;
|
||||
bb[3] = b[1] * cosb[2];
|
||||
bb[4] = b[1] * sinb[2];
|
||||
bb[5] = 0.;
|
||||
bb[6] = b[2] * cosb[1];
|
||||
bb[7] = -b[2] * sinb[1] * cosa[0];
|
||||
bb[8] = 1. / a[2];
|
||||
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
rlb[id - 1] = 0.;
|
||||
for (je = 1; je <= 3; ++je) {
|
||||
/* Computing 2nd power */
|
||||
d__1 = bb[je + id * 3 - 4];
|
||||
rlb[id - 1] += d__1 * d__1;
|
||||
/* L60: */
|
||||
}
|
||||
*ier = 1;
|
||||
if ((d__1 = rlb[id - 1], abs(d__1)) <= 1e-8) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 0;
|
||||
rlb[id - 1] = sqrt(rlb[id - 1]);
|
||||
/* L50: */
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* GENERATION OF S ORIENTATION MATRIX REC. LATTICE TO SCATTERING PLANE */
|
||||
|
||||
for (kg = 1; kg <= 2; ++kg) {
|
||||
for (ie = 1; ie <= 3; ++ie) {
|
||||
vv[kg + ie * 3 - 4] = 0.;
|
||||
for (jf = 1; jf <= 3; ++jf) {
|
||||
vv[kg + ie * 3 - 4] += bb[ie + jf * 3 - 4] * aspv[jf + kg * 3
|
||||
- 4];
|
||||
/* L90: */
|
||||
}
|
||||
/* L80: */
|
||||
}
|
||||
/* L70: */
|
||||
}
|
||||
for (md = 3; md >= 2; --md) {
|
||||
for (ne = 1; ne <= 3; ++ne) {
|
||||
id = md % 3 + 1;
|
||||
je = (md + 1) % 3 + 1;
|
||||
kg = ne % 3 + 1;
|
||||
lh = (ne + 1) % 3 + 1;
|
||||
vv[md + ne * 3 - 4] = vv[id + kg * 3 - 4] * vv[je + lh * 3 - 4] -
|
||||
vv[id + lh * 3 - 4] * vv[je + kg * 3 - 4];
|
||||
/* L110: */
|
||||
}
|
||||
/* L100: */
|
||||
}
|
||||
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
c__[id - 1] = 0.;
|
||||
for (je = 1; je <= 3; ++je) {
|
||||
/* Computing 2nd power */
|
||||
d__1 = vv[id + je * 3 - 4];
|
||||
c__[id - 1] += d__1 * d__1;
|
||||
/* L130: */
|
||||
}
|
||||
*ier = 3;
|
||||
if ((d__1 = c__[id - 1], abs(d__1)) <= 1e-6) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 0;
|
||||
c__[id - 1] = sqrt(c__[id - 1]);
|
||||
/* L120: */
|
||||
}
|
||||
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
for (je = 1; je <= 3; ++je) {
|
||||
vv[je + id * 3 - 4] /= c__[je - 1];
|
||||
/* L160: */
|
||||
}
|
||||
/* L150: */
|
||||
}
|
||||
for (kg = 1; kg <= 3; ++kg) {
|
||||
for (me = 1; me <= 3; ++me) {
|
||||
osolem_1.s[kg + (me << 2) - 5] = 0.;
|
||||
for (lf = 1; lf <= 3; ++lf) {
|
||||
osolem_1.s[kg + (me << 2) - 5] += vv[kg + lf * 3 - 4] * bb[lf
|
||||
+ me * 3 - 4];
|
||||
/* L190: */
|
||||
}
|
||||
/* L180: */
|
||||
}
|
||||
/* L170: */
|
||||
}
|
||||
osolem_1.s[15] = 1.;
|
||||
for (jd = 1; jd <= 3; ++jd) {
|
||||
osolem_1.s[(jd << 2) - 1] = 0.;
|
||||
osolem_1.s[jd + 11] = 0.;
|
||||
/* L200: */
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* INVERT TRANSFORMATION MATRIX S AND PU RESULT IN SINV */
|
||||
|
||||
*ier = 3;
|
||||
invs_(osolem_1.s, osolem_1.sinv, ier);
|
||||
*ier = 0;
|
||||
if (*ier != 0) {
|
||||
goto L999;
|
||||
}
|
||||
osolem_1.iok = 123;
|
||||
/* --------------------------------------------------------------------------- */
|
||||
/* SORTIE */
|
||||
|
||||
L999:
|
||||
if (*ier != 0) {
|
||||
erreso_(&imod, ier);
|
||||
}
|
||||
return 0;
|
||||
} /* setrlp_ */
|
||||
|
||||
/* =========================================================================== */
|
||||
/* Subroutine */ int rl2spv_(doublereal *qhkl, doublereal *qt, doublereal *qm,
|
||||
doublereal *qs, integer *ier)
|
||||
{
|
||||
/* System generated locals */
|
||||
doublereal d__1;
|
||||
|
||||
/* Builtin functions */
|
||||
double sqrt(doublereal);
|
||||
|
||||
/* Local variables */
|
||||
static integer id, je;
|
||||
|
||||
/* ========================================= */
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* INPUT QHKL QHKL -> QT */
|
||||
/* A Q-VECTOR TO BE TRANSFORM FROM RECIP LATTICE TO SCATTERING PLANE */
|
||||
/* CHECK THAT Q-VECTOR IS IN THE PLANE */
|
||||
|
||||
/* INPUT Q-VECTOR QHKL(3) Q-VECTOR IN RECIPROCICAL LATTICVE */
|
||||
|
||||
/* OUTPUT Q-VECTOR QT(3) Q-VECTOR IN SCATTERING PLANE */
|
||||
/* OUTPUT QM AND QS QMODULUS AND ITS SQUARE ( TO BE VERIFIED ) */
|
||||
/* OUTPUT ERROR IER */
|
||||
/* IER=1 MATRIX S NOT OK */
|
||||
/* IER=2 Q NOT IN SCATTERING PLANE */
|
||||
/* IER=3 Q MODULUS TOO SMALL */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Define the dummy arguments */
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* DO NOT EXPORT THE FOLLWING COOMON ! */
|
||||
/* IT IS JUST FOR PERMANENT STORAGE USE */
|
||||
|
||||
/* --------------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------------- */
|
||||
/* INIT AND TEST IF TRANSFO MATRICES ARE OK */
|
||||
/* Parameter adjustments */
|
||||
--qt;
|
||||
--qhkl;
|
||||
|
||||
/* Function Body */
|
||||
*ier = 1;
|
||||
if (osolem_1.iok != 123) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 0;
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
qt[id] = 0.;
|
||||
for (je = 1; je <= 3; ++je) {
|
||||
qt[id] += qhkl[je] * osolem_1.s[id + (je << 2) - 5];
|
||||
/* L20: */
|
||||
}
|
||||
/* L10: */
|
||||
}
|
||||
*ier = 2;
|
||||
if (abs(qt[3]) > 1e-4) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 0;
|
||||
*qs = 0.;
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
/* Computing 2nd power */
|
||||
d__1 = qt[id];
|
||||
*qs += d__1 * d__1;
|
||||
/* L30: */
|
||||
}
|
||||
if (*qs < 1e-8) {
|
||||
*ier = 3;
|
||||
} else {
|
||||
*qm = sqrt(*qs);
|
||||
}
|
||||
/* --------------------------------------------------------------------------- */
|
||||
|
||||
L999:
|
||||
return 0;
|
||||
} /* rl2spv_ */
|
||||
|
||||
/* =========================================================================== */
|
||||
/* Subroutine */ int sp2rlv_(doublereal *qhkl, doublereal *qt, doublereal *qm,
|
||||
doublereal *qs, integer *ier)
|
||||
{
|
||||
/* System generated locals */
|
||||
doublereal d__1;
|
||||
|
||||
/* Builtin functions */
|
||||
double sqrt(doublereal);
|
||||
|
||||
/* Local variables */
|
||||
static integer id, je;
|
||||
|
||||
/* ========================================= */
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* INPUT QT QHKL <- QT */
|
||||
/* A Q-VECTOR TO BE TRANSFORM FROM SCATTERING PLANE TO RECIP LATTICE */
|
||||
/* CHECK THAT Q, D & G VECTORS ARE IN THE SCATTERING PLANE */
|
||||
|
||||
/* INPUT Q-VECTOR QT(3) Q-VECTOR IN SCATTERING PLANE */
|
||||
|
||||
/* OUTPUT Q-VECTOR QHKL(3) Q-VECTOR IN RECIPROCICAL LATTICVE */
|
||||
/* OUTPUT QM AND QS QMODULUS AND ITS SQUARE ( TO BE VERIFIED ) */
|
||||
/* OUTPUT ERROR IER */
|
||||
/* IER=1 MATRIX S NOT OK */
|
||||
/* IER=2 Q NOT IN SCATTERING PLANE */
|
||||
/* IER=3 Q MODULUS TOO SMALL */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Define the dummy arguments */
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* DO NOT EXPORT THE FOLLWING COOMON ! */
|
||||
/* IT IS JUST FOR PERMANENT STORAGE USE */
|
||||
|
||||
/* --------------------------------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------------- */
|
||||
/* INIT AND TEST IF TRANSFO MATRICES ARE OK */
|
||||
/* Parameter adjustments */
|
||||
--qt;
|
||||
--qhkl;
|
||||
|
||||
/* Function Body */
|
||||
*ier = 1;
|
||||
if (osolem_1.iok != 123) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 2;
|
||||
if (abs(qt[3]) > 1e-4) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 0;
|
||||
/* ----------------------------------------------------------------------- */
|
||||
*qs = 0.;
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
/* Computing 2nd power */
|
||||
d__1 = qt[id];
|
||||
*qs += d__1 * d__1;
|
||||
/* L10: */
|
||||
}
|
||||
if (*qs < 1e-8) {
|
||||
*ier = 3;
|
||||
} else {
|
||||
*qm = sqrt(*qs);
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
qhkl[id] = 0.;
|
||||
for (je = 1; je <= 3; ++je) {
|
||||
qhkl[id] += osolem_1.sinv[id + (je << 2) - 5] * qt[je];
|
||||
/* L30: */
|
||||
}
|
||||
/* L20: */
|
||||
}
|
||||
/* --------------------------------------------------------------------------- */
|
||||
|
||||
L999:
|
||||
return 0;
|
||||
} /* sp2rlv_ */
|
||||
|
||||
/* ========================================================================== */
|
||||
/* Subroutine */ int invs_(doublereal *s, doublereal *sinv, integer *ier)
|
||||
{
|
||||
/* Initialized data */
|
||||
|
||||
static integer m[3] = { 2,3,1 };
|
||||
static integer n[3] = { 3,1,2 };
|
||||
|
||||
static integer id, je, mi, mj, ni, nj;
|
||||
static doublereal det;
|
||||
|
||||
/* ============================== */
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* ROUTINE TO INVERT MATRIX S, GENERATED BY SETRLP, WHICH TRANSFORMS */
|
||||
/* (QH,QK,QL) TO (Q1,Q2) IN THE SCATTERING PLANE */
|
||||
/* INPUT MATRIX DOUBLE PRECISION S(4,4) */
|
||||
/* OUTPUT MATRIX DOUBLE PRECISION SINV(4,4) */
|
||||
/* OUTPUT ERROR IER */
|
||||
/* IER=1 DETERMINANT OF MATRIX S TOO SMALL */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Define the dummy arguments */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/* Parameter adjustments */
|
||||
sinv -= 5;
|
||||
s -= 5;
|
||||
|
||||
/* Function Body */
|
||||
/* ------------------------------------------------------------------ */
|
||||
*ier = 0;
|
||||
for (id = 1; id <= 4; ++id) {
|
||||
for (je = 1; je <= 4; ++je) {
|
||||
sinv[id + (je << 2)] = 0.;
|
||||
/* L20: */
|
||||
}
|
||||
/* L10: */
|
||||
}
|
||||
det = 0.;
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
for (je = 1; je <= 3; ++je) {
|
||||
mi = m[id - 1];
|
||||
mj = m[je - 1];
|
||||
ni = n[id - 1];
|
||||
nj = n[je - 1];
|
||||
sinv[je + (id << 2)] = s[mi + (mj << 2)] * s[ni + (nj << 2)] - s[
|
||||
ni + (mj << 2)] * s[mi + (nj << 2)];
|
||||
/* L40: */
|
||||
}
|
||||
det += s[id + 4] * sinv[(id << 2) + 1];
|
||||
/* L30: */
|
||||
}
|
||||
if (abs(det) < 1e-6) {
|
||||
*ier = 1;
|
||||
} else {
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
for (je = 1; je <= 3; ++je) {
|
||||
sinv[id + (je << 2)] /= det;
|
||||
/* L70: */
|
||||
}
|
||||
/* L60: */
|
||||
}
|
||||
}
|
||||
sinv[20] = 1.;
|
||||
return 0;
|
||||
} /* invs_ */
|
||||
|
||||
/* ========================================================================= */
|
||||
/* Subroutine */ int erreso_(integer *module, integer *ier)
|
||||
{
|
||||
|
||||
/* System generated locals */
|
||||
integer i__1;
|
||||
|
||||
/* Local variables */
|
||||
static integer lmod, lier;
|
||||
|
||||
/* ============================= */
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* SUBROUTINE TO TREAT ERRORS FROM RESOLUTION CALCULATIONS */
|
||||
/* MODULE = 1 -> SETRLP */
|
||||
/* MODULE = 2 -> RL2SPV */
|
||||
/* MODULE = 3 -> EX_CASE */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
|
||||
/* INCLUDE 'MAD_DEF:IOLSDDEF.INC' */
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Define the dummy arguments */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------- */
|
||||
/* Computing MIN */
|
||||
i__1 = max(*ier,1);
|
||||
lier = min(i__1,4);
|
||||
/* Computing MIN */
|
||||
i__1 = max(*module,1);
|
||||
lmod = min(i__1,3);
|
||||
/* WRITE(6,501) MESER(LIER,LMOD) */
|
||||
/* 501 FORMAT(A) */
|
||||
return 0;
|
||||
} /* erreso_ */
|
||||
|
114
cryst.c
Normal file
114
cryst.c
Normal file
@ -0,0 +1,114 @@
|
||||
/*---------------------------------------------------------------------------
|
||||
C r y s t
|
||||
|
||||
This is a library of crystallographic utility routines for four
|
||||
circle diffractometers. It deals with all sorts of rotations and
|
||||
stuff. This is based on code originally developed by John Allibon
|
||||
at ILL and reimplemented in C using a matrix-library.
|
||||
|
||||
Mark Koennecke, July 2000
|
||||
----------------------------------------------------------------------------*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include "matrix/matrix.h"
|
||||
#include "cryst.h"
|
||||
|
||||
#define PIR 57.30
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
chimat, calculate chi rotation matrix. The input angle is in degrees.
|
||||
The setting is Busing & Levy.
|
||||
--------------------------------------------------------------------------*/
|
||||
|
||||
MATRIX chimat(double dAngle)
|
||||
{
|
||||
MATRIX res;
|
||||
double dChi;
|
||||
|
||||
res = mat_creat(3,3,ZERO_MATRIX);
|
||||
dChi = dAngle/PIR;
|
||||
|
||||
res[0][0] = cos(dChi);
|
||||
res[0][2] = sin(dChi);
|
||||
res[1][1] = 1.;
|
||||
res[2][0] = -res[0][2];
|
||||
res[2][2] = res[0][0];
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
phimat, calculate phi rotation matrix. The input angle is in degrees.
|
||||
The setting is Busing & Levy.
|
||||
--------------------------------------------------------------------------*/
|
||||
|
||||
MATRIX phimat(double dAngle)
|
||||
{
|
||||
MATRIX res;
|
||||
double dPhi;
|
||||
|
||||
res = mat_creat(3,3,ZERO_MATRIX);
|
||||
dPhi = dAngle/PIR;
|
||||
|
||||
res[0][0] = cos(dPhi);
|
||||
res[0][1] = sin(dChi);
|
||||
res[2][2] = 1.;
|
||||
res[1][0] = -res[0][1];
|
||||
res[1][1] = res[0][0];
|
||||
|
||||
return res;
|
||||
}
|
||||
/*-------------------------------------------------------------------------
|
||||
psimat, calculate psi rotation matrix. The input angle is in degrees.
|
||||
The setting is Busing & Levy.
|
||||
--------------------------------------------------------------------------*/
|
||||
|
||||
MATRIX psimat(double dAngle)
|
||||
{
|
||||
MATRIX res;
|
||||
double dPsi;
|
||||
|
||||
res = mat_creat(3,3,ZERO_MATRIX);
|
||||
dPsi = dAngle/PIR;
|
||||
|
||||
res[0][0] = 1.;
|
||||
res[1][1] = cos(dPsi);
|
||||
res[1][2] = -sin(dPsi);
|
||||
res[2][1] = -res[1][2];
|
||||
res[2][2] = res[1][1];
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
diffFromAngles calculates the diffraction vector from two theta, omega
|
||||
chi and phi. The angled need not be bissecting but it is assumed that
|
||||
the diffraction vector is in the equatorial plane.
|
||||
--------------------------------------------------------------------------*/
|
||||
|
||||
MATRIX diffFromAngles(double wave, double tth, double om,
|
||||
double chi, double phi)
|
||||
{
|
||||
MATRIX res, rot, dum, z;
|
||||
double dTh;
|
||||
|
||||
dTh = (tth/2.)/PIR;
|
||||
res = mat_creat(3,1,ZERO_MATRIX);
|
||||
res[0][0] = (2.*sin(dTh)*cos(dTh))/wave;
|
||||
res[1][0] = (-2. *sin(dTh)*sin(dTh))/wave;
|
||||
|
||||
/* undo omega rotation */
|
||||
rot = phimat(om);
|
||||
dum = mat_tran(rot);
|
||||
mat_free(rot);
|
||||
z = mat_mul(dum,res);
|
||||
mat_free(dum);
|
||||
mat_free(res);
|
||||
|
||||
/* result is now z */
|
||||
|
||||
}
|
||||
|
2
danu.dat
2
danu.dat
@ -1,3 +1,3 @@
|
||||
2
|
||||
24
|
||||
NEVER, EVER modify or delete this file
|
||||
You'll risk eternal damnation and a reincarnation as a cockroach!|n
|
@ -5,7 +5,8 @@
|
||||
<BODY>
|
||||
<H1>Aliases in SICS</H1>
|
||||
<P>
|
||||
SICS knows two different kinds of aliases: object aliases and command
|
||||
SICS knows three different kinds of aliases: object aliases,
|
||||
runtime aliases and command
|
||||
aliases. This is confusing but finds its explanation in the structure
|
||||
of SICS internals.
|
||||
</P>
|
||||
@ -22,7 +23,20 @@ command:
|
||||
<DT>SicsAlias newname oldname
|
||||
<DD>This command installs newname as alias for the object oldname.
|
||||
</dl>
|
||||
SicsAlias can only be used within initialization scripts.
|
||||
SicsAlias can only be used within initialization scripts. SicsAlias is
|
||||
considrered deprecated and can be replaced with the superior runtime
|
||||
aliases described below.
|
||||
</p>
|
||||
<h2>Runtime Aliases</h2>
|
||||
<p>
|
||||
Runtime aliases are full object aliases which can be configured into the
|
||||
system at run time by a SICS manager. The syntax looks like this:
|
||||
<dl>
|
||||
<dt>definealias SICSobject aliasname
|
||||
<dd>This defines aliasname to be the alias for the SICS object SICSobject.
|
||||
<dt>definealias aliasname
|
||||
<dd>This command deltes the alias aliasname.
|
||||
</dl>
|
||||
</p>
|
||||
<h2>Command Aliases</h2>
|
||||
<p>
|
||||
|
@ -46,7 +46,6 @@ number of the motor in the EL734 motor controller.
|
||||
El734DC motor controller. The
|
||||
parameters host, port, chan have the meanings defined above. no is the
|
||||
number of the motor in the EL734DC motor controller.
|
||||
</DL>
|
||||
<DT>MakePIMotor name c804 pararray
|
||||
<DD>Creates a motr name connected to a C804 motor controller from the
|
||||
manufacturer Physik Instrumente. Pararray is a Tcl array holding the
|
||||
@ -64,6 +63,7 @@ number of the motor in the EL734DC motor controller.
|
||||
<dd>Creates a piezo electric positioning device. Again the controller is a
|
||||
Physik Instrumente controller. pararray has the same meaning as for the
|
||||
C804 controller given above.
|
||||
</DL>
|
||||
</p>
|
||||
|
||||
<h3>Counting Devices</h3>
|
||||
@ -79,7 +79,6 @@ failures. This can be used in a instrument simulation server.
|
||||
<DD>This command creates a single
|
||||
counter name, using an EL737 driver. The counter is at host host, listening
|
||||
at port port and sits at serial port chan.
|
||||
</DL>
|
||||
<DT>MakeHMControl name counter hm1 hm2 hm3
|
||||
<dd>At some instruments (for instance TRICS) multiple counters or
|
||||
histogram memories are controlled by a master counter which watches
|
||||
|
@ -91,26 +91,48 @@ NeXus files.
|
||||
</P>
|
||||
<p>
|
||||
<h2>User Defined Scans</h2>
|
||||
In some cases users wish to exert more influence about the scan. Especially
|
||||
about what gets counted. In order to cater for this a hook was implemented
|
||||
in the internal scan command. This hook allows to run a tcl procedure at each
|
||||
scan point. This Tcl procedure is required to return a string containing
|
||||
up to 11 values for counters and monitors. The first value will be the one
|
||||
used as counts in the data file. The others will be placed as monitors.
|
||||
Please note, that only the first three monitors are written to file as of
|
||||
current. In order to use this facility the following steps are required:
|
||||
<p>
|
||||
In some cases users wish to control the scan more closely, i.e. do
|
||||
multiple counting operations at the same point etc. This is especially
|
||||
true when magnets are involved. In order to do this a facility has
|
||||
been provided which allows the user to specify a macro routine which
|
||||
is called at each point. This macro routine then performs all
|
||||
necessary operations and then is responsible for storing its data. In
|
||||
order to this commands have been defined which allow to append a line
|
||||
to the scan data file and to store measured data in the scan data
|
||||
structure. The last feature is necessary in order to make scan status
|
||||
displays and scan analysis, such as center detection, work. The
|
||||
following steps are required:
|
||||
<ol>
|
||||
<li>Write The Tcl-macro procedure to run. Make sure that is creates proper
|
||||
output.
|
||||
<li>Test the Tcl-procedure in SICS.
|
||||
<li>Install the Tcl-procedure into the scan object with the
|
||||
xxscan command name syntax.
|
||||
<li>Make the scan command use the Tcl procedure by setting channel to -10 with
|
||||
the xxscan setchannel -10 command.
|
||||
<li>Write a suitable macro procedure for the actions required at each
|
||||
scan point. The procedure signature looks like this:
|
||||
<pre>
|
||||
proc myScanPoint {point} {
|
||||
}
|
||||
</pre> And will be called with the number of the current scan point as
|
||||
a parameter. Besides all usual Tcl and SICS commands the following
|
||||
special commands may be used:
|
||||
<dl>
|
||||
<dt>xxxscan line text
|
||||
<dd>Appends all the text after line to the scan data file.
|
||||
<dt>xxxscan storecounts c1 c2 c3 c4 ...
|
||||
<dd>Stores the first number given as count data, all the others as
|
||||
monitor values in the internal scan data structure.
|
||||
</dl>
|
||||
<li>Test the procedure.
|
||||
<li>Switch the internal scan command command into user scan mode with
|
||||
the command:
|
||||
<b>xxxscan configure user</b>
|
||||
<li>Assign your procedure to the internal scan command with the
|
||||
command: <b>xxxscan command myScanPoint</b>
|
||||
<li>Use normal scan commands for doing your scan.
|
||||
<li>Switch the internal scan command into normal mode with the
|
||||
command:
|
||||
<B>xxxscan configure standard</b>.
|
||||
</ol>
|
||||
A hint: If you need to control the counting operation as well (because you
|
||||
are not using a counter to count) just run the scan object with a very low
|
||||
preset and do the counting yourself in your procedure.
|
||||
In all this replace xxxscan with the name of the internal scan
|
||||
command.
|
||||
</p>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
|
@ -53,7 +53,6 @@ which is described elsewhere.
|
||||
%html iscan.htm 2
|
||||
%html alias.htm 2
|
||||
%html cron.htm 2
|
||||
%html client.htm 1
|
||||
%html ../user/trouble.htm 1
|
||||
%html move.htm 1
|
||||
\end{document}
|
||||
|
@ -1,59 +1,59 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Moving SICS</TITLE>
|
||||
<TITLE>Replacing Hardware</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>Moving SICS</H1>
|
||||
<H2> Moving the SICS Server to a new Computer</h2>
|
||||
<P>
|
||||
Moving the SICS server from one computer to another involves quite a
|
||||
few steps:
|
||||
<OL>
|
||||
<LI>Recreate the directory structure on the new computer.
|
||||
<LI>Copy all necessary files across:
|
||||
<ul>
|
||||
<li> A copy of the SICServer.
|
||||
<li> A copy of the instrument configuration file.
|
||||
<li> All macro scripts used by this instrument.
|
||||
<li> The DataNumber file.
|
||||
<li> The necessary data file dictionary or header description files.
|
||||
<li> The client programs.
|
||||
</ul>
|
||||
All necessary files should be available from backup or under the
|
||||
/data/lnslib/sics/instrument tree on lnsa10.
|
||||
<LI>Edit the instrument configuration file and make all pathnames reflect the
|
||||
new directory structure. It should be enough to adapt the home variable at the
|
||||
top, but better check. All paths references must be renewed if the directory
|
||||
structure is changed from the one described <a href = "setup.htm">above</a>.
|
||||
<LI>Edit the client scripts to reflect the new location of the server. Only the
|
||||
box and logpath parameters should need to be changed.
|
||||
<LI> Edit the DataNumber file and set the number above the last valid data file
|
||||
number used. Otherwise the automatic numbering scheme
|
||||
for data files gets messed up.
|
||||
<LI>Test the new Installation!
|
||||
</OL>
|
||||
This requires the following steps:
|
||||
<ol>
|
||||
<li>Create a new local account on the host computer. There is a
|
||||
prefabricated account with the credentials: INSTBCK/INSTBCKLNS on
|
||||
lnsa15.
|
||||
<li>Run <b>sicsinstall <tt>instrument</tt> </b> in the new instruemnt
|
||||
account, thereby replacing instrument with the name of the instrument
|
||||
you are moving.
|
||||
<li>Create and edit a suitable DataNumber file for the instrument.
|
||||
<li>Edit the instrument configuration files and adapt the path names
|
||||
to match the new situation.
|
||||
<li>Configure the histogram memory to boot from the new computer, se
|
||||
histogram memory documsntation for instructions how to do that.
|
||||
<li>Try to start and debug.
|
||||
</ol>
|
||||
</P>
|
||||
<h2>Exchanging the Macintosh Serial Port Server</h2>
|
||||
<p>In its current configuration at SINQ, SICS requires a Macintosh PC running a serial
|
||||
port server program. Exchanging this Macintosh requires the following steps:
|
||||
<OL>
|
||||
<LI>Exchange the Macintosh physically. Plug everything as it was before the
|
||||
exchange. Not every Macintosh can be used. Any other Macintosh from another
|
||||
instrument or the spare Macintosh from the EDV-cabin will do. Other
|
||||
Macintoshs require some serious screwing and software installation
|
||||
procedures.
|
||||
<LI>Edit the instrument configuration file and replace all references to the name of
|
||||
the old Macintosh PC with the name of the new Macintosh PC.
|
||||
<LI>Test it!
|
||||
</OL>
|
||||
If you do not plug the serial devices back onto the Macintosh as they were, you
|
||||
need to adapt the channel numbers in the configuration file as well. The standard
|
||||
plugging scheme for the serial port extension box on the Macintosh is like this:
|
||||
<OL>
|
||||
<LI>Motor Controller 1
|
||||
<LI>Motor Controller 2
|
||||
<LI>Counter Box
|
||||
</OL>
|
||||
|
||||
<h2>Exchanging the Serial Port Server</h2>
|
||||
<p>
|
||||
<ol>
|
||||
<li>Fetch a new one and make sure that all cables are plugged as
|
||||
they were in the old one.
|
||||
<li>Edit the startsics script to start the SerPortServer program with
|
||||
the name of the new serial port server.
|
||||
<li>Done!
|
||||
</ol>
|
||||
</p>
|
||||
<h2>Exchanging the Histogram Memory</h2>
|
||||
<p>
|
||||
<ol>
|
||||
<li>Get a new histogram memory computer from either Peter Rasmussen,
|
||||
the test setup in WHGA/247 or in cases of greatest need, from SLS.
|
||||
<li>Put into the rack.
|
||||
<li>Configure the HM boot parameters through the console conneted to
|
||||
the serial port belonging to the HM. Instructions for this can be
|
||||
found in the histogram memory documentation.
|
||||
<li>Include the new HM into the /etc/hosts file of the instrument
|
||||
computer.
|
||||
<li>Adapt the instrument configuration file to reflect the new name of
|
||||
the HM.
|
||||
<li>Start and debug.
|
||||
</ol>
|
||||
</p>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -17,13 +17,14 @@ The following hardware is usually present for any SICs instrument:
|
||||
</ul>
|
||||
The terminal server software is provided by Lantronix, see the
|
||||
appropriate manuals for the device for a description. The histogram
|
||||
memories are 6800 VME onboard computers running the VXworks realtime
|
||||
memories are 68000 VME onboard computers running the VXworks realtime
|
||||
operating system and some home grown histogramming software documented
|
||||
elsewhere.
|
||||
</p>
|
||||
<h2>Server programs</h2>
|
||||
<p>
|
||||
On the instrument computer the following software must run:
|
||||
For proper operation of an instrument the following software components are
|
||||
required:
|
||||
<dl>
|
||||
<dt>SerPortServer
|
||||
<dd>This is a TCP/IP server which implements a special protocoll for
|
||||
@ -40,8 +41,8 @@ software is Markus Zolliker.
|
||||
instrument control program. Then the server starts a script which
|
||||
synchronizes the local data directory with the central data storage on
|
||||
the labarotory server. FileSync is configured through an
|
||||
initilaization file usually called fs.ini. See the comments therein
|
||||
for more information.
|
||||
initialization file usually called fs.ini. See the comments in the
|
||||
initialization file for more information.
|
||||
<dt>SICServer
|
||||
<dd>This is the actual instrument control server. The configuration of
|
||||
this program is documented in this manual.
|
||||
|
@ -6,6 +6,41 @@
|
||||
|
||||
<h1>SICS Trouble Shooting </h1>
|
||||
<hr size=4 width="66%">
|
||||
<H2>Inspecting Log Files</h2>
|
||||
<p>
|
||||
Suppose something went wrong over the weekend or during the night and
|
||||
you are not absolutely sure what the problem was. In such a case it is
|
||||
helpful to look at the SICS log files. They live in the log directory
|
||||
of the instrument account. For each day (or after each restart of the
|
||||
SICS server) a new log file is created. They are named according to the
|
||||
following convention:
|
||||
<pre>
|
||||
autoYYYY-mm-dd@hh-MM-ss.log
|
||||
</pre>
|
||||
with YYYY denoting the year, mm the month, dd the day, hh the hour of
|
||||
creation, MM the minute of creation and ss the seconds of
|
||||
creation. The most recent log file can be looked at with the
|
||||
<b>sicstail</b> command. <b>sicstail num</b> shows the last num lines
|
||||
of the log file. Within SICS and especially in the SICS command line
|
||||
client, the last 1000 lines of the log are accessible through the
|
||||
<b>commandlog tail num</b> command. The command log is also accessible
|
||||
through the WWW at lns00. The log file is equipped with hourly time
|
||||
stamps which allow to find out when exactly a problem began to
|
||||
appear.
|
||||
</p>
|
||||
<p>
|
||||
Quite often the inspection of the log files will indicate problems
|
||||
which are not software related such as:
|
||||
<ul>
|
||||
<li>Communication problems (usually network)
|
||||
<li>Positioning problems of motors.
|
||||
<li>BAD_EMERG_STOP: the motor emergency stop was engaged. It must be
|
||||
released before the motors move again.
|
||||
<li>BAD_STP: a motor had been switched off.
|
||||
</ul>
|
||||
</p>
|
||||
<h2>Restarting SICS</h2>
|
||||
<hr size=4 width="66%">
|
||||
<p>
|
||||
There is no such thing as bug free software. There are always bugs, nasty
|
||||
behaviour etc. This document shall help to solve these problems. The usual
|
||||
@ -13,7 +48,7 @@ symptom will be that a client cannot connect to the server or the server is
|
||||
not responding.
|
||||
</p>
|
||||
<p>
|
||||
An essential prerequisite of SICS is that the server is up
|
||||
An essential prerequisite of SICS is that the servers are up
|
||||
and running. The system is configured to restart the SICServer whenever it
|
||||
fails. Only after a reboot or when the keepalive processes were killed (see
|
||||
below) the SICServer must be restarted. This is done for all instruments by
|
||||
@ -21,10 +56,9 @@ typing:
|
||||
<pre>
|
||||
startsics
|
||||
</pre>
|
||||
at the command prompt. startsics actually starts two programs: one is
|
||||
the replicator application which is responsible for the automatic
|
||||
copying of data files to the laboratory server. The other is the SICS
|
||||
server. Both programs are started by means of a shell script called
|
||||
at the command prompt. startsics actually starts several programs, see
|
||||
the Setup section for details. All programs are started by means of a
|
||||
shell script called
|
||||
<b>keepalive</b>. keepalive is basically an endless loop which calls
|
||||
the program again and agaian and thus ensures that the program will
|
||||
never stop running.
|
||||
@ -142,12 +176,8 @@ If nothing seems to work any more, no connections can be obtained etc, then
|
||||
the next guess is to restart everything. This is especially necessary if
|
||||
mechanics or electronics people were closer to the instrument then 400 meters.
|
||||
<OL>
|
||||
<LI> Reboot the Macintosh PC by switching it off at the silver button on the
|
||||
left. Press deep and a few seconds to achieve an effect. The LED right to the
|
||||
button should be off, before you press again to boot the Macintosh.
|
||||
<LI> Reboot the histogram memory. It has a tiny button labelled RST. That' s
|
||||
the one. Can be operated with a hairpin, a ball point pen or the like.
|
||||
<LI> Wait 5 minutes. The Macintosh may take that time to come up again.
|
||||
<LI> Restart the SICServer. Watch for any messages about things not being
|
||||
connected or configured.
|
||||
<LI> Restart and reconnect the client programs.
|
||||
|
@ -25,7 +25,7 @@ last two digits of the year and an ending. All these components are
|
||||
controlled by variables.
|
||||
</p>
|
||||
<p>
|
||||
The exact syntax for creating variables lokks like this:
|
||||
The exact syntax for creating variables looks like this:
|
||||
<ul>
|
||||
<li> <b> VarMake name type access </b> creates a simple variable name. The
|
||||
variable type can be Text, Int or Float. The access parameter defines who
|
||||
|
376
doc/master.tex
Normal file
376
doc/master.tex
Normal file
@ -0,0 +1,376 @@
|
||||
\documentclass[12pt,a4paper]{article}
|
||||
%%\usepackage[dvips]{graphics}
|
||||
%%\usepackage{epsf}
|
||||
\setlength{\textheight}{24cm}
|
||||
\setlength{\textwidth}{16cm}
|
||||
\setlength{\headheight}{0cm}
|
||||
\setlength{\headsep}{0cm}
|
||||
\setlength{\topmargin}{0cm}
|
||||
\setlength{\oddsidemargin}{0cm}
|
||||
\setlength{\evensidemargin}{0cm}
|
||||
\setlength{\hoffset}{0cm}
|
||||
\setlength{\marginparwidth}{0cm}
|
||||
\setlength{\parindent}{0pt}
|
||||
\setlength{\parskip}{0.5cm}
|
||||
\newtheorem{error}{Error}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\begin{center}
|
||||
{\huge Sinq Systems Overview and Documentation Guide}
|
||||
\\
|
||||
Revision: \today \\
|
||||
Author: Mark K\"onnecke
|
||||
\end{center}
|
||||
\tableofcontents
|
||||
\clearpage
|
||||
\section{Introduction}
|
||||
This document gives an overview about all the hardware and software systems
|
||||
involved in SINQ instrument control. It describes the relationships between
|
||||
the various pieces and points to additional documentation, if available.
|
||||
A copy of all documents referred in this paper is stored at: /data/lnslib/distribution/sics/doclib. If they exist in electronic form, this is. The SICS user
|
||||
and manager information is available on the WWW starting from http://lns00.psi.ch/.
|
||||
|
||||
|
||||
\section{Hardware Overview}
|
||||
For each SINQ instrument the following computing hardware is available:
|
||||
\begin{itemize}
|
||||
\item A dedicated instrument workstation. Most of them are Compaq Alpha stations
|
||||
running True64Unix. One workstation is still running OpenVMS. Two instruments,
|
||||
POLDI and RITA--2, are controlled through Intel--PC's running Linux.
|
||||
\item A TCP/IP terminal server providing access to serial ports.
|
||||
\item Optionally, there are 1-3 histogram memory computers installed for those
|
||||
instruments which have area detectors. These histogram memory computers are
|
||||
Motorolla 6800 VME board processors running the vxWorks realtime
|
||||
operating system.
|
||||
\end{itemize}
|
||||
Most instrument hardware is accessed through RS--232 interfaces and the terminal
|
||||
server. Histogram memories are accessed through the TCP/IP network. Generally
|
||||
ethernet is used as the main instrument bus.
|
||||
|
||||
In addition to the computers at the instrument the following systems are
|
||||
available:
|
||||
\begin{itemize}
|
||||
\item A True64Unix laboratory server (lnsa15) for data management and
|
||||
primary data anlalysis.
|
||||
\item True64Unix PSI server systems for data processing.
|
||||
\item A WWW--server currently installed on lns00.
|
||||
\item pss123 is a Sun workstation holding the vxWorks development environment.
|
||||
\end{itemize}
|
||||
|
||||
\section{Software Overview}
|
||||
\subsection{Software at the Instrument}
|
||||
The main software component at the instrument is the Sinq Instrument Control
|
||||
Software (SICS). This is a client server system controlling the operation
|
||||
of the instrument. A central server running on the instrument workstation
|
||||
implements all the functionality of instrument control. Clients to this
|
||||
server implement the user interface to the instrument. The protocoll between
|
||||
clients and the SICS server is a ASCII command protocoll through either
|
||||
telnet or plain sockets.
|
||||
|
||||
RS--232 devices are not directly accessed through the terminal server but
|
||||
through a special server program, the SerPortServer program. The reasons
|
||||
for this are both historical and practical as this system permits access
|
||||
to a given serial port for several clients which is a valuable aid for
|
||||
debugging. Clients to this SerPortServer such as the SICS server communicate
|
||||
with the server through a special ASCII protocoll transported through TCP/IP.
|
||||
The only documentation
|
||||
for both the SerPortServer and the ASCII protocoll is the source code.
|
||||
|
||||
There exists another support program, the FileSync server, on any instrument
|
||||
computer. This is a little Java server which listens at a UDP port for a
|
||||
message from SICS. If such a message is recognized or any two hours, this
|
||||
server starts a shell script which copies new data files to the laboratory
|
||||
server. This program is again documented only in its configuration file and
|
||||
the Java source code.
|
||||
|
||||
Then there is the TecsServer. This is a server which maintains and configures
|
||||
Lakeshore temperature controllers used as standard temperature controllers
|
||||
at SINQ. The only documentation for this program is Markus Zolliker.
|
||||
|
||||
On many instruments there are histogram memory computers. These usually run the
|
||||
following programs:
|
||||
\begin{description}
|
||||
\item[bootUtil] a utility running when the histogram memory is booted which
|
||||
starts all the other tasks and configures the histogram memory from its
|
||||
command line parameters.
|
||||
\item[sinqHMfiller] this task reads data from the electronics and stores it
|
||||
into the right histogram.
|
||||
\item[SinqHMserver] This process handles the TCP/IP communication with
|
||||
clients of the histogram memory. It spawns child processes for doing so.
|
||||
\end{description}
|
||||
The histogram memory software, its setup and the TCP/IP protocoll for its
|
||||
control is described in great detail in the documents titled:
|
||||
\newline\centerline{Software Support Notes for the SINQ Histogram Memory}
|
||||
and \newline
|
||||
\centerline{The Sinq histogram memory, SinqHM}
|
||||
both authored by David Maden. The sources for these documents are distributed
|
||||
with the source code for the histogram memory.
|
||||
|
||||
The SICS software is described in a variety of documentation:
|
||||
\begin{itemize}
|
||||
\item There is user documentation for various instruments.
|
||||
\item The installation and setup of SICS on an instrument computer is
|
||||
described in the "SICS Manager Manual".
|
||||
\item The programming concepts of SICS are discussed in the "SICS Programmers
|
||||
Reference".
|
||||
\item An 90\% complete description of SICS source code modules is available
|
||||
as "SICS Reference Manual".
|
||||
\end{itemize}
|
||||
|
||||
|
||||
One instrument, TASP, is run with the TASMAD software from ILL which runs
|
||||
on VMS systems. A user documentation for this system is available at: \newline
|
||||
\centerline{http://sinq.web.psi.ch/sinq/doc/tasmad.html}
|
||||
Some configuration issues are explained in this docuement as well. Further
|
||||
documentation exists only in form of David Maden and an analysis of the
|
||||
source code.
|
||||
|
||||
The RITA--2 instrument from Ris\o{ } runs the TASCOM software.
|
||||
This software is quite well documented in various documents which can be
|
||||
obtained at WHGA/247 or directly from the Ris\o{ } team and Per Skarup.
|
||||
|
||||
\subsection{Facilities at the Laboratory Server(LNSA15)}
|
||||
\subsubsection{Central Data Repository}
|
||||
Under the /data/lnslib/data directory there exists a central storage area for
|
||||
data files measured at the instruments. Newly measured data files are
|
||||
automatically mirrored to this area once a measurement has finished.
|
||||
Not surprisingly there is a subdirectory for each instrument at SINQ.
|
||||
These instrument directories contain further subdirectories for each year
|
||||
of SINQ operation which hold the actual data files.
|
||||
|
||||
\subsubsection{The SINQ File Database}
|
||||
Right early on it was decided to separate the file archival function from the
|
||||
file search facility. For this decision there are two reasons:
|
||||
\begin{itemize}
|
||||
\item If more search criteria are required, only the database will need to be
|
||||
rebuilt.
|
||||
\item Most SINQ data files are binary. A special tool was needed anyway in
|
||||
order to extract the searchable information from the data files.
|
||||
\end{itemize}
|
||||
The SINQ File database is described in more detail in the document:\newline
|
||||
\centerline{The SINQ File Database}
|
||||
which is part of the source distribution for the system. Here only an
|
||||
overview of the SINQ database system is given.
|
||||
|
||||
The SINQ File Database consists of the following components:
|
||||
\begin{itemize}
|
||||
\item The database itself. This is the SQL database system mSQL from
|
||||
Hughes Technology.
|
||||
\item Any night the unix utility cron starts a shell script which is
|
||||
responsible for updating the database. This is done with two special
|
||||
utility programs:
|
||||
\begin{itemize}
|
||||
\item nx\_dbupdate scans a given directory for new files which are not
|
||||
yet in the database. If such a file is found, the data fields for the
|
||||
database are extracted and entered into the database.
|
||||
\item The Java program ScanScan does the same job as nx\_dbupdate for
|
||||
ASCII files.
|
||||
\end{itemize}
|
||||
\item A querying system. Curently the only query interface is a WWW--interface
|
||||
installed at the WWW--server.
|
||||
\end{itemize}
|
||||
|
||||
|
||||
\subsubsection{The NeXus Data Server}
|
||||
In order to provide access to SINQ data file to various clients on the
|
||||
network a NeXus Data Server was installed. This piece of software
|
||||
is required in order to support the "Load Old File" facility in the
|
||||
Java status display clients for various instruments.
|
||||
|
||||
\subsubsection{The CVS Repository}
|
||||
CVS is a shortcut for Concurrent Version control System. This is a system for
|
||||
keeping track of various versions of software. As a lot of source code has
|
||||
to be maintained at SINQ and we aspire to have several people working at
|
||||
it such a control system became necessary. The LNS setup is described in
|
||||
the document:\newline
|
||||
\centerline{The LNS CVS Repository}
|
||||
This document also explains how to get hold the source code for most
|
||||
of the software used at SINQ.
|
||||
|
||||
\subsubsection{Backup}
|
||||
The laboratory server is also the central backup server for SINQ. Backups are
|
||||
performed with the Legato networker software onto a tape jukebox holding
|
||||
5 tapes with 20GB capacity each. The following items are backed up through
|
||||
this system:
|
||||
\begin{itemize}
|
||||
\item The laboratory server.
|
||||
\item The instrument accounts on the instrument computers.
|
||||
\item The lnsdata and lnslib shares of the lns00 Windows--NT server.
|
||||
\end{itemize}
|
||||
This backup system is a protection against a major harddisk failure. It is no
|
||||
archive system. Though backup tapes are held as long as possible it
|
||||
cannot be guaranteed that files older then half a year can be recovered.
|
||||
The backup software is described in the documentation coming with the
|
||||
system. No further documentation exists, but the setup can be viewed
|
||||
through the nwadmin application.
|
||||
|
||||
|
||||
\subsubsection{Motor Parameter Backup}
|
||||
At SINQ the PSI EL--734 motor controllers are used. These motor controllers
|
||||
hold a set of parameters for each motor. As a safeguard against instrument
|
||||
scientists gone wild or a loss of parameters due some electronic or
|
||||
electrical incident these motor parameters are saved weekly. This happens
|
||||
on wednesdays mornings. The unix utility crom triggers the process and
|
||||
starts the script savemot which in turn does all necessary things. The
|
||||
actual saving of the motor parameters is accomplished with David Maden's
|
||||
el734 program. The saved parameters end up in the /data/lnslib/motors
|
||||
hierarchy. There exists a directory for each backup date which in turn
|
||||
holds a subdirectory for each instrument which holds the files with
|
||||
the saved parameters. All necessary shell scripts and programs can be
|
||||
found in the /data/lnslib/motors/bin directory.
|
||||
|
||||
|
||||
\subsubsection{License Server}
|
||||
Unfortunately some people use the proprietary IDL programming system. This
|
||||
system requires a license server to run on some computer. This license
|
||||
server is also installed together with the actual IDL distribution on the
|
||||
laboratory server. LNS has bought a number of network licenses of IDL.
|
||||
This means at any time only a certain number of people can use IDL on the
|
||||
network. When IDL starts up it requests a license from the license server
|
||||
and gives it back when it finishes. This only works if the license server
|
||||
still has enough spare licenses. This implies that any IDL user should
|
||||
close his program when she is done and not leave it running all weekend.
|
||||
The installation of the license server is described in the IDL installation
|
||||
instructions. License servers are black magic and should be handled by
|
||||
wizards only. There are only two things which can be done easily:
|
||||
\begin{enumerate}
|
||||
\item Check if it is running. the command: \begin{verbatim}
|
||||
ps -A | grep lmgrd
|
||||
\end{verbatim} should yield at least two entries.
|
||||
yield at least two entries.
|
||||
\item Start it if it is not running:
|
||||
\begin{enumerate}
|
||||
\item Become root
|
||||
\item Run: /usr/opt/idl/idl/bin/idlstart
|
||||
\end{enumerate}
|
||||
\end{enumerate}
|
||||
|
||||
|
||||
\subsection{Software at the WWW--server}
|
||||
The WWW--server running at lns00 does not provide static information only but also
|
||||
active content calculated at runtime. The following services are
|
||||
implemented:
|
||||
\begin{itemize}
|
||||
\item Keyword search in the SICS documentation.
|
||||
\item Searching the SINQ file database for files matching various criteria.
|
||||
\item Display of the current instrument status for a couple of instruments.
|
||||
\item An experimental WWW control system for powder diffractometers.
|
||||
\end{itemize}
|
||||
Most of these services are provided through java servlets. In order to do this
|
||||
a servlet engine was needed. The combination Apache WWW-server and Apache
|
||||
JServ was choosen. However, it is planned to exchange the latter component
|
||||
by the Jakarta engine in the near future.
|
||||
|
||||
The database search servlets are described in more detail in the document:
|
||||
\newline \centerline{The SINQ File Database}
|
||||
the status display and control servlets in the document:\newline
|
||||
\centerline{The SICS WWW--servlet System}
|
||||
. Both documents are part of their respective source code packages.
|
||||
|
||||
The SICS documentation searching system is built on top of the program SWISH-E which is available
|
||||
from http://sunsite.berkeley.edu/SWISH-E.
|
||||
The actual search is performed through a TCL--cgi script which calls the swishe
|
||||
application with appropriate parameters. This script can be found as
|
||||
swishsearch.cgi together with a batch file to start it properly
|
||||
(swishsearch.bat) in the cgi-bin directory of the WWW hierarchy on lns00.
|
||||
Prerequisite for such a search is the existence of an index file. This must
|
||||
be created offline after any major change to the documentation. In order to
|
||||
create this index, cd into the sics directory of the WWW hierarchy and run:
|
||||
\begin{verbatim}
|
||||
d:\bin\swishe sics.config
|
||||
\end{verbatim}
|
||||
This must be done on the lns00 computer. The placement of the index file,
|
||||
swishe executable and the root for serving documents are configured in
|
||||
sics/sicssearch.html and swishsearch.cgi. For more information about
|
||||
swish-e see the homepage mentioned.
|
||||
|
||||
|
||||
\section{Access Patterns}
|
||||
In order to understand the system better it is useful to look at the flow
|
||||
of information and the collaboration of the individual components in more
|
||||
detail.
|
||||
\subsection{Data Files}
|
||||
\begin{enumerate}
|
||||
\item Data Files are generated by the instrument control programs at the
|
||||
instrument computer.
|
||||
\item Data Files are automatically mirrored to the central repository
|
||||
on the laboratory server lnsa15. This happens through the FileSync server,
|
||||
a shell script and last not least the unix rsync utility. All this is installed
|
||||
at the instrument computer.
|
||||
\item Nightly new files are scanned for relevant information and their
|
||||
characteristics are entered into the database system on lnsa15.
|
||||
\end{enumerate}
|
||||
|
||||
|
||||
\subsection{SICS servers}
|
||||
SICS instrument control servers usually communicate with the terminal servers
|
||||
through the SerPortServer program, with temperature controllers through the
|
||||
TecsServer and directly via TCP/IP with the histogram memory computers.
|
||||
\subsection{SICS Java Clients}
|
||||
The SICS Java clients access the SICS servers on the selected instruments
|
||||
workstation. Most Java clients can display data from previously measured
|
||||
files. Such data is accessed through the NeXus Data Server running on the
|
||||
laboratory server lnsa15.
|
||||
\subsection{WWW Services}
|
||||
The file search service on the WWW--server lns00 accesses the database
|
||||
server running on the laboratory server lnsa15.
|
||||
|
||||
The instrument status display servlets on the WWW--server lns00 access the
|
||||
SICS instrument control servers on the appropriate instrument computers
|
||||
for data.
|
||||
|
||||
\section{Maintainance Tasks}
|
||||
\subsection{Yearly Maintainance}
|
||||
The only maintainance task at SINQ shutdown is to disable the cron job on
|
||||
lnsa15 which performs the motor parameter backup.
|
||||
|
||||
|
||||
Whith each new year a couple of things must be done in order to keep the
|
||||
system ship shape:
|
||||
\begin{enumerate}
|
||||
\item On each instrument computer:
|
||||
\begin{itemize}
|
||||
\item Create a new subdirectory for data files for the new year.
|
||||
\item In the new subdirectory create a DataNumber file with the data file
|
||||
number set to 0.
|
||||
\item Edit the path names in the data file mirroring script to point to the
|
||||
new years subdirectory. This script is usually called {\tt instsync} with
|
||||
inst replaced by the name of the instrument.
|
||||
\item Edit the instrument configuration file and adapt the path names for
|
||||
the data directory and the DataNumber file for the new year.
|
||||
\end{itemize}
|
||||
\item On the laboratory server lnsa15:
|
||||
\begin{itemize}
|
||||
\item Reenable the motor parameter backup cron job.
|
||||
\item Create new subdirectories for the new year in the data hierarchy.
|
||||
\item In /data/lnslib/lib/nxdb create new configuration files for the new
|
||||
year. Edit them to point to the new years subdirectory. Edit the
|
||||
updatenxdb shell script to use the newly created configuration files.
|
||||
Keep the old ones as they may come in handy if the whole database may
|
||||
require an update.
|
||||
\end{itemize}
|
||||
\item On the WWW--server lns00:
|
||||
\begin{itemize}
|
||||
\item Add the new year into the html--pages for the data file search.
|
||||
\item Check the configuration file for the status servlets, sics.conf,
|
||||
for necessary updates caused by computer changes.
|
||||
\end{itemize}
|
||||
\end{enumerate}
|
||||
Do these things quite early on in the year. People start measuring background
|
||||
quite early!
|
||||
|
||||
\subsection{Exchange of Instrument Computers}
|
||||
In order to keep up with ageing 1-2 computers have to be exchanged any year.
|
||||
A instrument computer change requires the following adaptions:
|
||||
\begin{enumerate}
|
||||
\item Edit the instrument configuration file and change all occurences of
|
||||
the old computers name to the new name.
|
||||
\item On lnsa15 as user lnslib: enter the new computer name into the
|
||||
.rhosts file. This is required for the mirroring to work.
|
||||
\item For the Java clients edit lnet/SINQConfig.java to point to the
|
||||
new computer and rebuild all clients. Redistribute them as well.
|
||||
\item For the WWW status, adapt the sics.conf file on lns00 and restart
|
||||
the WWW-server.
|
||||
\end{enumerate}
|
||||
\end{document}
|
@ -34,6 +34,12 @@ implementors.
|
||||
path of the SICS server. This is usually /home/INSTRUMENT/bin.
|
||||
</p>
|
||||
<p>
|
||||
<b>backup motSave</b> toggles a flag which controls saving of motor
|
||||
positions. If this flag is set, commands for driving motors to the
|
||||
current positions are included in the backup file. This is useful
|
||||
for instruments with slipping motors.
|
||||
</p>
|
||||
<p>
|
||||
<b>restore file</b> reads a file produced by the backup command described
|
||||
above and restores SICS to the state it was in when the status was saved with
|
||||
backup. If no file argument is given the system default file gets
|
||||
|
@ -10,8 +10,68 @@
|
||||
There is no such thing as bug free software. There are always bugs, nasty
|
||||
behaviour etc. This document shall help to solve these problems. The usual
|
||||
symptom will be that a client cannot connect to the server or the server is
|
||||
not responding.
|
||||
not responding. Or error messages show up. This section helps to solve such
|
||||
problems.
|
||||
</p>
|
||||
<h2>Looking at Log Files</h2>
|
||||
<p>
|
||||
The first thing to do, especially when confronted with confusing statements
|
||||
from either users or instrument scientists, is to look at the SICS servers
|
||||
log files. The last 1000 lines of the instrument log are accessible from
|
||||
any SICS client or through the WWW interface. The SICS commands:
|
||||
<dl>
|
||||
<dt>commandlog tail
|
||||
<dd> shows the last 20 lines of the log.
|
||||
<dt>commandlog tail n
|
||||
<dd>shows the last n lines of the log.
|
||||
</dl>
|
||||
will show you the information available. In order to see more, log in to the
|
||||
instrument account. There the following unix commands might help:
|
||||
<ul>
|
||||
<li><b>sicstail</b> shows the last 20 lines of the current log file and its
|
||||
name
|
||||
<li><b>sicstail n</b> shows the last n lines of the current log file.
|
||||
</ul>
|
||||
In order to see some more, cd into the log directory of the instrument
|
||||
account. In there are files with names like:
|
||||
<pre>
|
||||
auto2001-08-08@00-01-01.log
|
||||
</pre>
|
||||
This means the log file has been started at August, 8, 2001 at 00:01:01.
|
||||
There is a new log file daily. Load appropriate files into the editor and
|
||||
look what really happened.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The log files show you all commands given and all the responses of the system.
|
||||
Additionally there are hourly time stamps in the file which allow to narrow
|
||||
in when the problem started. Things to watch out for are:
|
||||
<dl>
|
||||
<dt>MOTOR ALARM
|
||||
<dd>This message means that the motor failed to reach his position for a
|
||||
couple of times. This is caused by either a concrete shielding element
|
||||
blocking the movement of the instrument, badly adjusted motor parameters,
|
||||
mechanical failures or the air cushions not operating properly.
|
||||
<dt>EL734__BAD_EMERG_STOP
|
||||
<dd>Somebody has pushed the emergency stop button. This must be released
|
||||
before the instrument can move again. Moreover the motor controller will
|
||||
not respond to further commands in this mode. Thus restarting SICS on this
|
||||
error message will make SICS fail to initialize the motors affected!
|
||||
<dt>EL***__BAD_PIPE, BAD_RECV, BAD_ILLG, BAD_TMO, BAD_SEND
|
||||
<dd>Network communication problems. Can generaly be solved by restarting
|
||||
SICS.
|
||||
<dt>EL737__BAD_BSY
|
||||
<dd>A counting operation was aborted while the beam was off. Unfortunately,
|
||||
the counter box does not respond to commands in this state and ignores the
|
||||
stop command sent to it during the abort operation. This can be resolved by
|
||||
the command:
|
||||
<pre>
|
||||
counter stop
|
||||
</pre>
|
||||
when the beam is on again.
|
||||
</dl>
|
||||
</p>
|
||||
<h2>Starting SICS</h2>
|
||||
<p>
|
||||
An essential prerequisite of SICS is that the server is up
|
||||
and running. The system is configured to restart the SICServer whenever it
|
||||
@ -43,108 +103,12 @@ given at the unix command line. You must be the instrument user
|
||||
(for example DMC) on the instrument computer for this to work properly.
|
||||
</p>
|
||||
|
||||
<h2>Finding the SICS server</h2>
|
||||
<p>The first thing when killing the SICS server manually is to find the
|
||||
server process.
|
||||
Log in as Instrument user on the instrument computer (for instance DMC on
|
||||
lnsa05). Type the command:
|
||||
<pre>
|
||||
/home/DMC> ps -A
|
||||
</pre>
|
||||
Note the capital A given as parameter. The reward will be listing like this:
|
||||
<pre width =132>
|
||||
PID TTY S TIME CMD
|
||||
0 ?? R 01:56:28 [kernel idle]
|
||||
1 ?? I 1:24.44 /sbin/init -a
|
||||
3 ?? IW 0:00.20 /sbin/kloadsrv
|
||||
24 ?? S 40:39.58 /sbin/update
|
||||
97 ?? S 0:04.87 /usr/sbin/syslogd
|
||||
99 ?? IW 0:00.03 /usr/sbin/binlogd
|
||||
159 ?? S 1:43.70 /usr/sbin/routed -q
|
||||
285 ?? S 1:00.45 /usr/sbin/portmap
|
||||
293 ?? S 6:03.45 /usr/sbin/ypserv
|
||||
299 ?? I 0:00.37 /usr/sbin/ypbind -s -S psunix,lnsa05.psi.ch
|
||||
307 ?? I 0:00.52 /usr/sbin/mountd -i
|
||||
309 ?? I 0:00.07 /usr/sbin/nfsd -t8 -u8
|
||||
311 ?? I 0:00.09 /usr/sbin/nfsiod 7
|
||||
317 ?? S 5:51.54 /usr/sbin/automount -f /etc/auto.master -M /psi
|
||||
370 ?? I 0:28.58 -accepting connections (sendmail)
|
||||
389 ?? S 1:41.15 /usr/sbin/xntpd -g -c /etc/ntp.conf
|
||||
419 ?? S 6:00.16 /usr/sbin/snmpd
|
||||
422 ?? S 1:00.91 /usr/sbin/os_mibs
|
||||
438 ?? S 34:29.67 /usr/sbin/advfsd
|
||||
449 ?? I 3:16.29 /usr/sbin/inetd
|
||||
482 ?? IW 0:11.53 /usr/sbin/cron
|
||||
510 ?? IW 0:00.02 /usr/lbin/lpd
|
||||
525 ?? I 5:31.67 /usr/opt/psw/psw_agent -x/dev/null -f/usr/opt/psw/psw_agent.conf
|
||||
532 ?? I 0:00.74 /usr/opt/psw/psw_sensor_syswd 1 -x/dev/null
|
||||
555 ?? I 0:00.58 /usr/bin/nsrexecd
|
||||
571 ?? I 0:20.27 /usr/dt/bin/dtlogin -daemon
|
||||
583 ?? S 1:38.27 lpsbootd -F /etc/lpsodb -l 0 -x 1
|
||||
585 ?? IW 0:00.04 /usr/sbin/getty /dev/lat/620 console vt100
|
||||
586 ?? IW 0:00.03 /usr/sbin/getty /dev/lat/621 console vt100
|
||||
587 ?? I 35:59.85 /usr/bin/X11/X :0 -auth /var/dt/authdir/authfiles/A:0-aaarBa
|
||||
657 ?? I 0:01.46 rpc.ttdbserverd
|
||||
4705 ?? IW 0:00.05 dtlogin -daemon
|
||||
9127 ?? I 0:00.37 /usr/bin/X11/dxconsole -geometry 480x150-0-0 -daemon -nobuttons -verbose -notify -exitOnFail -nostdin -bg gray
|
||||
9317 ?? IW 0:00.73 dtgreet -display :0
|
||||
14412 ?? S 0:39.71 netscape
|
||||
15524 ?? I 0:00.57 rpc.cmsd
|
||||
21678 ?? S 0:00.11 telnetd
|
||||
31912 ?? S 0:10.65 /home/DMC/bin/SICServer /home/DMC/bin/dmc.tcl
|
||||
584 console IW + 0:00.21 /usr/sbin/getty console console vt100
|
||||
21978 ttyp1 S 0:00.63 -tcsh (tcsh)
|
||||
22269 ttyp1 R + 0:00.10 ps -A
|
||||
</pre>
|
||||
This is a listing of all running processes on the machine where this command
|
||||
has been typed. Note, in this case, at the bottom in the line starting with
|
||||
<tt> 31912 ?? </tt> an entry for the SICS server. In this example the server
|
||||
is running. If the server is down, no such entry would be present.
|
||||
</p>
|
||||
|
||||
<h2> Killing a hanging SICS server </h2>
|
||||
<p>
|
||||
Suppose, the situation is that the SICS server does not respond anymore. It
|
||||
needs to be forcefully exited. Please note, that it is always better to
|
||||
close the server via the <tt>Sics_Exitus</tt> command typed with manager
|
||||
privilege in one of the command clients. In order to kill the server it is
|
||||
needed to find him first using the scheme given above. The information
|
||||
needed is the number given as first item in the same line where the server
|
||||
is listed. In this case: <tt>31912</tt>. Please note, that this number will
|
||||
always be different. The command to force the server to stop is:
|
||||
<pre>
|
||||
/home/DMC> kill -9 31912
|
||||
</pre>
|
||||
Note, the second parameter is the number found with <tt>ps -A</tt>. The
|
||||
SICServer will be restarted automatically by the system. Occasionally, it
|
||||
may happen, that you cannot connect to the SICS server after such an
|
||||
operation. This is due to some network buffering problems. Doing the killing
|
||||
again usually solves the problem.
|
||||
</p>
|
||||
|
||||
<h2> Shutting The SICS Server Down Completely</h2>
|
||||
<p>
|
||||
This is done for you by the killsics shell script. Just type
|
||||
<pre>
|
||||
killsics
|
||||
</pre>
|
||||
at the unix command line. Here is what killsics does for you:
|
||||
In order to completely shutdown the SICS server two process must be killed:
|
||||
the actual SICS server and the process which automatically restarts the
|
||||
SICServer. The latter must be killed first. It can be found in the ps -A
|
||||
listing as a line reading <b>keepalive SICServer </b>. Kill that one as
|
||||
described above, then kill the SICServer. For restarting SICS after this,
|
||||
use the startsics command.
|
||||
</p>
|
||||
<h2>Restart Everything</h2>
|
||||
<p>
|
||||
If nothing seems to work any more, no connections can be obtained etc, then
|
||||
the next guess is to restart everything. This is especially necessary if
|
||||
mechanics or electronics people were closer to the instrument then 400 meters.
|
||||
<OL>
|
||||
<LI> Reboot the Macintosh PC by switching it off at the silver button on the
|
||||
left. Press deep and a few seconds to achieve an effect. The LED right to the
|
||||
button should be off, before you press again to boot the Macintosh.
|
||||
<LI> Reboot the histogram memory. It has a tiny button labelled RST. That' s
|
||||
the one. Can be operated with a hairpin, a ball point pen or the like.
|
||||
<LI> Wait 5 minutes. The Macintosh may take that time to come up again.
|
||||
@ -155,6 +119,43 @@ connected or configured.
|
||||
If this fails (even after a second) time there may be a network problem which
|
||||
can not be resolved by simple means.
|
||||
</p>
|
||||
<h2>Checking SICS Startup</h2>
|
||||
<p>
|
||||
Sometimes it happens that the SICServer hangs while starting up or hardware
|
||||
components are not properly initialized. In such cases it is useful to
|
||||
look at the SICS servers startup messages. In order to do so, both the
|
||||
SICServer and its keepalive process must be killed first. On the instrument
|
||||
acount issue the command:
|
||||
<pre>
|
||||
ps -A | grep SICS
|
||||
</pre>
|
||||
A message like this will be printed:
|
||||
<pre>
|
||||
23644 ?? I 0:00.00 ksh keepalive SICServer focus.tcl
|
||||
23672 ?? R 59:24.05 SICServer focus.tcl
|
||||
7119 ttyp6 S + 0:00.00 grep SICS
|
||||
</pre>
|
||||
Remember the numbers in the first columns (the PID's) and kill both
|
||||
programs by issuing the command:
|
||||
<pre>
|
||||
kill -9 pid pid
|
||||
</pre>
|
||||
Example:
|
||||
<pre>
|
||||
kill -9 23644 23672
|
||||
</pre>
|
||||
Note, the numbers are those displayed with the ps -A command.
|
||||
Then cd into the bin directory of the instrument account and issue
|
||||
the unix command:
|
||||
<pre>
|
||||
SICServer inst.tcl | more
|
||||
</pre>
|
||||
Replace inst.tcl with the name of the appropriate instrument initialisation
|
||||
file. This allows to page through SICS startup messages and will help to
|
||||
identify the troublesome component. The proceed to check the component and
|
||||
the connections to it.
|
||||
</p>
|
||||
|
||||
<h2>Getting New SICS Software</h2>
|
||||
<p>
|
||||
Sometimes you might want to be sure that you have the latest SICS software.
|
||||
|
10
faverage.c
10
faverage.c
@ -171,6 +171,11 @@
|
||||
printf("Histogram received in %d seconds\n", tStart - tEnd);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
if(hiData == NULL)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: BAD Configuration",eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* first int: length of things to come */
|
||||
iData[0] = htonl(iLength);
|
||||
@ -256,6 +261,11 @@
|
||||
}
|
||||
setFMDataPointer(hiData, iLength);
|
||||
hiData = getFMBankPointer(iBank);
|
||||
if(hiData == NULL)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: BAD Configuration",eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get histogram length */
|
||||
iLength = getFMdim(iBank);
|
||||
|
@ -250,7 +250,8 @@ static void mergeData(void)
|
||||
int i, j, nDiv;
|
||||
HistInt *startMerge, *startData;
|
||||
|
||||
assert(mergedData);
|
||||
if(!mergedData)
|
||||
return;
|
||||
|
||||
for(i = 0; i < nMerged; i++)
|
||||
{
|
||||
|
130
hardsup/sinqhm.c
130
hardsup/sinqhm.c
@ -7,6 +7,8 @@
|
||||
|
||||
Updated for TOF support: Mark Koennecke, December 1998
|
||||
|
||||
Added Project for AMOR: Mark Koennecke, August 2001
|
||||
|
||||
Copyright:
|
||||
|
||||
Labor fuer Neutronenstreuung
|
||||
@ -1098,6 +1100,134 @@ extern int close(int fp);
|
||||
}
|
||||
}
|
||||
|
||||
/* swap bytes if necessary */
|
||||
if ((self->iBinWidth > 0) && (Rply_buff.bigend != 0x12345678))
|
||||
{
|
||||
switch (self->iBinWidth)
|
||||
{ /* Byte swapping is necessary */
|
||||
case 2:
|
||||
/* Not sure how to do this - this might be wrong! */
|
||||
p16 = (SQint16 *) pData;
|
||||
for (i = 0; i < iNoBins; i++)
|
||||
{
|
||||
p16[i] = ntohs (p16[i]);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
p32 = (SQint32 *) pData;
|
||||
for (i = 0; i < iNoBins; i++)
|
||||
{
|
||||
p32[i] = ntohl(p32[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* done */
|
||||
return 1;
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
int SINQHMProject(pSINQHM self, int code, int xStart, int nx,
|
||||
int yStart, int ny,
|
||||
void *pData, int iDataLen)
|
||||
{
|
||||
long lBins2Get, lSpace,iNoBins, i;
|
||||
int status, iRet;
|
||||
struct req_buff_struct Req_buff;
|
||||
struct rply_buff_struct Rply_buff;
|
||||
SQint16 *p16;
|
||||
SQint32 *p32;
|
||||
char *pPtr;
|
||||
char pBuffer[8192];
|
||||
|
||||
assert(self);
|
||||
|
||||
/* initialize the Request data */
|
||||
Req_buff.bigend = htonl (0x12345678);
|
||||
Req_buff.cmnd = htonl (SQHM_PROJECT);
|
||||
Req_buff.u.project.sub_code = htonl (code);
|
||||
|
||||
Req_buff.u.project.x_lo = htonl (xStart);
|
||||
Req_buff.u.project.nx = htonl (nx);
|
||||
Req_buff.u.project.y_lo = htonl (yStart);
|
||||
Req_buff.u.project.ny = htonl (ny);
|
||||
Req_buff.u.project.nhist = htonl (1);
|
||||
|
||||
/* send the message */
|
||||
status = send (self->iClientSocket, (char *) &Req_buff,
|
||||
sizeof (Req_buff), 0);
|
||||
if (status == -1)
|
||||
{
|
||||
return SEND_ERROR;
|
||||
}
|
||||
if (status != sizeof (Req_buff))
|
||||
{
|
||||
return SEND_ERROR;
|
||||
}
|
||||
|
||||
/* wait for an answer */
|
||||
status = recv (self->iClientSocket, (char *) &Rply_buff,
|
||||
sizeof (Rply_buff), MSG_WAITALL);
|
||||
|
||||
/* check various error conditions */
|
||||
if (status == -1)
|
||||
{
|
||||
return RECEIVE_ERROR;
|
||||
}
|
||||
if (status != sizeof (Rply_buff))
|
||||
{
|
||||
return INSUFFICIENT_DATA;
|
||||
}
|
||||
if(ntohl (Rply_buff.bigend) != 0x12345678)
|
||||
{
|
||||
return BYTE_ORDER_CHAOS;
|
||||
}
|
||||
iRet = ntohl(Rply_buff.status);
|
||||
if(iRet != KER__SUCCESS)
|
||||
{
|
||||
return HIST_BAD_CODE;
|
||||
}
|
||||
|
||||
/* calculate the size of things to come */
|
||||
lBins2Get = ntohl(Rply_buff.u.project.n_bins) *
|
||||
ntohl(Rply_buff.u.project.bytes_per_bin);
|
||||
|
||||
/* read data */
|
||||
pPtr = (char *)pData;
|
||||
lSpace = iDataLen;
|
||||
iNoBins = ntohl(Rply_buff.u.project.n_bins);
|
||||
while (lBins2Get > 0)
|
||||
{
|
||||
if(lBins2Get > self->iPacket)
|
||||
{
|
||||
i = self->iPacket;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = lBins2Get;
|
||||
}
|
||||
status = recv (self->iClientSocket, pBuffer,
|
||||
i, 0);
|
||||
if (status == -1)
|
||||
{
|
||||
return SEND_ERROR;
|
||||
}
|
||||
lBins2Get -= status;
|
||||
if((lSpace - status) > 0)
|
||||
{
|
||||
memcpy(pPtr,pBuffer,status);
|
||||
lSpace -= status;
|
||||
pPtr += status;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(lSpace > 0)
|
||||
{
|
||||
memcpy(pPtr,pBuffer,lSpace);
|
||||
lSpace = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* swap bytes if necessary */
|
||||
if ((self->iBinWidth > 0) && (Rply_buff.bigend != 0x12345678))
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#line 346 "sinqhm.w"
|
||||
#line 363 "sinqhm.w"
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
S I N Q H M
|
||||
@ -17,7 +17,7 @@
|
||||
typedef struct __SINQHM *pSINQHM;
|
||||
/*------------------------------ Error codes -----------------------------*/
|
||||
|
||||
#line 324 "sinqhm.w"
|
||||
#line 341 "sinqhm.w"
|
||||
|
||||
#define HMCOMPUTER_NOT_FOUND -2
|
||||
#define SOCKET_ERROR -3
|
||||
@ -39,7 +39,7 @@
|
||||
#define DAQ_INHIBIT -19
|
||||
#define DAQ_NOTSTOPPED -20
|
||||
|
||||
#line 362 "sinqhm.w"
|
||||
#line 379 "sinqhm.w"
|
||||
|
||||
|
||||
/*------------------------------ Prototypes ------------------------------*/
|
||||
@ -50,7 +50,8 @@
|
||||
pSINQHM CopySINQHM(pSINQHM self);
|
||||
void DeleteSINQHM(pSINQHM self);
|
||||
void SINQHMSetPar(pSINQHM self, int iRank, int iLength, int iBinWidth);
|
||||
|
||||
void SINQHMSetPSD(pSINQHM self, int xSize, int xOff, int xFac,
|
||||
int ySize, int yOff, int yFac);
|
||||
|
||||
#line 142 "sinqhm.w"
|
||||
|
||||
@ -89,9 +90,11 @@
|
||||
long SINQHMSize(pSINQHM self, int iNum, int iStart, int iEnd);
|
||||
int SINQHMRead(pSINQHM self, int iNum, int iStart, int iEnd,
|
||||
void *pData, int iDataLen);
|
||||
int SINQHMProject(pSINQHM self, int code, int xStart, int nx,
|
||||
int yStart, int ny, void *pData, int iDataLen);
|
||||
int SINQHMZero(pSINQHM self, int iNum, int iStart, int iEnd);
|
||||
|
||||
#line 365 "sinqhm.w"
|
||||
#line 382 "sinqhm.w"
|
||||
|
||||
|
||||
#line 232 "sinqhm.w"
|
||||
@ -99,6 +102,6 @@
|
||||
int SINQHMDefineBank(pSINQHM self, int iBankNumber, int iStart, int iEnd,
|
||||
float *iEdges, int iEdgeLength);
|
||||
|
||||
#line 366 "sinqhm.w"
|
||||
#line 383 "sinqhm.w"
|
||||
|
||||
#endif
|
||||
|
@ -394,6 +394,8 @@ $\langle$Protos {\footnotesize ?}$\rangle\equiv$
|
||||
\mbox{}\verb@ long SINQHMSize(pSINQHM self, int iNum, int iStart, int iEnd);@\\
|
||||
\mbox{}\verb@ int SINQHMRead(pSINQHM self, int iNum, int iStart, int iEnd, @\\
|
||||
\mbox{}\verb@ void *pData, int iDataLen); @\\
|
||||
\mbox{}\verb@ int SINQHMProject(pSINQHM self, int code, int xStart, int nx,@\\
|
||||
\mbox{}\verb@ int yStart, int ny, void *pData, int iDataLen);@\\
|
||||
\mbox{}\verb@ int SINQHMZero(pSINQHM self, int iNum, int iStart, int iEnd);@\\
|
||||
\mbox{}\verb@@$\diamond$
|
||||
\end{list}
|
||||
@ -432,6 +434,21 @@ SINQHMRead reads histograms. The parameters iNum, iStart and iEnd have the
|
||||
same meaning as with SINQHMWrite. Maximum iDataLen bytes of data are copied
|
||||
to the memory area pointed to by pData.
|
||||
|
||||
SINQHMProject requests a projection of the data from the histogram memory. This
|
||||
is currently only implemented for AMOR because histograms can get so large
|
||||
at this instrument that a transfer for processing would take to long. The
|
||||
parameters are:
|
||||
\begin{description}
|
||||
\item[code] The operation code for project. Can be PROJECT__COLL for
|
||||
collapsing all time channels onto a 2D array and PROJECT__SAMPLE for
|
||||
summing a rectangular region of the histogram memory in time.
|
||||
\item[xStart, nx] start value in x and number of detectors to sum in x direction
|
||||
\item[yStart,ny]start value in y and number of detectors to sum in y direction
|
||||
\item[pData] a pointer to a data array large enough for holding the projected
|
||||
data.
|
||||
\item[iDataLen] The length of pData.
|
||||
\end{description}
|
||||
|
||||
SINQHMZero clears the histogram iNum from iStart to iEnd to 0.
|
||||
A recommended call prior
|
||||
to any serious data aquisition.
|
||||
|
@ -272,6 +272,8 @@ cleared by default.
|
||||
long SINQHMSize(pSINQHM self, int iNum, int iStart, int iEnd);
|
||||
int SINQHMRead(pSINQHM self, int iNum, int iStart, int iEnd,
|
||||
void *pData, int iDataLen);
|
||||
int SINQHMProject(pSINQHM self, int code, int xStart, int nx,
|
||||
int yStart, int ny, void *pData, int iDataLen);
|
||||
int SINQHMZero(pSINQHM self, int iNum, int iStart, int iEnd);
|
||||
@}
|
||||
|
||||
@ -302,6 +304,21 @@ SINQHMRead reads histograms. The parameters iNum, iStart and iEnd have the
|
||||
same meaning as with SINQHMWrite. Maximum iDataLen bytes of data are copied
|
||||
to the memory area pointed to by pData.
|
||||
|
||||
SINQHMProject requests a projection of the data from the histogram memory. This
|
||||
is currently only implemented for AMOR because histograms can get so large
|
||||
at this instrument that a transfer for processing would take to long. The
|
||||
parameters are:
|
||||
\begin{description}
|
||||
\item[code] The operation code for project. Can be PROJECT__COLL for
|
||||
collapsing all time channels onto a 2D array and PROJECT__SAMPLE for
|
||||
summing a rectangular region of the histogram memory in time.
|
||||
\item[xStart, nx] start value in x and number of detectors to sum in x direction
|
||||
\item[yStart,ny]start value in y and number of detectors to sum in y direction
|
||||
\item[pData] a pointer to a data array large enough for holding the projected
|
||||
data.
|
||||
\item[iDataLen] The length of pData.
|
||||
\end{description}
|
||||
|
||||
SINQHMZero clears the histogram iNum from iStart to iEnd to 0.
|
||||
A recommended call prior
|
||||
to any serious data aquisition.
|
||||
|
@ -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 */
|
||||
@ -111,6 +111,10 @@
|
||||
*/
|
||||
#define PROJECT__ON_Y 0x0001 /* Project onto y-axis */
|
||||
#define PROJECT__1_DIM 0x0002 /* Make projection of a 1-dim histogram */
|
||||
#define PROJECT__COLL 0x0003 /* collapse PSD on one time channel */
|
||||
#define PROJECT__SAMPLE 0x0004 /* sum a rectangular part of the PSD
|
||||
detector in time
|
||||
*/
|
||||
/*
|
||||
** ----------------------------------------------------------
|
||||
** Definition of bits in <flag> of TOF edge-array
|
||||
@ -213,6 +217,15 @@
|
||||
#define LWL_TOF_C8 (0x08000000) /* TOF-Mode 8 chan dgrm hdr */
|
||||
#define LWL_TOF_C9 (0x09000000) /* TOF-Mode 9 chan dgrm hdr */
|
||||
|
||||
#define LWL_PSD_TSI 0x0E000000 /* PSD-Mode TSI datagram */
|
||||
#define LWL_PSD_DATA 0x12000000 /* PSD-mode data datagram */
|
||||
#define LWL_PSD_PWF 0x20000000 /* PSD-mode Power Fail bit */
|
||||
#define LWL_PSD_TIME 0x000fffff /* PSD-mode time stamp extraction
|
||||
mask */
|
||||
#define LWL_PSD_FLASH_MASK 0x00ff /* mask for flash count */
|
||||
#define LWL_PSD_XORF 0x2000 /* mask for TDC-XORF bit */
|
||||
#define LWL_PSD_CONF 0x0100 /* mask for TDC-CONF flag */
|
||||
|
||||
#define LWL_SM_NC (0x10000000) /* Strobo-Mode/No-Coinc 0 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C1 (0x11000000) /* Strobo-Mode/No-Coinc 1 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C2 (0x12000000) /* Strobo-Mode/No-Coinc 2 chan dgrm hdr */
|
||||
|
50
histmem.c
50
histmem.c
@ -655,7 +655,7 @@
|
||||
myDim++;
|
||||
}
|
||||
}
|
||||
if(self->pDriv->eHistMode == eHTOF)
|
||||
if(self->pDriv->eHistMode == eHTOF || self->pDriv->eHistMode == ePSD)
|
||||
{
|
||||
iDim[myDim] = self->pDriv->iTimeChan;
|
||||
myDim++;
|
||||
@ -1000,6 +1000,54 @@
|
||||
}
|
||||
memcpy(lData,lHist,iCopy*sizeof(HistInt));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*-------------------------------------------------------------------------*/
|
||||
int GetHistogramDirect(pHistMem self, SConnection *pCon,
|
||||
int i, int iStart, int iEnd, HistInt *lData, int iDataLen)
|
||||
{
|
||||
int ii, iErr, iRet, iCopy;
|
||||
char pBueffel[512], pError[80];
|
||||
HistInt *lHist = NULL;
|
||||
|
||||
assert(self);
|
||||
|
||||
if(!self->iInit)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: histogram memory not initialised",eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(iDataLen < iEnd*sizeof(HistInt))
|
||||
{
|
||||
SCWrite(pCon,"ERROR: Data space mismatch in GetHistogramDirect",
|
||||
eError);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* try at least three times */
|
||||
for(ii = 0; ii < 3; ii++)
|
||||
{
|
||||
iRet = self->pDriv->GetHistogram(self->pDriv,pCon,
|
||||
i,iStart,iEnd,
|
||||
lData);
|
||||
if(iRet == OKOK)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
iRet = self->pDriv->GetError(self->pDriv,&iErr,pError,79);
|
||||
sprintf(pBueffel,"ERROR: %s ",pError);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
iRet = self->pDriv->TryAndFixIt(self->pDriv,iErr);
|
||||
if(iRet == COTERM)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
@ -489,6 +489,9 @@ $\langle$Protos {\footnotesize ?}$\rangle\equiv$
|
||||
\mbox{}\verb@ int GetHistogram(pHistMem self, SConnection *pCon,@\\
|
||||
\mbox{}\verb@ int i,int iStart, int iEnd, HistInt *lData, int iDataLen);@\\
|
||||
\mbox{}\verb@ HistInt *GetHistogramPointer(pHistMem self,SConnection *pCon);@\\
|
||||
\mbox{}\verb@ int GetHistogramDirect(pHistMem self, SConnection *pCon,@\\
|
||||
\mbox{}\verb@ int i, int iStart, int iEnd, @\\
|
||||
\mbox{}\verb@ HistInt *lData, int iDataLen);@\\
|
||||
\mbox{}\verb@ int PresetHistogram(pHistMem self, SConnection *pCon, HistInt lVal);@\\
|
||||
\mbox{}\verb@@$\diamond$
|
||||
\end{list}
|
||||
@ -515,6 +518,11 @@ initialises the HM from the lData provided. GetHistogram reads an histogram
|
||||
into lData but maximum iDataLen items. PresetHistogram presets the HM to the
|
||||
value lVal. Can be used to clear the HM.
|
||||
|
||||
GetHistogram and GetHistogramPointer try to buffer the data when
|
||||
possible and configured. The configuration happens through the
|
||||
definition of an update intervall. GetHistogramDirect never buffers
|
||||
but goes for the histogram memory directly.
|
||||
|
||||
The histogram memory object buffers the histograms for a adjustable
|
||||
period of time. GetHistogramPointer retrieves a pointer to the local
|
||||
histogram buffer. It also makes sure, that the histogram has been
|
||||
|
@ -379,6 +379,9 @@ histogram memory:
|
||||
int GetHistogram(pHistMem self, SConnection *pCon,
|
||||
int i,int iStart, int iEnd, HistInt *lData, int iDataLen);
|
||||
HistInt *GetHistogramPointer(pHistMem self,SConnection *pCon);
|
||||
int GetHistogramDirect(pHistMem self, SConnection *pCon,
|
||||
int i, int iStart, int iEnd,
|
||||
HistInt *lData, int iDataLen);
|
||||
int PresetHistogram(pHistMem self, SConnection *pCon, HistInt lVal);
|
||||
@}
|
||||
For histogram I/O the following aproach has been taken: Histograms are kept
|
||||
@ -396,6 +399,11 @@ initialises the HM from the lData provided. GetHistogram reads an histogram
|
||||
into lData but maximum iDataLen items. PresetHistogram presets the HM to the
|
||||
value lVal. Can be used to clear the HM.
|
||||
|
||||
GetHistogram and GetHistogramPointer try to buffer the data when
|
||||
possible and configured. The configuration happens through the
|
||||
definition of an update intervall. GetHistogramDirect never buffers
|
||||
but goes for the histogram memory directly.
|
||||
|
||||
The histogram memory object buffers the histograms for a adjustable
|
||||
period of time. GetHistogramPointer retrieves a pointer to the local
|
||||
histogram buffer. It also makes sure, that the histogram has been
|
||||
|
28
nserver.c
28
nserver.c
@ -233,6 +233,15 @@
|
||||
/* install a secret fully priviledged entry point for ME */
|
||||
AddUser("Achterbahn","Kiel",usInternal);
|
||||
|
||||
/* install environment monitor */
|
||||
self->pMonitor = GetEnvMon(self->pSics);
|
||||
TaskRegister(self->pTasker,
|
||||
EnvMonTask,
|
||||
EnvMonSignal,
|
||||
NULL,
|
||||
self->pMonitor,1);
|
||||
|
||||
|
||||
/* initialize the last saved status of the system */
|
||||
strcpy(pBueffel,"Restore ");
|
||||
pText = IFindOption(pSICSOptions,"statusfile");
|
||||
@ -246,15 +255,14 @@
|
||||
IFAddOption(pSICSOptions,"statusfile",
|
||||
DEFAULTSTATUSFILE);
|
||||
}
|
||||
pCon = SCCreateDummyConnection(self->pSics);
|
||||
self->dummyCon = pCon = SCCreateDummyConnection(self->pSics);
|
||||
if(pCon)
|
||||
{
|
||||
InterpExecute(self->pSics,pCon,pBueffel);
|
||||
SCDeleteConnection(pCon);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("ERROR: Cannot allocate dummy connection, status NOT saved");
|
||||
printf("ERROR: Cannot allocate dummy connection, status NOT loaded");
|
||||
}
|
||||
|
||||
/* install performance monitor */
|
||||
@ -266,13 +274,6 @@
|
||||
NULL,
|
||||
pMon,1);
|
||||
|
||||
/* install environment monitor */
|
||||
self->pMonitor = GetEnvMon(self->pSics);
|
||||
TaskRegister(self->pTasker,
|
||||
EnvMonTask,
|
||||
EnvMonSignal,
|
||||
NULL,
|
||||
self->pMonitor,1);
|
||||
|
||||
/* install telnet port */
|
||||
InstallTelnet();
|
||||
@ -313,11 +314,10 @@
|
||||
{
|
||||
strcat(pBueffel,DEFAULTSTATUSFILE);
|
||||
}
|
||||
pCon = SCCreateDummyConnection(self->pSics);
|
||||
if(pCon)
|
||||
if(self->dummyCon)
|
||||
{
|
||||
InterpExecute(self->pSics,pCon,pBueffel);
|
||||
SCDeleteConnection(pCon);
|
||||
InterpExecute(self->pSics,self->dummyCon,pBueffel);
|
||||
SCDeleteConnection(self->dummyCon);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
mkChannel *pServerPort;
|
||||
pNetRead pReader;
|
||||
int simMode;
|
||||
SConnection *dummyCon;
|
||||
} SicsServer;
|
||||
|
||||
|
||||
|
137
nxamor.c
137
nxamor.c
@ -8,6 +8,7 @@
|
||||
|
||||
|
||||
Mark Koennecke, September 1999
|
||||
Updated, Mark Koennecke, August 2001
|
||||
--------------------------------------------------------------------------*/
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
@ -20,6 +21,12 @@
|
||||
#include "HistMem.h"
|
||||
#include "counter.h"
|
||||
#include "nxamor.h"
|
||||
#include "obpar.h"
|
||||
#include "motor.h"
|
||||
|
||||
#define MAXMOT 13 /* must be same as in amor2t.c */
|
||||
#include "amor2t.i"
|
||||
#include "amor2t.h"
|
||||
|
||||
/* some defines for some names */
|
||||
#define AMORDICT "amor.dic"
|
||||
@ -27,19 +34,18 @@
|
||||
#define SOURCENAME "Spallation source SINQ"
|
||||
#define SOURCETYPE "Continous flux spallation source"
|
||||
#define CHOPPERNAME "Dornier Chopper System"
|
||||
|
||||
/*
|
||||
this is the real detector size, the one in the dictionary will be
|
||||
updated from this!
|
||||
a pointer to amor2t which we need for a couple of parameters
|
||||
*/
|
||||
#define DETSIZE 128
|
||||
pAmor2T pAmor = NULL;
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
static void WriteDiaphragm(NXhandle hfil, NXdict hdict, int i,
|
||||
SConnection *pCon)
|
||||
{
|
||||
char pThing[30];
|
||||
|
||||
sprintf(pThing,"d%1.1ddist",i);
|
||||
SNXSPutVariable(pServ->pSics,pCon,hfil, hdict,pThing,pThing);
|
||||
|
||||
sprintf(pThing,"d%1.1dt",i);
|
||||
SNXSPutMotor(pServ->pSics,pCon,hfil,hdict,pThing,pThing);
|
||||
@ -56,7 +62,7 @@
|
||||
NXhandle hfil;
|
||||
NXdict hdict;
|
||||
int iRet;
|
||||
char pBueffel[512];
|
||||
char pBueffel[512], pThing[80];
|
||||
CounterMode eMode;
|
||||
CommandList *pCom = NULL;
|
||||
float fVal;
|
||||
@ -105,6 +111,8 @@
|
||||
|
||||
/* first Diaphragm */
|
||||
WriteDiaphragm(hfil,hdict,1,pCon);
|
||||
sprintf(pThing,"d%1.1ddist",1);
|
||||
SNXSPutVariable(pServ->pSics,pCon,hfil, hdict,pThing,pThing);
|
||||
|
||||
/* polarizing, monochromating mirror */
|
||||
SNXSPutVariable(pServ->pSics,pCon,hfil, hdict,"polname",
|
||||
@ -118,9 +126,13 @@
|
||||
|
||||
/* second Diaphragm */
|
||||
WriteDiaphragm(hfil,hdict,2,pCon);
|
||||
sprintf(pThing,"d%1.1ddist",2);
|
||||
SNXSPutVariable(pServ->pSics,pCon,hfil, hdict,pThing,pThing);
|
||||
|
||||
/* third Diaphragm */
|
||||
WriteDiaphragm(hfil,hdict,3,pCon);
|
||||
sprintf(pThing,"d%1.1ddist",3);
|
||||
SNXSPutVariable(pServ->pSics,pCon,hfil, hdict,pThing,pThing);
|
||||
|
||||
/* sample table */
|
||||
SNXSPutVariable(pServ->pSics,pCon,hfil, hdict,"saname",
|
||||
@ -131,9 +143,16 @@
|
||||
SNXSPutMotor(pServ->pSics,pCon,hfil,hdict,"schi","sch");
|
||||
SNXSPutMotor(pServ->pSics,pCon,hfil,hdict,"somega","som");
|
||||
SNXSPutMotor(pServ->pSics,pCon,hfil,hdict,"stheight","soz");
|
||||
fVal = ObVal(pAmor->aParameter,PARDH);
|
||||
NXDputalias(hfil,hdict,"baseheight",&fVal);
|
||||
|
||||
|
||||
/* fourth Diaphragm */
|
||||
WriteDiaphragm(hfil,hdict,4,pCon);
|
||||
fVal = ObVal(pAmor->aParameter,PARDD4);
|
||||
NXDputalias(hfil,hdict,"d4dist",&fVal);
|
||||
fVal = ObVal(pAmor->aParameter,PARD4H);
|
||||
NXDputalias(hfil,hdict,"d4base",&fVal);
|
||||
|
||||
/* analyzer */
|
||||
SNXSPutVariable(pServ->pSics,pCon,hfil, hdict,"anname",
|
||||
@ -143,9 +162,18 @@
|
||||
SNXSPutMotor(pServ->pSics,pCon,hfil,hdict,"anoz","atz");
|
||||
SNXSPutMotor(pServ->pSics,pCon,hfil,hdict,"anom","aom");
|
||||
SNXSPutMotor(pServ->pSics,pCon,hfil,hdict,"antz","aoz");
|
||||
fVal = ObVal(pAmor->aParameter,PARADIS);
|
||||
NXDputalias(hfil,hdict,"adis",&fVal);
|
||||
fVal = ObVal(pAmor->aParameter,PARANA);
|
||||
NXDputalias(hfil,hdict,"abase",&fVal);
|
||||
|
||||
|
||||
/* fifth Diaphragm!!!!!!!!! */
|
||||
WriteDiaphragm(hfil,hdict,5,pCon);
|
||||
fVal = ObVal(pAmor->aParameter,PARDD5);
|
||||
NXDputalias(hfil,hdict,"d5dist",&fVal);
|
||||
fVal = ObVal(pAmor->aParameter,PARD5H);
|
||||
NXDputalias(hfil,hdict,"d5base",&fVal);
|
||||
|
||||
/* counting data */
|
||||
pCom = FindCommand(pServ->pSics,"counter");
|
||||
@ -205,10 +233,6 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* write general detector data */
|
||||
SNXSPutVariable(pServ->pSics,pCon,hfil, hdict,"sdetdist",
|
||||
"detectordist");
|
||||
|
||||
|
||||
/* allocate memory for writing scan data */
|
||||
fAxis = (float *)malloc(pScan->iNP*sizeof(float));
|
||||
@ -313,6 +337,7 @@
|
||||
CommandList *pCom = NULL;
|
||||
const float *fTime;
|
||||
HistInt *lData = NULL, lVal;
|
||||
int detxsize, detysize, iDim[MAXDIM];
|
||||
|
||||
|
||||
/* open files */
|
||||
@ -331,9 +356,6 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* write general detector data */
|
||||
SNXSPutVariable(pServ->pSics,pCon,hfil, hdict,"detdist",
|
||||
"detectordist");
|
||||
|
||||
/* a few motors which may or may not be useful */
|
||||
SNXSPutMotor(pServ->pSics,pCon,hfil,hdict,"detx","cox");
|
||||
@ -363,26 +385,51 @@
|
||||
SCWrite(pCon,"WARNING: failed to find counter!",eWarning);
|
||||
}
|
||||
|
||||
/*
|
||||
find dimensions of detector
|
||||
*/
|
||||
GetHistDim(pHM,iDim,&iLength);
|
||||
detxsize = iDim[0];
|
||||
detysize = iDim[1];
|
||||
/* update detector size */
|
||||
sprintf(pBueffel,"%d",detxsize);
|
||||
NXDupdate(hdict,"detxsize",pBueffel);
|
||||
sprintf(pBueffel,"%d",detysize);
|
||||
NXDupdate(hdict,"detysize",pBueffel);
|
||||
|
||||
|
||||
/* write two axis */
|
||||
fAxis = (float *)malloc(DETSIZE*sizeof(float));
|
||||
if(detxsize > detysize)
|
||||
iLength = detxsize;
|
||||
else
|
||||
iLength = detysize;
|
||||
|
||||
fAxis = (float *)malloc(iLength*sizeof(float));
|
||||
if(!fAxis)
|
||||
{
|
||||
SCWrite(pCon,"ERROR: out of memory in WriteAmorTOF",eError);
|
||||
return 0;
|
||||
}
|
||||
for(i = 0; i < DETSIZE; i++)
|
||||
for(i = 0; i < detxsize; i++)
|
||||
{
|
||||
fAxis[i] = (float)i;
|
||||
}
|
||||
NXDputalias(hfil,hdict,"detxx",fAxis);
|
||||
for(i = 0; i < detysize; i++)
|
||||
{
|
||||
fAxis[i] = (float)i;
|
||||
}
|
||||
NXDputalias(hfil,hdict,"dety",fAxis);
|
||||
NXDaliaslink(hfil,hdict,"dana","detxx");
|
||||
NXDaliaslink(hfil,hdict,"dana","dety");
|
||||
free(fAxis);
|
||||
|
||||
/* update detector size */
|
||||
sprintf(pBueffel,"%d",DETSIZE);
|
||||
NXDupdate(hdict,"detsize",pBueffel);
|
||||
|
||||
/* add height and distances */
|
||||
fVal = ObVal(pAmor->aParameter,PARDS);
|
||||
NXDputalias(hfil,hdict,"detdist",&fVal);
|
||||
fVal = ObVal(pAmor->aParameter,PARDDH);
|
||||
NXDputalias(hfil,hdict,"detbase",&fVal);
|
||||
|
||||
|
||||
/* deal with time binning */
|
||||
@ -397,6 +444,7 @@
|
||||
sprintf(pBueffel,"%d",iLength);
|
||||
NXDupdate(hdict,"timebin",pBueffel);
|
||||
NXDputalias(hfil,hdict,"dettime",fTime2);
|
||||
NXDputalias(hfil,hdict,"singletime",fTime2);
|
||||
NXDaliaslink(hfil,hdict,"dana","dettime");
|
||||
free(fTime2);
|
||||
fTime2 = NULL;
|
||||
@ -408,7 +456,9 @@
|
||||
}
|
||||
|
||||
/* finally get histogram */
|
||||
iLength = GetHistLength(pHM);
|
||||
if(iDim[2] == 2) /* 2D data, no time binning on this detector */
|
||||
{
|
||||
iLength = detxsize*detysize;
|
||||
lData = (HistInt *)malloc(iLength*sizeof(HistInt));
|
||||
if(!lData)
|
||||
{
|
||||
@ -418,9 +468,35 @@
|
||||
}
|
||||
memset(lData,0,iLength*sizeof(HistInt));
|
||||
GetHistogram(pHM,pCon, 0,0,iLength,lData,iLength*sizeof(HistInt));
|
||||
NXDputalias(hfil,hdict,"spinup2d",lData);
|
||||
NXDaliaslink(hfil,hdict,"dana","spinup2d");
|
||||
}
|
||||
else
|
||||
{
|
||||
iLength = iDim[0]*iDim[1]*iDim[2];
|
||||
lData = (HistInt *)malloc(iLength*sizeof(HistInt));
|
||||
if(!lData)
|
||||
{
|
||||
SCWrite(pCon,
|
||||
"ERROR: out of memory, failed to write histogram",eError);
|
||||
return 0;
|
||||
}
|
||||
memset(lData,0,iLength*sizeof(HistInt));
|
||||
GetHistogramDirect(pHM,pCon,
|
||||
0,0,iLength,lData,iLength*sizeof(HistInt));
|
||||
NXDputalias(hfil,hdict,"spinup",lData);
|
||||
NXDaliaslink(hfil,hdict,"dana","spinup");
|
||||
|
||||
/*
|
||||
now get and write single detectors
|
||||
*/
|
||||
GetHistogramDirect(pHM,pCon,0,iLength,2*iDim[2],
|
||||
lData, iLength*sizeof(HistInt));
|
||||
NXDputalias(hfil,hdict,"singleup",lData);
|
||||
NXDaliaslink(hfil,hdict,"singledana","singleup");
|
||||
NXDaliaslink(hfil,hdict,"singledana","singletime");
|
||||
}
|
||||
|
||||
/* to do: add polarizing code */
|
||||
|
||||
free(lData);
|
||||
@ -459,7 +535,7 @@
|
||||
char pBueffel[512];
|
||||
int iRet;
|
||||
|
||||
if(argc < 2)
|
||||
if(argc < 3)
|
||||
{
|
||||
SCWrite(pCon,
|
||||
"ERROR: insufficient number of arguments to AmorStoreMake",
|
||||
@ -467,7 +543,7 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* we need one parameter which is the name of the histogram memory*/
|
||||
/* we need a parameter which is the name of the histogram memory*/
|
||||
pCom = FindCommand(pServ->pSics,argv[1]);
|
||||
if(!pCom)
|
||||
{
|
||||
@ -483,6 +559,25 @@
|
||||
}
|
||||
pMeme = (pHistMem)pCom->pData;
|
||||
|
||||
/* we need another parameter which is the name of the
|
||||
2theta calculation module
|
||||
*/
|
||||
pCom = FindCommand(pServ->pSics,argv[2]);
|
||||
if(!pCom)
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: amor2T module %s NOT found", argv[2]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
if(!pCom->pData)
|
||||
{
|
||||
sprintf(pBueffel,"ERROR: amor2t module %s NOT found", argv[2]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
pAmor = (pAmor2T)pCom->pData;
|
||||
|
||||
|
||||
/* install command */
|
||||
iRet = AddCommand(pSics,"storeamor",
|
||||
AmorStore,NULL,NULL);
|
||||
|
@ -1,5 +1,5 @@
|
||||
hm3 CountMode timer
|
||||
hm3 preset 2.000000
|
||||
hm3 preset 10.000000
|
||||
hm2 CountMode timer
|
||||
hm2 preset 2.000000
|
||||
hm1 CountMode timer
|
||||
@ -50,9 +50,9 @@ ch SoftZero 0.000000
|
||||
ch SoftLowerLim 0.000000
|
||||
ch SoftUpperLim 360.000000
|
||||
ch Fixed -1.000000
|
||||
ch sign 1.000000
|
||||
ch sign 0.500000
|
||||
ch InterruptMode 0.000000
|
||||
ch AccessCode 2.000000
|
||||
ch AccessCode 1.000000
|
||||
# Motor ph
|
||||
ph SoftZero 0.000000
|
||||
ph SoftLowerLim -360.000000
|
||||
@ -106,9 +106,9 @@ chi SoftZero 0.000000
|
||||
chi SoftLowerLim 0.000000
|
||||
chi SoftUpperLim 360.000000
|
||||
chi Fixed -1.000000
|
||||
chi sign 1.000000
|
||||
chi sign 0.500000
|
||||
chi InterruptMode 0.000000
|
||||
chi AccessCode 2.000000
|
||||
chi AccessCode 1.000000
|
||||
# Motor omega
|
||||
omega SoftZero 0.000000
|
||||
omega SoftLowerLim -73.000000
|
||||
@ -147,7 +147,7 @@ som SoftUpperLim 360.000000
|
||||
som Fixed -1.000000
|
||||
som sign 1.000000
|
||||
som InterruptMode 0.000000
|
||||
som AccessCode 2.000000
|
||||
som AccessCode 0.000000
|
||||
# Motor sax
|
||||
sax SoftZero 0.000000
|
||||
sax SoftLowerLim -30.000000
|
||||
@ -387,7 +387,7 @@ a3 SoftUpperLim 360.000000
|
||||
a3 Fixed -1.000000
|
||||
a3 sign 1.000000
|
||||
a3 InterruptMode 0.000000
|
||||
a3 AccessCode 2.000000
|
||||
a3 AccessCode 0.000000
|
||||
# Motor a2
|
||||
a2 SoftZero 0.000000
|
||||
a2 SoftLowerLim -73.000000
|
||||
@ -404,11 +404,11 @@ a1 Fixed -1.000000
|
||||
a1 sign 1.000000
|
||||
a1 InterruptMode 0.000000
|
||||
a1 AccessCode 2.000000
|
||||
user Daniel_the_Clementine
|
||||
user Uwe Filges
|
||||
user setAccess 2
|
||||
sample DanielOxid
|
||||
sample test
|
||||
sample setAccess 2
|
||||
title TopsiTupsiTapsi
|
||||
title uwe_test1
|
||||
title setAccess 2
|
||||
starttime 2001-07-19 15:11:21
|
||||
starttime setAccess 2
|
||||
|
@ -24,6 +24,9 @@
|
||||
#define MAX_TOF_CNTR 1024 /* The maximum number of individual counters ..
|
||||
** which can be handled in TOF mode */
|
||||
#define MAX_PSD_CNTR 1048576 /* maximum number of PSD elements */
|
||||
#define MAX_PSD_ED 2 /* maximum number of additional
|
||||
single detectors at AMOR
|
||||
*/
|
||||
#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 */
|
||||
@ -111,6 +114,10 @@
|
||||
*/
|
||||
#define PROJECT__ON_Y 0x0001 /* Project onto y-axis */
|
||||
#define PROJECT__1_DIM 0x0002 /* Make projection of a 1-dim histogram */
|
||||
#define PROJECT__COLL 0x0003 /* collapse PSD on one time channel */
|
||||
#define PROJECT__SAMPLE 0x0004 /* sum a rectangular part of the PSD
|
||||
detector in time
|
||||
*/
|
||||
/*
|
||||
** ----------------------------------------------------------
|
||||
** Definition of bits in <flag> of TOF edge-array
|
||||
@ -215,12 +222,14 @@
|
||||
|
||||
#define LWL_PSD_TSI 0x0E000000 /* PSD-Mode TSI datagram */
|
||||
#define LWL_PSD_DATA 0x12000000 /* PSD-mode data datagram */
|
||||
#define LWL_PSD_ED 0x03000000 /* PSD-mode single detector datagram */
|
||||
#define LWL_PSD_PWF 0x20000000 /* PSD-mode Power Fail bit */
|
||||
#define LWL_PSD_TIME 0x000fffff /* PSD-mode time stamp extraction
|
||||
mask */
|
||||
#define LWL_PSD_FLASH_MASK 0x00ff /* mask for flash count */
|
||||
#define LWL_PSD_XORF 0x2000 /* mask for TDC-XORF bit */
|
||||
#define LWL_PSD_CONF 0x0100 /* mask for TDC-CONF flag */
|
||||
#define LWL_HDR_ED_MASK 0x1C000000 /* mask for extracting ds4-ds2 */
|
||||
|
||||
#define LWL_SM_NC (0x10000000) /* Strobo-Mode/No-Coinc 0 chan dgrm hdr */
|
||||
#define LWL_SM_NC_C1 (0x11000000) /* Strobo-Mode/No-Coinc 1 chan dgrm hdr */
|
||||
|
@ -731,9 +731,9 @@
|
||||
uint ui4;
|
||||
usint ui2[2];
|
||||
uchar ui1[4];
|
||||
} lwl_hdr, xData, yData;
|
||||
} lwl_hdr, xData, yData, edData;
|
||||
|
||||
int xPos, yPos, iTime, dataPos;
|
||||
int xPos, yPos, iTime, dataPos, edNum;
|
||||
signed int sPosx, sPosy;
|
||||
int i, j, is, ts, left, right, middl, not_finished;
|
||||
uint *edge_pntr;
|
||||
@ -868,6 +868,122 @@
|
||||
*/
|
||||
dataPos = yPos*psdXSize*Tof_edges[0]->n_bins +
|
||||
xPos*Tof_edges[0]->n_bins + middl;
|
||||
|
||||
/* UD must come but the bit is not yet defined
|
||||
if ((Hm_mode_UD != 0) &&
|
||||
((lwl_hdr.ui4 & LWL_HDR_UD_MASK) != 0)) {
|
||||
dataPos +=
|
||||
(psdXSize*psdYSize+MAX_PSD_ED)*Tof_edges[0]->n_bins ;
|
||||
}
|
||||
*/
|
||||
switch(Bytes_per_bin)
|
||||
{
|
||||
case 1:
|
||||
histcPtr[dataPos]++;
|
||||
break;
|
||||
case 2:
|
||||
histsPtr[dataPos]++;
|
||||
break;
|
||||
case 4:
|
||||
histlPtr[dataPos]++;
|
||||
break;
|
||||
}
|
||||
|
||||
VmioBase[VMIO_PORT_A] = 0x00; /* Reset timer level (if present) */
|
||||
N_events++;
|
||||
}else if ( (lwl_hdr.ui4 & LWL_HDR_ED_MASK) == 0) {
|
||||
/*
|
||||
we have located a single detector packet from AMOR. We need to
|
||||
read the detector number
|
||||
*/
|
||||
VmioBase[VMIO_PORT_A] = 0xff; /* Set timer level (if present) */
|
||||
|
||||
for (i=0; i<1000; i++) {
|
||||
edData.ui4 = *Lwl_fifo; /* Get the detector number */
|
||||
if (edData.ui4 != LWL_FIFO_EMPTY) break;
|
||||
taskDelay (0); /* But wait if FIFO is slow! */
|
||||
}
|
||||
if (xData.ui4 == LWL_FIFO_EMPTY) {
|
||||
printf ("Time-out getting detector number !\n");
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
check if data aquisition is active
|
||||
*/
|
||||
if ((lwl_hdr.ui4 & Lwl_hdr_daq_mask) != Lwl_hdr_daq_soll) {
|
||||
/* Some header bits are not what they should be (e.g. NRL
|
||||
** ow PWF may be set) so skip the event.
|
||||
*/
|
||||
N_skipped++;
|
||||
if (Dbg_lev1) {
|
||||
printf("Skipped header: 0x%08x\n"
|
||||
" Mask: 0x%08x\n"
|
||||
" Soll: 0x%08x\n",
|
||||
lwl_hdr.ui4, Lwl_hdr_daq_mask, Lwl_hdr_daq_soll);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
We have a valid single detector packet.
|
||||
*/
|
||||
edNum = edData.ui2[1];
|
||||
if(edNum < 0 || edNum >= MAX_PSD_ED){
|
||||
printf("Got invalid detector number %d\n",edNum);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
Extract time stamp and match to the appropriate time bin.
|
||||
*/
|
||||
iTime = lwl_hdr.ui4 & LWL_PSD_TIME;
|
||||
if(Dbg_lev1){
|
||||
printf("Received single detector hit at no, time: %d, %d\n",
|
||||
edNum, iTime);
|
||||
}
|
||||
|
||||
edge_pntr = Tof_edges[0]->edges;
|
||||
left = 0;
|
||||
right = Tof_edges[0]->n_bins;
|
||||
middl = (left + right)/2;
|
||||
not_finished = True;
|
||||
iTime -= Tof_dts_soll;
|
||||
while (not_finished) {
|
||||
switch (right - left) {
|
||||
case 0:
|
||||
not_finished = False;
|
||||
break;
|
||||
case 1:
|
||||
middl = (iTime >= edge_pntr[right]) ? right : left;
|
||||
not_finished = False;
|
||||
break;
|
||||
default:
|
||||
middl = (left + right)/2;
|
||||
if (iTime == edge_pntr[middl]) {
|
||||
not_finished = False;
|
||||
}else if (iTime > edge_pntr[middl]) {
|
||||
left = middl;
|
||||
}else {
|
||||
right = middl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Dbg_lev1){
|
||||
printf("Matched time stamp %d into bin %d\n", iTime,middl);
|
||||
}
|
||||
|
||||
/*
|
||||
calculate histogram position to update
|
||||
*/
|
||||
dataPos = (psdYSize*psdXSize + edNum)*Tof_edges[0]->n_bins + middl;
|
||||
|
||||
/* UD must come but the UD bit is not defined......
|
||||
if ((Hm_mode_UD != 0) &&
|
||||
((lwl_hdr.ui4 & LWL_HDR_UD_MASK) != 0)) {
|
||||
dataPos +=
|
||||
(psdXSize*psdYSize+MAX_PSD_ED)*Tof_edges[0]->n_bins ;
|
||||
}
|
||||
*/
|
||||
|
||||
switch(Bytes_per_bin)
|
||||
{
|
||||
case 1:
|
||||
|
@ -21,6 +21,8 @@
|
||||
** 1B01 11-Jun-1999 DM Add SQHM__HRPT mode.
|
||||
** 1B02 10-Aug-1999 DM Make Lwl_hdr_daq_mask/Lwl_hdr_daq_soll dependent
|
||||
** on the instrument.
|
||||
** 1B03 May-2001 MK Added code for AMOR/TRICS PSD
|
||||
** 1B04 August 2001 MK Added code for AMOR to PROJECT handling
|
||||
**---------------------------------------------------------------------------
|
||||
** SinqHM_srv_routines.c is part of the SINQ Histogram Memory process
|
||||
** which will run in a front-end processor and perform the necessary
|
||||
@ -1555,44 +1557,14 @@
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
Total_bytes += (n_cntrs * n_bins * bytes_per_bin);
|
||||
if (Hm_mode_UD != 0) Total_bytes += (n_cntrs * n_bins * bytes_per_bin);
|
||||
|
||||
/* This is useful,but a waste of memory for a PSD. It would need
|
||||
2.6MB. Let us try if we can live without it.
|
||||
for (j = first; j < (first + n_cntrs); j++) {
|
||||
if (Tof_descr[j] != NULL) {
|
||||
printf ("do_SQHM__PSD_alloc: Doubly defined counter: %d.\n",
|
||||
(j));
|
||||
rply_status_setup (reply, KER__BAD_VALUE, 0, "Doubly defined counter");
|
||||
free_HM_memory (NULL);
|
||||
if (n_extra_bytes != 0) free (my_rqst);
|
||||
return ERROR;
|
||||
}
|
||||
Tof_descr[j] = calloc (1, sizeof (struct tof_histog));
|
||||
if (Tof_descr[j] == NULL) {
|
||||
printf ("do_SQHM__PSD_alloc: unable to alloc memory for "
|
||||
"histogram structure.\n");
|
||||
rply_status_setup (reply, KER__BAD_ALLOC, 0,
|
||||
"Failed to get buffer for Tof_descr structure");
|
||||
free_HM_memory (NULL);
|
||||
if (n_extra_bytes != 0) free (my_rqst);
|
||||
return ERROR;
|
||||
}
|
||||
Tof_descr[j]->cntr_nmbr = first + j;
|
||||
Tof_descr[j]->lo_edge = edge_info_pntr->edges[0];
|
||||
Tof_descr[j]->hi_edge = edge_info_pntr->hi_edge;
|
||||
Tof_descr[j]->flag = flag;
|
||||
Tof_descr[j]->bytes_per_bin = bytes_per_bin;
|
||||
Tof_descr[j]->n_bins = n_bins;
|
||||
Tof_descr[j]->cnt_early_up = 0;
|
||||
Tof_descr[j]->cnt_late_up = 0;
|
||||
Tof_descr[j]->cnt_early_down = 0;
|
||||
Tof_descr[j]->cnt_late_down = 0;
|
||||
Tof_descr[j]->bin_edge = edge_info_pntr->edges;
|
||||
Tof_descr[j]->u.b_bin_data = NULL;
|
||||
}
|
||||
/*
|
||||
here there is a tricky bit: AMOR has two additional single
|
||||
detectors which need to be binned. They are appended after the
|
||||
normal PSD-histogram
|
||||
*/
|
||||
Total_bytes += ((n_cntrs + MAX_PSD_ED) * n_bins * bytes_per_bin);
|
||||
if (Hm_mode_UD != 0)
|
||||
Total_bytes += ((n_cntrs + MAX_PSD_ED) * n_bins * bytes_per_bin);
|
||||
|
||||
if (i == 0) { /* Use the first counter bank to define some .. */
|
||||
N_hists = n_cntrs; /* .. globals since we expect there usually to .. */
|
||||
@ -1629,17 +1601,6 @@
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* as wee decided not to use Tof_descr, this is surplus as well.
|
||||
nxt_hist_addr = Hist_base_addr;
|
||||
for (i = 0; i < MAX_PSD_CNTR; i++) {
|
||||
if (Tof_descr[i] != NULL) {
|
||||
Tof_descr[i]->u.b_bin_data = nxt_hist_addr;
|
||||
j = Tof_descr[i]->n_bins * Tof_descr[i]->bytes_per_bin;
|
||||
if (Hm_mode_UD != 0) j = j * 2;
|
||||
nxt_hist_addr += j;
|
||||
}
|
||||
}
|
||||
*/
|
||||
Cnts_lo = Cnts_hi = 0;
|
||||
N_events = N_skipped = N_no_coin_tsi = N_coin_tsi = 0;
|
||||
Print_hdr = True;
|
||||
@ -2240,7 +2201,7 @@
|
||||
** Read a "rectangular" region of Hist Mem and send it
|
||||
** to the client.
|
||||
*/
|
||||
register int i, j, offs;
|
||||
register int i, j, k, offs, dataPtr, nTime;
|
||||
register uint my_bin_lo, my_bin_hi;
|
||||
register uint my_hist_lo, my_hist_hi;
|
||||
|
||||
@ -2402,6 +2363,35 @@
|
||||
** All the arguments are OK. Drop through to common code
|
||||
** for reserving buffer space.
|
||||
*/
|
||||
break;
|
||||
case SQHM__HM_PSD:
|
||||
/*
|
||||
** code for TRICS, AMOR PSD
|
||||
*/
|
||||
if(sub_code == PROJECT__COLL){
|
||||
my_nbins = psdXSize * psdYSize;
|
||||
nTime = Tof_edges[0]->n_bins;
|
||||
} else if(sub_code == PROJECT__SAMPLE) {
|
||||
if(x_lo < 0 || x_lo + nx > psdXSize){
|
||||
printf ("\n\007%s -- SQHM_PROJECT:Bad x_range lo %d, n %d,max %d\n",
|
||||
Tsk_name[index], x_lo,nx,psdXSize);
|
||||
is = rply_status_send (rw_skt, rply_bf);
|
||||
return OK;
|
||||
}
|
||||
if(y_lo < 0 || y_lo + ny > psdYSize){
|
||||
printf ("\n\007%s -- SQHM_PROJECT:Bad y_range lo %d, n %d,max %d\n",
|
||||
Tsk_name[index], y_lo,ny,psdYSize);
|
||||
is = rply_status_send (rw_skt, rply_bf);
|
||||
return OK;
|
||||
}
|
||||
my_nbins = Tof_edges[0]->n_bins;
|
||||
nTime = Tof_edges[0]->n_bins;
|
||||
} else {
|
||||
printf ("\n\007%s -- SQHM_PROJECT:Bad subcode for PSD\n",
|
||||
Tsk_name[index]);
|
||||
is = rply_status_send (rw_skt, rply_bf);
|
||||
return OK;
|
||||
}
|
||||
break;
|
||||
/*-----------------------------------------------------------*/
|
||||
default: /* SQHM_PROJECT is not supported in other modes. */
|
||||
@ -2417,8 +2407,11 @@
|
||||
** need for the projection depends on whether the
|
||||
** projection is onto the x-axis or y-axis.
|
||||
*/
|
||||
|
||||
if(Hm_mode != SQHM__HM_PSD){
|
||||
my_nbins = ((sub_code & PROJECT__ON_Y) == 0) ?
|
||||
(my_bin_hi - my_bin_lo + 1) : (my_hist_hi - my_hist_lo + 1);
|
||||
}
|
||||
|
||||
my_pntr.base = calloc (my_nbins, sizeof (uint));
|
||||
if (my_pntr.base == NULL) {
|
||||
@ -2521,6 +2514,52 @@
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SQHM__HM_PSD:
|
||||
/*
|
||||
** code for TRICS/AMOR PSD
|
||||
**
|
||||
*/
|
||||
if(sub_code == PROJECT__COLL){
|
||||
hm_pntr.base = Hist_base_addr;
|
||||
for(i = 0; i < psdXSize; i++){
|
||||
for(j = 0; j < psdYSize; j++){
|
||||
offs = j * psdXSize + i;
|
||||
dataPtr = j*psdXSize*nTime + i*nTime;
|
||||
my_pntr.i4[offs] = 0;
|
||||
for(k = 0; k < nTime; k++){
|
||||
switch(Bytes_per_bin)
|
||||
{
|
||||
case 1:
|
||||
my_pntr.i4[offs] += hm_pntr.ch[dataPtr + k];
|
||||
break;
|
||||
case 2:
|
||||
my_pntr.i4[offs] += hm_pntr.i2[dataPtr + k];
|
||||
break;
|
||||
case 4:
|
||||
my_pntr.i4[offs] += hm_pntr.i4[dataPtr + k];
|
||||
if(hm_pntr.i4[dataPtr +k] > 0 ) {
|
||||
printf("Data found at %d, %d, %d\n",i,j,k);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(sub_code == PROJECT__SAMPLE){
|
||||
hm_pntr.base = Hist_base_addr;
|
||||
for(i = 0; i < nTime; i++){
|
||||
my_pntr.i4[i] = 0;
|
||||
}
|
||||
for(i = x_lo; i < x_lo + nx; i++){
|
||||
for(j = y_lo; j < y_lo + ny; j++){
|
||||
dataPtr = j*psdXSize*nTime + i*nTime;
|
||||
for(k = 0; k < nTime; k++){
|
||||
my_pntr.i4[k] += hm_pntr.i4[dataPtr +k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
@ -2535,11 +2574,13 @@
|
||||
rply_bf->u.project.cnts_lo = htonl (Cnts_lo);
|
||||
rply_bf->u.project.cnts_hi = htonl (Cnts_hi);
|
||||
|
||||
|
||||
if (rply_bf->bigend != 0x12345678) { /* If byte swapping needed, ...
|
||||
** .. then swap them! */
|
||||
for (i = 0; i < my_nbins; i++) my_pntr.i4[i] = htonl (my_pntr.i4[i]);
|
||||
}
|
||||
|
||||
|
||||
is = rply_status_setup_and_send (rw_skt, rply_bf, KER__SUCCESS, 0, NULL);
|
||||
|
||||
bytes_to_go = my_nbins * sizeof (uint);
|
||||
|
10
sinqhmdriv.c
10
sinqhmdriv.c
@ -987,3 +987,13 @@
|
||||
|
||||
return pNew;
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int isSINQHMDriv(pHistDriver test)
|
||||
{
|
||||
if(test->Start == SQStart)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#line 56 "sinqhmdriv.w"
|
||||
#line 60 "sinqhmdriv.w"
|
||||
|
||||
/*--------------------------------------------------------------------------
|
||||
S I N Q H M
|
||||
@ -23,15 +23,16 @@
|
||||
int iLastCTError;
|
||||
} SinqHMDriv;
|
||||
|
||||
#line 69 "sinqhmdriv.w"
|
||||
#line 73 "sinqhmdriv.w"
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
#line 52 "sinqhmdriv.w"
|
||||
#line 55 "sinqhmdriv.w"
|
||||
|
||||
pHistDriver CreateSINQDriver(pStringDict pOption);
|
||||
int isSINQHMDriv(pHistDriver test);
|
||||
|
||||
#line 71 "sinqhmdriv.w"
|
||||
#line 75 "sinqhmdriv.w"
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -59,7 +59,10 @@ The driver implements all the functions specified in the driver interface.
|
||||
Please note that these contain functions for the deletion of driver private
|
||||
data structures which will be automatically called form DeleteHistDriver.
|
||||
Therefore the only function to define is CreateSINQDriver which sets things
|
||||
up.
|
||||
up. Another function is isSINQHMDriv which tests if the driver given as an
|
||||
argument actually is a SINQHM driver. This is currently only used in
|
||||
amorstat.c which has to circumvent normal SICS mechanisms for performance
|
||||
reasons.
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} \label{scrap2}
|
||||
@ -68,6 +71,7 @@ $\langle$Protos {\footnotesize ?}$\rangle\equiv$
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@ pHistDriver CreateSINQDriver(pStringDict pOption);@\\
|
||||
\mbox{}\verb@ int isSINQHMDriv(pHistDriver test);@\\
|
||||
\mbox{}\verb@@$\diamond$
|
||||
\end{list}
|
||||
\vspace{-1ex}
|
||||
|
@ -47,10 +47,14 @@ The driver implements all the functions specified in the driver interface.
|
||||
Please note that these contain functions for the deletion of driver private
|
||||
data structures which will be automatically called form DeleteHistDriver.
|
||||
Therefore the only function to define is CreateSINQDriver which sets things
|
||||
up.
|
||||
up. Another function is isSINQHMDriv which tests if the driver given as an
|
||||
argument actually is a SINQHM driver. This is currently only used in
|
||||
amorstat.c which has to circumvent normal SICS mechanisms for performance
|
||||
reasons.
|
||||
|
||||
@d Protos @{
|
||||
pHistDriver CreateSINQDriver(pStringDict pOption);
|
||||
int isSINQHMDriv(pHistDriver test);
|
||||
@}
|
||||
|
||||
@o sinqhmdriv.i -d @{
|
||||
|
19
status.c
19
status.c
@ -264,6 +264,8 @@
|
||||
pOwner->pSock = pCon->pSock;
|
||||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------*/
|
||||
static int motorSave = 0;
|
||||
/*-----------------------------------------------------------------------*/
|
||||
int BackupStatus(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
@ -280,7 +282,7 @@
|
||||
pFile = IFindOption(pSICSOptions,"statusfile");
|
||||
if(pFile)
|
||||
{
|
||||
iRet = WriteSicsStatus(pSics,pFile);
|
||||
iRet = WriteSicsStatus(pSics,pFile,motorSave);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -291,7 +293,20 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
iRet = WriteSicsStatus(pSics,argv[1]);
|
||||
if(strcmp(argv[1],"motorSave") == 0)
|
||||
{
|
||||
if(motorSave== 1)
|
||||
motorSave= 0;
|
||||
else
|
||||
motorSave= 1;
|
||||
sprintf(pBueffel,"New Value of motorSave= %d\n",motorSave);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
iRet = WriteSicsStatus(pSics,argv[1],motorSave);
|
||||
}
|
||||
}
|
||||
|
||||
if(!iRet)
|
||||
|
601
tacov.c
Normal file
601
tacov.c
Normal file
@ -0,0 +1,601 @@
|
||||
/* tacov.f -- translated by f2c (version 20000817).
|
||||
You must link the resulting object file with the libraries:
|
||||
-lf2c -lm (in that order)
|
||||
*/
|
||||
|
||||
#include "f2c.h"
|
||||
|
||||
/* Common Block Declarations */
|
||||
|
||||
struct {
|
||||
integer inx;
|
||||
real c1rx, c2rx, rmin, rmax, cl1r;
|
||||
} curve_;
|
||||
|
||||
#define curve_1 curve_
|
||||
|
||||
/* Table of constant values */
|
||||
|
||||
static doublereal c_b7 = 1.;
|
||||
static doublereal c_b9 = 360.;
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* FILE T_CONV */
|
||||
/* SUBROUTINE T_CONV(EI,AKI,EF,AKF,QHKL,EN,HX,HY,HZ,IF1,IF2,LDK,LDH,LDF */
|
||||
/* 1 LPA,DM,DA,HELM,F1H,F1V,F2H,F2V,F,IFX,ISS,ISM,ISA, */
|
||||
/* 2 T_A,T_RM,T_ALM,LDRA,LDR_RM,LDR_ALM,P_IH,C_IH,IER) */
|
||||
/* SUBROUTINE EX_CASE(DX,ISX,AKX,AX1,AX2,RX,ALX,IER) */
|
||||
/* SUBROUTINE SAM_CASE(QT,QM,QS,AKI,AKF,AX3,AX4,ISS,IER) */
|
||||
/* SUBROUTINE HELM_CASE(HX,HY,HZ,P_IH,AKI,AKF,A4,QM,HELM,IER) */
|
||||
/* SUBROUTINE FLIP_CASE(IF1,IF2,P_IH,F1V,F1H,F2V,F2H,AKI,AKF,IER) */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Subroutine */ int t_conv__(real *ei, real *aki, real *ef, real *akf, real *
|
||||
qhkl, real *en, real *hx, real *hy, real *hz, integer *if1, integer *
|
||||
if2, logical *ldk, logical *ldh, logical *ldf, logical *lpa, real *dm,
|
||||
real *da, real *helm, real *f1h, real *f1v, real *f2h, real *f2v,
|
||||
real *f, integer *ifx, integer *iss, integer *ism, integer *isa, real
|
||||
*t_a__, real *t_rm__, real *t_alm__, real *qm, logical *ldra, logical
|
||||
*ldr_rm__, logical *ldr_alm__, real *p_ih__, real *c_ih__, integer *
|
||||
ier)
|
||||
{
|
||||
/* System generated locals */
|
||||
doublereal d__1;
|
||||
|
||||
/* Builtin functions */
|
||||
double sqrt(doublereal);
|
||||
|
||||
/* Local variables */
|
||||
static doublereal edef[2], dakf, daki;
|
||||
static integer imod;
|
||||
extern /* Subroutine */ int sam_case__(doublereal *, doublereal *,
|
||||
doublereal *, doublereal *, doublereal *, doublereal *,
|
||||
doublereal *, integer *, integer *);
|
||||
static integer i__;
|
||||
static doublereal akdef[2];
|
||||
extern /* Subroutine */ int helm_case__(real *, real *, real *, real *,
|
||||
real *, real *, real *, doublereal *, real *, real *, integer *);
|
||||
static doublereal dqhkl[3];
|
||||
extern /* Subroutine */ int flip_case__(integer *, integer *, real *,
|
||||
real *, real *, real *, real *, real *, real *, integer *);
|
||||
static logical lmoan[2];
|
||||
static doublereal a1, a2, a3, a4, a5, a6;
|
||||
static integer id;
|
||||
static doublereal ra;
|
||||
extern /* Subroutine */ int rl2spv_(doublereal *, doublereal *,
|
||||
doublereal *, doublereal *, integer *);
|
||||
static integer iq;
|
||||
static doublereal rm;
|
||||
static logical lqhkle;
|
||||
extern /* Subroutine */ int erreso_(integer *, integer *);
|
||||
static doublereal dda, ala, def, dei, ddm, alm, dqm;
|
||||
extern /* Subroutine */ int ex_case__(doublereal *, integer *, doublereal
|
||||
*, doublereal *, doublereal *, doublereal *, doublereal *,
|
||||
integer *);
|
||||
static doublereal dqt[3], dqs;
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
/* INPUT */
|
||||
/* EI,AKI,EF,AKF,QHKL,EN,HX,HY,HZ : POTENTIAL TARGETS */
|
||||
/* IF1,IF2 Status of flippers On (1) Off (0) */
|
||||
/* LDK(8) LOGICAL INDICATING IF (ENERGY,K OR Q) ARE DRIVEN */
|
||||
/* LDH,LDF LOGICAL INDICATING IF (HX,HY,HZ) OR (F1,F2) ARE DRIVEN */
|
||||
|
||||
/* configuration of the machine */
|
||||
/* LPA LOGICAL TRUE IF MACHINE IN POLARIZATION MODE */
|
||||
/* DM,DA,HELM,F1H,F1V,F2H,F2V,F,IFX,ISS,ISM,ISA,QM (F ENERGY UNIT) */
|
||||
|
||||
/* OUTPUT */
|
||||
/* T_A TARGETS OF ANGLES A1-A6 */
|
||||
/* T_RM,T_ALM TARGETS OF RM ,LM */
|
||||
/* QM TARGETS OF QM */
|
||||
/* LDRA LOGICAL INDICATING WHICH ANGLES ARE TO BE DRIVEN */
|
||||
/* LDR_RM,LDR_ALM LOGICAL INDICATING IF RM OR ALM ARE TO BE DRIVEN */
|
||||
/* P_IH TARGETS OF CURRENTS FOR FLIPPERS AND HELMOTZ (8 CURRENTS) */
|
||||
/* C_IH CONVERSION FACTORS FOR HELMOTZ (4 CURRENTS) */
|
||||
|
||||
/* SPECIAL OUTPUTS */
|
||||
/* TARGET OF EI(EF) IS UPDATED IS KI(KF) IS DRIVEN */
|
||||
/* TARGET OF VARIABLE ENERGY IS UPDATED IF EN IS DRIVEN */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* PASSED PARAMETERS */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* LOCAL VARIABLES */
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* SET UP */
|
||||
/* IMOD INDEX FOR ERROR TREATMENAT BY ERRESO */
|
||||
/* LDQHKLE : LOGICAL INDICATING THAT WE ARE DEALING WITH A MOVE */
|
||||
/* IN RECIPROCICAL SPACE */
|
||||
/* WE REMAP THE ENERGY PB AS FIXED ENERGY IN EDEF(1) */
|
||||
/* AND VARIABLE ENERGY IN EDEF(2) */
|
||||
/* IF ISA IS NUL SET IFX TO 1 AND PUT EF,KF, EQUAL TO EI,KI */
|
||||
|
||||
/* Parameter adjustments */
|
||||
--c_ih__;
|
||||
--p_ih__;
|
||||
--ldra;
|
||||
--t_a__;
|
||||
--ldk;
|
||||
--qhkl;
|
||||
|
||||
/* Function Body */
|
||||
imod = 3;
|
||||
ddm = *dm;
|
||||
dda = *da;
|
||||
for (i__ = 1; i__ <= 2; ++i__) {
|
||||
lmoan[i__ - 1] = FALSE_;
|
||||
}
|
||||
lqhkle = FALSE_;
|
||||
for (iq = 5; iq <= 8; ++iq) {
|
||||
lqhkle = lqhkle || ldk[iq];
|
||||
}
|
||||
daki = *aki;
|
||||
dakf = *akf;
|
||||
if (*isa == 0) {
|
||||
*ifx = 1;
|
||||
}
|
||||
edef[*ifx - 1] = *ei;
|
||||
akdef[*ifx - 1] = *aki;
|
||||
edef[3 - *ifx - 1] = *ef;
|
||||
akdef[3 - *ifx - 1] = *akf;
|
||||
if (*isa == 0) {
|
||||
edef[1] = edef[0];
|
||||
akdef[1] = akdef[0];
|
||||
ldk[3] = TRUE_;
|
||||
ldk[4] = TRUE_;
|
||||
t_a__[5] = 0.f;
|
||||
t_a__[6] = 0.f;
|
||||
ldra[5] = TRUE_;
|
||||
ldra[6] = TRUE_;
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* FIRST TAKE IN ACCOUNT THE FIXED ENERGY PB */
|
||||
|
||||
if (ldk[(*ifx << 1) - 1] || ldk[*ifx * 2]) {
|
||||
lmoan[*ifx - 1] = TRUE_;
|
||||
if (ldk[(*ifx << 1) - 1]) {
|
||||
*ier = 1;
|
||||
if (edef[0] < .1) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 0;
|
||||
akdef[0] = sqrt(edef[0] / *f);
|
||||
} else {
|
||||
*ier = 1;
|
||||
if (akdef[0] < .1) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 0;
|
||||
/* Computing 2nd power */
|
||||
d__1 = akdef[0];
|
||||
edef[0] = *f * (d__1 * d__1);
|
||||
}
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* NOW TAKE IN ACCOUNT THE VARIABLE ENERGY PB */
|
||||
/* VARIABLE ENERGUY IS DRIVEN EITHER EXPLICITLY */
|
||||
/* E.G. BY DRIVING EI OR KI WITH IFX=2 */
|
||||
/* ( AND WE MUST CALCULATE EN FROM EVAR) */
|
||||
/* THE RULE IS : EI=EF+EN : EN IS THE ENERGY LOSS OF NEUTRONS */
|
||||
/* OR ENERGY GAIN OF SAMPLE */
|
||||
/* OR IMPLICITLY BY DRIVING THE TRANSFERED ENERGY EN */
|
||||
/* ( AND WE MUST CALCULATE EVAR FROM EN) */
|
||||
/* IF KI IS CONSTANT USE THE CURRENT VALUE CONTAINED IN POSN ARRAY */
|
||||
/* TO CALCULATE THE NON-"CONSTANT" K. */
|
||||
/* IF KF IS CONSTANT USE ALWAYS THE VALUE IN TARGET AND */
|
||||
/* DO A DRIVE OF KF TO KEEP A5/A6 IN RIGHT POSITION */
|
||||
|
||||
if (ldk[5 - (*ifx << 1)] || ldk[6 - (*ifx << 1)]) {
|
||||
lmoan[3 - *ifx - 1] = TRUE_;
|
||||
if (ldk[5 - (*ifx << 1)]) {
|
||||
*ier = 1;
|
||||
if (edef[1] < 1e-4) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 0;
|
||||
akdef[1] = sqrt(edef[1] / *f);
|
||||
} else {
|
||||
*ier = 1;
|
||||
if (akdef[1] < 1e-4) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 0;
|
||||
/* Computing 2nd power */
|
||||
d__1 = akdef[1];
|
||||
edef[1] = *f * (d__1 * d__1);
|
||||
}
|
||||
*en = (3 - (*ifx << 1)) * (edef[0] - edef[1]);
|
||||
} else if (lqhkle) {
|
||||
lmoan[3 - *ifx - 1] = TRUE_;
|
||||
edef[1] = edef[0] + ((*ifx << 1) - 3) * *en;
|
||||
*ier = 1;
|
||||
if (edef[1] < 1e-4) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 0;
|
||||
akdef[1] = sqrt(edef[1] / *f);
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* CALCULATE MONOCHROMATOR AND ANALYSER ANGLES */
|
||||
|
||||
if (lmoan[0]) {
|
||||
dei = edef[*ifx - 1];
|
||||
daki = akdef[*ifx - 1];
|
||||
ex_case__(&ddm, ism, &daki, &a1, &a2, &rm, &alm, ier);
|
||||
if (*ier == 0) {
|
||||
*aki = daki;
|
||||
*ei = dei;
|
||||
t_a__[1] = a1;
|
||||
t_a__[2] = a2;
|
||||
*t_rm__ = rm;
|
||||
*t_alm__ = alm;
|
||||
ldra[1] = TRUE_;
|
||||
ldra[2] = TRUE_;
|
||||
*ldr_rm__ = TRUE_;
|
||||
*ldr_alm__ = TRUE_;
|
||||
} else {
|
||||
goto L999;
|
||||
}
|
||||
}
|
||||
if (lmoan[1]) {
|
||||
def = edef[3 - *ifx - 1];
|
||||
dakf = akdef[3 - *ifx - 1];
|
||||
ex_case__(&dda, isa, &dakf, &a5, &a6, &ra, &ala, ier);
|
||||
if (*ier == 0) {
|
||||
*akf = dakf;
|
||||
*ef = def;
|
||||
t_a__[5] = a5;
|
||||
t_a__[6] = a6;
|
||||
ldra[5] = TRUE_;
|
||||
ldra[6] = TRUE_;
|
||||
} else {
|
||||
goto L999;
|
||||
}
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* USE (QH,QK,QL) TO CALCULATE A3 AND A4 */
|
||||
/* CALCULATE Q1 AND Q2 IN SCATTERING PLANE */
|
||||
|
||||
imod = 2;
|
||||
if (lqhkle) {
|
||||
for (id = 1; id <= 3; ++id) {
|
||||
dqhkl[id - 1] = qhkl[id];
|
||||
}
|
||||
rl2spv_(dqhkl, dqt, &dqm, &dqs, ier);
|
||||
if (*ier != 0) {
|
||||
goto L999;
|
||||
}
|
||||
sam_case__(dqt, &dqm, &dqs, &daki, &dakf, &a3, &a4, iss, ier);
|
||||
if (*ier == 0) {
|
||||
t_a__[3] = a3;
|
||||
t_a__[4] = a4;
|
||||
ldra[3] = TRUE_;
|
||||
ldra[4] = TRUE_;
|
||||
*qm = dqm;
|
||||
} else {
|
||||
goto L999;
|
||||
}
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* DEAL WITH FLIPPERS AND HELMOTZ COILS IF LPA */
|
||||
|
||||
if (*lpa && (lmoan[0] || lmoan[1])) {
|
||||
if (*ldf) {
|
||||
flip_case__(if1, if2, &p_ih__[1], f1v, f1h, f2v, f2h, aki, akf,
|
||||
ier);
|
||||
}
|
||||
if (*ldh) {
|
||||
helm_case__(hx, hy, hz, &p_ih__[1], &c_ih__[1], aki, akf, &a4, qm,
|
||||
helm, ier);
|
||||
}
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
L999:
|
||||
if (*ier != 0) {
|
||||
erreso_(&imod, ier);
|
||||
}
|
||||
return 0;
|
||||
} /* t_conv__ */
|
||||
|
||||
/* Subroutine */ int ex_case__(doublereal *dx, integer *isx, doublereal *akx,
|
||||
doublereal *ax1, doublereal *ax2, doublereal *rx, doublereal *alx,
|
||||
integer *ier)
|
||||
{
|
||||
/* System generated locals */
|
||||
doublereal d__1, d__2;
|
||||
|
||||
/* Builtin functions */
|
||||
double asin(doublereal), sin(doublereal), cos(doublereal), sqrt(
|
||||
doublereal);
|
||||
|
||||
/* Local variables */
|
||||
static doublereal dcl1r, dc1rx, dc2rx, drmin, drmax, arg;
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* CALCULATE ANGLES ON MONO/ANALYSER */
|
||||
/* CALCULATE AX1 AX2 */
|
||||
/* CALCULATE RX LX MONO CURVATURE AND LM FOR IN8 */
|
||||
|
||||
/* INPUT */
|
||||
/* DX D-SPACINGS */
|
||||
/* ISX SENS OF SCATTERING ON CRYSTAL */
|
||||
/* AKX TARGET OF MOMENTUM */
|
||||
/* OUTPUT */
|
||||
/* AX1 AX2 THETA 2*THETA ANGLES */
|
||||
/* RX MONO OR ANALYSER CURVATURE */
|
||||
/* ALX SPECIAL TRANSLATION FOR IN8 */
|
||||
/* IER */
|
||||
/* 1 ' KI OR KF CANNOT BE OBTAINED CHECK D-SPACINGS', */
|
||||
/* 2 ' KI OR KF TOO SMALL', */
|
||||
/* 3 ' KI OR KF TOO BIG', */
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* Values of parameters */
|
||||
|
||||
/* INX=1 IN8 , INX=0 others instruments */
|
||||
/* C1RX C2RX constants values to calculate RM on all instruments */
|
||||
/* RMIN, RMAX min max on RNM */
|
||||
/* CL1R constant value to calculate LM for IN8 */
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* PASSED PARAMETERS */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* LOCAL VAR */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* INIT AND TEST */
|
||||
|
||||
*ier = 0;
|
||||
dc1rx = curve_1.c1rx;
|
||||
dc2rx = curve_1.c2rx;
|
||||
drmin = curve_1.rmin;
|
||||
drmax = curve_1.rmax;
|
||||
dcl1r = curve_1.cl1r;
|
||||
if (*dx < .1f) {
|
||||
*ier = 1;
|
||||
}
|
||||
if (*akx < .1f) {
|
||||
*ier = 2;
|
||||
}
|
||||
arg = 3.1415926535897932384626433832795f / (*dx * *akx);
|
||||
if (abs(arg) > 1.f) {
|
||||
*ier = 3;
|
||||
}
|
||||
if (*ier != 0) {
|
||||
goto L999;
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* CALCULATION OF THE TWO ANGLES */
|
||||
|
||||
*ax1 = asin(arg) * *isx * 57.29577951308232087679815481410517f;
|
||||
*ax2 = *ax1 * 2.;
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* CALCULATION OF MONO CURVATURE RM OR ANALYSER CURVATURE RA */
|
||||
/* STANDARD LAW IS C1RX+C2RX/SIN(A1/RD) */
|
||||
/* C1RX AND C2RX ARE CONSTANTS DEPENDING ON MONO AND MACHINES */
|
||||
|
||||
/* C1RX=.47 */
|
||||
/* C2RX=.244 */
|
||||
/* RMIN=0. */
|
||||
/* RMAX=20. */
|
||||
/* IN1/IN3/IN12/IN14/IN20 CASE */
|
||||
if (curve_1.inx == 0) {
|
||||
/* Computing MIN */
|
||||
/* Computing MAX */
|
||||
d__2 = dc1rx + dc2rx / sin(abs(*ax1) /
|
||||
57.29577951308232087679815481410517f);
|
||||
d__1 = max(d__2,drmin);
|
||||
*rx = min(d__1,drmax);
|
||||
} else {
|
||||
/* IN8 CASE */
|
||||
*alx = dcl1r / sin(*ax2 / 57.29577951308232087679815481410517f) * cos(
|
||||
*ax2 / 57.29577951308232087679815481410517f);
|
||||
*rx = dc2rx * sqrt(sin(*ax2 / 57.29577951308232087679815481410517f))
|
||||
- dc1rx;
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
L999:
|
||||
return 0;
|
||||
} /* ex_case__ */
|
||||
|
||||
/* ========================================================================= */
|
||||
/* Subroutine */ int sam_case__(doublereal *qt, doublereal *qm, doublereal *
|
||||
qs, doublereal *aki, doublereal *akf, doublereal *ax3, doublereal *
|
||||
ax4, integer *iss, integer *ier)
|
||||
{
|
||||
/* System generated locals */
|
||||
doublereal d__1, d__2;
|
||||
|
||||
/* Builtin functions */
|
||||
double acos(doublereal), atan2(doublereal, doublereal), d_sign(doublereal
|
||||
*, doublereal *), d_mod(doublereal *, doublereal *);
|
||||
|
||||
/* Local variables */
|
||||
static doublereal arg, sax3;
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* DEAL WITH SAMPLE ANGLES CALCULATION FROM Q VERTOR IN C-N PLANE */
|
||||
/* CALCULATE A3 AND A4 */
|
||||
/* INPUT */
|
||||
/* QT Q-VECTOR IN SCATTERING PLANE */
|
||||
/* QM,QS Q MODULUS AND QMODULUS SQUARED */
|
||||
/* AKI,AKF MOMEMTA ON MONO AND ANYLSER */
|
||||
/* ISS SENS OF SCATTERING ON SAMPLE */
|
||||
|
||||
/* OUTPUT */
|
||||
/* AX3 AX4 ANGLES ON SAMPLES */
|
||||
/* IER SAME ERROR AS RL2SPV */
|
||||
/* IER */
|
||||
/* 1 ' MATRIX S NOT OK', */
|
||||
/* 2 ' Q NOT IN SCATTERING PLANE', */
|
||||
/* 3 ' Q MODULUS TOO SMALL', */
|
||||
/* 4 ' Q MODULUS TOO BIG', */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* PASSED PARAMETERS */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* INIT AND TEST */
|
||||
|
||||
/* Parameter adjustments */
|
||||
--qt;
|
||||
|
||||
/* Function Body */
|
||||
*ier = 0;
|
||||
if (abs(*qs) < 1e-6 || abs(*qm) < .001) {
|
||||
*ier = 3;
|
||||
goto L999;
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* CALCULATE A3 AND MOVE IT INTHE -180 ,+180 INTERVAL */
|
||||
|
||||
/* Computing 2nd power */
|
||||
d__1 = *aki;
|
||||
/* Computing 2nd power */
|
||||
d__2 = *akf;
|
||||
arg = (d__1 * d__1 + d__2 * d__2 - *qs) / (*aki * 2. * *akf);
|
||||
if (abs(arg) > 1.) {
|
||||
*ier = 4;
|
||||
goto L999;
|
||||
} else {
|
||||
*ax4 = acos(arg) * *iss * 57.29577951308232087679815481410517;
|
||||
}
|
||||
/* Computing 2nd power */
|
||||
d__1 = *akf;
|
||||
/* Computing 2nd power */
|
||||
d__2 = *aki;
|
||||
*ax3 = (-atan2(qt[2], qt[1]) - acos((d__1 * d__1 - *qs - d__2 * d__2) / (*
|
||||
qm * -2. * *aki)) * d_sign(&c_b7, ax4)) *
|
||||
57.29577951308232087679815481410517;
|
||||
sax3 = d_sign(&c_b7, ax3);
|
||||
d__1 = *ax3 + sax3 * 180.;
|
||||
*ax3 = d_mod(&d__1, &c_b9) - sax3 * 180.;
|
||||
|
||||
/* IF(LPLATE) AX3=-ATAN(SIN(AX4/RD)/(LSA*TAN(AX5/RD)/(ALMS*C */
|
||||
/* 1 TAN(AX1/RD))*(AKI/KF)**2-COS(AX4/RD)))*RD !PLATE FOCALIZATION OPTION */
|
||||
/* IF(AXX3.GT.180.D0) AX3=AX3-360.D0 */
|
||||
/* IF( A3.LT.-180.D0) AX3=AX3+360.D0 */
|
||||
/* IF(LPLATE.AND.A3.GT.0.0) AX3=AX3-180 */
|
||||
/* C----------------------------------------------------------------------- */
|
||||
L999:
|
||||
return 0;
|
||||
} /* sam_case__ */
|
||||
|
||||
/* ============================================================================ */
|
||||
/* Subroutine */ int helm_case__(real *hx, real *hy, real *hz, real *t_ih__,
|
||||
real *c_ih__, real *aki, real *akf, doublereal *a4, real *qm, real *
|
||||
helm, integer *ier)
|
||||
{
|
||||
/* System generated locals */
|
||||
real r__1, r__2;
|
||||
|
||||
/* Builtin functions */
|
||||
double cos(doublereal), sin(doublereal), atan2(doublereal, doublereal),
|
||||
sqrt(doublereal);
|
||||
|
||||
/* Local variables */
|
||||
static real hrad, hdir, qpar, hdir2, qperp;
|
||||
static integer ic;
|
||||
static real phi;
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* DEAL WITH HELMOTZ COIL FIELD CALCULATIONS */
|
||||
/* CALCULATE HX HY HZ */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* PASSED PARAMETERS */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* INIT AND TEST */
|
||||
|
||||
/* Parameter adjustments */
|
||||
--c_ih__;
|
||||
--t_ih__;
|
||||
|
||||
/* Function Body */
|
||||
*ier = 1;
|
||||
if (dabs(*qm) < 1e-4f) {
|
||||
goto L999;
|
||||
}
|
||||
*ier = 0;
|
||||
for (ic = 1; ic <= 4; ++ic) {
|
||||
if (c_ih__[ic] < 1e-4f) {
|
||||
*ier = 2;
|
||||
}
|
||||
}
|
||||
if (*ier != 0) {
|
||||
goto L999;
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* CALCULATE MODULE AND ANGLES OF IN PLANE FIELD H */
|
||||
/* PHI !ANGLE BETWEEN Q AND KI */
|
||||
/* HRAD !RADIAL COMP. OF H */
|
||||
/* HDIR !DIRECTION OF H (IN RADIANS) */
|
||||
/* HDIR2 !ANGLE BETWEEN FIELD AND AXE OF COIL 1 */
|
||||
|
||||
qpar = *aki - *akf * cos(*a4 / 57.29577951308232087679815481410517f);
|
||||
qperp = *akf * sin(*a4 / 57.29577951308232087679815481410517f);
|
||||
phi = atan2(qpar, qperp);
|
||||
/* Computing 2nd power */
|
||||
r__1 = *hx;
|
||||
/* Computing 2nd power */
|
||||
r__2 = *hy;
|
||||
hrad = sqrt(r__1 * r__1 + r__2 * r__2);
|
||||
if (hrad > 1e-4f) {
|
||||
hdir = atan2(*hy, *hx);
|
||||
}
|
||||
hdir2 = phi + hdir + *helm / 57.29577951308232087679815481410517f +
|
||||
1.5707963267948966f;
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* !CALC CURRENTS */
|
||||
/* !POSITION OF PSP FOR COIL I */
|
||||
|
||||
for (ic = 1; ic <= 3; ++ic) {
|
||||
t_ih__[ic + 4] = cos(hdir2 + (ic - 1) * 2.f *
|
||||
3.1415926535897932384626433832795f / 3.f) * hrad / c_ih__[ic]
|
||||
/ 1.5f;
|
||||
}
|
||||
t_ih__[8] = *hz / c_ih__[4];
|
||||
/* ----------------------------------------------------------------------- */
|
||||
L999:
|
||||
return 0;
|
||||
} /* helm_case__ */
|
||||
|
||||
/* Subroutine */ int flip_case__(integer *if1, integer *if2, real *t_ih__,
|
||||
real *f1v, real *f1h, real *f2v, real *f2h, real *aki, real *akf,
|
||||
integer *ier)
|
||||
{
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* DEAL WITH FLIPPER COIL CALCULATIONS */
|
||||
/* CALCULATE P_IF CURRENTS FOR THE TWO FLIPPERS */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* PASSED PARAMETERS */
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* INIT AND TEST */
|
||||
|
||||
/* Parameter adjustments */
|
||||
--t_ih__;
|
||||
|
||||
/* Function Body */
|
||||
*ier = 0;
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
if (*if1 == 1) {
|
||||
t_ih__[1] = *f1v;
|
||||
t_ih__[2] = *aki * *f1h;
|
||||
} else {
|
||||
t_ih__[1] = 0.f;
|
||||
t_ih__[2] = 0.f;
|
||||
}
|
||||
if (*if2 == 1) {
|
||||
t_ih__[3] = *f2v;
|
||||
t_ih__[4] = *akf * *f2h;
|
||||
} else {
|
||||
t_ih__[3] = 0.f;
|
||||
t_ih__[4] = 0.f;
|
||||
}
|
||||
/* ----------------------------------------------------------------------- */
|
||||
/* L999: */
|
||||
return 0;
|
||||
} /* flip_case__ */
|
||||
|
431
tacov.f
Normal file
431
tacov.f
Normal file
@ -0,0 +1,431 @@
|
||||
C-----------------------------------------------------------------------
|
||||
C FILE T_CONV
|
||||
C SUBROUTINE T_CONV(EI,AKI,EF,AKF,QHKL,EN,HX,HY,HZ,IF1,IF2,LDK,LDH,LDF
|
||||
C 1 LPA,DM,DA,HELM,F1H,F1V,F2H,F2V,F,IFX,ISS,ISM,ISA,
|
||||
C 2 T_A,T_RM,T_ALM,LDRA,LDR_RM,LDR_ALM,P_IH,C_IH,IER)
|
||||
C SUBROUTINE EX_CASE(DX,ISX,AKX,AX1,AX2,RX,ALX,IER)
|
||||
C SUBROUTINE SAM_CASE(QT,QM,QS,AKI,AKF,AX3,AX4,ISS,IER)
|
||||
C SUBROUTINE HELM_CASE(HX,HY,HZ,P_IH,AKI,AKF,A4,QM,HELM,IER)
|
||||
C SUBROUTINE FLIP_CASE(IF1,IF2,P_IH,F1V,F1H,F2V,F2H,AKI,AKF,IER)
|
||||
C-----------------------------------------------------------------------
|
||||
SUBROUTINE T_CONV(EI,AKI,EF,AKF,QHKL,EN,HX,HY,HZ,IF1,IF2,
|
||||
1 LDK,LDH,LDF,LPA,DM,DA,HELM,F1H,F1V,F2H,F2V,F,IFX,ISS,
|
||||
2 ISM,ISA,T_A,T_RM,T_ALM,QM,LDRA,LDR_RM,LDR_ALM,P_IH,C_IH,IER)
|
||||
C-----------------------------------------------------------------------
|
||||
C
|
||||
C INPUT
|
||||
C EI,AKI,EF,AKF,QHKL,EN,HX,HY,HZ : POTENTIAL TARGETS
|
||||
C IF1,IF2 Status of flippers On (1) Off (0)
|
||||
C LDK(8) LOGICAL INDICATING IF (ENERGY,K OR Q) ARE DRIVEN
|
||||
C LDH,LDF LOGICAL INDICATING IF (HX,HY,HZ) OR (F1,F2) ARE DRIVEN
|
||||
C
|
||||
C configuration of the machine
|
||||
C LPA LOGICAL TRUE IF MACHINE IN POLARIZATION MODE
|
||||
C DM,DA,HELM,F1H,F1V,F2H,F2V,F,IFX,ISS,ISM,ISA,QM (F ENERGY UNIT)
|
||||
C
|
||||
C OUTPUT
|
||||
C T_A TARGETS OF ANGLES A1-A6
|
||||
C T_RM,T_ALM TARGETS OF RM ,LM
|
||||
C QM TARGETS OF QM
|
||||
C LDRA LOGICAL INDICATING WHICH ANGLES ARE TO BE DRIVEN
|
||||
C LDR_RM,LDR_ALM LOGICAL INDICATING IF RM OR ALM ARE TO BE DRIVEN
|
||||
C P_IH TARGETS OF CURRENTS FOR FLIPPERS AND HELMOTZ (8 CURRENTS)
|
||||
C C_IH CONVERSION FACTORS FOR HELMOTZ (4 CURRENTS)
|
||||
C
|
||||
C SPECIAL OUTPUTS
|
||||
C TARGET OF EI(EF) IS UPDATED IS KI(KF) IS DRIVEN
|
||||
C TARGET OF VARIABLE ENERGY IS UPDATED IF EN IS DRIVEN
|
||||
C-----------------------------------------------------------------------
|
||||
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
|
||||
PARAMETER(EPS1=1.D-1,EPS4=1.D-4)
|
||||
C-----------------------------------------------------------------------
|
||||
C PASSED PARAMETERS
|
||||
REAL EI,AKI,EF,AKF,QHKL(3),EN,HX,HY,HZ
|
||||
LOGICAL LDK(8),LDH,LDF,LPA
|
||||
REAL DM,DA,HELM,F1H,F1V,F2H,F2V,F
|
||||
REAL T_A(6),T_RM,T_ALM,QM
|
||||
LOGICAL LDRA(6),LDR_RM,LDR_ALM
|
||||
REAL P_IH(8),C_IH(4)
|
||||
C-----------------------------------------------------------------------
|
||||
C LOCAL VARIABLES
|
||||
C
|
||||
DIMENSION EDEF(2),AKDEF(2),DQHKL(3),DQT(3)
|
||||
double precision ddm,dda
|
||||
LOGICAL LMOAN(2),LQHKLE
|
||||
C-----------------------------------------------------------------------
|
||||
C SET UP
|
||||
C IMOD INDEX FOR ERROR TREATMENAT BY ERRESO
|
||||
C LDQHKLE : LOGICAL INDICATING THAT WE ARE DEALING WITH A MOVE
|
||||
C IN RECIPROCICAL SPACE
|
||||
C WE REMAP THE ENERGY PB AS FIXED ENERGY IN EDEF(1)
|
||||
C AND VARIABLE ENERGY IN EDEF(2)
|
||||
C IF ISA IS NUL SET IFX TO 1 AND PUT EF,KF, EQUAL TO EI,KI
|
||||
C
|
||||
IMOD=3
|
||||
DDM=DM
|
||||
DDA=DA
|
||||
DO I=1,2
|
||||
LMOAN(I)=.FALSE.
|
||||
ENDDO
|
||||
LQHKLE=.FALSE.
|
||||
DO IQ=5,8
|
||||
LQHKLE=(LQHKLE.OR.LDK(IQ))
|
||||
ENDDO
|
||||
DAKI=AKI
|
||||
DAKF=AKF
|
||||
IF (ISA.EQ.0) IFX=1
|
||||
EDEF(IFX)=EI
|
||||
AKDEF(IFX)=AKI
|
||||
EDEF(3-IFX)=EF
|
||||
AKDEF(3-IFX)=AKF
|
||||
IF( ISA.EQ.0) THEN
|
||||
EDEF(2)=EDEF(1)
|
||||
AKDEF(2)=AKDEF(1)
|
||||
LDK(3)=.TRUE.
|
||||
LDK(4)=.TRUE.
|
||||
T_A(5)=0.
|
||||
T_A(6)=0.
|
||||
LDRA(5)=.TRUE.
|
||||
LDRA(6)=.TRUE.
|
||||
ENDIF
|
||||
C-----------------------------------------------------------------------
|
||||
C FIRST TAKE IN ACCOUNT THE FIXED ENERGY PB
|
||||
C
|
||||
IF (LDK(2*IFX-1).OR.LDK(2*IFX)) THEN
|
||||
LMOAN(IFX)=.TRUE.
|
||||
IF (LDK(2*IFX-1)) THEN
|
||||
IER=1
|
||||
IF(EDEF(1).LT.EPS1) GOTO 999
|
||||
IER=0
|
||||
AKDEF(1)=SQRT(EDEF(1)/F)
|
||||
ELSE
|
||||
IER=1
|
||||
IF(AKDEF(1).LT.EPS1) GOTO 999
|
||||
IER=0
|
||||
EDEF(1)=F*AKDEF(1)**2
|
||||
ENDIF
|
||||
ENDIF
|
||||
C-----------------------------------------------------------------------
|
||||
C NOW TAKE IN ACCOUNT THE VARIABLE ENERGY PB
|
||||
C VARIABLE ENERGUY IS DRIVEN EITHER EXPLICITLY
|
||||
C E.G. BY DRIVING EI OR KI WITH IFX=2
|
||||
C ( AND WE MUST CALCULATE EN FROM EVAR)
|
||||
C THE RULE IS : EI=EF+EN : EN IS THE ENERGY LOSS OF NEUTRONS
|
||||
C OR ENERGY GAIN OF SAMPLE
|
||||
C OR IMPLICITLY BY DRIVING THE TRANSFERED ENERGY EN
|
||||
C ( AND WE MUST CALCULATE EVAR FROM EN)
|
||||
C IF KI IS CONSTANT USE THE CURRENT VALUE CONTAINED IN POSN ARRAY
|
||||
C TO CALCULATE THE NON-"CONSTANT" K.
|
||||
C IF KF IS CONSTANT USE ALWAYS THE VALUE IN TARGET AND
|
||||
C DO A DRIVE OF KF TO KEEP A5/A6 IN RIGHT POSITION
|
||||
C
|
||||
IF (LDK(5-2*IFX).OR.LDK(6-2*IFX)) THEN
|
||||
LMOAN(3-IFX)=.TRUE.
|
||||
IF (LDK(5-2*IFX)) THEN
|
||||
IER=1
|
||||
IF(EDEF(2).LT.EPS4) GOTO 999
|
||||
IER=0
|
||||
AKDEF(2)=SQRT(EDEF(2)/F)
|
||||
ELSE
|
||||
IER=1
|
||||
IF(AKDEF(2).LT.EPS4) GOTO 999
|
||||
IER=0
|
||||
EDEF(2)=F*AKDEF(2)**2
|
||||
ENDIF
|
||||
EN=(3-2*IFX)*(EDEF(1)-EDEF(2))
|
||||
ELSE IF (LQHKLE) THEN
|
||||
LMOAN(3-IFX)=.TRUE.
|
||||
EDEF(2)=EDEF(1)+(2*IFX-3)*EN
|
||||
IER=1
|
||||
IF(EDEF(2).LT.EPS4) GOTO 999
|
||||
IER=0
|
||||
AKDEF(2)=SQRT(EDEF(2)/F)
|
||||
ENDIF
|
||||
C-----------------------------------------------------------------------
|
||||
C CALCULATE MONOCHROMATOR AND ANALYSER ANGLES
|
||||
C
|
||||
IF(LMOAN(1)) THEN
|
||||
DEI=EDEF(IFX)
|
||||
DAKI=AKDEF(IFX)
|
||||
CALL EX_CASE(DDM,ISM,DAKI,A1,A2,RM,ALM,IER)
|
||||
IF (IER.EQ.0) THEN
|
||||
AKI=DAKI
|
||||
EI=DEI
|
||||
T_A(1)=A1
|
||||
T_A(2)=A2
|
||||
T_RM=RM
|
||||
T_ALM=ALM
|
||||
LDRA(1)=.TRUE.
|
||||
LDRA(2)=.TRUE.
|
||||
LDR_RM=.TRUE.
|
||||
LDR_ALM=.TRUE.
|
||||
ELSE
|
||||
GOTO 999
|
||||
ENDIF
|
||||
ENDIF
|
||||
IF(LMOAN(2)) THEN
|
||||
DEF=EDEF(3-IFX)
|
||||
DAKF=AKDEF(3-IFX)
|
||||
CALL EX_CASE(DDA,ISA,DAKF,A5,A6,RA,ALA,IER)
|
||||
IF (IER.EQ.0) THEN
|
||||
AKF=DAKF
|
||||
EF=DEF
|
||||
T_A(5)=A5
|
||||
T_A(6)=A6
|
||||
LDRA(5)=.TRUE.
|
||||
LDRA(6)=.TRUE.
|
||||
ELSE
|
||||
GOTO 999
|
||||
ENDIF
|
||||
ENDIF
|
||||
C-----------------------------------------------------------------------
|
||||
C USE (QH,QK,QL) TO CALCULATE A3 AND A4
|
||||
C CALCULATE Q1 AND Q2 IN SCATTERING PLANE
|
||||
C
|
||||
IMOD=2
|
||||
IF (LQHKLE) THEN
|
||||
DO ID=1,3
|
||||
DQHKL(ID)=QHKL(ID)
|
||||
ENDDO
|
||||
CALL RL2SPV(DQHKL,DQT,DQM,DQS,IER)
|
||||
IF (IER.NE.0) GOTO 999
|
||||
CALL SAM_CASE(DQT,DQM,DQS,DAKI,DAKF,A3,A4,ISS,IER)
|
||||
IF (IER.EQ.0) THEN
|
||||
T_A(3)=A3
|
||||
T_A(4)=A4
|
||||
LDRA(3)=.TRUE.
|
||||
LDRA(4)=.TRUE.
|
||||
QM=DQM
|
||||
ELSE
|
||||
GOTO 999
|
||||
ENDIF
|
||||
ENDIF
|
||||
C-----------------------------------------------------------------------
|
||||
C DEAL WITH FLIPPERS AND HELMOTZ COILS IF LPA
|
||||
C
|
||||
IF (LPA.AND.(LMOAN(1).OR.LMOAN(2))) THEN
|
||||
IF (LDF) CALL FLIP_CASE(IF1,IF2,P_IH,F1V,F1H,F2V,F2H,AKI,AKF,IER)
|
||||
IF (LDH) CALL HELM_CASE(HX,HY,HZ,P_IH,C_IH,AKI,AKF,
|
||||
1 A4,QM,HELM,IER)
|
||||
endif
|
||||
C-----------------------------------------------------------------------
|
||||
999 CONTINUE
|
||||
IF (IER.NE.0) CALL ERRESO(IMOD,IER)
|
||||
RETURN
|
||||
END
|
||||
SUBROUTINE EX_CASE(DX,ISX,AKX,AX1,AX2,RX,ALX,IER)
|
||||
C-----------------------------------------------------------------------
|
||||
C CALCULATE ANGLES ON MONO/ANALYSER
|
||||
C CALCULATE AX1 AX2
|
||||
C CALCULATE RX LX MONO CURVATURE AND LM FOR IN8
|
||||
C
|
||||
C INPUT
|
||||
C DX D-SPACINGS
|
||||
C ISX SENS OF SCATTERING ON CRYSTAL
|
||||
C AKX TARGET OF MOMENTUM
|
||||
C OUTPUT
|
||||
C AX1 AX2 THETA 2*THETA ANGLES
|
||||
C RX MONO OR ANALYSER CURVATURE
|
||||
C ALX SPECIAL TRANSLATION FOR IN8
|
||||
C IER
|
||||
C 1 ' KI OR KF CANNOT BE OBTAINED CHECK D-SPACINGS',
|
||||
C 2 ' KI OR KF TOO SMALL',
|
||||
C 3 ' KI OR KF TOO BIG',
|
||||
C
|
||||
C-----------------------------------------------------------------------
|
||||
c Values of parameters
|
||||
COMMON /CURVE/INX,C1RX,C2RX,RMIN,RMAX,CL1R
|
||||
c
|
||||
c INX=1 IN8 , INX=0 others instruments
|
||||
C C1RX C2RX constants values to calculate RM on all instruments
|
||||
C RMIN, RMAX min max on RNM
|
||||
C CL1R constant value to calculate LM for IN8
|
||||
c
|
||||
C-----------------------------------------------------------------------
|
||||
PARAMETER (PI=3.14159265358979323846264338327950E0)
|
||||
PARAMETER(RD=57.29577951308232087679815481410517E0)
|
||||
PARAMETER (EPS1=1.D-1)
|
||||
C-----------------------------------------------------------------------
|
||||
C PASSED PARAMETERS
|
||||
DOUBLE PRECISION DX,AKX,AX1,AX2,ALX,RX
|
||||
C-----------------------------------------------------------------------
|
||||
C LOCAL VAR
|
||||
DOUBLE PRECISION ARG,DC1RX,DC2RX,DRMIN,DRMAX,DCL1R
|
||||
C-----------------------------------------------------------------------
|
||||
C INIT AND TEST
|
||||
C
|
||||
IER=0
|
||||
DC1RX=C1RX
|
||||
DC2RX=C2RX
|
||||
DRMIN=RMIN
|
||||
DRMAX=RMAX
|
||||
DCL1R=CL1R
|
||||
IF(DX.LT.EPS1) IER=1
|
||||
IF(AKX.LT.EPS1) IER=2
|
||||
ARG=PI/(DX*AKX)
|
||||
IF(ABS(ARG).GT.1.0) IER=3
|
||||
IF (IER.NE.0) GOTO 999
|
||||
C-----------------------------------------------------------------------
|
||||
C CALCULATION OF THE TWO ANGLES
|
||||
C
|
||||
AX1=ASIN(ARG)*ISX*RD
|
||||
AX2=2.0D0*AX1
|
||||
C-----------------------------------------------------------------------
|
||||
C CALCULATION OF MONO CURVATURE RM OR ANALYSER CURVATURE RA
|
||||
C STANDARD LAW IS C1RX+C2RX/SIN(A1/RD)
|
||||
C C1RX AND C2RX ARE CONSTANTS DEPENDING ON MONO AND MACHINES
|
||||
C
|
||||
C C1RX=.47
|
||||
C C2RX=.244
|
||||
C RMIN=0.
|
||||
C RMAX=20.
|
||||
C IN1/IN3/IN12/IN14/IN20 CASE
|
||||
if (inx.EQ.0) then
|
||||
RX=DMIN1(DMAX1(DC1RX+DC2RX/SIN(ABS(AX1)/RD),DRMIN),DRMAX)
|
||||
else
|
||||
C IN8 CASE
|
||||
ALX=(DCL1R/SIN(AX2/RD))*COS(AX2/RD)
|
||||
RX=DC2RX*SQRT(SIN(AX2/RD))-DC1RX
|
||||
ENDIF
|
||||
C-----------------------------------------------------------------------
|
||||
999 CONTINUE
|
||||
RETURN
|
||||
END
|
||||
C=========================================================================
|
||||
SUBROUTINE SAM_CASE(QT,QM,QS,AKI,AKF,AX3,AX4,ISS,IER)
|
||||
C-----------------------------------------------------------------------
|
||||
C DEAL WITH SAMPLE ANGLES CALCULATION FROM Q VERTOR IN C-N PLANE
|
||||
C CALCULATE A3 AND A4
|
||||
C INPUT
|
||||
C QT Q-VECTOR IN SCATTERING PLANE
|
||||
C QM,QS Q MODULUS AND QMODULUS SQUARED
|
||||
C AKI,AKF MOMEMTA ON MONO AND ANYLSER
|
||||
C ISS SENS OF SCATTERING ON SAMPLE
|
||||
C
|
||||
C OUTPUT
|
||||
C AX3 AX4 ANGLES ON SAMPLES
|
||||
C IER SAME ERROR AS RL2SPV
|
||||
C IER
|
||||
C 1 ' MATRIX S NOT OK',
|
||||
C 2 ' Q NOT IN SCATTERING PLANE',
|
||||
C 3 ' Q MODULUS TOO SMALL',
|
||||
C 4 ' Q MODULUS TOO BIG',
|
||||
C-----------------------------------------------------------------------
|
||||
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
|
||||
PARAMETER(RD=57.29577951308232087679815481410517E0)
|
||||
PARAMETER (EPS3=1.D-3,EPS6=1.D-6)
|
||||
C-----------------------------------------------------------------------
|
||||
C PASSED PARAMETERS
|
||||
DIMENSION QT(3)
|
||||
C-----------------------------------------------------------------------
|
||||
C INIT AND TEST
|
||||
C
|
||||
IER=0
|
||||
IF ((ABS(QS).LT.EPS6).OR.(ABS(QM).LT.EPS3)) THEN
|
||||
IER=3
|
||||
GOTO 999
|
||||
ENDIF
|
||||
C-----------------------------------------------------------------------
|
||||
C CALCULATE A3 AND MOVE IT INTHE -180 ,+180 INTERVAL
|
||||
C
|
||||
ARG = (AKI**2 + AKF**2 - QS)/(2.D0*AKI*AKF)
|
||||
IF(ABS(ARG).GT.1.D0)THEN
|
||||
IER=4
|
||||
GOTO 999
|
||||
ELSE
|
||||
AX4 = ACOS(ARG)*ISS*RD
|
||||
ENDIF
|
||||
AX3=(-ATAN2(QT(2),QT(1))-ACOS((AKF**2-QS-AKI**2)/
|
||||
1 (-2.D0*QM*AKI))*DSIGN(1.D0,AX4))*RD
|
||||
sax3=Dsign(1.D0,ax3)
|
||||
AX3=DMOD(AX3+sax3*180.D0,360.D0)-sax3*180.D0
|
||||
C
|
||||
C IF(LPLATE) AX3=-ATAN(SIN(AX4/RD)/(LSA*TAN(AX5/RD)/(ALMS*C
|
||||
C 1 TAN(AX1/RD))*(AKI/KF)**2-COS(AX4/RD)))*RD !PLATE FOCALIZATION OPTION
|
||||
C IF(AXX3.GT.180.D0) AX3=AX3-360.D0
|
||||
C IF( A3.LT.-180.D0) AX3=AX3+360.D0
|
||||
C IF(LPLATE.AND.A3.GT.0.0) AX3=AX3-180
|
||||
CC-----------------------------------------------------------------------
|
||||
999 CONTINUE
|
||||
RETURN
|
||||
END
|
||||
C============================================================================
|
||||
SUBROUTINE HELM_CASE(HX,HY,HZ,T_IH,C_IH,AKI,AKF,A4,QM,HELM,IER)
|
||||
C-----------------------------------------------------------------------
|
||||
C DEAL WITH HELMOTZ COIL FIELD CALCULATIONS
|
||||
C CALCULATE HX HY HZ
|
||||
C-----------------------------------------------------------------------
|
||||
PARAMETER (PI=3.14159265358979323846264338327950E0)
|
||||
PARAMETER(RD=57.29577951308232087679815481410517E0)
|
||||
PARAMETER (EPS4=1.D-4)
|
||||
C-----------------------------------------------------------------------
|
||||
C PASSED PARAMETERS
|
||||
DIMENSION T_IH(8),C_IH(4)
|
||||
REAL*8 A4
|
||||
C-----------------------------------------------------------------------
|
||||
C INIT AND TEST
|
||||
C
|
||||
IER=1
|
||||
IF (ABS(QM).LT.EPS4) goto 999
|
||||
IER=0
|
||||
DO IC=1,4
|
||||
IF (C_IH(IC).LT.EPS4) IER=2
|
||||
ENDDO
|
||||
IF (IER.NE.0) GOTO 999
|
||||
C-----------------------------------------------------------------------
|
||||
C CALCULATE MODULE AND ANGLES OF IN PLANE FIELD H
|
||||
C PHI !ANGLE BETWEEN Q AND KI
|
||||
C HRAD !RADIAL COMP. OF H
|
||||
C HDIR !DIRECTION OF H (IN RADIANS)
|
||||
C HDIR2 !ANGLE BETWEEN FIELD AND AXE OF COIL 1
|
||||
C
|
||||
QPAR=AKI-AKF*COS(A4/RD)
|
||||
QPERP=AKF*SIN(A4/RD)
|
||||
PHI=ATAN2(QPAR,QPERP)
|
||||
HRAD=SQRT(HX**2+HY**2)
|
||||
IF(HRAD.GT.EPS4) HDIR=ATAN2(HY,HX)
|
||||
HDIR2=PHI+HDIR+HELM/RD+0.5*PI
|
||||
C-----------------------------------------------------------------------
|
||||
C !CALC CURRENTS
|
||||
C !POSITION OF PSP FOR COIL I
|
||||
C
|
||||
DO IC=1,3
|
||||
T_IH(IC+4)=COS(HDIR2+(IC-1)*2.*PI/3.)*HRAD/C_IH(IC)/1.5
|
||||
ENDDO
|
||||
T_IH(8)=HZ/C_IH(4)
|
||||
C-----------------------------------------------------------------------
|
||||
999 CONTINUE
|
||||
RETURN
|
||||
END
|
||||
SUBROUTINE FLIP_CASE(IF1,IF2,T_IH,F1V,F1H,F2V,F2H,AKI,AKF,IER)
|
||||
C-----------------------------------------------------------------------
|
||||
C DEAL WITH FLIPPER COIL CALCULATIONS
|
||||
C CALCULATE P_IF CURRENTS FOR THE TWO FLIPPERS
|
||||
C-----------------------------------------------------------------------
|
||||
C PASSED PARAMETERS
|
||||
DIMENSION T_IH(8)
|
||||
C-----------------------------------------------------------------------
|
||||
C INIT AND TEST
|
||||
C
|
||||
IER=0
|
||||
C-----------------------------------------------------------------------
|
||||
C
|
||||
IF (IF1.EQ.1) THEN
|
||||
T_IH(1)=F1V
|
||||
T_IH(2)=AKI*F1H
|
||||
ELSE
|
||||
T_IH(1)=0.
|
||||
T_IH(2)=0.
|
||||
ENDIF
|
||||
IF (IF2.EQ.1) THEN
|
||||
T_IH(3)=F2V
|
||||
T_IH(4)=AKF*F2H
|
||||
ELSE
|
||||
T_IH(3)=0.
|
||||
T_IH(4)=0.
|
||||
ENDIF
|
||||
C-----------------------------------------------------------------------
|
||||
999 CONTINUE
|
||||
RETURN
|
||||
END
|
||||
|
129
tas.c
Normal file
129
tas.c
Normal file
@ -0,0 +1,129 @@
|
||||
/*--------------------------------------------------------------------------
|
||||
This is the implementation file for the TASMAD simulation module for
|
||||
SICS. The requirement is to make SICS look as much as TASMAD as
|
||||
possible. This includes:
|
||||
- TASMAD is variable driven
|
||||
- Sometimes variables are accessed in storage order.
|
||||
- A complicated calculation has to be done for getting the instruments
|
||||
settings right. The appropriate F77 routine from TASMAD will be
|
||||
reused.
|
||||
- The scan logic is different.
|
||||
- Output of ILL-formatted data files is required.
|
||||
|
||||
Mark Koennecke, November 2000
|
||||
---------------------------------------------------------------------------*/
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include "fortify.h"
|
||||
#include "sics.h"
|
||||
#include "sicsvar.h"
|
||||
#include "counter.h"
|
||||
#include "motor.h"
|
||||
#include "tas.h"
|
||||
|
||||
/*
|
||||
As variables may be accessed in storage order, it is necessary to
|
||||
know the order of the motors
|
||||
*/
|
||||
extern char *tasMotorOrder[] = { "A1",
|
||||
"A2",
|
||||
"A3",
|
||||
"A4",
|
||||
"A5",
|
||||
"A6",
|
||||
"MCV",
|
||||
"SRO",
|
||||
"ACH",
|
||||
"MTL",
|
||||
"MTU",
|
||||
"STL",
|
||||
"STU",
|
||||
"ATL",
|
||||
"ATU",
|
||||
"MGL",
|
||||
"SGL",
|
||||
"SGU",
|
||||
"AGL",
|
||||
NULL };
|
||||
/*
|
||||
In order to initialise the variable array in the TAS data structure we
|
||||
need to know the names of the variables in the right order. This order
|
||||
has to match the order defined in tas.h through the defines.
|
||||
*/
|
||||
char *tasVariableOrder[] = {
|
||||
"WAV",
|
||||
"DM",
|
||||
"DA",
|
||||
"ETAM",
|
||||
"ETAA",
|
||||
"TI",
|
||||
"MN",
|
||||
"IF1V",
|
||||
"IF1H",
|
||||
"IF2V",
|
||||
"IF2H",
|
||||
"HELM",
|
||||
"AS",
|
||||
"BS",
|
||||
"CS",
|
||||
"AA",
|
||||
"BB",
|
||||
"CC",
|
||||
"ETAS",
|
||||
"AX",
|
||||
"AY",
|
||||
"AZ",
|
||||
"BX",
|
||||
"BY",
|
||||
"BZ",
|
||||
"EI",
|
||||
"KI",
|
||||
"EF",
|
||||
"KF",
|
||||
"QH",
|
||||
"QK",
|
||||
"QL",
|
||||
"EN",
|
||||
"QM",
|
||||
"HX",
|
||||
"HY",
|
||||
"HZ",
|
||||
"DA1",
|
||||
"DA2",
|
||||
"DA3",
|
||||
"DA4",
|
||||
"DA5",
|
||||
"DA6",
|
||||
"DMCV",
|
||||
"SRO",
|
||||
"DACH",
|
||||
"DMTL",
|
||||
"DMTU",
|
||||
"DSTL",
|
||||
"DSTU",
|
||||
"DATL",
|
||||
"DATU",
|
||||
"DMGL",
|
||||
"DSGL",
|
||||
"DSGU",
|
||||
"DAGL",
|
||||
"DEI",
|
||||
"DKI",
|
||||
"DEF",
|
||||
"DKF",
|
||||
"DQH",
|
||||
"DQK",
|
||||
"DEN",
|
||||
"DQM",
|
||||
"DT",
|
||||
"SM",
|
||||
"SS",
|
||||
"SA",
|
||||
"FX",
|
||||
"NP",
|
||||
"F1",
|
||||
"F2",
|
||||
NULL};
|
||||
|
||||
|
||||
|
19
tas.hdd
Normal file
19
tas.hdd
Normal file
@ -0,0 +1,19 @@
|
||||
*************************** TOPSI Data File ********************************
|
||||
Title = !!VAR(Title)!!
|
||||
User = !!VAR(User)!!
|
||||
File Creation Stardate: !!DATE!!
|
||||
****************************************************************************
|
||||
Monochromator Lamda = !!DRIV(lambda)!!
|
||||
Monochromator A1 = !!DRIV(A1)!!
|
||||
Monochromator A2 = !!DRIV(A2)!!
|
||||
----------------------------------------------------------------------------
|
||||
Sample STL = !!DRIV(STL)!!
|
||||
Sample STU = !!DRIV(STU)!!
|
||||
Sample SGL = !!DRIV(SGL)!!
|
||||
Sample SGU = !!DRIV(SGU)!!
|
||||
Zero STL = !!ZERO(STL)!!
|
||||
Zero STU = !!ZERO(STU)!!
|
||||
Zero SGL = !!ZERO(SGL)!!
|
||||
Zero SGU = !!ZERO(SGU)!!
|
||||
!!SCANZERO!!
|
||||
**************************** DATA ******************************************
|
104
tasregress.tcl
Normal file
104
tasregress.tcl
Normal file
@ -0,0 +1,104 @@
|
||||
#-------------------------------------------------------------------------
|
||||
# Regression test for TAS
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
config file simchal.log
|
||||
|
||||
#--------- zero points
|
||||
A1 softzero .59
|
||||
A2 softzero -.01
|
||||
A3 softzero 11.54
|
||||
A4 softzero -.71
|
||||
A5 softzero 176.48
|
||||
A6 softzero .04
|
||||
|
||||
MTU softzero 2.85
|
||||
ATU softzero -.88
|
||||
MGL softzero 1.3
|
||||
SGL softzero 1.55
|
||||
AGL softzero -.49
|
||||
|
||||
#------------- box parameters
|
||||
DM 3.354
|
||||
DA 3.354
|
||||
SM 1
|
||||
SS 1
|
||||
SA -1
|
||||
FX 2
|
||||
NP 9
|
||||
MRX1 .28
|
||||
MRX2 10.42
|
||||
ARX1 .15
|
||||
ARX2 4.29
|
||||
|
||||
#----------- sample
|
||||
AS 5.
|
||||
BS 5.0
|
||||
CS 5.0
|
||||
AA 90.
|
||||
BB 90.
|
||||
CC 90.
|
||||
AX 1.0
|
||||
AY 0
|
||||
AZ 0
|
||||
BX 0
|
||||
BY 1.
|
||||
BZ 0
|
||||
|
||||
dr ef 8.0
|
||||
output a1,a2,a3,a4
|
||||
sc qh 2 0 0 3 dqh 0 0 0 0.05 np 9 ti 2
|
||||
sc qh 2 0 0 3 dqh 0.01 0 0 .0
|
||||
sc qh 2 0 0 3 dqh 0.01 0.01 0 .0
|
||||
sc qh 2 0 0 3 dqh 0.01 0.01 0 .1
|
||||
|
||||
dr ei 8
|
||||
fx 1
|
||||
|
||||
output a3,a4,a5,a6
|
||||
|
||||
sc qh 2 0 0 3 dqh 0 0 0 0.05 np 9 ti 2
|
||||
sc qh 2 0 0 3 dqh 0.01 0 0 .0
|
||||
sc qh 2 0 0 3 dqh 0.01 0.01 0 .0
|
||||
sc qh 2 0 0 3 dqh 0.01 0.01 0 .1
|
||||
|
||||
fx 2
|
||||
dr ef 8
|
||||
cc 120
|
||||
cs 10
|
||||
|
||||
output a1,a2,a3,a4
|
||||
sc qh 2 0 0 3 dqh 0 0 0 0.05 np 9 ti 2
|
||||
sc qh 2 0 0 3 dqh 0.01 0 0 .0
|
||||
sc qh 2 0 0 3 dqh 0.01 0.01 0 .0
|
||||
sc qh 2 0 0 3 dqh 0.01 0.01 0 .1
|
||||
|
||||
bz 1
|
||||
by 0
|
||||
|
||||
sc qh 0 0 2 3 dqh 0 0 0 0.05 np 9 ti 2
|
||||
sc qh 0 0 2 3 dqh 0.0 0.00 0.01 .0
|
||||
sc qh 0 0 2 3 dqh 0.01 0.0 0.01 .0
|
||||
sc qh 0 0 2 3 dqh 0.01 0.0 0.01 .1
|
||||
|
||||
dr ef 8 ei 8
|
||||
|
||||
output ach mcv
|
||||
sc ei 8 dei .5 np 15
|
||||
sc ef 8 dei .5 np 15
|
||||
|
||||
cs 7
|
||||
bb 67.89
|
||||
cc 90
|
||||
dr ef 8
|
||||
|
||||
output a1,a2,a3,a4
|
||||
sc qh 0 0 2 3 dqh 0 0 0 0.05 np 9 ti 2
|
||||
sc qh 0 0 2 3 dqh 0.0 0.00 0.01 .0
|
||||
sc qh 0 0 2 3 dqh 0.01 0.0 0.01 .0
|
||||
sc qh 0 0 2 3 dqh 0.01 0.0 0.01 .1
|
||||
|
||||
|
||||
|
||||
config close 0
|
264
tassim.tcl
Normal file
264
tassim.tcl
Normal file
@ -0,0 +1,264 @@
|
||||
# --------------------------------------------------------------------------
|
||||
# Initialization script for Triple Axis Instruments
|
||||
#
|
||||
# Dr. Mark Koennecke, November 2000
|
||||
#---------------------------------------------------------------------------
|
||||
# O P T I O N S
|
||||
set root "/data/koenneck/src/sics"
|
||||
# first all the server options are set
|
||||
|
||||
#ServerOption RedirectFile $root/log/stdtas
|
||||
|
||||
ServerOption ReadTimeOut 10
|
||||
# timeout when checking for commands. In the main loop SICS checks for
|
||||
# pending commands on each connection with the above timeout, has
|
||||
# PERFORMANCE impact!
|
||||
|
||||
ServerOption AcceptTimeOut 10
|
||||
# timeout when checking for connection req.
|
||||
# Similar to above, but for connections
|
||||
|
||||
ServerOption ReadUserPasswdTimeout 500000
|
||||
# time to wiat for a user/passwd to be sent from a client. Increase this
|
||||
# if there is a problem connecting to a server due to network overload\
|
||||
|
||||
ServerOption LogFileBaseName $root/log/taslog
|
||||
# the path and base name of the internal server logfile to which all
|
||||
# activity will be logged.
|
||||
|
||||
ServerOption ServerPort 3015
|
||||
# the port number the server is going to listen at. The client MUST know
|
||||
# this number in order to connect. It is in client.ini
|
||||
|
||||
ServerOption InterruptPort 3017
|
||||
# The UDP port where the server will wait for Interrupts from clients.
|
||||
# Obviously, clients wishing to interrupt need to know this number.
|
||||
|
||||
ServerOption LogFileDir $root/simlog
|
||||
#Where log files from commandlog are stored
|
||||
|
||||
ServerOption QuieckPort 2108
|
||||
# port to send data update messages to
|
||||
|
||||
ServerOption statusfile tasstat.tcl
|
||||
|
||||
# Telnet Options
|
||||
ServerOption TelnetPort 1305
|
||||
ServerOption TelWord sicslogin
|
||||
|
||||
# The token system
|
||||
TokenInit connan
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# U S E R S
|
||||
|
||||
# Here the SICS users are specified
|
||||
# Syntax: SicsUser name password userRightsCode
|
||||
SicsUser Spy 007 1
|
||||
#---------------------------------------------------------------------------
|
||||
# M O T O R S
|
||||
Motor A1 SIM 0. 111. -.1 2. # Monochromator Theta
|
||||
Motor A2 SIM 33.1 120. -.1 2. # Monochromator Two-Theta
|
||||
Motor A3 SIM -177.3 177.3 -.1 2. # Sample theta or omega
|
||||
Motor A4 SIM -135.1 123.4 -.1 2. # Sample Two-Theta
|
||||
Motor A5 SIM -200 200 -.1 2. # Analyzer Theta
|
||||
Motor A6 SIM -116. 166. -.1 2. # Analyzer Two-Theta
|
||||
Motor MCV SIM -9 124. -.1 2. # Monochromator curvature vertical
|
||||
Motor SRO SIM 0. 351. -.1 2. # Sample table second ring
|
||||
Motor ACH SIM -.5 11.5 -.1 2. # Analyzer curvature horizontal
|
||||
Motor MTL SIM -17 17 -.1 2. # Monochromator translation lower
|
||||
Motor MTU SIM -17 17. -.1 2. # Monochromator Translation upper
|
||||
Motor STL SIM -30 30. -.1 2. # Sample lower translation
|
||||
Motor STU SIM -30. 30. -.1 2. # Sample upper translation
|
||||
Motor ATL SIM -17 17 -.1 2. # Analyzer lower translation
|
||||
Motor ATU SIM -17 16.88 -.1 2. # Analyzer upper translation
|
||||
Motor MGL SIM -10 10 -.1 2. # Monochromator lower goniometer
|
||||
#Motor MGU SIM -30. 30. -.1 2. # Monochromator upper goniometer
|
||||
Motor SGL SIM -16 16 -.1 2. # Sample lower goniometer
|
||||
Motor SGU SIM -16 16. -.1 2. # Sample upper goniometer
|
||||
Motor AGL SIM -10 10 -.1 2. # Analyzer lower goniometer
|
||||
#Motor AGU SIM -30. 30. -.1 2. # Analyzer upper goniometer
|
||||
#Motor MSC SIM -30. 30. -.1 2. # Monochromator changer
|
||||
#Motor ASC SIM -30. 30. -.1 2. # Analyzer changer
|
||||
#Motor CSC SIM -30. 30. -.1 2. # Collimator changer
|
||||
#--------------------------------------------------------------------------
|
||||
# C O U N T E R
|
||||
MakeCounter counter SIM -1.
|
||||
#--------------------------------------------------------------------------
|
||||
# SA M P L E V A R I A B L E S
|
||||
# AS-CS cell length
|
||||
# AA-CC cell angles
|
||||
# AX-AZ scattering vector 1
|
||||
# BX-BY scattering vector 2
|
||||
|
||||
VarMake AS Float User
|
||||
VarMake BS Float User
|
||||
VarMake CS Float User
|
||||
VarMake AA Float User
|
||||
VarMake BB Float User
|
||||
VarMake CC Float User
|
||||
VarMake AX Float User
|
||||
VarMake AY Float User
|
||||
VarMake AZ Float User
|
||||
VarMake BX Float User
|
||||
VarMake BY Float User
|
||||
VarMake BZ Float User
|
||||
#---------------------------------------------------------------------------
|
||||
# E N E R G Y & R E L A T E D V A R I A B L E S
|
||||
#
|
||||
# EI incident energy
|
||||
# KI incident neutron wavevector
|
||||
# EF final neutron energy
|
||||
# KF final neutron wavevector
|
||||
# QH-QL Q in reciprocal space
|
||||
# EN energy transfer
|
||||
|
||||
|
||||
VarMake EI Float User
|
||||
VarMake KI Float User
|
||||
VarMake EF Float User
|
||||
VarMake KF Float User
|
||||
VarMake QH Float User
|
||||
VarMake QK Float User
|
||||
VarMake QL Float User
|
||||
VarMake EN Float User
|
||||
#---------------------------------------------------------------------------
|
||||
# I N S T R U M E N T V A R I A B L E S
|
||||
# DM, DA d-spacing monochromator, analyzer
|
||||
# SM, SS, SA scattering senses monochromator, sample, analyzer
|
||||
# FX 1 for constant KI, 2 for constant KF
|
||||
# NP no of scan points
|
||||
# TI preset time
|
||||
# MN preset monitor
|
||||
# IF* various magnet currents
|
||||
# HELM Helmholtz angle of some sort.
|
||||
# HX-HZ Helmholtz field components
|
||||
# F1, F2 Flipper switches
|
||||
|
||||
VarMake instrument Text Mugger
|
||||
instrument SIM-DRUECHAL
|
||||
instrument lock
|
||||
|
||||
VarMake DM Float Mugger
|
||||
VarMake DA Float Mugger
|
||||
VarMake SM Int User
|
||||
VarMake SS Int User
|
||||
VarMake SA Int User
|
||||
VarMake FX Int User
|
||||
VarMake NP Int User
|
||||
VarMake TI Float User
|
||||
VarMake MN Int User
|
||||
VarMake IF1V Float User
|
||||
VarMake IF2V Float User
|
||||
VarMake IF1H Float User
|
||||
VarMake IF2H Float User
|
||||
VarMake HELM Float User
|
||||
VarMake HX Float User
|
||||
VarMake HY Float User
|
||||
VarMake HZ Float User
|
||||
VarMake SWUNIT Int User
|
||||
|
||||
VarMake F1 Int User
|
||||
VarMake F2 Int User
|
||||
|
||||
VarMake title Text User
|
||||
VarMake user Text User
|
||||
VarMake lastcommand Text User
|
||||
VarMake output Text User
|
||||
VarMake local Text User
|
||||
VarMake alf1 Float User
|
||||
VarMake alf2 Float User
|
||||
VarMake alf3 Float User
|
||||
VarMake alf4 Float User
|
||||
VarMake bet1 Float User
|
||||
VarMake bet2 Float User
|
||||
VarMake bet3 Float User
|
||||
VarMake bet4 Float User
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# I N C R E M E N T V A R I A B L E S
|
||||
VarMake DA1 Float User
|
||||
VarMake DA2 Float User
|
||||
VarMake DA3 Float User
|
||||
VarMake DA4 Float User
|
||||
VarMake DA5 Float User
|
||||
VarMake DA6 Float User
|
||||
VarMake DMCV Float User
|
||||
VarMake DSRO Float User
|
||||
VarMake DACH Float User
|
||||
VarMake DMTL Float User
|
||||
VarMake DMTU Float User
|
||||
VarMake DSTL Float User
|
||||
VarMake DSTU Float User
|
||||
VarMake DATL Float User
|
||||
VarMake DATU Float User
|
||||
VarMake DMGL Float User
|
||||
#VarMake DMGU Float User
|
||||
VarMake DSGL Float User
|
||||
VarMake DSGU Float User
|
||||
VarMake DAGL Float User
|
||||
#VarMake DAGU Float User
|
||||
#VarMake DMSC Float User
|
||||
#VarMake DASC Float User
|
||||
#VarMake DCSC Float User
|
||||
VarMake DEI Float User
|
||||
VarMake DKI Float User
|
||||
VarMake DEF Float User
|
||||
VarMake DKF Float User
|
||||
VarMake DQH Float User
|
||||
VarMake DQK Float User
|
||||
VarMake DQL Float User
|
||||
VarMake DEN Float User
|
||||
VarMake WAV Float User
|
||||
VarMake ETAM Float User
|
||||
VarMake ETAS Float User
|
||||
VarMake ETAA Float User
|
||||
VarMake QM Float User
|
||||
VarMake DQM Float User
|
||||
VarMake DT Float User
|
||||
VarMake LPA Int User
|
||||
#--------------------------------------------------------------------------
|
||||
# Curvature variables
|
||||
VarMake MRX1 Float Mugger
|
||||
VarMake MRX2 Float Mugger
|
||||
VarMake ARX1 Float Mugger
|
||||
VarMake ARX2 Float Mugger
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Datafile generation variables
|
||||
VarMake SicsDataPath Text Mugger
|
||||
SicsDataPath "$root/tmp/"
|
||||
VarMake SicsDataPrefix Text Mugger
|
||||
SicsDataPrefix simchal
|
||||
SicsDataPrefix lock
|
||||
VarMake SicsDataPostFix Text Mugger
|
||||
SicsDataPostFix ".scn"
|
||||
SicsDataPostFix lock
|
||||
MakeDataNumber SicsDataNumber "$root/danu.dat"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# A helper variable for the status display
|
||||
VarMake scaninfo text Internal
|
||||
scaninfo "0,Unknown,1.0,.1"
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# I N S T A L L S P E C I A L S I C S C O M M A N D S
|
||||
MakeScanCommand iscan counter tas.hdd recover.bin
|
||||
MakePeakCenter iscan
|
||||
#---------------------------------------------------------------------------
|
||||
# I N S T A L L T A S C O M P A T A B I L I T Y C O M M A N D S
|
||||
MakeTAS iscan
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# I N S T A L L T A S S C R I P T E D C O M M A N D S
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# Install sync
|
||||
MakeSync localhost 2915 Spy 007
|
||||
|
||||
source $root/tascom.tcl
|
||||
|
||||
|
||||
|
||||
|
||||
|
262
tastest.tcl
Normal file
262
tastest.tcl
Normal file
@ -0,0 +1,262 @@
|
||||
# --------------------------------------------------------------------------
|
||||
# Initialization script for Triple Axis Instruments
|
||||
#
|
||||
# Dr. Mark Koennecke, November 2000
|
||||
#---------------------------------------------------------------------------
|
||||
# O P T I O N S
|
||||
set root "/data/koenneck/src/sics"
|
||||
# first all the server options are set
|
||||
|
||||
#ServerOption RedirectFile $root/log/stdtas
|
||||
|
||||
ServerOption ReadTimeOut 10
|
||||
# timeout when checking for commands. In the main loop SICS checks for
|
||||
# pending commands on each connection with the above timeout, has
|
||||
# PERFORMANCE impact!
|
||||
|
||||
ServerOption AcceptTimeOut 10
|
||||
# timeout when checking for connection req.
|
||||
# Similar to above, but for connections
|
||||
|
||||
ServerOption ReadUserPasswdTimeout 500000
|
||||
# time to wiat for a user/passwd to be sent from a client. Increase this
|
||||
# if there is a problem connecting to a server due to network overload\
|
||||
|
||||
ServerOption LogFileBaseName $root/log/taslog
|
||||
# the path and base name of the internal server logfile to which all
|
||||
# activity will be logged.
|
||||
|
||||
ServerOption ServerPort 2915
|
||||
# the port number the server is going to listen at. The client MUST know
|
||||
# this number in order to connect. It is in client.ini
|
||||
|
||||
ServerOption InterruptPort 2917
|
||||
# The UDP port where the server will wait for Interrupts from clients.
|
||||
# Obviously, clients wishing to interrupt need to know this number.
|
||||
|
||||
ServerOption LogFileDir $root/log
|
||||
#Where log files from commandlog are stored
|
||||
|
||||
ServerOption QuieckPort 2108
|
||||
# port to send data update messages to
|
||||
|
||||
ServerOption statusfile tasstat.tcl
|
||||
|
||||
# Telnet Options
|
||||
ServerOption TelnetPort 1301
|
||||
ServerOption TelWord sicslogin
|
||||
|
||||
# The token system
|
||||
TokenInit connan
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# U S E R S
|
||||
|
||||
# Here the SICS users are specified
|
||||
# Syntax: SicsUser name password userRightsCode
|
||||
SicsUser Spy 007 1
|
||||
#---------------------------------------------------------------------------
|
||||
# M O T O R S
|
||||
Motor A1 SIM 0. 111. -.1 2. # Monochromator Theta
|
||||
Motor A2 SIM 33.1 120. -.1 2. # Monochromator Two-Theta
|
||||
Motor A3 SIM -177.3 177.3 -.1 2. # Sample theta or omega
|
||||
Motor A4 SIM -135.1 123.4 -.1 2. # Sample Two-Theta
|
||||
Motor A5 SIM -200 200 -.1 2. # Analyzer Theta
|
||||
Motor A6 SIM -116. 166. -.1 2. # Analyzer Two-Theta
|
||||
Motor MCV SIM -9 124. -.1 2. # Monochromator curvature vertical
|
||||
Motor SRO SIM 0. 351. -.1 2. # Sample table second ring
|
||||
Motor ACH SIM -.5 11.5 -.1 2. # Analyzer curvature horizontal
|
||||
Motor MTL SIM -17 17 -.1 2. # Monochromator translation lower
|
||||
Motor MTU SIM -17 17. -.1 2. # Monochromator Translation upper
|
||||
Motor STL SIM -30 30. -.1 2. # Sample lower translation
|
||||
Motor STU SIM -30. 30. -.1 2. # Sample upper translation
|
||||
Motor ATL SIM -17 17 -.1 2. # Analyzer lower translation
|
||||
Motor ATU SIM -17 16.88 -.1 2. # Analyzer upper translation
|
||||
Motor MGL SIM -10 10 -.1 2. # Monochromator lower goniometer
|
||||
#Motor MGU SIM -30. 30. -.1 2. # Monochromator upper goniometer
|
||||
Motor SGL SIM -16 16 -.1 2. # Sample lower goniometer
|
||||
Motor SGU SIM -16 16. -.1 2. # Sample upper goniometer
|
||||
Motor AGL SIM -10 10 -.1 2. # Analyzer lower goniometer
|
||||
#Motor AGU SIM -30. 30. -.1 2. # Analyzer upper goniometer
|
||||
#Motor MSC SIM -30. 30. -.1 2. # Monochromator changer
|
||||
#Motor ASC SIM -30. 30. -.1 2. # Analyzer changer
|
||||
#Motor CSC SIM -30. 30. -.1 2. # Collimator changer
|
||||
#--------------------------------------------------------------------------
|
||||
# C O U N T E R
|
||||
MakeCounter counter SIM -1.
|
||||
#--------------------------------------------------------------------------
|
||||
# SA M P L E V A R I A B L E S
|
||||
# AS-CS cell length
|
||||
# AA-CC cell angles
|
||||
# AX-AZ scattering vector 1
|
||||
# BX-BY scattering vector 2
|
||||
|
||||
VarMake AS Float User
|
||||
VarMake BS Float User
|
||||
VarMake CS Float User
|
||||
VarMake AA Float User
|
||||
VarMake BB Float User
|
||||
VarMake CC Float User
|
||||
VarMake AX Float User
|
||||
VarMake AY Float User
|
||||
VarMake AZ Float User
|
||||
VarMake BX Float User
|
||||
VarMake BY Float User
|
||||
VarMake BZ Float User
|
||||
#---------------------------------------------------------------------------
|
||||
# E N E R G Y & R E L A T E D V A R I A B L E S
|
||||
#
|
||||
# EI incident energy
|
||||
# KI incident neutron wavevector
|
||||
# EF final neutron energy
|
||||
# KF final neutron wavevector
|
||||
# QH-QL Q in reciprocal space
|
||||
# EN energy transfer
|
||||
|
||||
|
||||
VarMake EI Float User
|
||||
VarMake KI Float User
|
||||
VarMake EF Float User
|
||||
VarMake KF Float User
|
||||
VarMake QH Float User
|
||||
VarMake QK Float User
|
||||
VarMake QL Float User
|
||||
VarMake EN Float User
|
||||
#---------------------------------------------------------------------------
|
||||
# I N S T R U M E N T V A R I A B L E S
|
||||
# DM, DA d-spacing monochromator, analyzer
|
||||
# SM, SS, SA scattering senses monochromator, sample, analyzer
|
||||
# FX 1 for constant KI, 2 for constant KF
|
||||
# NP no of scan points
|
||||
# TI preset time
|
||||
# MN preset monitor
|
||||
# IF* various magnet currents
|
||||
# HELM Helmholtz angle of some sort.
|
||||
# HX-HZ Helmholtz field components
|
||||
# F1, F2 Flipper switches
|
||||
|
||||
VarMake instrument Text Mugger
|
||||
instrument DRUECHAL
|
||||
instrument lock
|
||||
|
||||
VarMake DM Float Mugger
|
||||
VarMake DA Float Mugger
|
||||
VarMake SM Int User
|
||||
SM 1
|
||||
SM lock
|
||||
VarMake SS Int User
|
||||
VarMake SA Int User
|
||||
VarMake FX Int User
|
||||
VarMake NP Int User
|
||||
VarMake TI Float User
|
||||
VarMake MN Int User
|
||||
VarMake IF1V Float User
|
||||
VarMake IF2V Float User
|
||||
VarMake IF1H Float User
|
||||
VarMake IF2H Float User
|
||||
VarMake HELM Float User
|
||||
VarMake HX Float User
|
||||
VarMake HY Float User
|
||||
VarMake HZ Float User
|
||||
VarMake SWUNIT Int User
|
||||
|
||||
VarMake F1 Int User
|
||||
VarMake F2 Int User
|
||||
|
||||
VarMake title Text User
|
||||
VarMake user Text User
|
||||
VarMake lastcommand Text User
|
||||
VarMake output Text User
|
||||
VarMake local Text User
|
||||
VarMake alf1 Float User
|
||||
VarMake alf2 Float User
|
||||
VarMake alf3 Float User
|
||||
VarMake alf4 Float User
|
||||
VarMake bet1 Float User
|
||||
VarMake bet2 Float User
|
||||
VarMake bet3 Float User
|
||||
VarMake bet4 Float User
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# I N C R E M E N T V A R I A B L E S
|
||||
VarMake DA1 Float User
|
||||
VarMake DA2 Float User
|
||||
VarMake DA3 Float User
|
||||
VarMake DA4 Float User
|
||||
VarMake DA5 Float User
|
||||
VarMake DA6 Float User
|
||||
VarMake DMCV Float User
|
||||
VarMake DSRO Float User
|
||||
VarMake DACH Float User
|
||||
VarMake DMTL Float User
|
||||
VarMake DMTU Float User
|
||||
VarMake DSTL Float User
|
||||
VarMake DSTU Float User
|
||||
VarMake DATL Float User
|
||||
VarMake DATU Float User
|
||||
VarMake DMGL Float User
|
||||
#VarMake DMGU Float User
|
||||
VarMake DSGL Float User
|
||||
VarMake DSGU Float User
|
||||
VarMake DAGL Float User
|
||||
#VarMake DAGU Float User
|
||||
#VarMake DMSC Float User
|
||||
#VarMake DASC Float User
|
||||
#VarMake DCSC Float User
|
||||
VarMake DEI Float User
|
||||
VarMake DKI Float User
|
||||
VarMake DEF Float User
|
||||
VarMake DKF Float User
|
||||
VarMake DQH Float User
|
||||
VarMake DQK Float User
|
||||
VarMake DQL Float User
|
||||
VarMake DEN Float User
|
||||
VarMake WAV Float User
|
||||
VarMake ETAM Float User
|
||||
VarMake ETAS Float User
|
||||
VarMake ETAA Float User
|
||||
VarMake QM Float User
|
||||
VarMake DQM Float User
|
||||
VarMake DT Float User
|
||||
VarMake LPA Int User
|
||||
#--------------------------------------------------------------------------
|
||||
# Curvature variables
|
||||
VarMake MRX1 Float Mugger
|
||||
VarMake MRX2 Float Mugger
|
||||
VarMake ARX1 Float Mugger
|
||||
VarMake ARX2 Float Mugger
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Datafile generation variables
|
||||
VarMake SicsDataPath Text Mugger
|
||||
SicsDataPath "$root/tmp/"
|
||||
VarMake SicsDataPrefix Text Mugger
|
||||
SicsDataPrefix simchal
|
||||
SicsDataPrefix lock
|
||||
VarMake SicsDataPostFix Text Mugger
|
||||
SicsDataPostFix ".scn"
|
||||
SicsDataPostFix lock
|
||||
MakeDataNumber SicsDataNumber "$root/danu.dat"
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
# A helper variable for the status display
|
||||
VarMake scaninfo text Internal
|
||||
scaninfo "0,Unknown,1.0,.1"
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# I N S T A L L S P E C I A L S I C S C O M M A N D S
|
||||
MakeScanCommand iscan counter tas.hdd recover.bin
|
||||
MakePeakCenter iscan
|
||||
#---------------------------------------------------------------------------
|
||||
# I N S T A L L T A S C O M P A T A B I L I T Y C O M M A N D S
|
||||
MakeTAS iscan
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
# I N S T A L L T A S S C R I P T E D C O M M A N D S
|
||||
|
||||
source $root/tascom.tcl
|
||||
|
||||
|
||||
|
||||
|
||||
|
3
test.tcl
3
test.tcl
@ -172,6 +172,7 @@ nvs add 3800 4500
|
||||
nvs add 5900 6700
|
||||
nvs add 8100 9600
|
||||
unset dornen
|
||||
emon unregister nvswatch
|
||||
MakeSANSWave lumbda nvs
|
||||
ClientPut "Velocity Selector done"
|
||||
SicsAlias MTL sax
|
||||
@ -418,10 +419,12 @@ VarMake flightpathlength Float Mugger
|
||||
delay 2500
|
||||
|
||||
MakeFocusAverager average hm
|
||||
|
||||
FocusInstall hm focus.dic $shome/sics/focusmerge.dat
|
||||
storefocus upper 1
|
||||
storefocus lower 1
|
||||
|
||||
|
||||
#MakeChopper choco docho lnsp20 4000 8
|
||||
MakeChopper choco sim
|
||||
#ChopperAdapter fermispeed choco chopper1.nspee 0 20000
|
||||
|
Reference in New Issue
Block a user