SICS Hardware Configuration
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
initialisation the following parameters:
- hostname The name of the instrument computer.
- port The port number where the serial port server program is
listening for requests. It is usually 4000.
- channel The number of the RS-232 interface on the Macintosh. 0 is
the standard Macintosh modem port, 1 is the standard Macintosh printer port,
2 is the first connector on the interface extension box. This leads to much
confusion which can be healed with a simple rule: If a device is connected
to the Macintosh serial port extension box, then its channel number is the
interface number on the box plus one.
Motors
The following commands are available to install motors into the system:
- Motor name SIM lowlim uplim err speed
- This command creates a simulated
motor with the lower limits lowlim, the upper limit uplim, an ratio of
randomly generated errors err and a driving speed of speed. Use this for
testing and instrument simulation. If err is less then 0, the motor will
not create failures and thus can be used in a instrument simulation server.
- Motor name EL734 host port chan no
- This command creates a stepper motor named name which is controlled through a
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
parameters host, port, chan have the meanings defined above. no is the
number of the motor in the EL734DC motor controller.
- MakePIMotor name c804 pararray
- Creates a motr 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:
- Computer, port, channel
- The standard connection parameters.
- upperlimit, lowerlimit
- The limits for this motor.
- motor
- The number of the motor in the motor controller.
- Motor name pipiezo pararray
- Creates a piezo electric positioning device. Again the controller is a
Physik Instrumente controller. pararray has the same meaning as for the
C804 controller given above.
- Motor name ecb ecbcontroller ecb-number lowerlimit upperlimit
- This creates a motor which is controlled through the Risoe ECB
electronic. The parameters:
- ecbcontroller
- The ECB controller to which this motor is connected to. See below
for more on ECB controllers.
- ecb-number
- Number of the motor in the ECB system.
- lowerlimit
- The lower hardware limit for this motors operation
- upperlimit
- The upper hardware limit for this motors operation
In contrast to normal motors, the ECB motors have quite a number of
hardware parameters which must be configured. The general syntax to
configure them is: motorname parametername value. The following
parameters are available:
- encoder
- 0 if there is no encoder for this motor, 1-3 for the encoder used
for this motor.
- control
- The control bit flag. This falg determines if the motor sets a
control bit in the ECB controller. This control bit can be used to
drive air cushions and the like. If required set to 1, else leave at
0.
- delay
- Delay time to wait after setting a control bit.
- range
- The speed range for the motor: 0 for slow, 1 for fast
- multi
- The ECB controller supports up to 24 motors. In some instances
this is not enough. Then one ECB channel can be multiplexed into
several motors. This flag (),1) determines if this is the case.
- multchan
- The multiplexer channel for a multiplexed motor.
- port
- The ECB port a multiplexed motor is using.
- acceleration
- The speed with which the motor accelerates to its final speed.
- rotation_dir
- Rotation direction of the motor.
- startspeed
- Starting speed of the motor.
- maxspeed
- The maximum speed for this motor.
- auto
- Speed in automatic mode
- manuell
- Speed used when driving the motor through the manual control box.
- offset
- When using an encoder: the offset between the motor zero and the
encoder zero.
- dtolerance
- hardware tolerance of the motor.
- step2dig
- conversion factor from encoder steps to physical values.
- step2deg
- Conversion factor from motor pseudo encoder steps to physical
values.
- backlash
- In order to correct for backlash, Risoe motors always approach a
target position from the same direction. In order to do this the motor
has to overshoot and drive back when driving in the wrong
direction. The parameter backlash determines how much to overshoot.
ECB motors have another quirck: 8 motors in a rack share a power
supply! This has the consequence that only one of the 8 motors can run
at any given time. In SICS this is directed through the anticollider
module described elsewhere.
Counting Devices
- MakeCounter name SIM failrate
- This command creates a simulated single counter
accessible as object name. Failrate is the per centage of invocations
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,
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 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.
- MakeHMControl name counter hm1 hm2 hm3
- At some instruments (for instance TRICS) multiple counters or
histogram memories are controlled by a master counter which watches
over presets and the like. This command installs a virtual counter
which does exactly that. The parameters are:
- name
- The name of the virtual counter in SICS
- counter The name of the master counter
- hm1, hm2, hm3
- Up to three slave counting devices.
Histogram Memory
Due to the large amount of parameters, histogram memories are configured
differently. A histogram memory object is created using a special
creation command. This command is described below. Then a lot of options need to
be configured. The commands used for setting these options and their meanings
are defined in the user documentation because histogram memories
may be reconfigured at runtime. The sequence of configuartion options is
ended with the command hmname init. This last command actually initialises the
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.
As an example the configuration of a SINQHM HM with the name banana will be
shown:
MakeHM banana SINQHM
banana configure HistMode Normal
banana configure OverFlowMode Ceil
banana configure Rank 1
banana configure dim0 400
banana configure BinWidth 4
banana preset 100.
banana CountMode Timer
banana configure HMComputer psds04.psi.ch
banana configure HMPort 2400
banana configure Counter counter
banana init
Velocity Selectors
A velocity selector is configured in a three step process. First a Tcl array
is filled with the necessary configuration options for the actual velocity
selector driver. In a second step the
velocity selector is created with a special command. In a third step the
forbidden regions for the velocity selector are defined. Currently two
drivers for velocity selctors are known: a SIM driver for a simulated
velocity selector and a DORNIER driver for a Dornier velocity selector
hooked to a SINQ serial port setup. The last one needs a parameter array
containing the fields Host, Port, Channel and Timeout. Host, Port and
Channel have the meanings as defined at the very top of this section.
Timeout is the maximum time to wait for responses from the velocity selector.
A large value is required as the dornier velocity selector is very slow.
The second step is performed through the following commands:
- VelocitySelector name tilt-motor SIM
- This command installs a simulated velocity selector with the name name
into the system. tilt-motor is used for driving the tilt angle of the
selector. tilt-motor must exist before this command can be executed
successfully.
- VelocitySelector name tilt-motor DORNIER arrayname
- This command installs a dornier velocity selector into the system. name
and tilt-motor have the same meanings as described above. arrayname is the
Tcl-array with the driver configuration parameters.
As an example the configuration of a dornier velocity selector named
nvs is shown:
set dornen(Host) lnsp25.psi.ch
set dornen(Port) 4000
set dornen(Channel) 6
set dornen(Timeout) 5000
VelocitySelector nvs tilt DORNIER dornen
nvs add -20 28800
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.