anka

RST Gamma interface as used at ANKA

DESCRIPTION

The ANKA Synchrotron at the Forschungzentrum in Karlsruhe, Germany sponsored the adaptation of industrial control software to beamline control. The software product is called Gamma and is provided by RST Industrie Automation GmbH. The Gamma software runs on an OS/9 operating system in a VME crate and works using peer-to-peer connections. spec uses TCP/IP sockets over ethernet to communicate with the Gamma software and supports motors and counter/timers over this interface. spec also provides general access to Gamma variables through the new built-in user-level functions anka_get(), anka_put() and anka_par().

CONFIGURATION

Several connection parameters need to be specified that describe the Gamma peer-to-peer connection. The most important are the remote-host name, the remote-host Gamma node number and the local-host Gamma node number. These parameters are available to read or modify with the spec_par() facility using the names anka_remote_host, anka_remote_node and anka_local_node. The parameters can also be read from the config file using the SPEC_PAR: directive, as in:

SPEC_PAR: anka_remote_host = the.host.name
SPEC_PAR: anka_remote_node = 123
SPEC_PAR: anka_local_node = 456

Currently, SPEC_PAR: parameters must be manually added to the config file.

The special functions below will only be available when the ANKA hardware is configured or the above parameters are set.

The default TCP/IP port for the Gamma peer-to-peer connections is port 3500, although the local and remote ports can be reconfigured with the anka_par() function as described below.

Since only one process at a time can bind to a particular port number, spec can only connect to one Gamma system at a time with the same port number.

If the connection parameters are changed, either a reconfig or the command anka_par("reconnect") is needed to close the old connection and open a new one.

FUNCTIONS

anka_get(node, index1, index2 [, type])
Reads the data value described by the Gamma parameters node, index1 and index2 (LNR in Gamma lingo). The default data type is "long" (or SINT in Gamma lingo). Other data types can be retrieved as specified by the optional fourth argument, which can be one of the strings "byte", "ubyte", "short", "ushort", "long", "ulong", "float", "double" or "string".
anka_put(node, index1, index2, value [, type])
Sets the data value described by the Gamma parameters node, index1 and index2 (LNR in Gamma lingo) to value. The default data type is "long". Other data types can be sent as specified by the optional fourth argument, as listed above.
anka_par(name [, value])

Controls selected operational parameters according to the string name as follows:

"local_port"
Sets or retrieves the port number on which spec listens for connections from the remote Gamma peer. The default is 3500.
"remote_port"
Sets or retrieves the port number on which spec uses to connect to the remote Gamma peer. The default is 3500.
"new_driver"
If set, indicates a newer version of the Gamma software is running. The default is for the mode to be set.
"reconnect"
Closes the sockets associated with the current connection to the Gamma software, and attempts to reconnect using the current connection parameters.

The parameters are saved in the user's state file, so are retained between invocations of spec, but must be reset when starting fresh.

USING ANKA MOTORS

The ANKA RST Gamma motors are configured in the standard way. Choose

ANKA RST Gamma Motor Controller

as the motor controller type on the Devices screen of the configuration editor, and select controller type ANKA for the individual motor channels.

With respect to homing, the Gamma interface provides six home commands, which involve writing the values 0, 1, -10, -11, -20 or -21 to line number 30 of the Gamma data area for a particular motor. The first four values correspond to the standard spec search commands (as arguments to chg_dial()) "lim-", "lim+", "home+" and "home-", respectively. The -20 value corresponds to a sequence of 0 and -10, while -21 corresponds to 1 and -11. To accommodate these sequence searches within the existing spec structure, one can associate a particular Gamma home command with a particular motor for use with the default "home" search argument to chg_dial(). The association is done by entering the Gamma home value as "Generic parameter 1" on the second optional motor parameter screen of the configuration editor. (Get there by typing m twice from the standard motor parameter screen.)

In addition, the setting for the home position that is written to line number 29 of the Gamma data area can be saved as "Generic parameter 2" in the config file. The units are steps. The parameter value is copied, as is, to line number 29. If the chg_dial() function is invoked with a third argument, the value of that argument will override the value for the home position in the config file. The units for chg_dial(), home-position optional third argument are dial units.

DEBUGGING

Debug level 128 (0x80) displays the internal anka_get() and anka_put() commands generated by the built-in C code for the motor and counter commands sent to the Gamma software. Debug level 0x8000 displays information about each packet sent and received between spec and the Gamma software. Debug level 64 (0x40) displays the raw contents of the messages transmitted in the socket connections. If the debug level includes bit 0x400000, the contents will be displayed in aligned hexadecimal columns, rather than the default printable/escaped ASCII.