Personal tools
You are here: Home P200 Echelle ECHELLE Software User Manual DBSP Scripting
Document Actions

DBSP Scripting

by Marco Bonati last modified 2005-10-17 05:09 PM
Scripting

Since the ArcVIEW servers receive ascii commands, they can be handled using anything that is able to open a socket and send a message.
Any scripting languaje capable of doing this can be used directly (like python or TCL, for example)
However, in order to make it simpler for the scripts, a very simple xecutable is provided, which will open a socket, send a message, wait for the response, and close the socket. This executable can be called as any O.S. call.

The sintax is:

/usr/local/bin/sendsockcmd -h <host> -p <port> [-t <timeout [msecs]>]  <message>

This program will block the response untill it receives a response from the server.
For making it even simpler, some csh wrappers to this executable are provided:

dheblue <command>: sends a command directly to the DHE module on the blue side (SDSU controller)
                                    /*equivals to sendsockcmd -h localhost -p $blue_port "DHE <command>" */

dhered <command>: sends a command directly to the DHE module on the red side (FHH controller)
                                    /*equivals to sendsockcmd -h localhost -p $red_port "DHE <command> " */

TCS <command>: sends a command directly to the Telescope Control System. This csh tries ending it through the blue server, and if it fails (because the blue side is not running, for example) tries doing it throug the red side (both systems are connected to the TCS)
                                    /*equivals to if (sendsockcmd -h localhost -p $blue_port "TCS <command> == ERROR)
                                                                                sendsockcmd -h localhost -p $red_port "TCS <command>         */

Since these csh are on /usr/local/bin, they are visible evrywhere, as any other O.S. command.
For example (on any terminal):

> dheblue get exptime
> 150000 [ms]

> dheblue status
> SDSU Initialization OK state=idle

>dhered status
>EDTP11W Initialization OK state=reading

>TCS LOWLAMP ON
> DONE

These csh scripts can now be called from another simple script, like a csh or CL (iraf scripting).

Besides these wrappers, thereis still another more which allows to send any command, to any module, on either system. If they aresynchronized, then it will receive the responses from both sides. The sintax is

arcsync [system_name] <module> <command>

where,

[system_name] = to which system. It can be DBSPBLUE, DBSPRED, or BROADCAST. If none of these is specified, it will assume blue side if unsynced, or both sides if synced.
<module> = where to send the command. For example, DHE (controller), TCS, etc.
<command> = command to send to that module.

This is equivalent to sendsockcmd -h localhost -p $blue_port [system_name] <module> <command>

For example:

> arcsync DHE get exptime
> DBSPBLUE 150000 [ms]  
                  /*if systems are not sync.*/

>arcsync DHE get exptime
> DBSPBLUE 150000 [ms]
   DBSPRED 21000 [ms] 
                       /*if systems are in sync.*/

> arcsync DBSPRED DHE get exptime
> DBSPRED 21000 [ms]
                        /*if the systems are in sync.*/


For a  list of the available DHE commands (the module most commonly used), see the DHE quick command reference document

Some iraf data acquisition  scripts can be found on  arcview iraf package . For installation instrutions read here.