next up previous contents 5
Next: Installing the detector simulator Up: Installation Previous: Installing and configuring the   Contents


Installing DHS

A DHS can be any program that can speak the DCS protocol and is able to talk to a piece of hardware or another control system. It can be thought of as a protocol translator.

SSRL currently uses a DHS program which can talk to DMC2180 motion controllers and Q4, Q315, and MAR345 detectors. This program requires that a functional mysql database is available so that it can obtain its configuration at start-up.

  1. Install the mysql client libraries .

  2. Install the xos library .

  3. Checkout dhs from CVS into the /usr/local/dcs directory.

    blctlxx:/usr/local/dcs > cvs checkout dhs
    cvs checkout: Updating dhs
    cvs checkout: Updating dhs/decunix
    U dhs/decunix/dhs
    U dhs/decunix/makefile
    cvs checkout: Updating dhs/galil_scripts
    U dhs/galil_scripts/script3.txt
    U dhs/galil_scripts/script_05jul00.txt
    U dhs/galil_scripts/script_dose.txt
    cvs checkout: Updating dhs/irix
    U dhs/irix/makefile
    cvs checkout: Updating dhs/linux
    U dhs/linux/dhs
    U dhs/linux/makefile
    cvs checkout: Updating dhs/src
    U dhs/src/async.h
    U dhs/src/dcs.h
    U dhs/src/dhsMar345.cc
    U dhs/src/dhs_Camera.cc
    U dhs/src/dhs_Camera.h
    U dhs/src/dhs_Quantum315.cc
    U dhs/src/dhs_Quantum315.h
    U dhs/src/dhs_Quantum4.cc
    U dhs/src/dhs_Quantum4.h
    U dhs/src/dhs_async2100.cc
    U dhs/src/dhs_config.cc
    U dhs/src/dhs_config.h
    U dhs/src/dhs_database.cc
    U dhs/src/dhs_database.h
    U dhs/src/dhs_dcs_messages.cc
    U dhs/src/dhs_dcs_messages.h
    U dhs/src/dhs_detector.h
    U dhs/src/dhs_dmc1000.h
    U dhs/src/dhs_dmc2180.cc
    U dhs/src/dhs_dmc2180.h
    U dhs/src/dhs_main.cc
    U dhs/src/dhs_messages.h
    U dhs/src/dhs_monitor.cc
    U dhs/src/dhs_monitor.h
    U dhs/src/dhs_motor_messages.cc
    U dhs/src/dhs_motor_messages.h
    U dhs/src/dhs_network.cc
    U dhs/src/dhs_network.h
    U dhs/src/dhs_threads.cc
    U dhs/src/dhs_threads.h
    U dhs/src/imgCentering.cc
    U dhs/src/imgCentering.h
    U dhs/src/libimage.c
    U dhs/src/libimage.h
    U dhs/src/safeFile.cc
    U dhs/src/safeFile.h
    U dhs/src/xformstub.c
    U dhs/src/xformstub.h
    U dhs/src/xos_database.cc
    U dhs/src/xos_database.hh
    

  4. Install the the Q4 image transformation files. The files contain some algorithms and code which Area Detector Systems Corporation does not wish to have distributed without prior permission. Stub files are provided by SSRL for building the software if you do not have access to this separate project.

    If you do not have access to this project, the xformstub.c and xformstub.h can be used to easily build the DHS.

  5. Install the third party dali library or remove references to -DWITH_CAMERA_SUPPORT and DALIIMAGE_LIBS from the makefile if you do not need support for image analysis for crystal centering.

    blctlxx:/usr/local/dcs > ls -R dali
    dali:
    include  lib
    
    dali/include:
    bitparser.h  dvmbasic.h~    dvmimap.h    dvmpnm.h     tclDvmAmap.h      tclDvmColor.h    tclDvmJpeg.h    tclDvmVision.h
    dvmamap.h    dvmbytegeom.h  dvmjpeg.h    dvmvision.h  tclDvmAvi.h       tclDvmDisplay.h  tclDvmKernel.h  tclDvmWave.h
    dvmavi.h     dvmcolor.h     dvmkernel.h  dvmwave.h    tclDvmBasic.h     tclDvmGif.h      tclDvmMpeg.h
    dvmbasic.h   dvmgif.h       dvmmpeg.h    macro.h      tclDvmByteGeom.h  tclDvmImap.h     tclDvmPnm.h
    
    dali/lib:
    libdvmamap.a      libdvmcolor.a  libdvmjpeg.a    libdvmpnm.a     tclDvmAmap.so      tclDvmColor.so  tclDvmJpeg.so    tclDvmPnm.so
    libdvmbasic.a     libdvmgif.a    libdvmkernel.a  libdvmvision.a  tclDvmBasic.so     tclDvmGif.so    tclDvmKernel.so  tclDvmVision.so
    libdvmbytegeom.a  libdvmimap.a   libdvmmpeg.a    libdvmwave.a    tclDvmByteGeom.so  tclDvmImap.so   tclDvmMpeg.so    tclDvmWave.so
    

  6. cd into the linux, decunix, or irix build directory.

  7. Build the DHS binary.

    blctlxx:/usr/local/dcs/dhs/linux > make
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/dhs_main.cc
    cc -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../../xform/xform.c
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/dhs_network.cc
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/dhs_monitor.cc
    ../src/dhs_monitor.cc: In function `void 
    *dhs_device_polling_thread_routine (void *)':
    ../src/dhs_monitor.cc:99: warning: comparison between `enum 
    xos_result_t' and `enum xos_wait_result_t'
    ../src/dhs_monitor.cc: In function `void *dhs_watchdog_thread_routine 
    (void *)':
    ../src/dhs_monitor.cc:155: warning: no return statement in function 
    returning non-void
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/dhs_database.cc
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/dhs_dcs_messages.cc
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/dhs_motor_messages.cc
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx -I../../xform/ ../src/dhs_Quantum4.cc
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx -I../../xform/ ../src/dhs_Quantum315.cc
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/libimage.c
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/dhs_config.cc
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/dhs_threads.cc
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/dhs_async2100.cc
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/dhs_dmc2180.cc
    In file included from ../src/dhs_dmc2180.cc:50:
    ../src/dhs_dmc2180.h: In method `xos_result_t Dmc2180::get_response 
    (char *, int *, int)':
    ../src/dhs_dmc2180.h:644: warning: comparison between `enum 
    xos_wait_result_t' and `enum xos_result_t'
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/xos_database.cc
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx -I../../xform ../src/dhsMar345.cc
    ../src/dhsMar345.cc: In function `xos_result_t handle_message_file 
    (message_file_commands_t)':
    ../src/dhsMar345.cc:1214: warning: NULL used in arithmetic
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/safeFile.cc
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/dhs_Camera.cc
    g++ -c -pthread -DLINUX -Ddatabase_mysql -DWITH_CAMERA_SUPPORT -I../../xos/src/ -I/usr/include/mysql -I../../auth/src -I../../dali/include  -I/usr/include/cxx ../src/imgCentering.cc
    g++ -o dhs -pthread -lz dhs_main.o xform.o dhs_network.o dhs_monitor.o dhs_database.o dhs_dcs_messages.o dhs_motor_messages.o dhs_Quantum4.o dhs_Quantum315.o libimage.o dhs_config.o dhs_threads.o dhs_async2100.o dhs_dmc2180.o xos_database.o dhsMar345.o safeFile.o dhs_Camera.o imgCentering.o /usr/lib/mysql/libmysqlclient.a ../../xos/linux/xos.a ../../auth/linux/auth.a  -lpthread -lc -lm -lrt -L../../dali/lib -ldvmjpeg -ldvmpnm -ldvmcolor -ldvmvision -ldvmbasic
    

  8. ADD permissions to the mysql database for the new computer.

    mysql> grant select on * to dhs@blctlxx.slac.stanford.edu;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.42 sec)
    

  9. Find out which beam line the DHS is going to be a part of. Use this number in the following step when entering the information for the BeamlineID.

    mysql> select * from DCSS where BeamlineID=12;
    +----+---------------------------+---------------+---------------+------------+----------+
    | id | HostName                  | ListeningPort | MemoryMapFile | BeamlineID | beamline |
    +----+---------------------------+---------------+---------------+------------+----------+
    | 12 | blctlxx.slac.stanford.edu |         14242 | database.dat  |         12 | bl-xx    |
    +----+---------------------------+---------------+---------------+------------+----------+
    1 row in set (0.02 sec)
    

  10. Insert an entry in the mysql DHS table and use the id in the next step. The HostName entry in this step is the name of the computer that the DHS will run on (not DCSS).

    mysql> select * from DHS where BeamlineID=12;
    +----+---------------------------+-------------+------------+-----------------------+-----------------+------------------+--------------------+--------------+
    | id | HostName                  | privateNode | BeamlineID | LocalDatabaseFileName | AutoFlushPeriod | DevicePollPeriod | WatchdogKickPeriod |  |
    +----+---------------------------+-------------+------------+-----------------------+-----------------+------------------+--------------------+--------------+
    | 32 | blctlxx.slac.stanford.edu |             |         12 | blxxDetector.dat      |            5000 |             5000 |                500 | detector     |
    +----+---------------------------+-------------+------------+-----------------------+-----------------+------------------+--------------------+--------------+
    1 row in set (0.00 sec)
    

  11. Add as many entries in the Controllers table as the number of new devices that this DHS is responsible for.

    If the DHS is responsible for only one device the table may look like this:

    mysql> select * from Controllers where DHS_ID=32;
    +----+--------+
    | id | DHS_ID |
    +----+--------+
    | 35 |     32 |
    +----+--------+
    1 row in set (0.00 sec)
    

    If the DHS is responsible for more than one devices, the table may look like this:

    mysql> select * from Controllers where DHS_ID = 32;
    +----+--------+
    | id | DHS_ID |
    +----+--------+
    | 35 |     32 |
    | 36 |     32 |
    | 37 |     32 |
    +----+--------+
    24 rows in set (0.00 sec)
    

  12. Find the table representing the new hardware component. For example, if you are installing a new CCD (or emulated CCD), you would want to add an entry to the CCD table. Add all of the relevant facts about the hardware component in this table.

    mysql> select * from CCD where ControllerID=35;
    +----+--------------+--------------------------+-------------+----------+-------+--------------------+-----------------+----------------------+--------------+-------------+-------------+-----------------------+-----------------------+--------------------------+--------------------------+--------------------+--------------------+-----------------------+-----------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------------+----------------+------------+
    | id | serialNumber | HostName                 | CommandPort | DataPort | Chips | DarkImageDirectory | DarkRefreshTime | CalibrationDirectory | ControllerID | BeamCenterX | BeamCenterY | NonUniformitySlowFile | NonUniformityFastFile | NonUniformitySlowBinFile | NonUniformityFastBinFile | DistortionSlowFile | DistortionFastFile | DistortionSlowBinFile | DistortionFastBinFile | PostNonUniformitySlowFile | PostNonUniformityFastFile | PostNonUniformitySlowBinFile | PostNonUniformityFastBinFile | darkExposureTolerance | writeRawImages | j5_trigger |
    +----+--------------+--------------------------+-------------+----------+-------+--------------------+-----------------+----------------------+--------------+-------------+-------------+-----------------------+-----------------------+--------------------------+--------------------------+--------------------+--------------------+-----------------------+-----------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------------+----------------+------------+
    |  9 | 0            | blcpu3.slac.stanford.edu |        8041 |     8042 |     1 | ./darkimages/      |            7200 | ./                   |           35 |     94.0000 |     94.0000 | NONUNF                | NONUNF                | NONUNF                   | NONUNF                   | CALFIL             | CALFIL             | CALFIL                | CALFIL                | POSTNUF                   | POSTNUF                   | POSTNUF                      | POSTNUF                      |                  0.10 | N              | N          |
    +----+--------------+--------------------------+-------------+----------+-------+--------------------+-----------------+----------------------+--------------+-------------+-------------+-----------------------+-----------------------+--------------------------+--------------------------+--------------------+--------------------+-----------------------+-----------------------+---------------------------+---------------------------+------------------------------+------------------------------+-----------------------+----------------+------------+
    1 row in set (0.00 sec)
    

  13. Change your database.dat file to expect the connection from the new DHS by making a DHS entry as discussed in The DHS definition.

  14. Start the DHS from /usr/local/dcs/dhs/linux directory.

    blctlxx:/usr/local/dcs/dhs/linux > ./dhs instanceName

    where detectorInstance corresponds to the InstanceName in the DHS table in the mysql database.


next up previous contents 5
Next: Installing the detector simulator Up: Installation Previous: Installing and configuring the   Contents
Scott McPhillips 2002-10-10