esrf

Beamline Instrument Software Support
SPEC Macro documentation: [ Macro Index | BCU Home ]

TRANSFOCATOR.MAC
See other macros in category: All
Description:
    transfocator.mac - transfocator control
Documentation:
    DESCRIPTION
    A set of macros to control different type of transfocators. The macros control one transfocator at a time, but allow to show the status of all the configured in the same session vessels.

    SETUP
    The lenses are controlled pneumatically via WAGO output modules. The position is red from WAGO modules, in a different way, depending on the mechanics. The different types are configured as follows:

    Type1: This is the standard ESRF configuration - one control bit to move a lense, two limit switch bits to read the position. We use WAGO output module to insert/extract and WAGO inpit module to read the position. To insert the lense in the beam, the control bit is set to 1, to extracrt it - to 0. The in limit switch bit is 1 and the out limit switch bit is 0 when in or inverse when the lense is out of the beam. The even numbers are the in and the odd numbers are the out bits. One of the lenses is actually a pinhole, which can be inserted/extracted. It is shown when reading the position, but not changed when controlling all the lenses together.
    Type2: The same as type one, only there is no pinhole.
    Type3: Only one WAGO output module with one control/limit switch bit to run the transfocator. The bit is set to 1 to insert and to 0 to extract a lense. The position of the lense is given from the same bit.
    Type4: Two limit switch and two control bits, pinhole. To insert the lense in the beam, the in bit is set to 1 and the out bit it is set to 0 or inverse to extract the lense. The even numbers are the in and the odd numbers are the out bits. The position is given by a WAGO input module. The lense is reported as in the beam when the in limit switch bit is 1 and the out bit is 0, out of the beam in the opposite configuration. An error is reported if both in and out bits have the same value. The even numbers are the in and the odd numbers are the out bits. Type5: The same as type one, only there are two pinholes. Their position has to be specified. When the lenses are in, the two pinholes are taken out. When any or both pinholes are in, all the other lenses are taken out. When all is out, the two pinholes are out as well.


    DEPENDENCIES
    wagocore.mac XML_utils.mac


Macros:
    tfsetup
    Usage: tfsetup <type> <other_parametres>
    Configure the transfocator. The other_parameters depend on the control unit type.

    tfdelete
    Usage: tfdelete [tfname]
    Delete the tfname from the list of the setup transfocators.

    tf_wago_setup
    Usage: tf_wago_setup <nb> <root>
    set up transfocator box for nb lenses, controlled by wago devices with root name root.

    tfhosetup
    Usage: tfhosetup [name filename root label position]
    Set the transfocator name hardware object parameteres: the xml filename; the root path for each lense; the label keyword; the positionkeyword. first control (output) channel.

    tfshow
    Usage: tfshow
    Read transfocator and display all the lenses positions.

    tfselect
    Usage: tfselect [name]
    With no argument displays the available transfocator and shows which is currently selected. Otherwise set the name transfocator as the current one.

    tfstatus
    Usage: tfstatus
    Read transfocator status, display it and show all the lenses positions.

    tfin
    Usage: tfin number
    Put the lense number in the beam. If number=99, put only the pinhole(s) in, all other lenses out.

    tfout
    Usage: tfout number
    Put the lense number out of the beam.

    tfset
    Usage: tfset <status>
    Set current transfocator to desired status.

    tfget
    Usage: tfget
    Print out status of current transfocator

    tfinall
    Usage: tfinall
    Put all the lenses in the beam. Do not touch the pinhole, if any.

    tfoutall
    Usage: tfoutall
    Take all the lenses out of the beam. Do not touch the pinhole, if any.

    tftoggle
    Usage: tftoggle number
    Toggle the position in the beam of lense number.

    tf_getxml
    Usage: tf_getxml
    Get the lenses name and ordinal positions (starting from 1) for the current transfocator from the default hardware object - xml file.

    tf_writexml
    Usage: tf_writexml
    Write the lense names and corresponding ordinal positions (starting from 1) for the current transfocator from the default hardware object - xml file. The information to write is taken from the TF_LENSE arary.

Internal Macros:
    _tfinit
    Usage: _tfinit ()
    Initialise the different control types.

    _tf_get
    Usage: _tf_get ()
    Get the current tranfocator state.

    _tf_wagoget_1posbit
    Usage: _tf_wagoget_1posbit (name)
    Read the wago module(s) for 1 limit switch bit per lense. Return the sum of all the limit switch bits of the name transfocator or the current one if name not specified.

    _tf_wagoget_2posbit
    Usage: _tf_wagoget_2posbit (name)
    Read the wago module(s) for 2 limit switch bits per lense. The even numbers are the in and the odd numbers are the out bits. Return the sum of the limit switch bits as follows:
    1 - in bit 1 and out bit 0;
    0 - in bit 0 and out bit 1;
    1<<nb_of_lenses - in and out bit have the same value
    . If name not specified, the current transfocator is red.

    _tf_set
    Usage: _tf_set (st, name)
    Set the tranfocator name to a status st. If name not specified, the current transfocator is set.

    _tf_read
    Usage: _tf_read ()
    Get the wago transfocator value - summ of all inserted lenses. Return the number of

    _tf_write
    Usage: _tf_write (value, name)
    Set the transfocator to value - summ of all inserted lenses. The even numbers are the in and the odd numbers are the out bits, when there are 2 control bits/lense. Inser the pinhole as well if needed with any other lense.

    _tf_getxml
    Usage: _tf_getxml (ho, tfname, keys_root, keys)
    Get the lense names and corresponding ordinal positions (starting from 1) for the tfname transfocator from the ho hardware object - xml file.

    _tf_writexml
    Usage: _tf_writexml (ho, tfname, keys_root, keys)
    Write the lense names and corresponding ordinal positions (starting from 1) for the tfname transfocator in the ho hardware object - xml file. The information to write is taken from the TF_LENSE arary.

    _tf_lock
    Usage: _tf_lock (name)
    Define a local beamline macro to lock the name transfocators. If name not specified, the current transfocator is checked.

    tf_calc_lense
    Usage: tf_calc_lense (from, name)
    Calculate the lense status from the from parameter, that is:
    from[0]=1 - energy; from[0]=2 - distance; from[0]=3 - beamsize
    from[1] - energy [keV]/distance [m]/vertical beam size [mm]
    from[2] - horizontal beam size. If name not specified, the current transfocator is used. Return the lense status to be set if OK, -1 if error.

    tf_calc_energy
    Usage: tf_calc_energy (status, name)
    Calculate the energy from the lense status. If name not specified, the current transfocator is used. Return the energy [keV] if OK, -1 in case of error.

    tf_calc_beamsize
    Usage: tf_calc_beamsize (status, name)
    Calculate the beam size from the lense status. If name not specified, the current transfocator is used. Return the beam size [mm] - vertical, horizontal if OK, -1 in case of error.

    tf_calc_distance
    Usage: tf_calc_distance (status, name)
    Calculate the distance from the lense status. If name not specified, the current transfocator is used. Return the distance [m] if OK, -1 in case of error.

    tf_local_macrodefs
    Usage: tf_local_macrodefs ()
    DEfine, if not already the case, the local macros, used as hooks.

Filename: transfocator.mac
Author: A.Beteva, BLISS
$Revision: 1.6 $, $Date: 2013/06/04 15:08:19 $
Last mod.: 02/12/2016 11:27 by guilloud