4mRC Virtual Smart Motor Controller

Contents:

  1. Architecture
  2. Arcon/Iraf API
  3. VSMC

(Rev 1.0 Mar2001)

1. Architecture

The Arcon software run its high level tasks under the IRAF environment. IRAF provides the user with a command line interface from which to launch the various tasks that actually make things happen.

Making things happen involves not only setting up the CCD controller to take exposures but also preparing all the peripheral devices that take part in the observation. To communicate with all those devices, the Arcon software provides an API based on the Cerro Tololo SMC communication protocol. This is a simple protocol that defines the way two machines must send and acknowledge commands over a communication line. In this architecture one machine acts like a master sending ascii commands while the other plays the slave listening and returning back a report immediately after the command arrives (that is without waiting for command completion).

Every time Arcon wants to command a remote device to do something it opens a communication port and then send the command to the device controller waiting for the task to finish by polling for device status. Then Arcon close the communication port. Unfortunately Arcon API supports only one opened communication port at a time. Which means that unless the controllers were in some bus (e.g. 485 serial bus), Arcon in general supports one controller at a time.

To overcome the limitation on the number of devices that Arcon support  and have access to multiple device controllers at the same time (including the RC-Spectrograph controller itself) the RC-Spectrograph Arcon setup launches a TCL/TK program called VSMC (virtual SMC) that emulates a classic SMC and that communicates through the GWC router with other remote device controllers. The picture below illustrates this architecture.

The Arcon task open a client connection to the VSMC program and send a string command that the VSMC  routes through the GWC router to the different GWC clients (RC-Spectrograph Control Program, TCS Router, Hydra Control Program). The result of the operation is then sent back to the Arcon task. In such a way Arcon is now capable of communicating with many devices and still appear to have a single SMC to talk to.

2. Arcon/Iraf API

The Arcon API to talk to the VSMC (and to talk to any other SMC) lives in /xp/iraf/arcon/lib/motors/Drivers. It consists of several files that implement the SMC communication protocol over different communication channels. The current incarnation of the API includes support for communication through serial ports, TCL/DP channels, TCP sockets and RPC.

Selection of protocol is made by setting the "protocol" environment variable in the instrument_taks.cl file specific to each instrument. For the RC-Spectrograph the instrument_tasks.cl file lives at /xp/iraf/arcon/hardware/ctio/instruments/cs4m and the environment variable is called "lsi_protocol". This variable has to be set to "tcldp" to talk with the virtual SMC. The "lsi_host" variable must be set to the machine in which the VSMC program is running and the "lsi_port" variable has to be set to the port in which the VSMC is listening for connections that is port 2002.

3. VSMC

3.1 VSMC Source Code

The VSMC software code lives at /xp/source/sun/vsmc. The structure of the directory tree is as follows:

    vsmc
        bin
        doc
        lib
            bitmaps
            vsmc
        share
            include
            lib
        src
            api
            gwcwish

The VSMC software consist of an extended TCL/TK interpreter plus a set of TCL/TK scripts that build the functionality required by the application. The extended TCL/TK interpreter lives at sub directory "src/gwcwish". Support is provided for compiling the interpreter under Linux, SunOs and Solaris. The TCL/TK scripts live at sub directory lib/vsmc.

3.2 Starting the Program

Usually the VSMC program will automatically start as part of the RC-Spectrograph setup done by the "SetFiles -a" command. The SetFiles command allows to choose the instrument in use which in turn makes Arcon execute the specific instrument_init.cl script for that instrument to launch the VSMC program. Still it is possible to launch the program manually by typing "start_vsmc" in the Iraf command line. Arcon is also in charge of shutting the program down when Arcon is closed or restarted.

The startup script will search the /xp/source/sun/vsmc/bin directory for file "vsmcrc" to set the environment before running. If not found it will look for the default version of that file at the user home directory. Following is the vsmcrc file that actually lives at /xp/source/sun/vsmc/bin

---------------------------------------------------------------
# Environment variables

# Source the mosaic environment
source /usr/local/gwc/config/mosaic.env

# Environment variable for the VSMC home directory
setenv GCLIENT_HOME /xp/source/sun/vsmc

# Home directory of the TCL/TK library
setenv TCL_LIBRARY $GCLIENT_HOME/share/lib/tcl8.0
setenv TK_LIBRARY  $GCLIENT_HOME/share/lib/tk8.0
setenv TIX_LIBRARY  $GCLIENT_HOME/share/lib/tix4.1
setenv DP_LIBRARY  $GCLIENT_HOME/share/lib/dp4.0

# The MPG_ROUTER variable designates the name of the host in which
# the router run. When not defined the the mpg router is supposed
# to be running in indus.tuc.noao.edu.
# Here commented out to use the definition in mosaic.env
#setenv  MPG_ROUTER ctioa1

# The variable MPG_ROUTER_PORT designates the port in which the mpg
# router is listening for incoming connections. The default value
# for this variable is 1 plus the the wiyn router port (2345).
# Here commented out to use the definition in mosaic.env
#setenv  MPG_ROUTER_PORT 2347

# This tell the program where to find the binaries and configurations file.
setenv GCLIENT_BIN $GCLIENT_HOME/bin
setenv GCLIENT_LIB $GCLIENT_HOME/lib

# Make sure that guidebin is in the search path
set path = ( $GCLIENT_BIN $path )

# Make sure we have the right man path
if ($?MANPATH) then
  setenv MANPATH {$MANPATH}:$GCLIENT_HOME/man
else
  setenv MANPATH {/usr/man}:$GCLIENT_HOME/man
endif

# Uncomment this line if running in SunOs environment
setenv LD_LIBRARY_PATH /usr/lib:/usr/local/X11R5/lib:/usr/openwin/lib
---------------------------------------------------------------

3.3 VSMC Graphic Interface

The graphic user interface of the  VSMC program allows the user to check for resent requests and their result as well as for the current status of the communication link to the GWC router.

When the application starts it opens a connection to the GWC router. Then it publish some GWC command variables. Incoming Arcon request are logged into the logging panel along with a time stamp and a correlative number.

3.3.1 Menu Bar

The menu bar has three menus: Options, Windows and Help.

3.3.1.1 Options Menu

Use the options menu to activate/deactivate the alarm bell and to quit the application. When selected the alarm bell flag activates an audible tone to signal that the communication link to the GWC router is broken.

3.3.1.2 Windows Menu

Use the windows menu to pop up the console window and the comparison lamps interface.

a) Console window

Use the console window to type string commands to control the RC-Spectrograph, the comparison lamps and the rotator mirror. The only command available is rcspec. The available subcommands and arguments are listed below.

    rcspec all

return the current status of the RC-Spectrograph plus other devices. The order of the fields is as follows: complamp, rotator mirror, comparison lens, slit width, decker, grating tilt, collimator focus, upper filter position, lower filter position, mask position, sky suppresser position, rear slit viewer

    rcspec colfocus [move|position|status|stop] value

Interface to the collimator focus mechanism.

    rcspec clamp move [on|off]

Turn the old comparison lamps on or off.

    rcspec complamp [move [etalon|tha|qua|hene|pen|off|park] | position | status | stop]

Command interface to the hydra comparison lamps system.

    rcspec complens [move|position|status|stop] value

Command interface to the comparison lens mechanism.

    rcspec lfilter [move|position|status|stop] value

Command interface to the lower filter.

    rcspec mask [move|position|status|stop] value

Command interface to the newall mask mechanism.

    rcspec rotatormirror [move|position|status|stop] value

Command interface to the rotator mirror.

    rcspec slitwidth [move|position|status|stop] value

Command interface to the slit width mechanism.

    rcspec tilt [move|position|status|stop] value

Command interface to the grating tilt mechanism.

    rcspec ufilter [move|position|status|stop] value

Command interface to the upper filter mechanism.

b) Hydra Comparison Lamps Interface

The lamps window allows the user to turn the comparison lamps system on/off and to select the comparison lamps sources.

When no motion is sensed, the status labels are blue and white. When a mechanism is active or moving the status labels blink  and the background color goes yellow to reflect the new status. If no status information is available or an error condition is sensed the status labels blink and the background goes red.

3.3.2 Logging Panel

The logging area shows all the incoming requests to the VSMC and the exceptions that have occurred during the session. All messages are prefixed with a time stamp and a correlative number. Use the scroll bar to move across the log messages.

3.3.3 Status Bar

The status bar presents the current status of the communication link to the GWC router. When the link is broken the status label will go red and will start  blinking signaling that the communication has been lost. After that, the program will start a reconnection sequence trying to connect every ten seconds to the GWC router.

3.4 Trouble shooting

"ERROR: generic client can't connect to GWC ROUTER..." - Check that the GWC router is actually running on its host machine.
If its running check that the machine in which the VSMC is running is an enabled machine. Check the /usr/local/gwc/config/routersetup.tcl file for your machine name. If not present add the name using the rest of the file as a template.
Check also that the environment variables MPG_ROUTER and MPG_ROUTER_PORT are set to the proper values in the vsmcrc file.

"WARNING: generic client not connected to GWC ROUTER..." - This warning message appears to warn the user he chose not to
connect to the GWC router.

"ERROR: illegal command: rcspec ..." - You type an unknown command. Check the list of legal commands above in this document.

Last Updated:   March 5, 2001
rcantaruttiATnoao.edu

Updated on April 16, 2024, 9:29 am