diff --git a/confvirtualmot.c b/confvirtualmot.c index ad6b8aa2..19bb2f3a 100644 --- a/confvirtualmot.c +++ b/confvirtualmot.c @@ -206,7 +206,7 @@ static int ConfCheckLimits(void *pData, float fVal, char *error, int errLen){ while(iRet != 0) { LLDnodeDataTo(self->motorList,&tuktuk); - status = tuktuk.pDriv->CheckLimits(tuktuk.data,fVal,error,errLen); + status = tuktuk.pDriv->CheckLimits(tuktuk.data,tuktuk.value,error,errLen); if(status != 1){ return status; } diff --git a/doc/manager/amor.htm b/doc/manager/amor.htm new file mode 100644 index 00000000..ebfd8b92 --- /dev/null +++ b/doc/manager/amor.htm @@ -0,0 +1,113 @@ + + +Special Commands for the Reflectometer(AMOR) + + +

Special Commands for the Reflectometer (AMOR)

+

+There are some special command initializations for the reflectometer AMOR. + These commands are most likely not portable to other instruments because + they encompass the special geometry at AMOR and the AMOR development has + not fully matured. The following initialization commands are available: +

+
MakeAmor2T name da +
This creates a virtual two theta motor for the reflectometer +AMOR. The two parameters are the name of the object in SICS and a +Tcl-array with configuration parameters. The needed elements of this +array are: +
+
mom +
The monochromator omega motor. +
som +
The sample omega motor. +
coz +
The height movement of the detector. +
cox +
The movement of the detector along the optical bench. +
stz +
The height movement of the sample connected to the omega circle. +
soz +
The height movement of the sample table. +
d4b +
The motor moving the whole diaphragm 4 up. +
d5b +
The motor moving the whole diaphragm 5 up. +
com +
The omega mevement of the detector. +
+An example: +
+set a2t(mom) mom
+set a2t(som) som
+set a2t(coz) coz
+set a2t(cox) cox
+set a2t(stz) stz
+set a2t(soz) soz
+set a2t(d4b) d4b
+set a2t(d5b) d5b
+set a2t(com) com
+MakeAmor2T a2t a2t
+
+creates a virtual AMOR two theta motor with the name a2t. +
MakeStoreAmor hm +
Creates an object for writing reflectometer data files. The name +of the command is storeamor. The parameter hm denotes the histogram +memory object. +
MakeAmorStatus name scan hm +
This creates a helper object for the reflectometer status display +with name name. This object performs some operations on behalf of the +status display for the reflectometer AMOR. The parameter scan denotes +the name of the scan object. The parameter hm the name of the +histogram memory object. +
+

+

AMOR Status Display Commands

+

+MakeAmorStatus creates a SICS command which is used by the AMOR status + display for displaying proceesed data, especially in TOF-mode. This module + provides the following commands: +

+
amorstatus interest +
This registers this connection for receiving automatic +notifications. Automatic notifications send are: +
+
SCANSTART +
At scan start a message ScanClear is sent followed by the +uuencoded new x-axis for the plot. +
SCANPOINT +
At each scan point the arrays of counts in both detector are sent +in uuencoded form labelled arrow_spinupup and arrow_spinuplo. +
COUNTSTART +
The start of counting on the histogram memory. Send a message +TOFClear and then the uuencoded time binning labelled +arrow_time. +
FILELOADED +
activated each time user defined model data is loaded into the +SICS server. This data gets send as arrow_name in uuencoded form. Both +x- and y-axis are sent in floating point. +
+Please note that floating point data is transformed to fixed point by +multiplication of 65653 before transfer. The first number in each +uuencoded message is an integer describing the length of the data. In +case of double data such as fileloaded the y-data follows immediatetly +after the x-data. Also the appropriate data is automatically sent after +the interest command. +
amorstatus collapse +
sums all counts in all detectors in time and sends the data back +as an uuencoded image. The first two numbers in the message define the +dimensions of the data. +
amorstatus sample name x1 x2 y1 y2 +
Sums the detector counts on an area defined by the rectangle x1, +x2, y1, y2. The length of this is the time binning. The data is sent +back in uuencoded form labelled arrow_name. +
amorstatus clear +
Clears all user loaded data. +
amorstatus load filename scale +
loads user defined data for distribution to the status display +clients. The y data is scaled according to the scale factor provided. +
amorstatus projectytof +
Returns a UUencoded 2D array of y against TOF. +
+

+ + diff --git a/doc/manager/command.htm b/doc/manager/command.htm index ba24bbe6..3658a739 100644 --- a/doc/manager/command.htm +++ b/doc/manager/command.htm @@ -84,13 +84,17 @@ the token force command. circle diffractometer. The four parameters are the names of the motors driving the two theta, omega, chi and phi circles of the diffractometer. These motors must already exists before this command may succeed. +
MakeHKLMot hkl +
Creates the drivable H, k, l virtual motors using hkl, an object created by +MakeHKL for calculations.
MakeDifrac tth om chi phi cter
This command installs the Difrac subsystem into SICS. Difrac is a whole F77 package for controlling a four circle diffractometer. Afterwards Difrac commands are available in SICS with the prefix dif, for example dif ah calls the difrac ah command. Difrac is described in more detail elsewhere. The parameters are the four -circle motors two theta, omega, chi and phi and the counter. +circle motors two theta, omega, chi and phi and the counter. This is no longer + maintained.
MakeOptimise name countername
This command installs the Peak Optimiser into the SICS server. The Peak Optimiser is an object which can locate the maximum of a peak with respect @@ -157,7 +161,7 @@ with name name. This object performs some operations on behalf of the status display for the reflectometer AMOR. The parameter scan denotes the name of the scan object. The parameter hm the name of the histogram memory object. -
MakeMesure name scanobject hklobject omega o2t fileroot datanumberobject +
MakeMesure name scanobject hklobject omega s2t fileroot datanumberobject
MakeMesure installs the single counter four circle diffractometer measurement procedure into SICS. It will be accessible as object name afterwards. MakeMesure takes a lot of parameters: @@ -168,8 +172,8 @@ afterwards. MakeMesure takes a lot of parameters:
The name of the object which does crystallographic calculations.
omega
The name of the motor driving omega. -
o2t -
The name of the omega two theta virtual motor for omega two theta scans. +
s2t +
The name of the two theta motor for use in omega two theta scans.
fileroot
The full path to the data file directory without final /
datanumberobject @@ -189,7 +193,13 @@ selector which is controlled by this wavelength variable.
MakeXYTable myname
Creates a XYTable object with the name myname. This object can store a list of x-y values. - +
MakeNXScript [name] +
Installs the NeXus dictionary scripting module. If no name is given, the + name will be nxscript. +
MakeSinq +
Install the listener module for the accelerator divisions broadcast messages. This + creates a command sinq. +

The Scan Command Header Description File

diff --git a/doc/manager/focus.htm b/doc/manager/focus.htm new file mode 100644 index 00000000..e59607e5 --- /dev/null +++ b/doc/manager/focus.htm @@ -0,0 +1,47 @@ + + +Special FOCUS Initializations + + +

Special FOCUS Initializations

+

+These initailizations are special to the FOCUS instrument: +

+
InstallFocusmerge datafile +
Installs the module which is responsible for merging focus data into + merged detector banks. +
MakeFocusAverager average hmc +
Installs the average command and the focusraw command into SICS which + are used by the FOCUS status client in order to display processed + histogram memory data. +
+

+

Special Internal FOCUS Support Commands

+

+

+
focusraw bankid +
Dumps in UUencoded form the content of the detector bank bankid. This is +required in order to add the TOF-binning to the data and in order to handle + the virtual merged detector bank which is built from contributions of the + three physical detector banks. +
average start stop bankid +
Sums the detectors between start and stop of detector bankid into a + histogram. A standard display in the status client. +
focusmerge puttwotheta nxscriptmod bankname alias +
Writes two theta values for the detector bank bankname into + the file described by the nxscript module nxsciptmod to the + alias alias. A helper function for data file writing. +
focusmerge putmerged nxscriptmod alias +
Writes the virtual merged detector bank into alias in + nxscriptmod. +
focusmerge putsum nxscriptmod bankname alias +
Writes the summed counts for detector bank bankname under alias + into nxscriptmod. +
focusmerge putelastic nxscriptmod alias theoelastic +
Calculate the position of the elastic line and write it to alias in + nxscriptmod. If no elastic line can be calculated, the theoretical + elastic line, theoelastic, is used. +
+

+ + diff --git a/doc/manager/four.htm b/doc/manager/four.htm new file mode 100644 index 00000000..28b09973 --- /dev/null +++ b/doc/manager/four.htm @@ -0,0 +1,97 @@ + + +Initialization for Four Circle Diffractometers + + +

Initialization for Four Circle Diffractometers

+

+This section describes how the modules which are special for a four + circle single crystal diffractometer are configured into SICS. The + following feautures are available: +

+
MakeHKL theta omega chi phi +
MakeHKL creates the hkl command for the calculation of settings for a four +circle diffractometer. The four parameters are the names of the motors +driving the two theta, omega, chi and phi circles of the diffractometer. +These motors must already exists before this command may succeed. +
MakeHKLMot hkl +
Creates the drivable H, k, l virtual motors using hkl, an + object created by MakeHKL for calculations. +
MakeDifrac tth om chi phi cter +
This command installs the Difrac subsystem into SICS. Difrac is a +whole F77 package for controlling a four circle +diffractometer. Afterwards Difrac commands are available in SICS with +the prefix dif, for example dif ah calls the difrac ah command. Difrac +is described in more detail elsewhere. The parameters are the four +circle motors two theta, omega, chi and phi and the counter. This is no longer + maintained. +
MakeMesure name scanobject hklobject omega s2t fileroot datanumberobject +
MakeMesure installs the single counter four circle diffractometer +measurement procedure into SICS. It will be accessible as object name +afterwards. MakeMesure takes a lot of parameters: +
+
scanobject +
The name of the internal scan object. +
hklobject +
The name of the object which does crystallographic calculations. +
omega +
The name of the motor driving omega. +
s2t +
The name of the two theta motor for use in omega two theta scans. +
fileroot +
The full path to the data file directory without final / +
datanumberobject +
The name of the SICS data number object for creating unique file +numbers. +
+
MakeUBCalc name hklobject +
This installs a UB matrix calculation module with the name name + into SICS. The second parameter is a hklobject as created with MakeHKL + to which any calculated UB's can be transferred. +
MakeHklscan scanobject hklobject +
Installs the hklscan command which allows to scan in reciprocal space. +Scanobject is the name of SICS internal scan object, hklobject the name of a + reciprocal space calculation object as configured with MakeHKL. +
MakeTRICSSupport +
Installs a command, tricssupport, which helps the TRICS status + display. +
+

+

+Commands implemented by tricssupport: +

+
tricssupport oldframe file idet nFrame +
Loads and sends the frame nFrame of detector idet from file file in + UUencoded form. +
tricssupport interest +
Enables this connection to receive notifications whenever a new frame + of data had been written +
tricssupport newframe +
Called from scripts. Triggers sending new frames to all registered + connections. +
+

+There are also a lot of scripted command available for four circle + diffractometers. These may be copied from tricscom.tcl. These include: +
+
four +
print the four all important angles +
tricsscan start step np +
Omega scan with a PSD +
psdrefscan file step np mode preset +
Read reflections from file, drive to them, do a omega scan with tricsscan + using the parameters specified. +
detscan start step np +
Do a detector calibration scan. +
phscan start step np +
Do a phi scan +
hklscan2d +
Scanning reciprocal space with the area detector +
scan2d +
Configure SICS for general scanning with the PSD. This is meant + to supersede many of the special scans above. +
scan1d +
Configure SICS for general scanning with the single detector. +
+ + diff --git a/doc/manager/gencom.htm b/doc/manager/gencom.htm new file mode 100644 index 00000000..07dd82db --- /dev/null +++ b/doc/manager/gencom.htm @@ -0,0 +1,243 @@ + + +Initialization of General Commands + + +

Initialization of General Commands

+

+This section gives details on the initialization of commands which are + common to many different instruments. The command set of SICS can be tailored + to cover many specific needs. Moreover this system allows to replace + functionality by other implementations suited to another users taste. This + is a list of common command initialization commands. +

+
MakeRuenBuffer +
MakeRuenBuffer makes the RünBuffer system available. +
MakeBatchManager [name] +
Installs the new batch buffer management system. If no name is +given, the default will be exe. +
MakeDrive +
MakeDrive creates the drive and run command. +
Publish name access +
The SICS server uses Tcl as its internal macro language. However, it +was felt that the whole Tcl command set should not be available to all users +from the command line without any protection. There are reasons for this: + careless use of Tcl may clog up memory, thereby grinding the system to a + halt. Invalid Tcl statements may cause the server to hang. Last not least, + Tcl contains commands to manipulate files and access the operating system. + This is a potential security problem when the server is hacked. However, + in order to make macro procedures available the Publish + command exists. It makes a Tcl command name available to SICS users with the + access code access. Valid values for access are: Internal, Mugger, User + and Spy. +
TokenInit tokenpassword +
This command initialises the token control management system with the +token command. The single parameter tokenpassword specifies the password for +the token force command. +
MakeOptimise name countername +
This command installs the Peak Optimiser into the SICS server. The Peak +Optimiser is an object which can locate the maximum of a peak with respect +to several variables. The arguments are: name, the name under which the Peak +Optimiser can be accessed within SICS and countername, which is the name of +an already configured SICS counter box. +
MakeO2T nam OM 2TM +
creates an omega 2Theta virtual motor +with name nam for omega 2Theta scans. OM defines an omega motor, 2TM a two +theta motor. +
MakeDataNumber SicsDataNumber filename +
This command makes a +variable SicsDataNumber available which holds the current sequential data + file number. filename is the complete path to the file were this data +number is stored. This file should never, ever be edited without good +reason, i.e. resetting the sequential number to 0 at the beginning of a +year. +
MakeXYTable myname +
Creates a XYTable object with the name myname. This object can store a + list of x-y values. +
MakeSinq +
Install the listener module for the accelerator divisions broadcast + messages. This creates a command sinq. +
MakeMaximize counter +
Installs a command max into SICS which implements a more efficient + algorithm for locating the maximum of a peak then scanning and peak or + center. +
MakeMaxDetector name +
Installs name into SICS which implements a command for locating + maxima on a two dimensional histogram memory image. +
MakeLin2Ang name motor +
Creates a virtual motor name which translates an input angle into a + translation along a tangent to the rotation axis. The distance of the + translation table can be configured as variable: name length once this + is established. +
MakeSWHPMotor realmotor switchscript mot1 mot2 mot3 +
Creates switched motors mot1, mot2 and mot3 for real motor + realmotor. For switching the script switchscript is used. This + can be used when several motors are operated through the same + motor driver. This implementation is not completely general now. +
+

+

Monochromators

+

+A monochromator is represented in SICS through a monochromator object which + holds all the parameters associated with the monochromator and virtual + motors which drive wavelength or energy. The commands to configure such a + monochromator are: +

+
MakeMono name M1 M2 M3 M4 +
This command creates a crystal monochromator object. Such a +monochromator object is necessary for the usage of the wavelength or energy +variables. The parameter name defines the name of the monochromator object +in the system. M1 and M2 are the names of the Theta and two Theta motors +respectively. M3 is an optional parameter defining a motor for driving the +horizontal curvature. M4 is an optional parameter defining a motor for +driving the vertical curvature of the monochromator. +
MakeWaveLength nam mono +
creates a wavelength variable nam. The monochromator mono is used for +adjustment. +
MakeEnergy nam mono +
creates a energy variable nam. The +monochromator mono is used for adjustment. +
MakeOscillator name motor +
Installs a module name which oscillates motor between the software + limits of the motor. This is useful for suppressing preferred + orientation effects on powder diffractometers.name then supports the + commands: start, stop, status which are self explanatory. +
+

+

Reoccuring Tasks

+

+Sometimes it may be necessary to execute a SICS command at regular +time intervalls. This can be achieved with the sicscron command: +

+
sicscron intervall bla blab blab +
This command installs a reoccuring task into SICS. The first +parameter is the intervall in seconds between calls to the SICS +command. Everything behind that is treated as the command to execute. +
+

+

The SICS Online Help System

+

+SICS has a simple built in help system. Help text is stored in simple +ASCII text files which are printed to the client on demand. The help +system can search for help files in several directories. Typically one +would want one directory with general SICS help files and another one +with instrument specific help files. If help is invoked without any +options, a default help file is printed. This file is supposed to +contain a directory of available help topics together with a brief +description. The normal usage is: help topicname . The help system +will then search for a file named topicname.txt in its help +directories. +

+

+A SICS manager will need to configure this help system. A new +directory can be added to the list of directories to search with the +command: +

+help configure adddir dirname
+
+The default help file can be specified with: +
+help configure defaultfile filename 
+
+Each of these command given without a parameter print the current +settings. +

+

Aliases in SICS

+

+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. +

+

Object Aliases

+

+An object alias is another name for a first class object installed +into the SICS interpreter. For instance a second name for a motor. For +instance the motor twotheta is quite often aliased to a4. Such an +alias can be used like a normal SICS objects. Even in commands which +access internal SICS interfaces like the drive command or +others. Object aliases are installed into SICS with the SICSAlias +command: +

+
SicsAlias oldname newname +
This command installs newname as alias for the object oldname. +
+SicsAlias can only be used within initialization scripts. SicsAlias is + considered deprecated and can be replaced with the superior runtime + aliases described below. +

+

Runtime Aliases

+

+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: +

+
DefineAlias aliasname SICSobject +
This defines aliasname to be the alias for the SICS object SICSobject. + It is not needed that SICSobject already exists. If SICSobject is already + an alias, it is translated before definition. + Multiple translation is possible, depending on the order of definition. + When an alias is used, and it does not point to an existing object, + the behaviour is the same as if an unknown object would have been used. +
DefineAlias aliasname +
This command deletes the alias aliasname. +
+

+

Command Aliases

+

+Command aliases are shortcuts for lengthy commands. For instance one +might want to define A4LL as a shortcut for "a4 softlowerlim". This is +just to save typing or adapt SICS to MAD users who appear to have an +unlimited memory for 2-4 letter acronyms. It is possible to redefine a +SICS object with this for instance to define tt as an alias for +temperature. However if one tries to use tt in a drive command it will +fail because it is just a text replacement. A command alias can be +installed into SICS at any time with manager privilege and the +command: +

+
alias shortcut bla bla bla .... +
This define shortcut as an alias for everything behind it. +
+A shortcut may take parameters. +

+

The AntiCollision Module

+

+In some cases motors have to be drive in a coordinated way. For instance, + at TRICS, the chi motor may need to move first before omega can be + driven in order to avoid collisions. Or at the ECB instruments, only one + of eight motors in a rack can be driven at any given time. The anti collision + module now allows to implement this. Anticollisions pattern of + operation: Each + collaborating motor is registered with the anti collision module. When trying + to start such a motor, the anti collider just takes a note where it shoud go. + On the first status check, a program is called which has to + arrange the running of the motors into a sequence. This sequence then is + executed by the anti collision module. The program which arranges the + motors into a sequence is a configurable parameter and usually implemented + as a script in SICS own marco language. In the SICS initialization file this + requires the commands: +

+
AntiCollisionInstall +
Creates the anitcollision module. +
anticollision register motorname +
Registers motorname with the anti collision module. +
anticollision script scriptname +
This command configures the script which is responsible for + arranging the sequence of operations. +
+The script configured into anticollision is called with pairs + or motor names and targets as parameters, Example: +
+sans2rack mot1 target1 mot2 target2 .....
+
+Within the anticollision script, the following command may be + used in order to define the sequence. +
+
anticollision clear +
Clears the sequence list +
anticollision add level motor target +
Add motor with target to level in the sequence. +
+

+ + diff --git a/doc/manager/hwini.htm b/doc/manager/hwini.htm index e0c92029..2272a232 100644 --- a/doc/manager/hwini.htm +++ b/doc/manager/hwini.htm @@ -10,20 +10,392 @@ Hardware is configured into the SICS system by executing special hardware configuration commands from the server initialisation file. These commands are described here. Much SICS hardware is hooked up to the system via RS-232 interfaces. The SICS server communicates with such devices through a serial -port server program running on the instrument computer All such devices require on +port server program running on the instrument computer. + All such devices require on initialisation the following parameters: +

+

Bus Access

+

+SICS and its internals cover many common usage cases. However there are always + situations where SICS has to be bypassed and commands to be sent to a + controller directly. This can happen in order to satisfy a special request or + as first step in the integration of a special piece of hardware into SICS. In + order to do such things the following facilities are available: +

Direct Access to RS232 Controllers or TCP/IP Controllers.

+

+Both controllers listening on a TCP/IP port or RS-232 devices connected to a + terminal server can be directly accessed through the RS232 commands. The + first step in using this system is always to accounce the controller to SICS + using the command: +

+MakeRS232Controller name terminalserver port
+
+in the SICS initialization file. +For example: +
+MakeRS232Controller hugo psts213 3004
+
+name is the SICS name for the controller, terminalserver is the name +of the terminal server the device is connected to and port is the port +number at which the terminal server publishes the RS232 channel to +which the device is connected. This is usally the port number plus 3000. +

+

+Now various commands are available for interfacing with the RS232 +controller. In the following description the SICS name of the +controller is replaced by the symbol rs232name. +

+
rs232name sendterminator +
prints the current terminator used when sending data to the device +as hexadecimal numbers. +
rs232name sendterminator h1h2..hn +
sets the current terminator used when sending data to the device +to the characters described by the hexadecimal numbers h1 to hn. The +numbers are in the format 0xval, where val is the hex number. +
rs232name replyterminator +
prints the current terminator expected to terminate a response +from the device as a hexadecimal number. +
rs232name replyterminator h1h2..hn +
sets the current terminator expected to terminate a response from +the device to the characters described by the hexadecimal numbers h1 +to hn. +The numbers are in the format 0xval, where val is the hex number. +
rs232name timeout +
prints the current timeout when waiting for a reponse from the +device. +
rs232name timeout val +
sets the timeout for waiting for responses from the device. The +value is in microseconds. +
rs232name send data data data +
sends the remainder of the line to the RS232 device and waits for +a response terminated with the proper reply terminator specified. This +commands waits at maximum timeout microseconds for a response. If a +valid response is obtained it is printed, otherwise an error message +occurs. +
rs232name write data data data +
writes the remainder of the line after write to the device without +waiting for a response. +
rs232 available +
checks if data is pending to be read from the device. +
rs232 read +
reads data from the device. +
+

+

Accessing Serial Ports (Old System)

+

+In addition to the system describe above there is another system for accessing + serial ports which uses the SerPortServer program. The use of the system is + deprecated, new software should use the commands describe above. Nevertheless + the older sytem is described here for reference. +

+

+Serial port access is implemented as an extension to the Tcl macro language. +Essentially this is the same implementation as used in the program psish. + This section describes how to use serial port access. Several + steps have to be performed: +

    +
  1. Install the serialport command into the SICS server. This requires two lines to be added to +the server startup script: +
      +
    • SerialInit +
    • TclPublish serialport UserRights +
    +Where UserRights stands for one of the possible SICS user rights. + See documentation +for TclPublish above. +
  2. Each separate serial port will be represented by a name in the SICS server +after it has been initialized. This name is also a command. These port names + live in the Tcl interpreter and must be made accessible with TclPublish. + For example for +a port named p1 include this line in the server startup script: +
      +
    • TclPublish p1 User +
    +Replace User with the correct access code you want for a serial port. It is + recommended +to restrict serial port access to SICS managers only. +
  3. After starting the SICS server the command serialport is now available. +
  4. Now a serial port can be initialized with a command like this: +
      +
    • serialport name1 SerPortServer.host port channel force +
    • Example: serialport p1 localhost 4000 5 +
    +Such a command creates the command name1 and links it with serial port channel +channel on the instrument computer (localhost) running the SerPortServer program . Port is the port number on which the + SerPortServer is listening for connections (usually 4000). +The last flag force is optional. If something is there, the connection to that +port is done on a separate socket of its own. This has to do with some +feature of the software interface to the SerPortServer serial port server. +This +software interface tries to direct messages for multiple channels through one +socket connection between the host and the Macintosh server. This is perfectly +fine as long as none of the commands through this socket takes a long time +to execute. However, if a RS-232 device takes a long time to respond, the whole +socket is blocked. Fortunately, the serial port server runs a separate +thread of execution for each different socket. By forcing a new socket it can +be achieved that such a slow device is decoupled from the rest. Exactly this +is achieved with the force flag. +
  5. Once the port has been initialised (for example p1) it is ready to + operate. +The port object allows to send data to the serial port and receive data from +it. Furthermore some configuration is possible. The syntax is like this: +
    +
    portname -tmo number +
    Sets the timeout for the serial port. This is the maximum amount of time +the serial port server waits for data to arrive from the RS-232 device. +Increase this if a lot of _BAD_TMO error messages creep up. +
    portname -sendterm string +
    Sets the terminator which will be automatically added to the string + which is +sent. Some RS-232 devices require special terminators in order to accept a command. +The serial port implementation ensures that such a terminator is sent after +each message. This command allows to configure this terminator. Please note, +that the terminator string needs to be enclosed in quotes. An example: +
      +
    • p1 -sendterm "\r\n" +
    +This sets the terminator to carriage return - line feed. +
    portname -replyterm string. +
    The serial port server expects the RS-232 device to send a terminator +when it is done with sending answers. It even supports multiple lines to be +sent as a reply. This expected reply terminator is set with this command. +The string may may be four characters long. An example: 1\r\n sets +the expected terminator to one of \r\n. One of them is expected. +Thus the first character is the count of terminators to expect, followed by + the characters possible as terminators. This string must usually be quoted. +
    portname blablalakjdl +
    When none of the options -tmo, -replyterm, -sendterm, is found everything + after portname is sent to the RS-232 device. The reply from the RS-232 + device is printed. +
    +
+The defaults set for the configuration parameters of the serial port connection +are suited for the EL734, EL737 and ITC4 devices usually encountered at SINQ. + For other RS-232 devices consult the manuals hopefully delivered with the + device. +The defaults are: 100 for timeout, 1\r\n for the reply terminator and +\r\nfor the send terminator. +

+

GPIB Controller Access

+

+GPIB is yet another bus system. Up to 30 devices can share the bus and +transfer data on it. SICS likest to speak to GPIB devices through the +National Instrument ENET-100 TCP/IP bridge. In order for this to work +the National Instruments driver software must have been installed on +the computer running SICS. SICS has to be compiled with the define +HAVENI defined and the proper paths to the header file and library +configured. Then an GPIB controller can be installed into SICS with the +command: +

+MakeGPIB name drivertype
+
+Name is the name under which the GPIB controller is addressable within +SICS afterwards. drivertype is the driver to use for the GPIB +device. Supported values are: +
+
sim +
Simulation +
ni +
National instruments driver, see above. +
+The GPIB controller supports a couple of commands for communicating +with devices on the GPIB bus directly. Use with extra care because it +is very easy to lock things up on the GPIB bus. In the following +documentation of the command set it is assumed that a GPIB controller +has been configured into the system under the name gpib. Please +note, that managers privilege is required in order to be allowed to +wrestle with this controller. +
+
gpib attach controller-no gpib-address gpib-secondary timeout + eos eot +
This attaches the GPIB controller to a certain device at a certain + address for later communication. The return value is an integer + handle which will be used later on a s a handle devID when referring + to the connection. The parameters are: +
+
controller-no +
The number of the GPIB controller on the computer. There may be +more then one GPIB controllerinstalled on a given system. Usually this +is 0. +
gpib-address +
The GPIB address of the device on the bus. +
gpib-secondary +
GPIB devices may have a seconadry address. This can be specified +with this parameter. Usually this is 0. +
timeout +
The time to wait for answers on the GPIB bus. 13 is 10 seconds and +ussually a good value. +
eot +
A parameter determining the termination mode on this +connection. Consult NI documentation for this or leave at 0. +
eoi +
A terminator. Set to 1 or understand NI documentation for this +parameter. +
+
gpib detach devID +
Breaks the connection described through devID. devID is the return +value from attach. +
gpib clear devID +
Tries to clear the GPIB buffers for the conenction described +through devID. Usually in vain. +
gpib send devID bal bla bla +
sends data to the device at devID. +
gpib sendwithterm devID string terminator +
Sends string to the device at devID. The terminator character +identified through the integer terminator is automatically +appended. Use this to send things which require a +terminator. Terminators included in strings sent by send get messed up +through Tcl! +
gpib read devID +
Reads data from the device at devID and returns it as a string. +
gpib readtillterm devID terminator +
Read from teh device devID unti the terminator character described +through the interger terminator is read. Then return the data read as +a string. +
+

+

Controllers

+

+For the same reason as stated above, it is necessary to represent controllers + within SICS. Controllers implement more then only device access but also + maintain common state or implement special behaviour. +

+

ECB Controllers

+

+ECB controllers are at the heart of the Risoe data aquisition +system. These are essentially Z80 processors wired to the GPIB +bus. Functions can be invoked in this processor by sending a function +code followed by the contents of 4 8 bit registers. As a result the +contents of the registers after the function call are returned. A ECB +can be made knwon to SICS through the initialisation command: +

+MakeECB name gpib-controller gbib-controller-number gpib-address
+
+The parameters: +
+
name +
The name used as a token for this controller later on. +
gpib-controller +
the name of the GPIB interface to use. See above. +
gbib-controller-no +
The number of the GPIB board in the system +
gpib-address +
The GPIB address of the ECB on the GPIB bus. +
+Once installed, the ECB controller understands a few commands: +
+
ecb1 func funcode d e bc +
Invoke ECB function funcode with the registers d e b c.Returns the +contents of the registers d e b c. Function codes and register +contents are documented, if at all, in the ECB documentation. In fact, as + ECB documentation is not available, the only documentation on ECB is the + source code of tascom. +
ecb1 clear +
Tries, usually in vain, to clear the communications interface to +the ECB. +
ecb1 toint char +
A helper function which converts the character char to an +integer. Tcl does not seem to be able to do that. +
+

Siematic SPS Controllers

+

+Siematic SPS controllers are used at SinQ for handling all the things which +fit nowhere else. Such as operating air cushions on some instruments, +reading variables from ADC's, reading status of shutters or other parts of +the instrument and the like. Those SPS units have an RS-232 connector and +understand a simple ASCII command protocoll. + The Siematic SPS and its command protocoll are +special to PSI and this section is probably of no interest to SICS managers + outside. The SPS basiaclly support three operations: +

+This is so user unfriendly that the usage of the SPS will mostly be packaged +into Tcl-macros. +

+

+A SPS unit can be configured into the SICS server with the command:
+MakeSPS name macintosh port channel
+The parameters are: the name of the SPS in SICS, the serial port server +computer, the port where the serial port server is listening and the +channel number of the SPS unit at the serial port server computer. An +example:
+MakeSPS sps1 lnsp25.psi.ch 4000 6
+configures a SPS unit at lnsp25.psi.ch at channel 5. The serial port server +is listening at port number 4000. The SPS unit will be accessible as sps1 in +SICS. +

+

+After configuartion the following four commands are understood by name, +shown with sps1 as example: +

+
sps1 push byte bit +
Corresponds to pushing the button mapped to the bit bit in the byte +byte. +
sps1 adc num +
Reads the value in the ADC num. num can be between 0 to 7 for a maximum +of eight ADC's. Please note, that the values read are raw values which +usually must be converted in some way to physically meaningful values. +
sps1 status bit +
Reads the status of the bit bit. bit can be in the range 0 - 128. +
sps1 stat2 byte bit +
Reads the status bit bit in status byte byte. Is equivalent to status, +but adds some syntatctic sugar. +
+For all conversion factors, for all mappings of bytes and bits, consult the +electronician who coded the SPS. +

+

General Controller Object and Choppers

+

+Chopper systems are handled via a generic controller object. This basicly +consists of two components: One object represents the actual +controller. This basic object allows to query parameters only. Then +there is for each parameter which can be controlled from SICS in this +controller an adapter object. These adapter object are virtual motors +which can be driven with the normal run or drive commands. Currently +two drivers for this scheme exists: one for a simulated device, the +other for the Dornier Chopper Controller at FOCUS. The first step when +initializing this system is the installation of the general controller +object into SICS. This is done with the commands: +

+MakeChopper name sim
+MakeChopper name docho mac port channel
+
+The first command simply installs a simulated controller. +The second command install a controller with a driver for the FOCUS +Dornier Chopper system. Mac, port and channel are the usual Macintosh +terminal server parameters which describe where the chopper controller +is connected to through its RS-232 interface. After both commands the +controller is available as command name within SICS. +

+

+A drivable parameter at this controller is installed with a command +similar to this: +

+ChopperAdapter vname cname pname lower upper
+
+vname is the name under which the virtual motor will appear in +SICS. cname is the name of the controller object installed into SICS +with the commands in the previous paragraph. pname is the name of the +drivable parameter in the controller. upper and lower are the upper +and lower limits for this parameter. More then one of these commands +can be given for each general controller. +

+

+After this, the parameter can be modified by a command like: +

+drive vname newvalue
+

Motors

@@ -41,12 +413,18 @@ El734 motor controller. The parameters host, port, chan have the meanings defined above. no is the number of the motor in the EL734 motor controller.

Motor name EL734DC host port chan no -
This command creates an analog motor named name which is controlled through a -El734DC motor controller. The +
This command creates an analog motor named name which is controlled + through a 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. +
Motor name el734hp rs232controllername motornum +
Creates a motor object name using the newer motor drivers which access + the motor controller directly, without the serial port server. + rs232controllername is the name of a connection to the motor controll which +has been set up with MakeRS232, above. Motornum is the number of the motor in + the controller.
MakePIMotor name c804 pararray -
Creates a motr name connected to a C804 motor controller from the +
Creates a motor name connected to a C804 motor controller from the manufacturer Physik Instrumente. Pararray is a Tcl array holding the initialization information. The follwoing elements are required in this array: @@ -135,7 +513,6 @@ at any given time. In SICS this is directed through the anticollider module described elsewhere.

-

Counting Devices

@@ -146,13 +523,20 @@ at which the counter will generate a random failure for testing error treatment code. If failrate is less then 0, there are no failures. This can be used in a instrument simulation server.
MakeCounter name mcstas -
Creates a counter which interoperates with a McStas simulation. Please note, +
Creates a counter which interoperates with a + McStas simulation. Please note, that the McStas module mccontrol must have been initialized before this initialization can work.
MakeCounter name EL737 host port chan
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. +
MakeCounter name EL737hp terminalserver port +
Creates a counter object name which uses the faster driver which connects + directly to the terminal server without the serial port server program. + Terminalserver is the name of the instruments terminal server. Port is the + port number at which the terminal server publishes the port at which the EL737 + controller is connected. Usually this 3000 + port number.
MakeCounter name ecb ecb-controller
Installs a counetr on top of the Risoe ECB hardware. The only parameter is the name of the ECB controller to use. @@ -186,12 +570,21 @@ HM. Histogram memory objects can be created using the command:
MakeHM name type
The parameter name specifies the name under which the HM will be avialable in the system. type specifies which type of driver to use. -Currently three types of drivers are supported: SIM for a simulated HM -, SINQHM for the SINQ histogram memory and tdc for the Risoe histogram memory. - Please care to note, that the SINQHM -requires a EL737 counter box for count control. This counter must have been -defined before creating the HM object. +Currently these drivers are supported: +
+
SIM +
for a simulated HM +
SINQHM +
for the SINQ histogram memory +
tdc +
for the Risoe histogram memory. +
mcstas +
for the integration with the McStas simulation. +
+ Please care to note, that the SINQHM +requires a counter box for count control. This counter must have been +defined before creating the HM object. As an example the configuration of a SINQHM HM with the name banana will be shown:
@@ -249,188 +642,6 @@ nvs add 3800 4500
 nvs add 5900 6700
 nvs add 8100 9600
 
-

-

Chopper

-

-Chopper systems are handled via a generic controller object. This basicly -consists of two components: One object represents the actual -controller. This basic object allows to query parameters only. Then -there is for each parameter which can be controlled from SICS in this -controller an adapter object. These adapter object are virtual motors -which can be driven with the normal run or drive commands. Currently -two drivers for this scheme exists: one for a simulated device, the -other for the Dornier Chopper Controller at FOCUS. The first step when -initializing this system is the installation of the general controller -object into SICS. This is done with the commands: -

-MakeChopper name sim
-MakeChopper name docho mac port channel
-
-The first command simply installs a simulated controller. -The second command install a controller with a driver for the FOCUS -Dornier Chopper system. Mac, port and channel are the usual Macintosh -terminal server parameters which describe where the chopper controller -is connected to through its RS-232 interface. After both commands the -controller is available as command name within SICS. -

-

-A drivable parameter at this controller is installed with a command -similar to this: -

-ChopperAdapter vname cname pname lower upper
-
-vname is the name under which the virtual motor will appear in -SICS. cname is the name of the controller object installed into SICS -with the commands in the previous paragraph. pname is the name of the -drivable parameter in the controller. upper and lower are the upper -and lower limits for this parameter. More then one of these commands -can be given for each general controller. -

-

-After this, the parameter can be modified by a command like: -

-drive vname newvalue
-
-

-

RS232 Controller Direct Access

-

-RS232 controllers connected to a terminal server can be directly accessed -by SICS through the TCP/IP network, bypassing the SerPortServer -program. See the description of this facility -for more details. Such a controller can be configured into the system -through the command: -

-MakeRS232Controller name terminalserver port
-
-For example: -
-MakeRS232Controller hugo psts213 3004
-
-name is the SICS name for the controller, terminalserver is the name -of the terminal server the device is connected to and port is the port -number at which the terminal server publishes the RS232 channel to -which the device is connected. This is usally the port number plus 3000. -

-

-To be expanded. Please note, that environment devices such as temperature -controllers are dynamically configured into the system at run time. -Therefore the necessary commands are described in the user documentation. -

-

GPIB Controller Access

-

-GPIB is yet another bus system. Up to 30 devices can share the bus and -transfer data on it. SICS likest to speak to GPIB devices through the -National Instrument ENET-100 TCP/IP bridge. In order for this to work -the National Instruments driver software must have been installed on -the computer running SICS. SICS has to be compiled with the define -HAVENI defined and the proper paths to the header file and library -configured. The an GPIB controller can be installed into SICS with the -command: -

-MakeGPIB name drivertype
-
-Name is the name under which the GPIB controller is addressable within -SICS afterwards. drivertype is the driver to use for the GPIB -device. Supported values are: -
-
sim -
Simulation -
ni -<>National instruments driver, see above. -
-The GPIB controller supports a couple of commands for communicating -with devices on the GPIB bus directly. Use with extra care because it -is very easy to lock things up on the GPIB bus. In the following -documantation of the command set it is assumed that a GPIB controller -has been configured into the system under the name gpib. Please -note, that managers privilege is required in order to be allowed to -wrestle with this controller. -
-
-
gpib attach controller-no gpib-address gpib-secondary timeout - eos eot -
This attaches the GPIB controller to a certain device at a certain - address for later communication. The return value is an integer - handle which will be used later on a s a handle devID when referring - to the conenction. The parameters are: -
-
controller-no -
The number of the GPIB controller on the computer. There may be -more then one GPIB controllerinstalled on a given system. Usually this -is 0. -
gpib-address -
The GPIB address of the device on the bus. -
gpib-secondary -
GPIB devices may have a seconadry address. This can be specified -with this parameter. Usually this is 0. -
timeout -
The time to wait for answers on the GPIB bus. 13 is 10 seconds and -ussually a good value. -
eot -
A parameter determining the termination mode on this -connection. Consult NI documentation for this or leave at 0. -
eoi -
A terminator. Set to 1 or understand NI documentation for this -parameter. - -
gpib detach devID -
Breaks the connection described through devID. devID is the return -value from attach. -
gpib clear devID -
Tries to clear the GPIB buffers for the conenction described -through devID. Usually in vain. -
gpib send devID bal bla bla -
sends data to the device at devID. -
gpib sendwithterm devID string terminator -
Sends string to the device at devID. The terminator character -identified through the integer terminator is automatically -appended. Use this to send things which require a -terminator. Terminators included in strings sent by send get messed up -through Tcl! -
gpib read devID -
Reads data from the device at devID and returns it as a string. -
gpib readtillterm devID terminator -
Read from teh device devID unti the terminator character described -through the interger terminator is read. Then return the data read as -a string. -
-

-

ECB Controllers

-

-ECB controllers are at the heart of the Risoe data aquisition -system. These are essentially Z80 processors wired to the GPIB -bus. Functions can be invoked in this processor by sending a function -code followed by the contents of 4 8 bit registers. As a result the -contents of the registers after the function call are returned. A ECB -can be made knwon to SICS through the initialisation command: -

-MakeECB name gpib-controller gbib-controller-number gpib-address
-
-The parameters: -
-
name -
The name used as a token for this controller later on. -
gpib-controller -
the name of the GPIB interface to use. See above. -
gbib-controller-no -
The number of the GPIB board in the system -
gpib-address -
The GPIB address of the ECB on the GPIB bus. -
-Once installed, the ECB controller understands a few commands: -
-
ecb1 func funcode d e bc -
Invoke ECB function funcode with the registers d e b c.Returns the -contents of the registers d e b c. Function codes and register -contents are documented, if at all, in the ECB documentation. -
ecb1 clear -
Tries, usually in vain, to clear the communications interface to -the ECB. -
ecb1 toint char -
A helper function which converts the character char to an -integer. Tcl does not seem to be able to do that. -
-

diff --git a/doc/manager/ini.htm b/doc/manager/ini.htm index c8ec5fae..c1334830 100644 --- a/doc/manager/ini.htm +++ b/doc/manager/ini.htm @@ -20,7 +20,7 @@ its internal command list (No need to carry them around all the time). Now a status backup file will be read. This file contains normal SICS statements which initialise parameter values to the values they had before the last shutdown of the server. Such a file is automatically written whenever a -normal shutdown of the server happens. +normal shutdown of the server happens or variables change.

The SICS server configuration file is essentially a SICS macro language @@ -48,8 +48,8 @@ initialization. lowercase. This file holds instrument specific commands defined in the Tcl macro language. This file is automatically included by inst.tcl.

scancommand.tcl, tecs.tcl, log.tcl -
Some macro definitions which are used by so many instruments that -it was deemed appropraite to hold them in separate files. Such files +
Some macro definitions are used by so many instruments that +it was deemed appropriate to hold them in separate files. Such files are included from instcom.tcl.

diff --git a/doc/manager/iscan.htm b/doc/manager/iscan.htm index 74573635..d52f4dd4 100644 --- a/doc/manager/iscan.htm +++ b/doc/manager/iscan.htm @@ -4,18 +4,14 @@

The Internal Scan Commands

-

-Scans are preformed from a variety of commands in SICS. All these commands -are just Tcl--wrappers around an internal scan object implemented in C. This -section describes this internal scan command and how it works. This internal -scan command is installed into the SICS server via the MakeScanCommand -command in the initialisation file. This command install the internal -scan object under a user defined name. For the rest of this document it is -assumed that this name is xxscan. -

Scan Concepts

-Scanning in SICS evolved a little over time. It turned out that scans +Scans in SICS involve an internal scan module and a lot of scripts which + wrap the internal scan module into a syntax liked by the users. +

+

+The internal scan module in SICS evolved a little over time. It turned +out that scans are a demanding job for a programmer because of the plethora of special scans people wish to perform and the many data file formats which have to be supported. This requires a very high degree of @@ -36,16 +32,31 @@ The internal scan object is augmented by a library of standard scan functions. The transition to the new model is not yet clean in order not to break to much old code.

+

+The standard scan command can be configured into SICS using the command: +

+
MakeScanCommand name countername headfile recoverfil +
MakeScanCommand initialises the SICS internal scan command. It will be +accessible as name in the system. The next parameter is the name of a valid +counter object to use for counting. The next parameter is the full pathname of +a header description file. This file describes the contents of the header of +the data file. The format of this file is described below. The parameter +recoverfil is the full pathname of a file to store recover data. The internal +scan command writes the state of the scan to a file after each scan point. +This allows for restarting of aborted scans. +
+

+

The scan object (named here xxscan, but may have another name) understands the following commands:

+
xxscan clear +
clears the list of scan variables. Must be called before each scan with +different parameters.
xxscan add name start step
This command adds the variable specified by the argument name to the list of variables scanned in the next scan. The arguments start and step define the starting point and the sptep width for the scan on this variable. -
xxscan clear -
clears the list of scan variables. Must be called before each scan with -different parameters.
xxscan run NP mode preset
Executes a scan. The arguments are: NP the number of scan points, mode the counter mode to use (this can be either timer or monitor) and preset @@ -65,13 +76,13 @@ scan has been aborted due to user intervention or a system failure, this scheme allows to continue the scan when everything is alright again. This works only if the scan has been started with run, not with silent.
xxscan getfile -
This command retuns the name of the current data file. +
This command returns the name of the current data file.
xxscan setchannel n
Sometimes it is required to scan not the counter but a monitor. This command sets the channel to collect data from. The argument n is an integer ID for the channel to use.
xxscan getcounts -
Retrieves the counst collected during the scan. +
Retrieves the counts collected during the scan.
xxscan getmonitor i
Prints the monitor values collected during the scan for the monitor number i @@ -102,7 +113,7 @@ containing: point number first_scan_var_pos counts.
xxscan uninterest
Uninterest switches automatic notification about scan progress off.
xxscan integrate -
Calculates the integrated intensity of the peak and the variance of teh +
Calculates the integrated intensity of the peak and the variance of the intensity for the last scan. Returns either an error, when insufficient scan data is available or a pair of numbers. Peak integration is performed along the method described by Grant and Gabe in J. Appl. Cryst. (1978), 11, @@ -119,15 +130,21 @@ from the arguments given: pos denotes the position of the peak maximum, FWHM is the full width at half maximum for the peak and height is its height.
xxscan command tclcommand
Sets the tcl command procedure to invoke at each scan point. See below - for the description of user defined scans. Invoked without argument command + for the description of user defined scans (Old Style). + Invoked without argument command returns the name of the current command procedure.
xxscan configure mode -
Confugures the several possible scan modes for the scan +
Configures the several possible scan modes for the scan object. Currently there are two:
  • standard, the default mode writing ASCII files.
  • amor, a special mode the reflectometer AMOR which writes NeXus files. +
  • script Scan functions are overriden by the user. +
  • soft The scan stores and saves software zero point corrected + motor positions. The standard is to save the hardware positions as + read from the motor controller. +
  • user configures the old style user overridable scans.
xxscan storecounts counts time mon1 mon2 ...
This stores an entry of count values into the scan data @@ -173,7 +190,10 @@ starts. the scan data into the scan data structure.
writepoint
Is called for each scan point and is meant to print information -about the scan point to the data file and to the user. +about the scan point to the data ile and to the user. +
finish +
Is called after the scan finishes and may be used to dump a data file + or perform other clean up operations after a scan.
userdata
This is the name of a user defined object which may be used to store user data for the scan. @@ -183,9 +203,10 @@ The exact invocations of the functions:
  • writeheader scanobjectname userobjectname
  • prepare scanobjectname userobjectname
  • drive scanobjectname userobjectname point -
  • count scanobjectname userobjectname point +
  • count scanobjectname userobjectname point mode preset
  • collect scanobjectname userobjectname point
  • writepoint scanobjectname userobjectname point +
  • finish scanobjectname userobjname scanobjectname is the name of the scan object invoking the function. This can be used for querying the scan @@ -194,14 +215,20 @@ userdata in the configuration. point is the number of the current scan point.

    User Defined Scans(Old Style)

    +This feauture allows to override only the counting operation during a scan. + This feauture is deprecated in favour of the user overridable scan functions + described above. As it is still used, however, here is the documentation + for reference. +

    +

    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 +order to allow for 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: @@ -235,6 +262,39 @@ command: In all this replace xxxscan with the name of the internal scan command.

    +

    The Scan Command Header Description File

    +

    +As if all this configurability is not enough, there is another + level of configurability. +The SICS internal scan command allows to configure the contents of + the header of +the ASCII scan data file through a template header file. This is only + possible when the scan functions are left in their default configuration. + If scan functions are overloaded it is the users repsonsability to take + care of data file writing. +This section describes +the contents of the template file. This header description file + consists of normal +text mixed with a few special keywords. The normal test will be copied to +output verbatim. The keywords indicate that their place will be replaced by +values at run time. Currently only one keyword per line is supported. +Keywords recognized are: +

    +
    !!DATE!! +
    Will be replaced with the file creation date. +
    !!VAR(name)!! +
    Will be replaced with the value of the SICS variable name. +
    !!DRIV(name)!! +
    Will be replaced with the value drivable variable name. Drivable variables are +all motors and all variables which may be used in a drive or run command. +
    !!ZERO(name)!! +
    Will be replaced with the value of the softzero point for motor name. +
    !!FILE!! +
    Will be replaced by the creation name of the file. +
    +Please note that text behind such a keyword in the line will not be copied to +the output. +

    Differential Scans

    When aligning or when searching peaks a very fast scan is @@ -247,7 +307,8 @@ MakeDiffScan in the configuration file. An optional parameter defines another name then diffscan (the default) for this object. Differential scans can only be run against one motor as it cannot be guaranteed that -motors in a coordinated movement operate at the same speed. The +motors involved in a coordinated movement operate at the same speed + without mechanical coupling. The procedure to use diffscan is:

    • Configure a scan variable into a SICS scan object: xxscan add var @@ -273,6 +334,34 @@ A word of warning: positions found in differential scans may not be totally correct. The differential scan might even miss peaks when the relationship between motor speed and sampling rate is bad.

      +

      +Diffscan is usally wrapped in a common script command: +

      +
      fastscan motor start stop speed +
      which does a fast scan for motor from start to stop. Before the scan + the motors speed is set to speed. The motor is set to its original speed + after termination of the scan. +
      +This script can be copied from one of the older instrument command files. +

      +

      Peak Analysis

      +

      +There are several other feautures which can be configured into SICS + which interact very closely with the scan module: +

      +
      MakePeakCenter scancommand +
      MakePeakCenter initialises the peak analysis commands peak and center. The +only parameter is the name of the internal scan command. +
      +

      +

      Common Scan Scripts

      +

      +There exists a library of script functions around the scan module which are + commonly used. They provide an object oriented wrapper around the internal + scan command and the cscan and sscan commands. These + commands can be made available by including the scancommand.tcl file into + the instruments configuration file. +

      diff --git a/doc/manager/macroman.htm b/doc/manager/macroman.htm index 5675899c..64a10eee 100644 --- a/doc/manager/macroman.htm +++ b/doc/manager/macroman.htm @@ -3,7 +3,7 @@ Programming SICS Macros -

      Programming SICS Macros

      +

      Programming SICS Macros

      The SICS server has a built in macro language. This macro language is basically John Ousterhout's Tool Command Language Tcl. Tcl is described elsewhere. @@ -13,7 +13,7 @@ language can be used for the following purposes:

    • Add hoc measurement procedures.
    • Trial measurement procedures.
    • Syntax adaptions to one's own favourite syntax. -
    • Building of cmore complex commands from the SICS primitives. +
    • Building of more complex commands from the SICS primitives.
    The general procedure for defining a macro requires defining the macro in a new file, source this file from the configuration script and the use of the Publish @@ -28,7 +28,7 @@ In the following sections a few pecularities of the SICS macro system will be discussed.

    -

    Input/Output

    +

    Input/Output

    It would be quite verbose and confusing for the user if all output from SICS commands called from a macro would appear on the screen during macro execution. @@ -39,19 +39,25 @@ client executing the macro. The output of a SICS command is available within the macro script through the normal Tcl mechanism as a return value. This allows for processing of SICS output within a macro. If the output to the client executing the macro is required this can be done with the ClientPut command, detailed in the -user documantation. +user documentation.

    -

    Error Handling

    +

    Error Handling

    Tcl has the feature that it aborts execution of a script when an error occurs. If a macro script needs to handle errors either from Tcl or from SICS commands -this can be achieved by using the Tcl catch mechanism. A script can inquire the current interrupt value of the +this can be achieved by using the Tcl catch mechanism. +

    +

    +If things are seriously wrong or the users wishes to interrupt an operation + SICS interrupts are used. Scripts implementing measurement procedures may +need to test and even modify interrupt values. +A script can inquire the current interrupt value of the connection with the command GetInt. If a script can handle an error condition it may set the interrupt on the connection object with the SetInt command. The textual representations of interrupts for these commands are: continue, abortop, abortscan, abortbatch, halt, free, end.

    -

    Interacting with SICS within a Script

    +

    Interacting with SICS within a Script

    There exist a few commands which allow to inquire or manipulate SICS internals. Most of these commands are only available in macro scripts. @@ -73,10 +79,69 @@ the object var. var must be a drivable or countable object. The integer code ret are defined in the SICS programmers documentation.

  • +

    SICS Interfaces in Tcl

    -Currently it is not possible to define object interfaces from within the SICS -macro language. For the notion of object interfaces see the -SICS programmers documentation. This may be implemented in future when needed. +Work has begun to implement SICS internal interfaces in Tcl. This opens the + port for writing even device drivers in Tcl. Another use is to define + virtual motors quickly in Tcl. At the time of writing, July 2005, this + is only developed for the object interface and the drivable interface. + For the meaning of internal SICS interfaces please consult the SICS + programmers documentation. Be warned: with the feautures described in this + section, you can mess up SICS badly. +

    +

    The Object Interface

    +

    +

    +
    MakeTclInt name +
    Creates an object name. This object then understands the following + commands: +
    +
    name savescript scriptname +
    Configures a script which will be called when it is time to dump + the status of the SICS server. This script will be called with the + name of the object as its only parameter. +
    name backup bla bla bla.... +
    To be used from savescripts. Writes everything behind backup into the + status file. +
    + The use of this facility is to place special commands into the status file + which may, for instance, request calculations to be made or drive parameters + not caught in the standard SICS objects to special values. For example: + at SANS2 this is used in order to store attenuator and collimator + values. Both are implemented as scripted commands and thus do take part + in the standard SICS object saving scheme. +
    +

    +

    Overriding the Drivable Interface with Tcl

    +

    +The drivable interface of any given drivable object can be overriden with + tcl functions. This includes an object created with MakeTclInt. The syntax is: +

    +
    TclReplaceDrivable objname key scriptname tclName +
    This replaces the drivable interface function defined by key with the + script scriptname in the driveable interface of the SICS object object. + tclName is the name of an arbitrary Tcl object which can hold user data. + Possible function keys and their function signatures are: +
    +
    halt +
    haltscript, no parameters +
    checklimits +
    checklimitsscript targetvalue +
    setvalue +
    setvaluscript targetvalue +
    checkstatus +
    checkstatusscript, no parameters +
    getvalue +
    getvaluescript, no parameters +
    + All procedures, excpet getvaluescript, are supposed to return the + approriate SICS return codes (HW*) as integer numbers. Getvaluescript + is supposed to return the position of the device. +
    TclDrivableInvoke objname key +
    A debugging aid: Invokes the scripted function denoted by key of the + object objname and prints the results. The function keys are the same + as given above. +

    diff --git a/doc/manager/manager.htm b/doc/manager/manager.htm index eea0cb83..7bbec2e6 100644 --- a/doc/manager/manager.htm +++ b/doc/manager/manager.htm @@ -33,14 +33,32 @@ which is described elsewhere.

    Where to you want to go today?

    diff --git a/doc/manager/managerman b/doc/manager/managerman index 8791bf4c..d9586be1 100644 --- a/doc/manager/managerman +++ b/doc/manager/managerman @@ -26,6 +26,7 @@ CH--5232 Villigen--PSI\\ Switzerland\\ \end{center} \clearpage +\clearpage \tableofcontents \clearpage @@ -40,24 +41,26 @@ to understand John Ousterhouts Tool Command Language, which is described elsewhere. %html setup.htm 1 -%html inifile.htm 1 +%html move.htm 2 +%html trouble.htm 2 + +\chapter{The SICS Initialization File} %html ini.htm 1 %html option.htm 1 %html var.htm 1 %html hwini.htm 1 -%html command.htm 1 -%html helpman.htm 2 -%html mcstas.htm 2 -%html special.htm 1 -%html serial.htm 2 -%html status.htm 2 -%html sps.htm 2 -%html iscan.htm 2 -%html alias.htm 2 -%html cron.htm 2 -%html rs232.htm 2 +%html gencom.htm 2 +%html iscan.htm 2 %html nxscript.htm 2 -%html nxupdate.htm 2 -%html ../user/trouble.htm 1 -%html move.htm 1 +\section{Instrument Specific SICS Initializations} +%html four.htm 3 +%html tas.htm 3 +%html amor.htm 3 +%html sans.htm 3 +%html focus.htm 3 + +%html macroman.htm 1 + +%html mcstas.htm 1 + \end{document} diff --git a/doc/manager/mcstas.htm b/doc/manager/mcstas.htm index fcc4269f..9ed5fb6f 100644 --- a/doc/manager/mcstas.htm +++ b/doc/manager/mcstas.htm @@ -7,7 +7,7 @@

    It is useful to drive a simulation of an instrument with the same interface as is used at the original instruments. One of the better packages for performing simulations of neutron -scattering instruments, including samples, is McStas. This section describes SICS +scattering instruments, including samples, is McStas. This section describes the SICS interface to McStas simulations. The interface consists of three parts:

    The McStas Reader

    @@ -85,7 +82,7 @@ groups, the name attribute is used a path component.
    The counter object into which the monitor is read. This is a limitation, with the this McStas interface only counters can store monitors.
    monitornumber -
    Monitornumber is the monitor channel into which the value is to be stored. +
    Monitornumber is the monitor\ channel into which the value is to be stored.
    scale
    Scale is an optional scale factor for the monitor. Real monitors have a sensitivity of E-6, McStas monitors have an efficiency of 1.0. This factor allows to @@ -99,15 +96,15 @@ groups, the name attribute is used a path component. The mccreader module also supports reading data from any ASCII file into SICS. Mcreader close and open are not required then. For reading histogram memory data, the appropriate - data has to be parsed into a SICSdata object first. Then + data has to be parsed into a SICSdata object first. Then data can be trasnferred using the following commands:
    mcreader insertmondirect counter num value
    Assigns value to the monitor num at the counter object counter. Monitor 0 is the actual counts data. -
    mcreader inserthmfromdata hm data
    Inserts the data in the SICSData object data into the histogram memory hm. +

    The McStas Controller

    @@ -144,7 +141,7 @@ line and finally starts the simulation. This script is expected to return either often.

    mccontrol configure update monitorscale
    Configures the scaling factor to use on the monitor in monfile. Normal monitors have - a efficeincy of 1E-6, the McStas monitor counts every neutron. This can be compensated + a efficiency of 1E-6, the McStas monitor counts every neutron. This can be compensated for by this scaling factor. Note that this scaling factor may be dependent on the wavelength used.
    mccontrol configure mcmonfile filename diff --git a/doc/manager/move.htm b/doc/manager/move.htm index 71816257..cc94a23f 100644 --- a/doc/manager/move.htm +++ b/doc/manager/move.htm @@ -9,16 +9,13 @@ This requires the following steps:
    1. Create a new local account on the host computer. There is a -prefabricated account with the credentials: INSTBCK/INSTBCKLNS on -lnsa15. -
    2. Run sicsinstall instrument in the new instruemnt -account, thereby replacing instrument with the name of the instrument -you are moving. -
    3. Create and edit a suitable DataNumber file for the instrument. +prefabricated account with the credentials: instbck/INSTBCKLNS on +lnsl15. +
    4. Create the directory structure. +
    5. Create and edit a suitable DataNumber file for the instrument and put it + into data/YYYY. YYYY is the year.
    6. Edit the instrument configuration files and adapt the path names -to match the new situation. -
    7. Configure the histogram memory to boot from the new computer, se -histogram memory documsntation for instructions how to do that. +to match the new configuration.
    8. Try to start and debug.

    @@ -28,22 +25,24 @@ histogram memory documsntation for instructions how to do that.
    1. Fetch a new one and make sure that all cables are plugged as they were in the old one. -
    2. Edit the startsics script to start the SerPortServer program with -the name of the new serial port server. +
    3. Create a new .monitrc file by running makemonit. +
    4. Exchange all references to the old terminal server in the instrument + configuration files to the new terminal server.
    5. Done!

    Exchanging the Histogram Memory

      -
    1. Get a new histogram memory computer from either Peter Rasmussen, -the test setup in WHGA/247 or in cases of greatest need, from SLS. +
    2. Get a new histogram memory computer from either Gerd Theidel, +the test setup in the electronics barrack.
    3. Put into the rack. -
    4. Configure the HM boot parameters through the console conneted to +
    5. Configure the HM boot parameters through the console connected to the serial port belonging to the HM. Instructions for this can be -found in the histogram memory documentation. -
    6. Include the new HM into the /etc/hosts file of the instrument -computer. +found in the histogram memory documentation. Up to date boot + configuration parameters should be available under + /afs/psi.ch/group/sinqhm/boot/INST where INST is a place holder for the + instrument in upper case.
    7. Adapt the instrument configuration file to reflect the new name of the HM.
    8. Start and debug. diff --git a/doc/manager/nxscript.htm b/doc/manager/nxscript.htm index 3bcf187e..04db765e 100644 --- a/doc/manager/nxscript.htm +++ b/doc/manager/nxscript.htm @@ -57,6 +57,9 @@ nexusFile. The dictionary file dictFile is used.
      nxscript create4 nexusFile dictFile
      Creates a new NeXus file based on HDF-4 with the name nexusFile. The dictionary file dictFile is used. +
      nxscript createxml nexusFile dictFile +
      Creates a new NeXus file based on XML with the name +nexusFile. The dictionary file dictFile is used.
      nxscript reopen nexusFile dictFile
      Reopens an existing NeXus with the name nexusFile for modification or appending. @@ -112,7 +115,7 @@ values requested make sense to the histogram memory. In the case of subset writing, the dimensions have to be specified in the definition string belonging to the alias. Nxscript sets a variable timedim in the dictionary though which contains the length of a time binning if -appropriate. This is a special help for writing extra detectors at +appropriate. This is a special feauture for writing extra detectors at SANS and AMOR.
      nxscript puttimebinning aliasName hmName
      Writes the time binning at histogram memory hmName to file using @@ -132,5 +135,69 @@ attribute. designated by targetAlias.

      +

      Automatic Updating of NeXus Files

      +

      +Some instruments perform measurements for quite long counting +times. In such cases it is advisable to save the data measured so far +to file in order to protect against hardware or software failures. To +this purpose an automatic file upgrade manager is provided. On +installation the automatic update object is connected wth a counting +device through the the callback interface. This makes sure that the +update manager is automatically notified when counting starts or +finishes. +

      +

      Prerequisites for Using the Automatic Update Manager

      +

      +In order to use automatic updating, three programs must be +provided. Each of these programs can be a script which uses the +nxscript facility. It can also be a SICS command. +

      +
      startScript +
      This program is supposed to write the static part of the file. It +is called once when the file is created. +
      updateScript +
      This program is supposed to create and update the variable data +elements in the NeXus file. This is called frequently. +
      linkScript +
      This program is supposed to create the links within the NeXus +file. This is called once after startscript and updateScript have been +run. +
      +

      +

      Installing Automatic Update

      +

      +An automatic update object is installed into SICS with: +

      +updatefactory name countername
      +
      +name is a placeholder for the name under which SICS knows the +automatic update object. name is available as a SICS command later on. + countername is a placeholder for a counter +object (counter or HM) which triggers automatic updating of NeXus +files. This object has to support both the countable and callback +interfaces of SICS. Suitable SICS objects include counter and +histogram memory objects. +

      +

      Configuring Automatic Update

      +

      +The SICS command created with updatefactory (see above) supports a few +parameters which allow for the configuration of the whole +process. Parameters follow the normal SICS syntax. Futhermore there is +a subcommand list, which lists all configuration +parameters. Supported parameters are: +

      +
      startScript +
      The program supposed to write the static part of the file. +
      updateScript +
      The program supposed to create and update the variable data +elements in the NeXus file. +
      linkScript +
      This program supposed to create the links within the NeXus +file. +
      updateintervall +
      The time intervall in seconds between updates. The defualt is +1200, eg. 20 minutes. +
      +

      diff --git a/doc/manager/option.htm b/doc/manager/option.htm index 3ebdea60..1a8f7c6c 100644 --- a/doc/manager/option.htm +++ b/doc/manager/option.htm @@ -47,7 +47,7 @@ stored. When this is properly defined Tcl will autoload commands.
    9. statusfile defines the file to which he current state will be saved on close down of the server and restored from at startup time.
    10. TelnetPort The port number where the SICS server will be -listening for telnet connections. If this option is missing login via telent +listening for telnet connections. If this option is missing login via telnet to the SICS server is disabled.
    11. TelWord In order to login to SICS via telnet a magic word is needed. The login word, This option defines this word. If this option is diff --git a/doc/manager/sans.htm b/doc/manager/sans.htm new file mode 100644 index 00000000..9a925474 --- /dev/null +++ b/doc/manager/sans.htm @@ -0,0 +1,44 @@ + + +SANS Special Commands + + +

      SANS Special Commands

      +

      +Some special initializations for SANS Instruments: +

      +
      MakeMulti name +
      SANS uses a special syntax feature where several motors are grouped into a + component group. For example beamstop or detector. MakeMulti creates such a +group with the name name. Once such a group has been created, it has to be +configured. For this a few configuration commands are available: +
      +
      name alias motname compname +
      This command makes motor motname available as component motor compname. +For example: bs alias bsx x makes motor bsx available as x in the beamstop +group. Then the bsx motor can be driven by the command bx x = 12.. +
      name pos posname motname value motname value .... +
      The group command supports the notion of named positions. This means that +a special combination of angles can be accessed through a name. This commands +defines such a named position with the name posname. posname is followed by pairs +of motorname value which define the position. +
      name endconfig +
      Once a group has been completely defined the configuration process must be +ended with endconfig. +
      +
      MakeSANSWave name velo_name +
      > Installs a velocity selector wavelength variable into SICS. The +variable will have the name given as first parameter. Usually lambda is a +good idea. The second parameter, velo_name, is the name of the velocity +selector which is controlled by this wavelength variable. This module contains + a hard coded formula which may only be applicable to the SANS at PSI. +
      MakePSDFrame +
      This installs a command into SICS which allows to retrieve a detector + image from the histogram memory, even in TOF-mode. +
      +Many other commands for controlling collimators, attenuators, beamstops + and shutters are implemented in Tcl. These commands use non standardizable + hardware such as the Siematic SPS. +

      + + diff --git a/doc/manager/scan.htm b/doc/manager/scan.htm new file mode 100644 index 00000000..0d7d3c61 --- /dev/null +++ b/doc/manager/scan.htm @@ -0,0 +1,11 @@ + + +The SICS Scan System + + +

      The SICS Scan System

      +

      +

      + + + diff --git a/doc/manager/setup.htm b/doc/manager/setup.htm index 0e1514e7..17669658 100644 --- a/doc/manager/setup.htm +++ b/doc/manager/setup.htm @@ -3,7 +3,7 @@ SICS Setup -

      SICS programs, Scripts and Prerequisites

      +

      SICS programs, Scripts and Prerequisites

      Hardware

      The following hardware is usually present for any SICs instrument: @@ -17,7 +17,8 @@ The following hardware is usually present for any SICs instrument: The terminal server software is provided by Lantronix, see the appropriate manuals for the device for a description. The histogram -memories are 68000 VME onboard computers running the VXworks realtime +memories are 68000 VME or MEN-A12 onboard computers + running the VXworks realtime operating system and some home grown histogramming software documented elsewhere.

      @@ -31,10 +32,10 @@ required: communicating with serial ports. The actual communication with the serial ports is done through the Lantronix terminal server. Both the serial port protocoll and the SerPortServer are only documented in the -source code. +source code. The SerPortServer program is on its way out.
      TecsServer
      This is a TCP/IP server which watches over temperature -controllers. The only knwon source of documentation about this +controllers. The only known source of documentation about this software is Markus Zolliker.
      FileSync
      This is a little UDP server which waits for UDP messages from the @@ -51,28 +52,6 @@ Additionally a client program is needed which connects to the instrument control server and provides a user interface to it.

      -

      Scripts

      -

      -To get all this software up and running a couple of shell scripts have -been provided: -

      -
      startsics -
      This script starts all the necessary server programs for driving -the instrument. -
      killsics -
      This script shuts down all instrument control servers properly. -
      keepalice, keepaliveserp -
      The server programs are automatically restarted when they -die. This is done through these scripts. keepaliveserp is a special -script for the serial port server. -
      instsync -
      replace inst by the name of the instrument in lower case. This -script is invoked by the FileSync server and is responsible for -synchronizing the local data store with the one on the labaratory -server. This is usally done by calling the unix program rsync with -appropriate parameters. -
      -

      General SICS Setup

      @@ -90,9 +69,10 @@ instrument. In the following text this instrument root directory will be called sicsroot. This root directory has the following subdirectories:

      bin -
      The bin directory is the place where the actual executable for the SICS -server is kept along with local copies of all necessary clients, the server -initialisation files and special macro files defined for the instrument. +
      The directory where some executables live. +
      inst_sics +
      All instrument configuration files and the SICServer live in + this directory. Replace inst by the name of the instrument as appropriate.
      data
      The data directory is the central place where all data files collected at the instrument are stored. This directory contains subdirectories @@ -110,81 +90,107 @@ initialization file. generated client log files. Any now and then, and especially when disk space problems loom, the client*.log files should be deleted by the instrument manager. +
      lib +
      Contains some files needed for running SICS clients locally.
      doc
      This directory holds a copy of the SICS user documentation for the instrument. These are html files which can be viewed with WWW-browsers such as lynx or netscape. -
      sim -
      The sim directory is meant to hold all files necessary for a SICServer -initialised for the instrument but configured with simulated hardware. This -facility is meant for testing of command files.
      motor
      This directory holds a script for reading and restoring the motor parameter from the EL734 motor controllers. And the motor parameters stored in parameter files. It is the instrument scientists responsability to save the motor parameters after changes to the configuration of the instrument. +
      tmp +
      A directory for temporary and PID files. +
      help +
      A directory for help files for the help system.
      Besides these directories there should be nothing on the instrument account. All evaluated data, personal command files etc. should be held on the normal user account of the instrument user.

      + +

      System Control

      -For this purpose the /data/lnslib/bin directory holds copies of the -apropriate command line and status display clients for each instrument. A user can make -this directory (and much more) available by including the line -source /data/lnslib/bin/lns.login into her .login file. +All commands listed in this section have to issued with the privilege of the + instrument user account.

      -

      SICS Installation

      -All executables and files necessary to run SICS for each instrument is -avaialable under the /data/lnslib/distribution/sics hierarchy. -The bin directory -holds general executable files and a directory for each instrument which -holds instrument specific files. SICS installation on a unix system is -greatly simplified by using the sicsinstall korn shell script. This -script is available to each user. sicsinstall can be invoked simply by -typing sicsinstall at the command prompt. sicsinstall needs a subcommand in -order to know what it is expected to do: +In order to watch over all these servers, the monit software is used. This is + a program which watches server processes and restarts them as necessary. + Monit can also be used to watch over hardware and the file system. Monit + writes a log file and can trigger e-mail alerts on certain + problematic conditions. +

      +

      +Monit itself is controlled through a configuration file, .monitrc, which lives +in the instrument accounts home directory. Monit also uses another Tcl program runwithpid which is responsible for starting and stopping server programs. +In order to configure all this, there is another program: makemonit which + creates the monit configuration file and copies and edits the runwithpid + program. The syntax of makemonit is:

      -
      dev -
      copies knew executables from the development area to the distribution -directory. This command is meant to be used by computing staff only. -
      devfull -
      as dev, but copies all files. This command is meant to be used by computing staff only. -
      dmc -
      copies all files necessary for the instrument DMC. -
      topsi -
      copies all files necessary for the instrument TOPSI. -
      sans -
      copies all files necessary for the instrument SANS. -
      hrpt -
      copies all files necessary for the instrument HRPT. -
      amor -
      copies all files necessary for the instrument AMOR -
      focus -
      copies all files necessary for the instrument FOCUS -
      tasp -
      copies all files necessary for the instrument TASP -
      druechal -
      copies all files necessary for the instrument DRUECHAL -
      trics -
      copies all files necessary for the instrument TRICS -
      save inst -
      copies all the instrument configuration files from the instrument -account back to to the distribution area. Replace inst with the name -of the instrument in lower case. This call is necessary to save -modified instrument configurations. -
      doc -
      updates only the documentation on your disk. -
      exe -
      copies only new executable files from the distribution area. This is the -recommended option when you want to be sure, that you have the latest -version of SICS before reporting a bug. -
      -Most of these options require you to be in the home directory of the -instrument account. sicsinstall checks for this and warns you if this is not -the case. Directory structures are checked for and created as needed. +
      makemonit instrument terminalserver data-mount-point hm1 hm2 .. +
      instrument is the instrument name in lowercase, terminalserver is the + name of the terminal server used for serial port access, data-mount-point is + the name of file system onto which the instruments data is written. This is + followed by a list of all the histogram memory computers used by the + instrument. +
      monitinit +
      monitinit is an alias which calls makemonit with all required parameters + for a given instrument in standard configuration. + +

      +

      +Monit itself can be controlled with the following commands: +

      +
      monit +
      Starts the monit daemon and all configured processes. This is only + necessary after a reboot of the system. +
      monit status +
      This shows a status message listing the status of all configured servers + and the checked hardware. The monit status is also available on the WWW from + http://lns00.psi.ch/monit/instrument. Replace instrument with the appropriate + instrument name. +
      monit stop target +
      Stops the server process target. The following targest exist: +
      +
      all +
      All processes +
      sicsserver +
      The SICS server +
      SerPortServer +
      The serial port server. +
      sync +
      The file synchronisation server. +
      tecs +
      The TecsServer for controlling environment devices. +
      simserver +
      A simulation server(not on all instruments). +
      +
      monit start target +
      Starts a server process, targest are the same as described above. +
      monit restart target +
      Stops and starts the process target. Targets are as listed above. +
      monit quit +
      Stops monit alltogether. Please note, that servers stay running with + this command. In order to sop everything the sequence: monit stop all; + monit quit is required. +
      startsics +
      This script starts all the necessary server programs for driving +the instrument through monit. +
      killsics +
      This script shuts down all instrument control servers properly through + monit. +
      instsync +
      replace inst by the name of the instrument in lower case. This +script is invoked by the FileSync server and is responsible for +synchronizing the local data store with the one on the labaratory +server. This is usally done by calling the unix program rsync with +appropriate parameters. +

      diff --git a/doc/manager/tas.htm b/doc/manager/tas.htm new file mode 100644 index 00000000..4a774030 --- /dev/null +++ b/doc/manager/tas.htm @@ -0,0 +1,37 @@ + + +Triple Axis Spectrometer Specific Commands + + +

      Triple Axis Spectrometer Specific Commands

      +

      +One aim for the implementation of the triple axis spectrometer in SICS + was to implement as closely as possible the command set of the ILL program + MAD. For this, there are two implementations: an older one where + most things werde done in C-code. And a newer one which implements + a relaxter MAD emulation. The problem with the MAD emulation is that + MAD relies on the order of variables and motors in memory. The newer + MAD emulation obeys this only for the qh, qk, ql and en variables. + This section describes the newer more portable TAS setup. There are + some C-modules and a lots of scripts which implement the MAD emulation. +

      +

      +The TAS requires the following initializations in its instrument file: +

      +
      MakeTasUB tasub +
      Installs the TAS crystallographic calculation module into SICS. It will + have the name tasub (recommended). +
      MakeTasScan iscan tasub +
      Installs the module with the TAS specific scan functions into SICS. The + TAS implements its own data format resembling the ILL TAS data format. +
      +Moreover it is required to add the peak center module, drive, exe and a lot of + variables: polfile, alf1-4, bet1-4, ETAM ETAS ETAA. +

      +

      +The scripts for the MAD emulation live in the file tasubcom.tcl. This file + will need little editing in order to cope with another triple axis machine, + just a couple of path variables will need to be changed. +

      + + diff --git a/doc/manager/template.htm b/doc/manager/template.htm index 5412fb66..bebfe30b 100644 --- a/doc/manager/template.htm +++ b/doc/manager/template.htm @@ -1,9 +1,9 @@ -The Tcl-interface to the SINQ histogram memory + -

      The Tcl-interface to The SINQ histogram memory

      +

      diff --git a/doc/manager/trouble.htm b/doc/manager/trouble.htm index 2bff1997..f80b4dd5 100644 --- a/doc/manager/trouble.htm +++ b/doc/manager/trouble.htm @@ -6,6 +6,12 @@

      SICS Trouble Shooting


      +

      Check Server Status

      +

      +One of the first things to do is to check the server status with: +monit status. +

      +

      Inspecting Log Files

      Suppose something went wrong over the weekend or during the night and @@ -29,6 +35,11 @@ stamps which allow to find out when exactly a problem began to appear.

      +There is also another log file, log/monit.log, which logs messages from + the monit daemon. This can be used to determine when server processes + were restarted or when hardware failed. +

      +

      Quite often the inspection of the log files will indicate problems which are not software related such as:

        @@ -42,178 +53,65 @@ released before the motors move again.

        Restarting SICS


        -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. -

        -

        -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 -typing: -

        -startsics 
        -
        -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 -keepalive. keepalive is basically an endless loop which calls -the program again and agaian and thus ensures that the program will -never stop running. -

        -

        -When the SICS server hangs, or you want to enforce an reinitialization of -everything the server process must be killed. This can be accomplished either manually or through a shell script. -

        -

        Stopping SICS

        -

        -All SICS processes can be stopped through the command: -

        -killsics
        -
        -given at the unix command line. You must be the instrument user - (for example DMC) on the instrument computer for this to work properly. -

        - -

        Finding the SICS server

        -

        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: -

        -/home/DMC> ps -A
        -
        -Note the capital A given as parameter. The reward will be listing like this: -
        -  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
        -
        -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 - 31912 ?? an entry for the SICS server. In this example the server -is running. If the server is down, no such entry would be present. -

        - -

        Killing a hanging SICS server

        -

        -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 Sics_Exitus 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: 31912. Please note, that this number will -always be different. The command to force the server to stop is: -

        -/home/DMC> kill -9 31912
        -
        -Note, the second parameter is the number found with ps -A. 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. -

        - -

        Shutting The SICS Server Down Completely

        -

        -This is done for you by the killsics shell script. Just type -

        -killsics
        -
        - 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 keepalive SICServer . Kill that one as -described above, then kill the SICServer. For restarting SICS after this, -use the startsics command. +
        +
        monit restart sicsserver +

        +

        Restart Everything

        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. -

          +mechanics or electronics people were closer to the instrument then a + nautical mile. +
          • 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. -
          • Restart the SICServer. Watch for any messages about things not being -connected or configured. -
          • Restart and reconnect the client programs. -
        -If this fails (even after a second) time there may be a network problem which -can not be resolved by simple means. +
      • Restart all of SICS with the sequence: monit stop all; monit quit; monit +
      • Wait for a couple of minutes for the system to come up. +

      -

      Getting New SICS Software

      +
      +

      Starting SICS Manually

      -Sometimes you might want to be sure that you have the latest SICS software. -This is how to get it: -

        -
      1. Login to the instrument account. -
      2. If you are no there type cd to get into the home directory. -
      3. Type killsics at the unix prompt in order to stop the SICS server. -
      4. Type sicsinstall exe at the unix prompt for copying new - SICS software from the general distribution area. -
      5. Type startsics to restart the SICS software. -
      +In order to find out if some hardware is broken or if the SICS server + initializes badly it is useful to look at the SICS servers startup messages. +The following steps are required: +
        +
      • monit stop sicsserver +
      • cd ~/inst_sics +
      • ./SICServer inst.tcl | more +
      +Replace inst by the name of the instrument, as usual. Look at the screen + output in + order to find out why SICS does not initialize things or where the + initialization hangs. Do not forget to kill the SICServer thus started when + you are done and to issue the command: monit start sicsserver in order + to place the SICS server back under monits control again.

      -

      Hot Fixes

      +
      +

      Test the SerPortServer Program

      -When there is trouble with SICS you may be asked by one of the SICS - programmers to copy the most recent development reason of the SICS server - to your machine. This is done as follows: -

        -
      1. Login to the instrument account. -
      2. cd into the bin directory, for example: /home/DMC/bin. -
      3. Type killsics at the unix prompt in order to stop the SICS server. -
      4. Type cp /data/koenneck/src/sics/SICServer . at the unix prompt. -
      5. Type startsics to restart the SICS software. -
      -!!!!!! WARNING !!!!!!!. Do this only when advised to do so by a competent - SICS programmer. Otherwise you might be copying a SICS server in an - instable experimental state! +Sometimes the SerPortServer program hangs and inhibits the communication with + the RS-232 hardware. This can be diagnosed by the following procedure: Find + out at which port either a EL734 motor controller or a E737 counter box + lives. Then type:asyncom localhost 4000 portnumber This yields a + new prompt at which you type ID. If all is well a string identifying + the device will be printed. If not a large stack dump will come up. + The asyncom program can be exited by typing quit. If there is + a problem with the + SerPortServer program type: monit restart SerPortServer in order to + restart it.

      +
      +

      Trouble with Environment Devices

      +

      +The first stop for trouble with temperature or other environment devices + is Markus Zolliker. A common problem is that old environment controllers + have not be deconfigured from the system and still reserve terminal server + ports. Thus take care to deconfigure your old devices when swapping. +

      +

      HELP debugging!!!!

      The SICS server hanging or crashing should not happen. In order to sort such diff --git a/doc/manager/var.htm b/doc/manager/var.htm index a49b245a..8c672607 100644 --- a/doc/manager/var.htm +++ b/doc/manager/var.htm @@ -12,12 +12,6 @@ from the user, which should go into data files. Such information is kept in SICS variables, created with the command VarMake detailed below.

      -Another usage for variables is to control composite movements of instrument -components. For instance for changing the wavelength it is necessary to -drive at least two motors, Theta and TwoTheta. Such behaviour is implemented -with some SICS special variables. Their creation is described below. -

      -

      Variables are also used in order to control the SINQ automatic file name creation scheme for data files. At SINQ, data files are put into a special directory. The actual name consists of a prefix, a sequential number, the @@ -31,19 +25,6 @@ The exact syntax for creating variables looks like this: variable type can be Text, Int or Float. The access parameter defines who may may change the variable. Possible values are: Internal, Manager, User and Spy. -

    12. MakeWaveLength nam mono creates a wavelength variable nam. -The monochromator mono is used for adjustment. -
    13. MakeEnergy nam mono creates a energy variable nam. The -monochromator mono is used for adjustment. -
    14. MakeO2T nam OM 2TM creates an omega 2Theta dummy variable -with name nam for omega 2Theta scans. OM defines an omega motor, 2TM a two -theta motor. -
    15. MakeDataNumber SicsDataNumber filename This command makes a -variable SicsDataNumber available which holds the current sequential data - file number. filename is the complete path to the file were this data -number is stored. This file should never, ever be edited without good -reason, i.e. resetting the sequential number to 0 at the beginning of a -year.

      diff --git a/doc/user/autosms.htm b/doc/user/autosms.htm new file mode 100644 index 00000000..b7a530a1 --- /dev/null +++ b/doc/user/autosms.htm @@ -0,0 +1,31 @@ + + +Automatic SMS Notification + + +

      Automatic SMS Notification

      +

      +On some instruments an automatic notification system is installed which + can be configured to send an SMS when the instrument is stopped. An + instrument is considered stopped when there has been no counting or driving + activity for a configurable amount of time and there is beam at SINQ. This + system can be controlled with the follwoing commands: +

      +
      autosms +
      Shows if the autosms system is enabled or disabled +
      autosms on | off +
      Switches automatic notfications on or off. +
      autosms number [val] +
      Without a parameter, displays the telphone number for the SMS, with a parameter + configures the telephone number. Telephone numbers must be all numbers without + hyphens or anything else. +
      autosms maxidle [val] +
      Without a parameter, queries the idle time before a SMS is sent. With a + parameter sets a new value for the inactivity period which triggers a message. +
      +Please use the configurable settle time with environment controllers such as + temperature controllers in order to avoid false messages while waiting for the + temperature to settle. +

      + + diff --git a/doc/user/sinq.htm b/doc/user/sinq.htm new file mode 100644 index 00000000..ebe79735 --- /dev/null +++ b/doc/user/sinq.htm @@ -0,0 +1,24 @@ + + +The Sinq Module + + +

      The SINQ Module

      +

      +On some instruments a module is installed which listens to the broadcast messages + of the accelerator division. This gives information about the rinag and sinq status. + The following commands are recognized: +

      +
      sinq +
      Prints the last full text ring status message. Please note that this may be + empty for some minutes right after a restart of SICS. +
      sinq beam +
      Returns the current beam on SINQ +
      sinq beamavg +
      Returns the average beam on SINQ as measured the last 5 minutes. +
      sinq ring +
      Returns the acclerator ring current. +
      +

      + + diff --git a/doc/user/system.htm b/doc/user/system.htm index 8afd564b..b260aed6 100644 --- a/doc/user/system.htm +++ b/doc/user/system.htm @@ -72,5 +72,9 @@ when useless data files have been created during tests. As this is critical command in normal user operations, this command requires managers privilege.

      +

      +sicsidle prints the number of seconds since the last invocation of a counting + or driving operation. Used in scripts. +

      diff --git a/hkl.c b/hkl.c index 34df8d0f..d00d7553 100644 --- a/hkl.c +++ b/hkl.c @@ -60,6 +60,8 @@ self->fUB[5], self->fUB[6], self->fUB[7], self->fUB[8]); fprintf(fd,"%s hm %d\n",name, self->iHM); fprintf(fd,"%s scantolerance %f\n", name,self->scanTolerance); + fprintf(fd,"%s nb %d\n", name, self->iNOR); + fprintf(fd,"%s phiom %d\n", name, self->iOMPHI); return 1; } @@ -853,6 +855,27 @@ static int calculateNormalBeamOmega(MATRIX z1, pHKL self, if(self->iNOR == 0) { status = calculateBisecting(z1,self,pCon,fSet, myPsi, iRetry); + /* + * Betrand mode: wrap phi rotation into omega + */ + if(self->iOMPHI > 0) { + if(ABS(fSet[2] - .0) < .1 || ABS(fSet[2] - 180.) < .1){ + fSet[1] -= fSet[3]; + fSet[3] = .0; + if(fSet[1] < 0.){ + fSet[1] += 360.; + } + if(fSet[1] > 360.0){ + fSet[1] -= 360.; + } + } else { + snprintf(pBueffel,511, + "ERROR: for omphi mode chi must be 0 or 180, is %f", + fSet[2]); + SCWrite(pCon,pBueffel,eError); + return 0; + } + } } else if(self->iNOR == 1) { @@ -1333,8 +1356,9 @@ ente: if(strcmp(argv[1],"list") == 0 ) { sprintf(pBueffel, - "lambda = %f Normal Beam = %d Quadrant = %d HM = %d", - self->fLambda, self->iNOR, self->iQuad,self->iHM); + "lambda = %f Normal Beam = %d PHIOM = %d Quadrant = %d HM = %d", + self->fLambda, self->iNOR, self->iOMPHI, + self->iQuad,self->iHM); SCWrite(pCon,pBueffel,eValue); sprintf(pBueffel,"UB = { %f %f %f", self->fUB[0], self->fUB[1],self->fUB[2]); @@ -1547,8 +1571,9 @@ ente: { if(argc < 3) { - SCWrite(pCon,"ERROR: Insufficient number of arguments to HKL nb",eError); - return 0; + snprintf(pBueffel,511,"%s.nb = %d",argv[0],self->iNOR); + SCWrite(pCon,pBueffel,eValue); + return 1; } if(!SCMatchRights(pCon,usUser)) { @@ -1571,6 +1596,29 @@ ente: SCSendOK(pCon); return 1; } +/*------------- phi omega mode (to be removed) */ + else if(strcmp(argv[1],"phiom") == 0) + { + if(argc < 3) + { + snprintf(pBueffel,511,"%s.phiom = %d",argv[0],self->iOMPHI); + SCWrite(pCon,pBueffel,eValue); + return 1; + } + if(!SCMatchRights(pCon,usUser)) + { + return 0; + } + if(!isNumeric(argv[2])) + { + sprintf(pBueffel,"ERROR: %s was not recognized as a number", argv[2]); + SCWrite(pCon,pBueffel,eError); + return 0; + } + self->iOMPHI = atoi(argv[2]); + SCSendOK(pCon); + return 1; + } /*------------- quadrant */ else if(strcmp(argv[1],"quadrant") == 0) { diff --git a/hkl.h b/hkl.h index d5fa6885..5705e6fe 100644 --- a/hkl.h +++ b/hkl.h @@ -28,6 +28,7 @@ /*------------------------------------------------------------------------*/ int SetWavelengthVariable(SConnection *pCon, pHKL self, pSelVar pVar); int SetWavelengthManual(pHKL self, float fVal); + void SetHKLScanTolerance(pHKL self, float value); int SetUB(pHKL self, float fUB[9]); int GetUB(pHKL self, float fUB[9]); int SetNOR(pHKL self, int iNOB); @@ -47,6 +48,6 @@ int HKLAction(SConnection *pCon, SicsInterp *pSics, void *pData, int argc, char *argv[]); - void SetHKLScanTolerance(pHKL self, float fVal); + #endif diff --git a/hkl.i b/hkl.i index 14cbaed0..9665a544 100644 --- a/hkl.i +++ b/hkl.i @@ -15,6 +15,7 @@ int iManual; double fLastHKL[5]; int iNOR; + int iOMPHI; int iQuad; int iHM; pMotor pTheta; diff --git a/hkl.tex b/hkl.tex index 8eb331f4..726141fe 100644 --- a/hkl.tex +++ b/hkl.tex @@ -26,6 +26,7 @@ $\langle$hkldat {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@ int iManual;@\\ \mbox{}\verb@ double fLastHKL[5];@\\ \mbox{}\verb@ int iNOR;@\\ +\mbox{}\verb@ int iOMPHI;@\\ \mbox{}\verb@ int iQuad;@\\ \mbox{}\verb@ int iHM;@\\ \mbox{}\verb@ pMotor pTheta;@\\ @@ -104,6 +105,7 @@ $\langle$hklint {\footnotesize ?}$\rangle\equiv$ \mbox{}\verb@/*------------------------------------------------------------------------*/@\\ \mbox{}\verb@ int SetWavelengthVariable(SConnection *pCon, pHKL self, pSelVar pVar);@\\ \mbox{}\verb@ int SetWavelengthManual(pHKL self, float fVal);@\\ +\mbox{}\verb@ void SetHKLScanTolerance(pHKL self, float value);@\\ \mbox{}\verb@ int SetUB(pHKL self, float fUB[9]);@\\ \mbox{}\verb@ int GetUB(pHKL self, float fUB[9]);@\\ \mbox{}\verb@ int SetNOR(pHKL self, int iNOB);@\\ diff --git a/hkl.w b/hkl.w index 1685e17f..6caf351f 100644 --- a/hkl.w +++ b/hkl.w @@ -21,6 +21,7 @@ The object uses the following object data structure: int iManual; double fLastHKL[5]; int iNOR; + int iOMPHI; int iQuad; int iHM; pMotor pTheta; diff --git a/mcstas/dmc/DataNumber b/mcstas/dmc/DataNumber index c020f0ef..37109d54 100644 --- a/mcstas/dmc/DataNumber +++ b/mcstas/dmc/DataNumber @@ -1,3 +1,3 @@ - 81 + 89 NEVER, EVER modify or delete this file You'll risk eternal damnation and a reincarnation as a cockroach!|n \ No newline at end of file diff --git a/mcstas/dmc/MKMonitor.comp b/mcstas/dmc/MKMonitor.comp index 0b4303b5..d21d3c55 100644 --- a/mcstas/dmc/MKMonitor.comp +++ b/mcstas/dmc/MKMonitor.comp @@ -91,7 +91,7 @@ TRACE p2sum += p*p; currentCount++; if(dumpCount > 0 && currentCount > dumpCount){ - dumpTotal(controlfile,Nsum); + dumpTotal(controlfile,(long)Nsum); currentCount = 0; } SCATTER; diff --git a/mcstas/dmc/vdmccom.tcl b/mcstas/dmc/vdmccom.tcl index 07408040..6c763549 100644 --- a/mcstas/dmc/vdmccom.tcl +++ b/mcstas/dmc/vdmccom.tcl @@ -163,7 +163,7 @@ proc copydmcdata { } { mcreader open $home/dmc.xml mcreader insertmon \ "/$mcversion/DMC_diff/dmc.xml/PSD_sample/values" \ - counter 1 [expr 1./1000] + counter 1 [expr 1./700] mcreader insertmon \ "/$mcversion/DMC_diff/dmc.xml/Det9/det9.dat/values" \ counter 5 @@ -171,7 +171,7 @@ proc copydmcdata { } { if { $hmScale <= 0} { set hmScale 1e9 } else { - set hmScale [expr $hmScale * 1e7] + set hmScale [expr $hmScale * 1e5] } clientput "HM scale = $hmScale" mcreader inserthm \ @@ -188,7 +188,7 @@ mccontrol configure mcstart rundmcoptsim mccontrol configure mccopydata copydmcdata mccontrol configure update 60 mccontrol configure mcmonfile $home/monfile -mccontrol configure monitorscale [expr 1. /1000] +mccontrol configure monitorscale [expr 1. /700] mccontrol configure mcdump mcstasdump #-------------------------------------------------------------------------- # A count command for VDMC diff --git a/mcstas/dmc/vdmcstatus.tcl b/mcstas/dmc/vdmcstatus.tcl index 31d9cfdb..d5c4b54d 100644 --- a/mcstas/dmc/vdmcstatus.tcl +++ b/mcstas/dmc/vdmcstatus.tcl @@ -14,7 +14,7 @@ sicsdatapostfix .hdf sicsdatapostfix setAccess 0 sicsdataprefix powder sicsdataprefix setAccess 0 -starttime 2005-07-08 10:41:56 +starttime 2005-07-19 17:15:54 starttime setAccess 2 comment3 UNKNOWN comment3 setAccess 2 @@ -121,9 +121,9 @@ a1 precision 0.010000 a1 AccessCode 2.000000 a1 movecount 10.000000 banana CountMode monitor -banana preset 2.000000 +banana preset 4000.000000 # Counter counter -counter SetPreset 2000.000000 +counter SetPreset 40000000.000000 counter SetMode Monitor # Motor twothetad twothetad sign 1.000000 diff --git a/tasdrive.c b/tasdrive.c index 27a44723..458f1adc 100644 --- a/tasdrive.c +++ b/tasdrive.c @@ -64,20 +64,23 @@ static int readTASMotAngles(ptasUB self, SConnection *pCon, /* Analyzer */ - status = MotorGetSoftPosition(self->motors[A5],pCon,&val); - if(status == 0){ - return status; + if(self->tasMode != ELASTIC){ + status = MotorGetSoftPosition(self->motors[A5],pCon,&val); + if(status == 0){ + return status; + } + theta = val; + status = MotorGetSoftPosition(self->motors[A6],pCon,&val); + if(status == 0){ + return status; + } + ang->analyzer_two_theta = val; + if(ABS(val/2. - theta) > .1){ + SCWrite(pCon,"WARNING: theta analyzer not half of two theta",eWarning); + } + } else { + ang->analyzer_two_theta = ang->monochromator_two_theta; } - theta = val; - status = MotorGetSoftPosition(self->motors[A6],pCon,&val); - if(status == 0){ - return status; - } - ang->analyzer_two_theta = val; - if(ABS(val/2. - theta) > .1){ - SCWrite(pCon,"WARNING: theta analyzer not half of two theta",eWarning); - } - /* crystal @@ -123,6 +126,9 @@ static float TASGetValue(void *pData, SConnection *pCon){ SCWrite(pCon,"ERROR: out of memory calculating Q-E variables",eError); return -999.99; } + if(self->math->tasMode == ELASTIC){ + self->math->current.kf = self->math->current.ki; + } self->math->mustRecalculate = 0; } val = getTasPar(self->math->current,self->code); @@ -148,6 +154,9 @@ static float TASQMGetValue(void *pData, SConnection *pCon){ SCWrite(pCon,"ERROR: out of memory calculating Q-E variables",eError); return -999.99; } + if(self->math->tasMode == ELASTIC){ + self->math->current.kf = self->math->current.ki; + } self->math->mustRecalculate = 0; } val = getTasPar(self->math->current,self->code); @@ -165,10 +174,16 @@ static int TASCheckLimits(void *pData, float fVal, char *error, int iErrLen){ /*---------------------------------------------------------------------------------*/ static int TASHalt(void *pData){ ptasMot self = (ptasMot)pData; - int i; + int i, length = 12; assert(self); - for(i = 0; i < 12; i++){ + /** + * disregard non existing analyzer motors + */ + if(self->math->tasMode == ELASTIC){ + length = 8; + } + for(i = 0; i < length; i++){ if(self->math->motors[i] != NULL){ self->math->motors[i]->pDrivInt->Halt(self->math->motors[i]); } @@ -233,50 +248,55 @@ static int startMotors(ptasMot self, tasAngles angles, /* analyzer */ - val = self->math->motors[A5]->pDrivInt->GetValue(self->math->motors[A5],pCon); - if(ABS(val - angles.analyzer_two_theta/2.) > MOTPREC){ - status = self->math->motors[A5]->pDrivInt->SetValue(self->math->motors[A5], - pCon, - angles.analyzer_two_theta/2.); - if(status != OKOK){ - return status; - } - } - val = self->math->motors[A6]->pDrivInt->GetValue(self->math->motors[A6],pCon); - if(ABS(val - angles.analyzer_two_theta) > MOTPREC){ - status = self->math->motors[A6]->pDrivInt->SetValue(self->math->motors[A6], - pCon, - angles.analyzer_two_theta); - if(status != OKOK){ - return status; - } - } - if(self->math->motors[ACV] != NULL){ - curve = maCalcVerticalCurvature(self->math->machine.analyzer, - angles.analyzer_two_theta); - val = self->math->motors[ACV]->pDrivInt->GetValue(self->math->motors[ACV],pCon); - if(ABS(val - curve) > MOTPREC){ - status = self->math->motors[ACV]->pDrivInt->SetValue(self->math->motors[ACV], - pCon, - curve); - if(status != OKOK){ - return status; - } - } - } - if(self->math->motors[ACH] != NULL){ - curve = maCalcHorizontalCurvature(self->math->machine.analyzer, - angles.analyzer_two_theta); - val = self->math->motors[ACH]->pDrivInt->GetValue(self->math->motors[ACH],pCon); - if(ABS(val - curve) > MOTPREC){ - status = self->math->motors[ACH]->pDrivInt->SetValue(self->math->motors[ACH], - pCon, - curve); - if(status != OKOK){ - return status; - } - } + if(self->math->tasMode != ELASTIC){ + val = self->math->motors[A5]->pDrivInt->GetValue(self->math->motors[A5], + pCon); + if(ABS(val - angles.analyzer_two_theta/2.) > MOTPREC){ + status = self->math->motors[A5]->pDrivInt->SetValue(self->math->motors[A5], + pCon, + angles.analyzer_two_theta/2.); + if(status != OKOK){ + return status; + } + } + val = self->math->motors[A6]->pDrivInt->GetValue(self->math->motors[A6],pCon); + if(ABS(val - angles.analyzer_two_theta) > MOTPREC){ + status = self->math->motors[A6]->pDrivInt->SetValue(self->math->motors[A6], + pCon, + angles.analyzer_two_theta); + if(status != OKOK){ + return status; + } + } + if(self->math->motors[ACV] != NULL){ + curve = maCalcVerticalCurvature(self->math->machine.analyzer, + angles.analyzer_two_theta); + val = self->math->motors[ACV]->pDrivInt->GetValue(self->math->motors[ACV],pCon); + if(ABS(val - curve) > MOTPREC){ + status = self->math->motors[ACV]->pDrivInt->SetValue(self->math->motors[ACV], + pCon, + curve); + if(status != OKOK){ + return status; + } + } + } + if(self->math->motors[ACH] != NULL){ + curve = maCalcHorizontalCurvature(self->math->machine.analyzer, + angles.analyzer_two_theta); + val = self->math->motors[ACH]->pDrivInt->GetValue(self->math->motors[ACH], + pCon); + if(ABS(val - curve) > MOTPREC){ + status = self->math->motors[ACH]->pDrivInt->SetValue(self->math->motors[ACH], + pCon, + curve); + if(status != OKOK){ + return status; + } + } + } } + if(driveQ == 0){ return OKOK; } @@ -415,12 +435,16 @@ static int calculateAndDrive(ptasMot self, SConnection *pCon){ } /*-----------------------------------------------------------------------------*/ static int checkMotors(ptasMot self, SConnection *pCon){ - int i, status; + int i, status, length = 12; self->math->mustRecalculate = 1; + if(self->math->tasMode == ELASTIC){ + length = 8; + } for(i = 0; i < 12; i++){ if(self->math->motors[i] != NULL){ - status = self->math->motors[i]->pDrivInt->CheckStatus(self->math->motors[i],pCon); + status = self->math->motors[i]->pDrivInt->CheckStatus(self->math->motors[i], + pCon); if(status != HWIdle && status != OKOK){ return status; } diff --git a/tasub.c b/tasub.c index a1419396..6d5241b5 100644 --- a/tasub.c +++ b/tasub.c @@ -67,6 +67,8 @@ static int tasUBSave(void *pData, char *name, FILE *fd){ saveReflections(self,name,fd); if(self->tasMode == KICONST){ fprintf(fd,"%s const ki\n",name); + }else if(self->tasMode == ELASTIC){ + fprintf(fd,"%s const elastic\n",name); } else { fprintf(fd,"%s const kf\n",name); } @@ -175,11 +177,15 @@ static int readTASAngles(ptasUB self, SConnection *pCon, /* Analyzer */ - status = MotorGetSoftPosition(self->motors[A6],pCon,&val); - if(status == 0){ - return status; + if(self->tasMode != ELASTIC){ + status = MotorGetSoftPosition(self->motors[A6],pCon,&val); + if(status == 0){ + return status; + } + ang->analyzer_two_theta = val; + } else { + ang->analyzer_two_theta = ang->monochromator_two_theta; } - ang->analyzer_two_theta = val; /* crystal @@ -526,7 +532,7 @@ static int addReflection(ptasUB self, SicsInterp *pSics, SConnection *pCon, int argc, char *argv[]){ tasReflection r; - int status; + int status, count = 11; char pBueffel[256]; tasAngles angles; Tcl_DString list; @@ -560,7 +566,10 @@ static int addReflection(ptasUB self, SicsInterp *pSics, return 0; } - if(argc >= 11){ + if(self->tasMode == ELASTIC){ + count = 10; + } + if(argc >= count){ status = Tcl_GetDouble(InterpGetTcl(pSics),argv[5],&r.angles.a3); if(status != TCL_OK){ snprintf(pBueffel,255,"ERROR: failed to convert %s to number",argv[5]); @@ -591,14 +600,18 @@ static int addReflection(ptasUB self, SicsInterp *pSics, SCWrite(pCon,pBueffel,eError); return 0; } - r.qe.ki = energyToK(r.qe.ki); - status = Tcl_GetDouble(InterpGetTcl(pSics),argv[10],&r.qe.kf); - if(status != TCL_OK){ - snprintf(pBueffel,255,"ERROR: failed to convert %s to number",argv[10]); - SCWrite(pCon,pBueffel,eError); - return 0; - } - r.qe.kf = energyToK(r.qe.kf); + r.qe.ki = energyToK(r.qe.ki); + if(self->tasMode != ELASTIC){ + status = Tcl_GetDouble(InterpGetTcl(pSics),argv[10],&r.qe.kf); + if(status != TCL_OK){ + snprintf(pBueffel,255,"ERROR: failed to convert %s to number",argv[10]); + SCWrite(pCon,pBueffel,eError); + return 0; + } + r.qe.kf = energyToK(r.qe.kf); + } else { + r.qe.kf = r.qe.ki; + } } else { if(argc > 5){ SCWrite(pCon, @@ -612,6 +625,9 @@ static int addReflection(ptasUB self, SicsInterp *pSics, r.qe.ki = maCalcK(self->machine.monochromator,r.angles.monochromator_two_theta); r.qe.kf = maCalcK(self->machine.analyzer,r.angles.analyzer_two_theta); } + if(self->tasMode == ELASTIC){ + r.qe.kf = r.qe.ki; + } if(ABS(r.qe.ki - r.qe.kf) > .01) { SCWrite(pCon,"WARNING: KI != KF!",eWarning); } @@ -918,10 +934,18 @@ static int calcRefAngles(ptasUB self, SConnection *pCon, char pBueffel[256]; int status; - if(argc < 7){ - SCWrite(pCon,"ERROR: need Qh, Qk, Ql, EI, EF for calculation", - eError); - return 0; + if(self->tasMode == ELASTIC){ + if(argc < 6){ + SCWrite(pCon,"ERROR: need Qh, Qk, Ql, EI for calculation", + eError); + return 0; + } + } else { + if(argc < 7){ + SCWrite(pCon,"ERROR: need Qh, Qk, Ql, EI, EF for calculation", + eError); + return 0; + } } status = Tcl_GetDouble(InterpGetTcl(pSics),argv[2],&q.qh); if(status != TCL_OK){ @@ -947,12 +971,16 @@ static int calcRefAngles(ptasUB self, SConnection *pCon, SCWrite(pCon,pBueffel,eError); return 0; } - status = Tcl_GetDouble(InterpGetTcl(pSics),argv[6],&q.kf); - if(status != TCL_OK){ - snprintf(pBueffel,255,"ERROR: failed to convert %s to number",argv[6]); - SCWrite(pCon,pBueffel,eError); - return 0; - } + if(self->tasMode != ELASTIC){ + status = Tcl_GetDouble(InterpGetTcl(pSics),argv[6],&q.kf); + if(status != TCL_OK){ + snprintf(pBueffel,255,"ERROR: failed to convert %s to number",argv[6]); + SCWrite(pCon,pBueffel,eError); + return 0; + } + } else { + q.kf = q.ki; + } q.ki = energyToK(q.ki); q.kf = energyToK(q.kf); @@ -975,11 +1003,18 @@ static int calcRefAngles(ptasUB self, SConnection *pCon, return 0; break; } - snprintf(pBueffel,255," %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f", - angles.monochromator_two_theta, - angles.a3, angles.sample_two_theta, - angles.sgl, angles.sgu, - angles.analyzer_two_theta); + if(self->tasMode != ELASTIC){ + snprintf(pBueffel,255," %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f", + angles.monochromator_two_theta, + angles.a3, angles.sample_two_theta, + angles.sgl, angles.sgu, + angles.analyzer_two_theta); + } else { + snprintf(pBueffel,255," %8.2f %8.2f %8.2f %8.2f %8.2f", + angles.monochromator_two_theta, + angles.a3, angles.sample_two_theta, + angles.sgl, angles.sgu); + } SCWrite(pCon,pBueffel,eValue); return 1; } @@ -992,10 +1027,18 @@ static int calcQFromAngles(ptasUB self, SConnection *pCon, char pBueffel[256]; int status; - if(argc < 8){ - SCWrite(pCon,"ERROR: need a2, a3, a4, sgu, sgl, a6 for calculation", - eError); - return 0; + if(self->tasMode != ELASTIC){ + if(argc < 8){ + SCWrite(pCon,"ERROR: need a2, a3, a4, sgu, sgl, a6 for calculation", + eError); + return 0; + } + } else { + if(argc < 7){ + SCWrite(pCon,"ERROR: need a2, a3, a4, sgu, sgl for calculation", + eError); + return 0; + } } status = Tcl_GetDouble(InterpGetTcl(pSics),argv[2], &angles.monochromator_two_theta); @@ -1028,11 +1071,15 @@ static int calcQFromAngles(ptasUB self, SConnection *pCon, SCWrite(pCon,pBueffel,eError); return 0; } - status = Tcl_GetDouble(InterpGetTcl(pSics),argv[7],&angles.analyzer_two_theta); - if(status != TCL_OK){ - snprintf(pBueffel,255,"ERROR: failed to convert %s to number",argv[7]); - SCWrite(pCon,pBueffel,eError); - return 0; + if(self->tasMode != ELASTIC){ + status = Tcl_GetDouble(InterpGetTcl(pSics),argv[7],&angles.analyzer_two_theta); + if(status != TCL_OK){ + snprintf(pBueffel,255,"ERROR: failed to convert %s to number",argv[7]); + SCWrite(pCon,pBueffel,eError); + return 0; + } + } else { + angles.analyzer_two_theta = angles.monochromator_two_theta; } status = calcTasQEPosition(&self->machine,angles,&q); switch(status){ @@ -1042,6 +1089,9 @@ static int calcQFromAngles(ptasUB self, SConnection *pCon, break; } + if(self->tasMode == ELASTIC){ + q.kf = q.ki; + } snprintf(pBueffel,255,"%8.4f %8.4f %8.4f %8.4f %8.4f", q.qh, q.qk, @@ -1265,6 +1315,9 @@ static int tasUpdate(SConnection *pCon, ptasUB self){ SCWrite(pCon,"ERROR: out of memory calculating Q-E variables",eError); return 0; } + if(self->tasMode == ELASTIC){ + self->current.kf = self->current.ki; + } self->mustRecalculate = 0; SCSendOK(pCon); return 1; @@ -1369,8 +1422,11 @@ int TasUBWrapper(SConnection *pCon,SicsInterp *pSics, void *pData, self->tasMode = KICONST; } else if(strcmp(argv[2],"kf") == 0){ self->tasMode = KFCONST; + } else if(strcmp(argv[2],"elastic") == 0){ + self->tasMode = ELASTIC; } else { - SCWrite(pCon,"ERROR: unknown triple axis mode, accepted are ki, kf", + SCWrite(pCon, + "ERROR: unknown triple axis mode, accepted are ki, kf, elastic", eError); return 0; } @@ -1379,6 +1435,8 @@ int TasUBWrapper(SConnection *pCon,SicsInterp *pSics, void *pData, } else { if(self->tasMode == KICONST){ snprintf(pBueffel,131,"%s.const = ki",argv[0]); + } else if(self->tasMode == ELASTIC){ + snprintf(pBueffel,131,"%s.const = elastic", argv[0]); } else { snprintf(pBueffel,131,"%s.const = kf",argv[0]); } diff --git a/tasublib.c b/tasublib.c index 783851eb..9ca29a48 100644 --- a/tasublib.c +++ b/tasublib.c @@ -581,20 +581,34 @@ int calcTasPowderPosition(ptasMachine machine, tasAngles angles, void setTasPar(ptasQEPosition qe, int tasMode, int tasVar, double value){ double et; - assert(tasMode == KICONST || tasMode == KFCONST); + assert(tasMode == KICONST || tasMode == KFCONST || tasMode == ELASTIC); switch(tasVar){ case KF: - qe->kf = value; + if(tasMode == ELASTIC){ + qe->kf = qe->ki; + } else { + qe->kf = value; + } break; case EF: - qe->kf = energyToK(value); + if(tasMode == ELASTIC){ + qe->kf = qe->ki; + }else { + qe->kf = energyToK(value); + } break; case KI: qe->ki = value; + if(tasMode == ELASTIC){ + qe->kf = value; + } break; case EI: qe->ki = energyToK(value); + if(tasMode == ELASTIC){ + qe->kf = qe->ki; + } break; case QH: qe->qh = value; @@ -612,6 +626,8 @@ void setTasPar(ptasQEPosition qe, int tasMode, int tasVar, double value){ } else if(tasMode == KFCONST){ et = KtoEnergy(qe->kf) + value; qe->ki = energyToK(et); + }else if(tasMode == ELASTIC){ + qe->kf = qe->ki; } else { assert(0); } diff --git a/tasublib.h b/tasublib.h index 4fad553a..f9755e14 100644 --- a/tasublib.h +++ b/tasublib.h @@ -21,6 +21,10 @@ /*========================== defines for tasMode ====================*/ #define KICONST 1 #define KFCONST 2 +#define ELASTIC 3 +/* + * in elastic mode A5, A5 will be disregarded and ki = kf at all times + */ /*=========================== TAS Variables =========================*/ #define EI 1 #define KI 2